Merge
authorduke
Wed, 05 Jul 2017 19:21:26 +0200
changeset 21507 624a61211dd7
parent 21506 115e1128ce1a (current diff)
parent 21474 4d9ae2ec8ba6 (diff)
child 21508 3dd9732b1703
Merge
jdk/src/share/classes/java/lang/invoke/MagicLambdaImpl.java
jdk/src/share/demo/jfc/Notepad/resources/Notepad_fr.properties
jdk/src/share/demo/jfc/Notepad/resources/Notepad_sv.properties
jdk/test/java/net/NetworkInterface/MemLeakTest.java
jdk/test/jdk/lambda/vm/DefaultMethodsTest.java
jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.sh
jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.sh
jdk/test/sun/tools/jstatd/jpsOutput1.awk
jdk/test/sun/tools/jstatd/jstatGcutilOutput1.awk
jdk/test/sun/tools/jstatd/jstatdDefaults.sh
jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh
jdk/test/sun/tools/jstatd/jstatdPort.sh
jdk/test/sun/tools/jstatd/jstatdServerName.sh
jdk/test/sun/tools/jstatd/jstatdUsage1.sh
jdk/test/sun/tools/jstatd/usage.out
nashorn/src/jdk/nashorn/internal/runtime/ScriptObjectListAdapter.java
--- a/.hgtags-top-repo	Thu Oct 31 16:46:43 2013 -0700
+++ b/.hgtags-top-repo	Wed Jul 05 19:21:26 2017 +0200
@@ -235,3 +235,4 @@
 d086227bfc45d124f09b3bd72a07956b4073bf71 jdk8-b111
 547316ea137d83d9c63083a9b83db64198fe0c81 jdk8-b112
 6ba4c7cb623ec612031e05cf8bf279d8f407bd1e jdk8-b113
+4f2011496393a26dcfd7b1f7787a3673ddd32599 jdk8-b114
--- a/common/autoconf/basics.m4	Thu Oct 31 16:46:43 2013 -0700
+++ b/common/autoconf/basics.m4	Wed Jul 05 19:21:26 2017 +0200
@@ -514,7 +514,7 @@
     if test "x$IS_GNU_MAKE" = x; then
       AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.])
     else
-      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[[12]]\)\|\(4\.\)'`
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[[12]]' -e '4\.'`
       if test "x$IS_MODERN_MAKE" = x; then
         AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.])
       else
--- a/common/autoconf/generated-configure.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/common/autoconf/generated-configure.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -3865,7 +3865,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1382702260
+DATE_WHEN_GENERATED=1383151988
 
 ###############################################################################
 #
@@ -8323,7 +8323,7 @@
       { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
     else
-      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
       if test "x$IS_MODERN_MAKE" = x; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@@ -8680,7 +8680,7 @@
       { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
     else
-      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
       if test "x$IS_MODERN_MAKE" = x; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@@ -9034,7 +9034,7 @@
       { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
     else
-      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
       if test "x$IS_MODERN_MAKE" = x; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@@ -9393,7 +9393,7 @@
       { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
     else
-      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
       if test "x$IS_MODERN_MAKE" = x; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@@ -9746,7 +9746,7 @@
       { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
 $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
     else
-      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
+      IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
       if test "x$IS_MODERN_MAKE" = x; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
 $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
--- a/corba/.hgtags	Thu Oct 31 16:46:43 2013 -0700
+++ b/corba/.hgtags	Wed Jul 05 19:21:26 2017 +0200
@@ -235,3 +235,4 @@
 85c1c94e723582f9a1dd0251502c42b73d6deea7 jdk8-b111
 43cec76d1d62587a07af07e2d9bec93aba2a506b jdk8-b112
 a259ff3e42d91da68f4d4f09d7eb9dc22bc024fc jdk8-b113
+0bbccf77c23e566170b88b52c2cf28e5d31ce927 jdk8-b114
--- a/corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -580,7 +580,7 @@
             java.lang.Object[] objholder = new java.lang.Object[1];
             objholder[0] = object;
             long[] longholder = new long[1];
-            TCUtility.unmarshalIn(in, typeCode, longholder, objholder);
+            TCUtility.unmarshalIn(in, realType(), longholder, objholder);
             value = longholder[0];
             object = objholder[0];
             stream = null;
--- a/corba/src/share/classes/javax/rmi/CORBA/Stub.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/corba/src/share/classes/javax/rmi/CORBA/Stub.java	Wed Jul 05 19:21:26 2017 +0200
@@ -61,13 +61,11 @@
     private transient StubDelegate stubDelegate = null;
     private static Class stubDelegateClass = null;
     private static final String StubClassKey = "javax.rmi.CORBA.StubClass";
-    private static final String defaultStubImplName = "com.sun.corba.se.impl.javax.rmi.CORBA.StubDelegateImpl";
 
     static {
-        Object stubDelegateInstance = (Object) createDelegateIfSpecified(StubClassKey, defaultStubImplName);
+        Object stubDelegateInstance = createDelegate(StubClassKey);
         if (stubDelegateInstance != null)
             stubDelegateClass = stubDelegateInstance.getClass();
-
     }
 
 
@@ -207,7 +205,7 @@
     // are in different packages and the visibility needs to be package for
     // security reasons. If you know a better solution how to share this code
     // then remove it from PortableRemoteObject. Also in Util.java
-    private static Object createDelegateIfSpecified(String classKey, String defaultClassName) {
+    private static Object createDelegate(String classKey) {
         String className = (String)
             AccessController.doPrivileged(new GetPropertyAction(classKey));
         if (className == null) {
@@ -218,7 +216,7 @@
         }
 
         if (className == null) {
-            className = defaultClassName;
+            return new com.sun.corba.se.impl.javax.rmi.CORBA.StubDelegateImpl();
         }
 
         try {
--- a/corba/src/share/classes/javax/rmi/CORBA/Util.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/corba/src/share/classes/javax/rmi/CORBA/Util.java	Wed Jul 05 19:21:26 2017 +0200
@@ -60,14 +60,11 @@
 public class Util {
 
     // This can only be set at static initialization time (no sync necessary).
-    private static javax.rmi.CORBA.UtilDelegate utilDelegate = null;
+    private static final javax.rmi.CORBA.UtilDelegate utilDelegate;
     private static final String UtilClassKey = "javax.rmi.CORBA.UtilClass";
-    private static final String defaultUtilImplName =
-"com.sun.corba.se.impl.javax.rmi.CORBA.Util";
 
     static {
-        utilDelegate = (javax.rmi.CORBA.UtilDelegate)
-            createDelegateIfSpecified(UtilClassKey, defaultUtilImplName);
+        utilDelegate = (javax.rmi.CORBA.UtilDelegate)createDelegate(UtilClassKey);
     }
 
     private Util(){}
@@ -338,9 +335,7 @@
     // are in different packages and the visibility needs to be package for
     // security reasons. If you know a better solution how to share this code
     // then remove it from PortableRemoteObject. Also in Stub.java
-    private static Object createDelegateIfSpecified(String classKey,
-        String defaultClassName)
-    {
+    private static Object createDelegate(String classKey) {
         String className = (String)
             AccessController.doPrivileged(new GetPropertyAction(classKey));
         if (className == null) {
@@ -351,7 +346,7 @@
         }
 
         if (className == null) {
-            className = defaultClassName;
+            return new com.sun.corba.se.impl.javax.rmi.CORBA.Util();
         }
 
         try {
--- a/corba/src/share/classes/javax/rmi/PortableRemoteObject.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/corba/src/share/classes/javax/rmi/PortableRemoteObject.java	Wed Jul 05 19:21:26 2017 +0200
@@ -65,17 +65,14 @@
  */
 public class PortableRemoteObject {
 
-    private static javax.rmi.CORBA.PortableRemoteObjectDelegate proDelegate = null;
+    private static final javax.rmi.CORBA.PortableRemoteObjectDelegate proDelegate;
 
     private static final String PortableRemoteObjectClassKey =
             "javax.rmi.CORBA.PortableRemoteObjectClass";
 
-    private static final String defaultPortableRemoteObjectImplName =
-            "com.sun.corba.se.impl.javax.rmi.PortableRemoteObject";
-
     static {
         proDelegate = (javax.rmi.CORBA.PortableRemoteObjectDelegate)
-            createDelegateIfSpecified(PortableRemoteObjectClassKey);
+            createDelegate(PortableRemoteObjectClassKey);
     }
 
     /**
@@ -181,7 +178,7 @@
     // are in different packages and the visibility needs to be package for
     // security reasons. If you know a better solution how to share this code
     // then remove it from here.
-    private static Object createDelegateIfSpecified(String classKey) {
+    private static Object createDelegate(String classKey) {
         String className = (String)
             AccessController.doPrivileged(new GetPropertyAction(classKey));
         if (className == null) {
@@ -191,7 +188,7 @@
             }
         }
         if (className == null) {
-                className = defaultPortableRemoteObjectImplName;
+            return new com.sun.corba.se.impl.javax.rmi.PortableRemoteObject();
         }
 
         try {
--- a/corba/src/share/classes/org/omg/CORBA/ORB.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/corba/src/share/classes/org/omg/CORBA/ORB.java	Wed Jul 05 19:21:26 2017 +0200
@@ -174,15 +174,6 @@
     private static final String ORBSingletonClassKey = "org.omg.CORBA.ORBSingletonClass";
 
     //
-    // The last resort fallback ORB implementation classes in case
-    // no ORB implementation class is dynamically configured through
-    // properties or applet parameters. Change these values to
-    // vendor-specific class names.
-    //
-    private static final String defaultORB = "com.sun.corba.se.impl.orb.ORBImpl";
-    private static final String defaultORBSingleton = "com.sun.corba.se.impl.orb.ORBSingleton";
-
-    //
     // The global instance of the singleton ORB implementation which
     // acts as a factory for typecodes for generated Helper classes.
     // TypeCodes should be immutable since they may be shared across
@@ -294,10 +285,11 @@
             String className = getSystemProperty(ORBSingletonClassKey);
             if (className == null)
                 className = getPropertyFromFile(ORBSingletonClassKey);
-            if (className == null)
-                className = defaultORBSingleton;
-
-            singleton = create_impl(className);
+            if (className == null) {
+                singleton = new com.sun.corba.se.impl.orb.ORBSingleton();
+            } else {
+                singleton = create_impl(className);
+            }
         }
         return singleton;
     }
@@ -347,10 +339,12 @@
             className = getSystemProperty(ORBClassKey);
         if (className == null)
             className = getPropertyFromFile(ORBClassKey);
-        if (className == null)
-            className = defaultORB;
+        if (className == null) {
+            orb = new com.sun.corba.se.impl.orb.ORBImpl();
+        } else {
+            orb = create_impl(className);
+        }
 
-        orb = create_impl(className);
         orb.set_parameters(args, props);
         return orb;
     }
@@ -375,10 +369,12 @@
             className = getSystemProperty(ORBClassKey);
         if (className == null)
             className = getPropertyFromFile(ORBClassKey);
-        if (className == null)
-            className = defaultORB;
+        if (className == null) {
+            orb = new com.sun.corba.se.impl.orb.ORBImpl();
+        } else {
+            orb = create_impl(className);
+        }
 
-        orb = create_impl(className);
         orb.set_parameters(app, props);
         return orb;
     }
--- a/hotspot/.hgtags	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/.hgtags	Wed Jul 05 19:21:26 2017 +0200
@@ -389,3 +389,5 @@
 23b8db5ea31d3079f1326afde4cd5c67b1dac49c hs25-b55
 4589b398ab03aba6a5da8c06ff53603488d1b8f4 jdk8-b113
 82a9cdbf683e374a76f2009352de53e16bed5a91 hs25-b56
+7fd913010dbbf75260688fd2fa8964763fa49a09 jdk8-b114
+3b32d287da89a47a45d16f6d9ba5bd3cd9bf4b3e hs25-b57
--- a/hotspot/agent/src/os/bsd/ps_proc.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/agent/src/os/bsd/ps_proc.c	Wed Jul 05 19:21:26 2017 +0200
@@ -131,7 +131,7 @@
 
 static bool ptrace_continue(pid_t pid, int signal) {
   // pass the signal to the process so we don't swallow it
-  if (ptrace(PTRACE_CONT, pid, NULL, signal) < 0) {
+  if (ptrace(PT_CONTINUE, pid, NULL, signal) < 0) {
     print_debug("ptrace(PTRACE_CONT, ..) failed for %d\n", pid);
     return false;
   }
@@ -434,7 +434,6 @@
 // attach to the process. One and only one exposed stuff
 struct ps_prochandle* Pgrab(pid_t pid) {
   struct ps_prochandle* ph = NULL;
-  thread_info* thr = NULL;
 
   if ( (ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle))) == NULL) {
      print_debug("can't allocate memory for ps_prochandle\n");
--- a/hotspot/make/hotspot_version	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/make/hotspot_version	Wed Jul 05 19:21:26 2017 +0200
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=25
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=56
+HS_BUILD_NUMBER=57
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -365,7 +365,7 @@
   return entry;
 }
 
-address CppInterpreter::return_entry(TosState state, int length) {
+address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
   // make it look good in the debugger
   return CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation) + frame::pc_return_offset;
 }
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -4099,15 +4099,19 @@
 
 void MacroAssembler::encode_klass_not_null(Register r) {
   assert (UseCompressedClassPointers, "must be compressed");
-  assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized");
-  assert(r != G6_heapbase, "bad register choice");
-  set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
-  sub(r, G6_heapbase, r);
-  if (Universe::narrow_klass_shift() != 0) {
-    assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
-    srlx(r, LogKlassAlignmentInBytes, r);
+  if (Universe::narrow_klass_base() != NULL) {
+    assert(r != G6_heapbase, "bad register choice");
+    set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
+    sub(r, G6_heapbase, r);
+    if (Universe::narrow_klass_shift() != 0) {
+      assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
+      srlx(r, LogKlassAlignmentInBytes, r);
+    }
+    reinit_heapbase();
+  } else {
+    assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
+    srlx(r, Universe::narrow_klass_shift(), r);
   }
-  reinit_heapbase();
 }
 
 void MacroAssembler::encode_klass_not_null(Register src, Register dst) {
@@ -4115,11 +4119,16 @@
     encode_klass_not_null(src);
   } else {
     assert (UseCompressedClassPointers, "must be compressed");
-    assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized");
-    set((intptr_t)Universe::narrow_klass_base(), dst);
-    sub(src, dst, dst);
-    if (Universe::narrow_klass_shift() != 0) {
-      srlx(dst, LogKlassAlignmentInBytes, dst);
+    if (Universe::narrow_klass_base() != NULL) {
+      set((intptr_t)Universe::narrow_klass_base(), dst);
+      sub(src, dst, dst);
+      if (Universe::narrow_klass_shift() != 0) {
+        srlx(dst, LogKlassAlignmentInBytes, dst);
+      }
+    } else {
+      // shift src into dst
+      assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
+      srlx(src, Universe::narrow_klass_shift(), dst);
     }
   }
 }
@@ -4129,14 +4138,16 @@
 // the instructions they generate change, then this method needs to be updated.
 int MacroAssembler::instr_size_for_decode_klass_not_null() {
   assert (UseCompressedClassPointers, "only for compressed klass ptrs");
-  // set + add + set
-  int num_instrs = insts_for_internal_set((intptr_t)Universe::narrow_klass_base()) + 1 +
-    insts_for_internal_set((intptr_t)Universe::narrow_ptrs_base());
-  if (Universe::narrow_klass_shift() == 0) {
-    return num_instrs * BytesPerInstWord;
-  } else { // sllx
-    return (num_instrs + 1) * BytesPerInstWord;
+  int num_instrs = 1;  // shift src,dst or add
+  if (Universe::narrow_klass_base() != NULL) {
+    // set + add + set
+    num_instrs += insts_for_internal_set((intptr_t)Universe::narrow_klass_base()) +
+                  insts_for_internal_set((intptr_t)Universe::narrow_ptrs_base());
+    if (Universe::narrow_klass_shift() != 0) {
+      num_instrs += 1;  // sllx
+    }
   }
+  return num_instrs * BytesPerInstWord;
 }
 
 // !!! If the instructions that get generated here change then function
@@ -4145,13 +4156,17 @@
   // Do not add assert code to this unless you change vtableStubs_sparc.cpp
   // pd_code_size_limit.
   assert (UseCompressedClassPointers, "must be compressed");
-  assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized");
-  assert(r != G6_heapbase, "bad register choice");
-  set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
-  if (Universe::narrow_klass_shift() != 0)
-    sllx(r, LogKlassAlignmentInBytes, r);
-  add(r, G6_heapbase, r);
-  reinit_heapbase();
+  if (Universe::narrow_klass_base() != NULL) {
+    assert(r != G6_heapbase, "bad register choice");
+    set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
+    if (Universe::narrow_klass_shift() != 0)
+      sllx(r, LogKlassAlignmentInBytes, r);
+    add(r, G6_heapbase, r);
+    reinit_heapbase();
+  } else {
+    assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
+    sllx(r, Universe::narrow_klass_shift(), r);
+  }
 }
 
 void  MacroAssembler::decode_klass_not_null(Register src, Register dst) {
@@ -4161,16 +4176,21 @@
     // Do not add assert code to this unless you change vtableStubs_sparc.cpp
     // pd_code_size_limit.
     assert (UseCompressedClassPointers, "must be compressed");
-    assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized");
-    if (Universe::narrow_klass_shift() != 0) {
-      assert((src != G6_heapbase) && (dst != G6_heapbase), "bad register choice");
-      set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
-      sllx(src, LogKlassAlignmentInBytes, dst);
-      add(dst, G6_heapbase, dst);
-      reinit_heapbase();
+    if (Universe::narrow_klass_base() != NULL) {
+      if (Universe::narrow_klass_shift() != 0) {
+        assert((src != G6_heapbase) && (dst != G6_heapbase), "bad register choice");
+        set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
+        sllx(src, LogKlassAlignmentInBytes, dst);
+        add(dst, G6_heapbase, dst);
+        reinit_heapbase();
+      } else {
+        set((intptr_t)Universe::narrow_klass_base(), dst);
+        add(src, dst, dst);
+      }
     } else {
-      set((intptr_t)Universe::narrow_klass_base(), dst);
-      add(src, dst, dst);
+      // shift/mov src into dst.
+      assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
+      sllx(src, Universe::narrow_klass_shift(), dst);
     }
   }
 }
--- a/hotspot/src/cpu/sparc/vm/sparc.ad	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad	Wed Jul 05 19:21:26 2017 +0200
@@ -1660,12 +1660,16 @@
   if (UseCompressedClassPointers) {
     assert(Universe::heap() != NULL, "java heap should be initialized");
     st->print_cr("\tLDUW   [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check - compressed klass");
-    st->print_cr("\tSET    Universe::narrow_klass_base,R_G6_heap_base");
-    if (Universe::narrow_klass_shift() != 0) {
-      st->print_cr("\tSLL    R_G5,3,R_G5");
+    if (Universe::narrow_klass_base() != 0) {
+      st->print_cr("\tSET    Universe::narrow_klass_base,R_G6_heap_base");
+      if (Universe::narrow_klass_shift() != 0) {
+        st->print_cr("\tSLL    R_G5,Universe::narrow_klass_shift,R_G5");
+      }
+      st->print_cr("\tADD    R_G5,R_G6_heap_base,R_G5");
+      st->print_cr("\tSET    Universe::narrow_ptrs_base,R_G6_heap_base");
+    } else {
+      st->print_cr("\tSLL    R_G5,Universe::narrow_klass_shift,R_G5");
     }
-    st->print_cr("\tADD    R_G5,R_G6_heap_base,R_G5");
-    st->print_cr("\tSET    Universe::narrow_ptrs_base,R_G6_heap_base");
   } else {
     st->print_cr("\tLDX    [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check");
   }
--- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -153,13 +153,9 @@
 }
 
 
-address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) {
-  TosState incoming_state = state;
+address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) {
+  address entry = __ pc();
 
-  Label cont;
-  address compiled_entry = __ pc();
-
-  address entry = __ pc();
 #if !defined(_LP64) && defined(COMPILER2)
   // All return values are where we want them, except for Longs.  C2 returns
   // longs in G1 in the 32-bit build whereas the interpreter wants them in O0/O1.
@@ -170,14 +166,12 @@
   // do this here. Unfortunately if we did a rethrow we'd see an machepilog node
   // first which would move g1 -> O0/O1 and destroy the exception we were throwing.
 
-  if (incoming_state == ltos) {
+  if (state == ltos) {
     __ srl (G1,  0, O1);
     __ srlx(G1, 32, O0);
   }
 #endif // !_LP64 && COMPILER2
 
-  __ bind(cont);
-
   // The callee returns with the stack possibly adjusted by adapter transition
   // We remove that possible adjustment here.
   // All interpreter local registers are untouched. Any result is passed back
@@ -186,29 +180,18 @@
 
   __ mov(Llast_SP, SP);   // Remove any adapter added stack space.
 
-  Label L_got_cache, L_giant_index;
   const Register cache = G3_scratch;
-  const Register size  = G1_scratch;
-  if (EnableInvokeDynamic) {
-    __ ldub(Address(Lbcp, 0), G1_scratch);  // Load current bytecode.
-    __ cmp_and_br_short(G1_scratch, Bytecodes::_invokedynamic, Assembler::equal, Assembler::pn, L_giant_index);
-  }
-  __ get_cache_and_index_at_bcp(cache, G1_scratch, 1);
-  __ bind(L_got_cache);
-  __ ld_ptr(cache, ConstantPoolCache::base_offset() +
-                   ConstantPoolCacheEntry::flags_offset(), size);
-  __ and3(size, 0xFF, size);                   // argument size in words
-  __ sll(size, Interpreter::logStackElementSize, size); // each argument size in bytes
-  __ add(Lesp, size, Lesp);                    // pop arguments
+  const Register index  = G1_scratch;
+  __ get_cache_and_index_at_bcp(cache, index, 1, index_size);
+
+  const Register flags = cache;
+  __ ld_ptr(cache, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset(), flags);
+  const Register parameter_size = flags;
+  __ and3(flags, ConstantPoolCacheEntry::parameter_size_mask, parameter_size);  // argument size in words
+  __ sll(parameter_size, Interpreter::logStackElementSize, parameter_size);     // each argument size in bytes
+  __ add(Lesp, parameter_size, Lesp);                                           // pop arguments
   __ dispatch_next(state, step);
 
-  // out of the main line of code...
-  if (EnableInvokeDynamic) {
-    __ bind(L_giant_index);
-    __ get_cache_and_index_at_bcp(cache, G1_scratch, 1, sizeof(u4));
-    __ ba_short(L_got_cache);
-  }
-
   return entry;
 }
 
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -2932,9 +2932,7 @@
   ConstantPoolCacheEntry::verify_tos_state_shift();
   // load return address
   {
-    const address table_addr = (is_invokeinterface || is_invokedynamic) ?
-        (address)Interpreter::return_5_addrs_by_index_table() :
-        (address)Interpreter::return_3_addrs_by_index_table();
+    const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code);
     AddressLiteral table(table_addr);
     __ set(table, temp);
     __ sll(ra, LogBytesPerWord, ra);
@@ -2984,7 +2982,7 @@
   __ verify_oop(O0_recv);
 
   // get return address
-  AddressLiteral table(Interpreter::return_3_addrs_by_index_table());
+  AddressLiteral table(Interpreter::invoke_return_entry_table());
   __ set(table, Rtemp);
   __ srl(Rret, ConstantPoolCacheEntry::tos_state_shift, Rret);          // get return type
   // Make sure we don't need to mask Rret after the above shift
@@ -3026,7 +3024,7 @@
   __ profile_final_call(O4);
 
   // get return address
-  AddressLiteral table(Interpreter::return_3_addrs_by_index_table());
+  AddressLiteral table(Interpreter::invoke_return_entry_table());
   __ set(table, Rtemp);
   __ srl(Rret, ConstantPoolCacheEntry::tos_state_shift, Rret);          // get return type
   // Make sure we don't need to mask Rret after the above shift
--- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -1468,19 +1468,18 @@
     addr = new LIR_Address(src.result(), offset, type);
   }
 
-  if (data != dst) {
-    __ move(data, dst);
-    data = dst;
-  }
+  // Because we want a 2-arg form of xchg and xadd
+  __ move(data, dst);
+
   if (x->is_add()) {
-    __ xadd(LIR_OprFact::address(addr), data, dst, LIR_OprFact::illegalOpr);
+    __ xadd(LIR_OprFact::address(addr), dst, dst, LIR_OprFact::illegalOpr);
   } else {
     if (is_obj) {
       // Do the pre-write barrier, if any.
       pre_barrier(LIR_OprFact::address(addr), LIR_OprFact::illegalOpr /* pre_val */,
                   true /* do_load */, false /* patch */, NULL);
     }
-    __ xchg(LIR_OprFact::address(addr), data, dst, LIR_OprFact::illegalOpr);
+    __ xchg(LIR_OprFact::address(addr), dst, dst, LIR_OprFact::illegalOpr);
     if (is_obj) {
       // Seems to be a precise address
       post_barrier(LIR_OprFact::address(addr), data);
--- a/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -367,7 +367,7 @@
   return entry;
 }
 
-address CppInterpreter::return_entry(TosState state, int length) {
+address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
   // make it look good in the debugger
   return CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation);
 }
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -5049,25 +5049,32 @@
 }
 
 void MacroAssembler::encode_klass_not_null(Register r) {
-  assert(Universe::narrow_klass_base() != NULL, "Base should be initialized");
-  // Use r12 as a scratch register in which to temporarily load the narrow_klass_base.
-  assert(r != r12_heapbase, "Encoding a klass in r12");
-  mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base());
-  subq(r, r12_heapbase);
+  if (Universe::narrow_klass_base() != NULL) {
+    // Use r12 as a scratch register in which to temporarily load the narrow_klass_base.
+    assert(r != r12_heapbase, "Encoding a klass in r12");
+    mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base());
+    subq(r, r12_heapbase);
+  }
   if (Universe::narrow_klass_shift() != 0) {
     assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
     shrq(r, LogKlassAlignmentInBytes);
   }
-  reinit_heapbase();
+  if (Universe::narrow_klass_base() != NULL) {
+    reinit_heapbase();
+  }
 }
 
 void MacroAssembler::encode_klass_not_null(Register dst, Register src) {
   if (dst == src) {
     encode_klass_not_null(src);
   } else {
-    mov64(dst, (int64_t)Universe::narrow_klass_base());
-    negq(dst);
-    addq(dst, src);
+    if (Universe::narrow_klass_base() != NULL) {
+      mov64(dst, (int64_t)Universe::narrow_klass_base());
+      negq(dst);
+      addq(dst, src);
+    } else {
+      movptr(dst, src);
+    }
     if (Universe::narrow_klass_shift() != 0) {
       assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
       shrq(dst, LogKlassAlignmentInBytes);
@@ -5081,15 +5088,19 @@
 // generate change, then this method needs to be updated.
 int MacroAssembler::instr_size_for_decode_klass_not_null() {
   assert (UseCompressedClassPointers, "only for compressed klass ptrs");
-  // mov64 + addq + shlq? + mov64  (for reinit_heapbase()).
-  return (Universe::narrow_klass_shift() == 0 ? 20 : 24);
+  if (Universe::narrow_klass_base() != NULL) {
+    // mov64 + addq + shlq? + mov64  (for reinit_heapbase()).
+    return (Universe::narrow_klass_shift() == 0 ? 20 : 24);
+  } else {
+    // longest load decode klass function, mov64, leaq
+    return 16;
+  }
 }
 
 // !!! If the instructions that get generated here change then function
 // instr_size_for_decode_klass_not_null() needs to get updated.
 void  MacroAssembler::decode_klass_not_null(Register r) {
   // Note: it will change flags
-  assert(Universe::narrow_klass_base() != NULL, "Base should be initialized");
   assert (UseCompressedClassPointers, "should only be used for compressed headers");
   assert(r != r12_heapbase, "Decoding a klass in r12");
   // Cannot assert, unverified entry point counts instructions (see .ad file)
@@ -5100,14 +5111,15 @@
     shlq(r, LogKlassAlignmentInBytes);
   }
   // Use r12 as a scratch register in which to temporarily load the narrow_klass_base.
-  mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base());
-  addq(r, r12_heapbase);
-  reinit_heapbase();
+  if (Universe::narrow_klass_base() != NULL) {
+    mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base());
+    addq(r, r12_heapbase);
+    reinit_heapbase();
+  }
 }
 
 void  MacroAssembler::decode_klass_not_null(Register dst, Register src) {
   // Note: it will change flags
-  assert(Universe::narrow_klass_base() != NULL, "Base should be initialized");
   assert (UseCompressedClassPointers, "should only be used for compressed headers");
   if (dst == src) {
     decode_klass_not_null(dst);
@@ -5115,7 +5127,6 @@
     // Cannot assert, unverified entry point counts instructions (see .ad file)
     // vtableStubs also counts instructions in pd_code_size_limit.
     // Also do not verify_oop as this is called by verify_oop.
-
     mov64(dst, (int64_t)Universe::narrow_klass_base());
     if (Universe::narrow_klass_shift() != 0) {
       assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -150,13 +150,12 @@
 }
 
 
-address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) {
-  TosState incoming_state = state;
+address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) {
   address entry = __ pc();
 
 #ifdef COMPILER2
   // The FPU stack is clean if UseSSE >= 2 but must be cleaned in other cases
-  if ((incoming_state == ftos && UseSSE < 1) || (incoming_state == dtos && UseSSE < 2)) {
+  if ((state == ftos && UseSSE < 1) || (state == dtos && UseSSE < 2)) {
     for (int i = 1; i < 8; i++) {
         __ ffree(i);
     }
@@ -164,7 +163,7 @@
     __ empty_FPU_stack();
   }
 #endif
-  if ((incoming_state == ftos && UseSSE < 1) || (incoming_state == dtos && UseSSE < 2)) {
+  if ((state == ftos && UseSSE < 1) || (state == dtos && UseSSE < 2)) {
     __ MacroAssembler::verify_FPU(1, "generate_return_entry_for compiled");
   } else {
     __ MacroAssembler::verify_FPU(0, "generate_return_entry_for compiled");
@@ -172,12 +171,12 @@
 
   // In SSE mode, interpreter returns FP results in xmm0 but they need
   // to end up back on the FPU so it can operate on them.
-  if (incoming_state == ftos && UseSSE >= 1) {
+  if (state == ftos && UseSSE >= 1) {
     __ subptr(rsp, wordSize);
     __ movflt(Address(rsp, 0), xmm0);
     __ fld_s(Address(rsp, 0));
     __ addptr(rsp, wordSize);
-  } else if (incoming_state == dtos && UseSSE >= 2) {
+  } else if (state == dtos && UseSSE >= 2) {
     __ subptr(rsp, 2*wordSize);
     __ movdbl(Address(rsp, 0), xmm0);
     __ fld_d(Address(rsp, 0));
@@ -194,33 +193,22 @@
   __ restore_bcp();
   __ restore_locals();
 
-  if (incoming_state == atos) {
+  if (state == atos) {
     Register mdp = rbx;
     Register tmp = rcx;
     __ profile_return_type(mdp, rax, tmp);
   }
 
-  Label L_got_cache, L_giant_index;
-  if (EnableInvokeDynamic) {
-    __ cmpb(Address(rsi, 0), Bytecodes::_invokedynamic);
-    __ jcc(Assembler::equal, L_giant_index);
-  }
-  __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u2));
-  __ bind(L_got_cache);
-  __ movl(rbx, Address(rbx, rcx,
-                    Address::times_ptr, ConstantPoolCache::base_offset() +
-                    ConstantPoolCacheEntry::flags_offset()));
-  __ andptr(rbx, 0xFF);
-  __ lea(rsp, Address(rsp, rbx, Interpreter::stackElementScale()));
+  const Register cache = rbx;
+  const Register index = rcx;
+  __ get_cache_and_index_at_bcp(cache, index, 1, index_size);
+
+  const Register flags = cache;
+  __ movl(flags, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
+  __ andl(flags, ConstantPoolCacheEntry::parameter_size_mask);
+  __ lea(rsp, Address(rsp, flags, Interpreter::stackElementScale()));
   __ dispatch_next(state, step);
 
-  // out of the main line of code...
-  if (EnableInvokeDynamic) {
-    __ bind(L_giant_index);
-    __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u4));
-    __ jmp(L_got_cache);
-  }
-
   return entry;
 }
 
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -166,7 +166,7 @@
 }
 
 
-address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) {
+address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) {
   address entry = __ pc();
 
   // Restore stack bottom in case i2c adjusted stack
@@ -183,28 +183,16 @@
     __ profile_return_type(mdp, rax, tmp);
   }
 
-  Label L_got_cache, L_giant_index;
-  if (EnableInvokeDynamic) {
-    __ cmpb(Address(r13, 0), Bytecodes::_invokedynamic);
-    __ jcc(Assembler::equal, L_giant_index);
-  }
-  __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u2));
-  __ bind(L_got_cache);
-  __ movl(rbx, Address(rbx, rcx,
-                       Address::times_ptr,
-                       in_bytes(ConstantPoolCache::base_offset()) +
-                       3 * wordSize));
-  __ andl(rbx, 0xFF);
-  __ lea(rsp, Address(rsp, rbx, Address::times_8));
+  const Register cache = rbx;
+  const Register index = rcx;
+  __ get_cache_and_index_at_bcp(cache, index, 1, index_size);
+
+  const Register flags = cache;
+  __ movl(flags, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
+  __ andl(flags, ConstantPoolCacheEntry::parameter_size_mask);
+  __ lea(rsp, Address(rsp, flags, Interpreter::stackElementScale()));
   __ dispatch_next(state, step);
 
-  // out of the main line of code...
-  if (EnableInvokeDynamic) {
-    __ bind(L_giant_index);
-    __ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u4));
-    __ jmp(L_got_cache);
-  }
-
   return entry;
 }
 
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -2925,9 +2925,7 @@
   ConstantPoolCacheEntry::verify_tos_state_shift();
   // load return address
   {
-    const address table_addr = (is_invokeinterface || is_invokedynamic) ?
-        (address)Interpreter::return_5_addrs_by_index_table() :
-        (address)Interpreter::return_3_addrs_by_index_table();
+    const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code);
     ExternalAddress table(table_addr);
     __ movptr(flags, ArrayAddress(table, Address(noreg, flags, Address::times_ptr)));
   }
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -2980,9 +2980,7 @@
   ConstantPoolCacheEntry::verify_tos_state_shift();
   // load return address
   {
-    const address table_addr = (is_invokeinterface || is_invokedynamic) ?
-        (address)Interpreter::return_5_addrs_by_index_table() :
-        (address)Interpreter::return_3_addrs_by_index_table();
+    const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code);
     ExternalAddress table(table_addr);
     __ lea(rscratch1, table);
     __ movptr(flags, Address(rscratch1, flags, Address::times_ptr));
--- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -1006,7 +1006,7 @@
   istate->set_stack_limit(stack_base - method->max_stack() - 1);
 }
 
-address CppInterpreter::return_entry(TosState state, int length) {
+address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
   ShouldNotCallThis();
   return NULL;
 }
--- a/hotspot/src/cpu/zero/vm/globals_zero.hpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/cpu/zero/vm/globals_zero.hpp	Wed Jul 05 19:21:26 2017 +0200
@@ -57,6 +57,8 @@
 // GC Ergo Flags
 define_pd_global(uintx, CMSYoungGenPerWorker, 16*M);  // default max size of CMS young gen, per GC worker thread
 
+define_pd_global(uintx, TypeProfileLevel, 0);
+
 #define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct)
 
 #endif // CPU_ZERO_VM_GLOBALS_ZERO_HPP
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -945,17 +945,15 @@
 // Used by VMSelfDestructTimer and the MemProfiler.
 double os::elapsedTime() {
 
-  return (double)(os::elapsed_counter()) * 0.000001;
+  return ((double)os::elapsed_counter()) / os::elapsed_frequency();
 }
 
 jlong os::elapsed_counter() {
-  timeval time;
-  int status = gettimeofday(&time, NULL);
-  return jlong(time.tv_sec) * 1000 * 1000 + jlong(time.tv_usec) - initial_time_count;
+  return javaTimeNanos() - initial_time_count;
 }
 
 jlong os::elapsed_frequency() {
-  return (1000 * 1000);
+  return NANOSECS_PER_SEC; // nanosecond resolution
 }
 
 bool os::supports_vtime() { return true; }
@@ -3582,7 +3580,7 @@
   Bsd::_main_thread = pthread_self();
 
   Bsd::clock_init();
-  initial_time_count = os::elapsed_counter();
+  initial_time_count = javaTimeNanos();
 
 #ifdef __APPLE__
   // XXXDARWIN
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -1333,17 +1333,15 @@
 // Used by VMSelfDestructTimer and the MemProfiler.
 double os::elapsedTime() {
 
-  return (double)(os::elapsed_counter()) * 0.000001;
+  return ((double)os::elapsed_counter()) / os::elapsed_frequency(); // nanosecond resolution
 }
 
 jlong os::elapsed_counter() {
-  timeval time;
-  int status = gettimeofday(&time, NULL);
-  return jlong(time.tv_sec) * 1000 * 1000 + jlong(time.tv_usec) - initial_time_count;
+  return javaTimeNanos() - initial_time_count;
 }
 
 jlong os::elapsed_frequency() {
-  return (1000 * 1000);
+  return NANOSECS_PER_SEC; // nanosecond resolution
 }
 
 bool os::supports_vtime() { return true; }
@@ -4750,7 +4748,7 @@
   Linux::_main_thread = pthread_self();
 
   Linux::clock_init();
-  initial_time_count = os::elapsed_counter();
+  initial_time_count = javaTimeNanos();
 
   // pthread_condattr initialization for monotonic clock
   int status;
--- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -79,6 +79,15 @@
 # include <pthread_np.h>
 #endif
 
+// needed by current_stack_region() workaround for Mavericks
+#if defined(__APPLE__)
+# include <errno.h>
+# include <sys/types.h>
+# include <sys/sysctl.h>
+# define DEFAULT_MAIN_THREAD_STACK_PAGES 2048
+# define OS_X_10_9_0_KERNEL_MAJOR_VERSION 13
+#endif
+
 #ifdef AMD64
 #define SPELL_REG_SP "rsp"
 #define SPELL_REG_FP "rbp"
@@ -828,6 +837,21 @@
   pthread_t self = pthread_self();
   void *stacktop = pthread_get_stackaddr_np(self);
   *size = pthread_get_stacksize_np(self);
+  // workaround for OS X 10.9.0 (Mavericks)
+  // pthread_get_stacksize_np returns 128 pages even though the actual size is 2048 pages
+  if (pthread_main_np() == 1) {
+    if ((*size) < (DEFAULT_MAIN_THREAD_STACK_PAGES * (size_t)getpagesize())) {
+      char kern_osrelease[256];
+      size_t kern_osrelease_size = sizeof(kern_osrelease);
+      int ret = sysctlbyname("kern.osrelease", kern_osrelease, &kern_osrelease_size, NULL, 0);
+      if (ret == 0) {
+        // get the major number, atoi will ignore the minor amd micro portions of the version string
+        if (atoi(kern_osrelease) >= OS_X_10_9_0_KERNEL_MAJOR_VERSION) {
+          *size = (DEFAULT_MAIN_THREAD_STACK_PAGES*getpagesize());
+        }
+      }
+    }
+  }
   *bottom = (address) stacktop - *size;
 #elif defined(__OpenBSD__)
   stack_t ss;
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -1873,7 +1873,7 @@
         // number of implementors for decl_interface is 0 or 1. If
         // it's 0 then no class implements decl_interface and there's
         // no point in inlining.
-        if (!holder->is_loaded() || decl_interface->nof_implementors() != 1) {
+        if (!holder->is_loaded() || decl_interface->nof_implementors() != 1 || decl_interface->has_default_methods()) {
           singleton = NULL;
         }
       }
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -57,6 +57,7 @@
   _init_state = ik->init_state();
   _nonstatic_field_size = ik->nonstatic_field_size();
   _has_nonstatic_fields = ik->has_nonstatic_fields();
+  _has_default_methods = ik->has_default_methods();
   _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields:
 
   _implementor = NULL; // we will fill these lazily
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp	Wed Jul 05 19:21:26 2017 +0200
@@ -52,6 +52,7 @@
   bool                   _has_finalizer;
   bool                   _has_subklass;
   bool                   _has_nonstatic_fields;
+  bool                   _has_default_methods;
 
   ciFlags                _flags;
   jint                   _nonstatic_field_size;
@@ -171,6 +172,11 @@
     }
   }
 
+  bool has_default_methods()  {
+    assert(is_loaded(), "must be loaded");
+    return _has_default_methods;
+  }
+
   ciInstanceKlass* get_canonical_holder(int offset);
   ciField* get_field_by_offset(int field_offset, bool is_static);
   ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static);
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -131,6 +131,17 @@
   }
 }
 
+void ClassLoaderData::loaded_classes_do(KlassClosure* klass_closure) {
+  // Lock to avoid classes being modified/added/removed during iteration
+  MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
+  for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
+    // Do not filter ArrayKlass oops here...
+    if (k->oop_is_array() || (k->oop_is_instance() && InstanceKlass::cast(k)->is_loaded())) {
+      klass_closure->do_klass(k);
+    }
+  }
+}
+
 void ClassLoaderData::classes_do(void f(InstanceKlass*)) {
   for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
     if (k->oop_is_instance()) {
@@ -600,6 +611,12 @@
   }
 }
 
+void ClassLoaderDataGraph::loaded_classes_do(KlassClosure* klass_closure) {
+  for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
+    cld->loaded_classes_do(klass_closure);
+  }
+}
+
 void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) {
   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
   for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp	Wed Jul 05 19:21:26 2017 +0200
@@ -78,6 +78,7 @@
   static void keep_alive_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim);
   static void classes_do(KlassClosure* klass_closure);
   static void classes_do(void f(Klass* const));
+  static void loaded_classes_do(KlassClosure* klass_closure);
   static void classes_unloading_do(void f(Klass* const));
   static bool do_unloading(BoolObjectClosure* is_alive);
 
@@ -186,6 +187,7 @@
   bool keep_alive() const       { return _keep_alive; }
   bool is_alive(BoolObjectClosure* is_alive_closure) const;
   void classes_do(void f(Klass*));
+  void loaded_classes_do(KlassClosure* klass_closure);
   void classes_do(void f(InstanceKlass*));
 
   // Deallocate free list during class unloading.
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Wed Jul 05 19:21:26 2017 +0200
@@ -173,8 +173,6 @@
   /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
   do_klass(nio_Buffer_klass,                            java_nio_Buffer,                           Opt                 ) \
                                                                                                                          \
-  do_klass(PostVMInitHook_klass,                        sun_misc_PostVMInitHook,                   Opt                 ) \
-                                                                                                                         \
   /* Preload boxing klasses */                                                                                           \
   do_klass(Boolean_klass,                               java_lang_Boolean,                         Pre                 ) \
   do_klass(Character_klass,                             java_lang_Character,                       Pre                 ) \
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -780,6 +780,10 @@
 void CompileBroker::compilation_init() {
   _last_method_compiled[0] = '\0';
 
+  // No need to initialize compilation system if we do not use it.
+  if (!UseCompiler) {
+    return;
+  }
 #ifndef SHARK
   // Set the interface to the current compiler(s).
   int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple);
--- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	Wed Jul 05 19:21:26 2017 +0200
@@ -158,8 +158,8 @@
   // Runtime support
 
   // length = invoke bytecode length (to advance to next bytecode)
-  static address    deopt_entry   (TosState state, int length) { ShouldNotReachHere(); return NULL; }
-  static address    return_entry  (TosState state, int length) { ShouldNotReachHere(); return NULL; }
+  static address deopt_entry(TosState state, int length) { ShouldNotReachHere(); return NULL; }
+  static address return_entry(TosState state, int length, Bytecodes::Code code) { ShouldNotReachHere(); return NULL; }
 
   static address    rethrow_exception_entry()                   { return _rethrow_exception_entry; }
 
--- a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp	Wed Jul 05 19:21:26 2017 +0200
@@ -78,7 +78,7 @@
   static address    stack_result_to_stack(int index)            { return _stack_to_stack[index]; }
   static address    stack_result_to_native(int index)           { return _stack_to_native_abi[index]; }
 
-  static address    return_entry  (TosState state, int length);
+  static address    return_entry  (TosState state, int length, Bytecodes::Code code);
   static address    deopt_entry   (TosState state, int length);
 
 #ifdef TARGET_ARCH_x86
--- a/hotspot/src/share/vm/interpreter/interpreter.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/interpreter/interpreter.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -329,15 +329,21 @@
 //------------------------------------------------------------------------------------------------------------------------
 // Deoptimization support
 
-// If deoptimization happens, this function returns the point of next bytecode to continue execution
+/**
+ * If a deoptimization happens, this function returns the point of next bytecode to continue execution.
+ */
 address AbstractInterpreter::deopt_continue_after_entry(Method* method, address bcp, int callee_parameters, bool is_top_frame) {
   assert(method->contains(bcp), "just checkin'");
-  Bytecodes::Code code   = Bytecodes::java_code_at(method, bcp);
+
+  // Get the original and rewritten bytecode.
+  Bytecodes::Code code = Bytecodes::java_code_at(method, bcp);
   assert(!Interpreter::bytecode_should_reexecute(code), "should not reexecute");
-  int             bci    = method->bci_from(bcp);
-  int             length = -1; // initial value for debugging
+
+  const int bci = method->bci_from(bcp);
+
   // compute continuation length
-  length = Bytecodes::length_at(method, bcp);
+  const int length = Bytecodes::length_at(method, bcp);
+
   // compute result type
   BasicType type = T_ILLEGAL;
 
@@ -393,7 +399,7 @@
   return
     is_top_frame
     ? Interpreter::deopt_entry (as_TosState(type), length)
-    : Interpreter::return_entry(as_TosState(type), length);
+    : Interpreter::return_entry(as_TosState(type), length, code);
 }
 
 // If deoptimization happens, this function returns the point where the interpreter reexecutes
--- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -184,8 +184,9 @@
 EntryPoint TemplateInterpreter::_continuation_entry;
 EntryPoint TemplateInterpreter::_safept_entry;
 
-address    TemplateInterpreter::_return_3_addrs_by_index[TemplateInterpreter::number_of_return_addrs];
-address    TemplateInterpreter::_return_5_addrs_by_index[TemplateInterpreter::number_of_return_addrs];
+address TemplateInterpreter::_invoke_return_entry[TemplateInterpreter::number_of_return_addrs];
+address TemplateInterpreter::_invokeinterface_return_entry[TemplateInterpreter::number_of_return_addrs];
+address TemplateInterpreter::_invokedynamic_return_entry[TemplateInterpreter::number_of_return_addrs];
 
 DispatchTable TemplateInterpreter::_active_table;
 DispatchTable TemplateInterpreter::_normal_table;
@@ -237,22 +238,37 @@
 #endif // !PRODUCT
 
   { CodeletMark cm(_masm, "return entry points");
+    const int index_size = sizeof(u2);
     for (int i = 0; i < Interpreter::number_of_return_entries; i++) {
       Interpreter::_return_entry[i] =
         EntryPoint(
-          generate_return_entry_for(itos, i),
-          generate_return_entry_for(itos, i),
-          generate_return_entry_for(itos, i),
-          generate_return_entry_for(atos, i),
-          generate_return_entry_for(itos, i),
-          generate_return_entry_for(ltos, i),
-          generate_return_entry_for(ftos, i),
-          generate_return_entry_for(dtos, i),
-          generate_return_entry_for(vtos, i)
+          generate_return_entry_for(itos, i, index_size),
+          generate_return_entry_for(itos, i, index_size),
+          generate_return_entry_for(itos, i, index_size),
+          generate_return_entry_for(atos, i, index_size),
+          generate_return_entry_for(itos, i, index_size),
+          generate_return_entry_for(ltos, i, index_size),
+          generate_return_entry_for(ftos, i, index_size),
+          generate_return_entry_for(dtos, i, index_size),
+          generate_return_entry_for(vtos, i, index_size)
         );
     }
   }
 
+  { CodeletMark cm(_masm, "invoke return entry points");
+    const TosState states[] = {itos, itos, itos, itos, ltos, ftos, dtos, atos, vtos};
+    const int invoke_length = Bytecodes::length_for(Bytecodes::_invokestatic);
+    const int invokeinterface_length = Bytecodes::length_for(Bytecodes::_invokeinterface);
+    const int invokedynamic_length = Bytecodes::length_for(Bytecodes::_invokedynamic);
+
+    for (int i = 0; i < Interpreter::number_of_return_addrs; i++) {
+      TosState state = states[i];
+      Interpreter::_invoke_return_entry[i] = generate_return_entry_for(state, invoke_length, sizeof(u2));
+      Interpreter::_invokeinterface_return_entry[i] = generate_return_entry_for(state, invokeinterface_length, sizeof(u2));
+      Interpreter::_invokedynamic_return_entry[i] = generate_return_entry_for(state, invokedynamic_length, sizeof(u4));
+    }
+  }
+
   { CodeletMark cm(_masm, "earlyret entry points");
     Interpreter::_earlyret_entry =
       EntryPoint(
@@ -298,13 +314,6 @@
     }
   }
 
-  for (int j = 0; j < number_of_states; j++) {
-    const TosState states[] = {btos, ctos, stos, itos, ltos, ftos, dtos, atos, vtos};
-    int index = Interpreter::TosState_as_index(states[j]);
-    Interpreter::_return_3_addrs_by_index[index] = Interpreter::return_entry(states[j], 3);
-    Interpreter::_return_5_addrs_by_index[index] = Interpreter::return_entry(states[j], 5);
-  }
-
   { CodeletMark cm(_masm, "continuation entry points");
     Interpreter::_continuation_entry =
       EntryPoint(
@@ -534,9 +543,46 @@
 //------------------------------------------------------------------------------------------------------------------------
 // Entry points
 
-address TemplateInterpreter::return_entry(TosState state, int length) {
+/**
+ * Returns the return entry table for the given invoke bytecode.
+ */
+address* TemplateInterpreter::invoke_return_entry_table_for(Bytecodes::Code code) {
+  switch (code) {
+  case Bytecodes::_invokestatic:
+  case Bytecodes::_invokespecial:
+  case Bytecodes::_invokevirtual:
+  case Bytecodes::_invokehandle:
+    return Interpreter::invoke_return_entry_table();
+  case Bytecodes::_invokeinterface:
+    return Interpreter::invokeinterface_return_entry_table();
+  case Bytecodes::_invokedynamic:
+    return Interpreter::invokedynamic_return_entry_table();
+  default:
+    fatal(err_msg("invalid bytecode: %s", Bytecodes::name(code)));
+    return NULL;
+  }
+}
+
+/**
+ * Returns the return entry address for the given top-of-stack state and bytecode.
+ */
+address TemplateInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
   guarantee(0 <= length && length < Interpreter::number_of_return_entries, "illegal length");
-  return _return_entry[length].entry(state);
+  const int index = TosState_as_index(state);
+  switch (code) {
+  case Bytecodes::_invokestatic:
+  case Bytecodes::_invokespecial:
+  case Bytecodes::_invokevirtual:
+  case Bytecodes::_invokehandle:
+    return _invoke_return_entry[index];
+  case Bytecodes::_invokeinterface:
+    return _invokeinterface_return_entry[index];
+  case Bytecodes::_invokedynamic:
+    return _invokedynamic_return_entry[index];
+  default:
+    assert(!Bytecodes::is_invoke(code), err_msg("invoke instructions should be handled separately: %s", Bytecodes::name(code)));
+    return _return_entry[length].entry(state);
+  }
 }
 
 
--- a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp	Wed Jul 05 19:21:26 2017 +0200
@@ -120,8 +120,9 @@
   static EntryPoint _continuation_entry;
   static EntryPoint _safept_entry;
 
-  static address    _return_3_addrs_by_index[number_of_return_addrs];     // for invokevirtual   return entries
-  static address    _return_5_addrs_by_index[number_of_return_addrs];     // for invokeinterface return entries
+  static address _invoke_return_entry[number_of_return_addrs];           // for invokestatic, invokespecial, invokevirtual return entries
+  static address _invokeinterface_return_entry[number_of_return_addrs];  // for invokeinterface return entries
+  static address _invokedynamic_return_entry[number_of_return_addrs];    // for invokedynamic return entries
 
   static DispatchTable _active_table;                           // the active    dispatch table (used by the interpreter for dispatch)
   static DispatchTable _normal_table;                           // the normal    dispatch table (used to set the active table in normal mode)
@@ -161,12 +162,15 @@
   static address*   normal_table()                              { return _normal_table.table_for(); }
 
   // Support for invokes
-  static address*   return_3_addrs_by_index_table()             { return _return_3_addrs_by_index; }
-  static address*   return_5_addrs_by_index_table()             { return _return_5_addrs_by_index; }
-  static int        TosState_as_index(TosState state);          // computes index into return_3_entry_by_index table
+  static address*   invoke_return_entry_table()                 { return _invoke_return_entry; }
+  static address*   invokeinterface_return_entry_table()        { return _invokeinterface_return_entry; }
+  static address*   invokedynamic_return_entry_table()          { return _invokedynamic_return_entry; }
+  static int        TosState_as_index(TosState state);
 
-  static address    return_entry  (TosState state, int length);
-  static address    deopt_entry   (TosState state, int length);
+  static address* invoke_return_entry_table_for(Bytecodes::Code code);
+
+  static address deopt_entry(TosState state, int length);
+  static address return_entry(TosState state, int length, Bytecodes::Code code);
 
   // Safepoint support
   static void       notice_safepoints();                        // stops the thread when reaching a safepoint
--- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp	Wed Jul 05 19:21:26 2017 +0200
@@ -53,7 +53,7 @@
   address generate_ClassCastException_handler();
   address generate_ArrayIndexOutOfBounds_handler(const char* name);
   address generate_continuation_for(TosState state);
-  address generate_return_entry_for(TosState state, int step);
+  address generate_return_entry_for(TosState state, int step, size_t index_size);
   address generate_earlyret_entry_for(TosState state);
   address generate_deopt_entry_for(TosState state, int step);
   address generate_safept_entry_for(TosState state, address runtime_entry);
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -56,7 +56,7 @@
 
 MetaWord* last_allocated = 0;
 
-size_t Metaspace::_class_metaspace_size;
+size_t Metaspace::_compressed_class_space_size;
 
 // Used in declarations in SpaceManager and ChunkManager
 enum ChunkIndex {
@@ -2843,6 +2843,8 @@
 #define VIRTUALSPACEMULTIPLIER 2
 
 #ifdef _LP64
+static const uint64_t UnscaledClassSpaceMax = (uint64_t(max_juint) + 1);
+
 void Metaspace::set_narrow_klass_base_and_shift(address metaspace_base, address cds_base) {
   // Figure out the narrow_klass_base and the narrow_klass_shift.  The
   // narrow_klass_base is the lower of the metaspace base and the cds base
@@ -2852,14 +2854,22 @@
   address higher_address;
   if (UseSharedSpaces) {
     higher_address = MAX2((address)(cds_base + FileMapInfo::shared_spaces_size()),
-                          (address)(metaspace_base + class_metaspace_size()));
+                          (address)(metaspace_base + compressed_class_space_size()));
     lower_base = MIN2(metaspace_base, cds_base);
   } else {
-    higher_address = metaspace_base + class_metaspace_size();
+    higher_address = metaspace_base + compressed_class_space_size();
     lower_base = metaspace_base;
+
+    uint64_t klass_encoding_max = UnscaledClassSpaceMax << LogKlassAlignmentInBytes;
+    // If compressed class space fits in lower 32G, we don't need a base.
+    if (higher_address <= (address)klass_encoding_max) {
+      lower_base = 0; // effectively lower base is zero.
+    }
   }
+
   Universe::set_narrow_klass_base(lower_base);
-  if ((uint64_t)(higher_address - lower_base) < (uint64_t)max_juint) {
+
+  if ((uint64_t)(higher_address - lower_base) < UnscaledClassSpaceMax) {
     Universe::set_narrow_klass_shift(0);
   } else {
     assert(!UseSharedSpaces, "Cannot shift with UseSharedSpaces");
@@ -2874,24 +2884,24 @@
   assert(UseCompressedClassPointers, "Only use with CompressedKlassPtrs");
   address lower_base = MIN2((address)metaspace_base, cds_base);
   address higher_address = MAX2((address)(cds_base + FileMapInfo::shared_spaces_size()),
-                                (address)(metaspace_base + class_metaspace_size()));
-  return ((uint64_t)(higher_address - lower_base) < (uint64_t)max_juint);
+                                (address)(metaspace_base + compressed_class_space_size()));
+  return ((uint64_t)(higher_address - lower_base) < UnscaledClassSpaceMax);
 }
 
 // Try to allocate the metaspace at the requested addr.
 void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, address cds_base) {
   assert(using_class_space(), "called improperly");
   assert(UseCompressedClassPointers, "Only use with CompressedKlassPtrs");
-  assert(class_metaspace_size() < KlassEncodingMetaspaceMax,
+  assert(compressed_class_space_size() < KlassEncodingMetaspaceMax,
          "Metaspace size is too big");
-  assert_is_ptr_aligned(requested_addr,          _reserve_alignment);
-  assert_is_ptr_aligned(cds_base,                _reserve_alignment);
-  assert_is_size_aligned(class_metaspace_size(), _reserve_alignment);
+  assert_is_ptr_aligned(requested_addr, _reserve_alignment);
+  assert_is_ptr_aligned(cds_base, _reserve_alignment);
+  assert_is_size_aligned(compressed_class_space_size(), _reserve_alignment);
 
   // Don't use large pages for the class space.
   bool large_pages = false;
 
-  ReservedSpace metaspace_rs = ReservedSpace(class_metaspace_size(),
+  ReservedSpace metaspace_rs = ReservedSpace(compressed_class_space_size(),
                                              _reserve_alignment,
                                              large_pages,
                                              requested_addr, 0);
@@ -2906,7 +2916,7 @@
       while (!metaspace_rs.is_reserved() && (addr + increment > addr) &&
              can_use_cds_with_metaspace_addr(addr + increment, cds_base)) {
         addr = addr + increment;
-        metaspace_rs = ReservedSpace(class_metaspace_size(),
+        metaspace_rs = ReservedSpace(compressed_class_space_size(),
                                      _reserve_alignment, large_pages, addr, 0);
       }
     }
@@ -2917,11 +2927,11 @@
     // initialization has happened that depends on UseCompressedClassPointers.
     // So, UseCompressedClassPointers cannot be turned off at this point.
     if (!metaspace_rs.is_reserved()) {
-      metaspace_rs = ReservedSpace(class_metaspace_size(),
+      metaspace_rs = ReservedSpace(compressed_class_space_size(),
                                    _reserve_alignment, large_pages);
       if (!metaspace_rs.is_reserved()) {
         vm_exit_during_initialization(err_msg("Could not allocate metaspace: %d bytes",
-                                              class_metaspace_size()));
+                                              compressed_class_space_size()));
       }
     }
   }
@@ -2943,8 +2953,8 @@
   if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) {
     gclog_or_tty->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: " SIZE_FORMAT,
                             Universe::narrow_klass_base(), Universe::narrow_klass_shift());
-    gclog_or_tty->print_cr("Metaspace Size: " SIZE_FORMAT " Address: " PTR_FORMAT " Req Addr: " PTR_FORMAT,
-                           class_metaspace_size(), metaspace_rs.base(), requested_addr);
+    gclog_or_tty->print_cr("Compressed class space size: " SIZE_FORMAT " Address: " PTR_FORMAT " Req Addr: " PTR_FORMAT,
+                           compressed_class_space_size(), metaspace_rs.base(), requested_addr);
   }
 }
 
@@ -3010,7 +3020,7 @@
   MaxMetaspaceExpansion = restricted_align_down(MaxMetaspaceExpansion, _commit_alignment);
 
   CompressedClassSpaceSize = restricted_align_down(CompressedClassSpaceSize, _reserve_alignment);
-  set_class_metaspace_size(CompressedClassSpaceSize);
+  set_compressed_class_space_size(CompressedClassSpaceSize);
 }
 
 void Metaspace::global_initialize() {
@@ -3039,12 +3049,12 @@
     }
 
 #ifdef _LP64
-    if (cds_total + class_metaspace_size() > (uint64_t)max_juint) {
+    if (cds_total + compressed_class_space_size() > UnscaledClassSpaceMax) {
       vm_exit_during_initialization("Unable to dump shared archive.",
           err_msg("Size of archive (" SIZE_FORMAT ") + compressed class space ("
                   SIZE_FORMAT ") == total (" SIZE_FORMAT ") is larger than compressed "
-                  "klass limit: " SIZE_FORMAT, cds_total, class_metaspace_size(),
-                  cds_total + class_metaspace_size(), (size_t)max_juint));
+                  "klass limit: " SIZE_FORMAT, cds_total, compressed_class_space_size(),
+                  cds_total + compressed_class_space_size(), UnscaledClassSpaceMax));
     }
 
     // Set the compressed klass pointer base so that decoding of these pointers works
@@ -3092,7 +3102,8 @@
         cds_end = (char *)align_ptr_up(cds_end, _reserve_alignment);
         allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address);
       } else {
-        allocate_metaspace_compressed_klass_ptrs((char *)CompressedKlassPointersBase, 0);
+        char* base = (char*)align_ptr_up(Universe::heap()->reserved_region().end(), _reserve_alignment);
+        allocate_metaspace_compressed_klass_ptrs(base, 0);
       }
     }
 #endif
@@ -3354,6 +3365,11 @@
   return result;
 }
 
+size_t Metaspace::class_chunk_size(size_t word_size) {
+  assert(using_class_space(), "Has to use class space");
+  return class_vsm()->calc_chunk_size(word_size);
+}
+
 void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_size, MetadataType mdtype, TRAPS) {
   // If result is still null, we are out of memory.
   if (Verbose && TraceMetadataChunkAllocation) {
@@ -3365,9 +3381,19 @@
     MetaspaceAux::dump(gclog_or_tty);
   }
 
+  bool out_of_compressed_class_space = false;
+  if (is_class_space_allocation(mdtype)) {
+    Metaspace* metaspace = loader_data->metaspace_non_null();
+    out_of_compressed_class_space =
+      MetaspaceAux::committed_bytes(Metaspace::ClassType) +
+      (metaspace->class_chunk_size(word_size) * BytesPerWord) >
+      CompressedClassSpaceSize;
+  }
+
   // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
-  const char* space_string = is_class_space_allocation(mdtype) ? "Compressed class space" :
-                                                                 "Metadata space";
+  const char* space_string = out_of_compressed_class_space ?
+    "Compressed class space" : "Metaspace";
+
   report_java_out_of_memory(space_string);
 
   if (JvmtiExport::should_post_resource_exhausted()) {
@@ -3380,7 +3406,7 @@
     vm_exit_during_initialization("OutOfMemoryError", space_string);
   }
 
-  if (is_class_space_allocation(mdtype)) {
+  if (out_of_compressed_class_space) {
     THROW_OOP(Universe::out_of_memory_error_class_metaspace());
   } else {
     THROW_OOP(Universe::out_of_memory_error_metaspace());
--- a/hotspot/src/share/vm/memory/metaspace.hpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/memory/metaspace.hpp	Wed Jul 05 19:21:26 2017 +0200
@@ -115,13 +115,13 @@
   static size_t align_word_size_up(size_t);
 
   // Aligned size of the metaspace.
-  static size_t _class_metaspace_size;
+  static size_t _compressed_class_space_size;
 
-  static size_t class_metaspace_size() {
-    return _class_metaspace_size;
+  static size_t compressed_class_space_size() {
+    return _compressed_class_space_size;
   }
-  static void set_class_metaspace_size(size_t metaspace_size) {
-    _class_metaspace_size = metaspace_size;
+  static void set_compressed_class_space_size(size_t size) {
+    _compressed_class_space_size = size;
   }
 
   static size_t _first_chunk_word_size;
@@ -192,6 +192,8 @@
   AllocRecord * _alloc_record_head;
   AllocRecord * _alloc_record_tail;
 
+  size_t class_chunk_size(size_t word_size);
+
  public:
 
   Metaspace(Mutex* lock, MetaspaceType type);
@@ -252,6 +254,7 @@
   static bool is_class_space_allocation(MetadataType mdType) {
     return mdType == ClassType && using_class_space();
   }
+
 };
 
 class MetaspaceAux : AllStatic {
--- a/hotspot/src/share/vm/memory/universe.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/memory/universe.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -677,13 +677,13 @@
 // HeapBased - Use compressed oops with heap base + encoding.
 
 // 4Gb
-static const uint64_t NarrowOopHeapMax = (uint64_t(max_juint) + 1);
+static const uint64_t UnscaledOopHeapMax = (uint64_t(max_juint) + 1);
 // 32Gb
-// OopEncodingHeapMax == NarrowOopHeapMax << LogMinObjAlignmentInBytes;
+// OopEncodingHeapMax == UnscaledOopHeapMax << LogMinObjAlignmentInBytes;
 
 char* Universe::preferred_heap_base(size_t heap_size, size_t alignment, NARROW_OOP_MODE mode) {
   assert(is_size_aligned((size_t)OopEncodingHeapMax, alignment), "Must be");
-  assert(is_size_aligned((size_t)NarrowOopHeapMax, alignment), "Must be");
+  assert(is_size_aligned((size_t)UnscaledOopHeapMax, alignment), "Must be");
   assert(is_size_aligned(heap_size, alignment), "Must be");
 
   uintx heap_base_min_address_aligned = align_size_up(HeapBaseMinAddress, alignment);
@@ -702,20 +702,40 @@
     // If the total size is small enough to allow UnscaledNarrowOop then
     // just use UnscaledNarrowOop.
     } else if ((total_size <= OopEncodingHeapMax) && (mode != HeapBasedNarrowOop)) {
-      if ((total_size <= NarrowOopHeapMax) && (mode == UnscaledNarrowOop) &&
+      if ((total_size <= UnscaledOopHeapMax) && (mode == UnscaledNarrowOop) &&
           (Universe::narrow_oop_shift() == 0)) {
         // Use 32-bits oops without encoding and
         // place heap's top on the 4Gb boundary
-        base = (NarrowOopHeapMax - heap_size);
+        base = (UnscaledOopHeapMax - heap_size);
       } else {
         // Can't reserve with NarrowOopShift == 0
         Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
+
         if (mode == UnscaledNarrowOop ||
-            mode == ZeroBasedNarrowOop && total_size <= NarrowOopHeapMax) {
+            mode == ZeroBasedNarrowOop && total_size <= UnscaledOopHeapMax) {
+
           // Use zero based compressed oops with encoding and
           // place heap's top on the 32Gb boundary in case
           // total_size > 4Gb or failed to reserve below 4Gb.
-          base = (OopEncodingHeapMax - heap_size);
+          uint64_t heap_top = OopEncodingHeapMax;
+
+          // For small heaps, save some space for compressed class pointer
+          // space so it can be decoded with no base.
+          if (UseCompressedClassPointers && !UseSharedSpaces &&
+              OopEncodingHeapMax <= 32*G) {
+
+            uint64_t class_space = align_size_up(CompressedClassSpaceSize, alignment);
+            assert(is_size_aligned((size_t)OopEncodingHeapMax-class_space,
+                   alignment), "difference must be aligned too");
+            uint64_t new_top = OopEncodingHeapMax-class_space;
+
+            if (total_size <= new_top) {
+              heap_top = new_top;
+            }
+          }
+
+          // Align base to the adjusted top of the heap
+          base = heap_top - heap_size;
         }
       }
     } else {
@@ -737,7 +757,7 @@
       // Set to a non-NULL value so the ReservedSpace ctor computes
       // the correct no-access prefix.
       // The final value will be set in initialize_heap() below.
-      Universe::set_narrow_oop_base((address)NarrowOopHeapMax);
+      Universe::set_narrow_oop_base((address)UnscaledOopHeapMax);
 #ifdef _WIN64
       if (UseLargePages) {
         // Cannot allocate guard pages for implicit checks in indexed
@@ -833,7 +853,7 @@
         Universe::set_narrow_oop_use_implicit_null_checks(true);
       }
 #endif //  _WIN64
-      if((uint64_t)Universe::heap()->reserved_region().end() > NarrowOopHeapMax) {
+      if((uint64_t)Universe::heap()->reserved_region().end() > UnscaledOopHeapMax) {
         // Can't reserve heap below 4Gb.
         Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
       } else {
@@ -1029,7 +1049,7 @@
     Handle msg = java_lang_String::create_from_str("Java heap space", CHECK_false);
     java_lang_Throwable::set_message(Universe::_out_of_memory_error_java_heap, msg());
 
-    msg = java_lang_String::create_from_str("Metadata space", CHECK_false);
+    msg = java_lang_String::create_from_str("Metaspace", CHECK_false);
     java_lang_Throwable::set_message(Universe::_out_of_memory_error_metaspace, msg());
     msg = java_lang_String::create_from_str("Compressed class space", CHECK_false);
     java_lang_Throwable::set_message(Universe::_out_of_memory_error_class_metaspace, msg());
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -2393,15 +2393,38 @@
 
 
 const char* InstanceKlass::signature_name() const {
+  int hash_len = 0;
+  char hash_buf[40];
+
+  // If this is an anonymous class, append a hash to make the name unique
+  if (is_anonymous()) {
+    assert(EnableInvokeDynamic, "EnableInvokeDynamic was not set.");
+    intptr_t hash = (java_mirror() != NULL) ? java_mirror()->identity_hash() : 0;
+    sprintf(hash_buf, "/" UINTX_FORMAT, (uintx)hash);
+    hash_len = (int)strlen(hash_buf);
+  }
+
+  // Get the internal name as a c string
   const char* src = (const char*) (name()->as_C_string());
   const int src_length = (int)strlen(src);
-  char* dest = NEW_RESOURCE_ARRAY(char, src_length + 3);
-  int src_index = 0;
+
+  char* dest = NEW_RESOURCE_ARRAY(char, src_length + hash_len + 3);
+
+  // Add L as type indicator
   int dest_index = 0;
   dest[dest_index++] = 'L';
-  while (src_index < src_length) {
+
+  // Add the actual class name
+  for (int src_index = 0; src_index < src_length; ) {
     dest[dest_index++] = src[src_index++];
   }
+
+  // If we have a hash, append it
+  for (int hash_index = 0; hash_index < hash_len; ) {
+    dest[dest_index++] = hash_buf[hash_index++];
+  }
+
+  // Add the semicolon and the NULL
   dest[dest_index++] = ';';
   dest[dest_index] = '\0';
   return dest;
--- a/hotspot/src/share/vm/oops/method.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/oops/method.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -1515,7 +1515,10 @@
       return bp->orig_bytecode();
     }
   }
-  ShouldNotReachHere();
+  {
+    ResourceMark rm;
+    fatal(err_msg("no original bytecode found in %s at bci %d", name_and_sig_as_C_string(), bci));
+  }
   return Bytecodes::_shouldnotreachhere;
 }
 
--- a/hotspot/src/share/vm/opto/library_call.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -2006,9 +2006,9 @@
   Node* arg2 = NULL;
 
   if (is_increment) {
-      arg2 = intcon(1);
+    arg2 = intcon(1);
   } else {
-      arg2 = argument(1);
+    arg2 = argument(1);
   }
 
   Node* add = _gvn.transform( new(C) AddExactINode(NULL, arg1, arg2) );
@@ -2056,7 +2056,7 @@
   if (is_decrement) {
     arg2 = longcon(1);
   } else {
-    Node* arg2 = argument(2); // type long
+    arg2 = argument(2); // type long
     // argument(3) == TOP
   }
 
--- a/hotspot/src/share/vm/opto/loopTransform.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -713,6 +713,10 @@
       case Op_ModL: body_size += 30; break;
       case Op_DivL: body_size += 30; break;
       case Op_MulL: body_size += 10; break;
+      case Op_FlagsProj:
+        // Can't handle unrolling of loops containing
+        // nodes that generate a FlagsProj at the moment
+        return false;
       case Op_StrComp:
       case Op_StrEquals:
       case Op_StrIndexOf:
--- a/hotspot/src/share/vm/opto/postaloc.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/opto/postaloc.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -97,7 +97,8 @@
 static bool expected_yanked_node(Node *old, Node *orig_old) {
   // This code is expected only next original nodes:
   // - load from constant table node which may have next data input nodes:
-  //     MachConstantBase, Phi, MachTemp, MachSpillCopy
+  //     MachConstantBase, MachTemp, MachSpillCopy
+  // - Phi nodes that are considered Junk
   // - load constant node which may have next data input nodes:
   //     MachTemp, MachSpillCopy
   // - MachSpillCopy
@@ -112,7 +113,9 @@
     return (old == orig_old);
   } else if (old->is_MachTemp()) {
     return orig_old->is_Con();
-  } else if (old->is_Phi() || old->is_MachConstantBase()) {
+  } else if (old->is_Phi()) { // Junk phi's
+    return true;
+  } else if (old->is_MachConstantBase()) {
     return (orig_old->is_Con() && orig_old->is_MachConstant());
   }
   return false;
@@ -522,11 +525,9 @@
           u = u ? NodeSentinel : x; // Capture unique input, or NodeSentinel for 2nd input
       }
       if (u != NodeSentinel) {    // Junk Phi.  Remove
-        block->remove_node(j--);
+        phi->replace_by(u);
+        j -= yank_if_dead(phi, block, &value, &regnd);
         phi_dex--;
-        _cfg.unmap_node_from_block(phi);
-        phi->replace_by(u);
-        phi->disconnect_inputs(NULL, C);
         continue;
       }
       // Note that if value[pidx] exists, then we merged no new values here
--- a/hotspot/src/share/vm/opto/type.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/opto/type.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -2787,13 +2787,11 @@
 
 //-----------------------------filter------------------------------------------
 // Do not allow interface-vs.-noninterface joins to collapse to top.
-const Type *TypeOopPtr::filter( const Type *kills ) const {
+const Type *TypeOopPtr::filter(const Type *kills) const {
 
   const Type* ft = join(kills);
   const TypeInstPtr* ftip = ft->isa_instptr();
   const TypeInstPtr* ktip = kills->isa_instptr();
-  const TypeKlassPtr* ftkp = ft->isa_klassptr();
-  const TypeKlassPtr* ktkp = kills->isa_klassptr();
 
   if (ft->empty()) {
     // Check for evil case of 'this' being a class and 'kills' expecting an
@@ -2807,8 +2805,6 @@
     // uplift the type.
     if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface())
       return kills;             // Uplift to interface
-    if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface())
-      return kills;             // Uplift to interface
 
     return Type::TOP;           // Canonical empty value
   }
@@ -2825,14 +2821,6 @@
     assert(!ftip->klass_is_exact(), "interface could not be exact");
     return ktip->cast_to_ptr_type(ftip->ptr());
   }
-  // Interface klass type could be exact in opposite to interface type,
-  // return it here instead of incorrect Constant ptr J/L/Object (6894807).
-  if (ftkp != NULL && ktkp != NULL &&
-      ftkp->is_loaded() &&  ftkp->klass()->is_interface() &&
-      !ftkp->klass_is_exact() && // Keep exact interface klass
-      ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
-    return ktkp->cast_to_ptr_type(ftkp->ptr());
-  }
 
   return ft;
 }
@@ -4385,6 +4373,33 @@
   return (_offset == 0) && !below_centerline(_ptr);
 }
 
+// Do not allow interface-vs.-noninterface joins to collapse to top.
+const Type *TypeKlassPtr::filter(const Type *kills) const {
+  // logic here mirrors the one from TypeOopPtr::filter. See comments
+  // there.
+  const Type* ft = join(kills);
+  const TypeKlassPtr* ftkp = ft->isa_klassptr();
+  const TypeKlassPtr* ktkp = kills->isa_klassptr();
+
+  if (ft->empty()) {
+    if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface())
+      return kills;             // Uplift to interface
+
+    return Type::TOP;           // Canonical empty value
+  }
+
+  // Interface klass type could be exact in opposite to interface type,
+  // return it here instead of incorrect Constant ptr J/L/Object (6894807).
+  if (ftkp != NULL && ktkp != NULL &&
+      ftkp->is_loaded() &&  ftkp->klass()->is_interface() &&
+      !ftkp->klass_is_exact() && // Keep exact interface klass
+      ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
+    return ktkp->cast_to_ptr_type(ftkp->ptr());
+  }
+
+  return ft;
+}
+
 //----------------------compute_klass------------------------------------------
 // Compute the defining klass for this class
 ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const {
--- a/hotspot/src/share/vm/opto/type.hpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/opto/type.hpp	Wed Jul 05 19:21:26 2017 +0200
@@ -63,7 +63,7 @@
 class     TypeOopPtr;
 class       TypeInstPtr;
 class       TypeAryPtr;
-class       TypeKlassPtr;
+class     TypeKlassPtr;
 class     TypeMetadataPtr;
 
 //------------------------------Type-------------------------------------------
@@ -1202,6 +1202,9 @@
 
   virtual intptr_t get_con() const;
 
+  // Do not allow interface-vs.-noninterface joins to collapse to top.
+  virtual const Type *filter( const Type *kills ) const;
+
   // Convenience common pre-built types.
   static const TypeKlassPtr* OBJECT; // Not-null object klass or below
   static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same
--- a/hotspot/src/share/vm/prims/jvmtiGetLoadedClasses.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiGetLoadedClasses.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -29,8 +29,43 @@
 #include "runtime/thread.hpp"
 
 
+// The closure for GetLoadedClasses
+class LoadedClassesClosure : public KlassClosure {
+private:
+  Stack<jclass, mtInternal> _classStack;
+  JvmtiEnv* _env;
 
-// The closure for GetLoadedClasses and GetClassLoaderClasses
+public:
+  LoadedClassesClosure(JvmtiEnv* env) {
+    _env = env;
+  }
+
+  void do_klass(Klass* k) {
+    // Collect all jclasses
+    _classStack.push((jclass) _env->jni_reference(k->java_mirror()));
+  }
+
+  int extract(jclass* result_list) {
+    // The size of the Stack will be 0 after extract, so get it here
+    int count = (int)_classStack.size();
+    int i = count;
+
+    // Pop all jclasses, fill backwards
+    while (!_classStack.is_empty()) {
+      result_list[--i] = _classStack.pop();
+    }
+
+    // Return the number of elements written
+    return count;
+  }
+
+  // Return current size of the Stack
+  int get_count() {
+    return (int)_classStack.size();
+  }
+};
+
+// The closure for GetClassLoaderClasses
 class JvmtiGetLoadedClassesClosure : public StackObj {
   // Since the SystemDictionary::classes_do callback
   // doesn't pass a closureData pointer,
@@ -165,19 +200,6 @@
     }
   }
 
-  // Finally, the static methods that are the callbacks
-  static void increment(Klass* k) {
-    JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
-    if (that->get_initiatingLoader() == NULL) {
-      for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) {
-        that->set_count(that->get_count() + 1);
-      }
-    } else if (k != NULL) {
-      // if initiating loader not null, just include the instance with 1 dimension
-      that->set_count(that->get_count() + 1);
-    }
-  }
-
   static void increment_with_loader(Klass* k, ClassLoaderData* loader_data) {
     JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
     oop class_loader = loader_data->class_loader();
@@ -196,24 +218,6 @@
     }
   }
 
-  static void add(Klass* k) {
-    JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
-    if (that->available()) {
-      if (that->get_initiatingLoader() == NULL) {
-        for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) {
-          oop mirror = l->java_mirror();
-          that->set_element(that->get_index(), mirror);
-          that->set_index(that->get_index() + 1);
-        }
-      } else if (k != NULL) {
-        // if initiating loader not null, just include the instance with 1 dimension
-        oop mirror = k->java_mirror();
-        that->set_element(that->get_index(), mirror);
-        that->set_index(that->get_index() + 1);
-      }
-    }
-  }
-
   static void add_with_loader(Klass* k, ClassLoaderData* loader_data) {
     JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
     if (that->available()) {
@@ -255,39 +259,30 @@
 
 jvmtiError
 JvmtiGetLoadedClasses::getLoadedClasses(JvmtiEnv *env, jint* classCountPtr, jclass** classesPtr) {
-  // Since SystemDictionary::classes_do only takes a function pointer
-  // and doesn't call back with a closure data pointer,
-  // we can only pass static methods.
 
-  JvmtiGetLoadedClassesClosure closure;
+  LoadedClassesClosure closure(env);
   {
     // To get a consistent list of classes we need MultiArray_lock to ensure
-    // array classes aren't created, and SystemDictionary_lock to ensure that
-    // classes aren't added to the system dictionary,
+    // array classes aren't created.
     MutexLocker ma(MultiArray_lock);
-    MutexLocker sd(SystemDictionary_lock);
+
+    // Iterate through all classes in ClassLoaderDataGraph
+    // and collect them using the LoadedClassesClosure
+    ClassLoaderDataGraph::loaded_classes_do(&closure);
+  }
 
-    // First, count the classes
-    SystemDictionary::classes_do(&JvmtiGetLoadedClassesClosure::increment);
-    Universe::basic_type_classes_do(&JvmtiGetLoadedClassesClosure::increment);
-    // Next, fill in the classes
-    closure.allocate();
-    SystemDictionary::classes_do(&JvmtiGetLoadedClassesClosure::add);
-    Universe::basic_type_classes_do(&JvmtiGetLoadedClassesClosure::add);
-    // Drop the SystemDictionary_lock, so the results could be wrong from here,
-    // but we still have a snapshot.
+  // Return results by extracting the collected contents into a list
+  // allocated via JvmtiEnv
+  jclass* result_list;
+  jvmtiError error = env->Allocate(closure.get_count() * sizeof(jclass),
+                               (unsigned char**)&result_list);
+
+  if (error == JVMTI_ERROR_NONE) {
+    int count = closure.extract(result_list);
+    *classCountPtr = count;
+    *classesPtr = result_list;
   }
-  // Post results
-  jclass* result_list;
-  jvmtiError err = env->Allocate(closure.get_count() * sizeof(jclass),
-                                 (unsigned char**)&result_list);
-  if (err != JVMTI_ERROR_NONE) {
-    return err;
-  }
-  closure.extract(env, result_list);
-  *classCountPtr = closure.get_count();
-  *classesPtr = result_list;
-  return JVMTI_ERROR_NONE;
+  return error;
 }
 
 jvmtiError
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -1988,6 +1988,15 @@
     warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. "
         "Use MaxRAMFraction instead.");
   }
+  if (FLAG_IS_CMDLINE(UseCMSCompactAtFullCollection)) {
+    warning("UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.");
+  }
+  if (FLAG_IS_CMDLINE(CMSFullGCsBeforeCompaction)) {
+    warning("CMSFullGCsBeforeCompaction is deprecated and will likely be removed in a future release.");
+  }
+  if (FLAG_IS_CMDLINE(UseCMSCollectionPassing)) {
+    warning("UseCMSCollectionPassing is deprecated and will likely be removed in a future release.");
+  }
 }
 
 // Check stack pages settings
--- a/hotspot/src/share/vm/runtime/handles.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/runtime/handles.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -45,7 +45,7 @@
 oop* HandleArea::allocate_handle(oop obj) {
   assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark");
   assert(_no_handle_mark_nesting == 0, "allocating handle inside NoHandleMark");
-  assert(obj->is_oop(), "sanity check");
+  assert(obj->is_oop(), err_msg("not an oop: " INTPTR_FORMAT, (intptr_t*) obj));
   return real_allocate_handle(obj);
 }
 
--- a/hotspot/src/share/vm/runtime/thread.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -1097,7 +1097,7 @@
 // General purpose hook into Java code, run once when the VM is initialized.
 // The Java library method itself may be changed independently from the VM.
 static void call_postVMInitHook(TRAPS) {
-  Klass* k = SystemDictionary::PostVMInitHook_klass();
+  Klass* k = SystemDictionary::resolve_or_null(vmSymbols::sun_misc_PostVMInitHook(), THREAD);
   instanceKlassHandle klass (THREAD, k);
   if (klass.not_null()) {
     JavaValue result(T_VOID);
--- a/hotspot/src/share/vm/services/jmm.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/services/jmm.h	Wed Jul 05 19:21:26 2017 +0200
@@ -78,6 +78,7 @@
   JMM_COMPILE_TOTAL_TIME_MS          = 8,    /* Total accumulated time spent in compilation */
   JMM_GC_TIME_MS                     = 9,    /* Total accumulated time spent in collection */
   JMM_GC_COUNT                       = 10,   /* Total number of collections */
+  JMM_JVM_UPTIME_MS                  = 11,   /* The JVM uptime in milliseconds */
 
   JMM_INTERNAL_ATTRIBUTE_INDEX       = 100,
   JMM_CLASS_LOADED_BYTES             = 101,  /* Number of bytes loaded instance classes */
--- a/hotspot/src/share/vm/services/management.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/services/management.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -1032,6 +1032,9 @@
   case JMM_JVM_INIT_DONE_TIME_MS:
     return Management::vm_init_done_time();
 
+  case JMM_JVM_UPTIME_MS:
+    return Management::ticks_to_ms(os::elapsed_counter());
+
   case JMM_COMPILE_TOTAL_TIME_MS:
     return Management::ticks_to_ms(CompileBroker::total_compilation_ticks());
 
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Wed Jul 05 19:21:26 2017 +0200
@@ -368,8 +368,6 @@
 // Klass encoding metaspace max size
 const uint64_t KlassEncodingMetaspaceMax = (uint64_t(max_juint) + 1) << LogKlassAlignmentInBytes;
 
-const jlong CompressedKlassPointersBase = NOT_LP64(0) LP64_ONLY(CONST64(0x800000000));  // 32*G
-
 // Machine dependent stuff
 
 #ifdef TARGET_ARCH_x86
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/inlining/InlineDefaultMethod.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8026735
+ * @summary CHA in C1 should make correct decisions about default methods
+ * @run main/othervm -Xcomp -XX:CompileOnly=InlineDefaultMethod::test -XX:TieredStopAtLevel=1 InlineDefaultMethod
+ */
+
+
+interface InterfaceWithDefaultMethod0 {
+    default public int defaultMethod() {
+        return 1;
+    }
+}
+
+interface InterfaceWithDefaultMethod1 extends InterfaceWithDefaultMethod0 { }
+
+abstract class Subtype implements InterfaceWithDefaultMethod1 { }
+
+class Decoy extends Subtype {
+    public int defaultMethod() {
+        return 2;
+    }
+}
+
+class Instance extends Subtype { }
+
+public class InlineDefaultMethod {
+    public static int test(InterfaceWithDefaultMethod1 x) {
+        return x.defaultMethod();
+    }
+    public static void main(String[] args) {
+        InterfaceWithDefaultMethod1 a = new Decoy();
+        InterfaceWithDefaultMethod1 b = new Instance();
+        if (test(a) != 2 ||
+            test(b) != 1) {
+          System.err.println("FAILED");
+          System.exit(97);
+        }
+        System.err.println("PASSED");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/mathexact/NestedMathExactTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8027444
+ * @summary Test nested loops
+ * @compile NestedMathExactTest.java
+ * @run main NestedMathExactTest
+ *
+ */
+
+public class NestedMathExactTest {
+    public static final int LIMIT = 100;
+    public static int[] result = new int[LIMIT];
+    public static int value = 17;
+
+    public static void main(String[] args) {
+        for (int i = 0; i < 100; ++i) {
+            result[i] = runTest();
+        }
+    }
+
+    public static int runTest() {
+        int sum = 0;
+        for (int j = 0; j < 100000; j = Math.addExact(j, 1)) {
+            sum = 1;
+            for (int i = 0; i < 5; ++i) {
+                sum *= value;
+            }
+        }
+        return sum;
+    }
+}
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8026844
+ * @bug 8027353
  * @summary Test constant subtractExact
  * @compile SubExactLConstantTest.java Verify.java
  * @run main SubExactLConstantTest
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8026844
+ * @bug 8027353
  * @summary Test non constant subtractExact
  * @compile SubExactLNonConstantTest.java Verify.java
  * @run main SubExactLNonConstantTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/startup/StartupOutput.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8026949
+ * @summary Test ensures correct VM output during startup
+ * @library ../../testlibrary
+ *
+ */
+import com.oracle.java.testlibrary.*;
+
+public class StartupOutput {
+  public static void main(String[] args) throws Exception {
+    ProcessBuilder pb;
+    OutputAnalyzer out;
+
+    pb = ProcessTools.createJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version");
+    out = new OutputAnalyzer(pb.start());
+    out.shouldNotContain("no space to run compilers");
+
+    out.shouldHaveExitValue(0);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+
+/*
+* @test TestCMSForegroundFlags
+* @key gc
+* @bug 8027132
+* @summary Test that the deprecated CMS foreground collector flags print warning messages
+* @library /testlibrary
+* @run main TestCMSForegroundFlags -XX:-UseCMSCompactAtFullCollection UseCMSCompactAtFullCollection
+* @run main TestCMSForegroundFlags -XX:CMSFullGCsBeforeCompaction=4 CMSFullGCsBeforeCompaction
+* @run main TestCMSForegroundFlags -XX:-UseCMSCollectionPassing UseCMSCollectionPassing
+*/
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.oracle.java.testlibrary.ProcessTools;
+
+public class TestCMSForegroundFlags {
+  public static void main(String[] args) throws Exception {
+    if (args.length != 2) {
+      throw new Exception("Expected two arguments,flagValue and flagName");
+    }
+    String flagValue = args[0];
+    String flagName = args[1];
+
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flagValue, "-version");
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+    output.shouldContain("warning: " + flagName + " is deprecated and will likely be removed in a future release.");
+    output.shouldNotContain("error");
+    output.shouldHaveExitValue(0);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8026365
+ * @summary Test invokespecial of host class method from an anonymous class
+ * @author  Robert Field
+ * @library /testlibrary
+ * @compile -XDignore.symbol.file InvokeSpecialAnonTest.java
+ * @run main ClassFileInstaller InvokeSpecialAnonTest AnonTester
+ * @run main/othervm -Xbootclasspath/a:. -Xverify:all InvokeSpecialAnonTest
+ */
+import jdk.internal.org.objectweb.asm.*;
+import java.lang.reflect.Constructor;
+import sun.misc.Unsafe;
+
+public class InvokeSpecialAnonTest implements Opcodes {
+
+    static byte[] anonClassBytes() throws Exception {
+        ClassWriter cw = new ClassWriter(0);
+        MethodVisitor mv;
+
+        cw.visit(V1_8, ACC_FINAL + ACC_SUPER, "Anon", null, "java/lang/Object", null);
+
+        {
+            mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
+            mv.visitCode();
+            mv.visitVarInsn(ALOAD, 0);
+            mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(2, 2);
+            mv.visitEnd();
+        }
+        {
+            mv = cw.visitMethod(ACC_PUBLIC, "m", "(LInvokeSpecialAnonTest;)I", null, null);
+            mv.visitCode();
+            mv.visitVarInsn(ALOAD, 0);
+            mv.visitVarInsn(ALOAD, 1);
+            mv.visitMethodInsn(INVOKESPECIAL, "InvokeSpecialAnonTest", "privMethod", "()I");
+            mv.visitInsn(IRETURN);
+            mv.visitMaxs(2, 3);
+            mv.visitEnd();
+        }
+        cw.visitEnd();
+
+        return cw.toByteArray();
+    }
+
+    private int privMethod() { return 1234; }
+
+    public static void main(String[] args) throws Exception {
+        Class<?> klass = InvokeSpecialAnonTest.class;
+        try {
+           Class<?> result = AnonTester.defineTest(klass, anonClassBytes());
+           System.out.println("Passed.");
+        } catch (Exception e) {
+           e.printStackTrace();
+           throw e;
+        }
+    }
+}
+
+
+class AnonTester {
+    private static final Unsafe UNSAFE = Unsafe.getUnsafe();
+
+    public static Class<?> defineTest(Class<?> targetClass, byte[] classBytes) throws Exception {
+        return UNSAFE.defineAnonymousClass(targetClass, classBytes, null);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8024927
+ * @summary Testing address of compressed class pointer space as best as possible.
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class CompressedClassPointers {
+
+    public static void smallHeapTest() throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:SharedBaseAddress=8g",
+            "-Xmx128m",
+            "-XX:+PrintCompressedOopsMode",
+            "-XX:+VerifyBeforeGC", "-version");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Narrow klass base: 0x0000000000000000");
+        output.shouldHaveExitValue(0);
+    }
+
+    public static void smallHeapTestWith3G() throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:CompressedClassSpaceSize=3g",
+            "-Xmx128m",
+            "-XX:+PrintCompressedOopsMode",
+            "-XX:+VerifyBeforeGC", "-version");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Narrow klass base: 0x0000000000000000, Narrow klass shift: 3");
+        output.shouldHaveExitValue(0);
+    }
+
+    public static void largeHeapTest() throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-Xmx30g",
+            "-XX:+PrintCompressedOopsMode",
+            "-XX:+VerifyBeforeGC", "-version");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldNotContain("Narrow klass base: 0x0000000000000000");
+        output.shouldContain("Narrow klass shift: 0");
+        output.shouldHaveExitValue(0);
+    }
+
+    public static void largePagesTest() throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-Xmx128m",
+            "-XX:+UseLargePages",
+            "-XX:+PrintCompressedOopsMode",
+            "-XX:+VerifyBeforeGC", "-version");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Narrow klass base:");
+        output.shouldHaveExitValue(0);
+    }
+
+    public static void sharingTest() throws Exception {
+        // Test small heaps
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:SharedArchiveFile=./sample.jsa",
+            "-Xmx128m",
+            "-XX:SharedBaseAddress=8g",
+            "-XX:+PrintCompressedOopsMode",
+            "-XX:+VerifyBeforeGC",
+            "-Xshare:dump");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        try {
+          output.shouldContain("Loading classes to share");
+          output.shouldHaveExitValue(0);
+
+          pb = ProcessTools.createJavaProcessBuilder(
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:SharedArchiveFile=./sample.jsa",
+            "-Xmx128m",
+            "-XX:SharedBaseAddress=8g",
+            "-XX:+PrintCompressedOopsMode",
+            "-Xshare:on",
+            "-version");
+          output = new OutputAnalyzer(pb.start());
+          output.shouldContain("sharing");
+          output.shouldHaveExitValue(0);
+
+        } catch (RuntimeException e) {
+          output.shouldContain("Unable to use shared archive");
+          output.shouldHaveExitValue(1);
+        }
+    }
+
+  public static void main(String[] args) throws Exception {
+      if (!Platform.is64bit()) {
+          // Can't test this on 32 bit, just pass
+          System.out.println("Skipping test on 32bit");
+          return;
+      }
+      // Solaris 10 can't mmap compressed oops space without a base
+      if (Platform.isSolaris()) {
+           String name = System.getProperty("os.version");
+           if (name.equals("5.10")) {
+               System.out.println("Skipping test on Solaris 10");
+               return;
+           }
+      }
+      smallHeapTest();
+      smallHeapTestWith3G();
+      largeHeapTest();
+      largePagesTest();
+      sharingTest();
+  }
+}
--- a/jaxp/.hgtags	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/.hgtags	Wed Jul 05 19:21:26 2017 +0200
@@ -235,3 +235,4 @@
 17ee0d3e97fdb412e48f14d87f504946a708f846 jdk8-b111
 c1f9158fbb9c2da50f6946fffd974e8236e08447 jdk8-b112
 0046d2278204b7eff76803fc4623cb48c7e6384d jdk8-b113
+1b1e12117fe2840e5d21ae9a4b309e4f981f3ea8 jdk8-b114
--- a/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java	Wed Jul 05 19:21:26 2017 +0200
@@ -188,6 +188,19 @@
             ORACLE_JAXP_PROPERTY_PREFIX + "xmlSecurityPropertyManager";
 
     /**
+     * Feature enableExtensionFunctions
+     */
+    public static final String ORACLE_ENABLE_EXTENSION_FUNCTION =
+            ORACLE_JAXP_PROPERTY_PREFIX + "enableExtensionFunctions";
+    public static final String SP_ORACLE_ENABLE_EXTENSION_FUNCTION = "javax.xml.enableExtensionFunctions";
+
+    /**
+     * Values for a feature
+     */
+    public static final String FEATURE_TRUE = "true";
+    public static final String FEATURE_FALSE = "false";
+
+    /**
      * Check if we're in jdk8 or above
      */
     public static final boolean IS_JDK8_OR_ABOVE = isJavaVersionAtLeast(8);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/FeatureManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 com.sun.org.apache.xalan.internal.utils;
+
+
+import com.sun.org.apache.xalan.internal.XalanConstants;
+
+/**
+ * This class manages security related properties
+ *
+ */
+public final class FeatureManager extends FeaturePropertyBase {
+
+    /**
+     * States of the settings of a property, in the order: default value, value
+     * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
+     * properties, and jaxp api properties
+     */
+    public static enum State {
+        //this order reflects the overriding order
+        DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY
+    }
+
+    /**
+     * Xalan Features
+     */
+    public static enum Feature {
+        ORACLE_ENABLE_EXTENSION_FUNCTION(XalanConstants.ORACLE_ENABLE_EXTENSION_FUNCTION,
+                "true");
+
+        final String name;
+        final String defaultValue;
+
+        Feature(String name, String value) {
+            this.name = name;
+            this.defaultValue = value;
+        }
+
+        public boolean equalsName(String propertyName) {
+            return (propertyName == null) ? false : name.equals(propertyName);
+        }
+
+        String defaultValue() {
+            return defaultValue;
+        }
+    }
+
+    /**
+     * Default constructor. Establishes default values
+     */
+    public FeatureManager() {
+        values = new String[Feature.values().length];
+        for (Feature feature : Feature.values()) {
+            values[feature.ordinal()] = feature.defaultValue();
+        }
+        //read system properties or jaxp.properties
+        readSystemProperties();
+    }
+
+
+    /**
+     * Check if the feature is enabled
+     * @param feature name of the feature
+     * @return true if enabled, false otherwise
+     */
+    public boolean isFeatureEnabled(Feature feature) {
+        return Boolean.parseBoolean(values[feature.ordinal()]);
+    }
+
+    /**
+     * Check if the feature is enabled
+     * @param propertyName name of the feature
+     * @return true if enabled, false otherwise
+     */
+    public boolean isFeatureEnabled(String propertyName) {
+        return Boolean.parseBoolean(values[getIndex(propertyName)]);
+    }
+
+    /**
+     * Get the index by property name
+     * @param propertyName property name
+     * @return the index of the property if found; return -1 if not
+     */
+    public int getIndex(String propertyName){
+        for (Feature feature : Feature.values()) {
+            if (feature.equalsName(propertyName)) {
+                return feature.ordinal();
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Read from system properties, or those in jaxp.properties
+     */
+    private void readSystemProperties() {
+        getSystemProperty(Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
+                XalanConstants.SP_ORACLE_ENABLE_EXTENSION_FUNCTION);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/FeaturePropertyBase.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 com.sun.org.apache.xalan.internal.utils;
+
+import com.sun.org.apache.xalan.internal.XalanConstants;
+
+/**
+ * This is the base class for features and properties
+ *
+ */
+public abstract class FeaturePropertyBase {
+
+    /**
+     * States of the settings of a property, in the order: default value, value
+     * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
+     * properties, and jaxp api properties
+     */
+    public static enum State {
+        //this order reflects the overriding order
+        DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY
+    }
+
+
+    /**
+     * Values of the properties as defined in enum Properties
+     */
+    String[] values = null;
+    /**
+     * States of the settings for each property in Properties above
+     */
+    State[] states = {State.DEFAULT, State.DEFAULT};
+
+
+    /**
+     * Set the value for a specific property.
+     *
+     * @param property the property
+     * @param state the state of the property
+     * @param value the value of the property
+     */
+    public void setValue(Enum property, State state, String value) {
+        //only update if it shall override
+        if (state.compareTo(states[property.ordinal()]) >= 0) {
+            values[property.ordinal()] = value;
+            states[property.ordinal()] = state;
+        }
+    }
+
+    /**
+     * Set the value of a property by its index
+     * @param index the index of the property
+     * @param state the state of the property
+     * @param value the value of the property
+     */
+    public void setValue(int index, State state, String value) {
+        //only update if it shall override
+        if (state.compareTo(states[index]) >= 0) {
+            values[index] = value;
+            states[index] = state;
+        }
+    }
+
+     /**
+     * Set value by property name and state
+     * @param propertyName property name
+     * @param state the state of the property
+     * @param value the value of the property
+     * @return true if the property is managed by the security property manager;
+     *         false if otherwise.
+     */
+    public boolean setValue(String propertyName, State state, Object value) {
+        int index = getIndex(propertyName);
+        if (index > -1) {
+            setValue(index, state, (String)value);
+            return true;
+        }
+        return false;
+    }
+
+     /**
+     * Set value by property name and state
+     * @param propertyName property name
+     * @param state the state of the property
+     * @param value the value of the property
+     * @return true if the property is managed by the security property manager;
+     *         false if otherwise.
+     */
+    public boolean setValue(String propertyName, State state, boolean value) {
+        int index = getIndex(propertyName);
+        if (index > -1) {
+            if (value) {
+                setValue(index, state, XalanConstants.FEATURE_TRUE);
+            } else {
+                setValue(index, state, XalanConstants.FEATURE_FALSE);
+            }
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Return the value of the specified property
+     *
+     * @param property the property
+     * @return the value of the property
+     */
+    public String getValue(Enum property) {
+        return values[property.ordinal()];
+    }
+
+    /**
+     * Return the value of the specified property
+     *
+     * @param property the property
+     * @return the value of the property
+     */
+    public String getValue(String property) {
+        int index = getIndex(property);
+        if (index > -1) {
+            return getValueByIndex(index);
+        }
+        return null;
+    }
+
+    /**
+     * Return the value of the specified property.
+     *
+     * @param propertyName the property name
+     * @return the value of the property as a string. If a property is managed
+     * by this manager, its value shall not be null.
+     */
+    public String getValueAsString(String propertyName) {
+        int index = getIndex(propertyName);
+        if (index > -1) {
+            return getValueByIndex(index);
+        }
+
+        return null;
+    }
+
+    /**
+     * Return the value of a property by its ordinal
+     * @param index the index of a property
+     * @return value of a property
+     */
+    public String getValueByIndex(int index) {
+        return values[index];
+    }
+
+    /**
+     * Get the index by property name
+     * @param propertyName property name
+     * @return the index of the property if found; return -1 if not
+     */
+    public abstract int getIndex(String propertyName);
+
+    public <E extends Enum<E>> int getIndex(Class<E> property, String propertyName) {
+        for (Enum<E> enumItem : property.getEnumConstants()) {
+            if (enumItem.toString().equals(propertyName)) {
+                //internally, ordinal is used as index
+                return enumItem.ordinal();
+            }
+        }
+        return -1;
+    };
+
+
+    /**
+     * Read from system properties, or those in jaxp.properties
+     *
+     * @param property the property
+     * @param systemProperty the name of the system property
+     */
+    void getSystemProperty(Enum property, String systemProperty) {
+        try {
+            String value = SecuritySupport.getSystemProperty(systemProperty);
+            if (value != null) {
+                values[property.ordinal()] = value;
+                states[property.ordinal()] = State.SYSTEMPROPERTY;
+                return;
+            }
+
+            value = SecuritySupport.readJAXPProperty(systemProperty);
+            if (value != null) {
+                values[property.ordinal()] = value;
+                states[property.ordinal()] = State.JAXPDOTPROPERTIES;
+            }
+        } catch (NumberFormatException e) {
+            //invalid setting ignored
+        }
+    }
+}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,42 +1,28 @@
 /*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
- * or packager/legal/LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at packager/legal/LICENSE.txt.
+ * This code is free software; you can redistribute 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.
  *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
+ * You should have received a copy of the GNU General Public License version
+ * 2 along 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.sun.org.apache.xalan.internal.utils;
 
 import com.sun.org.apache.xalan.internal.XalanConstants;
--- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,20 +33,10 @@
  * This class manages security related properties
  *
  */
-public final class XMLSecurityPropertyManager {
+public final class XMLSecurityPropertyManager extends FeaturePropertyBase {
 
     /**
-     * States of the settings of a property, in the order: default value, value
-     * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
-     * properties, and jaxp api properties
-     */
-    public static enum State {
-        //this order reflects the overriding order
-        DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY
-    }
-
-    /**
-     * Limits managed by the security manager
+     * Properties managed by the security property manager
      */
     public static enum Property {
         ACCESS_EXTERNAL_DTD(XMLConstants.ACCESS_EXTERNAL_DTD,
@@ -73,15 +63,6 @@
 
 
     /**
-     * Values of the properties as defined in enum Properties
-     */
-    private final String[] values;
-    /**
-     * States of the settings for each property in Properties above
-     */
-    private State[] states = {State.DEFAULT, State.DEFAULT};
-
-    /**
      * Default constructor. Establishes default values
      */
     public XMLSecurityPropertyManager() {
@@ -94,86 +75,6 @@
     }
 
     /**
-     * Set limit by property name and state
-     * @param propertyName property name
-     * @param state the state of the property
-     * @param value the value of the property
-     * @return true if the property is managed by the security property manager;
-     *         false if otherwise.
-     */
-    public boolean setValue(String propertyName, State state, Object value) {
-        int index = getIndex(propertyName);
-        if (index > -1) {
-            setValue(index, state, (String)value);
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Set the value for a specific property.
-     *
-     * @param property the property
-     * @param state the state of the property
-     * @param value the value of the property
-     */
-    public void setValue(Property property, State state, String value) {
-        //only update if it shall override
-        if (state.compareTo(states[property.ordinal()]) >= 0) {
-            values[property.ordinal()] = value;
-            states[property.ordinal()] = state;
-        }
-    }
-
-    /**
-     * Set the value of a property by its index
-     * @param index the index of the property
-     * @param state the state of the property
-     * @param value the value of the property
-     */
-    public void setValue(int index, State state, String value) {
-        //only update if it shall override
-        if (state.compareTo(states[index]) >= 0) {
-            values[index] = value;
-            states[index] = state;
-        }
-    }
-
-    /**
-     * Return the value of the specified property
-     *
-     * @param propertyName the property name
-     * @return the value of the property as a string
-     */
-    public String getValue(String propertyName) {
-        int index = getIndex(propertyName);
-        if (index > -1) {
-            return getValueByIndex(index);
-        }
-
-        return null;
-    }
-
-    /**
-     * Return the value of the specified property
-     *
-     * @param property the property
-     * @return the value of the property
-     */
-    public String getValue(Property property) {
-        return values[property.ordinal()];
-    }
-
-    /**
-     * Return the value of a property by its ordinal
-     * @param index the index of a property
-     * @return value of a property
-     */
-    public String getValueByIndex(int index) {
-        return values[index];
-    }
-
-    /**
      * Get the index by property name
      * @param propertyName property name
      * @return the index of the property if found; return -1 if not
@@ -198,28 +99,4 @@
                 XalanConstants.SP_ACCESS_EXTERNAL_STYLESHEET);
     }
 
-    /**
-     * Read from system properties, or those in jaxp.properties
-     *
-     * @param property the property
-     * @param systemProperty the name of the system property
-     */
-    private void getSystemProperty(Property property, String systemProperty) {
-        try {
-            String value = SecuritySupport.getSystemProperty(systemProperty);
-            if (value != null) {
-                values[property.ordinal()] = value;
-                states[property.ordinal()] = State.SYSTEMPROPERTY;
-                return;
-            }
-
-            value = SecuritySupport.readJAXPProperty(systemProperty);
-            if (value != null) {
-                values[property.ordinal()] = value;
-                states[property.ordinal()] = State.JAXPDOTPROPERTIES;
-            }
-        } catch (NumberFormatException e) {
-            //invalid setting ignored
-        }
-    }
 }
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java	Wed Jul 05 19:21:26 2017 +0200
@@ -23,6 +23,7 @@
 
 package com.sun.org.apache.xalan.internal.xsltc.cmdline;
 
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 import java.io.File;
 import java.net.URL;
 import java.util.Vector;
@@ -77,7 +78,7 @@
             final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhsinv");
             if (args.length < 1) printUsage();
 
-            final XSLTC xsltc = new XSLTC(true);
+            final XSLTC xsltc = new XSLTC(true, new FeatureManager());
             xsltc.init();
 
             int c;
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java	Wed Jul 05 19:21:26 2017 +0200
@@ -42,6 +42,7 @@
 import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
 import com.sun.org.apache.bcel.internal.generic.NEW;
 import com.sun.org.apache.bcel.internal.generic.PUSH;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.BooleanType;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
@@ -717,6 +718,8 @@
         final ConstantPoolGen cpg = classGen.getConstantPool();
         final InstructionList il = methodGen.getInstructionList();
         final boolean isSecureProcessing = classGen.getParser().getXSLTC().isSecureProcessing();
+        final boolean isExtensionFunctionEnabled = classGen.getParser().getXSLTC()
+                .getFeature(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION);
         int index;
 
         // Translate calls to methods in the BasisLibrary
@@ -760,7 +763,7 @@
             il.append(new INVOKESTATIC(index));
         }
         else if (_isExtConstructor) {
-            if (isSecureProcessing)
+            if (isSecureProcessing && !isExtensionFunctionEnabled)
                 translateUnallowedExtension(cpg, il);
 
             final String clazz =
@@ -822,7 +825,7 @@
         }
         // Invoke function calls that are handled in separate classes
         else {
-            if (isSecureProcessing)
+            if (isSecureProcessing && !isExtensionFunctionEnabled)
                 translateUnallowedExtension(cpg, il);
 
             final String clazz = _chosenMethod.getDeclaringClass().getName();
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java	Wed Jul 05 19:21:26 2017 +0200
@@ -43,6 +43,8 @@
 
 import com.sun.org.apache.bcel.internal.classfile.JavaClass;
 import com.sun.org.apache.xalan.internal.XalanConstants;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager.Feature;
 import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
@@ -148,11 +150,14 @@
 
     private XMLSecurityManager _xmlSecurityManager;
 
+    private final FeatureManager _featureManager;
+
     /**
      * XSLTC compiler constructor
      */
-    public XSLTC(boolean useServicesMechanism) {
+    public XSLTC(boolean useServicesMechanism, FeatureManager featureManager) {
         _parser = new Parser(this, useServicesMechanism);
+        _featureManager = featureManager;
     }
 
     /**
@@ -182,6 +187,15 @@
         _useServicesMechanism = flag;
     }
 
+     /**
+     * Return the value of the specified feature
+     * @param name name of the feature
+     * @return true if the feature is enabled, false otherwise
+     */
+    public boolean getFeature(Feature name) {
+        return _featureManager.isFeatureEnabled(name);
+    }
+
     /**
      * Return allowed protocols for accessing external stylesheet.
      */
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java	Wed Jul 05 19:21:26 2017 +0200
@@ -74,12 +74,12 @@
             DocumentBuilderFactory.newInstance();
     private boolean _internal = true;
 
-    public SAX2DOM(boolean useServicesMachnism) throws ParserConfigurationException {
-        _document = createDocument(useServicesMachnism);
+    public SAX2DOM(boolean useServicesMechanism) throws ParserConfigurationException {
+        _document = createDocument(useServicesMechanism);
         _root = _document;
     }
 
-    public SAX2DOM(Node root, Node nextSibling, boolean useServicesMachnism) throws ParserConfigurationException {
+    public SAX2DOM(Node root, Node nextSibling, boolean useServicesMechanism) throws ParserConfigurationException {
         _root = root;
         if (root instanceof Document) {
           _document = (Document)root;
@@ -88,15 +88,15 @@
           _document = root.getOwnerDocument();
         }
         else {
-          _document = createDocument(useServicesMachnism);
+          _document = createDocument(useServicesMechanism);
           _root = _document;
         }
 
         _nextSibling = nextSibling;
     }
 
-    public SAX2DOM(Node root, boolean useServicesMachnism) throws ParserConfigurationException {
-        this(root, null, useServicesMachnism);
+    public SAX2DOM(Node root, boolean useServicesMechanism) throws ParserConfigurationException {
+        this(root, null, useServicesMechanism);
     }
 
     public Node getDOM() {
@@ -308,18 +308,19 @@
     public void startDTD(String name, String publicId, String systemId)
         throws SAXException {}
 
-    private Document createDocument(boolean useServicesMachnism) throws ParserConfigurationException {
+    private Document createDocument(boolean useServicesMechanism) throws ParserConfigurationException {
         if (_factory == null) {
-            if (useServicesMachnism)
+            if (useServicesMechanism) {
                 _factory = DocumentBuilderFactory.newInstance();
                 if (!(_factory instanceof com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl)) {
                     _internal = false;
                 }
-            else
+            } else {
                 _factory = DocumentBuilderFactory.newInstance(
                   "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl",
                   SAX2DOM.class.getClassLoader()
                   );
+            }
         }
         Document doc;
         if (_internal) {
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -95,7 +95,7 @@
         _tfactory = tfactory;
 
         // Instantiate XSLTC and get reference to parser object
-        XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism());
+        XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism(), tfactory.getFeatureManager());
         if (tfactory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING))
             xsltc.setSecureProcessing(true);
 
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -25,12 +25,14 @@
 
 import com.sun.org.apache.xalan.internal.XalanConstants;
 import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
+import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
 import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
 import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property;
-import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.State;
+import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase.State;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader;
 import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
@@ -227,6 +229,8 @@
     private XMLSecurityPropertyManager _xmlSecurityPropertyMgr;
     private XMLSecurityManager _xmlSecurityManager;
 
+    private final FeatureManager _featureManager;
+
     /**
      * javax.xml.transform.sax.TransformerFactory implementation.
      */
@@ -240,10 +244,13 @@
 
     private TransformerFactoryImpl(boolean useServicesMechanism) {
         this._useServicesMechanism = useServicesMechanism;
+        _featureManager = new FeatureManager();
 
         if (System.getSecurityManager() != null) {
             _isSecureMode = true;
             _isNotSecureProcessing = false;
+            _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
+                    FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
         }
 
         _xmlSecurityPropertyMgr = new XMLSecurityPropertyManager();
@@ -504,6 +511,10 @@
                         Property.ACCESS_EXTERNAL_STYLESHEET);
             }
 
+            if (value && _featureManager != null) {
+                _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
+                        FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
+            }
             return;
         }
         else if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
@@ -512,6 +523,11 @@
                 _useServicesMechanism = value;
         }
         else {
+            if (_featureManager != null &&
+                    _featureManager.setValue(name, State.APIPROPERTY, value)) {
+                return;
+            }
+
             // unknown feature
             ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name);
             throw new TransformerConfigurationException(err.toString());
@@ -561,6 +577,13 @@
                 return !_isNotSecureProcessing;
         }
 
+        /** Check to see if the property is managed by the security manager **/
+        String propertyValue = (_featureManager != null) ?
+                _featureManager.getValueAsString(name) : null;
+        if (propertyValue != null) {
+            return Boolean.parseBoolean(propertyValue);
+        }
+
         // Feature not supported
         return false;
     }
@@ -571,6 +594,13 @@
         return _useServicesMechanism;
     }
 
+     /**
+     * @return the feature manager
+     */
+    public FeatureManager getFeatureManager() {
+        return _featureManager;
+    }
+
     /**
      * javax.xml.transform.sax.TransformerFactory implementation.
      * Get the object that is used by default during the transformation to
@@ -857,7 +887,7 @@
         }
 
         // Create and initialize a stylesheet compiler
-        final XSLTC xsltc = new XSLTC(_useServicesMechanism);
+        final XSLTC xsltc = new XSLTC(_useServicesMechanism, _featureManager);
         if (_debug) xsltc.setDebug(true);
         if (_enableInlining)
                 xsltc.setTemplateInlining(true);
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -569,32 +569,13 @@
 
         // xerces features
         fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true);
-
         fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null);
-        fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
-
-        fElementAttributeLimit = (fSecurityManager != null)?
-                fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT):0;
-
         fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false);
 
         Object resolver = componentManager.getProperty(ENTITY_RESOLVER, null);
         fExternalSubsetResolver = (resolver instanceof ExternalSubsetResolver) ?
                 (ExternalSubsetResolver) resolver : null;
 
-        // initialize vars
-        fMarkupDepth = 0;
-        fCurrentElement = null;
-        fElementStack.clear();
-        fHasExternalDTD = false;
-        fStandaloneSet = false;
-        fStandalone = false;
-        fInScanContent = false;
-        //skipping algorithm
-        fShouldSkip = false;
-        fAdd = false;
-        fSkip = false;
-
         //attribute
         fReadingAttributes = false;
         //xxx: external entities are supported in Xerces
@@ -606,9 +587,6 @@
         // setup Driver
         setScannerState(SCANNER_STATE_CONTENT);
         setDriver(fContentDriver);
-        fEntityStore = fEntityManager.getEntityStore();
-
-        dtdGrammarUtil = null;
 
         // JAXP 1.5 features and properties
         XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
@@ -617,6 +595,7 @@
 
         fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false);
 
+        resetCommon();
         //fEntityManager.test();
     } // reset(XMLComponentManager)
 
@@ -630,17 +609,7 @@
         fNamespaces = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue();
         fNotifyBuiltInRefs = false ;
 
-        // initialize vars
-        fMarkupDepth = 0;
-        fCurrentElement = null;
-        fShouldSkip = false;
-        fAdd = false;
-        fSkip = false;
-        fElementStack.clear();
         //fElementStack2.clear();
-        fHasExternalDTD = false;
-        fStandaloneSet = false;
-        fStandalone = false;
         //fReplaceEntityReferences = true;
         //fSupportExternalEntities = true;
         Boolean bo = (Boolean)propertyManager.getProperty(XMLInputFactoryImpl.IS_REPLACING_ENTITY_REFERENCES);
@@ -661,20 +630,43 @@
         //we dont need to do this -- nb.
         //setScannerState(SCANNER_STATE_CONTENT);
         //setDriver(fContentDriver);
-        fEntityStore = fEntityManager.getEntityStore();
         //fEntityManager.test();
 
-        dtdGrammarUtil = null;
-
          // JAXP 1.5 features and properties
         XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
                 propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER);
         fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
 
         fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(Constants.SECURITY_MANAGER);
-        fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
+        resetCommon();
     } // reset(XMLComponentManager)
 
+    void resetCommon() {
+        // initialize vars
+        fMarkupDepth = 0;
+        fCurrentElement = null;
+        fElementStack.clear();
+        fHasExternalDTD = false;
+        fStandaloneSet = false;
+        fStandalone = false;
+        fInScanContent = false;
+        //skipping algorithm
+        fShouldSkip = false;
+        fAdd = false;
+        fSkip = false;
+
+        fEntityStore = fEntityManager.getEntityStore();
+        dtdGrammarUtil = null;
+
+        if (fSecurityManager != null) {
+            fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
+            fElementAttributeLimit = fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT);
+        } else {
+            fLimitAnalyzer = null;
+            fElementAttributeLimit = 0;
+        }
+    }
+
     /**
      * Returns a list of feature identifiers that are recognized by
      * this component. This method may return null if no features
@@ -1328,7 +1320,7 @@
                         fAttributes.getLength() > fElementAttributeLimit){
                     fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                                                  "ElementAttributeLimit",
-                                                 new Object[]{rawname, new Integer(fAttributes.getLength()) },
+                                                 new Object[]{rawname, fElementAttributeLimit },
                                                  XMLErrorReporter.SEVERITY_FATAL_ERROR );
                 }
 
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -256,7 +256,7 @@
                         fAttributes.getLength() > fElementAttributeLimit){
                     fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                                                  "ElementAttributeLimit",
-                                                 new Object[]{rawname, new Integer(fAttributes.getLength()) },
+                                                 new Object[]{rawname, fElementAttributeLimit },
                                                  XMLErrorReporter.SEVERITY_FATAL_ERROR );
                 }
 
--- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java	Wed Jul 05 19:21:26 2017 +0200
@@ -211,7 +211,7 @@
         if (i > 0) {
             return uri.substring(i+1, uri.length());
         }
-        return "";
+        return uri;
     }
 
     /**
--- a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/JAXPExtensionsProvider.java	Wed Jul 05 19:21:26 2017 +0200
@@ -33,6 +33,7 @@
 import com.sun.org.apache.xpath.internal.objects.XNodeSet;
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
 import com.sun.org.apache.xalan.internal.res.XSLMessages;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 
 import com.sun.org.apache.xpath.internal.functions.FuncExtFunction;
 import java.util.Vector;
@@ -54,9 +55,12 @@
     }
 
     public JAXPExtensionsProvider(XPathFunctionResolver resolver,
-        boolean featureSecureProcessing ) {
+        boolean featureSecureProcessing, FeatureManager featureManager ) {
         this.resolver = resolver;
-        this.extensionInvocationDisabled = featureSecureProcessing;
+        if (featureSecureProcessing &&
+                !featureManager.isFeatureEnabled(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION)) {
+            this.extensionInvocationDisabled = true;
+        }
     }
 
     /**
--- a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathExpressionImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -30,6 +30,7 @@
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
 import com.sun.org.apache.xalan.internal.res.XSLMessages;
 import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
@@ -67,33 +68,36 @@
     private boolean featureSecureProcessing = false;
 
     private boolean useServicesMechanism = true;
+
+    private final FeatureManager featureManager;
+
     /** Protected constructor to prevent direct instantiation; use compile()
      * from the context.
      */
-    protected XPathExpressionImpl() { };
+    protected XPathExpressionImpl() {
+        this(null, null, null, null,
+             false, true, new FeatureManager());
+    };
 
     protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
             JAXPPrefixResolver prefixResolver,
             XPathFunctionResolver functionResolver,
             XPathVariableResolver variableResolver ) {
-        this.xpath = xpath;
-        this.prefixResolver = prefixResolver;
-        this.functionResolver = functionResolver;
-        this.variableResolver = variableResolver;
-        this.featureSecureProcessing = false;
+        this(xpath, prefixResolver, functionResolver, variableResolver,
+             false, true, new FeatureManager());
     };
 
     protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
-            JAXPPrefixResolver prefixResolver,
-            XPathFunctionResolver functionResolver,
-            XPathVariableResolver variableResolver,
-            boolean featureSecureProcessing, boolean useServicesMechanism ) {
+            JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
+            XPathVariableResolver variableResolver, boolean featureSecureProcessing,
+            boolean useServicesMechanism, FeatureManager featureManager ) {
         this.xpath = xpath;
         this.prefixResolver = prefixResolver;
         this.functionResolver = functionResolver;
         this.variableResolver = variableResolver;
         this.featureSecureProcessing = featureSecureProcessing;
         this.useServicesMechanism = useServicesMechanism;
+        this.featureManager = featureManager;
     };
 
     public void setXPath (com.sun.org.apache.xpath.internal.XPath xpath ) {
@@ -111,7 +115,7 @@
         com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
         if ( functionResolver != null ) {
             JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
-                    functionResolver, featureSecureProcessing );
+                    functionResolver, featureSecureProcessing, featureManager );
             xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
         } else {
             xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
--- a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -24,6 +24,8 @@
 import com.sun.org.apache.xalan.internal.XalanConstants;
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
 import com.sun.org.apache.xalan.internal.res.XSLMessages;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
+import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
 
 import javax.xml.XMLConstants;
 import javax.xml.xpath.XPathFactory;
@@ -68,6 +70,8 @@
 
         private boolean _useServicesMechanism = true;
 
+        private final FeatureManager _featureManager;
+
         public XPathFactoryImpl() {
             this(true);
         }
@@ -77,9 +81,12 @@
         }
 
         public XPathFactoryImpl(boolean useServicesMechanism) {
+            _featureManager = new FeatureManager();
             if (System.getSecurityManager() != null) {
                 _isSecureMode = true;
                 _isNotSecureProcessing = false;
+                _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
+                        FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
             }
             this._useServicesMechanism = useServicesMechanism;
         }
@@ -131,7 +138,8 @@
         public javax.xml.xpath.XPath newXPath() {
             return new com.sun.org.apache.xpath.internal.jaxp.XPathImpl(
                     xPathVariableResolver, xPathFunctionResolver,
-                    !_isNotSecureProcessing, _useServicesMechanism );
+                    !_isNotSecureProcessing, _useServicesMechanism,
+                    _featureManager );
         }
 
         /**
@@ -181,6 +189,10 @@
                 }
 
                 _isNotSecureProcessing = !value;
+                if (value && _featureManager != null) {
+                    _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
+                            FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
+                }
 
                 // all done processing feature
                 return;
@@ -192,6 +204,11 @@
                 return;
             }
 
+            if (_featureManager != null &&
+                    _featureManager.setValue(name, FeaturePropertyBase.State.APIPROPERTY, value)) {
+                return;
+            }
+
             // unknown feature
             String fmsg = XSLMessages.createXPATHMessage(
                     XPATHErrorResources.ER_FEATURE_UNKNOWN,
@@ -240,6 +257,14 @@
             if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
                 return _useServicesMechanism;
             }
+
+            /** Check to see if the property is managed by the security manager **/
+            String propertyValue = (_featureManager != null) ?
+                    _featureManager.getValueAsString(name) : null;
+            if (propertyValue != null) {
+                return _featureManager.isFeatureEnabled(name);
+            }
+
             // unknown feature
             String fmsg = XSLMessages.createXPATHMessage(
                     XPATHErrorResources.ER_GETTING_UNKNOWN_FEATURE,
--- a/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/jaxp/XPathImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -35,6 +35,7 @@
 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
 import com.sun.org.apache.xalan.internal.res.XSLMessages;
 import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
+import com.sun.org.apache.xalan.internal.utils.FeatureManager;
 
 import org.w3c.dom.Node;
 import org.w3c.dom.Document;
@@ -70,18 +71,20 @@
     // extensions function need to throw XPathFunctionException
     private boolean featureSecureProcessing = false;
     private boolean useServiceMechanism = true;
+    private final FeatureManager featureManager;
 
     XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr ) {
-        this.origVariableResolver = this.variableResolver = vr;
-        this.origFunctionResolver = this.functionResolver = fr;
+        this(vr, fr, false, true, new FeatureManager());
     }
 
     XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr,
-            boolean featureSecureProcessing, boolean useServiceMechanism ) {
+            boolean featureSecureProcessing, boolean useServiceMechanism,
+            FeatureManager featureManager) {
         this.origVariableResolver = this.variableResolver = vr;
         this.origFunctionResolver = this.functionResolver = fr;
         this.featureSecureProcessing = featureSecureProcessing;
         this.useServiceMechanism = useServiceMechanism;
+        this.featureManager = featureManager;
     }
 
     /**
@@ -190,7 +193,7 @@
         com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
         if ( functionResolver != null ) {
             JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
-                    functionResolver, featureSecureProcessing );
+                    functionResolver, featureSecureProcessing, featureManager );
             xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
         } else {
             xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
@@ -391,7 +394,7 @@
             // Can have errorListener
             XPathExpressionImpl ximpl = new XPathExpressionImpl (xpath,
                     prefixResolver, functionResolver, variableResolver,
-                    featureSecureProcessing, useServiceMechanism );
+                    featureSecureProcessing, useServiceMechanism, featureManager );
             return ximpl;
         } catch ( javax.xml.transform.TransformerException te ) {
             throw new XPathExpressionException ( te ) ;
--- a/jaxws/.hgtags	Thu Oct 31 16:46:43 2013 -0700
+++ b/jaxws/.hgtags	Wed Jul 05 19:21:26 2017 +0200
@@ -235,3 +235,4 @@
 32edc7a2c86696dfcbdb6ffae641ff153f8e34bd jdk8-b111
 dbdd5c76250928582cb5342bcf7b299a6007d538 jdk8-b112
 9261f342aa73a79bbd1a817ae72fa72b15ef30bc jdk8-b113
+9ad289610fc6effe9076280b7920d0f16470709f jdk8-b114
--- a/jdk/.hgtags	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/.hgtags	Wed Jul 05 19:21:26 2017 +0200
@@ -235,3 +235,4 @@
 719befd87c7b96ae103c05730ca555227bfc0116 jdk8-b111
 f002f5f3a16cca62e139cb8eed05ffaeb373587d jdk8-b112
 5b4261b4b72af53e8e178933ef6bc6c7f8cdbc60 jdk8-b113
+f26a0c8071bde1e3b923713c75156e4a58955623 jdk8-b114
--- a/jdk/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/make/tools/src/build/tools/tzdb/TzdbZoneRulesCompiler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -618,6 +618,11 @@
         // remove ROC, which is not supported in j.u.tz
         builtZones.remove("ROC");
         links.remove("ROC");
+        // remove EST, HST and MST. They are supported via
+        // the short-id mapping
+        builtZones.remove("EST");
+        builtZones.remove("HST");
+        builtZones.remove("MST");
     }
 
     /**
--- a/jdk/makefiles/Setup.gmk	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/makefiles/Setup.gmk	Wed Jul 05 19:21:26 2017 +0200
@@ -27,7 +27,7 @@
 
 # To build with all warnings enabled, do the following:
 # make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
-JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,classfile,dep-ann,divzero,varargs -Werror
+JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,auxiliaryclass,classfile,dep-ann,divzero,empty,try,varargs -Werror
 
 # Any java code executed during a JDK build to build other parts of the JDK must be 
 # executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this 
--- a/jdk/makefiles/mapfiles/libjava/mapfile-vers	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/makefiles/mapfiles/libjava/mapfile-vers	Wed Jul 05 19:21:26 2017 +0200
@@ -267,7 +267,8 @@
 		Java_sun_misc_GC_maxObjectInspectionAge;
 		Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0;
 		Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
-		Java_sun_reflect_Reflection_getCallerClass;
+		Java_sun_reflect_Reflection_getCallerClass__;
+		Java_sun_reflect_Reflection_getCallerClass__I;
 		Java_sun_reflect_Reflection_getClassAccessFlags;
                 Java_sun_misc_Version_getJdkVersionInfo;
                 Java_sun_misc_Version_getJdkSpecialVersion;
--- a/jdk/makefiles/mapfiles/libjava/reorder-sparc	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/makefiles/mapfiles/libjava/reorder-sparc	Wed Jul 05 19:21:26 2017 +0200
@@ -27,7 +27,8 @@
 text: .text%Java_java_io_FileDescriptor_initIDs;
 text: .text%Java_java_io_FileOutputStream_initIDs;
 text: .text%Java_java_lang_System_setIn0;
-text: .text%Java_sun_reflect_Reflection_getCallerClass;
+text: .text%Java_sun_reflect_Reflection_getCallerClass__;
+text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
 text: .text%Java_java_lang_Class_forName0;
 text: .text%Java_java_lang_Object_getClass;
 text: .text%Java_sun_reflect_Reflection_getClassAccessFlags;
--- a/jdk/makefiles/mapfiles/libjava/reorder-sparcv9	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/makefiles/mapfiles/libjava/reorder-sparcv9	Wed Jul 05 19:21:26 2017 +0200
@@ -26,7 +26,8 @@
 text: .text%Java_java_io_FileDescriptor_initIDs;
 text: .text%Java_java_io_FileOutputStream_initIDs;
 text: .text%Java_java_lang_System_setIn0;
-text: .text%Java_sun_reflect_Reflection_getCallerClass;
+text: .text%Java_sun_reflect_Reflection_getCallerClass__;
+text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
 text: .text%Java_java_lang_Class_forName0;
 text: .text%Java_java_lang_String_intern;
 text: .text%Java_java_lang_Float_floatToIntBits;
--- a/jdk/makefiles/mapfiles/libjava/reorder-x86	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/makefiles/mapfiles/libjava/reorder-x86	Wed Jul 05 19:21:26 2017 +0200
@@ -28,7 +28,8 @@
 text: .text%Java_java_io_FileDescriptor_initIDs;
 text: .text%Java_java_io_FileOutputStream_initIDs;
 text: .text%Java_java_lang_System_setIn0;
-text: .text%Java_sun_reflect_Reflection_getCallerClass;
+text: .text%Java_sun_reflect_Reflection_getCallerClass__;
+text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
 text: .text%Java_java_lang_Class_forName0;
 text: .text%Java_java_lang_String_intern;
 text: .text%Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0;
--- a/jdk/src/macosx/bundle/JavaAppLauncher/src/JVMArgs.m	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/bundle/JavaAppLauncher/src/JVMArgs.m	Wed Jul 05 19:21:26 2017 +0200
@@ -163,7 +163,7 @@
     if ([[jvmInfo objectForKey:@"StartOnFirstThread"] boolValue]) {
         self.startOnFirstThread = YES;
     } else if ([[jvmInfo objectForKey:@"StartOnMainThread"] boolValue]) {
-        // for key compatability with the Apple JavaApplicationStub's 'Java' dictionary
+        // for key compatibility with the Apple JavaApplicationStub's 'Java' dictionary
         self.startOnFirstThread = YES;
     }
 
--- a/jdk/src/macosx/classes/com/apple/eawt/event/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/com/apple/eawt/event/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,7 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
+<title></title>
 </head>
 <body bgcolor="white">
 Classes for receiving gesture events.
--- a/jdk/src/macosx/classes/com/apple/eawt/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/com/apple/eawt/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,7 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
+<title></title>
 </head>
 <body bgcolor="white">
 Provides classes for integrating Java applications with the native application environment.
--- a/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -244,7 +244,7 @@
      * used for getting localized defaults.  Also initialize the default
      * locale used when no locale is passed into UIDefaults.get().  The
      * default locale should generally not be relied upon. It is here for
-     * compatability with releases prior to 1.4.
+     * compatibility with releases prior to 1.4.
      */
     private void initResourceBundle(final UIDefaults table) {
         table.setDefaultLocale(Locale.getDefault());
--- a/jdk/src/macosx/classes/com/apple/laf/AquaMenuPainter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaMenuPainter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -406,7 +406,7 @@
     }
 
     /** Draw a string with the graphics g at location (x,y) just like g.drawString() would.
-     *  The first occurence of underlineChar in text will be underlined. The matching is
+     *  The first occurrence of underlineChar in text will be underlined. The matching is
      *  not case sensitive.
      */
     public void drawString(final Graphics g, final JComponent c, final String text, final int underlinedChar, final int x, final int y, final boolean isEnabled, final boolean isSelected) {
--- a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -3514,7 +3514,7 @@
      * Instantiate it only within subclasses of BasicTabbedPaneUI.
      */
     public class PropertyChangeHandler implements PropertyChangeListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -3528,7 +3528,7 @@
      * Instantiate it only within subclasses of BasicTabbedPaneUI.
      */
     public class TabSelectionHandler implements ChangeListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -3542,7 +3542,7 @@
      * Instantiate it only within subclasses of BasicTabbedPaneUI.
      */
     public class MouseHandler extends MouseAdapter {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -3556,7 +3556,7 @@
      * Instantiate it only within subclasses of BasicTabbedPaneUI.
      */
     public class FocusHandler extends FocusAdapter {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
--- a/jdk/src/macosx/classes/com/apple/laf/AquaTreeUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaTreeUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -179,7 +179,7 @@
     }
 
     /**
-     * Paints the expand (toggle) part of a row. The reciever should NOT modify <code>clipBounds</code>, or
+     * Paints the expand (toggle) part of a row. The receiver should NOT modify <code>clipBounds</code>, or
      * <code>insets</code>.
      */
     protected void paintExpandControl(final Graphics g, final Rectangle clipBounds, final Insets insets, final Rectangle bounds, final TreePath path, final int row, final boolean isExpanded, final boolean hasBeenExpanded, final boolean isLeaf) {
--- a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java	Wed Jul 05 19:21:26 2017 +0200
@@ -93,9 +93,9 @@
         }
 
         if (fMenuItem instanceof JCheckBoxMenuItem) {
-            setState(((JCheckBoxMenuItem)fMenuItem).isSelected());
+            forceSetState(fMenuItem.isSelected());
         } else {
-            setState(fMenuItem.getModel().isSelected());
+            forceSetState(fMenuItem.getModel().isSelected());
         }
     }
 
@@ -196,10 +196,10 @@
 
             switch (e.getStateChange()) {
                 case ItemEvent.SELECTED:
-                    setState(true);
+                    forceSetState(true);
                     break;
                 case ItemEvent.DESELECTED:
-                    setState(false);
+                    forceSetState(false);
                     break;
             }
         }
@@ -210,4 +210,20 @@
             ((CCheckboxMenuItem)peer).setIsIndeterminate(indeterminate);
         }
     }
+
+    /*
+     * The CCheckboxMenuItem peer is calling setState unconditionally every time user clicks the menu
+     * However for Swing controls in the screen menu bar it is wrong - the state should be changed only
+     * in response to the ITEM_STATE_CHANGED event. So the setState is overridden to no-op and all the
+     * correct state changes are made with forceSetState
+     */
+
+    @Override
+    public synchronized void setState(boolean b) {
+        // No Op
+    }
+
+    private void forceSetState(boolean b) {
+        super.setState(b);
+    }
 }
--- a/jdk/src/macosx/classes/java/net/DefaultInterface.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/java/net/DefaultInterface.java	Wed Jul 05 19:21:26 2017 +0200
@@ -26,7 +26,7 @@
 package java.net;
 
 /**
- * Choose a network inteface to be the default for
+ * Choose a network interface to be the default for
  * outgoing IPv6 traffic that does not specify a scope_id (and which needs one).
  * We choose the first interface that is up and is (in order of preference):
  * 1. neither loopback nor point to point
--- a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java	Wed Jul 05 19:21:26 2017 +0200
@@ -122,7 +122,7 @@
     long user() { return user; }
     long host() { return host; }
 
-    // private contructor - use factory method getFile() instead
+    // private constructor - use factory method getFile() instead
     private MacOSXPreferencesFile(String newName, long newUser, long newHost)
     {
         appName = newName;
--- a/jdk/src/macosx/classes/sun/font/CFontManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/sun/font/CFontManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -342,7 +342,7 @@
 
     @Override
     public String getFontPath(boolean noType1Fonts) {
-        // In the case of the Cocoa toolkit, since we go through NSFont, we dont need to register /Library/Fonts
+        // In the case of the Cocoa toolkit, since we go through NSFont, we don't need to register /Library/Fonts
         Toolkit tk = Toolkit.getDefaultToolkit();
         if (tk instanceof HeadlessToolkit) {
             tk = ((HeadlessToolkit)tk).getUnderlyingToolkit();
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -56,15 +56,6 @@
 
     private final PlatformWindow platformWindow;
 
-    // Window bounds reported by the native system (as opposed to
-    // regular bounds inherited from LWComponentPeer which are
-    // requested by user and may haven't been applied yet because
-    // of asynchronous requests to the windowing system)
-    private int sysX;
-    private int sysY;
-    private int sysW;
-    private int sysH;
-
     private static final int MINIMUM_WIDTH = 1;
     private static final int MINIMUM_HEIGHT = 1;
 
@@ -320,10 +311,18 @@
         // Don't post ComponentMoved/Resized and Paint events
         // until we've got a notification from the delegate
         Rectangle cb = constrainBounds(x, y, w, h);
-        setBounds(cb.x, cb.y, cb.width, cb.height, op, false, false);
-        // Get updated bounds, so we don't have to handle 'op' here manually
-        Rectangle r = getBounds();
-        platformWindow.setBounds(r.x, r.y, r.width, r.height);
+
+        Rectangle newBounds = new Rectangle(getBounds());
+        if ((op & (SET_LOCATION | SET_BOUNDS)) != 0) {
+            newBounds.x = cb.x;
+            newBounds.y = cb.y;
+        }
+        if ((op & (SET_SIZE | SET_BOUNDS)) != 0) {
+            newBounds.width = cb.width;
+            newBounds.height = cb.height;
+        }
+        // Native system could constraint bounds, so the peer wold be updated in the callback
+        platformWindow.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height);
     }
 
     public Rectangle constrainBounds(Rectangle bounds) {
@@ -614,17 +613,10 @@
      */
     @Override
     public void notifyReshape(int x, int y, int w, int h) {
-        final boolean moved;
-        final boolean resized;
+        Rectangle oldBounds = getBounds();
         final boolean invalid = updateInsets(platformWindow.getInsets());
-        synchronized (getStateLock()) {
-            moved = (x != sysX) || (y != sysY);
-            resized = (w != sysW) || (h != sysH);
-            sysX = x;
-            sysY = y;
-            sysW = w;
-            sysH = h;
-        }
+        final boolean moved = (x != oldBounds.x) || (y != oldBounds.y);
+        final boolean resized = (w != oldBounds.width) || (h != oldBounds.height);
 
         // Check if anything changed
         if (!moved && !resized && !invalid) {
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java	Wed Jul 05 19:21:26 2017 +0200
@@ -620,8 +620,7 @@
                     retString[0] = new String(selectedText);
                 }}
             }, fAwtFocussedComponent);
-        } catch (InterruptedException ie) { ie.printStackTrace(); }
-        catch (InvocationTargetException ite) { ite.printStackTrace(); }
+        } catch (InvocationTargetException ite) { ite.printStackTrace(); }
 
         synchronized(retString) { return retString[0]; }
     }
@@ -669,8 +668,7 @@
 
                 }}
             }, fAwtFocussedComponent);
-        } catch (InterruptedException ie) { ie.printStackTrace(); }
-        catch (InvocationTargetException ite) { ite.printStackTrace(); }
+        } catch (InvocationTargetException ite) { ite.printStackTrace(); }
 
         synchronized(returnValue) { return returnValue; }
     }
@@ -695,8 +693,7 @@
                     returnValue[0] = fIMContext.getInsertPositionOffset();
                 }}
             }, fAwtFocussedComponent);
-        } catch (InterruptedException ie) { ie.printStackTrace(); }
-        catch (InvocationTargetException ite) { ite.printStackTrace(); }
+        } catch (InvocationTargetException ite) { ite.printStackTrace(); }
 
         returnValue[1] = fCurrentTextLength;
         synchronized(returnValue) { return returnValue; }
@@ -743,8 +740,7 @@
                     }
                 }}
             }, fAwtFocussedComponent);
-        } catch (InterruptedException ie) { ie.printStackTrace(); }
-        catch (InvocationTargetException ite) { ite.printStackTrace(); }
+        } catch (InvocationTargetException ite) { ite.printStackTrace(); }
 
         synchronized(rect) { return rect; }
     }
@@ -764,8 +760,7 @@
                     insertPositionOffset[0] = fIMContext.getInsertPositionOffset();
                 }}
             }, fAwtFocussedComponent);
-        } catch (InterruptedException ie) { ie.printStackTrace(); }
-        catch (InvocationTargetException ite) { ite.printStackTrace(); }
+        } catch (InvocationTargetException ite) { ite.printStackTrace(); }
 
         // This bit of gymnastics ensures that the returned location is within the composed text.
         // If it falls outside that region, the input method will commit the text, which is inconsistent with native
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformLWView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -54,14 +54,6 @@
     }
 
     @Override
-    public void enterFullScreenMode() {
-    }
-
-    @Override
-    public void exitFullScreenMode() {
-    }
-
-    @Override
     public SurfaceData replaceSurfaceData() {
         return null;
     }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -96,14 +96,6 @@
         return peer;
     }
 
-    public void enterFullScreenMode() {
-        CWrapper.NSView.enterFullScreenMode(ptr);
-    }
-
-    public void exitFullScreenMode() {
-        CWrapper.NSView.exitFullScreenMode(ptr);
-    }
-
     public void setToolTip(String msg) {
         CWrapper.NSView.setToolTip(ptr, msg);
     }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Jul 05 19:21:26 2017 +0200
@@ -63,6 +63,8 @@
     private static native void nativeSynthesizeMouseEnteredExitedEvents();
     private static native void nativeDispose(long nsWindowPtr);
     private static native CPlatformWindow nativeGetTopmostPlatformWindowUnderMouse();
+    private static native void nativeEnterFullScreenMode(long nsWindowPtr);
+    private static native void nativeExitFullScreenMode(long nsWindowPtr);
 
     // Loger to report issues happened during execution but that do not affect functionality
     private static final PlatformLogger logger = PlatformLogger.getLogger("sun.lwawt.macosx.CPlatformWindow");
@@ -230,7 +232,14 @@
         contentView.initialize(peer, responder);
 
         final long ownerPtr = owner != null ? owner.getNSWindowPtr() : 0L;
-        Rectangle bounds = _peer.constrainBounds(_target.getBounds());
+        Rectangle bounds;
+        if (!IS(DECORATED, styleBits)) {
+            // For undecorated frames the move/resize event does not come if the frame is centered on the screen
+            // so we need to set a stub location to force an initial move/resize. Real bounds would be set later.
+            bounds = new Rectangle(0, 0, 1, 1);
+        } else {
+            bounds = _peer.constrainBounds(_target.getBounds());
+        }
         final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(),
                 ownerPtr, styleBits, bounds.x, bounds.y, bounds.width, bounds.height);
         setPtr(nativeWindowPtr);
@@ -433,10 +442,7 @@
 
     @Override // PlatformWindow
     public Insets getInsets() {
-        if (!isFullScreenMode) {
-            return nativeGetNSWindowInsets(getNSWindowPtr());
-        }
-        return new Insets(0, 0, 0, 0);
+        return nativeGetNSWindowInsets(getNSWindowPtr());
     }
 
     @Override // PlatformWindow
@@ -538,6 +544,8 @@
         updateIconImages();
         updateFocusabilityForAutoRequestFocus(false);
 
+        boolean wasMaximized = isMaximized();
+
         // Actually show or hide the window
         LWWindowPeer blocker = (peer == null)? null : peer.getBlocker();
         if (blocker == null || !visible) {
@@ -571,16 +579,21 @@
         if (visible) {
             // Apply the extended state as expected in shared code
             if (target instanceof Frame) {
-                switch (((Frame)target).getExtendedState()) {
-                    case Frame.ICONIFIED:
-                        CWrapper.NSWindow.miniaturize(nsWindowPtr);
-                        break;
-                    case Frame.MAXIMIZED_BOTH:
-                        maximize();
-                        break;
-                    default: // NORMAL
-                        unmaximize(); // in case it was maximized, otherwise this is a no-op
-                        break;
+                if (!wasMaximized && isMaximized()) {
+                    // setVisible could have changed the native maximized state
+                    deliverZoom(true);
+                } else {
+                    switch (((Frame)target).getExtendedState()) {
+                        case Frame.ICONIFIED:
+                            CWrapper.NSWindow.miniaturize(nsWindowPtr);
+                            break;
+                        case Frame.MAXIMIZED_BOTH:
+                            maximize();
+                            break;
+                        default: // NORMAL
+                            unmaximize(); // in case it was maximized, otherwise this is a no-op
+                            break;
+                    }
                 }
             }
         }
@@ -750,18 +763,12 @@
     @Override
     public void enterFullScreenMode() {
         isFullScreenMode = true;
-        contentView.enterFullScreenMode();
-        // the move/size notification from the underlying system comes
-        // but it contains a bounds smaller than the whole screen
-        // and therefore we need to create the synthetic notifications
-        Rectangle screenBounds = getPeer().getGraphicsConfiguration().getBounds();
-        peer.notifyReshape(screenBounds.x, screenBounds.y, screenBounds.width,
-                           screenBounds.height);
+        nativeEnterFullScreenMode(getNSWindowPtr());
     }
 
     @Override
     public void exitFullScreenMode() {
-        contentView.exitFullScreenMode();
+        nativeExitFullScreenMode(getNSWindowPtr());
         isFullScreenMode = false;
     }
 
@@ -884,7 +891,7 @@
                         //Posting an empty to flush the EventQueue without blocking the main thread
                     }
                 }, target);
-            } catch (InterruptedException | InvocationTargetException e) {
+            } catch (InvocationTargetException e) {
                 e.printStackTrace();
             }
         }
@@ -919,13 +926,7 @@
 
     protected void deliverMoveResizeEvent(int x, int y, int width, int height,
                                         boolean byUser) {
-        // when the content view enters the full-screen mode, the native
-        // move/resize notifications contain a bounds smaller than
-        // the whole screen and therefore we ignore the native notifications
-        // and the content view itself creates correct synthetic notifications
-        if (isFullScreenMode) {
-            return;
-        }
+        checkZoom();
 
         final Rectangle oldB = nativeBounds;
         nativeBounds = new Rectangle(x, y, width, height);
@@ -957,6 +958,17 @@
         }
     }
 
+    private void checkZoom() {
+        if (target instanceof Frame && isVisible()) {
+            Frame targetFrame = (Frame)target;
+            if (targetFrame.getExtendedState() != Frame.MAXIMIZED_BOTH && isMaximized()) {
+                deliverZoom(true);
+            } else if (targetFrame.getExtendedState() == Frame.MAXIMIZED_BOTH && !isMaximized()) {
+                deliverZoom(false);
+            }
+        }
+    }
+
     private void deliverNCMouseDown() {
         if (peer != null) {
             peer.notifyNCMouseDown();
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Wed Jul 05 19:21:26 2017 +0200
@@ -233,6 +233,10 @@
 
 
         setAttributes(attributes);
+        // throw exception for invalid destination
+        if (destinationAttr != null) {
+            validateDestination(destinationAttr);
+        }
 
         /* Get the range of pages we are to print. If the
          * last page to print is unknown, then we print to
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java	Wed Jul 05 19:21:26 2017 +0200
@@ -97,6 +97,6 @@
                     setVisible(true);
                 }
             }, this);
-        } catch (InterruptedException | InvocationTargetException ex) {}
+        } catch (InvocationTargetException ex) {}
     }
 }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CWrapper.java	Wed Jul 05 19:21:26 2017 +0200
@@ -82,9 +82,6 @@
         public static native Rectangle2D frame(long view);
         public static native long window(long view);
 
-        public static native void enterFullScreenMode(long view);
-        public static native void exitFullScreenMode(long view);
-
         public static native void setHidden(long view, boolean hidden);
 
         public static native void setToolTip(long view, String msg);
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Wed Jul 05 19:21:26 2017 +0200
@@ -548,22 +548,18 @@
     // Any selector invoked using ThreadUtilities performOnMainThread will be processed in doAWTRunLoop
     // The InvocationEvent will call LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual runloop
     // Does not dispatch native events while in the loop
-    public static void invokeAndWait(Runnable event, Component component) throws InterruptedException, InvocationTargetException {
+    public static void invokeAndWait(Runnable runnable, Component component) throws InvocationTargetException {
         final long mediator = createAWTRunLoopMediator();
 
         InvocationEvent invocationEvent =
-                new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event) {
-                    @Override
-                    public void dispatch() {
-                        try {
-                            super.dispatch();
-                        } finally {
+                new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(),
+                        runnable,
+                        () -> {
                             if (mediator != 0) {
                                 stopAWTRunLoop(mediator);
                             }
-                        }
-                    }
-                };
+                        },
+                        true);
 
         if (component != null) {
             AppContext appContext = SunToolkit.targetToAppContext(component);
--- a/jdk/src/macosx/native/sun/awt/AWTView.m	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/native/sun/awt/AWTView.m	Wed Jul 05 19:21:26 2017 +0200
@@ -272,7 +272,6 @@
  */
 
 - (void) keyDown: (NSEvent *)event {
-
     fProcessingKeystroke = YES;
     fKeyEventsNeeded = YES;
 
@@ -308,6 +307,23 @@
 
 - (BOOL) performKeyEquivalent: (NSEvent *) event {
     [self deliverJavaKeyEventHelper: event];
+
+    // Workaround for 8020209: special case for "Cmd =" and "Cmd ." 
+    // because Cocoa calls performKeyEquivalent twice for these keystrokes  
+    NSUInteger modFlags = [event modifierFlags] & 
+        (NSCommandKeyMask | NSAlternateKeyMask | NSShiftKeyMask | NSControlKeyMask);
+    if (modFlags == NSCommandKeyMask) {
+        NSString *eventChars = [event charactersIgnoringModifiers];
+        if ([eventChars length] == 1) {
+            unichar ch = [eventChars characterAtIndex:0];
+            if (ch == '=' || ch == '.') {
+                [[NSApp mainMenu] performKeyEquivalent: event];
+                return YES;
+            }
+        }
+
+    }
+
     return NO;
 }
 
@@ -580,7 +596,7 @@
 
 // --- Services menu support for lightweights ---
 
-// finds the focused accessable element, and if it's a text element, obtains the text from it
+// finds the focused accessible element, and if it is a text element, obtains the text from it
 - (NSString *)accessibleSelectedText
 {
     id focused = [self accessibilityFocusedUIElement];
@@ -598,7 +614,7 @@
     return rtfdData;
 }
 
-// finds the focused accessable element, and if it's a text element, sets the text in it
+// finds the focused accessible element, and if it is a text element, sets the text in it
 - (BOOL)replaceAccessibleTextSelection:(NSString *)text
 {
     id focused = [self accessibilityFocusedUIElement];
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.h	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -45,6 +45,7 @@
     BOOL isEnabled;
     NSWindow *nsWindow;
     AWTWindow *ownerWindow;
+    jint preFullScreenLevel;
 }
 
 // An instance of either AWTWindow_Normal or AWTWindow_Panel
@@ -57,6 +58,7 @@
 @property (nonatomic) NSSize javaMaxSize;
 @property (nonatomic) jint styleBits;
 @property (nonatomic) BOOL isEnabled;
+@property (nonatomic) jint preFullScreenLevel;
 
 
 - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.m	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m	Wed Jul 05 19:21:26 2017 +0200
@@ -122,6 +122,7 @@
 @synthesize styleBits;
 @synthesize isEnabled;
 @synthesize ownerWindow;
+@synthesize preFullScreenLevel;
 
 - (void) updateMinMaxSize:(BOOL)resizable {
     if (resizable) {
@@ -501,20 +502,6 @@
     // window exposing in _setVisible:(BOOL)
 }
 
-- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)proposedFrame {
-AWT_ASSERT_APPKIT_THREAD;
-
-    [AWTToolkit eventCountPlusPlus];
-    JNIEnv *env = [ThreadUtilities getJNIEnv];
-    jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
-    if (platformWindow != NULL) {
-        static JNF_MEMBER_CACHE(jm_deliverZoom, jc_CPlatformWindow, "deliverZoom", "(Z)V");
-        JNFCallVoidMethod(env, platformWindow, jm_deliverZoom, ![window isZoomed]);
-        (*env)->DeleteLocalRef(env, platformWindow);
-    }
-    return YES;
-}
-
 - (void) _deliverIconify:(BOOL)iconify {
 AWT_ASSERT_APPKIT_THREAD;
 
@@ -1226,3 +1213,58 @@
 JNF_COCOA_EXIT(env);
 }
 
+JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeEnterFullScreenMode
+(JNIEnv *env, jclass clazz, jlong windowPtr)
+{
+JNF_COCOA_ENTER(env);
+
+    NSWindow *nsWindow = OBJC(windowPtr);
+    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
+        AWTWindow *window = (AWTWindow*)[nsWindow delegate];
+        NSNumber* screenID = [AWTWindow getNSWindowDisplayID_AppKitThread: nsWindow];
+        CGDirectDisplayID aID = [screenID intValue];
+
+        if (CGDisplayCapture(aID) == kCGErrorSuccess) {
+            // remove window decoration
+            NSUInteger styleMask = [AWTWindow styleMaskForStyleBits:window.styleBits];
+            [nsWindow setStyleMask:(styleMask & ~NSTitledWindowMask) | NSBorderlessWindowMask];
+
+            int shieldLevel = CGShieldingWindowLevel();
+            window.preFullScreenLevel = [nsWindow level];
+            [nsWindow setLevel: shieldLevel];
+
+            NSRect screenRect = [[nsWindow screen] frame];
+            [nsWindow setFrame:screenRect display:YES];
+        } else {
+            [JNFException raise:env as:kRuntimeException reason:"Failed to enter full screen."];            
+        }
+    }];
+
+JNF_COCOA_EXIT(env);
+}
+
+JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeExitFullScreenMode
+(JNIEnv *env, jclass clazz, jlong windowPtr)
+{
+JNF_COCOA_ENTER(env);
+
+    NSWindow *nsWindow = OBJC(windowPtr);
+    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
+        AWTWindow *window = (AWTWindow*)[nsWindow delegate];
+        NSNumber* screenID = [AWTWindow getNSWindowDisplayID_AppKitThread: nsWindow];
+        CGDirectDisplayID aID = [screenID intValue];
+
+        if (CGDisplayRelease(aID) == kCGErrorSuccess) {
+            NSUInteger styleMask = [AWTWindow styleMaskForStyleBits:window.styleBits];
+            [nsWindow setStyleMask:styleMask]; 
+            [nsWindow setLevel: window.preFullScreenLevel];
+
+            // GraphicsDevice takes care of restoring pre full screen bounds
+        } else {
+            [JNFException raise:env as:kRuntimeException reason:"Failed to exit full screen."];
+        }
+    }];
+
+JNF_COCOA_EXIT(env);
+}
+
--- a/jdk/src/macosx/native/sun/awt/CPrinterJob.m	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/native/sun/awt/CPrinterJob.m	Wed Jul 05 19:21:26 2017 +0200
@@ -359,7 +359,11 @@
     static JNF_CLASS_CACHE(jc_Pageable, "java/awt/print/Pageable");
     static JNF_MEMBER_CACHE(jm_getCopies, sjc_CPrinterJob, "getCopiesInt", "()I");
     static JNF_MEMBER_CACHE(jm_isCollated, sjc_CPrinterJob, "isCollated", "()Z");
+    static JNF_MEMBER_CACHE(jm_getFromPage, sjc_CPrinterJob, "getFromPageAttrib", "()I");
+    static JNF_MEMBER_CACHE(jm_getToPage, sjc_CPrinterJob, "getToPageAttrib", "()I");
+    static JNF_MEMBER_CACHE(jm_getSelectAttrib, sjc_CPrinterJob, "getSelectAttrib", "()I");
     static JNF_MEMBER_CACHE(jm_getNumberOfPages, jc_Pageable, "getNumberOfPages", "()I");
+    static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormatFromAttributes", "()Ljava/awt/print/PageFormat;");
 
     NSMutableDictionary* printingDictionary = [dst dictionary];
 
@@ -368,19 +372,35 @@
 
     jboolean collated = JNFCallBooleanMethod(env, srcPrinterJob, jm_isCollated); // AWT_THREADING Safe (known object)
     [printingDictionary setObject:[NSNumber numberWithBool:collated ? YES : NO] forKey:NSPrintMustCollate];
-
     jint jNumPages = JNFCallIntMethod(env, srcPageable, jm_getNumberOfPages); // AWT_THREADING Safe (!appKit)
     if (jNumPages != java_awt_print_Pageable_UNKNOWN_NUMBER_OF_PAGES)
     {
-        [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
+        jint selectID = JNFCallIntMethod(env, srcPrinterJob, jm_getSelectAttrib);
+        if (selectID ==0) {
+            [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
+        } else if (selectID == 2) {
+            // In Mac 10.7,  Print ALL is deselected if PrintSelection is YES whether
+            // NSPrintAllPages is YES or NO
+            [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
+            [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintSelectionOnly];
+        } else {
+            [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
+        }
 
-        [printingDictionary setObject:[NSNumber numberWithInteger:1] forKey:NSPrintFirstPage];
-        [printingDictionary setObject:[NSNumber numberWithInteger:jNumPages] forKey:NSPrintLastPage];
+        jint fromPage = JNFCallIntMethod(env, srcPrinterJob, jm_getFromPage);
+        jint toPage = JNFCallIntMethod(env, srcPrinterJob, jm_getToPage);
+        // setting fromPage and toPage will not be shown in the dialog if printing All pages
+        [printingDictionary setObject:[NSNumber numberWithInteger:fromPage] forKey:NSPrintFirstPage];
+        [printingDictionary setObject:[NSNumber numberWithInteger:toPage] forKey:NSPrintLastPage];
     }
     else
     {
         [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
     }
+    jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat); 
+    if (page != NULL) {
+        javaPageFormatToNSPrintInfo(env, NULL, page, dst);
+    }
 }
 
 /*
--- a/jdk/src/macosx/native/sun/awt/CTextPipe.m	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/native/sun/awt/CTextPipe.m	Wed Jul 05 19:21:26 2017 +0200
@@ -322,7 +322,7 @@
 
     Each stage of the pipeline is responsible for doing only one major thing, like allocating buffers,
     aquiring transform arrays from JNI, filling buffers, or striking glyphs. All resources or memory
-    aquired at a given stage, must be released in that stage. Any error that occurs (like a failed malloc)
+    acquired at a given stage, must be released in that stage. Any error that occurs (like a failed malloc)
     is to be handled in the stage it occurs in, and is to return immediatly after freeing it's resources.
 
 -----------------------------------*/
--- a/jdk/src/macosx/native/sun/awt/CWrapper.m	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/native/sun/awt/CWrapper.m	Wed Jul 05 19:21:26 2017 +0200
@@ -587,46 +587,6 @@
 
 /*
  * Class:     sun_lwawt_macosx_CWrapper$NSView
- * Method:    enterFullScreenMode
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL
-Java_sun_lwawt_macosx_CWrapper_00024NSView_enterFullScreenMode
-(JNIEnv *env, jclass cls, jlong viewPtr)
-{
-JNF_COCOA_ENTER(env);
-
-    NSView *view = (NSView *)jlong_to_ptr(viewPtr);
-    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
-        NSScreen *screen = [[view window] screen];
-        NSDictionary *opts = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], NSFullScreenModeAllScreens, nil];
-        [view enterFullScreenMode:screen withOptions:opts];
-    }];
-
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class:     sun_lwawt_macosx_CWrapper$NSView
- * Method:    exitFullScreenMode
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL
-Java_sun_lwawt_macosx_CWrapper_00024NSView_exitFullScreenMode
-(JNIEnv *env, jclass cls, jlong viewPtr)
-{
-JNF_COCOA_ENTER(env);
-
-    NSView *view = (NSView *)jlong_to_ptr(viewPtr);
-    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
-        [view exitFullScreenModeWithOptions:nil];
-    }];
-
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class:     sun_lwawt_macosx_CWrapper$NSView
  * Method:    window
  * Signature: (J)J
  */
--- a/jdk/src/macosx/native/sun/awt/awt.m	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/native/sun/awt/awt.m	Wed Jul 05 19:21:26 2017 +0200
@@ -312,15 +312,17 @@
         if (verbose) AWT_DEBUG_LOG(@"got out of the AppKit startup mutex");
     }
 
-    // Don't set the delegate until the NSApplication has been created and
-    // its finishLaunching has initialized it.
-    //  ApplicationDelegate is the support code for com.apple.eawt.
-    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
-        id<NSApplicationDelegate> delegate = [ApplicationDelegate sharedDelegate];
-        if (delegate != nil) {
-            OSXAPP_SetApplicationDelegate(delegate);
-        }        
-    }];
+    if (!headless) {
+        // Don't set the delegate until the NSApplication has been created and
+        // its finishLaunching has initialized it.
+        //  ApplicationDelegate is the support code for com.apple.eawt.
+        [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
+            id<NSApplicationDelegate> delegate = [ApplicationDelegate sharedDelegate];
+            if (delegate != nil) {
+                OSXAPP_SetApplicationDelegate(delegate);
+            }        
+        }];
+    }
 }
 
 - (void)starter:(NSArray*)args {
--- a/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m	Wed Jul 05 19:21:26 2017 +0200
@@ -341,6 +341,10 @@
     if ([event type] == NSApplicationDefined && TS_EQUAL([event timestamp], dummyEventTimestamp)) {
         [seenDummyEventLock lockWhenCondition:NO];
         [seenDummyEventLock unlockWithCondition:YES];
+    } else if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask)) {
+        // Cocoa won't send us key up event when releasing a key while Cmd is down,
+        // so we have to do it ourselves.
+        [[self keyWindow] sendEvent:event];
     } else {
         [super sendEvent:event];
     }
--- a/jdk/src/share/back/ThreadGroupReferenceImpl.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/back/ThreadGroupReferenceImpl.c	Wed Jul 05 19:21:26 2017 +0200
@@ -47,7 +47,7 @@
 
         (void)memset(&info, 0, sizeof(info));
         threadGroupInfo(group, &info);
-        (void)outStream_writeString(out, info.name);
+        (void)outStream_writeString(out, info.name == NULL ? "" : info.name);
         if ( info.name != NULL )
             jvmtiDeallocate(info.name);
 
--- a/jdk/src/share/back/commonRef.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/back/commonRef.c	Wed Jul 05 19:21:26 2017 +0200
@@ -52,7 +52,7 @@
  * the number times an object has been referenced through
  * commonRef_refToID. A RefNode is freed once the reference
  * count is decremented to 0 (with commonRef_release*), even if the
- * correspoding object has not been collected.
+ * corresponding object has not been collected.
  *
  * One hash table is maintained. The mapping of ID to jobject (or RefNode*)
  * is handled with one hash table that will re-size itself as the number
--- a/jdk/src/share/back/eventFilter.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/back/eventFilter.c	Wed Jul 05 19:21:26 2017 +0200
@@ -644,7 +644,7 @@
 
             case JDWP_REQUEST_MODIFIER(Count): {
                 /*
-                 * If preceeding filters have determined that events will
+                 * If preceding filters have determined that events will
                  * be filtered out, that is fine and we won't get here.
                  * However, the count must be decremented - even if
                  * subsequent filters will filter these events.  We
--- a/jdk/src/share/back/outStream.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/back/outStream.c	Wed Jul 05 19:21:26 2017 +0200
@@ -298,17 +298,15 @@
 outStream_writeString(PacketOutputStream *stream, char *string)
 {
     jdwpError error;
-    jint      length;
+    jint      length = string != NULL ? (int)strlen(string) : 0;
 
     /* Options utf8=y/n controls if we want Standard UTF-8 or Modified */
     if ( gdata->modifiedUtf8 ) {
-        length = (int)strlen(string);
         (void)outStream_writeInt(stream, length);
         error = writeBytes(stream, (jbyte *)string, length);
     } else {
         jint      new_length;
 
-        length = (int)strlen(string);
         new_length = (gdata->npt->utf8mToUtf8sLength)
                             (gdata->npt->utf, (jbyte*)string, length);
         if ( new_length == length ) {
--- a/jdk/src/share/back/util.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/back/util.c	Wed Jul 05 19:21:26 2017 +0200
@@ -1092,7 +1092,7 @@
      * we don't want to consume it.  It came from
      * user code and is intended for user code, not us.
      * So, we will remember that the interrupt has
-     * occured and re-activate it when this thread
+     * occurred and re-activate it when this thread
      * goes back into user code.
      * That being said, what do we do here?  Since
      * we could have been notified too, here we will
--- a/jdk/src/share/classes/com/sun/beans/decoder/AccessorElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/AccessorElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -40,7 +40,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>name
      * <dd>the name of the accessible entity
--- a/jdk/src/share/classes/com/sun/beans/decoder/ArrayElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/ArrayElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -57,7 +57,7 @@
  *     &lt;int&gt;456&lt;/int&gt;
  * &lt;/array&gt;</pre>
  * is equivalent to {@code int[] array = {123, 456}} in Java code.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>length
  * <dd>the array length
@@ -76,7 +76,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>length
      * <dd>the array length
@@ -110,6 +110,20 @@
     }
 
     /**
+     * Tests whether the value of this element can be used
+     * as an argument of the element that contained in this one.
+     *
+     * @return {@code true} if the value of this element can be used
+     *         as an argument of the element that contained in this one,
+     *         {@code false} otherwise
+     */
+    @Override
+    protected boolean isArgument() {
+        return true; // hack for compatibility
+    }
+
+
+    /**
      * Creates an instance of the array.
      *
      * @param type  the base class
--- a/jdk/src/share/classes/com/sun/beans/decoder/BooleanElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/BooleanElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -37,7 +37,7 @@
  *     &lt;string&gt;true&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Boolean.valueOf("true")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/ByteElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/ByteElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -37,7 +37,7 @@
  *     &lt;string&gt;127&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Byte.decode("127")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/CharElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/CharElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -33,7 +33,7 @@
  * For example:<pre>
  * &lt;char&gt;X&lt;/char&gt;</pre>
  * which is equivalent to {@code Character.valueOf('X')} in Java code.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>code
  * <dd>this attribute specifies character code
@@ -52,7 +52,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>code
      * <dd>this attribute specifies character code
--- a/jdk/src/share/classes/com/sun/beans/decoder/ClassElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/ClassElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -36,7 +36,7 @@
  *     &lt;string&gt;java.lang.Class&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Class.forName("java.lang.Class")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/DoubleElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/DoubleElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -37,7 +37,7 @@
  *     &lt;string&gt;1.23e45&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Double.valueOf("1.23e45")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/ElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/ElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -126,7 +126,7 @@
 
     /**
      * Parses attributes of the element.
-     * By default, the following atribute is supported:
+     * By default, the following attribute is supported:
      * <dl>
      * <dt>id
      * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/FalseElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/FalseElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -31,7 +31,7 @@
  * For example:<pre>
  * &lt;false/&gt;</pre>
  * is equivalent to {@code false} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/FieldElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/FieldElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -43,7 +43,7 @@
  * For example:<pre>
  * &lt;field name="id"&gt;&lt;int&gt;0&lt;/int&gt;&lt;/field&gt;</pre>
  * is equivalent to {@code id = 0} in Java code.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>name
  * <dd>the field name
@@ -62,7 +62,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>name
      * <dd>the field name
--- a/jdk/src/share/classes/com/sun/beans/decoder/FloatElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/FloatElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -37,7 +37,7 @@
  *     &lt;string&gt;-1.23&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Float.valueOf("-1.23")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/IntElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/IntElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -37,7 +37,7 @@
  *     &lt;string&gt;-1&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Integer.decode("-1")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/JavaElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/JavaElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -32,7 +32,7 @@
  * is evaluated in the context of the decoder itself.
  * Typically this outer context is used to retrieve the owner of the decoder,
  * which can be set before reading the archive.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>version
  * <dd>the Java version (not supported)
@@ -54,7 +54,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>version
      * <dd>the Java version (not supported)
--- a/jdk/src/share/classes/com/sun/beans/decoder/LongElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/LongElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -37,7 +37,7 @@
  *     &lt;string&gt;0xFFFF&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Long.decode("0xFFFF")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/MethodElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/MethodElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -43,7 +43,7 @@
  *     &lt;string&gt;10&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * is equivalent to {@code Long.valueOf("10")} in Java code.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>name
  * <dd>the method name
@@ -62,7 +62,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>name
      * <dd>the method name
--- a/jdk/src/share/classes/com/sun/beans/decoder/NewElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/NewElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -43,7 +43,7 @@
  *     &lt;string&gt;10&lt;/string&gt;
  * &lt;/new&gt;</pre>
  * is equivalent to {@code new Long("10")} in Java code.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>class
  * <dd>the type of object for instantiation
@@ -63,7 +63,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>class
      * <dd>the type of object for instantiation
--- a/jdk/src/share/classes/com/sun/beans/decoder/NullElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/NullElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -31,7 +31,7 @@
  * For example:<pre>
  * &lt;null/&gt;</pre>
  * is equivalent to {@code null} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/ObjectElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/ObjectElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -33,7 +33,7 @@
  * This element looks like &lt;void&gt; element,
  * but its value is always used as an argument for element
  * that contains this one.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>class
  * <dd>the type is used for static methods and fields
@@ -64,7 +64,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>class
      * <dd>the type is used for static methods and fields
--- a/jdk/src/share/classes/com/sun/beans/decoder/PropertyElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/PropertyElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -63,7 +63,7 @@
  *     &lt;int&gt;0&lt;/int&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code set(0)} in Java code.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>name
  * <dd>the property name
@@ -85,7 +85,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>name
      * <dd>the property name
--- a/jdk/src/share/classes/com/sun/beans/decoder/ShortElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/ShortElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -37,7 +37,7 @@
  *     &lt;string&gt;200&lt;/string&gt;
  * &lt;/method&gt;</pre>
  * which is equivalent to {@code Short.decode("200")} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/StringElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/StringElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -40,7 +40,7 @@
  * &lt;string&gt;
  *     &lt;true&gt;
  * &lt;/string&gt;</pre>
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/TrueElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/TrueElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -31,7 +31,7 @@
  * For example:<pre>
  * &lt;true/&gt;</pre>
  * is equivalent to {@code true} in Java code.
- * <p>The following atribute is supported:
+ * <p>The following attribute is supported:
  * <dl>
  * <dt>id
  * <dd>the identifier of the variable that is intended to store the result
--- a/jdk/src/share/classes/com/sun/beans/decoder/VarElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/VarElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -30,7 +30,7 @@
  * For example:<pre>
  * &lt;var id="id1" idref="id2"/&gt;</pre>
  * is equivalent to {@code id1 = id2} in Java code.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>idref
  * <dd>the identifier to refer to the variable
@@ -47,7 +47,7 @@
 
     /**
      * Parses attributes of the element.
-     * The following atributes are supported:
+     * The following attributes are supported:
      * <dl>
      * <dt>idref
      * <dd>the identifier to refer to the variable
--- a/jdk/src/share/classes/com/sun/beans/decoder/VoidElementHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/beans/decoder/VoidElementHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -29,7 +29,7 @@
  * This element looks like &lt;object&gt; element,
  * but its value is not used as an argument for element
  * that contains this one.
- * <p>The following atributes are supported:
+ * <p>The following attributes are supported:
  * <dl>
  * <dt>class
  * <dd>the type is used for static methods and fields
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBECipherCore.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBECipherCore.java	Wed Jul 05 19:21:26 2017 +0200
@@ -408,7 +408,7 @@
      * no padding has been requested (only in encryption mode), and the total
      * input length of the data processed by this cipher is not a multiple of
      * block size
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     byte[] doFinal(byte[] input, int inputOffset, int inputLen)
@@ -448,7 +448,7 @@
      * block size
      * @exception ShortBufferException if the given output buffer is too small
      * to hold the result
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     int doFinal(byte[] input, int inputOffset, int inputLen,
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBES1Core.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBES1Core.java	Wed Jul 05 19:21:26 2017 +0200
@@ -408,7 +408,7 @@
      * no padding has been requested (only in encryption mode), and the total
      * input length of the data processed by this cipher is not a multiple of
      * block size
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     byte[] doFinal(byte[] input, int inputOffset, int inputLen)
@@ -448,7 +448,7 @@
      * block size
      * @exception ShortBufferException if the given output buffer is too small
      * to hold the result
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     int doFinal(byte[] input, int inputOffset, int inputLen,
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java	Wed Jul 05 19:21:26 2017 +0200
@@ -307,7 +307,7 @@
      * no padding has been requested (only in encryption mode), and the total
      * input length of the data processed by this cipher is not a multiple of
      * block size
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
@@ -348,7 +348,7 @@
      * block size
      * @exception ShortBufferException if the given output buffer is too small
      * to hold the result
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     protected int engineDoFinal(byte[] input, int inputOffset, int inputLen,
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java	Wed Jul 05 19:21:26 2017 +0200
@@ -317,7 +317,7 @@
      * no padding has been requested (only in encryption mode), and the total
      * input length of the data processed by this cipher is not a multiple of
      * block size
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
@@ -358,7 +358,7 @@
      * block size
      * @exception ShortBufferException if the given output buffer is too small
      * to hold the result
-     * @exception BadPaddingException if decrypting and padding is choosen,
+     * @exception BadPaddingException if decrypting and padding is chosen,
      * but the last input data does not have proper padding bytes.
      */
     protected int engineDoFinal(byte[] input, int inputOffset, int inputLen,
--- a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -187,15 +187,24 @@
         return 1;
     }
 
+    @Override
     public int getWidth(int imageIndex) throws IOException {
         checkIndex(imageIndex);
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
         return width;
     }
 
     public int getHeight(int imageIndex) throws IOException {
         checkIndex(imageIndex);
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
         return height;
     }
 
@@ -205,7 +214,18 @@
         }
     }
 
-    public void readHeader() throws IOException {
+    /**
+     * Process the image header.
+     *
+     * @exception IllegalStateException if source stream is not set.
+     *
+     * @exception IOException if image stream is corrupted.
+     *
+     * @exception IllegalArgumentException if the image stream does not contain
+     *             a BMP image, or if a sample model instance to describe the
+     *             image can not be created.
+     */
+    protected void readHeader() throws IOException, IllegalArgumentException {
         if (gotHeader)
             return;
 
@@ -307,6 +327,9 @@
                 case BI_RLE4:  // 4-bit RLE compression
 
                     // Read in the palette
+                    if (bitmapOffset < (size + 14)) {
+                        throw new IIOException(I18N.getString("BMPImageReader7"));
+                    }
                     int numberOfEntries = (int)((bitmapOffset-14-size) / 4);
                     int sizeOfPalette = numberOfEntries * 4;
                     palette = new byte[sizeOfPalette];
@@ -375,7 +398,7 @@
                     break;
                 default:
                     throw new
-                        RuntimeException(I18N.getString("BMPImageReader2"));
+                        IIOException(I18N.getString("BMPImageReader2"));
                 }
             } else if (size == 108 || size == 124) {
                 // Windows 4.x BMP
@@ -478,7 +501,7 @@
                 }
             } else {
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader3"));
+                    IIOException(I18N.getString("BMPImageReader3"));
             }
         }
 
@@ -660,7 +683,11 @@
     public Iterator getImageTypes(int imageIndex)
       throws IOException {
         checkIndex(imageIndex);
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
         ArrayList list = new ArrayList(1);
         list.add(new ImageTypeSpecifier(originalColorModel,
                                         originalSampleModel));
@@ -675,7 +702,11 @@
       throws IOException {
         checkIndex(imageIndex);
         if (metadata == null) {
-            readHeader();
+            try {
+                readHeader();
+            } catch (IllegalArgumentException e) {
+                throw new IIOException(I18N.getString("BMPImageReader6"), e);
+            }
         }
         return metadata;
     }
@@ -686,7 +717,11 @@
 
     public boolean isRandomAccessEasy(int imageIndex) throws IOException {
         checkIndex(imageIndex);
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
         return metadata.compression == BI_RGB;
     }
 
@@ -705,7 +740,11 @@
             param = getDefaultReadParam();
 
         //read header
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
 
         sourceRegion = new Rectangle(0, 0, 0, 0);
         destinationRegion = new Rectangle(0, 0, 0, 0);
@@ -817,7 +856,7 @@
 
             default:
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader1"));
+                    IIOException(I18N.getString("BMPImageReader1"));
             }
             break;
 
@@ -833,7 +872,7 @@
 
             default:
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader1"));
+                    IIOException(I18N.getString("BMPImageReader1"));
             }
 
             break;
@@ -874,7 +913,7 @@
 
             default:
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader1"));
+                    IIOException(I18N.getString("BMPImageReader1"));
             }
 
         case VERSION_4_8_BIT:
@@ -890,7 +929,7 @@
 
             default:
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader1"));
+                    IIOException(I18N.getString("BMPImageReader1"));
             }
             break;
 
--- a/jdk/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java	Wed Jul 05 19:21:26 2017 +0200
@@ -32,7 +32,7 @@
 
 public class StandardMetadataFormat extends IIOMetadataFormatImpl {
 
-    // Utility method for nodes with a single atttribute named "value"
+    // Utility method for nodes with a single attribute named "value"
     private void addSingleAttributeElement(String elementName,
                                            String parentName,
                                            int dataType) {
--- a/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -21,6 +21,8 @@
 BMPImageReader3=New BMP version not implemented yet.
 BMPImageReader4=No ImageIO-style reader is found for
 BMPImageReader5=Input has not been set.
+BMPImageReader6=Unable to read the image header.
+BMPImageReader7=Invalid bitmap offset.
 BMPImageWriter0=Output is not an ImageOutputStream.
 BMPImageWriter1=The image region to be encoded is empty.
 BMPImageWriter2=Only 1 or 3 band image is encoded.
@@ -34,7 +36,7 @@
 BMPMetadata1=Metadata is read-only.
 
 
-# WBMP plugin properties 
+# WBMP plugin properties
 WBMPImageReader0=Only one image exists in the stream.
 WBMPImageReader1=Input has not been set.
 WBMPImageReader2=Bad WBMP header.
--- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -115,6 +115,8 @@
     // The current interlace pass, starting with 0.
     int interlacePass = 0;
 
+    private byte[] fallbackColorTable = null;
+
     // End per-stream settings
 
     // Constants used to control interlacing.
@@ -239,10 +241,22 @@
         byte[] colorTable;
         if (imageMetadata.localColorTable != null) {
             colorTable = imageMetadata.localColorTable;
+            fallbackColorTable = imageMetadata.localColorTable;
         } else {
             colorTable = streamMetadata.globalColorTable;
         }
 
+        if (colorTable == null) {
+            if (fallbackColorTable == null) {
+                this.processWarningOccurred("Use default color table.");
+
+                // no color table, the spec allows to use any palette.
+                fallbackColorTable = getDefaultPalette();
+            }
+
+            colorTable = fallbackColorTable;
+        }
+
         // Normalize color table length to 2^1, 2^2, 2^4, or 2^8
         int length = colorTable.length/3;
         int bits;
@@ -1036,5 +1050,34 @@
         streamY = -1;
         rowsDone = 0;
         interlacePass = 0;
+
+        fallbackColorTable = null;
+    }
+
+    private static byte[] defaultPalette = null;
+
+    private static synchronized byte[] getDefaultPalette() {
+        if (defaultPalette == null) {
+            BufferedImage img = new BufferedImage(1, 1,
+                    BufferedImage.TYPE_BYTE_INDEXED);
+            IndexColorModel icm = (IndexColorModel) img.getColorModel();
+
+            final int size = icm.getMapSize();
+            byte[] r = new byte[size];
+            byte[] g = new byte[size];
+            byte[] b = new byte[size];
+            icm.getReds(r);
+            icm.getGreens(g);
+            icm.getBlues(b);
+
+            defaultPalette = new byte[size * 3];
+
+            for (int i = 0; i < size; i++) {
+                defaultPalette[3 * i + 0] = r[i];
+                defaultPalette[3 * i + 1] = g[i];
+                defaultPalette[3 * i + 2] = b[i];
+            }
+        }
+        return defaultPalette;
     }
 }
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1368,7 +1368,7 @@
     /**
      * An APP2 marker segment containing an ICC profile.  In the stream
      * a profile larger than 64K is broken up into a series of chunks.
-     * This inner class represents the complete profile as a single objec,
+     * This inner class represents the complete profile as a single object,
      * combining chunks as necessary.
      */
     class ICCMarkerSegment extends MarkerSegment {
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java	Wed Jul 05 19:21:26 2017 +0200
@@ -28,6 +28,7 @@
 import javax.imageio.metadata.IIOInvalidTreeException;
 import javax.imageio.metadata.IIOMetadataNode;
 import javax.imageio.stream.ImageOutputStream;
+import javax.imageio.IIOException;
 
 import java.io.IOException;
 
@@ -60,6 +61,10 @@
         length = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
         length |= buffer.buf[buffer.bufPtr++] & 0xff;
         length -= 2;  // JPEG length includes itself, we don't
+
+        if (length < 0) {
+            throw new IIOException("Invalid segment length: " + length);
+        }
         buffer.bufAvail -= 3;
         // Now that we know the true length, ensure that we've got it,
         // or at least a bufferful if length is too big.
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java	Wed Jul 05 19:21:26 2017 +0200
@@ -78,7 +78,7 @@
         numLines |= buffer.buf[buffer.bufPtr++] & 0xff;
         samplesPerLine = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
         samplesPerLine |= buffer.buf[buffer.bufPtr++] & 0xff;
-        int numComponents = buffer.buf[buffer.bufPtr++];
+        int numComponents = buffer.buf[buffer.bufPtr++] & 0xff;
         componentSpecs = new ComponentSpec [numComponents];
         for (int i = 0; i < numComponents; i++) {
             componentSpecs[i] = new ComponentSpec(buffer);
--- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -688,6 +688,21 @@
             loop: while (true) {
                 int chunkLength = stream.readInt();
                 int chunkType = stream.readInt();
+                int chunkCRC;
+
+                // verify the chunk length
+                if (chunkLength < 0) {
+                    throw new IIOException("Invalid chunk lenght " + chunkLength);
+                };
+
+                try {
+                    stream.mark();
+                    stream.seek(stream.getStreamPosition() + chunkLength);
+                    chunkCRC = stream.readInt();
+                    stream.reset();
+                } catch (IOException e) {
+                    throw new IIOException("Invalid chunk length " + chunkLength);
+                }
 
                 switch (chunkType) {
                 case IDAT_TYPE:
@@ -762,7 +777,11 @@
                     break;
                 }
 
-                int chunkCRC = stream.readInt();
+                // double check whether all chunk data were consumed
+                if (chunkCRC != stream.readInt()) {
+                    throw new IIOException("Failed to read a chunk of type " +
+                            chunkType);
+                }
                 stream.flushBefore(stream.getStreamPosition());
             }
         } catch (IOException e) {
@@ -1277,6 +1296,16 @@
             is = new BufferedInputStream(is);
             this.pixelStream = new DataInputStream(is);
 
+            /*
+             * NB: the PNG spec declares that valid range for width
+             * and height is [1, 2^31-1], so here we may fail to allocate
+             * a buffer for destination image due to memory limitation.
+             *
+             * However, the recovery strategy for this case should be
+             * defined on the level of application, so we will not
+             * try to estimate the required amount of the memory and/or
+             * handle OOM in any way.
+             */
             theImage = getDestination(param,
                                       getImageTypes(0),
                                       width,
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1041,7 +1041,7 @@
         }
 
         /**
-         * Rotates the triangle to accomodate the passed in hue.
+         * Rotates the triangle to accommodate the passed in hue.
          */
         private void setAngleFromHue(float hue) {
             setHueAngle((1.0 - hue) * Math.PI * 2);
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -304,7 +304,7 @@
         table.put("Synth.doNotSetTextAA", true);
 
         initResourceBundle(table);
-        // For compatability with apps expecting certain defaults we'll
+        // For compatibility with apps expecting certain defaults we'll
         // populate the table with the values from basic.
         initSystemColorDefaults(table);
         initComponentDefaults(table);
@@ -332,7 +332,7 @@
     }
 
     protected void initComponentDefaults(UIDefaults table) {
-        // For compatability with apps expecting certain defaults we'll
+        // For compatibility with apps expecting certain defaults we'll
         // populate the table with the values from basic.
         super.initComponentDefaults(table);
 
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Wed Jul 05 19:21:26 2017 +0200
@@ -131,7 +131,7 @@
      * Returns a <code>SynthPainter</code> that will route the appropriate
      * calls to a <code>GTKEngine</code>.
      *
-     * @param state SynthContext indentifying requestor
+     * @param state SynthContext identifying requestor
      * @return SynthPainter
      */
     @Override
@@ -204,7 +204,7 @@
     /**
      * Returns the color for the specified state.
      *
-     * @param context SynthContext identifying requester
+     * @param context SynthContext identifying requestor
      * @param state to get the color for
      * @param type of the color
      * @return Color to render with
@@ -305,7 +305,7 @@
      * insets will be placed in it, otherwise a new Insets object will be
      * created and returned.
      *
-     * @param context SynthContext indentifying requestor
+     * @param context SynthContext identifying requestor
      * @param insets Where to place Insets
      * @return Insets.
      */
@@ -640,7 +640,7 @@
     /**
      * Convenience method to get a class specific integer value.
      *
-     * @param context SynthContext indentifying requestor
+     * @param context SynthContext identifying requestor
      * @param key Key identifying class specific value
      * @param defaultValue Returned if there is no value for the specified
      *        type
@@ -660,7 +660,7 @@
     /**
      * Convenience method to get a class specific Insets value.
      *
-     * @param context SynthContext indentifying requestor
+     * @param context SynthContext identifying requestor
      * @param key Key identifying class specific value
      * @param defaultValue Returned if there is no value for the specified
      *        type
@@ -680,7 +680,7 @@
     /**
      * Convenience method to get a class specific Boolean value.
      *
-     * @param context SynthContext indentifying requestor
+     * @param context SynthContext identifying requestor
      * @param key Key identifying class specific value
      * @param defaultValue Returned if there is no value for the specified
      *        type
@@ -702,7 +702,7 @@
      * to. A Style should NOT assume the opacity will remain this value, the
      * developer may reset it or override it.
      *
-     * @param context SynthContext indentifying requestor
+     * @param context SynthContext identifying requestor
      * @return opaque Whether or not the JComponent is opaque.
      */
     @Override
@@ -843,7 +843,7 @@
 
         // Is it another kind of value ?
         if (key != "engine") {
-            // For backward compatability we'll fallback to the UIManager.
+            // For backward compatibility we'll fallback to the UIManager.
             // We don't go to the UIManager for engine as the engine is GTK
             // specific.
             Object value = UIManager.get(key);
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk_de.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -41,7 +41,7 @@
 FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
 FileChooser.pathLabel.textAndMnemonic=Aus&wahl:
 FileChooser.filterLabel.textAndMnemonic=Filter:
-FileChooser.foldersLabel.textAndMnemonic=Or&dner
+FileChooser.foldersLabel.textAndMnemonic=O&rdner
 FileChooser.filesLabel.textAndMnemonic=&Dateien
 
 FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java	Wed Jul 05 19:21:26 2017 +0200
@@ -86,19 +86,19 @@
 
     protected void assembleSystemMenu() {
         systemMenu = new JPopupMenu();
-        JMenuItem mi = systemMenu.add(new JMenuItem(restoreAction));
-        mi.setMnemonic('R');
-        mi = systemMenu.add(new JMenuItem(moveAction));
-        mi.setMnemonic('M');
-        mi = systemMenu.add(new JMenuItem(sizeAction));
-        mi.setMnemonic('S');
-        mi = systemMenu.add(new JMenuItem(iconifyAction));
-        mi.setMnemonic('n');
-        mi = systemMenu.add(new JMenuItem(maximizeAction));
-        mi.setMnemonic('x');
+        JMenuItem mi = systemMenu.add(restoreAction);
+        mi.setMnemonic(getButtonMnemonic("restore"));
+        mi = systemMenu.add(moveAction);
+        mi.setMnemonic(getButtonMnemonic("move"));
+        mi = systemMenu.add(sizeAction);
+        mi.setMnemonic(getButtonMnemonic("size"));
+        mi = systemMenu.add(iconifyAction);
+        mi.setMnemonic(getButtonMnemonic("minimize"));
+        mi = systemMenu.add(maximizeAction);
+        mi.setMnemonic(getButtonMnemonic("maximize"));
         systemMenu.add(new JSeparator());
-        mi = systemMenu.add(new JMenuItem(closeAction));
-        mi.setMnemonic('C');
+        mi = systemMenu.add(closeAction);
+        mi.setMnemonic(getButtonMnemonic("close"));
 
         systemButton = new SystemButton();
         systemButton.addActionListener(new ActionListener() {
@@ -124,6 +124,14 @@
         });
     }
 
+    private static int getButtonMnemonic(String button) {
+        try {
+            return Integer.parseInt(UIManager.getString(
+                    "InternalFrameTitlePane." + button + "Button.mnemonic"));
+        } catch (NumberFormatException e) {
+            return -1;
+        }
+    }
 
     protected void createButtons() {
         minimizeButton = new MinimizeButton();
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java	Wed Jul 05 19:21:26 2017 +0200
@@ -45,7 +45,7 @@
 
     /**
      * Renders a text String in Windows without the mnemonic.
-     * This is here because the WindowsUI hiearchy doesn't match the Component heirarchy. All
+     * This is here because the WindowsUI hierarchy doesn't match the Component hierarchy. All
      * the overriden paintText methods of the ButtonUI delegates will call this static method.
      * <p>
      * @param g Graphics context
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -174,7 +174,7 @@
             XPStyle xp = XPStyle.getXP();
             if (xp != null) {
                 Skin skin = xp.getSkin(c, part);
-                JButton b = (JButton)c;
+                AbstractButton b = (AbstractButton)c;
                 ButtonModel model = b.getModel();
 
                 // Find out if frame is inactive
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java	Wed Jul 05 19:21:26 2017 +0200
@@ -326,18 +326,27 @@
 
     protected void addSystemMenuItems(JPopupMenu menu) {
         JMenuItem mi = menu.add(restoreAction);
-        mi.setMnemonic('R');
+        mi.setMnemonic(getButtonMnemonic("restore"));
         mi = menu.add(moveAction);
-        mi.setMnemonic('M');
+        mi.setMnemonic(getButtonMnemonic("move"));
         mi = menu.add(sizeAction);
-        mi.setMnemonic('S');
+        mi.setMnemonic(getButtonMnemonic("size"));
         mi = menu.add(iconifyAction);
-        mi.setMnemonic('n');
+        mi.setMnemonic(getButtonMnemonic("minimize"));
         mi = menu.add(maximizeAction);
-        mi.setMnemonic('x');
-        systemPopupMenu.add(new JSeparator());
+        mi.setMnemonic(getButtonMnemonic("maximize"));
+        menu.add(new JSeparator());
         mi = menu.add(closeAction);
-        mi.setMnemonic('C');
+        mi.setMnemonic(getButtonMnemonic("close"));
+    }
+
+    private static int getButtonMnemonic(String button) {
+        try {
+            return Integer.parseInt(UIManager.getString(
+                    "InternalFrameTitlePane." + button + "Button.mnemonic"));
+        } catch (NumberFormatException e) {
+            return -1;
+        }
     }
 
     protected void showSystemMenu(){
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -2012,7 +2012,7 @@
      * results.
      * </p>
      *
-     * @param component Component the error occured in, may be
+     * @param component Component the error occurred in, may be
      *                  null indicating the error condition is
      *                  not directly associated with a
      *                  <code>Component</code>.
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -50,7 +50,7 @@
  * <li>The cursor blinks at about 1/2 second intervals.
  * <li>The entire value is selected when focus is gained.
  * <li>Shift-left-arrow and shift-right-arrow extend selection
- * <li>Cntrl-left-arrow and cntrl-right-arrow act like home and
+ * <li>Ctrl-left-arrow and ctrl-right-arrow act like home and
  *   end respectively.
  * </ul>
  * <p>
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -162,7 +162,7 @@
          *        necessarily the region to paint.
          * @param c the editor
          * @param view View painting for
-         * @return region drawing occured in
+         * @return region drawing occurred in
          */
         public Shape paintLayer(Graphics g, int offs0, int offs1,
                                 Shape bounds, JTextComponent c, View view) {
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java	Wed Jul 05 19:21:26 2017 +0200
@@ -190,7 +190,7 @@
 
         copyInOption(Utils.DEBUG_VERBOSE);
         copyInOption(Pack200.Unpacker.DEFLATE_HINT);
-        if (modtime == Constants.NO_MODTIME)  // Dont pass KEEP && NOW
+        if (modtime == Constants.NO_MODTIME)  // Don't pass KEEP && NOW
             copyInOption(Utils.UNPACK_MODIFICATION_TIME);
         updateProgress();  // reset progress bar
         for (;;) {
--- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -106,7 +106,7 @@
 
     Set<Entry>                       requiredEntries;  // for the CP
     Map<Attribute.Layout, int[]>     backCountTable;   // for layout callables
-    int[][]     attrCounts;       // count attr. occurences
+    int[][]     attrCounts;       // count attr. occurrences
 
     void setup() {
         requiredEntries = new HashSet<>();
--- a/jdk/src/share/classes/com/sun/jdi/connect/ListeningConnector.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/connect/ListeningConnector.java	Wed Jul 05 19:21:26 2017 +0200
@@ -70,7 +70,7 @@
      * method).
      * <p>
      * If <code>arguments</code> contains addressing information. and
-     * only one conection will be accepted, the {@link #accept accept} method
+     * only one connection will be accepted, the {@link #accept accept} method
      * can be called immediately without calling this method.
      *
      * @return the address at which the connector is listening
--- a/jdk/src/share/classes/com/sun/jdi/connect/spi/TransportService.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/connect/spi/TransportService.java	Wed Jul 05 19:21:26 2017 +0200
@@ -250,7 +250,7 @@
      *
      * @param   address
      *          The address to start listening for connections,
-     *          or <tt>null</tt> to listen on an address choosen
+     *          or <tt>null</tt> to listen on an address chosen
      *          by the transport service.
      *
      * @return  a listen key to be used in subsequent calls to be
@@ -266,7 +266,7 @@
     public abstract ListenKey startListening(String address) throws IOException;
 
     /**
-     * Listens on an address choosen by the transport service.
+     * Listens on an address chosen by the transport service.
      *
      * <p> This convenience method works as if by invoking {@link
      * #startListening(String) startListening(<tt>null</tt>)}. </p>
--- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1291,7 +1291,7 @@
              * ambiguous set.  If this set itself corresponds to a constructor,
              * there is no ambiguity for that pair.  In the usual case, one
              * of the constructors is a superset of the other so the union is
-             * just the bigger constuctor.
+             * just the bigger constructor.
              *
              * The algorithm here is quadratic in the number of constructors
              * with a @ConstructorProperties annotation.  Typically this corresponds
--- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java	Wed Jul 05 19:21:26 2017 +0200
@@ -644,7 +644,7 @@
         /**
          * Returns the list of "getter" methods for the given class. The list
          * is ordered so that isXXX methods appear before getXXX methods - this
-         * is for compatability with the JavaBeans Introspector.
+         * is for compatibility with the JavaBeans Introspector.
          */
         static List<Method> getReadMethods(Class<?> clazz) {
             // return cached result if available
@@ -682,7 +682,7 @@
          * {@code null} if no method is found.
          */
         static Method getReadMethod(Class<?> clazz, String property) {
-            // first character in uppercase (compatability with JavaBeans)
+            // first character in uppercase (compatibility with JavaBeans)
             property = property.substring(0, 1).toUpperCase(Locale.ENGLISH) +
                 property.substring(1);
             String getMethod = GET_METHOD_PREFIX + property;
--- a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java	Wed Jul 05 19:21:26 2017 +0200
@@ -35,7 +35,7 @@
     */
 
    /**
-    * Lexical error occured.
+    * Lexical error occurred.
     */
    static final int LEXICAL_ERROR = 0;
 
@@ -114,10 +114,10 @@
     * token manager to indicate a lexical error.
     * Parameters :
     *    EOFSeen     : indicates if EOF caused the lexicl error
-    *    curLexState : lexical state in which this error occured
-    *    errorLine   : line number when the error occured
-    *    errorColumn : column number when the error occured
-    *    errorAfter  : prefix that was seen before this error occured
+    *    curLexState : lexical state in which this error occurred
+    *    errorLine   : line number when the error occurred
+    *    errorColumn : column number when the error occurred
+    *    errorAfter  : prefix that was seen before this error occurred
     *    curchar     : the offending character
     * Note: You can customize the lexical error message by modifying this method.
     */
--- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpString.java	Wed Jul 05 19:21:26 2017 +0200
@@ -130,7 +130,7 @@
      * @return The value.
      */
     public byte[] byteValue() {
-        return value ;
+        return value.clone() ;
     }
 
     /**
--- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpErrorHandlerAgent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -70,7 +70,7 @@
      * @param server The MBean server to register the service with.
      * @param name The object name.
      *
-     * @return The passed name paramter.
+     * @return The passed name parameter.
      *
      * @exception java.lang.Exception
      */
@@ -99,7 +99,7 @@
      *
      * @param inRequest The SnmpMibRequest object holding the list of variable to be retrieved.
      *
-     * @exception SnmpStatusException An error occured during the operation.
+     * @exception SnmpStatusException An error occurred during the operation.
      */
 
     @Override
@@ -147,7 +147,7 @@
      *
      * @param inRequest The SnmpMibRequest object holding the list of variable to be set.
      *
-     * @exception SnmpStatusException An error occured during the operation.
+     * @exception SnmpStatusException An error occurred during the operation.
      */
 
     @Override
@@ -165,7 +165,7 @@
      *
      * @param inRequest The SnmpMibRequest object holding the list of variables to be retrieved.
      *
-     * @exception SnmpStatusException An error occured during the operation.
+     * @exception SnmpStatusException An error occurred during the operation.
      */
 
     @Override
@@ -190,7 +190,7 @@
      *
      * @param inRequest The SnmpMibRequest object holding the list of variable to be retrieved.
      *
-     * @exception SnmpStatusException An error occured during the operation.
+     * @exception SnmpStatusException An error occurred during the operation.
      */
 
     @Override
--- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMib.java	Wed Jul 05 19:21:26 2017 +0200
@@ -476,8 +476,7 @@
                 rootOid[i++]= val.longValue();
             }
         }
-        return rootOid;
-
+        return rootOid.clone();
     }
 
     // --------------------------------------------------------------------
--- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -127,7 +127,7 @@
      *            be retrieved. This list is composed of
      *            <CODE>SnmpVarBind</CODE> objects.
      *
-     * @exception SnmpStatusException An error occured during the operation.
+     * @exception SnmpStatusException An error occurred during the operation.
      */
     @Override
     public abstract void get(SnmpMibRequest req)
@@ -142,7 +142,7 @@
      *            OIDs from which the next variables should be retrieved.
      *            This list is composed of <CODE>SnmpVarBind</CODE> objects.
      *
-     * @exception SnmpStatusException An error occured during the operation.
+     * @exception SnmpStatusException An error occurred during the operation.
      */
     @Override
     public abstract void getNext(SnmpMibRequest req)
@@ -166,7 +166,7 @@
      *    following the first <CODE>nonRepeat</CODE> variables for which
      *    multiple lexicographic successors are requested.
      *
-     * @exception SnmpStatusException An error occured during the operation.
+     * @exception SnmpStatusException An error occurred during the operation.
      */
     @Override
     public abstract void getBulk(SnmpMibRequest req, int nonRepeat,
@@ -184,7 +184,7 @@
      *            be set. This list is composed of
      *            <CODE>SnmpVarBind</CODE> objects.
      *
-     * @exception SnmpStatusException An error occured during the operation.
+     * @exception SnmpStatusException An error occurred during the operation.
      *            Throwing an exception in this method will break the
      *            atomicity of the SET operation. Care must be taken so that
      *            the exception is thrown in the {@link #check(SnmpMibRequest)}
@@ -643,7 +643,7 @@
      *
      * @return The variable list containing returned values.
      *
-     * @exception SnmpStatusException An error occured during the operation.
+     * @exception SnmpStatusException An error occurred during the operation.
      */
     void getBulkWithGetNext(SnmpMibRequest req, int nonRepeat, int maxRepeat)
         throws SnmpStatusException {
--- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgentMBean.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibAgentMBean.java	Wed Jul 05 19:21:26 2017 +0200
@@ -62,7 +62,7 @@
      *            be retrieved. This list is composed of
      *            <CODE>SnmpVarBind</CODE> objects.
      *
-     * @exception SnmpStatusException An error occured during the operation.
+     * @exception SnmpStatusException An error occurred during the operation.
      * @see SnmpMibAgent#get(SnmpMibRequest)
      */
     public void get(SnmpMibRequest req) throws SnmpStatusException;
@@ -75,7 +75,7 @@
      *            be retrieved. This list is composed of
      *            <CODE>SnmpVarBind</CODE> objects.
      *
-     * @exception SnmpStatusException An error occured during the operation.
+     * @exception SnmpStatusException An error occurred during the operation.
      * @see SnmpMibAgent#getNext(SnmpMibRequest)
      */
     public void getNext(SnmpMibRequest req) throws SnmpStatusException;
@@ -97,7 +97,7 @@
      *    following the first <CODE>nonRepeat</CODE> variables for which
      *    multiple lexicographic successors are requested.
      *
-     * @exception SnmpStatusException An error occured during the operation.
+     * @exception SnmpStatusException An error occurred during the operation.
      * @see SnmpMibAgent#getBulk(SnmpMibRequest,int,int)
      */
     public void getBulk(SnmpMibRequest req, int nonRepeat, int maxRepeat)
@@ -111,7 +111,7 @@
      *            be set. This list is composed of
      *            <CODE>SnmpVarBind</CODE> objects.
      *
-     * @exception SnmpStatusException An error occured during the operation.
+     * @exception SnmpStatusException An error occurred during the operation.
      * @see SnmpMibAgent#set(SnmpMibRequest)
      */
     public void set(SnmpMibRequest req) throws SnmpStatusException;
--- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibGroup.java	Wed Jul 05 19:21:26 2017 +0200
@@ -119,7 +119,7 @@
     // needed...
     // For instance, the subclass could provide a generated isNestedArc()
     // method in which the subgroup OID arcs would be hardcoded.
-    // However, the generic approach was prefered because at this time
+    // However, the generic approach was preferred because at this time
     // groups and subgroups are dynamically registered in the MIB.
     //
     /**
--- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibTable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -435,7 +435,7 @@
      * If the entry is going to be registered, or if ObjectName's are
      * required, then
      * {@link com.sun.jmx.snmp.agent.SnmpMibTable#addEntry(SnmpOid,
-     * ObjectName, Object)} should be prefered.
+     * ObjectName, Object)} should be preferred.
      * <br> This function is mainly provided for backward compatibility.
      *
      * <p>
@@ -1088,7 +1088,7 @@
      * @return <code>true</code> if the row can be placed in
      *         <i>notInService</i> state.
      *
-     * @exception SnmpStatusException An error occured while trying
+     * @exception SnmpStatusException An error occurred while trying
      *            to retrieve the row status, and the operation should
      *            be aborted.
      *
@@ -2444,7 +2444,7 @@
                                                l1+1,l2);
 
             } else if (pos < tablecount) {
-                // Vector is large enough to accomodate one additional
+                // Vector is large enough to accommodate one additional
                 // entry.
                 //
                 // Shift vector, making an empty room at `pos'
--- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpRequestTree.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpRequestTree.java	Wed Jul 05 19:21:26 2017 +0200
@@ -581,7 +581,7 @@
 
 
             } else if (pos < entrycount) {
-                // Vectors are large enough to accomodate one additional
+                // Vectors are large enough to accommodate one additional
                 // entry.
                 //
                 // Shift vectors, making an empty room at `pos'
--- a/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpTableSupport.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpTableSupport.java	Wed Jul 05 19:21:26 2017 +0200
@@ -480,7 +480,7 @@
      * associated  SnmpIndex.
      * <p>
      * If the entry is going to be registered, then
-     * {@link com.sun.jmx.snmp.agent.SnmpTableSupport#addEntry(SnmpIndex, ObjectName, Object)} should be prefered.
+     * {@link com.sun.jmx.snmp.agent.SnmpTableSupport#addEntry(SnmpIndex, ObjectName, Object)} should be preferred.
      * <br> This function is mainly provided for backward compatibility.
      *
      * @param index The SnmpIndex built from the given entry.
--- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1248,7 +1248,7 @@
                      "of this CommunicatorServer instance has changed.");
         }
 
-        return notifInfos;
+        return notifInfos.clone();
     }
 
     /**
--- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServerMBean.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServerMBean.java	Wed Jul 05 19:21:26 2017 +0200
@@ -473,7 +473,7 @@
      * @param specific The specific number of the trap.
      * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
      *
-     * @exception IOException An I/O error occured while sending the trap.
+     * @exception IOException An I/O error occurred while sending the trap.
      * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>.
      */
     public void snmpV1Trap(int generic, int specific, SnmpVarBindList varBindList) throws IOException, SnmpStatusException;
@@ -563,7 +563,7 @@
      * @param trapOid The OID identifying the trap.
      * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
      *
-     * @exception IOException An I/O error occured while sending the trap.
+     * @exception IOException An I/O error occurred while sending the trap.
      * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>.
      */
     public void snmpV2Trap(SnmpOid trapOid, SnmpVarBindList varBindList) throws IOException, SnmpStatusException;
--- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpRequestHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -559,7 +559,7 @@
         //
         SnmpPduPacket result= executeSubRequest(req,userData);
         if (result != null)
-            // It means that an error occured. The error is already
+            // It means that an error occurred. The error is already
             // formatted by the executeSubRequest
             // method.
             return result;
--- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubBulkRequestHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubBulkRequestHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -52,7 +52,7 @@
     private SnmpAdaptorServer server = null;
 
     /**
-     * The constuctor initialize the subrequest with the whole varbind list contained
+     * The constructor initialize the subrequest with the whole varbind list contained
      * in the original request.
      */
     protected SnmpSubBulkRequestHandler(SnmpEngine engine,
@@ -68,7 +68,7 @@
     }
 
     /**
-     * The constuctor initialize the subrequest with the whole varbind list contained
+     * The constructor initialize the subrequest with the whole varbind list contained
      * in the original request.
      */
     protected SnmpSubBulkRequestHandler(SnmpAdaptorServer server,
--- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubNextRequestHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubNextRequestHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -55,7 +55,7 @@
 class SnmpSubNextRequestHandler extends SnmpSubRequestHandler {
     private SnmpAdaptorServer server = null;
     /**
-     * The constuctor initialize the subrequest with the whole varbind
+     * The constructor initialize the subrequest with the whole varbind
      * list contained in the original request.
      */
     protected SnmpSubNextRequestHandler(SnmpAdaptorServer server,
--- a/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubRequestHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jmx/snmp/daemon/SnmpSubRequestHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -99,7 +99,7 @@
     }
 
     /**
-     * SNMP V1/V2 The constuctor initialize the subrequest with the whole varbind list contained
+     * SNMP V1/V2 The constructor initialize the subrequest with the whole varbind list contained
      * in the original request.
      */
     @SuppressWarnings("unchecked")  // cast to NonSyncVector<SnmpVarBind>
--- a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java	Wed Jul 05 19:21:26 2017 +0200
@@ -568,7 +568,7 @@
             //System.err.println("ldap.abandon: " + ex);
         }
 
-        // Dont expect any response for the abandon request.
+        // Don't expect any response for the abandon request.
     }
 
     synchronized void abandonOutstandingReqs(Control[] reqCtls) {
@@ -623,7 +623,7 @@
             //System.err.println("ldap.unbind: " + ex);
         }
 
-        // Dont expect any response for the unbind request.
+        // Don't expect any response for the unbind request.
     }
 
     /**
--- a/jdk/src/share/classes/com/sun/jndi/ldap/Filter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/Filter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -191,7 +191,7 @@
 
     /**
      * convert character 'c' that represents a hexadecimal digit to an integer.
-     * if 'c' is not a hexidecimal digit [0-9A-Fa-f], -1 is returned.
+     * if 'c' is not a hexadecimal digit [0-9A-Fa-f], -1 is returned.
      * otherwise the converted value is returned.
      */
     private static int hexchar2int( byte c ) {
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapCtx.java	Wed Jul 05 19:21:26 2017 +0200
@@ -176,7 +176,7 @@
         "com.sun.jndi.ldap.netscape.schemaBugs";
     // deprecated
     private static final String OLD_NETSCAPE_SCHEMA_BUG =
-        "com.sun.naming.netscape.schemaBugs";   // for backward compatability
+        "com.sun.naming.netscape.schemaBugs";   // for backward compatibility
 
     // Timeout for socket connect
     private static final String CONNECT_TIMEOUT =
--- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapName.java	Wed Jul 05 19:21:26 2017 +0200
@@ -862,7 +862,7 @@
                 --end;
             }
 
-            // Add back the trailing whitespace with a preceeding '\'
+            // Add back the trailing whitespace with a preceding '\'
             // (escaped or unescaped) that was taken off in the above
             // loop. Whether or not to retain this whitespace is
             // decided below.
@@ -918,7 +918,7 @@
             }
 
             // Get rid of the unescaped trailing whitespace with the
-            // preceeding '\' character that was previously added back.
+            // preceding '\' character that was previously added back.
             int len = buf.length();
             if (isWhitespace(buf.charAt(len - 1)) && esc != (end - 1)) {
                 buf.setLength(len - 1);
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -109,7 +109,7 @@
 
     /**
      * A cheap way of getting the environment.
-     * Default implemenation is NOT cheap because it simply calls
+     * Default implementation is NOT cheap because it simply calls
      * getEnvironment(), which most implementations clone before returning.
      * Subclass should ALWAYS override this with the cheapest possible way.
      * The toolkit knows to clone when necessary.
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -82,7 +82,7 @@
             return ctx.listBindings("");
     }
 
-    // Subclass should overrride so that instance is of same type as subclass
+    // Subclass should override so that instance is of same type as subclass
     protected ContextEnumerator newEnumerator(Context ctx, int scope,
         String contextName, boolean returnSelf) throws NamingException {
             return new ContextEnumerator(ctx, scope, contextName, returnSelf);
--- a/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Wed Jul 05 19:21:26 2017 +0200
@@ -106,7 +106,7 @@
         return info;
     }
 
-    /** Open the device from an aplication program.
+    /** Open the device from an application program.
      * Setting the open reference count to -1 here prevents Transmitters and Receivers that
      * opened the the device implicitly from closing it. The only way to close the device after
      * this call is a call to close().
--- a/jdk/src/share/classes/com/sun/media/sound/AiffFileReader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AiffFileReader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -51,15 +51,6 @@
 
     private static final int MAX_READ_LENGTH = 8;
 
-    /**
-     * Constructs a new AiffParser object.
-     */
-    public AiffFileReader() {
-    }
-
-
-
-
     // METHODS TO IMPLEMENT AudioFileReader
 
     /**
@@ -292,9 +283,15 @@
                     throw new UnsupportedAudioFileException("Invalid AIFF/COMM chunksize");
                 }
                 // Read header info.
-                int channels = dis.readShort();
-                dis.readInt();
-                int sampleSizeInBits = dis.readShort();
+                int channels = dis.readUnsignedShort();
+                if (channels <= 0) {
+                    throw new UnsupportedAudioFileException("Invalid number of channels");
+                }
+                dis.readInt(); // numSampleFrames
+                int sampleSizeInBits = dis.readUnsignedShort();
+                if (sampleSizeInBits < 1 || sampleSizeInBits > 32) {
+                    throw new UnsupportedAudioFileException("Invalid AIFF/COMM sampleSize");
+                }
                 float sampleRate = (float) read_ieee_extended(dis);
                 chunkRead += (2 + 4 + 2 + 10);
 
@@ -438,7 +435,4 @@
 
         return f;
     }
-
-
-
 }
--- a/jdk/src/share/classes/com/sun/media/sound/AuFileReader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AuFileReader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -49,13 +49,6 @@
  */
 public final class AuFileReader extends SunFileReader {
 
-    /**
-     * Constructs a new AuFileReader object.
-     */
-    public AuFileReader() {
-    }
-
-
     // METHODS TO IMPLEMENT AudioFileReader
 
     /**
@@ -90,7 +83,7 @@
         int frameRate      = -1;
         int frameSize      = -1;
         int channels       = -1;
-        int sampleSizeInBits = 0;
+        final int sampleSizeInBits;
         int length = 0;
         int nread = 0;
         AudioFormat.Encoding encoding = null;
@@ -118,6 +111,10 @@
         encoding_local = (bigendian==true ? dis.readInt() : rllong(dis) );  nread += 4;
         sampleRate     = (bigendian==true ? dis.readInt() : rllong(dis) );  nread += 4;
         channels       = (bigendian==true ? dis.readInt() : rllong(dis) );  nread += 4;
+        if (channels <= 0) {
+            dis.reset();
+            throw new UnsupportedAudioFileException("Invalid number of channels");
+        }
 
         frameRate = sampleRate;
 
@@ -372,7 +369,4 @@
 
         return result;
     }
-
-
-
 }
--- a/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java	Wed Jul 05 19:21:26 2017 +0200
@@ -34,7 +34,7 @@
     /**
      * Constructs a <code>AudioSynthesizerPropertyInfo</code> object with a given
      * name and value. The <code>description</code> and <code>choices</code>
-     * are intialized by <code>null</code> values.
+     * are initialized by <code>null</code> values.
      *
      * @param name the name of the property
      * @param value the current value or class used for values.
--- a/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java	Wed Jul 05 19:21:26 2017 +0200
@@ -378,7 +378,7 @@
         protected final boolean isSource;         // true for SourceDataLine, false for TargetDataLine
         protected volatile long bytePosition;
         protected volatile boolean doIO = false;     // true in between start() and stop() calls
-        protected volatile boolean stoppedWritten = false; // true if a write occured in stopped state
+        protected volatile boolean stoppedWritten = false; // true if a write occurred in stopped state
         protected volatile boolean drained = false; // set to true when drain function returns, set to false in write()
         protected boolean monitoring = false;
 
@@ -642,7 +642,7 @@
         public void drain() {
             noService = true;
             // additional safeguard against draining forever
-            // this occured on Solaris 8 x86, probably due to a bug
+            // this occurred on Solaris 8 x86, probably due to a bug
             // in the audio driver
             int counter = 0;
             long startPos = getLongFramePosition();
--- a/jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftMixingSourceDataLine.java	Wed Jul 05 19:21:26 2017 +0200
@@ -37,7 +37,7 @@
 import javax.sound.sampled.SourceDataLine;
 
 /**
- * SourceDataLine implemention for the SoftMixingMixer.
+ * SourceDataLine implementation for the SoftMixingMixer.
  *
  * @author Karl Helgason
  */
--- a/jdk/src/share/classes/com/sun/media/sound/WaveFileReader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/media/sound/WaveFileReader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -53,13 +53,6 @@
     private static final int MAX_READ_LENGTH = 12;
 
     /**
-     * Constructs a new WaveFileReader object.
-     */
-    public WaveFileReader() {
-    }
-
-
-    /**
      * Obtains the audio file format of the input stream provided.  The stream must
      * point to valid audio file data.  In general, audio file providers may
      * need to read some data from the stream before determining whether they
@@ -304,6 +297,9 @@
         }
         // channels
         channels = rlshort(dis); nread += 2;
+        if (channels <= 0) {
+            throw new UnsupportedAudioFileException("Invalid number of channels");
+        }
 
         // sample rate.
         sampleRate = rllong(dis); nread += 4;
@@ -316,6 +312,9 @@
 
         // this is the PCM-specific value bitsPerSample
         sampleSizeInBits = (int)rlshort(dis); nread += 2;
+        if (sampleSizeInBits <= 0) {
+            throw new UnsupportedAudioFileException("Invalid bitsPerSample");
+        }
 
         // if sampleSizeInBits==8, we need to use PCM_UNSIGNED
         if ((sampleSizeInBits==8) && encoding.equals(AudioFormat.Encoding.PCM_SIGNED))
@@ -373,5 +372,4 @@
                                   format,
                                   dataLength / format.getFrameSize());
     }
-
 }
--- a/jdk/src/share/classes/com/sun/net/httpserver/Headers.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/net/httpserver/Headers.java	Wed Jul 05 19:21:26 2017 +0200
@@ -33,7 +33,7 @@
  * {@link java.lang.String},{@link java.util.List}&lt;{@link java.lang.String}&gt;&gt;.
  * The keys are case-insensitive Strings representing the header names and
  * the value associated with each key is a {@link List}&lt;{@link String}&gt; with one
- * element for each occurence of the header name in the request or response.
+ * element for each occurrence of the header name in the request or response.
  * <p>
  * For example, if a response header instance contains one key "HeaderName" with two values "value1 and value2"
  * then this object is output as two header lines:
--- a/jdk/src/share/classes/com/sun/net/httpserver/HttpExchange.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/net/httpserver/HttpExchange.java	Wed Jul 05 19:21:26 2017 +0200
@@ -170,7 +170,7 @@
      * then no response body is being sent.
      * <p>
      * If the content-length response header has not already been set then
-     * this is set to the apropriate value depending on the response length parameter.
+     * this is set to the appropriate value depending on the response length parameter.
      * <p>
      * This method must be called prior to calling {@link #getResponseBody()}.
      * @param rCode the response code to send
--- a/jdk/src/share/classes/com/sun/net/ssl/internal/ssl/Provider.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/net/ssl/internal/ssl/Provider.java	Wed Jul 05 19:21:26 2017 +0200
@@ -41,7 +41,7 @@
         super();
     }
 
-    // prefered constructor to enable FIPS mode at runtime
+    // preferred constructor to enable FIPS mode at runtime
     public Provider(java.security.Provider cryptoProvider) {
         super(cryptoProvider);
     }
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java	Wed Jul 05 19:21:26 2017 +0200
@@ -110,7 +110,7 @@
      * Returns an iterator over all the additional elements contained in the
      * <code>EncryptionMethod</code>.
      *
-     * @return an <code>Iterator</code> over all the additional infomation
+     * @return an <code>Iterator</code> over all the additional information
      *   about the <code>EncryptionMethod</code>.
      */
     Iterator<Element> getEncryptionMethodInformation();
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java	Wed Jul 05 19:21:26 2017 +0200
@@ -63,7 +63,7 @@
  *
  * This includes:
  *
- * Constuct a <CODE>ds:Reference</CODE> from an {@link org.w3c.dom.Element}.
+ * Constructs a <CODE>ds:Reference</CODE> from an {@link org.w3c.dom.Element}.
  *
  * <p>Create a new reference</p>
  * <pre>
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java	Wed Jul 05 19:21:26 2017 +0200
@@ -846,7 +846,7 @@
     }
 
     /**
-     * Signal wether Manifest should be automatically validated.
+     * Signal whether Manifest should be automatically validated.
      * Checking the digests in References in a Signature are mandatory, but for
      * References inside a Manifest it is application specific. This boolean is
      * to indicate that the References inside Manifests should be validated.
--- a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -41,7 +41,7 @@
 /**
  * The standard implementation of the <code>CachedRowSet</code> interface.
  *
- * See interface defintion for full behaviour and implementation requirements.
+ * See interface definition for full behavior and implementation requirements.
  * This reference implementation has made provision for a one-to-one write back
  * facility and it is curremtly be possible to change the peristence provider
  * during the life-time of any CachedRowSetImpl.
@@ -119,14 +119,14 @@
     private Vector<Object> rvh;
 
     /**
-     * The current postion of the cursor in this <code>CachedRowSetImpl</code>
+     * The current position of the cursor in this <code>CachedRowSetImpl</code>
      * object.
      * @serial
      */
     private int cursorPos;
 
     /**
-     * The current postion of the cursor in this <code>CachedRowSetImpl</code>
+     * The current position of the cursor in this <code>CachedRowSetImpl</code>
      * object not counting rows that have been deleted, if any.
      * <P>
      * For example, suppose that the cursor is on the last row of a rowset
@@ -236,7 +236,7 @@
     private int startPos;
 
     /**
-     * The integer value indicating the positon from where the page prior to this
+     * The integer value indicating the position from where the page prior to this
      * was populated.
      */
     private int startPrev;
@@ -3730,7 +3730,7 @@
 
         /*
          * Each call to internalPrevious may move the cursor
-         * over multiple rows, the absolute postion moves one one row
+         * over multiple rows, the absolute position moves one one row
          */
         if (ret == true)
             --absolutePos;
@@ -6265,7 +6265,7 @@
     /**
      * Returns a result set containing the original value of the rowset. The
      * original value is the state of the <code>CachedRowSetImpl</code> after the
-     * last population or synchronization (whichever occured most recently) with
+     * last population or synchronization (whichever occurred most recently) with
      * the data source.
      * <p>
      * The cursor is positioned before the first row in the result set.
@@ -6300,7 +6300,7 @@
      * Returns a result set containing the original value of the current
      * row only.
      * The original value is the state of the <code>CachedRowSetImpl</code> after
-     * the last population or synchronization (whichever occured most recently)
+     * the last population or synchronization (whichever occurred most recently)
      * with the data source.
      *
      * @return the original result set of the row
@@ -9061,7 +9061,7 @@
 
 
    /**
-  * Sets the designated paramter to the given <code>String</code> object.
+  * Sets the designated parameter to the given <code>String</code> object.
   * The driver converts this to a SQL <code>NCHAR</code> or
   * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value
   * (depending on the argument's
@@ -9081,7 +9081,7 @@
 
 
  /**
-  * Sets the designated paramter to the given <code>String</code> object.
+  * Sets the designated parameter to the given <code>String</code> object.
   * The driver converts this to a SQL <code>NCHAR</code> or
   * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code>
   * @param parameterName the name of the column to be set
@@ -9421,7 +9421,7 @@
     * if parameterIndex does not correspond
     * to a parameter marker in the SQL statement,  if the length specified
     * is less than zero or if the number of bytes in the inputstream does not match
-    * the specfied length.
+    * the specified length.
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
     *
     * @since 1.6
@@ -9481,7 +9481,7 @@
      * @throws SQLException  if parameterIndex does not correspond
      * to a parameter marker in the SQL statement,  or if the length specified
      * is less than zero; if the number of bytes in the inputstream does not match
-     * the specfied length; if a database access error occurs or
+     * the specified length; if a database access error occurs or
      * this method is called on a closed <code>CallableStatement</code>
      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
      * this method
--- a/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -39,7 +39,7 @@
 
 /**
  * The standard implementation of the <code>FilteredRowSet</code> interface. See the interface
- * defintion for full behaviour and implementation requirements.
+ * definition for full behavior and implementation requirements.
  *
  * @see javax.sql.rowset.Predicate
  * @author Jonathan Bruce, Amit Handa
--- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -36,7 +36,7 @@
 
 /**
  * The standard implementation of the <code>JdbcRowSet</code> interface. See the interface
- * defintion for full behavior and implementation requirements.
+ * definition for full behavior and implementation requirements.
  *
  * @author Jonathan Bruce, Amit Handa
  */
@@ -67,7 +67,7 @@
     private ResultSet rs;
 
     /**
-     * The <code>RowSetMetaDataImpl</code> object that is contructed when
+     * The <code>RowSetMetaDataImpl</code> object that is constructed when
      * a <code>ResultSet</code> object is passed to the <code>JdbcRowSet</code>
      * constructor. This helps in constructing all metadata associated
      * with the <code>ResultSet</code> object using the setter methods of
@@ -3152,7 +3152,7 @@
      * <code>DatabaseMetaData</code> method, this method returns
      * <code>null</code>.
      *
-     * @return the <code>Statment</code> object that produced
+     * @return the <code>Statement</code> object that produced
      * this rowset's <code>ResultSet</code> object or <code>null</code>
      * if the result set was produced some other way
      * @throws SQLException if a database access error occurs
@@ -4748,7 +4748,7 @@
 
 
    /**
-     * Sets the designated paramter to the given <code>String</code> object.
+     * Sets the designated parameter to the given <code>String</code> object.
      * The driver converts this to a SQL <code>NCHAR</code> or
      * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value
      * (depending on the argument's
@@ -5883,7 +5883,7 @@
 
 
  /**
-  * Sets the designated paramter to the given <code>String</code> object.
+  * Sets the designated parameter to the given <code>String</code> object.
   * The driver converts this to a SQL <code>NCHAR</code> or
   * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code>
   * @param parameterName the name of the column to be set
@@ -6222,7 +6222,7 @@
     * if parameterIndex does not correspond
     * to a parameter marker in the SQL statement,  if the length specified
     * is less than zero or if the number of bytes in the inputstream does not match
-    * the specfied length.
+    * the specified length.
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
     *
     * @since 1.6
@@ -6283,7 +6283,7 @@
       * @throws SQLException  if parameterIndex does not correspond
       * to a parameter marker in the SQL statement,  or if the length specified
       * is less than zero; if the number of bytes in the inputstream does not match
-      * the specfied length; if a database access error occurs or
+      * the specified length; if a database access error occurs or
       * this method is called on a closed <code>CallableStatement</code>
       * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
       * this method
--- a/jdk/src/share/classes/com/sun/rowset/WebRowSetImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/WebRowSetImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -42,7 +42,7 @@
 
 /**
  * The standard implementation of the <code>WebRowSet</code> interface. See the interface
- * defintion for full behaviour and implementation requirements.
+ * definition for full behavior and implementation requirements.
  *
  * @author Jonathan Bruce, Amit Handa
  */
--- a/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -4109,7 +4109,7 @@
     /**
      * Returns a result set containing the original value of the rowset. The
      * original value is the state of the <code>CachedRowSetImpl</code> after the
-     * last population or synchronization (whichever occured most recently) with
+     * last population or synchronization (whichever occurred most recently) with
      * the data source.
      * <p>
      * The cursor is positioned before the first row in the result set.
@@ -4128,7 +4128,7 @@
      * Returns a result set containing the original value of the current
      * row only.
      * The original value is the state of the <code>CachedRowSetImpl</code> after
-     * the last population or synchronization (whichever occured most recently)
+     * the last population or synchronization (whichever occurred most recently)
      * with the data source.
      *
      * @return the original result set of the row
--- a/jdk/src/share/classes/com/sun/rowset/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/rowset/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -74,7 +74,7 @@
 <h3>3.0 Extending the JDBC RowSet Implementations</h3>
 
 The JDBC <code>RowSet</code> reference implementations are provided as non-final
-classess so that any developer can extend them to provider additional features
+classes so that any developer can extend them to provide additional features
 while maintaining the core required standard functionality and compatibility. It
 is anticipated that many vendors and developers will extend the standard feature
 set to their their particular needs. The website for JDBC Technology will
--- a/jdk/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/security/auth/module/LdapLoginModule.java	Wed Jul 05 19:21:26 2017 +0200
@@ -153,7 +153,7 @@
  *      If the attribute cannot be found then the option is ignored.
  *      When this option is supplied and the user has been successfully
  *      authenticated then an additional {@link UserPrincipal}
- *      is created using the authorization identity and it is assocated with
+ *      is created using the authorization identity and it is associated with
  *      the current {@link Subject}. </dd>
  *
  * <dt> <code>useSSL</code> </dt>
--- a/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -62,7 +62,7 @@
   *      LMv2: NTLM v2, LM only
   *      NTLMv2: NTLM v2, NTLM only
   *    If not specified, use system property "ntlm.version". If also
-  *    not specfied, all versions are accepted.
+  *    not specified, all versions are accepted.
   *
   * com.sun.security.sasl.ntlm.domain
   *    String, the domain of the server, default is server name (fqdn parameter)
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -144,12 +144,12 @@
 InternalFrame.closeButtonToolTip=Close
 
 ############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=Restore
-InternalFrameTitlePane.moveButton.textAndMnemonic=Move
-InternalFrameTitlePane.sizeButton.textAndMnemonic=Size
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimize
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximize
-InternalFrameTitlePane.closeButton.textAndMnemonic=Close
+InternalFrameTitlePane.restoreButton.textAndMnemonic=&Restore
+InternalFrameTitlePane.moveButton.textAndMnemonic=&Move
+InternalFrameTitlePane.sizeButton.textAndMnemonic=&Size
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimize
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximize
+InternalFrameTitlePane.closeButton.textAndMnemonic=&Close
 
 ############ Text strings #############
 # Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -143,12 +143,12 @@
 InternalFrame.closeButtonToolTip=Schlie\u00DFen
 
 ############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=Wiederherstellen
-InternalFrameTitlePane.moveButton.textAndMnemonic=Verschieben
-InternalFrameTitlePane.sizeButton.textAndMnemonic=Gr\u00F6\u00DFe
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimieren
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximieren
-InternalFrameTitlePane.closeButton.textAndMnemonic=Schlie\u00DFen
+InternalFrameTitlePane.restoreButton.textAndMnemonic=Wiede&rherstellen
+InternalFrameTitlePane.moveButton.textAndMnemonic=Verschieben(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Gr\u00F6\u00DFe(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimieren
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximieren
+InternalFrameTitlePane.closeButton.textAndMnemonic=S&chlie\u00DFen
 
 ############ Text strings #############
 # Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -143,12 +143,12 @@
 InternalFrame.closeButtonToolTip=Cerrar
 
 ############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurar
-InternalFrameTitlePane.moveButton.textAndMnemonic=Mover
-InternalFrameTitlePane.sizeButton.textAndMnemonic=Tama\u00F1o
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimizar
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximizar
-InternalFrameTitlePane.closeButton.textAndMnemonic=Cerrar
+InternalFrameTitlePane.restoreButton.textAndMnemonic=&Restaurar
+InternalFrameTitlePane.moveButton.textAndMnemonic=&Mover
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Tama\u00F1o(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimizar
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximizar
+InternalFrameTitlePane.closeButton.textAndMnemonic=&Cerrar
 
 ############ Text strings #############
 # Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -143,12 +143,12 @@
 InternalFrame.closeButtonToolTip=Fermer
 
 ############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurer
-InternalFrameTitlePane.moveButton.textAndMnemonic=D\u00E9placer
-InternalFrameTitlePane.sizeButton.textAndMnemonic=Taille
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=R\u00E9duire
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=Agrandir
-InternalFrameTitlePane.closeButton.textAndMnemonic=Fermer
+InternalFrameTitlePane.restoreButton.textAndMnemonic=&Restaurer
+InternalFrameTitlePane.moveButton.textAndMnemonic=D\u00E9placer(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Taille(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=R\u00E9duire(&N)
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Agrandir(&X)
+InternalFrameTitlePane.closeButton.textAndMnemonic=Fermer(&C)
 
 ############ Text strings #############
 # Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -143,12 +143,12 @@
 InternalFrame.closeButtonToolTip=Chiudi
 
 ############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=Ripristina
-InternalFrameTitlePane.moveButton.textAndMnemonic=Sposta
-InternalFrameTitlePane.sizeButton.textAndMnemonic=Dimensioni
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=Riduci a icona
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ingrandisci
-InternalFrameTitlePane.closeButton.textAndMnemonic=Chiudi
+InternalFrameTitlePane.restoreButton.textAndMnemonic=&Ripristina
+InternalFrameTitlePane.moveButton.textAndMnemonic=Sposta(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Dimen&sioni
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Riduci a ico&na
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ingrandisci(&X)
+InternalFrameTitlePane.closeButton.textAndMnemonic=&Chiudi
 
 ############ Text strings #############
 # Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -143,12 +143,12 @@
 InternalFrame.closeButtonToolTip=\u9589\u3058\u308B
 
 ############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u5143
-InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5
-InternalFrameTitlePane.sizeButton.textAndMnemonic=\u30B5\u30A4\u30BA
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316
-InternalFrameTitlePane.closeButton.textAndMnemonic=\u9589\u3058\u308B
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u5143(&R)
+InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\u30B5\u30A4\u30BA(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316(&N)
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316(&X)
+InternalFrameTitlePane.closeButton.textAndMnemonic=\u9589\u3058\u308B(&C)
 
 ############ Text strings #############
 # Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -143,12 +143,12 @@
 InternalFrame.closeButtonToolTip=\uB2EB\uAE30
 
 ############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=\uBCF5\uC6D0
-InternalFrameTitlePane.moveButton.textAndMnemonic=\uC774\uB3D9
-InternalFrameTitlePane.sizeButton.textAndMnemonic=\uD06C\uAE30
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=\uCD5C\uC18C\uD654
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=\uCD5C\uB300\uD654
-InternalFrameTitlePane.closeButton.textAndMnemonic=\uB2EB\uAE30
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\uBCF5\uC6D0(&R)
+InternalFrameTitlePane.moveButton.textAndMnemonic=\uC774\uB3D9(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\uD06C\uAE30(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\uCD5C\uC18C\uD654(&N)
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\uCD5C\uB300\uD654(&X)
+InternalFrameTitlePane.closeButton.textAndMnemonic=\uB2EB\uAE30(&C)
 
 ############ Text strings #############
 # Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -143,12 +143,12 @@
 InternalFrame.closeButtonToolTip=Fechar
 
 ############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurar
-InternalFrameTitlePane.moveButton.textAndMnemonic=Mover
-InternalFrameTitlePane.sizeButton.textAndMnemonic=Tamanho
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimizar
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximizar
-InternalFrameTitlePane.closeButton.textAndMnemonic=Fechar
+InternalFrameTitlePane.restoreButton.textAndMnemonic=&Restaurar
+InternalFrameTitlePane.moveButton.textAndMnemonic=&Mover
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Tamanho(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimizar
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximizar
+InternalFrameTitlePane.closeButton.textAndMnemonic=Fe&char
 
 ############ Text strings #############
 # Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -143,12 +143,12 @@
 InternalFrame.closeButtonToolTip=St\u00E4ng
 
 ############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=\u00C5terst\u00E4ll
-InternalFrameTitlePane.moveButton.textAndMnemonic=Flytta
-InternalFrameTitlePane.sizeButton.textAndMnemonic=Storlek
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimera
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximera
-InternalFrameTitlePane.closeButton.textAndMnemonic=St\u00E4ng
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u00C5terst\u00E4ll(&R)
+InternalFrameTitlePane.moveButton.textAndMnemonic=Flytta(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=&Storlek
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimera
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximera
+InternalFrameTitlePane.closeButton.textAndMnemonic=St\u00E4ng(&C)
 
 ############ Text strings #############
 # Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -143,12 +143,12 @@
 InternalFrame.closeButtonToolTip=\u5173\u95ED
 
 ############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=\u8FD8\u539F
-InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52A8
-InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316
-InternalFrameTitlePane.closeButton.textAndMnemonic=\u5173\u95ED
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u8FD8\u539F(&R)
+InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52A8(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316(&N)
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316(&X)
+InternalFrameTitlePane.closeButton.textAndMnemonic=\u5173\u95ED(&C)
 
 ############ Text strings #############
 # Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -143,12 +143,12 @@
 InternalFrame.closeButtonToolTip=\u95DC\u9589
 
 ############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u539F
-InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5
-InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316
-InternalFrameTitlePane.closeButton.textAndMnemonic=\u95DC\u9589
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u539F(&R)
+InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316(&N)
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316(&X)
+InternalFrameTitlePane.closeButton.textAndMnemonic=\u95DC\u9589(&C)
 
 ############ Text strings #############
 # Used for html forms
--- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java	Wed Jul 05 19:21:26 2017 +0200
@@ -44,7 +44,7 @@
     private static final long serialVersionUID = -6236440836177601522L;
 
    /**
-    * Lexical error occured.
+    * Lexical error occurred.
     */
    static final int LEXICAL_ERROR = 0;
 
@@ -123,10 +123,10 @@
     * token manager to indicate a lexical error.
     * Parameters :
     *    EOFSeen     : indicates if EOF caused the lexicl error
-    *    curLexState : lexical state in which this error occured
-    *    errorLine   : line number when the error occured
-    *    errorColumn : column number when the error occured
-    *    errorAfter  : prefix that was seen before this error occured
+    *    curLexState : lexical state in which this error occurred
+    *    errorLine   : line number when the error occurred
+    *    errorColumn : column number when the error occurred
+    *    errorAfter  : prefix that was seen before this error occurred
     *    curchar     : the offending character
     * Note: You can customize the lexical error message by modifying this method.
     */
--- a/jdk/src/share/classes/com/sun/tools/hat/resources/hat.js	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/tools/hat/resources/hat.js	Wed Jul 05 19:21:26 2017 +0200
@@ -33,7 +33,7 @@
 
 /**
  * This is JavaScript interface for heap analysis using HAT
- * (Heap Analysis Tool). HAT classes are refered from
+ * (Heap Analysis Tool). HAT classes are referred from
  * this file. In particular, refer to classes in hat.model 
  * package.
  * 
--- a/jdk/src/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java	Wed Jul 05 19:21:26 2017 +0200
@@ -68,7 +68,7 @@
 
         transport = new Transport() {
             public String name() {
-                return "dt_socket";     // for compatability reasons
+                return "dt_socket";     // for compatibility reasons
             }
         };
 
--- a/jdk/src/share/classes/com/sun/tools/jdi/SocketListeningConnector.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/tools/jdi/SocketListeningConnector.java	Wed Jul 05 19:21:26 2017 +0200
@@ -58,7 +58,7 @@
 
         transport = new Transport() {
             public String name() {
-                return "dt_socket";     // for compatability reasons
+                return "dt_socket";     // for compatibility reasons
             }
         };
     }
--- a/jdk/src/share/classes/com/sun/tools/jdi/ThreadListener.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/tools/jdi/ThreadListener.java	Wed Jul 05 19:21:26 2017 +0200
@@ -31,7 +31,7 @@
 interface ThreadListener extends EventListener {
     boolean threadResumable(ThreadAction action);
     /*
-     * Not needed for current implemenation, and hard to implement
+     * Not needed for current implementation, and hard to implement
      * correctly. (See TargetVM.handleEventCmdSet)
      *   void threadSuspended(ThreadAction action);
      */
--- a/jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -62,7 +62,7 @@
 
     // This is cached only while this one thread is suspended.  Each time
     // the thread is resumed, we abandon the current cache object and
-    // create a new intialized one.
+    // create a new initialized one.
     private static class LocalCache {
         JDWP.ThreadReference.Status status = null;
         List<StackFrame> frames = null;
--- a/jdk/src/share/classes/java/awt/AWTEventMulticaster.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/AWTEventMulticaster.java	Wed Jul 05 19:21:26 2017 +0200
@@ -998,7 +998,7 @@
      * If a <code>null</code> listener is specified, this method returns an
      * empty array. If the specified listener is not an instance of
      * <code>AWTEventMulticaster</code>, this method returns an array which
-     * contains only the specified listener. If no such listeners are chanined,
+     * contains only the specified listener. If no such listeners are chained,
      * this method returns an empty array.
      *
      * @param l the specified <code>java.util.EventListener</code>
--- a/jdk/src/share/classes/java/awt/AlphaComposite.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/AlphaComposite.java	Wed Jul 05 19:21:26 2017 +0200
@@ -197,7 +197,7 @@
  * <h3>Performance Considerations</h3>
  *
  * <p>
- * For performance reasons, it is preferrable that
+ * For performance reasons, it is preferable that
  * <code>Raster</code> objects passed to the <code>compose</code>
  * method of a {@link CompositeContext} object created by the
  * <code>AlphaComposite</code> class have premultiplied data.
--- a/jdk/src/share/classes/java/awt/BasicStroke.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/BasicStroke.java	Wed Jul 05 19:21:26 2017 +0200
@@ -88,7 +88,7 @@
  * but also by the transform attribute of the
  * <code>Graphics2D</code> object.  Consider this code:
  * <blockquote><tt>
- *      // sets the Graphics2D object's Tranform attribute
+ *      // sets the Graphics2D object's Transform attribute
  *      g2d.scale(10, 10);
  *      // sets the Graphics2D object's Stroke attribute
  *      g2d.setStroke(new BasicStroke(1.5f));
--- a/jdk/src/share/classes/java/awt/BorderLayout.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/BorderLayout.java	Wed Jul 05 19:21:26 2017 +0200
@@ -69,7 +69,7 @@
  * components, the latter constants are preferred.
  * <p>
  * Mixing both absolute and relative positioning constants can lead to
- * unpredicable results.  If
+ * unpredictable results.  If
  * you use both types, the relative constants will take precedence.
  * For example, if you add components using both the <code>NORTH</code>
  * and <code>PAGE_START</code> constants in a container whose
@@ -206,7 +206,7 @@
      *
      * A relative positioning constant, that can be used instead of
      * north, south, east, west or center.
-     * mixing the two types of constants can lead to unpredicable results.  If
+     * mixing the two types of constants can lead to unpredictable results.  If
      * you use both types, the relative constants will take precedence.
      * For example, if you add components using both the <code>NORTH</code>
      * and <code>BEFORE_FIRST_LINE</code> constants in a container whose
--- a/jdk/src/share/classes/java/awt/CheckboxMenuItem.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/CheckboxMenuItem.java	Wed Jul 05 19:21:26 2017 +0200
@@ -180,7 +180,7 @@
     }
 
     /**
-     * Sets this check box menu item to the specifed state.
+     * Sets this check box menu item to the specified state.
      * The boolean value <code>true</code> indicates "on" while
      * <code>false</code> indicates "off."
      *
--- a/jdk/src/share/classes/java/awt/Choice.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/Choice.java	Wed Jul 05 19:21:26 2017 +0200
@@ -418,7 +418,7 @@
      * an <code>ItemEvent</code>.  The only way to trigger an
      * <code>ItemEvent</code> is by user interaction.
      *
-     * @param      pos      the positon of the selected item
+     * @param      pos      the position of the selected item
      * @exception  IllegalArgumentException if the specified
      *                            position is greater than the
      *                            number of items or less than zero
--- a/jdk/src/share/classes/java/awt/Component.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/Component.java	Wed Jul 05 19:21:26 2017 +0200
@@ -276,7 +276,7 @@
      * @see #getFont
      * @see #setFont
      */
-    Font        font;
+    volatile Font font;
 
     /**
      * The font which the peer is currently using.
@@ -1885,10 +1885,8 @@
     public void setFont(Font f) {
         Font oldFont, newFont;
         synchronized(getTreeLock()) {
-            synchronized (this) {
-                oldFont = font;
-                newFont = font = f;
-            }
+            oldFont = font;
+            newFont = font = f;
             ComponentPeer peer = this.peer;
             if (peer != null) {
                 f = getFont();
@@ -2684,7 +2682,7 @@
     }
 
     /**
-     * Gets the mininimum size of this component.
+     * Gets the minimum size of this component.
      * @return a dimension object indicating this component's minimum size
      * @see #getPreferredSize
      * @see LayoutManager
@@ -5254,7 +5252,7 @@
      * Returns an array of all the component listeners
      * registered on this component.
      *
-     * @return all of this comonent's <code>ComponentListener</code>s
+     * @return all <code>ComponentListener</code>s of this component
      *         or an empty array if no component
      *         listeners are currently registered
      *
--- a/jdk/src/share/classes/java/awt/Container.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/Container.java	Wed Jul 05 19:21:26 2017 +0200
@@ -959,7 +959,7 @@
      *
      * @param     comp the component to be added
      * @param     constraints an object expressing
-     *                  layout contraints for this component
+     *                  layout constraints for this component
      * @exception NullPointerException if {@code comp} is {@code null}
      * @see #addImpl
      * @see #invalidate
@@ -986,7 +986,7 @@
      *
      *
      * @param comp the component to be added
-     * @param constraints an object expressing layout contraints for this
+     * @param constraints an object expressing layout constraints for this
      * @param index the position in the container's list at which to insert
      * the component; <code>-1</code> means insert at the end
      * component
--- a/jdk/src/share/classes/java/awt/Dialog.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/Dialog.java	Wed Jul 05 19:21:26 2017 +0200
@@ -338,7 +338,7 @@
      *
      * @param owner the owner of the dialog or <code>null</code> if
      *     this dialog has no owner
-     * @param modal specifes whether dialog blocks user input to other top-level
+     * @param modal specifies whether dialog blocks user input to other top-level
      *     windows when shown. If <code>false</code>, the dialog is <code>MODELESS</code>;
      *     if <code>true</code>, the modality type property is set to
      *     <code>DEFAULT_MODALITY_TYPE</code>
@@ -387,7 +387,7 @@
      *     this dialog has no owner
      * @param title the title of the dialog or <code>null</code> if this dialog
      *     has no title
-     * @param modal specifes whether dialog blocks user input to other top-level
+     * @param modal specifies whether dialog blocks user input to other top-level
      *     windows when shown. If <code>false</code>, the dialog is <code>MODELESS</code>;
      *     if <code>true</code>, the modality type property is set to
      *     <code>DEFAULT_MODALITY_TYPE</code>
@@ -416,7 +416,7 @@
      *     has no owner
      * @param title the title of the dialog or <code>null</code> if this dialog
      *     has no title
-     * @param modal specifes whether dialog blocks user input to other top-level
+     * @param modal specifies whether dialog blocks user input to other top-level
      *     windows when shown. If <code>false</code>, the dialog is <code>MODELESS</code>;
      *     if <code>true</code>, the modality type property is set to
      *     <code>DEFAULT_MODALITY_TYPE</code>
@@ -488,7 +488,7 @@
      *     dialog has no owner
      * @param title the title of the dialog or <code>null</code> if this
      *     dialog has no title
-     * @param modal specifes whether dialog blocks user input to other top-level
+     * @param modal specifies whether dialog blocks user input to other top-level
      *     windows when shown. If <code>false</code>, the dialog is <code>MODELESS</code>;
      *     if <code>true</code>, the modality type property is set to
      *     <code>DEFAULT_MODALITY_TYPE</code>
@@ -519,7 +519,7 @@
      *     dialog has no owner
      * @param title the title of the dialog or <code>null</code> if this
      *     dialog has no title
-     * @param modal specifes whether dialog blocks user input to other top-level
+     * @param modal specifies whether dialog blocks user input to other top-level
      *     windows when shown. If <code>false</code>, the dialog is <code>MODELESS</code>;
      *     if <code>true</code>, the modality type property is set to
      *     <code>DEFAULT_MODALITY_TYPE</code>
@@ -764,7 +764,7 @@
     /**
      * Indicates whether the dialog is modal.
      * <p>
-     * This method is obsolete and is kept for backwards compatiblity only.
+     * This method is obsolete and is kept for backwards compatibility only.
      * Use {@link #getModalityType getModalityType()} instead.
      *
      * @return    <code>true</code> if this dialog window is modal;
--- a/jdk/src/share/classes/java/awt/Event.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/Event.java	Wed Jul 05 19:21:26 2017 +0200
@@ -29,14 +29,14 @@
 
 /**
  * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
- * available only for backwards compatilibility.  It has been replaced
+ * available only for backwards compatibility.  It has been replaced
  * by the <code>AWTEvent</code> class and its subclasses.
  * <p>
  * <code>Event</code> is a platform-independent class that
  * encapsulates events from the platform's Graphical User
  * Interface in the Java&nbsp;1.0 event model. In Java&nbsp;1.1
  * and later versions, the <code>Event</code> class is maintained
- * only for backwards compatibilty. The information in this
+ * only for backwards compatibility. The information in this
  * class description is provided to assist programmers in
  * converting Java&nbsp;1.0 programs to the new event model.
  * <p>
@@ -390,7 +390,7 @@
     /**
      * The user has moved the bubble (thumb) in a scroll bar,
      * moving to an "absolute" position, rather than to
-     * an offset from the last postion.
+     * an offset from the last position.
      */
     public static final int SCROLL_ABSOLUTE     = 5 + SCROLL_EVENT;
 
@@ -609,7 +609,7 @@
 
     /**
      * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
-     * available only for backwards compatilibility.  It has been replaced
+     * available only for backwards compatibility.  It has been replaced
      * by the <code>AWTEvent</code> class and its subclasses.
      * <p>
      * Creates an instance of <code>Event</code> with the specified target
@@ -660,7 +660,7 @@
 
     /**
      * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
-     * available only for backwards compatilibility.  It has been replaced
+     * available only for backwards compatibility.  It has been replaced
      * by the <code>AWTEvent</code> class and its subclasses.
      * <p>
      * Creates an instance of <code>Event</code>, with the specified target
@@ -681,7 +681,7 @@
 
     /**
      * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
-     * available only for backwards compatilibility.  It has been replaced
+     * available only for backwards compatibility.  It has been replaced
      * by the <code>AWTEvent</code> class and its subclasses.
      * <p>
      * Creates an instance of <code>Event</code> with the specified
@@ -696,7 +696,7 @@
 
     /**
      * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
-     * available only for backwards compatilibility.  It has been replaced
+     * available only for backwards compatibility.  It has been replaced
      * by the <code>AWTEvent</code> class and its subclasses.
      * <p>
      * Translates this event so that its <i>x</i> and <i>y</i>
@@ -717,7 +717,7 @@
 
     /**
      * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
-     * available only for backwards compatilibility.  It has been replaced
+     * available only for backwards compatibility.  It has been replaced
      * by the <code>AWTEvent</code> class and its subclasses.
      * <p>
      * Checks if the Shift key is down.
@@ -733,7 +733,7 @@
 
     /**
      * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
-     * available only for backwards compatilibility.  It has been replaced
+     * available only for backwards compatibility.  It has been replaced
      * by the <code>AWTEvent</code> class and its subclasses.
      * <p>
      * Checks if the Control key is down.
@@ -749,7 +749,7 @@
 
     /**
      * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
-     * available only for backwards compatilibility.  It has been replaced
+     * available only for backwards compatibility.  It has been replaced
      * by the <code>AWTEvent</code> class and its subclasses.
      * <p>
      * Checks if the Meta key is down.
@@ -766,7 +766,7 @@
 
     /**
      * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
-     * available only for backwards compatilibility.  It has been replaced
+     * available only for backwards compatibility.  It has been replaced
      * by the <code>AWTEvent</code> class and its subclasses.
      */
     void consume() {
@@ -784,7 +784,7 @@
 
     /**
      * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
-     * available only for backwards compatilibility.  It has been replaced
+     * available only for backwards compatibility.  It has been replaced
      * by the <code>AWTEvent</code> class and its subclasses.
      */
     boolean isConsumed() {
@@ -793,7 +793,7 @@
 
     /*
      * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
-     * available only for backwards compatilibility.  It has been replaced
+     * available only for backwards compatibility.  It has been replaced
      * by the <code>AWTEvent</code> class and its subclasses.
      * <p>
      * Returns the integer key-code associated with the key in this event,
@@ -811,7 +811,7 @@
 
     /*
      * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
-     * available only for backwards compatilibility.  It has been replaced
+     * available only for backwards compatibility.  It has been replaced
      * by the <code>AWTEvent</code> class and its subclasses.
      * <p>
      * Returns a new KeyEvent char which corresponds to the int key
@@ -828,7 +828,7 @@
 
     /**
      * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
-     * available only for backwards compatilibility.  It has been replaced
+     * available only for backwards compatibility.  It has been replaced
      * by the <code>AWTEvent</code> class and its subclasses.
      * <p>
      * Returns a string representing the state of this <code>Event</code>.
@@ -864,7 +864,7 @@
 
     /**
      * <b>NOTE:</b> The <code>Event</code> class is obsolete and is
-     * available only for backwards compatilibility.  It has been replaced
+     * available only for backwards compatibility.  It has been replaced
      * by the <code>AWTEvent</code> class and its subclasses.
      * <p>
      * Returns a representation of this event's values as a string.
--- a/jdk/src/share/classes/java/awt/EventDispatchThread.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/EventDispatchThread.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -25,19 +25,11 @@
 
 package java.awt;
 
-import java.awt.event.InputEvent;
 import java.awt.event.MouseEvent;
 import java.awt.event.ActionEvent;
 import java.awt.event.WindowEvent;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import sun.security.action.GetPropertyAction;
-import sun.awt.AWTAutoShutdown;
-import sun.awt.SunToolkit;
-import sun.awt.AppContext;
 
 import java.util.ArrayList;
-import java.util.List;
 import sun.util.logging.PlatformLogger;
 
 import sun.awt.dnd.SunDragSourceContextPeer;
@@ -67,8 +59,7 @@
     private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.EventDispatchThread");
 
     private EventQueue theQueue;
-    private boolean doDispatch = true;
-    private volatile boolean shutdown = false;
+    private volatile boolean doDispatch = true;
 
     private static final int ANY_EVENT = -1;
 
@@ -86,24 +77,15 @@
         doDispatch = false;
     }
 
-    public void interrupt() {
-        shutdown = true;
-        super.interrupt();
-    }
-
     public void run() {
-        while (true) {
-            try {
-                pumpEvents(new Conditional() {
-                    public boolean evaluate() {
-                        return true;
-                    }
-                });
-            } finally {
-                if(getEventQueue().detachDispatchThread(this, shutdown)) {
-                    break;
+        try {
+            pumpEvents(new Conditional() {
+                public boolean evaluate() {
+                    return true;
                 }
-            }
+            });
+        } finally {
+            getEventQueue().detachDispatchThread(this);
         }
     }
 
@@ -130,8 +112,7 @@
     void pumpEventsForFilter(int id, Conditional cond, EventFilter filter) {
         addEventFilter(filter);
         doDispatch = true;
-        shutdown |= isInterrupted();
-        while (doDispatch && !shutdown && cond.evaluate()) {
+        while (doDispatch && !isInterrupted() && cond.evaluate()) {
             pumpOneEventForFilters(id);
         }
         removeEventFilter(filter);
@@ -223,12 +204,12 @@
             }
         }
         catch (ThreadDeath death) {
-            shutdown = true;
+            doDispatch = false;
             throw death;
         }
         catch (InterruptedException interruptedException) {
-            shutdown = true; // AppContext.dispose() interrupts all
-                             // Threads in the AppContext
+            doDispatch = false; // AppContext.dispose() interrupts all
+                                // Threads in the AppContext
         }
         catch (Throwable e) {
             processException(e);
--- a/jdk/src/share/classes/java/awt/EventQueue.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/EventQueue.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -1074,7 +1074,7 @@
         }
     }
 
-    final boolean detachDispatchThread(EventDispatchThread edt, boolean forceDetach) {
+    final void detachDispatchThread(EventDispatchThread edt) {
         /*
          * Minimize discard possibility for non-posted events
          */
@@ -1090,17 +1090,9 @@
         pushPopLock.lock();
         try {
             if (edt == dispatchThread) {
-                /*
-                 * Don't detach the thread if any events are pending. Not
-                 * sure if it's a possible scenario, though.
-                 */
-                if (!forceDetach && (peekEvent() != null)) {
-                    return false;
-                }
                 dispatchThread = null;
             }
             AWTAutoShutdown.getInstance().notifyThreadFree(edt);
-            return true;
         } finally {
             pushPopLock.unlock();
         }
@@ -1159,6 +1151,10 @@
                         if (entry.event instanceof SentEvent) {
                             ((SentEvent)entry.event).dispose();
                         }
+                        if (entry.event instanceof InvocationEvent) {
+                            AWTAccessor.getInvocationEventAccessor()
+                                    .dispose((InvocationEvent)entry.event);
+                        }
                         if (prev == null) {
                             queues[i].head = entry.next;
                         } else {
--- a/jdk/src/share/classes/java/awt/Font.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/Font.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1334,7 +1334,7 @@
      * Indicates whether or not this <code>Font</code> object's style is
      * PLAIN.
      * @return    <code>true</code> if this <code>Font</code> has a
-     *            PLAIN sytle;
+     *            PLAIN style;
      *            <code>false</code> otherwise.
      * @see       java.awt.Font#getStyle
      * @since     JDK1.0
--- a/jdk/src/share/classes/java/awt/Graphics.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/Graphics.java	Wed Jul 05 19:21:26 2017 +0200
@@ -105,7 +105,7 @@
 
     /**
      * Constructs a new <code>Graphics</code> object.
-     * This constructor is the default contructor for a graphics
+     * This constructor is the default constructor for a graphics
      * context.
      * <p>
      * Since <code>Graphics</code> is an abstract class, applications
--- a/jdk/src/share/classes/java/awt/Graphics2D.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/Graphics2D.java	Wed Jul 05 19:21:26 2017 +0200
@@ -305,7 +305,7 @@
  * aliasing or antialiasing is being used.
  * <ul>
  * <li> Device coordinates are defined to be between device pixels which
- * avoids any inconsistent results between aliased and antaliased
+ * avoids any inconsistent results between aliased and antialiased
  * rendering.  If coordinates were defined to be at a pixel's center, some
  * of the pixels covered by a shape, such as a rectangle, would only be
  * half covered.
@@ -806,7 +806,7 @@
      * @param s the <code>Shape</code> to check for a hit
      * @param onStroke flag used to choose between testing the
      * stroked or the filled shape.  If the flag is <code>true</code>, the
-     * <code>Stroke</code> oultine is tested.  If the flag is
+     * <code>Stroke</code> outline is tested.  If the flag is
      * <code>false</code>, the filled <code>Shape</code> is tested.
      * @return <code>true</code> if there is a hit; <code>false</code>
      * otherwise.
@@ -1162,7 +1162,7 @@
      * <code>Component</code>.  To change the background
      * of the <code>Component</code>, use appropriate methods of
      * the <code>Component</code>.
-     * @param color the background color that isused in
+     * @param color the background color that is used in
      * subsequent calls to <code>clearRect</code>
      * @see #getBackground
      * @see java.awt.Graphics#clearRect
--- a/jdk/src/share/classes/java/awt/GraphicsDevice.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/GraphicsDevice.java	Wed Jul 05 19:21:26 2017 +0200
@@ -162,7 +162,7 @@
      * <code>GraphicsEnvironment</code>.  Although there is
      * no public method to set this <code>String</code>, a programmer can
      * use the <code>String</code> for debugging purposes.  Vendors of
-     * the Java<sup><font size=-2>TM</font></sup> Runtime Environment can
+     * the Java&trade; Runtime Environment can
      * format the return value of the <code>String</code>.  To determine
      * how to interpret the value of the <code>String</code>, contact the
      * vendor of your Java Runtime.  To find out who the vendor is, from
@@ -325,7 +325,14 @@
             // Note that we use the graphics configuration of the device,
             // not the window's, because we're setting the fs window for
             // this device.
-            Rectangle screenBounds = getDefaultConfiguration().getBounds();
+            final GraphicsConfiguration gc = getDefaultConfiguration();
+            final Rectangle screenBounds = gc.getBounds();
+            if (SunToolkit.isDispatchThreadForAppContext(fullScreenWindow)) {
+                // Update graphics configuration here directly and do not wait
+                // asynchronous notification from the peer. Note that
+                // setBounds() will reset a GC, if it was set incorrectly.
+                fullScreenWindow.setGraphicsConfiguration(gc);
+            }
             fullScreenWindow.setBounds(screenBounds.x, screenBounds.y,
                                        screenBounds.width, screenBounds.height);
             fullScreenWindow.setVisible(true);
--- a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java	Wed Jul 05 19:21:26 2017 +0200
@@ -263,7 +263,7 @@
      * available in this <code>GraphicsEnvironment</code>.  Typical usage
      * would be to allow a user to select a particular font.  Then, the
      * application can size the font and set various font attributes by
-     * calling the <code>deriveFont</code> method on the choosen instance.
+     * calling the <code>deriveFont</code> method on the chosen instance.
      * <p>
      * This method provides for the application the most precise control
      * over which <code>Font</code> instance is used to render text.
--- a/jdk/src/share/classes/java/awt/GridBagLayout.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/GridBagLayout.java	Wed Jul 05 19:21:26 2017 +0200
@@ -125,9 +125,9 @@
  * <center><table BORDER=0 WIDTH=800
  *        SUMMARY="absolute, relative and baseline values as described above">
  * <tr>
- * <th><P STYLE="TEXT-ALIGN:LEFT">Absolute Values</th>
- * <th><P STYLE="TEXT-ALIGN:LEFT">Orientation Relative Values</th>
- * <th><P STYLE="TEXT-ALIGN:LEFT">Baseline Relative Values</th>
+ * <th><P style="text-align:left">Absolute Values</th>
+ * <th><P style="text-align:left">Orientation Relative Values</th>
+ * <th><P style="text-align:left">Baseline Relative Values</th>
  * </tr>
  * <tr>
  * <td>
@@ -255,10 +255,10 @@
  * <center><table WIDTH=600 summary="layout">
  * <tr ALIGN=CENTER>
  * <td>
- * <img src="doc-files/GridBagLayout-1.gif" alt="The preceeding text describes this graphic (Figure 1)." style="float:center; margin: 7px 10px;">
+ * <img src="doc-files/GridBagLayout-1.gif" alt="The preceding text describes this graphic (Figure 1)." style="float:center; margin: 7px 10px;">
  * </td>
  * <td>
- * <img src="doc-files/GridBagLayout-2.gif" alt="The preceeding text describes this graphic (Figure 2)." style="float:center; margin: 7px 10px;">
+ * <img src="doc-files/GridBagLayout-2.gif" alt="The preceding text describes this graphic (Figure 2)." style="float:center; margin: 7px 10px;">
  * </td>
  * <tr ALIGN=CENTER>
  * <td>Figure 2: Horizontal, Left-to-Right</td>
@@ -366,7 +366,7 @@
 
     static final int EMPIRICMULTIPLIER = 2;
     /**
-     * This field is no longer used to reserve arrays and keeped for backward
+     * This field is no longer used to reserve arrays and kept for backward
      * compatibility. Previously, this was
      * the maximum number of grid positions (both horizontal and
      * vertical) that could be laid out by the grid bag layout.
@@ -444,7 +444,7 @@
      * applied to the gridbag after all of the minimum row
      * heights have been calculated.
      * If <code>rowHeights</code> has more elements than the number of
-     * rows, rowa are added to the gridbag to match
+     * rows, rows are added to the gridbag to match
      * the number of elements in <code>rowHeights</code>.
      *
      * @serial
@@ -533,7 +533,7 @@
      * and returns <code>null</code>.
      *
      * @param       comp the component to be queried
-     * @return      the contraints for the specified component
+     * @return      the constraints for the specified component
      */
     protected GridBagConstraints lookupConstraints(Component comp) {
         GridBagConstraints constraints = comptable.get(comp);
@@ -800,7 +800,7 @@
     /**
      * Lays out the specified container using this grid bag layout.
      * This method reshapes components in the specified container in
-     * order to satisfy the contraints of this <code>GridBagLayout</code>
+     * order to satisfy the constraints of this <code>GridBagLayout</code>
      * object.
      * <p>
      * Most applications do not call this method directly.
@@ -897,7 +897,7 @@
      * <ol>
      * <li>Figure out the dimensions of the layout grid.
      * <li>Determine which cells the components occupy.
-     * <li>Distribute the weights and min sizes amoung the rows/columns.
+     * <li>Distribute the weights and min sizes among the rows/columns.
      * </ol>
      *
      * This also caches the minsizes for all the children when they are
@@ -979,7 +979,7 @@
 
     /**
      * This method is obsolete and supplied for backwards
-     * compatability only; new code should call {@link
+     * compatibility only; new code should call {@link
      * #getLayoutInfo(java.awt.Container, int) getLayoutInfo} instead.
      * This method is the same as <code>getLayoutInfo</code>;
      * refer to <code>getLayoutInfo</code> for details on parameters
@@ -1612,7 +1612,7 @@
 
     /**
      * This method is obsolete and supplied for backwards
-     * compatability only; new code should call {@link
+     * compatibility only; new code should call {@link
      * #adjustForGravity(java.awt.GridBagConstraints, java.awt.Rectangle)
      * adjustForGravity} instead.
      * This method is the same as <code>adjustForGravity</code>;
@@ -1993,7 +1993,7 @@
 
     /**
      * This method is obsolete and supplied for backwards
-     * compatability only; new code should call {@link
+     * compatibility only; new code should call {@link
      * #getMinSize(java.awt.Container, GridBagLayoutInfo) getMinSize} instead.
      * This method is the same as <code>getMinSize</code>;
      * refer to <code>getMinSize</code> for details on parameters
@@ -2033,7 +2033,7 @@
 
     /**
      * This method is obsolete and supplied for backwards
-     * compatability only; new code should call {@link
+     * compatibility only; new code should call {@link
      * #arrangeGrid(Container) arrangeGrid} instead.
      * This method is the same as <code>arrangeGrid</code>;
      * refer to <code>arrangeGrid</code> for details on the
@@ -2229,6 +2229,6 @@
         }
     }
 
-    // Added for serial backwards compatability (4348425)
+    // Added for serial backwards compatibility (4348425)
     static final long serialVersionUID = 8838754796412211005L;
 }
--- a/jdk/src/share/classes/java/awt/KeyEventDispatcher.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/KeyEventDispatcher.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -51,6 +51,7 @@
  * @see KeyboardFocusManager#removeKeyEventDispatcher
  * @since 1.4
  */
+@FunctionalInterface
 public interface KeyEventDispatcher {
 
     /**
--- a/jdk/src/share/classes/java/awt/KeyEventPostProcessor.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/KeyEventPostProcessor.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,7 @@
  * @see KeyboardFocusManager#removeKeyEventPostProcessor
  * @since 1.4
  */
+@FunctionalInterface
 public interface KeyEventPostProcessor {
 
     /**
--- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -2663,7 +2663,7 @@
                      * only if we have the last request to dispatch. If the last request
                      * fails, focus will be restored to either the component of the last
                      * previously succedded request, or to to the focus owner that was
-                     * before this clearing proccess.
+                     * before this clearing process.
                      */
                     if (!iter.hasNext()) {
                         disableRestoreFocus = false;
--- a/jdk/src/share/classes/java/awt/LinearGradientPaint.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/LinearGradientPaint.java	Wed Jul 05 19:21:26 2017 +0200
@@ -94,7 +94,8 @@
  * of the three cycle methods:
  * <p>
  * <center>
- * <img src = "doc-files/LinearGradientPaint.png" alt="LinearGradientPaint">
+ * <img src = "doc-files/LinearGradientPaint.png"
+ * alt="image showing the output of the example code">
  * </center>
  *
  * @see java.awt.Paint
--- a/jdk/src/share/classes/java/awt/List.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/List.java	Wed Jul 05 19:21:26 2017 +0200
@@ -797,7 +797,7 @@
     }
 
     /**
-     * Gets the minumum dimensions for a list with the specified
+     * Gets the minimum dimensions for a list with the specified
      * number of rows.
      * @param      rows    number of rows in the list
      * @return     the minimum dimensions for displaying this scrolling list
@@ -1164,7 +1164,7 @@
 
     /*
      * Serialization support.  Since the value of the selected
-     * field isn't neccessarily up to date we sync it up with the
+     * field isn't necessarily up to date, we sync it up with the
      * peer before serializing.
      */
 
--- a/jdk/src/share/classes/java/awt/MediaTracker.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/MediaTracker.java	Wed Jul 05 19:21:26 2017 +0200
@@ -744,7 +744,7 @@
      * All instances of <code>Image</code> being tracked
      * under the specified ID are removed regardless of scale.
      * @param      image the image to be removed
-     * @param      id the tracking ID frrom which to remove the image
+     * @param      id the tracking ID from which to remove the image
      * @see        java.awt.MediaTracker#removeImage(java.awt.Image)
      * @see        java.awt.MediaTracker#removeImage(java.awt.Image, int, int, int)
      * @since      JDK1.1
--- a/jdk/src/share/classes/java/awt/MenuComponent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/MenuComponent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -402,7 +402,7 @@
 
     /**
      * Gets this component's locking object (the object that owns the thread
-     * sychronization monitor) for AWT component-tree and layout
+     * synchronization monitor) for AWT component-tree and layout
      * operations.
      * @return this component's locking object
      */
@@ -686,7 +686,7 @@
         /**
          * Gets the <code>Cursor</code> of this object.
          *
-         * @return the <code>Curso</code>, if supported, of the object;
+         * @return the <code>Cursor</code>, if supported, of the object;
          *     otherwise, <code>null</code>
          */
         public Cursor getCursor() {
--- a/jdk/src/share/classes/java/awt/MultipleGradientPaintContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/MultipleGradientPaintContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -81,7 +81,7 @@
     protected float a00, a01, a10, a11, a02, a12;
 
     /**
-     * This boolean specifies wether we are in simple lookup mode, where an
+     * This boolean specifies whether we are in simple lookup mode, where an
      * input value between 0 and 1 may be used to directly index into a single
      * array of gradient colors.  If this boolean value is false, then we have
      * to use a 2-step process where we have to determine which gradient array
--- a/jdk/src/share/classes/java/awt/Polygon.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/Polygon.java	Wed Jul 05 19:21:26 2017 +0200
@@ -246,7 +246,7 @@
     }
 
     /*
-     * Resizes the bounding box to accomodate the specified coordinates.
+     * Resizes the bounding box to accommodate the specified coordinates.
      * @param x,&nbsp;y the specified coordinates
      */
     void updateBounds(int x, int y) {
--- a/jdk/src/share/classes/java/awt/PopupMenu.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/PopupMenu.java	Wed Jul 05 19:21:26 2017 +0200
@@ -150,7 +150,7 @@
      * @exception IllegalArgumentException  if this <code>PopupMenu</code>
      *                has a non-<code>Component</code> parent
      * @exception IllegalArgumentException if the origin is not in the
-     *                parent's heirarchy
+     *                parent's hierarchy
      * @exception RuntimeException if the parent is not showing on screen
      */
     public void show(Component origin, int x, int y) {
--- a/jdk/src/share/classes/java/awt/RadialGradientPaint.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/RadialGradientPaint.java	Wed Jul 05 19:21:26 2017 +0200
@@ -80,14 +80,16 @@
  * from the focus point. The following figure shows that the distance AB
  * is equal to the distance BC, and the distance AD is equal to the distance DE.
  * <center>
- * <img src = "doc-files/RadialGradientPaint-3.png" alt="RadialGradientPaint-3">
+ * <img src = "doc-files/RadialGradientPaint-3.png" alt="image showing the
+ * distance AB=BC, and AD=DE">
  * </center>
  * If the gradient and graphics rendering transforms are uniformly scaled and
  * the user sets the focus so that it coincides with the center of the circle,
  * the gradient color proportions are equal for any line drawn from the center.
  * The following figure shows the distances AB, BC, AD, and DE. They are all equal.
  * <center>
- * <img src = "doc-files/RadialGradientPaint-4.png" alt="RadialGradientPaint-4">
+ * <img src = "doc-files/RadialGradientPaint-4.png" alt="image showing the
+ * distance of AB, BC, AD, and DE are all equal">
  * </center>
  * Note that some minor variations in distances may occur due to sampling at
  * the granularity of a pixel.
@@ -117,7 +119,8 @@
  * (centered) focus for each of the three cycle methods:
  * <p>
  * <center>
- * <img src = "doc-files/RadialGradientPaint-1.png" alt="RadialGradientPaint-1">
+ * <img src = "doc-files/RadialGradientPaint-1.png" alt="image showing the
+ * output of the sameple code">
  * </center>
  *
  * <p>
@@ -141,7 +144,8 @@
  * focus for each of the three cycle methods:
  * <p>
  * <center>
- * <img src = "doc-files/RadialGradientPaint-2.png" alt="RadialGradientPaint-2">
+ * <img src = "doc-files/RadialGradientPaint-2.png" alt="image showing the
+ * output of the sample code">
  * </center>
  *
  * @see java.awt.Paint
--- a/jdk/src/share/classes/java/awt/RenderingHints.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/RenderingHints.java	Wed Jul 05 19:21:26 2017 +0200
@@ -101,7 +101,7 @@
             //     - the integer key of the Key
             // It is theoretically possible for 2 distinct keys to collide
             // along all 3 of those attributes in the context of multiple
-            // class loaders, but that occurence will be extremely rare and
+            // class loaders, but that occurrence will be extremely rare and
             // we account for that possibility below in the recordIdentity
             // method by slightly relaxing our uniqueness guarantees if we
             // end up in that situation.
@@ -729,7 +729,7 @@
      * from one side of a sample to the other.
      * As the image is scaled down, more image pixels have their
      * color samples represented in the resulting output since each
-     * output pixel recieves color information from up to 4 image
+     * output pixel receives color information from up to 4 image
      * pixels.
      *
      * @see #KEY_INTERPOLATION
--- a/jdk/src/share/classes/java/awt/ScrollPane.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/ScrollPane.java	Wed Jul 05 19:21:26 2017 +0200
@@ -425,8 +425,8 @@
 
     /**
      * Determine the size to allocate the child component.
-     * If the viewport area is bigger than the childs
-     * preferred size then the child is allocated enough
+     * If the viewport area is bigger than the preferred size
+     * of the child then the child is allocated enough
      * to fill the viewport, otherwise the child is given
      * it's preferred size.
      */
--- a/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -336,7 +336,7 @@
      * the AdjustementEvent with specified type and value.
      *
      * @param v the new value of the scrollbar
-     * @param type the type of the scrolling operation occured
+     * @param type the type of the scrolling operation occurred
      */
     private void setTypedValue(int v, int type) {
         v = Math.max(v, minimum);
--- a/jdk/src/share/classes/java/awt/Shape.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/Shape.java	Wed Jul 05 19:21:26 2017 +0200
@@ -269,7 +269,7 @@
      * Tests if the interior of the <code>Shape</code> entirely contains
      * the specified rectangular area.  All coordinates that lie inside
      * the rectangular area must lie within the <code>Shape</code> for the
-     * entire rectanglar area to be considered contained within the
+     * entire rectangular area to be considered contained within the
      * <code>Shape</code>.
      * <p>
      * The {@code Shape.contains()} method allows a {@code Shape}
--- a/jdk/src/share/classes/java/awt/TextComponent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/TextComponent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1000,7 +1000,7 @@
          * Return 0 if the text is empty, or the caret position
          * if no selection.
          *
-         * @return the index into teh text of the end of the selection &gt;= 0
+         * @return the index into the text of the end of the selection &gt;= 0
          */
         public int getSelectionEnd() {
             return TextComponent.this.getSelectionEnd();
--- a/jdk/src/share/classes/java/awt/TextField.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/TextField.java	Wed Jul 05 19:21:26 2017 +0200
@@ -405,7 +405,7 @@
     }
 
     /**
-     * Gets the minumum dimensions for a text field with
+     * Gets the minimum dimensions for a text field with
      * the specified number of columns.
      * @param    columns   the number of columns in
      *                          this text field.
@@ -430,7 +430,7 @@
     }
 
     /**
-     * Gets the minumum dimensions for this text field.
+     * Gets the minimum dimensions for this text field.
      * @return     the minimum dimensions for
      *                  displaying this text field.
      * @since      JDK1.1
--- a/jdk/src/share/classes/java/awt/Toolkit.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/Toolkit.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1457,7 +1457,7 @@
      * <p>Note that multi-frame images are invalid and may cause this
      * method to hang.
      *
-     * @param cursor the image to display when the cursor is actived
+     * @param cursor the image to display when the cursor is activated
      * @param hotSpot the X and Y of the large cursor's hot spot; the
      *   hotSpot values must be less than the Dimension returned by
      *   <code>getBestCursorSize</code>
@@ -1809,8 +1809,7 @@
 
         // This property should never be cached
         if (propertyName.equals("awt.dynamicLayoutSupported")) {
-            value = lazilyLoadDesktopProperty(propertyName);
-            return value;
+            return getDefaultToolkit().lazilyLoadDesktopProperty(propertyName);
         }
 
         value = desktopProperties.get(propertyName);
--- a/jdk/src/share/classes/java/awt/Window.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/Window.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1656,7 +1656,7 @@
      * effect until it is hidden and then shown again.
      *
      * @param exclusionType the modal exclusion type for this window; a {@code null}
-     *     value is equivivalent to {@link Dialog.ModalExclusionType#NO_EXCLUDE
+     *     value is equivalent to {@link Dialog.ModalExclusionType#NO_EXCLUDE
      *     NO_EXCLUDE}
      * @throws SecurityException if the calling thread does not have permission
      *     to set the modal exclusion property to the window with the given
@@ -2079,7 +2079,7 @@
     }
 
     /**
-     * Processes window focus event occuring on this window by
+     * Processes window focus event occurring on this window by
      * dispatching them to any registered WindowFocusListener objects.
      * NOTE: this method will not be called unless window focus events
      * are enabled for this window. This happens when one of the
@@ -2114,7 +2114,7 @@
     }
 
     /**
-     * Processes window state event occuring on this window by
+     * Processes window state event occurring on this window by
      * dispatching them to any registered {@code WindowStateListener}
      * objects.
      * NOTE: this method will not be called unless window state events
@@ -2191,13 +2191,11 @@
      * When the window is later shown, it will be always-on-top.
      *
      * <p> When this method is called on a window with a value of
-     * {@code false} the always-on-top state is set to normal. The
-     * window remains in the top-most position but it`s z-order can be
-     * changed as for any other window.  Calling this method with a value
-     * of {@code false} on a window that has a normal state has no
-     * effect.  Setting the always-on-top state to false has no effect on
-     * the relative z-order of the windows if there are no other
-     * always-on-top windows.
+     * {@code false} the always-on-top state is set to normal. It may also
+     * cause an unspecified, platform-dependent change in the z-order of
+     * top-level windows, but other always-on-top windows will remain in
+     * top-most position. Calling this method with a value of {@code false}
+     * on a window that has a normal state has no effect.
      *
      * <p><b>Note</b>: some platforms might not support always-on-top
      * windows.  To detect if always-on-top windows are supported by the
@@ -2978,11 +2976,11 @@
 
         addToWindowList();
         initGC(null);
+        ownedWindowList = new Vector<>();
     }
 
     private void deserializeResources(ObjectInputStream s)
         throws ClassNotFoundException, IOException, HeadlessException {
-            ownedWindowList = new Vector<>();
 
             if (windowSerializedDataVersion < 2) {
                 // Translate old-style focus tracking to new model. For 1.4 and
@@ -3678,7 +3676,7 @@
      * and either the {@code UnsupportedOperationException} or {@code
      * IllegalComponentStateException} will be thrown.
      * <p>
-     * The tranlucency levels of individual pixels may also be effected by the
+     * The translucency levels of individual pixels may also be effected by the
      * alpha component of their color (see {@link Window#setBackground(Color)}) and the
      * opacity value (see {@link #setOpacity(float)}). See {@link
      * GraphicsDevice.WindowTranslucency} for more details.
@@ -3749,7 +3747,7 @@
      * <p>
      * If the windowing system supports the {@link
      * GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT PERPIXEL_TRANSLUCENT}
-     * tranclucency, the alpha component of the given background color
+     * translucency, the alpha component of the given background color
      * may effect the mode of operation for this window: it indicates whether
      * this window must be opaque (alpha equals {@code 1.0f}) or per-pixel translucent
      * (alpha is less than {@code 1.0f}). If the given background color is
--- a/jdk/src/share/classes/java/awt/color/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/color/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,6 +25,7 @@
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <html>
+<head><title></title></head>
 <body bgcolor="white">
 
 Provides classes for color spaces.  It contains an
--- a/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/datatransfer/DataFlavor.java	Wed Jul 05 19:21:26 2017 +0200
@@ -104,7 +104,7 @@
 public class DataFlavor implements Externalizable, Cloneable {
 
     private static final long serialVersionUID = 8367026044764648243L;
-    private static final Class ioInputStreamClass = java.io.InputStream.class;
+    private static final Class<InputStream> ioInputStreamClass = InputStream.class;
 
     /**
      * Tries to load a class from: the bootstrap loader, the system loader,
@@ -151,7 +151,7 @@
     /*
      * private initializer
      */
-    static private DataFlavor createConstant(Class rc, String prn) {
+    static private DataFlavor createConstant(Class<?> rc, String prn) {
         try {
             return new DataFlavor(rc, prn);
         } catch (Exception e) {
@@ -323,7 +323,7 @@
      * @exception NullPointerException if either <code>primaryType</code>,
      *            <code>subType</code> or <code>representationClass</code> is null
      */
-    private DataFlavor(String primaryType, String subType, MimeTypeParameterList params, Class representationClass, String humanPresentableName) {
+    private DataFlavor(String primaryType, String subType, MimeTypeParameterList params, Class<?> representationClass, String humanPresentableName) {
         super();
         if (primaryType == null) {
             throw new NullPointerException("primaryType");
@@ -340,7 +340,7 @@
         params.set("class", representationClass.getName());
 
         if (humanPresentableName == null) {
-            humanPresentableName = (String)params.get("humanPresentableName");
+            humanPresentableName = params.get("humanPresentableName");
 
             if (humanPresentableName == null)
                 humanPresentableName = primaryType + "/" + subType;
@@ -741,7 +741,7 @@
         return bestFlavor;
     }
 
-    private static Comparator textFlavorComparator;
+    private static Comparator<DataFlavor> textFlavorComparator;
 
     static class TextFlavorComparator
         extends DataTransferer.DataFlavorComparator {
@@ -1447,6 +1447,6 @@
 
     /** Java class of objects this DataFlavor represents **/
 
-    private Class       representationClass;
+    private Class<?>       representationClass;
 
 } // class DataFlavor
--- a/jdk/src/share/classes/java/awt/datatransfer/FlavorMap.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/datatransfer/FlavorMap.java	Wed Jul 05 19:21:26 2017 +0200
@@ -30,7 +30,7 @@
 
 /**
  * A two-way Map between "natives" (Strings), which correspond to platform-
- * specfic data formats, and "flavors" (DataFlavors), which corerspond to
+ * specific data formats, and "flavors" (DataFlavors), which correspond to
  * platform-independent MIME types. FlavorMaps need not be symmetric, but
  * typically are.
  *
--- a/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java	Wed Jul 05 19:21:26 2017 +0200
@@ -33,7 +33,7 @@
 
 
 /**
- * An object that encapsualtes the parameter list of a MimeType
+ * An object that encapsulates the parameter list of a MimeType
  * as defined in RFC 2045 and 2046.
  *
  * @author jeff.dunn@eng.sun.com
@@ -44,13 +44,13 @@
      * Default constructor.
      */
     public MimeTypeParameterList() {
-        parameters = new Hashtable();
+        parameters = new Hashtable<>();
     }
 
     public MimeTypeParameterList(String rawdata)
         throws MimeTypeParseException
     {
-        parameters = new Hashtable();
+        parameters = new Hashtable<>();
 
         //    now parse rawdata
         parse(rawdata);
@@ -59,10 +59,10 @@
     public int hashCode() {
         int code = Integer.MAX_VALUE/45; // "random" value for empty lists
         String paramName = null;
-        Enumeration enum_ = this.getNames();
+        Enumeration<String> enum_ = this.getNames();
 
         while (enum_.hasMoreElements()) {
-            paramName = (String)enum_.nextElement();
+            paramName = enum_.nextElement();
             code += paramName.hashCode();
             code += this.get(paramName).hashCode();
         }
@@ -87,14 +87,14 @@
         String name = null;
         String thisValue = null;
         String thatValue = null;
-        Set entries = parameters.entrySet();
-        Iterator iterator = entries.iterator();
-        Map.Entry entry = null;
+        Set<Map.Entry<String, String>> entries = parameters.entrySet();
+        Iterator<Map.Entry<String, String>> iterator = entries.iterator();
+        Map.Entry<String, String> entry = null;
         while (iterator.hasNext()) {
-            entry = (Map.Entry)iterator.next();
-            name = (String)entry.getKey();
-            thisValue = (String)entry.getValue();
-            thatValue = (String)that.parameters.get(name);
+            entry = iterator.next();
+            name = entry.getKey();
+            thisValue = entry.getValue();
+            thatValue = that.parameters.get(name);
             if ((thisValue == null) || (thatValue == null)) {
                 // both null -> equal, only one null -> not equal
                 if (thisValue != thatValue) {
@@ -250,7 +250,7 @@
      * is no current association.
      */
     public String get(String name) {
-        return (String)parameters.get(name.trim().toLowerCase());
+        return parameters.get(name.trim().toLowerCase());
     }
 
     /**
@@ -271,7 +271,7 @@
     /**
      * Retrieve an enumeration of all the names in this list.
      */
-    public Enumeration getNames() {
+    public Enumeration<String> getNames() {
         return parameters.keys();
     }
 
@@ -279,15 +279,15 @@
         // Heuristic: 8 characters per field
         StringBuilder buffer = new StringBuilder(parameters.size() * 16);
 
-        Enumeration keys = parameters.keys();
+        Enumeration<String> keys = parameters.keys();
         while(keys.hasMoreElements())
         {
             buffer.append("; ");
 
-            String key = (String)keys.nextElement();
+            String key = keys.nextElement();
             buffer.append(key);
             buffer.append('=');
-               buffer.append(quote((String)parameters.get(key)));
+               buffer.append(quote(parameters.get(key)));
         }
 
         return buffer.toString();
@@ -307,7 +307,7 @@
          return newObj;
      }
 
-    private Hashtable parameters;
+    private Hashtable<String, String> parameters;
 
     //    below here be scary parsing related things
 
--- a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1324,7 +1324,7 @@
         List<String> retval = null;
         for (DataFlavor dataFlavor : convertMimeTypeToDataFlavors(type)) {
             List<String> natives = getFlavorToNative().get(dataFlavor);
-            if (!natives.isEmpty()) {
+            if (natives != null && !natives.isEmpty()) {
                 if (retval == null) {
                     retval = new ArrayList<>();
                 }
--- a/jdk/src/share/classes/java/awt/datatransfer/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/datatransfer/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,6 +25,7 @@
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <html>
+<head><title></title></head>
 <body bgcolor="white">
 
 Provides interfaces and classes for transferring data
--- a/jdk/src/share/classes/java/awt/dnd/DragGestureListener.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/dnd/DragGestureListener.java	Wed Jul 05 19:21:26 2017 +0200
@@ -50,8 +50,8 @@
     /**
      * This method is invoked by the {@code DragGestureRecognizer}
      * when the {@code DragGestureRecognizer} detects a platform-dependent
-     * drag initiating gesture. To intiate the drag and drop operation,
-     * if approtiate, {@link DragGestureEvent#startDrag startDrag()} method on
+     * drag initiating gesture. To initiate the drag and drop operation,
+     * if appropriate, {@link DragGestureEvent#startDrag startDrag()} method on
      * the {@code DragGestureEvent} has to be invoked.
      * <P>
      * @see java.awt.dnd.DragGestureRecognizer
--- a/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/dnd/DragGestureRecognizer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -46,7 +46,7 @@
  * <p>
  * The appropriate <code>DragGestureRecognizer</code>
  * subclass instance is obtained from the
- * {@link DragSource} asssociated with
+ * {@link DragSource} associated with
  * a particular <code>Component</code>, or from the <code>Toolkit</code> object via its
  * {@link java.awt.Toolkit#createDragGestureRecognizer createDragGestureRecognizer()}
  * method.
--- a/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/dnd/DragSourceContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -474,7 +474,7 @@
 
     protected synchronized void updateCurrentCursor(int sourceAct, int targetAct, int status) {
 
-        // if the cursor has been previously set then dont do any defaults
+        // if the cursor has been previously set then don't do any defaults
         // processing.
 
         if (useCustomCursor) {
--- a/jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/dnd/DragSourceEvent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -38,7 +38,7 @@
  * over, or exits a drop site, when the drop action changes, and when the drag
  * ends. The location for the generated <code>DragSourceEvent</code> specifies
  * the mouse cursor location in screen coordinates at the moment this event
- * occured.
+ * occurred.
  * <p>
  * In a multi-screen environment without a virtual device, the cursor location is
  * specified in the coordinate system of the <i>initiator</i>
@@ -71,7 +71,7 @@
 
     /**
      * The horizontal coordinate for the cursor location at the moment this
-     * event occured if the cursor location is specified for this event;
+     * event occurred if the cursor location is specified for this event;
      * otherwise zero.
      *
      * @serial
@@ -80,7 +80,7 @@
 
     /**
      * The vertical coordinate for the cursor location at the moment this event
-     * occured if the cursor location is specified for this event;
+     * occurred if the cursor location is specified for this event;
      * otherwise zero.
      *
      * @serial
@@ -141,7 +141,7 @@
 
     /**
      * This method returns a <code>Point</code> indicating the cursor
-     * location in screen coordinates at the moment this event occured, or
+     * location in screen coordinates at the moment this event occurred, or
      * <code>null</code> if the cursor location is not specified for this
      * event.
      *
@@ -159,7 +159,7 @@
 
     /**
      * This method returns the horizontal coordinate of the cursor location in
-     * screen coordinates at the moment this event occured, or zero if the
+     * screen coordinates at the moment this event occurred, or zero if the
      * cursor location is not specified for this event.
      *
      * @return an integer indicating the horizontal coordinate of the cursor
@@ -172,7 +172,7 @@
 
     /**
      * This method returns the vertical coordinate of the cursor location in
-     * screen coordinates at the moment this event occured, or zero if the
+     * screen coordinates at the moment this event occurred, or zero if the
      * cursor location is not specified for this event.
      *
      * @return an integer indicating the vertical coordinate of the cursor
--- a/jdk/src/share/classes/java/awt/dnd/DropTarget.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/dnd/DropTarget.java	Wed Jul 05 19:21:26 2017 +0200
@@ -612,7 +612,7 @@
             dropTargetContext =
                 (DropTargetContext)f.get("dropTargetContext", null);
         } catch (IllegalArgumentException e) {
-            // Pre-1.4 support. 'dropTargetContext' was previoulsy transient
+            // Pre-1.4 support. 'dropTargetContext' was previously transient
         }
         if (dropTargetContext == null) {
             dropTargetContext = createDropTargetContext();
@@ -789,7 +789,7 @@
     }
 
     /**
-     * update autoscrolling with current cursor locn
+     * update autoscrolling with current cursor location
      * <P>
      * @param dragCursorLocn the <code>Point</code>
      */
--- a/jdk/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/dnd/InvalidDnDOperationException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -29,7 +29,7 @@
  * This exception is thrown by various methods in the java.awt.dnd package.
  * It is usually thrown to indicate that the target in question is unable
  * to undertake the requested operation that the present time, since the
- * undrelying DnD system is not in the appropriate state.
+ * underlying DnD system is not in the appropriate state.
  *
  * @since 1.2
  */
--- a/jdk/src/share/classes/java/awt/dnd/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/dnd/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,6 +25,7 @@
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <html>
+<head><title></title></head>
 <body bgcolor="white">
 
 Drag and Drop is a direct manipulation gesture found in many Graphical
@@ -51,18 +52,18 @@
 associated with some presentation
 element (<code>Component</code>) in the GUI, to initiate a Drag and Drop of
 some potentially <code>Transferable</code> data. 
-<P>
+<br><br>
 <LI>1 or more <code>DropTarget</code>(s) come into/go out of 
 existence, associated
 with presentation elements in the GUI (Components), potentially
 capable of consuming <code>Transferable</code> data types. 
-<P>
+<br><br>
 <LI> A <code>DragGestureRecognizer</code> is 
 obtained from the <code>DragSource</code> and is
 associated with a <code>Component</code> in order 
 to track and identify any Drag
 initiating gesture by the user over the <code>Component</code>. 
-<P>
+<br><br>
 <LI> A user makes a Drag gesture over the <code>Component</code>, 
 which the registered
 <code>DragGestureRecognizer</code> detects, and notifies its
@@ -76,13 +77,13 @@
 recognizing mouse device gestures. Other abstract subclasses may be
 provided by the platform to support other input devices or
 particular <code>Component</code> class semantics. 
-    <P>
+<br><br>
 <LI> The <code>DragGestureListener</code> causes the 
 <code>DragSource</code> to initiate the Drag
 and Drop operation on behalf of the user, perhaps animating the
 GUI Cursor and/or rendering an <code>Image</code> of the item(s) that are the
 subject of the operation.
-<P>
+<br><br>
 <LI> As the user gestures navigate over <code>Component</code>(s) 
 in the GUI with
 associated <code>DropTarget</code>(s), the <code>DragSource</code> 
@@ -111,11 +112,11 @@
 <UL>
 <LI> By the transfer "operation" selected by the user, and supported by
 both the <code>DragSource</code> and <code>DropTarget</code>: Copy, Move or Reference(link). 
-<P>
+<br><br>
 <LI> By the intersection of the set of data types provided by the
 <code>DragSource</code> and the set of data types comprehensible by the 
 <code>DropTarget</code>. 
-<P>
+<br><br>
 <LI>When the user terminates the drag operation, normally resulting in a
 successful Drop, both the <code>DragSource</code> and <code>DropTarget</code>
 receive
--- a/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/doc-files/AWTThreadIssues.html	Wed Jul 05 19:21:26 2017 +0200
@@ -23,7 +23,11 @@
  questions.
 -->
 
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
+<head>
+<title></title>
+</head>
 <body bgcolor=white>
 
 <h1 align=center>AWT Threading Issues</h1>
@@ -81,13 +85,13 @@
        dispatched:
        <ul>
            <li> Sequentially.
-           <dd> That is, it is not permitted that several events from
-	        this queue are dispatched simultaneously. 
+           <dl><dd> That is, it is not permitted that several events from
+	        this queue are dispatched simultaneously. </dd></dl>
            <li> In the same order as they are enqueued.
-           <dd> That is, if <code>AWTEvent</code>&nbsp;A is enqueued
+           <dl><dd> That is, if <code>AWTEvent</code>&nbsp;A is enqueued
 	        to the <code>EventQueue</code> before
 		<code>AWTEvent</code>&nbsp;B then event B will not be 
-                dispatched before event A.
+                dispatched before event A.</dd></dl>
        </ul>
   <li> There is at least one alive non-daemon thread while there is at
        least one displayable AWT or Swing component within the
--- a/jdk/src/share/classes/java/awt/doc-files/DesktopProperties.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/doc-files/DesktopProperties.html	Wed Jul 05 19:21:26 2017 +0200
@@ -23,7 +23,11 @@
  questions.
 -->
 
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
+<head>
+<title></title>
+</head>
 <body bgcolor=white>
 
 <h1 align=center>AWT Desktop Properties</h1>
@@ -51,8 +55,8 @@
 <p>
 The following table summarizes the desktop properties documented
 here, and their value types.
-<p>
-<table align="center" border="0" cellspacing="0" cellpadding="2" width="%95
+<br><br>
+<table align="center" border="0" cellspacing="0" cellpadding="2"
   summary="Standard AWT Desktop Properties">
 <tr bgcolor="#ccccff">
 <th valign="TOP" align="LEFT">Property Name</th>
@@ -60,17 +64,17 @@
 <th valign="TOP" align="LEFT">Summary Description</th>
 </tr>
 <tr>
-<td valign="TOP"><A href=#awt.font.desktophints>awt.font.desktophints</A</td>
-<td valign="TOP"><a href="../../util/Map.html">java.util.Map<a/></td>
-<td valign="TOP">Font smoothing (text antialiasing) settings.<a/></td>
+<td valign="TOP"><A href="#awt.font.desktophints">awt.font.desktophints</A></td>
+<td valign="TOP"><a href="../../util/Map.html">java.util.Map</a></td>
+<td valign="TOP">Font smoothing (text antialiasing) settings.</td>
 </tr>
 <tr>
-<td valign="TOP"><A href=#"sun.awt.enableExtraMouseButtons">sun.awt.enableExtraMouseButtons</A</td>
-<td valign="TOP"><a href="../../lang/Boolean.html">java.lang.Boolean<a/></td>
-<td valign="TOP">Controls if mouse events from extra buttons are to be generated or not<a/></td>
+<td valign="TOP"><A href="#sun.awt.enableExtraMouseButtons">sun.awt.enableExtraMouseButtons</A></td>
+<td valign="TOP"><a href="../../lang/Boolean.html">java.lang.Boolean</a></td>
+<td valign="TOP">Controls if mouse events from extra buttons are to be generated or not</td>
 </tr>
 </table>
-<p>
+
 <h2>Desktop Font Rendering Hints</h2>
 <b>Desktop Property: <A name="awt.font.desktophints">"awt.font.desktophints"</A></b>
 <p>
@@ -84,14 +88,14 @@
 <a href="../../../javax/swing/JComponent.html"> Swing components</a> which
 are required to appear consistent with native desktop components or other
 Swing components.
-<p>
+
 <h3>Basic Usage</h3>
 The standard desktop property named
 <b>"awt.font.desktophints"</b>
 can be used to obtain the rendering hints that best match the desktop settings.
 
 The return value is a
-<a href="../../util/Map.html"> Map<a/> of
+<a href="../../util/Map.html"> Map</a> of
 <a href="../RenderingHints.html"> <code>RenderingHints</code></a> which
 can be directly applied to a <code>Graphics2D</code>.
 <p>
@@ -105,7 +109,7 @@
 }
 </code></pre>
 <h3>Advanced Usage Tips</h3>
-<p>
+
 <h4>Listening for changes</h4>
 <p>
 An application can listen for changes in the property
@@ -161,7 +165,7 @@
      if (hintsToSave.size() == 0) {
          return savedHints;
      }
-     /* RenderingHints.keySet() returns Set<Object> */
+     /* RenderingHints.keySet() returns Set&lt;Object&gt; */
      for (Object o : hintsToSave.keySet()) {
          RenderingHints.Key key = (RenderingHints.Key)o;
          Object value = g2d.getRenderingHint(key);
@@ -185,17 +189,17 @@
 <h3>Details</h3>
 <ul>
 <li>The return value will always be null or a <code>Map</code>
-<p>
+<br><br>
 <li>If the return value is null, then no desktop properties are available,
 and dynamic updates will not be available. This is a typical behaviour if
 the JDK does not recognise the desktop environment, or it is one which
 has no such settings. The <b>Headless</b> toolkit is one such example.
 Therefore it is important to test against null before using the map. 
-<p>
+<br><br>
 <li>If non-null the value will be a <code>Map</code> of
 <code>RenderingHints</code> such that every key is an instance of
 <code>RenderingHints.Key</code> and the value is a legal value for that key.
-<p>
+<br><br>
 <li>The map may contain the default value for a hint. This is
 needed in the event there is a previously a non-default value for the hint
 set on the <code>Graphics2D</code>. If the map did not contain
@@ -204,7 +208,7 @@
 <p>
 An application can use <code>setRenderingHints(Map)</code> to reinitialise
 all hints, but this would affect unrelated hints too.
-<p>
+<br><br>
 <li>A multi-screen desktop may support per-screen device settings in which
 case the returned value is for the default screen of the desktop.
 An application may want to use the settings for the screen on
--- a/jdk/src/share/classes/java/awt/doc-files/FocusSpec.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/doc-files/FocusSpec.html	Wed Jul 05 19:21:26 2017 +0200
@@ -27,7 +27,7 @@
 
 <html>
     <head>
-       <title align=center>The AWT Focus Subsystem</title>
+       <title>The AWT Focus Subsystem</title>
     </head>
 
     <body bgcolor="white">
@@ -660,16 +660,16 @@
   FocusTraversalPolicy of its own. To do so, one needs to set Container's focus
   traversal policy provider property to <code>true</code> with the call to
 
-  <ul>
+  <blockquote>
     <code>Container.setFocusTraversalPolicyProvider(boolean)</code>
-  </ul>
+  </blockquote>
 
   To determine whether a Container is a focus traversal policy provider, the
   following method should be used:
 
-  <ul>
+  <blockquote>
     <code>Container.isFocusTraversalPolicyProvider()</code>
-  </ul>
+  </blockquote>
 
   If focus traversal policy provider property is set on a focus cycle root, it
   isn't considered a focus traversal policy provider and behaves just like any
@@ -750,10 +750,10 @@
 to use one of the following methods on <code>KeyboardFocusManager</code>:
 
   <ul>
-    <code>KeyboardFocusManager.focusNextComponent()</code>
-    <code>KeyboardFocusManager.focusPreviousComponent()</code>
-    <code>KeyboardFocusManager.upFocusCycle()</code>
-    <code>KeyboardFocusManager.downFocusCycle()</code>
+    <li><code>KeyboardFocusManager.focusNextComponent()</code>
+    <li><code>KeyboardFocusManager.focusPreviousComponent()</code>
+    <li><code>KeyboardFocusManager.upFocusCycle()</code>
+    <li><code>KeyboardFocusManager.downFocusCycle()</code>
   </ul>
 
 <p>
@@ -1149,7 +1149,7 @@
         <b>Microsoft Windows</b>: The Window is moved to front and becomes the focused
         Window.
       <br>
-        </b>Solaris</b>: The Window is moved to front. In a point-to-focus focus
+        <b>Solaris</b>: The Window is moved to front. In a point-to-focus focus
         window manager, the Window will be focused if it is now the
         top-most Window under the cursor. In a click-to-focus window
         manager, the Window will become the focused Window.
--- a/jdk/src/share/classes/java/awt/doc-files/Modality.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/doc-files/Modality.html	Wed Jul 05 19:21:26 2017 +0200
@@ -43,7 +43,7 @@
       modality features and how to use them. It contains the following sections:
     </p><ul>
       <li><a href="#Definitions">Definitions</a></li>
-      </li><li><a href="#ModalityTypes">Modality types</a></li>
+      <li><a href="#ModalityTypes">Modality types</a></li>
       <li><a href="#ShowHideBlocking">Show/hide blocking</a></li>
       <li><a href="#ModalExclusion">Modal exclusion</a></li>
       <li><a href="#Related">Related AWT features</a></li>
@@ -54,13 +54,13 @@
     </ul>
 
     <a name="Definitions"></a>
-    </p><h3>Definitions</h3>
+    <h3>Definitions</h3>
 
     <p>
       <u>Document</u> - a window without an owner that, together with
       all its child hierarchy, may be operated on as a single self-contained
       document.
-      Every window belongs to some document &#151; its root can be found as
+      Every window belongs to some document &mdash; its root can be found as
       the closest ancestor window without an owner.
     </p><p>
       <a name="ModalBlocked"></a>
@@ -73,7 +73,7 @@
       <blockquote>
         <hr>
           <b>Warning!</b> Some window managers allow users to change the window
-          Z-order in an arbitrary way &#151; in that case the last requirement 
+          Z-order in an arbitrary way &mdash; in that case the last requirement 
           may not be met.
         <hr>
       </blockquote>
@@ -92,12 +92,12 @@
     </p><p>
      <blockquote><hr>
       <b>Note</b>: Everywhere in this document the notion of "window" is equal
-      to a top-level window in the Java programming language &#151; in other words
+      to a top-level window in the Java programming language &mdash; in other words
       an instance of <code>java.awt.Window</code> or any descendant class.
       <hr></blockquote>
 
     <a name="ModalityTypes"></a>
-    </p><h3>Modality types</h3>
+    <h3>Modality types</h3>
 
     <p>
       There are four supported modality types :
@@ -163,11 +163,11 @@
       <hr></blockquote>
 
     <a name="ShowHideBlocking"></a>
-    </p><h3>Show/hide blocking</h3>
+    <h3>Show/hide blocking</h3>
 
     <p>
       <u>Showing the window or modeless dialog: "F"</u><br>
-      All the visible modal dialogs are looked through &#151; if F is from the SB
+      All the visible modal dialogs are looked through &mdash; if F is from the SB
       of one of them, it becomes blocked by it. If there are several such
       dialogs, the first shown is used. If no such dialogs exist, F remains
       unblocked.
@@ -185,7 +185,7 @@
       dialogs outside M's SB and modal dialogs outside M's SB that do not
       block M).
       </ul>
-      </p><p>
+      <p>
       After the modal dialog M is shown, it becomes blocked by the first shown
       dialog from the first group (if there are any), all the windows from the
       second one become blocked by M, and all the windows from the third group
@@ -197,12 +197,12 @@
       </p><p>
       <u>Showing the document-modal dialog: "M"</u><br>
       All the visible application- and toolkit-modal dialogs are looked
-      through &#151; if M is from the SB of one of them,
+      through &mdash; if M is from the SB of one of them,
       it becomes blocked by it. If there are several such dialogs,
       the first shown is used. If no such dialogs exist, M remains unblocked.
       </p><p>
       <u>Showing the application-modal dialog: "M"</u><br>
-      All the visible toolkit-modal dialogs are looked through &#151;
+      All the visible toolkit-modal dialogs are looked through &mdash;
       if M is from the SB of one of them, it becomes blocked by it.
       If there are several such dialogs, the first shown is used.
       If no such dialogs exist, M remains unblocked.
@@ -212,7 +212,7 @@
       </p><p>
 <!--        <center> -->
           </p>
-          <table border="1" cols="5" rows="5">
+          <table border="1">
 	  <caption>The Standard Blocking Matrix</caption>
             <tbody><tr align="center">
               <td align="center">current/shown</td>
@@ -293,11 +293,10 @@
       <hr>
         <b>Implementation note</b>: Changing the modal exclusion type for a visible window
         may have no effect until it is hidden and then shown again.
-      </hr>
     </blockquote>
 
-    <a name="Related"</a>
-    </p><h3>Related AWT features</h3>
+    <a name="Related"></a>
+    <h3>Related AWT features</h3>
 
     <p>
       <u>Always-On-Top</u><br>
@@ -315,16 +314,16 @@
     <p>
       <u>Minimizing, maximizing and closing blocked windows</u><br>
       When a modal dialog blocks a window, the user may not be able to maximize or
-      minimize the blocked window&#151; however, the actual behavior is unspecified
+      minimize the blocked window&mdash; however, the actual behavior is unspecified
       and platform-dependent. In any case, the user can't close the blocked window
-      interactively&#151; but it can be closed programmatically by calling the
+      interactively&mdash; but it can be closed programmatically by calling the
       <code>setVisible(false)</code> or <code>dispose()</code> methods on the blocked
       window.
     </p>
     <p>
       <u>Blocked windows activations</u><br>
       When the user selects a blocked window, it may be brought to the front, along
-      with the blocking modal dialog which would then become the active window&#151;
+      with the blocking modal dialog which would then become the active window&mdash;
       however, the actual behavior is unspecified and platform-dependent.
     </p>
     <p>
@@ -339,9 +338,9 @@
       </li></ol>
       If the modal dialog to be hidden does not have focus, the active window remains
       unchanged.
-    </p>
+    
     <a name="Security"></a>
-    </p><h3>Security</h3>
+    <h3>Security</h3>
 
     <p>
       A special <code>AWTPermission</code>, <code>"toolkitModality"</code>,
@@ -386,35 +385,35 @@
     <a name="Examples"></a>
     </p><h3>Examples</h3>
 
-    <table cols="2" border="0">
+    <table border="0">
       <tbody><tr>
-        <td align="left" valign="center">
+        <td align="left" >
 	<ol>
           <li>Frame "F" is shown<br>
           <li>Document-modal dialog "D<sub>i</sub>" is shown<br>
-          <li>F becomes blocked by D<sub>i</sub> &#151; it's in the same document<br>
+          <li>F becomes blocked by D<sub>i</sub> &mdash; it's in the same document<br>
           <li>Document-modal dialog "D<sub>ii</sub>" is shown<br>
-          <li>D<sub>i</sub> becomes blocked by D<sub>ii</sub> &#151; it's in the
+          <li>D<sub>i</sub> becomes blocked by D<sub>ii</sub> &mdash; it's in the
 	      same document<br>
 	  </ol>
           <br>
         </td>
-        <td align="center" valign="center">
+        <td align="center">
           <img src="modal-example1.gif">
           <br>
         </td>
       </tr>
       <tr>
-        <td align="left" valign="center">
+        <td align="left">
 	<ol>
          <li>Frame "F" is shown<br>
          <li>Document-modal dialog "D<sub>i</sub>" is shown<br>
-         <li>F becomes blocked by D<sub>i</sub> &#151; it's in the same document<br>
+         <li>F becomes blocked by D<sub>i</sub> &mdash; it's in the same document<br>
          <li>Document-modal dialog "D<sub>ii</sub>" is shown<br>
-         <li>D<sub>i</sub> becomes blocked by D<sub>ii</sub> &#151;
+         <li>D<sub>i</sub> becomes blocked by D<sub>ii</sub> &mdash;
 	     it's in the same document<br>
          <li>D<sub>i</sub> is hidden<br>
-         <li>F becomes blocked by D<sub>ii</sub> &#151; it's in the same document<br>
+         <li>F becomes blocked by D<sub>ii</sub> &mdash; it's in the same document<br>
          </ol>
 	 <br>
         </td>
@@ -424,45 +423,45 @@
         </td>
       </tr>
       <tr>
-        <td align="left" valign="center">
+        <td align="left">
 	<ol>
           <li>Frame "F" is shown<br>
           <li>Toolkit-modal dialog "D<sub>i</sub>" is created, but not shown<br>
           <li>Document-modal dialog "D<sub>ii</sub>" is shown<br>
-          <li>F becomes blocked by D<sub>ii</sub> &#151; it's in the same document<br>
+          <li>F becomes blocked by D<sub>ii</sub> &mdash; it's in the same document<br>
           <li>Application-modal dialog "D<sub>iii</sub>" is shown<br>
-          <li>D<sub>ii</sub> becomes blocked by D<sub>iii</sub> &#151;
+          <li>D<sub>ii</sub> becomes blocked by D<sub>iii</sub> &mdash;
 	      it's in the same application<br>
           <li>D<sub>i</sub> is shown<br>
-          <li>D<sub>i</sub> becomes blocked by D<sub>ii</sub> &#151; it's its owner<br>
-          <li>D<sub>iii</sub> remains unblocked &#151; it blocks D<sub>ii</sub> and 
+          <li>D<sub>i</sub> becomes blocked by D<sub>ii</sub> &mdash; it's its owner<br>
+          <li>D<sub>iii</sub> remains unblocked &mdash; it blocks D<sub>ii</sub> and 
 	      D<sub>ii</sub> blocks D<sub>i</sub><br>
 	  </ol>
           <br>
         </td>
-        <td align="center" valign="center">
+        <td align="center">
           <img src="modal-example3.gif">
           <br>
         </td>
       </tr>
       <tr>
-        <td align="left" valign="center">
+        <td align="left">
 	<ol>
           <li>Frame "F" is shown<br>
           <li>Toolkit-modal dialog "D<sub>i</sub>" is created, but not shown<br>
           <li>Document-modal dialog "D<sub>ii</sub>" is shown<br>
-          <li>F becomes blocked by D<sub>ii</sub> &#151; it's in the same document<br>
+          <li>F becomes blocked by D<sub>ii</sub> &mdash; it's in the same document<br>
           <li>Application-modal dialog "D<sub>iii</sub>" is shown<br>
-          <li>D<sub>ii</sub> becomes blocked by D<sub>iii</sub> &#151; it's in the
+          <li>D<sub>ii</sub> becomes blocked by D<sub>iii</sub> &mdash; it's in the
 	      same application<br>
           <li>D<sub>i</sub> is shown<br>
-          <li>D<sub>iii</sub> becomes blocked by D<sub>i</sub> &#151; D<sub>i</sub>
+          <li>D<sub>iii</sub> becomes blocked by D<sub>i</sub> &mdash; D<sub>i</sub>
 	      is not blocked<br>
           <li>D<sub>i</sub> remains unblocked<br>
 	  </ol>
           <br>
         </td>
-        <td align="center" valign="center">
+        <td align="center">
           <img src="modal-example4.gif">
           <br>
         </td>
--- a/jdk/src/share/classes/java/awt/event/ActionEvent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/event/ActionEvent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -95,7 +95,7 @@
     public static final int ACTION_LAST                 = 1001;
 
     /**
-     * This event id indicates that a meaningful action occured.
+     * This event id indicates that a meaningful action occurred.
      */
     @Native public static final int ACTION_PERFORMED    = ACTION_FIRST; //Event.ACTION_EVENT
 
--- a/jdk/src/share/classes/java/awt/event/InvocationEvent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/event/InvocationEvent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -25,6 +25,8 @@
 
 package java.awt.event;
 
+import sun.awt.AWTAccessor;
+
 import java.awt.ActiveEvent;
 import java.awt.AWTEvent;
 
@@ -56,6 +58,15 @@
  */
 public class InvocationEvent extends AWTEvent implements ActiveEvent {
 
+    static {
+        AWTAccessor.setInvocationEventAccessor(new AWTAccessor.InvocationEventAccessor() {
+            @Override
+            public void dispose(InvocationEvent invocationEvent) {
+                invocationEvent.finishedDispatching(false);
+            }
+        });
+    }
+
     /**
      * Marks the first integer id for the range of invocation event ids.
      */
@@ -78,11 +89,21 @@
 
     /**
      * The (potentially null) Object whose notifyAll() method will be called
-     * immediately after the Runnable.run() method has returned or thrown an exception.
+     * immediately after the Runnable.run() method has returned or thrown an exception
+     * or after the event was disposed.
      *
      * @see #isDispatched
      */
-    protected Object notifier;
+    protected volatile Object notifier;
+
+    /**
+     * The (potentially null) Runnable whose run() method will be called
+     * immediately after the event was dispatched or disposed.
+     *
+     * @see #isDispatched
+     * @since 1.8
+     */
+    private final Runnable listener;
 
     /**
      * Indicates whether the <code>run()</code> method of the <code>runnable</code>
@@ -147,7 +168,7 @@
      * @see #InvocationEvent(Object, Runnable, Object, boolean)
      */
     public InvocationEvent(Object source, Runnable runnable) {
-        this(source, runnable, null, false);
+        this(source, INVOCATION_DEFAULT, runnable, null, null, false);
     }
 
     /**
@@ -171,7 +192,8 @@
      * @param notifier          The {@code Object} whose <code>notifyAll</code>
      *                          method will be called after
      *                          <code>Runnable.run</code> has returned or
-     *                          thrown an exception
+     *                          thrown an exception or after the event was
+     *                          disposed
      * @param catchThrowables   Specifies whether <code>dispatch</code>
      *                          should catch Throwable when executing
      *                          the <code>Runnable</code>'s <code>run</code>
@@ -185,7 +207,39 @@
      */
     public InvocationEvent(Object source, Runnable runnable, Object notifier,
                            boolean catchThrowables) {
-        this(source, INVOCATION_DEFAULT, runnable, notifier, catchThrowables);
+        this(source, INVOCATION_DEFAULT, runnable, notifier, null, catchThrowables);
+    }
+
+    /**
+     * Constructs an <code>InvocationEvent</code> with the specified
+     * source which will execute the runnable's <code>run</code>
+     * method when dispatched.  If listener is non-<code>null</code>,
+     * <code>listener.run()</code> will be called immediately after
+     * <code>run</code> has returned, thrown an exception or the event
+     * was disposed.
+     * <p>This method throws an <code>IllegalArgumentException</code>
+     * if <code>source</code> is <code>null</code>.
+     *
+     * @param source            The <code>Object</code> that originated
+     *                          the event
+     * @param runnable          The <code>Runnable</code> whose
+     *                          <code>run</code> method will be
+     *                          executed
+     * @param listener          The <code>Runnable</code>Runnable whose
+     *                          <code>run()</code> method will be called
+     *                          after the {@code InvocationEvent}
+     *                          was dispatched or disposed
+     * @param catchThrowables   Specifies whether <code>dispatch</code>
+     *                          should catch Throwable when executing
+     *                          the <code>Runnable</code>'s <code>run</code>
+     *                          method, or should instead propagate those
+     *                          Throwables to the EventDispatchThread's
+     *                          dispatch loop
+     * @throws IllegalArgumentException if <code>source</code> is null
+     */
+    public InvocationEvent(Object source, Runnable runnable, Runnable listener,
+                           boolean catchThrowables)  {
+        this(source, INVOCATION_DEFAULT, runnable, null, listener, catchThrowables);
     }
 
     /**
@@ -208,7 +262,8 @@
      * @param notifier          The <code>Object</code> whose <code>notifyAll</code>
      *                          method will be called after
      *                          <code>Runnable.run</code> has returned or
-     *                          thrown an exception
+     *                          thrown an exception or after the event was
+     *                          disposed
      * @param catchThrowables   Specifies whether <code>dispatch</code>
      *                          should catch Throwable when executing the
      *                          <code>Runnable</code>'s <code>run</code>
@@ -221,13 +276,18 @@
      */
     protected InvocationEvent(Object source, int id, Runnable runnable,
                               Object notifier, boolean catchThrowables) {
+        this(source, id, runnable, notifier, null, catchThrowables);
+    }
+
+    private InvocationEvent(Object source, int id, Runnable runnable,
+                            Object notifier, Runnable listener, boolean catchThrowables) {
         super(source, id);
         this.runnable = runnable;
         this.notifier = notifier;
+        this.listener = listener;
         this.catchExceptions = catchThrowables;
         this.when = System.currentTimeMillis();
     }
-
     /**
      * Executes the Runnable's <code>run()</code> method and notifies the
      * notifier (if any) when <code>run()</code> has returned or thrown an exception.
@@ -251,13 +311,7 @@
                 runnable.run();
             }
         } finally {
-            dispatched = true;
-
-            if (notifier != null) {
-                synchronized (notifier) {
-                    notifier.notifyAll();
-                }
-            }
+            finishedDispatching(true);
         }
     }
 
@@ -331,6 +385,25 @@
     }
 
     /**
+     * Called when the event was dispatched or disposed
+     * @param dispatched true if the event was dispatched
+     *                   false if the event was disposed
+     */
+    private void finishedDispatching(boolean dispatched) {
+        this.dispatched = dispatched;
+
+        if (notifier != null) {
+            synchronized (notifier) {
+                notifier.notifyAll();
+            }
+        }
+
+        if (listener != null) {
+            listener.run();
+        }
+    }
+
+    /**
      * Returns a parameter string identifying this event.
      * This method is useful for event-logging and for debugging.
      *
--- a/jdk/src/share/classes/java/awt/event/KeyEvent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/event/KeyEvent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -133,7 +133,7 @@
  * WARNING: Aside from those keys that are defined by the Java language
  * (VK_ENTER, VK_BACK_SPACE, and VK_TAB), do not rely on the values of the VK_
  * constants.  Sun reserves the right to change these values as needed
- * to accomodate a wider range of keyboards in the future.
+ * to accommodate a wider range of keyboards in the future.
  * <p>
  * An unspecified behavior will be caused if the {@code id} parameter
  * of any particular {@code KeyEvent} instance is not
--- a/jdk/src/share/classes/java/awt/event/WindowEvent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/event/WindowEvent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -79,8 +79,10 @@
     @Native public static final int WINDOW_CLOSING      = 1 + WINDOW_FIRST; //Event.WINDOW_DESTROY
 
     /**
-     * The window closed event. This event is delivered after
-     * the window has been closed as the result of a call to dispose.
+     * The window closed event. This event is delivered after the displayable
+     * window has been closed as the result of a call to dispose.
+     * @see java.awt.Component#isDisplayable
+     * @see Window#dispose
      */
     @Native public static final int WINDOW_CLOSED       = 2 + WINDOW_FIRST;
 
--- a/jdk/src/share/classes/java/awt/event/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/event/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,6 +25,7 @@
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <html>
+<head><title></title></head>
 <body bgcolor="white">
 
 Provides interfaces and classes for dealing with different
--- a/jdk/src/share/classes/java/awt/font/FontRenderContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/font/FontRenderContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -126,7 +126,7 @@
      * anti-aliasing or fractional metrics.
      * @param tx the transform which is used to scale typographical points
      * to pixels in this <code>FontRenderContext</code>.  If null, an
-     * identity tranform is used.
+     * identity transform is used.
      * @param aaHint - one of the text antialiasing rendering hint values
      * defined in {@link java.awt.RenderingHints java.awt.RenderingHints}.
      * Any other value will throw <code>IllegalArgumentException</code>.
--- a/jdk/src/share/classes/java/awt/font/GlyphMetrics.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/font/GlyphMetrics.java	Wed Jul 05 19:21:26 2017 +0200
@@ -43,7 +43,7 @@
 import java.awt.geom.Rectangle2D;
 
 /**
- * The <code>GlyphMetrics</code> class represents infomation for a
+ * The <code>GlyphMetrics</code> class represents information for a
  * single glyph.   A glyph is the visual representation of one or more
  * characters.  Many different glyphs can be used to represent a single
  * character or combination of characters.  <code>GlyphMetrics</code>
@@ -143,24 +143,24 @@
      * as a ligature, for example 'fi' or 'ffi'.  It is followed by
      * filler glyphs for the remaining characters. Filler and combining
      * glyphs can be intermixed to control positioning of accent marks
-     * on the logically preceeding ligature.
+     * on the logically preceding ligature.
      */
     public static final byte LIGATURE = 1;
 
     /**
      * Indicates a glyph that represents a combining character,
      * such as an umlaut.  There is no caret position between this glyph
-     * and the preceeding glyph.
+     * and the preceding glyph.
      */
     public static final byte COMBINING = 2;
 
     /**
      * Indicates a glyph with no corresponding character in the
      * backing store.  The glyph is associated with the character
-     * represented by the logicaly preceeding non-component glyph.  This
+     * represented by the logically preceding non-component glyph.  This
      * is used for kashida justification or other visual modifications to
      * existing glyphs.  There is no caret position between this glyph
-     * and the preceeding glyph.
+     * and the preceding glyph.
      */
     public static final byte COMPONENT = 3;
 
--- a/jdk/src/share/classes/java/awt/font/GlyphVector.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/font/GlyphVector.java	Wed Jul 05 19:21:26 2017 +0200
@@ -395,7 +395,7 @@
      * indicates that no special transform is applied for the specified
      * glyph.
      * This method can be used to rotate, mirror, translate and scale the
-     * glyph.  Adding a transform can result in signifant performance changes.
+     * glyph.  Adding a transform can result in significant performance changes.
      * @param glyphIndex the index into this <code>GlyphVector</code>
      * @param newTX the new transform of the glyph at <code>glyphIndex</code>
      * @throws IndexOutOfBoundsException if <code>glyphIndex</code>
--- a/jdk/src/share/classes/java/awt/font/LineBreakMeasurer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/font/LineBreakMeasurer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -112,7 +112,7 @@
  * <strong>Examples</strong>:<p>
  * Rendering a paragraph in a component
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * public void paint(Graphics graphics) {
  *
  *     Point2D pen = new Point2D(10, 20);
@@ -137,13 +137,13 @@
  *         pen.y += layout.getDescent() + layout.getLeading();
  *     }
  * }
- * </pre>
+ * }</pre>
  * </blockquote>
  * <p>
  * Rendering text with tabs.  For simplicity, the overall text
  * direction is assumed to be left-to-right
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * public void paint(Graphics graphics) {
  *
  *     float leftMargin = 10, rightMargin = 310;
@@ -240,7 +240,7 @@
  *         verticalPos += maxDescent;
  *     }
  * }
- * </pre>
+ * }</pre>
  * </blockquote>
  * @see TextLayout
  */
--- a/jdk/src/share/classes/java/awt/font/MultipleMaster.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/font/MultipleMaster.java	Wed Jul 05 19:21:26 2017 +0200
@@ -41,7 +41,7 @@
   public  int getNumDesignAxes();
 
   /**
-   * Returns an array of design limits interleaved in the form [from->to]
+   * Returns an array of design limits interleaved in the form [from&rarr;to]
    * for each axis.  For example,
    * design limits for weight could be from 0.1 to 1.0. The values are
    * returned in the same order returned by
--- a/jdk/src/share/classes/java/awt/font/NumericShaper.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/font/NumericShaper.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1212,7 +1212,7 @@
      * For example, to check if a shaper shapes to Arabic, you would use the
      * following:
      * <blockquote>
-     *   <code>if ((shaper.getRanges() & shaper.ARABIC) != 0) { ... </code>
+     *   <code>if ((shaper.getRanges() &amp; shaper.ARABIC) != 0) { ... </code>
      * </blockquote>
      *
      * <p>Note that this method supports only the bit mask-based
--- a/jdk/src/share/classes/java/awt/font/OpenType.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/font/OpenType.java	Wed Jul 05 19:21:26 2017 +0200
@@ -33,7 +33,7 @@
  * <p>
  * For more information on TrueType and OpenType fonts, see the
  * OpenType specification.
- * ( <a href=http://www.microsoft.com/typography/otspec/">http://www.microsoft.com/typography/otspec/l</a> ).
+ * ( <a href="http://www.microsoft.com/typography/otspec/">http://www.microsoft.com/typography/otspec/</a> ).
  */
 public interface OpenType {
 
@@ -268,7 +268,7 @@
   public final static int       TAG_ACNT        = 0x61636e74;
 
   /**
-   * Axis variaiton.  Table tag "avar" in the Open
+   * Axis variation.  Table tag "avar" in the Open
    * Type Specification.
    */
   public final static int       TAG_AVAR        = 0x61766172;
--- a/jdk/src/share/classes/java/awt/font/TextLayout.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/font/TextLayout.java	Wed Jul 05 19:21:26 2017 +0200
@@ -223,7 +223,7 @@
  * baseline-relative coordinates map the 'x' coordinate to the
  * distance along the baseline, (positive x is forward along the
  * baseline), and the 'y' coordinate to a distance along the
- * perpendicular to the baseline at 'x' (postitive y is 90 degrees
+ * perpendicular to the baseline at 'x' (positive y is 90 degrees
  * clockwise from the baseline vector).  Values in standard
  * coordinates are measured along the x and y axes, with 0,0 at the
  * origin of the TextLayout.  Documentation for each relevant API
@@ -337,7 +337,7 @@
                                           TextHitInfo hit2,
                                           TextLayout layout) {
 
-            // default implmentation just calls private method on layout
+            // default implementation just calls private method on layout
             return layout.getStrongHit(hit1, hit2);
         }
     }
@@ -912,7 +912,7 @@
      * The ascent is the distance from the top (right) of the
      * <code>TextLayout</code> to the baseline.  It is always either
      * positive or zero.  The ascent is sufficient to
-     * accomodate superscripted text and is the maximum of the sum of the
+     * accommodate superscripted text and is the maximum of the sum of the
      * ascent, offset, and baseline of each glyph.  The ascent is
      * the maximum ascent from the baseline of all the text in the
      * TextLayout.  It is in baseline-relative coordinates.
@@ -927,7 +927,7 @@
      * Returns the descent of this <code>TextLayout</code>.
      * The descent is the distance from the baseline to the bottom (left) of
      * the <code>TextLayout</code>.  It is always either positive or zero.
-     * The descent is sufficient to accomodate subscripted text and is the
+     * The descent is sufficient to accommodate subscripted text and is the
      * maximum of the sum of the descent, offset, and baseline of each glyph.
      * This is the maximum descent from the baseline of all the text in
      * the TextLayout.  It is in baseline-relative coordinates.
--- a/jdk/src/share/classes/java/awt/font/TransformAttribute.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/font/TransformAttribute.java	Wed Jul 05 19:21:26 2017 +0200
@@ -120,7 +120,7 @@
         return this;
     }
 
-    // Added for serial backwards compatability (4348425)
+    // Added for serial backwards compatibility (4348425)
     static final long serialVersionUID = 3356247357827709530L;
 
     /**
--- a/jdk/src/share/classes/java/awt/font/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/font/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,6 +25,7 @@
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <html>
+<head><title></title></head>
 <body bgcolor="white">
 
 Provides classes and interface relating to fonts.  It
--- a/jdk/src/share/classes/java/awt/geom/AffineTransform.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/geom/AffineTransform.java	Wed Jul 05 19:21:26 2017 +0200
@@ -47,7 +47,7 @@
  *      [ 1 ]   [   0    0    1   ] [ 1 ]   [         1         ]
  * </pre>
  * <p>
- * <a name="quadrantapproximation"></a><h4>Handling 90-Degree Rotations</h4>
+ * <h4><a name="quadrantapproximation">Handling 90-Degree Rotations</a></h4>
  * <p>
  * In some variations of the <code>rotate</code> methods in the
  * <code>AffineTransform</code> class, a double-precision argument
@@ -525,7 +525,7 @@
     /**
      * Constructs a new <code>AffineTransform</code> from an array of
      * floating point values representing either the 4 non-translation
-     * enries or the 6 specifiable entries of the 3x3 transformation
+     * entries or the 6 specifiable entries of the 3x3 transformation
      * matrix.  The values are retrieved from the array as
      * {&nbsp;m00&nbsp;m10&nbsp;m01&nbsp;m11&nbsp;[m02&nbsp;m12]}.
      * @param flatmatrix the float array containing the values to be set
@@ -715,7 +715,7 @@
 
     /**
      * Returns a transform that rotates coordinates around an anchor
-     * point accordinate to a rotation vector.
+     * point according to a rotation vector.
      * All coordinates rotate about the specified anchor coordinates
      * by the same amount.
      * The amount of rotation is such that coordinates along the former
@@ -845,7 +845,7 @@
      * this transform.
      * The return value is either one of the constants TYPE_IDENTITY
      * or TYPE_GENERAL_TRANSFORM, or a combination of the
-     * appriopriate flag bits.
+     * appropriate flag bits.
      * A valid combination of flag bits is an exclusive OR operation
      * that can combine
      * the TYPE_TRANSLATION flag bit
@@ -2876,7 +2876,7 @@
      * @param ptDst the specified <code>Point2D</code> that stores the
      * result of transforming <code>ptSrc</code>
      * @return the <code>ptDst</code> after transforming
-     * <code>ptSrc</code> and stroring the result in <code>ptDst</code>.
+     * <code>ptSrc</code> and storing the result in <code>ptDst</code>.
      * @since 1.2
      */
     public Point2D transform(Point2D ptSrc, Point2D ptDst) {
--- a/jdk/src/share/classes/java/awt/geom/Line2D.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/geom/Line2D.java	Wed Jul 05 19:21:26 2017 +0200
@@ -477,7 +477,7 @@
      * direction is clockwise.
      * <p>A return value of 0 indicates that the point lies
      * exactly on the line segment.  Note that an indicator value
-     * of 0 is rare and not useful for determining colinearity
+     * of 0 is rare and not useful for determining collinearity
      * because of floating point rounding issues.
      * <p>If the point is colinear with the line segment, but
      * not between the end points, then the value will be -1 if the point
--- a/jdk/src/share/classes/java/awt/geom/Path2D.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/geom/Path2D.java	Wed Jul 05 19:21:26 2017 +0200
@@ -2064,7 +2064,7 @@
      * @param w the width of the specified rectangular area
      * @param h the height of the specified rectangular area
      * @return {@code true} if the specified {@code PathIterator} contains
-     *         the specified rectangluar area; {@code false} otherwise.
+     *         the specified rectangular area; {@code false} otherwise.
      * @since 1.6
      */
     public static boolean contains(PathIterator pi,
--- a/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/geom/QuadCurve2D.java	Wed Jul 05 19:21:26 2017 +0200
@@ -511,7 +511,7 @@
     /**
      * Returns the X coordinate of the end point in
      * <code>double</code> precision.
-     * @return the x coordiante of the end point.
+     * @return the x coordinate of the end point.
      * @since 1.2
      */
     public abstract double getX2();
--- a/jdk/src/share/classes/java/awt/geom/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/geom/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,6 +25,7 @@
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <html>
+<head><title></title></head>
 <body bgcolor="white">
 
 Provides the Java 2D classes for defining and performing operations
--- a/jdk/src/share/classes/java/awt/im/InputContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/im/InputContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -98,7 +98,6 @@
      * an input method or keyboard layout has been successfully selected. The
      * following steps are taken until an input method has been selected:
      *
-     * <p>
      * <ul>
      * <li>
      * If the currently selected input method or keyboard layout supports the
--- a/jdk/src/share/classes/java/awt/im/InputMethodRequests.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/im/InputMethodRequests.java	Wed Jul 05 19:21:26 2017 +0200
@@ -83,7 +83,7 @@
      * For example, for horizontal left-to-right text (such as English), the
      * location to the left of the left-most character on the last line
      * containing selected text is returned. For vertical top-to-bottom text,
-     * with lines proceding from right to left, the location to the top of the
+     * with lines proceeding from right to left, the location to the top of the
      * left-most line containing selected text is returned.
      *
      * <p>
--- a/jdk/src/share/classes/java/awt/image/BandedSampleModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/image/BandedSampleModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -39,7 +39,7 @@
  *  This class represents image data which is stored in a band interleaved
  *  fashion and for
  *  which each sample of a pixel occupies one data element of the DataBuffer.
- *  It subclasses ComponentSampleModel but provides a more efficent
+ *  It subclasses ComponentSampleModel but provides a more efficient
  *  implementation for accessing band interleaved image data than is provided
  *  by ComponentSampleModel.  This class should typically be used when working
  *  with images which store sample data for each band in a different bank of the
--- a/jdk/src/share/classes/java/awt/image/BufferStrategy.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/image/BufferStrategy.java	Wed Jul 05 19:21:26 2017 +0200
@@ -34,7 +34,7 @@
  * to organize complex memory on a particular <code>Canvas</code> or
  * <code>Window</code>.  Hardware and software limitations determine whether and
  * how a particular buffer strategy can be implemented.  These limitations
- * are detectible through the capabilities of the
+ * are detectable through the capabilities of the
  * <code>GraphicsConfiguration</code> used when creating the
  * <code>Canvas</code> or <code>Window</code>.
  * <p>
--- a/jdk/src/share/classes/java/awt/image/BufferedImage.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/image/BufferedImage.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1336,7 +1336,7 @@
     /**
      * Returns the minimum tile index in the y direction.
      * This is always zero.
-     * @return the mininum tile index in the y direction.
+     * @return the minimum tile index in the y direction.
      */
     public int getMinTileY() {
         return 0;
--- a/jdk/src/share/classes/java/awt/image/ComponentColorModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/image/ComponentColorModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -2318,7 +2318,7 @@
      * and is not large enough to hold all the color and alpha components
      * (starting at <code>normOffset</code>).
      * <p>
-     * This method must be overrridden by a subclass if that subclass
+     * This method must be overridden by a subclass if that subclass
      * is designed to translate pixel sample values to color component values
      * in a non-default way.  The default translations implemented by this
      * class is described in the class comments.  Any subclass implementing
--- a/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -167,6 +167,7 @@
         for (int i=0; i<numBands; i++) {
             bankIndices[i] = 0;
         }
+        verify();
     }
 
 
@@ -244,24 +245,53 @@
             throw new IllegalArgumentException("Length of bandOffsets must "+
                                                "equal length of bankIndices.");
         }
+        verify();
+    }
+
+    private void verify() {
+        int requiredSize = getBufferSize();
     }
 
     /**
      * Returns the size of the data buffer (in data elements) needed
      * for a data buffer that matches this ComponentSampleModel.
      */
-     private long getBufferSize() {
+     private int getBufferSize() {
          int maxBandOff=bandOffsets[0];
-         for (int i=1; i<bandOffsets.length; i++)
+         for (int i=1; i<bandOffsets.length; i++) {
              maxBandOff = Math.max(maxBandOff,bandOffsets[i]);
+         }
+
+         if (maxBandOff < 0 || maxBandOff > (Integer.MAX_VALUE - 1)) {
+             throw new IllegalArgumentException("Invalid band offset");
+         }
+
+         if (pixelStride < 0 || pixelStride > (Integer.MAX_VALUE / width)) {
+             throw new IllegalArgumentException("Invalid pixel stride");
+         }
+
+         if (scanlineStride < 0 || scanlineStride > (Integer.MAX_VALUE / height)) {
+             throw new IllegalArgumentException("Invalid scanline stride");
+         }
 
-         long size = 0;
-         if (maxBandOff >= 0)
-             size += maxBandOff+1;
-         if (pixelStride > 0)
-             size += pixelStride * (width-1);
-         if (scanlineStride > 0)
-             size += scanlineStride*(height-1);
+         int size = maxBandOff + 1;
+
+         int val = pixelStride * (width - 1);
+
+         if (val > (Integer.MAX_VALUE - size)) {
+             throw new IllegalArgumentException("Invalid pixel stride");
+         }
+
+         size += val;
+
+         val = scanlineStride * (height - 1);
+
+         if (val > (Integer.MAX_VALUE - size)) {
+             throw new IllegalArgumentException("Invalid scan stride");
+         }
+
+         size += val;
+
          return size;
      }
 
@@ -409,7 +439,7 @@
     public DataBuffer createDataBuffer() {
         DataBuffer dataBuffer = null;
 
-        int size = (int)getBufferSize();
+        int size = getBufferSize();
         switch (dataType) {
         case DataBuffer.TYPE_BYTE:
             dataBuffer = new DataBufferByte(size, numBanks);
@@ -584,7 +614,7 @@
      *
      * @throws NullPointerException if data is null.
      * @throws ArrayIndexOutOfBoundsException if the coordinates are
-     * not in bounds, or if obj is too small to hold the ouput.
+     * not in bounds, or if obj is too small to hold the output.
      */
     public Object getDataElements(int x, int y, Object obj, DataBuffer data) {
         if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) {
--- a/jdk/src/share/classes/java/awt/image/ImageConsumer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/image/ImageConsumer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -191,7 +191,7 @@
      * finished delivering all of the pixels that the source image
      * contains, or when a single frame of a multi-frame animation has
      * been completed, or when an error in loading or producing the
-     * image has occured.  The ImageConsumer should remove itself from the
+     * image has occurred.  The ImageConsumer should remove itself from the
      * list of consumers registered with the ImageProducer at this time,
      * unless it is interested in successive frames.
      * @param status the status of image loading
--- a/jdk/src/share/classes/java/awt/image/IndexColorModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/image/IndexColorModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1152,7 +1152,7 @@
      * @throws ClassCastException if <code>pixel</code> is not a
      *            primitive array of type <code>transferType</code>
      * @throws UnsupportedOperationException if <code>transferType</code>
-     *         is not one of the supported transer types
+     *         is not one of the supported transfer types
      * @see ColorModel#hasAlpha
      * @see ColorModel#getNumComponents
      */
@@ -1271,7 +1271,7 @@
      *  array is not large enough to hold all of the color and alpha
      *  components starting at <code>offset</code>
      * @throws UnsupportedOperationException if <code>transferType</code>
-     *         is not one of the supported transer types
+     *         is not one of the supported transfer types
      * @see WritableRaster#setDataElements
      * @see SampleModel#setDataElements
      */
--- a/jdk/src/share/classes/java/awt/image/PixelInterleavedSampleModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/image/PixelInterleavedSampleModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -29,7 +29,7 @@
  *  This class represents image data which is stored in a pixel interleaved
  *  fashion and for
  *  which each sample of a pixel occupies one data element of the DataBuffer.
- *  It subclasses ComponentSampleModel but provides a more efficent
+ *  It subclasses ComponentSampleModel but provides a more efficient
  *  implementation for accessing pixel interleaved image data than is provided
  *  by ComponentSampleModel.  This class
  *  stores sample data for all bands in a single bank of the
--- a/jdk/src/share/classes/java/awt/image/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/image/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,6 +25,7 @@
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <html>
+<head><title></title></head>
 <body bgcolor="white">
 
 Provides classes for creating and modifying images.
--- a/jdk/src/share/classes/java/awt/image/renderable/RenderableImage.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/image/renderable/RenderableImage.java	Wed Jul 05 19:21:26 2017 +0200
@@ -65,7 +65,7 @@
      * String constant that can be used to identify a property on
      * a RenderedImage obtained via the createRendering or
      * createScaledRendering methods.  If such a property exists,
-     * the value of the propoery will be a RenderingHints object
+     * the value of the property will be a RenderingHints object
      * specifying which hints were observed in creating the rendering.
      */
      static final String HINTS_OBSERVED = "HINTS_OBSERVED";
@@ -162,7 +162,7 @@
      *
      * @param w the width of rendered image in pixels, or 0.
      * @param h the height of rendered image in pixels, or 0.
-     * @param hints a RenderingHints object containg hints.
+     * @param hints a RenderingHints object containing hints.
      * @return a RenderedImage containing the rendered data.
      */
     RenderedImage createScaledRendering(int w, int h, RenderingHints hints);
--- a/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java	Wed Jul 05 19:21:26 2017 +0200
@@ -236,7 +236,7 @@
      *
      * @param w the width of rendered image in pixels, or 0.
      * @param h the height of rendered image in pixels, or 0.
-     * @param hints a RenderingHints object containg hints.
+     * @param hints a RenderingHints object containing hints.
      * @return a RenderedImage containing the rendered data.
      */
     public RenderedImage createScaledRendering(int w, int h,
--- a/jdk/src/share/classes/java/awt/image/renderable/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/image/renderable/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,6 +25,7 @@
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <html>
+<head><title></title></head>
 <body bgcolor="white">
 
 Provides classes and interfaces for producing
--- a/jdk/src/share/classes/java/awt/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,6 +25,7 @@
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <html>
+<head><title></title></head>
 <body bgcolor="white">
 
 Contains all of the classes for creating user
@@ -53,7 +54,7 @@
 there is no way to properly arrange them within a Container object.
 The object's bounds are defined by any object's coordinate
 in combination with its size on a respective axis. 
-<p>
+
 
 <h2>Additional Specification</h2>
 <ul>
--- a/jdk/src/share/classes/java/awt/print/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/awt/print/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,6 +25,7 @@
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
 <html>
+<head><title></title></head>
 <body bgcolor="white">
 
 Provides classes and interfaces for a general printing API.  The
--- a/jdk/src/share/classes/java/beans/AppletInitializer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/beans/AppletInitializer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -32,7 +32,7 @@
 /**
  * <p>
  * This interface is designed to work in collusion with java.beans.Beans.instantiate.
- * The interafce is intended to provide mechanism to allow the proper
+ * The interface is intended to provide mechanism to allow the proper
  * initialization of JavaBeans that are also Applets, during their
  * instantiation by java.beans.Beans.instantiate().
  * </p>
--- a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Wed Jul 05 19:21:26 2017 +0200
@@ -273,7 +273,7 @@
         TableModelListener (the JTable itself in this case) to the supplied
         table model.
 
-        We do not need to explictly add these listeners to the model in an
+        We do not need to explicitly add these listeners to the model in an
         archive as they will be added automatically by, in the above case,
         the JTable's "setModel" method. In some cases, we must specifically
         avoid trying to do this since the listener may be an inner class
--- a/jdk/src/share/classes/java/beans/EventHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/beans/EventHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -611,7 +611,7 @@
      * the empty string.
      * The format of the <code>eventPropertyName</code> string is a sequence of
      * methods or properties where each method or
-     * property is applied to the value returned by the preceeding method
+     * property is applied to the value returned by the preceding method
      * starting from the incoming event object.
      * The syntax is: <code>propertyName{.propertyName}*</code>
      * where <code>propertyName</code> matches a method or
--- a/jdk/src/share/classes/java/beans/MethodDescriptor.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/beans/MethodDescriptor.java	Wed Jul 05 19:21:26 2017 +0200
@@ -76,7 +76,7 @@
     }
 
     /**
-     * Gets the method that this MethodDescriptor encapsualtes.
+     * Gets the method that this MethodDescriptor encapsulates.
      *
      * @return The low-level description of the method
      */
--- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java	Wed Jul 05 19:21:26 2017 +0200
@@ -335,7 +335,7 @@
      */
     void setClass0(Class<?> clz) {
         if (getClass0() != null && clz.isAssignableFrom(getClass0())) {
-            // dont replace a subclass with a superclass
+            // don't replace a subclass with a superclass
             return;
         }
         super.setClass0(clz);
--- a/jdk/src/share/classes/java/beans/PropertyEditorSupport.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/beans/PropertyEditorSupport.java	Wed Jul 05 19:21:26 2017 +0200
@@ -30,7 +30,7 @@
 /**
  * This is a support class to help build property editors.
  * <p>
- * It can be used either as a base class or as a delagatee.
+ * It can be used either as a base class or as a delegate.
  */
 
 public class PropertyEditorSupport implements PropertyEditor {
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java	Wed Jul 05 19:21:26 2017 +0200
@@ -302,7 +302,7 @@
 
     /**
      * This method may be overridden by subclasses to provide their own
-     * initialization behaviors. When invoked any resources requried by the
+     * initialization behaviors. When invoked any resources required by the
      * BeanContextChild should be obtained from the current BeanContext.
      */
 
@@ -317,7 +317,7 @@
     private void writeObject(ObjectOutputStream oos) throws IOException {
 
         /*
-         * dont serialize if we are delegated and the delegator isnt also
+         * don't serialize if we are delegated and the delegator is not also
          * serializable.
          */
 
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedListener.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedListener.java	Wed Jul 05 19:21:26 2017 +0200
@@ -38,7 +38,7 @@
 
     /**
      * The service named has been revoked. getService requests for
-     * this service will no longer be satisifed.
+     * this service will no longer be satisfied.
      * @param bcsre the <code>BeanContextServiceRevokedEvent</code> received
      * by this listener.
      */
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java	Wed Jul 05 19:21:26 2017 +0200
@@ -620,7 +620,7 @@
 
         /**
          * subclasses can override this method to create new subclasses of
-         * BCSSServiceProvider without having to overrride addService() in
+         * BCSSServiceProvider without having to override addService() in
          * order to instantiate.
          * @param sc the class
          * @param bcsp the service provider
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java	Wed Jul 05 19:21:26 2017 +0200
@@ -183,7 +183,7 @@
      * into a <tt>BeanContext</tt>.
      * </p>
      * <p>
-     * The semantics of the beanName parameter are defined by java.beans.Beans.instantate.
+     * The semantics of the beanName parameter are defined by java.beans.Beans.instantiate.
      * </p>
      *
      * @param beanName the name of the Bean to instantiate within this BeanContext
--- a/jdk/src/share/classes/java/io/ByteArrayInputStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/ByteArrayInputStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -275,7 +275,6 @@
      * Closing a <tt>ByteArrayInputStream</tt> has no effect. The methods in
      * this class can be called after the stream has been closed without
      * generating an <tt>IOException</tt>.
-     * <p>
      */
     public void close() throws IOException {
     }
--- a/jdk/src/share/classes/java/io/ByteArrayOutputStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/ByteArrayOutputStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -263,8 +263,6 @@
      * Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
      * this class can be called after the stream has been closed without
      * generating an <tt>IOException</tt>.
-     * <p>
-     *
      */
     public void close() throws IOException {
     }
--- a/jdk/src/share/classes/java/io/Closeable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/Closeable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -34,7 +34,6 @@
  *
  * @since 1.5
  */
-@FunctionalInterface
 public interface Closeable extends AutoCloseable {
 
     /**
--- a/jdk/src/share/classes/java/io/DataInput.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/DataInput.java	Wed Jul 05 19:21:26 2017 +0200
@@ -155,7 +155,7 @@
      * to the length of {@code b}.
      * <p>
      * This method blocks until one of the
-     * following conditions occurs:<p>
+     * following conditions occurs:
      * <ul>
      * <li>{@code b.length}
      * bytes of input data are available, in which
@@ -197,7 +197,7 @@
      * <p>
      * This method
      * blocks until one of the following conditions
-     * occurs:<p>
+     * occurs:
      * <ul>
      * <li>{@code len} bytes
      * of input data are available, in which case
@@ -316,8 +316,8 @@
      * be the second byte. The value
      * returned
      * is:
-     * <p><pre><code>(short)((a &lt;&lt; 8) | (b &amp; 0xff))
-     * </code></pre>
+     * <pre>{@code (short)((a << 8) | (b & 0xff))
+     * }</pre>
      * This method
      * is suitable for reading the bytes written
      * by the {@code writeShort} method of
@@ -337,8 +337,8 @@
      * be the first byte read and
      * {@code b}
      * be the second byte. The value returned is:
-     * <p><pre><code>(((a &amp; 0xff) &lt;&lt; 8) | (b &amp; 0xff))
-     * </code></pre>
+     * <pre>{@code (((a & 0xff) << 8) | (b & 0xff))
+     * }</pre>
      * This method is suitable for reading the bytes
      * written by the {@code writeShort} method
      * of interface {@code DataOutput}  if
@@ -359,8 +359,8 @@
      * be the first byte read and {@code b}
      * be the second byte. The value
      * returned is:
-     * <p><pre><code>(char)((a &lt;&lt; 8) | (b &amp; 0xff))
-     * </code></pre>
+     * <pre>{@code (char)((a << 8) | (b & 0xff))
+     * }</pre>
      * This method
      * is suitable for reading bytes written by
      * the {@code writeChar} method of interface
@@ -377,10 +377,10 @@
      * Reads four input bytes and returns an
      * {@code int} value. Let {@code a-d}
      * be the first through fourth bytes read. The value returned is:
-     * <p><pre><code>
-     * (((a &amp; 0xff) &lt;&lt; 24) | ((b &amp; 0xff) &lt;&lt; 16) |
-     * &#32;((c &amp; 0xff) &lt;&lt; 8) | (d &amp; 0xff))
-     * </code></pre>
+     * <pre>{@code
+     * (((a & 0xff) << 24) | ((b & 0xff) << 16) |
+     *  ((c & 0xff) <<  8) | (d & 0xff))
+     * }</pre>
      * This method is suitable
      * for reading bytes written by the {@code writeInt}
      * method of interface {@code DataOutput}.
@@ -397,16 +397,16 @@
      * a {@code long} value. Let {@code a-h}
      * be the first through eighth bytes read.
      * The value returned is:
-     * <p><pre><code>
-     * (((long)(a &amp; 0xff) &lt;&lt; 56) |
-     *  ((long)(b &amp; 0xff) &lt;&lt; 48) |
-     *  ((long)(c &amp; 0xff) &lt;&lt; 40) |
-     *  ((long)(d &amp; 0xff) &lt;&lt; 32) |
-     *  ((long)(e &amp; 0xff) &lt;&lt; 24) |
-     *  ((long)(f &amp; 0xff) &lt;&lt; 16) |
-     *  ((long)(g &amp; 0xff) &lt;&lt;  8) |
-     *  ((long)(h &amp; 0xff)))
-     * </code></pre>
+     * <pre>{@code
+     * (((long)(a & 0xff) << 56) |
+     *  ((long)(b & 0xff) << 48) |
+     *  ((long)(c & 0xff) << 40) |
+     *  ((long)(d & 0xff) << 32) |
+     *  ((long)(e & 0xff) << 24) |
+     *  ((long)(f & 0xff) << 16) |
+     *  ((long)(g & 0xff) <<  8) |
+     *  ((long)(h & 0xff)))
+     * }</pre>
      * <p>
      * This method is suitable
      * for reading bytes written by the {@code writeLong}
@@ -540,9 +540,9 @@
      * not match the bit pattern {@code 10xxxxxx},
      * then a {@code UTFDataFormatException}
      * is thrown. Otherwise, the group is converted
-     * to the character:<p>
-     * <pre><code>(char)(((a&amp; 0x1F) &lt;&lt; 6) | (b &amp; 0x3F))
-     * </code></pre>
+     * to the character:
+     * <pre>{@code (char)(((a & 0x1F) << 6) | (b & 0x3F))
+     * }</pre>
      * If the first byte of a group
      * matches the bit pattern {@code 1110xxxx},
      * then the group consists of that byte {@code a}
@@ -554,10 +554,10 @@
      * does not match the bit pattern {@code 10xxxxxx},
      * then a {@code UTFDataFormatException}
      * is thrown. Otherwise, the group is converted
-     * to the character:<p>
-     * <pre><code>
-     * (char)(((a &amp; 0x0F) &lt;&lt; 12) | ((b &amp; 0x3F) &lt;&lt; 6) | (c &amp; 0x3F))
-     * </code></pre>
+     * to the character:
+     * <pre>{@code
+     * (char)(((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F))
+     * }</pre>
      * If the first byte of a group matches the
      * pattern {@code 1111xxxx} or the pattern
      * {@code 10xxxxxx}, then a {@code UTFDataFormatException}
--- a/jdk/src/share/classes/java/io/DataOutput.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/DataOutput.java	Wed Jul 05 19:21:26 2017 +0200
@@ -134,11 +134,11 @@
      * Writes two bytes to the output
      * stream to represent the value of the argument.
      * The byte values to be written, in the  order
-     * shown, are: <p>
-     * <pre><code>
-     * (byte)(0xff &amp; (v &gt;&gt; 8))
-     * (byte)(0xff &amp; v)
-     * </code> </pre> <p>
+     * shown, are:
+     * <pre>{@code
+     * (byte)(0xff & (v >> 8))
+     * (byte)(0xff & v)
+     * }</pre> <p>
      * The bytes written by this method may be
      * read by the <code>readShort</code> method
      * of interface <code>DataInput</code> , which
@@ -156,10 +156,10 @@
      * output stream.
      * The byte values to be written, in the  order
      * shown, are:
-     * <p><pre><code>
-     * (byte)(0xff &amp; (v &gt;&gt; 8))
-     * (byte)(0xff &amp; v)
-     * </code></pre><p>
+     * <pre>{@code
+     * (byte)(0xff & (v >> 8))
+     * (byte)(0xff & v)
+     * }</pre><p>
      * The bytes written by this method may be
      * read by the <code>readChar</code> method
      * of interface <code>DataInput</code> , which
@@ -176,12 +176,12 @@
      * comprised of four bytes, to the output stream.
      * The byte values to be written, in the  order
      * shown, are:
-     * <p><pre><code>
-     * (byte)(0xff &amp; (v &gt;&gt; 24))
-     * (byte)(0xff &amp; (v &gt;&gt; 16))
-     * (byte)(0xff &amp; (v &gt;&gt; &#32; &#32;8))
-     * (byte)(0xff &amp; v)
-     * </code></pre><p>
+     * <pre>{@code
+     * (byte)(0xff & (v >> 24))
+     * (byte)(0xff & (v >> 16))
+     * (byte)(0xff & (v >>  8))
+     * (byte)(0xff & v)
+     * }</pre><p>
      * The bytes written by this method may be read
      * by the <code>readInt</code> method of interface
      * <code>DataInput</code> , which will then
@@ -197,16 +197,16 @@
      * comprised of eight bytes, to the output stream.
      * The byte values to be written, in the  order
      * shown, are:
-     * <p><pre><code>
-     * (byte)(0xff &amp; (v &gt;&gt; 56))
-     * (byte)(0xff &amp; (v &gt;&gt; 48))
-     * (byte)(0xff &amp; (v &gt;&gt; 40))
-     * (byte)(0xff &amp; (v &gt;&gt; 32))
-     * (byte)(0xff &amp; (v &gt;&gt; 24))
-     * (byte)(0xff &amp; (v &gt;&gt; 16))
-     * (byte)(0xff &amp; (v &gt;&gt;  8))
-     * (byte)(0xff &amp; v)
-     * </code></pre><p>
+     * <pre>{@code
+     * (byte)(0xff & (v >> 56))
+     * (byte)(0xff & (v >> 48))
+     * (byte)(0xff & (v >> 40))
+     * (byte)(0xff & (v >> 32))
+     * (byte)(0xff & (v >> 24))
+     * (byte)(0xff & (v >> 16))
+     * (byte)(0xff & (v >>  8))
+     * (byte)(0xff & v)
+     * }</pre><p>
      * The bytes written by this method may be
      * read by the <code>readLong</code> method
      * of interface <code>DataInput</code> , which
@@ -314,24 +314,24 @@
      * If a character <code>c</code>
      * is in the range <code>&#92;u0001</code> through
      * <code>&#92;u007f</code>, it is represented
-     * by one byte:<p>
+     * by one byte:
      * <pre>(byte)c </pre>  <p>
      * If a character <code>c</code> is <code>&#92;u0000</code>
      * or is in the range <code>&#92;u0080</code>
      * through <code>&#92;u07ff</code>, then it is
      * represented by two bytes, to be written
-     * in the order shown:<p> <pre><code>
-     * (byte)(0xc0 | (0x1f &amp; (c &gt;&gt; 6)))
-     * (byte)(0x80 | (0x3f &amp; c))
-     *  </code></pre>  <p> If a character
+     * in the order shown: <pre>{@code
+     * (byte)(0xc0 | (0x1f & (c >> 6)))
+     * (byte)(0x80 | (0x3f & c))
+     * }</pre> <p> If a character
      * <code>c</code> is in the range <code>&#92;u0800</code>
      * through <code>uffff</code>, then it is
      * represented by three bytes, to be written
-     * in the order shown:<p> <pre><code>
-     * (byte)(0xe0 | (0x0f &amp; (c &gt;&gt; 12)))
-     * (byte)(0x80 | (0x3f &amp; (c &gt;&gt;  6)))
-     * (byte)(0x80 | (0x3f &amp; c))
-     *  </code></pre>  <p> First,
+     * in the order shown: <pre>{@code
+     * (byte)(0xe0 | (0x0f & (c >> 12)))
+     * (byte)(0x80 | (0x3f & (c >>  6)))
+     * (byte)(0x80 | (0x3f & c))
+     * }</pre>  <p> First,
      * the total number of bytes needed to represent
      * all the characters of <code>s</code> is
      * calculated. If this number is larger than
--- a/jdk/src/share/classes/java/io/File.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/File.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1685,7 +1685,7 @@
      *           operation will fail if the user does not have permission to
      *           change the access permissions of this abstract pathname.  If
      *           <code>executable</code> is <code>false</code> and the underlying
-     *           file system does not implement an excute permission, then the
+     *           file system does not implement an execute permission, then the
      *           operation will fail.
      *
      * @throws  SecurityException
--- a/jdk/src/share/classes/java/io/FilePermission.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/FilePermission.java	Wed Jul 05 19:21:26 2017 +0200
@@ -55,7 +55,7 @@
  * a list of one or more comma-separated keywords. The possible keywords are
  * "read", "write", "execute", "delete", and "readlink". Their meaning is
  * defined as follows:
- * <P>
+ *
  * <DL>
  *    <DT> read <DD> read permission
  *    <DT> write <DD> write permission
@@ -297,11 +297,11 @@
     /**
      * Checks if this FilePermission object "implies" the specified permission.
      * <P>
-     * More specifically, this method returns true if:<p>
+     * More specifically, this method returns true if:
      * <ul>
-     * <li> <i>p</i> is an instanceof FilePermission,<p>
+     * <li> <i>p</i> is an instanceof FilePermission,
      * <li> <i>p</i>'s actions are a proper subset of this
-     * object's actions, and <p>
+     * object's actions, and
      * <li> <i>p</i>'s pathname is implied by this object's
      *      pathname. For example, "/tmp/*" implies "/tmp/foo", since
      *      "/tmp/*" encompasses all files in the "/tmp" directory,
--- a/jdk/src/share/classes/java/io/Flushable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/Flushable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -34,7 +34,6 @@
  *
  * @since 1.5
  */
-@FunctionalInterface
 public interface Flushable {
 
     /**
--- a/jdk/src/share/classes/java/io/InputStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/InputStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -306,8 +306,7 @@
      *
      * <p> The general contract of <code>reset</code> is:
      *
-     * <p><ul>
-     *
+     * <ul>
      * <li> If the method <code>markSupported</code> returns
      * <code>true</code>, then:
      *
--- a/jdk/src/share/classes/java/io/ObjectInputStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/ObjectInputStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -109,7 +109,7 @@
  *
  * <p>Serializable classes that require special handling during the
  * serialization and deserialization process should implement the following
- * methods:<p>
+ * methods:
  *
  * <pre>
  * private void writeObject(java.io.ObjectOutputStream stream)
--- a/jdk/src/share/classes/java/io/ObjectStreamConstants.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/ObjectStreamConstants.java	Wed Jul 05 19:21:26 2017 +0200
@@ -219,7 +219,7 @@
     * This protocol is written by JVM 1.2.
     *
     * Externalizable data is written in block data mode and is
-    * terminated with TC_ENDBLOCKDATA. Externalizable classdescriptor
+    * terminated with TC_ENDBLOCKDATA. Externalizable class descriptor
     * flags has SC_BLOCK_DATA enabled. JVM 1.1.6 and greater can
     * read this format change.
     *
--- a/jdk/src/share/classes/java/io/PipedInputStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/PipedInputStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -172,15 +172,14 @@
      * unconnected piped output stream and <code>snk</code>
      * is an unconnected piped input stream, they
      * may be connected by either the call:
-     * <p>
+     *
      * <pre><code>snk.connect(src)</code> </pre>
      * <p>
      * or the call:
-     * <p>
+     *
      * <pre><code>src.connect(snk)</code> </pre>
      * <p>
-     * The two
-     * calls have the same effect.
+     * The two calls have the same effect.
      *
      * @param      src   The piped output stream to connect to.
      * @exception  IOException  if an I/O error occurs.
--- a/jdk/src/share/classes/java/io/PipedReader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/PipedReader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -145,15 +145,14 @@
      * unconnected piped writer and <code>snk</code>
      * is an unconnected piped reader, they
      * may be connected by either the call:
-     * <p>
+     *
      * <pre><code>snk.connect(src)</code> </pre>
      * <p>
      * or the call:
-     * <p>
+     *
      * <pre><code>src.connect(snk)</code> </pre>
      * <p>
-     * The two
-     * calls have the same effect.
+     * The two calls have the same effect.
      *
      * @param      src   The piped writer to connect to.
      * @exception  IOException  if an I/O error occurs.
--- a/jdk/src/share/classes/java/io/PrintStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/PrintStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -303,7 +303,7 @@
      *          creating the file
      *
      * @throws  SecurityException
-     *          If a security manager is presentand {@link
+     *          If a security manager is present and {@link
      *          SecurityManager#checkWrite checkWrite(file.getPath())}
      *          denies write access to the file
      *
--- a/jdk/src/share/classes/java/io/RandomAccessFile.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/RandomAccessFile.java	Wed Jul 05 19:21:26 2017 +0200
@@ -784,7 +784,7 @@
      * </pre></blockquote>
      * <p>
      * then the result is equal to:
-     * <p><blockquote><pre>
+     * <blockquote><pre>
      *     ((long)b1 &lt;&lt; 56) + ((long)b2 &lt;&lt; 48)
      *     + ((long)b3 &lt;&lt; 40) + ((long)b4 &lt;&lt; 32)
      *     + ((long)b5 &lt;&lt; 24) + ((long)b6 &lt;&lt; 16)
--- a/jdk/src/share/classes/java/io/Serializable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/Serializable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -55,7 +55,7 @@
  *
  * Classes that require special handling during the serialization and
  * deserialization process must implement special methods with these exact
- * signatures: <p>
+ * signatures:
  *
  * <PRE>
  * private void writeObject(java.io.ObjectOutputStream out)
@@ -101,7 +101,7 @@
  *
  * <p>Serializable classes that need to designate an alternative object to be
  * used when writing an object to the stream should implement this
- * special method with the exact signature: <p>
+ * special method with the exact signature:
  *
  * <PRE>
  * ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException;
@@ -115,7 +115,7 @@
  *
  * Classes that need to designate a replacement when an instance of it
  * is read from the stream should implement this special method with the
- * exact signature.<p>
+ * exact signature.
  *
  * <PRE>
  * ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;
@@ -133,7 +133,7 @@
  * deserialization will result in an {@link InvalidClassException}.  A
  * serializable class can declare its own serialVersionUID explicitly by
  * declaring a field named <code>"serialVersionUID"</code> that must be static,
- * final, and of type <code>long</code>:<p>
+ * final, and of type <code>long</code>:
  *
  * <PRE>
  * ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L;
--- a/jdk/src/share/classes/java/io/SerializablePermission.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/io/SerializablePermission.java	Wed Jul 05 19:21:26 2017 +0200
@@ -43,7 +43,6 @@
  * The following table lists all the possible SerializablePermission target names,
  * and for each provides a description of what the permission allows
  * and a discussion of the risks of granting code the permission.
- * <P>
  *
  * <table border=1 cellpadding=5 summary="Permission target name, what the permission allows, and associated risks">
  * <tr>
--- a/jdk/src/share/classes/java/lang/AbstractStringBuilder.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/AbstractStringBuilder.java	Wed Jul 05 19:21:26 2017 +0200
@@ -330,9 +330,9 @@
      * characters to be copied is {@code srcEnd-srcBegin}. The
      * characters are copied into the subarray of {@code dst} starting
      * at index {@code dstBegin} and ending at index:
-     * <p><blockquote><pre>
+     * <pre>{@code
      * dstbegin + (srcEnd-srcBegin) - 1
-     * </pre></blockquote>
+     * }</pre>
      *
      * @param      srcBegin   start copying at this offset.
      * @param      srcEnd     stop copying at this offset.
@@ -859,16 +859,16 @@
      *
      * <p> An invocation of this method of the form
      *
-     * <blockquote><pre>
-     * sb.subSequence(begin,&nbsp;end)</pre></blockquote>
+     * <pre>{@code
+     * sb.subSequence(begin,&nbsp;end)}</pre>
      *
      * behaves in exactly the same way as the invocation
      *
-     * <blockquote><pre>
-     * sb.substring(begin,&nbsp;end)</pre></blockquote>
+     * <pre>{@code
+     * sb.substring(begin,&nbsp;end)}</pre>
      *
      * This method is provided so that this class can
-     * implement the {@link CharSequence} interface. </p>
+     * implement the {@link CharSequence} interface.
      *
      * @param      start   the start index, inclusive.
      * @param      end     the end index, exclusive.
@@ -1287,9 +1287,9 @@
      * Returns the index within this string of the first occurrence of the
      * specified substring. The integer returned is the smallest value
      * <i>k</i> such that:
-     * <blockquote><pre>
+     * <pre>{@code
      * this.toString().startsWith(str, <i>k</i>)
-     * </pre></blockquote>
+     * }</pre>
      * is {@code true}.
      *
      * @param   str   any string.
@@ -1306,10 +1306,10 @@
      * Returns the index within this string of the first occurrence of the
      * specified substring, starting at the specified index.  The integer
      * returned is the smallest value {@code k} for which:
-     * <blockquote><pre>
+     * <pre>{@code
      *     k >= Math.min(fromIndex, this.length()) &&
      *                   this.toString().startsWith(str, k)
-     * </pre></blockquote>
+     * }</pre>
      * If no such value of <i>k</i> exists, then -1 is returned.
      *
      * @param   str         the substring for which to search.
@@ -1326,9 +1326,9 @@
      * of the specified substring.  The rightmost empty string "" is
      * considered to occur at the index value {@code this.length()}.
      * The returned index is the largest value <i>k</i> such that
-     * <blockquote><pre>
+     * <pre>{@code
      * this.toString().startsWith(str, k)
-     * </pre></blockquote>
+     * }</pre>
      * is true.
      *
      * @param   str   the substring to search for.
@@ -1345,10 +1345,10 @@
      * Returns the index within this string of the last occurrence of the
      * specified substring. The integer returned is the largest value <i>k</i>
      * such that:
-     * <blockquote><pre>
+     * <pre>{@code
      *     k <= Math.min(fromIndex, this.length()) &&
      *                   this.toString().startsWith(str, k)
-     * </pre></blockquote>
+     * }</pre>
      * If no such value of <i>k</i> exists, then -1 is returned.
      *
      * @param   str         the substring to search for.
--- a/jdk/src/share/classes/java/lang/ArrayStoreException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/ArrayStoreException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -29,7 +29,7 @@
  * Thrown to indicate that an attempt has been made to store the
  * wrong type of object into an array of objects. For example, the
  * following code generates an <code>ArrayStoreException</code>:
- * <p><blockquote><pre>
+ * <blockquote><pre>
  *     Object x[] = new String[3];
  *     x[0] = new Integer(0);
  * </pre></blockquote>
--- a/jdk/src/share/classes/java/lang/AutoCloseable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/AutoCloseable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -48,7 +48,6 @@
  * @author Josh Bloch
  * @since 1.7
  */
-@FunctionalInterface
 public interface AutoCloseable {
     /**
      * Closes this resource, relinquishing any underlying resources.
--- a/jdk/src/share/classes/java/lang/Byte.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Byte.java	Wed Jul 05 19:21:26 2017 +0200
@@ -244,7 +244,7 @@
      * <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
      * <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
      * <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
-     * <p>
+     *
      * <dt><i>Sign:</i>
      * <dd>{@code -}
      * <dd>{@code +}
--- a/jdk/src/share/classes/java/lang/Character.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Character.java	Wed Jul 05 19:21:26 2017 +0200
@@ -5394,7 +5394,7 @@
      * Other_Lowercase as defined by the Unicode Standard.
      * <p>
      * The following are examples of lowercase characters:
-     * <p><blockquote><pre>
+     * <blockquote><pre>
      * a b c d e f g h i j k l m n o p q r s t u v w x y z
      * '&#92;u00DF' '&#92;u00E0' '&#92;u00E1' '&#92;u00E2' '&#92;u00E3' '&#92;u00E4' '&#92;u00E5' '&#92;u00E6'
      * '&#92;u00E7' '&#92;u00E8' '&#92;u00E9' '&#92;u00EA' '&#92;u00EB' '&#92;u00EC' '&#92;u00ED' '&#92;u00EE'
@@ -5430,7 +5430,7 @@
      * Other_Lowercase as defined by the Unicode Standard.
      * <p>
      * The following are examples of lowercase characters:
-     * <p><blockquote><pre>
+     * <blockquote><pre>
      * a b c d e f g h i j k l m n o p q r s t u v w x y z
      * '&#92;u00DF' '&#92;u00E0' '&#92;u00E1' '&#92;u00E2' '&#92;u00E3' '&#92;u00E4' '&#92;u00E5' '&#92;u00E6'
      * '&#92;u00E7' '&#92;u00E8' '&#92;u00E9' '&#92;u00EA' '&#92;u00EB' '&#92;u00EC' '&#92;u00ED' '&#92;u00EE'
@@ -5461,14 +5461,14 @@
      * or it has contributory property Other_Uppercase as defined by the Unicode Standard.
      * <p>
      * The following are examples of uppercase characters:
-     * <p><blockquote><pre>
+     * <blockquote><pre>
      * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
      * '&#92;u00C0' '&#92;u00C1' '&#92;u00C2' '&#92;u00C3' '&#92;u00C4' '&#92;u00C5' '&#92;u00C6' '&#92;u00C7'
      * '&#92;u00C8' '&#92;u00C9' '&#92;u00CA' '&#92;u00CB' '&#92;u00CC' '&#92;u00CD' '&#92;u00CE' '&#92;u00CF'
      * '&#92;u00D0' '&#92;u00D1' '&#92;u00D2' '&#92;u00D3' '&#92;u00D4' '&#92;u00D5' '&#92;u00D6' '&#92;u00D8'
      * '&#92;u00D9' '&#92;u00DA' '&#92;u00DB' '&#92;u00DC' '&#92;u00DD' '&#92;u00DE'
      * </pre></blockquote>
-     * <p> Many other Unicode characters are uppercase too.<p>
+     * <p> Many other Unicode characters are uppercase too.
      *
      * <p><b>Note:</b> This method cannot handle <a
      * href="#supplementary"> supplementary characters</a>. To support
@@ -5496,7 +5496,7 @@
      * or it has contributory property Other_Uppercase as defined by the Unicode Standard.
      * <p>
      * The following are examples of uppercase characters:
-     * <p><blockquote><pre>
+     * <blockquote><pre>
      * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
      * '&#92;u00C0' '&#92;u00C1' '&#92;u00C2' '&#92;u00C3' '&#92;u00C4' '&#92;u00C5' '&#92;u00C6' '&#92;u00C7'
      * '&#92;u00C8' '&#92;u00C9' '&#92;u00CA' '&#92;u00CB' '&#92;u00CC' '&#92;u00CD' '&#92;u00CE' '&#92;u00CF'
@@ -5540,7 +5540,7 @@
      * <li>{@code LATIN CAPITAL LETTER N WITH SMALL LETTER J}
      * <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z}
      * </ul>
-     * <p> Many other Unicode characters are titlecase too.<p>
+     * <p> Many other Unicode characters are titlecase too.
      *
      * <p><b>Note:</b> This method cannot handle <a
      * href="#supplementary"> supplementary characters</a>. To support
--- a/jdk/src/share/classes/java/lang/Class.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Class.java	Wed Jul 05 19:21:26 2017 +0200
@@ -91,7 +91,7 @@
  * <p> The following example uses a {@code Class} object to print the
  * class name of an object:
  *
- * <p> <blockquote><pre>
+ * <blockquote><pre>
  *     void printClassName(Object obj) {
  *         System.out.println("The class of " + obj +
  *                            " is " + obj.getClass().getName());
@@ -103,7 +103,7 @@
  * <cite>The Java&trade; Language Specification</cite>.
  * For example:
  *
- * <p> <blockquote>
+ * <blockquote>
  *     {@code System.out.println("The name of class Foo is: "+Foo.class.getName());}
  * </blockquote>
  *
@@ -1571,6 +1571,10 @@
      * <p> If this {@code Class} object represents a primitive type or void,
      * then the returned array has length 0.
      *
+     * <p> Static methods declared in superinterfaces of the class or interface
+     * represented by this {@code Class} object are not considered members of
+     * the class or interface.
+     *
      * <p> The elements in the returned array are not sorted and are not in any
      * particular order.
      *
@@ -1729,6 +1733,10 @@
      * <p> If this {@code Class} object represents an array type, then this
      * method does not find the {@code clone()} method.
      *
+     * <p> Static methods declared in superinterfaces of the class or interface
+     * represented by this {@code Class} object are not considered members of
+     * the class or interface.
+     *
      * @param name the name of the method
      * @param parameterTypes the list of parameters
      * @return the {@code Method} object that matches the specified
@@ -1752,7 +1760,7 @@
     public Method getMethod(String name, Class<?>... parameterTypes)
         throws NoSuchMethodException, SecurityException {
         checkMemberAccess(Member.PUBLIC, Reflection.getCallerClass(), true);
-        Method method = getMethod0(name, parameterTypes);
+        Method method = getMethod0(name, parameterTypes, true);
         if (method == null) {
             throw new NoSuchMethodException(getName() + "." + name + argumentTypesToString(parameterTypes));
         }
@@ -2727,6 +2735,14 @@
             }
         }
 
+        void addAllNonStatic(Method[] methods) {
+            for (Method candidate : methods) {
+                if (!Modifier.isStatic(candidate.getModifiers())) {
+                    add(candidate);
+                }
+            }
+        }
+
         int length() {
             return length;
         }
@@ -2797,7 +2813,7 @@
         MethodArray inheritedMethods = new MethodArray();
         Class<?>[] interfaces = getInterfaces();
         for (int i = 0; i < interfaces.length; i++) {
-            inheritedMethods.addAll(interfaces[i].privateGetPublicMethods());
+            inheritedMethods.addAllNonStatic(interfaces[i].privateGetPublicMethods());
         }
         if (!isInterface()) {
             Class<?> c = getSuperclass();
@@ -2900,7 +2916,7 @@
     }
 
 
-    private Method getMethod0(String name, Class<?>[] parameterTypes) {
+    private Method getMethod0(String name, Class<?>[] parameterTypes, boolean includeStaticMethods) {
         // Note: the intent is that the search algorithm this routine
         // uses be equivalent to the ordering imposed by
         // privateGetPublicMethods(). It fetches only the declared
@@ -2913,25 +2929,23 @@
         if ((res = searchMethods(privateGetDeclaredMethods(true),
                                  name,
                                  parameterTypes)) != null) {
-            return res;
+            if (includeStaticMethods || !Modifier.isStatic(res.getModifiers()))
+                return res;
         }
         // Search superclass's methods
         if (!isInterface()) {
             Class<? super T> c = getSuperclass();
             if (c != null) {
-                if ((res = c.getMethod0(name, parameterTypes)) != null) {
+                if ((res = c.getMethod0(name, parameterTypes, true)) != null) {
                     return res;
                 }
             }
         }
         // Search superinterfaces' methods
         Class<?>[] interfaces = getInterfaces();
-        for (int i = 0; i < interfaces.length; i++) {
-            Class<?> c = interfaces[i];
-            if ((res = c.getMethod0(name, parameterTypes)) != null) {
+        for (Class<?> c : interfaces)
+            if ((res = c.getMethod0(name, parameterTypes, false)) != null)
                 return res;
-            }
-        }
         // Not found
         return null;
     }
@@ -3300,7 +3314,10 @@
     public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationClass) {
         Objects.requireNonNull(annotationClass);
 
-        return AnnotationSupport.getMultipleAnnotations(annotationData().annotations, annotationClass);
+        AnnotationData annotationData = annotationData();
+        return AnnotationSupport.getAssociatedAnnotations(annotationData.declaredAnnotations,
+                                                          this,
+                                                          annotationClass);
     }
 
     /**
@@ -3330,7 +3347,8 @@
     public <A extends Annotation> A[] getDeclaredAnnotationsByType(Class<A> annotationClass) {
         Objects.requireNonNull(annotationClass);
 
-        return AnnotationSupport.getMultipleAnnotations(annotationData().declaredAnnotations, annotationClass);
+        return AnnotationSupport.getDirectlyAndIndirectlyPresent(annotationData().declaredAnnotations,
+                                                                 annotationClass);
     }
 
     /**
@@ -3424,6 +3442,10 @@
         return annotationType;
     }
 
+    Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap() {
+        return annotationData().declaredAnnotations;
+    }
+
     /* Backing store of user-defined values pertaining to this class.
      * Maintained by the ClassValue class.
      */
--- a/jdk/src/share/classes/java/lang/ClassCastException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/ClassCastException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -29,7 +29,7 @@
  * Thrown to indicate that the code has attempted to cast an object
  * to a subclass of which it is not an instance. For example, the
  * following code generates a <code>ClassCastException</code>:
- * <p><blockquote><pre>
+ * <blockquote><pre>
  *     Object x = new Integer(0);
  *     System.out.println((String)x);
  * </pre></blockquote>
--- a/jdk/src/share/classes/java/lang/ClassLoader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/ClassLoader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -362,7 +362,7 @@
      * default implementation of this method searches for classes in the
      * following order:
      *
-     * <p><ol>
+     * <ol>
      *
      *   <li><p> Invoke {@link #findLoadedClass(String)} to check if the class
      *   has already been loaded.  </p></li>
@@ -488,7 +488,7 @@
         final SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             if (ReflectUtil.isNonPublicProxyClass(cls)) {
-                for (Class intf: cls.getInterfaces()) {
+                for (Class<?> intf: cls.getInterfaces()) {
                     checkPackageAccess(intf, pd);
                 }
                 return;
--- a/jdk/src/share/classes/java/lang/ClassValue.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/ClassValue.java	Wed Jul 05 19:21:26 2017 +0200
@@ -692,7 +692,7 @@
 
         /** Remove all stale entries, everywhere. */
         private void removeStaleEntries() {
-            Entry[] cache = getCache();
+            Entry<?>[] cache = getCache();
             removeStaleEntries(cache, 0, cache.length + PROBE_LIMIT - 1);
         }
 
--- a/jdk/src/share/classes/java/lang/Comparable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Comparable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -93,7 +93,6 @@
  * @see java.util.Comparator
  * @since 1.2
  */
-@FunctionalInterface
 public interface Comparable<T> {
     /**
      * Compares this object with the specified object for order.  Returns a
--- a/jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java	Wed Jul 05 19:21:26 2017 +0200
@@ -74,7 +74,6 @@
         new Entry(0x00CC, new char[]{0x0069, 0x0307, 0x0300}, new char[]{0x00CC}, "lt", 0), // # LATIN CAPITAL LETTER I WITH GRAVE
         new Entry(0x00CD, new char[]{0x0069, 0x0307, 0x0301}, new char[]{0x00CD}, "lt", 0), // # LATIN CAPITAL LETTER I WITH ACUTE
         new Entry(0x0128, new char[]{0x0069, 0x0307, 0x0303}, new char[]{0x0128}, "lt", 0), // # LATIN CAPITAL LETTER I WITH TILDE
-        new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, "lt", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
 
         //# ================================================================================
         //# Turkish and Azeri
@@ -85,10 +84,7 @@
         new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "tr", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I
         new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "az", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I
         new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "tr", 0), // # LATIN SMALL LETTER I
-        new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "az", 0), // # LATIN SMALL LETTER I
-        //# ================================================================================
-        //# Other
-        new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, "en", 0), // # LATIN CAPITALLETTER I WITH DOT ABOVE
+        new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "az", 0)  // # LATIN SMALL LETTER I
     };
 
     // A hash table that contains the above entries
--- a/jdk/src/share/classes/java/lang/Double.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Double.java	Wed Jul 05 19:21:26 2017 +0200
@@ -361,15 +361,11 @@
      * <dd><i>SignedInteger</i>
      * </dl>
      *
-     * <p>
-     *
      * <dl>
      * <dt><i>HexFloatingPointLiteral</i>:
      * <dd> <i>HexSignificand BinaryExponent FloatTypeSuffix<sub>opt</sub></i>
      * </dl>
      *
-     * <p>
-     *
      * <dl>
      * <dt><i>HexSignificand:</i>
      * <dd><i>HexNumeral</i>
@@ -380,15 +376,11 @@
      *     </i>{@code .} <i>HexDigits</i>
      * </dl>
      *
-     * <p>
-     *
      * <dl>
      * <dt><i>BinaryExponent:</i>
      * <dd><i>BinaryExponentIndicator SignedInteger</i>
      * </dl>
      *
-     * <p>
-     *
      * <dl>
      * <dt><i>BinaryExponentIndicator:</i>
      * <dd>{@code p}
--- a/jdk/src/share/classes/java/lang/Float.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Float.java	Wed Jul 05 19:21:26 2017 +0200
@@ -321,15 +321,11 @@
      * <dd><i>SignedInteger</i>
      * </dl>
      *
-     * <p>
-     *
      * <dl>
      * <dt><i>HexFloatingPointLiteral</i>:
      * <dd> <i>HexSignificand BinaryExponent FloatTypeSuffix<sub>opt</sub></i>
      * </dl>
      *
-     * <p>
-     *
      * <dl>
      * <dt><i>HexSignificand:</i>
      * <dd><i>HexNumeral</i>
@@ -340,15 +336,11 @@
      *     </i>{@code .} <i>HexDigits</i>
      * </dl>
      *
-     * <p>
-     *
      * <dl>
      * <dt><i>BinaryExponent:</i>
      * <dd><i>BinaryExponentIndicator SignedInteger</i>
      * </dl>
      *
-     * <p>
-     *
      * <dl>
      * <dt><i>BinaryExponentIndicator:</i>
      * <dd>{@code p}
--- a/jdk/src/share/classes/java/lang/Integer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Integer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1123,7 +1123,7 @@
      * <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
      * <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
      * <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
-     * <p>
+     *
      * <dt><i>Sign:</i>
      * <dd>{@code -}
      * <dd>{@code +}
--- a/jdk/src/share/classes/java/lang/Iterable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Iterable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -42,7 +42,6 @@
  * @since 1.5
  * @jls 14.14.2 The enhanced for statement
  */
-@FunctionalInterface
 public interface Iterable<T> {
     /**
      * Returns an iterator over elements of type {@code T}.
@@ -52,10 +51,12 @@
     Iterator<T> iterator();
 
     /**
-     * Performs the given action on the contents of the {@code Iterable}, in the
-     * order elements occur when iterating, until all elements have been
-     * processed or the action throws an exception.  Errors or runtime
-     * exceptions thrown by the action are relayed to the caller.
+     * Performs the given action for each element of the {@code Iterable}
+     * until all elements have been processed or the action throws an
+     * exception.  Unless otherwise specified by the implementing class,
+     * actions are performed in the order of iteration (if an iteration order
+     * is specified).  Exceptions thrown by the action are relayed to the
+     * caller.
      *
      * @implSpec
      * <p>The default implementation behaves as if:
@@ -100,4 +101,3 @@
         return Spliterators.spliteratorUnknownSize(iterator(), 0);
     }
 }
-
--- a/jdk/src/share/classes/java/lang/Long.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Long.java	Wed Jul 05 19:21:26 2017 +0200
@@ -853,7 +853,7 @@
      * <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
      * <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
      * <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
-     * <p>
+     *
      * <dt><i>Sign:</i>
      * <dd>{@code -}
      * <dd>{@code +}
--- a/jdk/src/share/classes/java/lang/Readable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Readable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -34,7 +34,6 @@
  *
  * @since 1.5
  */
-@FunctionalInterface
 public interface Readable {
 
     /**
--- a/jdk/src/share/classes/java/lang/RuntimePermission.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/RuntimePermission.java	Wed Jul 05 19:21:26 2017 +0200
@@ -47,7 +47,6 @@
  * The following table lists all the possible RuntimePermission target names,
  * and for each provides a description of what the permission allows
  * and a discussion of the risks of granting code the permission.
- * <P>
  *
  * <table border=1 cellpadding=5 summary="permission target name,
  *  what the target allows,and associated risks">
--- a/jdk/src/share/classes/java/lang/SecurityManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/SecurityManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -56,7 +56,7 @@
  * are called by various methods in the Java libraries before those
  * methods perform certain potentially sensitive operations. The
  * invocation of such a <code>check</code> method typically looks like this:
- * <p><blockquote><pre>
+ * <blockquote><pre>
  *     SecurityManager security = System.getSecurityManager();
  *     if (security != null) {
  *         security.check<i>XXX</i>(argument, &nbsp;.&nbsp;.&nbsp;.&nbsp;);
@@ -323,7 +323,7 @@
      * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
      * <p>
      * This method will return
-     * <code>null</code> in the following three cases:<p>
+     * <code>null</code> in the following three cases:
      * <ol>
      *   <li>All methods on the execution stack are from classes
      *   defined using the system class loader or one of its ancestors.
@@ -370,7 +370,7 @@
      * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
      * <p>
      * This method will return
-     * <code>null</code> in the following three cases:<p>
+     * <code>null</code> in the following three cases:
      * <ol>
      *   <li>All methods on the execution stack are from classes
      *   defined using the system class loader or one of its ancestors.
@@ -429,7 +429,7 @@
      * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
      * <p>
      * This method will return
-     * -1 in the following three cases:<p>
+     * -1 in the following three cases:
      * <ol>
      *   <li>All methods on the execution stack are from classes
      *   defined using the system class loader or one of its ancestors.
@@ -1281,7 +1281,6 @@
      * This method calls <code>checkPermission</code> with the
      * <code>PropertyPermission(key, "read")</code> permission.
      * <p>
-     * <p>
      * If you override this method, then you should make a call to
      * <code>super.checkPropertyAccess</code>
      * at the point the overridden method would normally throw an
@@ -1714,7 +1713,7 @@
             throw new NullPointerException("class can't be null");
         }
         if (which != Member.PUBLIC) {
-            Class stack[] = getClassContext();
+            Class<?> stack[] = getClassContext();
             /*
              * stack depth of 4 should be the caller of one of the
              * methods in java.lang.Class that invoke checkMember
--- a/jdk/src/share/classes/java/lang/Short.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Short.java	Wed Jul 05 19:21:26 2017 +0200
@@ -249,7 +249,7 @@
      * <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
      * <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
      * <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
-     * <p>
+     *
      * <dt><i>Sign:</i>
      * <dd>{@code -}
      * <dd>{@code +}
--- a/jdk/src/share/classes/java/lang/String.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/String.java	Wed Jul 05 19:21:26 2017 +0200
@@ -47,16 +47,16 @@
  * Strings are constant; their values cannot be changed after they
  * are created. String buffers support mutable strings.
  * Because String objects are immutable they can be shared. For example:
- * <p><blockquote><pre>
+ * <blockquote><pre>
  *     String str = "abc";
  * </pre></blockquote><p>
  * is equivalent to:
- * <p><blockquote><pre>
+ * <blockquote><pre>
  *     char data[] = {'a', 'b', 'c'};
  *     String str = new String(data);
  * </pre></blockquote><p>
  * Here are some more examples of how strings can be used:
- * <p><blockquote><pre>
+ * <blockquote><pre>
  *     System.out.println("abc");
  *     String cde = "cde";
  *     System.out.println("abc" + cde);
@@ -786,7 +786,7 @@
      * {@code srcEnd-srcBegin}). The characters are copied into the
      * subarray of {@code dst} starting at index {@code dstBegin}
      * and ending at index:
-     * <p><blockquote><pre>
+     * <blockquote><pre>
      *     dstbegin + (srcEnd-srcBegin) - 1
      * </pre></blockquote>
      *
@@ -2598,21 +2598,14 @@
             }
             if (localeDependent || srcChar == '\u03A3') { // GREEK CAPITAL LETTER SIGMA
                 lowerChar = ConditionalSpecialCasing.toLowerCaseEx(this, i, locale);
-            } else if (srcChar == '\u0130') { // LATIN CAPITAL LETTER I DOT
-                lowerChar = Character.ERROR;
             } else {
                 lowerChar = Character.toLowerCase(srcChar);
             }
             if ((lowerChar == Character.ERROR)
                     || (lowerChar >= Character.MIN_SUPPLEMENTARY_CODE_POINT)) {
                 if (lowerChar == Character.ERROR) {
-                    if (!localeDependent && srcChar == '\u0130') {
-                        lowerCharArray =
-                                ConditionalSpecialCasing.toLowerCaseCharArray(this, i, Locale.ENGLISH);
-                    } else {
-                        lowerCharArray =
-                                ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale);
-                    }
+                    lowerCharArray =
+                            ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale);
                 } else if (srcCount == 2) {
                     resultOffset += Character.toChars(lowerChar, result, i + resultOffset) - srcCount;
                     continue;
@@ -2669,7 +2662,7 @@
      * {@code String} may be a different length than the original {@code String}.
      * <p>
      * Examples of locale-sensitive and 1:M case mappings are in the following table.
-     * <p>
+     *
      * <table border="1" summary="Examples of locale-sensitive and 1:M case mappings. Shows Language code of locale, lower case, upper case, and description.">
      * <tr>
      *   <th>Language Code of Locale</th>
--- a/jdk/src/share/classes/java/lang/System.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/System.java	Wed Jul 05 19:21:26 2017 +0200
@@ -26,10 +26,12 @@
 
 import java.io.*;
 import java.lang.reflect.Executable;
+import java.lang.annotation.Annotation;
 import java.security.AccessControlContext;
 import java.util.Properties;
 import java.util.PropertyPermission;
 import java.util.StringTokenizer;
+import java.util.Map;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.AllPermission;
@@ -1227,6 +1229,9 @@
             public AnnotationType getAnnotationType(Class<?> klass) {
                 return klass.getAnnotationType();
             }
+            public Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap(Class<?> klass) {
+                return klass.getDeclaredAnnotationMap();
+            }
             public byte[] getRawClassAnnotations(Class<?> klass) {
                 return klass.getRawAnnotations();
             }
--- a/jdk/src/share/classes/java/lang/Thread.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/Thread.java	Wed Jul 05 19:21:26 2017 +0200
@@ -76,7 +76,7 @@
  * <code>Thread</code>. An instance of the subclass can then be
  * allocated and started. For example, a thread that computes primes
  * larger than a stated value could be written as follows:
- * <p><hr><blockquote><pre>
+ * <hr><blockquote><pre>
  *     class PrimeThread extends Thread {
  *         long minPrime;
  *         PrimeThread(long minPrime) {
@@ -91,7 +91,7 @@
  * </pre></blockquote><hr>
  * <p>
  * The following code would then create a thread and start it running:
- * <p><blockquote><pre>
+ * <blockquote><pre>
  *     PrimeThread p = new PrimeThread(143);
  *     p.start();
  * </pre></blockquote>
@@ -102,7 +102,7 @@
  * then be allocated, passed as an argument when creating
  * <code>Thread</code>, and started. The same example in this other
  * style looks like the following:
- * <p><hr><blockquote><pre>
+ * <hr><blockquote><pre>
  *     class PrimeRun implements Runnable {
  *         long minPrime;
  *         PrimeRun(long minPrime) {
@@ -117,7 +117,7 @@
  * </pre></blockquote><hr>
  * <p>
  * The following code would then create a thread and start it running:
- * <p><blockquote><pre>
+ * <blockquote><pre>
  *     PrimeRun p = new PrimeRun(143);
  *     new Thread(p).start();
  * </pre></blockquote>
--- a/jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -101,7 +101,6 @@
      *                       should implement.
      * @param additionalBridges Method types for additional signatures to be
      *                          bridged to the implementation method
-     * @throws ReflectiveOperationException
      * @throws LambdaConversionException If any of the meta-factory protocol
      * invariants are violated
      */
@@ -114,7 +113,7 @@
                                        boolean isSerializable,
                                        Class<?>[] markerInterfaces,
                                        MethodType[] additionalBridges)
-            throws ReflectiveOperationException, LambdaConversionException {
+            throws LambdaConversionException {
         this.targetClass = caller.lookupClass();
         this.invokedType = invokedType;
 
@@ -160,7 +159,7 @@
      * @throws ReflectiveOperationException
      */
     abstract CallSite buildCallSite()
-            throws ReflectiveOperationException, LambdaConversionException;
+            throws LambdaConversionException;
 
     /**
      * Check the meta-factory arguments for errors
--- a/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -26,16 +26,19 @@
 package java.lang.invoke;
 
 import jdk.internal.org.objectweb.asm.*;
+import sun.invoke.util.BytecodeDescriptor;
 import sun.misc.Unsafe;
 import sun.security.action.GetPropertyAction;
 
 import java.io.FilePermission;
+import java.io.Serializable;
 import java.lang.reflect.Constructor;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.security.ProtectionDomain;
+import java.util.LinkedHashSet;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.PropertyPermission;
+import java.util.Set;
 
 import static jdk.internal.org.objectweb.asm.Opcodes.*;
 
@@ -50,14 +53,19 @@
 
     private static final int CLASSFILE_VERSION = 51;
     private static final String METHOD_DESCRIPTOR_VOID = Type.getMethodDescriptor(Type.VOID_TYPE);
-    private static final String NAME_MAGIC_ACCESSOR_IMPL = "java/lang/invoke/MagicLambdaImpl";
+    private static final String JAVA_LANG_OBJECT = "java/lang/Object";
     private static final String NAME_CTOR = "<init>";
+    private static final String NAME_FACTORY = "get$Lambda";
 
     //Serialization support
     private static final String NAME_SERIALIZED_LAMBDA = "java/lang/invoke/SerializedLambda";
+    private static final String NAME_NOT_SERIALIZABLE_EXCEPTION = "java/io/NotSerializableException";
     private static final String DESCR_METHOD_WRITE_REPLACE = "()Ljava/lang/Object;";
+    private static final String DESCR_METHOD_WRITE_OBJECT = "(Ljava/io/ObjectOutputStream;)V";
+    private static final String DESCR_METHOD_READ_OBJECT = "(Ljava/io/ObjectInputStream;)V";
     private static final String NAME_METHOD_WRITE_REPLACE = "writeReplace";
-    private static final String NAME_OBJECT = "java/lang/Object";
+    private static final String NAME_METHOD_READ_OBJECT = "readObject";
+    private static final String NAME_METHOD_WRITE_OBJECT = "writeObject";
     private static final String DESCR_CTOR_SERIALIZED_LAMBDA
             = MethodType.methodType(void.class,
                                     Class.class,
@@ -65,6 +73,12 @@
                                     int.class, String.class, String.class, String.class,
                                     String.class,
                                     Object[].class).toMethodDescriptorString();
+    private static final String DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION
+            = MethodType.methodType(void.class, String.class).toMethodDescriptorString();
+    private static final String[] SER_HOSTILE_EXCEPTIONS = new String[] {NAME_NOT_SERIALIZABLE_EXCEPTION};
+
+
+    private static final String[] EMPTY_STRING_ARRAY = new String[0];
 
     // Used to ensure that each spun class name is unique
     private static final AtomicInteger counter = new AtomicInteger(0);
@@ -84,15 +98,12 @@
     private final String implMethodClassName;        // Name of type containing implementation "CC"
     private final String implMethodName;             // Name of implementation method "impl"
     private final String implMethodDesc;             // Type descriptor for implementation methods "(I)Ljava/lang/String;"
-    private final Type[] implMethodArgumentTypes;    // ASM types for implementation method parameters
-    private final Type implMethodReturnType;         // ASM type for implementation method return type "Ljava/lang/String;"
+    private final Class<?> implMethodReturnClass;    // class for implementaion method return type "Ljava/lang/String;"
     private final MethodType constructorType;        // Generated class constructor type "(CC)void"
-    private final String constructorDesc;            // Type descriptor for constructor "(LCC;)V"
     private final ClassWriter cw;                    // ASM class writer
-    private final Type[] argTypes;                   // ASM types for the constructor arguments
     private final String[] argNames;                 // Generated names for the constructor arguments
+    private final String[] argDescs;                 // Type descriptors for the constructor arguments
     private final String lambdaClassName;            // Generated name for the generated class "X$$Lambda$1"
-    private final Type[] instantiatedArgumentTypes;  // ASM types for the functional interface arguments
 
     /**
      * General meta-factory constructor, supporting both standard cases and
@@ -128,7 +139,6 @@
      *                       should implement.
      * @param additionalBridges Method types for additional signatures to be
      *                          bridged to the implementation method
-     * @throws ReflectiveOperationException
      * @throws LambdaConversionException If any of the meta-factory protocol
      * invariants are violated
      */
@@ -141,29 +151,30 @@
                                        boolean isSerializable,
                                        Class<?>[] markerInterfaces,
                                        MethodType[] additionalBridges)
-            throws ReflectiveOperationException, LambdaConversionException {
+            throws LambdaConversionException {
         super(caller, invokedType, samMethodName, samMethodType,
               implMethod, instantiatedMethodType,
               isSerializable, markerInterfaces, additionalBridges);
         implMethodClassName = implDefiningClass.getName().replace('.', '/');
         implMethodName = implInfo.getName();
         implMethodDesc = implMethodType.toMethodDescriptorString();
-        Type implMethodAsmType = Type.getMethodType(implMethodDesc);
-        implMethodArgumentTypes = implMethodAsmType.getArgumentTypes();
-        implMethodReturnType = (implKind == MethodHandleInfo.REF_newInvokeSpecial)
-                ? Type.getObjectType(implMethodClassName)
-                : implMethodAsmType.getReturnType();
+        implMethodReturnClass = (implKind == MethodHandleInfo.REF_newInvokeSpecial)
+                ? implDefiningClass
+                : implMethodType.returnType();
         constructorType = invokedType.changeReturnType(Void.TYPE);
-        constructorDesc = constructorType.toMethodDescriptorString();
         lambdaClassName = targetClass.getName().replace('.', '/') + "$$Lambda$" + counter.incrementAndGet();
         cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
-        argTypes = Type.getArgumentTypes(constructorDesc);
-        argNames = new String[argTypes.length];
-        for (int i = 0; i < argTypes.length; i++) {
-            argNames[i] = "arg$" + (i + 1);
+        int parameterCount = invokedType.parameterCount();
+        if (parameterCount > 0) {
+            argNames = new String[parameterCount];
+            argDescs = new String[parameterCount];
+            for (int i = 0; i < parameterCount; i++) {
+                argNames[i] = "arg$" + (i + 1);
+                argDescs[i] = BytecodeDescriptor.unparse(invokedType.parameterType(i));
+            }
+        } else {
+            argNames = argDescs = EMPTY_STRING_ARRAY;
         }
-        instantiatedArgumentTypes = Type.getArgumentTypes(
-                instantiatedMethodType.toMethodDescriptorString());
     }
 
     /**
@@ -179,36 +190,44 @@
      * is not found
      */
     @Override
-    CallSite buildCallSite() throws ReflectiveOperationException, LambdaConversionException {
+    CallSite buildCallSite() throws LambdaConversionException {
         final Class<?> innerClass = spinInnerClass();
         if (invokedType.parameterCount() == 0) {
             final Constructor[] ctrs = AccessController.doPrivileged(
                     new PrivilegedAction<Constructor[]>() {
                 @Override
                 public Constructor[] run() {
-                    return innerClass.getDeclaredConstructors();
+                    Constructor<?>[] ctrs = innerClass.getDeclaredConstructors();
+                    if (ctrs.length == 1) {
+                        // The lambda implementing inner class constructor is private, set
+                        // it accessible (by us) before creating the constant sole instance
+                        ctrs[0].setAccessible(true);
+                    }
+                    return ctrs;
                 }
-            });
+                    });
             if (ctrs.length != 1) {
-                throw new ReflectiveOperationException("Expected one lambda constructor for "
+                throw new LambdaConversionException("Expected one lambda constructor for "
                         + innerClass.getCanonicalName() + ", got " + ctrs.length);
             }
-            // The lambda implementing inner class constructor is private, set
-            // it accessible (by us) before creating the constant sole instance
-            AccessController.doPrivileged(new PrivilegedAction<Void>() {
-                @Override
-                public Void run() {
-                    ctrs[0].setAccessible(true);
-                    return null;
-                }
-            });
-            Object inst = ctrs[0].newInstance();
-            return new ConstantCallSite(MethodHandles.constant(samBase, inst));
+
+            try {
+                Object inst = ctrs[0].newInstance();
+                return new ConstantCallSite(MethodHandles.constant(samBase, inst));
+            }
+            catch (ReflectiveOperationException e) {
+                throw new LambdaConversionException("Exception instantiating lambda object", e);
+            }
         } else {
-            return new ConstantCallSite(
-                    MethodHandles.Lookup.IMPL_LOOKUP
-                         .findConstructor(innerClass, constructorType)
-                         .asType(constructorType.changeReturnType(samBase)));
+            try {
+                UNSAFE.ensureClassInitialized(innerClass);
+                return new ConstantCallSite(
+                        MethodHandles.Lookup.IMPL_LOOKUP
+                             .findStatic(innerClass, NAME_FACTORY, invokedType));
+            }
+            catch (ReflectiveOperationException e) {
+                throw new LambdaConversionException("Exception finding constructor", e);
+            }
         }
     }
 
@@ -228,44 +247,59 @@
      * is not found
      */
     private Class<?> spinInnerClass() throws LambdaConversionException {
-        String[] interfaces = new String[markerInterfaces.length + 1];
-        interfaces[0] = samBase.getName().replace('.', '/');
-        for (int i=0; i<markerInterfaces.length; i++) {
-            interfaces[i+1] = markerInterfaces[i].getName().replace('.', '/');
+        String[] interfaces;
+        String samIntf = samBase.getName().replace('.', '/');
+        boolean accidentallySerializable = !isSerializable && Serializable.class.isAssignableFrom(samBase);
+        if (markerInterfaces.length == 0) {
+            interfaces = new String[]{samIntf};
+        } else {
+            // Assure no duplicate interfaces (ClassFormatError)
+            Set<String> itfs = new LinkedHashSet<>(markerInterfaces.length + 1);
+            itfs.add(samIntf);
+            for (Class<?> markerInterface : markerInterfaces) {
+                itfs.add(markerInterface.getName().replace('.', '/'));
+                accidentallySerializable |= !isSerializable && Serializable.class.isAssignableFrom(markerInterface);
+            }
+            interfaces = itfs.toArray(new String[itfs.size()]);
         }
+
         cw.visit(CLASSFILE_VERSION, ACC_SUPER + ACC_FINAL + ACC_SYNTHETIC,
                  lambdaClassName, null,
-                 NAME_MAGIC_ACCESSOR_IMPL, interfaces);
+                 JAVA_LANG_OBJECT, interfaces);
 
         // Generate final fields to be filled in by constructor
-        for (int i = 0; i < argTypes.length; i++) {
+        for (int i = 0; i < argDescs.length; i++) {
             FieldVisitor fv = cw.visitField(ACC_PRIVATE + ACC_FINAL,
                                             argNames[i],
-                                            argTypes[i].getDescriptor(),
+                                            argDescs[i],
                                             null, null);
             fv.visitEnd();
         }
 
         generateConstructor();
 
+        if (invokedType.parameterCount() != 0) {
+            generateFactory();
+        }
+
         // Forward the SAM method
-        String methodDescriptor = samMethodType.toMethodDescriptorString();
         MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, samMethodName,
-                                          methodDescriptor, null, null);
-        new ForwardingMethodGenerator(mv).generate(methodDescriptor);
+                                          samMethodType.toMethodDescriptorString(), null, null);
+        new ForwardingMethodGenerator(mv).generate(samMethodType);
 
         // Forward the bridges
         if (additionalBridges != null) {
             for (MethodType mt : additionalBridges) {
-                methodDescriptor = mt.toMethodDescriptorString();
                 mv = cw.visitMethod(ACC_PUBLIC|ACC_BRIDGE, samMethodName,
-                                    methodDescriptor, null, null);
-                new ForwardingMethodGenerator(mv).generate(methodDescriptor);
+                                    mt.toMethodDescriptorString(), null, null);
+                new ForwardingMethodGenerator(mv).generate(mt);
             }
         }
 
         if (isSerializable)
-            generateWriteReplace();
+            generateSerializationFriendlyMethods();
+        else if (accidentallySerializable)
+            generateSerializationHostileMethods();
 
         cw.visitEnd();
 
@@ -287,21 +321,27 @@
             new PropertyPermission("user.dir", "read"));
         }
 
-        ClassLoader loader = targetClass.getClassLoader();
-        ProtectionDomain pd = (loader == null)
-                              ? null
-                              : AccessController.doPrivileged(
-                                      new PrivilegedAction<ProtectionDomain>() {
-                                          @Override
-                                          public ProtectionDomain run() {
-                                              return targetClass.getProtectionDomain();
-                                          }
-                                      }
-                              );
+        return UNSAFE.defineAnonymousClass(targetClass, classBytes, null);
+    }
 
-        return UNSAFE.defineClass(lambdaClassName,
-                                  classBytes, 0, classBytes.length,
-                                  loader, pd);
+    /**
+     * Generate the factory method for the class
+     */
+    private void generateFactory() {
+        MethodVisitor m = cw.visitMethod(ACC_PRIVATE | ACC_STATIC, NAME_FACTORY, invokedType.toMethodDescriptorString(), null, null);
+        m.visitCode();
+        m.visitTypeInsn(NEW, lambdaClassName);
+        m.visitInsn(Opcodes.DUP);
+        int parameterCount = invokedType.parameterCount();
+        for (int typeIndex = 0, varIndex = 0; typeIndex < parameterCount; typeIndex++) {
+            Class<?> argType = invokedType.parameterType(typeIndex);
+            m.visitVarInsn(getLoadOpcode(argType), varIndex);
+            varIndex += getParameterSize(argType);
+        }
+        m.visitMethodInsn(INVOKESPECIAL, lambdaClassName, NAME_CTOR, constructorType.toMethodDescriptorString());
+        m.visitInsn(ARETURN);
+        m.visitMaxs(-1, -1);
+        m.visitEnd();
     }
 
     /**
@@ -310,18 +350,18 @@
     private void generateConstructor() {
         // Generate constructor
         MethodVisitor ctor = cw.visitMethod(ACC_PRIVATE, NAME_CTOR,
-                                            constructorDesc, null, null);
+                                            constructorType.toMethodDescriptorString(), null, null);
         ctor.visitCode();
         ctor.visitVarInsn(ALOAD, 0);
-        ctor.visitMethodInsn(INVOKESPECIAL, NAME_MAGIC_ACCESSOR_IMPL, NAME_CTOR,
+        ctor.visitMethodInsn(INVOKESPECIAL, JAVA_LANG_OBJECT, NAME_CTOR,
                              METHOD_DESCRIPTOR_VOID);
-        int lvIndex = 0;
-        for (int i = 0; i < argTypes.length; i++) {
+        int parameterCount = invokedType.parameterCount();
+        for (int i = 0, lvIndex = 0; i < parameterCount; i++) {
             ctor.visitVarInsn(ALOAD, 0);
-            ctor.visitVarInsn(argTypes[i].getOpcode(ILOAD), lvIndex + 1);
-            lvIndex += argTypes[i].getSize();
-            ctor.visitFieldInsn(PUTFIELD, lambdaClassName, argNames[i],
-                                argTypes[i].getDescriptor());
+            Class<?> argType = invokedType.parameterType(i);
+            ctor.visitVarInsn(getLoadOpcode(argType), lvIndex + 1);
+            lvIndex += getParameterSize(argType);
+            ctor.visitFieldInsn(PUTFIELD, lambdaClassName, argNames[i], argDescs[i]);
         }
         ctor.visitInsn(RETURN);
         // Maxs computed by ClassWriter.COMPUTE_MAXS, these arguments ignored
@@ -330,9 +370,9 @@
     }
 
     /**
-     * Generate the writeReplace method (if needed for serialization)
+     * Generate a writeReplace method that supports serialization
      */
-    private void generateWriteReplace() {
+    private void generateSerializationFriendlyMethods() {
         TypeConvertingMethodAdapter mv
                 = new TypeConvertingMethodAdapter(
                     cw.visitMethod(ACC_PRIVATE + ACC_FINAL,
@@ -351,16 +391,14 @@
         mv.visitLdcInsn(implInfo.getName());
         mv.visitLdcInsn(implInfo.getMethodType().toMethodDescriptorString());
         mv.visitLdcInsn(instantiatedMethodType.toMethodDescriptorString());
-
-        mv.iconst(argTypes.length);
-        mv.visitTypeInsn(ANEWARRAY, NAME_OBJECT);
-        for (int i = 0; i < argTypes.length; i++) {
+        mv.iconst(argDescs.length);
+        mv.visitTypeInsn(ANEWARRAY, JAVA_LANG_OBJECT);
+        for (int i = 0; i < argDescs.length; i++) {
             mv.visitInsn(DUP);
             mv.iconst(i);
             mv.visitVarInsn(ALOAD, 0);
-            mv.visitFieldInsn(GETFIELD, lambdaClassName, argNames[i],
-                              argTypes[i].getDescriptor());
-            mv.boxIfTypePrimitive(argTypes[i]);
+            mv.visitFieldInsn(GETFIELD, lambdaClassName, argNames[i], argDescs[i]);
+            mv.boxIfTypePrimitive(Type.getType(argDescs[i]));
             mv.visitInsn(AASTORE);
         }
         mv.visitMethodInsn(INVOKESPECIAL, NAME_SERIALIZED_LAMBDA, NAME_CTOR,
@@ -372,6 +410,37 @@
     }
 
     /**
+     * Generate a readObject/writeObject method that is hostile to serialization
+     */
+    private void generateSerializationHostileMethods() {
+        MethodVisitor mv = cw.visitMethod(ACC_PRIVATE + ACC_FINAL,
+                                          NAME_METHOD_WRITE_OBJECT, DESCR_METHOD_WRITE_OBJECT,
+                                          null, SER_HOSTILE_EXCEPTIONS);
+        mv.visitCode();
+        mv.visitTypeInsn(NEW, NAME_NOT_SERIALIZABLE_EXCEPTION);
+        mv.visitInsn(DUP);
+        mv.visitLdcInsn("Non-serializable lambda");
+        mv.visitMethodInsn(INVOKESPECIAL, NAME_NOT_SERIALIZABLE_EXCEPTION, NAME_CTOR,
+                           DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION);
+        mv.visitInsn(ATHROW);
+        mv.visitMaxs(-1, -1);
+        mv.visitEnd();
+
+        mv = cw.visitMethod(ACC_PRIVATE + ACC_FINAL,
+                            NAME_METHOD_READ_OBJECT, DESCR_METHOD_READ_OBJECT,
+                            null, SER_HOSTILE_EXCEPTIONS);
+        mv.visitCode();
+        mv.visitTypeInsn(NEW, NAME_NOT_SERIALIZABLE_EXCEPTION);
+        mv.visitInsn(DUP);
+        mv.visitLdcInsn("Non-serializable lambda");
+        mv.visitMethodInsn(INVOKESPECIAL, NAME_NOT_SERIALIZABLE_EXCEPTION, NAME_CTOR,
+                           DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION);
+        mv.visitInsn(ATHROW);
+        mv.visitMaxs(-1, -1);
+        mv.visitEnd();
+    }
+
+    /**
      * This class generates a method body which calls the lambda implementation
      * method, converting arguments, as needed.
      */
@@ -381,20 +450,19 @@
             super(mv);
         }
 
-        void generate(String methodDescriptor) {
+        void generate(MethodType methodType) {
             visitCode();
 
             if (implKind == MethodHandleInfo.REF_newInvokeSpecial) {
                 visitTypeInsn(NEW, implMethodClassName);
                 visitInsn(DUP);
             }
-            for (int i = 0; i < argTypes.length; i++) {
+            for (int i = 0; i < argNames.length; i++) {
                 visitVarInsn(ALOAD, 0);
-                visitFieldInsn(GETFIELD, lambdaClassName, argNames[i],
-                               argTypes[i].getDescriptor());
+                visitFieldInsn(GETFIELD, lambdaClassName, argNames[i], argDescs[i]);
             }
 
-            convertArgumentTypes(Type.getArgumentTypes(methodDescriptor));
+            convertArgumentTypes(methodType);
 
             // Invoke the method we want to forward to
             visitMethodInsn(invocationOpcode(), implMethodClassName, implMethodName, implMethodDesc);
@@ -402,46 +470,36 @@
             // Convert the return value (if any) and return it
             // Note: if adapting from non-void to void, the 'return'
             // instruction will pop the unneeded result
-            Type samReturnType = Type.getReturnType(methodDescriptor);
-            convertType(implMethodReturnType, samReturnType, samReturnType);
-            visitInsn(samReturnType.getOpcode(Opcodes.IRETURN));
+            Class<?> samReturnClass = methodType.returnType();
+            convertType(implMethodReturnClass, samReturnClass, samReturnClass);
+            visitInsn(getReturnOpcode(samReturnClass));
             // Maxs computed by ClassWriter.COMPUTE_MAXS,these arguments ignored
             visitMaxs(-1, -1);
             visitEnd();
         }
 
-        private void convertArgumentTypes(Type[] samArgumentTypes) {
+        private void convertArgumentTypes(MethodType samType) {
             int lvIndex = 0;
             boolean samIncludesReceiver = implIsInstanceMethod &&
-                                                   argTypes.length == 0;
+                                                   invokedType.parameterCount() == 0;
             int samReceiverLength = samIncludesReceiver ? 1 : 0;
             if (samIncludesReceiver) {
                 // push receiver
-                Type rcvrType = samArgumentTypes[0];
-                Type instantiatedRcvrType = instantiatedArgumentTypes[0];
-
-                visitVarInsn(rcvrType.getOpcode(ILOAD), lvIndex + 1);
-                lvIndex += rcvrType.getSize();
-                convertType(rcvrType, Type.getType(implDefiningClass), instantiatedRcvrType);
+                Class<?> rcvrType = samType.parameterType(0);
+                visitVarInsn(getLoadOpcode(rcvrType), lvIndex + 1);
+                lvIndex += getParameterSize(rcvrType);
+                convertType(rcvrType, implDefiningClass, instantiatedMethodType.parameterType(0));
             }
-            int argOffset = implMethodArgumentTypes.length - samArgumentTypes.length;
-            for (int i = samReceiverLength; i < samArgumentTypes.length; i++) {
-                Type argType = samArgumentTypes[i];
-                Type targetType = implMethodArgumentTypes[argOffset + i];
-                Type instantiatedArgType = instantiatedArgumentTypes[i];
-
-                visitVarInsn(argType.getOpcode(ILOAD), lvIndex + 1);
-                lvIndex += argType.getSize();
-                convertType(argType, targetType, instantiatedArgType);
+            int samParametersLength = samType.parameterCount();
+            int argOffset = implMethodType.parameterCount() - samParametersLength;
+            for (int i = samReceiverLength; i < samParametersLength; i++) {
+                Class<?> argType = samType.parameterType(i);
+                visitVarInsn(getLoadOpcode(argType), lvIndex + 1);
+                lvIndex += getParameterSize(argType);
+                convertType(argType, implMethodType.parameterType(argOffset + i), instantiatedMethodType.parameterType(i));
             }
         }
 
-        private void convertType(Type argType, Type targetType, Type functionalType) {
-            convertType(argType.getDescriptor(),
-                        targetType.getDescriptor(),
-                        functionalType.getDescriptor());
-        }
-
         private int invocationOpcode() throws InternalError {
             switch (implKind) {
                 case MethodHandleInfo.REF_invokeStatic:
@@ -459,4 +517,43 @@
             }
         }
     }
+
+    static int getParameterSize(Class<?> c) {
+        if (c == Void.TYPE) {
+            return 0;
+        } else if (c == Long.TYPE || c == Double.TYPE) {
+            return 2;
+        }
+        return 1;
+    }
+
+    static int getLoadOpcode(Class<?> c) {
+        if(c == Void.TYPE) {
+            throw new InternalError("Unexpected void type of load opcode");
+        }
+        return ILOAD + getOpcodeOffset(c);
+    }
+
+    static int getReturnOpcode(Class<?> c) {
+        if(c == Void.TYPE) {
+            return RETURN;
+        }
+        return IRETURN + getOpcodeOffset(c);
+    }
+
+    private static int getOpcodeOffset(Class<?> c) {
+        if (c.isPrimitive()) {
+            if (c == Long.TYPE) {
+                return 1;
+            } else if (c == Float.TYPE) {
+                return 2;
+            } else if (c == Double.TYPE) {
+                return 3;
+            }
+            return 0;
+        } else {
+            return 4;
+        }
+    }
+
 }
--- a/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -29,88 +29,128 @@
 import java.util.Arrays;
 
 /**
- * <p>Bootstrap methods for converting lambda expressions and method references to functional interface objects.</p>
- *
- * <p>For every lambda expressions or method reference in the source code, there is a target type which is a
- * functional interface. Evaluating a lambda expression produces an object of its target type. The mechanism for
- * evaluating lambda expressions is to invoke an invokedynamic call site, which takes arguments describing the sole
- * method of the functional interface and the implementation method, and returns an object (the lambda object) that
- * implements the target type. Methods of the lambda object invoke the implementation method. For method
- * references, the implementation method is simply the referenced method; for lambda expressions, the
- * implementation method is produced by the compiler based on the body of the lambda expression. The methods in
- * this file are the bootstrap methods for those invokedynamic call sites, called lambda factories, and the
- * bootstrap methods responsible for linking the lambda factories are called lambda meta-factories.
- *
- * <p>The bootstrap methods in this class take the information about the functional interface, the implementation
- * method, and the static types of the captured lambda arguments, and link a call site which, when invoked,
- * produces the lambda object.
- *
- * <p>When parameterized types are used, the instantiated type of the functional interface method may be different
- * from that in the functional interface. For example, consider
- * {@code interface I<T> { int m(T x); }} if this functional interface type is used in a lambda
- * {@code I<Byte>; v = ...}, we need both the actual functional interface method which has the signature
- * {@code (Object)int} and the erased instantiated type of the functional interface method (or simply
- * <I>instantiated method type</I>), which has signature
- * {@code (Byte)int}.
+ * <p>Methods to facilitate the creation of simple "function objects" that
+ * implement one or more interfaces by delegation to a provided {@link MethodHandle},
+ * possibly after type adaptation and partial evaluation of arguments.  These
+ * methods are typically used as <em>bootstrap methods</em> for {@code invokedynamic}
+ * call sites, to support the <em>lambda expression</em> and <em>method
+ * reference expression</em> features of the Java Programming Language.
  *
- * <p>The argument list of the implementation method and the argument list of the functional interface method(s)
- * may differ in several ways.  The implementation methods may have additional arguments to accommodate arguments
- * captured by the lambda expression; there may also be differences resulting from permitted adaptations of
- * arguments, such as casting, boxing, unboxing, and primitive widening. They may also differ because of var-args,
- * but this is expected to be handled by the compiler.
- *
- * <p>Invokedynamic call sites have two argument lists: a static argument list and a dynamic argument list.  The
- * static argument list lives in the constant pool; the dynamic argument list lives on the operand stack at
- * invocation time.  The bootstrap method has access to the entire static argument list (which in this case,
- * contains method handles describing the implementation method and the canonical functional interface method),
- * as well as a method signature describing the number and static types (but not the values) of the dynamic
- * arguments, and the static return type of the invokedynamic site.
+ * <p>Indirect access to the behavior specified by the provided {@code MethodHandle}
+ * proceeds in order through three phases:
+ * <ul>
+ *     <li><em>Linkage</em> occurs when the methods in this class are invoked.
+ *     They take as arguments an interface to be implemented (typically a
+ *     <em>functional interface</em>, one with a single abstract method), a
+ *     name and signature of a method from that interface to be implemented, a
+ *     method handle describing the desired implementation behavior
+ *     for that method, and possibly other additional metadata, and produce a
+ *     {@link CallSite} whose target can be used to create suitable function
+ *     objects.  Linkage may involve dynamically loading a new class that
+ *     implements the target interface. The {@code CallSite} can be considered a
+ *     "factory" for function objects and so these linkage methods are referred
+ *     to as "metafactories".</li>
  *
- * <p>The implementation method is described with a method handle. In theory, any method handle could be used.
- * Currently supported are method handles representing invocation of virtual, interface, constructor and static
- * methods.
+ *     <li><em>Capture</em> occurs when the {@code CallSite}'s target is
+ *     invoked, typically through an {@code invokedynamic} call site,
+ *     producing a function object.  This may occur many times for
+ *     a single factory {@code CallSite}.  Capture may involve allocation of a
+ *     new function object, or may return an existing function object.  The
+ *     behavior {@code MethodHandle} may have additional parameters beyond those
+ *     of the specified interface method; these are referred to as <em>captured
+ *     parameters</em>, which must be provided as arguments to the
+ *     {@code CallSite} target, and which may be early-bound to the behavior
+ *     {@code MethodHandle}.  The number of captured parameters and their types
+ *     are determined during linkage.</li>
  *
- * <p>Assume:
- * <ul>
- *      <li>the functional interface method has N arguments, of types (U1, U2, ... Un) and return type Ru</li>
- *      <li>then the instantiated method type also has N arguments, of types (T1, T2, ... Tn) and return type Rt</li>
- *      <li>the implementation method has M arguments, of types (A1..Am) and return type Ra,</li>
- *      <li>the dynamic argument list has K arguments of types (D1..Dk), and the invokedynamic return site has
- *          type Rd</li>
- *      <li>the functional interface type is F</li>
+ *     <li><em>Invocation</em> occurs when an implemented interface method
+ *     is invoked on a function object.  This may occur many times for a single
+ *     function object.  The method referenced by the behavior {@code MethodHandle}
+ *     is invoked with the captured arguments and any additional arguments
+ *     provided on invocation, as if by {@link MethodHandle#invoke(Object...)}.</li>
  * </ul>
  *
- * <p>The following signature invariants must hold:
+ * <p>It is sometimes useful to restrict the set of inputs or results permitted
+ * at invocation.  For example, when the generic interface {@code Predicate<T>}
+ * is parameterized as {@code Predicate<String>}, the input must be a
+ * {@code String}, even though the method to implement allows any {@code Object}.
+ * At linkage time, an additional {@link MethodType} parameter describes the
+ * "instantiated" method type; on invocation, the arguments and eventual result
+ * are checked against this {@code MethodType}.
+ *
+ * <p>This class provides two forms of linkage methods: a standard version
+ * ({@link #metafactory(MethodHandles.Lookup, String, MethodType, MethodType, MethodHandle, MethodType)})
+ * using an optimized protocol, and an alternate version
+ * {@link #altMetafactory(MethodHandles.Lookup, String, MethodType, Object...)}).
+ * The alternate version is a generalization of the standard version, providing
+ * additional control over the behavior of the generated function objects via
+ * flags and additional arguments.  The alternate version adds the ability to
+ * manage the following attributes of function objects:
+ *
  * <ul>
- *     <li>Rd is a subtype of F</li>
- *     <li>For i=1..N, Ti is a subtype of Ui</li>
- *     <li>Either Rt and Ru are primitive and are the same type, or both are reference types and
- *         Rt is a subtype of Ru</li>
- *     <li>If the implementation method is a static method:
- *     <ul>
- *         <li>K + N = M</li>
- *         <li>For i=1..K, Di = Ai</li>
- *         <li>For i=1..N, Ti is adaptable to Aj, where j=i+k</li>
- *     </ul></li>
- *     <li>If the implementation method is an instance method:
- *     <ul>
- *         <li>K + N = M + 1</li>
- *         <li>D1 must be a subtype of the enclosing class for the implementation method</li>
- *         <li>For i=2..K, Di = Aj, where j=i-1</li>
- *         <li>For i=1..N, Ti is adaptable to Aj, where j=i+k-1</li>
- *     </ul></li>
- *     <li>The return type Rt is void, or the return type Ra is not void and is adaptable to Rt</li>
+ *     <li><em>Bridging.</em>  It is sometimes useful to implement multiple
+ *     variations of the method signature, involving argument or return type
+ *     adaptation.  This occurs when multiple distinct VM signatures for a method
+ *     are logically considered to be the same method by the language.  The
+ *     flag {@code FLAG_BRIDGES} indicates that a list of additional
+ *     {@code MethodType}s will be provided, each of which will be implemented
+ *     by the resulting function object.  These methods will share the same
+ *     name and instantiated type.</li>
+ *
+ *     <li><em>Multiple interfaces.</em>  If needed, more than one interface
+ *     can be implemented by the function object.  (These additional interfaces
+ *     are typically marker interfaces with no methods.)  The flag {@code FLAG_MARKERS}
+ *     indicates that a list of additional interfaces will be provided, each of
+ *     which should be implemented by the resulting function object.</li>
+ *
+ *     <li><em>Serializability.</em>  The generated function objects do not
+ *     generally support serialization.  If desired, {@code FLAG_SERIALIZABLE}
+ *     can be used to indicate that the function objects should be serializable.
+ *     Serializable function objects will use, as their serialized form,
+ *     instances of the class {@code SerializedLambda}, which requires additional
+ *     assistance from the capturing class (the class described by the
+ *     {@link MethodHandles.Lookup} parameter {@code caller}); see
+ *     {@link SerializedLambda} for details.</li>
  * </ul>
  *
- * <p>Note that the potentially parameterized implementation return type provides the value for the SAM. Whereas
- * the completely known instantiated return type is adapted to the implementation arguments. Because the
- * instantiated type of the implementation method is not available, the adaptability of return types cannot be
- * checked as precisely at link-time as the arguments can be checked. Thus a loose version of link-time checking is
- * done on return type, while a strict version is applied to arguments.
+ * <p>Assume the linkage arguments are as follows:
+ * <ul>
+ *      <li>{@code invokedType} (describing the {@code CallSite} signature) has
+ *      K parameters of types (D1..Dk) and return type Rd;</li>
+ *      <li>{@code samMethodType} (describing the implemented method type) has N
+ *      parameters, of types (U1..Un) and return type Ru;</li>
+ *      <li>{@code implMethod} (the {@code MethodHandle} providing the
+ *      implementation has M parameters, of types (A1..Am) and return type Ra
+ *      (if the method describes an instance method, the method type of this
+ *      method handle already includes an extra first argument corresponding to
+ *      the receiver);</li>
+ *      <li>{@code instantiatedMethodType} (allowing restrictions on invocation)
+ *      has N parameters, of types (T1..Tn) and return type Rt.</li>
+ * </ul>
+ *
+ * <p>Then the following linkage invariants must hold:
+ * <ul>
+ *     <li>Rd is an interface</li>
+ *     <li>{@code implMethod} is a <em>direct method handle</em></li>
+ *     <li>{@code samMethodType} and {@code instantiatedMethodType} have the same
+ *     arity N, and for i=1..N, Ti and Ui are the same type, or Ti and Ui are
+ *     both reference types and Ti is a subtype of Ui</li>
+ *     <li>Either Rt and Ru are the same type, or both are reference types and
+ *     Rt is a subtype of Ru</li>
+ *     <li>K + N = M</li>
+ *     <li>For i=1..K, Di = Ai</li>
+ *     <li>For i=1..N, Ti is adaptable to Aj, where j=i+k</li>
+ *     <li>The return type Rt is void, or the return type Ra is not void and is
+ *     adaptable to Rt</li>
+ * </ul>
+ *
+ * <p>Further, at capture time, if {@code implMethod} corresponds to an instance
+ * method, and there are any capture arguments ({@code K > 0}), then the first
+ * capture argument (corresponding to the receiver) must be non-null.
  *
  * <p>A type Q is considered adaptable to S as follows:
  * <table summary="adaptable types">
- *     <tr><th>Q</th><th>S</th><th>Link-time checks</th><th>Capture-time checks</th></tr>
+ *     <tr><th>Q</th><th>S</th><th>Link-time checks</th><th>Invocation-time checks</th></tr>
  *     <tr>
  *         <td>Primitive</td><td>Primitive</td>
  *         <td>Q can be converted to S via a primitive widening conversion</td>
@@ -123,27 +163,59 @@
  *     </tr>
  *     <tr>
  *         <td>Reference</td><td>Primitive</td>
- *         <td>strict: Q is a primitive wrapper and Primitive(Q) can be widened to S
- *         <br>loose: If Q is a primitive wrapper, check that Primitive(Q) can be widened to S</td>
- *         <td>If Q is not a primitive wrapper, cast Q to the base Wrapper(S); for example Number for numeric types</td>
+ *         <td>for parameter types: Q is a primitive wrapper and Primitive(Q)
+ *         can be widened to S
+ *         <br>for return types: If Q is a primitive wrapper, check that
+ *         Primitive(Q) can be widened to S</td>
+ *         <td>If Q is not a primitive wrapper, cast Q to the base Wrapper(S);
+ *         for example Number for numeric types</td>
  *     </tr>
  *     <tr>
  *         <td>Reference</td><td>Reference</td>
- *         <td>strict: S is a supertype of Q
- *         <br>loose: none</td>
+ *         <td>for parameter types: S is a supertype of Q
+ *         <br>for return types: none</td>
  *         <td>Cast from Q to S</td>
  *     </tr>
  * </table>
  *
- * The default bootstrap ({@link #metafactory}) represents the common cases and uses an optimized protocol.
- * Alternate bootstraps (e.g., {@link #altMetafactory}) exist to support uncommon cases such as serialization
- * or additional marker superinterfaces.
+ * @apiNote These linkage methods are designed to support the evaluation
+ * of <em>lambda expressions</em> and <em>method references</em> in the Java
+ * Language.  For every lambda expressions or method reference in the source code,
+ * there is a target type which is a functional interface.  Evaluating a lambda
+ * expression produces an object of its target type. The recommended mechanism
+ * for evaluating lambda expressions is to desugar the lambda body to a method,
+ * invoke an invokedynamic call site whose static argument list describes the
+ * sole method of the functional interface and the desugared implementation
+ * method, and returns an object (the lambda object) that implements the target
+ * type. (For method references, the implementation method is simply the
+ * referenced method; no desugaring is needed.)
  *
+ * <p>The argument list of the implementation method and the argument list of
+ * the interface method(s) may differ in several ways.  The implementation
+ * methods may have additional arguments to accommodate arguments captured by
+ * the lambda expression; there may also be differences resulting from permitted
+ * adaptations of arguments, such as casting, boxing, unboxing, and primitive
+ * widening. (Varargs adaptations are not handled by the metafactories; these are
+ * expected to be handled by the caller.)
+ *
+ * <p>Invokedynamic call sites have two argument lists: a static argument list
+ * and a dynamic argument list.  The static argument list is stored in the
+ * constant pool; the dynamic argument is pushed on the operand stack at capture
+ * time.  The bootstrap method has access to the entire static argument list
+ * (which in this case, includes information describing the implementation method,
+ * the target interface, and the target interface method(s)), as well as a
+ * method signature describing the number and static types (but not the values)
+ * of the dynamic arguments and the static return type of the invokedynamic site.
+ *
+ * @implNote The implementation method is described with a method handle. In
+ * theory, any method handle could be used. Currently supported are direct method
+ * handles representing invocation of virtual, interface, constructor and static
+ * methods.
  */
 public class LambdaMetafactory {
 
-    /** Flag for alternate metafactories indicating the lambda object is
-     * must to be serializable */
+    /** Flag for alternate metafactories indicating the lambda object
+     * must be serializable */
     public static final int FLAG_SERIALIZABLE = 1 << 0;
 
     /**
@@ -163,41 +235,58 @@
     private static final MethodType[] EMPTY_MT_ARRAY = new MethodType[0];
 
     /**
-     * Standard meta-factory for conversion of lambda expressions or method
-     * references to functional interfaces.
+     * Facilitates the creation of simple "function objects" that implement one
+     * or more interfaces by delegation to a provided {@link MethodHandle},
+     * after appropriate type adaptation and partial evaluation of arguments.
+     * Typically used as a <em>bootstrap method</em> for {@code invokedynamic}
+     * call sites, to support the <em>lambda expression</em> and <em>method
+     * reference expression</em> features of the Java Programming Language.
+     *
+     * <p>This is the standard, streamlined metafactory; additional flexibility
+     * is provided by {@link #altMetafactory(MethodHandles.Lookup, String, MethodType, Object...)}.
+     * A general description of the behavior of this method is provided
+     * {@link LambdaMetafactory above}.
      *
-     * @param caller Stacked automatically by VM; represents a lookup context
-     *                   with the accessibility privileges of the caller.
-     * @param invokedName Stacked automatically by VM; the name of the invoked
-     *                    method as it appears at the call site.
-     *                    Used as the name of the functional interface method
-     *                    to which the lambda or method reference is being
-     *                    converted.
-     * @param invokedType Stacked automatically by VM; the signature of the
-     *                    invoked method, which includes the expected static
-     *                    type of the returned lambda object, and the static
-     *                    types of the captured arguments for the lambda.
+     * <p>When the target of the {@code CallSite} returned from this method is
+     * invoked, the resulting function objects are instances of a class which
+     * implements the interface named by the return type of {@code invokedType},
+     * declares a method with the name given by {@code invokedName} and the
+     * signature given by {@code samMethodType}.  It may also override additional
+     * methods from {@code Object}.
+     *
+     * @param caller Represents a lookup context with the accessibility
+     *               privileges of the caller.  When used with {@code invokedynamic},
+     *               this is stacked automatically by the VM.
+     * @param invokedName The name of the method to implement.  When used with
+     *                    {@code invokedynamic}, this is provided by the
+     *                    {@code NameAndType} of the {@code InvokeDynamic}
+     *                    structure and is stacked automatically by the VM.
+     * @param invokedType The expected signature of the {@code CallSite}.  The
+     *                    parameter types represent the types of capture variables;
+     *                    the return type is the interface to implement.   When
+     *                    used with {@code invokedynamic}, this is provided by
+     *                    the {@code NameAndType} of the {@code InvokeDynamic}
+     *                    structure and is stacked automatically by the VM.
      *                    In the event that the implementation method is an
-     *                    instance method, the first argument in the invocation
-     *                    signature will correspond to the receiver.
-     * @param samMethodType MethodType of the method in the functional interface
-     *                      to which the lambda or method reference is being
-     *                      converted, represented as a MethodType.
-     * @param implMethod The implementation method which should be called
-     *                   (with suitable adaptation of argument types, return
-     *                   types, and adjustment for captured arguments) when
-     *                   methods of the resulting functional interface instance
-     *                   are invoked.
-     * @param instantiatedMethodType The signature of the primary functional
-     *                               interface method after type variables
-     *                               are substituted with their instantiation
-     *                               from the capture site
-     * @return a CallSite, which, when invoked, will return an instance of the
-     * functional interface
-     * @throws ReflectiveOperationException if the caller is not able to
-     * reconstruct one of the method handles
-     * @throws LambdaConversionException If any of the meta-factory protocol
-     * invariants are violated
+     *                    instance method and this signature has any parameters,
+     *                    the first parameter in the invocation signature must
+     *                    correspond to the receiver.
+     * @param samMethodType Signature and return type of method to be implemented
+     *                      by the function object.
+     * @param implMethod A direct method handle describing the implementation
+     *                   method which should be called (with suitable adaptation
+     *                   of argument types, return types, and with captured
+     *                   arguments prepended to the invocation arguments) at
+     *                   invocation time.
+     * @param instantiatedMethodType The signature and return type that should
+     *                               be enforced dynamically at invocation time.
+     *                               This may be the same as {@code samMethodType},
+     *                               or may be a specialization of it.
+     * @return a CallSite whose target can be used to perform capture, generating
+     *         instances of the interface named by {@code invokedType}
+     * @throws LambdaConversionException If any of the linkage invariants
+     *                                   described {@link LambdaMetafactory above}
+     *                                   are violated
      */
     public static CallSite metafactory(MethodHandles.Lookup caller,
                                        String invokedName,
@@ -205,7 +294,7 @@
                                        MethodType samMethodType,
                                        MethodHandle implMethod,
                                        MethodType instantiatedMethodType)
-                   throws ReflectiveOperationException, LambdaConversionException {
+            throws LambdaConversionException {
         AbstractValidatingLambdaMetafactory mf;
         mf = new InnerClassLambdaMetafactory(caller, invokedType,
                                              invokedName, samMethodType,
@@ -216,60 +305,128 @@
     }
 
     /**
-     * Alternate meta-factory for conversion of lambda expressions or method
-     * references to functional interfaces, which supports serialization and
-     * other uncommon options.
+     * Facilitates the creation of simple "function objects" that implement one
+     * or more interfaces by delegation to a provided {@link MethodHandle},
+     * after appropriate type adaptation and partial evaluation of arguments.
+     * Typically used as a <em>bootstrap method</em> for {@code invokedynamic}
+     * call sites, to support the <em>lambda expression</em> and <em>method
+     * reference expression</em> features of the Java Programming Language.
      *
-     * The declared argument list for this method is:
+     * <p>This is the general, more flexible metafactory; a streamlined version
+     * is provided by {@link #altMetafactory(MethodHandles.Lookup, String, MethodType, Object...)}.
+     * A general description of the behavior of this method is provided
+     * {@link LambdaMetafactory above}.
      *
+     * <p>The argument list for this method includes three fixed parameters,
+     * corresponding to the parameters automatically stacked by the VM for the
+     * bootstrap method in an {@code invokedynamic} invocation, and an {@code Object[]}
+     * parameter that contains additional parameters.  The declared argument
+     * list for this method is:
+     *
+     * <pre>{@code
      *  CallSite altMetafactory(MethodHandles.Lookup caller,
      *                          String invokedName,
      *                          MethodType invokedType,
      *                          Object... args)
+     * }</pre>
      *
-     * but it behaves as if the argument list is:
+     * <p>but it behaves as if the argument list is as follows:
      *
+     * <pre>{@code
      *  CallSite altMetafactory(MethodHandles.Lookup caller,
      *                          String invokedName,
      *                          MethodType invokedType,
-     *                          MethodType samMethodType
+     *                          MethodType samMethodType,
      *                          MethodHandle implMethod,
      *                          MethodType instantiatedMethodType,
      *                          int flags,
-     *                          int markerInterfaceCount, // IF flags has MARKERS set
-     *                          Class... markerInterfaces // IF flags has MARKERS set
-     *                          int bridgeCount,          // IF flags has BRIDGES set
-     *                          MethodType... bridges     // IF flags has BRIDGES set
+     *                          int markerInterfaceCount,  // IF flags has MARKERS set
+     *                          Class... markerInterfaces, // IF flags has MARKERS set
+     *                          int bridgeCount,           // IF flags has BRIDGES set
+     *                          MethodType... bridges      // IF flags has BRIDGES set
      *                          )
+     * }</pre>
      *
+     * <p>Arguments that appear in the argument list for
+     * {@link #metafactory(MethodHandles.Lookup, String, MethodType, MethodType, MethodHandle, MethodType)}
+     * have the same specification as in that method.  The additional arguments
+     * are interpreted as follows:
+     * <ul>
+     *     <li>{@code flags} indicates additional options; this is a bitwise
+     *     OR of desired flags.  Defined flags are {@link #FLAG_BRIDGES},
+     *     {@link #FLAG_MARKERS}, and {@link #FLAG_SERIALIZABLE}.</li>
+     *     <li>{@code markerInterfaceCount} is the number of additional interfaces
+     *     the function object should implement, and is present if and only if the
+     *     {@code FLAG_MARKERS} flag is set.</li>
+     *     <li>{@code markerInterfaces} is a variable-length list of additional
+     *     interfaces to implement, whose length equals {@code markerInterfaceCount},
+     *     and is present if and only if the {@code FLAG_MARKERS} flag is set.</li>
+     *     <li>{@code bridgeCount} is the number of additional method signatures
+     *     the function object should implement, and is present if and only if
+     *     the {@code FLAG_BRIDGES} flag is set.</li>
+     *     <li>{@code bridges} is a variable-length list of additional
+     *     methods signatures to implement, whose length equals {@code bridgeCount},
+     *     and is present if and only if the {@code FLAG_BRIDGES} flag is set.</li>
+     * </ul>
+     *
+     * <p>Each class named by {@code markerInterfaces} is subject to the same
+     * restrictions as {@code Rd}, the return type of {@code invokedType},
+     * as described {@link LambdaMetafactory above}.  Each {@code MethodType}
+     * named by {@code bridges} is subject to the same restrictions as
+     * {@code samMethodType}, as described {@link LambdaMetafactory above}.
+     *
+     * <p>When FLAG_SERIALIZABLE is set in {@code flags}, the function objects
+     * will implement {@code Serializable}, and will have a {@code writeReplace}
+     * method that returns an appropriate {@link SerializedLambda}.  The
+     * {@code caller} class must have an appropriate {@code $deserializeLambda$}
+     * method, as described in {@link SerializedLambda}.
      *
-     * @param caller Stacked automatically by VM; represents a lookup context
-     *               with the accessibility privileges of the caller.
-     * @param invokedName Stacked automatically by VM; the name of the invoked
-     *                    method as it appears at the call site.
-     *                    Used as the name of the functional interface method
-     *                    to which the lambda or method reference is being
-     *                    converted.
-     * @param invokedType Stacked automatically by VM; the signature of the
-     *                    invoked method, which includes the expected static
-     *                    type of the returned lambda object, and the static
-     *                    types of the captured arguments for the lambda.
+     * <p>When the target of the {@code CallSite} returned from this method is
+     * invoked, the resulting function objects are instances of a class with
+     * the following properties:
+     * <ul>
+     *     <li>The class implements the interface named by the return type
+     *     of {@code invokedType} and any interfaces named by {@code markerInterfaces}</li>
+     *     <li>The class declares methods with the name given by {@code invokedName},
+     *     and the signature given by {@code samMethodType} and additional signatures
+     *     given by {@code bridges}</li>
+     *     <li>The class may override methods from {@code Object}, and may
+     *     implement methods related to serialization.</li>
+     * </ul>
+     *
+     * @param caller Represents a lookup context with the accessibility
+     *               privileges of the caller.  When used with {@code invokedynamic},
+     *               this is stacked automatically by the VM.
+     * @param invokedName The name of the method to implement.  When used with
+     *                    {@code invokedynamic}, this is provided by the
+     *                    {@code NameAndType} of the {@code InvokeDynamic}
+     *                    structure and is stacked automatically by the VM.
+     * @param invokedType The expected signature of the {@code CallSite}.  The
+     *                    parameter types represent the types of capture variables;
+     *                    the return type is the interface to implement.   When
+     *                    used with {@code invokedynamic}, this is provided by
+     *                    the {@code NameAndType} of the {@code InvokeDynamic}
+     *                    structure and is stacked automatically by the VM.
      *                    In the event that the implementation method is an
-     *                    instance method, the first argument in the invocation
-     *                    signature will correspond to the receiver.
-     * @param  args       flags and optional arguments, as described above
-     * @return a CallSite, which, when invoked, will return an instance of the
-     * functional interface
-     * @throws ReflectiveOperationException if the caller is not able to
-     * reconstruct one of the method handles
-     * @throws LambdaConversionException If any of the meta-factory protocol
-     * invariants are violated
+     *                    instance method and this signature has any parameters,
+     *                    the first parameter in the invocation signature must
+     *                    correspond to the receiver.
+     * @param  args       An {@code Object[]} array containing the required
+     *                    arguments {@code samMethodType}, {@code implMethod},
+     *                    {@code instantiatedMethodType}, {@code flags}, and any
+     *                    optional arguments, as described
+     *                    {@link #altMetafactory(MethodHandles.Lookup, String, MethodType, Object...)} above}
+     * @return a CallSite whose target can be used to perform capture, generating
+     *         instances of the interface named by {@code invokedType}
+     * @throws LambdaConversionException If any of the linkage invariants
+     *                                   described {@link LambdaMetafactory above}
+     *                                   are violated
      */
     public static CallSite altMetafactory(MethodHandles.Lookup caller,
                                           String invokedName,
                                           MethodType invokedType,
                                           Object... args)
-            throws ReflectiveOperationException, LambdaConversionException {
+            throws LambdaConversionException {
         MethodType samMethodType = (MethodType)args[0];
         MethodHandle implMethod = (MethodHandle)args[1];
         MethodType instantiatedMethodType = (MethodType)args[2];
@@ -294,15 +451,15 @@
         else
             bridges = EMPTY_MT_ARRAY;
 
-        boolean foundSerializableSupertype = Serializable.class.isAssignableFrom(invokedType.returnType());
-        for (Class<?> c : markerInterfaces)
-            foundSerializableSupertype |= Serializable.class.isAssignableFrom(c);
-        boolean isSerializable = ((flags & LambdaMetafactory.FLAG_SERIALIZABLE) != 0)
-                                 || foundSerializableSupertype;
-
-        if (isSerializable && !foundSerializableSupertype) {
-            markerInterfaces = Arrays.copyOf(markerInterfaces, markerInterfaces.length + 1);
-            markerInterfaces[markerInterfaces.length-1] = Serializable.class;
+        boolean isSerializable = ((flags & FLAG_SERIALIZABLE) != 0);
+        if (isSerializable) {
+            boolean foundSerializableSupertype = Serializable.class.isAssignableFrom(invokedType.returnType());
+            for (Class<?> c : markerInterfaces)
+                foundSerializableSupertype |= Serializable.class.isAssignableFrom(c);
+            if (!foundSerializableSupertype) {
+                markerInterfaces = Arrays.copyOf(markerInterfaces, markerInterfaces.length + 1);
+                markerInterfaces[markerInterfaces.length-1] = Serializable.class;
+            }
         }
 
         AbstractValidatingLambdaMetafactory mf
--- a/jdk/src/share/classes/java/lang/invoke/MagicLambdaImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  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 java.lang.invoke;
-
-/** <P> MagicLambdaImpl (named for similarity to MagicAccessorImpl and
- others, not because it actually implements an interface) is a
- marker class in the hierarchy. All subclasses of this class are
- "magically" granted access by the VM to otherwise inaccessible
- fields and methods of other classes. It is distinct from MagicAccessorImpl
- because, while we want to bypass accessibility checks, we do not want to
- bypass verification.</P>
-
- <P> Do not change the name of this class without also changing the
- VM's code. </P> */
-
-class MagicLambdaImpl {
-}
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Wed Jul 05 19:21:26 2017 +0200
@@ -441,8 +441,13 @@
             assert(refKindIsValid(refKind));
             return lookup.linkMethodHandleConstant((byte) refKind, defc, name, type);
         } catch (IllegalAccessException ex) {
-            Error err = new IllegalAccessError(ex.getMessage());
-            throw initCauseFrom(err, ex);
+            Throwable cause = ex.getCause();
+            if (cause instanceof AbstractMethodError) {
+                throw (AbstractMethodError) cause;
+            } else {
+                Error err = new IllegalAccessError(ex.getMessage());
+                throw initCauseFrom(err, ex);
+            }
         } catch (NoSuchMethodException ex) {
             Error err = new NoSuchMethodError(ex.getMessage());
             throw initCauseFrom(err, ex);
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1716,6 +1716,13 @@
                 checkSymbolicClass(defc);
                 return mh;
             }
+            // Treat MethodHandle.invoke and invokeExact specially.
+            if (defc == MethodHandle.class && refKind == REF_invokeVirtual) {
+                mh = findVirtualForMH(member.getName(), member.getMethodType());
+                if (mh != null) {
+                    return mh;
+                }
+            }
             MemberName resolved = resolveOrFail(refKind, member);
             mh = getDirectMethodForConstant(refKind, defc, resolved);
             if (mh instanceof DirectMethodHandle
@@ -1768,12 +1775,6 @@
             if (MethodHandleNatives.refKindIsField(refKind)) {
                 return getDirectFieldNoSecurityManager(refKind, defc, member);
             } else if (MethodHandleNatives.refKindIsMethod(refKind)) {
-                if (defc == MethodHandle.class && refKind == REF_invokeVirtual) {
-                    MethodHandle mh = findVirtualForMH(member.getName(), member.getMethodType());
-                    if (mh != null) {
-                        return mh;
-                    }
-                }
                 return getDirectMethodNoSecurityManager(refKind, defc, member, lookupClass);
             } else if (refKind == REF_newInvokeSpecial) {
                 return getDirectConstructorNoSecurityManager(defc, member);
--- a/jdk/src/share/classes/java/lang/invoke/MethodType.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/MethodType.java	Wed Jul 05 19:21:26 2017 +0200
@@ -813,7 +813,7 @@
      * So this method returns {@link #parameterCount() parameterCount} plus the
      * number of long and double parameters (if any).
      * <p>
-     * This method is included for the benfit of applications that must
+     * This method is included for the benefit of applications that must
      * generate bytecodes that process method handles and invokedynamic.
      * @return the number of JVM stack slots for this type's parameters
      */
@@ -844,7 +844,7 @@
      * <em>plus</em> the number of long or double arguments
      * at or after after the argument for the given parameter.
      * <p>
-     * This method is included for the benfit of applications that must
+     * This method is included for the benefit of applications that must
      * generate bytecodes that process method handles and invokedynamic.
      * @param num an index (zero-based, inclusive) within the parameter types
      * @return the index of the (shallowest) JVM stack slot transmitting the
@@ -862,7 +862,7 @@
      * If the {@link #returnType() return type} is void, it will be zero,
      * else if the return type is long or double, it will be two, else one.
      * <p>
-     * This method is included for the benfit of applications that must
+     * This method is included for the benefit of applications that must
      * generate bytecodes that process method handles and invokedynamic.
      * @return the number of JVM stack slots (0, 1, or 2) for this type's return value
      * Will be removed for PFD.
@@ -882,7 +882,7 @@
      * constructed by this method, because their component types are
      * not all reachable from a common class loader.
      * <p>
-     * This method is included for the benfit of applications that must
+     * This method is included for the benefit of applications that must
      * generate bytecodes that process method handles and {@code invokedynamic}.
      * @param descriptor a bytecode-level type descriptor string "(T...)T"
      * @param loader the class loader in which to look up the types
@@ -912,7 +912,7 @@
      * Two distinct classes which share a common name but have different class loaders
      * will appear identical when viewed within descriptor strings.
      * <p>
-     * This method is included for the benfit of applications that must
+     * This method is included for the benefit of applications that must
      * generate bytecodes that process method handles and {@code invokedynamic}.
      * {@link #fromMethodDescriptorString(java.lang.String, java.lang.ClassLoader) fromMethodDescriptorString},
      * because the latter requires a suitable class loader argument.
--- a/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java	Wed Jul 05 19:21:26 2017 +0200
@@ -32,9 +32,26 @@
 import java.util.Objects;
 
 /**
- * Serialized form of a lambda expression.  The properties of this class represent the information that is present
- * at the lambda factory site, including the identity of the primary functional interface method, the identity of the
- * implementation method, and any variables captured from the local environment at the time of lambda capture.
+ * Serialized form of a lambda expression.  The properties of this class
+ * represent the information that is present at the lambda factory site, including
+ * static metafactory arguments such as the identity of the primary functional
+ * interface method and the identity of the implementation method, as well as
+ * dynamic metafactory arguments such as values captured from the lexical scope
+ * at the time of lambda capture.
+ *
+ * <p>Implementors of serializable lambdas, such as compilers or language
+ * runtime libraries, are expected to ensure that instances deserialize properly.
+ * One means to do so is to ensure that the {@code writeReplace} method returns
+ * an instance of {@code SerializedLambda}, rather than allowing default
+ * serialization to proceed.
+ *
+ * <p>{@code SerializedLambda} has a {@code readResolve} method that looks for
+ * a (possibly private) static method called
+ * {@code $deserializeLambda$(SerializedLambda)} in the capturing class, invokes
+ * that with itself as the first argument, and returns the result.  Lambda classes
+ * implementing {@code $deserializeLambda$} are responsible for validating
+ * that the properties of the {@code SerializedLambda} are consistent with a
+ * lambda actually captured by that class.
  *
  * @see LambdaMetafactory
  */
--- a/jdk/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -28,6 +28,7 @@
 import jdk.internal.org.objectweb.asm.MethodVisitor;
 import jdk.internal.org.objectweb.asm.Opcodes;
 import jdk.internal.org.objectweb.asm.Type;
+import sun.invoke.util.BytecodeDescriptor;
 import sun.invoke.util.Wrapper;
 import static sun.invoke.util.Wrapper.*;
 
@@ -204,27 +205,27 @@
     }
 
     /**
-     * Convert an argument of type 'argType' to be passed to 'targetType' assuring that it is 'functionalType'.
+     * Convert an argument of type 'arg' to be passed to 'target' assuring that it is 'functional'.
      * Insert the needed conversion instructions in the method code.
-     * @param argType
-     * @param targetType
-     * @param functionalType
+     * @param arg
+     * @param target
+     * @param functional
      */
-    void convertType(String dArg, String dTarget, String dFunctional) {
-        if (dArg.equals(dTarget)) {
+    void convertType(Class<?> arg, Class<?> target, Class<?> functional) {
+        if (arg.equals(target)) {
             return;
         }
-        Wrapper wArg = toWrapper(dArg);
-        Wrapper wTarget = toWrapper(dTarget);
-        if (wArg == VOID || wTarget == VOID) {
+        if (arg == Void.TYPE || target == Void.TYPE) {
             return;
         }
-        if (isPrimitive(wArg)) {
-            if (isPrimitive(wTarget)) {
+        if (arg.isPrimitive()) {
+            Wrapper wArg = Wrapper.forPrimitiveType(arg);
+            if (target.isPrimitive()) {
                 // Both primitives: widening
-                widen(wArg, wTarget);
+                widen(wArg, Wrapper.forPrimitiveType(target));
             } else {
                 // Primitive argument to reference target
+                String dTarget = BytecodeDescriptor.unparse(target);
                 Wrapper wPrimTarget = wrapperOrNullFromDescriptor(dTarget);
                 if (wPrimTarget != null) {
                     // The target is a boxed primitive type, widen to get there before boxing
@@ -237,16 +238,18 @@
                 }
             }
         } else {
+            String dArg = BytecodeDescriptor.unparse(arg);
             String dSrc;
-            Wrapper wFunctional = toWrapper(dFunctional);
-            if (isPrimitive(wFunctional)) {
+            if (functional.isPrimitive()) {
                 dSrc = dArg;
             } else {
                 // Cast to convert to possibly more specific type, and generate CCE for invalid arg
-                dSrc = dFunctional;
-                cast(dArg, dFunctional);
+                dSrc = BytecodeDescriptor.unparse(functional);
+                cast(dArg, dSrc);
             }
-            if (isPrimitive(wTarget)) {
+            String dTarget = BytecodeDescriptor.unparse(target);
+            if (target.isPrimitive()) {
+                Wrapper wTarget = toWrapper(dTarget);
                 // Reference argument to primitive target
                 Wrapper wps = wrapperOrNullFromDescriptor(dSrc);
                 if (wps != null) {
--- a/jdk/src/share/classes/java/lang/management/CompilationMXBean.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/management/CompilationMXBean.java	Wed Jul 05 19:21:26 2017 +0200
@@ -74,7 +74,7 @@
     public boolean isCompilationTimeMonitoringSupported();
 
     /**
-     * Returns the approximate accumlated elapsed time (in milliseconds)
+     * Returns the approximate accumulated elapsed time (in milliseconds)
      * spent in compilation.
      * If multiple threads are used for compilation, this value is
      * summation of the approximate time that each thread spent in compilation.
--- a/jdk/src/share/classes/java/lang/management/ManagementFactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/management/ManagementFactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -60,7 +60,7 @@
  * one or more <i>platform MXBeans</i> representing
  * the management interface of a component of the Java virtual
  * machine.
- * <p>
+ *
  * <h3><a name="MXBean">Platform MXBeans</a></h3>
  * <p>
  * A platform MXBean is a <i>managed bean</i> that
--- a/jdk/src/share/classes/java/lang/management/ManagementPermission.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/management/ManagementPermission.java	Wed Jul 05 19:21:26 2017 +0200
@@ -33,10 +33,8 @@
  * The following table
  * provides a summary description of what the permission allows,
  * and discusses the risks of granting code the permission.
- * <P>
  *
- * <table border=1 cellpadding=5 summary="Table shows permission target name, wh
-at the permission allows, and associated risks">
+ * <table border=1 cellpadding=5 summary="Table shows permission target name, what the permission allows, and associated risks">
  * <tr>
  * <th>Permission Target Name</th>
  * <th>What the Permission Allows</th>
--- a/jdk/src/share/classes/java/lang/management/MemoryPoolMXBean.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/management/MemoryPoolMXBean.java	Wed Jul 05 19:21:26 2017 +0200
@@ -147,7 +147,7 @@
  *       by calling either the {@link #getUsage} method for all
  *       memory pools or the {@link #isUsageThresholdExceeded} method
  *       for those memory pools that support a usage threshold.
- *       Below is example code that has a thread delicated for
+ *       Below is example code that has a thread dedicated for
  *       task distribution and processing.  At every interval,
  *       it will determine if it should receive and process new tasks based
  *       on its memory usage.  If the memory usage exceeds its usage threshold,
@@ -191,7 +191,7 @@
  * <hr>
  *       The above example does not differentiate the case where
  *       the memory usage has temporarily dropped below the usage threshold
- *       from the case where the memory usage remains above the threshould
+ *       from the case where the memory usage remains above the threshold
  *       between two iterations.  The usage threshold count returned by
  *       the {@link #getUsageThresholdCount} method
  *       can be used to determine
--- a/jdk/src/share/classes/java/lang/management/MemoryUsage.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/management/MemoryUsage.java	Wed Jul 05 19:21:26 2017 +0200
@@ -79,7 +79,7 @@
  * </table>
  *
  * Below is a picture showing an example of a memory pool:
- * <p>
+ *
  * <pre>
  *        +----------------------------------------------+
  *        +////////////////           |                  +
@@ -250,7 +250,7 @@
      * Returns a <tt>MemoryUsage</tt> object represented by the
      * given <tt>CompositeData</tt>. The given <tt>CompositeData</tt>
      * must contain the following attributes:
-     * <p>
+     *
      * <blockquote>
      * <table border summary="The attributes and the types the given CompositeData contains">
      * <tr>
--- a/jdk/src/share/classes/java/lang/management/ThreadInfo.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/management/ThreadInfo.java	Wed Jul 05 19:21:26 2017 +0200
@@ -492,7 +492,7 @@
      * @return the thread ID of the owner thread of the object
      * this thread is blocked on;
      * <tt>-1</tt> if this thread is not blocked
-     * or if the object lis not owned by any thread.
+     * or if the object is not owned by any thread.
      *
      * @see #getLockInfo
      */
--- a/jdk/src/share/classes/java/lang/management/ThreadMXBean.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/management/ThreadMXBean.java	Wed Jul 05 19:21:26 2017 +0200
@@ -646,7 +646,7 @@
      *         exists and the caller does not have
      *         ManagementPermission("monitor").
      * @throws java.lang.UnsupportedOperationException if the Java virtual
-     * machine does not support monitoriing of ownable synchronizer usage.
+     * machine does not support monitoring of ownable synchronizer usage.
      *
      * @see #isSynchronizerUsageSupported
      * @see #findMonitorDeadlockedThreads
--- a/jdk/src/share/classes/java/lang/management/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/management/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -82,7 +82,7 @@
 <b>1. Direct access to an MXBean interface</b>
 <p>
 <ul>
-<li>Get an MXBean instance locally in the running Java virtual machine:<p>
+<li>Get an MXBean instance locally in the running Java virtual machine:
 <pre>
    RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
 
@@ -103,7 +103,7 @@
 <p>
 </li>
 <li>Construct an MXBean proxy instance that forwards the
-    method calls to a given MBeanServer:<p>
+    method calls to a given MBeanServer:
 <pre>
    MBeanServerConnection mbs;
 
--- a/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java	Wed Jul 05 19:21:26 2017 +0200
@@ -27,6 +27,15 @@
 
 import java.lang.annotation.Annotation;
 import java.lang.annotation.AnnotationFormatError;
+import java.lang.annotation.Repeatable;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import sun.reflect.annotation.AnnotationSupport;
+import sun.reflect.annotation.AnnotationType;
 
 /**
  * Represents an annotated element of the program currently running in this
@@ -222,6 +231,18 @@
      * The caller of this method is free to modify the returned array; it will
      * have no effect on the arrays returned to other callers.
      *
+     * @implSpec The default implementation first calls {@link
+     * #getDeclaredAnnotationsByType(Class)} passing {@code
+     * annotationClass} as the argument. If the returned array has
+     * length greater than zero, the array is returned. If the returned
+     * array is zero-length and this {@code AnnotatedElement} is a
+     * class and the argument type is an inheritable annotation type,
+     * and the superclass of this {@code AnnotatedElement} is non-null,
+     * then the returned result is the result of calling {@link
+     * #getAnnotationsByType(Class)} on the superclass with {@code
+     * annotationClass} as the argument. Otherwise, a zero-length
+     * array is returned.
+     *
      * @param <T> the type of the annotation to query for and return if present
      * @param annotationClass the Class object corresponding to the
      *        annotation type
@@ -230,7 +251,29 @@
      * @throws NullPointerException if the given annotation class is null
      * @since 1.8
      */
-    <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass);
+    default <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
+         /*
+          * Definition of associated: directly or indirectly present OR
+          * neither directly nor indirectly present AND the element is
+          * a Class, the annotation type is inheritable, and the
+          * annotation type is associated with the superclass of the
+          * element.
+          */
+         T[] result = getDeclaredAnnotationsByType(annotationClass);
+
+         if (result.length == 0 && // Neither directly nor indirectly present
+             this instanceof Class && // the element is a class
+             AnnotationType.getInstance(annotationClass).isInherited()) { // Inheritable
+             Class<?> superClass = ((Class<?>) this).getSuperclass();
+             if (superClass != null) {
+                 // Determine if the annotation is associated with the
+                 // superclass
+                 result = superClass.getAnnotationsByType(annotationClass);
+             }
+         }
+
+         return result;
+     }
 
     /**
      * Returns this element's annotation for the specified type if
@@ -239,6 +282,11 @@
      * This method ignores inherited annotations. (Returns null if no
      * annotations are directly present on this element.)
      *
+     * @implSpec The default implementation first performs a null check
+     * and then loops over the results of {@link
+     * #getDeclaredAnnotations} returning the first annotation whose
+     * annotation type matches the argument type.
+     *
      * @param <T> the type of the annotation to query for and return if directly present
      * @param annotationClass the Class object corresponding to the
      *        annotation type
@@ -247,7 +295,18 @@
      * @throws NullPointerException if the given annotation class is null
      * @since 1.8
      */
-    <T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass);
+    default <T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass) {
+         Objects.requireNonNull(annotationClass);
+         // Loop over all directly-present annotations looking for a matching one
+         for (Annotation annotation : getDeclaredAnnotations()) {
+             if (annotationClass.equals(annotation.annotationType())) {
+                 // More robust to do a dynamic cast at runtime instead
+                 // of compile-time only.
+                 return annotationClass.cast(annotation);
+             }
+         }
+         return null;
+     }
 
     /**
      * Returns this element's annotation(s) for the specified type if
@@ -268,6 +327,22 @@
      * The caller of this method is free to modify the returned array; it will
      * have no effect on the arrays returned to other callers.
      *
+     * @implSpec The default implementation may call {@link
+     * #getDeclaredAnnotation(Class)} one or more times to find a
+     * directly present annotation and, if the annotation type is
+     * repeatable, to find a container annotation. If annotations of
+     * the annotation type {@code annotationClass} are found to be both
+     * directly and indirectly present, then {@link
+     * #getDeclaredAnnotations()} will get called to determine the
+     * order of the elements in the returned array.
+     *
+     * <p>Alternatively, the default implementation may call {@link
+     * #getDeclaredAnnotations()} a single time and the returned array
+     * examined for both directly and indirectly present
+     * annotations. The results of calling {@link
+     * #getDeclaredAnnotations()} are assumed to be consistent with the
+     * results of calling {@link #getDeclaredAnnotation(Class)}.
+     *
      * @param <T> the type of the annotation to query for and return
      * if directly or indirectly present
      * @param annotationClass the Class object corresponding to the
@@ -277,7 +352,16 @@
      * @throws NullPointerException if the given annotation class is null
      * @since 1.8
      */
-    <T extends Annotation> T[] getDeclaredAnnotationsByType(Class<T> annotationClass);
+    default <T extends Annotation> T[] getDeclaredAnnotationsByType(Class<T> annotationClass) {
+        Objects.requireNonNull(annotationClass);
+        return AnnotationSupport.
+            getDirectlyAndIndirectlyPresent(Arrays.stream(getDeclaredAnnotations()).
+                                            collect(Collectors.toMap(Annotation::annotationType,
+                                                                     Function.identity(),
+                                                                     ((first,second) -> first),
+                                                                     LinkedHashMap::new)),
+                                            annotationClass);
+    }
 
     /**
      * Returns annotations that are <em>directly present</em> on this element.
--- a/jdk/src/share/classes/java/lang/reflect/Constructor.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java	Wed Jul 05 19:21:26 2017 +0200
@@ -28,6 +28,8 @@
 import sun.reflect.CallerSensitive;
 import sun.reflect.ConstructorAccessor;
 import sun.reflect.Reflection;
+import sun.reflect.annotation.TypeAnnotation;
+import sun.reflect.annotation.TypeAnnotationParser;
 import sun.reflect.generics.repository.ConstructorRepository;
 import sun.reflect.generics.factory.CoreReflectionFactory;
 import sun.reflect.generics.factory.GenericsFactory;
@@ -534,4 +536,22 @@
     public AnnotatedType getAnnotatedReturnType() {
         return getAnnotatedReturnType0(getDeclaringClass());
     }
+
+    /**
+     * {@inheritDoc}
+     * @since 1.8
+     */
+    @Override
+    public AnnotatedType getAnnotatedReceiverType() {
+        if (getDeclaringClass().getEnclosingClass() == null)
+            return super.getAnnotatedReceiverType();
+
+        return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
+                sun.misc.SharedSecrets.getJavaLangAccess().
+                        getConstantPool(getDeclaringClass()),
+                this,
+                getDeclaringClass(),
+                getDeclaringClass().getEnclosingClass(),
+                TypeAnnotation.TypeAnnotationTarget.METHOD_RECEIVER);
+    }
 }
--- a/jdk/src/share/classes/java/lang/reflect/Executable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Executable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -383,7 +383,7 @@
     private transient volatile Parameter[] parameters;
 
     private native Parameter[] getParameters0();
-    private native byte[] getTypeAnnotationBytes0();
+    native byte[] getTypeAnnotationBytes0();
 
     // Needed by reflectaccess
     byte[] getTypeAnnotationBytes() {
@@ -527,7 +527,7 @@
     public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
         Objects.requireNonNull(annotationClass);
 
-        return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass);
+        return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass);
     }
 
     /**
--- a/jdk/src/share/classes/java/lang/reflect/Field.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Field.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1123,7 +1123,7 @@
     public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
         Objects.requireNonNull(annotationClass);
 
-        return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass);
+        return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass);
     }
 
     /**
--- a/jdk/src/share/classes/java/lang/reflect/Parameter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Parameter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -295,7 +295,7 @@
     public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
         Objects.requireNonNull(annotationClass);
 
-        return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass);
+        return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass);
     }
 
     /**
--- a/jdk/src/share/classes/java/lang/reflect/ReflectPermission.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/ReflectPermission.java	Wed Jul 05 19:21:26 2017 +0200
@@ -31,7 +31,6 @@
  * The following table
  * provides a summary description of what the permission allows,
  * and discusses the risks of granting code the permission.
- * <P>
  *
  * <table border=1 cellpadding=5 summary="Table shows permission target name, what the permission allows, and associated risks">
  * <tr>
--- a/jdk/src/share/classes/java/math/BigInteger.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/math/BigInteger.java	Wed Jul 05 19:21:26 2017 +0200
@@ -97,6 +97,21 @@
  * {@code NullPointerException} when passed
  * a null object reference for any input parameter.
  *
+ * BigInteger must support values in the range
+ * -2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive) to
+ * +2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive)
+ * and may support values outside of that range.
+ *
+ * The range of probable prime values is limited and may be less than
+ * the full supported positive range of {@code BigInteger}.
+ * The range must be at least 1 to 2<sup>500000000</sup>.
+ *
+ * @implNote
+ * BigInteger constructors and operations throw {@code ArithmeticException} when
+ * the result is out of the supported range of
+ * -2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive) to
+ * +2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive).
+ *
  * @see     BigDecimal
  * @author  Josh Bloch
  * @author  Michael McCloskey
@@ -183,6 +198,18 @@
     final static long LONG_MASK = 0xffffffffL;
 
     /**
+     * This constant limits {@code mag.length} of BigIntegers to the supported
+     * range.
+     */
+    private static final int MAX_MAG_LENGTH = Integer.MAX_VALUE / Integer.SIZE + 1; // (1 << 26)
+
+    /**
+     * Bit lengths larger than this constant can cause overflow in searchLen
+     * calculation and in BitSieve.singleSearch method.
+     */
+    private static final  int PRIME_SEARCH_BIT_LENGTH_LIMIT = 500000000;
+
+    /**
      * The threshold value for using Karatsuba multiplication.  If the number
      * of ints in both mag arrays are greater than this number, then
      * Karatsuba multiplication will be used.   This value is found
@@ -256,6 +283,9 @@
             mag = stripLeadingZeroBytes(val);
             signum = (mag.length == 0 ? 0 : 1);
         }
+        if (mag.length >= MAX_MAG_LENGTH) {
+            checkRange();
+        }
     }
 
     /**
@@ -275,6 +305,9 @@
             mag = trustedStripLeadingZeroInts(val);
             signum = (mag.length == 0 ? 0 : 1);
         }
+        if (mag.length >= MAX_MAG_LENGTH) {
+            checkRange();
+        }
     }
 
     /**
@@ -306,6 +339,9 @@
                 throw(new NumberFormatException("signum-magnitude mismatch"));
             this.signum = signum;
         }
+        if (mag.length >= MAX_MAG_LENGTH) {
+            checkRange();
+        }
     }
 
     /**
@@ -327,6 +363,9 @@
                 throw(new NumberFormatException("signum-magnitude mismatch"));
             this.signum = signum;
         }
+        if (mag.length >= MAX_MAG_LENGTH) {
+            checkRange();
+        }
     }
 
     /**
@@ -359,17 +398,20 @@
         int sign = 1;
         int index1 = val.lastIndexOf('-');
         int index2 = val.lastIndexOf('+');
-        if ((index1 + index2) <= -1) {
-            // No leading sign character or at most one leading sign character
-            if (index1 == 0 || index2 == 0) {
-                cursor = 1;
-                if (len == 1)
-                    throw new NumberFormatException("Zero length BigInteger");
+        if (index1 >= 0) {
+            if (index1 != 0 || index2 >= 0) {
+                throw new NumberFormatException("Illegal embedded sign character");
             }
-            if (index1 == 0)
-                sign = -1;
-        } else
-            throw new NumberFormatException("Illegal embedded sign character");
+            sign = -1;
+            cursor = 1;
+        } else if (index2 >= 0) {
+            if (index2 != 0) {
+                throw new NumberFormatException("Illegal embedded sign character");
+            }
+            cursor = 1;
+        }
+        if (cursor == len)
+            throw new NumberFormatException("Zero length BigInteger");
 
         // Skip leading zeros and compute number of digits in magnitude
         while (cursor < len &&
@@ -388,8 +430,11 @@
 
         // Pre-allocate array of expected size. May be too large but can
         // never be too small. Typically exact.
-        int numBits = (int)(((numDigits * bitsPerDigit[radix]) >>> 10) + 1);
-        int numWords = (numBits + 31) >>> 5;
+        long numBits = ((numDigits * bitsPerDigit[radix]) >>> 10) + 1;
+        if (numBits + 31 >= (1L << 32)) {
+            reportOverflow();
+        }
+        int numWords = (int) (numBits + 31) >>> 5;
         int[] magnitude = new int[numWords];
 
         // Process first (potentially short) digit group
@@ -413,6 +458,9 @@
         }
         // Required for cases where the array was overallocated.
         mag = trustedStripLeadingZeroInts(magnitude);
+        if (mag.length >= MAX_MAG_LENGTH) {
+            checkRange();
+        }
     }
 
     /*
@@ -439,8 +487,11 @@
         if (len < 10) {
             numWords = 1;
         } else {
-            int numBits = (int)(((numDigits * bitsPerDigit[10]) >>> 10) + 1);
-            numWords = (numBits + 31) >>> 5;
+            long numBits = ((numDigits * bitsPerDigit[10]) >>> 10) + 1;
+            if (numBits + 31 >= (1L << 32)) {
+                reportOverflow();
+            }
+            numWords = (int) (numBits + 31) >>> 5;
         }
         int[] magnitude = new int[numWords];
 
@@ -456,6 +507,9 @@
             destructiveMulAdd(magnitude, intRadix[10], groupVal);
         }
         mag = trustedStripLeadingZeroInts(magnitude);
+        if (mag.length >= MAX_MAG_LENGTH) {
+            checkRange();
+        }
     }
 
     // Create an integer with the digits between the two indexes
@@ -575,7 +629,7 @@
      *         this constructor is proportional to the value of this parameter.
      * @param  rnd source of random bits used to select candidates to be
      *         tested for primality.
-     * @throws ArithmeticException {@code bitLength < 2}.
+     * @throws ArithmeticException {@code bitLength < 2} or {@code bitLength} is too large.
      * @see    #bitLength()
      */
     public BigInteger(int bitLength, int certainty, Random rnd) {
@@ -607,7 +661,7 @@
      * @param  rnd source of random bits used to select candidates to be
      *         tested for primality.
      * @return a BigInteger of {@code bitLength} bits that is probably prime
-     * @throws ArithmeticException {@code bitLength < 2}.
+     * @throws ArithmeticException {@code bitLength < 2} or {@code bitLength} is too large.
      * @see    #bitLength()
      * @since 1.4
      */
@@ -677,7 +731,7 @@
         p.mag[p.mag.length-1] &= 0xfffffffe;
 
         // Use a sieve length likely to contain the next prime number
-        int searchLen = (bitLength / 20) * 64;
+        int searchLen = getPrimeSearchLen(bitLength);
         BitSieve searchSieve = new BitSieve(p, searchLen);
         BigInteger candidate = searchSieve.retrieve(p, certainty, rnd);
 
@@ -701,7 +755,7 @@
     *
     * @return the first integer greater than this {@code BigInteger} that
     *         is probably prime.
-    * @throws ArithmeticException {@code this < 0}.
+    * @throws ArithmeticException {@code this < 0} or {@code this} is too large.
     * @since 1.5
     */
     public BigInteger nextProbablePrime() {
@@ -750,7 +804,7 @@
             result = result.subtract(ONE);
 
         // Looking for the next large prime
-        int searchLen = (result.bitLength() / 20) * 64;
+        int searchLen = getPrimeSearchLen(result.bitLength());
 
         while (true) {
            BitSieve searchSieve = new BitSieve(result, searchLen);
@@ -762,6 +816,13 @@
         }
     }
 
+    private static int getPrimeSearchLen(int bitLength) {
+        if (bitLength > PRIME_SEARCH_BIT_LENGTH_LIMIT + 1) {
+            throw new ArithmeticException("Prime search implementation restriction on bitLength");
+        }
+        return bitLength / 20 * 64;
+    }
+
     /**
      * Returns {@code true} if this BigInteger is probably prime,
      * {@code false} if it's definitely composite.
@@ -965,6 +1026,9 @@
     BigInteger(int[] magnitude, int signum) {
         this.signum = (magnitude.length == 0 ? 0 : signum);
         this.mag = magnitude;
+        if (mag.length >= MAX_MAG_LENGTH) {
+            checkRange();
+        }
     }
 
     /**
@@ -974,6 +1038,25 @@
     private BigInteger(byte[] magnitude, int signum) {
         this.signum = (magnitude.length == 0 ? 0 : signum);
         this.mag = stripLeadingZeroBytes(magnitude);
+        if (mag.length >= MAX_MAG_LENGTH) {
+            checkRange();
+        }
+    }
+
+    /**
+     * Throws an {@code ArithmeticException} if the {@code BigInteger} would be
+     * out of the supported range.
+     *
+     * @throws ArithmeticException if {@code this} exceeds the supported range.
+     */
+    private void checkRange() {
+        if (mag.length > MAX_MAG_LENGTH || mag.length == MAX_MAG_LENGTH && mag[0] < 0) {
+            reportOverflow();
+        }
+    }
+
+    private static void reportOverflow() {
+        throw new ArithmeticException("BigInteger would overflow supported range");
     }
 
     //Static Factory Methods
@@ -2073,6 +2156,10 @@
         // The remaining part can then be exponentiated faster.  The
         // powers of two will be multiplied back at the end.
         int powersOfTwo = partToSquare.getLowestSetBit();
+        long bitsToShift = (long)powersOfTwo * exponent;
+        if (bitsToShift > Integer.MAX_VALUE) {
+            reportOverflow();
+        }
 
         int remainingBits;
 
@@ -2126,11 +2213,10 @@
 
             // Multiply back the powers of two (quickly, by shifting left)
             if (powersOfTwo > 0) {
-                int bitsToShift = powersOfTwo*exponent;
                 if (bitsToShift + scaleFactor <= 62) { // Fits in long?
                     return valueOf((result << bitsToShift) * newSign);
                 } else {
-                    return valueOf(result*newSign).shiftLeft(bitsToShift);
+                    return valueOf(result*newSign).shiftLeft((int) bitsToShift);
                 }
             }
             else {
@@ -2375,8 +2461,17 @@
             BigInteger y1 = m2.modInverse(m1);
             BigInteger y2 = m1.modInverse(m2);
 
-            result = a1.multiply(m2).multiply(y1).add
-                     (a2.multiply(m1).multiply(y2)).mod(m);
+            if (m.mag.length < MAX_MAG_LENGTH / 2) {
+                result = a1.multiply(m2).multiply(y1).add(a2.multiply(m1).multiply(y2)).mod(m);
+            } else {
+                MutableBigInteger t1 = new MutableBigInteger();
+                new MutableBigInteger(a1.multiply(m2)).multiply(new MutableBigInteger(y1), t1);
+                MutableBigInteger t2 = new MutableBigInteger();
+                new MutableBigInteger(a2.multiply(m1)).multiply(new MutableBigInteger(y2), t2);
+                t1.add(t2);
+                MutableBigInteger q = new MutableBigInteger();
+                result = t1.divide(new MutableBigInteger(m), q).toBigInteger();
+            }
         }
 
         return (invertResult ? result.modInverse(m) : result);
@@ -2797,27 +2892,31 @@
      *
      * @param  n shift distance, in bits.
      * @return {@code this << n}
-     * @throws ArithmeticException if the shift distance is {@code
-     *         Integer.MIN_VALUE}.
      * @see #shiftRight
      */
     public BigInteger shiftLeft(int n) {
         if (signum == 0)
             return ZERO;
-        if (n == 0)
+        if (n > 0) {
+            return new BigInteger(shiftLeft(mag, n), signum);
+        } else if (n == 0) {
             return this;
-        if (n < 0) {
-            if (n == Integer.MIN_VALUE) {
-                throw new ArithmeticException("Shift distance of Integer.MIN_VALUE not supported.");
-            } else {
-                return shiftRight(-n);
-            }
+        } else {
+            // Possible int overflow in (-n) is not a trouble,
+            // because shiftRightImpl considers its argument unsigned
+            return shiftRightImpl(-n);
         }
-        int[] newMag = shiftLeft(mag, n);
-
-        return new BigInteger(newMag, signum);
     }
 
+    /**
+     * Returns a magnitude array whose value is {@code (mag << n)}.
+     * The shift distance, {@code n}, is considered unnsigned.
+     * (Computes <tt>this * 2<sup>n</sup></tt>.)
+     *
+     * @param mag magnitude, the most-significant int ({@code mag[0]}) must be non-zero.
+     * @param  n unsigned shift distance, in bits.
+     * @return {@code mag << n}
+     */
     private static int[] shiftLeft(int[] mag, int n) {
         int nInts = n >>> 5;
         int nBits = n & 0x1f;
@@ -2853,21 +2952,31 @@
      *
      * @param  n shift distance, in bits.
      * @return {@code this >> n}
-     * @throws ArithmeticException if the shift distance is {@code
-     *         Integer.MIN_VALUE}.
      * @see #shiftLeft
      */
     public BigInteger shiftRight(int n) {
-        if (n == 0)
+        if (signum == 0)
+            return ZERO;
+        if (n > 0) {
+            return shiftRightImpl(n);
+        } else if (n == 0) {
             return this;
-        if (n < 0) {
-            if (n == Integer.MIN_VALUE) {
-                throw new ArithmeticException("Shift distance of Integer.MIN_VALUE not supported.");
-            } else {
-                return shiftLeft(-n);
-            }
+        } else {
+            // Possible int overflow in {@code -n} is not a trouble,
+            // because shiftLeft considers its argument unsigned
+            return new BigInteger(shiftLeft(mag, -n), signum);
         }
-
+    }
+
+    /**
+     * Returns a BigInteger whose value is {@code (this >> n)}. The shift
+     * distance, {@code n}, is considered unsigned.
+     * (Computes <tt>floor(this * 2<sup>-n</sup>)</tt>.)
+     *
+     * @param  n unsigned shift distance, in bits.
+     * @return {@code this >> n}
+     */
+    private BigInteger shiftRightImpl(int n) {
         int nInts = n >>> 5;
         int nBits = n & 0x1f;
         int magLen = mag.length;
@@ -3899,7 +4008,7 @@
             ;
 
         int extraByte = (k == byteLength) ? 1 : 0;
-        int intLength = ((byteLength - keep + extraByte) + 3)/4;
+        int intLength = ((byteLength - keep + extraByte) + 3) >>> 2;
         int result[] = new int[intLength];
 
         /* Copy one's complement of input into output, leaving extra
@@ -4135,7 +4244,8 @@
                 message = "BigInteger: Signum not present in stream";
             throw new java.io.StreamCorruptedException(message);
         }
-        if ((magnitude.length == 0) != (sign == 0)) {
+        int[] mag = stripLeadingZeroBytes(magnitude);
+        if ((mag.length == 0) != (sign == 0)) {
             String message = "BigInteger: signum-magnitude mismatch";
             if (fields.defaulted("magnitude"))
                 message = "BigInteger: Magnitude not present in stream";
@@ -4146,7 +4256,14 @@
         UnsafeHolder.putSign(this, sign);
 
         // Calculate mag field from magnitude and discard magnitude
-        UnsafeHolder.putMag(this, stripLeadingZeroBytes(magnitude));
+        UnsafeHolder.putMag(this, mag);
+        if (mag.length >= MAX_MAG_LENGTH) {
+            try {
+                checkRange();
+            } catch (ArithmeticException e) {
+                throw new java.io.StreamCorruptedException("BigInteger: Out of the supported range");
+            }
+        }
     }
 
     // Support for resetting final fields while deserializing
--- a/jdk/src/share/classes/java/math/MutableBigInteger.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/math/MutableBigInteger.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1257,14 +1257,14 @@
 
             int j = (s+m-1) / m;      // step 2a: j = ceil(s/m)
             int n = j * m;            // step 2b: block length in 32-bit units
-            int n32 = 32 * n;         // block length in bits
-            int sigma = Math.max(0, n32 - b.bitLength());   // step 3: sigma = max{T | (2^T)*B < beta^n}
+            long n32 = 32L * n;         // block length in bits
+            int sigma = (int) Math.max(0, n32 - b.bitLength());   // step 3: sigma = max{T | (2^T)*B < beta^n}
             MutableBigInteger bShifted = new MutableBigInteger(b);
             bShifted.safeLeftShift(sigma);   // step 4a: shift b so its length is a multiple of n
             safeLeftShift(sigma);     // step 4b: shift this by the same amount
 
             // step 5: t is the number of blocks needed to accommodate this plus one additional bit
-            int t = (bitLength()+n32) / n32;
+            int t = (int) ((bitLength()+n32) / n32);
             if (t < 2) {
                 t = 2;
             }
@@ -1421,10 +1421,10 @@
     }
 
     /** @see BigInteger#bitLength() */
-    int bitLength() {
+    long bitLength() {
         if (intLen == 0)
             return 0;
-        return intLen*32 - Integer.numberOfLeadingZeros(value[offset]);
+        return intLen*32L - Integer.numberOfLeadingZeros(value[offset]);
     }
 
     /**
--- a/jdk/src/share/classes/java/net/Authenticator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/Authenticator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -358,7 +358,7 @@
      * will be based on a URL, but in a future JDK it could be, for
      * example, "SOCKS" for a password-protected SOCKS5 firewall.
      *
-     * @return the protcol, optionally followed by "/version", where
+     * @return the protocol, optionally followed by "/version", where
      *          version is a version number.
      *
      * @see java.net.URL#getProtocol()
--- a/jdk/src/share/classes/java/net/CookieManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/CookieManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -143,7 +143,7 @@
      *
      * @param store     a {@code CookieStore} to be used by cookie manager.
      *                  if {@code null}, cookie manager will use a default one,
-     *                  which is an in-memory CookieStore implmentation.
+     *                  which is an in-memory CookieStore implementation.
      * @param cookiePolicy      a {@code CookiePolicy} instance
      *                          to be used by cookie manager as policy callback.
      *                          if {@code null}, ACCEPT_ORIGINAL_SERVER will
--- a/jdk/src/share/classes/java/net/CookieStore.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/CookieStore.java	Wed Jul 05 19:21:26 2017 +0200
@@ -48,7 +48,7 @@
      * <p>A cookie to store may or may not be associated with an URI. If it
      * is not associated with an URI, the cookie's domain and path attribute
      * will indicate where it comes from. If it is associated with an URI and
-     * its domain and path attribute are not speicifed, given URI will indicate
+     * its domain and path attribute are not specified, given URI will indicate
      * where this cookie comes from.
      *
      * <p>If a cookie corresponding to the given URI already exists,
--- a/jdk/src/share/classes/java/net/DatagramSocket.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/DatagramSocket.java	Wed Jul 05 19:21:26 2017 +0200
@@ -196,7 +196,7 @@
      * socket address.
      * <p>
      * If, if the address is {@code null}, creates an unbound socket.
-     * <p>
+     *
      * <p>If there is a security manager,
      * its {@code checkListen} method is first called
      * with the port from the socket address
@@ -640,7 +640,7 @@
                 SecurityManager security = System.getSecurityManager();
 
                 // The reason you want to synchronize on datagram packet
-                // is because you dont want an applet to change the address
+                // is because you don't want an applet to change the address
                 // while you are trying to send the packet for example
                 // after the security check but before the send.
                 if (security != null) {
@@ -1109,7 +1109,7 @@
      * represent the value of the TOS octet in IP packets sent by
      * the socket.
      * RFC 1349 defines the TOS values as follows:
-     * <p>
+     *
      * <UL>
      * <LI><CODE>IPTOS_LOWCOST (0x02)</CODE></LI>
      * <LI><CODE>IPTOS_RELIABILITY (0x04)</CODE></LI>
--- a/jdk/src/share/classes/java/net/HttpCookie.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/HttpCookie.java	Wed Jul 05 19:21:26 2017 +0200
@@ -761,7 +761,7 @@
     // from RFC 2068, token special case characters
     //
     // private static final String tspecials = "()<>@,;:\\\"/[]?={} \t";
-    private static final String tspecials = ",;";
+    private static final String tspecials = ",; ";  // deliberately includes space
 
     /*
      * Tests a string and returns true if the string counts as a token.
--- a/jdk/src/share/classes/java/net/Inet6Address.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/Inet6Address.java	Wed Jul 05 19:21:26 2017 +0200
@@ -133,7 +133,7 @@
  *         representation. However, it will be converted into an IPv4
  *         address.</td></tr>
  * </table></blockquote>
- * <p>
+ *
  * <h4><A NAME="scoped">Textual representation of IPv6 scoped addresses</a></h4>
  *
  * <p> The textual representation of IPv6 addresses as described above can be
@@ -150,11 +150,11 @@
  *
  * <p> The general format for specifying the <i>scope_id</i> is the following:
  *
- * <p><blockquote><i>IPv6-address</i>%<i>scope_id</i></blockquote>
+ * <blockquote><i>IPv6-address</i>%<i>scope_id</i></blockquote>
  * <p> The IPv6-address is a literal IPv6 address as described above.
  * The <i>scope_id</i> refers to an interface on the local system, and it can be
  * specified in two ways.
- * <p><ol><li><i>As a numeric identifier.</i> This must be a positive integer
+ * <ol><li><i>As a numeric identifier.</i> This must be a positive integer
  * that identifies the particular interface and scope as understood by the
  * system. Usually, the numeric values can be determined through administration
  * tools on the system. Each interface may have multiple values, one for each
--- a/jdk/src/share/classes/java/net/InetSocketAddress.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/InetSocketAddress.java	Wed Jul 05 19:21:26 2017 +0200
@@ -196,7 +196,7 @@
      * If that attempt fails, the address will be flagged as <I>unresolved</I>.
      * <p>
      * If there is a security manager, its {@code checkConnect} method
-     * is called with the host name as its argument to check the permissiom
+     * is called with the host name as its argument to check the permission
      * to resolve it. This could result in a SecurityException.
      * <P>
      * A valid port value is between 0 and 65535.
--- a/jdk/src/share/classes/java/net/InterfaceAddress.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/InterfaceAddress.java	Wed Jul 05 19:21:26 2017 +0200
@@ -56,7 +56,7 @@
     }
 
     /**
-     * Returns an {@code InetAddress} for the brodcast address
+     * Returns an {@code InetAddress} for the broadcast address
      * for this InterfaceAddress.
      * <p>
      * Only IPv4 networks have broadcast address therefore, in the case
--- a/jdk/src/share/classes/java/net/JarURLConnection.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/JarURLConnection.java	Wed Jul 05 19:21:26 2017 +0200
@@ -82,7 +82,7 @@
  *
  * </dl>
  *
- * <p>{@code !/} is refered to as the <em>separator</em>.
+ * <p>{@code !/} is referred to as the <em>separator</em>.
  *
  * <p>When constructing a JAR url via {@code new URL(context, spec)},
  * the following rules apply:
@@ -223,7 +223,7 @@
      * for this connection.
      *
      * @exception IOException if getting the JAR file for this
-     * connection causes an IOException to be trown.
+     * connection causes an IOException to be thrown.
      *
      * @see #getJarFile
      */
@@ -240,7 +240,7 @@
      * the JAR URL for this connection points to a JAR file.
      *
      * @exception IOException if getting the JAR file for this
-     * connection causes an IOException to be trown.
+     * connection causes an IOException to be thrown.
      *
      * @see #getJarFile
      * @see #getJarEntry
--- a/jdk/src/share/classes/java/net/MulticastSocket.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/MulticastSocket.java	Wed Jul 05 19:21:26 2017 +0200
@@ -140,7 +140,7 @@
      * Create a MulticastSocket bound to the specified socket address.
      * <p>
      * Or, if the address is {@code null}, create an unbound socket.
-     * <p>
+     *
      * <p>If there is a security manager,
      * its {@code checkListen} method is first called
      * with the SocketAddress port as its argument to ensure the operation is allowed.
--- a/jdk/src/share/classes/java/net/NetPermission.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/NetPermission.java	Wed Jul 05 19:21:26 2017 +0200
@@ -46,7 +46,6 @@
  * The following table lists all the possible NetPermission target names,
  * and for each provides a description of what the permission allows
  * and a discussion of the risks of granting code the permission.
- * <P>
  *
  * <table border=1 cellpadding=5 summary="Permission target name, what the permission allows, and associated risks">
  * <tr>
--- a/jdk/src/share/classes/java/net/Proxy.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/Proxy.java	Wed Jul 05 19:21:26 2017 +0200
@@ -66,8 +66,8 @@
      * Used, for instance, to create sockets bypassing any other global
      * proxy settings (like SOCKS):
      * <P>
-     * {@code Socket s = new Socket(Proxy.NO_PROXY);}<br>
-     * <P>
+     * {@code Socket s = new Socket(Proxy.NO_PROXY);}
+     *
      */
     public final static Proxy NO_PROXY = new Proxy();
 
--- a/jdk/src/share/classes/java/net/ServerSocket.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/ServerSocket.java	Wed Jul 05 19:21:26 2017 +0200
@@ -610,7 +610,7 @@
     /**
      * Returns the binding state of the ServerSocket.
      *
-     * @return true if the ServerSocket succesfuly bound to an address
+     * @return true if the ServerSocket successfully bound to an address
      * @since 1.4
      */
     public boolean isBound() {
--- a/jdk/src/share/classes/java/net/Socket.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/Socket.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1230,13 +1230,13 @@
      * Generally, the window size can be modified at any time when a socket is
      * connected. However, if a receive window larger than 64K is required then
      * this must be requested <B>before</B> the socket is connected to the
-     * remote peer. There are two cases to be aware of:<p>
+     * remote peer. There are two cases to be aware of:
      * <ol>
      * <li>For sockets accepted from a ServerSocket, this must be done by calling
      * {@link ServerSocket#setReceiveBufferSize(int)} before the ServerSocket
      * is bound to a local address.<p></li>
      * <li>For client sockets, setReceiveBufferSize() must be called before
-     * connecting the socket to its remote peer.<p></li></ol>
+     * connecting the socket to its remote peer.</li></ol>
      * @param size the size to which to set the receive buffer
      * size. This value must be greater than 0.
      *
@@ -1329,7 +1329,7 @@
      * represent the value of the TOS octet in IP packets sent by
      * the socket.
      * RFC 1349 defines the TOS values as follows:
-     * <p>
+     *
      * <UL>
      * <LI><CODE>IPTOS_LOWCOST (0x02)</CODE></LI>
      * <LI><CODE>IPTOS_RELIABILITY (0x04)</CODE></LI>
--- a/jdk/src/share/classes/java/net/SocketOptions.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/SocketOptions.java	Wed Jul 05 19:21:26 2017 +0200
@@ -134,7 +134,7 @@
      * previously written data.
      *<P>
      * Valid for TCP only: SocketImpl.
-     * <P>
+     *
      * @see Socket#setTcpNoDelay
      * @see Socket#getTcpNoDelay
      */
@@ -155,7 +155,7 @@
      * This option <B>must</B> be specified in the constructor.
      * <P>
      * Valid for: SocketImpl, DatagramSocketImpl
-     * <P>
+     *
      * @see Socket#getLocalAddress
      * @see DatagramSocket#getLocalAddress
      */
@@ -186,7 +186,7 @@
      * want to use other than the system default.  Takes/returns an InetAddress.
      * <P>
      * Valid for Multicast: DatagramSocketImpl
-     * <P>
+     *
      * @see MulticastSocket#setInterface(InetAddress)
      * @see MulticastSocket#getInterface()
      */
--- a/jdk/src/share/classes/java/net/SocketPermission.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/SocketPermission.java	Wed Jul 05 19:21:26 2017 +0200
@@ -779,27 +779,27 @@
      * specified permission.
      * <P>
      * More specifically, this method first ensures that all of the following
-     * are true (and returns false if any of them are not):<p>
+     * are true (and returns false if any of them are not):
      * <ul>
-     * <li> <i>p</i> is an instanceof SocketPermission,<p>
+     * <li> <i>p</i> is an instanceof SocketPermission,
      * <li> <i>p</i>'s actions are a proper subset of this
-     * object's actions, and<p>
+     * object's actions, and
      * <li> <i>p</i>'s port range is included in this port range. Note:
-     * port range is ignored when p only contains the action, 'resolve'.<p>
+     * port range is ignored when p only contains the action, 'resolve'.
      * </ul>
      *
      * Then {@code implies} checks each of the following, in order,
-     * and for each returns true if the stated condition is true:<p>
+     * and for each returns true if the stated condition is true:
      * <ul>
      * <li> If this object was initialized with a single IP address and one of <i>p</i>'s
-     * IP addresses is equal to this object's IP address.<p>
+     * IP addresses is equal to this object's IP address.
      * <li>If this object is a wildcard domain (such as *.sun.com), and
      * <i>p</i>'s canonical name (the name without any preceding *)
      * ends with this object's canonical host name. For example, *.sun.com
-     * implies *.eng.sun.com..<p>
+     * implies *.eng.sun.com.
      * <li>If this object was not initialized with a single IP address, and one of this
-     * object's IP addresses equals one of <i>p</i>'s IP addresses.<p>
-     * <li>If this canonical name equals <i>p</i>'s canonical name.<p>
+     * object's IP addresses equals one of <i>p</i>'s IP addresses.
+     * <li>If this canonical name equals <i>p</i>'s canonical name.
      * </ul>
      *
      * If none of the above are true, {@code implies} returns false.
--- a/jdk/src/share/classes/java/net/SocksSocketImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/SocksSocketImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -437,7 +437,7 @@
             }
         }
 
-        // cmdIn & cmdOut were intialized during the privilegedConnect() call
+        // cmdIn & cmdOut were initialized during the privilegedConnect() call
         BufferedOutputStream out = new BufferedOutputStream(cmdOut, 512);
         InputStream in = cmdIn;
 
--- a/jdk/src/share/classes/java/net/StandardSocketOptions.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/StandardSocketOptions.java	Wed Jul 05 19:21:26 2017 +0200
@@ -257,7 +257,7 @@
      * represents the outgoing interface for multicast datagrams sent by the
      * datagram-oriented socket. For {@link StandardProtocolFamily#INET6 IPv6}
      * sockets then it is system dependent whether setting this option also
-     * sets the outgoing interface for multlicast datagrams sent to IPv4
+     * sets the outgoing interface for multicast datagrams sent to IPv4
      * addresses.
      *
      * <p> The initial/default value of this socket option may be {@code null}
--- a/jdk/src/share/classes/java/net/URI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/URI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -389,20 +389,20 @@
  * colon following a host name but no port (as in
  * {@code http://java.sun.com:}&nbsp;), and that does not encode characters
  * except those that must be quoted, the following identities also hold:
- * <p><pre>
+ * <pre>
  *     new URI(<i>u</i>.getScheme(),
  *             <i>u</i>.getSchemeSpecificPart(),
  *             <i>u</i>.getFragment())
  *     .equals(<i>u</i>)</pre>
  * in all cases,
- * <p><pre>
+ * <pre>
  *     new URI(<i>u</i>.getScheme(),
  *             <i>u</i>.getUserInfo(), <i>u</i>.getAuthority(),
  *             <i>u</i>.getPath(), <i>u</i>.getQuery(),
  *             <i>u</i>.getFragment())
  *     .equals(<i>u</i>)</pre>
  * if <i>u</i> is hierarchical, and
- * <p><pre>
+ * <pre>
  *     new URI(<i>u</i>.getScheme(),
  *             <i>u</i>.getUserInfo(), <i>u</i>.getHost(), <i>u</i>.getPort(),
  *             <i>u</i>.getPath(), <i>u</i>.getQuery(),
--- a/jdk/src/share/classes/java/net/URL.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/URL.java	Wed Jul 05 19:21:26 2017 +0200
@@ -465,7 +465,7 @@
      * Otherwise, the path is treated as a relative path and is appended to the
      * context path, as described in RFC2396. Also, in this case,
      * the path is canonicalized through the removal of directory
-     * changes made by occurences of &quot;..&quot; and &quot;.&quot;.
+     * changes made by occurrences of &quot;..&quot; and &quot;.&quot;.
      * <p>
      * For a more detailed description of URL parsing, refer to RFC2396.
      *
--- a/jdk/src/share/classes/java/net/URLClassLoader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/URLClassLoader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -25,21 +25,30 @@
 
 package java.net;
 
-import java.io.*;
-import java.util.*;
-import java.util.jar.Manifest;
-import java.util.jar.JarFile;
-import java.util.jar.Attributes;
-import java.util.jar.Attributes.Name;
+import java.io.Closeable;
+import java.io.File;
+import java.io.FilePermission;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.AccessControlContext;
+import java.security.AccessController;
 import java.security.CodeSigner;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-import java.security.AccessController;
-import java.security.AccessControlContext;
-import java.security.SecureClassLoader;
 import java.security.CodeSource;
 import java.security.Permission;
 import java.security.PermissionCollection;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedExceptionAction;
+import java.security.SecureClassLoader;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Objects;
+import java.util.Set;
+import java.util.WeakHashMap;
+import java.util.jar.Attributes;
+import java.util.jar.Attributes.Name;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
 import sun.misc.Resource;
 import sun.misc.URLClassPath;
 import sun.net.www.ParseUtil;
@@ -84,6 +93,7 @@
      * @exception  SecurityException  if a security manager exists and its
      *             {@code checkCreateClassLoader} method doesn't allow
      *             creation of a class loader.
+     * @exception  NullPointerException if {@code urls} is {@code null}.
      * @see SecurityManager#checkCreateClassLoader
      */
     public URLClassLoader(URL[] urls, ClassLoader parent) {
@@ -127,6 +137,7 @@
      * @exception  SecurityException  if a security manager exists and its
      *             {@code checkCreateClassLoader} method doesn't allow
      *             creation of a class loader.
+     * @exception  NullPointerException if {@code urls} is {@code null}.
      * @see SecurityManager#checkCreateClassLoader
      */
     public URLClassLoader(URL[] urls) {
@@ -169,6 +180,7 @@
      * @exception  SecurityException  if a security manager exists and its
      *             {@code checkCreateClassLoader} method doesn't allow
      *             creation of a class loader.
+     * @exception  NullPointerException if {@code urls} is {@code null}.
      * @see SecurityManager#checkCreateClassLoader
      */
     public URLClassLoader(URL[] urls, ClassLoader parent,
@@ -260,13 +272,13 @@
     * and errors are not caught. Calling close on an already closed
     * loader has no effect.
     * <p>
-    * @throws IOException if closing any file opened by this class loader
+    * @exception IOException if closing any file opened by this class loader
     * resulted in an IOException. Any such exceptions are caught internally.
     * If only one is caught, then it is re-thrown. If more than one exception
     * is caught, then the second and following exceptions are added
     * as suppressed exceptions of the first one caught, which is then re-thrown.
     *
-    * @throws SecurityException if a security manager is set, and it denies
+    * @exception SecurityException if a security manager is set, and it denies
     *   {@link RuntimePermission}{@code ("closeClassLoader")}
     *
     * @since 1.7
@@ -339,6 +351,7 @@
      * @return the resulting class
      * @exception ClassNotFoundException if the class could not be found,
      *            or if the loader is closed.
+     * @exception NullPointerException if {@code name} is {@code null}.
      */
     protected Class<?> findClass(final String name)
          throws ClassNotFoundException
@@ -621,6 +634,7 @@
      * If the protocol is not "file", then permission
      * to connect to and accept connections from the URL's host is granted.
      * @param codesource the codesource
+     * @exception NullPointerException if {@code codesource} is {@code null}.
      * @return the permissions granted to the codesource
      */
     protected PermissionCollection getPermissions(CodeSource codesource)
@@ -700,6 +714,7 @@
      *
      * @param urls the URLs to search for classes and resources
      * @param parent the parent class loader for delegation
+     * @exception  NullPointerException if {@code urls} is {@code null}.
      * @return the resulting class loader
      */
     public static URLClassLoader newInstance(final URL[] urls,
@@ -725,6 +740,7 @@
      * loading the class.
      *
      * @param urls the URLs to search for classes and resources
+     * @exception  NullPointerException if {@code urls} is {@code null}.
      * @return the resulting class loader
      */
     public static URLClassLoader newInstance(final URL[] urls) {
--- a/jdk/src/share/classes/java/net/URLConnection.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/URLConnection.java	Wed Jul 05 19:21:26 2017 +0200
@@ -45,7 +45,7 @@
  * application and a URL. Instances of this class can be used both to
  * read from and to write to the resource referenced by the URL. In
  * general, creating a connection to a URL is a multistep process:
- * <p>
+ *
  * <center><table border=2 summary="Describes the process of creating a connection to a URL: openConnection() and connect() over time.">
  * <tr><th>{@code openConnection()}</th>
  *     <th>{@code connect()}</th></tr>
@@ -371,7 +371,7 @@
      * java.net.SocketTimeoutException is raised. A timeout of zero is
      * interpreted as an infinite timeout.
 
-     * <p> Some non-standard implmentation of this method may ignore
+     * <p> Some non-standard implementation of this method may ignore
      * the specified timeout. To see the connect timeout set, please
      * call getConnectTimeout().
      *
@@ -1059,7 +1059,7 @@
      *
      * <p> NOTE: HTTP requires all request properties which can
      * legally have multiple instances with the same key
-     * to use a comma-seperated list syntax which enables multiple
+     * to use a comma-separated list syntax which enables multiple
      * properties to be appended into a single property.
      *
      * @param   key     the keyword by which the request is known
--- a/jdk/src/share/classes/java/net/URLDecoder.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/URLDecoder.java	Wed Jul 05 19:21:26 2017 +0200
@@ -43,7 +43,7 @@
  * as the start of a special escaped sequence.
  * <p>
  * The following rules are applied in the conversion:
- * <p>
+ *
  * <ul>
  * <li>The alphanumeric characters &quot;{@code a}&quot; through
  *     &quot;{@code z}&quot;, &quot;{@code A}&quot; through
@@ -116,7 +116,7 @@
      * "http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars">
      * World Wide Web Consortium Recommendation</a> states that
      * UTF-8 should be used. Not doing so may introduce
-     * incompatibilites.</em>
+     * incompatibilities.</em>
      *
      * @param s the {@code String} to decode
      * @param enc   The name of a supported
--- a/jdk/src/share/classes/java/net/URLEncoder.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/URLEncoder.java	Wed Jul 05 19:21:26 2017 +0200
@@ -49,7 +49,6 @@
  * <p>
  * When encoding a String, the following rules apply:
  *
- * <p>
  * <ul>
  * <li>The alphanumeric characters &quot;{@code a}&quot; through
  *     &quot;{@code z}&quot;, &quot;{@code A}&quot; through
@@ -186,7 +185,7 @@
      * "http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars">
      * World Wide Web Consortium Recommendation</a> states that
      * UTF-8 should be used. Not doing so may introduce
-     * incompatibilites.</em>
+     * incompatibilities.</em>
      *
      * @param   s   {@code String} to be translated.
      * @param   enc   The name of a supported
--- a/jdk/src/share/classes/java/net/URLPermission.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/URLPermission.java	Wed Jul 05 19:21:26 2017 +0200
@@ -45,7 +45,7 @@
  * </pre>
  * <i>scheme</i> will typically be http or https, but is not restricted by this
  * class.
- * <i>authority</i> is specified as:<p>
+ * <i>authority</i> is specified as:
  * <pre>
  *     authority = hostrange [ : portrange ]
  *     portrange = portnumber | -portnumber | portnumber-[portnumber] | *
@@ -223,7 +223,7 @@
      * Checks if this URLPermission implies the given permission.
      * Specifically, the following checks are done as if in the
      * following sequence:
-     * <p><ul>
+     * <ul>
      * <li>if 'p' is not an instance of URLPermission return false</li>
      * <li>if any of p's methods are not in this's method list, and if
      *     this's method list is not equal to "*", then return false.</li>
@@ -242,7 +242,7 @@
      * <li>otherwise, return false</li>
      * </ul>
      * <p>Some examples of how paths are matched are shown below:
-     * <p><table border>
+     * <table border>
      * <caption>Examples of Path Matching</caption>
      * <tr><th>this's path</th><th>p's path</th><th>match</th></tr>
      * <tr><td>/a/b</td><td>/a/b</td><td>yes</td></tr>
@@ -353,7 +353,7 @@
         return getActions().hashCode()
             + scheme.hashCode()
             + authority.hashCode()
-            + path == null ? 0 : path.hashCode();
+            + (path == null ? 0 : path.hashCode());
     }
 
 
--- a/jdk/src/share/classes/java/net/package-info.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/net/package-info.java	Wed Jul 05 19:21:26 2017 +0200
@@ -127,9 +127,9 @@
  *    resources, then convert it into a {@link java.net.URL} when it is time to
  *    access the resource. From that URL, you can either get the
  *    {@link java.net.URLConnection} for fine control, or get directly the
- *    InputStream.<p>
+ *    InputStream.
  * <p>Here is an example:</p>
- * <p><pre>
+ * <pre>
  * URI uri = new URI("http://java.sun.com/");
  * URL url = uri.toURL();
  * InputStream in = url.openStream();
@@ -147,7 +147,7 @@
  *    the {@code java.protocol.handler.pkgs} system property. For instance if
  *    it is set to {@code myapp.protocols}, then the URL code will try, in the
  *    case of http, first to load {@code myapp.protocols.http.Handler}, then,
- *    if this fails, {@code http.Handler} from the default location.<p>
+ *    if this fails, {@code http.Handler} from the default location.
  * <p>Note that the Handler class <b>has to</b> be a subclass of the abstract
  *    class {@link java.net.URLStreamHandler}.</p>
  * <h2>Additional Specification</h2>
--- a/jdk/src/share/classes/java/nio/X-Buffer.java.template	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/nio/X-Buffer.java.template	Wed Jul 05 19:21:26 2017 +0200
@@ -1129,7 +1129,7 @@
      *
      * <p> Two $type$ buffers are equal if, and only if,
      *
-     * <p><ol>
+     * <ol>
      *
      *   <li><p> They have the same element type,  </p></li>
      *
--- a/jdk/src/share/classes/java/nio/channels/AsynchronousChannelGroup.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/AsynchronousChannelGroup.java	Wed Jul 05 19:21:26 2017 +0200
@@ -199,7 +199,7 @@
      *
      * <p> The {@code initialSize} parameter may be used by the implementation
      * as a <em>hint</em> as to the initial number of tasks it may submit. For
-     * example, it may be used to indictae the initial number of threads that
+     * example, it may be used to indicate the initial number of threads that
      * wait on I/O events.
      *
      * <p> The executor is intended to be used exclusively by the resulting
--- a/jdk/src/share/classes/java/nio/channels/DatagramChannel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/DatagramChannel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -153,7 +153,7 @@
      * Opens a datagram channel.
      *
      * <p> The {@code family} parameter is used to specify the {@link
-     * ProtocolFamily}. If the datagram channel is to be used for IP multicasing
+     * ProtocolFamily}. If the datagram channel is to be used for IP multicasting
      * then this should correspond to the address type of the multicast groups
      * that this channel will join.
      *
--- a/jdk/src/share/classes/java/nio/channels/MembershipKey.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/MembershipKey.java	Wed Jul 05 19:21:26 2017 +0200
@@ -103,7 +103,7 @@
      * multicast datagrams from the given source address. If the given source
      * address is already blocked then this method has no effect.
      * After a source address is blocked it may still be possible to receive
-     * datagams from that source. This can arise when datagrams are waiting to
+     * datagrams from that source. This can arise when datagrams are waiting to
      * be received in the socket's receive buffer.
      *
      * @param   source
--- a/jdk/src/share/classes/java/nio/channels/package-info.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/nio/channels/package-info.java	Wed Jul 05 19:21:26 2017 +0200
@@ -269,7 +269,7 @@
  * own asynchronous channel groups or configure the {@code ExecutorService}
  * that will be used for the default group.
  *
- * <p> As with selectors, the implementatin of asynchronous channels can be
+ * <p> As with selectors, the implementation of asynchronous channels can be
  * replaced by "plugging in" an alternative definition or instance of the {@link
  * java.nio.channels.spi.AsynchronousChannelProvider} class defined in the
  * <tt>{@link java.nio.channels.spi}</tt> package.  It is not expected that many
--- a/jdk/src/share/classes/java/nio/charset/Charset.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/nio/charset/Charset.java	Wed Jul 05 19:21:26 2017 +0200
@@ -201,7 +201,7 @@
  *
  * </ul>
  *
- * In any case, byte order marks occuring after the first element of an
+ * In any case, byte order marks occurring after the first element of an
  * input sequence are not omitted since the same code is used to represent
  * <small>ZERO-WIDTH NON-BREAKING SPACE</small>.
  *
--- a/jdk/src/share/classes/java/nio/file/FileSystem.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/FileSystem.java	Wed Jul 05 19:21:26 2017 +0200
@@ -355,7 +355,7 @@
      *
      * <p> The following rules are used to interpret glob patterns:
      *
-     * <p> <ul>
+     * <ul>
      *   <li><p> The {@code *} character matches zero or more {@link Character
      *   characters} of a {@link Path#getName(int) name} component without
      *   crossing directory boundaries. </p></li>
--- a/jdk/src/share/classes/java/nio/file/attribute/UserDefinedFileAttributeView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/nio/file/attribute/UserDefinedFileAttributeView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -81,7 +81,7 @@
     /**
      * Returns a list containing the names of the user-defined attributes.
      *
-     * @return  An unmodifiable list continaing the names of the file's
+     * @return  An unmodifiable list containing the names of the file's
      *          user-defined
      *
      * @throws  IOException
@@ -179,7 +179,7 @@
      * <p> If an attribute of the given name already exists then its value is
      * replaced. If the attribute does not exist then it is created. If it
      * implementation specific if a test to check for the existence of the
-     * attribute and the creation of attribute are atomic with repect to other
+     * attribute and the creation of attribute are atomic with respect to other
      * file system activities.
      *
      * <p> Where there is insufficient space to store the attribute, or the
--- a/jdk/src/share/classes/java/rmi/MarshalledObject.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/rmi/MarshalledObject.java	Wed Jul 05 19:21:26 2017 +0200
@@ -135,7 +135,7 @@
     /**
      * Returns a new copy of the contained marshalledobject.  The internal
      * representation is deserialized with the semantics used for
-     * unmarshaling paramters for RMI calls.
+     * unmarshaling parameters for RMI calls.
      *
      * @return a copy of the contained object
      * @exception IOException if an <code>IOException</code> occurs while
@@ -182,7 +182,7 @@
      * in the serialized representation.
      *
      * @param obj the object to compare with this <code>MarshalledObject</code>
-     * @return <code>true</code> if the argument contains an equaivalent
+     * @return <code>true</code> if the argument contains an equivalent
      * serialized object; <code>false</code> otherwise
      * @since 1.2
      */
--- a/jdk/src/share/classes/java/rmi/RMISecurityManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/rmi/RMISecurityManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -28,35 +28,38 @@
 import java.security.*;
 
 /**
- * A subclass of {@link SecurityManager} used by RMI applications that use
- * downloaded code.  RMI's class loader will not download any classes from
- * remote locations if no security manager has been set.
- * <code>RMISecurityManager</code> does not apply to applets, which run
- * under the protection of their browser's security manager.
+ * {@code RMISecurityManager} implements a policy identical to the policy
+ * implemented by {@link SecurityManager}. RMI applications
+ * should use the {@code SecurityManager} class or another appropriate
+ * {@code SecurityManager} implementation instead of this class. RMI's class
+ * loader will download classes from remote locations only if a security
+ * manager has been set.
  *
- * <code>RMISecurityManager</code> implements a policy that
- * is no different than the policy implemented by {@link SecurityManager}.
- * Therefore an RMI application should use the <code>SecurityManager</code>
- * class or another application-specific <code>SecurityManager</code>
- * implementation instead of this class.
+ * @implNote
+ * <p>Applets typically run in a container that already has a security
+ * manager, so there is generally no need for applets to set a security
+ * manager. If you have a standalone application, you might need to set a
+ * {@code SecurityManager} in order to enable class downloading. This can be
+ * done by adding the following to your code. (It needs to be executed before
+ * RMI can download code from remote hosts, so it most likely needs to appear
+ * in the {@code main} method of your application.)
  *
- * <p>To use a <code>SecurityManager</code> in your application, add
- * the following statement to your code (it needs to be executed before RMI
- * can download code from remote hosts, so it most likely needs to appear
- * in the <code>main</code> method of your application):
- *
- * <pre>
- * System.setSecurityManager(new SecurityManager());
- * </pre>
+ * <pre>{@code
+ *    if (System.getSecurityManager() == null) {
+ *        System.setSecurityManager(new SecurityManager());
+ *    }
+ * }</pre>
  *
  * @author  Roger Riggs
  * @author  Peter Jones
  * @since JDK1.1
- **/
+ * @deprecated Use {@link SecurityManager} instead.
+ */
+@Deprecated
 public class RMISecurityManager extends SecurityManager {
 
     /**
-     * Constructs a new <code>RMISecurityManager</code>.
+     * Constructs a new {@code RMISecurityManager}.
      * @since JDK1.1
      */
     public RMISecurityManager() {
--- a/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/rmi/activation/ActivationGroup.java	Wed Jul 05 19:21:26 2017 +0200
@@ -74,7 +74,7 @@
  * <code>ActivationGroup</code> will override the system properties
  * with the properties requested when its
  * <code>ActivationGroupDesc</code> was created, and will set a
- * <code>java.rmi.RMISecurityManager</code> as the default system
+ * {@link SecurityManager} as the default system
  * security manager.  If your application requires specific properties
  * to be set when objects are activated in the group, the application
  * should create a special <code>Properties</code> object containing
@@ -84,7 +84,7 @@
  * <code>ActivationDesc</code>s (before the default
  * <code>ActivationGroupDesc</code> is created).  If your application
  * requires the use of a security manager other than
- * <code>java.rmi.RMISecurityManager</code>, in the
+ * {@link SecurityManager}, in the
  * ActivativationGroupDescriptor properties list you can set
  * <code>java.security.manager</code> property to the name of the security
  * manager you would like to install.
@@ -154,21 +154,21 @@
      * active). If the object does not call
      * <code>Activatable.inactive</code> when it deactivates, the
      * object will never be garbage collected since the group keeps
-     * strong references to the objects it creates. <p>
+     * strong references to the objects it creates.
      *
      * <p>The group's <code>inactiveObject</code> method unexports the
      * remote object from the RMI runtime so that the object can no
      * longer receive incoming RMI calls. An object will only be unexported
      * if the object has no pending or executing calls.
      * The subclass of <code>ActivationGroup</code> must override this
-     * method and unexport the object. <p>
+     * method and unexport the object.
      *
      * <p>After removing the object from the RMI runtime, the group
      * must inform its <code>ActivationMonitor</code> (via the monitor's
      * <code>inactiveObject</code> method) that the remote object is
      * not currently active so that the remote object will be
      * re-activated by the activator upon a subsequent activation
-     * request.<p>
+     * request.
      *
      * <p>This method simply informs the group's monitor that the object
      * is inactive.  It is up to the concrete subclass of ActivationGroup
@@ -235,7 +235,7 @@
      * <p>Note that if your application creates its own custom
      * activation group, a security manager must be set for that
      * group.  Otherwise objects cannot be activated in the group.
-     * <code>java.rmi.RMISecurityManager</code> is set by default.
+     * {@link SecurityManager} is set by default.
      *
      * <p>If a security manager is already set in the group VM, this
      * method first calls the security manager's
--- a/jdk/src/share/classes/java/rmi/dgc/VMID.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/rmi/dgc/VMID.java	Wed Jul 05 19:21:26 2017 +0200
@@ -67,7 +67,7 @@
      * conditions: a) the conditions for uniqueness for objects of
      * the class <code>java.rmi.server.UID</code> are satisfied, and b) an
      * address can be obtained for this host that is unique and constant
-     * for the lifetime of this object.  <p>
+     * for the lifetime of this object.
      */
     public VMID() {
         addr = randomBytes;
--- a/jdk/src/share/classes/java/rmi/server/RMISocketFactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/rmi/server/RMISocketFactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -41,7 +41,15 @@
  * (due to a firewall), the runtime uses HTTP with the explicit port
  * number of the server.  If the firewall does not allow this type of
  * communication, then HTTP to a cgi-bin script on the server is used
- * to POST the RMI call.
+ * to POST the RMI call. The HTTP tunneling mechanisms are disabled by
+ * default. This behavior is controlled by the {@code java.rmi.server.disableHttp}
+ * property, whose default value is {@code true}. Setting this property's
+ * value to {@code false} will enable the HTTP tunneling mechanisms.
+ *
+ * <p><strong>Deprecated: HTTP Tunneling.</strong> <em>The HTTP tunneling mechanisms
+ * described above, specifically HTTP with an explicit port and HTTP to a
+ * cgi-bin script, are deprecated. These HTTP tunneling mechanisms are
+ * subject to removal in a future release of the platform.</em>
  *
  * <p>The default socket factory implementation creates server sockets that
  * are bound to the wildcard address, which accepts requests from all network
--- a/jdk/src/share/classes/java/rmi/server/RemoteStub.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/rmi/server/RemoteStub.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -25,7 +25,8 @@
 package java.rmi.server;
 
 /**
- * The <code>RemoteStub</code> class is the common superclass to client
+ * The {@code RemoteStub} class is the common superclass of
+ * statically generated client
  * stubs and provides the framework to support a wide range of remote
  * reference semantics.  Stub objects are surrogates that support
  * exactly the same set of remote interfaces defined by the actual
@@ -33,21 +34,26 @@
  *
  * @author  Ann Wollrath
  * @since   JDK1.1
+ *
+ * @deprecated Statically generated stubs are deprecated, since
+ * stubs are generated dynamically. See {@link UnicastRemoteObject}
+ * for information about dynamic stub generation.
  */
+@Deprecated
 abstract public class RemoteStub extends RemoteObject {
 
     /** indicate compatibility with JDK 1.1.x version of class */
     private static final long serialVersionUID = -1585587260594494182L;
 
     /**
-     * Constructs a <code>RemoteStub</code>.
+     * Constructs a {@code RemoteStub}.
      */
     protected RemoteStub() {
         super();
     }
 
     /**
-     * Constructs a <code>RemoteStub</code>, with the specified remote
+     * Constructs a {@code RemoteStub} with the specified remote
      * reference.
      *
      * @param ref the remote reference
@@ -58,14 +64,17 @@
     }
 
     /**
-     * Sets the remote reference inside the remote stub.
+     * Throws {@link UnsupportedOperationException}.
      *
      * @param stub the remote stub
      * @param ref the remote reference
+     * @throws UnsupportedOperationException always
      * @since JDK1.1
-     * @deprecated no replacement.  The <code>setRef</code> method
-     * is not needed since <code>RemoteStub</code>s can be created with
-     * the <code>RemoteStub(RemoteRef)</code> constructor.
+     * @deprecated No replacement.  The {@code setRef} method
+     * was intended for setting the remote reference of a remote
+     * stub. This is unnecessary, since {@code RemoteStub}s can be created
+     * and initialized with a remote reference through use of
+     * the {@link #RemoteStub(RemoteRef)} constructor.
      */
     @Deprecated
     protected static void setRef(RemoteStub stub, RemoteRef ref) {
--- a/jdk/src/share/classes/java/rmi/server/ServerRef.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/rmi/server/ServerRef.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -33,7 +33,9 @@
  *
  * @author  Ann Wollrath
  * @since   JDK1.1
+ * @deprecated No replacement. This interface is unused and is obsolete.
  */
+@Deprecated
 public interface ServerRef extends RemoteRef {
 
     /** indicate compatibility with JDK 1.1.x version of class. */
--- a/jdk/src/share/classes/java/rmi/server/SocketSecurityException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/rmi/server/SocketSecurityException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -30,7 +30,9 @@
  *
  * @author  Ann Wollrath
  * @since   JDK1.1
- **/
+ * @deprecated This class is obsolete. Use {@link ExportException} instead.
+ */
+@Deprecated
 public class SocketSecurityException extends ExportException {
 
     /* indicate compatibility with JDK 1.1.x version of class */
--- a/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java	Wed Jul 05 19:21:26 2017 +0200
@@ -30,52 +30,88 @@
 
 /**
  * Used for exporting a remote object with JRMP and obtaining a stub
- * that communicates to the remote object.
+ * that communicates to the remote object. Stubs are either generated
+ * at runtime using dynamic proxy objects, or they are generated statically
+ * at build time, typically using the {@code rmic} tool.
+ *
+ * <p><strong>Deprecated: Static Stubs.</strong> <em>Support for statically
+ * generated stubs is deprecated. This includes the API in this class that
+ * requires the use of static stubs, as well as the runtime support for
+ * loading static stubs.  Generating stubs dynamically is preferred, using one
+ * of the five non-deprecated ways of exporting objects as listed below. Do
+ * not run {@code rmic} to generate static stub classes. It is unnecessary, and
+ * it is also deprecated.</em>
  *
- * <p>For the constructors and static <code>exportObject</code> methods
- * below, the stub for a remote object being exported is obtained as
- * follows:
+ * <p>There are six ways to export remote objects:
+ *
+ * <ol>
+ *
+ * <li>Subclassing {@code UnicastRemoteObject} and calling the
+ * {@link #UnicastRemoteObject()} constructor.
+ *
+ * <li>Subclassing {@code UnicastRemoteObject} and calling the
+ * {@link #UnicastRemoteObject(int) UnicastRemoteObject(port)} constructor.
+ *
+ * <li>Subclassing {@code UnicastRemoteObject} and calling the
+ * {@link #UnicastRemoteObject(int, RMIClientSocketFactory, RMIServerSocketFactory)
+ * UnicastRemoteObject(port, csf, ssf)} constructor.
  *
- * <p><ul>
+ * <li>Calling the
+ * {@link #exportObject(Remote) exportObject(Remote)} method.
+ * <strong>Deprecated.</strong>
+ *
+ * <li>Calling the
+ * {@link #exportObject(Remote, int) exportObject(Remote, port)} method.
+ *
+ * <li>Calling the
+ * {@link #exportObject(Remote, int, RMIClientSocketFactory, RMIServerSocketFactory)
+ * exportObject(Remote, port, csf, ssf)} method.
+ *
+ * </ol>
  *
- * <li>If the remote object is exported using the {@link
- * #exportObject(Remote) UnicastRemoteObject.exportObject(Remote)} method,
- * a stub class (typically pregenerated from the remote object's class
- * using the <code>rmic</code> tool) is loaded and an instance of that stub
- * class is constructed as follows.
+ * <p>The fourth technique, {@link #exportObject(Remote)},
+ * always uses statically generated stubs and is deprecated.
+ *
+ * <p>The other five techniques all use the following approach: if the
+ * {@code java.rmi.server.ignoreStubClasses} property is {@code true}
+ * (case insensitive) or if a static stub cannot be found, stubs are generated
+ * dynamically using {@link java.lang.reflect.Proxy Proxy} objects. Otherwise,
+ * static stubs are used.
+ *
+ * <p>The default value of the
+ * {@code java.rmi.server.ignoreStubClasses} property is {@code false}.
+ *
+ * <p>Statically generated stubs are typically pregenerated from the
+ * remote object's class using the {@code rmic} tool. A static stub is
+ * loaded and an instance of that stub class is constructed as described
+ * below.
+ *
  * <ul>
  *
- * <li>A "root class" is determined as follows:  if the remote object's
+ * <li>A "root class" is determined as follows: if the remote object's
  * class directly implements an interface that extends {@link Remote}, then
  * the remote object's class is the root class; otherwise, the root class is
  * the most derived superclass of the remote object's class that directly
- * implements an interface that extends <code>Remote</code>.
+ * implements an interface that extends {@code Remote}.
  *
  * <li>The name of the stub class to load is determined by concatenating
- * the binary name of the root class with the suffix <code>"_Stub"</code>.
+ * the binary name of the root class with the suffix {@code _Stub}.
  *
  * <li>The stub class is loaded by name using the class loader of the root
- * class.  The stub class must extend {@link RemoteStub} and must have a
- * public constructor that has one parameter, of type {@link RemoteRef}.
+ * class. The stub class must extend {@link RemoteStub} and must have a
+ * public constructor that has one parameter of type {@link RemoteRef}.
  *
  * <li>Finally, an instance of the stub class is constructed with a
  * {@link RemoteRef}.
- * </ul>
  *
- * <li>If the appropriate stub class could not be found, or the stub class
- * could not be loaded, or a problem occurs creating the stub instance, a
+ * <li>If the appropriate stub class could not be found, or if the stub class
+ * could not be loaded, or if a problem occurs creating the stub instance, a
  * {@link StubNotFoundException} is thrown.
  *
- * <p>
- * <li>For all other means of exporting:
- * <p><ul>
+ * </ul>
  *
- * <li>If the remote object's stub class (as defined above) could not be
- * loaded or the system property
- * <code>java.rmi.server.ignoreStubClasses</code> is set to
- * <code>"true"</code> (case insensitive), a {@link
- * java.lang.reflect.Proxy} instance is constructed with the following
- * properties:
+ * <p>Stubs are dynamically generated by constructing an instance of
+ * a {@link java.lang.reflect.Proxy Proxy} with the following characteristics:
  *
  * <ul>
  *
@@ -91,29 +127,13 @@
  *
  * <li>If the proxy could not be created, a {@link StubNotFoundException}
  * will be thrown.
- * </ul>
  *
- * <p>
- * <li>Otherwise, an instance of the remote object's stub class (as
- * described above) is used as the stub.
- *
- * </ul>
  * </ul>
  *
- * <p>If an object is exported with the
- * {@link #exportObject(Remote) exportObject(Remote)}
- * or
- * {@link #exportObject(Remote, int) exportObject(Remote, port)}
- * methods, or if a subclass constructor invokes one of the
- * {@link #UnicastRemoteObject()}
- * or
- * {@link #UnicastRemoteObject(int) UnicastRemoteObject(port)}
- * constructors, the object is exported with a server socket created using the
- * {@link RMISocketFactory}
- * class.
- *
  * @implNote
- * <p>By default, server sockets created by the {@link RMISocketFactory} class
+ * Depending upon which constructor or static method is used for exporting an
+ * object, {@link RMISocketFactory} may be used for creating sockets.
+ * By default, server sockets created by {@link RMISocketFactory}
  * listen on all network interfaces. See the
  * {@link RMISocketFactory} class and the section
  * <a href="{@docRoot}/../platform/rmi/spec/rmi-server29.html">RMI Socket Factories</a>
@@ -148,6 +168,10 @@
     /**
      * Creates and exports a new UnicastRemoteObject object using an
      * anonymous port.
+     *
+     * <p>The object is exported with a server socket
+     * created using the {@link RMISocketFactory} class.
+     *
      * @throws RemoteException if failed to export object
      * @since JDK1.1
      */
@@ -159,6 +183,10 @@
     /**
      * Creates and exports a new UnicastRemoteObject object using the
      * particular supplied port.
+     *
+     * <p>The object is exported with a server socket
+     * created using the {@link RMISocketFactory} class.
+     *
      * @param port the port number on which the remote object receives calls
      * (if <code>port</code> is zero, an anonymous port is chosen)
      * @throws RemoteException if failed to export object
@@ -173,6 +201,11 @@
     /**
      * Creates and exports a new UnicastRemoteObject object using the
      * particular supplied port and socket factories.
+     *
+     * <p>Either socket factory may be {@code null}, in which case
+     * the corresponding client or server socket creation method of
+     * {@link RMISocketFactory} is used instead.
+     *
      * @param port the port number on which the remote object receives calls
      * (if <code>port</code> is zero, an anonymous port is chosen)
      * @param csf the client-side socket factory for making calls to the
@@ -238,12 +271,23 @@
 
     /**
      * Exports the remote object to make it available to receive incoming
-     * calls using an anonymous port.
+     * calls using an anonymous port. This method will always return a
+     * statically generated stub.
+     *
+     * <p>The object is exported with a server socket
+     * created using the {@link RMISocketFactory} class.
+     *
      * @param obj the remote object to be exported
      * @return remote object stub
      * @exception RemoteException if export fails
      * @since JDK1.1
+     * @deprecated This method is deprecated because it supports only static stubs.
+     * Use {@link #exportObject(Remote, int) exportObject(Remote, port)} or
+     * {@link #exportObject(Remote, int, RMIClientSocketFactory, RMIServerSocketFactory)
+     * exportObject(Remote, port, csf, ssf)}
+     * instead.
      */
+    @Deprecated
     public static RemoteStub exportObject(Remote obj)
         throws RemoteException
     {
@@ -260,6 +304,10 @@
     /**
      * Exports the remote object to make it available to receive incoming
      * calls, using the particular supplied port.
+     *
+     * <p>The object is exported with a server socket
+     * created using the {@link RMISocketFactory} class.
+     *
      * @param obj the remote object to be exported
      * @param port the port to export the object on
      * @return remote object stub
@@ -275,6 +323,11 @@
     /**
      * Exports the remote object to make it available to receive incoming
      * calls, using a transport specified by the given socket factory.
+     *
+     * <p>Either socket factory may be {@code null}, in which case
+     * the corresponding client or server socket creation method of
+     * {@link RMISocketFactory} is used instead.
+     *
      * @param obj the remote object to be exported
      * @param port the port to export the object on
      * @param csf the client-side socket factory for making calls to the
--- a/jdk/src/share/classes/java/rmi/server/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/rmi/server/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 1998, 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
@@ -32,6 +32,27 @@
 generated by the rmic stub compiler.  Another group of classes
 implements the RMI Transport protocol and HTTP tunneling.
 
+<p><strong>Deprecated: HTTP Tunneling.</strong> <em>The HTTP tunneling
+mechanism has been deprecated. See {@link java.rmi.server.RMISocketFactory} for
+further information.</em>
+
+<p><strong>Deprecated: Skeletons and Static Stubs.</strong>
+
+<em>Skeletons and statically generated stubs are deprecated.  This
+includes the APIs in this package that require the use of skeletons
+or static stubs, the runtime support for them, and the use of the
+{@code rmic} stub compiler to generate them.  Support for skeletons
+and static stubs may be removed in a future release of the
+platform. Skeletons are unnecessary, as server-side method dispatching
+is handled directly by the RMI runtime. Statically generated stubs are
+unnecessary, as stubs are generated dynamically using {@link
+java.lang.reflect.Proxy Proxy} objects. See {@link
+java.rmi.server.UnicastRemoteObject UnicastRemoteObject} for
+information about dynamic stub generation. Generation of skeletons and
+static stubs was typically performed as part of an application's build
+process by calling the {@code rmic} tool. This is unnecessary, and
+calls to {@code rmic} can simply be omitted.</em>
+
 <!--
 <h2>Package Specification</h2>
 
--- a/jdk/src/share/classes/java/security/AccessControlContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/AccessControlContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -350,6 +350,10 @@
         return combiner;
     }
 
+    boolean isAuthorized() {
+        return isAuthorized;
+    }
+
     /**
      * Determines whether the access request indicated by the
      * specified permission should be allowed or denied, based on
--- a/jdk/src/share/classes/java/security/AccessControlException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/AccessControlException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -44,7 +44,7 @@
 
     private static final long serialVersionUID = 5138225684096988535L;
 
-    // the permission that caused the exeception to be thrown.
+    // the permission that caused the exception to be thrown.
     private Permission perm;
 
     /**
@@ -71,7 +71,7 @@
     }
 
     /**
-     * Gets the Permission object associated with this exeception, or
+     * Gets the Permission object associated with this exception, or
      * null if there was no corresponding Permission object.
      *
      * @return the Permission object.
--- a/jdk/src/share/classes/java/security/AccessController.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/AccessController.java	Wed Jul 05 19:21:26 2017 +0200
@@ -39,9 +39,9 @@
  * <ul>
  * <li> to decide whether an access to a critical system
  * resource is to be allowed or denied, based on the security policy
- * currently in effect,<p>
+ * currently in effect,
  * <li>to mark code as being "privileged", thus affecting subsequent
- * access determinations, and<p>
+ * access determinations, and
  * <li>to obtain a "snapshot" of the current calling context so
  * access-control decisions from a different context can be made with
  * respect to the saved context. </ul>
@@ -344,9 +344,10 @@
      * If the action's {@code run} method throws an (unchecked) exception,
      * it will propagate through this method.
      * <p>
-     * If a security manager is installed and the {@code AccessControlContext}
-     * was not created by system code and the caller's {@code ProtectionDomain}
-     * has not been granted the {@literal "createAccessControlContext"}
+     * If a security manager is installed and the specified
+     * {@code AccessControlContext} was not created by system code and the
+     * caller's {@code ProtectionDomain} has not been granted the
+     * {@literal "createAccessControlContext"}
      * {@link java.security.SecurityPermission}, then the action is performed
      * with no permissions.
      *
@@ -384,6 +385,13 @@
      * <p>
      * If the action's {@code run} method throws an (unchecked) exception,
      * it will propagate through this method.
+     * <p>
+     * If a security manager is installed and the specified
+     * {@code AccessControlContext} was not created by system code and the
+     * caller's {@code ProtectionDomain} has not been granted the
+     * {@literal "createAccessControlContext"}
+     * {@link java.security.SecurityPermission}, then the action is performed
+     * with no permissions.
      *
      * @param <T> the type of the value returned by the PrivilegedAction's
      *                  {@code run} method.
@@ -438,6 +446,13 @@
      *
      * <p> This method preserves the current AccessControlContext's
      * DomainCombiner (which may be null) while the action is performed.
+     * <p>
+     * If a security manager is installed and the specified
+     * {@code AccessControlContext} was not created by system code and the
+     * caller's {@code ProtectionDomain} has not been granted the
+     * {@literal "createAccessControlContext"}
+     * {@link java.security.SecurityPermission}, then the action is performed
+     * with no permissions.
      *
      * @param <T> the type of the value returned by the PrivilegedAction's
      *                  {@code run} method.
@@ -571,8 +586,18 @@
                       AccessControlContext parent, AccessControlContext context,
                       Permission[] perms)
     {
-        return new AccessControlContext(getCallerPD(caller), combiner, parent,
-                                        context, perms);
+        ProtectionDomain callerPD = getCallerPD(caller);
+        // check if caller is authorized to create context
+        if (context != null && !context.isAuthorized() &&
+            System.getSecurityManager() != null &&
+            !callerPD.impliesCreateAccessControlContext())
+        {
+            ProtectionDomain nullPD = new ProtectionDomain(null, null);
+            return new AccessControlContext(new ProtectionDomain[] { nullPD });
+        } else {
+            return new AccessControlContext(callerPD, combiner, parent,
+                                            context, perms);
+        }
     }
 
     private static ProtectionDomain getCallerPD(final Class <?> caller) {
@@ -597,9 +622,10 @@
      * If the action's {@code run} method throws an <i>unchecked</i>
      * exception, it will propagate through this method.
      * <p>
-     * If a security manager is installed and the {@code AccessControlContext}
-     * was not created by system code and the caller's {@code ProtectionDomain}
-     * has not been granted the {@literal "createAccessControlContext"}
+     * If a security manager is installed and the specified
+     * {@code AccessControlContext} was not created by system code and the
+     * caller's {@code ProtectionDomain} has not been granted the
+     * {@literal "createAccessControlContext"}
      * {@link java.security.SecurityPermission}, then the action is performed
      * with no permissions.
      *
@@ -641,6 +667,13 @@
      * <p>
      * If the action's {@code run} method throws an (unchecked) exception,
      * it will propagate through this method.
+     * <p>
+     * If a security manager is installed and the specified
+     * {@code AccessControlContext} was not created by system code and the
+     * caller's {@code ProtectionDomain} has not been granted the
+     * {@literal "createAccessControlContext"}
+     * {@link java.security.SecurityPermission}, then the action is performed
+     * with no permissions.
      *
      * @param <T> the type of the value returned by the
      *                  PrivilegedExceptionAction's {@code run} method.
@@ -697,6 +730,13 @@
      *
      * <p> This method preserves the current AccessControlContext's
      * DomainCombiner (which may be null) while the action is performed.
+     * <p>
+     * If a security manager is installed and the specified
+     * {@code AccessControlContext} was not created by system code and the
+     * caller's {@code ProtectionDomain} has not been granted the
+     * {@literal "createAccessControlContext"}
+     * {@link java.security.SecurityPermission}, then the action is performed
+     * with no permissions.
      *
      * @param <T> the type of the value returned by the
      *                  PrivilegedExceptionAction's {@code run} method.
--- a/jdk/src/share/classes/java/security/AlgorithmParameterGenerator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/AlgorithmParameterGenerator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -48,7 +48,7 @@
  * of the prime modulus (in bits).
  * When using this approach, algorithm-specific parameter generation
  * values - if any - default to some standard values, unless they can be
- * derived from the specified size.<P>
+ * derived from the specified size.
  *
  * <li>The other approach initializes a parameter generator object
  * using algorithm-specific semantics, which are represented by a set of
--- a/jdk/src/share/classes/java/security/BasicPermission.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/BasicPermission.java	Wed Jul 05 19:21:26 2017 +0200
@@ -57,7 +57,6 @@
  * Subclasses may implement actions on top of BasicPermission,
  * if desired.
  * <p>
- * <P>
  * @see java.security.Permission
  * @see java.security.Permissions
  * @see java.security.PermissionCollection
@@ -153,9 +152,9 @@
      * Checks if the specified permission is "implied" by
      * this object.
      * <P>
-     * More specifically, this method returns true if:<p>
+     * More specifically, this method returns true if:
      * <ul>
-     * <li> <i>p</i>'s class is the same as this object's class, and<p>
+     * <li> <i>p</i>'s class is the same as this object's class, and
      * <li> <i>p</i>'s name equals or (in the case of wildcards)
      *      is implied by this object's
      *      name. For example, "a.b.*" implies "a.b.c".
--- a/jdk/src/share/classes/java/security/CodeSource.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/CodeSource.java	Wed Jul 05 19:21:26 2017 +0200
@@ -234,7 +234,7 @@
      * Returns true if this CodeSource object "implies" the specified CodeSource.
      * <p>
      * More specifically, this method makes the following checks.
-     * If any fail, it returns false. If they all succeed, it returns true.<p>
+     * If any fail, it returns false. If they all succeed, it returns true.
      * <ul>
      * <li> <i>codesource</i> must not be null.
      * <li> If this object's certificates are not null, then all
@@ -242,7 +242,7 @@
      * certificates.
      * <li> If this object's location (getLocation()) is not null, then the
      * following checks are made against this object's location and
-     * <i>codesource</i>'s:<p>
+     * <i>codesource</i>'s:
      *   <ul>
      *     <li>  <i>codesource</i>'s location must not be null.
      *
--- a/jdk/src/share/classes/java/security/DigestOutputStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/DigestOutputStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -38,7 +38,7 @@
  *
  * <p>To complete the message digest computation, call one of the
  * {@code digest} methods on the associated message
- * digest after your calls to one of this digest ouput stream's
+ * digest after your calls to one of this digest output stream's
  * {@link #write(int) write} methods.
  *
  * <p>It is possible to turn this stream on or off (see
--- a/jdk/src/share/classes/java/security/Key.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/Key.java	Wed Jul 05 19:21:26 2017 +0200
@@ -39,7 +39,7 @@
  * RSA), which will work with those algorithms and with related
  * algorithms (such as MD5 with RSA, SHA-1 with RSA, Raw DSA, etc.)
  * The name of the algorithm of a key is obtained using the
- * {@link #getAlgorithm() getAlgorithm} method.<P>
+ * {@link #getAlgorithm() getAlgorithm} method.
  *
  * <LI>An Encoded Form
  *
@@ -65,12 +65,11 @@
  * For more information, see
  * <a href="http://www.ietf.org/rfc/rfc3280.txt">RFC 3280:
  * Internet X.509 Public Key Infrastructure Certificate and CRL Profile</a>.
- * <P>
  *
  * <LI>A Format
  *
  * <P>This is the name of the format of the encoded key. It is returned
- * by the {@link #getFormat() getFormat} method.<P>
+ * by the {@link #getFormat() getFormat} method.
  *
  * </UL>
  *
--- a/jdk/src/share/classes/java/security/KeyPairGenerator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/KeyPairGenerator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -77,7 +77,6 @@
  * providers might have precomputed parameter sets for more than just the
  * three modulus sizes mentioned above. Still others might not have a list of
  * precomputed parameters at all and instead always create new parameter sets.
- * <p>
  *
  * <li><b>Algorithm-Specific Initialization</b>
  * <p>For situations where a set of algorithm-specific parameters already
--- a/jdk/src/share/classes/java/security/KeyStore.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/KeyStore.java	Wed Jul 05 19:21:26 2017 +0200
@@ -98,7 +98,6 @@
  *    KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
  * </pre>
  * The system will return a keystore implementation for the default type.
- * <p>
  *
  * <li>To provide a specific keystore type:
  * <pre>
@@ -1612,7 +1611,7 @@
          * Returns the KeyStore described by this object.
          *
          * @return the {@code KeyStore} described by this object
-         * @exception KeyStoreException if an error occured during the
+         * @exception KeyStoreException if an error occurred during the
          *   operation, for example if the KeyStore could not be
          *   instantiated or loaded
          */
@@ -1628,7 +1627,7 @@
          *   the {@link KeyStore.Entry Entry} with the given alias.
          * @param alias the alias of the KeyStore entry
          * @throws NullPointerException if alias is null
-         * @throws KeyStoreException if an error occured during the
+         * @throws KeyStoreException if an error occurred during the
          *   operation
          * @throws IllegalStateException if the getKeyStore method has
          *   not been invoked prior to calling this method
--- a/jdk/src/share/classes/java/security/MessageDigest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/MessageDigest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -54,21 +54,21 @@
  *
  * <p>Implementations are free to implement the Cloneable interface.
  * Client applications can test cloneability by attempting cloning
- * and catching the CloneNotSupportedException: <p>
+ * and catching the CloneNotSupportedException:
+ *
+ * <pre>{@code
+ * MessageDigest md = MessageDigest.getInstance("SHA");
  *
-* <pre>
-* MessageDigest md = MessageDigest.getInstance("SHA");
-*
-* try {
-*     md.update(toChapter1);
-*     MessageDigest tc1 = md.clone();
-*     byte[] toChapter1Digest = tc1.digest();
-*     md.update(toChapter2);
-*     ...etc.
-* } catch (CloneNotSupportedException cnse) {
-*     throw new DigestException("couldn't make digest of partial content");
-* }
-* </pre>
+ * try {
+ *     md.update(toChapter1);
+ *     MessageDigest tc1 = md.clone();
+ *     byte[] toChapter1Digest = tc1.digest();
+ *     md.update(toChapter2);
+ *     ...etc.
+ * } catch (CloneNotSupportedException cnse) {
+ *     throw new DigestException("couldn't make digest of partial content");
+ * }
+ * }</pre>
  *
  * <p>Note that if a given implementation is not cloneable, it is
  * still possible to compute intermediate digests by instantiating
--- a/jdk/src/share/classes/java/security/Permission.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/Permission.java	Wed Jul 05 19:21:26 2017 +0200
@@ -138,14 +138,14 @@
      * Returns the hash code value for this Permission object.
      * <P>
      * The required {@code hashCode} behavior for Permission Objects is
-     * the following: <p>
+     * the following:
      * <ul>
      * <li>Whenever it is invoked on the same Permission object more than
      *     once during an execution of a Java application, the
      *     {@code hashCode} method
      *     must consistently return the same integer. This integer need not
      *     remain consistent from one execution of an application to another
-     *     execution of the same application. <p>
+     *     execution of the same application.
      * <li>If two Permission objects are equal according to the
      *     {@code equals}
      *     method, then calling the {@code hashCode} method on each of the
--- a/jdk/src/share/classes/java/security/PermissionCollection.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/PermissionCollection.java	Wed Jul 05 19:21:26 2017 +0200
@@ -37,7 +37,6 @@
  *      collection, using the {@code implies} method.
  * <LI> enumerate all the permissions, using the {@code elements} method.
  * </UL>
- * <P>
  *
  * <p>When it is desirable to group together a number of Permission objects
  * of the same type, the {@code newPermissionCollection} method on that
--- a/jdk/src/share/classes/java/security/ProtectionDomain.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/ProtectionDomain.java	Wed Jul 05 19:21:26 2017 +0200
@@ -401,7 +401,7 @@
         if (perms != null && permissions != null) {
             //
             // Weed out the duplicates from the policy. Unless a refresh
-            // has occured since the pd was consed this should result in
+            // has occurred since the pd was consed this should result in
             // an empty vector.
             synchronized (permissions) {
                 e = permissions.elements();   // domain vs policy
--- a/jdk/src/share/classes/java/security/Provider.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/Provider.java	Wed Jul 05 19:21:26 2017 +0200
@@ -30,6 +30,9 @@
 import static java.util.Locale.ENGLISH;
 import java.lang.ref.*;
 import java.lang.reflect.*;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.Function;
 
 /**
  * This class represents a "provider" for the
@@ -185,15 +188,10 @@
      * Clears this provider so that it no longer contains the properties
      * used to look up facilities implemented by the provider.
      *
-     * <p>First, if there is a security manager, its
-     * {@code checkSecurityAccess} method is called with the string
-     * {@code "clearProviderProperties."+name} (where {@code name}
-     * is the provider name) to see if it's ok to clear this provider.
-     * If the default implementation of {@code checkSecurityAccess}
-     * is used (that is, that method is not overriden), then this results in
-     * a call to the security manager's {@code checkPermission} method
-     * with a {@code SecurityPermission("clearProviderProperties."+name)}
-     * permission.
+     * <p>If a security manager is enabled, its {@code checkSecurityAccess}
+     * method is called with the string {@code "clearProviderProperties."+name}
+     * (where {@code name} is the provider name) to see if it's ok to clear
+     * this provider.
      *
      * @throws  SecurityException
      *          if a security manager exists and its {@link
@@ -202,6 +200,7 @@
      *
      * @since 1.2
      */
+    @Override
     public synchronized void clear() {
         check("clearProviderProperties."+name);
         if (debug != null) {
@@ -218,6 +217,7 @@
      *               input stream.
      * @see java.util.Properties#load
      */
+    @Override
     public synchronized void load(InputStream inStream) throws IOException {
         check("putProviderProperty."+name);
         if (debug != null) {
@@ -235,6 +235,7 @@
      *
      * @since 1.2
      */
+    @Override
     public synchronized void putAll(Map<?,?> t) {
         check("putProviderProperty."+name);
         if (debug != null) {
@@ -250,6 +251,7 @@
      * @see   java.util.Map.Entry
      * @since 1.2
      */
+    @Override
     public synchronized Set<Map.Entry<Object,Object>> entrySet() {
         checkInitialized();
         if (entrySet == null) {
@@ -276,6 +278,7 @@
      *
      * @since 1.2
      */
+    @Override
     public Set<Object> keySet() {
         checkInitialized();
         return Collections.unmodifiableSet(super.keySet());
@@ -287,6 +290,7 @@
      *
      * @since 1.2
      */
+    @Override
     public Collection<Object> values() {
         checkInitialized();
         return Collections.unmodifiableCollection(super.values());
@@ -296,22 +300,10 @@
      * Sets the {@code key} property to have the specified
      * {@code value}.
      *
-     * <p>First, if there is a security manager, its
-     * {@code checkSecurityAccess} method is called with the string
-     * {@code "putProviderProperty."+name}, where {@code name} is the
-     * provider name, to see if it's ok to set this provider's property values.
-     * If the default implementation of {@code checkSecurityAccess}
-     * is used (that is, that method is not overriden), then this results in
-     * a call to the security manager's {@code checkPermission} method
-     * with a {@code SecurityPermission("putProviderProperty."+name)}
-     * permission.
-     *
-     * @param key the property key.
-     *
-     * @param value the property value.
-     *
-     * @return the previous value of the specified property
-     * ({@code key}), or null if it did not have one.
+     * <p>If a security manager is enabled, its {@code checkSecurityAccess}
+     * method is called with the string {@code "putProviderProperty."+name},
+     * where {@code name} is the provider name, to see if it's ok to set this
+     * provider's property values.
      *
      * @throws  SecurityException
      *          if a security manager exists and its {@link
@@ -320,6 +312,7 @@
      *
      * @since 1.2
      */
+    @Override
     public synchronized Object put(Object key, Object value) {
         check("putProviderProperty."+name);
         if (debug != null) {
@@ -330,24 +323,38 @@
     }
 
     /**
+     * If the specified key is not already associated with a value (or is mapped
+     * to {@code null}) associates it with the given value and returns
+     * {@code null}, else returns the current value.
+     *
+     * <p>If a security manager is enabled, its {@code checkSecurityAccess}
+     * method is called with the string {@code "putProviderProperty."+name},
+     * where {@code name} is the provider name, to see if it's ok to set this
+     * provider's property values.
+     *
+     * @throws  SecurityException
+     *          if a security manager exists and its {@link
+     *          java.lang.SecurityManager#checkSecurityAccess} method
+     *          denies access to set property values.
+     */
+    @Override
+    public synchronized Object putIfAbsent(Object key, Object value) {
+        check("putProviderProperty."+name);
+        if (debug != null) {
+            debug.println("Set " + name + " provider property [" +
+                          key + "/" + value +"]");
+        }
+        return implPutIfAbsent(key, value);
+    }
+
+    /**
      * Removes the {@code key} property (and its corresponding
      * {@code value}).
      *
-     * <p>First, if there is a security manager, its
-     * {@code checkSecurityAccess} method is called with the string
-     * {@code "removeProviderProperty."+name}, where {@code name} is
-     * the provider name, to see if it's ok to remove this provider's
-     * properties. If the default implementation of
-     * {@code checkSecurityAccess} is used (that is, that method is not
-     * overriden), then this results in a call to the security manager's
-     * {@code checkPermission} method with a
-     * {@code SecurityPermission("removeProviderProperty."+name)}
-     * permission.
-     *
-     * @param key the key for the property to be removed.
-     *
-     * @return the value to which the key had been mapped,
-     * or null if the key did not have a mapping.
+     * <p>If a security manager is enabled, its {@code checkSecurityAccess}
+     * method is called with the string {@code "removeProviderProperty."+name},
+     * where {@code name} is the provider name, to see if it's ok to remove this
+     * provider's properties.
      *
      * @throws  SecurityException
      *          if a security manager exists and its {@link
@@ -356,6 +363,7 @@
      *
      * @since 1.2
      */
+    @Override
     public synchronized Object remove(Object key) {
         check("removeProviderProperty."+name);
         if (debug != null) {
@@ -364,19 +372,245 @@
         return implRemove(key);
     }
 
+    /**
+     * Removes the entry for the specified key only if it is currently
+     * mapped to the specified value.
+     *
+     * <p>If a security manager is enabled, its {@code checkSecurityAccess}
+     * method is called with the string {@code "removeProviderProperty."+name},
+     * where {@code name} is the provider name, to see if it's ok to remove this
+     * provider's properties.
+     *
+     * @throws  SecurityException
+     *          if a security manager exists and its {@link
+     *          java.lang.SecurityManager#checkSecurityAccess} method
+     *          denies access to remove this provider's properties.
+     */
+    @Override
+    public synchronized boolean remove(Object key, Object value) {
+        check("removeProviderProperty."+name);
+        if (debug != null) {
+            debug.println("Remove " + name + " provider property " + key);
+        }
+        return implRemove(key, value);
+    }
+
+    /**
+     * Replaces the entry for the specified key only if currently
+     * mapped to the specified value.
+     *
+     * <p>If a security manager is enabled, its {@code checkSecurityAccess}
+     * method is called with the string {@code "putProviderProperty."+name},
+     * where {@code name} is the provider name, to see if it's ok to set this
+     * provider's property values.
+     *
+     * @throws  SecurityException
+     *          if a security manager exists and its {@link
+     *          java.lang.SecurityManager#checkSecurityAccess} method
+     *          denies access to set property values.
+     */
+    @Override
+    public synchronized boolean replace(Object key, Object oldValue,
+            Object newValue) {
+        check("putProviderProperty." + name);
+
+        if (debug != null) {
+            debug.println("Replace " + name + " provider property " + key);
+        }
+        return implReplace(key, oldValue, newValue);
+    }
+
+    /**
+     * Replaces the entry for the specified key only if it is
+     * currently mapped to some value.
+     *
+     * <p>If a security manager is enabled, its {@code checkSecurityAccess}
+     * method is called with the string {@code "putProviderProperty."+name},
+     * where {@code name} is the provider name, to see if it's ok to set this
+     * provider's property values.
+     *
+     * @throws  SecurityException
+     *          if a security manager exists and its {@link
+     *          java.lang.SecurityManager#checkSecurityAccess} method
+     *          denies access to set property values.
+     */
+    @Override
+    public synchronized Object replace(Object key, Object value) {
+        check("putProviderProperty." + name);
+
+        if (debug != null) {
+            debug.println("Replace " + name + " provider property " + key);
+        }
+        return implReplace(key, value);
+    }
+
+    /**
+     * Replaces each entry's value with the result of invoking the given
+     * function on that entry, in the order entries are returned by an entry
+     * set iterator, until all entries have been processed or the function
+     * throws an exception.
+     *
+     * <p>If a security manager is enabled, its {@code checkSecurityAccess}
+     * method is called with the string {@code "putProviderProperty."+name},
+     * where {@code name} is the provider name, to see if it's ok to set this
+     * provider's property values.
+     *
+     * @throws  SecurityException
+     *          if a security manager exists and its {@link
+     *          java.lang.SecurityManager#checkSecurityAccess} method
+     *          denies access to set property values.
+     */
+    @Override
+    public synchronized void replaceAll(BiFunction<? super Object, ? super Object, ? extends Object> function) {
+        check("putProviderProperty." + name);
+
+        if (debug != null) {
+            debug.println("ReplaceAll " + name + " provider property ");
+        }
+        implReplaceAll(function);
+    }
+
+    /**
+     * Attempts to compute a mapping for the specified key and its
+     * current mapped value (or {@code null} if there is no current
+     * mapping).
+     *
+     * <p>If a security manager is enabled, its {@code checkSecurityAccess}
+     * method is called with the strings {@code "putProviderProperty."+name}
+     * and {@code "removeProviderProperty."+name}, where {@code name} is the
+     * provider name, to see if it's ok to set this provider's property values
+     * and remove this provider's properties.
+     *
+     * @throws  SecurityException
+     *          if a security manager exists and its {@link
+     *          java.lang.SecurityManager#checkSecurityAccess} method
+     *          denies access to set property values or remove properties.
+     */
+    @Override
+    public synchronized Object compute(Object key,
+        BiFunction<? super Object, ? super Object, ? extends Object> remappingFunction) {
+        check("putProviderProperty." + name);
+        check("removeProviderProperty" + name);
+
+        if (debug != null) {
+            debug.println("Compute " + name + " provider property " + key);
+        }
+        return implCompute(key, remappingFunction);
+    }
+
+    /**
+     * If the specified key is not already associated with a value (or
+     * is mapped to {@code null}), attempts to compute its value using
+     * the given mapping function and enters it into this map unless
+     * {@code null}.
+     *
+     * <p>If a security manager is enabled, its {@code checkSecurityAccess}
+     * method is called with the strings {@code "putProviderProperty."+name}
+     * and {@code "removeProviderProperty."+name}, where {@code name} is the
+     * provider name, to see if it's ok to set this provider's property values
+     * and remove this provider's properties.
+     *
+     * @throws  SecurityException
+     *          if a security manager exists and its {@link
+     *          java.lang.SecurityManager#checkSecurityAccess} method
+     *          denies access to set property values and remove properties.
+     */
+    @Override
+    public synchronized Object computeIfAbsent(Object key, Function<? super Object, ? extends Object> mappingFunction) {
+        check("putProviderProperty." + name);
+        check("removeProviderProperty" + name);
+
+        if (debug != null) {
+            debug.println("ComputeIfAbsent " + name + " provider property " +
+                    key);
+        }
+        return implComputeIfAbsent(key, mappingFunction);
+    }
+
+    /**
+     * If the value for the specified key is present and non-null, attempts to
+     * compute a new mapping given the key and its current mapped value.
+     *
+     * <p>If a security manager is enabled, its {@code checkSecurityAccess}
+     * method is called with the strings {@code "putProviderProperty."+name}
+     * and {@code "removeProviderProperty."+name}, where {@code name} is the
+     * provider name, to see if it's ok to set this provider's property values
+     * and remove this provider's properties.
+     *
+     * @throws  SecurityException
+     *          if a security manager exists and its {@link
+     *          java.lang.SecurityManager#checkSecurityAccess} method
+     *          denies access to set property values or remove properties.
+     */
+    @Override
+    public synchronized Object computeIfPresent(Object key, BiFunction<? super Object, ? super Object, ? extends Object> remappingFunction) {
+        check("putProviderProperty." + name);
+        check("removeProviderProperty" + name);
+
+        if (debug != null) {
+            debug.println("ComputeIfPresent " + name + " provider property " +
+                    key);
+        }
+        return implComputeIfPresent(key, remappingFunction);
+    }
+
+    /**
+     * If the specified key is not already associated with a value or is
+     * associated with null, associates it with the given value. Otherwise,
+     * replaces the value with the results of the given remapping function,
+     * or removes if the result is null. This method may be of use when
+     * combining multiple mapped values for a key.
+     *
+     * <p>If a security manager is enabled, its {@code checkSecurityAccess}
+     * method is called with the strings {@code "putProviderProperty."+name}
+     * and {@code "removeProviderProperty."+name}, where {@code name} is the
+     * provider name, to see if it's ok to set this provider's property values
+     * and remove this provider's properties.
+     *
+     * @throws  SecurityException
+     *          if a security manager exists and its {@link
+     *          java.lang.SecurityManager#checkSecurityAccess} method
+     *          denies access to set property values or remove properties.
+     */
+    @Override
+    public synchronized Object merge(Object key, Object value,  BiFunction<? super Object, ? super Object, ? extends Object>  remappingFunction) {
+        check("putProviderProperty." + name);
+        check("removeProviderProperty" + name);
+
+        if (debug != null) {
+            debug.println("Merge " + name + " provider property " + key);
+        }
+        return implMerge(key, value, remappingFunction);
+    }
+
     // let javadoc show doc from superclass
+    @Override
     public Object get(Object key) {
         checkInitialized();
         return super.get(key);
     }
 
+    @Override
+    public synchronized Object getOrDefault(Object key, Object defaultValue) {
+        checkInitialized();
+        return super.getOrDefault(key, defaultValue);
+    }
+
+    @Override
+    public synchronized void forEach(BiConsumer<? super Object, ? super Object> action) {
+        checkInitialized();
+        super.forEach(action);
+    }
+
     // let javadoc show doc from superclass
+    @Override
     public Enumeration<Object> keys() {
         checkInitialized();
         return super.keys();
     }
 
     // let javadoc show doc from superclass
+    @Override
     public Enumeration<Object> elements() {
         checkInitialized();
         return super.elements();
@@ -446,6 +680,19 @@
         putAll(copy);
     }
 
+    private boolean checkLegacy(Object key) {
+        String keyString = (String)key;
+        if (keyString.startsWith("Provider.")) {
+            return false;
+        }
+
+        legacyChanged = true;
+        if (legacyStrings == null) {
+            legacyStrings = new LinkedHashMap<String,String>();
+        }
+        return true;
+    }
+
     /**
      * Copies all of the mappings from the specified Map to this provider.
      * Internal method to be called AFTER the security check has been
@@ -459,34 +706,121 @@
 
     private Object implRemove(Object key) {
         if (key instanceof String) {
-            String keyString = (String)key;
-            if (keyString.startsWith("Provider.")) {
+            if (!checkLegacy(key)) {
                 return null;
             }
-            legacyChanged = true;
-            if (legacyStrings == null) {
-                legacyStrings = new LinkedHashMap<String,String>();
-            }
-            legacyStrings.remove(keyString);
+            legacyStrings.remove((String)key);
         }
         return super.remove(key);
     }
 
-    private Object implPut(Object key, Object value) {
+    private boolean implRemove(Object key, Object value) {
+        if (key instanceof String && value instanceof String) {
+            if (!checkLegacy(key)) {
+                return false;
+            }
+            legacyStrings.remove((String)key, value);
+        }
+        return super.remove(key, value);
+    }
+
+    private boolean implReplace(Object key, Object oldValue, Object newValue) {
+        if ((key instanceof String) && (oldValue instanceof String) &&
+                (newValue instanceof String)) {
+            if (!checkLegacy(key)) {
+                return false;
+            }
+            legacyStrings.replace((String)key, (String)oldValue,
+                    (String)newValue);
+        }
+        return super.replace(key, oldValue, newValue);
+    }
+
+    private Object implReplace(Object key, Object value) {
         if ((key instanceof String) && (value instanceof String)) {
-            String keyString = (String)key;
-            if (keyString.startsWith("Provider.")) {
+            if (!checkLegacy(key)) {
+                return null;
+            }
+            legacyStrings.replace((String)key, (String)value);
+        }
+        return super.replace(key, value);
+    }
+
+    private void implReplaceAll(BiFunction<? super Object, ? super Object, ? extends Object> function) {
+        legacyChanged = true;
+        if (legacyStrings == null) {
+            legacyStrings = new LinkedHashMap<String,String>();
+        } else {
+            legacyStrings.replaceAll((BiFunction<? super String, ? super String, ? extends String>) function);
+        }
+        super.replaceAll(function);
+    }
+
+
+    private Object implMerge(Object key, Object value, BiFunction<? super Object, ? super Object, ? extends Object> remappingFunction) {
+        if ((key instanceof String) && (value instanceof String)) {
+            if (!checkLegacy(key)) {
                 return null;
             }
-            legacyChanged = true;
-            if (legacyStrings == null) {
-                legacyStrings = new LinkedHashMap<String,String>();
+            legacyStrings.merge((String)key, (String)value,
+                    (BiFunction<? super String, ? super String, ? extends String>) remappingFunction);
+        }
+        return super.merge(key, value, remappingFunction);
+    }
+
+    private Object implCompute(Object key, BiFunction<? super Object, ? super Object, ? extends Object> remappingFunction) {
+        if (key instanceof String) {
+            if (!checkLegacy(key)) {
+                return null;
+            }
+            legacyStrings.computeIfAbsent((String) key,
+                    (Function<? super String, ? extends String>) remappingFunction);
+        }
+        return super.compute(key, remappingFunction);
+    }
+
+    private Object implComputeIfAbsent(Object key, Function<? super Object, ? extends Object> mappingFunction) {
+        if (key instanceof String) {
+            if (!checkLegacy(key)) {
+                return null;
             }
-            legacyStrings.put(keyString, (String)value);
+            legacyStrings.computeIfAbsent((String) key,
+                    (Function<? super String, ? extends String>) mappingFunction);
+        }
+        return super.computeIfAbsent(key, mappingFunction);
+    }
+
+    private Object implComputeIfPresent(Object key, BiFunction<? super Object, ? super Object, ? extends Object> remappingFunction) {
+        if (key instanceof String) {
+            if (!checkLegacy(key)) {
+                return null;
+            }
+            legacyStrings.computeIfPresent((String) key,
+                    (BiFunction<? super String, ? super String, ? extends String>) remappingFunction);
+        }
+        return super.computeIfPresent(key, remappingFunction);
+    }
+
+    private Object implPut(Object key, Object value) {
+        if ((key instanceof String) && (value instanceof String)) {
+            if (!checkLegacy(key)) {
+                return null;
+            }
+            legacyStrings.put((String)key, (String)value);
         }
         return super.put(key, value);
     }
 
+    private Object implPutIfAbsent(Object key, Object value) {
+        if ((key instanceof String) && (value instanceof String)) {
+            if (!checkLegacy(key)) {
+                return null;
+            }
+            legacyStrings.putIfAbsent((String)key, (String)value);
+        }
+        return super.putIfAbsent(key, value);
+    }
+
     private void implClear() {
         if (legacyStrings != null) {
             legacyStrings.clear();
--- a/jdk/src/share/classes/java/security/Security.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/Security.java	Wed Jul 05 19:21:26 2017 +0200
@@ -496,7 +496,7 @@
      * <li> <i>{@literal <crypto_service>.<algorithm_or_type>
      * <attribute_name>:<attribute_value>}</i>
      * <p> The cryptographic service name must not contain any dots. There
-     * must be one or more space charaters between the
+     * must be one or more space characters between the
      * <i>{@literal <algorithm_or_type>}</i> and the
      * <i>{@literal <attribute_name>}</i>.
      *  <p> A provider satisfies this selection criterion iff the
@@ -570,7 +570,7 @@
      * <li>  <i>{@literal <crypto_service>}.
      * {@literal <algorithm_or_type> <attribute_name>}</i>
      * <p> The cryptographic service name must not contain any dots. There
-     * must be one or more space charaters between the
+     * must be one or more space characters between the
      * <i>{@literal <algorithm_or_type>}</i>
      * and the <i>{@literal <attribute_name>}</i>.
      * <p> The value associated with the key must be a non-empty string.
--- a/jdk/src/share/classes/java/security/SecurityPermission.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/SecurityPermission.java	Wed Jul 05 19:21:26 2017 +0200
@@ -44,7 +44,6 @@
  * The following table lists all the possible SecurityPermission target names,
  * and for each provides a description of what the permission allows
  * and a discussion of the risks of granting code the permission.
- * <P>
  *
  * <table border=1 cellpadding=5 summary="target name,what the permission allows, and associated risks">
  * <tr>
@@ -193,7 +192,6 @@
  * associated with classes that have been deprecated: {@link Identity},
  * {@link IdentityScope}, {@link Signer}. Use of them is discouraged. See the
  * applicable classes for more information.
- * <P>
  *
  * <table border=1 cellpadding=5 summary="target name,what the permission allows, and associated risks">
  * <tr>
--- a/jdk/src/share/classes/java/security/Signature.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/Signature.java	Wed Jul 05 19:21:26 2017 +0200
@@ -77,13 +77,13 @@
  *     (see {@link #initSign(PrivateKey)}
  *     and {@link #initSign(PrivateKey, SecureRandom)}).
  *
- *     </ul><p>
+ *     </ul>
  *
- * <li>Updating<p>
+ * <li>Updating
  *
  * <p>Depending on the type of initialization, this will update the
  * bytes to be signed or verified. See the
- * {@link #update(byte) update} methods.<p>
+ * {@link #update(byte) update} methods.
  *
  * <li>Signing or Verifying a signature on all updated bytes. See the
  * {@link #sign() sign} methods and the {@link #verify(byte[]) verify}
--- a/jdk/src/share/classes/java/security/SignedObject.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/SignedObject.java	Wed Jul 05 19:21:26 2017 +0200
@@ -43,7 +43,7 @@
  * object passed to the constructor and the {@code verify} method.
  * A typical usage for signing is the following:
  *
- * <p> <pre>{@code
+ * <pre>{@code
  * Signature signingEngine = Signature.getInstance(algorithm,
  *                                                 provider);
  * SignedObject so = new SignedObject(myobject, signingKey,
@@ -53,7 +53,7 @@
  * <p> A typical usage for verification is the following (having
  * received SignedObject {@code so}):
  *
- * <p> <pre>{@code
+ * <pre>{@code
  * Signature verificationEngine =
  *     Signature.getInstance(algorithm, provider);
  * if (so.verify(publickey, verificationEngine))
--- a/jdk/src/share/classes/java/security/UnresolvedPermission.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/UnresolvedPermission.java	Wed Jul 05 19:21:26 2017 +0200
@@ -441,7 +441,7 @@
      *
      * @return the target name of the underlying permission that
      *          has not been resolved, or {@code null},
-     *          if there is no targe name
+     *          if there is no target name
      *
      * @since 1.5
      */
--- a/jdk/src/share/classes/java/security/acl/Acl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/acl/Acl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -42,27 +42,27 @@
  * granted to the associated principal. If negative, the permissions
  * are to be denied.<p>
  *
- * The ACL Entries in each ACL observe the following rules:<p>
+ * The ACL Entries in each ACL observe the following rules:
  *
  * <ul> <li>Each principal can have at most one positive ACL entry and
  * one negative entry; that is, multiple positive or negative ACL
  * entries are not allowed for any principal.  Each entry specifies
  * the set of permissions that are to be granted (if positive) or
- * denied (if negative). <p>
+ * denied (if negative).
  *
  * <li>If there is no entry for a particular principal, then the
- * principal is considered to have a null (empty) permission set.<p>
+ * principal is considered to have a null (empty) permission set.
  *
  * <li>If there is a positive entry that grants a principal a
  * particular permission, and a negative entry that denies the
  * principal the same permission, the result is as though the
- * permission was never granted or denied. <p>
+ * permission was never granted or denied.
  *
  * <li>Individual permissions always override permissions of the
  * group(s) to which the individual belongs. That is, individual
  * negative permissions (specific denial of permissions) override the
  * groups' positive permissions. And individual positive permissions
- * override the groups' negative permissions.<p>
+ * override the groups' negative permissions.
  *
  * </ul>
  *
@@ -159,12 +159,12 @@
      * Returns an enumeration for the set of allowed permissions for the
      * specified principal (representing an entity such as an individual or
      * a group). This set of allowed permissions is calculated as
-     * follows:<p>
+     * follows:
      *
      * <ul>
      *
      * <li>If there is no entry in this Access Control List for the
-     * specified principal, an empty permission set is returned.<p>
+     * specified principal, an empty permission set is returned.
      *
      * <li>Otherwise, the principal's group permission sets are determined.
      * (A principal can belong to one or more groups, where a group is a
--- a/jdk/src/share/classes/java/security/cert/CertificateFactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertificateFactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -63,7 +63,7 @@
  * supports those methods), so that each call to
  * {@code generateCertificate} consumes only one certificate, and the
  * read position of the input stream is positioned to the next certificate in
- * the file:<p>
+ * the file:
  *
  * <pre>{@code
  * FileInputStream fis = new FileInputStream(filename);
@@ -78,7 +78,7 @@
  * }</pre>
  *
  * <p>The following example parses a PKCS#7-formatted certificate reply stored
- * in a file and extracts all the certificates from it:<p>
+ * in a file and extracts all the certificates from it:
  *
  * <pre>
  * FileInputStream fis = new FileInputStream(filename);
--- a/jdk/src/share/classes/java/security/cert/CertificateRevokedException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/CertificateRevokedException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -129,7 +129,7 @@
     }
 
     /**
-     * Returns the invalidity date, as specifed in the Invalidity Date
+     * Returns the invalidity date, as specified in the Invalidity Date
      * extension of this {@code CertificateRevokedException}. The
      * invalidity date is the date on which it is known or suspected that the
      * private key was compromised or that the certificate otherwise became
--- a/jdk/src/share/classes/java/security/cert/PKIXRevocationChecker.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/PKIXRevocationChecker.java	Wed Jul 05 19:21:26 2017 +0200
@@ -299,7 +299,7 @@
         /**
          * Allow revocation check to succeed if the revocation status cannot be
          * determined for one of the following reasons:
-         * <p><ul>
+         * <ul>
          *  <li>The CRL or OCSP response cannot be obtained because of a
          *      network error.
          *  <li>The OCSP responder returns one of the following errors
--- a/jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java	Wed Jul 05 19:21:26 2017 +0200
@@ -35,7 +35,7 @@
  * structure.
  *
  * <p>The ASN.1 definition is as follows:
- * <p><pre>
+ * <pre>
  *   PolicyQualifierInfo ::= SEQUENCE {
  *        policyQualifierId       PolicyQualifierId,
  *        qualifier               ANY DEFINED BY policyQualifierId }
--- a/jdk/src/share/classes/java/security/cert/TrustAnchor.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/TrustAnchor.java	Wed Jul 05 19:21:26 2017 +0200
@@ -44,7 +44,6 @@
  * individual parameters.
  * <p>
  * <b>Concurrent Access</b>
- * <p>
  * <p>All {@code TrustAnchor} objects must be immutable and
  * thread-safe. That is, multiple threads may concurrently invoke the
  * methods defined in this class on a single {@code TrustAnchor}
--- a/jdk/src/share/classes/java/security/cert/X509CertSelector.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/cert/X509CertSelector.java	Wed Jul 05 19:21:26 2017 +0200
@@ -359,7 +359,7 @@
      * criticality setting, and encapsulating OCTET STRING)
      * for a SubjectKeyIdentifier extension.
      * The ASN.1 notation for this structure follows.
-     * <p>
+     *
      * <pre>{@code
      * SubjectKeyIdentifier ::= KeyIdentifier
      *
@@ -399,7 +399,7 @@
      * criticality setting, and encapsulating OCTET STRING)
      * for an AuthorityKeyIdentifier extension.
      * The ASN.1 notation for this structure follows.
-     * <p>
+     *
      * <pre>{@code
      * AuthorityKeyIdentifier ::= SEQUENCE {
      *    keyIdentifier             [0] KeyIdentifier           OPTIONAL,
--- a/jdk/src/share/classes/java/security/interfaces/DSAKeyPairGenerator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/interfaces/DSAKeyPairGenerator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -43,11 +43,11 @@
  *
  * <li>Get a key pair generator for the DSA algorithm by calling the
  * KeyPairGenerator {@code getInstance} method with "DSA"
- * as its argument.<p>
+ * as its argument.
  *
  * <li>Initialize the generator by casting the result to a DSAKeyPairGenerator
  * and calling one of the
- * {@code initialize} methods from this DSAKeyPairGenerator interface.<p>
+ * {@code initialize} methods from this DSAKeyPairGenerator interface.
  *
  * <li>Generate a key pair by calling the {@code generateKeyPair}
  * method from the KeyPairGenerator class.
--- a/jdk/src/share/classes/java/security/spec/ECFieldF2m.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/security/spec/ECFieldF2m.java	Wed Jul 05 19:21:26 2017 +0200
@@ -64,7 +64,7 @@
      * field which has 2^{@code m} elements with
      * polynomial basis.
      * The reduction polynomial for this field is based
-     * on {@code rp} whose i-th bit correspondes to
+     * on {@code rp} whose i-th bit corresponds to
      * the i-th coefficient of the reduction polynomial.<p>
      * Note: A valid reduction polynomial is either a
      * trinomial (X^{@code m} + X^{@code k} + 1
--- a/jdk/src/share/classes/java/sql/Array.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/Array.java	Wed Jul 05 19:21:26 2017 +0200
@@ -323,7 +323,7 @@
    * element at index <code>index</code>.  The result set has
    * up to <code>count</code> rows in ascending order based on the
    * indices.  Each row has two columns:  The second column stores
-   * the element value; the first column stroes the index into the
+   * the element value; the first column stores the index into the
    * array for that element.
    *
    * @param index the array index of the first element to retrieve;
--- a/jdk/src/share/classes/java/sql/BatchUpdateException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/BatchUpdateException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -143,7 +143,7 @@
    * initialized by a call to the
    * {@link Throwable#initCause(java.lang.Throwable)} method.  The
    * <code>SQLState</code> is initialized to <code>null</code>
-   * and the vender code is initialized to 0.
+   * and the vendor code is initialized to 0.
    * <p>
    * <strong>Note:</strong> There is no validation of {@code updateCounts} for
    * overflow and because of this it is recommended that you use the constructor
--- a/jdk/src/share/classes/java/sql/Blob.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/Blob.java	Wed Jul 05 19:21:26 2017 +0200
@@ -158,7 +158,7 @@
      * in the <code>Blob</code> object starting at the position
      * <code>pos</code>.  If the end of the <code>Blob</code> value is reached
      * while writing the array of bytes, then the length of the <code>Blob</code>
-     * value will be increased to accomodate the extra bytes.
+     * value will be increased to accommodate the extra bytes.
      * <p>
      * <b>Note:</b> If the value specified for <code>pos</code>
      * is greater then the length+1 of the <code>BLOB</code> value then the
@@ -190,7 +190,7 @@
      * in the <code>Blob</code> object starting at the position
      * <code>pos</code>.  If the end of the <code>Blob</code> value is reached
      * while writing the array of bytes, then the length of the <code>Blob</code>
-     * value will be increased to accomodate the extra bytes.
+     * value will be increased to accommodate the extra bytes.
      * <p>
      * <b>Note:</b> If the value specified for <code>pos</code>
      * is greater then the length+1 of the <code>BLOB</code> value then the
@@ -224,7 +224,7 @@
      * in the <code>Blob</code> object starting at the position
      * <code>pos</code>.  If the end of the <code>Blob</code> value is reached
      * while writing to the stream, then the length of the <code>Blob</code>
-     * value will be increased to accomodate the extra bytes.
+     * value will be increased to accommodate the extra bytes.
      * <p>
      * <b>Note:</b> If the value specified for <code>pos</code>
      * is greater then the length+1 of the <code>BLOB</code> value then the
--- a/jdk/src/share/classes/java/sql/CallableStatement.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/CallableStatement.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1900,7 +1900,7 @@
      * @throws SQLException  if parameterName does not correspond to a named
      * parameter; if the length specified
      * is less than zero; if the number of bytes in the inputstream does not match
-     * the specfied length; if a database access error occurs or
+     * the specified length; if a database access error occurs or
      * this method is called on a closed <code>CallableStatement</code>
      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
      * this method
--- a/jdk/src/share/classes/java/sql/Clob.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/Clob.java	Wed Jul 05 19:21:26 2017 +0200
@@ -172,7 +172,7 @@
      * in the <code>Clob</code> object starting at the position
      * <code>pos</code>.  If the end of the <code>Clob</code> value is reached
      * while writing the given string, then the length of the <code>Clob</code>
-     * value will be increased to accomodate the extra characters.
+     * value will be increased to accommodate the extra characters.
      * <p>
      * <b>Note:</b> If the value specified for <code>pos</code>
      * is greater then the length+1 of the <code>CLOB</code> value then the
@@ -202,7 +202,7 @@
      * in the <code>Clob</code> object starting at the position
      * <code>pos</code>.  If the end of the <code>Clob</code> value is reached
      * while writing the given string, then the length of the <code>Clob</code>
-     * value will be increased to accomodate the extra characters.
+     * value will be increased to accommodate the extra characters.
      * <p>
      * <b>Note:</b> If the value specified for <code>pos</code>
      * is greater then the length+1 of the <code>CLOB</code> value then the
@@ -235,7 +235,7 @@
      * in the <code>Clob</code> object starting at the position
      * <code>pos</code>.  If the end of the <code>Clob</code> value is reached
      * while writing characters to the stream, then the length of the <code>Clob</code>
-     * value will be increased to accomodate the extra characters.
+     * value will be increased to accommodate the extra characters.
      * <p>
      * <b>Note:</b> If the value specified for <code>pos</code>
      * is greater then the length+1 of the <code>CLOB</code> value then the
@@ -264,7 +264,7 @@
      * in the <code>Clob</code> object starting at the position
      * <code>pos</code>.  If the end of the <code>Clob</code> value is reached
      * while writing characters to the stream, then the length of the <code>Clob</code>
-     * value will be increased to accomodate the extra characters.
+     * value will be increased to accommodate the extra characters.
      * <p>
      * <b>Note:</b> If the value specified for <code>pos</code>
      * is greater then the length+1 of the <code>CLOB</code> value then the
--- a/jdk/src/share/classes/java/sql/Connection.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/Connection.java	Wed Jul 05 19:21:26 2017 +0200
@@ -242,7 +242,7 @@
      *
      * @exception SQLException if a database access error occurs,
      * this method is called while participating in a distributed transaction,
-     * if this method is called on a closed conection or this
+     * if this method is called on a closed connection or this
      *            <code>Connection</code> object is in auto-commit mode
      * @see #setAutoCommit
      */
--- a/jdk/src/share/classes/java/sql/DataTruncation.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/DataTruncation.java	Wed Jul 05 19:21:26 2017 +0200
@@ -30,7 +30,7 @@
  * (on writes) or reported as a
  * <code>DataTruncation</code> warning (on reads)
  *  when a data values is unexpectedly truncated for reasons other than its having
- *  execeeded <code>MaxFieldSize</code>.
+ *  exceeded <code>MaxFieldSize</code>.
  *
  * <P>The SQLstate for a <code>DataTruncation</code> during read is <code>01004</code>.
  * <P>The SQLstate for a <code>DataTruncation</code> during write is <code>22001</code>.
@@ -107,7 +107,7 @@
      * <P>This may be -1 if the column or parameter index is unknown, in
      * which case the <code>parameter</code> and <code>read</code> fields should be ignored.
      *
-     * @return the index of the truncated paramter or column value
+     * @return the index of the truncated parameter or column value
      */
     public int getIndex() {
         return index;
--- a/jdk/src/share/classes/java/sql/DatabaseMetaData.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/DatabaseMetaData.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1701,7 +1701,7 @@
      * <P>Only privileges matching the column name criteria are
      * returned.  They are ordered by COLUMN_NAME and PRIVILEGE.
      *
-     * <P>Each privilige description has the following columns:
+     * <P>Each privilege description has the following columns:
      *  <OL>
      *  <LI><B>TABLE_CAT</B> String {@code =>} table catalog (may be <code>null</code>)
      *  <LI><B>TABLE_SCHEM</B> String {@code =>} table schema (may be <code>null</code>)
@@ -1747,7 +1747,7 @@
      * <code>TABLE_SCHEM</code>, <code>TABLE_NAME</code>,
      * and <code>PRIVILEGE</code>.
      *
-     * <P>Each privilige description has the following columns:
+     * <P>Each privilege description has the following columns:
      *  <OL>
      *  <LI><B>TABLE_CAT</B> String {@code =>} table catalog (may be <code>null</code>)
      *  <LI><B>TABLE_SCHEM</B> String {@code =>} table schema (may be <code>null</code>)
@@ -3257,7 +3257,7 @@
     boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException;
 
     /**
-     * Retrieves whether a <code>SQLException</code> while autoCommit is <code>true</code> inidcates
+     * Retrieves whether a <code>SQLException</code> while autoCommit is <code>true</code> indicates
      * that all open ResultSets are closed, even ones that are holdable.  When a <code>SQLException</code> occurs while
      * autocommit is <code>true</code>, it is vendor specific whether the JDBC driver responds with a commit operation, a
      * rollback operation, or by doing neither a commit nor a rollback.  A potential result of this difference
--- a/jdk/src/share/classes/java/sql/DriverManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/DriverManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -59,7 +59,7 @@
  * <code>my.sql.Driver</code>
  * </pre>
  *
- * <P>Applications no longer need to explictly load JDBC drivers using <code>Class.forName()</code>. Existing programs
+ * <P>Applications no longer need to explicitly load JDBC drivers using <code>Class.forName()</code>. Existing programs
  * which currently load JDBC drivers using <code>Class.forName()</code> will continue to work without
  * modification.
  *
--- a/jdk/src/share/classes/java/sql/DriverPropertyInfo.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/DriverPropertyInfo.java	Wed Jul 05 19:21:26 2017 +0200
@@ -38,7 +38,7 @@
     /**
      * Constructs a <code>DriverPropertyInfo</code> object with a  given
      * name and value.  The <code>description</code> and <code>choices</code>
-     * are intialized to <code>null</code> and <code>required</code> is initialized
+     * are initialized to <code>null</code> and <code>required</code> is initialized
      * to <code>false</code>.
      *
      * @param name the name of the property
--- a/jdk/src/share/classes/java/sql/PreparedStatement.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/PreparedStatement.java	Wed Jul 05 19:21:26 2017 +0200
@@ -856,7 +856,7 @@
      * this method is called on a closed <code>PreparedStatement</code>;
      *  if the length specified
      * is less than zero or if the number of bytes in the inputstream does not match
-     * the specfied length.
+     * the specified length.
      * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
      *
      * @since 1.6
--- a/jdk/src/share/classes/java/sql/ResultSet.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/ResultSet.java	Wed Jul 05 19:21:26 2017 +0200
@@ -184,7 +184,7 @@
      * <P>The closing of a <code>ResultSet</code> object does <strong>not</strong> close the <code>Blob</code>,
      * <code>Clob</code> or <code>NClob</code> objects created by the <code>ResultSet</code>. <code>Blob</code>,
      * <code>Clob</code> or <code>NClob</code> objects remain valid for at least the duration of the
-     * transaction in which they are creataed, unless their <code>free</code> method is invoked.
+     * transaction in which they are created, unless their <code>free</code> method is invoked.
      *<p>
      * When a <code>ResultSet</code> is closed, any <code>ResultSetMetaData</code>
      * instances that were created by calling the  <code>getMetaData</code>
@@ -2423,7 +2423,7 @@
      * <code>DatabaseMetaData</code> method, this method  may return
      * <code>null</code>.
      *
-     * @return the <code>Statment</code> object that produced
+     * @return the <code>Statement</code> object that produced
      * this <code>ResultSet</code> object or <code>null</code>
      * if the result set was produced some other way
      * @exception SQLException if a database access error occurs
@@ -2749,7 +2749,7 @@
 
     /**
      * The constant indicating that open <code>ResultSet</code> objects with this
-     * holdability will remain open when the current transaction is commited.
+     * holdability will remain open when the current transaction is committed.
      *
      * @since 1.4
      */
@@ -2757,7 +2757,7 @@
 
     /**
      * The constant indicating that open <code>ResultSet</code> objects with this
-     * holdability will be closed when the current transaction is commited.
+     * holdability will be closed when the current transaction is committed.
      *
      * @since 1.4
      */
--- a/jdk/src/share/classes/java/sql/SQLException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -107,7 +107,7 @@
     /**
      *  Constructs a <code>SQLException</code> object with a given
      * <code>reason</code>. The  <code>SQLState</code>  is initialized to
-     * <code>null</code> and the vender code is initialized to 0.
+     * <code>null</code> and the vendor code is initialized to 0.
      *
      * The <code>cause</code> is not initialized, and may subsequently be
      * initialized by a call to the
--- a/jdk/src/share/classes/java/sql/SQLFeatureNotSupportedException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLFeatureNotSupportedException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -60,7 +60,7 @@
         /**
          * Constructs a <code>SQLFeatureNotSupportedException</code> object
          * with a given <code>reason</code>. The <code>SQLState</code>
-         * is initialized to <code>null</code> and the vender code is initialized
+         * is initialized to <code>null</code> and the vendor code is initialized
          * to 0.
          *
          * The <code>cause</code> is not initialized, and may subsequently be
@@ -118,7 +118,7 @@
      * <code>cause==null</code> or to <code>cause.toString()</code> if
      * <code>cause!=null</code>.
      * <p>
-     * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval bythe <code>getCause()</code> method); may be null indicating
+     * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
      *     the cause is non-existent or unknown.
      * @since 1.6
      */
--- a/jdk/src/share/classes/java/sql/SQLIntegrityConstraintViolationException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLIntegrityConstraintViolationException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -55,7 +55,7 @@
         /**
          * Constructs a <code>SQLIntegrityConstraintViolationException</code>
          *  with a given <code>reason</code>. The <code>SQLState</code>
-         * is initialized to <code>null</code> and the vender code is initialized
+         * is initialized to <code>null</code> and the vendor code is initialized
          * to 0.
          *
          * The <code>cause</code> is not initialized, and may subsequently be
--- a/jdk/src/share/classes/java/sql/SQLInvalidAuthorizationSpecException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLInvalidAuthorizationSpecException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -55,7 +55,7 @@
         /**
          * Constructs a <code>SQLInvalidAuthorizationSpecException</code> object
          *  with a given <code>reason</code>. The <code>SQLState</code>
-         * is initialized to <code>null</code> and the vender code is initialized
+         * is initialized to <code>null</code> and the vendor code is initialized
          * to 0.
          *
          * The <code>cause</code> is not initialized, and may subsequently be
--- a/jdk/src/share/classes/java/sql/SQLNonTransientConnectionException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLNonTransientConnectionException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -56,7 +56,7 @@
         /**
          * Constructs a <code>SQLNonTransientConnectionException</code> object
          *  with a given <code>reason</code>. The <code>SQLState</code>
-         * is initialized to <code>null</code> and the vender code is initialized
+         * is initialized to <code>null</code> and the vendor code is initialized
          * to 0.
          *
          * The <code>cause</code> is not initialized, and may subsequently be
--- a/jdk/src/share/classes/java/sql/SQLNonTransientException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLNonTransientException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -54,7 +54,7 @@
         /**
          * Constructs a <code>SQLNonTransientException</code> object
          * with a given <code>reason</code>. The <code>SQLState</code>
-         * is initialized to <code>null</code> and the vender code is initialized
+         * is initialized to <code>null</code> and the vendor code is initialized
          * to 0.
          *
          * The <code>cause</code> is not initialized, and may subsequently be
--- a/jdk/src/share/classes/java/sql/SQLRecoverableException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLRecoverableException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -56,7 +56,7 @@
         /**
          * Constructs a <code>SQLRecoverableException</code> object
          *  with a given <code>reason</code>. The <code>SQLState</code>
-         * is initialized to <code>null</code> and the vender code is initialized
+         * is initialized to <code>null</code> and the vendor code is initialized
          * to 0.
          *
          * The <code>cause</code> is not initialized, and may subsequently be
--- a/jdk/src/share/classes/java/sql/SQLSyntaxErrorException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLSyntaxErrorException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -54,7 +54,7 @@
         /**
          * Constructs a <code>SQLSyntaxErrorException</code> object
          * with a given <code>reason</code>. The <code>SQLState</code>
-         * is initialized to <code>null</code> and the vender code is initialized
+         * is initialized to <code>null</code> and the vendor code is initialized
          * to 0.
          *
          * The <code>cause</code> is not initialized, and may subsequently be
@@ -112,7 +112,7 @@
      * <code>cause==null</code> or to <code>cause.toString()</code> if
      * <code>cause!=null</code>.
      * <p>
-     * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval bythe <code>getCause()</code> method); may be null indicating
+     * @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
      *     the cause is non-existent or unknown.
      * @since 1.6
      */
--- a/jdk/src/share/classes/java/sql/SQLTimeoutException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLTimeoutException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -54,7 +54,7 @@
         /**
          * Constructs a <code>SQLTimeoutException</code> object
          * with a given <code>reason</code>. The <code>SQLState</code>
-         * is initialized to <code>null</code> and the vender code is initialized
+         * is initialized to <code>null</code> and the vendor code is initialized
          * to 0.
          *
          * The <code>cause</code> is not initialized, and may subsequently be
--- a/jdk/src/share/classes/java/sql/SQLTransactionRollbackException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLTransactionRollbackException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -54,7 +54,7 @@
         /**
          * Constructs a <code>SQLTransactionRollbackException</code> object
          * with a given <code>reason</code>. The <code>SQLState</code>
-         * is initialized to <code>null</code> and the vender code is initialized
+         * is initialized to <code>null</code> and the vendor code is initialized
          * to 0.
          *
          * The <code>cause</code> is not initialized, and may subsequently be
--- a/jdk/src/share/classes/java/sql/SQLTransientConnectionException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLTransientConnectionException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -55,7 +55,7 @@
         /**
          * Constructs a <code>SQLTransientConnectionException</code> object
          * with a given <code>reason</code>. The <code>SQLState</code>
-         * is initialized to <code>null</code> and the vender code is initialized
+         * is initialized to <code>null</code> and the vendor code is initialized
          * to 0.
          *
          * The <code>cause</code> is not initialized, and may subsequently be
--- a/jdk/src/share/classes/java/sql/SQLTransientException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLTransientException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -27,7 +27,7 @@
 
 /**
  * The subclass of {@link SQLException} is thrown in situations where a
- * previoulsy failed operation might be able to succeed when the operation is
+ * previously failed operation might be able to succeed when the operation is
  * retried without any intervention by application-level functionality.
  *<p>
  *
@@ -53,7 +53,7 @@
         /**
          * Constructs a <code>SQLTransientException</code> object
          *  with a given <code>reason</code>. The <code>SQLState</code>
-         * is initialized to <code>null</code> and the vender code is initialized
+         * is initialized to <code>null</code> and the vendor code is initialized
          * to 0.
          *
          * The <code>cause</code> is not initialized, and may subsequently be
--- a/jdk/src/share/classes/java/sql/SQLWarning.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLWarning.java	Wed Jul 05 19:21:26 2017 +0200
@@ -86,7 +86,7 @@
     /**
      * Constructs a <code>SQLWarning</code> object
      * with a given <code>reason</code>. The <code>SQLState</code>
-     * is initialized to <code>null</code> and the vender code is initialized
+     * is initialized to <code>null</code> and the vendor code is initialized
      * to 0.
      *
      * The <code>cause</code> is not initialized, and may subsequently be
--- a/jdk/src/share/classes/java/sql/SQLXML.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/SQLXML.java	Wed Jul 05 19:21:26 2017 +0200
@@ -362,7 +362,7 @@
    *
    * @param <T> the type of the class modeled by this Class object
    * @param sourceClass The class of the source, or null.
-   * If the class is null, a vendor specifc Source implementation will be returned.
+   * If the class is null, a vendor specific Source implementation will be returned.
    * The following classes are supported at a minimum:
    * <pre>
    *   javax.xml.transform.dom.DOMSource - returns a DOMSource
--- a/jdk/src/share/classes/java/sql/Statement.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/Statement.java	Wed Jul 05 19:21:26 2017 +0200
@@ -34,8 +34,8 @@
  * <code>ResultSet</code> object is interleaved
  * with the reading of another, each must have been generated by
  * different <code>Statement</code> objects. All execution methods in the
- * <code>Statement</code> interface implicitly close a statment's current
- * <code>ResultSet</code> object if an open one exists.
+ * <code>Statement</code> interface implicitly close a current
+ * <code>ResultSet</code> object of the statement if an open one exists.
  *
  * @see Connection#createStatement
  * @see ResultSet
@@ -445,7 +445,7 @@
     /**
      * Gives the JDBC driver a hint as to the number of rows that should
      * be fetched from the database when more rows are needed for
-     * <code>ResultSet</code> objects genrated by this <code>Statement</code>.
+     * <code>ResultSet</code> objects generated by this <code>Statement</code>.
      * If the value specified is zero, then the hint is ignored.
      * The default value is zero.
      *
@@ -501,7 +501,7 @@
     int getResultSetType()  throws SQLException;
 
     /**
-     * Adds the given SQL command to the current list of commmands for this
+     * Adds the given SQL command to the current list of commands for this
      * <code>Statement</code> object. The commands in this list can be
      * executed as a batch by calling the method <code>executeBatch</code>.
      * <P>
@@ -567,8 +567,8 @@
      * <P>
      * The possible implementations and return values have been modified in
      * the Java 2 SDK, Standard Edition, version 1.3 to
-     * accommodate the option of continuing to proccess commands in a batch
-     * update after a <code>BatchUpdateException</code> obejct has been thrown.
+     * accommodate the option of continuing to process commands in a batch
+     * update after a <code>BatchUpdateException</code> object has been thrown.
      *
      * @return an array of update counts containing one element for each
      * command in the batch.  The elements of the array are ordered according
@@ -635,7 +635,7 @@
     int SUCCESS_NO_INFO = -2;
 
     /**
-     * The constant indicating that an error occured while executing a
+     * The constant indicating that an error occurred while executing a
      * batch statement.
      *
      * @since 1.4
--- a/jdk/src/share/classes/java/sql/Struct.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/Struct.java	Wed Jul 05 19:21:26 2017 +0200
@@ -81,7 +81,7 @@
   /**
    * Produces the ordered values of the attributes of the SQL
    * structured type that this <code>Struct</code> object represents.
-   *  As individual attrbutes are proccessed, this method uses the given type map
+   *  As individual attributes are processed, this method uses the given type map
    * for customizations of the type mappings.
    * If there is no
    * entry in the given type map that matches the structured
--- a/jdk/src/share/classes/java/sql/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/sql/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -221,7 +221,7 @@
  <lI>SQLException enhancements -- Added support for cause chaining; New SQLExceptions
  added for common SQLState class value codes
  <li>Enhanced Blob/Clob functionality -- Support provided to create and free a Blob/Clob instance
- as well as additional methods added to improve accessiblity
+ as well as additional methods added to improve accessibility
  <li>Support added for accessing a SQL ROWID
  <li>Support added to allow a JDBC application to access an instance of a JDBC resource
  that has been wrapped by a vendor, usually in an application server or connection 
--- a/jdk/src/share/classes/java/text/BreakIterator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/text/BreakIterator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -338,7 +338,7 @@
      * Otherwise, the iterator's current position is set to the returned boundary.
      * The value returned is always less than the offset or the value
      * <code>BreakIterator.DONE</code>.
-     * @param offset the characater offset to begin scanning.
+     * @param offset the character offset to begin scanning.
      * @return The last boundary before the specified offset or
      * <code>BreakIterator.DONE</code> if the first text boundary is passed in
      * as the offset.
--- a/jdk/src/share/classes/java/text/ChoiceFormat.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/text/ChoiceFormat.java	Wed Jul 05 19:21:26 2017 +0200
@@ -409,7 +409,7 @@
      * @param status an input-output parameter.  On input, the
      * status.index field indicates the first character of the
      * source text that should be parsed.  On exit, if no error
-     * occured, status.index is set to the first unparsed character
+     * occurred, status.index is set to the first unparsed character
      * in the source text.  On exit, if an error did occur,
      * status.index is unchanged and status.errorIndex is set to the
      * first index of the character that caused the parse to fail.
--- a/jdk/src/share/classes/java/text/DigitList.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/text/DigitList.java	Wed Jul 05 19:21:26 2017 +0200
@@ -483,7 +483,7 @@
              *
              *   This has to be considered only if digit at maximumDigits index
              *   is exactly the last one in the set of digits, otherwise there are
-             *   remaining digits after that position and we dont have to consider
+             *   remaining digits after that position and we don't have to consider
              *   what FloatingDecimal did.
              *
              * - Other rounding modes are not impacted by these tie cases.
@@ -570,7 +570,7 @@
                             return false;
 
                         if (!allDecimalDigits)
-                            // Otherwise if the digits dont represent exact value,
+                            // Otherwise if the digits don't represent exact value,
                             // value was above tie and FloatingDecimal truncated
                             // digits to tie. We must round up.
                             return true;
--- a/jdk/src/share/classes/java/text/FieldPosition.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/text/FieldPosition.java	Wed Jul 05 19:21:26 2017 +0200
@@ -136,7 +136,7 @@
      * constant, <code>fieldID</code> should be -1.
      *
      * @param attribute Format.Field constant identifying a field
-     * @param fieldID integer constantce identifying a field
+     * @param fieldID integer constant identifying a field
      * @since 1.4
      */
     public FieldPosition(Format.Field attribute, int fieldID) {
--- a/jdk/src/share/classes/java/text/Format.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/text/Format.java	Wed Jul 05 19:21:26 2017 +0200
@@ -281,7 +281,7 @@
     }
 
     /**
-     * Creates an <code>AttributedCharacterIterator</code> containg the
+     * Creates an <code>AttributedCharacterIterator</code> containing the
      * concatenated contents of the passed in
      * <code>AttributedCharacterIterator</code>s.
      *
--- a/jdk/src/share/classes/java/text/MessageFormat.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/text/MessageFormat.java	Wed Jul 05 19:21:26 2017 +0200
@@ -125,7 +125,6 @@
  * valid patterns, but <code>"ab {0'}' de"</code>, <code>"ab } de"</code>
  * and <code>"''{''"</code> are not.
  *
- * <p>
  * <dl><dt><b>Warning:</b><dd>The rules for using quotes within message
  * format patterns unfortunately have shown to be somewhat confusing.
  * In particular, it isn't always obvious to localizers whether single
@@ -146,7 +145,7 @@
  * table shows how the values map to {@code Format} instances. Combinations not
  * shown in the table are illegal. A <i>SubformatPattern</i> must
  * be a valid pattern string for the {@code Format} subclass used.
- * <p>
+ *
  * <table border=1 summary="Shows how FormatType and FormatStyle values map to Format instances">
  *    <tr>
  *       <th id="ft" class="TableHeadingColor">FormatType
@@ -215,7 +214,6 @@
  *       <td headers="fs"><i>SubformatPattern</i>
  *       <td headers="sc">{@code new} {@link ChoiceFormat#ChoiceFormat(String) ChoiceFormat}{@code (subformatPattern)}
  * </table>
- * <p>
  *
  * <h4>Usage Information</h4>
  *
@@ -761,7 +759,7 @@
      * as indicated by the first matching line of the following table. An
      * argument is <i>unavailable</i> if <code>arguments</code> is
      * <code>null</code> or has fewer than argumentIndex+1 elements.
-     * <p>
+     *
      * <table border=1 summary="Examples of subformat,argument,and formatted text">
      *    <tr>
      *       <th>Subformat
--- a/jdk/src/share/classes/java/text/Normalizer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/text/Normalizer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -53,12 +53,12 @@
  * several different ways in Unicode.  For example, take the character A-acute.
  * In Unicode, this can be encoded as a single character (the "composed" form):
  *
- * <p><pre>
+ * <pre>
  *      U+00C1    LATIN CAPITAL LETTER A WITH ACUTE</pre>
  *
  * or as two separate characters (the "decomposed" form):
  *
- * <p><pre>
+ * <pre>
  *      U+0041    LATIN CAPITAL LETTER A
  *      U+0301    COMBINING ACUTE ACCENT</pre>
  *
@@ -72,14 +72,14 @@
  * <p>
  * Similarly, the string "ffi" can be encoded as three separate letters:
  *
- * <p><pre>
+ * <pre>
  *      U+0066    LATIN SMALL LETTER F
  *      U+0066    LATIN SMALL LETTER F
  *      U+0069    LATIN SMALL LETTER I</pre>
  *
  * or as the single character
  *
- * <p><pre>
+ * <pre>
  *      U+FB03    LATIN SMALL LIGATURE FFI</pre>
  *
  * The ffi ligature is not a distinct semantic character, and strictly speaking
--- a/jdk/src/share/classes/java/text/RuleBasedCollator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/text/RuleBasedCollator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -671,7 +671,7 @@
         if (tables.isFrenchSec())
         {
             if (preSecIgnore < secResult.length()) {
-                // If we've accumlated any secondary characters after the last base character,
+                // If we've accumulated any secondary characters after the last base character,
                 // reverse them.
                 RBCollationTables.reverse(secResult, preSecIgnore, secResult.length());
             }
--- a/jdk/src/share/classes/java/text/SimpleDateFormat.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/text/SimpleDateFormat.java	Wed Jul 05 19:21:26 2017 +0200
@@ -356,7 +356,6 @@
  * may be replaced with other, locale dependent, pattern letters.
  * <code>SimpleDateFormat</code> does not deal with the localization of text
  * other than the pattern letters; that's up to the client of the class.
- * <p>
  *
  * <h4>Examples</h4>
  *
--- a/jdk/src/share/classes/java/time/Duration.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/Duration.java	Wed Jul 05 19:21:26 2017 +0200
@@ -141,7 +141,7 @@
     /**
      * The pattern for parsing.
      */
-    private final static Pattern PATTERN =
+    private static final Pattern PATTERN =
             Pattern.compile("([-+]?)P(?:([-+]?[0-9]+)D)?" +
                     "(T(?:([-+]?[0-9]+)H)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)(?:[.,]([0-9]{0,9}))?S)?)?",
                     Pattern.CASE_INSENSITIVE);
@@ -554,7 +554,7 @@
      * the simple initialization in Duration.
      */
     private static class DurationUnits {
-        final static List<TemporalUnit> UNITS =
+        static final List<TemporalUnit> UNITS =
                 Collections.unmodifiableList(Arrays.<TemporalUnit>asList(SECONDS, NANOS));
     }
 
--- a/jdk/src/share/classes/java/time/OffsetDateTime.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/OffsetDateTime.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1903,9 +1903,9 @@
      * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
      * @serialData
      * <pre>
-     *  out.writeByte(10);  // identifies a OffsetDateTime
-     *  out.writeObject(dateTime);
-     *  out.writeObject(offset);
+     *  out.writeByte(10);  // identifies an OffsetDateTime
+     *  // the <a href="../../serialized-form.html#java.time.LocalDateTime">datetime</a> excluding the one byte header
+     *  // the <a href="../../serialized-form.html#java.time.ZoneOffset">offset</a> excluding the one byte header
      * </pre>
      *
      * @return the instance of {@code Ser}, not null
@@ -1924,13 +1924,13 @@
     }
 
     void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(dateTime);
-        out.writeObject(offset);
+        dateTime.writeExternal(out);
+        offset.writeExternal(out);
     }
 
     static OffsetDateTime readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        LocalDateTime dateTime = (LocalDateTime) in.readObject();
-        ZoneOffset offset = (ZoneOffset) in.readObject();
+        LocalDateTime dateTime = LocalDateTime.readExternal(in);
+        ZoneOffset offset = ZoneOffset.readExternal(in);
         return OffsetDateTime.of(dateTime, offset);
     }
 
--- a/jdk/src/share/classes/java/time/OffsetTime.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/OffsetTime.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1374,9 +1374,9 @@
      * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
      * @serialData
      * <pre>
-     *  out.writeByte(9);  // identifies a OffsetTime
-     *  out.writeObject(time);
-     *  out.writeObject(offset);
+     *  out.writeByte(9);  // identifies an OffsetTime
+     *  // the <a href="../../serialized-form.html#java.time.LocalTime">time</a> excluding the one byte header
+     *  // the <a href="../../serialized-form.html#java.time.ZoneOffset">offset</a> excluding the one byte header
      * </pre>
      *
      * @return the instance of {@code Ser}, not null
@@ -1395,13 +1395,13 @@
     }
 
     void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(time);
-        out.writeObject(offset);
+        time.writeExternal(out);
+        offset.writeExternal(out);
     }
 
     static OffsetTime readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        LocalTime time = (LocalTime) in.readObject();
-        ZoneOffset offset = (ZoneOffset) in.readObject();
+        LocalTime time = LocalTime.readExternal(in);
+        ZoneOffset offset = ZoneOffset.readExternal(in);
         return OffsetTime.of(time, offset);
     }
 
--- a/jdk/src/share/classes/java/time/Period.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/Period.java	Wed Jul 05 19:21:26 2017 +0200
@@ -138,13 +138,13 @@
     /**
      * The pattern for parsing.
      */
-    private final static Pattern PATTERN =
+    private static final Pattern PATTERN =
             Pattern.compile("([-+]?)P(?:([-+]?[0-9]+)Y)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)W)?(?:([-+]?[0-9]+)D)?", Pattern.CASE_INSENSITIVE);
 
     /**
      * The set of supported units.
      */
-    private final static List<TemporalUnit> SUPPORTED_UNITS =
+    private static final List<TemporalUnit> SUPPORTED_UNITS =
             Collections.unmodifiableList(Arrays.<TemporalUnit>asList(YEARS, MONTHS, DAYS));
 
     /**
--- a/jdk/src/share/classes/java/time/ZoneId.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/ZoneId.java	Wed Jul 05 19:21:26 2017 +0200
@@ -169,60 +169,15 @@
 public abstract class ZoneId implements Serializable {
 
     /**
-     * A map of zone overrides to enable the older short time-zone names to be used.
-     * <p>
-     * Use of short zone IDs has been deprecated in {@code java.util.TimeZone}.
-     * This map allows the IDs to continue to be used via the
-     * {@link #of(String, Map)} factory method.
-     * <p>
-     * This map contains an older mapping of the IDs, where 'EST', 'MST' and 'HST'
-     * map to IDs which include daylight savings.
-     * This is in line with versions of TZDB before 2005r.
-     * <p>
-     * This maps as follows:
-     * <ul>
-     * <li>EST - America/New_York</li>
-     * <li>MST - America/Denver</li>
-     * <li>HST - Pacific/Honolulu</li>
-     * <li>ACT - Australia/Darwin</li>
-     * <li>AET - Australia/Sydney</li>
-     * <li>AGT - America/Argentina/Buenos_Aires</li>
-     * <li>ART - Africa/Cairo</li>
-     * <li>AST - America/Anchorage</li>
-     * <li>BET - America/Sao_Paulo</li>
-     * <li>BST - Asia/Dhaka</li>
-     * <li>CAT - Africa/Harare</li>
-     * <li>CNT - America/St_Johns</li>
-     * <li>CST - America/Chicago</li>
-     * <li>CTT - Asia/Shanghai</li>
-     * <li>EAT - Africa/Addis_Ababa</li>
-     * <li>ECT - Europe/Paris</li>
-     * <li>IET - America/Indiana/Indianapolis</li>
-     * <li>IST - Asia/Kolkata</li>
-     * <li>JST - Asia/Tokyo</li>
-     * <li>MIT - Pacific/Apia</li>
-     * <li>NET - Asia/Yerevan</li>
-     * <li>NST - Pacific/Auckland</li>
-     * <li>PLT - Asia/Karachi</li>
-     * <li>PNT - America/Phoenix</li>
-     * <li>PRT - America/Puerto_Rico</li>
-     * <li>PST - America/Los_Angeles</li>
-     * <li>SST - Pacific/Guadalcanal</li>
-     * <li>VST - Asia/Ho_Chi_Minh</li>
-     * </ul>
-     * The map is unmodifiable.
-     */
-    public static final Map<String, String> OLD_SHORT_IDS;
-    /**
      * A map of zone overrides to enable the short time-zone names to be used.
      * <p>
      * Use of short zone IDs has been deprecated in {@code java.util.TimeZone}.
      * This map allows the IDs to continue to be used via the
      * {@link #of(String, Map)} factory method.
      * <p>
-     * This map contains a newer mapping of the IDs, where 'EST', 'MST' and 'HST'
-     * map to IDs which do not include daylight savings
-     * This is in line with TZDB 2005r and later.
+     * This map contains a mapping of the IDs that is in line with TZDB 2005r and
+     * later, where 'EST', 'MST' and 'HST' map to IDs which do not include daylight
+     * savings.
      * <p>
      * This maps as follows:
      * <ul>
@@ -259,42 +214,36 @@
      */
     public static final Map<String, String> SHORT_IDS;
     static {
-        Map<String, String> base = new HashMap<>();
-        base.put("ACT", "Australia/Darwin");
-        base.put("AET", "Australia/Sydney");
-        base.put("AGT", "America/Argentina/Buenos_Aires");
-        base.put("ART", "Africa/Cairo");
-        base.put("AST", "America/Anchorage");
-        base.put("BET", "America/Sao_Paulo");
-        base.put("BST", "Asia/Dhaka");
-        base.put("CAT", "Africa/Harare");
-        base.put("CNT", "America/St_Johns");
-        base.put("CST", "America/Chicago");
-        base.put("CTT", "Asia/Shanghai");
-        base.put("EAT", "Africa/Addis_Ababa");
-        base.put("ECT", "Europe/Paris");
-        base.put("IET", "America/Indiana/Indianapolis");
-        base.put("IST", "Asia/Kolkata");
-        base.put("JST", "Asia/Tokyo");
-        base.put("MIT", "Pacific/Apia");
-        base.put("NET", "Asia/Yerevan");
-        base.put("NST", "Pacific/Auckland");
-        base.put("PLT", "Asia/Karachi");
-        base.put("PNT", "America/Phoenix");
-        base.put("PRT", "America/Puerto_Rico");
-        base.put("PST", "America/Los_Angeles");
-        base.put("SST", "Pacific/Guadalcanal");
-        base.put("VST", "Asia/Ho_Chi_Minh");
-        Map<String, String> pre = new HashMap<>(base);
-        pre.put("EST", "America/New_York");
-        pre.put("MST", "America/Denver");
-        pre.put("HST", "Pacific/Honolulu");
-        OLD_SHORT_IDS = Collections.unmodifiableMap(pre);
-        Map<String, String> post = new HashMap<>(base);
-        post.put("EST", "-05:00");
-        post.put("MST", "-07:00");
-        post.put("HST", "-10:00");
-        SHORT_IDS = Collections.unmodifiableMap(post);
+        Map<String, String> map = new HashMap<>(64);
+        map.put("ACT", "Australia/Darwin");
+        map.put("AET", "Australia/Sydney");
+        map.put("AGT", "America/Argentina/Buenos_Aires");
+        map.put("ART", "Africa/Cairo");
+        map.put("AST", "America/Anchorage");
+        map.put("BET", "America/Sao_Paulo");
+        map.put("BST", "Asia/Dhaka");
+        map.put("CAT", "Africa/Harare");
+        map.put("CNT", "America/St_Johns");
+        map.put("CST", "America/Chicago");
+        map.put("CTT", "Asia/Shanghai");
+        map.put("EAT", "Africa/Addis_Ababa");
+        map.put("ECT", "Europe/Paris");
+        map.put("IET", "America/Indiana/Indianapolis");
+        map.put("IST", "Asia/Kolkata");
+        map.put("JST", "Asia/Tokyo");
+        map.put("MIT", "Pacific/Apia");
+        map.put("NET", "Asia/Yerevan");
+        map.put("NST", "Pacific/Auckland");
+        map.put("PLT", "Asia/Karachi");
+        map.put("PNT", "America/Phoenix");
+        map.put("PRT", "America/Puerto_Rico");
+        map.put("PST", "America/Los_Angeles");
+        map.put("SST", "Pacific/Guadalcanal");
+        map.put("VST", "Asia/Ho_Chi_Minh");
+        map.put("EST", "-05:00");
+        map.put("MST", "-07:00");
+        map.put("HST", "-10:00");
+        SHORT_IDS = Collections.unmodifiableMap(map);
     }
     /**
      * Serialization version.
@@ -314,7 +263,7 @@
      * @throws ZoneRulesException if the converted zone region ID cannot be found
      */
     public static ZoneId systemDefault() {
-        return ZoneId.of(TimeZone.getDefault().getID(), SHORT_IDS);
+        return TimeZone.getDefault().toZoneId();
     }
 
     /**
--- a/jdk/src/share/classes/java/time/chrono/ChronoPeriodImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/chrono/ChronoPeriodImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -104,7 +104,7 @@
     /**
      * The set of supported units.
      */
-    private final static List<TemporalUnit> SUPPORTED_UNITS =
+    private static final List<TemporalUnit> SUPPORTED_UNITS =
             Collections.unmodifiableList(Arrays.<TemporalUnit>asList(YEARS, MONTHS, DAYS));
 
     /**
--- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java	Wed Jul 05 19:21:26 2017 +0200
@@ -158,7 +158,7 @@
      * This method matches the signature of the functional interface {@link TemporalQuery}
      * allowing it to be used as a query via method reference, {@code ChronoZonedDateTime::from}.
      *
-     * @param temporal  the temporal objec t to convert, not null
+     * @param temporal  the temporal object to convert, not null
      * @return the date-time, not null
      * @throws DateTimeException if unable to convert to a {@code ChronoZonedDateTime}
      * @see Chronology#zonedDateTime(TemporalAccessor)
--- a/jdk/src/share/classes/java/time/chrono/JapaneseDate.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/chrono/JapaneseDate.java	Wed Jul 05 19:21:26 2017 +0200
@@ -140,7 +140,7 @@
     /**
      * The first day supported by the JapaneseChronology is Meiji 6, January 1st.
      */
-    final static LocalDate MEIJI_6_ISODATE = LocalDate.of(1873, 1, 1);
+    static final LocalDate MEIJI_6_ISODATE = LocalDate.of(1873, 1, 1);
 
     //-----------------------------------------------------------------------
     /**
--- a/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java	Wed Jul 05 19:21:26 2017 +0200
@@ -557,12 +557,13 @@
      * a two digit year parse will be in the range 1950-01-01 to 2049-12-31.
      * Only the year would be extracted from the date, thus a base date of
      * 1950-08-25 would also parse to the range 1950-01-01 to 2049-12-31.
-     * This behaviour is necessary to support fields such as week-based-year
+     * This behavior is necessary to support fields such as week-based-year
      * or other calendar systems where the parsed value does not align with
      * standard ISO years.
      * <p>
      * The exact behavior is as follows. Parse the full set of fields and
-     * determine the effective chronology. Then convert the base date to the
+     * determine the effective chronology using the last chronology if
+     * it appears more than once. Then convert the base date to the
      * effective chronology. Then extract the specified field from the
      * chronology-specific base date and use it to determine the
      * {@code baseValue} used below.
@@ -2809,9 +2810,19 @@
         int setValue(DateTimeParseContext context, long value, int errorPos, int successPos) {
             int baseValue = this.baseValue;
             if (baseDate != null) {
-                // TODO: effective chrono is inaccurate at this point
                 Chronology chrono = context.getEffectiveChronology();
                 baseValue = chrono.date(baseDate).get(field);
+
+                // In case the Chronology is changed later, add a callback when/if it changes
+                final long initialValue = value;
+                context.addChronoChangedListener(
+                        (_unused) ->  {
+                            /* Repeat the set of the field using the current Chronology
+                             * The success/error position is ignored because the value is
+                             * intentionally being overwritten.
+                             */
+                            setValue(context, initialValue, errorPos, successPos);
+                        });
             }
             int parseLen = successPos - errorPos;
             if (parseLen == minWidth && value >= 0) {
--- a/jdk/src/share/classes/java/time/format/DateTimeParseContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/format/DateTimeParseContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -61,7 +61,6 @@
  */
 package java.time.format;
 
-import java.time.Duration;
 import java.time.ZoneId;
 import java.time.chrono.Chronology;
 import java.time.chrono.IsoChronology;
@@ -69,6 +68,7 @@
 import java.util.ArrayList;
 import java.util.Locale;
 import java.util.Objects;
+import java.util.function.Consumer;
 
 /**
  * Context object used during date and time parsing.
@@ -105,6 +105,10 @@
      * The list of parsed data.
      */
     private final ArrayList<Parsed> parsed = new ArrayList<>();
+    /**
+     * List of Consumers<Chronology> to be notified if the Chronology changes.
+     */
+    private ArrayList<Consumer<Chronology>> chronoListeners = null;
 
     /**
      * Creates a new instance of the context.
@@ -354,12 +358,36 @@
      * <p>
      * This stores the chronology that has been parsed.
      * No validation is performed other than ensuring it is not null.
+     * <p>
+     * The list of listeners is copied and cleared so that each
+     * listener is called only once.  A listener can add itself again
+     * if it needs to be notified of future changes.
      *
      * @param chrono  the parsed chronology, not null
      */
     void setParsed(Chronology chrono) {
         Objects.requireNonNull(chrono, "chrono");
         currentParsed().chrono = chrono;
+        if (chronoListeners != null && !chronoListeners.isEmpty()) {
+            Consumer[] tmp = new Consumer[1];
+            Consumer<Chronology>[] listeners = chronoListeners.toArray(tmp);
+            chronoListeners.clear();
+            for (Consumer<Chronology> l : listeners) {
+                l.accept(chrono);
+            }
+        }
+    }
+
+    /**
+     * Adds a Consumer<Chronology> to the list of listeners to be notified
+     * if the Chronology changes.
+     * @param listener a Consumer<Chronology> to be called when Chronology changes
+     */
+    void addChronoChangedListener(Consumer<Chronology> listener) {
+        if (chronoListeners == null) {
+            chronoListeners = new ArrayList<Consumer<Chronology>>();
+        }
+        chronoListeners.add(listener);
     }
 
     /**
--- a/jdk/src/share/classes/java/time/temporal/TemporalQueries.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/temporal/TemporalQueries.java	Wed Jul 05 19:21:26 2017 +0200
@@ -341,34 +341,23 @@
     /**
      * A strict query for the {@code ZoneId}.
      */
-    static final TemporalQuery<ZoneId> ZONE_ID = (temporal) -> {
-        return temporal.query(ZONE_ID);
-    };
+    static final TemporalQuery<ZoneId> ZONE_ID = (temporal) ->
+        temporal.query(TemporalQueries.ZONE_ID);
 
     /**
      * A query for the {@code Chronology}.
      */
-    static final TemporalQuery<Chronology> CHRONO = (temporal) -> {
-        return temporal.query(CHRONO);
-    };
+    static final TemporalQuery<Chronology> CHRONO = (temporal) ->
+        temporal.query(TemporalQueries.CHRONO);
 
     /**
      * A query for the smallest supported unit.
      */
-    static final TemporalQuery<TemporalUnit> PRECISION = (temporal) -> {
-        return temporal.query(PRECISION);
-    };
+    static final TemporalQuery<TemporalUnit> PRECISION = (temporal) ->
+        temporal.query(TemporalQueries.PRECISION);
 
     //-----------------------------------------------------------------------
     /**
-     * A lenient query for the {@code ZoneId}, falling back to the {@code ZoneOffset}.
-     */
-    static final TemporalQuery<ZoneId> ZONE = (temporal) -> {
-        ZoneId zone = temporal.query(ZONE_ID);
-        return (zone != null ? zone : temporal.query(OFFSET));
-    };
-
-    /**
      * A query for {@code ZoneOffset} returning null if not found.
      */
     static final TemporalQuery<ZoneOffset> OFFSET = (temporal) -> {
@@ -379,6 +368,14 @@
     };
 
     /**
+     * A lenient query for the {@code ZoneId}, falling back to the {@code ZoneOffset}.
+     */
+    static final TemporalQuery<ZoneId> ZONE = (temporal) -> {
+        ZoneId zone = temporal.query(ZONE_ID);
+        return (zone != null ? zone : temporal.query(OFFSET));
+    };
+
+    /**
      * A query for {@code LocalDate} returning null if not found.
      */
     static final TemporalQuery<LocalDate> LOCAL_DATE = (temporal) -> {
--- a/jdk/src/share/classes/java/time/temporal/WeekFields.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/temporal/WeekFields.java	Wed Jul 05 19:21:26 2017 +0200
@@ -245,15 +245,15 @@
     /**
      * The field used to access the computed DayOfWeek.
      */
-    private transient final TemporalField dayOfWeek = ComputedDayOfField.ofDayOfWeekField(this);
+    private final transient TemporalField dayOfWeek = ComputedDayOfField.ofDayOfWeekField(this);
     /**
      * The field used to access the computed WeekOfMonth.
      */
-    private transient final TemporalField weekOfMonth = ComputedDayOfField.ofWeekOfMonthField(this);
+    private final transient TemporalField weekOfMonth = ComputedDayOfField.ofWeekOfMonthField(this);
     /**
      * The field used to access the computed WeekOfYear.
      */
-    private transient final TemporalField weekOfYear = ComputedDayOfField.ofWeekOfYearField(this);
+    private final transient TemporalField weekOfYear = ComputedDayOfField.ofWeekOfYearField(this);
     /**
      * The field that represents the week-of-week-based-year.
      * <p>
@@ -261,7 +261,7 @@
      * <p>
      * This unit is an immutable and thread-safe singleton.
      */
-    private transient final TemporalField weekOfWeekBasedYear = ComputedDayOfField.ofWeekOfWeekBasedYearField(this);
+    private final transient TemporalField weekOfWeekBasedYear = ComputedDayOfField.ofWeekOfWeekBasedYearField(this);
     /**
      * The field that represents the week-based-year.
      * <p>
@@ -269,7 +269,7 @@
      * <p>
      * This unit is an immutable and thread-safe singleton.
      */
-    private transient final TemporalField weekBasedYear = ComputedDayOfField.ofWeekBasedYearField(this);
+    private final transient TemporalField weekBasedYear = ComputedDayOfField.ofWeekBasedYearField(this);
 
     //-----------------------------------------------------------------------
     /**
--- a/jdk/src/share/classes/java/time/zone/Ser.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/zone/Ser.java	Wed Jul 05 19:21:26 2017 +0200
@@ -171,9 +171,9 @@
      * <li><a href="../../../serialized-form.html#java.time.zone.ZoneRules">ZoneRules</a>
      * - {@code ZoneRules.of(standardTransitions, standardOffsets, savingsInstantTransitions, wallOffsets, lastRules);}
      * <li><a href="../../../serialized-form.html#java.time.zone.ZoneOffsetTransition">ZoneOffsetTransition</a>
-     * - {@code ;}
+     * - {@code ZoneOffsetTransition of(LocalDateTime.ofEpochSecond(epochSecond), offsetBefore, offsetAfter);}
      * <li><a href="../../../serialized-form.html#java.time.zone.ZoneOffsetTransitionRule">ZoneOffsetTransitionRule</a>
-     * - {@code ;}
+     * - {@code ZoneOffsetTransitionRule.of(month, dom, dow, time, timeEndOfDay, timeDefinition, standardOffset, offsetBefore, offsetAfter);}
      * </ul>
      * @param in  the data to read, not null
      */
--- a/jdk/src/share/classes/java/time/zone/TzdbZoneRulesProvider.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/zone/TzdbZoneRulesProvider.java	Wed Jul 05 19:21:26 2017 +0200
@@ -62,6 +62,7 @@
 package java.time.zone;
 
 import java.io.ByteArrayInputStream;
+import java.io.BufferedInputStream;
 import java.io.DataInputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -107,7 +108,8 @@
         try {
             String libDir = System.getProperty("java.home") + File.separator + "lib";
             try (DataInputStream dis = new DataInputStream(
-                     new FileInputStream(new File(libDir, "tzdb.dat")))) {
+                     new BufferedInputStream(new FileInputStream(
+                         new File(libDir, "tzdb.dat"))))) {
                 load(dis);
             }
         } catch (Exception ex) {
--- a/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java	Wed Jul 05 19:21:26 2017 +0200
@@ -191,7 +191,7 @@
      *   out.writeByte(2);                // identifies a ZoneOffsetTransition
      *   out.writeEpochSec(toEpochSecond);
      *   out.writeOffset(offsetBefore);
-     *   out.writeOfset(offsetAfter);
+     *   out.writeOffset(offsetAfter);
      * }
      * </pre>
      * @return the replacing object, not null
--- a/jdk/src/share/classes/java/time/zone/ZoneRules.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/time/zone/ZoneRules.java	Wed Jul 05 19:21:26 2017 +0200
@@ -899,7 +899,7 @@
                     return transArray[i];
                 }
             }
-            // use last from preceeding year
+            // use last from preceding year
             int lastHistoricYear = findYear(lastHistoric, lastHistoricOffset);
             if (--year > lastHistoricYear) {
                 transArray = findTransitionArray(year);
--- a/jdk/src/share/classes/java/util/Arrays.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/Arrays.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1225,7 +1225,7 @@
      *
      * <p>The implementation was adapted from Tim Peters's list sort for Python
      * (<a href="http://svn.python.org/projects/python/trunk/Objects/listsort.txt">
-     * TimSort</a>).  It uses techiques from Peter McIlroy's "Optimistic
+     * TimSort</a>).  It uses techniques from Peter McIlroy's "Optimistic
      * Sorting and Information Theoretic Complexity", in Proceedings of the
      * Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pp 467-474,
      * January 1993.
@@ -1284,7 +1284,7 @@
      *
      * <p>The implementation was adapted from Tim Peters's list sort for Python
      * (<a href="http://svn.python.org/projects/python/trunk/Objects/listsort.txt">
-     * TimSort</a>).  It uses techiques from Peter McIlroy's "Optimistic
+     * TimSort</a>).  It uses techniques from Peter McIlroy's "Optimistic
      * Sorting and Information Theoretic Complexity", in Proceedings of the
      * Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pp 467-474,
      * January 1993.
@@ -1411,7 +1411,7 @@
      *
      * <p>The implementation was adapted from Tim Peters's list sort for Python
      * (<a href="http://svn.python.org/projects/python/trunk/Objects/listsort.txt">
-     * TimSort</a>).  It uses techiques from Peter McIlroy's "Optimistic
+     * TimSort</a>).  It uses techniques from Peter McIlroy's "Optimistic
      * Sorting and Information Theoretic Complexity", in Proceedings of the
      * Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pp 467-474,
      * January 1993.
@@ -1475,7 +1475,7 @@
      *
      * <p>The implementation was adapted from Tim Peters's list sort for Python
      * (<a href="http://svn.python.org/projects/python/trunk/Objects/listsort.txt">
-     * TimSort</a>).  It uses techiques from Peter McIlroy's "Optimistic
+     * TimSort</a>).  It uses techniques from Peter McIlroy's "Optimistic
      * Sorting and Information Theoretic Complexity", in Proceedings of the
      * Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pp 467-474,
      * January 1993.
--- a/jdk/src/share/classes/java/util/Base64.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/Base64.java	Wed Jul 05 19:21:26 2017 +0200
@@ -40,7 +40,6 @@
  * <a href="http://www.ietf.org/rfc/rfc4648.txt">RFC 4648</a> and
  * <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>.
  *
- * <p>
  * <ul>
  * <li><a name="basic"><b>Basic</b></a>
  * <p> Uses "The Base64 Alphabet" as specified in Table 1 of
@@ -128,7 +127,7 @@
      *          character of "The Base64 Alphabet" as specified in Table 1 of
      *          RFC 2045.
      */
-    public static Encoder getEncoder(int lineLength, byte[] lineSeparator) {
+    public static Encoder getMimeEncoder(int lineLength, byte[] lineSeparator) {
          Objects.requireNonNull(lineSeparator);
          int[] base64 = Decoder.fromBase64;
          for (byte b : lineSeparator) {
@@ -620,11 +619,20 @@
      * required. So if the final unit of the encoded byte data only has
      * two or three Base64 characters (without the corresponding padding
      * character(s) padded), they are decoded as if followed by padding
-     * character(s). If there is padding character present in the
-     * final unit, the correct number of padding character(s) must be
-     * present, otherwise {@code IllegalArgumentException} (
-     * {@code IOException} when reading from a Base64 stream) is thrown
-     * during decoding.
+     * character(s).
+     * <p>
+     * For decoders that use the <a href="#basic">Basic</a> and
+     * <a href="#url">URL and Filename safe</a> type base64 scheme, and
+     * if there is padding character present in the final unit, the
+     * correct number of padding character(s) must be present, otherwise
+     * {@code IllegalArgumentException} ({@code IOException} when reading
+     * from a Base64 stream) is thrown during decoding.
+     * <p>
+     * Decoders that use the <a href="#mime">MIME</a> type base64 scheme
+     * are more lenient when decoding the padding character(s). If the
+     * padding character(s) is incorrectly encoded, the first padding
+     * character encountered is interpreted as the end of the encoded byte
+     * data, the decoding operation will then end and return normally.
      *
      * <p> Instances of {@link Decoder} class are safe for use by
      * multiple concurrent threads.
@@ -903,8 +911,9 @@
                     int b = sa[sp++] & 0xff;
                     if ((b = base64[b]) < 0) {
                         if (b == -2) {   // padding byte
-                            if (shiftto == 6 && (sp == sl || sa[sp++] != '=') ||
-                                shiftto == 18) {
+                            if (!isMIME &&
+                                (shiftto == 6 && (sp == sl || sa[sp++] != '=') ||
+                                 shiftto == 18)) {
                                 throw new IllegalArgumentException(
                                      "Input byte array has wrong 4-byte ending unit");
                             }
@@ -943,11 +952,12 @@
                     throw new IllegalArgumentException(
                         "Last unit does not have enough valid bits");
                 }
-                while (sp < sl) {
-                    if (isMIME && base64[sa[sp++]] < 0)
-                        continue;
-                    throw new IllegalArgumentException(
-                        "Input byte array has incorrect ending byte at " + sp);
+                if (sp < sl) {
+                    if (isMIME)
+                        sp = sl;
+                    else
+                        throw new IllegalArgumentException(
+                            "Input byte array has incorrect ending byte at " + sp);
                 }
                 mark = sp;
                 return dp - dp0;
@@ -972,8 +982,9 @@
                     int b = src.get(sp++) & 0xff;
                     if ((b = base64[b]) < 0) {
                         if (b == -2) {  // padding byte
-                            if (shiftto == 6 && (sp == sl || src.get(sp++) != '=') ||
-                                shiftto == 18) {
+                            if (!isMIME &&
+                                (shiftto == 6 && (sp == sl || src.get(sp++) != '=') ||
+                                 shiftto == 18)) {
                                 throw new IllegalArgumentException(
                                      "Input byte array has wrong 4-byte ending unit");
                             }
@@ -1012,11 +1023,12 @@
                     throw new IllegalArgumentException(
                         "Last unit does not have enough valid bits");
                 }
-                while (sp < sl) {
-                    if (isMIME && base64[src.get(sp++)] < 0)
-                        continue;
-                    throw new IllegalArgumentException(
-                        "Input byte array has incorrect ending byte at " + sp);
+                if (sp < sl) {
+                    if (isMIME)
+                        sp = sl;
+                    else
+                        throw new IllegalArgumentException(
+                            "Input byte array has incorrect ending byte at " + sp);
                 }
                 mark = sp;
                 return dp - dp0;
@@ -1072,14 +1084,15 @@
             while (sp < sl) {
                 int b = src[sp++] & 0xff;
                 if ((b = base64[b]) < 0) {
-                    if (b == -2) {     // padding byte '='
-                        // xx=   shiftto==6&&sp==sl missing last =
-                        // xx=y  shiftto==6 last is not =
-                        // =     shiftto==18 unnecessary padding
-                        // x=    shiftto==12 be taken care later
-                        //       together with single x, invalid anyway
-                        if (shiftto == 6 && (sp == sl || src[sp++] != '=') ||
-                            shiftto == 18) {
+                    if (b == -2) {         // padding byte '='
+                        if (!isMIME  &&    // be lenient for rfc2045
+                            // =     shiftto==18 unnecessary padding
+                            // x=    shiftto==12 a dangling single x
+                            // x     to be handled together with non-padding case
+                            // xx=   shiftto==6&&sp==sl missing last =
+                            // xx=y  shiftto==6 last is not =
+                            (shiftto == 6 && (sp == sl || src[sp++] != '=') ||
+                            shiftto == 18)) {
                             throw new IllegalArgumentException(
                                 "Input byte array has wrong 4-byte ending unit");
                         }
@@ -1109,14 +1122,14 @@
                 dst[dp++] = (byte)(bits >> 16);
                 dst[dp++] = (byte)(bits >>  8);
             } else if (shiftto == 12) {
+                // dangling single "x", throw exception even in lenient mode,
+                // it's incorrectly encoded.
                 throw new IllegalArgumentException(
                     "Last unit does not have enough valid bits");
             }
             // anything left is invalid, if is not MIME.
-            // if MIME, ignore all non-base64 character
-            while (sp < sl) {
-                if (isMIME && base64[src[sp++]] < 0)
-                    continue;
+            // if MIME (lenient), just ignore all leftover
+            if (sp < sl && !isMIME) {
                 throw new IllegalArgumentException(
                     "Input byte array has incorrect ending byte at " + sp);
             }
@@ -1286,7 +1299,7 @@
                         if (nextin == 12)
                             throw new IOException("Base64 stream has one un-decoded dangling byte.");
                         // treat ending xx/xxx without padding character legal.
-                        // same logic as v == 'v' below
+                        // same logic as v == '=' below
                         b[off++] = (byte)(bits >> (16));
                         len--;
                         if (nextin == 0) {           // only one padding byte
@@ -1305,21 +1318,31 @@
                 }
                 if (v == '=') {                  // padding byte(s)
                     // =     shiftto==18 unnecessary padding
-                    // x=    shiftto==12 invalid unit
+                    // x=    shiftto==12 dangling x, invalid unit
                     // xx=   shiftto==6 && missing last '='
-                    // xx=y                or last is not '='
+                    // xx=y  or last is not '='
                     if (nextin == 18 || nextin == 12 ||
                         nextin == 6 && is.read() != '=') {
-                        throw new IOException("Illegal base64 ending sequence:" + nextin);
-                    }
-                    b[off++] = (byte)(bits >> (16));
-                    len--;
-                    if (nextin == 0) {           // only one padding byte
-                        if (len == 0) {          // no enough output space
-                            bits >>= 8;          // shift to lowest byte
-                            nextout = 0;
-                        } else {
-                            b[off++] = (byte) (bits >>  8);
+                        if (!isMIME || nextin == 12) {
+                            throw new IOException("Illegal base64 ending sequence:" + nextin);
+                        } else if (nextin != 18) {
+                            // lenient mode for mime
+                            // (1) handle the "unnecessary padding in "xxxx ="
+                            //     case as the eof (nextin == 18)
+                            // (2) decode "xx=" and "xx=y" normally
+                            b[off++] = (byte)(bits >> (16));
+                            len--;
+                        }
+                    } else {
+                        b[off++] = (byte)(bits >> (16));
+                        len--;
+                        if (nextin == 0) {           // only one padding byte
+                            if (len == 0) {          // no enough output space
+                                bits >>= 8;          // shift to lowest byte
+                                nextout = 0;
+                            } else {
+                                b[off++] = (byte) (bits >>  8);
+                            }
                         }
                     }
                     eof = true;
--- a/jdk/src/share/classes/java/util/BitSet.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/BitSet.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1164,10 +1164,10 @@
      * <p>Example:
      * <pre>
      * BitSet drPepper = new BitSet();</pre>
-     * Now {@code drPepper.toString()} returns "{@code {}}".<p>
+     * Now {@code drPepper.toString()} returns "{@code {}}".
      * <pre>
      * drPepper.set(2);</pre>
-     * Now {@code drPepper.toString()} returns "{@code {2}}".<p>
+     * Now {@code drPepper.toString()} returns "{@code {2}}".
      * <pre>
      * drPepper.set(4);
      * drPepper.set(10);</pre>
--- a/jdk/src/share/classes/java/util/Deque.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/Deque.java	Wed Jul 05 19:21:26 2017 +0200
@@ -56,7 +56,6 @@
  * <p>The twelve methods described above are summarized in the
  * following table:
  *
- * <p>
  * <table BORDER CELLPADDING=3 CELLSPACING=1>
  * <caption>Summary of Deque methods</caption>
  *  <tr>
@@ -100,7 +99,6 @@
  * inherited from the {@code Queue} interface are precisely equivalent to
  * {@code Deque} methods as indicated in the following table:
  *
- * <p>
  * <table BORDER CELLPADDING=3 CELLSPACING=1>
  * <caption>Comparison of Queue and Deque methods</caption>
  *  <tr>
@@ -139,7 +137,6 @@
  * beginning of the deque.  Stack methods are precisely equivalent to
  * {@code Deque} methods as indicated in the table below:
  *
- * <p>
  * <table BORDER CELLPADDING=3 CELLSPACING=1>
  * <caption>Comparison of Stack and Deque methods</caption>
  *  <tr>
--- a/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java	Wed Jul 05 19:21:26 2017 +0200
@@ -127,7 +127,7 @@
      * numerical sum compared to a simple summation of {@code double}
      * values.
      *
-     * @apiNote Sorting values by increasing absolute magnitude tends to yield
+     * @apiNote Values sorted by increasing absolute magnitude tend to yield
      * more accurate results.
      *
      * @return the sum of values, or zero if none
--- a/jdk/src/share/classes/java/util/Formatter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/Formatter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -131,7 +131,7 @@
  *   import static java.util.Calendar.*;
  *
  *   Calendar c = new GregorianCalendar(1995, MAY, 23);
- *   String s = String.format("Duke's Birthday: %1$tm %1$te,%1$tY", c);
+ *   String s = String.format("Duke's Birthday: %1$tb %1$te, %1$tY", c);
  *   // -&gt; s == "Duke's Birthday: May 23, 1995"
  * </pre></blockquote>
  *
@@ -253,7 +253,7 @@
  * <li> <b>Integral</b> - may be applied to Java integral types: {@code byte},
  * {@link Byte}, {@code short}, {@link Short}, {@code int} and {@link
  * Integer}, {@code long}, {@link Long}, and {@link java.math.BigInteger
- * BigInteger}
+ * BigInteger} (but not {@code char} or {@link Character})
  *
  * <li><b>Floating Point</b> - may be applied to Java floating-point types:
  * {@code float}, {@link Float}, {@code double}, {@link Double}, and {@link
@@ -899,7 +899,7 @@
  * <table cellpadding=5 summary="IntConv">
  *
  * <tr><td valign="top"> {@code 'd'}
- *     <td valign="top"> <tt>'&#92;u0054'</tt>
+ *     <td valign="top"> <tt>'&#92;u0064'</tt>
  *     <td> Formats the argument as a decimal integer. The <a
  *     href="#L10nAlgorithm">localization algorithm</a> is applied.
  *
@@ -1057,7 +1057,7 @@
  * <table cellpadding=5 summary="BIntConv">
  *
  * <tr><td valign="top"> {@code 'd'}
- *     <td valign="top"> <tt>'&#92;u0054'</tt>
+ *     <td valign="top"> <tt>'&#92;u0064'</tt>
  *     <td> Requires the output to be formatted as a decimal integer. The <a
  *     href="#L10nAlgorithm">localization algorithm</a> is applied.
  *
--- a/jdk/src/share/classes/java/util/HashMap.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/HashMap.java	Wed Jul 05 19:21:26 2017 +0200
@@ -915,7 +915,7 @@
             return removeNode(hash(key), key, null, false, true) != null;
         }
         public final Spliterator<K> spliterator() {
-            return new KeySpliterator<K,V>(HashMap.this, 0, -1, 0, 0);
+            return new KeySpliterator<>(HashMap.this, 0, -1, 0, 0);
         }
         public final void forEach(Consumer<? super K> action) {
             Node<K,V>[] tab;
@@ -959,7 +959,7 @@
         public final Iterator<V> iterator()     { return new ValueIterator(); }
         public final boolean contains(Object o) { return containsValue(o); }
         public final Spliterator<V> spliterator() {
-            return new ValueSpliterator<K,V>(HashMap.this, 0, -1, 0, 0);
+            return new ValueSpliterator<>(HashMap.this, 0, -1, 0, 0);
         }
         public final void forEach(Consumer<? super V> action) {
             Node<K,V>[] tab;
@@ -1022,7 +1022,7 @@
             return false;
         }
         public final Spliterator<Map.Entry<K,V>> spliterator() {
-            return new EntrySpliterator<K,V>(HashMap.this, 0, -1, 0, 0);
+            return new EntrySpliterator<>(HashMap.this, 0, -1, 0, 0);
         }
         public final void forEach(Consumer<? super Map.Entry<K,V>> action) {
             Node<K,V>[] tab;
@@ -1042,19 +1042,23 @@
 
     // Overrides of JDK8 Map extension methods
 
+    @Override
     public V getOrDefault(Object key, V defaultValue) {
         Node<K,V> e;
         return (e = getNode(hash(key), key)) == null ? defaultValue : e.value;
     }
 
+    @Override
     public V putIfAbsent(K key, V value) {
         return putVal(hash(key), key, value, true, true);
     }
 
+    @Override
     public boolean remove(Object key, Object value) {
         return removeNode(hash(key), key, value, true, true) != null;
     }
 
+    @Override
     public boolean replace(K key, V oldValue, V newValue) {
         Node<K,V> e; V v;
         if ((e = getNode(hash(key), key)) != null &&
@@ -1066,6 +1070,7 @@
         return false;
     }
 
+    @Override
     public V replace(K key, V value) {
         Node<K,V> e;
         if ((e = getNode(hash(key), key)) != null) {
@@ -1077,6 +1082,7 @@
         return null;
     }
 
+    @Override
     public V computeIfAbsent(K key,
                              Function<? super K, ? extends V> mappingFunction) {
         if (mappingFunction == null)
@@ -1150,6 +1156,7 @@
         return null;
     }
 
+    @Override
     public V compute(K key,
                      BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
         if (remappingFunction == null)
@@ -1202,6 +1209,7 @@
         return v;
     }
 
+    @Override
     public V merge(K key, V value,
                    BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
         if (remappingFunction == null)
@@ -1230,7 +1238,11 @@
             }
         }
         if (old != null) {
-            V v = remappingFunction.apply(old.value, value);
+            V v;
+            if (old.value != null)
+                v = remappingFunction.apply(old.value, value);
+            else
+                v = value;
             if (v != null) {
                 old.value = v;
                 afterNodeAccess(old);
@@ -1254,6 +1266,7 @@
         return value;
     }
 
+    @Override
     public void forEach(BiConsumer<? super K, ? super V> action) {
         Node<K,V>[] tab;
         if (action == null)
@@ -1269,6 +1282,7 @@
         }
     }
 
+    @Override
     public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) {
         Node<K,V>[] tab;
         if (function == null)
@@ -1295,6 +1309,7 @@
      * @return a shallow copy of this map
      */
     @SuppressWarnings("unchecked")
+    @Override
     public Object clone() {
         HashMap<K,V> result;
         try {
@@ -1496,7 +1511,7 @@
         public KeySpliterator<K,V> trySplit() {
             int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
             return (lo >= mid || current != null) ? null :
-                new KeySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+                new KeySpliterator<>(map, lo, index = mid, est >>>= 1,
                                         expectedModCount);
         }
 
@@ -1568,7 +1583,7 @@
         public ValueSpliterator<K,V> trySplit() {
             int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
             return (lo >= mid || current != null) ? null :
-                new ValueSpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+                new ValueSpliterator<>(map, lo, index = mid, est >>>= 1,
                                           expectedModCount);
         }
 
@@ -1639,7 +1654,7 @@
         public EntrySpliterator<K,V> trySplit() {
             int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
             return (lo >= mid || current != null) ? null :
-                new EntrySpliterator<K,V>(map, lo, index = mid, est >>>= 1,
+                new EntrySpliterator<>(map, lo, index = mid, est >>>= 1,
                                           expectedModCount);
         }
 
@@ -1714,22 +1729,22 @@
 
     // Create a regular (non-tree) node
     Node<K,V> newNode(int hash, K key, V value, Node<K,V> next) {
-        return new Node<K,V>(hash, key, value, next);
+        return new Node<>(hash, key, value, next);
     }
 
     // For conversion from TreeNodes to plain nodes
     Node<K,V> replacementNode(Node<K,V> p, Node<K,V> next) {
-        return new Node<K,V>(p.hash, p.key, p.value, next);
+        return new Node<>(p.hash, p.key, p.value, next);
     }
 
     // Create a tree bin node
     TreeNode<K,V> newTreeNode(int hash, K key, V value, Node<K,V> next) {
-        return new TreeNode<K,V>(hash, key, value, next);
+        return new TreeNode<>(hash, key, value, next);
     }
 
     // For treeifyBin
     TreeNode<K,V> replacementTreeNode(Node<K,V> p, Node<K,V> next) {
-        return new TreeNode<K,V>(p.hash, p.key, p.value, next);
+        return new TreeNode<>(p.hash, p.key, p.value, next);
     }
 
     /**
--- a/jdk/src/share/classes/java/util/Iterator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/Iterator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -94,10 +94,10 @@
     }
 
     /**
-     * Performs the given action for each remaining element, in the order
-     * elements occur when iterating, until all elements have been processed or
-     * the action throws an exception.  Errors or runtime exceptions thrown by
-     * the action are relayed to the caller.
+     * Performs the given action for each remaining element until all elements
+     * have been processed or the action throws an exception.  Actions are
+     * performed in the order of iteration, if that order is specified.
+     * Exceptions thrown by the action are relayed to the caller.
      *
      * @implSpec
      * <p>The default implementation behaves as if:
--- a/jdk/src/share/classes/java/util/List.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/List.java	Wed Jul 05 19:21:26 2017 +0200
@@ -192,8 +192,9 @@
      * The following code can be used to dump the list into a newly
      * allocated array of <tt>String</tt>:
      *
-     * <pre>
-     *     String[] y = x.toArray(new String[0]);</pre>
+     * <pre>{@code
+     *     String[] y = x.toArray(new String[0]);
+     * }</pre>
      *
      * Note that <tt>toArray(new Object[0])</tt> is identical in function to
      * <tt>toArray()</tt>.
@@ -383,14 +384,13 @@
      *
      * @implSpec
      * The default implementation is equivalent to, for this {@code list}:
-     * <pre>
-     * {@code
-     * final ListIterator<E> li = list.listIterator();
-     * while (li.hasNext()) {
-     *   li.set(operator.apply(li.next()));
-     * }
-     * }
-     * </pre>
+     * <pre>{@code
+     *     final ListIterator<E> li = list.listIterator();
+     *     while (li.hasNext()) {
+     *         li.set(operator.apply(li.next()));
+     *     }
+     * }</pre>
+     *
      * If the list's list-iterator does not support the {@code set} operation
      * then an {@code UnsupportedOperationException} will be thrown when
      * replacing the first element.
@@ -469,11 +469,11 @@
     /**
      * Returns the hash code value for this list.  The hash code of a list
      * is defined to be the result of the following calculation:
-     * <pre>
-     *  int hashCode = 1;
-     *  for (E e : list)
-     *      hashCode = 31*hashCode + (e==null ? 0 : e.hashCode());
-     * </pre>
+     * <pre>{@code
+     *     int hashCode = 1;
+     *     for (E e : list)
+     *         hashCode = 31*hashCode + (e==null ? 0 : e.hashCode());
+     * }</pre>
      * This ensures that <tt>list1.equals(list2)</tt> implies that
      * <tt>list1.hashCode()==list2.hashCode()</tt> for any two lists,
      * <tt>list1</tt> and <tt>list2</tt>, as required by the general
@@ -640,9 +640,9 @@
      * a list can be used as a range operation by passing a subList view
      * instead of a whole list.  For example, the following idiom
      * removes a range of elements from a list:
-     * <pre>
+     * <pre>{@code
      *      list.subList(from, to).clear();
-     * </pre>
+     * }</pre>
      * Similar idioms may be constructed for <tt>indexOf</tt> and
      * <tt>lastIndexOf</tt>, and all of the algorithms in the
      * <tt>Collections</tt> class can be applied to a subList.<p>
--- a/jdk/src/share/classes/java/util/Locale.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/Locale.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1248,7 +1248,7 @@
      * Returns a string representation of this <code>Locale</code>
      * object, consisting of language, country, variant, script,
      * and extensions as below:
-     * <p><blockquote>
+     * <blockquote>
      * language + "_" + country + "_" + (variant + "_#" | "#") + script + "-" + extensions
      * </blockquote>
      *
@@ -1836,7 +1836,7 @@
      * country<br>
      * </blockquote>
      * depending on which fields are specified in the locale.  If the
-     * language, sacript, country, and variant fields are all empty,
+     * language, script, country, and variant fields are all empty,
      * this function returns the empty string.
      *
      * @return The name of the locale appropriate to display.
@@ -2199,7 +2199,7 @@
      * are exactly "ja", "JP", "JP" or "th", "TH", "TH" and script/extensions
      * fields are empty, this method supplies <code>UNICODE_LOCALE_EXTENSION</code>
      * "ca"/"japanese" (calendar type is "japanese") or "nu"/"thai" (number script
-     * type is "thai"). See <a href="Locale.html#special_cases_constructor"/>Special Cases</a>
+     * type is "thai"). See <a href="Locale.html#special_cases_constructor">Special Cases</a>
      * for more information.
      *
      * @return an instance of <code>Locale</code> equivalent to
--- a/jdk/src/share/classes/java/util/Map.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/Map.java	Wed Jul 05 19:21:26 2017 +0200
@@ -562,11 +562,11 @@
     // Defaultable methods
 
     /**
-     * Returns the value to which the specified key is mapped,
-     * or {@code defaultValue} if this map contains no mapping
-     * for the key.
+     * Returns the value to which the specified key is mapped, or
+     * {@code defaultValue} if this map contains no mapping for the key.
      *
-     * <p>The default implementation makes no guarantees about synchronization
+     * @implSpec
+     * The default implementation makes no guarantees about synchronization
      * or atomicity properties of this method. Any implementation providing
      * atomicity guarantees must override this method and document its
      * concurrency properties.
@@ -591,27 +591,24 @@
     }
 
     /**
-     * Performs the given action on each entry in this map, in the order entries
-     * are returned by an entry set iterator (which may be unspecified), until
-     * all entries have been processed or the action throws an {@code Exception}.
+     * Performs the given action for each entry in this map until all entries
+     * have been processed or the action throws an exception.   Unless
+     * otherwise specified by the implementing class, actions are performed in
+     * the order of entry set iteration (if an iteration order is specified.)
      * Exceptions thrown by the action are relayed to the caller.
      *
-     * <p>The default implementation should be overridden by implementations if
-     * they can provide a more performant implementation than an iterator-based
-     * one.
-     *
-     * <p>The default implementation makes no guarantees about synchronization
-     * or atomicity properties of this method. Any implementation providing
-     * atomicity guarantees must override this method and document its
-     * concurrency properties.
-     *
-     * @implSpec The default implementation is equivalent to, for this
-     * {@code map}:
+     * @implSpec
+     * The default implementation is equivalent to, for this {@code map}:
      * <pre> {@code
      * for ((Map.Entry<K, V> entry : map.entrySet())
      *     action.accept(entry.getKey(), entry.getValue());
      * }</pre>
      *
+     * The default implementation makes no guarantees about synchronization
+     * or atomicity properties of this method. Any implementation providing
+     * atomicity guarantees must override this method and document its
+     * concurrency properties.
+     *
      * @param action The action to be performed for each entry
      * @throws NullPointerException if the specified action is null
      * @throws ConcurrentModificationException if an entry is found to be
@@ -636,14 +633,9 @@
 
     /**
      * Replaces each entry's value with the result of invoking the given
-     * function on that entry, in the order entries are returned by an entry
-     * set iterator, until all entries have been processed or the function
-     * throws an exception.
-     *
-     * <p>The default implementation makes no guarantees about synchronization
-     * or atomicity properties of this method. Any implementation providing
-     * atomicity guarantees must override this method and document its
-     * concurrency properties.
+     * function on that entry until all entries have been processed or the
+     * function throws an exception.  Exceptions thrown by the function are
+     * relayed to the caller.
      *
      * @implSpec
      * <p>The default implementation is equivalent to, for this {@code map}:
@@ -652,6 +644,11 @@
      *     entry.setValue(function.apply(entry.getKey(), entry.getValue()));
      * }</pre>
      *
+     * <p>The default implementation makes no guarantees about synchronization
+     * or atomicity properties of this method. Any implementation providing
+     * atomicity guarantees must override this method and document its
+     * concurrency properties.
+     *
      * @param function the function to apply to each entry
      * @throws UnsupportedOperationException if the {@code set} operation
      * is not supported by this map's entry set iterator.
@@ -703,22 +700,23 @@
      * to {@code null}) associates it with the given value and returns
      * {@code null}, else returns the current value.
      *
-     * <p>The default implementation makes no guarantees about synchronization
-     * or atomicity properties of this method. Any implementation providing
-     * atomicity guarantees must override this method and document its
-     * concurrency properties.
-     *
      * @implSpec
      * The default implementation is equivalent to, for this {@code
      * map}:
      *
      * <pre> {@code
-     * if (map.get(key) == null)
-     *     return map.put(key, value);
-     * else
-     *     return map.get(key);
+     * V v = map.get(key);
+     * if (v == null)
+     *     v = map.put(key, value);
+     *
+     * return v;
      * }</pre>
      *
+     * <p>The default implementation makes no guarantees about synchronization
+     * or atomicity properties of this method. Any implementation providing
+     * atomicity guarantees must override this method and document its
+     * concurrency properties.
+     *
      * @param key key with which the specified value is to be associated
      * @param value value to be associated with the specified key
      * @return the previous value associated with the specified key, or
@@ -738,16 +736,12 @@
      * @throws IllegalArgumentException if some property of the specified key
      *         or value prevents it from being stored in this map
      *         (<a href="Collection.html#optional-restrictions">optional</a>)
-     * @throws ConcurrentModificationException if a modification of the map is
-     * detected during insertion of the value.
      * @since 1.8
      */
     default V putIfAbsent(K key, V value) {
         V v = get(key);
         if (v == null) {
-            if (put(key, value) != null) {
-                throw new ConcurrentModificationException();
-            }
+            v = put(key, value);
         }
 
         return v;
@@ -757,11 +751,6 @@
      * Removes the entry for the specified key only if it is currently
      * mapped to the specified value.
      *
-     * <p>The default implementation makes no guarantees about synchronization
-     * or atomicity properties of this method. Any implementation providing
-     * atomicity guarantees must override this method and document its
-     * concurrency properties.
-     *
      * @implSpec
      * The default implementation is equivalent to, for this {@code map}:
      *
@@ -773,6 +762,11 @@
      *     return false;
      * }</pre>
      *
+     * <p>The default implementation makes no guarantees about synchronization
+     * or atomicity properties of this method. Any implementation providing
+     * atomicity guarantees must override this method and document its
+     * concurrency properties.
+     *
      * @param key key with which the specified value is associated
      * @param value value expected to be associated with the specified key
      * @return {@code true} if the value was removed
@@ -801,11 +795,6 @@
      * Replaces the entry for the specified key only if currently
      * mapped to the specified value.
      *
-     * <p>The default implementation makes no guarantees about synchronization
-     * or atomicity properties of this method. Any implementation providing
-     * atomicity guarantees must override this method and document its
-     * concurrency properties.
-    *
      * @implSpec
      * The default implementation is equivalent to, for this {@code map}:
      *
@@ -821,6 +810,11 @@
      * for maps that do not support null values if oldValue is null unless
      * newValue is also null.
      *
+     * <p>The default implementation makes no guarantees about synchronization
+     * or atomicity properties of this method. Any implementation providing
+     * atomicity guarantees must override this method and document its
+     * concurrency properties.
+     *
      * @param key key with which the specified value is associated
      * @param oldValue value expected to be associated with the specified key
      * @param newValue value to be associated with the specified key
@@ -853,11 +847,6 @@
      * Replaces the entry for the specified key only if it is
      * currently mapped to some value.
      *
-     * <p>The default implementation makes no guarantees about synchronization
-     * or atomicity properties of this method. Any implementation providing
-     * atomicity guarantees must override this method and document its
-     * concurrency properties.
-     *
      * @implSpec
      * The default implementation is equivalent to, for this {@code map}:
      *
@@ -868,6 +857,11 @@
      *     return null;
      * }</pre>
      *
+     * <p>The default implementation makes no guarantees about synchronization
+     * or atomicity properties of this method. Any implementation providing
+     * atomicity guarantees must override this method and document its
+     * concurrency properties.
+      *
      * @param key key with which the specified value is associated
      * @param value value to be associated with the specified key
      * @return the previous value associated with the specified key, or
@@ -888,14 +882,17 @@
      * @since 1.8
      */
     default V replace(K key, V value) {
-        return containsKey(key) ? put(key, value) : null;
+        V curValue;
+        if (((curValue = get(key)) != null) || containsKey(key)) {
+            curValue = put(key, value);
+        }
+        return curValue;
     }
 
     /**
-     * If the specified key is not already associated with a value (or
-     * is mapped to {@code null}), attempts to compute its value using
-     * the given mapping function and enters it into this map unless
-     * {@code null}.
+     * If the specified key is not already associated with a value (or is mapped
+     * to {@code null}), attempts to compute its value using the given mapping
+     * function and enters it into this map unless {@code null}.
      *
      * <p>If the function returns {@code null} no mapping is recorded. If
      * the function itself throws an (unchecked) exception, the
@@ -907,35 +904,42 @@
      * map.computeIfAbsent(key, k -> new Value(f(k)));
      * }</pre>
      *
+     * <p>Or to implement a multi-value map, {@code Map<K,Collection<V>>},
+     * supporting multiple values per key:
+     *
+     * <pre> {@code
+     * map.computeIfAbsent(key, k -> new HashSet<V>()).add(v);
+     * }</pre>
+     *
+     *
+     * @implSpec
+     * The default implementation is equivalent to the following steps for this
+     * {@code map}, then returning the current value or {@code null} if now
+     * absent:
+     *
+     * <pre> {@code
+     * if (map.get(key) == null) {
+     *     V newValue = mappingFunction.apply(key);
+     *     if (newValue != null)
+     *         map.put(key, newValue);
+     * }
+     * }</pre>
+     *
      * <p>The default implementation makes no guarantees about synchronization
      * or atomicity properties of this method. Any implementation providing
      * atomicity guarantees must override this method and document its
      * concurrency properties. In particular, all implementations of
      * subinterface {@link java.util.concurrent.ConcurrentMap} must document
      * whether the function is applied once atomically only if the value is not
-     * present.  Any class that permits null values must document
-     * whether and how this method distinguishes absence from null mappings.
-     *
-     * @implSpec
-     * The default implementation is equivalent to the following
-     * steps for this {@code map}, then returning the current value or
-     * {@code null} if now absent:
-     *
-     * <pre> {@code
-     * if (map.get(key) == null) {
-     *     V newValue = mappingFunction.apply(key);
-     *     if (newValue != null)
-     *         map.putIfAbsent(key, newValue);
-     * }
-     * }</pre>
+     * present.
      *
      * @param key key with which the specified value is to be associated
      * @param mappingFunction the function to compute a value
      * @return the current (existing or computed) value associated with
      *         the specified key, or null if the computed value is null
      * @throws NullPointerException if the specified key is null and
-     *         this map does not support null keys, or the
-     *         mappingFunction is null
+     *         this map does not support null keys, or the mappingFunction
+     *         is null
      * @throws UnsupportedOperationException if the {@code put} operation
      *         is not supported by this map
      *         (<a href="Collection.html#optional-restrictions">optional</a>)
@@ -947,10 +951,16 @@
     default V computeIfAbsent(K key,
             Function<? super K, ? extends V> mappingFunction) {
         Objects.requireNonNull(mappingFunction);
-        V v, newValue;
-        return ((v = get(key)) == null &&
-                (newValue = mappingFunction.apply(key)) != null &&
-                (v = putIfAbsent(key, newValue)) == null) ? newValue : v;
+        V v;
+        if ((v = get(key)) == null) {
+            V newValue;
+            if ((newValue = mappingFunction.apply(key)) != null) {
+                put(key, newValue);
+                return newValue;
+            }
+        }
+
+        return v;
     }
 
     /**
@@ -960,6 +970,22 @@
      * <p>If the function returns {@code null}, the mapping is removed.  If the
      * function itself throws an (unchecked) exception, the exception is
      * rethrown, and the current mapping is left unchanged.
+    *
+     * @implSpec
+     * The default implementation is equivalent to performing the following
+     * steps for this {@code map}, then returning the current value or
+     * {@code null} if now absent:
+     *
+     * <pre> {@code
+     * if (map.get(key) != null) {
+     *     V oldValue = map.get(key);
+     *     V newValue = remappingFunction.apply(key, oldValue);
+     *     if (newValue != null)
+     *         map.put(key, newValue);
+     *     else
+     *         map.remove(key);
+     * }
+     * }</pre>
      *
      * <p>The default implementation makes no guarantees about synchronization
      * or atomicity properties of this method. Any implementation providing
@@ -967,27 +993,7 @@
      * concurrency properties. In particular, all implementations of
      * subinterface {@link java.util.concurrent.ConcurrentMap} must document
      * whether the function is applied once atomically only if the value is not
-     * present.  Any class that permits null values must document
-     * whether and how this method distinguishes absence from null mappings.
-     *
-     * @implSpec
-     * The default implementation is equivalent to performing the
-     * following steps for this {@code map}, then returning the
-     * current value or {@code null} if now absent:
-     *
-     * <pre> {@code
-     * if (map.get(key) != null) {
-     *     V oldValue = map.get(key);
-     *     V newValue = remappingFunction.apply(key, oldValue);
-     *     if (newValue != null)
-     *         map.replace(key, oldValue, newValue);
-     *     else
-     *         map.remove(key, oldValue);
-     * }
-     * }</pre>
-     *
-     * In concurrent contexts, the default implementation may retry
-     * these steps when multiple threads attempt updates.
+     * present.
      *
      * @param key key with which the specified value is to be associated
      * @param remappingFunction the function to compute a value
@@ -1007,22 +1013,25 @@
             BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
         Objects.requireNonNull(remappingFunction);
         V oldValue;
-        while ((oldValue = get(key)) != null) {
+        if ((oldValue = get(key)) != null) {
             V newValue = remappingFunction.apply(key, oldValue);
             if (newValue != null) {
-                if (replace(key, oldValue, newValue))
-                    return newValue;
-            } else if (remove(key, oldValue))
+                put(key, newValue);
+                return newValue;
+            } else {
+                remove(key);
                 return null;
+            }
+        } else {
+            return null;
         }
-        return oldValue;
     }
 
     /**
-     * Attempts to compute a mapping for the specified key and its
-     * current mapped value (or {@code null} if there is no current
-     * mapping). For example, to either create or append a {@code
-     * String msg} to a value mapping:
+     * Attempts to compute a mapping for the specified key and its current
+     * mapped value (or {@code null} if there is no current mapping). For
+     * example, to either create or append a {@code String} msg to a value
+     * mapping:
      *
      * <pre> {@code
      * map.compute(key, (k, v) -> (v == null) ? msg : v.concat(msg))}</pre>
@@ -1033,15 +1042,6 @@
      * (unchecked) exception, the exception is rethrown, and the current mapping
      * is left unchanged.
      *
-     * <p>The default implementation makes no guarantees about synchronization
-     * or atomicity properties of this method. Any implementation providing
-     * atomicity guarantees must override this method and document its
-     * concurrency properties. In particular, all implementations of
-     * subinterface {@link java.util.concurrent.ConcurrentMap} must document
-     * whether the function is applied once atomically only if the value is not
-     * present.  Any class that permits null values must document
-     * whether and how this method distinguishes absence from null mappings.
-     *
      * @implSpec
      * The default implementation is equivalent to performing the following
      * steps for this {@code map}, then returning the current value or
@@ -1052,19 +1052,24 @@
      * V newValue = remappingFunction.apply(key, oldValue);
      * if (oldValue != null ) {
      *    if (newValue != null)
-     *       map.replace(key, oldValue, newValue);
+     *       map.put(key, newValue);
      *    else
-     *       map.remove(key, oldValue);
+     *       map.remove(key);
      * } else {
      *    if (newValue != null)
-     *       map.putIfAbsent(key, newValue);
+     *       map.put(key, newValue);
      *    else
      *       return null;
      * }
      * }</pre>
      *
-     * In concurrent contexts, the default implementation may retry
-     * these steps when multiple threads attempt updates.
+     * <p>The default implementation makes no guarantees about synchronization
+     * or atomicity properties of this method. Any implementation providing
+     * atomicity guarantees must override this method and document its
+     * concurrency properties. In particular, all implementations of
+     * subinterface {@link java.util.concurrent.ConcurrentMap} must document
+     * whether the function is applied once atomically only if the value is not
+     * present.
      *
      * @param key key with which the specified value is to be associated
      * @param remappingFunction the function to compute a value
@@ -1084,44 +1089,22 @@
             BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
         Objects.requireNonNull(remappingFunction);
         V oldValue = get(key);
-        for (;;) {
-            V newValue = remappingFunction.apply(key, oldValue);
-            if (newValue == null) {
-                // delete mapping
-                if(oldValue != null || containsKey(key)) {
-                    // something to remove
-                    if (remove(key, oldValue)) {
-                        // removed the old value as expected
-                        return null;
-                    }
 
-                    // some other value replaced old value. try again.
-                    oldValue = get(key);
-                } else {
-                    // nothing to do. Leave things as they were.
-                    return null;
-                }
+        V newValue = remappingFunction.apply(key, oldValue);
+        if (newValue == null) {
+            // delete mapping
+            if (oldValue != null || containsKey(key)) {
+                // something to remove
+                remove(key);
+                return null;
             } else {
-                // add or replace old mapping
-                if (oldValue != null) {
-                    // replace
-                    if (replace(key, oldValue, newValue)) {
-                        // replaced as expected.
-                        return newValue;
-                    }
-
-                    // some other value replaced old value. try again.
-                    oldValue = get(key);
-                } else {
-                    // add (replace if oldValue was null)
-                    if ((oldValue = putIfAbsent(key, newValue)) == null) {
-                        // replaced
-                        return newValue;
-                    }
-
-                    // some other value replaced old value. try again.
-                }
+                // nothing to do. Leave things as they were.
+                return null;
             }
+        } else {
+            // add or replace old mapping
+            put(key, newValue);
+            return newValue;
         }
     }
 
@@ -1143,15 +1126,6 @@
      * (unchecked) exception, the exception is rethrown, and the current mapping
      * is left unchanged.
      *
-     * <p>The default implementation makes no guarantees about synchronization
-     * or atomicity properties of this method. Any implementation providing
-     * atomicity guarantees must override this method and document its
-     * concurrency properties. In particular, all implementations of
-     * subinterface {@link java.util.concurrent.ConcurrentMap} must document
-     * whether the function is applied once atomically only if the value is not
-     * present.  Any class that permits null values must document
-     * whether and how this method distinguishes absence from null mappings.
-     *
      * @implSpec
      * The default implementation is equivalent to performing the
      * following steps for this {@code map}, then returning the
@@ -1162,15 +1136,20 @@
      * V newValue = (oldValue == null) ? value :
      *              remappingFunction.apply(oldValue, value);
      * if (newValue == null)
-     *     map.remove(key, oldValue);
+     *     map.remove(key);
      * else if (oldValue == null)
-     *     map.putIfAbsent(key, newValue);
+     *     map.remove(key);
      * else
-     *     map.replace(key, oldValue, newValue);
+     *     map.put(key, newValue);
      * }</pre>
      *
-     * In concurrent contexts, the default implementation may retry
-     * these steps when multiple threads attempt updates.
+     * <p>The default implementation makes no guarantees about synchronization
+     * or atomicity properties of this method. Any implementation providing
+     * atomicity guarantees must override this method and document its
+     * concurrency properties. In particular, all implementations of
+     * subinterface {@link java.util.concurrent.ConcurrentMap} must document
+     * whether the function is applied once atomically only if the value is not
+     * present.
      *
      * @param key key with which the specified value is to be associated
      * @param value the value to use if absent
@@ -1183,32 +1162,30 @@
      *         prevents it from being stored in this map
      *         (<a href="Collection.html#optional-restrictions">optional</a>)
      * @throws NullPointerException if the specified key is null and
-     *         this map does not support null keys, or the
-     *         remappingFunction is null
+     *         this map does not support null keys, or the remappingFunction
+     *         is null
      * @since 1.8
      */
     default V merge(K key, V value,
             BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
         Objects.requireNonNull(remappingFunction);
         V oldValue = get(key);
-        for (;;) {
-            if (oldValue != null) {
-                V newValue = remappingFunction.apply(oldValue, value);
-                if (newValue != null) {
-                    if (replace(key, oldValue, newValue))
-                        return newValue;
-                } else if (remove(key, oldValue)) {
-                    return null;
-                }
-                oldValue = get(key);
+        if (oldValue != null) {
+            V newValue = remappingFunction.apply(oldValue, value);
+            if (newValue != null) {
+                put(key, newValue);
+                return newValue;
             } else {
-                if (value == null) {
-                    return null;
-                }
-
-                if ((oldValue = putIfAbsent(key, value)) == null) {
-                    return value;
-                }
+                remove(key);
+                return null;
+            }
+        } else {
+            if (value == null) {
+                remove(key);
+                return null;
+            } else {
+                put(key, value);
+                return value;
             }
         }
     }
--- a/jdk/src/share/classes/java/util/MissingFormatWidthException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/MissingFormatWidthException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -28,7 +28,7 @@
 /**
  * Unchecked exception thrown when the format width is required.
  *
- * <p> Unless otherwise specified, passing a <tt>null</tt> argument to anyg
+ * <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
  * method or constructor in this class will cause a {@link
  * NullPointerException} to be thrown.
  *
--- a/jdk/src/share/classes/java/util/PrimitiveIterator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/PrimitiveIterator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -76,6 +76,7 @@
      * @param action The action to be performed for each element
      * @throws NullPointerException if the specified action is null
      */
+    @SuppressWarnings("overloads")
     void forEachRemaining(T_CONS action);
 
     /**
@@ -93,10 +94,10 @@
         int nextInt();
 
         /**
-         * Performs the given action for each remaining element, in the order
-         * elements occur when iterating, until all elements have been processed
-         * or the action throws an exception.  Errors or runtime exceptions
-         * thrown by the action are relayed to the caller.
+         * Performs the given action for each remaining element until all elements
+         * have been processed or the action throws an exception.  Actions are
+         * performed in the order of iteration, if that order is specified.
+         * Exceptions thrown by the action are relayed to the caller.
          *
          * @implSpec
          * <p>The default implementation behaves as if:
@@ -167,10 +168,10 @@
         long nextLong();
 
         /**
-         * Performs the given action for each remaining element, in the order
-         * elements occur when iterating, until all elements have been processed
-         * or the action throws an exception.  Errors or runtime exceptions
-         * thrown by the action are relayed to the caller.
+         * Performs the given action for each remaining element until all elements
+         * have been processed or the action throws an exception.  Actions are
+         * performed in the order of iteration, if that order is specified.
+         * Exceptions thrown by the action are relayed to the caller.
          *
          * @implSpec
          * <p>The default implementation behaves as if:
@@ -240,10 +241,10 @@
         double nextDouble();
 
         /**
-         * Performs the given action for each remaining element, in the order
-         * elements occur when iterating, until all elements have been processed
-         * or the action throws an exception.  Errors or runtime exceptions
-         * thrown by the action are relayed to the caller.
+         * Performs the given action for each remaining element until all elements
+         * have been processed or the action throws an exception.  Actions are
+         * performed in the order of iteration, if that order is specified.
+         * Exceptions thrown by the action are relayed to the caller.
          *
          * @implSpec
          * <p>The default implementation behaves as if:
--- a/jdk/src/share/classes/java/util/PriorityQueue.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/PriorityQueue.java	Wed Jul 05 19:21:26 2017 +0200
@@ -65,7 +65,7 @@
  * java.util.concurrent.PriorityBlockingQueue} class.
  *
  * <p>Implementation note: this implementation provides
- * O(log(n)) time for the enqueing and dequeing methods
+ * O(log(n)) time for the enqueuing and dequeuing methods
  * ({@code offer}, {@code poll}, {@code remove()} and {@code add});
  * linear time for the {@code remove(Object)} and {@code contains(Object)}
  * methods; and constant time for the retrieval methods
--- a/jdk/src/share/classes/java/util/Properties.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/Properties.java	Wed Jul 05 19:21:26 2017 +0200
@@ -244,7 +244,6 @@
      * As an example, each of the following three lines specifies the key
      * {@code "Truth"} and the associated element value
      * {@code "Beauty"}:
-     * <p>
      * <pre>
      * Truth = Beauty
      *  Truth:Beauty
@@ -252,14 +251,12 @@
      * </pre>
      * As another example, the following three lines specify a single
      * property:
-     * <p>
      * <pre>
      * fruits                           apple, banana, pear, \
      *                                  cantaloupe, watermelon, \
      *                                  kiwi, mango
      * </pre>
      * The key is {@code "fruits"} and the associated element is:
-     * <p>
      * <pre>"apple, banana, pear, cantaloupe, watermelon, kiwi, mango"</pre>
      * Note that a space appears before each {@code \} so that a space
      * will appear after each comma in the final result; the {@code \},
@@ -268,13 +265,11 @@
      * characters.
      * <p>
      * As a third example, the line:
-     * <p>
      * <pre>cheeses
      * </pre>
      * specifies that the key is {@code "cheeses"} and the associated
-     * element is the empty string {@code ""}.<p>
+     * element is the empty string {@code ""}.
      * <p>
-     *
      * <a name="unicodeescapes"></a>
      * Characters in keys and elements can be represented in escape
      * sequences similar to those used for character and string literals
--- a/jdk/src/share/classes/java/util/PropertyPermission.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/PropertyPermission.java	Wed Jul 05 19:21:26 2017 +0200
@@ -51,11 +51,10 @@
  * signify a wildcard match. For example: "java.*" and "*" signify a wildcard
  * match, while "*java" and "a*b" do not.
  * <P>
- * <P>
  * The actions to be granted are passed to the constructor in a string containing
  * a list of one or more comma-separated keywords. The possible keywords are
  * "read" and "write". Their meaning is defined as follows:
- * <P>
+ *
  * <DL>
  *    <DT> read
  *    <DD> read permission. Allows <code>System.getProperty</code> to
@@ -166,11 +165,11 @@
      * Checks if this PropertyPermission object "implies" the specified
      * permission.
      * <P>
-     * More specifically, this method returns true if:<p>
+     * More specifically, this method returns true if:
      * <ul>
-     * <li> <i>p</i> is an instanceof PropertyPermission,<p>
+     * <li> <i>p</i> is an instanceof PropertyPermission,
      * <li> <i>p</i>'s actions are a subset of this
-     * object's actions, and <p>
+     * object's actions, and
      * <li> <i>p</i>'s name is implied by this object's
      *      name. For example, "java.*" implies "java.home".
      * </ul>
--- a/jdk/src/share/classes/java/util/Queue.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/Queue.java	Wed Jul 05 19:21:26 2017 +0200
@@ -47,7 +47,6 @@
  * implementations; in most implementations, insert operations cannot
  * fail.
  *
- * <p>
  * <table BORDER CELLPADDING=3 CELLSPACING=1>
  * <caption>Summary of Queue methods</caption>
  *  <tr>
--- a/jdk/src/share/classes/java/util/ResourceBundle.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/ResourceBundle.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1084,7 +1084,6 @@
      * bundles. Conceptually, the bundle loading process with the given
      * <code>control</code> is performed in the following steps.
      *
-     * <p>
      * <ol>
      * <li>This factory method looks up the resource bundle in the cache for
      * the specified <code>baseName</code>, <code>targetLocale</code> and
@@ -1255,7 +1254,7 @@
      * <p><code>getBundle</code> finds
      * <code>foo/bar/Messages_fr.properties</code> and creates a
      * <code>ResourceBundle</code> instance. Then, <code>getBundle</code>
-     * sets up its parent chain from the list of the candiate locales.  Only
+     * sets up its parent chain from the list of the candidate locales.  Only
      * <code>foo/bar/Messages.properties</code> is found in the list and
      * <code>getBundle</code> creates a <code>ResourceBundle</code> instance
      * that becomes the parent of the instance for
@@ -2241,7 +2240,7 @@
          * <li>For an input <code>Locale</code> with a variant value consisting
          * of multiple subtags separated by underscore, generate candidate
          * <code>Locale</code>s by omitting the variant subtags one by one, then
-         * insert them after every occurence of <code> Locale</code>s with the
+         * insert them after every occurrence of <code> Locale</code>s with the
          * full variant value in the original list.  For example, if the
          * the variant consists of two subtags <em>V1</em> and <em>V2</em>:
          *
@@ -2844,7 +2843,7 @@
          * and <code>variant</code> are the language, script, country, and variant
          * values of <code>locale</code>, respectively. Final component values that
          * are empty Strings are omitted along with the preceding '_'.  When the
-         * script is empty, the script value is ommitted along with the preceding '_'.
+         * script is empty, the script value is omitted along with the preceding '_'.
          * If all of the values are empty strings, then <code>baseName</code>
          * is returned.
          *
--- a/jdk/src/share/classes/java/util/Scanner.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/Scanner.java	Wed Jul 05 19:21:26 2017 +0200
@@ -216,7 +216,6 @@
  * are specified in terms of the following regular-expression grammar, where
  * Rmax is the highest digit in the radix being used (for example, Rmax is 9 in base 10).
  *
- * <p>
  * <dl>
  *   <dt><i>NonAsciiDigit</i>:
  *       <dd>A non-ASCII character c for which
--- a/jdk/src/share/classes/java/util/Spliterator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/Spliterator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -613,6 +613,7 @@
          * upon entry to this method, else {@code true}.
          * @throws NullPointerException if the specified action is null
          */
+        @SuppressWarnings("overloads")
         boolean tryAdvance(T_CONS action);
 
         /**
@@ -630,6 +631,7 @@
          * @param action The action
          * @throws NullPointerException if the specified action is null
          */
+        @SuppressWarnings("overloads")
         default void forEachRemaining(T_CONS action) {
             do { } while (tryAdvance(action));
         }
--- a/jdk/src/share/classes/java/util/TimeZone.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/TimeZone.java	Wed Jul 05 19:21:26 2017 +0200
@@ -544,7 +544,16 @@
      * @since 1.8
      */
     public ZoneId toZoneId() {
-        return ZoneId.of(getID(), ZoneId.SHORT_IDS);
+        String id = getID();
+        if (ZoneInfoFile.useOldMapping() && id.length() == 3) {
+            if ("EST".equals(id))
+                return ZoneId.of("America/New_York");
+            if ("MST".equals(id))
+                return ZoneId.of("America/Denver");
+            if ("HST".equals(id))
+                return ZoneId.of("America/Honolulu");
+        }
+        return ZoneId.of(id, ZoneId.SHORT_IDS);
     }
 
     private static TimeZone getTimeZone(String ID, boolean fallback) {
@@ -597,7 +606,7 @@
      * Otherwise, the method takes the following steps to determine the default
      * time zone.
      *
-     * <p><ul>
+     * <ul>
      * <li>Use the {@code user.timezone} property value as the default
      * time zone ID if it's available.</li>
      * <li>Detect the platform time zone ID. The source of the
--- a/jdk/src/share/classes/java/util/UUID.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/UUID.java	Wed Jul 05 19:21:26 2017 +0200
@@ -233,7 +233,7 @@
      * number describes how this {@code UUID} was generated.
      *
      * The version number has the following meaning:
-     * <p><ul>
+     * <ul>
      * <li>1    Time-based UUID
      * <li>2    DCE security UUID
      * <li>3    Name-based UUID
@@ -252,7 +252,7 @@
      * number describes the layout of the {@code UUID}.
      *
      * The variant number has the following meaning:
-     * <p><ul>
+     * <ul>
      * <li>0    Reserved for NCS backward compatibility
      * <li>2    <a href="http://www.ietf.org/rfc/rfc4122.txt">IETF&nbsp;RFC&nbsp;4122</a>
      * (Leach-Salz), used by this class
--- a/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ArrayBlockingQueue.java	Wed Jul 05 19:21:26 2017 +0200
@@ -946,7 +946,7 @@
         }
 
         /**
-         * Called whenever an interior remove (not at takeIndex) occured.
+         * Called whenever an interior remove (not at takeIndex) occurred.
          *
          * Notifies all iterators, and expunges any that are now stale.
          */
@@ -1305,7 +1305,7 @@
         }
 
         /**
-         * Called whenever an interior remove (not at takeIndex) occured.
+         * Called whenever an interior remove (not at takeIndex) occurred.
          *
          * @return true if this iterator should be unlinked from itrs
          */
--- a/jdk/src/share/classes/java/util/concurrent/BlockingDeque.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/BlockingDeque.java	Wed Jul 05 19:21:26 2017 +0200
@@ -50,7 +50,6 @@
  * and the fourth blocks for only a given maximum time limit before giving
  * up.  These methods are summarized in the following table:
  *
- * <p>
  * <table BORDER CELLPADDING=3 CELLSPACING=1>
  * <caption>Summary of BlockingDeque methods</caption>
  *  <tr>
@@ -126,7 +125,6 @@
  * {@code BlockingQueue} interface are precisely equivalent to
  * {@code BlockingDeque} methods as indicated in the following table:
  *
- * <p>
  * <table BORDER CELLPADDING=3 CELLSPACING=1>
  * <caption>Comparison of BlockingQueue and BlockingDeque methods</caption>
  *  <tr>
--- a/jdk/src/share/classes/java/util/concurrent/BlockingQueue.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/BlockingQueue.java	Wed Jul 05 19:21:26 2017 +0200
@@ -53,7 +53,6 @@
  * and the fourth blocks for only a given maximum time limit before giving
  * up.  These methods are summarized in the following table:
  *
- * <p>
  * <table BORDER CELLPADDING=3 CELLSPACING=1>
  * <caption>Summary of BlockingQueue methods</caption>
  *  <tr>
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentMap.java	Wed Jul 05 19:21:26 2017 +0200
@@ -36,7 +36,9 @@
 package java.util.concurrent;
 import java.util.Map;
 import java.util.Objects;
+import java.util.function.BiConsumer;
 import java.util.function.BiFunction;
+import java.util.function.Function;
 
 /**
  * A {@link java.util.Map} providing thread safety and atomicity
@@ -64,9 +66,13 @@
      * {@inheritDoc}
      *
      * @implNote This implementation assumes that the ConcurrentMap cannot
-     * contain null values and get() returning null unambiguously means the key
-     * is absent. Implementations which support null values must override this
-     * default implementation.
+     * contain null values and {@code get()} returning null unambiguously means
+     * the key is absent. Implementations which support null values
+     * <strong>must</strong> override this default implementation.
+     *
+     * @throws ClassCastException {@inheritDoc}
+     * @throws NullPointerException {@inheritDoc}
+     * @since 1.8
      */
     @Override
     default V getOrDefault(Object key, V defaultValue) {
@@ -74,6 +80,41 @@
         return ((v = get(key)) != null) ? v : defaultValue;
     }
 
+   /**
+     * {@inheritDoc}
+     *
+     * @implSpec The default implementation is equivalent to, for this
+     * {@code map}:
+     * <pre> {@code
+     * for ((Map.Entry<K, V> entry : map.entrySet())
+     *     action.accept(entry.getKey(), entry.getValue());
+     * }</pre>
+     *
+     * @implNote The default implementation assumes that
+     * {@code IllegalStateException} thrown by {@code getKey()} or
+     * {@code getValue()} indicates that the entry has been removed and cannot
+     * be processed. Operation continues for subsequent entries.
+     *
+     * @throws NullPointerException {@inheritDoc}
+     * @since 1.8
+     */
+    @Override
+    default void forEach(BiConsumer<? super K, ? super V> action) {
+        Objects.requireNonNull(action);
+        for (Map.Entry<K, V> entry : entrySet()) {
+            K k;
+            V v;
+            try {
+                k = entry.getKey();
+                v = entry.getValue();
+            } catch(IllegalStateException ise) {
+                // this usually means the entry is no longer in the map.
+                continue;
+            }
+            action.accept(k, v);
+        }
+    }
+
     /**
      * If the specified key is not already associated
      * with a value, associate it with the given value.
@@ -82,10 +123,14 @@
      * if (!map.containsKey(key))
      *   return map.put(key, value);
      * else
-     *   return map.get(key);}</pre>
+     *   return map.get(key);
+     * }</pre>
      *
      * except that the action is performed atomically.
      *
+     * @implNote This implementation intentionally re-abstracts the
+     * inappropriate default provided in {@code Map}.
+     *
      * @param key key with which the specified value is to be associated
      * @param value value to be associated with the specified key
      * @return the previous value associated with the specified key, or
@@ -102,7 +147,7 @@
      * @throws IllegalArgumentException if some property of the specified key
      *         or value prevents it from being stored in this map
      */
-    V putIfAbsent(K key, V value);
+     V putIfAbsent(K key, V value);
 
     /**
      * Removes the entry for a key only if currently mapped to a given value.
@@ -112,10 +157,14 @@
      *   map.remove(key);
      *   return true;
      * } else
-     *   return false;}</pre>
+     *   return false;
+     * }</pre>
      *
      * except that the action is performed atomically.
      *
+     * @implNote This implementation intentionally re-abstracts the
+     * inappropriate default provided in {@code Map}.
+     *
      * @param key key with which the specified value is associated
      * @param value value expected to be associated with the specified key
      * @return {@code true} if the value was removed
@@ -138,10 +187,14 @@
      *   map.put(key, newValue);
      *   return true;
      * } else
-     *   return false;}</pre>
+     *   return false;
+     * }</pre>
      *
      * except that the action is performed atomically.
      *
+     * @implNote This implementation intentionally re-abstracts the
+     * inappropriate default provided in {@code Map}.
+     *
      * @param key key with which the specified value is associated
      * @param oldValue value expected to be associated with the specified key
      * @param newValue value to be associated with the specified key
@@ -164,10 +217,14 @@
      * if (map.containsKey(key)) {
      *   return map.put(key, value);
      * } else
-     *   return null;}</pre>
+     *   return null;
+     * }</pre>
      *
      * except that the action is performed atomically.
      *
+     * @implNote This implementation intentionally re-abstracts the
+     * inappropriate default provided in {@code Map}.
+     *
      * @param key key with which the specified value is associated
      * @param value value to be associated with the specified key
      * @return the previous value associated with the specified key, or
@@ -189,10 +246,30 @@
     /**
      * {@inheritDoc}
      *
-     * @implNote This implementation assumes that the ConcurrentMap cannot
-     * contain null values and get() returning null unambiguously means the key
-     * is absent. Implementations which support null values
-     * <strong>must</strong> override this default implementation.
+     * @implSpec
+     * <p>The default implementation is equivalent to, for this {@code map}:
+     * <pre> {@code
+     * for ((Map.Entry<K, V> entry : map.entrySet())
+     *     do {
+     *        K k = entry.getKey();
+     *        V v = entry.getValue();
+     *     } while(!replace(k, v, function.apply(k, v)));
+     * }</pre>
+     *
+     * The default implementation may retry these steps when multiple
+     * threads attempt updates including potentially calling the function
+     * repeatedly for a given key.
+     *
+     * <p>This implementation assumes that the ConcurrentMap cannot contain null
+     * values and {@code get()} returning null unambiguously means the key is
+     * absent. Implementations which support null values <strong>must</strong>
+     * override this default implementation.
+     *
+     * @throws UnsupportedOperationException {@inheritDoc}
+     * @throws NullPointerException {@inheritDoc}
+     * @throws ClassCastException {@inheritDoc}
+     * @throws IllegalArgumentException {@inheritDoc}
+     * @since 1.8
      */
     @Override
     default void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) {
@@ -200,11 +277,243 @@
         forEach((k,v) -> {
             while(!replace(k, v, function.apply(k, v))) {
                 // v changed or k is gone
-                if( (v = get(k)) == null) {
+                if ( (v = get(k)) == null) {
                     // k is no longer in the map.
                     break;
                 }
             }
         });
     }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @implSpec
+     * The default implementation is equivalent to the following steps for this
+     * {@code map}, then returning the current value or {@code null} if now
+     * absent:
+     *
+     * <pre> {@code
+     * if (map.get(key) == null) {
+     *     V newValue = mappingFunction.apply(key);
+     *     if (newValue != null)
+     *         return map.putIfAbsent(key, newValue);
+     * }
+     * }</pre>
+     *
+     * The default implementation may retry these steps when multiple
+     * threads attempt updates including potentially calling the mapping
+     * function multiple times.
+     *
+     * <p>This implementation assumes that the ConcurrentMap cannot contain null
+     * values and {@code get()} returning null unambiguously means the key is
+     * absent. Implementations which support null values <strong>must</strong>
+     * override this default implementation.
+     *
+     * @throws UnsupportedOperationException {@inheritDoc}
+     * @throws ClassCastException {@inheritDoc}
+     * @throws NullPointerException {@inheritDoc}
+     * @since 1.8
+     */
+    @Override
+    default V computeIfAbsent(K key,
+            Function<? super K, ? extends V> mappingFunction) {
+        Objects.requireNonNull(mappingFunction);
+        V v, newValue;
+        return ((v = get(key)) == null &&
+                (newValue = mappingFunction.apply(key)) != null &&
+                (v = putIfAbsent(key, newValue)) == null) ? newValue : v;
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @implSpec
+     * The default implementation is equivalent to performing the following
+     * steps for this {@code map}, then returning the current value or
+     * {@code null} if now absent. :
+     *
+     * <pre> {@code
+     * if (map.get(key) != null) {
+     *     V oldValue = map.get(key);
+     *     V newValue = remappingFunction.apply(key, oldValue);
+     *     if (newValue != null)
+     *         map.replace(key, oldValue, newValue);
+     *     else
+     *         map.remove(key, oldValue);
+     * }
+     * }</pre>
+     *
+     * The default implementation may retry these steps when multiple threads
+     * attempt updates including potentially calling the remapping function
+     * multiple times.
+     *
+     * <p>This implementation assumes that the ConcurrentMap cannot contain null
+     * values and {@code get()} returning null unambiguously means the key is
+     * absent. Implementations which support null values <strong>must</strong>
+     * override this default implementation.
+     *
+     * @throws UnsupportedOperationException {@inheritDoc}
+     * @throws ClassCastException {@inheritDoc}
+     * @throws NullPointerException {@inheritDoc}
+     * @since 1.8
+     */
+    @Override
+    default V computeIfPresent(K key,
+            BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
+        Objects.requireNonNull(remappingFunction);
+        V oldValue;
+        while((oldValue = get(key)) != null) {
+            V newValue = remappingFunction.apply(key, oldValue);
+            if (newValue != null) {
+                if (replace(key, oldValue, newValue))
+                    return newValue;
+            } else if (remove(key, oldValue))
+               return null;
+        }
+        return oldValue;
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @implSpec
+     * The default implementation is equivalent to performing the following
+     * steps for this {@code map}, then returning the current value or
+     * {@code null} if absent:
+     *
+     * <pre> {@code
+     * V oldValue = map.get(key);
+     * V newValue = remappingFunction.apply(key, oldValue);
+     * if (oldValue != null ) {
+     *    if (newValue != null)
+     *       map.replace(key, oldValue, newValue);
+     *    else
+     *       map.remove(key, oldValue);
+     * } else {
+     *    if (newValue != null)
+     *       map.putIfAbsent(key, newValue);
+     *    else
+     *       return null;
+     * }
+     * }</pre>
+     *
+     * The default implementation may retry these steps when multiple
+     * threads attempt updates including potentially calling the remapping
+     * function multiple times.
+     *
+     * <p>This implementation assumes that the ConcurrentMap cannot contain null
+     * values and {@code get()} returning null unambiguously means the key is
+     * absent. Implementations which support null values <strong>must</strong>
+     * override this default implementation.
+     *
+     * @throws UnsupportedOperationException {@inheritDoc}
+     * @throws ClassCastException {@inheritDoc}
+     * @throws NullPointerException {@inheritDoc}
+     * @since 1.8
+     */
+    @Override
+    default V compute(K key,
+            BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
+        Objects.requireNonNull(remappingFunction);
+        V oldValue = get(key);
+        for(;;) {
+            V newValue = remappingFunction.apply(key, oldValue);
+            if (newValue == null) {
+                // delete mapping
+                if (oldValue != null || containsKey(key)) {
+                    // something to remove
+                    if (remove(key, oldValue)) {
+                        // removed the old value as expected
+                        return null;
+                    }
+
+                    // some other value replaced old value. try again.
+                    oldValue = get(key);
+                } else {
+                    // nothing to do. Leave things as they were.
+                    return null;
+                }
+            } else {
+                // add or replace old mapping
+                if (oldValue != null) {
+                    // replace
+                    if (replace(key, oldValue, newValue)) {
+                        // replaced as expected.
+                        return newValue;
+                    }
+
+                    // some other value replaced old value. try again.
+                    oldValue = get(key);
+                } else {
+                    // add (replace if oldValue was null)
+                    if ((oldValue = putIfAbsent(key, newValue)) == null) {
+                        // replaced
+                        return newValue;
+                    }
+
+                    // some other value replaced old value. try again.
+                }
+            }
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     *
+     * @implSpec
+     * The default implementation is equivalent to performing the
+     * following steps for this {@code map}, then returning the
+     * current value or {@code null} if absent:
+     *
+     * <pre> {@code
+     * V oldValue = map.get(key);
+     * V newValue = (oldValue == null) ? value :
+     *              remappingFunction.apply(oldValue, value);
+     * if (newValue == null)
+     *     map.remove(key);
+     * else if (oldValue == null)
+     *     map.remove(key);
+     * else
+     *     map.put(key, newValue);
+     * }</pre>
+     *
+     * <p>The default implementation may retry these steps when multiple
+     * threads attempt updates including potentially calling the remapping
+     * function multiple times.
+     *
+     * <p>This implementation assumes that the ConcurrentMap cannot contain null
+     * values and {@code get()} returning null unambiguously means the key is
+     * absent. Implementations which support null values <strong>must</strong>
+     * override this default implementation.
+     *
+     * @throws UnsupportedOperationException {@inheritDoc}
+     * @throws ClassCastException {@inheritDoc}
+     * @throws NullPointerException {@inheritDoc}
+     * @since 1.8
+     */
+    @Override
+    default V merge(K key, V value,
+            BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
+        Objects.requireNonNull(remappingFunction);
+        Objects.requireNonNull(value);
+        V oldValue = get(key);
+        for (;;) {
+            if (oldValue != null) {
+                V newValue = remappingFunction.apply(oldValue, value);
+                if (newValue != null) {
+                    if (replace(key, oldValue, newValue))
+                        return newValue;
+                } else if (remove(key, oldValue)) {
+                    return null;
+                }
+                oldValue = get(key);
+            } else {
+                if ((oldValue = putIfAbsent(key, value)) == null) {
+                    return value;
+                }
+            }
+        }
+    }
 }
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Wed Jul 05 19:21:26 2017 +0200
@@ -265,7 +265,7 @@
      * highly contended cases.
      *
      * Unlike most skip-list implementations, index insertion and
-     * deletion here require a separate traversal pass occuring after
+     * deletion here require a separate traversal pass occurring after
      * the base-level action, to add or remove index nodes.  This adds
      * to single-threaded overhead, but improves contended
      * multithreaded performance by narrowing interference windows,
--- a/jdk/src/share/classes/java/util/concurrent/ExecutorCompletionService.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ExecutorCompletionService.java	Wed Jul 05 19:21:26 2017 +0200
@@ -161,7 +161,7 @@
      * @param completionQueue the queue to use as the completion queue
      *        normally one dedicated for use by this service. This
      *        queue is treated as unbounded -- failed attempted
-     *        {@code Queue.add} operations for completed taskes cause
+     *        {@code Queue.add} operations for completed tasks cause
      *        them not to be retrievable.
      * @throws NullPointerException if executor or completionQueue are {@code null}
      */
--- a/jdk/src/share/classes/java/util/concurrent/Future.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/Future.java	Wed Jul 05 19:21:26 2017 +0200
@@ -52,8 +52,8 @@
  *
  * <p>
  * <b>Sample Usage</b> (Note that the following classes are all
- * made-up.) <p>
- *  <pre> {@code
+ * made-up.)
+ * <pre> {@code
  * interface ArchiveSearcher { String search(String target); }
  * class App {
  *   ExecutorService executor = ...
--- a/jdk/src/share/classes/java/util/concurrent/atomic/DoubleAccumulator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/DoubleAccumulator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -224,18 +224,71 @@
         return (float)get();
     }
 
-    private void writeObject(java.io.ObjectOutputStream s)
-        throws java.io.IOException {
-        s.defaultWriteObject();
-        s.writeDouble(get());
+    /**
+     * Serialization proxy, used to avoid reference to the non-public
+     * Striped64 superclass in serialized forms.
+     * @serial include
+     */
+    private static class SerializationProxy implements Serializable {
+        private static final long serialVersionUID = 7249069246863182397L;
+
+        /**
+         * The current value returned by get().
+         * @serial
+         */
+        private final double value;
+        /**
+         * The function used for updates.
+         * @serial
+         */
+        private final DoubleBinaryOperator function;
+        /**
+         * The identity value
+         * @serial
+         */
+        private final long identity;
+
+        SerializationProxy(DoubleAccumulator a) {
+            function = a.function;
+            identity = a.identity;
+            value = a.get();
+        }
+
+        /**
+         * Returns a {@code DoubleAccumulator} object with initial state
+         * held by this proxy.
+         *
+         * @return a {@code DoubleAccumulator} object with initial state
+         * held by this proxy.
+         */
+        private Object readResolve() {
+            double d = Double.longBitsToDouble(identity);
+            DoubleAccumulator a = new DoubleAccumulator(function, d);
+            a.base = Double.doubleToRawLongBits(value);
+            return a;
+        }
     }
 
+    /**
+     * Returns a
+     * <a href="../../../../serialized-form.html#java.util.concurrent.atomic.DoubleAccumulator.SerializationProxy">
+     * SerializationProxy</a>
+     * representing the state of this instance.
+     *
+     * @return a {@link SerializationProxy}
+     * representing the state of this instance
+     */
+    private Object writeReplace() {
+        return new SerializationProxy(this);
+    }
+
+    /**
+     * @param s the stream
+     * @throws java.io.InvalidObjectException always
+     */
     private void readObject(java.io.ObjectInputStream s)
-        throws java.io.IOException, ClassNotFoundException {
-        s.defaultReadObject();
-        cellsBusy = 0;
-        cells = null;
-        base = Double.doubleToRawLongBits(s.readDouble());
+        throws java.io.InvalidObjectException {
+        throw new java.io.InvalidObjectException("Proxy required");
     }
 
 }
--- a/jdk/src/share/classes/java/util/concurrent/atomic/DoubleAdder.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/DoubleAdder.java	Wed Jul 05 19:21:26 2017 +0200
@@ -210,18 +210,58 @@
         return (float)sum();
     }
 
-    private void writeObject(java.io.ObjectOutputStream s)
-        throws java.io.IOException {
-        s.defaultWriteObject();
-        s.writeDouble(sum());
+    /**
+     * Serialization proxy, used to avoid reference to the non-public
+     * Striped64 superclass in serialized forms.
+     * @serial include
+     */
+    private static class SerializationProxy implements Serializable {
+        private static final long serialVersionUID = 7249069246863182397L;
+
+        /**
+         * The current value returned by sum().
+         * @serial
+         */
+        private final double value;
+
+        SerializationProxy(DoubleAdder a) {
+            value = a.sum();
+        }
+
+        /**
+         * Returns a {@code DoubleAdder} object with initial state
+         * held by this proxy.
+         *
+         * @return a {@code DoubleAdder} object with initial state
+         * held by this proxy.
+         */
+        private Object readResolve() {
+            DoubleAdder a = new DoubleAdder();
+            a.base = Double.doubleToRawLongBits(value);
+            return a;
+        }
     }
 
+    /**
+     * Returns a
+     * <a href="../../../../serialized-form.html#java.util.concurrent.atomic.DoubleAdder.SerializationProxy">
+     * SerializationProxy</a>
+     * representing the state of this instance.
+     *
+     * @return a {@link SerializationProxy}
+     * representing the state of this instance
+     */
+    private Object writeReplace() {
+        return new SerializationProxy(this);
+    }
+
+    /**
+     * @param s the stream
+     * @throws java.io.InvalidObjectException always
+     */
     private void readObject(java.io.ObjectInputStream s)
-        throws java.io.IOException, ClassNotFoundException {
-        s.defaultReadObject();
-        cellsBusy = 0;
-        cells = null;
-        base = Double.doubleToRawLongBits(s.readDouble());
+        throws java.io.InvalidObjectException {
+        throw new java.io.InvalidObjectException("Proxy required");
     }
 
 }
--- a/jdk/src/share/classes/java/util/concurrent/atomic/LongAccumulator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/LongAccumulator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -221,18 +221,70 @@
         return (double)get();
     }
 
-    private void writeObject(java.io.ObjectOutputStream s)
-        throws java.io.IOException {
-        s.defaultWriteObject();
-        s.writeLong(get());
+    /**
+     * Serialization proxy, used to avoid reference to the non-public
+     * Striped64 superclass in serialized forms.
+     * @serial include
+     */
+    private static class SerializationProxy implements Serializable {
+        private static final long serialVersionUID = 7249069246863182397L;
+
+        /**
+         * The current value returned by get().
+         * @serial
+         */
+        private final long value;
+        /**
+         * The function used for updates.
+         * @serial
+         */
+        private final LongBinaryOperator function;
+        /**
+         * The identity value
+         * @serial
+         */
+        private final long identity;
+
+        SerializationProxy(LongAccumulator a) {
+            function = a.function;
+            identity = a.identity;
+            value = a.get();
+        }
+
+        /**
+         * Returns a {@code LongAccumulator} object with initial state
+         * held by this proxy.
+         *
+         * @return a {@code LongAccumulator} object with initial state
+         * held by this proxy.
+         */
+        private Object readResolve() {
+            LongAccumulator a = new LongAccumulator(function, identity);
+            a.base = value;
+            return a;
+        }
     }
 
+    /**
+     * Returns a
+     * <a href="../../../../serialized-form.html#java.util.concurrent.atomic.LongAccumulator.SerializationProxy">
+     * SerializationProxy</a>
+     * representing the state of this instance.
+     *
+     * @return a {@link SerializationProxy}
+     * representing the state of this instance
+     */
+    private Object writeReplace() {
+        return new SerializationProxy(this);
+    }
+
+    /**
+     * @param s the stream
+     * @throws java.io.InvalidObjectException always
+     */
     private void readObject(java.io.ObjectInputStream s)
-        throws java.io.IOException, ClassNotFoundException {
-        s.defaultReadObject();
-        cellsBusy = 0;
-        cells = null;
-        base = s.readLong();
+        throws java.io.InvalidObjectException {
+        throw new java.io.InvalidObjectException("Proxy required");
     }
 
 }
--- a/jdk/src/share/classes/java/util/concurrent/atomic/LongAdder.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/LongAdder.java	Wed Jul 05 19:21:26 2017 +0200
@@ -211,18 +211,58 @@
         return (double)sum();
     }
 
-    private void writeObject(java.io.ObjectOutputStream s)
-        throws java.io.IOException {
-        s.defaultWriteObject();
-        s.writeLong(sum());
+    /**
+     * Serialization proxy, used to avoid reference to the non-public
+     * Striped64 superclass in serialized forms.
+     * @serial include
+     */
+    private static class SerializationProxy implements Serializable {
+        private static final long serialVersionUID = 7249069246863182397L;
+
+        /**
+         * The current value returned by sum().
+         * @serial
+         */
+        private final long value;
+
+        SerializationProxy(LongAdder a) {
+            value = a.sum();
+        }
+
+        /**
+         * Return a {@code LongAdder} object with initial state
+         * held by this proxy.
+         *
+         * @return a {@code LongAdder} object with initial state
+         * held by this proxy.
+         */
+        private Object readResolve() {
+            LongAdder a = new LongAdder();
+            a.base = value;
+            return a;
+        }
     }
 
+    /**
+     * Returns a
+     * <a href="../../../../serialized-form.html#java.util.concurrent.atomic.LongAdder.SerializationProxy">
+     * SerializationProxy</a>
+     * representing the state of this instance.
+     *
+     * @return a {@link SerializationProxy}
+     * representing the state of this instance
+     */
+    private Object writeReplace() {
+        return new SerializationProxy(this);
+    }
+
+    /**
+     * @param s the stream
+     * @throws java.io.InvalidObjectException always
+     */
     private void readObject(java.io.ObjectInputStream s)
-        throws java.io.IOException, ClassNotFoundException {
-        s.defaultReadObject();
-        cellsBusy = 0;
-        cells = null;
-        base = s.readLong();
+        throws java.io.InvalidObjectException {
+        throw new java.io.InvalidObjectException("Proxy required");
     }
 
 }
--- a/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java	Wed Jul 05 19:21:26 2017 +0200
@@ -56,7 +56,6 @@
  * constraints.  A nonfair lock that is continuously contended may
  * indefinitely postpone one or more reader or writer threads, but
  * will normally have higher throughput than a fair lock.
- * <p>
  *
  * <dt><b><i>Fair mode</i></b>
  * <dd>When constructed as fair, threads contend for entry using an
--- a/jdk/src/share/classes/java/util/function/package-info.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/function/package-info.java	Wed Jul 05 19:21:26 2017 +0200
@@ -60,7 +60,11 @@
  * actions, or predicates.  In documenting functional interfaces, or referring
  * to variables typed as functional interfaces, it is common to refer directly
  * to those abstract concepts, for example using "this function" instead of
- * "the function represented by this object".
+ * "the function represented by this object".  When an API method is said to
+ * accept or return a functional interface in this manner, such as "applies the
+ * provided function to...", this is understood to mean a <i>non-null</i>
+ * reference to an object implementing the appropriate functional interface,
+ * unless potential nullity is explicitly specified.
  *
  * <p>The functional interfaces in this package follow an extensible naming
  * convention, as follows:
--- a/jdk/src/share/classes/java/util/jar/Manifest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/jar/Manifest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -63,7 +63,7 @@
      * Constructs a new Manifest from the specified input stream.
      *
      * @param is the input stream containing manifest data
-     * @throws IOException if an I/O error has occured
+     * @throws IOException if an I/O error has occurred
      */
     public Manifest(InputStream is) throws IOException {
         read(is);
--- a/jdk/src/share/classes/java/util/jar/Pack200.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/jar/Pack200.java	Wed Jul 05 19:21:26 2017 +0200
@@ -44,7 +44,7 @@
  * The unpacker  engine is used by deployment applications to
  * transform the byte-stream back to JAR format.
  * <p>
- * Here is an example using  packer and unpacker:<p>
+ * Here is an example using  packer and unpacker:
  * <pre>{@code
  *    import java.util.jar.Pack200;
  *    import java.util.jar.Pack200.*;
--- a/jdk/src/share/classes/java/util/logging/LogManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -770,9 +770,10 @@
             ref = owner.new LoggerWeakRef(logger);
             namedLoggers.put(name, ref);
 
-            // Apply any initial level defined for the new logger.
+            // Apply any initial level defined for the new logger, unless
+            // the logger's level is already initialized
             Level level = owner.getLevelProperty(name + ".level", null);
-            if (level != null) {
+            if (level != null && !logger.isLevelInitialized()) {
                 doSetLevel(logger, level);
             }
 
--- a/jdk/src/share/classes/java/util/logging/Logger.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/logging/Logger.java	Wed Jul 05 19:21:26 2017 +0200
@@ -150,7 +150,7 @@
  * has or inherited a resource bundle name, then that resource bundle name
  * will be mapped to a {@code ResourceBundle} object, using the default Locale
  * at the time of logging.
- * <br><a name="ResourceBundleMapping"/>When mapping resource bundle names to
+ * <br id="ResourceBundleMapping">When mapping resource bundle names to
  * {@code ResourceBundle} objects, the logger will first try to use the
  * Thread's {@linkplain java.lang.Thread#getContextClassLoader() context class
  * loader} to map the given resource bundle name to a {@code ResourceBundle}.
@@ -555,7 +555,9 @@
      * Even although the new logger is anonymous, it is configured
      * to have the root logger ("") as its parent.  This means that
      * by default it inherits its effective level and handlers
-     * from the root logger.
+     * from the root logger. Changing its parent via the
+     * {@link #setParent(java.util.logging.Logger) setParent} method
+     * will still require the security permission specified by that method.
      * <p>
      *
      * @return a newly created private Logger
@@ -579,7 +581,9 @@
      * Even although the new logger is anonymous, it is configured
      * to have the root logger ("") as its parent.  This means that
      * by default it inherits its effective level and handlers
-     * from the root logger.
+     * from the root logger.  Changing its parent via the
+     * {@link #setParent(java.util.logging.Logger) setParent} method
+     * will still require the security permission specified by that method.
      * <p>
      * @param   resourceBundleName  name of ResourceBundle to be used for localizing
      *                          messages for this logger.
@@ -648,8 +652,9 @@
      * be published.
      *
      * @param   newFilter  a filter object (may be null)
-     * @exception  SecurityException  if a security manager exists and if
-     *             the caller does not have LoggingPermission("control").
+     * @throws  SecurityException if a security manager exists,
+     *          this logger is not anonymous, and the caller
+     *          does not have LoggingPermission("control").
      */
     public void setFilter(Filter newFilter) throws SecurityException {
         checkPermission();
@@ -1629,8 +1634,9 @@
      * (non-null) level value.
      *
      * @param newLevel   the new value for the log level (may be null)
-     * @exception  SecurityException  if a security manager exists and if
-     *             the caller does not have LoggingPermission("control").
+     * @throws  SecurityException if a security manager exists,
+     *          this logger is not anonymous, and the caller
+     *          does not have LoggingPermission("control").
      */
     public void setLevel(Level newLevel) throws SecurityException {
         checkPermission();
@@ -1640,6 +1646,10 @@
         }
     }
 
+    final boolean isLevelInitialized() {
+        return levelObject != null;
+    }
+
     /**
      * Get the log Level that has been specified for this Logger.
      * The result may be null, which means that this logger's
@@ -1682,8 +1692,9 @@
      * that essentially act as default handlers for all loggers.
      *
      * @param   handler a logging Handler
-     * @exception  SecurityException  if a security manager exists and if
-     *             the caller does not have LoggingPermission("control").
+     * @throws  SecurityException if a security manager exists,
+     *          this logger is not anonymous, and the caller
+     *          does not have LoggingPermission("control").
      */
     public void addHandler(Handler handler) throws SecurityException {
         // Check for null handler
@@ -1698,8 +1709,9 @@
      * Returns silently if the given Handler is not found or is null
      *
      * @param   handler a logging Handler
-     * @exception  SecurityException  if a security manager exists and if
-     *             the caller does not have LoggingPermission("control").
+     * @throws  SecurityException if a security manager exists,
+     *          this logger is not anonymous, and the caller
+     *          does not have LoggingPermission("control").
      */
     public void removeHandler(Handler handler) throws SecurityException {
         checkPermission();
@@ -1726,8 +1738,9 @@
      *
      * @param useParentHandlers   true if output is to be sent to the
      *          logger's parent.
-     * @exception  SecurityException  if a security manager exists and if
-     *             the caller does not have LoggingPermission("control").
+     * @throws  SecurityException if a security manager exists,
+     *          this logger is not anonymous, and the caller
+     *          does not have LoggingPermission("control").
      */
     public void setUseParentHandlers(boolean useParentHandlers) {
         checkPermission();
@@ -1890,8 +1903,9 @@
      *         {@linkplain ResourceBundle#getBaseBundleName base name},
      *         or if this logger already has a resource bundle set but
      *         the given bundle has a different base name.
-     * @throws SecurityException  if a security manager exists and if
-     *         the caller does not have LoggingPermission("control").
+     * @throws SecurityException if a security manager exists,
+     *         this logger is not anonymous, and the caller
+     *         does not have LoggingPermission("control").
      * @since 1.8
      */
     public void setResourceBundle(ResourceBundle bundle) {
@@ -1948,14 +1962,20 @@
      * It should not be called from application code.
      * <p>
      * @param  parent   the new parent logger
-     * @exception  SecurityException  if a security manager exists and if
-     *             the caller does not have LoggingPermission("control").
+     * @throws  SecurityException  if a security manager exists and if
+     *          the caller does not have LoggingPermission("control").
      */
     public void setParent(Logger parent) {
         if (parent == null) {
             throw new NullPointerException();
         }
-        checkPermission();
+
+        // check permission for all loggers, including anonymous loggers
+        if (manager == null) {
+            manager = LogManager.getLogManager();
+        }
+        manager.checkPermission();
+
         doSetParent(parent);
     }
 
--- a/jdk/src/share/classes/java/util/regex/Pattern.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/regex/Pattern.java	Wed Jul 05 19:21:26 2017 +0200
@@ -618,7 +618,7 @@
  * are in conformance with the recommendation of <i>Annex C: Compatibility Properties</i>
  * of <a href="http://www.unicode.org/reports/tr18/"><i>Unicode Regular Expression
  * </i></a>, when {@link #UNICODE_CHARACTER_CLASS} flag is specified.
- * <p>
+ *
  * <table border="0" cellpadding="1" cellspacing="0"
  *  summary="predefined and posix character classes in Unicode mode">
  * <tr align="left">
@@ -2438,7 +2438,7 @@
             // single 0x0B). This breaks the range if '\v' is used as
             // the start or end value, such as [\v-...] or [...-\v], in
             // which a single definite value (0x0B) is expected. For
-            // compatiblity concern '\013'/0x0B is returned if isrange.
+            // compatibility concern '\013'/0x0B is returned if isrange.
             if (isrange)
                 return '\013';
             if (create) root = new VertWS();
--- a/jdk/src/share/classes/java/util/spi/LocaleServiceProvider.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/spi/LocaleServiceProvider.java	Wed Jul 05 19:21:26 2017 +0200
@@ -41,7 +41,7 @@
  * <code>java.util</code> packages use implementations of the provider
  * interfaces to offer support for locales beyond the set of locales
  * supported by the Java runtime environment itself.
- * <p>
+ *
  * <h3>Packaging of Locale Sensitive Service Provider Implementations</h3>
  * Implementations of these locale sensitive services are packaged using the
  * <a href="../../../../technotes/guides/extensions/index.html">Java Extension Mechanism</a>
--- a/jdk/src/share/classes/java/util/stream/BaseStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/BaseStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -35,9 +35,10 @@
 import java.util.function.Predicate;
 
 /**
- * A sequence of elements supporting sequential and parallel aggregate
- * operations.  The following example illustrates an aggregate operation using
- * {@link Stream} and {@link IntStream}:
+ * Base interface for streams, which are sequences of elements supporting
+ * sequential and parallel aggregate operations.  The following example
+ * illustrates an aggregate operation using the stream types {@link Stream}
+ * and {@link IntStream}, computing the sum of the weights of the red widgets:
  *
  * <pre>{@code
  *     int sum = widgets.stream()
@@ -46,80 +47,18 @@
  *                      .sum();
  * }</pre>
  *
- * In this example, {@code widgets} is a {@code Collection<Widget>}.  We create
- * a stream of {@code Widget} objects via {@link Collection#stream Collection.stream()},
- * filter it to produce a stream containing only the red widgets, and then
- * transform it into a stream of {@code int} values representing the weight of
- * each red widget. Then this stream is summed to produce a total weight.
- *
- * <p>To perform a computation, stream
- * <a href="package-summary.html#StreamOps">operations</a> are composed into a
- * <em>stream pipeline</em>.  A stream pipeline consists of a source (which
- * might be an array, a collection, a generator function, an IO channel,
- * etc), zero or more <em>intermediate operations</em> (which transform a
- * stream into another stream, such as {@link Stream#filter(Predicate)}), and a
- * <em>terminal operation</em> (which produces a result or side-effect, such
- * as {@link IntStream#sum()} or {@link IntStream#forEach(IntConsumer)}).
- * Streams are lazy; computation on the source data is only performed when the
- * terminal operation is initiated, and source elements are consumed only
- * as needed.
- *
- * <p>Collections and streams, while bearing some superficial similarities,
- * have different goals.  Collections are primarily concerned with the efficient
- * management of, and access to, their elements.  By contrast, streams do not
- * provide a means to directly access or manipulate their elements, and are
- * instead concerned with declaratively describing their source and the
- * computational operations which will be performed in aggregate on that source.
- * However, if the provided stream operations do not offer the desired
- * functionality, the {@link #iterator()} and {@link #spliterator()} operations
- * can be used to perform a controlled traversal.
- *
- * <p>A stream pipeline, like the "widgets" example above, can be viewed as
- * a <em>query</em> on the stream source.  Unless the source was explicitly
- * designed for concurrent modification (such as a {@link ConcurrentHashMap}),
- * unpredictable or erroneous behavior may result from modifying the stream
- * source while it is being queried.
- *
- * <p>Most stream operations accept parameters that describe user-specified
- * behavior, such as the lambda expression {@code w -> w.getWeight()} passed to
- * {@code mapToInt} in the example above.  Such parameters are always instances
- * of a <a href="../function/package-summary.html">functional interface</a> such
- * as {@link java.util.function.Function}, and are often lambda expressions or
- * method references.  These parameters can never be null, should not modify the
- * stream source, and should be
- * <a href="package-summary.html#NonInterference">effectively stateless</a>
- * (their result should not depend on any state that might change during
- * execution of the stream pipeline.)
- *
- * <p>A stream should be operated on (invoking an intermediate or terminal stream
- * operation) only once.  This rules out, for example, "forked" streams, where
- * the same source feeds two or more pipelines, or multiple traversals of the
- * same stream.  A stream implementation may throw {@link IllegalStateException}
- * if it detects that the stream is being reused. However, since some stream
- * operations may return their receiver rather than a new stream object, it may
- * not be possible to detect reuse in all cases.
- *
- * <p>Streams have a {@link #close()} method and implement {@link AutoCloseable},
- * but nearly all stream instances do not actually need to be closed after use.
- * Generally, only streams whose source is an IO channel (such as those returned
- * by {@link Files#lines(Path, Charset)}) will require closing.  Most streams
- * are backed by collections, arrays, or generating functions, which require no
- * special resource management.  (If a stream does require closing, it can be
- * declared as a resource in a {@code try}-with-resources statement.)
- *
- * <p>Stream pipelines may execute either sequentially or in
- * <a href="package-summary.html#Parallelism">parallel</a>.  This
- * execution mode is a property of the stream.  Streams are created
- * with an initial choice of sequential or parallel execution.  (For example,
- * {@link Collection#stream() Collection.stream()} creates a sequential stream,
- * and {@link Collection#parallelStream() Collection.parallelStream()} creates
- * a parallel one.)  This choice of execution mode may be modified by the
- * {@link #sequential()} or {@link #parallel()} methods, and may be queried with
- * the {@link #isParallel()} method.
+ * See the class documentation for {@link Stream} and the package documentation
+ * for <a href="package-summary.html">java.util.stream</a> for additional
+ * specification of streams, stream operations, stream pipelines, and
+ * parallelism, which governs the behavior of all stream types.
  *
  * @param <T> the type of the stream elements
  * @param <S> the type of of the stream implementing {@code BaseStream}
  * @since 1.8
+ * @see Stream
+ * @see IntStream
+ * @see LongStream
+ * @see DoubleStream
  * @see <a href="package-summary.html">java.util.stream</a>
  */
 public interface BaseStream<T, S extends BaseStream<T, S>>
--- a/jdk/src/share/classes/java/util/stream/Collectors.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/Collectors.java	Wed Jul 05 19:21:26 2017 +0200
@@ -462,7 +462,7 @@
      */
     public static <T> Collector<T, ?, Integer>
     summingInt(ToIntFunction<? super T> mapper) {
-        return new CollectorImpl<T, int[], Integer>(
+        return new CollectorImpl<>(
                 () -> new int[1],
                 (a, t) -> { a[0] += mapper.applyAsInt(t); },
                 (a, b) -> { a[0] += b[0]; return a; },
@@ -480,7 +480,7 @@
      */
     public static <T> Collector<T, ?, Long>
     summingLong(ToLongFunction<? super T> mapper) {
-        return new CollectorImpl<T, long[], Long>(
+        return new CollectorImpl<>(
                 () -> new long[1],
                 (a, t) -> { a[0] += mapper.applyAsLong(t); },
                 (a, b) -> { a[0] += b[0]; return a; },
@@ -505,7 +505,7 @@
      */
     public static <T> Collector<T, ?, Double>
     summingDouble(ToDoubleFunction<? super T> mapper) {
-        return new CollectorImpl<T, double[], Double>(
+        return new CollectorImpl<>(
                 () -> new double[1],
                 (a, t) -> { a[0] += mapper.applyAsDouble(t); },
                 (a, b) -> { a[0] += b[0]; return a; },
@@ -523,7 +523,7 @@
      */
     public static <T> Collector<T, ?, Double>
     averagingInt(ToIntFunction<? super T> mapper) {
-        return new CollectorImpl<T, long[], Double>(
+        return new CollectorImpl<>(
                 () -> new long[2],
                 (a, t) -> { a[0] += mapper.applyAsInt(t); a[1]++; },
                 (a, b) -> { a[0] += b[0]; a[1] += b[1]; return a; },
@@ -541,7 +541,7 @@
      */
     public static <T> Collector<T, ?, Double>
     averagingLong(ToLongFunction<? super T> mapper) {
-        return new CollectorImpl<T, long[], Double>(
+        return new CollectorImpl<>(
                 () -> new long[2],
                 (a, t) -> { a[0] += mapper.applyAsLong(t); a[1]++; },
                 (a, b) -> { a[0] += b[0]; a[1] += b[1]; return a; },
@@ -566,7 +566,7 @@
      */
     public static <T> Collector<T, ?, Double>
     averagingDouble(ToDoubleFunction<? super T> mapper) {
-        return new CollectorImpl<T, double[], Double>(
+        return new CollectorImpl<>(
                 () -> new double[2],
                 (a, t) -> { a[0] += mapper.applyAsDouble(t); a[1]++; },
                 (a, b) -> { a[0] += b[0]; a[1] += b[1]; return a; },
@@ -723,6 +723,14 @@
      *     groupingBy(classifier, toList());
      * }</pre>
      *
+     * @implNote
+     * The returned {@code Collector} is not concurrent.  For parallel stream
+     * pipelines, the {@code combiner} function operates by merging the keys
+     * from one map into another, which can be an expensive operation.  If
+     * preservation of the order in which elements appear in the resulting {@code Map}
+     * collector is not required, using {@link #groupingByConcurrent(Function)}
+     * may offer better parallel performance.
+     *
      * @param <T> the type of the input elements
      * @param <K> the type of the keys
      * @param classifier the classifier function mapping input elements to keys
@@ -759,6 +767,14 @@
      *                                              mapping(Person::getLastName, toSet())));
      * }</pre>
      *
+     * @implNote
+     * The returned {@code Collector} is not concurrent.  For parallel stream
+     * pipelines, the {@code combiner} function operates by merging the keys
+     * from one map into another, which can be an expensive operation.  If
+     * preservation of the order in which elements are presented to the downstream
+     * collector is not required, using {@link #groupingByConcurrent(Function, Collector)}
+     * may offer better parallel performance.
+     *
      * @param <T> the type of the input elements
      * @param <K> the type of the keys
      * @param <A> the intermediate accumulation type of the downstream collector
@@ -798,6 +814,14 @@
      *                                              mapping(Person::getLastName, toSet())));
      * }</pre>
      *
+     * @implNote
+     * The returned {@code Collector} is not concurrent.  For parallel stream
+     * pipelines, the {@code combiner} function operates by merging the keys
+     * from one map into another, which can be an expensive operation.  If
+     * preservation of the order in which elements are presented to the downstream
+     * collector is not required, using {@link #groupingByConcurrent(Function, Supplier, Collector)}
+     * may offer better parallel performance.
+     *
      * @param <T> the type of the input elements
      * @param <K> the type of the keys
      * @param <A> the intermediate accumulation type of the downstream collector
@@ -871,7 +895,7 @@
      * @param <T> the type of the input elements
      * @param <K> the type of the keys
      * @param classifier a classifier function mapping input elements to keys
-     * @return a {@code Collector} implementing the group-by operation
+     * @return a concurrent, unordered {@code Collector} implementing the group-by operation
      *
      * @see #groupingBy(Function)
      * @see #groupingByConcurrent(Function, Collector)
@@ -912,7 +936,7 @@
      * @param <D> the result type of the downstream reduction
      * @param classifier a classifier function mapping input elements to keys
      * @param downstream a {@code Collector} implementing the downstream reduction
-     * @return a {@code Collector} implementing the cascaded group-by operation
+     * @return a concurrent, unordered {@code Collector} implementing the cascaded group-by operation
      *
      * @see #groupingBy(Function, Collector)
      * @see #groupingByConcurrent(Function)
@@ -958,7 +982,7 @@
      * @param downstream a {@code Collector} implementing the downstream reduction
      * @param mapFactory a function which, when called, produces a new empty
      *                   {@code ConcurrentMap} of the desired type
-     * @return a {@code Collector} implementing the cascaded group-by operation
+     * @return a concurrent, unordered {@code Collector} implementing the cascaded group-by operation
      *
      * @see #groupingByConcurrent(Function)
      * @see #groupingByConcurrent(Function, Collector)
@@ -1072,7 +1096,7 @@
     }
 
     /**
-     * Returns a {@code Collector} that accumulate elements into a
+     * Returns a {@code Collector} that accumulates elements into a
      * {@code Map} whose keys and values are the result of applying the provided
      * mapping functions to the input elements.
      *
@@ -1101,6 +1125,14 @@
      *                                         Functions.identity());
      * }</pre>
      *
+     * @implNote
+     * The returned {@code Collector} is not concurrent.  For parallel stream
+     * pipelines, the {@code combiner} function operates by merging the keys
+     * from one map into another, which can be an expensive operation.  If it is
+     * not required that results are inserted into the {@code Map} in encounter
+     * order, using {@link #toConcurrentMap(Function, Function)}
+     * may offer better parallel performance.
+     *
      * @param <T> the type of the input elements
      * @param <K> the output type of the key mapping function
      * @param <U> the output type of the value mapping function
@@ -1121,7 +1153,7 @@
     }
 
     /**
-     * Returns a {@code Collector} that accumulate elements into a
+     * Returns a {@code Collector} that accumulates elements into a
      * {@code Map} whose keys and values are the result of applying the provided
      * mapping functions to the input elements.
      *
@@ -1146,6 +1178,14 @@
      *                                       (s, a) -> s + ", " + a));
      * }</pre>
      *
+     * @implNote
+     * The returned {@code Collector} is not concurrent.  For parallel stream
+     * pipelines, the {@code combiner} function operates by merging the keys
+     * from one map into another, which can be an expensive operation.  If it is
+     * not required that results are merged into the {@code Map} in encounter
+     * order, using {@link #toConcurrentMap(Function, Function, BinaryOperator)}
+     * may offer better parallel performance.
+     *
      * @param <T> the type of the input elements
      * @param <K> the output type of the key mapping function
      * @param <U> the output type of the value mapping function
@@ -1172,7 +1212,7 @@
     }
 
     /**
-     * Returns a {@code Collector} that accumulate elements into a
+     * Returns a {@code Collector} that accumulates elements into a
      * {@code Map} whose keys and values are the result of applying the provided
      * mapping functions to the input elements.
      *
@@ -1182,6 +1222,14 @@
      * results are merged using the provided merging function.  The {@code Map}
      * is created by a provided supplier function.
      *
+     * @implNote
+     * The returned {@code Collector} is not concurrent.  For parallel stream
+     * pipelines, the {@code combiner} function operates by merging the keys
+     * from one map into another, which can be an expensive operation.  If it is
+     * not required that results are merged into the {@code Map} in encounter
+     * order, using {@link #toConcurrentMap(Function, Function, BinaryOperator, Supplier)}
+     * may offer better parallel performance.
+     *
      * @param <T> the type of the input elements
      * @param <K> the output type of the key mapping function
      * @param <U> the output type of the value mapping function
@@ -1215,7 +1263,7 @@
     }
 
     /**
-     * Returns a {@code Collector} that accumulate elements into a
+     * Returns a concurrent {@code Collector} that accumulates elements into a
      * {@code ConcurrentMap} whose keys and values are the result of applying
      * the provided mapping functions to the input elements.
      *
@@ -1252,7 +1300,7 @@
      * @param <U> the output type of the value mapping function
      * @param keyMapper the mapping function to produce keys
      * @param valueMapper the mapping function to produce values
-     * @return a concurrent {@code Collector} which collects elements into a
+     * @return a concurrent, unordered {@code Collector} which collects elements into a
      * {@code ConcurrentMap} whose keys are the result of applying a key mapping
      * function to the input elements, and whose values are the result of
      * applying a value mapping function to the input elements
@@ -1268,7 +1316,7 @@
     }
 
     /**
-     * Returns a {@code Collector} that accumulate elements into a
+     * Returns a concurrent {@code Collector} that accumulates elements into a
      * {@code ConcurrentMap} whose keys and values are the result of applying
      * the provided mapping functions to the input elements.
      *
@@ -1303,7 +1351,7 @@
      * @param mergeFunction a merge function, used to resolve collisions between
      *                      values associated with the same key, as supplied
      *                      to {@link Map#merge(Object, Object, BiFunction)}
-     * @return a concurrent {@code Collector} which collects elements into a
+     * @return a concurrent, unordered {@code Collector} which collects elements into a
      * {@code ConcurrentMap} whose keys are the result of applying a key mapping
      * function to the input elements, and whose values are the result of
      * applying a value mapping function to all input elements equal to the key
@@ -1322,7 +1370,7 @@
     }
 
     /**
-     * Returns a {@code Collector} that accumulate elements into a
+     * Returns a concurrent {@code Collector} that accumulates elements into a
      * {@code ConcurrentMap} whose keys and values are the result of applying
      * the provided mapping functions to the input elements.
      *
@@ -1345,7 +1393,7 @@
      *                      to {@link Map#merge(Object, Object, BiFunction)}
      * @param mapSupplier a function which returns a new, empty {@code Map} into
      *                    which the results will be inserted
-     * @return a concurrent {@code Collector} which collects elements into a
+     * @return a concurrent, unordered {@code Collector} which collects elements into a
      * {@code ConcurrentMap} whose keys are the result of applying a key mapping
      * function to the input elements, and whose values are the result of
      * applying a value mapping function to all input elements equal to the key
--- a/jdk/src/share/classes/java/util/stream/DistinctOps.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/DistinctOps.java	Wed Jul 05 19:21:26 2017 +0200
@@ -54,6 +54,16 @@
     static <T> ReferencePipeline<T, T> makeRef(AbstractPipeline<?, T, ?> upstream) {
         return new ReferencePipeline.StatefulOp<T, T>(upstream, StreamShape.REFERENCE,
                                                       StreamOpFlag.IS_DISTINCT | StreamOpFlag.NOT_SIZED) {
+
+            <P_IN> Node<T> reduce(PipelineHelper<T> helper, Spliterator<P_IN> spliterator) {
+                // If the stream is SORTED then it should also be ORDERED so the following will also
+                // preserve the sort order
+                TerminalOp<T, LinkedHashSet<T>> reduceOp
+                        = ReduceOps.<T, LinkedHashSet<T>>makeRef(LinkedHashSet::new, LinkedHashSet::add,
+                                                                 LinkedHashSet::addAll);
+                return Nodes.node(reduceOp.evaluateParallel(helper, spliterator));
+            }
+
             @Override
             <P_IN> Node<T> opEvaluateParallel(PipelineHelper<T> helper,
                                               Spliterator<P_IN> spliterator,
@@ -63,12 +73,7 @@
                     return helper.evaluate(spliterator, false, generator);
                 }
                 else if (StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
-                    // If the stream is SORTED then it should also be ORDERED so the following will also
-                    // preserve the sort order
-                    TerminalOp<T, LinkedHashSet<T>> reduceOp
-                            = ReduceOps.<T, LinkedHashSet<T>>makeRef(LinkedHashSet::new, LinkedHashSet::add,
-                                                                     LinkedHashSet::addAll);
-                    return Nodes.node(reduceOp.evaluateParallel(helper, spliterator));
+                    return reduce(helper, spliterator);
                 }
                 else {
                     // Holder of null state since ConcurrentHashMap does not support null values
@@ -95,6 +100,22 @@
             }
 
             @Override
+            <P_IN> Spliterator<T> opEvaluateParallelLazy(PipelineHelper<T> helper, Spliterator<P_IN> spliterator) {
+                if (StreamOpFlag.DISTINCT.isKnown(helper.getStreamAndOpFlags())) {
+                    // No-op
+                    return helper.wrapSpliterator(spliterator);
+                }
+                else if (StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) {
+                    // Not lazy, barrier required to preserve order
+                    return reduce(helper, spliterator).spliterator();
+                }
+                else {
+                    // Lazy
+                    return new StreamSpliterators.DistinctSpliterator<>(helper.wrapSpliterator(spliterator));
+                }
+            }
+
+            @Override
             Sink<T> opWrapSink(int flags, Sink<T> sink) {
                 Objects.requireNonNull(sink);
 
--- a/jdk/src/share/classes/java/util/stream/DoubleStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/DoubleStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -50,9 +50,13 @@
 import java.util.function.Supplier;
 
 /**
- * A sequence of elements supporting sequential and parallel aggregate
- * operations.  The following example illustrates an aggregate operation using
- * {@link Stream} and {@link DoubleStream}:
+ * A sequence of primitive double-valued elements supporting sequential and parallel
+ * aggregate operations.  This is the {@code double} primitive specialization of
+ * {@link Stream}.
+ *
+ * <p>The following example illustrates an aggregate operation using
+ * {@link Stream} and {@link DoubleStream}, computing the sum of the weights of the
+ * red widgets:
  *
  * <pre>{@code
  *     double sum = widgets.stream()
@@ -61,78 +65,13 @@
  *                         .sum();
  * }</pre>
  *
- * In this example, {@code widgets} is a {@code Collection<Widget>}.  We create
- * a stream of {@code Widget} objects via {@link Collection#stream Collection.stream()},
- * filter it to produce a stream containing only the red widgets, and then
- * transform it into a stream of {@code double} values representing the weight of
- * each red widget. Then this stream is summed to produce a total weight.
- *
- * <p>To perform a computation, stream
- * <a href="package-summary.html#StreamOps">operations</a> are composed into a
- * <em>stream pipeline</em>.  A stream pipeline consists of a source (which
- * might be an array, a collection, a generator function, an IO channel,
- * etc), zero or more <em>intermediate operations</em> (which transform a
- * stream into another stream, such as {@link DoubleStream#filter(DoublePredicate)}), and a
- * <em>terminal operation</em> (which produces a result or side-effect, such
- * as {@link DoubleStream#sum()} or {@link DoubleStream#forEach(DoubleConsumer)}.
- * Streams are lazy; computation on the source data is only performed when the
- * terminal operation is initiated, and source elements are consumed only
- * as needed.
- *
- * <p>Collections and streams, while bearing some superficial similarities,
- * have different goals.  Collections are primarily concerned with the efficient
- * management of, and access to, their elements.  By contrast, streams do not
- * provide a means to directly access or manipulate their elements, and are
- * instead concerned with declaratively describing their source and the
- * computational operations which will be performed in aggregate on that source.
- * However, if the provided stream operations do not offer the desired
- * functionality, the {@link #iterator()} and {@link #spliterator()} operations
- * can be used to perform a controlled traversal.
- *
- * <p>A stream pipeline, like the "widgets" example above, can be viewed as
- * a <em>query</em> on the stream source.  Unless the source was explicitly
- * designed for concurrent modification (such as a {@link ConcurrentHashMap}),
- * unpredictable or erroneous behavior may result from modifying the stream
- * source while it is being queried.
- *
- * <p>Most stream operations accept parameters that describe user-specified
- * behavior, such as the lambda expression {@code w -> w.getWeight()} passed to
- * {@code mapToDouble} in the example above.  Such parameters are always instances
- * of a <a href="../function/package-summary.html">functional interface</a> such
- * as {@link java.util.function.Function}, and are often lambda expressions or
- * method references.  These parameters can never be null, should not modify the
- * stream source, and should be
- * <a href="package-summary.html#NonInterference">effectively stateless</a>
- * (their result should not depend on any state that might change during
- * execution of the stream pipeline.)
- *
- * <p>A stream should be operated on (invoking an intermediate or terminal stream
- * operation) only once.  This rules out, for example, "forked" streams, where
- * the same source feeds two or more pipelines, or multiple traversals of the
- * same stream.  A stream implementation may throw {@link IllegalStateException}
- * if it detects that the stream is being reused. However, since some stream
- * operations may return their receiver rather than a new stream object, it may
- * not be possible to detect reuse in all cases.
- *
- * <p>Streams have a {@link #close()} method and implement {@link AutoCloseable},
- * but nearly all stream instances do not actually need to be closed after use.
- * Generally, only streams whose source is an IO channel (such as those returned
- * by {@link Files#lines(Path, Charset)}) will require closing.  Most streams
- * are backed by collections, arrays, or generating functions, which require no
- * special resource management.  (If a stream does require closing, it can be
- * declared as a resource in a {@code try}-with-resources statement.)
- *
- * <p>Stream pipelines may execute either sequentially or in
- * <a href="package-summary.html#Parallelism">parallel</a>.  This
- * execution mode is a property of the stream.  Streams are created
- * with an initial choice of sequential or parallel execution.  (For example,
- * {@link Collection#stream() Collection.stream()} creates a sequential stream,
- * and {@link Collection#parallelStream() Collection.parallelStream()} creates
- * a parallel one.)  This choice of execution mode may be modified by the
- * {@link #sequential()} or {@link #parallel()} methods, and may be queried with
- * the {@link #isParallel()} method.
+ * See the class documentation for {@link Stream} and the package documentation
+ * for <a href="package-summary.html">java.util.stream</a> for additional
+ * specification of streams, stream operations, stream pipelines, and
+ * parallelism.
  *
  * @since 1.8
+ * @see Stream
  * @see <a href="package-summary.html">java.util.stream</a>
  */
 public interface DoubleStream extends BaseStream<Double, DoubleStream> {
@@ -144,9 +83,10 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">
-     *                  non-interfering, stateless</a> predicate to apply to
-     *                  each element to determine if it should be included
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to each element to determine if it
+     *                  should be included
      * @return the new stream
      */
     DoubleStream filter(DoublePredicate predicate);
@@ -158,9 +98,9 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to
-     *               each element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     DoubleStream map(DoubleUnaryOperator mapper);
@@ -173,9 +113,9 @@
      *     intermediate operation</a>.
      *
      * @param <U> the element type of the new stream
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     <U> Stream<U> mapToObj(DoubleFunction<? extends U> mapper);
@@ -187,9 +127,9 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     IntStream mapToInt(DoubleToIntFunction mapper);
@@ -201,9 +141,9 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     LongStream mapToLong(DoubleToLongFunction mapper);
@@ -218,10 +158,10 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to
-     *               each element which produces an {@code DoubleStream} of new
-     *               values
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element which produces a
+     *               {@code DoubleStream} of new values
      * @return the new stream
      * @see Stream#flatMap(Function)
      */
@@ -276,8 +216,8 @@
      * }</pre>
      *
      * @param action a <a href="package-summary.html#NonInterference">
-     *                 non-interfering</a> action to perform on the elements as
-     *                 they are consumed from the stream
+     *               non-interfering</a> action to perform on the elements as
+     *               they are consumed from the stream
      * @return the new stream
      */
     DoubleStream peek(DoubleConsumer action);
@@ -423,9 +363,10 @@
      * synchronization and with greatly reduced risk of data races.
      *
      * @param identity the identity value for the accumulating function
-     * @param op an <a href="package-summary.html#Associativity">associative</a>
-     *                    <a href="package-summary.html#NonInterference">non-interfering,
-     *                    stateless</a> function for combining two values
+     * @param op an <a href="package-summary.html#Associativity">associative</a>,
+     *           <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *           <a href="package-summary.html#Statelessness">stateless</a>
+     *           function for combining two values
      * @return the result of the reduction
      * @see #sum()
      * @see #min()
@@ -462,9 +403,10 @@
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
-     * @param op an <a href="package-summary.html#Associativity">associative</a>
-     *           <a href="package-summary.html#NonInterference">non-interfering,
-     *           stateless</a> function for combining two values
+     * @param op an <a href="package-summary.html#Associativity">associative</a>,
+     *           <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *           <a href="package-summary.html#Statelessness">stateless</a>
+     *           function for combining two values
      * @return the result of the reduction
      * @see #reduce(double, DoubleBinaryOperator)
      */
@@ -495,14 +437,15 @@
      * @param supplier a function that creates a new result container. For a
      *                 parallel execution, this function may be called
      *                 multiple times and must return a fresh value each time.
-     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
-     *                    <a href="package-summary.html#NonInterference">non-interfering,
-     *                    stateless</a> function for incorporating an additional
-     *                    element into a result
-     * @param combiner an <a href="package-summary.html#Associativity">associative</a>
-     *                 <a href="package-summary.html#NonInterference">non-interfering,
-     *                 stateless</a> function for combining two values, which
-     *                 must be compatible with the accumulator function
+     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>,
+     *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                    <a href="package-summary.html#Statelessness">stateless</a>
+     *                    function for incorporating an additional element into a result
+     * @param combiner an <a href="package-summary.html#Associativity">associative</a>,
+     *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                    <a href="package-summary.html#Statelessness">stateless</a>
+     *                    function for combining two values, which must be
+     *                    compatible with the accumulator function
      * @return the result of the reduction
      * @see Stream#collect(Supplier, BiConsumer, BiConsumer)
      */
@@ -544,8 +487,8 @@
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
-     * @apiNote Sorting values by increasing absolute magnitude tends to yield
-     * more accurate results.
+     * @apiNote Elements sorted by increasing absolute magnitude tend
+     * to yield more accurate results.
      *
      * @return the sum of elements in this stream
      */
@@ -651,48 +594,67 @@
     /**
      * Returns whether any elements of this stream match the provided
      * predicate.  May not evaluate the predicate on all elements if not
-     * necessary for determining the result.
+     * necessary for determining the result.  If the stream is empty then
+     * {@code false} is returned and the predicate is not evaluated.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
      * terminal operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
-     *                  stateless</a> predicate to apply to elements of this
-     *                  stream
+     * @apiNote
+     * This method evaluates the <em>existential quantification</em> of the
+     * predicate over the elements of the stream (for some x P(x)).
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements of this stream
      * @return {@code true} if any elements of the stream match the provided
-     * predicate otherwise {@code false}
+     * predicate, otherwise {@code false}
      */
     boolean anyMatch(DoublePredicate predicate);
 
     /**
      * Returns whether all elements of this stream match the provided predicate.
      * May not evaluate the predicate on all elements if not necessary for
-     * determining the result.
+     * determining the result.  If the stream is empty then {@code true} is
+     * returned and the predicate is not evaluated.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
      * terminal operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
-     *                  stateless</a> predicate to apply to elements of this
-     *                  stream
-     * @return {@code true} if all elements of the stream match the provided
-     * predicate otherwise {@code false}
+     * @apiNote
+     * This method evaluates the <em>universal quantification</em> of the
+     * predicate over the elements of the stream (for all x P(x)).  If the
+     * stream is empty, the quantification is said to be <em>vacuously
+     * satisfied</em> and is always {@code true} (regardless of P(x)).
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements of this stream
+     * @return {@code true} if either all elements of the stream match the
+     * provided predicate or the stream is empty, otherwise {@code false}
      */
     boolean allMatch(DoublePredicate predicate);
 
     /**
      * Returns whether no elements of this stream match the provided predicate.
      * May not evaluate the predicate on all elements if not necessary for
-     * determining the result.
+     * determining the result.  If the stream is empty then {@code true} is
+     * returned and the predicate is not evaluated.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
      * terminal operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
-     *                  stateless</a> predicate to apply to elements of this
-     *                  stream
-     * @return {@code true} if no elements of the stream match the provided
-     * predicate otherwise {@code false}
+     * @apiNote
+     * This method evaluates the <em>universal quantification</em> of the
+     * negated predicate over the elements of the stream (for all x ~P(x)).  If
+     * the stream is empty, the quantification is said to be vacuously satisfied
+     * and is always {@code true}, regardless of P(x).
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements of this stream
+     * @return {@code true} if either no elements of the stream match the
+     * provided predicate or the stream is empty, otherwise {@code false}
      */
     boolean noneMatch(DoublePredicate predicate);
 
@@ -832,12 +794,12 @@
     }
 
     /**
-     * Returns a sequential stream where each element is generated by
-     * the provided {@code DoubleSupplier}.  This is suitable for generating
-     * constant streams, streams of random elements, etc.
+     * Returns an infinite sequential unordered stream where each element is
+     * generated by the provided {@code DoubleSupplier}.  This is suitable for
+     * generating constant streams, streams of random elements, etc.
      *
      * @param s the {@code DoubleSupplier} for generated elements
-     * @return a new sequential {@code DoubleStream}
+     * @return a new infinite sequential unordered {@code DoubleStream}
      */
     public static DoubleStream generate(DoubleSupplier s) {
         Objects.requireNonNull(s);
@@ -848,11 +810,16 @@
     /**
      * Creates a lazily concatenated stream whose elements are all the
      * elements of the first stream followed by all the elements of the
-     * second stream. The resulting stream is ordered if both
+     * second stream.  The resulting stream is ordered if both
      * of the input streams are ordered, and parallel if either of the input
      * streams is parallel.  When the resulting stream is closed, the close
      * handlers for both input streams are invoked.
      *
+     * @implNote
+     * Use caution when constructing streams from repeated concatenation.
+     * Accessing an element of a deeply concatenated stream can result in deep
+     * call chains, or even {@code StackOverflowException}.
+     *
      * @param a the first stream
      * @param b the second stream
      * @return the concatenation of the two input streams
--- a/jdk/src/share/classes/java/util/stream/IntStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/IntStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -24,11 +24,7 @@
  */
 package java.util.stream;
 
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Path;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.IntSummaryStatistics;
 import java.util.Objects;
 import java.util.OptionalDouble;
@@ -36,7 +32,6 @@
 import java.util.PrimitiveIterator;
 import java.util.Spliterator;
 import java.util.Spliterators;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.function.BiConsumer;
 import java.util.function.Function;
 import java.util.function.IntBinaryOperator;
@@ -51,9 +46,13 @@
 import java.util.function.Supplier;
 
 /**
- * A sequence of elements supporting sequential and parallel aggregate
- * operations.  The following example illustrates an aggregate operation using
- * {@link Stream} and {@link IntStream}:
+ * A sequence of primitive int-valued elements supporting sequential and parallel
+ * aggregate operations.  This is the {@code int} primitive specialization of
+ * {@link Stream}.
+ *
+ * <p>The following example illustrates an aggregate operation using
+ * {@link Stream} and {@link IntStream}, computing the sum of the weights of the
+ * red widgets:
  *
  * <pre>{@code
  *     int sum = widgets.stream()
@@ -62,78 +61,13 @@
  *                      .sum();
  * }</pre>
  *
- * In this example, {@code widgets} is a {@code Collection<Widget>}.  We create
- * a stream of {@code Widget} objects via {@link Collection#stream Collection.stream()},
- * filter it to produce a stream containing only the red widgets, and then
- * transform it into a stream of {@code int} values representing the weight of
- * each red widget. Then this stream is summed to produce a total weight.
- *
- * <p>To perform a computation, stream
- * <a href="package-summary.html#StreamOps">operations</a> are composed into a
- * <em>stream pipeline</em>.  A stream pipeline consists of a source (which
- * might be an array, a collection, a generator function, an IO channel,
- * etc), zero or more <em>intermediate operations</em> (which transform a
- * stream into another stream, such as {@link IntStream#filter(IntPredicate)}), and a
- * <em>terminal operation</em> (which produces a result or side-effect, such
- * as {@link IntStream#sum()} or {@link IntStream#forEach(IntConsumer)}).
- * Streams are lazy; computation on the source data is only performed when the
- * terminal operation is initiated, and source elements are consumed only
- * as needed.
- *
- * <p>Collections and streams, while bearing some superficial similarities,
- * have different goals.  Collections are primarily concerned with the efficient
- * management of, and access to, their elements.  By contrast, streams do not
- * provide a means to directly access or manipulate their elements, and are
- * instead concerned with declaratively describing their source and the
- * computational operations which will be performed in aggregate on that source.
- * However, if the provided stream operations do not offer the desired
- * functionality, the {@link #iterator()} and {@link #spliterator()} operations
- * can be used to perform a controlled traversal.
- *
- * <p>A stream pipeline, like the "widgets" example above, can be viewed as
- * a <em>query</em> on the stream source.  Unless the source was explicitly
- * designed for concurrent modification (such as a {@link ConcurrentHashMap}),
- * unpredictable or erroneous behavior may result from modifying the stream
- * source while it is being queried.
- *
- * <p>Most stream operations accept parameters that describe user-specified
- * behavior, such as the lambda expression {@code w -> w.getWeight()} passed to
- * {@code mapToInt} in the example above.  Such parameters are always instances
- * of a <a href="../function/package-summary.html">functional interface</a> such
- * as {@link java.util.function.Function}, and are often lambda expressions or
- * method references.  These parameters can never be null, should not modify the
- * stream source, and should be
- * <a href="package-summary.html#NonInterference">effectively stateless</a>
- * (their result should not depend on any state that might change during
- * execution of the stream pipeline.)
- *
- * <p>A stream should be operated on (invoking an intermediate or terminal stream
- * operation) only once.  This rules out, for example, "forked" streams, where
- * the same source feeds two or more pipelines, or multiple traversals of the
- * same stream.  A stream implementation may throw {@link IllegalStateException}
- * if it detects that the stream is being reused. However, since some stream
- * operations may return their receiver rather than a new stream object, it may
- * not be possible to detect reuse in all cases.
- *
- * <p>Streams have a {@link #close()} method and implement {@link AutoCloseable},
- * but nearly all stream instances do not actually need to be closed after use.
- * Generally, only streams whose source is an IO channel (such as those returned
- * by {@link Files#lines(Path, Charset)}) will require closing.  Most streams
- * are backed by collections, arrays, or generating functions, which require no
- * special resource management.  (If a stream does require closing, it can be
- * declared as a resource in a {@code try}-with-resources statement.)
- *
- * <p>Stream pipelines may execute either sequentially or in
- * <a href="package-summary.html#Parallelism">parallel</a>.  This
- * execution mode is a property of the stream.  Streams are created
- * with an initial choice of sequential or parallel execution.  (For example,
- * {@link Collection#stream() Collection.stream()} creates a sequential stream,
- * and {@link Collection#parallelStream() Collection.parallelStream()} creates
- * a parallel one.)  This choice of execution mode may be modified by the
- * {@link #sequential()} or {@link #parallel()} methods, and may be queried with
- * the {@link #isParallel()} method.
+ * See the class documentation for {@link Stream} and the package documentation
+ * for <a href="package-summary.html">java.util.stream</a> for additional
+ * specification of streams, stream operations, stream pipelines, and
+ * parallelism.
  *
  * @since 1.8
+ * @see Stream
  * @see <a href="package-summary.html">java.util.stream</a>
  */
 public interface IntStream extends BaseStream<Integer, IntStream> {
@@ -145,9 +79,10 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">
-     *                  non-interfering, stateless</a> predicate to apply to
-     *                  each element to determine if it should be included
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to each element to determine if it
+     *                  should be included
      * @return the new stream
      */
     IntStream filter(IntPredicate predicate);
@@ -159,9 +94,9 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     IntStream map(IntUnaryOperator mapper);
@@ -174,9 +109,9 @@
      *     intermediate operation</a>.
      *
      * @param <U> the element type of the new stream
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     <U> Stream<U> mapToObj(IntFunction<? extends U> mapper);
@@ -188,9 +123,9 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     LongStream mapToLong(IntToLongFunction mapper);
@@ -202,9 +137,9 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     DoubleStream mapToDouble(IntToDoubleFunction mapper);
@@ -219,10 +154,10 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to
-     *               each element which produces an {@code IntStream} of new
-     *               values
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element which produces an
+     *               {@code IntStream} of new values
      * @return the new stream
      * @see Stream#flatMap(Function)
      */
@@ -421,9 +356,10 @@
      * synchronization and with greatly reduced risk of data races.
      *
      * @param identity the identity value for the accumulating function
-     * @param op an <a href="package-summary.html#Associativity">associative</a>
-     *                    <a href="package-summary.html#NonInterference">non-interfering,
-     *                    stateless</a> function for combining two values
+     * @param op an <a href="package-summary.html#Associativity">associative</a>,
+     *           <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *           <a href="package-summary.html#Statelessness">stateless</a>
+     *           function for combining two values
      * @return the result of the reduction
      * @see #sum()
      * @see #min()
@@ -460,9 +396,10 @@
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
-     * @param op an <a href="package-summary.html#Associativity">associative</a>
-     *           <a href="package-summary.html#NonInterference">non-interfering,
-     *           stateless</a> function for combining two values
+     * @param op an <a href="package-summary.html#Associativity">associative</a>,
+     *           <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *           <a href="package-summary.html#Statelessness">stateless</a>
+     *           function for combining two values
      * @return the result of the reduction
      * @see #reduce(int, IntBinaryOperator)
      */
@@ -492,14 +429,15 @@
      * @param supplier a function that creates a new result container. For a
      *                 parallel execution, this function may be called
      *                 multiple times and must return a fresh value each time.
-     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
-     *                    <a href="package-summary.html#NonInterference">non-interfering,
-     *                    stateless</a> function for incorporating an additional
-     *                    element into a result
-     * @param combiner an <a href="package-summary.html#Associativity">associative</a>
-     *                 <a href="package-summary.html#NonInterference">non-interfering,
-     *                 stateless</a> function for combining two values, which
-     *                 must be compatible with the accumulator function
+     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>,
+     *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                    <a href="package-summary.html#Statelessness">stateless</a>
+     *                    function for incorporating an additional element into a result
+     * @param combiner an <a href="package-summary.html#Associativity">associative</a>,
+     *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                    <a href="package-summary.html#Statelessness">stateless</a>
+     *                    function for combining two values, which must be
+     *                    compatible with the accumulator function
      * @return the result of the reduction
      * @see Stream#collect(Supplier, BiConsumer, BiConsumer)
      */
@@ -599,48 +537,67 @@
     /**
      * Returns whether any elements of this stream match the provided
      * predicate.  May not evaluate the predicate on all elements if not
-     * necessary for determining the result.
+     * necessary for determining the result.  If the stream is empty then
+     * {@code false} is returned and the predicate is not evaluated.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
      * terminal operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
-     *                  stateless</a> predicate to apply to elements of this
-     *                  stream
+     * @apiNote
+     * This method evaluates the <em>existential quantification</em> of the
+     * predicate over the elements of the stream (for some x P(x)).
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements of this stream
      * @return {@code true} if any elements of the stream match the provided
-     * predicate otherwise {@code false}
+     * predicate, otherwise {@code false}
      */
     boolean anyMatch(IntPredicate predicate);
 
     /**
      * Returns whether all elements of this stream match the provided predicate.
      * May not evaluate the predicate on all elements if not necessary for
-     * determining the result.
+     * determining the result.  If the stream is empty then {@code true} is
+     * returned and the predicate is not evaluated.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
      * terminal operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
-     *                  stateless</a> predicate to apply to elements of this
-     *                  stream
-     * @return {@code true} if all elements of the stream match the provided
-     * predicate otherwise {@code false}
+     * @apiNote
+     * This method evaluates the <em>universal quantification</em> of the
+     * predicate over the elements of the stream (for all x P(x)).  If the
+     * stream is empty, the quantification is said to be <em>vacuously
+     * satisfied</em> and is always {@code true} (regardless of P(x)).
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements of this stream
+     * @return {@code true} if either all elements of the stream match the
+     * provided predicate or the stream is empty, otherwise {@code false}
      */
     boolean allMatch(IntPredicate predicate);
 
     /**
      * Returns whether no elements of this stream match the provided predicate.
      * May not evaluate the predicate on all elements if not necessary for
-     * determining the result.
+     * determining the result.  If the stream is empty then {@code true} is
+     * returned and the predicate is not evaluated.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
      * terminal operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
-     *                  stateless</a> predicate to apply to elements of this
-     *                  stream
-     * @return {@code true} if no elements of the stream match the provided
-     * predicate otherwise {@code false}
+     * @apiNote
+     * This method evaluates the <em>universal quantification</em> of the
+     * negated predicate over the elements of the stream (for all x ~P(x)).  If
+     * the stream is empty, the quantification is said to be vacuously satisfied
+     * and is always {@code true}, regardless of P(x).
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements of this stream
+     * @return {@code true} if either no elements of the stream match the
+     * provided predicate or the stream is empty, otherwise {@code false}
      */
     boolean noneMatch(IntPredicate predicate);
 
@@ -803,12 +760,12 @@
     }
 
     /**
-     * Returns a sequential stream where each element is generated by
-     * the provided {@code IntSupplier}.  This is suitable for generating
-     * constant streams, streams of random elements, etc.
+     * Returns an infinite sequential unordered stream where each element is
+     * generated by the provided {@code IntSupplier}.  This is suitable for
+     * generating constant streams, streams of random elements, etc.
      *
      * @param s the {@code IntSupplier} for generated elements
-     * @return a new sequential {@code IntStream}
+     * @return a new infinite sequential unordered {@code IntStream}
      */
     public static IntStream generate(IntSupplier s) {
         Objects.requireNonNull(s);
@@ -871,11 +828,16 @@
     /**
      * Creates a lazily concatenated stream whose elements are all the
      * elements of the first stream followed by all the elements of the
-     * second stream. The resulting stream is ordered if both
+     * second stream.  The resulting stream is ordered if both
      * of the input streams are ordered, and parallel if either of the input
      * streams is parallel.  When the resulting stream is closed, the close
      * handlers for both input streams are invoked.
      *
+     * @implNote
+     * Use caution when constructing streams from repeated concatenation.
+     * Accessing an element of a deeply concatenated stream can result in deep
+     * call chains, or even {@code StackOverflowException}.
+     *
      * @param a the first stream
      * @param b the second stream
      * @return the concatenation of the two input streams
--- a/jdk/src/share/classes/java/util/stream/LongStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/LongStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -51,9 +51,13 @@
 import java.util.function.Supplier;
 
 /**
- * A sequence of elements supporting sequential and parallel aggregate
- * operations.  The following example illustrates an aggregate operation using
- * {@link Stream} and {@link LongStream}:
+ * A sequence of primitive long-valued elements supporting sequential and parallel
+ * aggregate operations.  This is the {@code long} primitive specialization of
+ * {@link Stream}.
+ *
+ * <p>The following example illustrates an aggregate operation using
+ * {@link Stream} and {@link LongStream}, computing the sum of the weights of the
+ * red widgets:
  *
  * <pre>{@code
  *     long sum = widgets.stream()
@@ -62,78 +66,13 @@
  *                       .sum();
  * }</pre>
  *
- * In this example, {@code widgets} is a {@code Collection<Widget>}.  We create
- * a stream of {@code Widget} objects via {@link Collection#stream Collection.stream()},
- * filter it to produce a stream containing only the red widgets, and then
- * transform it into a stream of {@code long} values representing the weight of
- * each red widget. Then this stream is summed to produce a total weight.
- *
- * <p>To perform a computation, stream
- * <a href="package-summary.html#StreamOps">operations</a> are composed into a
- * <em>stream pipeline</em>.  A stream pipeline consists of a source (which
- * might be an array, a collection, a generator function, an IO channel,
- * etc), zero or more <em>intermediate operations</em> (which transform a
- * stream into another stream, such as {@link LongStream#filter(LongPredicate)}), and a
- * <em>terminal operation</em> (which produces a result or side-effect, such
- * as {@link LongStream#sum()} or {@link LongStream#forEach(LongConsumer)}).
- * Streams are lazy; computation on the source data is only performed when the
- * terminal operation is initiated, and source elements are consumed only
- * as needed.
- *
- * <p>Collections and streams, while bearing some superficial similarities,
- * have different goals.  Collections are primarily concerned with the efficient
- * management of, and access to, their elements.  By contrast, streams do not
- * provide a means to directly access or manipulate their elements, and are
- * instead concerned with declaratively describing their source and the
- * computational operations which will be performed in aggregate on that source.
- * However, if the provided stream operations do not offer the desired
- * functionality, the {@link #iterator()} and {@link #spliterator()} operations
- * can be used to perform a controlled traversal.
- *
- * <p>A stream pipeline, like the "widgets" example above, can be viewed as
- * a <em>query</em> on the stream source.  Unless the source was explicitly
- * designed for concurrent modification (such as a {@link ConcurrentHashMap}),
- * unpredictable or erroneous behavior may result from modifying the stream
- * source while it is being queried.
- *
- * <p>Most stream operations accept parameters that describe user-specified
- * behavior, such as the lambda expression {@code w -> w.getWeight()} passed to
- * {@code mapToLong} in the example above.  Such parameters are always instances
- * of a <a href="../function/package-summary.html">functional interface</a> such
- * as {@link java.util.function.Function}, and are often lambda expressions or
- * method references.  These parameters can never be null, should not modify the
- * stream source, and should be
- * <a href="package-summary.html#NonInterference">effectively stateless</a>
- * (their result should not depend on any state that might change during
- * execution of the stream pipeline.)
- *
- * <p>A stream should be operated on (invoking an intermediate or terminal stream
- * operation) only once.  This rules out, for example, "forked" streams, where
- * the same source feeds two or more pipelines, or multiple traversals of the
- * same stream.  A stream implementation may throw {@link IllegalStateException}
- * if it detects that the stream is being reused. However, since some stream
- * operations may return their receiver rather than a new stream object, it may
- * not be possible to detect reuse in all cases.
- *
- * <p>Streams have a {@link #close()} method and implement {@link AutoCloseable},
- * but nearly all stream instances do not actually need to be closed after use.
- * Generally, only streams whose source is an IO channel (such as those returned
- * by {@link Files#lines(Path, Charset)}) will require closing.  Most streams
- * are backed by collections, arrays, or generating functions, which require no
- * special resource management.  (If a stream does require closing, it can be
- * declared as a resource in a {@code try}-with-resources statement.)
- *
- * <p>Stream pipelines may execute either sequentially or in
- * <a href="package-summary.html#Parallelism">parallel</a>.  This
- * execution mode is a property of the stream.  Streams are created
- * with an initial choice of sequential or parallel execution.  (For example,
- * {@link Collection#stream() Collection.stream()} creates a sequential stream,
- * and {@link Collection#parallelStream() Collection.parallelStream()} creates
- * a parallel one.)  This choice of execution mode may be modified by the
- * {@link #sequential()} or {@link #parallel()} methods, and may be queried with
- * the {@link #isParallel()} method.
+ * See the class documentation for {@link Stream} and the package documentation
+ * for <a href="package-summary.html">java.util.stream</a> for additional
+ * specification of streams, stream operations, stream pipelines, and
+ * parallelism.
  *
  * @since 1.8
+ * @see Stream
  * @see <a href="package-summary.html">java.util.stream</a>
  */
 public interface LongStream extends BaseStream<Long, LongStream> {
@@ -145,9 +84,10 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">
-     *                  non-interfering, stateless</a> predicate to apply to
-     *                  each element to determine if it should be included
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to each element to determine if it
+     *                  should be included
      * @return the new stream
      */
     LongStream filter(LongPredicate predicate);
@@ -159,9 +99,9 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     LongStream map(LongUnaryOperator mapper);
@@ -174,9 +114,9 @@
      *     intermediate operation</a>.
      *
      * @param <U> the element type of the new stream
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     <U> Stream<U> mapToObj(LongFunction<? extends U> mapper);
@@ -188,9 +128,9 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     IntStream mapToInt(LongToIntFunction mapper);
@@ -202,9 +142,9 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     DoubleStream mapToDouble(LongToDoubleFunction mapper);
@@ -219,10 +159,10 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to
-     *               each element which produces an {@code LongStream} of new
-     *               values
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element which produces a
+     *               {@code LongStream} of new values
      * @return the new stream
      * @see Stream#flatMap(Function)
      */
@@ -421,9 +361,10 @@
      * synchronization and with greatly reduced risk of data races.
      *
      * @param identity the identity value for the accumulating function
-     * @param op an <a href="package-summary.html#Associativity">associative</a>
-     *                    <a href="package-summary.html#NonInterference">non-interfering,
-     *                    stateless</a> function for combining two values
+     * @param op an <a href="package-summary.html#Associativity">associative</a>,
+     *           <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *           <a href="package-summary.html#Statelessness">stateless</a>
+     *           function for combining two values
      * @return the result of the reduction
      * @see #sum()
      * @see #min()
@@ -460,9 +401,10 @@
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
-     * @param op an <a href="package-summary.html#Associativity">associative</a>
-     *           <a href="package-summary.html#NonInterference">non-interfering,
-     *           stateless</a> function for combining two values
+     * @param op an <a href="package-summary.html#Associativity">associative</a>,
+     *           <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *           <a href="package-summary.html#Statelessness">stateless</a>
+     *           function for combining two values
      * @return the result of the reduction
      * @see #reduce(long, LongBinaryOperator)
      */
@@ -492,14 +434,15 @@
      * @param supplier a function that creates a new result container. For a
      *                 parallel execution, this function may be called
      *                 multiple times and must return a fresh value each time.
-     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
-     *                    <a href="package-summary.html#NonInterference">non-interfering,
-     *                    stateless</a> function for incorporating an additional
-     *                    element into a result
-     * @param combiner an <a href="package-summary.html#Associativity">associative</a>
-     *                 <a href="package-summary.html#NonInterference">non-interfering,
-     *                 stateless</a> function for combining two values, which
-     *                 must be compatible with the accumulator function
+     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>,
+     *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                    <a href="package-summary.html#Statelessness">stateless</a>
+     *                    function for incorporating an additional element into a result
+     * @param combiner an <a href="package-summary.html#Associativity">associative</a>,
+     *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                    <a href="package-summary.html#Statelessness">stateless</a>
+     *                    function for combining two values, which must be
+     *                    compatible with the accumulator function
      * @return the result of the reduction
      * @see Stream#collect(Supplier, BiConsumer, BiConsumer)
      */
@@ -599,48 +542,67 @@
     /**
      * Returns whether any elements of this stream match the provided
      * predicate.  May not evaluate the predicate on all elements if not
-     * necessary for determining the result.
+     * necessary for determining the result.  If the stream is empty then
+     * {@code false} is returned and the predicate is not evaluated.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
      * terminal operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
-     *                  stateless</a> predicate to apply to elements of this
-     *                  stream
+     * @apiNote
+     * This method evaluates the <em>existential quantification</em> of the
+     * predicate over the elements of the stream (for some x P(x)).
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements of this stream
      * @return {@code true} if any elements of the stream match the provided
-     * predicate otherwise {@code false}
+     * predicate, otherwise {@code false}
      */
     boolean anyMatch(LongPredicate predicate);
 
     /**
      * Returns whether all elements of this stream match the provided predicate.
      * May not evaluate the predicate on all elements if not necessary for
-     * determining the result.
+     * determining the result.  If the stream is empty then {@code true} is
+     * returned and the predicate is not evaluated.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
      * terminal operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
-     *                  stateless</a> predicate to apply to elements of this
-     *                  stream
-     * @return {@code true} if all elements of the stream match the provided
-     * predicate otherwise {@code false}
+     * @apiNote
+     * This method evaluates the <em>universal quantification</em> of the
+     * predicate over the elements of the stream (for all x P(x)).  If the
+     * stream is empty, the quantification is said to be <em>vacuously
+     * satisfied</em> and is always {@code true} (regardless of P(x)).
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements of this stream
+     * @return {@code true} if either all elements of the stream match the
+     * provided predicate or the stream is empty, otherwise {@code false}
      */
     boolean allMatch(LongPredicate predicate);
 
     /**
-     * Returns whether no elements of this stream match the provided  predicate.
+     * Returns whether no elements of this stream match the provided predicate.
      * May not evaluate the predicate on all elements if not necessary for
-     * determining the result.
+     * determining the result.  If the stream is empty then {@code true} is
+     * returned and the predicate is not evaluated.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
      * terminal operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
-     *                  stateless</a> predicate to apply to elements of this
-     *                  stream
-     * @return {@code true} if no elements of the stream match the provided
-     * predicate otherwise {@code false}
+     * @apiNote
+     * This method evaluates the <em>universal quantification</em> of the
+     * negated predicate over the elements of the stream (for all x ~P(x)).  If
+     * the stream is empty, the quantification is said to be vacuously satisfied
+     * and is always {@code true}, regardless of P(x).
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements of this stream
+     * @return {@code true} if either no elements of the stream match the
+     * provided predicate or the stream is empty, otherwise {@code false}
      */
     boolean noneMatch(LongPredicate predicate);
 
@@ -791,12 +753,12 @@
     }
 
     /**
-     * Returns a sequential stream where each element is generated by
-     * the provided {@code LongSupplier}.  This is suitable for generating
-     * constant streams, streams of random elements, etc.
+     * Returns an infinite sequential unordered stream where each element is
+     * generated by the provided {@code LongSupplier}.  This is suitable for
+     * generating constant streams, streams of random elements, etc.
      *
      * @param s the {@code LongSupplier} for generated elements
-     * @return a new sequential {@code LongStream}
+     * @return a new infinite sequential unordered {@code LongStream}
      */
     public static LongStream generate(LongSupplier s) {
         Objects.requireNonNull(s);
@@ -874,11 +836,16 @@
     /**
      * Creates a lazily concatenated stream whose elements are all the
      * elements of the first stream followed by all the elements of the
-     * second stream. The resulting stream is ordered if both
+     * second stream.  The resulting stream is ordered if both
      * of the input streams are ordered, and parallel if either of the input
      * streams is parallel.  When the resulting stream is closed, the close
      * handlers for both input streams are invoked.
      *
+     * @implNote
+     * Use caution when constructing streams from repeated concatenation.
+     * Accessing an element of a deeply concatenated stream can result in deep
+     * call chains, or even {@code StackOverflowException}.
+     *
      * @param a the first stream
      * @param b the second stream
      * @return the concatenation of the two input streams
--- a/jdk/src/share/classes/java/util/stream/Node.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/Node.java	Wed Jul 05 19:21:26 2017 +0200
@@ -241,6 +241,7 @@
          * @param action a consumer that is to be invoked with each
          *        element in this {@code Node.OfPrimitive}
          */
+        @SuppressWarnings("overloads")
         void forEach(T_CONS action);
 
         @Override
--- a/jdk/src/share/classes/java/util/stream/SpinedBuffer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/SpinedBuffer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -579,6 +579,7 @@
             spineIndex = 0;
         }
 
+        @SuppressWarnings("overloads")
         public void forEach(T_CONS consumer) {
             // completed chunks, if any
             for (int j = 0; j < spineIndex; j++)
--- a/jdk/src/share/classes/java/util/stream/Stream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/Stream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -67,6 +67,11 @@
  * transform it into a stream of {@code int} values representing the weight of
  * each red widget. Then this stream is summed to produce a total weight.
  *
+ * <p>In addition to {@code Stream}, which is a stream of object references,
+ * there are primitive specializations for {@link IntStream}, {@link LongStream},
+ * and {@link DoubleStream}, all of which are referred to as "streams" and
+ * conform to the characteristics and restrictions described here.
+ *
  * <p>To perform a computation, stream
  * <a href="package-summary.html#StreamOps">operations</a> are composed into a
  * <em>stream pipeline</em>.  A stream pipeline consists of a source (which
@@ -97,14 +102,21 @@
  *
  * <p>Most stream operations accept parameters that describe user-specified
  * behavior, such as the lambda expression {@code w -> w.getWeight()} passed to
- * {@code mapToInt} in the example above.  Such parameters are always instances
- * of a <a href="../function/package-summary.html">functional interface</a> such
+ * {@code mapToInt} in the example above.  To preserve correct behavior,
+ * these <em>behavioral parameters</em>:
+ * <ul>
+ * <li>must be <a href="package-summary.html#NonInterference">non-interfering</a>
+ * (they do not modify the stream source); and</li>
+ * <li>in most cases must be <a href="package-summary.html#Statelessness">stateless</a>
+ * (their result should not depend on any state that might change during execution
+ * of the stream pipeline).</li>
+ * </ul>
+ *
+ * <p>Such parameters are always instances of a
+ * <a href="../function/package-summary.html">functional interface</a> such
  * as {@link java.util.function.Function}, and are often lambda expressions or
- * method references.  These parameters can never be null, should not modify the
- * stream source, and should be
- * <a href="package-summary.html#NonInterference">effectively stateless</a>
- * (their result should not depend on any state that might change during
- * execution of the stream pipeline.)
+ * method references.  Unless otherwise specified these parameters must be
+ * <em>non-null</em>.
  *
  * <p>A stream should be operated on (invoking an intermediate or terminal stream
  * operation) only once.  This rules out, for example, "forked" streams, where
@@ -134,6 +146,9 @@
  *
  * @param <T> the type of the stream elements
  * @since 1.8
+ * @see IntStream
+ * @see LongStream
+ * @see DoubleStream
  * @see <a href="package-summary.html">java.util.stream</a>
  */
 public interface Stream<T> extends BaseStream<T, Stream<T>> {
@@ -145,9 +160,10 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">
-     *                  non-interfering, stateless</a> predicate to apply to
-     *                  each element to determine if it should be included
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to each element to determine if it
+     *                  should be included
      * @return the new stream
      */
     Stream<T> filter(Predicate<? super T> predicate);
@@ -160,9 +176,9 @@
      * operation</a>.
      *
      * @param <R> The element type of the new stream
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     <R> Stream<R> map(Function<? super T, ? extends R> mapper);
@@ -174,9 +190,9 @@
      * <p>This is an <a href="package-summary.html#StreamOps">
      *     intermediate operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     IntStream mapToInt(ToIntFunction<? super T> mapper);
@@ -188,9 +204,9 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     LongStream mapToLong(ToLongFunction<? super T> mapper);
@@ -202,9 +218,9 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element
      * @return the new stream
      */
     DoubleStream mapToDouble(ToDoubleFunction<? super T> mapper);
@@ -221,19 +237,33 @@
      *
      * @apiNote
      * The {@code flatMap()} operation has the effect of applying a one-to-many
-     * tranformation to the elements of the stream, and then flattening the
-     * resulting elements into a new stream. For example, if {@code orders}
-     * is a stream of purchase orders, and each purchase order contains a
-     * collection of line items, then the following produces a stream of line
-     * items:
+     * transformation to the elements of the stream, and then flattening the
+     * resulting elements into a new stream.
+     *
+     * <p><b>Examples.</b>
+     *
+     * <p>If {@code orders} is a stream of purchase orders, and each purchase
+     * order contains a collection of line items, then the following produces a
+     * stream containing all the line items in all the orders:
      * <pre>{@code
-     *     orderStream.flatMap(order -> order.getLineItems().stream())...
+     *     orders.flatMap(order -> order.getLineItems().stream())...
      * }</pre>
      *
+     * <p>If {@code path} is the path to a file, then the following produces a
+     * stream of the {@code words} contained in that file:
+     * <pre>{@code
+     *     Stream<String> lines = Files.lines(path, StandardCharsets.UTF_8);
+     *     Stream<String> words = lines.flatMap(line -> Stream.of(line.split(" +")));
+     * }</pre>
+     * The {@code mapper} function passed to {@code flatMap} splits a line,
+     * using a simple regular expression, into an array of words, and then
+     * creates a stream of words from that array.
+     *
      * @param <R> The element type of the new stream
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element which produces a stream of new values
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element which produces a stream
+     *               of new values
      * @return the new stream
      */
     <R> Stream<R> flatMap(Function<? super T, ? extends Stream<? extends R>> mapper);
@@ -248,10 +278,12 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element which produces a stream of new values
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element which produces a stream
+     *               of new values
      * @return the new stream
+     * @see #flatMap(Function)
      */
     IntStream flatMapToInt(Function<? super T, ? extends IntStream> mapper);
 
@@ -265,10 +297,12 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to
-     *               each element which produces a stream of new values
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element which produces a stream
+     *               of new values
      * @return the new stream
+     * @see #flatMap(Function)
      */
     LongStream flatMapToLong(Function<? super T, ? extends LongStream> mapper);
 
@@ -282,10 +316,12 @@
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
      *
-     * @param mapper a <a href="package-summary.html#NonInterference">
-     *               non-interfering, stateless</a> function to apply to each
-     *               element which produces a stream of new values
+     * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *               <a href="package-summary.html#Statelessness">stateless</a>
+     *               function to apply to each element which produces a stream
+     *               of new values
      * @return the new stream
+     * @see #flatMap(Function)
      */
     DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper);
 
@@ -293,9 +329,27 @@
      * Returns a stream consisting of the distinct elements (according to
      * {@link Object#equals(Object)}) of this stream.
      *
+     * <p>For ordered streams, the selection of distinct elements is stable
+     * (for duplicated elements, the element appearing first in the encounter
+     * order is preserved.)  For unordered streams, no stability guarantees
+     * are made.
+     *
      * <p>This is a <a href="package-summary.html#StreamOps">stateful
      * intermediate operation</a>.
      *
+     * @apiNote
+     * Preserving stability for {@code distinct()} in parallel pipelines is
+     * relatively expensive (requires that the operation act as a full barrier,
+     * with substantial buffering overhead), and stability is often not needed.
+     * Using an unordered stream source (such as {@link #generate(Supplier)})
+     * or removing the ordering constraint with {@link #unordered()} may result
+     * in significantly more efficient execution for {@code distinct()} in parallel
+     * pipelines, if the semantics of your situation permit.  If consistency
+     * with encounter order is required, and you are experiencing poor performance
+     * or memory utilization with {@code distinct()} in parallel pipelines,
+     * switching to sequential execution with {@link #sequential()} may improve
+     * performance.
+     *
      * @return the new stream
      */
     Stream<T> distinct();
@@ -306,6 +360,9 @@
      * {@code Comparable}, a {@code java.lang.ClassCastException} may be thrown
      * when the terminal operation is executed.
      *
+     * <p>For ordered streams, the sort is stable.  For unordered streams, no
+     * stability guarantees are made.
+     *
      * <p>This is a <a href="package-summary.html#StreamOps">stateful
      * intermediate operation</a>.
      *
@@ -317,12 +374,15 @@
      * Returns a stream consisting of the elements of this stream, sorted
      * according to the provided {@code Comparator}.
      *
+     * <p>For ordered streams, the sort is stable.  For unordered streams, no
+     * stability guarantees are made.
+     *
      * <p>This is a <a href="package-summary.html#StreamOps">stateful
      * intermediate operation</a>.
      *
-     * @param comparator a <a href="package-summary.html#NonInterference">
-     *                   non-interfering, stateless</a> {@code Comparator} to
-     *                   be used to compare stream elements
+     * @param comparator a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                   <a href="package-summary.html#Statelessness">stateless</a>
+     *                   {@code Comparator} to be used to compare stream elements
      * @return the new stream
      */
     Stream<T> sorted(Comparator<? super T> comparator);
@@ -420,7 +480,8 @@
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
-     * <p>For parallel stream pipelines, this operation does <em>not</em>
+     * <p>The behavior of this operation is explicitly nondeterministic.
+     * For parallel stream pipelines, this operation does <em>not</em>
      * guarantee to respect the encounter order of the stream, as doing so
      * would sacrifice the benefit of parallelism.  For any given element, the
      * action may be performed at whatever time and in whatever thread the
@@ -433,13 +494,18 @@
     void forEach(Consumer<? super T> action);
 
     /**
-     * Performs an action for each element of this stream, guaranteeing that
-     * each element is processed in encounter order for streams that have a
-     * defined encounter order.
+     * Performs an action for each element of this stream, in the encounter
+     * order of the stream if the stream has a defined encounter order.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
+     * <p>This operation processes the elements one at a time, in encounter
+     * order if one exists.  Performing the action for one element
+     * <a href="../concurrent/package-summary.html#MemoryVisibility"><i>happens-before</i></a>
+     * performing the action for subsequent elements, but for any given element,
+     * the action may be performed in whatever thread the library chooses.
+     *
      * @param action a <a href="package-summary.html#NonInterference">
      *               non-interfering</a> action to perform on the elements
      * @see #forEach(Consumer)
@@ -528,9 +594,10 @@
      * synchronization and with greatly reduced risk of data races.
      *
      * @param identity the identity value for the accumulating function
-     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
-     *                    <a href="package-summary.html#NonInterference">non-interfering,
-     *                    stateless</a> function for combining two values
+     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>,
+     *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                    <a href="package-summary.html#Statelessness">stateless</a>
+     *                    function for combining two values
      * @return the result of the reduction
      */
     T reduce(T identity, BinaryOperator<T> accumulator);
@@ -563,14 +630,15 @@
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
-     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
-     *                    <a href="package-summary.html#NonInterference">non-interfering,
-     *                    stateless</a> function for combining two values
+     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>,
+     *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                    <a href="package-summary.html#Statelessness">stateless</a>
+     *                    function for combining two values
      * @return an {@link Optional} describing the result of the reduction
      * @throws NullPointerException if the result of the reduction is null
      * @see #reduce(Object, BinaryOperator)
-     * @see #min(java.util.Comparator)
-     * @see #max(java.util.Comparator)
+     * @see #min(Comparator)
+     * @see #max(Comparator)
      */
     Optional<T> reduce(BinaryOperator<T> accumulator);
 
@@ -608,14 +676,15 @@
      *
      * @param <U> The type of the result
      * @param identity the identity value for the combiner function
-     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
-     *                    <a href="package-summary.html#NonInterference">non-interfering,
-     *                    stateless</a> function for incorporating an additional
-     *                    element into a result
-     * @param combiner an <a href="package-summary.html#Associativity">associative</a>
-     *                 <a href="package-summary.html#NonInterference">non-interfering,
-     *                 stateless</a> function for combining two values, which
-     *                 must be compatible with the accumulator function
+     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>,
+     *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                    <a href="package-summary.html#Statelessness">stateless</a>
+     *                    function for incorporating an additional element into a result
+     * @param combiner an <a href="package-summary.html#Associativity">associative</a>,
+     *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                    <a href="package-summary.html#Statelessness">stateless</a>
+     *                    function for combining two values, which must be
+     *                    compatible with the accumulator function
      * @return the result of the reduction
      * @see #reduce(BinaryOperator)
      * @see #reduce(Object, BinaryOperator)
@@ -664,14 +733,15 @@
      * @param supplier a function that creates a new result container. For a
      *                 parallel execution, this function may be called
      *                 multiple times and must return a fresh value each time.
-     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
-     *                    <a href="package-summary.html#NonInterference">non-interfering,
-     *                    stateless</a> function for incorporating an additional
-     *                    element into a result
-     * @param combiner an <a href="package-summary.html#Associativity">associative</a>
-     *                 <a href="package-summary.html#NonInterference">non-interfering,
-     *                 stateless</a> function for combining two values, which
-     *                 must be compatible with the accumulator function
+     * @param accumulator an <a href="package-summary.html#Associativity">associative</a>,
+     *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                    <a href="package-summary.html#Statelessness">stateless</a>
+     *                    function for incorporating an additional element into a result
+     * @param combiner an <a href="package-summary.html#Associativity">associative</a>,
+     *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                    <a href="package-summary.html#Statelessness">stateless</a>
+     *                    function for combining two values, which must be
+     *                    compatible with the accumulator function
      * @return the result of the reduction
      */
     <R> R collect(Supplier<R> supplier,
@@ -687,6 +757,13 @@
      * collection strategies and composition of collect operations such as
      * multiple-level grouping or partitioning.
      *
+     * <p>If the stream is parallel, and the {@code Collector}
+     * is {@link Collector.Characteristics#CONCURRENT concurrent}, and
+     * either the stream is unordered or the collector is
+     * {@link Collector.Characteristics#UNORDERED unordered},
+     * then a concurrent reduction will be performed (see {@link Collector} for
+     * details on concurrent reduction.)
+     *
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
@@ -732,9 +809,9 @@
      *
      * <p>This is a <a href="package-summary.html#StreamOps">terminal operation</a>.
      *
-     * @param comparator a <a href="package-summary.html#NonInterference">non-interfering,
-     *                   stateless</a> {@code Comparator} to use to compare
-     *                   elements of this stream
+     * @param comparator a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                   <a href="package-summary.html#Statelessness">stateless</a>
+     *                   {@code Comparator} to compare elements of this stream
      * @return an {@code Optional} describing the minimum element of this stream,
      * or an empty {@code Optional} if the stream is empty
      * @throws NullPointerException if the minimum element is null
@@ -749,9 +826,9 @@
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
-     * @param comparator a <a href="package-summary.html#NonInterference">non-interfering,
-     *                   stateless</a> {@code Comparator} to use to compare
-     *                   elements of this stream
+     * @param comparator a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                   <a href="package-summary.html#Statelessness">stateless</a>
+     *                   {@code Comparator} to compare elements of this stream
      * @return an {@code Optional} describing the maximum element of this stream,
      * or an empty {@code Optional} if the stream is empty
      * @throws NullPointerException if the maximum element is null
@@ -775,48 +852,67 @@
     /**
      * Returns whether any elements of this stream match the provided
      * predicate.  May not evaluate the predicate on all elements if not
-     * necessary for determining the result.
+     * necessary for determining the result.  If the stream is empty then
+     * {@code false} is returned and the predicate is not evaluated.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
      * terminal operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
-     *                  stateless</a> predicate to apply to elements of this
-     *                  stream
+     * @apiNote
+     * This method evaluates the <em>existential quantification</em> of the
+     * predicate over the elements of the stream (for some x P(x)).
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements of this stream
      * @return {@code true} if any elements of the stream match the provided
-     * predicate otherwise {@code false}
+     * predicate, otherwise {@code false}
      */
     boolean anyMatch(Predicate<? super T> predicate);
 
     /**
      * Returns whether all elements of this stream match the provided predicate.
      * May not evaluate the predicate on all elements if not necessary for
-     * determining the result.
+     * determining the result.  If the stream is empty then {@code true} is
+     * returned and the predicate is not evaluated.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
      * terminal operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
-     *                  stateless</a> predicate to apply to elements of this
-     *                  stream
-     * @return {@code true} if all elements of the stream match the provided
-     * predicate otherwise {@code false}
+     * @apiNote
+     * This method evaluates the <em>universal quantification</em> of the
+     * predicate over the elements of the stream (for all x P(x)).  If the
+     * stream is empty, the quantification is said to be <em>vacuously
+     * satisfied</em> and is always {@code true} (regardless of P(x)).
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements of this stream
+     * @return {@code true} if either all elements of the stream match the
+     * provided predicate or the stream is empty, otherwise {@code false}
      */
     boolean allMatch(Predicate<? super T> predicate);
 
     /**
      * Returns whether no elements of this stream match the provided predicate.
      * May not evaluate the predicate on all elements if not necessary for
-     * determining the result.
+     * determining the result.  If the stream is empty then {@code true} is
+     * returned and the predicate is not evaluated.
      *
      * <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
      * terminal operation</a>.
      *
-     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering,
-     *                  stateless</a> predicate to apply to elements of this
-     *                  stream
-     * @return {@code true} if no elements of the stream match the provided
-     * predicate otherwise {@code false}
+     * @apiNote
+     * This method evaluates the <em>universal quantification</em> of the
+     * negated predicate over the elements of the stream (for all x ~P(x)).  If
+     * the stream is empty, the quantification is said to be vacuously satisfied
+     * and is always {@code true}, regardless of P(x).
+     *
+     * @param predicate a <a href="package-summary.html#NonInterference">non-interfering</a>,
+     *                  <a href="package-summary.html#Statelessness">stateless</a>
+     *                  predicate to apply to elements of this stream
+     * @return {@code true} if either no elements of the stream match the
+     * provided predicate or the stream is empty, otherwise {@code false}
      */
     boolean noneMatch(Predicate<? super T> predicate);
 
@@ -939,13 +1035,13 @@
     }
 
     /**
-     * Returns a sequential stream where each element is generated by
-     * the provided {@code Supplier}.  This is suitable for generating
-     * constant streams, streams of random elements, etc.
+     * Returns an infinite sequential unordered stream where each element is
+     * generated by the provided {@code Supplier}.  This is suitable for
+     * generating constant streams, streams of random elements, etc.
      *
      * @param <T> the type of stream elements
      * @param s the {@code Supplier} of generated elements
-     * @return a new sequential {@code Stream}
+     * @return a new infinite sequential unordered {@code Stream}
      */
     public static<T> Stream<T> generate(Supplier<T> s) {
         Objects.requireNonNull(s);
@@ -956,11 +1052,16 @@
     /**
      * Creates a lazily concatenated stream whose elements are all the
      * elements of the first stream followed by all the elements of the
-     * second stream. The resulting stream is ordered if both
+     * second stream.  The resulting stream is ordered if both
      * of the input streams are ordered, and parallel if either of the input
      * streams is parallel.  When the resulting stream is closed, the close
      * handlers for both input streams are invoked.
      *
+     * @implNote
+     * Use caution when constructing streams from repeated concatenation.
+     * Accessing an element of a deeply concatenated stream can result in deep
+     * call chains, or even {@code StackOverflowException}.
+     *
      * @param <T> The type of stream elements
      * @param a the first stream
      * @param b the second stream
--- a/jdk/src/share/classes/java/util/stream/StreamSpliterators.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/StreamSpliterators.java	Wed Jul 05 19:21:26 2017 +0200
@@ -27,6 +27,7 @@
 import java.util.Comparator;
 import java.util.Objects;
 import java.util.Spliterator;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.BooleanSupplier;
 import java.util.function.Consumer;
@@ -1227,6 +1228,88 @@
     }
 
     /**
+     * A wrapping spliterator that only reports distinct elements of the
+     * underlying spliterator. Does not preserve size and encounter order.
+     */
+    static final class DistinctSpliterator<T> implements Spliterator<T>, Consumer<T> {
+
+        // The value to represent null in the ConcurrentHashMap
+        private static final Object NULL_VALUE = new Object();
+
+        // The underlying spliterator
+        private final Spliterator<T> s;
+
+        // ConcurrentHashMap holding distinct elements as keys
+        private final ConcurrentHashMap<T, Boolean> seen;
+
+        // Temporary element, only used with tryAdvance
+        private T tmpSlot;
+
+        DistinctSpliterator(Spliterator<T> s) {
+            this(s, new ConcurrentHashMap<>());
+        }
+
+        private DistinctSpliterator(Spliterator<T> s, ConcurrentHashMap<T, Boolean> seen) {
+            this.s = s;
+            this.seen = seen;
+        }
+
+        @Override
+        public void accept(T t) {
+            this.tmpSlot = t;
+        }
+
+        @SuppressWarnings("unchecked")
+        private T mapNull(T t) {
+            return t != null ? t : (T) NULL_VALUE;
+        }
+
+        @Override
+        public boolean tryAdvance(Consumer<? super T> action) {
+            while (s.tryAdvance(this)) {
+                if (seen.putIfAbsent(mapNull(tmpSlot), Boolean.TRUE) == null) {
+                    action.accept(tmpSlot);
+                    tmpSlot = null;
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        @Override
+        public void forEachRemaining(Consumer<? super T> action) {
+            s.forEachRemaining(t -> {
+                if (seen.putIfAbsent(mapNull(t), Boolean.TRUE) == null) {
+                    action.accept(t);
+                }
+            });
+        }
+
+        @Override
+        public Spliterator<T> trySplit() {
+            Spliterator<T> split = s.trySplit();
+            return (split != null) ? new DistinctSpliterator<>(split, seen) : null;
+        }
+
+        @Override
+        public long estimateSize() {
+            return s.estimateSize();
+        }
+
+        @Override
+        public int characteristics() {
+            return (s.characteristics() & ~(Spliterator.SIZED | Spliterator.SUBSIZED |
+                                            Spliterator.SORTED | Spliterator.ORDERED))
+                   | Spliterator.DISTINCT;
+        }
+
+        @Override
+        public Comparator<? super T> getComparator() {
+            return s.getComparator();
+        }
+    }
+
+    /**
      * A Spliterator that infinitely supplies elements in no particular order.
      *
      * <p>Splitting divides the estimated size in two and stops when the
--- a/jdk/src/share/classes/java/util/stream/StreamSupport.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/StreamSupport.java	Wed Jul 05 19:21:26 2017 +0200
@@ -96,7 +96,8 @@
      * @param supplier a {@code Supplier} of a {@code Spliterator}
      * @param characteristics Spliterator characteristics of the supplied
      *        {@code Spliterator}.  The characteristics must be equal to
-     *        {@code supplier.get().characteristics()}.
+     *        {@code supplier.get().characteristics()}, otherwise undefined
+     *        behavior may occur when terminal operation commences.
      * @param parallel if {@code true} then the returned stream is a parallel
      *        stream; if {@code false} the returned stream is a sequential
      *        stream.
@@ -163,7 +164,8 @@
      * @param supplier a {@code Supplier} of a {@code Spliterator.OfInt}
      * @param characteristics Spliterator characteristics of the supplied
      *        {@code Spliterator.OfInt}.  The characteristics must be equal to
-     *        {@code supplier.get().characteristics()}
+     *        {@code supplier.get().characteristics()}, otherwise undefined
+     *        behavior may occur when terminal operation commences.
      * @param parallel if {@code true} then the returned stream is a parallel
      *        stream; if {@code false} the returned stream is a sequential
      *        stream.
@@ -230,7 +232,8 @@
      * @param supplier a {@code Supplier} of a {@code Spliterator.OfLong}
      * @param characteristics Spliterator characteristics of the supplied
      *        {@code Spliterator.OfLong}.  The characteristics must be equal to
-     *        {@code supplier.get().characteristics()}
+     *        {@code supplier.get().characteristics()}, otherwise undefined
+     *        behavior may occur when terminal operation commences.
      * @param parallel if {@code true} then the returned stream is a parallel
      *        stream; if {@code false} the returned stream is a sequential
      *        stream.
@@ -297,7 +300,8 @@
      * @param supplier A {@code Supplier} of a {@code Spliterator.OfDouble}
      * @param characteristics Spliterator characteristics of the supplied
      *        {@code Spliterator.OfDouble}.  The characteristics must be equal to
-     *        {@code supplier.get().characteristics()}
+     *        {@code supplier.get().characteristics()}, otherwise undefined
+     *        behavior may occur when terminal operation commences.
      * @param parallel if {@code true} then the returned stream is a parallel
      *        stream; if {@code false} the returned stream is a sequential
      *        stream.
--- a/jdk/src/share/classes/java/util/stream/package-info.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/package-info.java	Wed Jul 05 19:21:26 2017 +0200
@@ -219,31 +219,18 @@
  * <em>not modified at all</em> during the execution of the stream pipeline.
  * The notable exception to this are streams whose sources are concurrent
  * collections, which are specifically designed to handle concurrent modification.
+ * Concurrent stream sources are those whose {@code Spliterator} reports the
+ * {@code CONCURRENT} characteristic.
  *
- * <p>Accordingly, behavioral parameters passed to stream methods should never
- * modify the stream's data source.  An implementation is said to
- * <em>interfere</em> with the data source if it modifies, or causes to be
+ * <p>Accordingly, behavioral parameters in stream pipelines whose source might
+ * not be concurrent should never modify the stream's data source.
+ * A behavioral parameter is said to <em>interfere</em> with a non-concurrent
+ * data source if it modifies, or causes to be
  * modified, the stream's data source.  The need for non-interference applies
  * to all pipelines, not just parallel ones.  Unless the stream source is
  * concurrent, modifying a stream's data source during execution of a stream
  * pipeline can cause exceptions, incorrect answers, or nonconformant behavior.
  *
- * <p>Results may be nondeterministic or incorrect if the behavioral
- * parameters of stream operations are <em>stateful</em>.  A stateful lambda
- * (or other object implementing the appropriate functional interface) is one
- * whose result depends on any state which might change during the execution
- * of the stream pipeline.  An example of a stateful lambda is:
- *
- * <pre>{@code
- *     Set<Integer> seen = Collections.synchronizedSet(new HashSet<>());
- *     stream.parallel().map(e -> { if (seen.add(e)) return 0; else return e; })...
- * }</pre>
- *
- * Here, if the mapping operation is performed in parallel, the results for the
- * same input could vary from run to run, due to thread scheduling differences,
- * whereas, with a stateless lambda expression the results would always be the
- * same.
- *
  * For well-behaved stream sources, the source can be modified before the
  * terminal operation commences and those modifications will be reflected in
  * the covered elements.  For example, consider the following code:
@@ -265,26 +252,54 @@
  * <a href="package-summary.html#StreamSources">Low-level stream
  * construction</a> for requirements for building well-behaved streams.
  *
- * <p>Some streams, particularly those whose stream sources are concurrent, can
- * tolerate concurrent modification during execution of a stream pipeline.
- * However, in no case -- even if the stream source is concurrent -- should
- * behavioral parameters to stream operations modify the stream source.  Modifying
- * the stream source from within the stream source may cause pipeline execution
- * to fail to terminate, produce inaccurate results, or throw exceptions.
- * The following example shows inappropriate interference with the source:
+ * <h3><a name="Statelessness">Stateless behaviors</a></h3>
+ *
+ * Stream pipeline results may be nondeterministic or incorrect if the behavioral
+ * parameters to the stream operations are <em>stateful</em>.  A stateful lambda
+ * (or other object implementing the appropriate functional interface) is one
+ * whose result depends on any state which might change during the execution
+ * of the stream pipeline.  An example of a stateful lambda is the parameter
+ * to {@code map()} in:
+ *
  * <pre>{@code
- *     // Don't do this!
- *     List<String> l = new ArrayList(Arrays.asList("one", "two"));
- *     Stream<String> sl = l.stream();
- *     String s = sl.peek(s -> l.add("BAD LAMBDA")).collect(joining(" "));
+ *     Set<Integer> seen = Collections.synchronizedSet(new HashSet<>());
+ *     stream.parallel().map(e -> { if (seen.add(e)) return 0; else return e; })...
  * }</pre>
  *
+ * Here, if the mapping operation is performed in parallel, the results for the
+ * same input could vary from run to run, due to thread scheduling differences,
+ * whereas, with a stateless lambda expression the results would always be the
+ * same.
+ *
+ * <p>Note also that attempting to access mutable state from behavioral parameters
+ * presents you with a bad choice with respect to safety and performance; if
+ * you do not synchronize access to that state, you have a data race and
+ * therefore your code is broken, but if you do synchronize access to that
+ * state, you risk having contention undermine the parallelism you are seeking
+ * to benefit from.  The best approach is to avoid stateful behavioral
+ * parameters to stream operations entirely; there is usually a way to
+ * restructure the stream pipeline to avoid statefulness.
+ *
  * <h3>Side-effects</h3>
  *
  * Side-effects in behavioral parameters to stream operations are, in general,
  * discouraged, as they can often lead to unwitting violations of the
- * statelessness requirement, as well as other thread-safety hazards.  Many
- * computations where one might be tempted to use side effects can be more
+ * statelessness requirement, as well as other thread-safety hazards.
+ *
+ * <p>If the behavioral parameters do have side-effects, unless explicitly
+ * stated, there are no guarantees as to the
+ * <a href="../concurrent/package-summary.html#MemoryVisibility"><i>visibility</i></a>
+ * of those side-effects to other threads, nor are there any guarantees that
+ * different operations on the "same" element within the same stream pipeline
+ * are executed in the same thread.  Further, the ordering of those effects
+ * may be surprising.  Even when a pipeline is constrained to produce a
+ * <em>result</em> that is consistent with the encounter order of the stream
+ * source (for example, {@code IntStream.range(0,5).parallel().map(x -> x*2).toArray()}
+ * must produce {@code [0, 2, 4, 6, 8]}), no guarantees are made as to the order
+ * in which the mapper function is applied to individual elements, or in what
+ * thread any behavioral parameter is executed for a given element.
+ *
+ * <p>Many computations where one might be tempted to use side effects can be more
  * safely and efficiently expressed without side-effects, such as using
  * <a href="package-summary.html#Reduction">reduction</a> instead of mutable
  * accumulators. However, side-effects such as using {@code println()} for debugging
--- a/jdk/src/share/classes/javax/accessibility/AccessibleContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/accessibility/AccessibleContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -480,7 +480,7 @@
      * a set of predefined roles.  This enables assistive technologies to
      * provide a consistent interface to various tweaked subclasses of
      * components (e.g., use AccessibleRole.PUSH_BUTTON for all components
-     * that act like a push button) as well as distinguish between sublasses
+     * that act like a push button) as well as distinguish between subclasses
      * that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes
      * and AccessibleRole.RADIO_BUTTON for radio buttons).
      * <p>Note that the AccessibleRole class is also extensible, so
--- a/jdk/src/share/classes/javax/accessibility/AccessibleText.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/accessibility/AccessibleText.java	Wed Jul 05 19:21:26 2017 +0200
@@ -175,7 +175,7 @@
      * If there is no selection, but there is
      * a caret, the start and end offsets will be the same.
      *
-     * @return the index into teh text of the end of the selection
+     * @return the index into the text of the end of the selection
      */
     public int getSelectionEnd();
 
--- a/jdk/src/share/classes/javax/crypto/NullCipher.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/crypto/NullCipher.java	Wed Jul 05 19:21:26 2017 +0200
@@ -27,7 +27,7 @@
 
 /**
  * The NullCipher class is a class that provides an
- * "identity cipher" -- one that does not tranform the plaintext.  As
+ * "identity cipher" -- one that does not transform the plain text.  As
  * a consequence, the ciphertext is identical to the plaintext.  All
  * initialization methods do nothing, while the blocksize is set to 1
  * byte.
--- a/jdk/src/share/classes/javax/crypto/NullCipherSpi.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/crypto/NullCipherSpi.java	Wed Jul 05 19:21:26 2017 +0200
@@ -30,7 +30,7 @@
 
 /**
  * This class provides a delegate for the identity cipher - one that does not
- * tranform the plaintext.
+ * transform the plain text.
  *
  * @author  Li Gong
  * @see NullCipher
--- a/jdk/src/share/classes/javax/imageio/IIOParam.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/IIOParam.java	Wed Jul 05 19:21:26 2017 +0200
@@ -95,7 +95,7 @@
     /**
      * An <code>ImageTypeSpecifier</code> to be used to generate a
      * destination image when reading, or to set the output color type
-     * when writing.  If non has been setm the value will be
+     * when writing.  If non has been set the value will be
      * <code>null</code>.  By default, the value is <code>null</code>.
      */
     protected ImageTypeSpecifier destinationType = null;
--- a/jdk/src/share/classes/javax/imageio/ImageIO.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/ImageIO.java	Wed Jul 05 19:21:26 2017 +0200
@@ -102,7 +102,7 @@
      * into the registry for later retrieval.
      *
      * <p> The exact set of locations searched depends on the
-     * implementation of the Java runtime enviroment.
+     * implementation of the Java runtime environment.
      *
      * @see ClassLoader#getResources
      */
@@ -1466,7 +1466,7 @@
      * it is the responsibility of the caller to close the stream, if desired.
      *
      * @param im a <code>RenderedImage</code> to be written.
-     * @param formatName a <code>String</code> containg the informal
+     * @param formatName a <code>String</code> containing the informal
      * name of the format.
      * @param output an <code>ImageOutputStream</code> to be written to.
      *
@@ -1499,7 +1499,7 @@
      * discarded.
      *
      * @param im a <code>RenderedImage</code> to be written.
-     * @param formatName a <code>String</code> containg the informal
+     * @param formatName a <code>String</code> containing the informal
      * name of the format.
      * @param output a <code>File</code> to be written to.
      *
@@ -1551,7 +1551,7 @@
      * <code>getCacheDirectory</code> will be used to control caching.
      *
      * @param im a <code>RenderedImage</code> to be written.
-     * @param formatName a <code>String</code> containg the informal
+     * @param formatName a <code>String</code> containing the informal
      * name of the format.
      * @param output an <code>OutputStream</code> to be written to.
      *
--- a/jdk/src/share/classes/javax/imageio/ImageReader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/ImageReader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -632,7 +632,7 @@
      * Returns the aspect ratio of the given image (that is, its width
      * divided by its height) as a <code>float</code>.  For images
      * that are inherently resizable, this method provides a way to
-     * determine the appropriate width given a deired height, or vice
+     * determine the appropriate width given a desired height, or vice
      * versa.  For non-resizable images, the true width and height
      * are used.
      *
@@ -750,7 +750,7 @@
      * not associated with any particular image).  If no such data
      * exists, <code>null</code> is returned.
      *
-     * <p> The resuting metadata object is only responsible for
+     * <p> The resulting metadata object is only responsible for
      * returning documents in the format named by
      * <code>formatName</code>.  Within any documents that are
      * returned, only nodes whose names are members of
@@ -855,7 +855,7 @@
      * if the reader does not support reading metadata or none
      * is available.
      *
-     * <p> The resuting metadata object is only responsible for
+     * <p> The resulting metadata object is only responsible for
      * returning documents in the format named by
      * <code>formatName</code>.  Within any documents that are
      * returned, only nodes whose names are members of
@@ -1435,7 +1435,7 @@
      *
      * <p> This method is merely a convenience equivalent to calling
      * <code>read(int, ImageReadParam)</code> with a read param
-     * specifiying a source region having offsets of
+     * specifying a source region having offsets of
      * <code>tileX*getTileWidth(imageIndex)</code>,
      * <code>tileY*getTileHeight(imageIndex)</code> and width and
      * height of <code>getTileWidth(imageIndex)</code>,
@@ -1948,7 +1948,7 @@
      *
      * <p> The final results of decoding will be the same whether or
      * not intermediate updates are performed.  Thus if only the final
-     * image is desired it may be perferable not to register any
+     * image is desired it may be preferable not to register any
      * <code>IIOReadUpdateListener</code>s.  In general, progressive
      * updating is most effective when fetching images over a network
      * connection that is very slow compared to local CPU processing;
--- a/jdk/src/share/classes/javax/imageio/ImageWriteParam.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/ImageWriteParam.java	Wed Jul 05 19:21:26 2017 +0200
@@ -253,7 +253,7 @@
      * <code>false</code>.  Subclasses must set the value manually.
      *
      * <p> Subclasses that do not support writing tiles, or that
-     * supprt writing but not offsetting tiles must ensure that this
+     * support writing but not offsetting tiles must ensure that this
      * value is set to <code>false</code>.
      */
     protected boolean canOffsetTiles = false;
@@ -803,7 +803,7 @@
      *
      * <ul>
      *   <li><code>MODE_DISABLED</code> - No progression.  Use this to
-     *   turn off progession.
+     *   turn off progression.
      *
      *   <li><code>MODE_COPY_FROM_METADATA</code> - The output image
      *   will use whatever progression parameters are found in the
--- a/jdk/src/share/classes/javax/imageio/ImageWriter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/ImageWriter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -423,7 +423,7 @@
     // Thumbnails
 
     /**
-     * Returns the number of thumbnails suported by the format being
+     * Returns the number of thumbnails supported by the format being
      * written, given the image type and any additional write
      * parameters and metadata objects that will be used during
      * encoding.  A return value of <code>-1</code> indicates that
@@ -923,7 +923,7 @@
      * <p> The default implementation throws an
      * <code>IllegalStateException</code> if the output is
      * <code>null</code>, and otherwise returns <code>false</code>
-     * withour checking the value of <code>imageIndex</code>.
+     * without checking the value of <code>imageIndex</code>.
      *
      * @param imageIndex the index at which the image is to be
      * inserted.
--- a/jdk/src/share/classes/javax/imageio/event/IIOReadProgressListener.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/event/IIOReadProgressListener.java	Wed Jul 05 19:21:26 2017 +0200
@@ -62,7 +62,7 @@
     void sequenceStarted(ImageReader source, int minIndex);
 
     /**
-     * Reports that a sequence of read operationshas completed.
+     * Reports that a sequence of read operations has completed.
      * <code>ImageReader</code> implementations are required to call
      * this method exactly once from their
      * <code>readAll(Iterator)</code> method.
--- a/jdk/src/share/classes/javax/imageio/event/IIOReadUpdateListener.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/event/IIOReadUpdateListener.java	Wed Jul 05 19:21:26 2017 +0200
@@ -58,7 +58,7 @@
      * @param source the <code>ImageReader</code> object calling this
      * method.
      * @param theImage the <code>BufferedImage</code> being updated.
-     * @param pass the numer of the pass that is about to begin,
+     * @param pass the number of the pass that is about to begin,
      * starting with 0.
      * @param minPass the index of the first pass that will be decoded.
      * @param maxPass the index of the last pass that will be decoded.
@@ -175,7 +175,7 @@
      * method.
      * @param theThumbnail the <code>BufferedImage</code> thumbnail
      * being updated.
-     * @param pass the numer of the pass that is about to begin,
+     * @param pass the number of the pass that is about to begin,
      * starting with 0.
      * @param minPass the index of the first pass that will be decoded.
      * @param maxPass the index of the last pass that will be decoded.
--- a/jdk/src/share/classes/javax/imageio/event/IIOReadWarningListener.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/event/IIOReadWarningListener.java	Wed Jul 05 19:21:26 2017 +0200
@@ -46,7 +46,7 @@
 public interface IIOReadWarningListener extends EventListener {
 
     /**
-     * Reports the occurence of a non-fatal error in decoding.  Decoding
+     * Reports the occurrence of a non-fatal error in decoding.  Decoding
      * will continue following the call to this method.  The application
      * may choose to display a dialog, print the warning to the console,
      * ignore the warning, or take any other action it chooses.
--- a/jdk/src/share/classes/javax/imageio/event/IIOWriteWarningListener.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/event/IIOWriteWarningListener.java	Wed Jul 05 19:21:26 2017 +0200
@@ -46,7 +46,7 @@
 public interface IIOWriteWarningListener extends EventListener {
 
     /**
-     * Reports the occurence of a non-fatal error in encoding.  Encoding
+     * Reports the occurrence of a non-fatal error in encoding.  Encoding
      * will continue following the call to this method.  The application
      * may choose to display a dialog, print the warning to the console,
      * ignore the warning, or take any other action it chooses.
--- a/jdk/src/share/classes/javax/imageio/metadata/IIOMetadata.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/metadata/IIOMetadata.java	Wed Jul 05 19:21:26 2017 +0200
@@ -45,7 +45,7 @@
  * is designed to encode its metadata losslessly.  This format will
  * typically be designed specifically to work with a specific file
  * format, so that images may be loaded and saved in the same format
- * with no loss of metadata, but may be less useful for transfering
+ * with no loss of metadata, but may be less useful for transferring
  * metadata between an <code>ImageReader</code> and an
  * <code>ImageWriter</code> for different image formats.  To convert
  * between two native formats as losslessly as the image file formats
@@ -130,9 +130,9 @@
 
     /**
      * Constructs an empty <code>IIOMetadata</code> object.  The
-     * subclass is responsible for suppying values for all protected
+     * subclass is responsible for supplying values for all protected
      * instance variables that will allow any non-overridden default
-     * implemtations of methods to satisfy their contracts.  For example,
+     * implementations of methods to satisfy their contracts.  For example,
      * <code>extraMetadataFormatNames</code> should not have length 0.
      */
     protected IIOMetadata() {}
@@ -475,7 +475,7 @@
      * Alters the internal state of this <code>IIOMetadata</code>
      * object from a tree of XML DOM <code>Node</code>s whose syntax
      * is defined by the given metadata format.  The previous state is
-     * altered only as necessary to accomodate the nodes that are
+     * altered only as necessary to accommodate the nodes that are
      * present in the given tree.  If the tree structure or contents
      * are invalid, an <code>IIOInvalidTreeException</code> will be
      * thrown.
--- a/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataFormat.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataFormat.java	Wed Jul 05 19:21:26 2017 +0200
@@ -40,7 +40,7 @@
  *
  * <p> N.B: classes that implement this interface should contain a
  * method declared as <code>public static getInstance()</code> which
- * returns an instance of the class.  Commonly, an implentation will
+ * returns an instance of the class.  Commonly, an implementation will
  * construct only a single instance and cache it for future
  * invocations of <code>getInstance</code>.
  *
@@ -307,7 +307,7 @@
      * with child policy <code>CHILD_POLICY_REPEAT</code>.  For
      * example, an element representing color primary information
      * might be required to have at least 3 children, one for each
-     * primay.
+     * primary.
      *
      * @param elementName the name of the element being queried.
      *
@@ -343,7 +343,7 @@
 
     /**
      * Returns a <code>String</code> containing a description of the
-     * named element, or <code>null</code>.  The desciption will be
+     * named element, or <code>null</code>.  The description will be
      * localized for the supplied <code>Locale</code> if possible.
      *
      * <p> If <code>locale</code> is <code>null</code>, the current
@@ -434,8 +434,8 @@
     /**
      * Returns one of the constants starting with
      * <code>DATATYPE_</code>, indicating the format and
-     * interpretation of the value of the given attribute within th
-     * enamed element.  If <code>getAttributeValueType</code> returns
+     * interpretation of the value of the given attribute within the
+     * named element.  If <code>getAttributeValueType</code> returns
      * <code>VALUE_LIST</code>, then the legal value is a
      * whitespace-spearated list of values of the returned datatype.
      *
@@ -460,7 +460,7 @@
      * @param elementName the name of the element being queried.
      * @param attrName the name of the attribute being queried.
      *
-     * @return <code>true</code> if the attribut must be present.
+     * @return <code>true</code> if the attribute must be present.
      *
      * @exception IllegalArgumentException if <code>elementName</code>
      * is <code>null</code> or is not a legal element name for this
@@ -473,7 +473,7 @@
 
     /**
      * Returns the default value of the named attribute, if it is not
-     * explictly present within the named element, as a
+     * explicitly present within the named element, as a
      * <code>String</code>, or <code>null</code> if no default value
      * is available.
      *
@@ -624,7 +624,7 @@
 
     /**
      * Returns a <code>String</code> containing a description of the
-     * named attribute, or <code>null</code>.  The desciption will be
+     * named attribute, or <code>null</code>.  The description will be
      * localized for the supplied <code>Locale</code> if possible.
      *
      * <p> If <code>locale</code> is <code>null</code>, the current
@@ -725,7 +725,7 @@
      * <code>VALUE_ENUMERATION</code>.
      *
      * <p> The <code>Object</code> associated with a node that accepts
-     * emuerated values must be equal to one of the values returned by
+     * enumerated values must be equal to one of the values returned by
      * this method, as defined by the <code>==</code> operator (as
      * opposed to the <code>Object.equals</code> method).
      *
--- a/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataFormatImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataFormatImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -234,7 +234,7 @@
      * name will be equal to <code>this.getClass().getName() +
      * "Resources"</code>.
      *
-     * @param resourceBaseName a <code>String</code> containg the new
+     * @param resourceBaseName a <code>String</code> containing the new
      * base name.
      *
      * @exception IllegalArgumentException if
@@ -381,7 +381,7 @@
      *
      * @param parentName the name of the element that will be the
      * new parent of the element.
-     * @param elementName the name of the element to be addded as a
+     * @param elementName the name of the element to be added as a
      * child.
      *
      * @exception IllegalArgumentException if <code>elementName</code>
@@ -991,7 +991,7 @@
 
     /**
      * Returns a <code>String</code> containing a description of the
-     * named element, or <code>null</code>.  The desciption will be
+     * named element, or <code>null</code>.  The description will be
      * localized for the supplied <code>Locale</code> if possible.
      *
      * <p> The default implementation will first locate a
@@ -1129,7 +1129,7 @@
 
     /**
      * Returns a <code>String</code> containing a description of the
-     * named attribute, or <code>null</code>.  The desciption will be
+     * named attribute, or <code>null</code>.  The description will be
      * localized for the supplied <code>Locale</code> if possible.
      *
      * <p> The default implementation will first locate a
--- a/jdk/src/share/classes/javax/imageio/metadata/doc-files/standard_metadata.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/metadata/doc-files/standard_metadata.html	Wed Jul 05 19:21:26 2017 +0200
@@ -228,7 +228,7 @@
           &lt;!-- Data type: Float --&gt;
 
       &lt;!ELEMENT "HorizontalPixelOffset" EMPTY&gt;
-        &lt;!-- The horizonal position, in pixels, where the image should be 
+        &lt;!-- The horizontal position, in pixels, where the image should be 
              rendered onto a raster display --&gt; 
         &lt;!ATTLIST "HorizontalPixelOffset" "value" #CDATA #REQUIRED&gt;
           &lt;!-- Data type: Integer --&gt;
--- a/jdk/src/share/classes/javax/imageio/spi/ImageReaderSpi.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/spi/ImageReaderSpi.java	Wed Jul 05 19:21:26 2017 +0200
@@ -341,7 +341,7 @@
      * @exception IOException if the attempt to instantiate
      * the reader fails.
      * @exception IllegalArgumentException if the
-     * <code>ImageReader</code>'s contructor throws an
+     * <code>ImageReader</code>'s constructor throws an
      * <code>IllegalArgumentException</code> to indicate that the
      * extension object is unsuitable.
      */
--- a/jdk/src/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java	Wed Jul 05 19:21:26 2017 +0200
@@ -538,7 +538,7 @@
      * Returns an <code>IIOMetadataFormat</code> object describing the
      * given image metadata format, or <code>null</code> if no
      * description is available.  The supplied name must be the native
-     * iamge metadata format name, the standard metadata format name,
+     * image metadata format name, the standard metadata format name,
      * or one of those returned by
      * <code>getExtraImageMetadataFormatNames</code>.
      *
--- a/jdk/src/share/classes/javax/imageio/stream/ImageInputStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/imageio/stream/ImageInputStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -550,7 +550,7 @@
      * the read occurs.
      *
      * @param s an array of shorts to be written to.
-     * @param off the starting position withinb to write to.
+     * @param off the starting position within <code>s</code> to write to.
      * @param len the maximum number of <code>short</code>s to read.
      *
      * @exception IndexOutOfBoundsException if <code>off</code> is
@@ -575,7 +575,7 @@
      * the read occurs.
      *
      * @param c an array of chars to be written to.
-     * @param off the starting position withinb to write to.
+     * @param off the starting position within <code>c</code> to write to.
      * @param len the maximum number of <code>char</code>s to read.
      *
      * @exception IndexOutOfBoundsException if <code>off</code> is
@@ -600,7 +600,7 @@
      * the read occurs.
      *
      * @param i an array of ints to be written to.
-     * @param off the starting position withinb to write to.
+     * @param off the starting position within <code>i</code> to write to.
      * @param len the maximum number of <code>int</code>s to read.
      *
      * @exception IndexOutOfBoundsException if <code>off</code> is
@@ -625,7 +625,7 @@
      * the read occurs.
      *
      * @param l an array of longs to be written to.
-     * @param off the starting position withinb to write to.
+     * @param off the starting position within <code>l</code> to write to.
      * @param len the maximum number of <code>long</code>s to read.
      *
      * @exception IndexOutOfBoundsException if <code>off</code> is
@@ -650,7 +650,7 @@
      * the read occurs.
      *
      * @param f an array of floats to be written to.
-     * @param off the starting position withinb to write to.
+     * @param off the starting position within <code>f</code> to write to.
      * @param len the maximum number of <code>float</code>s to read.
      *
      * @exception IndexOutOfBoundsException if <code>off</code> is
@@ -675,7 +675,7 @@
      * the read occurs.
      *
      * @param d an array of doubles to be written to.
-     * @param off the starting position withinb to write to.
+     * @param off the starting position within <code>d</code> to write to.
      * @param len the maximum number of <code>double</code>s to read.
      *
      * @exception IndexOutOfBoundsException if <code>off</code> is
@@ -904,7 +904,7 @@
 
     /**
      * Discards the initial portion of the stream prior to the
-     * indicated postion.  Attempting to seek to an offset within the
+     * indicated position.  Attempting to seek to an offset within the
      * flushed portion of the stream will result in an
      * <code>IndexOutOfBoundsException</code>.
      *
--- a/jdk/src/share/classes/javax/management/relation/RelationService.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/management/relation/RelationService.java	Wed Jul 05 19:21:26 2017 +0200
@@ -132,7 +132,7 @@
     private MBeanServer myMBeanServer = null;
 
     // Filter registered in the MBean Server with the Relation Service to be
-    // informed of referenced MBean unregistrations
+    // informed of referenced MBean deregistrations
     private MBeanServerNotificationFilter myUnregNtfFilter = null;
 
     // List of unregistration notifications received (storage used if purge
@@ -2108,7 +2108,7 @@
      * <P>Will check the role according to its corresponding role definition
      * provided in relation's relation type
      * <P>The Relation Service will keep track of the change to keep the
-     * consistency of relations by handling referenced MBean unregistrations.
+     * consistency of relations by handling referenced MBean deregistrations.
      *
      * @param relationId  relation id
      * @param role  role to be set (name and new value)
@@ -2220,7 +2220,7 @@
      * <P>Will check the role according to its corresponding role definition
      * provided in relation's relation type
      * <P>The Relation Service keeps track of the changes to keep the
-     * consistency of relations by handling referenced MBean unregistrations.
+     * consistency of relations by handling referenced MBean deregistrations.
      *
      * @param relationId  relation id
      * @param roleList  list of roles to be set
@@ -2831,7 +2831,7 @@
     }
 
     // Updates the listener registered to the MBean Server to be informed of
-    // referenced MBean unregistrations
+    // referenced MBean deregistrations
     //
     // -param newRefList  ArrayList of ObjectNames for new references done
     //  to MBeans (can be null)
--- a/jdk/src/share/classes/javax/management/relation/RelationServiceMBean.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/management/relation/RelationServiceMBean.java	Wed Jul 05 19:21:26 2017 +0200
@@ -699,7 +699,7 @@
      * <P>Will check the role according to its corresponding role definition
      * provided in relation's relation type
      * <P>The Relation Service will keep track of the change to keep the
-     * consistency of relations by handling referenced MBean unregistrations.
+     * consistency of relations by handling referenced MBean deregistrations.
      *
      * @param relationId  relation id
      * @param role  role to be set (name and new value)
@@ -742,7 +742,7 @@
      * <P>Will check the role according to its corresponding role definition
      * provided in relation's relation type
      * <P>The Relation Service keeps track of the changes to keep the
-     * consistency of relations by handling referenced MBean unregistrations.
+     * consistency of relations by handling referenced MBean deregistrations.
      *
      * @param relationId  relation id
      * @param roleList  list of roles to be set
--- a/jdk/src/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -120,6 +120,7 @@
      */
     @Override
     protected Class<?> findClass(String name) throws ClassNotFoundException {
+        // Note: classNames is guaranteed by the constructor to be non-null.
         for (int i = 0; i < classNames.length; i++) {
             if (name.equals(classNames[i])) {
                 return defineClass(classNames[i], byteCodes[i], 0,
--- a/jdk/src/share/classes/javax/management/remote/rmi/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/management/remote/rmi/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -95,7 +95,7 @@
       <code>rmi</code> or <code>iiop</code> in the
       <code><em>protocol</em></code> part of the
       <code>serviceURL</code> when creating the connector server.  You
-      can also create specialised connector servers by instantiating
+      can also create specialized connector servers by instantiating
       an appropriate subclass of {@link
       javax.management.remote.rmi.RMIServerImpl RMIServerImpl} and
       supplying it to the <code>RMIConnectorServer</code>
--- a/jdk/src/share/classes/javax/naming/Binding.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/Binding.java	Wed Jul 05 19:21:26 2017 +0200
@@ -48,7 +48,7 @@
 public class Binding extends NameClassPair {
     /**
      * Contains this binding's object.
-     * It is initialized by the constuctor and can be updated using
+     * It is initialized by the constructor and can be updated using
      * <tt>setObject</tt>.
      * @serial
      * @see #getObject
--- a/jdk/src/share/classes/javax/naming/CompositeName.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/CompositeName.java	Wed Jul 05 19:21:26 2017 +0200
@@ -41,7 +41,7 @@
  * This range may be written as [0,N).
  * The most significant component is at index 0.
  * An empty composite name has no components.
- *<p>
+ *
  * <h1>JNDI Composite Name Syntax</h1>
  * JNDI defines a standard string representation for composite names. This
  * representation is the concatenation of the components of a composite name
@@ -72,12 +72,12 @@
  * A trailing component separator (the composite name string ends with
  * a separator) denotes a trailing empty component.
  * Adjacent component separators denote an empty component.
- *<p>
+ *
  *<h1>Composite Name Examples</h1>
  *This table shows examples of some composite names. Each row shows
  *the string form of a composite name and its corresponding structural form
  *(<tt>CompositeName</tt>).
- *<p>
+ *
 <table border="1" cellpadding=3 summary="examples showing string form of composite name and its corresponding structural form (CompositeName)">
 
 <tr>
@@ -136,7 +136,7 @@
 <td>{"x", "", "y"}</td>
 </tr>
 </table>
- * <p>
+ *
  *<h1>Composition Examples</h1>
  * Here are some composition examples.  The right column shows composing
  * string composite names while the left column shows composing the
@@ -144,7 +144,7 @@
  * string forms of two composite names simply involves concatenating
  * their string forms together.
 
-<p> <table border="1" cellpadding=3 summary="composition examples showing string names and composite names">
+<table border="1" cellpadding=3 summary="composition examples showing string names and composite names">
 
 <tr>
 <th>String Names</th>
@@ -188,7 +188,7 @@
 </tr>
 
 </table>
- *<p>
+ *
  *<h1>Multithreaded Access</h1>
  * A <tt>CompositeName</tt> instance is not synchronized against concurrent
  * multithreaded access. Multiple threads trying to access and modify a
--- a/jdk/src/share/classes/javax/naming/CompoundName.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/CompoundName.java	Wed Jul 05 19:21:26 2017 +0200
@@ -38,7 +38,7 @@
  * This range may be written as [0,N).
  * The most significant component is at index 0.
  * An empty compound name has no components.
- *<p>
+ *
  * <h1>Compound Name Syntax</h1>
  * The syntax of a compound name is specified using a set of properties:
  *<dl>
@@ -135,7 +135,7 @@
  * applied (e.g. embedded separators are escaped or quoted)
  * so that when the same string is parsed, it will yield the same components
  * of the original compound name.
- *<p>
+ *
  *<h1>Multithreaded Access</h1>
  * A <tt>CompoundName</tt> instance is not synchronized against concurrent
  * multithreaded access. Multiple threads trying to access and modify a
--- a/jdk/src/share/classes/javax/naming/Context.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/Context.java	Wed Jul 05 19:21:26 2017 +0200
@@ -31,7 +31,7 @@
  * This interface represents a naming context, which
  * consists of a set of name-to-object bindings.
  * It contains methods for examining and updating these bindings.
- * <p>
+ *
  * <h1>Names</h1>
  * Each name passed as an argument to a <tt>Context</tt> method is relative
  * to that context.  The empty name is used to name the context itself.
@@ -68,12 +68,12 @@
  * <tt>NamingEnumeration</tt> may be names in their own namespace rather than
  * names in a composite namespace, at the discretion of the service
  * provider.
- *<p>
+ *
  *<h1>Exceptions</h1>
  * All the methods in this interface can throw a <tt>NamingException</tt> or
  * any of its subclasses. See <tt>NamingException</tt> and their subclasses
  * for details on each exception.
- *<p>
+ *
  *<h1>Concurrent Access</h1>
  * A Context instance is not guaranteed to be synchronized against
  * concurrent access by multiple threads.  Threads that need to access
@@ -90,7 +90,7 @@
  * use, or while any referrals generated by that operation are still
  * being followed.
  *
- *<p>
+ *
  *<h1>Parameters</h1>
  * A <tt>Name</tt> parameter passed to any method of the
  * <tt>Context</tt> interface or one of its subinterfaces
@@ -102,7 +102,7 @@
  * A <tt>Name</tt> returned by any such method is owned by the caller.
  * The caller may subsequently modify it; the service provider may not.
  *
- *<p>
+ *
  *<h1>Environment Properties</h1>
  *<p>
  * JNDI applications need a way to communicate various preferences
--- a/jdk/src/share/classes/javax/naming/InitialContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/InitialContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -361,7 +361,7 @@
      * follows.
      * Define a new method that uses this method to get an initial
      * context of the desired subclass.
-     * <p><blockquote><pre>
+     * <blockquote><pre>
      * protected XXXContext getURLOrDefaultInitXXXCtx(Name name)
      * throws NamingException {
      *  Context answer = getURLOrDefaultInitCtx(name);
@@ -377,7 +377,7 @@
      * </pre></blockquote>
      * When providing implementations for the new methods in the subclass,
      * use this newly defined method to get the initial context.
-     * <p><blockquote><pre>
+     * <blockquote><pre>
      * public Object XXXMethod1(Name name, ...) {
      *  throws NamingException {
      *    return getURLOrDefaultInitXXXCtx(name).XXXMethod1(name, ...);
--- a/jdk/src/share/classes/javax/naming/InsufficientResourcesException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/InsufficientResourcesException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -30,7 +30,7 @@
   * the requested operation. This might due to a lack of resources on
   * the server or on the client. There are no restrictions to resource types,
   * as different services might make use of different resources. Such
-  * restrictions might be due to physical limits and/or adminstrative quotas.
+  * restrictions might be due to physical limits and/or administrative quotas.
   * Examples of limited resources are internal buffers, memory, network bandwidth.
   *<p>
   * InsufficientResourcesException is different from LimitExceededException in that
--- a/jdk/src/share/classes/javax/naming/ReferralException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/ReferralException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -156,7 +156,7 @@
      * <code>getReferralContext</code> to allow the processing of
      * other referrals to continue.
      * The following code fragment shows a typical usage pattern.
-     * <p><blockquote><pre>
+     * <blockquote><pre>
      *  } catch (ReferralException e) {
      *      if (!shallIFollow(e.getReferralInfo())) {
      *          if (!e.skipReferral()) {
@@ -177,7 +177,7 @@
      * <code>getReferralContext</code> to allow the current
      * referral to be retried.
      * The following code fragment shows a typical usage pattern.
-     * <p><blockquote><pre>
+     * <blockquote><pre>
      *  } catch (ReferralException e) {
      *      while (true) {
      *          try {
--- a/jdk/src/share/classes/javax/naming/directory/DirContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/directory/DirContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -31,7 +31,7 @@
  * The directory service interface, containing
  * methods for examining and updating attributes
  * associated with objects, and for searching the directory.
- * <p>
+ *
  * <h1>Names</h1>
  * Each name passed as an argument to a <tt>DirContext</tt> method is relative
  * to that context.  The empty name is used to name the context itself.
@@ -50,7 +50,7 @@
  * See <tt>Context</tt> for a discussion on the interpretation of the
  * name argument to the <tt>Context</tt> methods. These same rules
  * apply to the name argument to the <tt>DirContext</tt> methods.
- * <p>
+ *
  * <h1>Attribute Models</h1>
  * There are two basic models of what attributes should be
  * associated with.  First, attributes may be directly associated with a
@@ -80,7 +80,7 @@
  * JNDI clients are safest when they do not make assumptions about
  * whether an object's attributes are stored as part of the object, or stored
  * within the parent object and associated with the object's name.
- * <p>
+ *
  * <h1>Attribute Type Names</h1>
  * In the <tt>getAttributes()</tt> and <tt>search()</tt> methods,
  * you can supply the attributes to return by supplying a list of
@@ -112,7 +112,7 @@
  * <li>description;lang-fr
  * </ul>
  *
- * <p>
+ *
  *<h1>Operational Attributes</h1>
  *<p>
  * Some directories have the notion of "operational attributes" which are
@@ -126,7 +126,7 @@
  * The attributes returned do <em>not</em> include operational attributes.
  * In order to retrieve operational attributes, you must name them explicitly.
  *
- * <p>
+ *
  * <h1>Named Context</h1>
  * <p>
  * There are certain methods in which the name must resolve to a context
@@ -137,7 +137,7 @@
  * <code>NotContextException</code> is thrown.
  * Aside from these methods, there is no requirement that the
  * <em>named object</em> be a DirContext.
- *<p>
+ *
  *<h1>Parameters</h1>
  *<p>
  * An <tt>Attributes</tt>, <tt>SearchControls</tt>, or array object
@@ -149,7 +149,7 @@
  * An <tt>Attributes</tt> object returned by any method is owned by
  * the caller.  The caller may subsequently modify it; the service
  * provider will not.
- *<p>
+ *
  *<h1>Exceptions</h1>
  *<p>
  * All the methods in this interface can throw a NamingException or
--- a/jdk/src/share/classes/javax/naming/event/EventContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/event/EventContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -33,7 +33,7 @@
 /**
  * Contains methods for registering/deregistering listeners to be notified of
  * events fired when objects named in a context changes.
- *<p>
+ *
  *<h1>Target</h1>
  * The name parameter in the <tt>addNamingListener()</tt> methods is referred
  * to as the <em>target</em>. The target, along with the scope, identify
@@ -58,7 +58,7 @@
  * An application can use the method <tt>targetMustExist()</tt> to check
  * whether a <tt>EventContext</tt> supports registration
  * of nonexistent targets.
- *<p>
+ *
  *<h1>Event Source</h1>
  * The <tt>EventContext</tt> instance on which you invoke the
  * registration methods is the <em>event source</em> of the events that are
--- a/jdk/src/share/classes/javax/naming/ldap/LdapContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/ldap/LdapContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -338,7 +338,7 @@
      * parameter, a system property, or one or more resource files.
      *<p>
      * The value of this constant is "java.naming.factory.control".
-     *<p>
+     *
      * @see ControlFactory
      * @see javax.naming.Context#addToEnvironment
      * @see javax.naming.Context#removeFromEnvironment
--- a/jdk/src/share/classes/javax/naming/ldap/LdapName.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/ldap/LdapName.java	Wed Jul 05 19:21:26 2017 +0200
@@ -432,7 +432,7 @@
      * Adds the components of a name -- in order -- at a specified position
      * within this name. Components of this LDAP name at or after the
      * index (if any) of the first new component are shifted up
-     * (away from index 0) to accomodate the new components.
+     * (away from index 0) to accommodate the new components.
      *
      * @param suffix    The non-null components to add.
      * @param posn      The index at which to add the new component.
@@ -467,7 +467,7 @@
      * Adds the RDNs of a name -- in order -- at a specified position
      * within this name. RDNs of this LDAP name at or after the
      * index (if any) of the first new RDN are shifted up (away from index 0) to
-     * accomodate the new RDNs.
+     * accommodate the new RDNs.
      *
      * @param suffixRdns        The non-null suffix <tt>Rdn</tt>s to add.
      * @param posn              The index at which to add the suffix RDNs.
--- a/jdk/src/share/classes/javax/naming/ldap/Rdn.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/naming/ldap/Rdn.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -116,7 +116,7 @@
      * Constructs an Rdn from the given attribute set. See
      * {@link javax.naming.directory.Attributes Attributes}.
      * <p>
-     * The string attribute values are not interpretted as
+     * The string attribute values are not interpreted as
      * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>
      * formatted RDN strings. That is, the values are used
      * literally (not parsed) and assumed to be unescaped.
@@ -179,7 +179,7 @@
     /**
      * Constructs an Rdn from the given attribute type and
      * value.
-     * The string attribute values are not interpretted as
+     * The string attribute values are not interpreted as
      * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>
      * formatted RDN strings. That is, the values are used
      * literally (not parsed) and assumed to be unescaped.
@@ -215,7 +215,7 @@
 
     /*
      * Adds the given attribute type and value to this Rdn.
-     * The string attribute values are not interpretted as
+     * The string attribute values are not interpreted as
      * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>
      * formatted RDN strings. That is the values are used
      * literally (not parsed) and assumed to be unescaped.
@@ -315,7 +315,6 @@
      * @return  A negative integer, zero, or a positive integer as this Rdn
      *          is less than, equal to, or greater than the given Object.
      * @exception ClassCastException if obj is null or not a Rdn.
-     * <p>
      */
     public int compareTo(Object obj) {
         if (!(obj instanceof Rdn)) {
@@ -344,7 +343,7 @@
      * components in multi-valued Rdns (such as "ou=Sales+cn=Bob") is not
      * significant.
      * <p>
-     * Type and value equalilty matching is done as below:
+     * Type and value equality matching is done as below:
      * <ul>
      * <li> The types are compared for equality with their case ignored.
      * <li> String values with different but equivalent usage of quoting,
@@ -606,7 +605,7 @@
                 --end;
             }
 
-            // Add back the trailing whitespace with a preceeding '\'
+            // Add back the trailing whitespace with a preceding '\'
             // (escaped or unescaped) that was taken off in the above
             // loop. Whether or not to retain this whitespace is decided below.
             if (end != chars.length &&
@@ -663,7 +662,7 @@
             }
 
             // Get rid of the unescaped trailing whitespace with the
-            // preceeding '\' character that was previously added back.
+            // preceding '\' character that was previously added back.
             int len = builder.length();
             if (isWhitespace(builder.charAt(len - 1)) && esc != (end - 1)) {
                 builder.setLength(len - 1);
--- a/jdk/src/share/classes/javax/net/ssl/SSLPeerUnverifiedException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/net/ssl/SSLPeerUnverifiedException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -46,7 +46,7 @@
 
     /**
      * Constructs an exception reporting that the SSL peer's
-     * identity has not been verifiied.
+     * identity has not been verified.
      *
      * @param reason describes the problem.
      */
--- a/jdk/src/share/classes/javax/net/ssl/SSLSocket.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/net/ssl/SSLSocket.java	Wed Jul 05 19:21:26 2017 +0200
@@ -78,7 +78,7 @@
  * </UL>
  *
  * <P>If handshaking fails for any reason, the <code>SSLSocket</code>
- * is closed, and no futher communications can be done.
+ * is closed, and no further communications can be done.
  *
  * <P>There are two groups of cipher suites which you will need to know
  * about when managing cipher suites: <UL>
--- a/jdk/src/share/classes/javax/print/CancelablePrintJob.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/print/CancelablePrintJob.java	Wed Jul 05 19:21:26 2017 +0200
@@ -55,7 +55,7 @@
      * Stops further processing of a print job.
      * <p>
      * If a service supports this method it cannot be concluded that
-     * job cancellation will always suceeed. A job may not be able to be
+     * job cancellation will always succeed. A job may not be able to be
      * cancelled once it has reached and passed some point in its processing.
      * A successful cancellation means only that the entire job was not
      * printed, some portion may already have printed when cancel returns.
--- a/jdk/src/share/classes/javax/print/DocFlavor.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/print/DocFlavor.java	Wed Jul 05 19:21:26 2017 +0200
@@ -95,7 +95,7 @@
  * <UL>
  * <LI>
  * Character array (<CODE>char[]</CODE>) -- The print data consists of the
- * Unicde characters in the array.
+ * Unicode characters in the array.
  * <P>
  * <LI>
  * <code>String</code>  --
@@ -163,7 +163,7 @@
  * Every instance of the Java virtual machine has a default character encoding
  * determined during virtual-machine startup and typically depends upon the
  * locale and charset being used by the underlying operating system.
- * In a distributed environment there is no gurantee that two VM's share
+ * In a distributed environment there is no guarantee that two VM share
  * the same default encoding. Thus clients which want to stream platform
  * encoded text data from the host platform to a Java Print Service instance
  * must explicitly declare the charset and not rely on defaults.
--- a/jdk/src/share/classes/javax/print/DocPrintJob.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/print/DocPrintJob.java	Wed Jul 05 19:21:26 2017 +0200
@@ -102,7 +102,7 @@
      * specific job attribute should verify it is in that set, but
      * updates about an attribute will be made only if it changes and this
      * is detected by the job. Also updates may be subject to batching
-     * by the job. To minimise overhead in print job processing it is
+     * by the job. To minimize overhead in print job processing it is
      * recommended to listen on only that subset of attributes which
      * are likely to change.
      * If the specified set is empty no attribute updates will be reported
--- a/jdk/src/share/classes/javax/print/MultiDoc.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/print/MultiDoc.java	Wed Jul 05 19:21:26 2017 +0200
@@ -117,7 +117,7 @@
      * @return  Current doc object.
      *
      * @exception  IOException
-     *     Thrown if a error ocurred reading the document.
+     *     Thrown if a error occurred reading the document.
      */
     public Doc getDoc() throws IOException;
 
--- a/jdk/src/share/classes/javax/print/PrintService.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/print/PrintService.java	Wed Jul 05 19:21:26 2017 +0200
@@ -118,7 +118,7 @@
     /**
      * Gets the value of the single specified service attribute.
      * This may be useful to clients which only need the value of one
-     * attribute and want to minimise overhead.
+     * attribute and want to minimize overhead.
      * @param category the category of a PrintServiceAttribute supported
      * by this service - may not be null.
      * @return the value of the supported attribute or null if the
--- a/jdk/src/share/classes/javax/print/attribute/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -1,3 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
 <html>
 <head>
 <title>javax.print.attribute package</title>
@@ -30,7 +31,6 @@
 Provides classes and interfaces
 that describe the types of Java<sup><font size="-2">TM</font></sup> Print
 Service attributes and how they can be collected into attribute sets.
-<P>
 <H3>What is an Attribute?</H3>
 When setting up a print job,
 a client specifies two things:
@@ -71,7 +71,6 @@
 which it achieves the results specified by the processing instructions.
 Representing processing instructions as descriptive items
 provides more flexibility for implementing print jobs.
-<P>
 <h4>Attribute Categories and Values</h4>
 Each printer has a set of capabilities, such as the ability to print on
 different paper sizes or the ability to print more than one copy.  Each of 
@@ -222,7 +221,6 @@
 All of these classes extend <A HREF="HashAttributeSet.html">HashAttributeSet</A>
 and enforce the restriction that the attribute set is only allowed to contain
 the corresponding kind of attribute.
-<P>
 <H3>Attribute Class Design</H3>
 An attribute value is a small, atomic data item,
 such as an integer or an enumerated value.  The Java Print Service API 
@@ -299,8 +297,8 @@
 <code>Attribute</code>.  Most attribute classes also extend the appropriate 
 abstract syntax class to get the implementation.  Consider the 
 <code>Sides</code> attribute class:
+<blockquote>
 <pre>
-<blockquote>
 public class Sides
   extends EnumSyntax
   implements DocAttribute, PrintRequestAttribute, PrintJobAttribute
@@ -311,8 +309,8 @@
     }
   ...
   }
+</pre>
 </blockquote>  
-</pre>
 <p>
 Since every attribute class implements <code>Attribute</code>, every attribute
 class must provide an implementation for the 
@@ -363,9 +361,8 @@
 client usually specifies.  This example demonstrates creating an attribute
 set of print-request attributes and locating a printer that can
 print the document according to the specified attributes:
-<p>
+<blockquote>
 <pre>
-<blockquote>
 
 FileInputStream psStream;
 try {
@@ -392,8 +389,8 @@
 	job.print(myDoc, aset);
    } catch (PrintException pe) {}
 }
+</pre>
 </blockquote>
-</pre>
 <P>
 Please note: In the javax.print APIs, a null reference parameter to methods 
 is incorrect unless explicitly documented on the method as having a meaningful
--- a/jdk/src/share/classes/javax/print/attribute/standard/MediaTray.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/MediaTray.java	Wed Jul 05 19:21:26 2017 +0200
@@ -55,7 +55,7 @@
     public static final MediaTray TOP = new MediaTray(0);
 
     /**
-     * The middle input tray in the printe.
+     * The middle input tray in the printer.
      */
     public static final MediaTray MIDDLE = new MediaTray(1);
 
--- a/jdk/src/share/classes/javax/print/attribute/standard/PresentationDirection.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PresentationDirection.java	Wed Jul 05 19:21:26 2017 +0200
@@ -56,56 +56,56 @@
 
     /**
      * Pages are laid out in columns starting at the top left,
-     * proceeeding towards the bottom {@literal &} right.
+     * proceeding towards the bottom {@literal &} right.
      */
     public static final PresentationDirection TOBOTTOM_TORIGHT =
         new PresentationDirection(0);
 
     /**
      * Pages are laid out in columns starting at the top right,
-     * proceeeding towards the bottom {@literal &} left.
+     * proceeding towards the bottom {@literal &} left.
      */
     public static final PresentationDirection TOBOTTOM_TOLEFT =
         new PresentationDirection(1);
 
     /**
      * Pages are laid out in columns starting at the bottom left,
-     * proceeeding towards the top {@literal &} right.
+     * proceeding towards the top {@literal &} right.
      */
     public static final PresentationDirection TOTOP_TORIGHT =
         new PresentationDirection(2);
 
     /**
      * Pages are laid out in columns starting at the bottom right,
-     * proceeeding towards the top {@literal &} left.
+     * proceeding towards the top {@literal &} left.
      */
     public static final PresentationDirection TOTOP_TOLEFT =
         new PresentationDirection(3);
 
     /**
      * Pages are laid out in rows starting at the top left,
-     * proceeeding towards the right {@literal &} bottom.
+     * proceeding towards the right {@literal &} bottom.
      */
     public static final PresentationDirection TORIGHT_TOBOTTOM =
         new PresentationDirection(4);
 
     /**
      * Pages are laid out in rows starting at the bottom left,
-     * proceeeding towards the right {@literal &} top.
+     * proceeding towards the right {@literal &} top.
      */
     public static final PresentationDirection TORIGHT_TOTOP =
         new PresentationDirection(5);
 
     /**
      * Pages are laid out in rows starting at the top right,
-     * proceeeding towards the left {@literal &} bottom.
+     * proceeding towards the left {@literal &} bottom.
      */
     public static final PresentationDirection TOLEFT_TOBOTTOM =
         new PresentationDirection(6);
 
     /**
      * Pages are laid out in rows starting at the bottom right,
-     * proceeeding towards the left {@literal &} top.
+     * proceeding towards the left {@literal &} top.
      */
     public static final PresentationDirection TOLEFT_TOTOP =
         new PresentationDirection(7);
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterIsAcceptingJobs.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterIsAcceptingJobs.java	Wed Jul 05 19:21:26 2017 +0200
@@ -39,7 +39,7 @@
  * will accept jobs even when the {@link PrinterState PrinterState} is STOPPED.
  * <P>
  * <B>IPP Compatibility:</B> The IPP boolean value is "true" for ACCEPTING_JOBS
- * and "false" for NOT_ACCEPTING_JOBS. TThe category name returned by
+ * and "false" for NOT_ACCEPTING_JOBS. The category name returned by
  * <CODE>getName()</CODE> is the IPP attribute name.  The enumeration's
  * integer value is the IPP enum value.  The <code>toString()</code> method
  * returns the IPP string representation of the attribute value.
@@ -59,7 +59,7 @@
         NOT_ACCEPTING_JOBS = new PrinterIsAcceptingJobs(0);
 
     /**
-     * The printer is currently acccepting jobs.
+     * The printer is currently accepting jobs.
      */
     public static final PrinterIsAcceptingJobs
         ACCEPTING_JOBS = new PrinterIsAcceptingJobs(1);
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterStateReason.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterStateReason.java	Wed Jul 05 19:21:26 2017 +0200
@@ -50,7 +50,7 @@
  * object to the Print Service's
  * {@link PrinterStateReasons PrinterStateReasons} attribute when the
  * corresponding condition becomes true of the printer, and the printer
- * removesthe PrinterStateReason object again when the corresponding
+ * removes the PrinterStateReason object again when the corresponding
  * condition becomes false, regardless of whether the Print Service's overall
  * {@link PrinterState PrinterState} also changed.
  * <P>
--- a/jdk/src/share/classes/javax/print/attribute/standard/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -1,3 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
 <title>javax.print.attribute.standard package</title>
@@ -199,7 +200,6 @@
 so there is no restricted <A HREF="../AttributeSet.html">
 AttributeSet</A>
 subinterface for them.
-<P>
 
 <H4>Attribute Table</H4>
 The table below lists all the printing attributes.
@@ -213,7 +213,6 @@
 lists the supported-values attribute class, if any,
 with which a print service 
 indicates the supported values for that attribute category.
-<P>
 <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=1 SUMMARY="Lists all printing attributes as described in above text">
 <TR BGCOLOR="#E5E5E5">
 <TH VALIGN="bottom">Attribute Class</TH>
--- a/jdk/src/share/classes/javax/print/event/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/print/event/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -1,3 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
 <html>
 <head>
 <title>javax.print.event package</title>
@@ -30,7 +31,7 @@
 Package javax.print.event contains event classes  and listener interfaces.
 <p>
 They may be used to monitor both print services (such as printers going
-on-line & off-line), and the progress of a specific print job.
+on-line &amp; off-line), and the progress of a specific print job.
 <P>
 Please note: In the javax.print APIs, a null reference parameter to methods 
 is incorrect unless explicitly documented on the method as having a meaningful
--- a/jdk/src/share/classes/javax/print/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/print/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -1,3 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
 <html>
 <head>
 <title>javax.print package</title>
@@ -52,7 +53,7 @@
 implementations of <code>PrintServiceLookup</code>.  The print-service provider 
 can dynamically install these <code>PrintServiceLookup</code> implementations 
 using the 
-<a href="../../../technotes/guides/jar/jar.html#Service Provider">
+<a href="../../../technotes/guides/jar/jar.html#Service%20Provider">
 SPI JAR file specification</a>.
 
 <h3>Attribute Definitions</h3>
@@ -69,7 +70,7 @@
 <a href="http://www.ietf.org/rfc/rfc2911.txt">
 RFC 2911 Internet Printing Protocol, 1.1: Model and Semantics</a>, dated 
 September 2000.  The attributes specified in <code>javax.print.attribute.standard</code>
-include common capabilites, such as: resolution, copies, media sizes, 
+include common capabilities, such as: resolution, copies, media sizes, 
 job priority, and page ranges.
 
 <h3>Document Type Specification</h3>
@@ -105,9 +106,8 @@
 of a Postscript document on size A4 paper, creating a print job from 
 one of the returned print services, and calling print.
 
-<p>
+<blockquote>
 <pre>
-<blockquote>
 FileInputStream psStream;
 try {
    psStream = new FileInputStream("file.ps");
@@ -132,8 +132,8 @@
 	job.print(myDoc, aset);
    } catch (PrintException pe) {}
 }
+</pre>
 </blockquote>
-</pre>
 <P>
 Please note: In the javax.print APIs, a null reference parameter to methods 
 is incorrect unless explicitly documented on the method as having a meaningful
--- a/jdk/src/share/classes/javax/script/AbstractScriptEngine.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/script/AbstractScriptEngine.java	Wed Jul 05 19:21:26 2017 +0200
@@ -255,7 +255,7 @@
      *
      * @param script A <code>String</code> containing the source of the script.
      * @return The return value from <code>eval(String, ScriptContext)</code>
-     * @throws ScriptException if an error occurrs in script.
+     * @throws ScriptException if an error occurs in script.
      * @throws NullPointerException if any of the parameters is null.
      */
     public Object eval(String script) throws ScriptException {
--- a/jdk/src/share/classes/javax/script/CompiledScript.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/script/CompiledScript.java	Wed Jul 05 19:21:26 2017 +0200
@@ -36,7 +36,7 @@
  * Each <code>CompiledScript</code> is associated with a <code>ScriptEngine</code> -- A call to an  <code>eval</code>
  * method of the <code>CompiledScript</code> causes the execution of the script by the
  * <code>ScriptEngine</code>.  Changes in the state of the <code>ScriptEngine</code> caused by execution
- * of tne <code>CompiledScript</code>  may visible during subsequent executions of scripts by the engine.
+ * of the <code>CompiledScript</code>  may visible during subsequent executions of scripts by the engine.
  *
  * @author Mike Grogan
  * @since 1.6
--- a/jdk/src/share/classes/javax/script/Invocable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/script/Invocable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -51,7 +51,7 @@
      * @return The value returned by the procedure.  The rules for converting the scripting
      * variable returned by the script method to a Java Object are implementation-specific.
      *
-     * @throws ScriptException if an error occurrs during invocation of the method.
+     * @throws ScriptException if an error occurs during invocation of the method.
      * @throws NoSuchMethodException if method with given name or matching argument types cannot be found.
      * @throws NullPointerException if the method name is null.
      * @throws IllegalArgumentException if the specified thiz is null or the specified Object is
@@ -67,7 +67,7 @@
      * @param args Arguments to pass to the procedure or function
      * @return The value returned by the procedure or function
      *
-     * @throws ScriptException if an error occurrs during invocation of the method.
+     * @throws ScriptException if an error occurs during invocation of the method.
      * @throws NoSuchMethodException if method with given name or matching argument types cannot be found.
      * @throws NullPointerException if method name is null.
      */
--- a/jdk/src/share/classes/javax/script/ScriptEngine.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/script/ScriptEngine.java	Wed Jul 05 19:21:26 2017 +0200
@@ -114,7 +114,7 @@
      *
      * @return The value returned from the execution of the script.
      *
-     * @throws ScriptException if an error occurrs in script. ScriptEngines should create and throw
+     * @throws ScriptException if an error occurs in script. ScriptEngines should create and throw
      * <code>ScriptException</code> wrappers for checked Exceptions thrown by underlying scripting
      * implementations.
      * @throws NullPointerException if either argument is null.
@@ -132,7 +132,7 @@
      *
      * @return The value returned from the execution of the script.
      *
-     * @throws ScriptException if an error occurrs in script.
+     * @throws ScriptException if an error occurs in script.
      * @throws NullPointerException if either argument is null.
      */
     public Object eval(Reader reader , ScriptContext context) throws ScriptException;
@@ -145,7 +145,7 @@
      *
      * @return The value returned from the execution of the script.
      *
-     * @throws ScriptException if error occurrs in script.
+     * @throws ScriptException if error occurs in script.
      * @throws NullPointerException if the argument is null.
      */
     public Object eval(String script) throws ScriptException;
@@ -158,7 +158,7 @@
      *
      * @return The value returned by the script.
      *
-     * @throws ScriptException if an error occurrs in script.
+     * @throws ScriptException if an error occurs in script.
      * @throws NullPointerException if the argument is null.
      */
     public Object eval(Reader reader) throws ScriptException;
@@ -177,7 +177,7 @@
      *
      * @return The value returned by the script.
      *
-     * @throws ScriptException if an error occurrs in script.
+     * @throws ScriptException if an error occurs in script.
      * @throws NullPointerException if either argument is null.
      */
     public Object eval(String script, Bindings n) throws ScriptException;
@@ -191,7 +191,7 @@
      *
      * @return The value returned by the script.
      *
-     * @throws ScriptException if an error occurrs.
+     * @throws ScriptException if an error occurs.
      * @throws NullPointerException if either argument is null.
      */
     public Object eval(Reader reader , Bindings n) throws ScriptException;
--- a/jdk/src/share/classes/javax/script/ScriptEngineFactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/script/ScriptEngineFactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -142,7 +142,7 @@
 
     /**
      * Returns a String which can be used to invoke a method of a  Java object using the syntax
-     * of the supported scripting language.  For instance, an implementaton for a Javascript
+     * of the supported scripting language.  For instance, an implementation for a Javascript
      * engine might be;
      * <p>
      * <pre>{@code
@@ -178,7 +178,7 @@
 
     /**
      * Returns a String that can be used as a statement to display the specified String  using
-     * the syntax of the supported scripting language.  For instance, the implementaton for a Perl
+     * the syntax of the supported scripting language.  For instance, the implementation for a Perl
      * engine might be;
      * <p>
      * <pre><code>
@@ -196,7 +196,7 @@
 
 
     /**
-     * Returns a valid scripting language executable progam with given statements.
+     * Returns a valid scripting language executable program with given statements.
      * For instance an implementation for a PHP engine might be:
      * <p>
      * <pre>{@code
--- a/jdk/src/share/classes/javax/security/sasl/RealmChoiceCallback.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/security/sasl/RealmChoiceCallback.java	Wed Jul 05 19:21:26 2017 +0200
@@ -46,7 +46,7 @@
      * @param choices the non-null list of realms to choose from.
      * @param defaultChoice the choice to be used as the default choice
      * when the list of choices is displayed. It is an index into
-     * the {@code choices} arary.
+     * the {@code choices} array.
      * @param multiple true if multiple choices allowed; false otherwise
      * @throws IllegalArgumentException If {@code prompt} is null or the empty string,
      * if {@code choices} has a length of 0, if any element from
--- a/jdk/src/share/classes/javax/security/sasl/Sasl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/security/sasl/Sasl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -172,7 +172,7 @@
      *
      * Mechanism implementations that support reuse might allow customization
      * of its implementation, for factors such as cache size, timeouts, and
-     * criteria for reuseability. Such customizations are
+     * criteria for reusability. Such customizations are
      * implementation-dependent.
      */
      public static final String REUSE = "javax.security.sasl.reuse";
--- a/jdk/src/share/classes/javax/security/sasl/SaslClient.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/security/sasl/SaslClient.java	Wed Jul 05 19:21:26 2017 +0200
@@ -123,7 +123,7 @@
      * @param challenge The non-null challenge sent from the server.
      * The challenge array may have zero length.
      *
-     * @return The possibly null reponse to send to the server.
+     * @return The possibly null response to send to the server.
      * It is null if the challenge accompanied a "SUCCESS" status and the challenge
      * only contains data for the client to update its state and no response
      * needs to be sent to the server. The response is a zero-length byte
--- a/jdk/src/share/classes/javax/security/sasl/SaslException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/security/sasl/SaslException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -107,7 +107,7 @@
     /**
      * Returns the string representation of this exception.
      * The string representation contains
-     * this exception's class name, its detailed messsage, and if
+     * this exception's class name, its detailed message, and if
      * it has a root exception, the string representation of the root
      * exception. This string representation
      * is meant for debugging and not meant to be interpreted
--- a/jdk/src/share/classes/javax/smartcardio/CardChannel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/smartcardio/CardChannel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -122,7 +122,7 @@
 
     /**
      * Transmits the command APDU stored in the command ByteBuffer and receives
-     * the reponse APDU in the response ByteBuffer.
+     * the response APDU in the response ByteBuffer.
      *
      * <p>The command buffer must contain valid command APDU data starting
      * at <code>command.position()</code> and the APDU must be
--- a/jdk/src/share/classes/javax/smartcardio/CardTerminal.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/smartcardio/CardTerminal.java	Wed Jul 05 19:21:26 2017 +0200
@@ -28,7 +28,7 @@
 import java.util.*;
 
 /**
- * A Smart Card terminal, sometimes refered to as a Smart Card Reader.
+ * A Smart Card terminal, sometimes referred to as a Smart Card Reader.
  * A CardTerminal object can be obtained by calling
  * {@linkplain CardTerminals#list}
  * or {@linkplain CardTerminals#getTerminal CardTerminals.getTerminal()}.
--- a/jdk/src/share/classes/javax/sound/midi/MidiDevice.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sound/midi/MidiDevice.java	Wed Jul 05 19:21:26 2017 +0200
@@ -60,7 +60,7 @@
  * <code>Receiver</code> or <code>Transmitter</code> that resulted in
  * opening it. If more than one implicitly opening
  * <code>Receiver</code> or <code>Transmitter</code> were obtained by
- * the application, the decive is closed after the last
+ * the application, the device is closed after the last
  * <code>Receiver</code> or <code>Transmitter</code> has been
  * closed. On the other hand, calling <code>getReceiver</code> or
  * <code>getTransmitter</code> on the device instance directly does
--- a/jdk/src/share/classes/javax/sound/midi/MidiMessage.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sound/midi/MidiMessage.java	Wed Jul 05 19:21:26 2017 +0200
@@ -59,7 +59,7 @@
  * <p>
  * If you simply need to pass a known MIDI byte value as a method parameter,
  * it can be expressed directly as an integer, using (for example) decimal or
- * hexidecimal notation.  For instance, to pass the "active sensing" status byte
+ * hexadecimal notation.  For instance, to pass the "active sensing" status byte
  * as the first argument to ShortMessage's
  * {@link ShortMessage#setMessage(int) setMessage(int)}
  * method, you can express it as 254 or 0xFE.
--- a/jdk/src/share/classes/javax/sound/midi/MidiSystem.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sound/midi/MidiSystem.java	Wed Jul 05 19:21:26 2017 +0200
@@ -120,7 +120,7 @@
  * is optional.
  *
  * <p>If the provider class is specified, and it can be
- * successully retrieved from the installed providers,
+ * successfully retrieved from the installed providers,
  * the list of
  * <code>MidiDevice.Info</code> objects is retrieved
  * from the provider. Otherwise, or when these devices
--- a/jdk/src/share/classes/javax/sound/midi/ShortMessage.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sound/midi/ShortMessage.java	Wed Jul 05 19:21:26 2017 +0200
@@ -94,7 +94,7 @@
     // System real-time messages
 
     /**
-     * Status byte for Timing Clock messagem (0xF8, or 248).
+     * Status byte for Timing Clock message (0xF8, or 248).
      * @see MidiMessage#getStatus
      */
     public static final int TIMING_CLOCK                                = 0xF8; // 248
--- a/jdk/src/share/classes/javax/sound/midi/Soundbank.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sound/midi/Soundbank.java	Wed Jul 05 19:21:26 2017 +0200
@@ -100,7 +100,7 @@
 
     /**
      * Extracts a list of non-Instrument resources contained in the sound bank.
-     * @return an array of resources, exclusing instruments.  If the sound bank contains
+     * @return an array of resources, excluding instruments.  If the sound bank contains
      * no resources (other than instruments), returns an array of length 0.
      */
     public SoundbankResource[] getResources();
--- a/jdk/src/share/classes/javax/sound/midi/Synthesizer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sound/midi/Synthesizer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -212,7 +212,7 @@
      * @param from the <code>Instrument</code> object to be replaced
      * @param to the <code>Instrument</code> object to be used in place
      * of the old instrument, it should be loaded into the synthesizer
-     * @return <code>true</code> if the instrument succeessfully remapped,
+     * @return <code>true</code> if the instrument successfully remapped,
      * <code>false</code> if feature is not implemented by synthesizer
      * @throws IllegalArgumentException if instrument
      * <code>from</code> or instrument <code>to</code> aren't supported by
--- a/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java	Wed Jul 05 19:21:26 2017 +0200
@@ -31,7 +31,7 @@
 
 /**
  * <code>AudioFormat</code> is the class that specifies a particular arrangement of data in a sound stream.
- * By examing the information stored in the audio format, you can discover how to interpret the bits in the
+ * By examining the information stored in the audio format, you can discover how to interpret the bits in the
  * binary sound data.
  * <p>
  * Every data line has an audio format associated with its data stream. The audio format of a source (playback) data line indicates
--- a/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java	Wed Jul 05 19:21:26 2017 +0200
@@ -115,7 +115,7 @@
  * is optional.
  *
  * <p>If the provider class is specified, and it can be
- * successully retrieved from the installed providers, the list of
+ * successfully retrieved from the installed providers, the list of
  * <code>Mixer.Info</code> objects is retrieved
  * from the provider. Otherwise, or when these mixers
  * do not provide a subsequent match, the list is retrieved
--- a/jdk/src/share/classes/javax/sound/sampled/ReverbType.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sound/sampled/ReverbType.java	Wed Jul 05 19:21:26 2017 +0200
@@ -42,7 +42,7 @@
  * intensity of late reflections, and an overall decay time.
  * Early reflections are the initial individual low-order reflections of the
  * direct signal off the surfaces in the room.
- * The late Relections are the dense, high-order reflections that characterize
+ * The late Reflections are the dense, high-order reflections that characterize
  * the room's reverberation.
  * The delay times for the start of these two reflection types give the listener
  * a sense of the overall size and complexity of the room's shape and contents.
--- a/jdk/src/share/classes/javax/sql/PooledConnection.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/PooledConnection.java	Wed Jul 05 19:21:26 2017 +0200
@@ -73,7 +73,7 @@
  * if a fatal error has made the connection unusable.
  *
  * <p>
- * A connection pool manager is often also a statement pool manager, maintining
+ * A connection pool manager is often also a statement pool manager, maintaining
  *  a pool of <code>PreparedStatement</code> objects.
  *  When an application closes a prepared statement, it calls the
  *  <code>PreparedStatement</code>
--- a/jdk/src/share/classes/javax/sql/RowSet.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/RowSet.java	Wed Jul 05 19:21:26 2017 +0200
@@ -206,7 +206,7 @@
   int getTransactionIsolation();
 
   /**
-   * Sets the transaction isolation level for this <code>RowSet</code> obejct.
+   * Sets the transaction isolation level for this <code>RowSet</code> object.
    *
    * @param level the transaction isolation level; one of
    *      <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
@@ -1438,7 +1438,7 @@
      * if parameterIndex does not correspond
      * to a parameter marker in the SQL statement,  if the length specified
      * is less than zero or if the number of bytes in the inputstream does not match
-     * the specfied length.
+     * the specified length.
      * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
      *
      * @since 1.6
@@ -1492,7 +1492,7 @@
      * @throws SQLException  if parameterIndex does not correspond
      * to a parameter marker in the SQL statement,  or if the length specified
      * is less than zero; if the number of bytes in the inputstream does not match
-     * the specfied length; if a database access error occurs or
+     * the specified length; if a database access error occurs or
      * this method is called on a closed <code>CallableStatement</code>
      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
      * this method
@@ -1956,7 +1956,7 @@
    void setRowId(String parameterName, RowId x) throws SQLException;
 
     /**
-     * Sets the designated paramter to the given <code>String</code> object.
+     * Sets the designated parameter to the given <code>String</code> object.
      * The driver converts this to a SQL <code>NCHAR</code> or
      * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value
      * (depending on the argument's
@@ -1973,7 +1973,7 @@
      void setNString(int parameterIndex, String value) throws SQLException;
 
     /**
-     * Sets the designated paramter to the given <code>String</code> object.
+     * Sets the designated parameter to the given <code>String</code> object.
      * The driver converts this to a SQL <code>NCHAR</code> or
      * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code>
      * @param parameterName the name of the column to be set
--- a/jdk/src/share/classes/javax/sql/StatementEvent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/StatementEvent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -53,7 +53,7 @@
          * <p>
          * @param con                   The <code>PooledConnection</code> that the closed or invalid
          * <code>PreparedStatement</code>is associated with.
-         * @param statement             The <code>PreparedStatement</code> that is bieng closed or is invalid
+         * @param statement             The <code>PreparedStatement</code> that is being closed or is invalid
          * <p>
          * @throws IllegalArgumentException if <code>con</code> is null.
          *
--- a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java	Wed Jul 05 19:21:26 2017 +0200
@@ -211,7 +211,7 @@
  * to the driver or the DBMS. For example, the methods <code>setDate</code>,
  * <code>setTime</code>, and <code>setTimestamp</code> can take a <code>Calendar</code>
  * object as their third parameter.  If the DBMS does not store time zone information,
- * the drivern uses the <code>Calendar</code> object to construct the <code>Date</code>,
+ * the driver uses the <code>Calendar</code> object to construct the <code>Date</code>,
  * <code>Time</code>, or <code>Timestamp</code> object being set. As is true with other
  * methods that provide additional information, the element in the array returned
  * by <code>getParams</code> is an array instead of a simple <code>Object</code> instance.
@@ -3162,7 +3162,7 @@
      * @return an array of <code>Object</code> instances that includes the
      *         parameter values that may be set in this <code>RowSet</code> object's
      *         command; an empty array if no parameters have been set
-     * @throws SQLException if an error occurs retrieveing the object array of
+     * @throws SQLException if an error occurs retrieving the object array of
      *         parameters of this <code>RowSet</code> object or if not all parameters have
      *         been set
      */
@@ -3810,7 +3810,7 @@
     * if parameterIndex does not correspond
     * to a parameter marker in the SQL statement,  if the length specified
     * is less than zero or if the number of bytes in the inputstream does not match
-    * the specfied length.
+    * the specified length.
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
     *
     * @since 1.6
@@ -3870,7 +3870,7 @@
      * @throws SQLException  if parameterIndex does not correspond
      * to a parameter marker in the SQL statement,  or if the length specified
      * is less than zero; if the number of bytes in the inputstream does not match
-     * the specfied length; if a database access error occurs or
+     * the specified length; if a database access error occurs or
      * this method is called on a closed <code>CallableStatement</code>
      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
      * this method
@@ -4253,7 +4253,7 @@
  }
 
  /**
-  * Sets the designated paramter to the given <code>String</code> object.
+  * Sets the designated parameter to the given <code>String</code> object.
   * The driver converts this to a SQL <code>NCHAR</code> or
   * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value
   * (depending on the argument's
@@ -4275,7 +4275,7 @@
 
 
  /**
-  * Sets the designated paramter to the given <code>String</code> object.
+  * Sets the designated parameter to the given <code>String</code> object.
   * The driver converts this to a SQL <code>NCHAR</code> or
   * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code>
   * @param parameterName the name of the column to be set
--- a/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1104,7 +1104,7 @@
     public SyncProvider getSyncProvider() throws SQLException;
 
    /**
-    * Sets the <code>SyncProvider</code> objec for this <code>CachedRowSet</code>
+    * Sets the <code>SyncProvider</code> object for this <code>CachedRowSet</code>
     * object to the one specified.  This method
     * allows the <code>SyncProvider</code> object to be reset.
     * <P>
@@ -1173,7 +1173,7 @@
     * the last synchronization with the underlying data source.  If there have been
     * no synchronizations, the original value will be the value with which the
     * <code>RowSet</code> object was populated.  This method is called internally
-    * when an aplication calls the method <code>acceptChanges</code> and the
+    * when an application calls the method <code>acceptChanges</code> and the
     * <code>SyncProvider</code> object has been implemented to check for conflicts.
     * If this is the case, the writer compares the original value with the value
     * currently in the data source to check for conflicts.
--- a/jdk/src/share/classes/javax/sql/rowset/JoinRowSet.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/JoinRowSet.java	Wed Jul 05 19:21:26 2017 +0200
@@ -359,7 +359,7 @@
      * <code>RowSet</code> objects that have been added to this
      * <code>JoinRowSet</code> object.
      * This should return the 'n' number of RowSet contained
-     * within the <code>JOIN</code> and maintain any updates that have occured while in
+     * within the <code>JOIN</code> and maintain any updates that have occurred while in
      * this union.
      *
      * @return a <code>Collection</code> object consisting of the
--- a/jdk/src/share/classes/javax/sql/rowset/Joinable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/Joinable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -76,7 +76,7 @@
  *     jrs.addRowSet(crs);
  * </pre>
  * In the previous example, <i>crs</i> is a <code>CachedRowSet</code> object that
- * has emplemented the <code>Joinable</code> interface.  In the following example,
+ * has implemented the <code>Joinable</code> interface.  In the following example,
  * <i>crs2</i> has not, so it must supply the match column as an argument to the
  * <code>addRowSet</code> method. This example assumes that column 1 is the match
  * column.
@@ -250,7 +250,7 @@
      * Unsets the designated columns as the match column for this <code>RowSet</code>
      * object.
      *
-     * @param columnIdxes an arrary of <code>int</code> that identifies the indexes
+     * @param columnIdxes an array of <code>int</code> that identifies the indexes
      *     of the columns that are to be unset as match columns
      * @throws SQLException if an invalid column index is designated or if
      *          the designated column was not previously set as a match
--- a/jdk/src/share/classes/javax/sql/rowset/Predicate.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/Predicate.java	Wed Jul 05 19:21:26 2017 +0200
@@ -131,7 +131,7 @@
      *        SQL index of a column in this <code>RowSet</code> object. This must
      *        have been passed to <code>Predicate</code> as one of the columns
      *        for filtering while initializing a <code>Predicate</code>
-     * @return <code>true</code> ifrow value lies within the filter;
+     * @return <code>true</code> if row value lies within the filter;
      *     <code>false</code> otherwise
      * @throws SQLException if the column is not part of filtering criteria
      */
--- a/jdk/src/share/classes/javax/sql/rowset/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -43,7 +43,7 @@
 <ul>
 <li><a href="#pkgspec">1.0 Package Specification</a>
 <li><a href="#stdrowset">2.0 Standard RowSet Definitions</a>
-<li><a href="#impl">3.0 Implementater's Guide</a>
+<li><a href="#impl">3.0 Implementer's Guide</a>
 <li><a href="#relspec">4.0 Related Specifications</a>
 <li><a href="#reldocs">5.0 Related Documentation</a>
 </ul>
--- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -71,7 +71,7 @@
  *       <code>WebRowSet</code> objects
  * </UL>
  * Note that the JDBC RowSet Implementations include the <code>SyncProvider</code>
- * implemtations <code>RIOptimisticProvider</code> and <code>RIXmlProvider</code>,
+ * implementations <code>RIOptimisticProvider</code> and <code>RIXmlProvider</code>,
  * which satisfy this requirement.
  * <P>
  * The <code>SyncFactory</code> class provides accessor methods to assist
--- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncResolver.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncResolver.java	Wed Jul 05 19:21:26 2017 +0200
@@ -264,10 +264,10 @@
     public static int INSERT_ROW_CONFLICT = 2;
 
     /**
-     * Indicates that <b>no</b> conflict occured while the <code>RowSet</code> object
+     * Indicates that <b>no</b> conflict occurred while the <code>RowSet</code> object
      * was attempting to update, delete or insert a row in the data source. The values in
      * the <code>SyncResolver</code> will contain <code>null</code> values only as an indication
-     * that no information in pertitent to the conflict resolution in this row.
+     * that no information in pertinent to the conflict resolution in this row.
      */
     public static int NO_ROW_CONFLICT = 3;
 
--- a/jdk/src/share/classes/javax/sql/rowset/spi/TransactionalWriter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/spi/TransactionalWriter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -37,10 +37,10 @@
  * <code>SyncProvider</code> abstract class so that it has finer grained
  * transaction control.
  * <p>
- * If one or more disconnected <code>RowSet</code> objects are particating
+ * If one or more disconnected <code>RowSet</code> objects are participating
  * in a global transaction, they may wish to coordinate their synchronization
  * commits to preserve data integrity and reduce the number of
- * sychronization exceptions. If this is the case, an application should set
+ * synchronization exceptions. If this is the case, an application should set
  * the <code>CachedRowSet</code> constant <code>COMMIT_ON_ACCEPT_CHANGES</code>
  * to <code>false</code> and use the <code>commit</code> and <code>rollback</code>
  * methods defined in this interface to manage transaction boundaries.
--- a/jdk/src/share/classes/javax/sql/rowset/spi/XmlReader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/spi/XmlReader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -38,7 +38,7 @@
  * <P>
  * <code>SyncProvider</code>  implementations that supply XML data reader
  * capabilities such as output XML stream capabilities can implement this
- * interface to provider standard <code>XmlReader</code> objects to
+ * interface to provide standard <code>XmlReader</code> objects to
  * <code>WebRowSet</code> implementations.
  * <p>
  * An <code>XmlReader</code> object is registered as the
--- a/jdk/src/share/classes/javax/sql/rowset/spi/XmlWriter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/spi/XmlWriter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -38,7 +38,7 @@
  * <p>
  * <code>SyncProvider</code>  implementations that supply XML data writer
  * capabilities such as output XML stream capabilities can implement this
- * interface to provider standard <code>XmlWriter</code> objects to
+ * interface to provide standard <code>XmlWriter</code> objects to
  * <code>WebRowSet</code> implementations.
  * <P>
  * Writing a <code>WebRowSet</code> object includes printing the
--- a/jdk/src/share/classes/javax/swing/AbstractButton.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/AbstractButton.java	Wed Jul 05 19:21:26 2017 +0200
@@ -330,7 +330,7 @@
     /**
      * Sets the state of the button. Note that this method does not
      * trigger an <code>actionEvent</code>.
-     * Call <code>doClick</code> to perform a programatic action change.
+     * Call <code>doClick</code> to perform a programmatic action change.
      *
      * @param b  true if the button is selected, otherwise false
      */
@@ -2928,7 +2928,7 @@
          * If there is no selection, but there is
          * a caret, the start and end offsets will be the same.
          *
-         * @return the index into teh text of the end of the selection
+         * @return the index into the text of the end of the selection
          * @since 1.3
          */
         public int getSelectionEnd() {
--- a/jdk/src/share/classes/javax/swing/Action.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/Action.java	Wed Jul 05 19:21:26 2017 +0200
@@ -98,10 +98,10 @@
  *         summary="Supported Action properties"
  *         valign="top" >
  *  <tr valign="top"  align="left">
- *    <th bgcolor="#CCCCFF" align="left">Component Property
- *    <th bgcolor="#CCCCFF" align="left">Components
- *    <th bgcolor="#CCCCFF" align="left">Action Key
- *    <th bgcolor="#CCCCFF" align="left">Notes
+ *    <th style="background-color:#CCCCFF" align="left">Component Property
+ *    <th style="background-color:#CCCCFF" align="left">Components
+ *    <th style="background-color:#CCCCFF" align="left">Action Key
+ *    <th style="background-color:#CCCCFF" align="left">Notes
  *  <tr valign="top"  align="left">
  *      <td><b><code>enabled</code></b>
  *      <td>All
--- a/jdk/src/share/classes/javax/swing/BoxLayout.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/BoxLayout.java	Wed Jul 05 19:21:26 2017 +0200
@@ -338,7 +338,7 @@
      * to lay out the components it contains.
      *
      * @param target  the container that needs to be laid out
-     * @return the dimenions >= 0 && <= Integer.MAX_VALUE
+     * @return the dimensions >= 0 && <= Integer.MAX_VALUE
      * @exception AWTError  if the target isn't the container specified to the
      *                      BoxLayout constructor
      * @see #preferredLayoutSize
--- a/jdk/src/share/classes/javax/swing/DefaultListSelectionModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/DefaultListSelectionModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -786,7 +786,7 @@
      * leadIndex and newLeadIndex is the new one.
      * <p>
      * If the value at the anchor index is not selected, do the same thing in
-     * reverse selecting values in the old range and deslecting values in the
+     * reverse selecting values in the old range and deselecting values in the
      * new one.
      * <p>
      * Generate a single event for this change and notify all listeners.
--- a/jdk/src/share/classes/javax/swing/DefaultRowSorter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/DefaultRowSorter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -53,7 +53,7 @@
  * <code>Collator.getInstance()</code> is used on the results of
  * calling <code>toString</code> on the underlying objects.  The
  * <code>Comparator</code> is never passed <code>null</code>.  A
- * <code>null</code> value is treated as occuring before a
+ * <code>null</code> value is treated as occurring before a
  * non-<code>null</code> value, and two <code>null</code> values are
  * considered equal.
  * <p>
--- a/jdk/src/share/classes/javax/swing/GroupLayout.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/GroupLayout.java	Wed Jul 05 19:21:26 2017 +0200
@@ -79,7 +79,7 @@
  * The following diagram shows a sequential group along the horizontal
  * axis. The sequential group contains three components. A parallel group
  * was used along the vertical axis.
- * <p align="center">
+ * <p style="text-align:center">
  * <img src="doc-files/groupLayout.1.gif">
  * <p>
  * To reinforce that each axis is treated independently the diagram shows
@@ -101,7 +101,7 @@
  * parallel group along the horizontal axis and the sequential group along
  * the vertical axis.
  * <p>
- * <p align="center">
+ * <p style="text-align:center">
  * <img src="doc-files/groupLayout.2.gif">
  * <p>
  * As {@code c1} is the largest of the three components, the parallel
@@ -115,7 +115,7 @@
  * <p>
  * The following diagram shows a sequential group along both the horizontal
  * and vertical axis.
- * <p align="center">
+ * <p style="text-align:center">
  * <img src="doc-files/groupLayout.3.gif">
  * <p>
  * {@code GroupLayout} provides the ability to insert gaps between
@@ -172,7 +172,7 @@
  * </pre>
  * <p>
  * When run the following is produced.
- * <p align="center">
+ * <p style="text-align:center">
  * <img src="doc-files/groupLayout.example.png">
  * <p>
  * This layout consists of the following.
@@ -382,7 +382,7 @@
     }
 
     /**
-     * Sets whether component visiblity is considered when sizing and
+     * Sets whether component visibility is considered when sizing and
      * positioning components. A value of {@code true} indicates that
      * non-visible components should not be treated as part of the
      * layout. A value of {@code false} indicates that components should be
@@ -397,7 +397,7 @@
      * <p>
      * The default is {@code true}.
      *
-     * @param honorsVisibility whether component visiblity is considered when
+     * @param honorsVisibility whether component visibility is considered when
      *                         sizing and positioning components
      * @see #setHonorsVisibility(Component,Boolean)
      */
@@ -411,10 +411,10 @@
     }
 
     /**
-     * Returns whether component visiblity is considered when sizing and
+     * Returns whether component visibility is considered when sizing and
      * positioning components.
      *
-     * @return whether component visiblity is considered when sizing and
+     * @return whether component visibility is considered when sizing and
      *         positioning components
      */
     public boolean getHonorsVisibility() {
@@ -422,7 +422,7 @@
     }
 
     /**
-     * Sets whether the component's visiblity is considered for
+     * Sets whether the component's visibility is considered for
      * sizing and positioning. A value of {@code Boolean.TRUE}
      * indicates that if {@code component} is not visible it should
      * not be treated as part of the layout. A value of {@code false}
@@ -432,11 +432,11 @@
      * setHonorsVisibility} should be used.
      * <p>
      * If {@code component} is not a child of the {@code Container} this
-     * {@code GroupLayout} is managine, it will be added to the
+     * {@code GroupLayout} is managing, it will be added to the
      * {@code Container}.
      *
      * @param component the component
-     * @param honorsVisibility whether {@code component}'s visiblity should be
+     * @param honorsVisibility whether visibility of this {@code component} should be
      *              considered for sizing and positioning
      * @throws IllegalArgumentException if {@code component} is {@code null}
      * @see #setHonorsVisibility(Component,Boolean)
@@ -1315,7 +1315,7 @@
             return parent;
         }
 
-        // This is here purely as a conveniance for ParallelGroup to avoid
+        // This is here purely as a convenience for ParallelGroup to avoid
         // having to track alignment separately.
         void setAlignment(Alignment alignment) {
             this.alignment = alignment;
@@ -2048,7 +2048,7 @@
             // 2. Sort the list in ascending order
             // 3. Iterate through each of the resizable Springs, attempting
             //    to give them (pref - size) / resizeCount
-            // 4. For any Springs that can not accomodate that much space
+            // 4. For any Springs that can not accommodate that much space
             //    add the remainder back to the amount to distribute and
             //    recalculate how must space the remaining springs will get.
             // 5. Set the size of the springs.
@@ -2275,7 +2275,7 @@
                 if (!baselineSpring.isResizable(VERTICAL)) {
                     // Spring to use for baseline isn't resizable. In this case
                     // baseline resize behavior can be determined based on how
-                    // preceeding springs resize.
+                    // preceding springs resize.
                     boolean leadingResizable = false;
                     for (Spring spring : springs) {
                         if (spring == baselineSpring) {
--- a/jdk/src/share/classes/javax/swing/ImageIcon.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/ImageIcon.java	Wed Jul 05 19:21:26 2017 +0200
@@ -80,8 +80,20 @@
     ImageObserver imageObserver;
     String description = null;
 
-    // Fields for twisted backward compatibility only. DO NOT USE.
+    /**
+     * Do not use this shared component, which is used to track image loading.
+     * It is left for backward compatibility only.
+     * @deprecated since 1.8
+     */
+    @Deprecated
     protected final static Component component;
+
+    /**
+     * Do not use this shared media tracker, which is used to load images.
+     * It is left for backward compatibility only.
+     * @deprecated since 1.8
+     */
+    @Deprecated
     protected final static MediaTracker tracker;
 
     static {
--- a/jdk/src/share/classes/javax/swing/JApplet.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JApplet.java	Wed Jul 05 19:21:26 2017 +0200
@@ -46,9 +46,10 @@
  * <code>java.applet.Applet</code>.  <code>JApplet</code> contains a
  * <code>JRootPane</code> as its only child.  The <code>contentPane</code>
  * should be the parent of any children of the <code>JApplet</code>.
- * As a convenience <code>add</code> and its variants, <code>remove</code> and
- * <code>setLayout</code> have been overridden to forward to the
- * <code>contentPane</code> as necessary. This means you can write:
+ * As a convenience, the {@code add}, {@code remove}, and {@code setLayout}
+ * methods of this class are overridden, so that they delegate calls
+ * to the corresponding methods of the {@code ContentPane}.
+ * For example, you can add a child component to an applet as follows:
  * <pre>
  *       applet.add(child);
  * </pre>
@@ -256,7 +257,7 @@
      * <code>setLayout</code> are forwarded to the <code>contentPane</code>.
      *
      * @return true if <code>add</code> and <code>setLayout</code>
-     *         are fowarded; false otherwise
+     *         are forwarded; false otherwise
      *
      * @see #addImpl
      * @see #setLayout
--- a/jdk/src/share/classes/javax/swing/JComboBox.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JComboBox.java	Wed Jul 05 19:21:26 2017 +0200
@@ -2143,7 +2143,7 @@
              * a set of predefined roles.  This enables assistive technologies to
              * provide a consistent interface to various tweaked subclasses of
              * components (e.g., use AccessibleRole.PUSH_BUTTON for all components
-             * that act like a push button) as well as distinguish between sublasses
+             * that act like a push button) as well as distinguish between subclasses
              * that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes
              * and AccessibleRole.RADIO_BUTTON for radio buttons).
              * <p>Note that the AccessibleRole class is also extensible, so
--- a/jdk/src/share/classes/javax/swing/JComponent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JComponent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -316,7 +316,7 @@
 
     /**
      * <code>JPopupMenu</code> assigned to this component
-     * and all of its childrens
+     * and all of its children
      */
     private JPopupMenu popupMenu;
 
@@ -2020,7 +2020,7 @@
     /**
      * This method is now obsolete, please use a combination of
      * <code>getActionMap()</code> and <code>getInputMap()</code> for
-     * similiar behavior. For example, to bind the <code>KeyStroke</code>
+     * similar behavior. For example, to bind the <code>KeyStroke</code>
      * <code>aKeyStroke</code> to the <code>Action</code> <code>anAction</code>
      * now use:
      * <pre>
@@ -2207,7 +2207,7 @@
     /**
      * This method is now obsolete, please use a combination of
      * <code>getActionMap()</code> and <code>getInputMap()</code> for
-     * similiar behavior.
+     * similar behavior.
      */
     public void registerKeyboardAction(ActionListener anAction,KeyStroke aKeyStroke,int aCondition) {
         registerKeyboardAction(anAction,null,aKeyStroke,aCondition);
@@ -5236,7 +5236,7 @@
      *
      * @return NOT_OBSCURED if non of the siblings above the Component obscure
      *         it, COMPLETELY_OBSCURED if one of the siblings completely
-     *         obscures the Component or PARTIALLY_OBSCURED if the Comonent is
+     *         obscures the Component or PARTIALLY_OBSCURED if the Component is
      *         only partially obscured.
      */
     private int getObscuredState(int compIndex, int x, int y, int width,
--- a/jdk/src/share/classes/javax/swing/JDialog.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JDialog.java	Wed Jul 05 19:21:26 2017 +0200
@@ -44,9 +44,10 @@
  * as its only child.
  * The {@code contentPane} should be the parent of any children of the
  * {@code JDialog}.
- * As a convenience {@code add} and its variants, {@code remove} and
- * {@code setLayout} have been overridden to forward to the
- * {@code contentPane} as necessary. This means you can write:
+ * As a convenience, the {@code add}, {@code remove}, and {@code setLayout}
+ * methods of this class are overridden, so that they delegate calls
+ * to the corresponding methods of the {@code ContentPane}.
+ * For example, you can add a child component to a dialog as follows:
  * <pre>
  *       dialog.add(child);
  * </pre>
@@ -862,7 +863,7 @@
      * {@code setLayout} are forwarded to the {@code contentPane}.
      *
      * @return true if {@code add} and {@code setLayout}
-     *         are fowarded; false otherwise
+     *         are forwarded; false otherwise
      *
      * @see #addImpl
      * @see #setLayout
@@ -1024,7 +1025,7 @@
      * This method is called by the constructor.
      * <p>
      * Swing's painting architecture requires an opaque {@code JComponent}
-     * in the containment hiearchy. This is typically provided by the
+     * in the containment hierarchy. This is typically provided by the
      * content pane. If you replace the content pane it is recommended you
      * replace it with an opaque {@code JComponent}.
      * @see JRootPane
--- a/jdk/src/share/classes/javax/swing/JFileChooser.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JFileChooser.java	Wed Jul 05 19:21:26 2017 +0200
@@ -134,7 +134,7 @@
     public static final int APPROVE_OPTION = 0;
 
     /**
-     * Return value if an error occured.
+     * Return value if an error occurred.
      */
     public static final int ERROR_OPTION = -1;
 
--- a/jdk/src/share/classes/javax/swing/JFormattedTextField.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JFormattedTextField.java	Wed Jul 05 19:21:26 2017 +0200
@@ -126,14 +126,14 @@
  * policy is <code>JFormattedTextField.PERSIST</code>
  * and the <code>JFormattedTextField</code> has been edited, the
  * <code>AbstractFormatterFactory</code> will not be queried until the
- * value has been commited. Similarly if the focus lost policy is
+ * value has been committed. Similarly if the focus lost policy is
  * <code>JFormattedTextField.COMMIT</code> and an exception
  * is thrown from <code>stringToValue</code>, the
- * <code>AbstractFormatterFactory</code> will not be querired when focus is
+ * <code>AbstractFormatterFactory</code> will not be queried when focus is
  * lost or gained.
  * <p>
  * <code>JFormattedTextField.AbstractFormatter</code>
- * is also responsible for determining when values are commited to
+ * is also responsible for determining when values are committed to
  * the <code>JFormattedTextField</code>. Some
  * <code>JFormattedTextField.AbstractFormatter</code>s will make new values
  * available on every edit, and others will never commit the value. You can
@@ -184,7 +184,7 @@
 
     /**
      * Constant identifying that when focus is lost,
-     * <code>commitEdit</code> should be invoked. If in commiting the
+     * <code>commitEdit</code> should be invoked. If in committing the
      * new value a <code>ParseException</code> is thrown, the invalid
      * value will remain.
      *
@@ -194,7 +194,7 @@
 
     /**
      * Constant identifying that when focus is lost,
-     * <code>commitEdit</code> should be invoked. If in commiting the new
+     * <code>commitEdit</code> should be invoked. If in committing the new
      * value a <code>ParseException</code> is thrown, the value will be
      * reverted.
      *
@@ -878,7 +878,7 @@
      * Instances of <code>AbstractFormatter</code> are used by
      * <code>JFormattedTextField</code> to handle the conversion both
      * from an Object to a String, and back from a String to an Object.
-     * <code>AbstractFormatter</code>s can also enfore editing policies,
+     * <code>AbstractFormatter</code>s can also enforce editing policies,
      * or navigation policies, or manipulate the
      * <code>JFormattedTextField</code> in any way it sees fit to
      * enforce the desired policy.
@@ -1116,7 +1116,7 @@
                     ((JFormattedTextField)target).commitEdit();
                 } catch (ParseException pe) {
                     ((JFormattedTextField)target).invalidEdit();
-                    // value not commited, don't notify ActionListeners
+                    // value not committed, don't notify ActionListeners
                     return;
                 }
             }
--- a/jdk/src/share/classes/javax/swing/JFrame.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JFrame.java	Wed Jul 05 19:21:26 2017 +0200
@@ -50,9 +50,10 @@
  * as a rule, contain
  * all the non-menu components displayed by the <code>JFrame</code>.
  * This is different from the AWT <code>Frame</code> case.
- * As a conveniance <code>add</code> and its variants, <code>remove</code> and
- * <code>setLayout</code> have been overridden to forward to the
- * <code>contentPane</code> as necessary. This means you can write:
+ * As a convenience, the {@code add}, {@code remove}, and {@code setLayout}
+ * methods of this class are overridden, so that they delegate calls
+ * to the corresponding methods of the {@code ContentPane}.
+ * For example, you can add a child component to a frame as follows:
  * <pre>
  *       frame.add(child);
  * </pre>
@@ -505,7 +506,7 @@
      * <code>setLayout</code> are forwarded to the <code>contentPane</code>.
      *
      * @return true if <code>add</code> and <code>setLayout</code>
-     *         are fowarded; false otherwise
+     *         are forwarded; false otherwise
      *
      * @see #addImpl
      * @see #setLayout
@@ -673,7 +674,7 @@
      * This method is called by the constructor.
      * <p>
      * Swing's painting architecture requires an opaque <code>JComponent</code>
-     * in the containment hiearchy. This is typically provided by the
+     * in the containment hierarchy. This is typically provided by the
      * content pane. If you replace the content pane it is recommended you
      * replace it with an opaque <code>JComponent</code>.
      *
--- a/jdk/src/share/classes/javax/swing/JInternalFrame.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JInternalFrame.java	Wed Jul 05 19:21:26 2017 +0200
@@ -63,9 +63,10 @@
  * <p>
  * The <code>JInternalFrame</code> content pane
  * is where you add child components.
- * As a conveniance <code>add</code> and its variants, <code>remove</code> and
- * <code>setLayout</code> have been overridden to forward to the
- * <code>contentPane</code> as necessary. This means you can write:
+ * As a convenience, the {@code add}, {@code remove}, and {@code setLayout}
+ * methods of this class are overridden, so that they delegate calls
+ * to the corresponding methods of the {@code ContentPane}.
+ * For example, you can add a child component to an internal frame as follows:
  * <pre>
  *       internalFrame.add(child);
  * </pre>
@@ -445,7 +446,7 @@
      * <code>setLayout</code> are forwarded to the <code>contentPane</code>.
      *
      * @return true if <code>add</code> and <code>setLayout</code>
-     *         are fowarded; false otherwise
+     *         are forwarded; false otherwise
      *
      * @see #addImpl
      * @see #setLayout
--- a/jdk/src/share/classes/javax/swing/JLabel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JLabel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1457,7 +1457,7 @@
          * If there is no selection, but there is
          * a caret, the start and end offsets will be the same.
          *
-         * @return the index into teh text of the end of the selection
+         * @return the index into the text of the end of the selection
          * @since 1.3
          */
         public int getSelectionEnd() {
--- a/jdk/src/share/classes/javax/swing/JLayeredPane.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JLayeredPane.java	Wed Jul 05 19:21:26 2017 +0200
@@ -168,7 +168,7 @@
     /** Convenience object defining the Drag layer. Equivalent to new Integer(400).*/
     public final static Integer DRAG_LAYER = new Integer(400);
     /** Convenience object defining the Frame Content layer.
-      * This layer is normally only use to positon the contentPane and menuBar
+      * This layer is normally only use to position the contentPane and menuBar
       * components of JFrame.
       * Equivalent to new Integer(-30000).
       * @see JFrame
@@ -648,7 +648,7 @@
     /**
      * This method is an extended version of insertIndexForLayer()
      * to support setLayer which uses Container.setZOrder which does
-     * not remove the component from the containment heirarchy though
+     * not remove the component from the containment hierarchy though
      * we need to ignore it when calculating the insertion index.
      *
      * @param comp      component to ignore when determining index
--- a/jdk/src/share/classes/javax/swing/JMenu.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JMenu.java	Wed Jul 05 19:21:26 2017 +0200
@@ -495,7 +495,7 @@
      * In most cases, the delay is not observed for top level menus
      * or while dragging.  The default for <code>delay</code> is 0.
      * This method is a property of the look and feel code and is used
-     * to manage the idiosyncracies of the various UI implementations.
+     * to manage the idiosyncrasies of the various UI implementations.
      *
      *
      * @return the <code>delay</code> property
@@ -510,7 +510,7 @@
      * it's own policy for observing the delay property.  In most cases,
      * the delay is not observed for top level menus or while dragging.
      * This method is a property of the look and feel code and is used
-     * to manage the idiosyncracies of the various UI implementations.
+     * to manage the idiosyncrasies of the various UI implementations.
      *
      * @param       d the number of milliseconds to delay
      * @exception   IllegalArgumentException if <code>d</code>
--- a/jdk/src/share/classes/javax/swing/JPasswordField.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JPasswordField.java	Wed Jul 05 19:21:26 2017 +0200
@@ -348,7 +348,7 @@
 
     /**
      * This method is a hack to get around the fact that we cannot
-     * directly override setUIProperty because part of the inheritance heirarchy
+     * directly override setUIProperty because part of the inheritance hierarchy
      * goes outside of the javax.swing package, and therefore calling a package
      * private method isn't allowed. This method should return true if the property
      * was handled, and false otherwise.
--- a/jdk/src/share/classes/javax/swing/JPopupMenu.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1104,7 +1104,7 @@
 
     /**
      * Returns the margin, in pixels, between the popup menu's border and
-     * its containees.
+     * its containers.
      *
      * @return an <code>Insets</code> object containing the margin values.
      */
--- a/jdk/src/share/classes/javax/swing/JRootPane.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JRootPane.java	Wed Jul 05 19:21:26 2017 +0200
@@ -161,7 +161,7 @@
  * <p>
  * The painting architecture of Swing requires an opaque
  * <code>JComponent</code>
- * to exist in the containment hieararchy above all other components. This is
+ * to exist in the containment hierarchy above all other components. This is
  * typically provided by way of the content pane. If you replace the content
  * pane, it is recommended that you make the content pane opaque
  * by way of <code>setOpaque(true)</code>. Additionally, if the content pane
@@ -608,7 +608,7 @@
      * parented by the root pane.
      * <p>
      * Swing's painting architecture requires an opaque <code>JComponent</code>
-     * in the containment hiearchy. This is typically provided by the
+     * in the containment hierarchy. This is typically provided by the
      * content pane. If you replace the content pane it is recommended you
      * replace it with an opaque <code>JComponent</code>.
      *
@@ -741,7 +741,7 @@
      * On the other hand, the <code>glassPane</code>
      * is normally not visible, and so this can return true if the
      * <code>glassPane</code> isn't visible. Therefore, the
-     * return value here depends upon the visiblity of the
+     * return value here depends upon the visibility of the
      * <code>glassPane</code>.
      *
      * @return true if this component's children don't overlap
--- a/jdk/src/share/classes/javax/swing/JSlider.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JSlider.java	Wed Jul 05 19:21:26 2017 +0200
@@ -662,7 +662,7 @@
 
     /**
      * Returns the "extent" from the <code>BoundedRangeModel</code>.
-     * This respresents the range of values "covered" by the knob.
+     * This represents the range of values "covered" by the knob.
      *
      * @return an int representing the extent
      * @see #setExtent
--- a/jdk/src/share/classes/javax/swing/JSpinner.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JSpinner.java	Wed Jul 05 19:21:26 2017 +0200
@@ -545,7 +545,7 @@
      * call if forwarded to the editor, otherwise this does nothing.
      *
      * @throws ParseException if the currently edited value couldn't
-     *         be commited.
+     *         be committed.
      */
     public void commitEdit() throws ParseException {
         JComponent editor = getEditor();
@@ -1462,7 +1462,7 @@
          * a set of predefined roles.  This enables assistive technologies to
          * provide a consistent interface to various tweaked subclasses of
          * components (e.g., use AccessibleRole.PUSH_BUTTON for all components
-         * that act like a push button) as well as distinguish between sublasses
+         * that act like a push button) as well as distinguish between subclasses
          * that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes
          * and AccessibleRole.RADIO_BUTTON for radio buttons).
          * <p>Note that the AccessibleRole class is also extensible, so
@@ -1889,7 +1889,7 @@
          * If there is no selection, but there is
          * a caret, the start and end offsets will be the same.
          *
-         * @return the index into teh text of the end of the selection
+         * @return the index into the text of the end of the selection
          */
         public int getSelectionEnd() {
             AccessibleText at = getEditorAccessibleText();
--- a/jdk/src/share/classes/javax/swing/JSplitPane.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JSplitPane.java	Wed Jul 05 19:21:26 2017 +0200
@@ -828,7 +828,7 @@
      * Returns the last value passed to <code>setDividerLocation</code>.
      * The value returned from this method may differ from the actual
      * divider location (if <code>setDividerLocation</code> was passed a
-     * value bigger than the curent size).
+     * value bigger than the current size).
      *
      * @return an integer specifying the location of the divider
      */
--- a/jdk/src/share/classes/javax/swing/JTable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JTable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -2991,7 +2991,7 @@
 
     /**
      * Causes this table to lay out its rows and columns.  Overridden so
-     * that columns can be resized to accomodate a change in the size of
+     * that columns can be resized to accommodate a change in the size of
      * a containing parent.
      * Resizes one or more of the columns in the table
      * so that the total width of all of this <code>JTable</code>'s
@@ -3014,7 +3014,7 @@
      * The modes are:
      * <ul>
      * <li>  AUTO_RESIZE_OFF: Don't automatically adjust the column's
-     * widths at all. Use a horizontal scrollbar to accomodate the
+     * widths at all. Use a horizontal scrollbar to accommodate the
      * columns when their sum exceeds the width of the
      * <code>Viewport</code>.  If the <code>JTable</code> is not
      * enclosed in a <code>JScrollPane</code> this may
@@ -3104,7 +3104,7 @@
      * <P>
      * The overall effect is that the total size moves that same percentage,
      * k, towards the total minimum or maximum and that percentage guarantees
-     * accomodation of the required space, DELTA.
+     * accommodation of the required space, DELTA.
      *
      * <H4>Details</H4>
      * <P>
--- a/jdk/src/share/classes/javax/swing/JViewport.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JViewport.java	Wed Jul 05 19:21:26 2017 +0200
@@ -463,7 +463,7 @@
                     // and paint is received another repaint is queued
                     // indicating part of the view is invalid. There
                     // is no way for JViewport to notice another
-                    // repaint has occured and it ends up blitting
+                    // repaint has occurred and it ends up blitting
                     // what is now a dirty region and the repaint is
                     // never delivered.
                     // It just so happens JTable encounters this
@@ -585,7 +585,7 @@
      * Returns the insets (border) dimensions as (0,0,0,0), since borders
      * are not supported on a <code>JViewport</code>.
      *
-     * @return a <code>Rectange</code> of zero dimension and zero origin
+     * @return a <code>Rectangle</code> of zero dimension and zero origin
      * @see #setBorder
      */
     public final Insets getInsets() {
--- a/jdk/src/share/classes/javax/swing/JWindow.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/JWindow.java	Wed Jul 05 19:21:26 2017 +0200
@@ -43,9 +43,10 @@
  * The <code>JWindow</code> component contains a <code>JRootPane</code>
  * as its only child.  The <code>contentPane</code> should be the parent
  * of any children of the <code>JWindow</code>.
- * As a conveniance <code>add</code> and its variants, <code>remove</code> and
- * <code>setLayout</code> have been overridden to forward to the
- * <code>contentPane</code> as necessary. This means you can write:
+ * As a convenience, the {@code add}, {@code remove}, and {@code setLayout}
+ * methods of this class are overridden, so that they delegate calls
+ * to the corresponding methods of the {@code ContentPane}.
+ * For example, you can add a child component to a window as follows:
  * <pre>
  *       window.add(child);
  * </pre>
@@ -286,7 +287,7 @@
      * <code>setLayout</code> are forwarded to the <code>contentPane</code>.
      *
      * @return true if <code>add</code> and <code>setLayout</code>
-     *         are fowarded; false otherwise
+     *         are forwarded; false otherwise
      *
      * @see #addImpl
      * @see #setLayout
--- a/jdk/src/share/classes/javax/swing/LookAndFeel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/LookAndFeel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -74,7 +74,7 @@
  * BasicLookAndFeel} providing the key-value pair {@code
  * "TreeUI"-"javax.swing.plaf.basic.BasicTreeUI"}, in the
  * {@code UIDefaults} returned from {@code getDefaults}. Refer to
- * {@link UIDefaults#getUI(JComponent)} for defails on how the implementation
+ * {@link UIDefaults#getUI(JComponent)} for details on how the implementation
  * of the {@code ComponentUI} subclass is obtained.
  * <p>
  * When a {@code LookAndFeel} is installed the {@code UIManager} does
@@ -114,7 +114,7 @@
  * <p>
  * For primitive values, such as {@code opaque}, the method {@code
  * installProperty} should be invoked.  {@code installProperty} only changes
- * the correspoding property if the value has not been changed by the
+ * the corresponding property if the value has not been changed by the
  * developer.
  * <p>
  * {@code ComponentUI} implementations should use the various install methods
@@ -269,7 +269,7 @@
      */
     public static void installProperty(JComponent c,
                                        String propertyName, Object propertyValue) {
-        // this is a special case because the JPasswordField's ancestor heirarchy
+        // this is a special case because the JPasswordField's ancestor hierarchy
         // includes a class outside of javax.swing, thus we cannot call setUIProperty
         // directly.
         if (SunToolkit.isInstanceOf(c, "javax.swing.JPasswordField")) {
--- a/jdk/src/share/classes/javax/swing/ProgressMonitor.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/ProgressMonitor.java	Wed Jul 05 19:21:26 2017 +0200
@@ -650,7 +650,7 @@
          * a set of predefined roles.  This enables assistive technologies to
          * provide a consistent interface to various tweaked subclasses of
          * components (e.g., use AccessibleRole.PUSH_BUTTON for all components
-         * that act like a push button) as well as distinguish between sublasses
+         * that act like a push button) as well as distinguish between subclasses
          * that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes
          * and AccessibleRole.RADIO_BUTTON for radio buttons).
          * <p>Note that the AccessibleRole class is also extensible, so
@@ -1017,7 +1017,7 @@
          * If there is no selection, but there is
          * a caret, the start and end offsets will be the same.
          *
-         * @return the index into teh text of the end of the selection
+         * @return the index into the text of the end of the selection
          */
         public int getSelectionEnd() {
             AccessibleText at = getNoteLabelAccessibleText();
--- a/jdk/src/share/classes/javax/swing/RepaintManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/RepaintManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -698,7 +698,7 @@
 
     /**
      * This is invoked to process paint requests.  It's needed
-     * for backward compatability in so far as RepaintManager would previously
+     * for backward compatibility in so far as RepaintManager would previously
      * not see paint requests for top levels, so, we have to make sure
      * a subclass correctly paints any dirty top levels.
      */
--- a/jdk/src/share/classes/javax/swing/RootPaneContainer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/RootPaneContainer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -45,18 +45,18 @@
  * dropping a component on a RootPaneContainer would be interpreted
  * as <code>frame.getContentPane().add(child)</code>.
  * <p>
- * For conveniance
- * <code>JFrame</code>, <code>JDialog</code>, <code>JWindow</code>,
- * <code>JApplet</code> and <code>JInternalFrame</code>, by default,
- * forward, by default, all calls to the <code>add</code>,
- * <code>remove</code> and <code>setLayout</code> methods, to the
- * <code>contentPane</code>. This means you can call:
+ * As a convenience, the standard classes that implement this interface
+ * (such as {@code JFrame}, {@code JDialog}, {@code JWindow}, {@code JApplet},
+ * and {@code JInternalFrame}) have their {@code add}, {@code remove},
+ * and {@code setLayout} methods overridden, so that they delegate calls
+ * to the corresponding methods of the {@code ContentPane}.
+ * For example, you can add a child component to a frame as follows:
  * <pre>
- * rootPaneContainer.add(component);
+ *       frame.add(child);
  * </pre>
  * instead of:
  * <pre>
- * rootPaneContainer.getContentPane().add(component);
+ *       frame.getContentPane().add(child);
  * </pre>
  * <p>
  * The behavior of the <code>add</code> and
--- a/jdk/src/share/classes/javax/swing/ScrollPaneConstants.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/ScrollPaneConstants.java	Wed Jul 05 19:21:26 2017 +0200
@@ -40,7 +40,7 @@
     String VIEWPORT = "VIEWPORT";
     /** Identifies a vertical scrollbar. */
     String VERTICAL_SCROLLBAR = "VERTICAL_SCROLLBAR";
-    /** Identifies a horizonal scrollbar. */
+    /** Identifies a horizontal scrollbar. */
     String HORIZONTAL_SCROLLBAR = "HORIZONTAL_SCROLLBAR";
     /**
      * Identifies the area along the left side of the viewport between the
--- a/jdk/src/share/classes/javax/swing/SpinnerDateModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/SpinnerDateModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -67,7 +67,7 @@
  *   <li><code>Calendar.SECOND</code>
  *   <li><code>Calendar.MILLISECOND</code>
  * </ul>
- * However some UIs may set the calendarField before commiting the edit
+ * However some UIs may set the calendarField before committing the edit
  * to spin the field under the cursor. If you only want one field to
  * spin you can subclass and ignore the setCalendarField calls.
  * <p>
@@ -133,7 +133,7 @@
      * upper or lower bound.  If <code>value</code> or
      * <code>calendarField</code> is <code>null</code>, or if both
      * <code>start</code> and <code>end</code> are specified and
-     * <code>mininum &gt; maximum</code> then an
+     * <code>minimum &gt; maximum</code> then an
      * <code>IllegalArgumentException</code> is thrown.
      * Similarly if <code>(minimum &lt;= value &lt;= maximum)</code> is false,
      * an IllegalArgumentException is thrown.
@@ -310,7 +310,7 @@
      * simply move the specified <code>Calendar</code> field forward or backward
      * by one unit with the <code>Calendar.add</code> method.
      * You should use this method with care as some UIs may set the
-     * calendarField before commiting the edit to spin the field under
+     * calendarField before committing the edit to spin the field under
      * the cursor. If you only want one field to spin you can subclass
      * and ignore the setCalendarField calls.
      *
--- a/jdk/src/share/classes/javax/swing/SpinnerModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/SpinnerModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -33,7 +33,7 @@
  * A model for a potentially unbounded sequence of object values.  This model
  * is similar to <code>ListModel</code> however there are some important differences:
  * <ul>
- * <li> The number of sequence elements isn't neccessarily bounded.
+ * <li> The number of sequence elements isn't necessarily bounded.
  * <li> The model doesn't support indexed random access to sequence elements.
  *      Only three sequence values are accessible at a time: current, next and
  *      previous.
@@ -50,7 +50,7 @@
  *     last element of the sequence.
  *
  *   <dt><code>previousValue</code>
- *   <dd>The preceeding element or null if <code>value</code> is the
+ *   <dd>The preceding element or null if <code>value</code> is the
  *     first element of the sequence.
  * </dl>
  * When the the <code>value</code> property changes,
--- a/jdk/src/share/classes/javax/swing/SpinnerNumberModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/SpinnerNumberModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -102,7 +102,7 @@
      * have an upper or lower bound.
      * If <code>value</code> or <code>stepSize</code> is <code>null</code>,
      * or if both <code>minimum</code> and <code>maximum</code>
-     * are specified and <code>mininum &gt; maximum</code> then an
+     * are specified and <code>minimum &gt; maximum</code> then an
      * <code>IllegalArgumentException</code> is thrown.
      * Similarly if <code>(minimum &lt;= value &lt;= maximum</code>) is false,
      * an <code>IllegalArgumentException</code> is thrown.
--- a/jdk/src/share/classes/javax/swing/SpringLayout.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/SpringLayout.java	Wed Jul 05 19:21:26 2017 +0200
@@ -286,7 +286,7 @@
      * as EAST - WIDTH.
      * <p>
      * [RELATIVE_BASELINE is a private constraint that is set automatically when
-     * the SpringLayout.Constraints(Component) constuctor is called or when
+     * the SpringLayout.Constraints(Component) constructor is called or when
      * a constraints object is registered with a SpringLayout object.]
      * <p>
      * <b>Note</b>: In this document,
@@ -1167,7 +1167,7 @@
      * method, instead of returning the current binding for the
      * edge, returns a proxy that tracks the characteristics
      * of the edge even if the edge is subsequently rebound.
-     * Proxies are intended to be used in builder envonments
+     * Proxies are intended to be used in builder environments
      * where it is useful to allow the user to define the
      * constraints for a layout in any order. Proxies do, however,
      * provide the means to create cyclic dependencies amongst
--- a/jdk/src/share/classes/javax/swing/SwingUtilities.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/SwingUtilities.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1337,7 +1337,7 @@
      * <code>java.awt.EventQueue.invokeAndWait()</code>.
      *
      * @exception  InterruptedException if we're interrupted while waiting for
-     *             the event dispatching thread to finish excecuting
+     *             the event dispatching thread to finish executing
      *             <code>doRun.run()</code>
      * @exception  InvocationTargetException  if an exception is thrown
      *             while running <code>doRun</code>
--- a/jdk/src/share/classes/javax/swing/ToolTipManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/ToolTipManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -37,7 +37,7 @@
  * hide. Consider a component that has a different tooltip based on where
  * the mouse is, such as JTree. When the mouse moves into the JTree and
  * over a region that has a valid tooltip, the tooltip will become
- * visibile after <code>initialDelay</code> milliseconds. After
+ * visible after <code>initialDelay</code> milliseconds. After
  * <code>dismissDelay</code> milliseconds the tooltip will be hidden. If
  * the mouse is over a region that has a valid tooltip, and the tooltip
  * is currently visible, when the mouse moves to a region that doesn't have
--- a/jdk/src/share/classes/javax/swing/TransferHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/TransferHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -759,7 +759,7 @@
      * returns. Should the clipboard be unavailable when attempting to place
      * data on it, the <code>IllegalStateException</code> thrown by
      * {@link Clipboard#setContents(Transferable, ClipboardOwner)} will
-     * be propogated through this method. However,
+     * be propagated through this method. However,
      * <code>exportDone</code> will first be called with an action
      * of <code>NONE</code> for consistency.
      *
--- a/jdk/src/share/classes/javax/swing/UIManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/UIManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -126,7 +126,7 @@
  *       current look and feel ({@code setLookAndFeel()} is invoked). The
  *       look and feel defaults can be obtained using the {@code
  *       getLookAndFeelDefaults()} method.
- *   <li>Sytem defaults. The system defaults are provided by Swing.
+ *   <li>System defaults. The system defaults are provided by Swing.
  * </ol>
  * Invoking any of the various {@code get} methods
  * results in checking each of the defaults, in order, returning
@@ -152,7 +152,7 @@
  * and documented by that look and feel. In addition, each look and
  * feel, or {@code ComponentUI} provided by a look and feel, may
  * access the defaults at different times in their life cycle. Some
- * look and feels may agressively look up defaults, so that changing a
+ * look and feels may aggressively look up defaults, so that changing a
  * default may not have an effect after installing the look and feel.
  * Other look and feels may lazily access defaults so that a change to
  * the defaults may effect an existing look and feel. Finally, other look
@@ -313,7 +313,7 @@
          *
          * @param name      a <code>String</code> specifying the name of
          *                      the look and feel
-         * @param className a <code>String</code> specifiying the name of
+         * @param className a <code>String</code> specifying the name of
          *                      the class that implements the look and feel
          */
         public LookAndFeelInfo(String name, String className) {
--- a/jdk/src/share/classes/javax/swing/border/TitledBorder.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/border/TitledBorder.java	Wed Jul 05 19:21:26 2017 +0200
@@ -45,7 +45,7 @@
  * specified position and justification.
  * <p>
  * If the border, font, or color property values are not
- * specified in the constuctor or by invoking the appropriate
+ * specified in the constructor or by invoking the appropriate
  * set methods, the property values will be defined by the current
  * look and feel, using the following property names in the
  * Defaults Table:
--- a/jdk/src/share/classes/javax/swing/border/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/border/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 <body bgcolor="white">
 
--- a/jdk/src/share/classes/javax/swing/colorchooser/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/colorchooser/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,6 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
+<title></title>
 </head>
 <body bgcolor="white">
 
--- a/jdk/src/share/classes/javax/swing/event/DocumentEvent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/event/DocumentEvent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -79,7 +79,7 @@
      * This method is for observers to discover the structural
      * changes that were made.  This means that only elements
      * that existed prior to the mutation (and still exist after
-     * the mutatino) need to have ElementChange records.
+     * the mutation) need to have ElementChange records.
      * The changes made available need not be recursive.
      * <p>
      * For example, if the an element is removed from it's
--- a/jdk/src/share/classes/javax/swing/event/HyperlinkEvent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/event/HyperlinkEvent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -158,7 +158,7 @@
     /**
      * Returns the <code>Element</code> that corresponds to the source of the
      * event. This will typically be an <code>Element</code> representing
-     * an anchor. If a constructur that is used that does not specify a source
+     * an anchor. If a constructor that is used that does not specify a source
      * <code>Element</code>, or null was specified as the source
      * <code>Element</code>, this will return null.
      *
--- a/jdk/src/share/classes/javax/swing/event/TableModelEvent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/event/TableModelEvent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -67,7 +67,7 @@
  */
 public class TableModelEvent extends java.util.EventObject
 {
-    /** Identifies the addtion of new rows or columns. */
+    /** Identifies the addition of new rows or columns. */
     public static final int INSERT =  1;
     /** Identifies a change to existing data. */
     public static final int UPDATE =  0;
--- a/jdk/src/share/classes/javax/swing/event/TreeModelEvent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/event/TreeModelEvent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -89,7 +89,7 @@
      * before the deletes have occurred. Since the indexes must be specified in
      * order, the most natural processing methodology is to use a delete-counter.
      * Start by initializing the counter to zero and start work through the
-     * list from lowest to higest. Every time you do a delete, add the current
+     * list from lowest to highest. Every time you do a delete, add the current
      * value of the delete-counter to the index-position where the delete occurred,
      * and append the result to a Vector of delete-locations, using
      * <code>addElement()</code>. Then increment the delete-counter. The index
--- a/jdk/src/share/classes/javax/swing/event/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/event/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 <body bgcolor="white">
 
--- a/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -122,7 +122,7 @@
     }
 
     /**
-     * Determines if the given file is a root in the navigatable tree(s).
+     * Determines if the given file is a root in the navigable tree(s).
      * Examples: Windows 98 has one root, the Desktop folder. DOS has one root
      * per drive letter, <code>C:\</code>, <code>D:\</code>, etc. Unix has one root,
      * the <code>"/"</code> directory.
@@ -130,7 +130,7 @@
      * The default implementation gets information from the <code>ShellFolder</code> class.
      *
      * @param f a <code>File</code> object representing a directory
-     * @return <code>true</code> if <code>f</code> is a root in the navigatable tree.
+     * @return <code>true</code> if <code>f</code> is a root in the navigable tree.
      * @see #isFileSystemRoot
      */
     public boolean isRoot(File f) {
@@ -201,7 +201,7 @@
     /**
      * Type description for a file, directory, or folder as it would be displayed in
      * a system file browser. Example from Windows: the "Desktop" folder
-     * is desribed as "Desktop".
+     * is described as "Desktop".
      *
      * Override for platforms with native ShellFolder implementations.
      *
@@ -254,7 +254,7 @@
      * parent directory in the filesystem. Folder could for example be the
      * "Desktop" folder which is not the same as file.getParentFile().
      *
-     * @param folder a <code>File</code> object repesenting a directory or special folder
+     * @param folder a <code>File</code> object representing a directory or special folder
      * @param file a <code>File</code> object
      * @return <code>true</code> if <code>folder</code> is a directory or special folder and contains <code>file</code>.
      * @since 1.4
@@ -281,7 +281,7 @@
 
     /**
      *
-     * @param parent a <code>File</code> object repesenting a directory or special folder
+     * @param parent a <code>File</code> object representing a directory or special folder
      * @param fileName a name of a file or folder which exists in <code>parent</code>
      * @return a File object. This is normally constructed with <code>new
      * File(parent, fileName)</code> except when parent and child are both
@@ -698,7 +698,7 @@
     /**
      * Type description for a file, directory, or folder as it would be displayed in
      * a system file browser. Example from Windows: the "Desktop" folder
-     * is desribed as "Desktop".
+     * is described as "Desktop".
      *
      * The Windows implementation gets information from the ShellFolder class.
      */
--- a/jdk/src/share/classes/javax/swing/filechooser/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/filechooser/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 
 <body bgcolor="white">
--- a/jdk/src/share/classes/javax/swing/plaf/ComboBoxUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/ComboBoxUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -36,7 +36,7 @@
 public abstract class ComboBoxUI extends ComponentUI {
 
     /**
-     * Set the visiblity of the popup
+     * Set the visibility of the popup
      */
     public abstract void setPopupVisible( JComboBox c, boolean v );
 
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java	Wed Jul 05 19:21:26 2017 +0200
@@ -497,7 +497,7 @@
 
 
     /**
-     * Draws the border around the splitpane. To work correctly you shoudl
+     * Draws the border around the splitpane. To work correctly you should
      * also install a border on the divider (property SplitPaneDivider.border).
      */
     public static class SplitPaneBorder implements Border, UIResource {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -41,7 +41,7 @@
 /**
  * Basic UI implementation for JComboBox.
  * <p>
- * The combo box is a compound component which means that it is an agregate of
+ * The combo box is a compound component which means that it is an aggregate of
  * many simpler components. This class creates and manages the listeners
  * on the combo box and the combo box model. These listeners update the user
  * interface in response to changes in the properties and state of the combo box.
@@ -705,7 +705,7 @@
     }
 
     /**
-     * The aggregate components which compise the combo box are
+     * The aggregate components which comprise the combo box are
      * unregistered and uninitialized. This method is called as part of the
      * UI uninstallation process.
      */
@@ -911,7 +911,7 @@
     }
 
     /**
-     * The minumum size is the size of the display area plus insets plus the button.
+     * The minimum size is the size of the display area plus insets plus the button.
      */
     @Override
     public Dimension getMinimumSize( JComponent c ) {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -456,7 +456,7 @@
 
         public void mouseClicked(MouseEvent evt) {
             // Note: we can't depend on evt.getSource() because of backward
-            // compatability
+            // compatibility
             if (list != null &&
                 SwingUtilities.isLeftMouseButton(evt) &&
                 (evt.getClickCount()%2 == 0)) {
@@ -565,7 +565,7 @@
     }
 
     protected class DoubleClickListener extends MouseAdapter {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -591,7 +591,7 @@
     }
 
     protected class SelectionListener implements ListSelectionListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java	Wed Jul 05 19:21:26 2017 +0200
@@ -270,18 +270,27 @@
 
     protected void addSystemMenuItems(JMenu systemMenu) {
         JMenuItem mi = systemMenu.add(restoreAction);
-        mi.setMnemonic('R');
+        mi.setMnemonic(getButtonMnemonic("restore"));
         mi = systemMenu.add(moveAction);
-        mi.setMnemonic('M');
+        mi.setMnemonic(getButtonMnemonic("move"));
         mi = systemMenu.add(sizeAction);
-        mi.setMnemonic('S');
+        mi.setMnemonic(getButtonMnemonic("size"));
         mi = systemMenu.add(iconifyAction);
-        mi.setMnemonic('n');
+        mi.setMnemonic(getButtonMnemonic("minimize"));
         mi = systemMenu.add(maximizeAction);
-        mi.setMnemonic('x');
+        mi.setMnemonic(getButtonMnemonic("maximize"));
         systemMenu.add(new JSeparator());
         mi = systemMenu.add(closeAction);
-        mi.setMnemonic('C');
+        mi.setMnemonic(getButtonMnemonic("close"));
+    }
+
+    private static int getButtonMnemonic(String button) {
+        try {
+            return Integer.parseInt(UIManager.getString(
+                    "InternalFrameTitlePane." + button + "Button.mnemonic"));
+        } catch (NumberFormatException e) {
+            return -1;
+        }
     }
 
     protected JMenu createSystemMenu() {
@@ -556,7 +565,7 @@
      * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class PropertyChangeHandler implements PropertyChangeListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -570,7 +579,7 @@
      * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class TitlePaneLayout implements LayoutManager {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -477,7 +477,7 @@
 
     public class InternalFramePropertyChangeListener implements
         PropertyChangeListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -491,7 +491,7 @@
     }
 
   public class InternalFrameLayout implements LayoutManager {
-    // NOTE: This class exists only for backward compatability. All
+    // NOTE: This class exists only for backward compatibility. All
     // its functionality has been moved into Handler. If you need to add
     // new functionality add it to the Handler, but make sure this
     // class calls into the Handler.
@@ -1093,7 +1093,7 @@
     }    /// End BorderListener Class
 
     protected class ComponentHandler implements ComponentListener {
-      // NOTE: This class exists only for backward compatability. All
+      // NOTE: This class exists only for backward compatibility. All
       // its functionality has been moved into Handler. If you need to add
       // new functionality add it to the Handler, but make sure this
       // class calls into the Handler.
@@ -1119,7 +1119,7 @@
 
 
     protected class GlassPaneDispatcher implements MouseInputListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -1159,7 +1159,7 @@
 
     protected class BasicInternalFrameListener implements InternalFrameListener
     {
-      // NOTE: This class exists only for backward compatability. All
+      // NOTE: This class exists only for backward compatibility. All
       // its functionality has been moved into Handler. If you need to add
       // new functionality add it to the Handler, but make sure this
       // class calls into the Handler.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -433,7 +433,7 @@
      * used for getting localized defaults.  Also initialize the default
      * locale used when no locale is passed into UIDefaults.get().  The
      * default locale should generally not be relied upon. It is here for
-     * compatability with releases prior to 1.4.
+     * compatibility with releases prior to 1.4.
      */
     private void initResourceBundle(UIDefaults table) {
         table.setDefaultLocale( Locale.getDefault() );
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -760,7 +760,7 @@
             Thread.dumpStack();
     }
     protected class MouseInputHandler implements MouseInputListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -322,7 +322,7 @@
      * @since 1.4
      */
     protected class MouseInputHandler implements MouseInputListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -923,7 +923,7 @@
         private boolean reverseButtons;
         /**
          * Indicates whether or not centersChildren should be used vs
-         * the orientation. This is done for backward compatability
+         * the orientation. This is done for backward compatibility
          * for subclassers.
          */
         private boolean useOrientation;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -335,7 +335,7 @@
 
     /**
      * Returns the width (if HORIZONTAL) or height (if VERTICAL)
-     * of each of the indivdual cells/units to be rendered in the
+     * of each of the individual cells/units to be rendered in the
      * progress bar. However, for text rendering simplification and
      * aesthetic considerations, this function will return 1 when
      * the progress string is being rendered.
@@ -1215,7 +1215,7 @@
      * Instantiate it only within subclasses of {@code BasicProgressBarUI}.
      */
     public class ChangeHandler implements ChangeListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1489,7 +1489,7 @@
 
     public class PropertyChangeHandler implements PropertyChangeListener
     {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -443,7 +443,7 @@
     public class ViewportChangeHandler implements ChangeListener
     {
 
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -464,7 +464,7 @@
     public class HSBChangeListener implements ChangeListener
     {
 
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -494,7 +494,7 @@
     public class VSBChangeListener implements ChangeListener
     {
 
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -534,7 +534,7 @@
      */
     protected class MouseWheelHandler implements MouseWheelListener {
 
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -665,7 +665,7 @@
     public class PropertyChangeHandler implements PropertyChangeListener
     {
 
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -743,7 +743,7 @@
     }
 
     public class PropertyChangeHandler implements PropertyChangeListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -1545,7 +1545,7 @@
      * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class ChangeHandler implements ChangeListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -1852,7 +1852,7 @@
      * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class ComponentHandler extends ComponentAdapter {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -1868,7 +1868,7 @@
      * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class FocusHandler implements FocusListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -1895,7 +1895,7 @@
      * Instantiate it only within subclasses of <code>Foo</code>.
      */
     public class ActionScroller extends AbstractAction {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Actions. If you need to add
         // new functionality add it to the Actions, but make sure this
         // class calls into the Actions.
@@ -1928,7 +1928,7 @@
      * A static version of the above.
      */
     static class SharedActionScroller extends AbstractAction {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Actions. If you need to add
         // new functionality add it to the Actions, but make sure this
         // class calls into the Actions.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -273,7 +273,7 @@
     private Color dividerDraggingColor;
     private boolean rememberPaneSizes;
 
-    // Indicates wether the one of splitpane sides is expanded
+    // Indicates whether the one of splitpane sides is expanded
     private boolean keepHidden = false;
 
     /** Indicates that we have painted once. */
@@ -637,7 +637,7 @@
 
 
     /**
-     * Determines wether the JSplitPane is set to use a continuous layout.
+     * Determines whether the JSplitPane is set to use a continuous layout.
      */
     public boolean isContinuousLayout() {
         return continuousLayout;
@@ -683,7 +683,7 @@
      */
     public class PropertyHandler implements PropertyChangeListener
     {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -707,7 +707,7 @@
      */
     public class FocusHandler extends FocusAdapter
     {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -1073,7 +1073,7 @@
 
     /**
      * Returns the preferred size for the passed in component,
-     * This is passed off to the current layoutmanager.
+     * This is passed off to the current layout manager.
      */
     public Dimension getPreferredSize(JComponent jc) {
         if(splitPane != null)
@@ -1084,7 +1084,7 @@
 
     /**
      * Returns the minimum size for the passed in component,
-     * This is passed off to the current layoutmanager.
+     * This is passed off to the current layout manager.
      */
     public Dimension getMinimumSize(JComponent jc) {
         if(splitPane != null)
@@ -1095,7 +1095,7 @@
 
     /**
      * Returns the maximum size for the passed in component,
-     * This is passed off to the current layoutmanager.
+     * This is passed off to the current layout manager.
      */
     public Dimension getMaximumSize(JComponent jc) {
         if(splitPane != null)
@@ -1438,8 +1438,8 @@
 
         /**
          * Returns the minimum size needed to contain the children.
-         * The width is the sum of all the childrens min widths and
-         * the height is the largest of the childrens minimum heights.
+         * The width is the sum of all the children's min widths and
+         * the height is the largest of the children's minimum heights.
          */
         public Dimension minimumLayoutSize(Container container) {
             int         minPrimary = 0;
@@ -1471,8 +1471,8 @@
 
         /**
          * Returns the preferred size needed to contain the children.
-         * The width is the sum of all the childrens preferred widths and
-         * the height is the largest of the childrens preferred heights.
+         * The width is the sum of all the preferred widths of the children and
+         * the height is the largest preferred height of the children.
          */
         public Dimension preferredLayoutSize(Container container) {
             int         prePrimary = 0;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -3748,7 +3748,7 @@
      * Instantiate it only within subclasses of BasicTabbedPaneUI.
      */
     public class PropertyChangeHandler implements PropertyChangeListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -3762,7 +3762,7 @@
      * Instantiate it only within subclasses of BasicTabbedPaneUI.
      */
     public class TabSelectionHandler implements ChangeListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -3776,7 +3776,7 @@
      * Instantiate it only within subclasses of BasicTabbedPaneUI.
      */
     public class MouseHandler extends MouseAdapter {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -3790,7 +3790,7 @@
      * Instantiate it only within subclasses of BasicTabbedPaneUI.
      */
     public class FocusHandler extends FocusAdapter {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -738,7 +738,7 @@
      * the current <code>TableCellEditor</code>.
      */
      public class KeyHandler implements KeyListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -764,7 +764,7 @@
      * Instantiate it only within subclasses of {@code BasicTableUI}.
      */
     public class FocusHandler implements FocusListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -786,7 +786,7 @@
      * Instantiate it only within subclasses of BasicTableUI.
      */
     public class MouseInputHandler implements MouseInputListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1560,6 +1560,10 @@
          * location that one might place a caret.  Some views may not be visible,
          * they might not be in the same order found in the model, or they just
          * might not allow access to some of the locations in the model.
+         * This method enables specifying a position to convert
+         * within the range of &gt;=0.  If the value is -1, a position
+         * will be calculated automatically.  If the value &lt; -1,
+         * the {@code BadLocationException} will be thrown.
          *
          * @param pos the position to convert &gt;= 0
          * @param a the allocated region to render into
@@ -1569,13 +1573,17 @@
          *  SwingConstants.NORTH, or SwingConstants.SOUTH.
          * @return the location within the model that best represents the next
          *  location visual position.
-         * @exception BadLocationException
+         * @exception BadLocationException the given position is not a valid
+         *                                 position within the document
          * @exception IllegalArgumentException for an invalid direction
          */
         public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
                                              int direction,
                                              Position.Bias[] biasRet)
             throws BadLocationException {
+            if (pos < -1) {
+                throw new BadLocationException("invalid position", pos);
+            }
             if( view != null ) {
                 int nextPos = view.getNextVisualPositionFrom(pos, b, a,
                                                      direction, biasRet);
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -583,7 +583,7 @@
 
     /**
      * Sets the flag for enabling rollover borders on the toolbar and it will
-     * also install the apropriate border depending on the state of the flag.
+     * also install the appropriate border depending on the state of the flag.
      *
      * @param rollover if true, rollover borders are installed.
      *        Otherwise non-rollover borders are installed
@@ -606,7 +606,7 @@
      * This is a convenience method to call <code>setBorderToRollover</code>
      * for each child component.
      *
-     * @param c container which holds the child components (usally a JToolBar)
+     * @param c container which holds the child components (usually a JToolBar)
      * @see #setBorderToRollover
      * @since 1.4
      */
@@ -630,7 +630,7 @@
      * This is a convenience method to call <code>setBorderToNonRollover</code>
      * for each child component.
      *
-     * @param c container which holds the child components (usally a JToolBar)
+     * @param c container which holds the child components (usually a JToolBar)
      * @see #setBorderToNonRollover
      * @since 1.4
      */
@@ -654,7 +654,7 @@
      * This is a convenience method to call <code>setBorderNormal</code>
      * for each child component.
      *
-     * @param c container which holds the child components (usally a JToolBar)
+     * @param c container which holds the child components (usually a JToolBar)
      * @see #setBorderToNonRollover
      * @since 1.4
      */
@@ -1274,7 +1274,7 @@
     }
 
     protected class ToolBarContListener implements ContainerListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -1289,7 +1289,7 @@
     }
 
     protected class ToolBarFocusListener implements FocusListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -1303,7 +1303,7 @@
     }
 
     protected class PropertyListener implements PropertyChangeListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -1317,7 +1317,7 @@
      * Instantiate it only within subclasses of BasicToolBarUI.
      */
     public class DockingListener implements MouseInputListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -204,7 +204,7 @@
         JComponent comp = ((JToolTip)c).getComponent();
 
         if (comp != null && !(comp.isEnabled())) {
-            // For better backward compatability, only install inactive
+            // For better backward compatibility, only install inactive
             // properties if they are defined.
             if (UIManager.getBorder("ToolTip.borderInactive") != null) {
                 LookAndFeel.installBorder(c, "ToolTip.borderInactive");
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -140,7 +140,7 @@
     /** Used to determine what to display. */
     protected TreeModel         treeModel;
 
-    /** Model maintaing the selection. */
+    /** Model maintaining the selection. */
     protected TreeSelectionModel treeSelectionModel;
 
     /** How much the depth should be offset to properly calculate
@@ -1275,7 +1275,7 @@
     }
 
     /**
-     * Returns a ubounding box for the drop line.
+     * Returns a unbounding box for the drop line.
      *
      * @param loc a {@code DropLocation}
      * @return bounding box for the drop line
@@ -2525,7 +2525,7 @@
      * Updates the TreeState in response to nodes expanding/collapsing.
      */
     public class TreeExpansionHandler implements TreeExpansionListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -2627,7 +2627,7 @@
      */
     public class TreeModelHandler implements TreeModelListener {
 
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -2656,7 +2656,7 @@
      */
     public class TreeSelectionHandler implements TreeSelectionListener {
 
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -2677,7 +2677,7 @@
      */
     public class CellEditorHandler implements CellEditorListener {
 
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -2695,12 +2695,12 @@
 
 
     /**
-     * This is used to get mutliple key down events to appropriately generate
+     * This is used to get multiple key down events to appropriately generate
      * events.
      */
     public class KeyHandler extends KeyAdapter {
 
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -2742,7 +2742,7 @@
      * Repaints the lead selection row when focus is lost/gained.
      */
     public class FocusHandler implements FocusListener {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -2844,7 +2844,7 @@
      */
     public class MouseHandler extends MouseAdapter implements MouseMotionListener
  {
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -2877,12 +2877,12 @@
 
     /**
      * PropertyChangeListener for the tree. Updates the appropriate
-     * varaible, or TreeState, based on what changes.
+     * variable, or TreeState, based on what changes.
      */
     public class PropertyChangeHandler implements
                        PropertyChangeListener {
 
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
@@ -2900,7 +2900,7 @@
     public class SelectionModelPropertyChangeHandler implements
                       PropertyChangeListener {
 
-        // NOTE: This class exists only for backward compatability. All
+        // NOTE: This class exists only for backward compatibility. All
         // its functionality has been moved into Handler. If you need to add
         // new functionality add it to the Handler, but make sure this
         // class calls into the Handler.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 <body bgcolor="white">
 
--- a/jdk/src/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java	Wed Jul 05 19:21:26 2017 +0200
@@ -57,7 +57,7 @@
  *     <code>UIManager.put("swing.boldMetal",&nbsp;Boolean.FALSE);</code>
  * </ul>
  * The defaults property <code>swing.boldMetal</code>, if set,
- * takes precendence over the system property of the same name. After
+ * takes precedence over the system property of the same name. After
  * setting this defaults property you need to re-install
  * <code>MetalLookAndFeel</code>, as well as update the UI
  * of any previously created widgets. Otherwise the results are undefined.
@@ -284,7 +284,7 @@
     /**
      * Returns the system text font. This returns Dialog, 12pt, plain.
      *
-     * @return the sytem text font
+     * @return the system text font
      */
     public FontUIResource getSystemTextFont() {
         return getFont(SYSTEM_TEXT_FONT);
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1738,7 +1738,7 @@
     public static FontUIResource getControlTextFont() { return getCurrentTheme().getControlTextFont();}
 
     /**
-     * Returns the sytem text font of the current theme. This is a
+     * Returns the system text font of the current theme. This is a
      * cover method for {@code getCurrentTheme().getSystemTextFont()}.
      *
      * @return the system text font
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -682,7 +682,7 @@
         private boolean isMovingWindow;
 
         /**
-         * Used to determine the corner the resize is occuring from.
+         * Used to determine the corner the resize is occurring from.
          */
         private int dragCursor;
 
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -64,14 +64,14 @@
 
    /**
     * A default horizontal thumb <code>Icon</code>. This field might not be
-    * used. To change the <code>Icon</code> used by this delgate directly set it
+    * used. To change the <code>Icon</code> used by this delegate directly set it
     * using the <code>Slider.horizontalThumbIcon</code> UIManager property.
     */
     protected static Icon horizThumbIcon;
 
    /**
     * A default vertical thumb <code>Icon</code>. This field might not be
-    * used. To change the <code>Icon</code> used by this delgate directly set it
+    * used. To change the <code>Icon</code> used by this delegate directly set it
     * using the <code>Slider.verticalThumbIcon</code> UIManager property.
     */
     protected static Icon vertThumbIcon;
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -64,7 +64,7 @@
     private static List<WeakReference<JComponent>> components = new ArrayList<WeakReference<JComponent>>();
 
     /**
-     * This protected field is implemenation specific. Do not access directly
+     * This protected field is implementation specific. Do not access directly
      * or override. Use the create method instead.
      *
      * @see #createContainerListener
@@ -72,7 +72,7 @@
     protected ContainerListener contListener;
 
     /**
-     * This protected field is implemenation specific. Do not access directly
+     * This protected field is implementation specific. Do not access directly
      * or override. Use the create method instead.
      *
      * @see #createRolloverListener
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java	Wed Jul 05 19:21:26 2017 +0200
@@ -64,7 +64,7 @@
  * </table>
  *
  * <p>
- * As it is typically impratical to obtain the <code>TreeUI</code> from
+ * As it is typically impractical to obtain the <code>TreeUI</code> from
  * the <code>JTree</code> and cast to an instance of <code>MetalTreeUI</code>
  * you enable this property via the client property
  * <code>JTree.lineStyle</code>. For example, to switch to
--- a/jdk/src/share/classes/javax/swing/plaf/metal/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 <body bgcolor="white">
 
--- a/jdk/src/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html	Wed Jul 05 19:21:26 2017 +0200
@@ -14,14 +14,14 @@
 
 <blockquote>
 <hr>
+<p>
 <i>
-<p>
 This document is based on an article
 originally published in
 <a href="http://java.sun.com/products/jfc/tsc/" target="_top"><em>The Swing
 Connection</em></a>.
+</i>
 </p>
-</i>
 <hr>
 </blockquote>
 
@@ -43,7 +43,6 @@
 and requires no modifications to work with auxiliary look and feels.
 </p>
 
-</p>
 
 <p>
 This document has the following sections:
@@ -76,14 +75,12 @@
 </p>
 
 <p> 
-<a name="overview">
+<a name="overview"></a>
 <hr width=100% align=LEFT size=2>
-</a>
 <b>
 <font color="#000080" size="+2">Overview</font>
 </b>
 
-<p></p>
 
 <p>
 
@@ -146,14 +143,12 @@
 the Multiplexing look and feel.
 
 <p> 
-<a name="howtouse">
+<a name="howtouse"></a>
 <hr width=100% align=LEFT size=2>
-</a>
 <b>
 <font color="#000080" size="+2">How to Use Auxiliary Look and Feels</font>
 </b>
 
-<p></p>
 
 <p>
 It's easy to use auxiliary look and feels with Swing. To instruct 
@@ -204,14 +199,12 @@
 </p>
 
 <p> 
-<a name="howtowrite">
+<a name="howtowrite"></a>
 <hr width=100% align=LEFT size=2>
-</a>
 <b>
 <font color="#000080" size="+2">Tips for Writing an Auxiliary Look and Feel</font>
 </b>
 
-<p></p>
 
 <p>
 An auxiliary look and feel is like any other look and feel,
@@ -252,7 +245,6 @@
 <font color="#000080" size="+1"><b>Dos and Don'ts</b></font> 
 </a>
 </p>
-<p></p>
 
 <p>
 The following paragraphs provide some general recommendations for developing 
@@ -264,22 +256,19 @@
 to perform all initialization,
 and the <code>uninstallUI</code> method
 to perform all cleanup.</b></font>
-</font>
 </p>
-<ul>
-<p>
+<blockquote>
 The <code>installUI</code> and <code>uninstallUI</code>
 methods are invoked when a component's look and feel is set.
 The <code>installUI</code> method gives the new UI object
 a chance to add listeners on the component and its data model.
 Similarly, the <code>uninstallUI</code> method
 lets the previous UI object remove its listeners.
-</p>
-            </ul>
+</blockquote>
             <p> <font color="#000080"><b>Don't extend 
               visual look and feels.</b></font></p>
-            <ul>
-              <p> We recommended that you <i>don't</i> implement 
+<blockquote>
+               We recommended that you <i>don't</i> implement 
                 UI classes of an auxiliary look and feel as subclasses of the 
                 UI classes of a visual look and feel. Why not? Because they might 
                 accidentally inherit code that installs listeners on a component 
@@ -290,13 +279,13 @@
                 Instead, we recommend that the UI classes of an auxiliary look 
                 and feel directly extend the abstract UI classes in the <code>javax.swing.plaf</code> 
                 package. By using this strategy, the developer of an auxiliary 
-                look and feel can avoid competing with the default look and feel.</p>
-            </ul>
+                look and feel can avoid competing with the default look and feel.
+</blockquote>
             <p> <font color="#000080"><b>Override all UI-specific methods
 	    your UI classes inherit.</b></font>
 	    </p>
-            <ul>
-              <p> We recommend that each UI class of 
+<blockquote>
+               We recommend that each UI class of 
                 an auxiliary look and feel override the methods 
 		defined in the <code>javax.swing.plaf</code>
                 UI classes it descends from
@@ -309,15 +298,14 @@
 		if the 
                 component is opaque. If a UI class from a non-visual auxiliary 
                 look and feel does not override this method, all 
-                opaque components appear as blank areas on the screen!</p>
-            </ul>
+                opaque components appear as blank areas on the screen!
+</blockquote>
             <p> 
 
 <br>
 <a name="uidefaults">
 <font color="#000080" size="+1"><b>Extending UIDefaults</b></font> 
 </a>
-            <p></p>
 
             <p>In many cases, you 
               might want an auxiliary look and feel to be &quot;incomplete.&quot; That 
@@ -379,7 +367,6 @@
 <a name="defaultui">
 <b><font color="#000080" size="+1">Examining Other UI Objects</font></b> 
 </a>
-<p></p>
 
             <p>In 
               rare instances, a UI object from an auxiliary look and feel 
@@ -395,12 +382,10 @@
 	      </p>
 
 <p> 
-<a name="implementation">
+<a name="implementation"></a>
 <hr width=100% align=LEFT size=2>
-</a>
 <font color="#000080" size="+2"><b>How the Multiplexing Look and Feel
 Is Implemented</b></font> 
-<p></p>
 
 <p>
 The Multiplexing look and feel
@@ -437,8 +422,8 @@
                 and feel is always the first to be created. After that, a UI object 
                 is created from each auxiliary look and feel in the order 
                 they are specified in the <code>swing.auxiliarylaf</code> 
-                property.</li>
-<p>
+                property.<br><br></li>
+
               <li> When a method that requests information 
                 from a UI object is invoked, the multiplexing UI object 
 		invokes the method on all the UI objects, but returns 
@@ -450,8 +435,8 @@
 		The <code>getPreferredSize</code> method
 		is also invoked on the UI object for each auxiliary look and feel,
 		but the return values are ignored.
-                </li>
-<p>
+                <br><br></li>
+
               <li> When a method that does not request information 
                 from the UI object is invoked, the multiplexing UI object 
                 invokes that method on all UIs --
@@ -474,14 +459,12 @@
 
 <p> 
 
-<a name="custom">
+<a name="custom"></a>
 <hr width=100% align=LEFT size=2>
-</a>
 <font color="#000080" size="+2"><b>How to Provide a Custom Multiplexing Look
 and Feel</b></font> 
-<p></p>
 
-            <p><font color="#000080" size="+2"><b></b></font>While 
+            <p>While 
               we hope the behavior of the Multiplexing look and feel is 
               flexible enough not to require an alternative multiplexing look 
               and feel, Swing allows the user to specify another multiplexing look 
--- a/jdk/src/share/classes/javax/swing/plaf/multi/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/multi/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 <body bgcolor="white">
 
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -187,7 +187,7 @@
     protected abstract PaintContext getPaintContext();
 
     /**
-     * <p>Configures the given Graphics2D. Often, rendering hints or compositiing rules are
+     * <p>Configures the given Graphics2D. Often, rendering hints or compositing rules are
      * applied to a Graphics2D object prior to painting, which should affect all of the
      * subsequent painting operations. This method provides a convenient hook for configuring
      * the Graphics object prior to rendering, regardless of whether the render operation is
@@ -201,7 +201,7 @@
 
     /**
      * Actually performs the painting operation. Subclasses must implement this method.
-     * The graphics object passed may represent the actual surface being rendererd to,
+     * The graphics object passed may represent the actual surface being rendered to,
      * or it may be an intermediate buffer. It has also been pre-translated. Simply render
      * the component as if it were located at 0, 0 and had a width of <code>width</code>
      * and a height of <code>height</code>. For performance reasons, you may want to read
@@ -313,13 +313,13 @@
      * Decodes and returns a color, which is derived from a base color in UI
      * defaults.
      *
-     * @param key     A key corrosponding to the value in the UI Defaults table
+     * @param key     A key corresponding to the value in the UI Defaults table
      *                of UIManager where the base color is defined
      * @param hOffset The hue offset used for derivation.
      * @param sOffset The saturation offset used for derivation.
      * @param bOffset The brightness offset used for derivation.
      * @param aOffset The alpha offset used for derivation. Between 0...255
-     * @return The derived color, whos color value will change if the parent
+     * @return The derived color, whose color value will change if the parent
      *         uiDefault color changes.
      */
     protected final Color decodeColor(String key, float hOffset, float sOffset,
@@ -532,11 +532,11 @@
          *                   to one of the "decode" methods will return the passed in value.
          * @param inverted Whether to "invert" the meaning of the 9-square grid and stretching insets
          * @param cacheMode A hint as to which caching mode to use. If null, then set to no caching.
-         * @param maxH The maximium scale in the horizontal direction to use before punting and redrawing from scratch.
+         * @param maxH The maximum scale in the horizontal direction to use before punting and redrawing from scratch.
          *             For example, if maxH is 2, then we will attempt to scale any cached images up to 2x the canvas
          *             width before redrawing from scratch. Reasonable maxH values may improve painting performance.
          *             If set too high, then you may get poor looking graphics at higher zoom levels. Must be &gt;= 1.
-         * @param maxV The maximium scale in the vertical direction to use before punting and redrawing from scratch.
+         * @param maxV The maximum scale in the vertical direction to use before punting and redrawing from scratch.
          *             For example, if maxV is 2, then we will attempt to scale any cached images up to 2x the canvas
          *             height before redrawing from scratch. Reasonable maxV values may improve painting performance.
          *             If set too high, then you may get poor looking graphics at higher zoom levels. Must be &gt;= 1.
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/LoweredBorder.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/LoweredBorder.java	Wed Jul 05 19:21:26 2017 +0200
@@ -64,7 +64,7 @@
     /**
      * Actually performs the painting operation. Subclasses must implement this
      * method. The graphics object passed may represent the actual surface being
-     * rendererd to, or it may be an intermediate buffer. It has also been
+     * rendered to, or it may be an intermediate buffer. It has also been
      * pre-translated. Simply render the component as if it were located at 0, 0
      * and had a width of <code>width</code> and a height of
      * <code>height</code>. For performance reasons, you may want to read the
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java	Wed Jul 05 19:21:26 2017 +0200
@@ -808,7 +808,7 @@
     }
 
     /**
-     * Simple utility method that searchs the given array of Strings for the
+     * Simple utility method that searches the given array of Strings for the
      * given string. This method is only called from getExtendedState if
      * the developer has specified a specific state for the component to be
      * in (ie, has "wedged" the component in that state) by specifying
@@ -1010,7 +1010,7 @@
     }
 
     /**
-     * Contains values such as the UIDefaults and painters asssociated with
+     * Contains values such as the UIDefaults and painters associated with
      * a state. Whereas <code>State</code> represents a distinct state that a
      * component can be in (such as Enabled), this class represents the colors,
      * fonts, painters, etc associated with some state for this
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/doc-files/properties.html	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,7 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
+<title></title>
 </head>
 <body>
 <h1 id="primaryColors">Primary Colors</h1>
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 <body bgcolor="white">
 
@@ -39,11 +39,11 @@
 
 <p>Nimbus allows customizing many of its properties, including painters, by
 altering the {@link javax.swing.UIDefaults} table. Here's an example:
-<code><pre>
+<pre>
     UIManager.put("ProgressBar.tileWidth", myTileWidth);
     UIManager.put("ProgressBar[Enabled].backgroundPainter", myBgPainter);
     UIManager.put("ProgressBar[Enabled].foregroundPainter", myFgPainter);
-</pre></code>
+</pre>
 
 <p>Per-component customization is also possible. When rendering a component,
 Nimbus checks its client property named "Nimbus.Overrides". The value of this
@@ -53,14 +53,14 @@
 Boolean, specifies whether the overriding settings should be merged with
 default ones ({@code true}), or replace them ({@code false}). By default they
 are merged:
-<code><pre>
+<pre>
     JProgressBar bar = new JProgressBar();
     UIDefaults overrides = new UIDefaults();
     overrides.put("ProgressBar.cycleTime", 330);
     ...
     bar.putClientProperty("Nimbus.Overrides", overrides);
     bar.putClientProperty("Nimbus.Overrides.InheritDefaults", false);
-</pre></code>
+</pre>
 
 <p>Colors in Nimbus are derived from a core set of
 <a href="doc-files/properties.html#primaryColors">primary colors</a>. There are also
--- a/jdk/src/share/classes/javax/swing/plaf/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 <body bgcolor="white">
 
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java	Wed Jul 05 19:21:26 2017 +0200
@@ -191,20 +191,28 @@
     }
 
     protected void addSystemMenuItems(JPopupMenu menu) {
-        // PENDING: this should all be localizable!
         JMenuItem mi = menu.add(restoreAction);
-        mi.setMnemonic('R');
+        mi.setMnemonic(getButtonMnemonic("restore"));
         mi = menu.add(moveAction);
-        mi.setMnemonic('M');
+        mi.setMnemonic(getButtonMnemonic("move"));
         mi = menu.add(sizeAction);
-        mi.setMnemonic('S');
+        mi.setMnemonic(getButtonMnemonic("size"));
         mi = menu.add(iconifyAction);
-        mi.setMnemonic('n');
+        mi.setMnemonic(getButtonMnemonic("minimize"));
         mi = menu.add(maximizeAction);
-        mi.setMnemonic('x');
+        mi.setMnemonic(getButtonMnemonic("maximize"));
         menu.add(new JSeparator());
         mi = menu.add(closeAction);
-        mi.setMnemonic('C');
+        mi.setMnemonic(getButtonMnemonic("close"));
+    }
+
+    private static int getButtonMnemonic(String button) {
+        try {
+            return Integer.parseInt(UIManager.getString(
+                    "InternalFrameTitlePane." + button + "Button.mnemonic"));
+        } catch (NumberFormatException e) {
+            return -1;
+        }
     }
 
     protected void showSystemMenu() {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -116,7 +116,7 @@
     /**
      * Used by the renderers. For the most part the renderers are implemented
      * as Labels, which is problematic in so far as they are never selected.
-     * To accomodate this SynthLabelUI checks if the current
+     * To accommodate this SynthLabelUI checks if the current
      * UI matches that of <code>selectedUI</code> (which this methods sets), if
      * it does, then a state as set by this method is returned. This provides
      * a way for labels to have a state other than selected.
--- a/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/componentProperties.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/componentProperties.html	Wed Jul 05 19:21:26 2017 +0200
@@ -47,7 +47,7 @@
 JComboBox, JScrollBar and JSplitPane (for the buttons on the divider).
 In       addition to the <a
  href="#buttonProperties">Button 	properties</a>, ArrowButton supports
-the following propeties: </p>
+the following properties: </p>
 <h5>ArrowButton Specific Properties</h5>
 <table border="1">
   <thead><tr>
@@ -887,7 +887,7 @@
       JScrollPane is unique in that it provides a method for setting
       the Border around the JViewport with JViewport throwing an
       IllegalArgumentException from <code>setBorder</code>. To
-      accomodate this a special border is installed on the
+      accommodate this a special border is installed on the
       <code>JScrollPane</code> that uses the 
       insets from the key
       <code>ScrollPane.viewportBorderInsets</code>. The
@@ -1190,7 +1190,7 @@
       <td>Tree.scrollsHorizontallyAndVertically</td>
       <td>Boolean</td>
       <td>false 	 </td>
-      <td>If false and scrolling needs to happen to accomodate 	 cells
+      <td>If false and scrolling needs to happen to accommodate 	 cells
 it will only happen along the vertical axis, if 	    true, scrolling
 may happen along both the horizontal and 	    vertical axis. 	</td>
     </tr>
--- a/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html	Wed Jul 05 19:21:26 2017 +0200
@@ -2,7 +2,7 @@
 <html>
   <head>
     <title>Synth File Format</title>
-  <style>
+  <style type="text/css">
 div.dtd-fragment {
     width: 100%;
     border: none;
@@ -24,7 +24,7 @@
       Synth's file format (<a href="synth.dtd">dtd</a>)
       allows for specifying all the pieces
       necessary to create your own look and feel. A synth file is
-      loaded by way of the <A HREF="../../../../../javax/swing/plaf/synth/SynthLookAndFeel.html#load(java.io.InputStream, java.lang.Class)">SynthLookAndFeel.load(InputStream, Class)</a> or
+      loaded by way of the <A HREF="../../../../../javax/swing/plaf/synth/SynthLookAndFeel.html#load(java.io.InputStream,%20java.lang.Class)">SynthLookAndFeel.load(InputStream, Class)</a> or
       <a href="../../../../../javax/swing/plaf/synth/SynthLookAndFeel.html#load(java.net.URL)">SynthLookAndFeel.load(URL)</a> methods.
       The following example uses the <code>load</code> method to configure 
       a <code>SynthLookAndFeel</code> and sets it as the current look
@@ -110,7 +110,7 @@
 	    style.</dd>
     </dl>
     <p>
-      A <a name="e.style">style</a> element corresponds to a
+      A style element corresponds to a
       <code>SynthStyle</code>, with the child elements specifying
       properties that apply to all states or state elements which
       contain properties specific to a particular state. The following
@@ -216,7 +216,6 @@
       contains at least SELECTED and PRESSED, state <code>one</code> will be
       chosen, otherwise if the state is SELECTED, but not does not
       contain PRESSED, state <code>two</code> will be used.
-    <p>
 
     <h3>The font element</h3>
 <div class="dtd-fragment">
@@ -462,7 +461,6 @@
 	for idref properties this will be the unique id of a
 	previously defined object.</dd>
     </dl>
-    </dl>
     <p>
       <a href="#e.defaultsProperty">DefaultsProperty</a> elements are
       used to define properties that will be placed in the
@@ -738,7 +736,7 @@
   &lt;state value="SELECTED">
     &lt;painter idref="stateFallbackPainter"/>
     &lt;painter idref="stateButtonBackgroundPainter" method="buttonBackground"/>
-  &lt/state>
+  &lt;/state>
 &lt;/style>
       </pre>
     </div>      
--- a/jdk/src/share/classes/javax/swing/plaf/synth/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -27,6 +27,7 @@
 
 
 -->
+<title></title>
 </head>
 <body bgcolor="white">
     <p>
--- a/jdk/src/share/classes/javax/swing/table/DefaultTableColumnModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/table/DefaultTableColumnModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -315,7 +315,7 @@
      * of the view/controller object using this model (typically JTable).  The
      * view/controller need not display the columns sequentially from left to
      * right.  For example, columns could be displayed from right to left to
-     * accomodate a locale preference or some columns might be hidden at the
+     * accommodate a locale preference or some columns might be hidden at the
      * request of the user.  Because the model does not know how the columns
      * are laid out on screen, the given <code>xPosition</code> should not be
      * considered to be a coordinate in 2D graphics space.  Instead, it should
--- a/jdk/src/share/classes/javax/swing/table/JTableHeader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/table/JTableHeader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -869,7 +869,7 @@
 
       /**
        * This class provides an implementation of the Java Accessibility
-       * API appropropriate for JTableHeader entries.
+       * API appropriate for JTableHeader entries.
        */
         protected class AccessibleJTableHeaderEntry extends AccessibleContext
             implements Accessible, AccessibleComponent  {
--- a/jdk/src/share/classes/javax/swing/table/TableColumn.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/table/TableColumn.java	Wed Jul 05 19:21:26 2017 +0200
@@ -37,7 +37,7 @@
 
 /**
  *  A <code>TableColumn</code> represents all the attributes of a column in a
- *  <code>JTable</code>, such as width, resizibility, minimum and maximum width.
+ *  <code>JTable</code>, such as width, resizability, minimum and maximum width.
  *  In addition, the <code>TableColumn</code> provides slots for a renderer and
  *  an editor that can be used to display and edit the values in this column.
  *  <p>
--- a/jdk/src/share/classes/javax/swing/table/TableColumnModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/table/TableColumnModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -154,7 +154,7 @@
      * of the view/controller object using this model (typically JTable).  The
      * view/controller need not display the columns sequentially from left to
      * right.  For example, columns could be displayed from right to left to
-     * accomodate a locale preference or some columns might be hidden at the
+     * accommodate a locale preference or some columns might be hidden at the
      * request of the user.  Because the model does not know how the columns
      * are laid out on screen, the given <code>xPosition</code> should not be
      * considered to be a coordinate in 2D graphics space.  Instead, it should
--- a/jdk/src/share/classes/javax/swing/table/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/table/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 <body bgcolor="white">
 
--- a/jdk/src/share/classes/javax/swing/text/AbstractDocument.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/AbstractDocument.java	Wed Jul 05 19:21:26 2017 +0200
@@ -48,7 +48,7 @@
  * all observers of the document have been notified of a previous
  * change before beginning another mutation to the document.  The
  * read lock is acquired and released using the <code>render</code>
- * method.  A write lock is aquired by the methods that mutate the
+ * method.  A write lock is acquired by the methods that mutate the
  * document, and are held for the duration of the method call.
  * Notification is done on the thread that produced the mutation,
  * and the thread has full read access to the document for the
@@ -391,7 +391,7 @@
      * is being executed.  The runnable itself may <em>not</em>
      * make any mutations.
      * <p>
-     * This is implemented to aquire a read lock for the duration
+     * This is implemented to acquire a read lock for the duration
      * of the runnables execution.  There may be multiple runnables
      * executing at the same time, and all writers will be blocked
      * while there are active rendering runnables.  If the runnable
@@ -1373,7 +1373,7 @@
 
     /**
      * Releases a write lock previously obtained via <code>writeLock</code>.
-     * After decrementing the lock count if there are no oustanding locks
+     * After decrementing the lock count if there are no outstanding locks
      * this will allow a new writer, or readers.
      *
      * @see #writeLock
@@ -1642,7 +1642,7 @@
          * @param where   The offset into the sequence to make the
          *   insertion &gt;= 0.
          * @param nitems  The number of items in the sequence to remove &gt;= 0.
-         * @return  If the implementation supports a history mechansim,
+         * @return  If the implementation supports a history mechanism,
          *    a reference to an Edit implementation will be returned,
          *    otherwise null.
          * @exception BadLocationException  Thrown if the area covered by
--- a/jdk/src/share/classes/javax/swing/text/AbstractWriter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/AbstractWriter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -396,7 +396,7 @@
     }
 
     /**
-     * Sets the String used to reprsent newlines. This is initialized
+     * Sets the String used to represent newlines. This is initialized
      * in the constructor from either the Document, or the System property
      * line.separator.
      *
@@ -698,7 +698,7 @@
     }
 
     /**
-     * Support method to locate an occurence of a particular character.
+     * Support method to locate an occurrence of a particular character.
      */
     private int indexOf(char[] chars, char sChar, int startIndex,
                         int endIndex) {
--- a/jdk/src/share/classes/javax/swing/text/AsyncBoxView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/AsyncBoxView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -42,7 +42,7 @@
  * or a visible area) can be taken on.
  * <p>
  * While the child view is being accessed
- * a read lock is aquired on the associated document
+ * a read lock is acquired on the associated document
  * so that the model is stable while being accessed.
  *
  * @author  Timothy Prinzing
@@ -77,7 +77,7 @@
     }
 
     /**
-     * Fetch the minor axis (the axis orthoginal
+     * Fetch the minor axis (the axis orthogonal
      * to the tiled axis).  This will have a value of
      * either X_AXIS or Y_AXIS.
      */
@@ -827,8 +827,12 @@
      * location that one might place a caret.  Some views may not be visible,
      * they might not be in the same order found in the model, or they just
      * might not allow access to some of the locations in the model.
+     * This method enables specifying a position to convert
+     * within the range of &gt;=0.  If the value is -1, a position
+     * will be calculated automatically.  If the value &lt; -1,
+     * the {@code BadLocationException} will be thrown.
      *
-     * @param pos the position to convert &gt;= 0
+     * @param pos the position to convert
      * @param a the allocated region to render into
      * @param direction the direction from the current position that can
      *  be thought of as the arrow keys typically found on a keyboard;
@@ -842,13 +846,17 @@
      * @param biasRet an array contain the bias that was checked
      * @return the location within the model that best represents the next
      *  location visual position
-     * @exception BadLocationException
+     * @exception BadLocationException the given position is not a valid
+     *                                 position within the document
      * @exception IllegalArgumentException if <code>direction</code> is invalid
      */
     public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
                                          int direction,
                                          Position.Bias[] biasRet)
                                                   throws BadLocationException {
+        if (pos < -1) {
+            throw new BadLocationException("invalid position", pos);
+        }
         return Utilities.getNextVisualPositionFrom(
                             this, pos, b, a, direction, biasRet);
     }
@@ -1048,7 +1056,7 @@
         /**
          * Copy the currently allocated shape into the Rectangle
          * used to store the current allocation.  This would be
-         * a floating point rectangle in a Java2D-specific implmentation.
+         * a floating point rectangle in a Java2D-specific implementation.
          */
         protected void setAllocation(Shape a) {
             if (a instanceof Rectangle) {
@@ -1216,7 +1224,7 @@
          * time updating the child state (intended to
          * be the layout thread).
          * <p>
-         * This aquires a read lock on the associated
+         * This acquires a read lock on the associated
          * document for the duration of the update to
          * ensure the model is not changed while it is
          * operating.  The first thing to do would be
--- a/jdk/src/share/classes/javax/swing/text/BoxView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/BoxView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -38,7 +38,7 @@
  * This is a building block that might be useful to represent
  * things like a collection of lines, paragraphs,
  * lists, columns, pages, etc.  The axis along which the children are tiled is
- * considered the major axis.  The orthoginal axis is the minor axis.
+ * considered the major axis.  The orthogonal axis is the minor axis.
  * <p>
  * Layout for each axis is handled separately by the methods
  * <code>layoutMajorAxis</code> and <code>layoutMinorAxis</code>.
@@ -507,7 +507,7 @@
      * Determines the desired alignment for this view along an
      * axis.  This is implemented to give the total alignment
      * needed to position the children with the alignment points
-     * lined up along the axis orthoginal to the axis that is
+     * lined up along the axis orthogonal to the axis that is
      * being tiled.  The axis being tiled will request to be
      * centered (i.e. 0.5f).
      *
@@ -650,7 +650,7 @@
      * @param x the X coordinate &gt;= 0
      * @param y the Y coordinate &gt;= 0
      * @param alloc the parents inner allocation on entry, which should
-     *   be changed to the childs allocation on exit
+     *   be changed to the child's allocation on exit
      * @return the view
      */
     protected View getViewAtPoint(int x, int y, Rectangle alloc) {
@@ -816,7 +816,7 @@
 
     /**
      * Performs layout for the minor axis of the box (i.e. the
-     * axis orthoginal to the axis that it represents). The results
+     * axis orthogonal to the axis that it represents). The results
      * of the layout (the offset and span for each children) are
      * placed in the given arrays which represent the allocations to
      * the children along the minor axis.
@@ -1102,7 +1102,7 @@
     }
 
     /**
-     * Fetches the span of a particular childs current layout.
+     * Fetches the span of a particular child's current layout.
      * @param axis the axis being studied
      * @param childIndex the index of the requested child
      * @return the span (width or height) of the specified child
--- a/jdk/src/share/classes/javax/swing/text/CompositeView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/CompositeView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -435,8 +435,12 @@
      * might not allow access to some of the locations in the model.
      * This is a convenience method for {@link #getNextNorthSouthVisualPositionFrom}
      * and {@link #getNextEastWestVisualPositionFrom}.
+     * This method enables specifying a position to convert
+     * within the range of &gt;=0.  If the value is -1, a position
+     * will be calculated automatically.  If the value &lt; -1,
+     * the {@code BadLocationException} will be thrown.
      *
-     * @param pos the position to convert &gt;= 0
+     * @param pos the position to convert
      * @param b a bias value of either <code>Position.Bias.Forward</code>
      *  or <code>Position.Bias.Backward</code>
      * @param a the allocated region to render into
@@ -452,12 +456,16 @@
      * @param biasRet an array containing the bias that was checked
      * @return the location within the model that best represents the next
      *  location visual position
-     * @exception BadLocationException
+     * @exception BadLocationException the given position is not a valid
+     *                                 position within the document
      * @exception IllegalArgumentException if <code>direction</code> is invalid
      */
     public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
                                          int direction, Position.Bias[] biasRet)
       throws BadLocationException {
+        if (pos < -1) {
+            throw new BadLocationException("invalid position", pos);
+        }
         Rectangle alloc = getInsideAllocation(a);
 
         switch (direction) {
--- a/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/DefaultFormatter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -34,7 +34,7 @@
 import javax.swing.text.*;
 
 /**
- * <code>DefaultFormatter</code> formats aribtrary objects. Formatting is done
+ * <code>DefaultFormatter</code> formats arbitrary objects. Formatting is done
  * by invoking the <code>toString</code> method. In order to convert the
  * value back to a String, your class must provide a constructor that
  * takes a String argument. If no single argument constructor that takes a
@@ -137,7 +137,7 @@
      * <code>JFormattedTextField</code>, typically when enter is pressed
      * or focus leaves the <code>JFormattedTextField</code>.
      *
-     * @param commit Used to indicate when edits are commited back to the
+     * @param commit Used to indicate when edits are committed back to the
      *               JTextComponent
      */
     public void setCommitsOnValidEdit(boolean commit) {
@@ -148,7 +148,7 @@
      * Returns when edits are published back to the
      * <code>JFormattedTextField</code>.
      *
-     * @return true if edits are commited after evey valid edit
+     * @return true if edits are committed after every valid edit
      */
     public boolean getCommitsOnValidEdit() {
         return commitOnEdit;
@@ -213,7 +213,7 @@
     /**
      * Returns that class that is used to create new Objects.
      *
-     * @return Class used to constuct return value from stringToValue
+     * @return Class used to construct return value from stringToValue
      */
     public Class<?> getValueClass() {
         return valueClass;
@@ -225,7 +225,7 @@
      * takes a String argument. If <code>getValueClass</code>
      * returns null, the Class of the current value in the
      * <code>JFormattedTextField</code> will be used. If this is null, a
-     * String will be returned. If the constructor thows an exception, a
+     * String will be returned. If the constructor throws an exception, a
      * <code>ParseException</code> will be thrown. If there is no single
      * argument String constructor, <code>string</code> will be returned.
      *
@@ -500,7 +500,7 @@
 
 
     /**
-     * Finds the next navigatable character.
+     * Finds the next navigable character.
      */
     int getNextVisualPositionFrom(JTextComponent text, int pos,
                                   Position.Bias bias, int direction,
--- a/jdk/src/share/classes/javax/swing/text/DefaultHighlighter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/DefaultHighlighter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -447,7 +447,7 @@
          *        necessarily the region to paint.
          * @param c the editor
          * @param view View painting for
-         * @return region drawing occured in
+         * @return region drawing occurred in
          */
         public Shape paintLayer(Graphics g, int offs0, int offs1,
                                 Shape bounds, JTextComponent c, View view) {
--- a/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/DefaultStyledDocument.java	Wed Jul 05 19:21:26 2017 +0200
@@ -2328,7 +2328,7 @@
         /**
          * Recreates <code>toDuplicate</code>. This is called when an
          * element needs to be created as the result of an insertion. This
-         * will recurse and create all the children. This is similiar to
+         * will recurse and create all the children. This is similar to
          * <code>clone</code>, but deteremines the offsets differently.
          */
         Element recreateFracturedElement(Element parent, Element toDuplicate) {
--- a/jdk/src/share/classes/javax/swing/text/Document.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/Document.java	Wed Jul 05 19:21:26 2017 +0200
@@ -123,7 +123,7 @@
  * rather than a mutation to the <code>Document</code> made through its
  * api.
  * <p style="text-align:center"><img src="doc-files/Document-notification.gif"
- * alt="The preceeding text describes this graphic.">
+ * alt="The preceding text describes this graphic.">
  * <p>
  * Referring to the above diagram, suppose that the component shown
  * on the left mutates the document object represented by the blue
--- a/jdk/src/share/classes/javax/swing/text/DocumentFilter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/DocumentFilter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -131,7 +131,7 @@
      */
     public static abstract class FilterBypass {
         /**
-         * Returns the Document the mutation is occuring on.
+         * Returns the Document the mutation is occurring on.
          *
          * @return Document that remove/insertString will operate on
          */
--- a/jdk/src/share/classes/javax/swing/text/ElementIterator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/ElementIterator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -30,7 +30,7 @@
 
 /**
  * <p>
- * ElementIterator, as the name suggests, iteratates over the Element
+ * ElementIterator, as the name suggests, iterates over the Element
  * tree.  The constructor can be invoked with either Document or an Element
  * as an argument.  If the constructor is invoked with a Document as an
  * argument then the root of the iteration is the return value of
@@ -284,7 +284,7 @@
 
 
     /**
-     * Fetches the previous Element. If howver the current
+     * Fetches the previous Element. If however the current
      * element is the last element, or the current element
      * is null, then null is returned.
      *
--- a/jdk/src/share/classes/javax/swing/text/FlowView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/FlowView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -171,7 +171,7 @@
      * the layout along the box axis.  The FlowStrategy.layout
      * method will be called to rebuild the flow rows as
      * appropriate.  If the height of this view changes
-     * (determined by the perferred size along the box axis),
+     * (determined by the preferred size along the box axis),
      * a preferenceChanged is called.  Following all of that,
      * the normal box layout of the superclass is performed.
      *
@@ -221,7 +221,7 @@
     }
 
     /**
-     * Calculate equirements along the minor axis.  This
+     * Calculate requirements along the minor axis.  This
      * is implemented to forward the request to the logical
      * view by calling getMinimumSpan, getPreferredSpan, and
      * getMaximumSpan on it.
@@ -328,7 +328,7 @@
      * entire flow if the layout is invalid on the
      * given FlowView.  Alternative strategies can
      * be implemented by subclassing, and might
-     * perform incrementatal repair to the layout
+     * perform incremental repair to the layout
      * or alternative breaking behavior.
      * @since 1.3
      */
@@ -491,7 +491,7 @@
          * This is implemented to fill the row by repeatedly calling
          * the createView method until the available span has been
          * exhausted, a forced break was encountered, or the createView
-         * method returned null.  If the remaining span was exhaused,
+         * method returned null.  If the remaining span was exhausted,
          * the adjustRow method will be called to perform adjustments
          * to the row to try and make it fit into the given span.
          *
--- a/jdk/src/share/classes/javax/swing/text/GapContent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/GapContent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -44,7 +44,7 @@
  * to take advantage of common behavior where most changes are
  * in the same location.  Changes that occur at a gap boundary are
  * generally cheap and moving the gap is generally cheaper than
- * moving the array contents directly to accomodate the change.
+ * moving the array contents directly to accommodate the change.
  * <p>
  * The positions tracking change are also generally cheap to
  * maintain.  The Position implementations (marks) store the array
--- a/jdk/src/share/classes/javax/swing/text/GapVector.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/GapVector.java	Wed Jul 05 19:21:26 2017 +0200
@@ -36,7 +36,7 @@
  * to take advantage of common behavior where most changes occur
  * in the same location.  Changes that occur at a gap boundary are
  * generally cheap and moving the gap is generally cheaper than
- * moving the array contents directly to accomodate the change.
+ * moving the array contents directly to accommodate the change.
  *
  * @author  Timothy Prinzing
  * @see GapContent
--- a/jdk/src/share/classes/javax/swing/text/GlyphView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/GlyphView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -879,8 +879,12 @@
      * visible, they might not be in the same order found in the model, or
      * they just might not allow access to some of the locations in the
      * model.
+     * This method enables specifying a position to convert
+     * within the range of &gt;=0.  If the value is -1, a position
+     * will be calculated automatically.  If the value &lt; -1,
+     * the {@code BadLocationException} will be thrown.
      *
-     * @param pos the position to convert &gt;= 0
+     * @param pos the position to convert
      * @param a the allocated region to render into
      * @param direction the direction from the current position that can
      *  be thought of as the arrow keys typically found on a keyboard.
@@ -888,7 +892,8 @@
      *  SwingConstants.NORTH, or SwingConstants.SOUTH.
      * @return the location within the model that best represents the next
      *  location visual position.
-     * @exception BadLocationException
+     * @exception BadLocationException the given position is not a valid
+     *                                 position within the document
      * @exception IllegalArgumentException for an invalid direction
      */
     public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
@@ -896,6 +901,9 @@
                                          Position.Bias[] biasRet)
         throws BadLocationException {
 
+        if (pos < -1) {
+            throw new BadLocationException("invalid position", pos);
+        }
         return painter.getNextVisualPositionFrom(this, pos, b, a, direction, biasRet);
     }
 
--- a/jdk/src/share/classes/javax/swing/text/InternationalFormatter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/InternationalFormatter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -569,7 +569,7 @@
     }
 
     /**
-     * Returns true if the character at offset is navigatable too. This
+     * Returns true if the character at offset is navigable too. This
      * is implemented in terms of <code>isLiteral</code>, subclasses
      * may wish to provide different behavior.
      */
@@ -862,7 +862,7 @@
     }
 
     /**
-     * Returns the number of occurences of <code>f</code> before
+     * Returns the number of occurrences of <code>f</code> before
      * the location <code>start</code> in the current
      * <code>AttributedCharacterIterator</code>.
      */
--- a/jdk/src/share/classes/javax/swing/text/JTextComponent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/JTextComponent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -160,9 +160,9 @@
  *
  * <table border=1 summary="Stages of keyboard and input method event handling">
  * <tr>
- * <th id="stage"><p align="left">Stage</p></th>
- * <th id="ke"><p align="left">KeyEvent</p></th>
- * <th id="ime"><p align="left">InputMethodEvent</p></th></tr>
+ * <th id="stage"><p style="text-align:left">Stage</p></th>
+ * <th id="ke"><p style="text-align:left">KeyEvent</p></th>
+ * <th id="ime"><p style="text-align:left">InputMethodEvent</p></th></tr>
  * <tr><td headers="stage">1.   </td>
  *     <td headers="ke">input methods </td>
  *     <td headers="ime">(generated here)</td></tr>
@@ -214,7 +214,7 @@
  * The text document model may be shared by other views which act as observers
  * of the model (e.g. a document may be shared by multiple components).
  *
- * <p align=center><img src="doc-files/editor.gif" alt="Diagram showing interaction between Controller, Document, events, and ViewFactory"
+ * <p style="text-align:center"><img src="doc-files/editor.gif" alt="Diagram showing interaction between Controller, Document, events, and ViewFactory"
  *                  HEIGHT=358 WIDTH=587></p>
  *
  * <p>
@@ -426,7 +426,7 @@
         Document old = model;
 
         /*
-         * aquire a read lock on the old model to prevent notification of
+         * acquire a read lock on the old model to prevent notification of
          * mutations while we disconnecting the old model.
          */
         try {
@@ -1399,8 +1399,8 @@
      * Fetches a portion of the text represented by the
      * component.  Returns an empty string if length is 0.
      *
-     * @param offs the offset >= 0
-     * @param len the length >= 0
+     * @param offs the offset &ge; 0
+     * @param len the length &ge; 0
      * @return the text
      * @exception BadLocationException if the offset or length are invalid
      */
@@ -1416,7 +1416,7 @@
      * be computed until the component has been sized).  The
      * component does not have to be visible or painted.
      *
-     * @param pos the position >= 0
+     * @param pos the position &ge; 0
      * @return the coordinates as a rectangle, with (r.x, r.y) as the location
      *   in the coordinate system, or null if the component does
      *   not yet have a positive size.
@@ -1437,7 +1437,7 @@
      * component does not have to be visible or painted.
      *
      * @param pt the location in the view to translate
-     * @return the offset >= 0 from the start of the document,
+     * @return the offset &ge; 0 from the start of the document,
      *   or -1 if the component does not yet have a positive
      *   size.
      * @see TextUI#viewToModel
@@ -1493,10 +1493,10 @@
     }
 
     /**
-     * This is a conveniance method that is only useful for
+     * This is a convenience method that is only useful for
      * <code>cut</code>, <code>copy</code> and <code>paste</code>.  If
      * an <code>Action</code> with the name <code>name</code> does not
-     * exist in the <code>ActionMap</code>, this will attemp to install a
+     * exist in the <code>ActionMap</code>, this will attempt to install a
      * <code>TransferHandler</code> and then use <code>altAction</code>.
      */
     private void invokeAction(String name, Action altAction) {
@@ -1688,7 +1688,7 @@
      * text component.
      *
      * @return the position of the text insertion caret for the
-     *  text component >= 0
+     *  text component &ge; 0
      */
     @Transient
     public int getCaretPosition() {
@@ -1814,7 +1814,7 @@
      * Returns the selected text's start position.  Return 0 for an
      * empty document, or the value of dot if no selection.
      *
-     * @return the start position >= 0
+     * @return the start position &ge; 0
      */
     @Transient
     public int getSelectionStart() {
@@ -1832,7 +1832,7 @@
      * This is implemented to forward to the <code>Caret</code>
      * implementation which is where the actual selection is maintained.
      *
-     * @param selectionStart the start position of the text >= 0
+     * @param selectionStart the start position of the text &ge; 0
      * @beaninfo
      * description: starting location of the selection.
      */
@@ -1847,7 +1847,7 @@
      * Returns the selected text's end position.  Return 0 if the document
      * is empty, or the value of dot if there is no selection.
      *
-     * @return the end position >= 0
+     * @return the end position &ge; 0
      */
     @Transient
     public int getSelectionEnd() {
@@ -1865,7 +1865,7 @@
      * This is implemented to forward to the <code>Caret</code>
      * implementation which is where the actual selection is maintained.
      *
-     * @param selectionEnd the end position of the text >= 0
+     * @param selectionEnd the end position of the text &ge; 0
      * @beaninfo
      * description: ending location of the selection.
      */
@@ -2785,7 +2785,7 @@
          * if the JTextComponent is contained in a JScrollPane in which
          * case the resulting rectangle should be composed with the parent
          * coordinates.  A good algorithm to use is:
-         * <nf>
+         * <pre>
          * Accessible a:
          * AccessibleText at = a.getAccessibleText();
          * AccessibleComponent ac = a.getAccessibleComponent();
@@ -2793,14 +2793,14 @@
          * Point p = ac.getLocation();
          * r.x += p.x;
          * r.y += p.y;
-         * </nf>
+         * </pre>
          *
          * Note: the JTextComponent must have a valid size (e.g. have
          * been added to a parent container whose ancestor container
          * is a valid top-level window) for this method to be able
          * to return a meaningful (non-null) value.
          *
-         * @param i the index into the String >= 0
+         * @param i the index into the String &ge; 0
          * @return the screen coordinates of the character's bounding box
          */
         public Rectangle getCharacterBounds(int i) {
@@ -2844,7 +2844,7 @@
         /**
          * Returns the number of characters (valid indices)
          *
-         * @return the number of characters >= 0
+         * @return the number of characters &ge; 0
          */
         public int getCharCount() {
             return model.getLength();
@@ -2895,7 +2895,7 @@
          * Return 0 if the text is empty, or the caret position
          * if no selection.
          *
-         * @return the index into the text of the start of the selection >= 0
+         * @return the index into the text of the start of the selection &ge; 0
          */
         public int getSelectionStart() {
             return JTextComponent.this.getSelectionStart();
@@ -2908,7 +2908,7 @@
          * Return 0 if the text is empty, or the caret position
          * if no selection.
          *
-         * @return the index into teh text of the end of the selection >= 0
+         * @return the index into the text of the end of the selection &ge; 0
          */
         public int getSelectionEnd() {
             return JTextComponent.this.getSelectionEnd();
--- a/jdk/src/share/classes/javax/swing/text/NumberFormatter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/NumberFormatter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -34,7 +34,7 @@
  * <code>NumberFormatter</code> subclasses <code>InternationalFormatter</code>
  * adding special behavior for numbers. Among the specializations are
  * (these are only used if the <code>NumberFormatter</code> does not display
- * invalid nubers, eg <code>setAllowsInvalid(false)</code>):
+ * invalid numbers, for example, <code>setAllowsInvalid(false)</code>):
  * <ul>
  *   <li>Pressing +/- (- is determined from the
  *       <code>DecimalFormatSymbols</code> associated with the
@@ -44,7 +44,7 @@
  *   <li>Pressing +/- (- is determined from the
  *       <code>DecimalFormatSymbols</code> associated with the
  *       <code>DecimalFormat</code>) in the exponent field will
- *       attemp to change the sign of the exponent to positive/negative.
+ *       attempt to change the sign of the exponent to positive/negative.
  * </ul>
  * <p>
  * If you are displaying scientific numbers, you may wish to turn on
@@ -299,9 +299,9 @@
     }
 
     /**
-     * Subclassed to make the decimal separator navigatable, as well
+     * Subclassed to make the decimal separator navigable, as well
      * as making the character between the integer field and the next
-     * field navigatable.
+     * field navigable.
      */
     boolean isNavigatable(int index) {
         if (!super.isNavigatable(index)) {
--- a/jdk/src/share/classes/javax/swing/text/ParagraphView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/ParagraphView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -567,7 +567,7 @@
 
     /**
      * Renders using the given rendering surface and area on that
-     * surface.  This is implemented to delgate to the superclass
+     * surface.  This is implemented to delegate to the superclass
      * after stashing the base coordinate for tab calculations.
      *
      * @param g the rendering surface to use
@@ -931,7 +931,7 @@
 
         /**
          * Perform layout for the minor axis of the box (i.e. the
-         * axis orthoginal to the axis that it represents).  The results
+         * axis orthogonal to the axis that it represents).  The results
          * of the layout should be placed in the given arrays which represent
          * the allocations to the children along the minor axis.
          * <p>
@@ -939,7 +939,7 @@
          * by calling BoxView.baselineLayout.
          *
          * @param targetSpan the total span given to the view, which
-         *  whould be used to layout the children.
+         *  would be used to layout the children.
          * @param axis the axis being layed out.
          * @param offsets the offsets from the origin of the view for
          *  each of the child views.  This is a return value and is
--- a/jdk/src/share/classes/javax/swing/text/SimpleAttributeSet.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/SimpleAttributeSet.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -29,8 +29,9 @@
 import java.util.Collections;
 import java.io.IOException;
 import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.io.Serializable;
+import java.util.AbstractMap;
+import java.util.LinkedHashMap;
 
 /**
  * A straightforward implementation of MutableAttributeSet using a
@@ -56,7 +57,7 @@
      */
     public static final AttributeSet EMPTY = new EmptyAttributeSet();
 
-    private transient Hashtable<Object, Object> table = new Hashtable<Object, Object>(3);
+    private transient LinkedHashMap<Object, Object> table = new LinkedHashMap<>(3);
 
     /**
      * Creates a new attribute set.
@@ -73,10 +74,6 @@
         addAttributes(source);
     }
 
-    private SimpleAttributeSet(Hashtable<Object, Object> table) {
-        this.table = table;
-    }
-
     /**
      * Checks whether the set of attributes is empty.
      *
@@ -132,7 +129,7 @@
      * @return the names as an <code>Enumeration</code>
      */
     public Enumeration<?> getAttributeNames() {
-        return table.keys();
+        return Collections.enumeration(table.keySet());
     }
 
     /**
@@ -278,7 +275,7 @@
         SimpleAttributeSet attr;
         try {
             attr = (SimpleAttributeSet) super.clone();
-            attr.table = (Hashtable) table.clone();
+            attr.table = (LinkedHashMap) table.clone();
         } catch (CloneNotSupportedException cnse) {
             attr = null;
         }
@@ -341,7 +338,7 @@
     private void readObject(ObjectInputStream s)
       throws ClassNotFoundException, IOException {
         s.defaultReadObject();
-        table = new Hashtable<Object, Object>(3);
+        table = new LinkedHashMap<>(3);
         StyleContext.readAttributeSet(s, this);
     }
 
--- a/jdk/src/share/classes/javax/swing/text/StyleConstants.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/StyleConstants.java	Wed Jul 05 19:21:26 2017 +0200
@@ -39,7 +39,7 @@
  * All sizes are specified in points (such as found in postscript), a
  * device independent measure.
  * </p>
- * <p align=center><img src="doc-files/paragraph.gif"
+ * <p style="text-align:center"><img src="doc-files/paragraph.gif"
  * alt="Diagram shows SpaceAbove, FirstLineIndent, LeftIndent, RightIndent,
  *      and SpaceBelow a paragraph."></p>
  * <p>
@@ -65,7 +65,7 @@
     public static final Object NameAttribute = new StyleConstants("name");
 
     /**
-     * Attribute name used to identifiy the resolving parent
+     * Attribute name used to identify the resolving parent
      * set of attributes, if one is defined.
      */
     public static final Object ResolveAttribute = new StyleConstants("resolver");
--- a/jdk/src/share/classes/javax/swing/text/StyleContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/StyleContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -438,7 +438,7 @@
     }
 
     /**
-     * Returns a set no longer needed by the MutableAttributeSet implmentation.
+     * Returns a set no longer needed by the MutableAttributeSet implementation.
      * This is useful for operation under 1.1 where there are no weak
      * references.  This would typically be called by the finalize method
      * of the MutableAttributeSet implementation.
@@ -576,7 +576,7 @@
      * special care to deal with static attribute keys that
      * have been registered wit the
      * <code>registerStaticAttributeKey</code> method.
-     * Any attribute key not regsitered as a static key
+     * Any attribute key not registered as a static key
      * will be serialized directly.  All values are expected
      * to be serializable.
      *
@@ -839,7 +839,7 @@
         }
 
         /**
-         * Compares this object to the specifed object.
+         * Compares this object to the specified object.
          * The result is <code>true</code> if the object is an equivalent
          * set of attributes.
          * @param     obj   the object to compare with.
@@ -1040,7 +1040,7 @@
 
     /**
      * Sorts the key strings so that they can be very quickly compared
-     * in the attribute set searchs.
+     * in the attribute set searches.
      */
     class KeyBuilder {
 
@@ -1209,7 +1209,7 @@
         }
 
         /**
-         * Compares this object to the specifed object.
+         * Compares this object to the specified object.
          * The result is <code>true</code> if and only if the argument is not
          * <code>null</code> and is a <code>Font</code> object with the same
          * name, style, and point size as this font.
--- a/jdk/src/share/classes/javax/swing/text/TableView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/TableView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -308,7 +308,7 @@
 
     /**
      * Perform layout for the minor axis of the box (i.e. the
-     * axis orthoginal to the axis that it represents).  The results
+     * axis orthogonal to the axis that it represents).  The results
      * of the layout should be placed in the given arrays which represent
      * the allocations to the children along the minor axis.  This
      * is called by the superclass whenever the layout needs to be
@@ -320,7 +320,7 @@
      * of the tables rows.
      *
      * @param targetSpan the total span given to the view, which
-     *  whould be used to layout the children.
+     *  would be used to layout the children.
      * @param axis the axis being layed out.
      * @param offsets the offsets from the origin of the view for
      *  each of the child views.  This is a return value and is
@@ -657,7 +657,7 @@
          * the multi-column span.
          *
          * @param targetSpan the total span given to the view, which
-         *  whould be used to layout the children.
+         *  would be used to layout the children.
          * @param axis the axis being layed out.
          * @param offsets the offsets from the origin of the view for
          *  each of the child views.  This is a return value and is
@@ -691,7 +691,7 @@
 
         /**
          * Perform layout for the minor axis of the box (i.e. the
-         * axis orthoginal to the axis that it represents).  The results
+         * axis orthogonal to the axis that it represents).  The results
          * of the layout should be placed in the given arrays which represent
          * the allocations to the children along the minor axis.  This
          * is called by the superclass whenever the layout needs to be
@@ -701,7 +701,7 @@
          * the span for any cell that spans multiple rows.
          *
          * @param targetSpan the total span given to the view, which
-         *  whould be used to layout the children.
+         *  would be used to layout the children.
          * @param axis the axis being layed out.
          * @param offsets the offsets from the origin of the view for
          *  each of the child views.  This is a return value and is
--- a/jdk/src/share/classes/javax/swing/text/View.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/View.java	Wed Jul 05 19:21:26 2017 +0200
@@ -128,7 +128,7 @@
     A view should set any settings needed.
     <li>A <code>View</code> is inherently transparent.  While a view may render into its
     entire allocation, typically a view does not.  Rendering is performed by
-    tranversing down the tree of <code>View</code> implementations.
+    traversing down the tree of <code>View</code> implementations.
     Each <code>View</code> is responsible
     for rendering its children.  This behavior is depended upon for thread
     safety.  While view implementations do not necessarily have to be implemented
@@ -324,7 +324,7 @@
      * the view has been removed from the hierarchy as
      * well. When this method is called to set the parent to
      * null, this method does the same for each of its children,
-     * propogating the notification that they have been
+     * propagating the notification that they have been
      * disconnected from the view tree. If this is
      * reimplemented, <code>super.setParent()</code> should
      * be called.
@@ -476,8 +476,12 @@
      * Some views may not be visible,
      * they might not be in the same order found in the model, or they just
      * might not allow access to some of the locations in the model.
+     * This method enables specifying a position to convert
+     * within the range of &gt;=0.  If the value is -1, a position
+     * will be calculated automatically.  If the value &lt; -1,
+     * the {@code BadLocationException} will be thrown.
      *
-     * @param pos the position to convert &gt;= 0
+     * @param pos the position to convert
      * @param a the allocated region in which to render
      * @param direction the direction from the current position that can
      *  be thought of as the arrow keys typically found on a keyboard.
@@ -490,7 +494,8 @@
      * </ul>
      * @return the location within the model that best represents the next
      *  location visual position
-     * @exception BadLocationException
+     * @exception BadLocationException the given position is not a valid
+     *                                 position within the document
      * @exception IllegalArgumentException if <code>direction</code>
      *          doesn't have one of the legal values above
      */
--- a/jdk/src/share/classes/javax/swing/text/WrappedPlainView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/WrappedPlainView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -380,8 +380,8 @@
     public void setSize(float width, float height) {
         updateMetrics();
         if ((int) width != getWidth()) {
-            // invalidate the view itself since the childrens
-            // desired widths will be based upon this views width.
+            // invalidate the view itself since the desired widths
+            // of the children will be based upon this views width.
             preferenceChanged(null, true, true);
             widthChanging = true;
         }
--- a/jdk/src/share/classes/javax/swing/text/ZoneView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/ZoneView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -60,7 +60,7 @@
  *   Boxes are easier to estimate the size of than some other shapes.
  *   </ul>
  * <p>
- * The default behavior is controled by two properties, maxZoneSize
+ * The default behavior is controlled by two properties, maxZoneSize
  * and maxZonesLoaded.  Setting maxZoneSize to Integer.MAX_VALUE would
  * have the effect of causing only one zone to be created.  This would
  * effectively turn the view into an implementation of the decorator
@@ -144,7 +144,7 @@
      * Called by a zone when it gets loaded.  This happens when
      * an attempt is made to display or perform a model/view
      * translation on a zone that was in an unloaded state.
-     * This is imlemented to check if the maximum number of
+     * This is implemented to check if the maximum number of
      * zones was reached and to unload the oldest zone if so.
      *
      * @param zone the child view that was just loaded.
--- a/jdk/src/share/classes/javax/swing/text/html/AccessibleHTML.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/AccessibleHTML.java	Wed Jul 05 19:21:26 2017 +0200
@@ -276,7 +276,7 @@
          * a set of predefined roles.  This enables assistive technologies to
          * provide a consistent interface to various tweaked subclasses of
          * components (e.g., use AccessibleRole.PUSH_BUTTON for all components
-         * that act like a push button) as well as distinguish between sublasses
+         * that act like a push button) as well as distinguish between subclasses
          * that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes
          * and AccessibleRole.RADIO_BUTTON for radio buttons).
          * <p>Note that the AccessibleRole class is also extensible, so
@@ -893,7 +893,7 @@
              * a set of predefined roles.  This enables assistive technologies to
              * provide a consistent interface to various tweaked subclasses of
              * components (e.g., use AccessibleRole.PUSH_BUTTON for all components
-             * that act like a push button) as well as distinguish between sublasses
+             * that act like a push button) as well as distinguish between subclasses
              * that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes
              * and AccessibleRole.RADIO_BUTTON for radio buttons).
              * <p>Note that the AccessibleRole class is also extensible, so
@@ -1192,7 +1192,7 @@
              * If there is no selection, but there is
              * a caret, the start and end offsets will be the same.
              *
-             * @return the index into teh text of the end of the selection
+             * @return the index into the text of the end of the selection
              */
             public int getSelectionEnd() {
                 return editor.getSelectionEnd();
@@ -1327,7 +1327,7 @@
              * a set of predefined roles.  This enables assistive technologies to
              * provide a consistent interface to various tweaked subclasses of
              * components (e.g., use AccessibleRole.PUSH_BUTTON for all components
-             * that act like a push button) as well as distinguish between sublasses
+             * that act like a push button) as well as distinguish between subclasses
              * that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes
              * and AccessibleRole.RADIO_BUTTON for radio buttons).
              * <p>Note that the AccessibleRole class is also extensible, so
@@ -1628,7 +1628,7 @@
              * a set of predefined roles.  This enables assistive technologies to
              * provide a consistent interface to various tweaked subclasses of
              * components (e.g., use AccessibleRole.PUSH_BUTTON for all components
-             * that act like a push button) as well as distinguish between sublasses
+             * that act like a push button) as well as distinguish between subclasses
              * that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes
              * and AccessibleRole.RADIO_BUTTON for radio buttons).
              * <p>Note that the AccessibleRole class is also extensible, so
--- a/jdk/src/share/classes/javax/swing/text/html/BlockView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/BlockView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -106,7 +106,7 @@
 
     /**
      * Calculate the requirements of the block along the minor
-     * axis (i.e. the axis orthoginal to the axis along with it tiles).
+     * axis (i.e. the axis orthogonal to the axis along with it tiles).
      * This is implemented
      * to provide the superclass behavior and then adjust it if the
      * CSS width or height attribute is specified and applicable to
@@ -218,13 +218,13 @@
 
     /**
      * Performs layout for the minor axis of the box (i.e. the
-     * axis orthoginal to the axis that it represents). The results
+     * axis orthogonal to the axis that it represents). The results
      * of the layout (the offset and span for each children) are
      * placed in the given arrays which represent the allocations to
      * the children along the minor axis.
      *
      * @param targetSpan the total span given to the view, which
-     *  whould be used to layout the childre.
+     *  would be used to layout the children.
      * @param axis the axis being layed out
      * @param offsets the offsets from the origin of the view for
      *  each of the child views; this is a return value and is
--- a/jdk/src/share/classes/javax/swing/text/html/CSS.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java	Wed Jul 05 19:21:26 2017 +0200
@@ -49,7 +49,7 @@
  * CSS attributes to determine how they will render. This also defines
  * methods to map between CSS/HTML/StyleConstants. Any shorthand
  * properties, such as font, are mapped to the intrinsic properties.
- * <p>The following describes the CSS properties that are suppored by the
+ * <p>The following describes the CSS properties that are supported by the
  * rendering engine:
  * <ul><li>font-family
  *   <li>font-style
@@ -3070,7 +3070,7 @@
                     }
                 }
                 if (!valid) {
-                    // Part is non-parseable or occured more than once.
+                    // Part is non-parseable or occurred more than once.
                     return;
                 }
             }
--- a/jdk/src/share/classes/javax/swing/text/html/CSSParser.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/CSSParser.java	Wed Jul 05 19:21:26 2017 +0200
@@ -513,7 +513,7 @@
      * hit.
      */
     // NOTE: this could be combined with readTill, as they contain somewhat
-    // similiar functionality.
+    // similar functionality.
     private boolean getIdentifier(char stopChar) throws IOException {
         boolean lastWasEscape = false;
         boolean done = false;
--- a/jdk/src/share/classes/javax/swing/text/html/FormSubmitEvent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/FormSubmitEvent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -29,7 +29,7 @@
 
 /**
  * FormSubmitEvent is used to notify interested
- * parties that a form was submited.
+ * parties that a form was submitted.
  *
  * @since 1.5
  * @author    Denis Sharypov
--- a/jdk/src/share/classes/javax/swing/text/html/FormView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/FormView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -663,7 +663,7 @@
 
                     if (type != null && type.equals("submit") &&
                         next != getElement()) {
-                        // do nothing - this submit isnt the trigger
+                        // do nothing - this submit is not the trigger
                     } else if (type == null || !type.equals("image")) {
                         // images only result in data if they triggered
                         // the submit and they require that the mouse click
--- a/jdk/src/share/classes/javax/swing/text/html/FrameSetView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/FrameSetView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -157,7 +157,7 @@
      * to the children along the major axis.
      *
      * @param targetSpan the total span given to the view, which
-     *  whould be used to layout the children
+     *  would be used to layout the children
      * @param axis the axis being layed out
      * @param offsets the offsets from the origin of the view for
      *  each of the child views; this is a return value and is
@@ -267,7 +267,7 @@
             // they share priority, however, unspecified what happens when
             // overallocation occurs.)
 
-            // addendum is that we behave similiar to netscape in that specified
+            // addendum is that we behave similar to netscape in that specified
             // widths have precedance over percentage widths...
 
             float vTotal = (float)(targetSpan - remainingSpace);
--- a/jdk/src/share/classes/javax/swing/text/html/HTML.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/HTML.java	Wed Jul 05 19:21:26 2017 +0200
@@ -303,7 +303,7 @@
         }
 
         /**
-         * Compares this object to the specifed object.
+         * Compares this object to the specified object.
          * The result is <code>true</code> if and only if the argument is not
          * <code>null</code> and is an <code>UnknownTag</code> object
          * with the same name.
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java	Wed Jul 05 19:21:26 2017 +0200
@@ -184,7 +184,6 @@
  * of various methods described above.</p>
  *
  * <table border=1 cellspacing=0>
- *   <caption></caption>
  *   <tr>
  *     <th>Example</th>
  *     <th><code>insertAfterStart</code></th>
@@ -262,8 +261,8 @@
  * not be compatible with future Swing releases. The current
  * serialization support is appropriate for short term storage or RMI
  * between applications running the same version of Swing.  As of 1.4,
- * support for long term storage of all JavaBeans<sup><font
- * size="-2">TM</font></sup> has been added to the
+ * support for long term storage of all JavaBeans&trade;
+ * has been added to the
  * <code>java.beans</code> package.  Please see {@link
  * java.beans.XMLEncoder}.</p>
  *
@@ -1012,7 +1011,7 @@
      * If either <code>elem</code> or <code>htmlText</code> parameter
      * is <code>null</code>, no changes are made to the document.</p>
      *
-     * <p>For this to work correcty, the document must have an
+     * <p>For this to work correctly, the document must have an
      * <code>HTMLEditorKit.Parser</code> set. This will be the case
      * if the document was created from an HTMLEditorKit via the
      * <code>createDefaultDocument</code> method.</p>
@@ -1054,7 +1053,7 @@
      * a newline present if one is needed. This may result in an additional
      * element being inserted. Consider, if you were to replace a character
      * element that contained a newline with &lt;img&gt; this would create
-     * two elements, one for the image, ane one for the newline.</p>
+     * two elements, one for the image, and one for the newline.</p>
      *
      * <p>If you try to replace the element at length you will most
      * likely end up with two elements, eg
@@ -1090,7 +1089,7 @@
      * parameter is <code>null</code>, no changes are made to the
      * document.</p>
      *
-     * <p>For this to work correcty, the document must have an
+     * <p>For this to work correctly, the document must have an
      * HTMLEditorKit.Parser set. This will be the case if the document
      * was created from an HTMLEditorKit via the
      * <code>createDefaultDocument</code> method.</p>
@@ -1167,7 +1166,7 @@
      * If either <code>elem</code> or <code>htmlText</code> parameter
      * is <code>null</code>, no changes are made to the document.</p>
      *
-     * <p>For this to work correcty, the document must have an
+     * <p>For this to work correctly, the document must have an
      * <code>HTMLEditorKit.Parser</code> set. This will be the case
      * if the document was created from an HTMLEditorKit via the
      * <code>createDefaultDocument</code> method.</p>
@@ -1237,7 +1236,7 @@
      * If either <code>elem</code> or <code>htmlText</code> parameter
      * is <code>null</code>, no changes are made to the document.</p>
      *
-     * <p>For this to work correcty, the document must have an
+     * <p>For this to work correctly, the document must have an
      * <code>HTMLEditorKit.Parser</code> set. This will be the case
      * if the document was created from an HTMLEditorKit via the
      * <code>createDefaultDocument</code> method.</p>
@@ -1301,7 +1300,7 @@
      * parameter is <code>null</code>, no changes are made to the
      * document.</p>
      *
-     * <p>For this to work correcty, the document must have an
+     * <p>For this to work correctly, the document must have an
      * <code>HTMLEditorKit.Parser</code> set. This will be the case
      * if the document was created from an HTMLEditorKit via the
      * <code>createDefaultDocument</code> method.</p>
@@ -1359,7 +1358,7 @@
      * parameter is <code>null</code>, no changes are made to the
      * document.</p>
      *
-     * <p>For this to work correcty, the document must have an
+     * <p>For this to work correctly, the document must have an
      * <code>HTMLEditorKit.Parser</code> set. This will be the case
      * if the document was created from an HTMLEditorKit via the
      * <code>createDefaultDocument</code> method.</p>
@@ -3345,7 +3344,7 @@
                     String type = (String)
                         attr.getAttribute(HTML.Attribute.TYPE);
                     /*
-                     * if type is not defined teh default is
+                     * if type is not defined the default is
                      * assumed to be text.
                      */
                     if (type == null) {
@@ -3735,7 +3734,7 @@
             int size = parseBuffer.size();
             if (insertTagDepthDelta < 0) {
                 // When inserting via an insertTag, the depths (of the tree
-                // being read in, and existing hiearchy) may not match up.
+                // being read in, and existing hierarchy) may not match up.
                 // This attemps to clean it up.
                 int removeCounter = insertTagDepthDelta;
                 while (removeCounter < 0 && size >= 0 &&
@@ -3974,7 +3973,7 @@
         private boolean receivedEndHTML;
         /** Number of times <code>flushBuffer</code> has been invoked. */
         private int flushCount;
-        /** If true, behavior is similiar to insertTag, but instead of
+        /** If true, behavior is similar to insertTag, but instead of
          * waiting for insertTag will wait for first Element without
          * an 'implied' attribute and begin inserting then. */
         private boolean insertAfterImplied;
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java	Wed Jul 05 19:21:26 2017 +0200
@@ -69,7 +69,7 @@
  * exactly as defined in the HTML document.
  * <p>
  * The modeling of HTML is provided by the class <code>HTMLDocument</code>.
- * Its documention describes the details of how the HTML is modeled.
+ * Its documentation describes the details of how the HTML is modeled.
  * The editing support leverages heavily off of the text package.
  * <p>
  * <dt>
@@ -80,7 +80,7 @@
  * features.
  * <ol>
  *   <li>
- *   The parser is replacable.  The default parser is the Hot Java
+ *   The parser is replaceable.  The default parser is the Hot Java
  *   parser which is DTD based.  A different DTD can be used, or an
  *   entirely different parser can be used.  To change the parser,
  *   reimplement the getParser method.  The default parser is
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLFrameHyperlinkEvent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLFrameHyperlinkEvent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -92,7 +92,7 @@
      * @param source the object responsible for the event
      * @param type the event type
      * @param targetURL the affected URL
-     * @param desc a desription
+     * @param desc a description
      * @param sourceElement the element that corresponds to the source
      *                      of the event
      * @param targetFrame the Frame to display the document in
@@ -109,7 +109,7 @@
      * @param source the object responsible for the event
      * @param type the event type
      * @param targetURL the affected URL
-     * @param desc a desription
+     * @param desc a description
      * @param sourceElement the element that corresponds to the source
      *                      of the event
      * @param inputEvent  InputEvent that triggered the hyperlink event
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLWriter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLWriter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -750,7 +750,7 @@
 
     /**
      * Searches the attribute set and for each tag
-     * that is stored in the tag vector.  If the tag isnt found,
+     * that is stored in the tag vector.  If the tag is not found,
      * then the tag is removed from the vector and a corresponding
      * end tag is written out.
      *
--- a/jdk/src/share/classes/javax/swing/text/html/OptionListModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/OptionListModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -502,7 +502,7 @@
      * leadIndex and newLeadIndex is the new one.
      * <p>
      * If the value at the anchor index is not selected, do the same thing in reverse,
-     * selecting values in the old range and deslecting values in the new one.
+     * selecting values in the old range and deselecting values in the new one.
      * <p>
      * Generate a single event for this change and notify all listeners.
      * For the purposes of generating minimal bounds in this event, do the
--- a/jdk/src/share/classes/javax/swing/text/html/ParagraphView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/ParagraphView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -211,7 +211,7 @@
 
     /**
      * Renders using the given rendering surface and area on that
-     * surface.  This is implemented to delgate to the superclass
+     * surface.  This is implemented to delegate to the superclass
      * after stashing the base coordinate for tab calculations.
      *
      * @param g the rendering surface to use
--- a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java	Wed Jul 05 19:21:26 2017 +0200
@@ -105,7 +105,7 @@
  * background. But if the html file also contains the CSS rule
  * <code>body { background: blue }</code> it becomes less clear as to
  * what color the background of the body should be. The current
- * implemention gives visual attributes defined in the element the
+ * implementation gives visual attributes defined in the element the
  * highest precedence, that is they are always checked before any styles.
  * Therefore, in the previous example the background would have a
  * red color as the body element defines the background color to be red.
@@ -938,7 +938,7 @@
     /**
      * Sets the base font size from the passed in String. The string
      * can either identify a specific font size, with legal values between
-     * 1 and 7, or identifiy a relative font size such as +1 or -2.
+     * 1 and 7, or identify a relative font size such as +1 or -2.
      */
     public void setBaseFontSize(String size) {
         css.setBaseFontSize(size);
@@ -1035,7 +1035,7 @@
     }
 
     //
-    // The following gaggle of methods is used in maintaing the rules from
+    // The following gaggle of methods is used in maintaining the rules from
     // the sheet.
     //
 
@@ -2959,13 +2959,13 @@
                 return true;
             }
             if (thisDotIndex != -1) {
-                // Reciever references a class, just check element name.
+                // Receiver references a class, just check element name.
                 return (((thisDotIndex - thisCurrent) == (sLast - sCurrent)) &&
                         selector.regionMatches(sCurrent, name, thisCurrent,
                                                thisDotIndex - thisCurrent));
             }
             if (thisPoundIndex != -1) {
-                // Reciever references an id, just check element name.
+                // Receiver references an id, just check element name.
                 return (((thisPoundIndex - thisCurrent) ==(sLast - sCurrent))&&
                         selector.regionMatches(sCurrent, name, thisCurrent,
                                                thisPoundIndex - thisCurrent));
@@ -2977,7 +2977,7 @@
         }
 
         /**
-         * Similiar to String.indexOf, but allows an upper bound
+         * Similar to String.indexOf, but allows an upper bound
          * (this is slower in that it will still check string starting at
          * start.
          */
--- a/jdk/src/share/classes/javax/swing/text/html/TableView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/TableView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -620,7 +620,7 @@
 
     /**
      * Perform layout for the minor axis of the box (i.e. the
-     * axis orthoginal to the axis that it represents).  The results
+     * axis orthogonal to the axis that it represents).  The results
      * of the layout should be placed in the given arrays which represent
      * the allocations to the children along the minor axis.  This
      * is called by the superclass whenever the layout needs to be
@@ -632,7 +632,7 @@
      * of the tables rows.
      *
      * @param targetSpan the total span given to the view, which
-     *  whould be used to layout the children
+     *  would be used to layout the children
      * @param axis the axis being layed out
      * @param offsets the offsets from the origin of the view for
      *  each of the child views.  This is a return value and is
@@ -675,7 +675,7 @@
      * with border spacing and border collapsing capabilities.
      *
      * @param targetSpan the total span given to the view, which
-     *  whould be used to layout the children
+     *  would be used to layout the children
      * @param axis the axis being layed out
      * @param offsets the offsets from the origin of the view for
      *  each of the child views; this is a return value and is
@@ -1169,7 +1169,7 @@
         }
 
         /**
-         * Fixup preferences to accomodate a multi-row table cell
+         * Fixup preferences to accommodate a multi-row table cell
          * if not already covered by existing preferences.  This is
          * a no-op if not all of the rows needed (to do this check/fixup)
          * have arrived yet.
@@ -1523,7 +1523,7 @@
          * the multi-column span.
          *
          * @param targetSpan the total span given to the view, which
-         *  whould be used to layout the children
+         *  would be used to layout the children
          * @param axis the axis being layed out
          * @param offsets the offsets from the origin of the view for
          *  each of the child views; this is a return value and is
@@ -1564,7 +1564,7 @@
 
         /**
          * Perform layout for the minor axis of the box (i.e. the
-         * axis orthoginal to the axis that it represents).  The results
+         * axis orthogonal to the axis that it represents).  The results
          * of the layout should be placed in the given arrays which represent
          * the allocations to the children along the minor axis.  This
          * is called by the superclass whenever the layout needs to be
@@ -1574,7 +1574,7 @@
          * the span for any cell that spans multiple rows.
          *
          * @param targetSpan the total span given to the view, which
-         *  whould be used to layout the children
+         *  would be used to layout the children
          * @param axis the axis being layed out
          * @param offsets the offsets from the origin of the view for
          *  each of the child views; this is a return value and is
@@ -1716,7 +1716,7 @@
          * (i.e. position according to the html valign attribute).
          *
          * @param targetSpan the total span given to the view, which
-         *  whould be used to layout the children
+         *  would be used to layout the children
          * @param axis the axis being layed out
          * @param offsets the offsets from the origin of the view for
          *  each of the child views; this is a return value and is
--- a/jdk/src/share/classes/javax/swing/text/html/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 <body bgcolor="white">
 
--- a/jdk/src/share/classes/javax/swing/text/html/parser/ContentModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/ContentModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -34,7 +34,7 @@
  * A representation of a content model. A content model is
  * basically a restricted BNF expression. It is restricted in
  * the sense that it must be deterministic. This means that you
- * don't have to represent it as a finite state automata.<p>
+ * don't have to represent it as a finite state automaton.<p>
  * See Annex H on page 556 of the SGML handbook for more information.
  *
  * @author   Arthur van Hoff
--- a/jdk/src/share/classes/javax/swing/text/html/parser/DocumentParser.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/DocumentParser.java	Wed Jul 05 19:21:26 2017 +0200
@@ -69,7 +69,7 @@
  * a String value of 'neat' and the String key 'foo' with a String value of
  * 'bar'.
  * <p>The position argument will indicate the start of the tag, comment
- * or text. Similiar to arrays, the first character in the stream has a
+ * or text. Similar to arrays, the first character in the stream has a
  * position of 0. For tags that are
  * implied the position will indicate
  * the location of the next encountered tag. In the first example,
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Element.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Element.java	Wed Jul 05 19:21:26 2017 +0200
@@ -32,7 +32,7 @@
 
 /**
  * An element as described in a DTD using the ELEMENT construct.
- * This is essentiall the description of a tag. It describes the
+ * This is essential the description of a tag. It describes the
  * type, content model, attributes, attribute types etc. It is used
  * to correctly parse a document by the Parser.
  *
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java	Wed Jul 05 19:21:26 2017 +0200
@@ -547,7 +547,7 @@
         // The use of all error recovery strategies are contingent
         // on the value of the strict property.
         //
-        // These are commonly occuring errors.  if insertTag is true,
+        // These are commonly occurring errors.  if insertTag is true,
         // then we want to adopt an error recovery strategy that
         // involves attempting to insert an additional tag to
         // legalize the context.  The two errors addressed here
@@ -606,7 +606,7 @@
         // They try to find a legal context by checking if the current
         // tag is valid in an enclosing context.  If so
         // close out the tags by outputing end tags and then
-        // insert the curent tag.  If the tags that are
+        // insert the current tag.  If the tags that are
         // being closed out do not have an optional end tag
         // specification in the DTD then an html error is
         // reported.
@@ -1761,7 +1761,7 @@
 
             // find the corresponding start tag
 
-            // A commonly occuring error appears to be the insertion
+            // A commonly occurring error appears to be the insertion
             // of extra end tags in a table.  The intent here is ignore
             // such extra end tags.
             //
@@ -1769,7 +1769,7 @@
                 String stackElem = stack.elem.getName();
 
                 if (stackElem.equals("table")) {
-                    // If it isnt a valid end tag ignore it and return
+                    // If it is not a valid end tag ignore it and return
                     //
                     if (!elem.getName().equals(stackElem)) {
                         error("tag.ignore", elem.getName());
--- a/jdk/src/share/classes/javax/swing/text/html/parser/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 <body bgcolor="white">
 
--- a/jdk/src/share/classes/javax/swing/text/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 <body bgcolor="white">
 
--- a/jdk/src/share/classes/javax/swing/text/rtf/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/text/rtf/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 <body bgcolor="white">
 
--- a/jdk/src/share/classes/javax/swing/tree/AbstractLayoutCache.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/AbstractLayoutCache.java	Wed Jul 05 19:21:26 2017 +0200
@@ -68,7 +68,7 @@
 
     /**
      * Sets the renderer that is responsible for drawing nodes in the tree
-     * and which is threfore responsible for calculating the dimensions of
+     * and which is therefore responsible for calculating the dimensions of
      * individual nodes.
      *
      * @param nd a <code>NodeDimensions</code> object
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellEditor.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellEditor.java	Wed Jul 05 19:21:26 2017 +0200
@@ -45,7 +45,7 @@
  * If you do not supply a <code>TreeCellEditor</code>,
  * a <code>TextField</code> will be used. Editing is started
  * on a triple mouse click, or after a click, pause, click and
- * a delay of 1200 miliseconds.
+ * a delay of 1200 milliseconds.
  *<p>
  * <strong>Warning:</strong>
  * Serialized objects of this class will not be compatible with
@@ -173,7 +173,7 @@
      * Sets the font to edit with. <code>null</code> indicates
      * the renderers font should be used. This will NOT
      * override any font you have set in the editor
-     * the receiver was instantied with. If <code>null</code>
+     * the receiver was instantiated with. If <code>null</code>
      * for an editor was passed in a default editor will be
      * created that will pick up this font.
      *
@@ -216,7 +216,7 @@
                                         isSelected, expanded,leaf, row);
 
 
-        // this is kept for backwards compatability but isn't really needed
+        // this is kept for backwards compatibility but isn't really needed
         // with the current BasicTreeUI implementation.
         TreePath        newPath = tree.getPathForRow(row);
 
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -62,8 +62,8 @@
  * {@code DefaultTreeCellRenderer} property and defaults table key:
  * <table border="1" cellpadding="1" cellspacing="0" summary="">
  *   <tr valign="top"  align="left">
- *     <th bgcolor="#CCCCFF" align="left">Property:
- *     <th bgcolor="#CCCCFF" align="left">Key:
+ *     <th style="background-color:#CCCCFF" align="left">Property:
+ *     <th style="background-color:#CCCCFF" align="left">Key:
  *   <tr><td>"leafIcon"<td>"Tree.leafIcon"
  *   <tr><td>"closedIcon"<td>"Tree.closedIcon"
  *   <tr><td>"openIcon"<td>"Tree.openIcon"
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -357,7 +357,7 @@
 
     /**
       * Invoke this method if you've totally changed the children of
-      * node and its childrens children...  This will post a
+      * node and its children's children...  This will post a
       * treeStructureChanged event.
       */
     public void nodeStructureChanged(TreeNode node) {
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1123,7 +1123,7 @@
     /**
      * This method is obsolete and its implementation is now a noop.  It's
      * still called by setSelectionPaths and addSelectionPaths, but only
-     * for backwards compatability.
+     * for backwards compatibility.
      */
     protected void insureUniqueness() {
     }
--- a/jdk/src/share/classes/javax/swing/tree/FixedHeightLayoutCache.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/FixedHeightLayoutCache.java	Wed Jul 05 19:21:26 2017 +0200
@@ -936,7 +936,7 @@
         }
 
         /**
-         * Recreates the receivers path, and all its childrens paths.
+         * Recreates the receivers path, and all its children's paths.
          */
         protected void resetChildrenPaths(TreePath parentPath) {
             removeMapping(this);
@@ -1079,7 +1079,7 @@
         }
 
         /**
-         * Resets the receivers childrens rows. Starting with the child
+         * Resets the receivers children's rows. Starting with the child
          * at <code>childIndex</code> (and <code>modelIndex</code>) to
          * <code>newRow</code>. This uses <code>setRowAndChildren</code>
          * to recursively descend children, and uses
@@ -1346,7 +1346,7 @@
                         return true;
                     }
                     else {
-                        // May have been in last childs bounds.
+                        // May have been in last child's bounds.
                         int          lastChildEndRow = 1 + child.row -
                                      (child.childIndex - lastChild.childIndex);
 
@@ -1474,7 +1474,7 @@
     /**
      * An enumerator to iterate through visible nodes.
      */
-    // This is very similiar to
+    // This is very similar to
     // VariableHeightTreeState.VisibleTreeStateNodeEnumeration
     private class VisibleFHTreeStateNodeEnumeration
         implements Enumeration<TreePath>
--- a/jdk/src/share/classes/javax/swing/tree/TreeModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/TreeModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -30,7 +30,7 @@
  * The model used by <code>JTree</code>.
  * <p>
  * <code>JTree</code> and its related classes make extensive use of
- * <code>TreePath</code>s for indentifying nodes in the <code>TreeModel</code>.
+ * <code>TreePath</code>s for identifying nodes in the <code>TreeModel</code>.
  * If a <code>TreeModel</code> returns the same object, as compared by
  * <code>equals</code>, at two different indices under the same parent
  * than the resulting <code>TreePath</code> objects will be considered equal
--- a/jdk/src/share/classes/javax/swing/tree/TreeSelectionModel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/TreeSelectionModel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -47,7 +47,7 @@
   *
   * A TreeSelectionModel can be configured to allow only one
   * path (<code>SINGLE_TREE_SELECTION</code>) a number of
-  * continguous paths (<code>CONTIGUOUS_TREE_SELECTION</code>) or a number of
+  * contiguous paths (<code>CONTIGUOUS_TREE_SELECTION</code>) or a number of
   * discontiguous paths (<code>DISCONTIGUOUS_TREE_SELECTION</code>).
   * A <code>RowMapper</code> is used to determine if TreePaths are
   * contiguous.
--- a/jdk/src/share/classes/javax/swing/tree/VariableHeightLayoutCache.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/VariableHeightLayoutCache.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1315,7 +1315,7 @@
         //
 
         /**
-         * Recreates the receivers path, and all its childrens paths.
+         * Recreates the receivers path, and all its children's paths.
          */
         protected void resetChildrenPaths(TreePath parentPath) {
             removeMapping(this);
--- a/jdk/src/share/classes/javax/swing/tree/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 <body bgcolor="white">
 
--- a/jdk/src/share/classes/javax/swing/undo/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/undo/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -25,7 +25,7 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<title></title>
 </head>
 <body bgcolor="white">
 
--- a/jdk/src/share/classes/javax/xml/crypto/KeySelector.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/xml/crypto/KeySelector.java	Wed Jul 05 19:21:26 2017 +0200
@@ -34,7 +34,7 @@
 /**
  * A selector that finds and returns a key using the data contained in a
  * {@link KeyInfo} object. An example of an implementation of
- * this class is one that searchs a {@link java.security.KeyStore} for
+ * this class is one that searches a {@link java.security.KeyStore} for
  * trusted keys that match information contained in a <code>KeyInfo</code>.
  *
  * <p>Whether or not the returned key is trusted and the mechanisms
--- a/jdk/src/share/classes/javax/xml/crypto/MarshalException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/xml/crypto/MarshalException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -36,7 +36,7 @@
 import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
 
 /**
- * Indicates an exceptional condition that occured during the XML
+ * Indicates an exceptional condition that occurred during the XML
  * marshalling or unmarshalling process.
  *
  * <p>A <code>MarshalException</code> can contain a cause: another
--- a/jdk/src/share/classes/javax/xml/crypto/dsig/TransformException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/TransformException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -31,7 +31,7 @@
 import java.io.PrintWriter;
 
 /**
- * Indicates an exceptional condition that occured while executing a
+ * Indicates an exceptional condition that occurred while executing a
  * transform algorithm.
  *
  * <p>A <code>TransformException</code> can contain a cause: another
--- a/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignatureException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/javax/xml/crypto/dsig/XMLSignatureException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -31,7 +31,7 @@
 import java.io.PrintWriter;
 
 /**
- * Indicates an exceptional condition that occured during the XML
+ * Indicates an exceptional condition that occurred during the XML
  * signature generation or validation process.
  *
  * <p>An <code>XMLSignatureException</code> can contain a cause: another
--- a/jdk/src/share/classes/jdi-overview.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/jdi-overview.html	Wed Jul 05 19:21:26 2017 +0200
@@ -6,7 +6,7 @@
   <body>
 	The Java<sup><font size="-2">TM</font></sup>
  Debug Interface (JDI) is a high level Java
-API providing information useful for debuggers and similiar
+API providing information useful for debuggers and similar
 systems needing access to the running state of a (usually remote)
 virtual machine.
 <p>
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/Frame.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/Frame.java	Wed Jul 05 19:21:26 2017 +0200
@@ -537,7 +537,7 @@
     /**
      * The types that are initialized in the basic block. A constructor
      * invocation on an UNINITIALIZED or UNINITIALIZED_THIS type must replace
-     * <i>every occurence</i> of this type in the local variables and in the
+     * <i>every occurrence</i> of this type in the local variables and in the
      * operand stack. This cannot be done during the first phase of the
      * algorithm since, during this phase, the local variables and the operand
      * stack are not completely computed. It is therefore necessary to store the
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -404,7 +404,7 @@
      *         instruction of the method. The size of the returned array is
      *         equal to the number of instructions (and labels) of the method. A
      *         given frame is <tt>null</tt> if the corresponding instruction
-     *         cannot be reached, or if an error occured during the analysis of
+     *         cannot be reached, or if an error occurred during the analysis of
      *         the method.
      */
     public Frame<V>[] getFrames() {
--- a/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Interpreter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Interpreter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -111,7 +111,7 @@
      *            the bytecode instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occured during the interpretation.
+     *             if an error occurred during the interpretation.
      */
     public abstract V newOperation(AbstractInsnNode insn)
             throws AnalyzerException;
@@ -130,7 +130,7 @@
      * @return the result of the interpretation of the given instruction. The
      *         returned value must be <tt>equal</tt> to the given value.
      * @throws AnalyzerException
-     *             if an error occured during the interpretation.
+     *             if an error occurred during the interpretation.
      */
     public abstract V copyOperation(AbstractInsnNode insn, V value)
             throws AnalyzerException;
@@ -151,7 +151,7 @@
      *            the argument of the instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occured during the interpretation.
+     *             if an error occurred during the interpretation.
      */
     public abstract V unaryOperation(AbstractInsnNode insn, V value)
             throws AnalyzerException;
@@ -175,7 +175,7 @@
      *            the second argument of the instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occured during the interpretation.
+     *             if an error occurred during the interpretation.
      */
     public abstract V binaryOperation(AbstractInsnNode insn, V value1, V value2)
             throws AnalyzerException;
@@ -196,7 +196,7 @@
      *            the third argument of the instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occured during the interpretation.
+     *             if an error occurred during the interpretation.
      */
     public abstract V ternaryOperation(AbstractInsnNode insn, V value1,
             V value2, V value3) throws AnalyzerException;
@@ -214,7 +214,7 @@
      *            the arguments of the instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occured during the interpretation.
+     *             if an error occurred during the interpretation.
      */
     public abstract V naryOperation(AbstractInsnNode insn,
             List<? extends V> values) throws AnalyzerException;
@@ -232,7 +232,7 @@
      * @param expected
      *            the expected return type of the analyzed method.
      * @throws AnalyzerException
-     *             if an error occured during the interpretation.
+     *             if an error occurred during the interpretation.
      */
     public abstract void returnOperation(AbstractInsnNode insn, V value,
             V expected) throws AnalyzerException;
--- a/jdk/src/share/classes/jdk/internal/org/xml/sax/EntityResolver.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/jdk/internal/org/xml/sax/EntityResolver.java	Wed Jul 05 19:21:26 2017 +0200
@@ -55,7 +55,7 @@
  *
  * <p>Many SAX applications will not need to implement this interface,
  * but it will be especially useful for applications that build
- * XML documents from databases or other specialised input sources,
+ * XML documents from databases or other specialized input sources,
  * or for applications that use URI types other than URLs.</p>
  *
  * <p>The following resolver would provide the application
--- a/jdk/src/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java	Wed Jul 05 19:21:26 2017 +0200
@@ -27,6 +27,7 @@
 
 import java.io.*;
 import java.util.InvalidPropertiesFormatException;
+import java.util.Map.Entry;
 import java.util.Properties;
 import jdk.internal.org.xml.sax.Attributes;
 import jdk.internal.org.xml.sax.InputSource;
@@ -107,12 +108,17 @@
                 writer.writeEndElement();
             }
 
-            for (String key : props.stringPropertyNames()) {
-                String val = props.getProperty(key);
-                writer.writeStartElement(ELEMENT_ENTRY);
-                writer.writeAttribute(ATTR_KEY, key);
-                writer.writeCharacters(val);
-                writer.writeEndElement();
+            synchronized(props) {
+                for (Entry<Object, Object> e : props.entrySet()) {
+                    final Object k = e.getKey();
+                    final Object v = e.getValue();
+                    if (k instanceof String && v instanceof String) {
+                        writer.writeStartElement(ELEMENT_ENTRY);
+                        writer.writeAttribute(ATTR_KEY, (String)k);
+                        writer.writeCharacters((String)v);
+                        writer.writeEndElement();
+                    }
+                }
             }
 
             writer.writeEndElement();
--- a/jdk/src/share/classes/jdk/internal/util/xml/XMLStreamException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/jdk/internal/util/xml/XMLStreamException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -50,7 +50,7 @@
     }
 
     /**
-     * Construct an exception with the assocated message.
+     * Construct an exception with the associated message.
      *
      * @param msg the message to report
      */
@@ -59,7 +59,7 @@
     }
 
     /**
-     * Construct an exception with the assocated exception
+     * Construct an exception with the associated exception
      *
      * @param th a nested exception
      */
@@ -69,7 +69,7 @@
     }
 
     /**
-     * Construct an exception with the assocated message and exception
+     * Construct an exception with the associated message and exception
      *
      * @param th a nested exception
      * @param msg the message to report
--- a/jdk/src/share/classes/jdk/internal/util/xml/impl/Parser.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/jdk/internal/util/xml/impl/Parser.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1052,7 +1052,7 @@
                         case 'X':
                         case ':':
                             bkch();
-                            //          Get the attribut from the list or add a new one.
+                            //          Get the attribute from the list or add a new one.
                             attqn = qname(mIsNSAware);
                             att = find(elm.list, attqn);
                             if (att == null) {
@@ -2960,7 +2960,7 @@
      * Parses the xml text declaration.
      *
      * This method gets encoding from the xml text declaration [#4.3.1] if any.
-     * The method assumes the buffer (mChars) is big enough to accomodate whole
+     * The method assumes the buffer (mChars) is big enough to accommodate whole
      * xml text declaration.
      *
      * @param reader is entity reader.
--- a/jdk/src/share/classes/org/ietf/jgss/GSSContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/org/ietf/jgss/GSSContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1094,7 +1094,7 @@
      * side  and it has to be done prior to the first call to
      * <code>initSecContext</code>.<p>
      *
-     * The actual lifetime of the context will depend on the capabilites of
+     * The actual lifetime of the context will depend on the capabilities of
      * the underlying mechanism and the application should call the {@link
      * #getLifetime() getLifetime} method to determine this.<p>
      *
--- a/jdk/src/share/classes/org/ietf/jgss/GSSCredential.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/org/ietf/jgss/GSSCredential.java	Wed Jul 05 19:21:26 2017 +0200
@@ -203,7 +203,7 @@
      * expire.  A return value of 0 indicates that the credential element is
      * already expired.
      *
-     * @param mech the Oid of the mechanism whose intiator credential element
+     * @param mech the Oid of the mechanism whose initiator credential element
      * should be queried.
      *
      * @throws GSSException containing the following
--- a/jdk/src/share/classes/org/ietf/jgss/GSSException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/org/ietf/jgss/GSSException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -291,7 +291,7 @@
      * this exception to be thrown. Major error codes are
      * defined at the mechanism independent GSS-API level in this
      * class. Mechanism specific error codes that might provide more
-     * information aer set as the minor error code.
+     * information are set as the minor error code.
      *
      * @return int the GSS-API level major error code causing this exception
      * @see #getMajorString
--- a/jdk/src/share/classes/org/ietf/jgss/GSSManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/org/ietf/jgss/GSSManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -214,7 +214,7 @@
      * the namespace type parameter indicates NT_EXPORT_NAME or when the
      * GSS-API implementation is not multi-mechanism. It is
      * not recommended to use this method with a NT_EXPORT_NAME type because
-     * representing a previously exported name consisting of abitrary bytes
+     * representing a previously exported name consisting of arbitrary bytes
      * as a String might cause problems with character encoding schemes. In
      * such cases it is recommended that the bytes be passed in directly to
      * the overloaded form of this method {@link #createName(byte[],
--- a/jdk/src/share/classes/org/ietf/jgss/GSSName.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/org/ietf/jgss/GSSName.java	Wed Jul 05 19:21:26 2017 +0200
@@ -45,7 +45,7 @@
  * single-mechanism environments where the underlying mechanism supports
  * multiple namespaces). Different name formats and their definitions are
  * identified with {@link Oid Oid's} and some standard types
- * are defind in this interface. The format of the names can be derived
+ * are defined in this interface. The format of the names can be derived
  * based on the unique <code>Oid</code> of its name type.<p>
  *
  * Included below are code examples utilizing the <code>GSSName</code> interface.
--- a/jdk/src/share/classes/org/ietf/jgss/package.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/org/ietf/jgss/package.html	Wed Jul 05 19:21:26 2017 +0200
@@ -86,9 +86,9 @@
 
     This model does require that a {@link
     javax.security.auth.login JAAS login} be performed in order to
-    authenticate and populate a Subject that the JGSS mechnanism can later 
+    authenticate and populate a Subject that the JGSS mechanism can later 
     utilize. However, applications have the ability to relax this
-    restiction by means of a system property:
+    restriction by means of a system property:
     <code>javax.security.auth.useSubjectCredsOnly</code>. By default
     this system property will be assumed to be <code>true</code> (even when
     it is unset) indicating that providers must only use the credentials
--- a/jdk/src/share/classes/sun/applet/AppletClassLoader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/applet/AppletClassLoader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -239,6 +239,7 @@
      * the "localhost".
      *
      * @param codesource the codesource
+     * @throws NullPointerException if {@code codesource} is {@code null}.
      * @return the permissions granted to the codesource
      */
     protected PermissionCollection getPermissions(CodeSource codesource)
--- a/jdk/src/share/classes/sun/applet/AppletSecurity.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/applet/AppletSecurity.java	Wed Jul 05 19:21:26 2017 +0200
@@ -140,7 +140,7 @@
          * fix bug # 6433620 the logic here is : try to find URLClassLoader from
          * class context, check its AccessControlContext to see if
          * AppletClassLoader is in stack when it's created. for this kind of
-         * URLClassLoader, return the AppContext assocated with the
+         * URLClassLoader, return the AppContext associated with the
          * AppletClassLoader.
          */
         for (int i = 0; i < context.length; i++) {
@@ -304,7 +304,7 @@
      *
      * @since   JDK1.1
      * @exception  SecurityException  if the caller does not have
-     *             permission to accesss the AWT event queue.
+     *             permission to access the AWT event queue.
      */
     public void checkAwtEventQueueAccess() {
         AppContext appContext = AppContext.getAppContext();
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java	Wed Jul 05 19:21:26 2017 +0200
@@ -31,6 +31,7 @@
 import java.awt.KeyboardFocusManager;
 import java.awt.DefaultKeyboardFocusManager;
 import java.awt.event.InputEvent;
+import java.awt.event.InvocationEvent;
 import java.awt.event.KeyEvent;
 import java.awt.geom.Point2D;
 import java.awt.peer.ComponentPeer;
@@ -721,6 +722,13 @@
     }
 
     /*
+     * An accessor object for the InvocationEvent class
+     */
+    public interface InvocationEventAccessor {
+        void dispose(InvocationEvent event);
+    }
+
+    /*
      * Accessor instances are initialized in the static initializers of
      * corresponding AWT classes by using setters defined below.
      */
@@ -748,6 +756,7 @@
     private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor;
     private static SequencedEventAccessor sequencedEventAccessor;
     private static ToolkitAccessor toolkitAccessor;
+    private static InvocationEventAccessor invocationEventAccessor;
 
     /*
      * Set an accessor object for the java.awt.Component class.
@@ -1159,4 +1168,18 @@
 
         return toolkitAccessor;
     }
+
+    /*
+     * Get the accessor object for the java.awt.event.InvocationEvent class.
+     */
+    public static void setInvocationEventAccessor(InvocationEventAccessor invocationEventAccessor) {
+        AWTAccessor.invocationEventAccessor = invocationEventAccessor;
+    }
+
+    /*
+     * Set the accessor object for the java.awt.event.InvocationEvent class.
+     */
+    public static InvocationEventAccessor getInvocationEventAccessor() {
+        return invocationEventAccessor;
+    }
 }
--- a/jdk/src/share/classes/sun/awt/AppContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/awt/AppContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -167,6 +167,9 @@
      */
     private static volatile AppContext mainAppContext = null;
 
+    private static class GetAppContextLock {};
+    private final static Object getAppContextLock = new GetAppContextLock();
+
     /*
      * The hash map associated with this AppContext.  A private delegate
      * is used instead of subclassing HashMap so as to avoid all of
@@ -309,14 +312,16 @@
                     // if no contexts have been created yet. This covers standalone apps
                     // and excludes applets because by the time applet starts
                     // a number of contexts have already been created by the plugin.
-                    if (numAppContexts.get() == 0) {
-                        if (System.getProperty("javaplugin.version") == null &&
-                                System.getProperty("javawebstart.version") == null) {
-                            initMainAppContext();
-                        } else if (System.getProperty("javafx.version") != null &&
-                                threadGroup.getParent() != null) {
-                            // Swing inside JavaFX case
-                            SunToolkit.createNewAppContext();
+                    synchronized (getAppContextLock) {
+                        if (numAppContexts.get() == 0) {
+                            if (System.getProperty("javaplugin.version") == null &&
+                                    System.getProperty("javawebstart.version") == null) {
+                                initMainAppContext();
+                            } else if (System.getProperty("javafx.version") != null &&
+                                    threadGroup.getParent() != null) {
+                                // Swing inside JavaFX case
+                                SunToolkit.createNewAppContext();
+                            }
                         }
                     }
 
--- a/jdk/src/share/classes/sun/awt/FontConfiguration.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1278,7 +1278,7 @@
     //////////////////////////////////////////////////////////////////////
     /* The binary font configuration file begins with a short[] "head", which
      * contains the offsets to the starts of the individual data table which
-     * immediately follow. Teh current implemention includes the tables shown
+     * immediately follow. The current implementation includes the tables shown
      * below.
      *
      * (00) table_scriptIDs    :stringIDs of all defined CharacterSubsetNames
@@ -2119,7 +2119,7 @@
         private void parseProperty(String key, String value) {
             if (key.startsWith("filename.")) {
                 //the only special case is "MingLiu_HKSCS" which has "_" in its
-                //facename, we dont want to replace the "_" with " "
+                //facename, we don't want to replace the "_" with " "
                 key = key.substring(9);
                 if (!"MingLiU_HKSCS".equals(key)) {
                     key = key.replace('_', ' ');
@@ -2224,7 +2224,7 @@
                 proportionals.put(getID(componentFontNameIDs, key),
                                   getID(componentFontNameIDs, value));
             } else {
-                //"name.style.script(.motif)", we dont care anything else
+                //"name.style.script(.motif)", we don't care anything else
                 int dot1, dot2;
                 boolean isMotif = false;
 
--- a/jdk/src/share/classes/sun/awt/GlobalCursorManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/awt/GlobalCursorManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -157,7 +157,7 @@
      *
      * (2) If 'useCache' is true, the native code is free to use a cached
      * value to determine the most specific, visible, enabled heavyweight
-     * because this update is occuring in response to a mouse move. If
+     * because this update is occurring in response to a mouse move. If
      * 'useCache' is false, the native code must perform a new search given
      * the current mouse coordinates.
      *
--- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -1674,6 +1674,15 @@
                 theObject = translateStream(bais, flavor, format, localeTransferable);
             }
 
+        } else if (flavor.isRepresentationClassRemote()) {
+            try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+                 ObjectInputStream ois = new ObjectInputStream(bais))
+            {
+                theObject = RMI.getMarshalledObject(ois.readObject());
+            } catch (Exception e) {
+                throw new IOException(e.getMessage());
+            }
+
             // Target data is Serializable
         } else if (flavor.isRepresentationClassSerializable()) {
 
@@ -1731,6 +1740,14 @@
             }
             theObject = files;
 
+        // Target data is a String. Strip terminating NUL bytes. Decode bytes
+        // into characters. Search-and-replace EOLN.
+        } else if (String.class.equals(flavor.getRepresentationClass()) &&
+                   isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
+
+            return translateBytesToString(inputStreamToByteArray(str),
+                format, localeTransferable);
+
             // Special hack to maintain backwards-compatibility with the brokenness
             // of StringSelection. Return a StringReader instead of an InputStream.
             // Recur to obtain String and encapsulate.
--- a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -271,14 +271,11 @@
                 throw new InvalidDnDOperationException(e.getMessage());
             }
         } else if (ret instanceof InputStream) {
-            InputStream inputStream = (InputStream)ret;
             try {
                 return DataTransferer.getInstance().
-                    translateStream(inputStream, df, format, this);
+                    translateStream((InputStream)ret, df, format, this);
             } catch (IOException e) {
                 throw new InvalidDnDOperationException(e.getMessage());
-            } finally {
-                inputStream.close();
             }
         } else {
             throw new IOException("no native data was transfered");
--- a/jdk/src/share/classes/sun/awt/shell/ShellFolderManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/awt/shell/ShellFolderManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -48,7 +48,7 @@
      *  "fileChooserDefaultFolder":
      *    Returns a <code>File</code> - the default shellfolder for a new filechooser
      *  "roots":
-     *    Returns a <code>File[]</code> - containing the root(s) of the displayable hieararchy
+     *    Returns a <code>File[]</code> - containing the root(s) of the displayable hierarchy
      *  "fileChooserComboBoxFolders":
      *    Returns a <code>File[]</code> - an array of shellfolders representing the list to
      *    show by default in the file chooser's combobox
@@ -73,7 +73,7 @@
                 return homeDir;
             }
         } else if (key.equals("roots")) {
-            // The root(s) of the displayable hieararchy
+            // The root(s) of the displayable hierarchy
             return File.listRoots();
         } else if (key.equals("fileChooserComboBoxFolders")) {
             // Return an array of ShellFolders representing the list to
--- a/jdk/src/share/classes/sun/dc/DuctusRenderingEngine.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/dc/DuctusRenderingEngine.java	Wed Jul 05 19:21:26 2017 +0200
@@ -290,7 +290,7 @@
                  * and Infinity values. Ignoring current path segment in case
                  * of invalid endpoints's data. Equivalent to the SEG_LINETO
                  * if endpoint coordinates are valid but there are invalid data
-                 * amoung other coordinates
+                 * among other coordinates
                  */
                 if (point[2] < UPPER_BND && point[2] > LOWER_BND &&
                     point[3] < UPPER_BND && point[3] > LOWER_BND)
@@ -319,7 +319,7 @@
                  * and Infinity values. Ignoring current path segment in case
                  * of invalid endpoints's data. Equivalent to the SEG_LINETO
                  * if endpoint coordinates are valid but there are invalid data
-                 * amoung other coordinates
+                 * among other coordinates
                  */
                 if (point[4] < UPPER_BND && point[4] > LOWER_BND &&
                     point[5] < UPPER_BND && point[5] > LOWER_BND)
@@ -545,7 +545,7 @@
                      * NaN and Infinity values. Ignoring current path segment
                      * in case of invalid endpoints's data. Equivalent to the
                      * SEG_LINETO if endpoint coordinates are valid but there
-                     * are invalid data amoung other coordinates
+                     * are invalid data among other coordinates
                      */
                     if (point[2] < UPPER_BND && point[2] > LOWER_BND &&
                         point[3] < UPPER_BND && point[3] > LOWER_BND)
@@ -574,7 +574,7 @@
                      * NaN and Infinity values. Ignoring  current path segment
                      * in case of invalid endpoints's data. Equivalent to the
                      * SEG_LINETO if endpoint coordinates are valid but there
-                     * are invalid data amoung other coordinates
+                     * are invalid data among other coordinates
                      */
 
                     if (point[4] < UPPER_BND && point[4] > LOWER_BND &&
--- a/jdk/src/share/classes/sun/font/ExtendedTextSourceLabel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/font/ExtendedTextSourceLabel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -569,7 +569,7 @@
 * The output maps this to character positions, and therefore caret positions, via the following assumptions:
 * - zero-advance glyphs do not contribute to the advance of their character (i.e. position is ignored), conversely
 *   if a glyph is to contribute to the advance of its character it must have a non-zero (float) advance
-* - no carets can appear between a zero width character and its preceeding character, where 'preceeding' is
+* - no carets can appear between a zero width character and its preceding character, where 'preceding' is
 *   defined logically.
 * - no carets can appear within a split character
 * - no carets can appear within a local reordering (i.e. Indic reordering, or non-adjacent split characters)
--- a/jdk/src/share/classes/sun/font/FileFontStrike.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/font/FileFontStrike.java	Wed Jul 05 19:21:26 2017 +0200
@@ -189,7 +189,7 @@
 
         /* Always segment for fonts with > 256 glyphs, but also for smaller
          * fonts with non-typical sizes and transforms.
-         * Segmenting for all non-typical pt sizes helps to minimise memory
+         * Segmenting for all non-typical pt sizes helps to minimize memory
          * usage when very many distinct strikes are created.
          * The size range of 0->5 and 37->INF for segmenting is arbitrary
          * but the intention is that typical GUI integer point sizes (6->36)
--- a/jdk/src/share/classes/sun/font/FontManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/font/FontManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -92,7 +92,7 @@
 
     /**
      * If usingPerAppContextComposites is true, we are in "applet"
-     * (eg browser) enviroment and at least one context has selected
+     * (eg browser) environment and at least one context has selected
      * an alternate composite font behaviour.
      */
     public boolean usingPerAppContextComposites();
--- a/jdk/src/share/classes/sun/font/FontRunIterator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/font/FontRunIterator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -90,10 +90,10 @@
      * problems: we optimize latin-1 and cjk text assuming a fixed
      * width for each character.  since latin-1 digits and punctuation
      * are common, following this algorithm they will change to match
-     * the fonts used for the preceeding text, and potentially change metrics.
+     * the fonts used for the preceding text, and potentially change metrics.
      *
      * this also seems to have the potential for changing arbitrary runs of text, e.g.
-     * any number of digits and spaces can change depending on the preceeding (or following!)
+     * any number of digits and spaces can change depending on the preceding (or following!)
      * non-COMMON character's font assignment.  this is not good.
      *
      * since the goal is to enable layout to be performed using as few physical fonts as
--- a/jdk/src/share/classes/sun/font/LayoutPathImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/font/LayoutPathImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -144,7 +144,7 @@
         /**
          * Reset the builder for a new path.  Datalen is a hint of how many
          * points will be in the path, and the working buffer will be sized
-         * to accomodate at least this number of points.  If datalen is zero,
+         * to accommodate at least this number of points.  If datalen is zero,
          * the working buffer is freed (it will be allocated on first use).
          */
         public void reset(int datalen) {
--- a/jdk/src/share/classes/sun/font/ScriptRun.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/font/ScriptRun.java	Wed Jul 05 19:21:26 2017 +0200
@@ -39,7 +39,7 @@
  * the same script, as defined in the <code>Script</code> class.
  * It implements a simple iterator over an array of characters.
  * The iterator will assign <code>COMMON</code> and <code>INHERITED</code>
- * characters to the same script as the preceeding characters. If the
+ * characters to the same script as the preceding characters. If the
  * COMMON and INHERITED characters are first, they will be assigned to
  * the same script as the following characters.
  *
--- a/jdk/src/share/classes/sun/font/StandardTextSource.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/font/StandardTextSource.java	Wed Jul 05 19:21:26 2017 +0200
@@ -97,7 +97,7 @@
       throw new IllegalArgumentException("bad frc: null");
     }
 
-    this.chars = chars;
+    this.chars = chars.clone();
     this.start = start;
     this.len = len;
     this.cstart = cstart;
@@ -148,7 +148,7 @@
   // TextSource API
 
   public char[] getChars() {
-    return chars;
+    return chars.clone();
   }
 
   public int getStart() {
--- a/jdk/src/share/classes/sun/font/StrikeCache.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/font/StrikeCache.java	Wed Jul 05 19:21:26 2017 +0200
@@ -166,7 +166,7 @@
                 * cache strikes. The default is "soft" which hints to keep
                 * the strikes around. This property allows the client to
                 * override this to "weak" which hint to the GC to free
-                * memory more agressively.
+                * memory more aggressively.
                 */
                String refType =
                    System.getProperty("sun.java2d.font.reftype", "soft");
--- a/jdk/src/share/classes/sun/font/SunFontManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/font/SunFontManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -2814,7 +2814,7 @@
      * these methods will be called very rarely.
      *
      * If _usingPerAppContextComposites is true, we are in "applet"
-     * (eg browser) enviroment and at least one context has selected
+     * (eg browser) environment and at least one context has selected
      * an alternate composite font behaviour.
      * If _usingAlternateComposites is true, we are not in an "applet"
      * environment and the (single) application has selected
--- a/jdk/src/share/classes/sun/font/TextLabelFactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/font/TextLabelFactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -32,7 +32,6 @@
 import java.awt.Font;
 
 import java.awt.font.FontRenderContext;
-import java.awt.font.LineMetrics;
 import java.text.Bidi;
 
   /**
@@ -70,7 +69,7 @@
                           Bidi bidi,
                           int flags) {
     this.frc = frc;
-    this.text = text;
+    this.text = text.clone();
     this.bidi = bidi;
     this.flags = flags;
     this.lineBidi = bidi;
@@ -82,30 +81,10 @@
     return frc;
   }
 
-  public char[] getText() {
-    return text;
-  }
-
-  public Bidi getParagraphBidi() {
-    return bidi;
-  }
-
   public Bidi getLineBidi() {
     return lineBidi;
   }
 
-  public int getLayoutFlags() {
-    return flags;
-  }
-
-  public int getLineStart() {
-    return lineStart;
-  }
-
-  public int getLineLimit() {
-    return lineLimit;
-  }
-
   /**
    * Set a line context for the factory.  Shaping only occurs on this line.
    * Characters are ordered as they would appear on this line.
--- a/jdk/src/share/classes/sun/font/TrueTypeFont.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/font/TrueTypeFont.java	Wed Jul 05 19:21:26 2017 +0200
@@ -630,7 +630,7 @@
      * only one of these ranges then we need to distinguish based on
      * country. So far this only seems to matter for zh.
      * REMIND: Unicode locales such as Hindi do not have a code page so
-     * this whole mechansim needs to be revised to map languages to
+     * this whole mechanism needs to be revised to map languages to
      * the Unicode ranges either when this fails, or as an additional
      * validating test. Basing it on Unicode ranges should get us away
      * from needing to map to this small and incomplete set of Windows
--- a/jdk/src/share/classes/sun/font/Type1Font.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/font/Type1Font.java	Wed Jul 05 19:21:26 2017 +0200
@@ -368,7 +368,7 @@
         String fontType = null;
         try {
             //Parse font looking for explicit FullName, FamilyName and FontName
-            //  (acording to Type1 spec they are optional)
+            //  (according to Type1 spec they are optional)
             while ((fullName == null || familyName == null || psName == null || fontType == null) && !eof) {
                 int tokenType = nextTokenType(bb);
                 if (tokenType == PSNAMETOKEN) {
--- a/jdk/src/share/classes/sun/java2d/SurfaceDataProxy.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/java2d/SurfaceDataProxy.java	Wed Jul 05 19:21:26 2017 +0200
@@ -368,7 +368,7 @@
      * be useful given the operational parameters.
      * This method checks any preexisting cached copy for being "up to date"
      * and tries to update it if it is stale or non-existant and the
-     * appropriate number of accesses have occured since it last was stale.
+     * appropriate number of accesses have occurred since it last was stale.
      * <p>
      * An outline of the process is as follows:
      * <ol>
--- a/jdk/src/share/classes/sun/java2d/loops/ProcessPath.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/java2d/loops/ProcessPath.java	Wed Jul 05 19:21:26 2017 +0200
@@ -744,7 +744,7 @@
 
             /* Checking that we are not running out of the endpoint and bounding
              * violating coordinate.  The check is pretty simple because the
-             * curve passed to the DrawCubic already splitted into the
+             * curve passed to the DrawCubic already split into the
              * monotonic in X and Y pieces
              */
 
@@ -1105,7 +1105,7 @@
 
                 /* Checking that we are not running out of the endpoint and
                  * bounding violating coordinate.  The check is pretty simple
-                 * because the curve passed to the DrawCubic already splitted
+                 * because the curve passed to the DrawCubic already split
                  * into the monotonic in X and Y pieces
                  */
 
--- a/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java	Wed Jul 05 19:21:26 2017 +0200
@@ -720,7 +720,7 @@
 }
 
 /**
- * This general Blit implemenation converts any source surface to an
+ * This general Blit implementation converts any source surface to an
  * intermediate IntArgbPre surface, and then uses the more specific
  * IntArgbPre->OpenGLSurface/Texture loop to get the intermediate
  * (premultiplied) surface down to OpenGL.
--- a/jdk/src/share/classes/sun/java2d/pipe/BufferedMaskFill.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/java2d/pipe/BufferedMaskFill.java	Wed Jul 05 19:21:26 2017 +0200
@@ -120,7 +120,7 @@
                     }
                 }
             } else {
-                // queue is too small to accomodate entire mask; perform
+                // queue is too small to accommodate entire mask; perform
                 // the operation directly on the queue flushing thread
                 rq.flushAndInvokeNow(new Runnable() {
                     public void run() {
--- a/jdk/src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java	Wed Jul 05 19:21:26 2017 +0200
@@ -224,7 +224,7 @@
                 buf.put(xPoints, 0, nPoints);
                 buf.put(yPoints, 0, nPoints);
             } else {
-                // queue is too small to accomodate all points; perform the
+                // queue is too small to accommodate all points; perform the
                 // operation directly on the queue flushing thread
                 rq.flushAndInvokeNow(new Runnable() {
                     public void run() {
--- a/jdk/src/share/classes/sun/java2d/pipe/BufferedTextPipe.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/java2d/pipe/BufferedTextPipe.java	Wed Jul 05 19:21:26 2017 +0200
@@ -137,7 +137,7 @@
                 buf.put(positions, 0, 2*totalGlyphs);
             }
         } else {
-            // queue is too small to accomodate glyphs; perform
+            // queue is too small to accommodate glyphs; perform
             // the operation directly on the queue flushing thread
             rq.flushAndInvokeNow(new Runnable() {
                 public void run() {
--- a/jdk/src/share/classes/sun/java2d/pipe/DrawImage.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/java2d/pipe/DrawImage.java	Wed Jul 05 19:21:26 2017 +0200
@@ -128,7 +128,7 @@
 
     /*
      * This method is only called in those circumstances where the
-     * operation has a non-null secondary transform specfied.  Its
+     * operation has a non-null secondary transform specified.  Its
      * role is to check for various optimizations based on the types
      * of both the secondary and SG2D transforms and to do some
      * quick calculations to avoid having to combine the transforms
--- a/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java	Wed Jul 05 19:21:26 2017 +0200
@@ -344,7 +344,7 @@
 
     /**
      * Returns the minimum pen width that the antialiasing rasterizer
-     * can represent without dropouts occuring.
+     * can represent without dropouts occurring.
      * @since 1.7
      */
     public abstract float getMinimumAAPenSize();
--- a/jdk/src/share/classes/sun/java2d/pipe/hw/AccelDeviceEventNotifier.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/java2d/pipe/hw/AccelDeviceEventNotifier.java	Wed Jul 05 19:21:26 2017 +0200
@@ -81,7 +81,7 @@
     }
 
     /**
-     * Called to indicate that a device event had occured.
+     * Called to indicate that a device event had occurred.
      * If a singleton exists, the listeners (those associated with
      * the device) will be notified.
      *
--- a/jdk/src/share/classes/sun/java2d/pisces/PiscesRenderingEngine.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/java2d/pisces/PiscesRenderingEngine.java	Wed Jul 05 19:21:26 2017 +0200
@@ -632,7 +632,7 @@
 
     /**
      * Returns the minimum pen width that the antialiasing rasterizer
-     * can represent without dropouts occuring.
+     * can represent without dropouts occurring.
      * @since 1.7
      */
     public float getMinimumAAPenSize() {
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/PerfDataBufferImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/PerfDataBufferImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -120,7 +120,7 @@
                 }
             } catch (MonitorException e) {
                 /*
-                 * just ignore this here and let the reciever of the
+                 * just ignore this here and let the receiver of the
                  * byte[] detect and handle the problem.
                  */
             }
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/file/FileMonitoredVm.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/file/FileMonitoredVm.java	Wed Jul 05 19:21:26 2017 +0200
@@ -34,7 +34,7 @@
 
 /**
  * Concrete implementation of the AbstractMonitoredVm class for the
- * <em>file:</em> protcol for the HotSpot PerfData monitoring implementation.
+ * <em>file:</em> protocol for the HotSpot PerfData monitoring implementation.
  * <p>
  * This class provides the ability to attach to the instrumentation buffer
  * (saved or live) of a target Java Virtual Machine by providing a
--- a/jdk/src/share/classes/sun/launcher/resources/launcher_pt_BR.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/launcher/resources/launcher_pt_BR.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -34,7 +34,7 @@
 java.launcher.ergo.message2  =\                  porque a execu\u00E7\u00E3o est\u00E1 sendo feita em uma m\u00E1quina de classe de servidor.\n
 
 # Translators please note do not translate the options themselves
-java.launcher.opt.footer     =\    -cp <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n    -classpath <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n                  Uma lista separada por {0} de diret\u00F3rios, archives JAR\n                  e archives ZIP nos quais ser\u00E3o procurados os arquivos de classe.\n    -D<nome>=<valor>\n                  define uma propriedade do sistema\n    -verbose:[classe|gc|jni]\n                  ativa a sa\u00EDda detalhada\n    -version      imprime a vers\u00E3o do produto e sai do programa\n    -version:<valor>\n                  requer a execu\u00E7\u00E3o da vers\u00E3o especificada\n    -showversion  imprime a vers\u00E3o do produto e continua\n    -jre-restrict-search | -no-jre-restrict-search\n                  inclui/exclui JREs privados do usu\u00E1rio na pesquisa de vers\u00E3o\n    -? -help      imprime esta mensagem de ajuda\n    -X            imprime a ajuda sobre op\u00E7\u00F5es n\u00E3o padronizadas\n    -ea[:<nome do pacote>...|:<nome da classe>]\n    -enableassertions[:<nome do pacote>...|:<nome da classe>]\n                  ativa asser\u00E7\u00F5es com granularidade especificada\n    -da[:<nome do pacote>...|:<nome da classe>]\n    -disableassertions[:<nome do pacote>...|:<nome da classe>]\n                  desativa asser\u00E7\u00F5es com granularidade especificada\n    -esa | -enablesystemassertions\n                  ativa asser\u00E7\u00F5es do sistema\n    -dsa | -disablesystemassertions\n                  desativa asser\u00E7\u00F5es do sistema\n    -agentlib:<nome da biblioteca>[=<op\u00E7\u00F5es>]\n                  carrega a biblioteca de agentes nativa <nome da biblioteca>, por exemplo: -agentlib:hprof\n                  consulte tamb\u00E9m: -agentlib:jdwp=help e -agentlib:hprof=help\n    -agentpath:<nome do caminho>[=<op\u00E7\u00F5es>]\n                  carrega a biblioteca de agentes nativa com base no nome do caminho completo\n    -javaagent:<caminho do arquivo jar>[=<op\u00E7\u00F5es>]\n                  carrega o agente da linguagem de programa\u00E7\u00E3o Java; consulte java.lang.instrument\n    -splash:<caminho da imagem>\n                  mostra a tela de abertura com a imagem especificada\nConsulte http://www.oracle.com/technetwork/java/javase/documentation/index.html para obter mais detalhes.
+java.launcher.opt.footer     =\    -cp <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n    -classpath <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n                  Uma lista separada por {0} de diret\u00F3rios, archives JAR\n                  e archives ZIP nos quais ser\u00E3o procurados os arquivos de classe.\n    -D<nome>=<valor>\n                  define uma propriedade do sistema\n    -verbose:[class|gc|jni]\n                  ativa a sa\u00EDda detalhada\n    -version      imprime a vers\u00E3o do produto e sai do programa\n    -version:<valor>\n                  requer a execu\u00E7\u00E3o da vers\u00E3o especificada\n    -showversion  imprime a vers\u00E3o do produto e continua\n    -jre-restrict-search | -no-jre-restrict-search\n                  inclui/exclui JREs privados do usu\u00E1rio na pesquisa de vers\u00E3o\n    -? -help      imprime esta mensagem de ajuda\n    -X            imprime a ajuda sobre op\u00E7\u00F5es n\u00E3o padronizadas\n    -ea[:<nome do pacote>...|:<nome da classe>]\n    -enableassertions[:<nome do pacote>...|:<nome da classe>]\n                  ativa asser\u00E7\u00F5es com granularidade especificada\n    -da[:<nome do pacote>...|:<nome da classe>]\n    -disableassertions[:<nome do pacote>...|:<nome da classe>]\n                  desativa asser\u00E7\u00F5es com granularidade especificada\n    -esa | -enablesystemassertions\n                  ativa asser\u00E7\u00F5es do sistema\n    -dsa | -disablesystemassertions\n                  desativa asser\u00E7\u00F5es do sistema\n    -agentlib:<nome da biblioteca>[=<op\u00E7\u00F5es>]\n                  carrega a biblioteca de agentes nativa <nome da biblioteca>, por exemplo: -agentlib:hprof\n                  consulte tamb\u00E9m: -agentlib:jdwp=help e -agentlib:hprof=help\n    -agentpath:<nome do caminho>[=<op\u00E7\u00F5es>]\n                  carrega a biblioteca de agentes nativa com base no nome do caminho completo\n    -javaagent:<caminho do arquivo jar>[=<op\u00E7\u00F5es>]\n                  carrega o agente da linguagem de programa\u00E7\u00E3o Java; consulte java.lang.instrument\n    -splash:<caminho da imagem>\n                  mostra a tela de abertura com a imagem especificada\nConsulte http://www.oracle.com/technetwork/java/javase/documentation/index.html para obter mais detalhes.
 
 # Translators please note do not translate the options themselves
 java.launcher.X.usage=\    -Xmixed           execu\u00E7\u00E3o no modo misto (default)\n    -Xint             execu\u00E7\u00E3o somente no modo interpretado\n    -Xbootclasspath:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n                      define o caminho de pesquisa para classes e recursos de inicializa\u00E7\u00E3o\n    -Xbootclasspath/a:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n                      anexa no final do caminho da classe de inicializa\u00E7\u00E3o\n    -Xbootclasspath/p:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n                      anexa no in\u00EDcio do caminho da classe de inicializa\u00E7\u00E3o\n    -Xdiag            mostra mensagens de diagn\u00F3stico adicionais\n    -Xnoclassgc       desativa a coleta de lixo da classe\n    -Xincgc           ativa a coleta de lixo incremental\n    -Xloggc:<arquivo>    registra o status do GC status em um arquivo com marca\u00E7\u00F5es de data e hor\u00E1rio\n    -Xbatch           desativa a compila\u00E7\u00E3o em segundo plano\n    -Xms<tamanho>        define o tamanho inicial do heap Java\n    -Xmx<tamanho>        define o tamanho m\u00E1ximo do heap Java\n    -Xss<tamanho>        define o tamanho da pilha de threads java\n    -Xprof            produz dados de perfil da cpu\n    -Xfuture          ativa verifica\u00E7\u00F5es de n\u00EDvel m\u00E1ximo de exig\u00EAncia, prevendo o valor default futuro\n    -Xrs              reduz o uso de sinais do SO pelo(a) Java/VM (consulte a documenta\u00E7\u00E3o)\n    -Xcheck:jni       executa verifica\u00E7\u00F5es adicionais de fun\u00E7\u00F5es da JNI\n    -Xshare:off       n\u00E3o tenta usar dados da classe compartilhada\n    -Xshare:auto      se poss\u00EDvel, usa dados da classe compartilhada (default)\n    -Xshare:on        requer o uso de dados da classe compartilhada, caso contr\u00E1rio haver\u00E1 falha.\n    -XshowSettings    mostra todas as defini\u00E7\u00F5es e continua\n    -XshowSettings:all\n                      mostra todas as defini\u00E7\u00F5es e continua\n    -XshowSettings:vm mostra todas as defini\u00E7\u00F5es relacionadas \u00E0 vm e continua\n    -XshowSettings:properties\n                      mostra todas as defini\u00E7\u00F5es da propriedade e continua\n    -XshowSettings:locale\n                      mostra todas as defini\u00E7\u00F5es relativas \u00E0s configura\u00E7\u00F5es regionais e continua\n\nAs -X options n\u00E3o s\u00E3o padronizadas e est\u00E3o sujeitas a altera\u00E7\u00F5es sem aviso.\n
--- a/jdk/src/share/classes/sun/management/Agent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/management/Agent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -323,7 +323,7 @@
                     : String.format(
                     "service:jmx:rmi:///jndi/rmi://%s:%s/jmxrmi", hostname, jmxremotePort);
 
-            String instanceName = System.getProperty("com.sun.management.jdp.name");
+            String instanceName = props.getProperty("com.sun.management.jdp.name");
 
             try{
                JdpController.startDiscoveryService(address, port, instanceName, jmxUrlStr);
--- a/jdk/src/share/classes/sun/management/counter/perf/InstrumentationException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/management/counter/perf/InstrumentationException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -28,14 +28,14 @@
 public class InstrumentationException extends RuntimeException {
     /**
      * Constructs a <tt>InstrumentationException</tt> with no
-     * detail mesage.
+     * detail message.
      */
      public InstrumentationException() {
      }
 
     /**
      * Constructs a <tt>InstrumentationException</tt> with a specified
-     * detail mesage.
+     * detail message.
      *
      * @param message the detail message
      */
--- a/jdk/src/share/classes/sun/management/counter/perf/PerfDataType.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/management/counter/perf/PerfDataType.java	Wed Jul 05 19:21:26 2017 +0200
@@ -32,7 +32,7 @@
  * performance data.
  *
  * <p> The enumeration values for this typesafe enumeration must be
- * kept in sychronization with the PerfDataType enum in the
+ * kept in synchronization with the PerfDataType enum in the
  * globalsDefinitions.hpp file in the HotSpot source base.</p>
  *
  * @author  Brian Doherty
--- a/jdk/src/share/classes/sun/management/jdp/JdpController.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/management/jdp/JdpController.java	Wed Jul 05 19:21:26 2017 +0200
@@ -29,6 +29,12 @@
 import java.net.UnknownHostException;
 import java.util.UUID;
 
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import sun.management.VMManagement;
+
 /**
  * JdpController is responsible to create and manage a broadcast loop
  *
@@ -126,6 +132,25 @@
         }
     }
 
+    // Get the process id of the current running Java process
+    private static Integer getProcessId() {
+        try {
+            // Get the current process id using a reflection hack
+            RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
+            Field jvm = runtime.getClass().getDeclaredField("jvm");
+            jvm.setAccessible(true);
+
+            VMManagement mgmt = (sun.management.VMManagement) jvm.get(runtime);
+            Method pid_method = mgmt.getClass().getDeclaredMethod("getProcessId");
+            pid_method.setAccessible(true);
+            Integer pid = (Integer) pid_method.invoke(mgmt);
+            return pid;
+        } catch(Exception ex) {
+            return null;
+        }
+    }
+
+
     /**
      * Starts discovery service
      *
@@ -173,6 +198,20 @@
         // it the key is skipped. PacketWriter is responsible to skip keys having null value.
         packet.setInstanceName(instanceName);
 
+        // Set rmi server hostname if it explicitly specified by user with
+        // java.rmi.server.hostname
+        String rmiHostname = System.getProperty("java.rmi.server.hostname");
+        packet.setRmiHostname(rmiHostname);
+
+        // Set broadcast interval
+        packet.setBroadcastInterval(new Integer(pause).toString());
+
+        // Set process id
+        Integer pid = getProcessId();
+        if (pid != null) {
+           packet.setProcessId(pid.toString());
+        }
+
         JdpBroadcaster bcast = new JdpBroadcaster(address, sourceAddress, port, ttl);
 
         // Stop discovery service if it's already running
--- a/jdk/src/share/classes/sun/management/jdp/JdpJmxPacket.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/management/jdp/JdpJmxPacket.java	Wed Jul 05 19:21:26 2017 +0200
@@ -64,11 +64,27 @@
      * Name of Java instance
      */
     public final static String INSTANCE_NAME_KEY = "INSTANCE_NAME";
+    /**
+     * PID of java process, optional presented if it could be obtained
+     */
+    public final static String PROCESS_ID_KEY = "PROCESS_ID";
+    /**
+     * Hostname of rmi server, optional presented if user overrides rmi server
+     * hostname by java.rmi.server.hostname property
+     */
+    public final static String RMI_HOSTNAME_KEY = "RMI_HOSTNAME";
+    /**
+     * Configured broadcast interval, optional
+     */
+    public final static String BROADCAST_INTERVAL_KEY = "BROADCAST_INTERVAL";
 
     private UUID id;
     private String mainClass;
     private String jmxServiceUrl;
     private String instanceName;
+    private String processId;
+    private String rmiHostname;
+    private String broadcastInterval;
 
     /**
      * Create new instance from user provided data. Set mandatory fields
@@ -99,6 +115,9 @@
         this.jmxServiceUrl = p.get(JMX_SERVICE_URL_KEY);
         this.mainClass = p.get(MAIN_CLASS_KEY);
         this.instanceName = p.get(INSTANCE_NAME_KEY);
+        this.processId = p.get(PROCESS_ID_KEY);
+        this.rmiHostname = p.get(RMI_HOSTNAME_KEY);
+        this.broadcastInterval = p.get(BROADCAST_INTERVAL_KEY);
     }
 
     /**
@@ -150,6 +169,30 @@
         return instanceName;
     }
 
+    public String getProcessId() {
+        return processId;
+    }
+
+    public void setProcessId(String processId) {
+        this.processId = processId;
+    }
+
+    public String getRmiHostname() {
+        return rmiHostname;
+    }
+
+    public void setRmiHostname(String rmiHostname) {
+        this.rmiHostname = rmiHostname;
+    }
+
+    public String getBroadcastInterval() {
+        return broadcastInterval;
+    }
+
+    public void setBroadcastInterval(String broadcastInterval) {
+        this.broadcastInterval = broadcastInterval;
+    }
+
     /**
      *
      * @return assembled packet ready to be sent across a Net
@@ -164,6 +207,10 @@
         writer.addEntry(MAIN_CLASS_KEY, mainClass);
         writer.addEntry(JMX_SERVICE_URL_KEY, jmxServiceUrl);
         writer.addEntry(INSTANCE_NAME_KEY, instanceName);
+        writer.addEntry(PROCESS_ID_KEY, processId);
+        writer.addEntry(RMI_HOSTNAME_KEY, rmiHostname);
+        writer.addEntry(BROADCAST_INTERVAL_KEY, broadcastInterval);
+
         return writer.getPacketBytes();
     }
 
--- a/jdk/src/share/classes/sun/misc/CRC16.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/CRC16.java	Wed Jul 05 19:21:26 2017 +0200
@@ -28,7 +28,7 @@
 /**
  * The CRC-16 class calculates a 16 bit cyclic redundancy check of a set
  * of bytes. This error detecting code is used to determine if bit rot
- * has occured in a byte stream.
+ * has occurred in a byte stream.
  */
 
 public class CRC16 {
--- a/jdk/src/share/classes/sun/misc/CharacterDecoder.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/CharacterDecoder.java	Wed Jul 05 19:21:26 2017 +0200
@@ -145,7 +145,7 @@
      * Decode the text from the InputStream and write the decoded
      * octets to the OutputStream. This method runs until the stream
      * is exhausted.
-     * @exception CEFormatException An error has occured while decoding
+     * @exception CEFormatException An error has occurred while decoding
      * @exception CEStreamExhausted The input stream is unexpectedly out of data
      */
     public void decodeBuffer(InputStream aStream, OutputStream bStream) throws IOException {
@@ -181,7 +181,7 @@
     /**
      * Alternate decode interface that takes a String containing the encoded
      * buffer and returns a byte array containing the data.
-     * @exception CEFormatException An error has occured while decoding
+     * @exception CEFormatException An error has occurred while decoding
      */
     public byte decodeBuffer(String inputString)[] throws IOException {
         byte    inputBuffer[] = new byte[inputString.length()];
--- a/jdk/src/share/classes/sun/misc/JavaLangAccess.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/JavaLangAccess.java	Wed Jul 05 19:21:26 2017 +0200
@@ -28,6 +28,7 @@
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Executable;
 import java.security.AccessControlContext;
+import java.util.Map;
 
 import sun.reflect.ConstantPool;
 import sun.reflect.annotation.AnnotationType;
@@ -50,6 +51,11 @@
     AnnotationType getAnnotationType(Class<?> klass);
 
     /**
+     * Get the declared annotations for a given class, indexed by their types.
+     */
+    Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap(Class<?> klass);
+
+    /**
      * Get the array of bytes that is the class-file representation
      * of this Class' annotations.
      */
--- a/jdk/src/share/classes/sun/misc/PerformanceLogger.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/misc/PerformanceLogger.java	Wed Jul 05 19:21:26 2017 +0200
@@ -37,7 +37,7 @@
  * This class is intended to be a central place for the jdk to
  * log timing events of interest.  There is pre-defined event
  * of startTime, as well as a general
- * mechanism of setting aribtrary times in an array.
+ * mechanism of setting arbitrary times in an array.
  * All unreserved times in the array can be used by callers
  * in application-defined situations.  The caller is responsible
  * for setting and getting all times and for doing whatever
--- a/jdk/src/share/classes/sun/net/NetworkClient.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/net/NetworkClient.java	Wed Jul 05 19:21:26 2017 +0200
@@ -244,7 +244,7 @@
      * Sets the read timeout.
      *
      * Note: Public URLConnection (and protocol specific implementations)
-     * protect against negative timeout values being set. This implemenation,
+     * protect against negative timeout values being set. This implementation,
      * and protocol specific implementations, use -1 to represent the default
      * read timeout.
      *
--- a/jdk/src/share/classes/sun/net/TelnetOutputStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/net/TelnetOutputStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -81,7 +81,7 @@
     }
 
     /**
-     * set the stickyCRLF flag. Tells wether the terminal considers CRLF as a single
+     * set the stickyCRLF flag. Tells whether the terminal considers CRLF as a single
      * char.
      *
      * @param   on      the <code>boolean</code> to set the flag to.
--- a/jdk/src/share/classes/sun/net/ftp/FtpClient.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/net/ftp/FtpClient.java	Wed Jul 05 19:21:26 2017 +0200
@@ -267,7 +267,7 @@
      * @param user The user name
      * @param password The password for that user
      * @return this FtpClient
-     * @throws IOException if an error occured during the transmission
+     * @throws IOException if an error occurred during the transmission
      * @throws FtpProtocolException if the login was refused by the server
      */
     public abstract FtpClient login(String user, char[] password) throws FtpProtocolException, IOException;
@@ -378,7 +378,7 @@
      *
      * @param name the name of the remote file
      * @return the {@link java.io.InputStream} from the data connection
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @throws FtpProtocolException if the command was refused by the server
      * @see #setRestartOffset(long)
      */
@@ -398,7 +398,7 @@
      * @param name the name of the remote file to write.
      * @return the {@link java.io.OutputStream} from the data connection or
      *         {@code null} if the command was unsuccessful.
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public OutputStream putFileStream(String name) throws FtpProtocolException, IOException {
@@ -427,7 +427,7 @@
      * @param unique {@code true} if the remote files should be unique,
      *        in which case the STOU command will be used.
      * @return the {@link java.io.OutputStream} from the data connection.
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public abstract OutputStream putFileStream(String name, boolean unique) throws FtpProtocolException, IOException;
@@ -456,7 +456,7 @@
      * @param local the {@code InputStream} that points to the data to
      *        transfer.
      * @return this FtpClient
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public FtpClient putFile(String name, InputStream local) throws FtpProtocolException, IOException {
@@ -481,7 +481,7 @@
      * @param unique {@code true} if the remote file should be unique
      *        (i.e. not already existing), {@code false} otherwise.
      * @return this FtpClient
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @throws FtpProtocolException if the command was rejected by the server
      * @see #getLastFileName()
      */
@@ -500,7 +500,7 @@
      * @param local The {@code InputStream} providing access to the data
      *        to be appended.
      * @return this FtpClient
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public abstract FtpClient appendFile(String name, InputStream local) throws FtpProtocolException, IOException;
@@ -511,7 +511,7 @@
      * @param from the name of the file being renamed
      * @param to the new name for the file
      * @return this FtpClient
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public abstract FtpClient rename(String from, String to) throws FtpProtocolException, IOException;
@@ -522,7 +522,7 @@
      * @param name a {@code String} containing the name of the file
      *        to delete.
      * @return this FtpClient
-     * @throws IOException if an error occured during the exchange
+     * @throws IOException if an error occurred during the exchange
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public abstract FtpClient deleteFile(String name) throws FtpProtocolException, IOException;
@@ -533,7 +533,7 @@
      * @param name a {@code String} containing the name of the directory
      *        to create.
      * @return this FtpClient
-     * @throws IOException if an error occured during the exchange
+     * @throws IOException if an error occurred during the exchange
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public abstract FtpClient makeDirectory(String name) throws FtpProtocolException, IOException;
@@ -545,7 +545,7 @@
      *        to remove.
      *
      * @return this FtpClient
-     * @throws IOException if an error occured during the exchange.
+     * @throws IOException if an error occurred during the exchange.
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public abstract FtpClient removeDirectory(String name) throws FtpProtocolException, IOException;
@@ -555,7 +555,7 @@
      * status or as a <I>keep alive</I> mechanism.
      *
      * @return this FtpClient
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public abstract FtpClient noop() throws FtpProtocolException, IOException;
@@ -572,7 +572,7 @@
      * @param name an optional {@code String} containing the pathname
      *        the STAT command should apply to.
      * @return the response from the server
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public abstract String getStatus(String name) throws FtpProtocolException, IOException;
@@ -602,7 +602,7 @@
      * after an abort.</p>
      *
      * @return this FtpClient
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public abstract FtpClient abort() throws FtpProtocolException, IOException;
@@ -637,7 +637,7 @@
      * </pre>
      * <p>Since {@link #close()} will call completePending() if necessary.</p>
      * @return this FtpClient
-     * @throws IOException if an error occured during the transfer
+     * @throws IOException if an error occurred during the transfer
      * @throws FtpProtocolException if the command didn't complete successfully
      */
     public abstract FtpClient completePending() throws FtpProtocolException, IOException;
@@ -786,7 +786,7 @@
      *        for the current working directoty.
      * @return a {@code Iterator} of files or {@code null} if the
      *         command failed.
-     * @throws IOException if an error occured during the transmission
+     * @throws IOException if an error occurred during the transmission
      * @see #setDirParser(FtpDirParser)
      * @see #changeDirectory(String)
      * @throws FtpProtocolException if the command was rejected by the server
@@ -862,7 +862,7 @@
      * but before calling {@link #login(java.lang.String, char[]) }.</p>
      *
      * @return this FtpCLient
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @throws FtpProtocolException if the command was rejected by the server
      * @see #endSecureSession()
      */
@@ -874,7 +874,7 @@
      * back to a non encrypted transmission.
      *
      * @return this FtpClient
-     * @throws IOException if an error occured during transmission.
+     * @throws IOException if an error occurred during transmission.
      * @throws FtpProtocolException if the command was rejected by the server
      * @see #startSecureSession()
      */
@@ -886,7 +886,7 @@
      *
      * @param size The number of bytes to allocate.
      * @return this FtpClient
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public abstract FtpClient allocate(long size) throws FtpProtocolException, IOException;
@@ -899,7 +899,7 @@
      * @param struct a {@code String} containing the name of the
      *        structure to mount.
      * @return this FtpClient
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public abstract FtpClient structureMount(String struct) throws FtpProtocolException, IOException;
@@ -911,7 +911,7 @@
      *
      * @return a {@code String} describing the OS, or {@code null}
      *         if the operation was not successful.
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public abstract String getSystem() throws FtpProtocolException, IOException;
@@ -924,7 +924,7 @@
      *        {@code null} for the general help
      * @return a {@code String} containing the text sent back by the
      *         server, or {@code null} if the command failed.
-     * @throws IOException if an error occured during transmission
+     * @throws IOException if an error occurred during transmission
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public abstract String getHelp(String cmd) throws FtpProtocolException, IOException;
@@ -936,7 +936,7 @@
      *
      * @param cmd the command to be sent.
      * @return this FtpClient
-     * @throws IOException if an error occured during transmission
+     * @throws IOException if an error occurred during transmission
      * @throws FtpProtocolException if the command was rejected by the server
      */
     public abstract FtpClient siteCmd(String cmd) throws FtpProtocolException, IOException;
--- a/jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java	Wed Jul 05 19:21:26 2017 +0200
@@ -491,7 +491,7 @@
      * Read the reply from the FTP server.
      *
      * @return <code>true</code> if the command was successful
-     * @throws IOException if an error occured
+     * @throws IOException if an error occurred
      */
     private boolean readReply() throws IOException {
         lastReplyCode = FtpReplyCode.find(readServerResponse());
@@ -537,7 +537,7 @@
      *
      * @param cmd String containing the command
      *
-     * @throws FtpProtocolException if an error occured
+     * @throws FtpProtocolException if an error occurred
      */
     private void issueCommandCheck(String cmd) throws sun.net.ftp.FtpProtocolException, IOException {
         if (!issueCommand(cmd)) {
@@ -738,7 +738,7 @@
             // Some FTP servers (like the one on Solaris) are bugged, they
             // will accept the EPRT command but then, the subsequent command
             // (e.g. RETR) will fail, so we have to check BOTH results (the
-            // EPRT cmd then the actual command) to decide wether we should
+            // EPRT cmd then the actual command) to decide whether we should
             // fall back on the older PORT command.
             portCmd = "EPRT |" + ((myAddress instanceof Inet6Address) ? "2" : "1") + "|" +
                     myAddress.getHostAddress() + "|" + portSocket.getLocalPort() + "|";
@@ -1037,7 +1037,7 @@
      * @param user The user name
      * @param password The password for that user
      * @return <code>true</code> if the login was successful.
-     * @throws IOException if an error occured during the transmission
+     * @throws IOException if an error occurred during the transmission
      */
     public sun.net.ftp.FtpClient login(String user, char[] password) throws sun.net.ftp.FtpProtocolException, IOException {
         if (!isConnected()) {
@@ -1262,7 +1262,7 @@
      * @param name the name of the remote file
      * @return the {@link java.io.InputStream} from the data connection, or
      *         <code>null</code> if the command was unsuccessful.
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      */
     public InputStream getFileStream(String name) throws sun.net.ftp.FtpProtocolException, IOException {
         Socket s;
@@ -1311,7 +1311,7 @@
      *        in which case the STOU command will be used.
      * @return the {@link java.io.OutputStream} from the data connection or
      *         <code>null</code> if the command was unsuccessful.
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      */
     public OutputStream putFileStream(String name, boolean unique)
         throws sun.net.ftp.FtpProtocolException, IOException
@@ -1340,7 +1340,7 @@
      * @param unique <code>true</code> if the remote file should be unique
      *        (i.e. not already existing), <code>false</code> otherwise.
      * @return <code>true</code> if the transfer was successful.
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @see #getLastFileName()
      */
     public sun.net.ftp.FtpClient putFile(String name, InputStream local, boolean unique) throws sun.net.ftp.FtpProtocolException, IOException {
@@ -1371,7 +1371,7 @@
      * @param local The <code>InputStream</code> providing access to the data
      *        to be appended.
      * @return <code>true</code> if the transfer was successful.
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      */
     public sun.net.ftp.FtpClient appendFile(String name, InputStream local) throws sun.net.ftp.FtpProtocolException, IOException {
         int mtu = 1500;
@@ -1407,7 +1407,7 @@
      * @param name a <code>String</code> containing the name of the file
      *        to delete.
      * @return <code>true</code> if the command was successful
-     * @throws IOException if an error occured during the exchange
+     * @throws IOException if an error occurred during the exchange
      */
     public sun.net.ftp.FtpClient deleteFile(String name) throws sun.net.ftp.FtpProtocolException, IOException {
         issueCommandCheck("DELE " + name);
@@ -1420,7 +1420,7 @@
      * @param name a <code>String</code> containing the name of the directory
      *        to create.
      * @return <code>true</code> if the operation was successful.
-     * @throws IOException if an error occured during the exchange
+     * @throws IOException if an error occurred during the exchange
      */
     public sun.net.ftp.FtpClient makeDirectory(String name) throws sun.net.ftp.FtpProtocolException, IOException {
         issueCommandCheck("MKD " + name);
@@ -1434,7 +1434,7 @@
      *        to remove.
      *
      * @return <code>true</code> if the operation was successful.
-     * @throws IOException if an error occured during the exchange.
+     * @throws IOException if an error occurred during the exchange.
      */
     public sun.net.ftp.FtpClient removeDirectory(String name) throws sun.net.ftp.FtpProtocolException, IOException {
         issueCommandCheck("RMD " + name);
@@ -1465,7 +1465,7 @@
      *        the STAT command should apply to.
      * @return the response from the server or <code>null</code> if the
      *         command failed.
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      */
     public String getStatus(String name) throws sun.net.ftp.FtpProtocolException, IOException {
         issueCommandCheck((name == null ? "STAT" : "STAT " + name));
@@ -1548,7 +1548,7 @@
      * It tells the server to stop the previous command or transfer.
      *
      * @return <code>true</code> if the command was successful.
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      */
     public sun.net.ftp.FtpClient abort() throws sun.net.ftp.FtpProtocolException, IOException {
         issueCommandCheck("ABOR");
@@ -1871,7 +1871,7 @@
      *        for the current working directoty.
      * @return a <code>Iterator</code> of files or <code>null</code> if the
      *         command failed.
-     * @throws IOException if an error occured during the transmission
+     * @throws IOException if an error occurred during the transmission
      * @see #setDirParser(FtpDirParser)
      * @see #changeDirectory(String)
      */
@@ -2038,7 +2038,7 @@
      * {@link #reInit()} command or a {@link #endSecureSession()} command is issued.
      *
      * @return <code>true</code> if the operation was successful.
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      * @see #endSecureSession()
      */
     public sun.net.ftp.FtpClient startSecureSession() throws sun.net.ftp.FtpProtocolException, IOException {
@@ -2086,7 +2086,7 @@
      * back to a non crypted transmission.
      *
      * @return <code>true</code> if the operation was successful.
-     * @throws IOException if an error occured during transmission.
+     * @throws IOException if an error occurred during transmission.
      * @see #startSecureSession()
      */
     public sun.net.ftp.FtpClient endSecureSession() throws sun.net.ftp.FtpProtocolException, IOException {
@@ -2117,7 +2117,7 @@
      *
      * @param size The number of bytes to allocate.
      * @return <code>true</code> if the operation was successful.
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      */
     public sun.net.ftp.FtpClient allocate(long size) throws sun.net.ftp.FtpProtocolException, IOException {
         issueCommandCheck("ALLO " + size);
@@ -2132,7 +2132,7 @@
      * @param struct a <code>String</code> containing the name of the
      *        structure to mount.
      * @return <code>true</code> if the operation was successful.
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      */
     public sun.net.ftp.FtpClient structureMount(String struct) throws sun.net.ftp.FtpProtocolException, IOException {
         issueCommandCheck("SMNT " + struct);
@@ -2146,7 +2146,7 @@
      *
      * @return a <code>String</code> describing the OS, or <code>null</code>
      *         if the operation was not successful.
-     * @throws IOException if an error occured during the transmission.
+     * @throws IOException if an error occurred during the transmission.
      */
     public String getSystem() throws sun.net.ftp.FtpProtocolException, IOException {
         issueCommandCheck("SYST");
@@ -2166,7 +2166,7 @@
      *        <code>null</code> for the general help
      * @return a <code>String</code> containing the text sent back by the
      *         server, or <code>null</code> if the command failed.
-     * @throws IOException if an error occured during transmission
+     * @throws IOException if an error occurred during transmission
      */
     public String getHelp(String cmd) throws sun.net.ftp.FtpProtocolException, IOException {
         issueCommandCheck("HELP " + cmd);
@@ -2209,7 +2209,7 @@
      *
      * @param cmd the command to be sent.
      * @return <code>true</code> if the command was successful.
-     * @throws IOException if an error occured during transmission
+     * @throws IOException if an error occurred during transmission
      */
     public sun.net.ftp.FtpClient siteCmd(String cmd) throws sun.net.ftp.FtpProtocolException, IOException {
         issueCommandCheck("SITE " + cmd);
--- a/jdk/src/share/classes/sun/net/httpserver/Request.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/net/httpserver/Request.java	Wed Jul 05 19:21:26 2017 +0200
@@ -222,7 +222,7 @@
         ByteBuffer chanbuf;
         byte[] one;
         private boolean closed = false, eof = false;
-        ByteBuffer markBuf; /* reads may be satisifed from this buffer */
+        ByteBuffer markBuf; /* reads may be satisfied from this buffer */
         boolean marked;
         boolean reset;
         int readlimit;
--- a/jdk/src/share/classes/sun/net/idn/StringPrep.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/net/idn/StringPrep.java	Wed Jul 05 19:21:26 2017 +0200
@@ -153,7 +153,7 @@
         }
     }
 
-    // CharTrie implmentation for reading the trie data
+    // CharTrie implementation for reading the trie data
     private StringPrepTrieImpl sprepTrieImpl;
     // Indexes read from the data file
     private int[] indexes;
--- a/jdk/src/share/classes/sun/net/smtp/SmtpProtocolException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/net/smtp/SmtpProtocolException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -28,7 +28,7 @@
 import java.io.IOException;
 
 /**
- * This exeception is thrown when unexpected results are returned during
+ * This exception is thrown when unexpected results are returned during
  * an SMTP session.
  */
 public class SmtpProtocolException extends IOException {
--- a/jdk/src/share/classes/sun/net/www/http/ChunkedInputStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/net/www/http/ChunkedInputStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -755,7 +755,7 @@
      * stream. If the last chunk (and optional trailers) can be read without
      * blocking then the stream is considered hurried.
      * <p>
-     * Note that if an error has occured or we can't get to last chunk
+     * Note that if an error has occurred or we can't get to last chunk
      * without blocking then this stream can't be hurried and should be
      * closed.
      */
--- a/jdk/src/share/classes/sun/net/www/http/HttpClient.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/net/www/http/HttpClient.java	Wed Jul 05 19:21:26 2017 +0200
@@ -247,7 +247,7 @@
     }
 
     /* This class has no public constructor for HTTP.  This method is used to
-     * get an HttpClient to the specifed URL.  If there's currently an
+     * get an HttpClient to the specified URL.  If there's currently an
      * active HttpClient to that server/port, you'll get that one.
      */
     public static HttpClient New(URL url)
--- a/jdk/src/share/classes/sun/net/www/http/PosterOutputStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/net/www/http/PosterOutputStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -81,7 +81,7 @@
     /**
      * Resets the <code>count</code> field of this output
      * stream to zero, so that all currently accumulated output in the
-     * ouput stream is discarded. The output stream can be used again,
+     * output stream is discarded. The output stream can be used again,
      * reusing the already allocated buffer space. If the output stream
      * has been closed, then this method has no effect.
      *
--- a/jdk/src/share/classes/sun/net/www/protocol/http/AuthCacheValue.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/AuthCacheValue.java	Wed Jul 05 19:21:26 2017 +0200
@@ -29,7 +29,7 @@
 import java.net.PasswordAuthentication;
 
 /**
- * AuthCacheValue: interface to minimise exposure to authentication cache
+ * AuthCacheValue: interface to minimize exposure to authentication cache
  * for external users (ie. plugin)
  *
  * @author Michael McMahon
--- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Wed Jul 05 19:21:26 2017 +0200
@@ -903,6 +903,18 @@
 
     private String getHostAndPort(URL url) {
         String host = url.getHost();
+        final String hostarg = host;
+        try {
+            // lookup hostname and use IP address if available
+            host = AccessController.doPrivileged(
+                new PrivilegedExceptionAction<String>() {
+                    public String run() throws IOException {
+                            InetAddress addr = InetAddress.getByName(hostarg);
+                            return addr.getHostAddress();
+                    }
+                }
+            );
+        } catch (PrivilegedActionException e) {}
         int port = url.getPort();
         if (port == -1) {
             String scheme = url.getProtocol();
@@ -2256,7 +2268,7 @@
      * Gets the authentication for an HTTP server, and applies it to
      * the connection.
      * @param authHdr the AuthenticationHeader which tells what auth scheme is
-     * prefered.
+     * preferred.
      */
     @SuppressWarnings("fallthrough")
     private AuthenticationInfo getServerAuthentication (AuthenticationHeader authhdr) {
--- a/jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -840,7 +840,15 @@
             ti = threads.add();
             if (!isOpen())
                 return null;
-            if (size() < position + size) { // Extend file size
+
+            long filesize;
+            do {
+                filesize = nd.size(fd);
+            } while ((filesize == IOStatus.INTERRUPTED) && isOpen());
+            if (!isOpen())
+                return null;
+
+            if (filesize < position + size) { // Extend file size
                 if (!writable) {
                     throw new IOException("Channel not open for writing " +
                         "- cannot extend file to required size");
@@ -849,6 +857,8 @@
                 do {
                     rv = nd.truncate(fd, position + size);
                 } while ((rv == IOStatus.INTERRUPTED) && isOpen());
+                if (!isOpen())
+                    return null;
             }
             if (size == 0) {
                 addr = 0;
--- a/jdk/src/share/classes/sun/nio/cs/ext/DoubleByte.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/ext/DoubleByte.java	Wed Jul 05 19:21:26 2017 +0200
@@ -111,7 +111,6 @@
     public static class Decoder extends CharsetDecoder
                                 implements DelegatableDecoder, ArrayDecoder
     {
-
         final char[][] b2c;
         final char[] b2cSB;
         final int b2Min;
@@ -122,7 +121,12 @@
             return CoderResult.UNDERFLOW;
         }
 
-        protected CoderResult crMalformedOrUnmappable(int b) {
+        protected CoderResult crMalformedOrUnmappable(int b1, int b2) {
+            if (b2c[b1] == B2C_UNMAPPABLE ||                // isNotLeadingByte(b1)
+                b2c[b2] != B2C_UNMAPPABLE ||                // isLeadingByte(b2)
+                decodeSingle(b2) != UNMAPPABLE_DECODING) {  // isSingle(b2)
+                return CoderResult.malformedForLength(1);
+            }
             return CoderResult.unmappableForLength(2);
         }
 
@@ -161,7 +165,7 @@
                         int b2 = sa[sp + 1] & 0xff;
                         if (b2 < b2Min || b2 > b2Max ||
                             (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
-                            return crMalformedOrUnmappable(b1);
+                            return crMalformedOrUnmappable(b1, b2);
                         }
                         inSize++;
                     }
@@ -190,7 +194,7 @@
                         int b2 = src.get() & 0xff;
                         if (b2 < b2Min || b2 > b2Max ||
                             (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING)
-                            return crMalformedOrUnmappable(b1);
+                            return crMalformedOrUnmappable(b1, b2);
                         inSize++;
                     }
                     dst.put(c);
@@ -221,8 +225,13 @@
                 if (c == UNMAPPABLE_DECODING) {
                     if (sp < sl) {
                         int b2 = src[sp++] & 0xff;
-                        if (b2 >= b2Min && b2 <= b2Max) {
-                            c = b2c[b1][b2 - b2Min];
+                        if (b2 < b2Min || b2 > b2Max ||
+                            (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
+                            if (b2c[b1] == B2C_UNMAPPABLE ||  // isNotLeadingByte
+                                b2c[b2] != B2C_UNMAPPABLE ||  // isLeadingByte
+                                decodeSingle(b2) != UNMAPPABLE_DECODING) {
+                                sp--;
+                            }
                         }
                     }
                     if (c == UNMAPPABLE_DECODING) {
@@ -466,8 +475,8 @@
             return CoderResult.UNDERFLOW;
         }
 
-        protected CoderResult crMalformedOrUnmappable(int b) {
-            if (b == SS2 || b == SS3 )
+        protected CoderResult crMalformedOrUnmappable(int b1, int b2) {
+            if (b1 == SS2 || b1 == SS3 )
                 return CoderResult.malformedForLength(1);
             return CoderResult.unmappableForLength(2);
         }
--- a/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java	Wed Jul 05 19:21:26 2017 +0200
@@ -128,7 +128,7 @@
                     "gb2312-1980",
                     "euc-cn",
                     "euccn",
-                    "x-EUC-CN", // 1.4 compatability
+                    "x-EUC-CN", // 1.4 compatibility
                     "EUC_CN" //JDK historical
                 });
 
--- a/jdk/src/share/classes/sun/nio/fs/Util.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/nio/fs/Util.java	Wed Jul 05 19:21:26 2017 +0200
@@ -27,6 +27,9 @@
 
 import java.util.*;
 import java.nio.file.*;
+import java.nio.charset.Charset;
+import java.security.*;
+import sun.security.action.*;
 
 /**
  * Utility methods
@@ -35,6 +38,33 @@
 class Util {
     private Util() { }
 
+    private static final Charset jnuEncoding = Charset.forName(
+        AccessController.doPrivileged(new GetPropertyAction("sun.jnu.encoding")));
+
+    /**
+     * Returns {@code Charset} corresponding to the sun.jnu.encoding property
+     */
+    static Charset jnuEncoding() {
+        return jnuEncoding;
+    }
+
+    /**
+     * Encodes the given String into a sequence of bytes using the {@code Charset}
+     * specified by the sun.jnu.encoding property.
+     */
+    static byte[] toBytes(String s) {
+        return s.getBytes(jnuEncoding);
+    }
+
+    /**
+     * Constructs a new String by decoding the specified array of bytes using the
+     * {@code Charset} specified by the sun.jnu.encoding property.
+     */
+    static String toString(byte[] bytes) {
+        return new String(bytes, jnuEncoding);
+    }
+
+
     /**
      * Splits a string around the given character. The array returned by this
      * method contains each substring that is terminated by the character. Use
--- a/jdk/src/share/classes/sun/print/PSPathGraphics.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/print/PSPathGraphics.java	Wed Jul 05 19:21:26 2017 +0200
@@ -258,7 +258,7 @@
      *
      * @param   img     The image to be drawn.
      *                  This method does nothing if <code>img</code> is null.
-     * @param   xform   Used to tranform the image before drawing.
+     * @param   xform   Used to transform the image before drawing.
      *                  This can be null.
      * @param   bgcolor This color is drawn where the image has transparent
      *                  pixels. If this parameter is null then the
--- a/jdk/src/share/classes/sun/print/PSPrinterJob.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/print/PSPrinterJob.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1644,7 +1644,7 @@
     /*
      * Currently CharToByteConverter.getCharacterEncoding() return values are
      * not fixed yet. These are used as the part of the key of
-     * psfont.propeties. When those name are fixed this routine can
+     * psfont.properties. When those name are fixed this routine can
      * be erased.
      */
     private String makeCharsetName(String name, char[] chs) {
--- a/jdk/src/share/classes/sun/print/PathGraphics.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/print/PathGraphics.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1340,7 +1340,7 @@
      *
      * @param   img     The image to be drawn.
      *                  This method does nothing if <code>img</code> is null.
-     * @param   xform   Used to tranform the image before drawing.
+     * @param   xform   Used to transform the image before drawing.
      *                  This can be null.
      * @param   bgcolor This color is drawn where the image has transparent
      *                  pixels. If this parameter is null then the
--- a/jdk/src/share/classes/sun/print/PrintJob2D.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/print/PrintJob2D.java	Wed Jul 05 19:21:26 2017 +0200
@@ -812,7 +812,7 @@
             currentGraphics.translate(pageFormat.getImageableX(),
                                       pageFormat.getImageableY());
 
-            /* Scale to accomodate AWT's notion of printer resolution */
+            /* Scale to accommodate AWT's notion of printer resolution */
             double awtScale = 72.0/getPageResolutionInternal();
             currentGraphics.scale(awtScale, awtScale);
 
--- a/jdk/src/share/classes/sun/print/RasterPrinterJob.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/print/RasterPrinterJob.java	Wed Jul 05 19:21:26 2017 +0200
@@ -118,6 +118,16 @@
     protected static final int STREAM = 2;
 
     /**
+     * Pageable MAX pages
+     */
+    protected static final int MAX_UNKNOWN_PAGES = 9999;
+
+    protected static final int PD_ALLPAGES = 0x00000000;
+    protected static final int PD_SELECTION = 0x00000001;
+    protected static final int PD_PAGENUMS = 0x00000002;
+    protected static final int PD_NOSELECTION = 0x00000004;
+
+    /**
      * Maximum amount of memory in bytes to use for the
      * buffered image "band". 4Mb is a compromise between
      * limiting the number of bands on hi-res printers and
@@ -195,7 +205,7 @@
     /* Instance Variables */
 
     /**
-     * Used to minimise GC & reallocation of band when printing
+     * Used to minimize GC & reallocation of band when printing
      */
     private int cachedBandWidth = 0;
     private int cachedBandHeight = 0;
@@ -800,6 +810,14 @@
         }
    }
 
+   protected PageFormat getPageFormatFromAttributes() {
+       if (attributes == null) {
+            return null;
+        }
+        return attributeToPageFormat(getPrintService(), this.attributes);
+   }
+
+
    /**
      * Presents the user a dialog for changing properties of the
      * print job interactively.
@@ -1359,34 +1377,7 @@
             setAttributes(attributes);
             // throw exception for invalid destination
             if (destinationAttr != null) {
-                // destinationAttr is null for Destination(new URI(""))
-                // because isAttributeValueSupported returns false in setAttributes
-
-                // Destination(new URI(" ")) throws URISyntaxException
-                File f = new File(destinationAttr);
-                try {
-                    // check if this is a new file and if filename chars are valid
-                    if (f.createNewFile()) {
-                        f.delete();
-                    }
-                } catch (IOException ioe) {
-                    throw new PrinterException("Cannot write to file:"+
-                                               destinationAttr);
-                } catch (SecurityException se) {
-                    //There is already file read/write access so at this point
-                    // only delete access is denied.  Just ignore it because in
-                    // most cases the file created in createNewFile gets overwritten
-                    // anyway.
-                }
-
-                File pFile = f.getParentFile();
-                if ((f.exists() &&
-                     (!f.isFile() || !f.canWrite())) ||
-                    ((pFile != null) &&
-                     (!pFile.exists() || (pFile.exists() && !pFile.canWrite())))) {
-                    throw new PrinterException("Cannot write to file:"+
-                                               destinationAttr);
-                }
+                validateDestination(destinationAttr);
             }
         } else {
             spoolToService(psvc, attributes);
@@ -1509,6 +1500,40 @@
         }
     }
 
+    protected void validateDestination(String dest) throws PrinterException {
+        if (dest == null) {
+            return;
+        }
+        // dest is null for Destination(new URI(""))
+        // because isAttributeValueSupported returns false in setAttributes
+
+        // Destination(new URI(" ")) throws URISyntaxException
+        File f = new File(dest);
+        try {
+            // check if this is a new file and if filename chars are valid
+            if (f.createNewFile()) {
+                f.delete();
+            }
+        } catch (IOException ioe) {
+            throw new PrinterException("Cannot write to file:"+
+                                       dest);
+        } catch (SecurityException se) {
+            //There is already file read/write access so at this point
+            // only delete access is denied.  Just ignore it because in
+            // most cases the file created in createNewFile gets overwritten
+            // anyway.
+        }
+
+        File pFile = f.getParentFile();
+        if ((f.exists() &&
+             (!f.isFile() || !f.canWrite())) ||
+            ((pFile != null) &&
+             (!pFile.exists() || (pFile.exists() && !pFile.canWrite())))) {
+            throw new PrinterException("Cannot write to file:"+
+                                       dest);
+        }
+    }
+
     /**
      * updates a Paper object to reflect the current printer's selected
      * paper size and imageable area for that paper size.
@@ -1755,6 +1780,78 @@
             return mCollate;
     }
 
+    protected final int getSelectAttrib() {
+        if (attributes != null) {
+            SunPageSelection pages =
+                (SunPageSelection)attributes.get(SunPageSelection.class);
+            if (pages == SunPageSelection.RANGE) {
+                return PD_PAGENUMS;
+            } else if (pages == SunPageSelection.SELECTION) {
+                return PD_SELECTION;
+            } else if (pages ==  SunPageSelection.ALL) {
+                return PD_ALLPAGES;
+            }
+        }
+        return PD_NOSELECTION;
+    }
+
+    //returns 1-based index for "From" page
+    protected final int getFromPageAttrib() {
+        if (attributes != null) {
+            PageRanges pageRangesAttr =
+                (PageRanges)attributes.get(PageRanges.class);
+            if (pageRangesAttr != null) {
+                int[][] range = pageRangesAttr.getMembers();
+                return range[0][0];
+            }
+        }
+        return getMinPageAttrib();
+    }
+
+    //returns 1-based index for "To" page
+    protected final int getToPageAttrib() {
+        if (attributes != null) {
+            PageRanges pageRangesAttr =
+                (PageRanges)attributes.get(PageRanges.class);
+            if (pageRangesAttr != null) {
+                int[][] range = pageRangesAttr.getMembers();
+                return range[range.length-1][1];
+            }
+        }
+        return getMaxPageAttrib();
+    }
+
+    protected final int getMinPageAttrib() {
+        if (attributes != null) {
+            SunMinMaxPage s =
+                (SunMinMaxPage)attributes.get(SunMinMaxPage.class);
+            if (s != null) {
+                return s.getMin();
+            }
+        }
+        return 1;
+    }
+
+    protected final int getMaxPageAttrib() {
+        if (attributes != null) {
+            SunMinMaxPage s =
+                (SunMinMaxPage)attributes.get(SunMinMaxPage.class);
+            if (s != null) {
+                return s.getMax();
+            }
+        }
+
+        Pageable pageable = getPageable();
+        if (pageable != null) {
+            int numPages = pageable.getNumberOfPages();
+            if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) {
+                numPages = MAX_UNKNOWN_PAGES;
+            }
+            return  ((numPages == 0) ? 1 : numPages);
+        }
+
+        return Integer.MAX_VALUE;
+    }
     /**
      * Called by the print() method at the start of
      * a print job.
--- a/jdk/src/share/classes/sun/reflect/Reflection.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/reflect/Reflection.java	Wed Jul 05 19:21:26 2017 +0200
@@ -57,6 +57,14 @@
     @CallerSensitive
     public static native Class<?> getCallerClass();
 
+    /**
+     * @deprecated This method will be removed in JDK 9.
+     * This method is a private JDK API and retained temporarily for
+     * existing code to run until a replacement API is defined.
+     */
+    @Deprecated
+    public static native Class<?> getCallerClass(int depth);
+
     /** Retrieves the access flags written to the class file. For
         inner classes these flags may differ from those returned by
         Class.getModifiers(), which searches the InnerClasses
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotatedTypeFactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotatedTypeFactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -95,6 +95,8 @@
             Class<?> clz = (Class)type;
             if (clz.getEnclosingClass() == null)
                 return addTo;
+            if (Modifier.isStatic(clz.getModifiers()))
+                return addNesting(clz.getEnclosingClass(), addTo);
             return addNesting(clz.getEnclosingClass(), addTo.pushInner());
         } else if (type instanceof ParameterizedType) {
             ParameterizedType t = (ParameterizedType)type;
@@ -166,7 +168,7 @@
 
         @Override
         public <T extends Annotation> T[] getDeclaredAnnotationsByType(Class<T> annotation) {
-            return AnnotationSupport.getMultipleAnnotations(annotations, annotation);
+            return AnnotationSupport.getDirectlyAndIndirectlyPresent(annotations, annotation);
         }
 
         // AnnotatedType
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationSupport.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationSupport.java	Wed Jul 05 19:21:26 2017 +0200
@@ -28,109 +28,212 @@
 import java.lang.annotation.*;
 import java.lang.reflect.*;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
+
+import sun.misc.JavaLangAccess;
 
 public final class AnnotationSupport {
+    private static final JavaLangAccess LANG_ACCESS = sun.misc.SharedSecrets.getJavaLangAccess();
+
     /**
-     * Finds and returns all annotation of the type indicated by
-     * {@code annotationClass} from the {@code Map} {@code
-     * annotationMap}. Looks into containers of the {@code
-     * annotationClass} (as specified by an the {@code
-     * annotationClass} type being meta-annotated with an {@code
-     * Repeatable} annotation).
+     * Finds and returns all annotations in {@code annotations} matching
+     * the given {@code annoClass}.
+     *
+     * Apart from annotations directly present in {@code annotations} this
+     * method searches for annotations inside containers i.e. indirectly
+     * present annotations.
      *
-     * @param annotationMap the {@code Map} used to store annotations indexed by their type
-     * @param annotationClass the type of annotation to search for
+     * The order of the elements in the array returned depends on the iteration
+     * order of the provided map. Specifically, the directly present annotations
+     * come before the indirectly present annotations if and only if the
+     * directly present annotations come before the indirectly present
+     * annotations in the map.
      *
-     * @return an array of instances of {@code annotationClass} or an empty array if none were found
+     * @param annotations the {@code Map} in which to search for annotations
+     * @param annoClass the type of annotation to search for
+     *
+     * @return an array of instances of {@code annoClass} or an empty
+     *         array if none were found
      */
-    public static  <A extends Annotation> A[] getMultipleAnnotations(
-            final Map<Class<? extends Annotation>, Annotation> annotationMap,
-            final Class<A> annotationClass) {
-        final List<A> res = new ArrayList<A>();
+    public static <A extends Annotation> A[] getDirectlyAndIndirectlyPresent(
+            Map<Class<? extends Annotation>, Annotation> annotations,
+            Class<A> annoClass) {
+        List<A> result = new ArrayList<A>();
 
         @SuppressWarnings("unchecked")
-        final A candidate = (A)annotationMap.get(annotationClass);
-        if (candidate != null) {
-            res.add(candidate);
+        A direct = (A) annotations.get(annoClass);
+        if (direct != null)
+            result.add(direct);
+
+        A[] indirect = getIndirectlyPresent(annotations, annoClass);
+        if (indirect != null && indirect.length != 0) {
+            boolean indirectFirst = direct == null ||
+                                    containerBeforeContainee(annotations, annoClass);
+
+            result.addAll((indirectFirst ? 0 : 1), Arrays.asList(indirect));
         }
 
-        final Class<? extends Annotation> containerClass = getContainer(annotationClass);
-        if (containerClass != null) {
-            res.addAll(unpackAll(annotationMap.get(containerClass), annotationClass));
-        }
+        @SuppressWarnings("unchecked")
+        A[] arr = (A[]) Array.newInstance(annoClass, result.size());
+        return result.toArray(arr);
+    }
 
-        @SuppressWarnings("unchecked") // should be safe annotationClass is a token for A
-        final A[] emptyTemplateArray = (A[])Array.newInstance(annotationClass, 0);
-        return res.isEmpty() ? emptyTemplateArray : res.toArray(emptyTemplateArray);
+    /**
+     * Finds and returns all annotations matching the given {@code annoClass}
+     * indirectly present in {@code annotations}.
+     *
+     * @param annotations annotations to search indexed by their types
+     * @param annoClass the type of annotation to search for
+     *
+     * @return an array of instances of {@code annoClass} or an empty array if no
+     *         indirectly present annotations were found
+     */
+    private static <A extends Annotation> A[] getIndirectlyPresent(
+            Map<Class<? extends Annotation>, Annotation> annotations,
+            Class<A> annoClass) {
+
+        Repeatable repeatable = annoClass.getDeclaredAnnotation(Repeatable.class);
+        if (repeatable == null)
+            return null;  // Not repeatable -> no indirectly present annotations
+
+        Class<? extends Annotation> containerClass = repeatable.value();
+
+        Annotation container = annotations.get(containerClass);
+        if (container == null)
+            return null;
+
+        // Unpack container
+        A[] valueArray = getValueArray(container);
+        checkTypes(valueArray, container, annoClass);
+
+        return valueArray;
     }
 
-    /** Helper to get the container, or null if none, of an annotation. */
-    private static <A extends Annotation> Class<? extends Annotation> getContainer(Class<A> annotationClass) {
-        Repeatable containingAnnotation = annotationClass.getDeclaredAnnotation(Repeatable.class);
-        return (containingAnnotation == null) ? null : containingAnnotation.value();
+
+    /**
+     * Figures out if conatiner class comes before containee class among the
+     * keys of the given map.
+     *
+     * @return true if container class is found before containee class when
+     *         iterating over annotations.keySet().
+     */
+    private static <A extends Annotation> boolean containerBeforeContainee(
+            Map<Class<? extends Annotation>, Annotation> annotations,
+            Class<A> annoClass) {
+
+        Class<? extends Annotation> containerClass =
+                annoClass.getDeclaredAnnotation(Repeatable.class).value();
+
+        for (Class<? extends Annotation> c : annotations.keySet()) {
+            if (c == containerClass) return true;
+            if (c == annoClass) return false;
+        }
+
+        // Neither containee nor container present
+        return false;
     }
 
-    /** Reflectively look up and get the returned array from the the
-     * invocation of the value() element on an instance of an
-     * Annotation.
+
+    /**
+     * Finds and returns all associated annotations matching the given class.
+     *
+     * The order of the elements in the array returned depends on the iteration
+     * order of the provided maps. Specifically, the directly present annotations
+     * come before the indirectly present annotations if and only if the
+     * directly present annotations come before the indirectly present
+     * annotations in the relevant map.
+     *
+     * @param declaredAnnotations the declared annotations indexed by their types
+     * @param decl the class declaration on which to search for annotations
+     * @param annoClass the type of annotation to search for
+     *
+     * @return an array of instances of {@code annoClass} or an empty array if none were found.
      */
-    private static  <A extends Annotation> A[] getValueArray(Annotation containerInstance) {
+    public static <A extends Annotation> A[] getAssociatedAnnotations(
+            Map<Class<? extends Annotation>, Annotation> declaredAnnotations,
+            Class<?> decl,
+            Class<A> annoClass) {
+        Objects.requireNonNull(decl);
+
+        // Search declared
+        A[] result = getDirectlyAndIndirectlyPresent(declaredAnnotations, annoClass);
+
+        // Search inherited
+        if(AnnotationType.getInstance(annoClass).isInherited()) {
+            Class<?> superDecl = decl.getSuperclass();
+            while (result.length == 0 && superDecl != null) {
+                result = getDirectlyAndIndirectlyPresent(LANG_ACCESS.getDeclaredAnnotationMap(superDecl), annoClass);
+                superDecl = superDecl.getSuperclass();
+            }
+        }
+
+        return result;
+    }
+
+
+    /* Reflectively invoke the values-method of the given annotation
+     * (container), cast it to an array of annotations and return the result.
+     */
+    private static <A extends Annotation> A[] getValueArray(Annotation container) {
         try {
-            // the spec tells us the container must have an array-valued
-            // value element. Get the AnnotationType, get the "value" element
-            // and invoke it to get the contents.
+            // According to JLS the container must have an array-valued value
+            // method. Get the AnnotationType, get the "value" method and invoke
+            // it to get the content.
 
-            Class<? extends Annotation> containerClass = containerInstance.annotationType();
+            Class<? extends Annotation> containerClass = container.annotationType();
             AnnotationType annoType = AnnotationType.getInstance(containerClass);
             if (annoType == null)
-                throw new AnnotationFormatError(containerInstance + " is an invalid container for repeating annotations");
+                throw invalidContainerException(container, null);
 
             Method m = annoType.members().get("value");
             if (m == null)
-                throw new AnnotationFormatError(containerInstance +
-                                                          " is an invalid container for repeating annotations");
+                throw invalidContainerException(container, null);
+
             m.setAccessible(true);
 
-            @SuppressWarnings("unchecked") // not provably safe, but we catch the ClassCastException
-            A[] a = (A[])m.invoke(containerInstance); // this will erase to (Annotation[]) but we
-                                                      // do a runtime cast on the return-value
-                                                      // in the methods that call this method
-            return a;
-        } catch (IllegalAccessException | // couldnt loosen security
-                 IllegalArgumentException | // parameters doesn't match
+            // This will erase to (Annotation[]) but we do a runtime cast on the
+            // return-value in the method that call this method.
+            @SuppressWarnings("unchecked")
+            A[] values = (A[]) m.invoke(container);
+
+            return values;
+
+        } catch (IllegalAccessException    | // couldn't loosen security
+                 IllegalArgumentException  | // parameters doesn't match
                  InvocationTargetException | // the value method threw an exception
-                 ClassCastException e) { // well, a cast failed ...
-            throw new AnnotationFormatError(
-                    containerInstance + " is an invalid container for repeating annotations",
-                    e);
+                 ClassCastException e) {
+
+            throw invalidContainerException(container, e);
+
         }
     }
 
-    /* Sanity check type of and return a list of all the annotation
-     * instances of type {@code annotationClass} from {@code
-     * containerInstance}.
-     */
-    private static <A extends Annotation> List<A> unpackAll(Annotation containerInstance,
-                                                            Class<A> annotationClass) {
-        if (containerInstance == null) {
-            return Collections.emptyList(); // container not present
-        }
+
+    private static AnnotationFormatError invalidContainerException(Annotation anno,
+                                                                   Throwable cause) {
+        return new AnnotationFormatError(
+                anno + " is an invalid container for repeating annotations",
+                cause);
+    }
+
 
-        try {
-            A[] a = getValueArray(containerInstance);
-            List<A> l = new ArrayList<>(a.length);
-            for (int i  = 0; i < a.length; i++)
-                l.add(annotationClass.cast(a[i]));
-            return l;
-        } catch (ClassCastException |
-                 NullPointerException e) {
-            throw new AnnotationFormatError(
-                    String.format("%s is an invalid container for repeating annotations of type: %s",
-                        containerInstance, annotationClass),
-                    e);
+    /* Sanity check type of all the annotation instances of type {@code annoClass}
+     * from {@code container}.
+     */
+    private static <A extends Annotation> void checkTypes(A[] annotations,
+                                                          Annotation container,
+                                                          Class<A> annoClass) {
+        for (A a : annotations) {
+            if (!annoClass.isInstance(a)) {
+                throw new AnnotationFormatError(
+                        String.format("%s is an invalid container for " +
+                                      "repeating annotations of type: %s",
+                                      container, annoClass));
+            }
         }
     }
 }
--- a/jdk/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java	Wed Jul 05 19:21:26 2017 +0200
@@ -54,7 +54,7 @@
      *
      * @param rawAnnotations the byte[] encoding of all type annotations on this declaration
      * @param cp the ConstantPool needed to parse the embedded Annotation
-     * @param decl the dclaration this type annotation is on
+     * @param decl the declaration this type annotation is on
      * @param container the Class this type annotation is on (may be the same as decl)
      * @param type the type the AnnotatedType corresponds to
      * @param filter the type annotation targets included in this AnnotatedType
--- a/jdk/src/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -198,7 +198,7 @@
     @Override
     public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
         Objects.requireNonNull(annotationClass);
-        return AnnotationSupport.getMultipleAnnotations(mapAnnotations(getAnnotations()), annotationClass);
+        return AnnotationSupport.getDirectlyAndIndirectlyPresent(mapAnnotations(getAnnotations()), annotationClass);
     }
 
     @Override
--- a/jdk/src/share/classes/sun/rmi/rmic/RemoteClass.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/rmic/RemoteClass.java	Wed Jul 05 19:21:26 2017 +0200
@@ -621,7 +621,7 @@
 
     /**
      * Sort array of class declarations alphabetically by their mangled
-     * fully-qualfied class name.  This is used to feed a method's exceptions
+     * fully-qualified class name.  This is used to feed a method's exceptions
      * in a canonical order into the digest stream for the interface hash
      * computation.
      */
--- a/jdk/src/share/classes/sun/rmi/rmic/Util.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/rmic/Util.java	Wed Jul 05 19:21:26 2017 +0200
@@ -52,7 +52,7 @@
      * class.
      * @param theClass The fully qualified name of the class.
      * @param rootDir The directory to use as the root of the
-     * package heirarchy.  May be null, in which case the current
+     * package hierarchy.  May be null, in which case the current
      * working directory is used as the root.
      */
     public static File getOutputDirectoryFor(Identifier theClass,
--- a/jdk/src/share/classes/sun/rmi/rmic/newrmic/jrmp/StubSkeletonWriter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/rmic/newrmic/jrmp/StubSkeletonWriter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -53,7 +53,7 @@
     /** rmic environment for this object */
     private final BatchEnvironment env;
 
-    /** the remote implemention class to generate code for */
+    /** the remote implementation class to generate code for */
     private final RemoteClass remoteClass;
 
     /** version of the JRMP stub protocol to generate code for */
--- a/jdk/src/share/classes/sun/rmi/runtime/Log.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/runtime/Log.java	Wed Jul 05 19:21:26 2017 +0200
@@ -379,7 +379,7 @@
 
         private LogStreamLog(LogStream stream, Level level) {
             if ((stream != null) && (level != null)) {
-                /* if the stream or level is null, dont log any
+                /* if the stream or level is null, don't log any
                  * messages
                  */
                 levelValue = level.intValue();
--- a/jdk/src/share/classes/sun/rmi/server/Activation.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/server/Activation.java	Wed Jul 05 19:21:26 2017 +0200
@@ -684,7 +684,7 @@
                  * Now exit... A System.exit should only be done if
                  * the RMI activation system daemon was started up
                  * by the main method below (in which should always
-                 * be the case since the Activation contructor is private).
+                 * be the case since the Activation constructor is private).
                  */
                 System.err.println(getTextResource("rmid.daemon.shutdown"));
                 System.exit(0);
@@ -784,7 +784,7 @@
     /**
      * Container for group information: group's descriptor, group's
      * instantiator, flag to indicate pending group creation, and
-     * table of the group's actived objects.
+     * table of the objects that are activated in the group.
      *
      * WARNING: GroupEntry objects should not be written into log file
      * updates.  GroupEntrys are inner classes of Activation and they
--- a/jdk/src/share/classes/sun/rmi/transport/ObjectTable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/transport/ObjectTable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -223,7 +223,7 @@
 
     /**
      * Process client VM signalling reference for given ObjID: forward to
-     * correspoding Target entry.  If ObjID is not found in table,
+     * corresponding Target entry.  If ObjID is not found in table,
      * no action is taken.
      */
     static void referenced(ObjID id, long sequenceNum, VMID vmid) {
@@ -239,7 +239,7 @@
 
     /**
      * Process client VM dropping reference for given ObjID: forward to
-     * correspoding Target entry.  If ObjID is not found in table,
+     * corresponding Target entry.  If ObjID is not found in table,
      * no action is taken.
      */
     static void unreferenced(ObjID id, long sequenceNum, VMID vmid,
--- a/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -34,6 +34,7 @@
 import sun.rmi.runtime.NewThreadAction;
 import sun.security.action.GetBooleanAction;
 import sun.security.action.GetLongAction;
+import sun.security.action.GetPropertyAction;
 
 /**
  * RMIMasterSocketFactory attempts to create a socket connection to the
@@ -103,22 +104,21 @@
         try {
             String proxyHost;
             proxyHost = java.security.AccessController.doPrivileged(
-                new sun.security.action.GetPropertyAction("http.proxyHost"));
+                new GetPropertyAction("http.proxyHost"));
 
             if (proxyHost == null)
                 proxyHost = java.security.AccessController.doPrivileged(
-                    new sun.security.action.GetPropertyAction("proxyHost"));
+                    new GetPropertyAction("proxyHost"));
 
-            Boolean tmp = java.security.AccessController.doPrivileged(
-                new sun.security.action.GetBooleanAction("java.rmi.server.disableHttp"));
+            boolean disable = java.security.AccessController.doPrivileged(
+                new GetPropertyAction("java.rmi.server.disableHttp", "true"))
+                .equalsIgnoreCase("true");
 
-            if (!tmp.booleanValue() &&
-                (proxyHost != null && proxyHost.length() > 0)) {
+            if (!disable && proxyHost != null && proxyHost.length() > 0) {
                 setFactories = true;
             }
         } catch (Exception e) {
-            // unable to obtain the properties, so assume default behavior.
-            setFactories = true;
+            // unable to obtain the properties, so use the default behavior.
         }
 
         if (setFactories) {
--- a/jdk/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -367,7 +367,7 @@
     /**
      * Send packet of requested data on connection to remote endpoint.
      * @param info connection information structure
-     * @param buf array containg bytes to send
+     * @param buf array containing bytes to send
      * @param off offset of first array index of packet
      * @param len number of bytes in packet to send
      */
--- a/jdk/src/share/classes/sun/rmi/transport/tcp/MultiplexOutputStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/transport/tcp/MultiplexOutputStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -27,7 +27,7 @@
 import java.io.*;
 
 /**
- * MultiplexOutputStream manages sending data over a conection managed
+ * MultiplexOutputStream manages sending data over a connection managed
  * by a ConnectionMultiplexer object.  Data written is buffered until the
  * internal buffer is full or the flush() method is called, at which
  * point it attempts to push a packet of bytes through to the remote
@@ -171,7 +171,7 @@
     }
 
     /**
-     * Take note of more bytes requested by conection at remote endpoint.
+     * Take note of more bytes requested by connection at remote endpoint.
      * @param num number of additional bytes requested
      */
     void request(int num)
--- a/jdk/src/share/classes/sun/rmi/transport/tcp/TCPChannel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/rmi/transport/tcp/TCPChannel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -515,7 +515,7 @@
     }
 
     /**
-     * Give transport next accepted conection, when available.
+     * Give transport next accepted connection, when available.
      */
     public void run() {
         Connection conn;
--- a/jdk/src/share/classes/sun/security/jca/GetInstance.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/jca/GetInstance.java	Wed Jul 05 19:21:26 2017 +0200
@@ -165,7 +165,7 @@
         } catch (NoSuchAlgorithmException e) {
             failure = e;
         }
-        // if we cannot get the service from the prefered provider,
+        // if we cannot get the service from the preferred provider,
         // fail over to the next
         for (Service s : list.getServices(type, algorithm)) {
             if (s == firstService) {
--- a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Context.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Context.java	Wed Jul 05 19:21:26 2017 +0200
@@ -867,7 +867,7 @@
     }
 
     /**
-     * Queries the context for largest data size to accomodate
+     * Queries the context for largest data size to accommodate
      * the specified protection and be <= maxTokSize.
      *
      * @param qop the quality of protection that the context will be
--- a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5NameElement.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5NameElement.java	Wed Jul 05 19:21:26 2017 +0200
@@ -253,7 +253,7 @@
 
     /**
      * Returns the principal name in the form user@REALM or
-     * host/service@REALM but with the following contraints that are
+     * host/service@REALM but with the following constraints that are
      * imposed by RFC 1964:
      * <pre>
      *  (1) all occurrences of the characters `@`,  `/`, and `\` within
@@ -265,7 +265,7 @@
      *   represented, respectively, with `\0`, `\b`, `\t`, or `\n`.
      *
      *   (3) the `\` quoting character shall not be emitted within an
-     *   exported name except to accomodate cases (1) and (2).
+     *   exported name except to accommodate cases (1) and (2).
      * </pre>
      */
     public byte[] export() throws GSSException {
--- a/jdk/src/share/classes/sun/security/jgss/krb5/MessageToken.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/MessageToken.java	Wed Jul 05 19:21:26 2017 +0200
@@ -596,7 +596,7 @@
          * Constructs a MessageTokenHeader for the specified token type with
          * appropriate checksum and encryption algorithms fields.
          *
-         * @param tokenId the token id for this mesage token
+         * @param tokenId the token id for this message token
          * @param conf true if confidentiality will be resuested with this
          * message token, false otherwise.
          * @param qop the value of the quality of protection that will be
--- a/jdk/src/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Wed Jul 05 19:21:26 2017 +0200
@@ -232,7 +232,7 @@
                         throws GSSException;
 
     /**
-     * Queries the context for largest data size to accomodate
+     * Queries the context for largest data size to accommodate
      * the specified protection and for the token to remain less then
      * maxTokSize.
      *
@@ -313,7 +313,7 @@
                         MessageProp msgProp) throws GSSException;
 
     /**
-     * For apps that want simplicity and dont care about buffer copies.
+     * For apps that want simplicity and don't care about buffer copies.
      */
     public byte[] unwrap(byte inBuf[], int offset, int len,
                          MessageProp msgProp) throws GSSException;
--- a/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java	Wed Jul 05 19:21:26 2017 +0200
@@ -541,7 +541,7 @@
                 if (mech_wanted == null) {
                     valid = false;
                 }
-                // save the desired mechansim
+                // save the desired mechanism
                 internal_mech = mech_wanted;
 
                 // get the token for mechanism
@@ -741,7 +741,7 @@
             return null;
         }
 
-        // check if mechansim supports integrity
+        // check if mechanism supports integrity
         if (!mechContext.getIntegState()) {
             if (DEBUG) {
                 System.out.println("SpNegoContext: no MIC token included" +
@@ -783,7 +783,7 @@
             return true;
         }
 
-        // check if mechansim supports integrity
+        // check if mechanism supports integrity
         if (!mechContext.getIntegState()) {
             if (DEBUG) {
                 System.out.println("SpNegoContext: no MIC token validation" +
--- a/jdk/src/share/classes/sun/security/krb5/Config.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/Config.java	Wed Jul 05 19:21:26 2017 +0200
@@ -63,7 +63,7 @@
     private static Config singleton = null;
 
     /*
-     * Hashtable used to store configuration infomation.
+     * Hashtable used to store configuration information.
      */
     private Hashtable<String,Object> stanzaTable = new Hashtable<>();
 
--- a/jdk/src/share/classes/sun/security/krb5/KdcComm.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/KdcComm.java	Wed Jul 05 19:21:26 2017 +0200
@@ -426,7 +426,7 @@
     }
 
     /**
-     * Returns krb5.conf setting of {@code key} for a specfic realm,
+     * Returns krb5.conf setting of {@code key} for a specific realm,
      * which can be:
      * 1. defined in the sub-stanza for the given realm inside [realms], or
      * 2. defined in [libdefaults], or
--- a/jdk/src/share/classes/sun/security/krb5/Realm.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/Realm.java	Wed Jul 05 19:21:26 2017 +0200
@@ -400,7 +400,7 @@
     }
 
     /**
-     * Creates a realm name using components from the given postion.
+     * Creates a realm name using components from the given position.
      * For example, subStringFrom({"A", "B", "C"}, 1) is "B.C".
      */
     private static String subStringFrom(String[] components, int from) {
--- a/jdk/src/share/classes/sun/security/krb5/internal/CredentialsUtil.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/CredentialsUtil.java	Wed Jul 05 19:21:26 2017 +0200
@@ -281,7 +281,7 @@
             }
             else {
                 /*
-                 * The new tgt's realm is not in the heirarchy of realms.
+                 * The new tgt's realm is not in the hierarchy of realms.
                  * It's probably not safe to get a tgt from
                  * a tgs that is outside the known list of realms.
                  * Give up now.
--- a/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java	Wed Jul 05 19:21:26 2017 +0200
@@ -513,7 +513,7 @@
                         }
                     });
             if (p == null) {
-                // exception occured in execing the command
+                // exception occurred during executing the command
                 return null;
             }
 
--- a/jdk/src/share/classes/sun/security/krb5/internal/crypto/DesCbcEType.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/crypto/DesCbcEType.java	Wed Jul 05 19:21:26 2017 +0200
@@ -94,7 +94,7 @@
         byte[] new_data;
         byte pad;
         /*Data padding: using Kerberos 5 GSS-API mechanism (1.2.2.3), Jun 1996.
-         *Before encryption, plaintext data is padded to the next higest multiple of blocksize.
+         *Before encryption, plain text data is padded to the next highest multiple of blocksize.
          *by appending between 1 and 8 bytes, the value of each such byte being the total number
          *of pad bytes. For example, if new_size = 10, blockSize is 8, we should pad 2 bytes,
          *and the value of each byte is 2.
--- a/jdk/src/share/classes/sun/security/pkcs11/P11DHKeyFactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11DHKeyFactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -38,7 +38,7 @@
 import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
 
 /**
- * DH KeyFactory implemenation.
+ * DH KeyFactory implementation.
  *
  * @author  Andreas Sterbenz
  * @since   1.5
--- a/jdk/src/share/classes/sun/security/pkcs11/P11DSAKeyFactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11DSAKeyFactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -36,7 +36,7 @@
 import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
 
 /**
- * DSA KeyFactory implemenation.
+ * DSA KeyFactory implementation.
  *
  * @author  Andreas Sterbenz
  * @since   1.5
--- a/jdk/src/share/classes/sun/security/pkcs11/P11ECKeyFactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11ECKeyFactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -40,7 +40,7 @@
 import sun.security.util.ECUtil;
 
 /**
- * EC KeyFactory implemenation.
+ * EC KeyFactory implementation.
  *
  * @author  Andreas Sterbenz
  * @since   1.6
--- a/jdk/src/share/classes/sun/security/pkcs11/P11RSAKeyFactory.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11RSAKeyFactory.java	Wed Jul 05 19:21:26 2017 +0200
@@ -38,7 +38,7 @@
 import sun.security.rsa.RSAKeyFactory;
 
 /**
- * RSA KeyFactory implemenation.
+ * RSA KeyFactory implementation.
  *
  * @author  Andreas Sterbenz
  * @since   1.5
--- a/jdk/src/share/classes/sun/security/pkcs11/wrapper/PKCS11.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/wrapper/PKCS11.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1503,7 +1503,7 @@
      *         (PKCS#11 param: CK_FLAGS flags)
      * @param pReserved reserved. Should be null
      *         (PKCS#11 param: CK_VOID_PTR pReserved)
-     * @return the slot ID where the event occured
+     * @return the slot ID where the event occurred
      *         (PKCS#11 param: CK_SLOT_ID_PTR pSlot)
      * @exception PKCS11Exception If function returns other value than CKR_OK.
      * @preconditions (pRserved == null)
--- a/jdk/src/share/classes/sun/security/provider/DSA.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/provider/DSA.java	Wed Jul 05 19:21:26 2017 +0200
@@ -529,7 +529,7 @@
          * i.e. FIPS186.
          *
          * @param seed the seed for generating k. This seed should be
-         * secure. This is what is refered to as the KSEED in the DSA
+         * secure. This is what is referred to as the KSEED in the DSA
          * specification.
          *
          * @param g the g parameter from the DSA key pair.
--- a/jdk/src/share/classes/sun/security/provider/certpath/AdjacencyList.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/provider/certpath/AdjacencyList.java	Wed Jul 05 19:21:26 2017 +0200
@@ -64,7 +64,7 @@
  * The iterator method returns objects of type <code>BuildStep</code>, not
  * objects of type <code>Vertex</code>.
  * A <code>BuildStep</code> contains a <code>Vertex</code> and a result code,
- * accessable via getResult method. There are five result values.
+ * accessible via getResult method. There are five result values.
  * <code>POSSIBLE</code> denotes that the current step represents a
  * <code>Certificate</code> that the builder is considering at this point in
  * the build. <code>FOLLOW</code> denotes a <code>Certificate</code> (one of
--- a/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ForwardBuilder.java	Wed Jul 05 19:21:26 2017 +0200
@@ -675,7 +675,7 @@
          * check for looping - abort a loop if
          * ((we encounter the same certificate twice) AND
          * ((policyMappingInhibited = true) OR (no policy mapping
-         * extensions can be found between the occurences of the same
+         * extensions can be found between the occurrences of the same
          * certificate)))
          */
         if (certPathList != null) {
--- a/jdk/src/share/classes/sun/security/provider/certpath/ReverseBuilder.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ReverseBuilder.java	Wed Jul 05 19:21:26 2017 +0200
@@ -364,10 +364,10 @@
          * check for looping - abort a loop if
          * ((we encounter the same certificate twice) AND
          * ((policyMappingInhibited = true) OR (no policy mapping
-         * extensions can be found between the occurences of the same
+         * extensions can be found between the occurrences of the same
          * certificate)))
          * in order to facilitate the check to see if there are
-         * any policy mapping extensions found between the occurences
+         * any policy mapping extensions found between the occurrences
          * of the same certificate, we reverse the certpathlist first
          */
         if ((certPathList != null) && (!certPathList.isEmpty())) {
--- a/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java	Wed Jul 05 19:21:26 2017 +0200
@@ -307,7 +307,7 @@
                                               : anchor.getCAPublicKey();
         }
         crlSignFlag = true;
-        if (params.certPath() != null) {
+        if (params != null && params.certPath() != null) {
             certIndex = params.certPath().getCertificates().size() - 1;
         } else {
             certIndex = -1;
--- a/jdk/src/share/classes/sun/security/rsa/RSAKeyPairGenerator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/rsa/RSAKeyPairGenerator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -117,7 +117,7 @@
 
     // generate the keypair. See JCA doc
     public KeyPair generateKeyPair() {
-        // accomodate odd key sizes in case anybody wants to use them
+        // accommodate odd key sizes in case anybody wants to use them
         int lp = (keySize + 1) >> 1;
         int lq = keySize - lp;
         if (random == null) {
--- a/jdk/src/share/classes/sun/security/ssl/HandshakeOutStream.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/HandshakeOutStream.java	Wed Jul 05 19:21:26 2017 +0200
@@ -139,8 +139,8 @@
     /*
      * Tell the OutputRecord that a finished message was
      * contained either in this record or the one immeiately
-     * preceeding it.  We need to reliably pass back notifications
-     * that a finish message occured.
+     * preceding it.  We need to reliably pass back notifications
+     * that a finish message occurred.
      */
     void setFinishedMsg() {
         assert(socket == null);
--- a/jdk/src/share/classes/sun/security/ssl/Handshaker.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/Handshaker.java	Wed Jul 05 19:21:26 2017 +0200
@@ -902,7 +902,7 @@
             }
 
             /*
-             * Process the messsage.  We require
+             * Process the message.  We require
              * that processMessage() consumes the entire message.  In
              * lieu of explicit error checks (how?!) we assume that the
              * data will look like garbage on encoding/processing errors,
--- a/jdk/src/share/classes/sun/security/ssl/RSASignature.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/RSASignature.java	Wed Jul 05 19:21:26 2017 +0200
@@ -39,7 +39,7 @@
  * negative interaction with the JCA mechanisms for hardware providers.
  *
  * The class should be instantiated via the getInstance() method in this class,
- * which returns the implementation from the prefered provider. The internal
+ * which returns the implementation from the preferred provider. The internal
  * implementation allows the hashes to be explicitly set, which is required
  * for RSA client authentication. It can be obtained via the
  * getInternalInstance() method.
--- a/jdk/src/share/classes/sun/security/ssl/Record.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/Record.java	Wed Jul 05 19:21:26 2017 +0200
@@ -102,7 +102,7 @@
      * this is the amount OpenSSL is using.
      */
     static final int    maxLargeRecordSize =
-                maxRecordSize   // Max size with a conforming implemenation
+                maxRecordSize   // Max size with a conforming implementation
               + maxDataSize;    // extra 2^14 bytes for large data packets.
 
 
--- a/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -243,7 +243,7 @@
     abstract SSLParameters getDefaultClientSSLParams();
     abstract SSLParameters getSupportedSSLParams();
 
-    // Get suported ProtoclList.
+    // Get supported ProtocolList.
     ProtocolList getSuportedProtocolList() {
         if (supportedProtocolList == null) {
             supportedProtocolList =
@@ -253,7 +253,7 @@
         return supportedProtocolList;
     }
 
-    // Get default ProtoclList.
+    // Get default ProtocolList.
     ProtocolList getDefaultProtocolList(boolean roleIsServer) {
         if (roleIsServer) {
             if (defaultServerProtocolList == null) {
@@ -272,7 +272,7 @@
         }
     }
 
-    // Get suported CipherSuiteList.
+    // Get supported CipherSuiteList.
     CipherSuiteList getSupportedCipherSuiteList() {
         // The maintenance of cipher suites needs to be synchronized.
         synchronized (this) {
--- a/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -762,7 +762,7 @@
 
     /**
      * Unwraps a buffer.  Does a variety of checks before grabbing
-     * the unwrapLock, which blocks multiple unwraps from occuring.
+     * the unwrapLock, which blocks multiple unwraps from occurring.
      */
     @Override
     public SSLEngineResult unwrap(ByteBuffer netData, ByteBuffer [] appData,
@@ -1143,7 +1143,7 @@
 
     /**
      * Wraps a buffer.  Does a variety of checks before grabbing
-     * the wrapLock, which blocks multiple wraps from occuring.
+     * the wrapLock, which blocks multiple wraps from occurring.
      */
     @Override
     public SSLEngineResult wrap(ByteBuffer [] appData,
--- a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1727,7 +1727,7 @@
 
             while (((state = getConnectionState()) != cs_CLOSED) &&
                    (state != cs_ERROR) && (state != cs_APP_CLOSED)) {
-                // create the InputRecord if it isn't intialized.
+                // create the InputRecord if it isn't initialized.
                 if (inrec == null) {
                     inrec = new InputRecord();
                 }
--- a/jdk/src/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Wed Jul 05 19:21:26 2017 +0200
@@ -282,7 +282,7 @@
             } else if ((keySize > 0) && (keySize < 512)) {
                 maxDigestLength = HashAlgorithm.SHA1.length;
             }   // Otherwise, cannot determine the key size, prefer the most
-                // perferable hash algorithm.
+                // preferable hash algorithm.
         }
 
         for (SignatureAndHashAlgorithm algorithm : algorithms) {
--- a/jdk/src/share/classes/sun/security/ssl/SunJSSE.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SunJSSE.java	Wed Jul 05 19:21:26 2017 +0200
@@ -112,7 +112,7 @@
         registerAlgorithms(false);
     }
 
-    // prefered constructor to enable FIPS mode at runtime
+    // preferred constructor to enable FIPS mode at runtime
     protected SunJSSE(java.security.Provider cryptoProvider){
         this(checkNull(cryptoProvider), cryptoProvider.getName());
     }
--- a/jdk/src/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -36,7 +36,7 @@
 
 
 /**
- * An implemention of X509KeyManager backed by a KeyStore.
+ * An implementation of X509KeyManager backed by a KeyStore.
  *
  * The backing KeyStore is inspected when this object is constructed.
  * All key entries containing a PrivateKey and a non-empty chain of
--- a/jdk/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/X509KeyManagerImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -48,7 +48,7 @@
  *    CallbackHandler) or to have keys within one KeyStore protected by
  *    different keys.
  *  . it can use multiple KeyStores at the same time.
- *  . it is explicitly designed to accomodate KeyStores that change over
+ *  . it is explicitly designed to accommodate KeyStores that change over
  *    the lifetime of the process.
  *  . it makes an effort to choose the key that matches best, i.e. one that
  *    is not expired and has the appropriate certificate extensions.
--- a/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java	Wed Jul 05 19:21:26 2017 +0200
@@ -682,7 +682,7 @@
 
                         // The label finally contains 2 parts separated by '|':
                         // The legend displayed before the entry names, and
-                        // the cert info (if -certs specfied).
+                        // the cert info (if -certs specified).
 
                         if (!output.containsKey(label)) {
                             output.put(label, new ArrayList<String>());
--- a/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_ja.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Resources_ja.java	Wed Jul 05 19:21:26 2017 +0200
@@ -79,7 +79,7 @@
         {".verbose.suboptions.verbose.output.when.signing.verifying.",
                 "[-verbose[:suboptions]]     \u7F72\u540D/\u691C\u8A3C\u6642\u306E\u8A73\u7D30\u51FA\u529B\u3002"},
         {".suboptions.can.be.all.grouped.or.summary",
-                "                            \u30B5\u30D6\u30AA\u30D7\u30B7\u30E7\u30F3\u3068\u3057\u3066\u3001\u3059\u3079\u3066\u3001\u30B0\u30EB\u30FC\u30D7\u307E\u305F\u306F\u30B5\u30DE\u30EA\u30FC\u3092\u4F7F\u7528\u3067\u304D\u307E\u3059"},
+                "                            \u30B5\u30D6\u30AA\u30D7\u30B7\u30E7\u30F3\u3068\u3057\u3066\u3001all\u3001grouped\u307E\u305F\u306Fsummary\u3092\u4F7F\u7528\u3067\u304D\u307E\u3059"},
         {".certs.display.certificates.when.verbose.and.verifying",
                 "[-certs]                    \u8A73\u7D30\u51FA\u529B\u304A\u3088\u3073\u691C\u8A3C\u6642\u306B\u8A3C\u660E\u66F8\u3092\u8868\u793A"},
         {".tsa.url.location.of.the.Timestamping.Authority",
--- a/jdk/src/share/classes/sun/security/tools/policytool/PolicyTool.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/tools/policytool/PolicyTool.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1092,19 +1092,19 @@
         JMenu menu = new JMenu();
         configureButton(menu, "File");
         ActionListener actionListener = new FileMenuListener(tool, this);
-        addMenuItem(menu, NEW_POLICY_FILE, actionListener);
-        addMenuItem(menu, OPEN_POLICY_FILE, actionListener);
-        addMenuItem(menu, SAVE_POLICY_FILE, actionListener);
-        addMenuItem(menu, SAVE_AS_POLICY_FILE, actionListener);
-        addMenuItem(menu, VIEW_WARNINGS, actionListener);
-        addMenuItem(menu, QUIT, actionListener);
+        addMenuItem(menu, NEW_POLICY_FILE, actionListener, "N");
+        addMenuItem(menu, OPEN_POLICY_FILE, actionListener, "O");
+        addMenuItem(menu, SAVE_POLICY_FILE, actionListener, "S");
+        addMenuItem(menu, SAVE_AS_POLICY_FILE, actionListener, null);
+        addMenuItem(menu, VIEW_WARNINGS, actionListener, null);
+        addMenuItem(menu, QUIT, actionListener, null);
         menuBar.add(menu);
 
         // create a KeyStore menu
         menu = new JMenu();
         configureButton(menu, "KeyStore");
         actionListener = new MainWindowListener(tool, this);
-        addMenuItem(menu, EDIT_KEYSTORE, actionListener);
+        addMenuItem(menu, EDIT_KEYSTORE, actionListener, null);
         menuBar.add(menu);
         setJMenuBar(menuBar);
 
@@ -1220,23 +1220,24 @@
     // Platform specific modifier (control / command).
     private int shortCutModifier = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
 
-    private void addMenuItem(JMenu menu, String key, ActionListener actionListener) {
+    private void addMenuItem(JMenu menu, String key, ActionListener actionListener, String accelerator) {
         JMenuItem menuItem = new JMenuItem();
         configureButton(menuItem, key);
 
         if (PolicyTool.rb.containsKey(key + ".accelerator")) {
-            String accelerator = PolicyTool.getMessage(key + ".accelerator");
-            if (accelerator != null && !accelerator.isEmpty()) {
-                KeyStroke keyStroke;
-                if (accelerator.matches("^control .$")) {
-                    // Map "control" key to "command" on MacOS
-                    keyStroke = KeyStroke.getKeyStroke(KeyEvent.getExtendedKeyCodeForChar(accelerator.charAt(8)),
-                                                       shortCutModifier);
-                } else {
-                    keyStroke = KeyStroke.getKeyStroke(accelerator);
-                }
-                menuItem.setAccelerator(keyStroke);
+            // Accelerator from resources takes precedence
+            accelerator = PolicyTool.getMessage(key + ".accelerator");
+        }
+
+        if (accelerator != null && !accelerator.isEmpty()) {
+            KeyStroke keyStroke;
+            if (accelerator.length() == 1) {
+                keyStroke = KeyStroke.getKeyStroke(KeyEvent.getExtendedKeyCodeForChar(accelerator.charAt(0)),
+                                                   shortCutModifier);
+            } else {
+                keyStroke = KeyStroke.getKeyStroke(accelerator);
             }
+            menuItem.setAccelerator(keyStroke);
         }
 
         menuItem.addActionListener(actionListener);
--- a/jdk/src/share/classes/sun/security/tools/policytool/Resources.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/tools/policytool/Resources.java	Wed Jul 05 19:21:26 2017 +0200
@@ -45,11 +45,8 @@
         {".file.file.policy.file.location",
                 "  [-file <file>]    policy file location"},
         {"New", "&New"},
-        {"New.accelerator", "control N"},
         {"Open", "&Open..."},
-        {"Open.accelerator", "control O"},
         {"Save", "&Save"},
-        {"Save.accelerator", "control S"},
         {"Save.As", "Save &As..."},
         {"View.Warning.Log", "View &Warning Log"},
         {"Exit", "E&xit"},
@@ -92,8 +89,6 @@
         {"OK.to.overwrite.existing.file.filename.",
                 "OK to overwrite existing file {0}?"},
         {"Cancel", "Cancel"},
-
-        // Policy Entry Dialog
         {"CodeBase.", "&CodeBase:"},
         {"SignedBy.", "&SignedBy:"},
         {"Add.Principal", "&Add Principal"},
@@ -104,13 +99,10 @@
         {".Edit.Permission", "  Ed&it Permission"},
         {"Remove.Permission", "Re&move Permission"},
         {"Done", "Done"},
-
-        // KeyStore Edit Dialog
         {"KeyStore.URL.", "KeyStore &URL:"},
         {"KeyStore.Type.", "KeyStore &Type:"},
         {"KeyStore.Provider.", "KeyStore &Provider:"},
         {"KeyStore.Password.URL.", "KeyStore Pass&word URL:"},
-
         {"Principals", "Principals"},
         {".Edit.Principal.", "  Edit Principal:"},
         {".Add.New.Principal.", "  Add New Principal:"},
--- a/jdk/src/share/classes/sun/security/util/HostnameChecker.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/util/HostnameChecker.java	Wed Jul 05 19:21:26 2017 +0200
@@ -212,7 +212,7 @@
     /**
      * Return the subject of a certificate as X500Name, by reparsing if
      * necessary. X500Name should only be used if access to name components
-     * is required, in other cases X500Principal is to be prefered.
+     * is required, in other cases X500Principal is to be preferred.
      *
      * This method is currently used from within JSSE, do not remove.
      */
--- a/jdk/src/share/classes/sun/security/x509/AlgIdDSA.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/security/x509/AlgIdDSA.java	Wed Jul 05 19:21:26 2017 +0200
@@ -113,9 +113,9 @@
      * define the algorithm parameters.  Those integers are encoded
      * as big-endian byte arrays.
      *
-     * @param p the DSS/DSA paramter "P"
-     * @param q the DSS/DSA paramter "Q"
-     * @param g the DSS/DSA paramter "G"
+     * @param p the DSS/DSA parameter "P"
+     * @param q the DSS/DSA parameter "Q"
+     * @param g the DSS/DSA parameter "G"
      */
     public AlgIdDSA (byte p [], byte q [], byte g [])
     throws IOException
@@ -130,9 +130,9 @@
      * If all three are null, then the parameters portion of the algorithm id
      * is set to null.  See note in header regarding use.
      *
-     * @param p the DSS/DSA paramter "P"
-     * @param q the DSS/DSA paramter "Q"
-     * @param g the DSS/DSA paramter "G"
+     * @param p the DSS/DSA parameter "P"
+     * @param q the DSS/DSA parameter "Q"
+     * @param g the DSS/DSA parameter "G"
      */
     public AlgIdDSA (BigInteger p, BigInteger q, BigInteger g)
     {
--- a/jdk/src/share/classes/sun/swing/plaf/synth/DefaultSynthStyle.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/swing/plaf/synth/DefaultSynthStyle.java	Wed Jul 05 19:21:26 2017 +0200
@@ -276,7 +276,7 @@
     /**
      * Returns a SynthGraphicsUtils.
      *
-     * @param context SynthContext indentifying requestor
+     * @param context SynthContext identifying requestor
      * @return SynthGraphicsUtils
      */
     public SynthGraphicsUtils getGraphicsUtils(SynthContext context) {
@@ -300,7 +300,7 @@
      * insets will be placed in it, otherwise a new Insets object will be
      * created and returned.
      *
-     * @param context SynthContext indentifying requestor
+     * @param context SynthContext identifying requestor
      * @param to Where to place Insets
      * @return Insets.
      */
@@ -332,7 +332,7 @@
     /**
      * Returns the Painter for the passed in Component. This may return null.
      *
-     * @param ss SynthContext indentifying requestor
+     * @param ss SynthContext identifying requestor
      * @return Painter for the border
      */
     public SynthPainter getPainter(SynthContext ss) {
@@ -353,7 +353,7 @@
      * to. A Style should NOT assume the opacity will remain this value, the
      * developer may reset it or override it.
      *
-     * @param ss SynthContext indentifying requestor
+     * @param ss SynthContext identifying requestor
      * @return opaque Whether or not the JComponent is opaque.
      */
     public boolean isOpaque(SynthContext ss) {
@@ -382,7 +382,7 @@
     /**
      * Getter for a region specific style property.
      *
-     * @param state SynthContext indentifying requestor
+     * @param state SynthContext identifying requestor
      * @param key Property being requested.
      * @return Value of the named property
      */
@@ -435,7 +435,7 @@
      * Returns the default value for a particular property.  This is only
      * invoked if this style doesn't define a property for <code>key</code>.
      *
-     * @param state SynthContext indentifying requestor
+     * @param state SynthContext identifying requestor
      * @param key Property being requested.
      * @return Value of the named property
      */
--- a/jdk/src/share/classes/sun/swing/plaf/synth/Paint9Painter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/swing/plaf/synth/Paint9Painter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -83,7 +83,7 @@
     public static final int PAINT_ALL = 512;
 
     /**
-     * Conveniance method for testing the validity of an image.
+     * Convenience method for testing the validity of an image.
      *
      * @param image Image to check.
      * @return true if <code>image</code> is non-null and has a positive
--- a/jdk/src/share/classes/sun/text/normalizer/ReplaceableUCharacterIterator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/text/normalizer/ReplaceableUCharacterIterator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -179,7 +179,7 @@
     // private data members ----------------------------------------------------
 
     /**
-     * Replacable object
+     * Replaceable object
      */
     private Replaceable replaceable;
     /**
--- a/jdk/src/share/classes/sun/text/resources/th/CollationData_th.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/text/resources/th/CollationData_th.java	Wed Jul 05 19:21:26 2017 +0200
@@ -144,11 +144,11 @@
                 // Below are thai puntuation marks and Tonal(Accent) marks. According to CLDR 1.9 and
                 // ISO/IEC 14651, Annex C, C.2.1 Thai ordering principles, 0E2F to 0E5B are punctuaion marks that need to be ignored
                 // in the first three leveles.  0E4E to 0E4B are tonal marks to be compared in secondary level.
-                // In real implmentation, set puncutation marks in tertiary as there is no fourth level in Java.
+                // In real implementation, set punctuation marks in tertiary as there is no fourth level in Java.
                 // Set all these special marks after \u0301, the accute accent.
                 + "& \u0301 "   // acute accent
 
-                //puncutation marks
+                //punctuation marks
                 + ", \u0E2F "                   //  PAIYANNOI      (ellipsis, abbreviation)
                 + ", \u0E46 "                   //  MAIYAMOK
                 + ", \u0E4F "                   //  FONGMAN
--- a/jdk/src/share/classes/sun/tools/jar/Main.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/Main.java	Wed Jul 05 19:21:26 2017 +0200
@@ -31,6 +31,7 @@
 import java.util.*;
 import java.util.zip.*;
 import java.util.jar.*;
+import java.util.jar.Pack200.*;
 import java.util.jar.Manifest;
 import java.text.MessageFormat;
 import sun.misc.JarIndex;
@@ -72,8 +73,9 @@
      * flag0: no zip compression (store only)
      * Mflag: DO NOT generate a manifest file (just ZIP)
      * iflag: generate jar index
+     * nflag: Perform jar normalization at the end
      */
-    boolean cflag, uflag, xflag, tflag, vflag, flag0, Mflag, iflag;
+    boolean cflag, uflag, xflag, tflag, vflag, flag0, Mflag, iflag, nflag;
 
     static final String MANIFEST_DIR = "META-INF/";
     static final String VERSION = "1.0";
@@ -197,12 +199,56 @@
                         vflag = false;
                     }
                 }
+                File tmpfile = null;
+                final OutputStream finalout = out;
+                final String tmpbase = (fname == null)
+                        ? "tmpjar"
+                        : fname.substring(fname.indexOf(File.separatorChar) + 1);
+                if (nflag) {
+                    tmpfile = createTemporaryFile(tmpbase, ".jar");
+                    out = new FileOutputStream(tmpfile);
+                }
                 expand(null, files, false);
                 create(new BufferedOutputStream(out, 4096), manifest);
                 if (in != null) {
                     in.close();
                 }
                 out.close();
+                if(nflag) {
+                    JarFile jarFile = null;
+                    File packFile = null;
+                    JarOutputStream jos = null;
+                    try {
+                        Packer packer = Pack200.newPacker();
+                        Map<String, String> p = packer.properties();
+                        p.put(Packer.EFFORT, "1"); // Minimal effort to conserve CPU
+                        jarFile = new JarFile(tmpfile.getCanonicalPath());
+                        packFile = createTemporaryFile(tmpbase, ".pack");
+                        out = new FileOutputStream(packFile);
+                        packer.pack(jarFile, out);
+                        jos = new JarOutputStream(finalout);
+                        Unpacker unpacker = Pack200.newUnpacker();
+                        unpacker.unpack(packFile, jos);
+                    } catch (IOException ioe) {
+                        fatalError(ioe);
+                    } finally {
+                        if (jarFile != null) {
+                            jarFile.close();
+                        }
+                        if (out != null) {
+                            out.close();
+                        }
+                        if (jos != null) {
+                            jos.close();
+                        }
+                        if (tmpfile != null && tmpfile.exists()) {
+                            tmpfile.delete();
+                        }
+                        if (packFile != null && packFile.exists()) {
+                            packFile.delete();
+                        }
+                    }
+                }
             } else if (uflag) {
                 File inputFile = null, tmpFile = null;
                 FileInputStream in;
@@ -358,6 +404,9 @@
                     rootjar = args[count++];
                     iflag = true;
                     break;
+                case 'n':
+                    nflag = true;
+                    break;
                 case 'e':
                      ename = args[count++];
                      break;
@@ -1170,7 +1219,7 @@
     }
 
     /**
-     * Print an error mesage; like something is broken
+     * Print an error message; like something is broken
      */
     protected void error(String s) {
         err.println(s);
@@ -1215,4 +1264,34 @@
             e.setCrc(crc.getValue());
         }
     }
+
+    /**
+     * Attempt to create temporary file in the system-provided temporary folder, if failed attempts
+     * to create it in the same folder as the file in parameter (if any)
+     */
+    private File createTemporaryFile(String tmpbase, String suffix) {
+        File tmpfile = null;
+
+        try {
+            tmpfile = File.createTempFile(tmpbase, suffix);
+        } catch (IOException | SecurityException e) {
+            // Unable to create file due to permission violation or security exception
+        }
+        if (tmpfile == null) {
+            // Were unable to create temporary file, fall back to temporary file in the same folder
+            if (fname != null) {
+                try {
+                    File tmpfolder = new File(fname).getAbsoluteFile().getParentFile();
+                    tmpfile = File.createTempFile(fname, ".tmp" + suffix, tmpfolder);
+                } catch (IOException ioe) {
+                    // Last option failed - fall gracefully
+                    fatalError(ioe);
+                }
+            } else {
+                // No options left - we can not compress to stdout without access to the temporary folder
+                fatalError(new IOException(getMsg("error.create.tempfile")));
+            }
+        }
+        return tmpfile;
+    }
 }
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -44,6 +44,8 @@
         {0} : could not create directory
 error.incorrect.length=\
         incorrect length while processing: {0}
+error.create.tempfile=\
+        Could not create a temporary file
 out.added.manifest=\
         added manifest
 out.update.manifest=\
@@ -66,7 +68,7 @@
         (in = {0}) (out= {1})
 
 usage=\
-Usage: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\
+Usage: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\
 Options:\n\
 \ \   -c  create new archive\n\
 \ \   -t  list table of contents for archive\n\
@@ -75,6 +77,7 @@
 \ \   -v  generate verbose output on standard output\n\
 \ \   -f  specify archive file name\n\
 \ \   -m  include manifest information from specified manifest file\n\
+\ \   -n  perform Pack200 normalization after creating a new archive\n\
 \ \   -e  specify application entry point for stand-alone application \n\
 \ \       bundled into an executable jar file\n\
 \ \   -0  store only; use no ZIP compression\n\
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_es.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_es.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -44,4 +44,4 @@
 out.inflated=\ inflado: {0}
 out.size=(entrada = {0}) (salida = {1})
 
-usage=Sintaxis: jar {ctxui}[vfm0Me] [archive-jar] [archive-manifiesto] [punto-entrada] [-C dir] archivos...\nOpciones:\n    -c  crear nuevo archivo\n    -t  crear la tabla de contenido del archivo\n    -x extraer el archive mencionado (o todos) del archivo\n    -u  actualizar archive existente\n    -v  generar salida detallada de los datos de salida est\u00E1ndar\n    -f  especificar nombre de archive de almacenamiento\n    -m  incluir informaci\u00F3n de manifiesto del archive de manifiesto especificado\n    -e  especificar punto de entrada de la aplicaci\u00F3n para la aplicaci\u00F3n aut\u00F3noma \n        que se incluye dentro de un archive jar ejecutable\n    -0  s\u00F3lo almacenar; no utilizar compresi\u00F3n ZIP\n    -M  no crear un archive de manifiesto para las entradas\n    -i  generar informaci\u00F3n de \u00EDndice para los archives jar especificados\n    -C  cambiar al directorio especificado e incluir el archivo siguiente\nSi alg\u00FAn archivo es un directorio, se procesar\u00E1 de forma recurrente.\nEl nombre del archivo de manifiesto, el nombre del archivo de almacenamiento y el nombre del punto de entrada se\nespecifican en el mismo orden que los indicadores 'm', 'f' y 'e'.\n\nEjemplo 1: para archivar archivos de dos clases en un archivo llamado classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nEjemplo 2: utilice un archivo de manifiesto existente 'mymanifest' y archive todos los\n           archivos del directorio foo/ en 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Sintaxis: jar {ctxui}[vfm0Me] [archive-jar] [archive-manifiesto] [punto-entrada] [-C dir] archivos...\nOpciones:\n    -c  crear nuevo archivo\n    -t  crear la tabla de contenido del archivo\n    -x  extraer el archive mencionado (o todos) del archivo\n    -u  actualizar archive existente\n    -v  generar salida detallada de los datos de salida est\u00E1ndar\n    -f  especificar nombre de archive de almacenamiento\n    -m  incluir informaci\u00F3n de manifiesto del archive de manifiesto especificado\n    -e  especificar punto de entrada de la aplicaci\u00F3n para la aplicaci\u00F3n aut\u00F3noma \n        que se incluye dentro de un archive jar ejecutable\n    -0  s\u00F3lo almacenar; no utilizar compresi\u00F3n ZIP\n    -M  no crear un archive de manifiesto para las entradas\n    -i  generar informaci\u00F3n de \u00EDndice para los archives jar especificados\n    -C  cambiar al directorio especificado e incluir el archivo siguiente\nSi alg\u00FAn archivo es un directorio, se procesar\u00E1 de forma recurrente.\nEl nombre del archivo de manifiesto, el nombre del archivo de almacenamiento y el nombre del punto de entrada se\nespecifican en el mismo orden que los indicadores 'm', 'f' y 'e'.\n\nEjemplo 1: para archivar archivos de dos clases en un archivo llamado classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nEjemplo 2: utilice un archivo de manifiesto existente 'mymanifest' y archive todos los\n           archivos del directorio foo/ en 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_it.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_it.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -44,4 +44,4 @@
 out.inflated=\ decompresso: {0}
 out.size=(in = {0}) (out = {1})
 
-usage=Uso: jar {ctxui}[vfm0Me] [file-jar] [file-manifest] [punto di ingresso] [-C dir] file ...\nOpzioni:\n    -c  crea un nuovo archivio\n    -t  visualizza l'indice dell'archivio\n    -x  estrae i file con nome (o tutti i file) dall'archivio\n    -u  aggiorna l'archivio esistente\n    -v  genera output commentato dall'output standard\n    -f  specifica il nome file dell'archivio\n    -m  include informazioni manifest dal file manifest specificato\n    -e  specifica il punto di ingresso per l'applicazione stand-alone \n        inclusa nel file jar eseguibile\n    -0  solo memorizzazione; senza compressione ZIP\n    -M  consente di non creare un file manifest per le voci\n    -i  genera informazioni sull'indice per i file jar specificati\n    -C  imposta la directory specificata e include il file seguente\nSe un file \u00E8 una directory, verr\u00E0 elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di ingresso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' ed 'e'.\n\nEsempio 1: archiviazione di due file di classe in un archivio con il nome classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nEsempio 2: utilizzo del file manifest esistente 'mymanifest' e archiviazione di tutti i\n           file della directory foo/ in 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/.\n
+usage=Uso: jar {ctxui}[vfm0Me] [file-jar] [file-manifest] [punto di ingresso] [-C dir] file ...\nOpzioni:\n    -c  crea un nuovo archivio\n    -t  visualizza l'indice dell'archivio\n    -x  estrae i file con nome (o tutti i file) dall'archivio\n    -u  aggiorna l'archivio esistente\n    -v  genera output commentato dall'output standard\n    -f  specifica il nome file dell'archivio\n    -m  include informazioni manifest dal file manifest specificato\n    -e  specifica il punto di ingresso per l'applicazione stand-alone \n        inclusa nel file jar eseguibile\n    -0  solo memorizzazione; senza compressione ZIP\n    -M  consente di non creare un file manifest per le voci\n    -i  genera informazioni sull'indice per i file jar specificati\n    -C  imposta la directory specificata e include il file seguente\nSe un file \u00E8 una directory, verr\u00E0 elaborato in modo ricorsivo.\nIl nome del file manifest, del file di archivio e del punto di ingresso devono\nessere specificati nello stesso ordine dei flag 'm', 'f' ed 'e'.\n\nEsempio 1: archiviazione di due file di classe in un archivio con il nome classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nEsempio 2: utilizzo del file manifest esistente 'mymanifest' e archiviazione di tutti i\n           file della directory foo/ in 'classes.jar': \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_ja.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_ja.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -44,4 +44,4 @@
 out.inflated=\ {0}\u304C\u5C55\u958B\u3055\u308C\u307E\u3057\u305F
 out.size=(\u5165={0})(\u51FA={1})
 
-usage=\u4F7F\u7528\u65B9\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u30AA\u30D7\u30B7\u30E7\u30F3:\n   -c \u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B\n   -t \u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u5185\u5BB9\u3092\u4E00\u89A7\u8868\u793A\u3059\u308B\n   -x \u6307\u5B9A\u306E(\u307E\u305F\u306F\u3059\u3079\u3066\u306E)\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u62BD\u51FA\u3059\u308B\n   -u \u65E2\u5B58\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u66F4\u65B0\u3059\u308B\n   -v \u6A19\u6E96\u51FA\u529B\u306B\u8A73\u7D30\u306A\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n   -f \u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3059\u308B\n   -m \u6307\u5B9A\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u60C5\u5831\u3092\u53D6\u308A\u8FBC\u3080\n   -e \u5B9F\u884C\u53EF\u80FDjar\u30D5\u30A1\u30A4\u30EB\u306B\u30D0\u30F3\u30C9\u30EB\u3055\u308C\u305F\u30B9\u30BF\u30F3\u30C9\u30A2\u30ED\u30F3\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\n      \u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u3092\u6307\u5B9A\u3059\u308B\n   -0 \u683C\u7D0D\u306E\u307F\u3002ZIP\u5727\u7E2E\u3092\u4F7F\u7528\u3057\u306A\u3044\n   -M \u30A8\u30F3\u30C8\u30EA\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u306A\u3044\n   -i \u6307\u5B9A\u306Ejar\u30D5\u30A1\u30A4\u30EB\u306E\u7D22\u5F15\u60C5\u5831\u3092\u751F\u6210\u3059\u308B\n   -C \u6307\u5B9A\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u5909\u66F4\u3057\u3001\u4EE5\u4E0B\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u53D6\u308A\u8FBC\u3080\n\u30D5\u30A1\u30A4\u30EB\u304C\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u5834\u5408\u306F\u518D\u5E30\u7684\u306B\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\n\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3001\u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u304A\u3088\u3073\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u540D\u306F\u3001\n\u30D5\u30E9\u30B0'm'\u3001'f'\u3001'e'\u306E\u6307\u5B9A\u3068\u540C\u3058\u9806\u756A\u3067\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\n\u4F8B1: 2\u3064\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6classes.jar\u306B\u4FDD\u5B58\u3059\u308B:\n     jar cvf classes.jar Foo.class Bar.class\n\u4F8B2: \u65E2\u5B58\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB'mymanifest'\u3092\u4F7F\u7528\u3057\u3001foo/\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\n    \u5168\u30D5\u30A1\u30A4\u30EB\u3092'classes.jar'\u306B\u30A2\u30FC\u30AB\u30A4\u30D6\u3059\u308B:\n     jar cvfm classes.jar mymanifest -C foo/ \n
+usage=\u4F7F\u7528\u65B9\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u30AA\u30D7\u30B7\u30E7\u30F3:\n   -c \u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u65B0\u898F\u4F5C\u6210\u3059\u308B\n   -t \u30A2\u30FC\u30AB\u30A4\u30D6\u306E\u5185\u5BB9\u3092\u4E00\u89A7\u8868\u793A\u3059\u308B\n   -x \u6307\u5B9A\u306E(\u307E\u305F\u306F\u3059\u3079\u3066\u306E)\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6\u304B\u3089\u62BD\u51FA\u3059\u308B\n   -u \u65E2\u5B58\u30A2\u30FC\u30AB\u30A4\u30D6\u3092\u66F4\u65B0\u3059\u308B\n   -v \u6A19\u6E96\u51FA\u529B\u306B\u8A73\u7D30\u306A\u51FA\u529B\u3092\u751F\u6210\u3059\u308B\n   -f \u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u6307\u5B9A\u3059\u308B\n   -m \u6307\u5B9A\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u304B\u3089\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u60C5\u5831\u3092\u53D6\u308A\u8FBC\u3080\n   -e \u5B9F\u884C\u53EF\u80FDjar\u30D5\u30A1\u30A4\u30EB\u306B\u30D0\u30F3\u30C9\u30EB\u3055\u308C\u305F\u30B9\u30BF\u30F3\u30C9\u30A2\u30ED\u30F3\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\n      \u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u3092\u6307\u5B9A\u3059\u308B\n   -0 \u683C\u7D0D\u306E\u307F\u3002ZIP\u5727\u7E2E\u3092\u4F7F\u7528\u3057\u306A\u3044\n   -M \u30A8\u30F3\u30C8\u30EA\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u306A\u3044\n   -i \u6307\u5B9A\u306Ejar\u30D5\u30A1\u30A4\u30EB\u306E\u7D22\u5F15\u60C5\u5831\u3092\u751F\u6210\u3059\u308B\n   -C \u6307\u5B9A\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u5909\u66F4\u3057\u3001\u4EE5\u4E0B\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u53D6\u308A\u8FBC\u3080\n\u30D5\u30A1\u30A4\u30EB\u304C\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u5834\u5408\u306F\u518D\u5E30\u7684\u306B\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\n\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u3001\u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u30D5\u30A1\u30A4\u30EB\u540D\u304A\u3088\u3073\u30A8\u30F3\u30C8\u30EA\u30FB\u30DD\u30A4\u30F3\u30C8\u540D\u306F\u3001\n\u30D5\u30E9\u30B0'm'\u3001'f'\u3001'e'\u306E\u6307\u5B9A\u3068\u540C\u3058\u9806\u756A\u3067\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n\n\u4F8B1: 2\u3064\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30FC\u30AB\u30A4\u30D6classes.jar\u306B\u4FDD\u5B58\u3059\u308B:\n     jar cvf classes.jar Foo.class Bar.class\n\u4F8B2: \u65E2\u5B58\u306E\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB'mymanifest'\u3092\u4F7F\u7528\u3057\u3001foo/\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\n     \u5168\u30D5\u30A1\u30A4\u30EB\u3092'classes.jar'\u306B\u30A2\u30FC\u30AB\u30A4\u30D6\u3059\u308B:\n     jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_sv.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_sv.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -44,4 +44,4 @@
 out.inflated=\ uppackat: {0}
 out.size=(in = {0}) (ut = {1})
 
-usage=Syntax: jar {ctxui}[vfm0Me] [jar fil] [manifestfil] [startpunkt] [-C-katalog] ...\nAlternativ:\n    -c  skapa nytt arkiv\n    -t  lista inneh\u00E5llsf\u00F6rteckning f\u00F6r arkiv\n    -x  extrahera namngivna (eller alla) filer fr\u00E5n arkiv\n    -u  uppdatera befintligt arkiv\n    -v  generera utf\u00F6rliga utdata vid standardutmatning\n    -f  ange arkivfilens namn\n    -m  inkludera manifestinformation fr\u00E5n angivet manifest\n    -e  ange programstartpunkt f\u00F6r frist\u00E5ende applikation \n        som medf\u00F6ljer i en jar-programfil\n    -0  endast lagra  (ingen zip-komprimering)\n    -M  skapa inte n\u00E5gon manifestfil f\u00F6r posterna\n    -i  generera indexinformation f\u00F6r de angivna jar-filerna\n    -C  \u00E4ndra till den angivna katalogen och inkludera f\u00F6ljande fil\nOm en fil \u00E4r en katalog bearbetas den rekursivt.\nNamnen p\u00E5 manifestfilen, arkivfilen och startpunkten anges i samma\nordning som m-, f- och e-flaggorna.\n\nExempel 1: S\u00E5 h\u00E4r arkiverar du tv\u00E5 klassfiler i ett arkiv med namnet classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nExempel 2: Anv\u00E4nd en befintlig manifestfil (mymanifest) och arkivera alla\n           filer fr\u00E5n katalogen foo/ i classes.jar: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
+usage=Syntax: jar {ctxui}[vfm0Me] [jar-fil] [manifestfil] [startpunkt] [-C katalog] filer...\nAlternativ:\n    -c  skapa nytt arkiv\n    -t  lista inneh\u00E5llsf\u00F6rteckning f\u00F6r arkiv\n    -x  extrahera namngivna (eller alla) filer fr\u00E5n arkiv\n    -u  uppdatera befintligt arkiv\n    -v  generera utf\u00F6rliga utdata vid standardutmatning\n    -f  ange arkivfilens namn\n    -m  inkludera manifestinformation fr\u00E5n angivet manifest\n    -e  ange programstartpunkt f\u00F6r frist\u00E5ende applikation \n        som medf\u00F6ljer i en jar-programfil\n    -0  endast lagra  (ingen zip-komprimering)\n    -M  skapa inte n\u00E5gon manifestfil f\u00F6r posterna\n    -i  generera indexinformation f\u00F6r de angivna jar-filerna\n    -C  \u00E4ndra till den angivna katalogen och inkludera f\u00F6ljande fil\nOm en fil \u00E4r en katalog bearbetas den rekursivt.\nNamnen p\u00E5 manifestfilen, arkivfilen och startpunkten anges i samma\nordning som m-, f- och e-flaggorna.\n\nExempel 1: S\u00E5 h\u00E4r arkiverar du tv\u00E5 klassfiler i ett arkiv med namnet classes.jar: \n       jar cvf classes.jar Foo.class Bar.class \nExempel 2: Anv\u00E4nd en befintlig manifestfil (mymanifest) och arkivera alla\n           filer fr\u00E5n katalogen foo/ i classes.jar: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_CN.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jar/resources/jar_zh_CN.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -44,4 +44,4 @@
 out.inflated=\  \u5DF2\u89E3\u538B: {0}
 out.size=(\u8F93\u5165 = {0}) (\u8F93\u51FA = {1})
 
-usage=\u7528\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u9009\u9879\u5305\u62EC: \n    -c  \u521B\u5EFA\u65B0\u7684\u5F52\u6863\u6587\u4EF6\n    -t  \u5217\u51FA\u5F52\u6863\u76EE\u5F55\n    -x  \u4ECE\u6863\u6848\u4E2D\u63D0\u53D6\u6307\u5B9A\u7684 (\u6216\u6240\u6709) \u6587\u4EF6\n    -u  \u66F4\u65B0\u73B0\u6709\u7684\u5F52\u6863\u6587\u4EF6\n    -v  \u5728\u6807\u51C6\u8F93\u51FA\u4E2D\u751F\u6210\u8BE6\u7EC6\u8F93\u51FA\n    -f  \u6307\u5B9A\u5F52\u6863\u6587\u4EF6\u540D\n    -m  \u5305\u542B\u6307\u5B9A\u6E05\u5355\u6587\u4EF6\u4E2D\u7684\u6E05\u5355\u4FE1\u606F\n    -e  \u4E3A\u6346\u7ED1\u5230\u53EF\u6267\u884C jar \u6587\u4EF6\u7684\u72EC\u7ACB\u5E94\u7528\u7A0B\u5E8F\n        \u6307\u5B9A\u5E94\u7528\u7A0B\u5E8F\u5165\u53E3\u70B9\n    -0  \u4EC5\u5B58\u50A8; \u4E0D\u4F7F\u7528\u60C5\u51B5\u4EFB\u4F55 ZIP \u538B\u7F29\n    -M  \u4E0D\u521B\u5EFA\u6761\u76EE\u7684\u6E05\u5355\u6587\u4EF6\n    -i  \u4E3A\u6307\u5B9A\u7684 jar \u6587\u4EF6\u751F\u6210\u7D22\u5F15\u4FE1\u606F\n    -C  \u66F4\u6539\u4E3A\u6307\u5B9A\u7684\u76EE\u5F55\u5E76\u5305\u542B\u5176\u4E2D\u7684\u6587\u4EF6\n\u5982\u679C\u6709\u4EFB\u4F55\u76EE\u5F55\u6587\u4EF6, \u5219\u5BF9\u5176\u8FDB\u884C\u9012\u5F52\u5904\u7406\u3002\n\u6E05\u5355\u6587\u4EF6\u540D, \u5F52\u6863\u6587\u4EF6\u540D\u548C\u5165\u53E3\u70B9\u540D\u79F0\u7684\u6307\u5B9A\u987A\u5E8F\n\u4E0E 'm', 'f' \u548C 'e' \u6807\u8BB0\u7684\u6307\u5B9A\u987A\u5E8F\u76F8\u540C\u3002\n\n\u793A\u4F8B 1: \u5C06\u4E24\u4E2A\u7C7B\u6587\u4EF6\u5F52\u6863\u5230\u4E00\u4E2A\u540D\u4E3A classes.jar \u7684\u5F52\u6863\u6587\u4EF6\u4E2D: \n       jar cvf classes.jar Foo.class Bar.class \n\u793A\u4F8B 2: \u4F7F\u7528\u73B0\u6709\u7684\u6E05\u5355\u6587\u4EF6 'mymanifest' \u5E76\n           \u5C06 foo/ \u76EE\u5F55\u4E2D\u7684\u6240\u6709\u6587\u4EF6\u5F52\u6863\u5230 'classes.jar' \u4E2D: \n       jar cvfm classes.jar mymanifest -C foo/\u3002\n
+usage=\u7528\u6CD5: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\u9009\u9879\u5305\u62EC: \n    -c  \u521B\u5EFA\u65B0\u7684\u5F52\u6863\u6587\u4EF6\n    -t  \u5217\u51FA\u5F52\u6863\u76EE\u5F55\n    -x  \u4ECE\u6863\u6848\u4E2D\u63D0\u53D6\u6307\u5B9A\u7684 (\u6216\u6240\u6709) \u6587\u4EF6\n    -u  \u66F4\u65B0\u73B0\u6709\u7684\u5F52\u6863\u6587\u4EF6\n    -v  \u5728\u6807\u51C6\u8F93\u51FA\u4E2D\u751F\u6210\u8BE6\u7EC6\u8F93\u51FA\n    -f  \u6307\u5B9A\u5F52\u6863\u6587\u4EF6\u540D\n    -m  \u5305\u542B\u6307\u5B9A\u6E05\u5355\u6587\u4EF6\u4E2D\u7684\u6E05\u5355\u4FE1\u606F\n    -e  \u4E3A\u6346\u7ED1\u5230\u53EF\u6267\u884C jar \u6587\u4EF6\u7684\u72EC\u7ACB\u5E94\u7528\u7A0B\u5E8F\n        \u6307\u5B9A\u5E94\u7528\u7A0B\u5E8F\u5165\u53E3\u70B9\n    -0  \u4EC5\u5B58\u50A8; \u4E0D\u4F7F\u7528\u60C5\u51B5\u4EFB\u4F55 ZIP \u538B\u7F29\n    -M  \u4E0D\u521B\u5EFA\u6761\u76EE\u7684\u6E05\u5355\u6587\u4EF6\n    -i  \u4E3A\u6307\u5B9A\u7684 jar \u6587\u4EF6\u751F\u6210\u7D22\u5F15\u4FE1\u606F\n    -C  \u66F4\u6539\u4E3A\u6307\u5B9A\u7684\u76EE\u5F55\u5E76\u5305\u542B\u5176\u4E2D\u7684\u6587\u4EF6\n\u5982\u679C\u6709\u4EFB\u4F55\u76EE\u5F55\u6587\u4EF6, \u5219\u5BF9\u5176\u8FDB\u884C\u9012\u5F52\u5904\u7406\u3002\n\u6E05\u5355\u6587\u4EF6\u540D, \u5F52\u6863\u6587\u4EF6\u540D\u548C\u5165\u53E3\u70B9\u540D\u79F0\u7684\u6307\u5B9A\u987A\u5E8F\n\u4E0E 'm', 'f' \u548C 'e' \u6807\u8BB0\u7684\u6307\u5B9A\u987A\u5E8F\u76F8\u540C\u3002\n\n\u793A\u4F8B 1: \u5C06\u4E24\u4E2A\u7C7B\u6587\u4EF6\u5F52\u6863\u5230\u4E00\u4E2A\u540D\u4E3A classes.jar \u7684\u5F52\u6863\u6587\u4EF6\u4E2D: \n       jar cvf classes.jar Foo.class Bar.class \n\u793A\u4F8B 2: \u4F7F\u7528\u73B0\u6709\u7684\u6E05\u5355\u6587\u4EF6 'mymanifest' \u5E76\n           \u5C06 foo/ \u76EE\u5F55\u4E2D\u7684\u6240\u6709\u6587\u4EF6\u5F52\u6863\u5230 'classes.jar' \u4E2D: \n       jar cvfm classes.jar mymanifest -C foo/ .\n
--- a/jdk/src/share/classes/sun/tools/jconsole/BorderedComponent.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jconsole/BorderedComponent.java	Wed Jul 05 19:21:26 2017 +0200
@@ -266,7 +266,7 @@
      * default position.
      * <p>
      * If the border property value is not
-     * specified in the constuctor or by invoking the appropriate
+     * specified in the constructor or by invoking the appropriate
      * set method, the property value will be defined by the current
      * look and feel, using the following property name in the
      * Defaults Table:
--- a/jdk/src/share/classes/sun/tools/jconsole/inspector/XTextField.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jconsole/inspector/XTextField.java	Wed Jul 05 19:21:26 2017 +0200
@@ -182,19 +182,19 @@
 
     public void changedUpdate(DocumentEvent e) {
         // the user typed something, so remove references
-        // to the obejct that was dropped.
+        // to the object that was dropped.
         clearObject();
     }
 
     public void removeUpdate(DocumentEvent e) {
         // the user typed something, so remove references
-        // to the obejct that was dropped.
+        // to the object that was dropped.
         clearObject();
     }
 
     public void insertUpdate(DocumentEvent e) {
         // the user typed something, so remove references
-        // to the obejct that was dropped.
+        // to the object that was dropped.
         clearObject();
     }
 
--- a/jdk/src/share/classes/sun/tools/jinfo/JInfo.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jinfo/JInfo.java	Wed Jul 05 19:21:26 2017 +0200
@@ -35,7 +35,7 @@
 
 /*
  * This class is the main class for the JInfo utility. It parses its arguments
- * and decides if the command should be satisifed using the VM attach mechanism
+ * and decides if the command should be satisfied using the VM attach mechanism
  * or an SA tool. At this time the only option that uses the VM attach
  * mechanism is the -flag option to set or print a command line option of a
  * running application. All other options are mapped to SA tools.
--- a/jdk/src/share/classes/sun/tools/jmap/JMap.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jmap/JMap.java	Wed Jul 05 19:21:26 2017 +0200
@@ -36,7 +36,7 @@
 
 /*
  * This class is the main class for the JMap utility. It parses its arguments
- * and decides if the command should be satisifed using the VM attach mechanism
+ * and decides if the command should be satisfied using the VM attach mechanism
  * or an SA tool. At this time the only option that uses the VM attach mechanism
  * is the -dump option to get a heap dump of a running application. All other
  * options are mapped to SA tools.
--- a/jdk/src/share/classes/sun/tools/jstat/ColumnFormat.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jstat/ColumnFormat.java	Wed Jul 05 19:21:26 2017 +0200
@@ -57,7 +57,7 @@
         // should allow null data statments
 
         if (expression == null) {
-            // current policy is that a data statment must be specified
+            // current policy is that a data statement must be specified
             throw new ParserException("Missing data statement in column " + number);
         }
         if (header == null) {
--- a/jdk/src/share/classes/sun/tools/jstat/resources/jstat_options	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/jstat/resources/jstat_options	Wed Jul 05 19:21:26 2017 +0200
@@ -314,7 +314,7 @@
     format "0.0"
   }
   column {
-    header "^OGCMN^"	/* Old Generation Capacity - Minumum */
+    header "^OGCMN^"	/* Old Generation Capacity - Minimum */
     data sun.gc.generation.1.minCapacity
     scale K
     align right
@@ -776,7 +776,7 @@
 
 option gcoldcapacity {
   column {
-    header "^OGCMN^"	/* Old Generation Capacity - Minumum */
+    header "^OGCMN^"	/* Old Generation Capacity - Minimum */
     data sun.gc.generation.1.minCapacity
     scale K
     align right
--- a/jdk/src/share/classes/sun/tools/tree/ExprExpression.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/tree/ExprExpression.java	Wed Jul 05 19:21:26 2017 +0200
@@ -29,7 +29,7 @@
 import java.util.Hashtable;
 
 /**
- * Parenthesised expressions.
+ * Parenthesized expressions.
  *
  * WARNING: The contents of this source file are not part of any
  * supported API.  Code that depends on them does so at its own risk:
--- a/jdk/src/share/classes/sun/tools/tree/FieldExpression.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/tools/tree/FieldExpression.java	Wed Jul 05 19:21:26 2017 +0200
@@ -154,7 +154,7 @@
                 return t;
             }
 
-            // These were ommitted earlier in calls to 'toType', but I can't
+            // These were omitted earlier in calls to 'toType', but I can't
             // see any reason for that.  I think it was an oversight.  See
             // 'checkCommon' and 'checkInnerClass'.
             innerClass.noteUsedBy(ctxClass, where, env);
@@ -1121,7 +1121,7 @@
         // either.
         //
         // However, NullPointerException can't happen and initialization must
-        // already have occured if you are dotting into 'this'.  So
+        // already have occurred if you are dotting into 'this'.  So
         // allow fields of 'this' to be eliminated as a special case.
         Expression e = inlineValue(env, ctx);
         if (e instanceof FieldExpression) {
--- a/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Wed Jul 05 19:21:26 2017 +0200
@@ -26,6 +26,7 @@
 package sun.util.calendar;
 
 import java.io.ByteArrayInputStream;
+import java.io.BufferedInputStream;
 import java.io.DataInput;
 import java.io.DataInputStream;
 import java.io.File;
@@ -65,8 +66,17 @@
      * @return a set of time zone IDs.
      */
     public static String[] getZoneIds() {
-        String[] ids = Arrays.copyOf(regions, regions.length + oldMappings.length);
+        int len = regions.length + oldMappings.length;
+        if (!USE_OLDMAPPING) {
+            len += 3;    // EST/HST/MST not in tzdb.dat
+        }
+        String[] ids = Arrays.copyOf(regions, len);
         int i = regions.length;
+        if (!USE_OLDMAPPING) {
+            ids[i++] = "EST";
+            ids[i++] = "HST";
+            ids[i++] = "MST";
+        }
         for (int j = 0; j < oldMappings.length; j++) {
             ids[i++] = oldMappings[j][0];
         }
@@ -243,7 +253,8 @@
                 try {
                     String libDir = System.getProperty("java.home") + File.separator + "lib";
                     try (DataInputStream dis = new DataInputStream(
-                             new FileInputStream(new File(libDir, "tzdb.dat")))) {
+                             new BufferedInputStream(new FileInputStream(
+                                 new File(libDir, "tzdb.dat"))))) {
                         load(dis);
                     }
                 } catch (Exception x) {
@@ -262,9 +273,17 @@
             aliases.put("EST", "America/New_York");
             aliases.put("MST", "America/Denver");
             aliases.put("HST", "Pacific/Honolulu");
+        } else {
+            zones.put("EST", new ZoneInfo("EST", -18000000));
+            zones.put("MST", new ZoneInfo("MST", -25200000));
+            zones.put("HST", new ZoneInfo("HST", -36000000));
         }
     }
 
+    public static boolean useOldMapping() {
+       return USE_OLDMAPPING;
+    }
+
     /**
      * Loads the rules from a DateInputStream
      *
--- a/jdk/src/share/classes/sun/util/locale/provider/RuleBasedBreakIterator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/util/locale/provider/RuleBasedBreakIterator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -822,7 +822,7 @@
     }
 
     /**
-     * Returns true if the specfied position is a boundary position.  As a side
+     * Returns true if the specified position is a boundary position.  As a side
      * effect, leaves the iterator pointing to the first boundary position at
      * or after "offset".
      * @param offset the offset to check.
--- a/jdk/src/share/classes/sun/util/logging/PlatformLogger.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/util/logging/PlatformLogger.java	Wed Jul 05 19:21:26 2017 +0200
@@ -135,7 +135,7 @@
 
         static Level valueOf(int level) {
             switch (level) {
-                // ordering per the highest occurences in the jdk source
+                // ordering per the highest occurrences in the jdk source
                 // finest, fine, finer, info first
                 case PlatformLogger.FINEST  : return Level.FINEST;
                 case PlatformLogger.FINE    : return Level.FINE;
--- a/jdk/src/share/classes/sun/util/resources/ko/LocaleNames_ko.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/util/resources/ko/LocaleNames_ko.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -1045,7 +1045,7 @@
 PN=\ud54f\ucf00\uc5b8 \uc81c\ub3c4
 PR=\ud478\uc5d0\ub974\ud1a0\ub9ac\ucf54
 PS=\ud314\ub808\uc2a4\ud0c0\uc778
-PT=\ud3ec\ub974\ud2b8\uce7c
+PT=\ud3ec\ub974\ud22c\uce7c
 PW=\ud314\ub77c\uc6b0
 PY=\ud30c\ub77c\uacfc\uc774
 QA=\uce74\ud0c0\ub974
--- a/jdk/src/share/classes/sun/util/resources/sv/LocaleNames_sv.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/util/resources/sv/LocaleNames_sv.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -1106,7 +1106,7 @@
 WS=Samoa
 YE=Jemen
 YT=Mayotte
-ZA=Sydafrika 
+ZA=Sydafrika
 ZM=Zambia
 ZW=Zimbabwe
 
--- a/jdk/src/share/classes/sun/util/xml/PlatformXmlPropertiesProvider.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/classes/sun/util/xml/PlatformXmlPropertiesProvider.java	Wed Jul 05 19:21:26 2017 +0200
@@ -28,6 +28,7 @@
 import java.io.*;
 import java.util.*;
 import java.nio.charset.*;
+import java.util.Map.Entry;
 import org.xml.sax.*;
 import org.w3c.dom.*;
 import javax.xml.parsers.*;
@@ -153,11 +154,15 @@
         }
 
         synchronized (props) {
-            for (String key : props.stringPropertyNames()) {
-                Element entry = (Element)properties.appendChild(
-                    doc.createElement("entry"));
-                entry.setAttribute("key", key);
-                entry.appendChild(doc.createTextNode(props.getProperty(key)));
+            for (Entry<Object, Object> e : props.entrySet()) {
+                final Object k = e.getKey();
+                final Object v = e.getValue();
+                if (k instanceof String && v instanceof String) {
+                    Element entry = (Element)properties.appendChild(
+                        doc.createElement("entry"));
+                    entry.setAttribute("key", (String)k);
+                    entry.appendChild(doc.createTextNode((String)v));
+                }
             }
         }
         emitDocument(doc, os, encoding);
--- a/jdk/src/share/demo/jfc/Font2DTest/FontPanel.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/demo/jfc/Font2DTest/FontPanel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -524,7 +524,7 @@
              * graphics anti-aliasing hint if the text anti-aliasing hint
              * was set. The dubious element here is that people simply
              * using this program may think this is built-in behaviour
-             * but its not - at least not when the app explictly draws
+             * but its not - at least not when the app explicitly draws
              * outline text.
              * This becomes more dubious in cases such as "GASP" where the
              * size at which text is AA'ed is not something you can easily
--- a/jdk/src/share/demo/jfc/Notepad/resources/Notepad_fr.properties	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-#
-# Resource strings for Notepad example
-
-Title=Notepad
-
-# Menu labels
-fileLabel=Fichier
-openLabel=Ouvrir
-newLabel=Nouveau
-saveLabel=Sauver
-exitLabel=Quitter
-
-editLabel=Edition
-cutLabel=Couper
-copyLabel=Copier
-pasteLabel=Coller
-
--- a/jdk/src/share/demo/jfc/Notepad/resources/Notepad_sv.properties	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-#
-# Resource strings for Notepad example
-
-Title=Notepad
-
-# Menu labels
-fileLabel=Arkiv
-openLabel=Öppna
-newLabel=Ny
-saveLabel=Spara
-exitLabel=Avsluta
-
-editLabel=Redigera
-cutLabel=Klippa
-copyLabel=Kopiera
-pasteLabel=Klistra
-
--- a/jdk/src/share/demo/jfc/TableExample/TableExample4.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/demo/jfc/TableExample/TableExample4.java	Wed Jul 05 19:21:26 2017 +0200
@@ -54,7 +54,7 @@
 /**
  * Another JTable example, showing how column attributes can be refined
  * even when columns have been created automatically. Here we create some
- * specialised renderers and editors as well as changing widths and colors
+ * specialized renderers and editors as well as changing widths and colors
  * for some of the columns in the SwingSet demo table.
  *
  * @author Philip Milne
--- a/jdk/src/share/demo/jvmti/hprof/debug_malloc.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/demo/jvmti/hprof/debug_malloc.c	Wed Jul 05 19:21:26 2017 +0200
@@ -250,7 +250,7 @@
 static char *debug_check;
 static void *clobbered_ptr;
 
-/* Minumum macro */
+/* Minimum macro */
 #define minimum(a,b) ((a)<(b)?(a):(b))
 
 /* Message routine */
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1023,7 +1023,7 @@
     }
 
     // Reads zip file central directory. Returns the file position of first
-    // CEN header, otherwise returns -1 if an error occured. If zip->msg != NULL
+    // CEN header, otherwise returns -1 if an error occurred. If zip->msg != NULL
     // then the error was a zip format error and zip->msg has the error text.
     // Always pass in -1 for knownTotal; it's used for a recursive call.
     private byte[] initCEN() throws IOException {
@@ -1740,7 +1740,7 @@
     static class IndexNode {
         byte[] name;
         int    hashcode;  // node is hashable/hashed by its name
-        int    pos = -1;  // postion in cen table, -1 menas the
+        int    pos = -1;  // position in cen table, -1 menas the
                           // entry does not exists in zip file
         IndexNode(byte[] name, int pos) {
             name(name);
--- a/jdk/src/share/javavm/export/jvm.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/javavm/export/jvm.h	Wed Jul 05 19:21:26 2017 +0200
@@ -351,7 +351,7 @@
  * java.lang.Class and java.lang.ClassLoader
  */
 
-#define JVM_DEPTH -1
+#define JVM_CALLER_DEPTH -1
 
 /*
  * Returns the immediate caller class of the native method invoking
@@ -856,7 +856,7 @@
 JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cb, jint index);
 
 /*
- * Returns the name of the field refered to at a given constant pool
+ * Returns the name of the field referred to at a given constant pool
  * index.
  *
  * The result is in UTF format and remains valid until JVM_ReleaseUTF
@@ -869,7 +869,7 @@
 JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cb, jint index);
 
 /*
- * Returns the name of the method refered to at a given constant pool
+ * Returns the name of the method referred to at a given constant pool
  * index.
  *
  * The result is in UTF format and remains valid until JVM_ReleaseUTF
@@ -882,7 +882,7 @@
 JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cb, jint index);
 
 /*
- * Returns the signature of the method refered to at a given constant pool
+ * Returns the signature of the method referred to at a given constant pool
  * index.
  *
  * The result is in UTF format and remains valid until JVM_ReleaseUTF
@@ -895,7 +895,7 @@
 JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cb, jint index);
 
 /*
- * Returns the signature of the field refered to at a given constant pool
+ * Returns the signature of the field referred to at a given constant pool
  * index.
  *
  * The result is in UTF format and remains valid until JVM_ReleaseUTF
@@ -908,7 +908,7 @@
 JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cb, jint index);
 
 /*
- * Returns the class name refered to at a given constant pool index.
+ * Returns the class name referred to at a given constant pool index.
  *
  * The result is in UTF format and remains valid until JVM_ReleaseUTF
  * is called.
@@ -920,7 +920,7 @@
 JVM_GetCPClassNameUTF(JNIEnv *env, jclass cb, jint index);
 
 /*
- * Returns the class name refered to at a given constant pool index.
+ * Returns the class name referred to at a given constant pool index.
  *
  * The constant pool entry must refer to a CONSTANT_Fieldref.
  *
@@ -934,7 +934,7 @@
 JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cb, jint index);
 
 /*
- * Returns the class name refered to at a given constant pool index.
+ * Returns the class name referred to at a given constant pool index.
  *
  * The constant pool entry must refer to CONSTANT_Methodref or
  * CONSTANT_InterfaceMethodref.
--- a/jdk/src/share/lib/security/java.security-linux	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/lib/security/java.security-linux	Wed Jul 05 19:21:26 2017 +0200
@@ -183,6 +183,7 @@
                com.sun.jmx.,\
                com.sun.media.sound.,\
                com.sun.proxy.,\
+               com.sun.corba.se.,\
                com.sun.org.apache.bcel.internal.,\
                com.sun.org.apache.regexp.internal.,\
                com.sun.org.apache.xerces.internal.,\
@@ -228,6 +229,7 @@
                    com.sun.jmx.,\
                    com.sun.media.sound.,\
                    com.sun.proxy.,\
+                   com.sun.corba.se.,\
                    com.sun.org.apache.bcel.internal.,\
                    com.sun.org.apache.regexp.internal.,\
                    com.sun.org.apache.xerces.internal.,\
--- a/jdk/src/share/lib/security/java.security-macosx	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/lib/security/java.security-macosx	Wed Jul 05 19:21:26 2017 +0200
@@ -184,6 +184,7 @@
                com.sun.jmx.,\
                com.sun.media.sound.,\
                com.sun.proxy.,\
+               com.sun.corba.se.,\
                com.sun.org.apache.bcel.internal.,\
                com.sun.org.apache.regexp.internal.,\
                com.sun.org.apache.xerces.internal.,\
@@ -229,6 +230,7 @@
                    com.sun.jmx.,\
                    com.sun.media.sound.,\
                    com.sun.proxy.,\
+                   com.sun.corba.se.,\
                    com.sun.org.apache.bcel.internal.,\
                    com.sun.org.apache.regexp.internal.,\
                    com.sun.org.apache.xerces.internal.,\
--- a/jdk/src/share/lib/security/java.security-solaris	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/lib/security/java.security-solaris	Wed Jul 05 19:21:26 2017 +0200
@@ -185,6 +185,7 @@
                com.sun.jmx.,\
                com.sun.media.sound.,\
                com.sun.proxy.,\
+               com.sun.corba.se.,\
                com.sun.org.apache.bcel.internal.,\
                com.sun.org.apache.regexp.internal.,\
                com.sun.org.apache.xerces.internal.,\
@@ -229,6 +230,7 @@
                    com.sun.jmx.,\
                    com.sun.media.sound.,\
                    com.sun.proxy.,\
+                   com.sun.corba.se.,\
                    com.sun.org.apache.bcel.internal.,\
                    com.sun.org.apache.regexp.internal.,\
                    com.sun.org.apache.xerces.internal.,\
--- a/jdk/src/share/lib/security/java.security-windows	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/lib/security/java.security-windows	Wed Jul 05 19:21:26 2017 +0200
@@ -184,6 +184,7 @@
                com.sun.jmx.,\
                com.sun.media.sound.,\
                com.sun.proxy.,\
+               com.sun.corba.se.,\
                com.sun.org.apache.bcel.internal.,\
                com.sun.org.apache.regexp.internal.,\
                com.sun.org.apache.xerces.internal.,\
@@ -229,6 +230,7 @@
                    com.sun.jmx.,\
                    com.sun.media.sound.,\
                    com.sun.proxy.,\
+                   com.sun.corba.se.,\
                    com.sun.org.apache.bcel.internal.,\
                    com.sun.org.apache.regexp.internal.,\
                    com.sun.org.apache.xerces.internal.,\
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -62,7 +62,7 @@
 
 #endif // End of ZLIB
 
-#ifdef sparc
+#ifdef _BIG_ENDIAN
 #define SWAP_BYTES(a) \
     ((((a) << 8) & 0xff00) | 0x00ff) & (((a) >> 8) | 0xff00)
 #else
@@ -467,7 +467,7 @@
         zs.avail_in -= TRAILER_LEN;
       } else {
         // Bug: 5023768,we read past the TRAILER_LEN to see if there is
-        // any extraneous data, as we dont support concatenated .gz
+        // any extraneous data, as we don't support concatenated .gz
         // files just yet.
         int extra = (int) read_gzin_fn(u, inbuf, 1, inbuflen);
         zs.avail_in += extra - TRAILER_LEN;
--- a/jdk/src/share/native/com/sun/media/sound/PlatformMidi.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/com/sun/media/sound/PlatformMidi.h	Wed Jul 05 19:21:26 2017 +0200
@@ -222,7 +222,7 @@
 
 /*
  * Return the current time stamp in microseconds.
- * If not supported, or problem occured, returns -1
+ * If not supported, or problem occurred, returns -1
  */
 INT64 MIDI_IN_GetTimeStamp(MidiDeviceHandle* handle);
 
@@ -311,7 +311,7 @@
 /*
  * Return the current time stamp in microseconds (the time since the device
  * was opened).
- * If not supported, or problem occured, returns -1
+ * If not supported, or problem occurred, returns -1
  */
 INT64 MIDI_OUT_GetTimeStamp(MidiDeviceHandle* handle);
 
--- a/jdk/src/share/native/common/jni_util.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/common/jni_util.h	Wed Jul 05 19:21:26 2017 +0200
@@ -40,7 +40,7 @@
  * particularly aware of the fact that these functions are convenience
  * functions, and as such are often compound operations, each one of
  * which may throw an exception. Therefore, the functions this file
- * will often return silently if an exception has occured, and callers
+ * will often return silently if an exception has occurred, and callers
  * must check for exception themselves.
  */
 
@@ -186,7 +186,7 @@
  * pass to it.
  *
  * The method will return an initialized instance if successful.
- * It will return NULL if an error has occured (for example if
+ * It will return NULL if an error has occurred (for example if
  * it ran out of memory) and the appropriate Java exception will
  * have been thrown.
  */
--- a/jdk/src/share/native/java/lang/fdlibm/src/k_rem_pio2.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/java/lang/fdlibm/src/k_rem_pio2.c	Wed Jul 05 19:21:26 2017 +0200
@@ -55,7 +55,7 @@
  *                      z    = (z-x[i])*2**24
  *
  *
- *      y[]     ouput result in an array of double precision numbers.
+ *      y[]     output result in an array of double precision numbers.
  *              The dimension of y[] is:
  *                      24-bit  precision       1
  *                      53-bit  precision       2
--- a/jdk/src/share/native/java/util/zip/zip_util.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/java/util/zip/zip_util.c	Wed Jul 05 19:21:26 2017 +0200
@@ -536,7 +536,7 @@
 
 /*
  * Reads zip file central directory. Returns the file position of first
- * CEN header, otherwise returns -1 if an error occured. If zip->msg != NULL
+ * CEN header, otherwise returns -1 if an error occurred. If zip->msg != NULL
  * then the error was a zip format error and zip->msg has the error text.
  * Always pass in -1 for knownTotal; it's used for a recursive call.
  */
--- a/jdk/src/share/native/sun/awt/image/cvutils/img_dcm.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/awt/image/cvutils/img_dcm.h	Wed Jul 05 19:21:26 2017 +0200
@@ -28,7 +28,7 @@
  * the macros used by the generic scaleloop function.
  *
  * This implementation can decode the pixel information associated
- * with any Java DirectColorModel object.  This implemenation will
+ * with any Java DirectColorModel object.  This implementation will
  * scale the decoded color components to 8-bit quantities if needed.
  * Another file is provided to optimize DCM parsing when the masks
  * are guaranteed to be at least 8-bits wide.  This implementation
--- a/jdk/src/share/native/sun/awt/image/cvutils/img_replscale.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/awt/image/cvutils/img_replscale.h	Wed Jul 05 19:21:26 2017 +0200
@@ -35,7 +35,7 @@
  * more than one output pixel.  Conversely, when scaling smaller than
  * the original image size, the input pixels will be omitted as needed
  * to pare them down to the required number of samples for the output
- * image.  If there is no scaling occuring in one or both directions
+ * image.  If there is no scaling occurring in one or both directions
  * the macros attempt to short-circuit most of the more complicated
  * calculations in an attempt to impose little cost for using this
  * implementation in the general case.  The calculations also do not
--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Wed Jul 05 19:21:26 2017 +0200
@@ -983,7 +983,7 @@
  * buffer filling be done at the top application level, using this
  * function.  Due to the way that backtracking works, this procedure
  * saves all of the data that was left in the buffer when suspension
- * occured and read new data only at the end.
+ * occurred and read new data only at the end.
  */
 
 GLOBAL(void)
--- a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c	Wed Jul 05 19:21:26 2017 +0200
@@ -310,7 +310,7 @@
  * Note that with I/O suspension turned on, the JPEG library requires
  * that all buffer filling be done at the top application level.  Due
  * to the way that backtracking works, this procedure should save all
- * of the data that was left in the buffer when suspension occured and
+ * of the data that was left in the buffer when suspension occurred and
  * only read new data at the end.
  */
 
--- a/jdk/src/share/native/sun/awt/libpng/CHANGES	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/awt/libpng/CHANGES	Wed Jul 05 19:21:26 2017 +0200
@@ -2126,7 +2126,7 @@
     png_decompress_chunk(), and remove "chunkdata" from parameter list.
   Put a call to png_check_chunk_name() in png_read_chunk_header().
   Revised png_check_chunk_name() to reject a name with a lowercase 3rd byte.
-  Removed two calls to png_check_chunk_name() occuring later in the process.
+  Removed two calls to png_check_chunk_name() occurring later in the process.
   Define PNG_NO_ERROR_NUMBERS by default in pngconf.h
 
 Version 1.4.0beta25 [July 30, 2008]
--- a/jdk/src/share/native/sun/awt/libpng/png.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/awt/libpng/png.h	Wed Jul 05 19:21:26 2017 +0200
@@ -1351,7 +1351,7 @@
  *
  * When the default gamma of PNG files doesn't match the output gamma.
  *    If you have PNG files with no gamma information png_set_alpha_mode allows
- *    you to provide a default gamma, but it also sets the ouput gamma to the
+ *    you to provide a default gamma, but it also sets the output gamma to the
  *    matching value.  If you know your PNG files have a gamma that doesn't
  *    match the output you can take advantage of the fact that
  *    png_set_alpha_mode always sets the output gamma but only sets the PNG
--- a/jdk/src/share/native/sun/awt/libpng/pngconf.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/awt/libpng/pngconf.h	Wed Jul 05 19:21:26 2017 +0200
@@ -633,7 +633,7 @@
 #  else
      /* This is an attempt to detect an old Windows system where (int) is
       * actually 16 bits, in that case png_malloc must have an argument with a
-      * bigger size to accomodate the requirements of the library.
+      * bigger size to accommodate the requirements of the library.
       */
 #    if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \
         (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
--- a/jdk/src/share/native/sun/awt/libpng/pngpriv.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/awt/libpng/pngpriv.h	Wed Jul 05 19:21:26 2017 +0200
@@ -1195,7 +1195,7 @@
     png_warning_parameters p, png_const_charp message);
     /* 'message' follows the X/Open approach of using @1, @2 to insert
      * parameters previously supplied using the above functions.  Errors in
-     * specifying the paramters will simple result in garbage substitutions.
+     * specifying the parameters will simple result in garbage substitutions.
      */
 #endif
 
--- a/jdk/src/share/native/sun/awt/libpng/pngrutil.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/awt/libpng/pngrutil.c	Wed Jul 05 19:21:26 2017 +0200
@@ -126,7 +126,7 @@
 png_uint_16 (PNGAPI
 png_get_uint_16)(png_const_bytep buf)
 {
-   /* ANSI-C requires an int value to accomodate at least 16 bits so this
+   /* ANSI-C requires an int value to accommodate at least 16 bits so this
     * works and allows the compiler not to worry about possible narrowing
     * on 32 bit systems.  (Pre-ANSI systems did not make integers smaller
     * than 16 bits either.)
--- a/jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.h	Wed Jul 05 19:21:26 2017 +0200
@@ -209,7 +209,7 @@
      * This method converts the Arabic Presentation Forms in the temp glyph array
      * into actual glyph indices using ArabicOpenTypeLayoutEngine::mapCharsToGlyps.
      *
-     * Input paramters:
+     * Input parameters:
      * @param tempGlyphs - the input presentation forms
      * @param tempCharIndices - the input character index array
      * @param tempGlyphCount - the number of Presentation Froms
--- a/jdk/src/share/native/sun/font/layout/IndicReordering.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/font/layout/IndicReordering.h	Wed Jul 05 19:21:26 2017 +0200
@@ -42,7 +42,7 @@
 
 U_NAMESPACE_BEGIN
 
-// Characters that get refered to by name...
+// Characters that get referred to by name...
 #define C_SIGN_ZWNJ           0x200C
 #define C_SIGN_ZWJ            0x200D
 
--- a/jdk/src/share/native/sun/font/layout/KhmerReordering.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/font/layout/KhmerReordering.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -40,7 +40,7 @@
 
 U_NAMESPACE_BEGIN
 
-// Characters that get refered to by name...
+// Characters that get referred to by name...
 enum
 {
     C_SIGN_ZWNJ     = 0x200C,
--- a/jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/font/layout/OpenTypeLayoutEngine.h	Wed Jul 05 19:21:26 2017 +0200
@@ -59,7 +59,7 @@
  * 3) Glyph post processing - in cases where the font doesn't directly contain a GSUB table,
  *    the previous two steps may have generated "fake" glyph indices to use with a "canned" GSUB
  *    table. This step turns those glyph indices into actual font-specific glyph indices, and may
- *    perform any other adjustments requried by the previous steps.
+ *    perform any other adjustments required by the previous steps.
  *
  * OpenTypeLayoutEngine will also use the font's GPOS table to apply position adjustments
  * such as kerning and accent positioning.
@@ -349,7 +349,7 @@
      * index and character index arrays, assuming that no "fake" glyph indices
      * were needed to do GSUB processing.
      *
-     * Input paramters:
+     * Input parameters:
      * @param tempGlyphs - the input "fake" glyph index array
      * @param tempCharIndices - the input "fake" character index array
      * @param tempGlyphCount - the number of "fake" glyph indices
--- a/jdk/src/share/native/sun/font/layout/TibetanReordering.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/font/layout/TibetanReordering.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -47,7 +47,7 @@
 
 U_NAMESPACE_BEGIN
 
-// Characters that get refered to by name...
+// Characters that get referred to by name...
 enum
 {
     C_DOTTED_CIRCLE = 0x25CC,
--- a/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Wed Jul 05 19:21:26 2017 +0200
@@ -31,6 +31,7 @@
 #include "Trace.h"
 #include "Disposer.h"
 #include "lcms2.h"
+#include "jlong.h"
 
 
 #define ALIGNLONG(x) (((x)+3) & ~(3))         // Aligns to DWORD boundary
@@ -98,13 +99,6 @@
     cmsHPROFILE pf;
 } lcmsProfile_t, *lcmsProfile_p;
 
-typedef union storeID_s {    /* store SProfile stuff in a Java Long */
-    lcmsProfile_p lcmsPf;
-    cmsHTRANSFORM xf;
-    jobject jobj;
-    jlong j;
-} storeID_t, *storeID_p;
-
 typedef union {
     cmsTagSignature cms;
     jint j;
@@ -148,23 +142,21 @@
 }
 
 void LCMS_freeProfile(JNIEnv *env, jlong ptr) {
-    storeID_t sProfile;
-    sProfile.j = ptr;
+    lcmsProfile_p p = (lcmsProfile_p)jlong_to_ptr(ptr);
 
-    if (sProfile.lcmsPf != NULL) {
-        if (sProfile.lcmsPf->pf != NULL) {
-            cmsCloseProfile(sProfile.lcmsPf->pf);
+    if (p != NULL) {
+        if (p->pf != NULL) {
+            cmsCloseProfile(p->pf);
         }
-        free(sProfile.lcmsPf);
+        free(p);
     }
 }
 
 void LCMS_freeTransform(JNIEnv *env, jlong ID)
 {
-    storeID_t sTrans;
-    sTrans.j = ID;
+    cmsHTRANSFORM sTrans = jlong_to_ptr(ID);
     /* Passed ID is always valid native ref so there is no check for zero */
-    cmsDeleteTransform(sTrans.xf);
+    cmsDeleteTransform(sTrans);
 }
 
 /*
@@ -179,12 +171,16 @@
 {
     cmsHPROFILE _iccArray[DF_ICC_BUF_SIZE];
     cmsHPROFILE *iccArray = &_iccArray[0];
-    storeID_t sTrans;
+    cmsHTRANSFORM sTrans = NULL;
     int i, j, size;
     jlong* ids;
 
     size = (*env)->GetArrayLength (env, profileIDs);
     ids = (*env)->GetLongArrayElements(env, profileIDs, 0);
+    if (ids == NULL) {
+        // An exception should have already been thrown.
+        return 0L;
+    }
 
 #ifdef _LITTLE_ENDIAN
     /* Reversing data packed into int for LE archs */
@@ -209,11 +205,10 @@
 
     j = 0;
     for (i = 0; i < size; i++) {
-        cmsHPROFILE icc;
         cmsColorSpaceSignature cs;
+        lcmsProfile_p profilePtr = (lcmsProfile_p)jlong_to_ptr(ids[i]);
+        cmsHPROFILE icc = profilePtr->pf;
 
-        sTrans.j = ids[i];
-        icc = sTrans.lcmsPf->pf;
         iccArray[j++] = icc;
 
         /* Middle non-abstract profiles should be doubled before passing to
@@ -228,26 +223,26 @@
         }
     }
 
-    sTrans.xf = cmsCreateMultiprofileTransform(iccArray, j,
+    sTrans = cmsCreateMultiprofileTransform(iccArray, j,
         inFormatter, outFormatter, renderType, 0);
 
     (*env)->ReleaseLongArrayElements(env, profileIDs, ids, 0);
 
-    if (sTrans.xf == NULL) {
+    if (sTrans == NULL) {
         J2dRlsTraceLn(J2D_TRACE_ERROR, "LCMS_createNativeTransform: "
-                                       "sTrans.xf == NULL");
+                                       "sTrans == NULL");
         if ((*env)->ExceptionOccurred(env) == NULL) {
             JNU_ThrowByName(env, "java/awt/color/CMMException",
                             "Cannot get color transform");
         }
     } else {
-        Disposer_AddRecord(env, disposerRef, LCMS_freeTransform, sTrans.j);
+        Disposer_AddRecord(env, disposerRef, LCMS_freeTransform, ptr_to_jlong(sTrans));
     }
 
     if (iccArray != &_iccArray[0]) {
         free(iccArray);
     }
-    return sTrans.j;
+    return ptr_to_jlong(sTrans);
 }
 
 
@@ -261,7 +256,7 @@
 {
     jbyte* dataArray;
     jint dataSize;
-    storeID_t sProf;
+    lcmsProfile_p sProf = NULL;
     cmsHPROFILE pf;
 
     if (JNU_IsNull(env, data)) {
@@ -269,16 +264,14 @@
         return 0L;
     }
 
-    sProf.j = 0L;
-
     dataArray = (*env)->GetByteArrayElements (env, data, 0);
-    dataSize = (*env)->GetArrayLength (env, data);
-
     if (dataArray == NULL) {
-        JNU_ThrowIllegalArgumentException(env, "Invalid profile data");
+        // An exception should have already been thrown.
         return 0L;
     }
 
+    dataSize = (*env)->GetArrayLength (env, data);
+
     pf = cmsOpenProfileFromMem((const void *)dataArray,
                                      (cmsUInt32Number) dataSize);
 
@@ -303,17 +296,17 @@
 
     if (pf != NULL) {
         // create profile holder
-        sProf.lcmsPf = (lcmsProfile_p)malloc(sizeof(lcmsProfile_t));
-        if (sProf.lcmsPf != NULL) {
+        sProf = (lcmsProfile_p)malloc(sizeof(lcmsProfile_t));
+        if (sProf != NULL) {
             // register the disposer record
-            sProf.lcmsPf->pf = pf;
-            Disposer_AddRecord(env, disposerRef, LCMS_freeProfile, sProf.j);
+            sProf->pf = pf;
+            Disposer_AddRecord(env, disposerRef, LCMS_freeProfile, ptr_to_jlong(sProf));
         } else {
             cmsCloseProfile(pf);
         }
     }
 
-    return sProf.j;
+    return ptr_to_jlong(sProf);
 }
 
 /*
@@ -324,11 +317,10 @@
 JNIEXPORT jint JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileSizeNative
   (JNIEnv *env, jobject obj, jlong id)
 {
-    storeID_t sProf;
+    lcmsProfile_p sProf = (lcmsProfile_p)jlong_to_ptr(id);
     cmsUInt32Number pfSize = 0;
-    sProf.j = id;
 
-    if (cmsSaveProfileToMem(sProf.lcmsPf->pf, NULL, &pfSize) && ((jint)pfSize > 0)) {
+    if (cmsSaveProfileToMem(sProf->pf, NULL, &pfSize) && ((jint)pfSize > 0)) {
         return (jint)pfSize;
     } else {
       JNU_ThrowByName(env, "java/awt/color/CMMException",
@@ -345,16 +337,14 @@
 JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileDataNative
   (JNIEnv *env, jobject obj, jlong id, jbyteArray data)
 {
-    storeID_t sProf;
+    lcmsProfile_p sProf = (lcmsProfile_p)jlong_to_ptr(id);
     jint size;
     jbyte* dataArray;
     cmsUInt32Number pfSize = 0;
     cmsBool status;
 
-    sProf.j = id;
-
     // determine actual profile size
-    if (!cmsSaveProfileToMem(sProf.lcmsPf->pf, NULL, &pfSize)) {
+    if (!cmsSaveProfileToMem(sProf->pf, NULL, &pfSize)) {
         JNU_ThrowByName(env, "java/awt/color/CMMException",
                         "Can not access specified profile.");
         return;
@@ -369,8 +359,12 @@
     }
 
     dataArray = (*env)->GetByteArrayElements (env, data, 0);
+    if (dataArray == NULL) {
+        // An exception should have already been thrown.
+        return;
+    }
 
-    status = cmsSaveProfileToMem(sProf.lcmsPf->pf, dataArray, &pfSize);
+    status = cmsSaveProfileToMem(sProf->pf, dataArray, &pfSize);
 
     (*env)->ReleaseByteArrayElements (env, data, dataArray, 0);
 
@@ -395,7 +389,7 @@
 JNIEXPORT jbyteArray JNICALL Java_sun_java2d_cmm_lcms_LCMS_getTagNative
   (JNIEnv *env, jobject obj, jlong id, jint tagSig)
 {
-    storeID_t sProf;
+    lcmsProfile_p sProf = (lcmsProfile_p)jlong_to_ptr(id);
     TagSignature_t sig;
     cmsInt32Number tagSize;
 
@@ -404,7 +398,6 @@
 
     jint bufSize;
 
-    sProf.j = id;
     sig.j = tagSig;
 
     if (tagSig == SigHead) {
@@ -415,20 +408,18 @@
         data = (*env)->NewByteArray(env, bufSize);
 
         if (data == NULL) {
-            JNU_ThrowByName(env, "java/awt/color/CMMException",
-                            "Unable to allocate buffer");
+            // An exception should have already been thrown.
             return NULL;
         }
 
         dataArray = (*env)->GetByteArrayElements (env, data, 0);
 
         if (dataArray == NULL) {
-           JNU_ThrowByName(env, "java/awt/color/CMMException",
-                            "Unable to get buffer");
-           return NULL;
+            // An exception should have already been thrown.
+            return NULL;
         }
 
-        status = _getHeaderInfo(sProf.lcmsPf->pf, dataArray, bufSize);
+        status = _getHeaderInfo(sProf->pf, dataArray, bufSize);
 
         (*env)->ReleaseByteArrayElements (env, data, dataArray, 0);
 
@@ -441,8 +432,8 @@
         return data;
     }
 
-    if (cmsIsTag(sProf.lcmsPf->pf, sig.cms)) {
-        tagSize = cmsReadRawTag(sProf.lcmsPf->pf, sig.cms, NULL, 0);
+    if (cmsIsTag(sProf->pf, sig.cms)) {
+        tagSize = cmsReadRawTag(sProf->pf, sig.cms, NULL, 0);
     } else {
         JNU_ThrowByName(env, "java/awt/color/CMMException",
                         "ICC profile tag not found");
@@ -452,20 +443,18 @@
     // allocate java array
     data = (*env)->NewByteArray(env, tagSize);
     if (data == NULL) {
-        JNU_ThrowByName(env, "java/awt/color/CMMException",
-                        "Unable to allocate buffer");
+        // An exception should have already been thrown.
         return NULL;
     }
 
     dataArray = (*env)->GetByteArrayElements (env, data, 0);
 
     if (dataArray == NULL) {
-        JNU_ThrowByName(env, "java/awt/color/CMMException",
-                        "Unable to get buffer");
+        // An exception should have already been thrown.
         return NULL;
     }
 
-    bufSize = cmsReadRawTag(sProf.lcmsPf->pf, sig.cms, dataArray, tagSize);
+    bufSize = cmsReadRawTag(sProf->pf, sig.cms, dataArray, tagSize);
 
     (*env)->ReleaseByteArrayElements (env, data, dataArray, 0);
 
@@ -485,7 +474,7 @@
 JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_setTagDataNative
   (JNIEnv *env, jobject obj, jlong id, jint tagSig, jbyteArray data)
 {
-    storeID_t sProf;
+    lcmsProfile_p sProf = (lcmsProfile_p)jlong_to_ptr(id);
     cmsHPROFILE pfReplace = NULL;
 
     TagSignature_t sig;
@@ -493,7 +482,6 @@
     jbyte* dataArray;
     int tagSize;
 
-    sProf.j = id;
     sig.j = tagSig;
 
     if (JNU_IsNull(env, data)) {
@@ -506,19 +494,19 @@
     dataArray = (*env)->GetByteArrayElements(env, data, 0);
 
     if (dataArray == NULL) {
-        JNU_ThrowIllegalArgumentException(env, "Can not write tag data.");
+        // An exception should have already been thrown.
         return;
     }
 
     if (tagSig == SigHead) {
-        status  = _setHeaderInfo(sProf.lcmsPf->pf, dataArray, tagSize);
+        status  = _setHeaderInfo(sProf->pf, dataArray, tagSize);
     } else {
         /*
         * New strategy for generic tags: create a place holder,
         * dump all existing tags there, dump externally supplied
         * tag, and return the new profile to the java.
         */
-        pfReplace = _writeCookedTag(sProf.lcmsPf->pf, sig.cms, dataArray, tagSize);
+        pfReplace = _writeCookedTag(sProf->pf, sig.cms, dataArray, tagSize);
         status = (pfReplace != NULL);
     }
 
@@ -527,8 +515,8 @@
     if (!status) {
         JNU_ThrowIllegalArgumentException(env, "Can not write tag data.");
     } else if (pfReplace != NULL) {
-        cmsCloseProfile(sProf.lcmsPf->pf);
-        sProf.lcmsPf->pf = pfReplace;
+        cmsCloseProfile(sProf->pf);
+        sProf->pf = pfReplace;
     }
 }
 
@@ -582,7 +570,7 @@
 JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
   (JNIEnv *env, jclass obj, jobject trans, jobject src, jobject dst)
 {
-    storeID_t sTrans;
+    cmsHTRANSFORM sTrans = NULL;
     int srcDType, dstDType;
     int srcOffset, srcNextRowOffset, dstOffset, dstNextRowOffset;
     int width, height, i;
@@ -603,9 +591,9 @@
     srcAtOnce = (*env)->GetBooleanField(env, src, IL_imageAtOnce_fID);
     dstAtOnce = (*env)->GetBooleanField(env, dst, IL_imageAtOnce_fID);
 
-    sTrans.j = (*env)->GetLongField (env, trans, Trans_ID_fID);
+    sTrans = jlong_to_ptr((*env)->GetLongField (env, trans, Trans_ID_fID));
 
-    if (sTrans.xf == NULL) {
+    if (sTrans == NULL) {
         J2dRlsTraceLn(J2D_TRACE_ERROR, "LCMS_colorConvert: transform == NULL");
         JNU_ThrowByName(env, "java/awt/color/CMMException",
                         "Cannot get color transform");
@@ -617,8 +605,7 @@
 
     if (inputBuffer == NULL) {
         J2dRlsTraceLn(J2D_TRACE_ERROR, "");
-        JNU_ThrowByName(env, "java/awt/color/CMMException",
-                        "Cannot get input data");
+        // An exception should have already been thrown.
         return;
     }
 
@@ -626,8 +613,7 @@
 
     if (outputBuffer == NULL) {
         releaseILData(env, inputBuffer, srcDType, srcData);
-        JNU_ThrowByName(env, "java/awt/color/CMMException",
-                        "Cannot get output data");
+        // An exception should have already been thrown.
         return;
     }
 
@@ -635,10 +621,10 @@
     outputRow = (char*)outputBuffer + dstOffset;
 
     if (srcAtOnce && dstAtOnce) {
-        cmsDoTransform(sTrans.xf, inputRow, outputRow, width * height);
+        cmsDoTransform(sTrans, inputRow, outputRow, width * height);
     } else {
         for (i = 0; i < height; i++) {
-            cmsDoTransform(sTrans.xf, inputRow, outputRow, width);
+            cmsDoTransform(sTrans, inputRow, outputRow, width);
             inputRow += srcNextRowOffset;
             outputRow += dstNextRowOffset;
         }
@@ -656,14 +642,22 @@
 JNIEXPORT jobject JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileID
   (JNIEnv *env, jclass cls, jobject pf)
 {
+    jclass clsLcmsProfile;
+    jobject cmmProfile;
     jfieldID fid = (*env)->GetFieldID (env,
         (*env)->GetObjectClass(env, pf),
         "cmmProfile", "Lsun/java2d/cmm/Profile;");
+    if (fid == NULL) {
+        return NULL;
+    }
 
-    jclass clsLcmsProfile = (*env)->FindClass(env,
+    clsLcmsProfile = (*env)->FindClass(env,
             "sun/java2d/cmm/lcms/LCMSProfile");
+    if (clsLcmsProfile == NULL) {
+        return NULL;
+    }
 
-    jobject cmmProfile = (*env)->GetObjectField (env, pf, fid);
+    cmmProfile = (*env)->GetObjectField (env, pf, fid);
 
     if (JNU_IsNull(env, cmmProfile)) {
         return NULL;
@@ -687,18 +681,51 @@
      * unloading
      */
     Trans_renderType_fID = (*env)->GetFieldID (env, Trans, "renderType", "I");
+    if (Trans_renderType_fID == NULL) {
+        return;
+    }
     Trans_ID_fID = (*env)->GetFieldID (env, Trans, "ID", "J");
+    if (Trans_ID_fID == NULL) {
+        return;
+    }
 
     IL_isIntPacked_fID = (*env)->GetFieldID (env, IL, "isIntPacked", "Z");
+    if (IL_isIntPacked_fID == NULL) {
+        return;
+    }
     IL_dataType_fID = (*env)->GetFieldID (env, IL, "dataType", "I");
+    if (IL_dataType_fID == NULL) {
+        return;
+    }
     IL_pixelType_fID = (*env)->GetFieldID (env, IL, "pixelType", "I");
+    if (IL_pixelType_fID == NULL) {
+        return;
+    }
     IL_dataArray_fID = (*env)->GetFieldID(env, IL, "dataArray",
                                           "Ljava/lang/Object;");
+    if (IL_dataArray_fID == NULL) {
+        return;
+    }
     IL_width_fID = (*env)->GetFieldID (env, IL, "width", "I");
+    if (IL_width_fID == NULL) {
+        return;
+    }
     IL_height_fID = (*env)->GetFieldID (env, IL, "height", "I");
+    if (IL_height_fID == NULL) {
+        return;
+    }
     IL_offset_fID = (*env)->GetFieldID (env, IL, "offset", "I");
+    if (IL_offset_fID == NULL) {
+        return;
+    }
     IL_imageAtOnce_fID = (*env)->GetFieldID (env, IL, "imageAtOnce", "Z");
+    if (IL_imageAtOnce_fID == NULL) {
+        return;
+    }
     IL_nextRowOffset_fID = (*env)->GetFieldID (env, IL, "nextRowOffset", "I");
+    if (IL_nextRowOffset_fID == NULL) {
+        return;
+    }
 }
 
 static cmsBool _getHeaderInfo(cmsHPROFILE pf, jbyte* pBuffer, jint bufferSize)
@@ -709,7 +736,7 @@
 
   if (!cmsSaveProfileToMem(pf, NULL, &pfSize) ||
       pfSize < sizeof(cmsICCHeader) ||
-      bufferSize < sizeof(cmsICCHeader))
+      bufferSize < (jint)sizeof(cmsICCHeader))
   {
     return FALSE;
   }
@@ -730,9 +757,9 @@
 
 static cmsBool _setHeaderInfo(cmsHPROFILE pf, jbyte* pBuffer, jint bufferSize)
 {
-  cmsICCHeader pfHeader = { 0 };
+  cmsICCHeader pfHeader;
 
-  if (pBuffer == NULL || bufferSize < sizeof(cmsICCHeader)) {
+  if (pBuffer == NULL || bufferSize < (jint)sizeof(cmsICCHeader)) {
     return FALSE;
   }
 
@@ -765,13 +792,14 @@
     cmsInt32Number i;
     cmsHPROFILE pfSanity = NULL;
 
-    cmsICCHeader hdr = { 0 };
+    cmsICCHeader hdr;
 
     cmsHPROFILE p = cmsCreateProfilePlaceholder(NULL);
 
     if (NULL == p) {
         return NULL;
     }
+    memset(&hdr, 0, sizeof(cmsICCHeader));
 
     // Populate the placeholder's header according to target profile
     hdr.flags = cmsGetHeaderFlags(pfTarget);
--- a/jdk/src/share/native/sun/java2d/cmm/lcms/cmsio0.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/java2d/cmm/lcms/cmsio0.c	Wed Jul 05 19:21:26 2017 +0200
@@ -350,7 +350,7 @@
     return nReaded;
 }
 
-// Postion file pointer in the file
+// Position file pointer in the file
 static
 cmsBool  FileSeek(cmsIOHANDLER* iohandler, cmsUInt32Number offset)
 {
--- a/jdk/src/share/native/sun/java2d/cmm/lcms/cmslut.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/java2d/cmm/lcms/cmslut.c	Wed Jul 05 19:21:26 2017 +0200
@@ -1266,7 +1266,7 @@
 static
 void BlessLUT(cmsPipeline* lut)
 {
-    // We can set the input/ouput channels only if we have elements.
+    // We can set the input/output channels only if we have elements.
     if (lut ->Elements != NULL) {
 
         cmsStage *First, *Last;
--- a/jdk/src/share/native/sun/java2d/loops/ProcessPath.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/java2d/loops/ProcessPath.c	Wed Jul 05 19:21:26 2017 +0200
@@ -641,7 +641,7 @@
 
         /* Checking that we are not running out of the endpoint and bounding
          * violating coordinate.  The check is pretty simple because the curve
-         * passed to the DrawMonotonicQuad already splitted into the monotonic
+         * passed to the DrawMonotonicQuad already split into the monotonic
          * in X and Y pieces
          */
 
@@ -1129,7 +1129,7 @@
             /* Checking that we are not running out of the endpoint and
              * bounding violating coordinate.  The check is pretty simple
              * because the curve passed to the DrawMonotonicCubic already
-             * splitted into the monotonic in X and Y pieces
+             * split into the monotonic in X and Y pieces
              */
 
             /* Bounding x2 by xe */
--- a/jdk/src/share/native/sun/java2d/opengl/OGLBlitLoops.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/java2d/opengl/OGLBlitLoops.c	Wed Jul 05 19:21:26 2017 +0200
@@ -661,7 +661,12 @@
                             (sy2-sy1) != (jint)(dy2-dy1) ||
                             oglc->extraAlpha != 1.0f;
                         break;
-
+#ifdef MACOSX
+                    case OGLC_VENDOR_ATI:
+                        // see 8024461
+                        viaTexture = JNI_TRUE;
+                        break;
+#endif
                     default:
                         // just use the glDrawPixels() codepath
                         viaTexture = JNI_FALSE;
--- a/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c	Wed Jul 05 19:21:26 2017 +0200
@@ -772,7 +772,7 @@
             } else if (remainingWidth < ginfo->width) {
                 // in some cases, the x-advance may be slightly smaller
                 // than the actual width of the glyph; if so, adjust our
-                // estimate so that we can accomodate the entire glyph
+                // estimate so that we can accommodate the entire glyph
                 remainingWidth = ginfo->width;
             }
         } else {
--- a/jdk/src/share/native/sun/reflect/Reflection.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/reflect/Reflection.c	Wed Jul 05 19:21:26 2017 +0200
@@ -26,10 +26,16 @@
 #include "jvm.h"
 #include "sun_reflect_Reflection.h"
 
-JNIEXPORT jclass JNICALL Java_sun_reflect_Reflection_getCallerClass
+JNIEXPORT jclass JNICALL Java_sun_reflect_Reflection_getCallerClass__
 (JNIEnv *env, jclass unused)
 {
-    return JVM_GetCallerClass(env, JVM_DEPTH); // JVM_DEPTH is only the expected value
+    return JVM_GetCallerClass(env, JVM_CALLER_DEPTH);
+}
+
+JNIEXPORT jclass JNICALL Java_sun_reflect_Reflection_getCallerClass__I
+(JNIEnv *env, jclass unused, jint depth)
+{
+    return JVM_GetCallerClass(env, depth);
 }
 
 JNIEXPORT jint JNICALL Java_sun_reflect_Reflection_getClassAccessFlags
--- a/jdk/src/share/native/sun/security/pkcs11/wrapper/p11_sessmgmt.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/native/sun/security/pkcs11/wrapper/p11_sessmgmt.c	Wed Jul 05 19:21:26 2017 +0200
@@ -539,7 +539,7 @@
 #ifndef NO_CALLBACKS
 
 /*
- * The function handling notify callbacks. It casts the pApplication paramter
+ * The function handling notify callbacks. It casts the pApplication parameter
  * back to a NotifyEncapsulation structure and retrieves the Notify object and
  * the application data from it.
  *
--- a/jdk/src/share/sample/jmx/jmx-scandir/index.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/sample/jmx/jmx-scandir/index.html	Wed Jul 05 19:21:26 2017 +0200
@@ -1579,7 +1579,7 @@
     <ul>
    <p>The <a 
 href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirClient.html" 
-title="The ScanDirClient class is a very short example of secure programatic client"
+title="The ScanDirClient class is a very short example of secure programmatic client"
      >ScanDirClient</a> is an example class that shows how a
     programmatic client can connect to a secured <i>scandir</i> application.
     This class contains a <code>main</code> method which creates and
@@ -2025,7 +2025,7 @@
         </p>
    <p>The <a 
 href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirClient.html" 
-title="The ScanDirClient class is a very short example of secure programatic client"
+title="The ScanDirClient class is a very short example of secure programmatic client"
      >ScanDirClient</a> is an example class that shows how a
     programmatic client can connect to a secured <i>scandir</i> application.
     This class contains a <code>main</code> method which creates and
--- a/jdk/src/share/sample/nio/chatserver/ClientReader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/sample/nio/chatserver/ClientReader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -58,7 +58,7 @@
     }
 
     /**
-     * Runs a cycle of doing a beforeRead action and then enqueing a new
+     * Runs a cycle of doing a beforeRead action and then inquiring a new
      * read on the client. Handles closed channels and errors while reading.
      * If the client is still connected a new round of actions are called.
      */
--- a/jdk/src/share/sample/scripting/scriptpad/src/resources/gui.js	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/share/sample/scripting/scriptpad/src/resources/gui.js	Wed Jul 05 19:21:26 2017 +0200
@@ -124,7 +124,7 @@
  *
  * @param title of the dialog box [optional]
  * @param color default color [optional]
- * @return choosen color or default color
+ * @return chosen color or default color
  */
 function colorDialog(title, color) {
     var result;
--- a/jdk/src/solaris/classes/java/lang/UNIXProcess.java.bsd	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/java/lang/UNIXProcess.java.bsd	Wed Jul 05 19:21:26 2017 +0200
@@ -337,40 +337,54 @@
      * able to read any buffered data lingering in the OS pipe buffer.
      */
     static class ProcessPipeInputStream extends BufferedInputStream {
+        private final Object closeLock = new Object();
+
         ProcessPipeInputStream(int fd) {
             super(new FileInputStream(newFileDescriptor(fd)));
         }
 
-        private static byte[] drainInputStream(InputStream in)
+        private InputStream drainInputStream(InputStream in)
                 throws IOException {
-            if (in == null) return null;
             int n = 0;
             int j;
             byte[] a = null;
-            while ((j = in.available()) > 0) {
+            synchronized (closeLock) {
+                if (buf == null) // asynchronous close()?
+                    return null; // discard
+                j = in.available();
+            }
+            while (j > 0) {
                 a = (a == null) ? new byte[j] : Arrays.copyOf(a, n + j);
-                n += in.read(a, n, j);
+                synchronized (closeLock) {
+                    if (buf == null) // asynchronous close()?
+                        return null; // discard
+                    n += in.read(a, n, j);
+                    j = in.available();
+                }
             }
-            return (a == null || n == a.length) ? a : Arrays.copyOf(a, n);
+            return (a == null) ?
+                    ProcessBuilder.NullInputStream.INSTANCE :
+                    new ByteArrayInputStream(n == a.length ? a : Arrays.copyOf(a, n));
         }
 
         /** Called by the process reaper thread when the process exits. */
         synchronized void processExited() {
-            // Most BufferedInputStream methods are synchronized, but close()
-            // is not, and so we have to handle concurrent racing close().
             try {
                 InputStream in = this.in;
                 if (in != null) {
-                    byte[] stragglers = drainInputStream(in);
+                    InputStream stragglers = drainInputStream(in);
                     in.close();
-                    this.in = (stragglers == null) ?
-                        ProcessBuilder.NullInputStream.INSTANCE :
-                        new ByteArrayInputStream(stragglers);
-                    if (buf == null) // asynchronous close()?
-                        this.in = null;
+                    this.in = stragglers;
                 }
-            } catch (IOException ignored) {
-                // probably an asynchronous close().
+            } catch (IOException ignored) { }
+        }
+
+        @Override
+        public void close() throws IOException {
+            // BufferedInputStream#close() is not synchronized unlike most other methods.
+            // Synchronizing helps avoid racing with drainInputStream().
+            synchronized (closeLock) {
+                super.close();
             }
         }
     }
--- a/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux	Wed Jul 05 19:21:26 2017 +0200
@@ -339,40 +339,54 @@
      * able to read any buffered data lingering in the OS pipe buffer.
      */
     static class ProcessPipeInputStream extends BufferedInputStream {
+        private final Object closeLock = new Object();
+
         ProcessPipeInputStream(int fd) {
             super(new FileInputStream(newFileDescriptor(fd)));
         }
 
-        private static byte[] drainInputStream(InputStream in)
+        private InputStream drainInputStream(InputStream in)
                 throws IOException {
-            if (in == null) return null;
             int n = 0;
             int j;
             byte[] a = null;
-            while ((j = in.available()) > 0) {
+            synchronized (closeLock) {
+                if (buf == null) // asynchronous close()?
+                    return null; // discard
+                j = in.available();
+            }
+            while (j > 0) {
                 a = (a == null) ? new byte[j] : Arrays.copyOf(a, n + j);
-                n += in.read(a, n, j);
+                synchronized (closeLock) {
+                    if (buf == null) // asynchronous close()?
+                        return null; // discard
+                    n += in.read(a, n, j);
+                    j = in.available();
+                }
             }
-            return (a == null || n == a.length) ? a : Arrays.copyOf(a, n);
+            return (a == null) ?
+                    ProcessBuilder.NullInputStream.INSTANCE :
+                    new ByteArrayInputStream(n == a.length ? a : Arrays.copyOf(a, n));
         }
 
         /** Called by the process reaper thread when the process exits. */
         synchronized void processExited() {
-            // Most BufferedInputStream methods are synchronized, but close()
-            // is not, and so we have to handle concurrent racing close().
             try {
                 InputStream in = this.in;
                 if (in != null) {
-                    byte[] stragglers = drainInputStream(in);
+                    InputStream stragglers = drainInputStream(in);
                     in.close();
-                    this.in = (stragglers == null) ?
-                        ProcessBuilder.NullInputStream.INSTANCE :
-                        new ByteArrayInputStream(stragglers);
-                    if (buf == null) // asynchronous close()?
-                        this.in = null;
+                    this.in = stragglers;
                 }
-            } catch (IOException ignored) {
-                // probably an asynchronous close().
+            } catch (IOException ignored) { }
+        }
+
+        @Override
+        public void close() throws IOException {
+            // BufferedInputStream#close() is not synchronized unlike most other methods.
+            // Synchronizing helps avoid racing with drainInputStream().
+            synchronized (closeLock) {
+                super.close();
             }
         }
     }
--- a/jdk/src/solaris/classes/java/net/DefaultInterface.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/java/net/DefaultInterface.java	Wed Jul 05 19:21:26 2017 +0200
@@ -26,7 +26,7 @@
 package java.net;
 
 /**
- * Choose a network inteface to be the default for
+ * Choose a network interface to be the default for
  * outgoing IPv6 traffic that does not specify a scope_id (and which needs one).
  *
  * Platforms that do not require a default interface may return null
--- a/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java	Wed Jul 05 19:21:26 2017 +0200
@@ -187,7 +187,7 @@
      ************************************************/
 
     /**
-     * Returns parent menu window (not the X-heirarchy parent window)
+     * Returns parent menu window (not the X-hierarchy parent window)
      */
     protected abstract XBaseMenuWindow getParentMenuWindow();
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XButtonPeer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XButtonPeer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -79,10 +79,17 @@
         return true;
     }
 
-    public void  setLabel(java.lang.String label) {
-        this.label = label;
-        repaint();
+    @Override
+    public void setLabel(String label) {
+        if (label == null) {
+            label = "";
+        }
+        if (!label.equals(this.label)) {
+            this.label = label;
+            repaint();
+        }
     }
+
     public void setBackground(Color c) {
         updateMotifColors(c);
         super.setBackground(c);
@@ -257,10 +264,6 @@
         drawMotif3DRect(g, x, y, w-1, h-1, pressed);
     }
 
-    public void setFont(Font f) {
-        super.setFont(f);
-        target.repaint();
-    }
     protected void paintFocus(Graphics g, int x, int y, int w, int h){
         g.setColor(focusColor);
         g.drawRect(x,y,w,h);
--- a/jdk/src/solaris/classes/sun/awt/X11/XCanvasPeer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XCanvasPeer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -103,15 +103,4 @@
     protected boolean doEraseBackground() {
         return !eraseBackgroundDisabled;
     }
-    public void setBackground(Color c) {
-        boolean doRepaint = false;
-        if( getPeerBackground() == null ||
-           !getPeerBackground().equals( c ) ) {
-            doRepaint = true;
-        }
-        super.setBackground(c);
-        if( doRepaint ) {
-            target.repaint();
-        }
-    }
 }
--- a/jdk/src/solaris/classes/sun/awt/X11/XCheckboxPeer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XCheckboxPeer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -31,6 +31,7 @@
 import java.awt.image.BufferedImage;
 import javax.swing.plaf.basic.BasicGraphicsUtils;
 import java.awt.geom.AffineTransform;
+import java.util.Objects;
 
 import sun.util.logging.PlatformLogger;
 
@@ -135,14 +136,16 @@
 
     public void keyReleased(KeyEvent e) {}
 
-    public void  setLabel(java.lang.String label) {
-        if ( label == null ) {
-            this.label = "";
-        } else {
+    @Override
+    public void setLabel(String label) {
+        if (label == null) {
+            label = "";
+        }
+        if (!label.equals(this.label)) {
             this.label = label;
+            layout();
+            repaint();
         }
-        layout();
-        repaint();
     }
 
     void handleJavaMouseEvent(MouseEvent e) {
@@ -377,10 +380,6 @@
             g.drawImage(buffer, x, y, null);
         }
     }
-    public void setFont(Font f) {
-        super.setFont(f);
-        target.repaint();
-    }
 
     public void paintRadioButton(Graphics g, int x, int y, int w, int h) {
 
@@ -424,16 +423,21 @@
         g.drawRect(x,y,w,h);
     }
 
+    @Override
     public void setState(boolean state) {
         if (selected != state) {
             selected = state;
             repaint();
         }
     }
-    public void setCheckboxGroup(CheckboxGroup g) {
-        // If changed from grouped/ungrouped, need to repaint()
-        checkBoxGroup = g;
-        repaint();
+
+    @Override
+    public void setCheckboxGroup(final CheckboxGroup g) {
+        if (!Objects.equals(g, checkBoxGroup)) {
+            // If changed from grouped/ungrouped, need to repaint()
+            checkBoxGroup = g;
+            repaint();
+        }
     }
 
     // NOTE: This method is called by privileged threads.
--- a/jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -87,7 +87,7 @@
     private boolean firstPress = false;      // mouse was pressed on
                                              // furled Choice so we
                                              // not need to furl the
-                                             // Choice when MOUSE_RELEASED occured
+                                             // Choice when MOUSE_RELEASED occurred
 
     // 6425067. Mouse was pressed on furled choice and dropdown list appeared over Choice itself
     // and then there were no mouse movements until MOUSE_RELEASE.
@@ -814,12 +814,12 @@
                 x = screen.width - width;
             }
 
+            if (y + height > screen.height) {
+                y = global.y - height;
+            }
             if (y < 0) {
                 y = 0;
             }
-            else if (y + height > screen.height) {
-                y = screen.height - height;
-            }
             return new Rectangle(x, y, width, height);
         }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -61,6 +61,7 @@
 import java.lang.reflect.*;
 import java.security.*;
 import java.util.Collection;
+import java.util.Objects;
 import java.util.Set;
 import sun.util.logging.PlatformLogger;
 import sun.awt.*;
@@ -635,22 +636,30 @@
         g.drawLine(x+width, y+height, x+width, y+1);  // right
     }
 
+    @Override
     public void setBackground(Color c) {
         if (log.isLoggable(PlatformLogger.Level.FINE)) {
             log.fine("Set background to " + c);
         }
         synchronized (getStateLock()) {
+            if (Objects.equals(background, c)) {
+                return;
+            }
             background = c;
         }
         super.setBackground(c);
         repaint();
     }
 
+    @Override
     public void setForeground(Color c) {
         if (log.isLoggable(PlatformLogger.Level.FINE)) {
             log.fine("Set foreground to " + c);
         }
         synchronized (getStateLock()) {
+            if (Objects.equals(foreground, c)) {
+                return;
+            }
             foreground = c;
         }
         repaint();
@@ -674,18 +683,21 @@
         return sun.font.FontDesignMetrics.getMetrics(font);
     }
 
+    @Override
     public void setFont(Font f) {
+        if (f == null) {
+            f = XWindow.getDefaultFont();
+        }
         synchronized (getStateLock()) {
-            if (f == null) {
-                f = XWindow.getDefaultFont();
+            if (f.equals(font)) {
+                return;
             }
             font = f;
         }
-        // as it stands currently we dont need to do layout or repaint since
+        // as it stands currently we don't need to do layout since
         // layout is done in the Component upon setFont.
         //layout();
-        // target.repaint();
-        //repaint()?
+        repaint();
     }
 
     public Font getFont() {
--- a/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -142,7 +142,7 @@
     }
 
 
-    public void handleExposeEvent(Component target, int x, int y, int w, int h) {
+    public void postPaintEvent(Component target, int x, int y, int w, int h) {
         // TODO: ?
         // get rid of 'istanceof' by subclassing:
         // XContentWindow -> XFrameContentWindow
@@ -160,13 +160,13 @@
             iconifiedExposeEvents.add(new SavedExposeEvent(target, x, y, w, h));
         } else {
             // Normal case: [it is not a frame or] the frame is not iconified.
-            super.handleExposeEvent(target, x, y, w, h);
+            super.postPaintEvent(target, x, y, w, h);
         }
     }
 
     void purgeIconifiedExposeEvents() {
         for (SavedExposeEvent evt : iconifiedExposeEvents) {
-            super.handleExposeEvent(evt.target, evt.x, evt.y, evt.w, evt.h);
+            super.postPaintEvent(evt.target, evt.x, evt.y, evt.w, evt.h);
         }
         iconifiedExposeEvents.clear();
     }
--- a/jdk/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java	Wed Jul 05 19:21:26 2017 +0200
@@ -70,7 +70,7 @@
     public abstract String getProtocolName();
 
     /**
-     * Initalizes a drag operation with the specified supported drop actions,
+     * Initializes a drag operation with the specified supported drop actions,
      * contents and data formats.
      *
      * @param actions a bitwise mask of <code>DnDConstants</code> that represent
--- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java	Wed Jul 05 19:21:26 2017 +0200
@@ -61,7 +61,7 @@
 
     /**
      * Returns the XID of the topmost window with WM_STATE set in the ancestor
-     * heirarchy of the specified window or 0 if none found.
+     * hierarchy of the specified window or 0 if none found.
      */
     private long getToplevelWindow(long window) {
         XBaseWindow candWindow = XToolkit.windowToXWindow(window);
--- a/jdk/src/solaris/classes/sun/awt/X11/XLabelPeer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XLabelPeer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -132,20 +132,22 @@
         }
     }
 
-    public void setText(String text) {
-        label = text;
+    @Override
+    public void setText(String label) {
         if (label == null) {
             label = "";
         }
-        repaint();
-    }
-    public void setFont(Font f) {
-        super.setFont(f);
-        repaint();
+        if (!label.equals(this.label)) {
+            this.label = label;
+            repaint();
+        }
     }
 
-    public void setAlignment(int align) {
-        alignment = align;
-        repaint();
+    @Override
+    public void setAlignment(final int alignment) {
+        if (this.alignment != alignment) {
+            this.alignment = alignment;
+            repaint();
+        }
     }
 }
--- a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -31,8 +31,8 @@
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.peer.*;
+import java.util.Objects;
 import java.util.Vector;
-import java.awt.geom.*;
 import java.awt.image.*;
 import sun.util.logging.PlatformLogger;
 
@@ -409,7 +409,7 @@
         if (g != null) {
             try {
                 painter.paint(g, firstItem, lastItem, options, source, distance);
-                target.paint(g);
+                postPaintEvent(target, 0, 0, getWidth(), getHeight());
             } finally {
                 g.dispose();
             }
@@ -1682,11 +1682,13 @@
      * The bug is due to incorrent caching of the list item size
      * So we should recalculate font metrics on setFont
      */
-    public void setFont(Font f){
-        super.setFont(f);
-        initFontMetrics();
-        layout();
-        repaint();
+    public void setFont(Font f) {
+        if (!Objects.equals(getFont(), f)) {
+            super.setFont(f);
+            initFontMetrics();
+            layout();
+            repaint();
+        }
     }
 
     /**
--- a/jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuItemPeer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -60,7 +60,7 @@
      */
 
     /**
-     * Rectange occupied by menu item in container's
+     * Rectangle occupied by menu item in container's
      * coordinates. Filled by map(...) function from
      * XBaseMenuWindow.map()
      */
--- a/jdk/src/solaris/classes/sun/awt/X11/XScrollbar.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XScrollbar.java	Wed Jul 05 19:21:26 2017 +0200
@@ -564,7 +564,7 @@
      * This method enforces the same constraints as in java.awt.Scrollbar:
      * <UL>
      * <LI> The maximum must be greater than the minimum </LI>
-     * <LI> The value must be greater than or equal to the minumum
+     * <LI> The value must be greater than or equal to the minimum
      *      and less than or equal to the maximum minus the
      *      visible amount </LI>
      * <LI> The visible amount must be greater than 1 and less than or equal
@@ -855,7 +855,7 @@
         }
 
         // There was one final adjustment here in the Motif function, which was
-        // noted to be for backward-compatiblity.  It has been left out for now.
+        // noted to be for backward-compatibility.  It has been left out for now.
 
         return retVal;
     }
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Wed Jul 05 19:21:26 2017 +0200
@@ -560,7 +560,7 @@
             awtLock();
             try {
                 if (loop == SECONDARY_LOOP) {
-                    // In the secondary loop we may have already aquired awt_lock
+                    // In the secondary loop we may have already acquired awt_lock
                     // several times, so waitForEvents() might be unable to release
                     // the awt_lock and this causes lock up.
                     // For now, we just avoid waitForEvents in the secondary loop.
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Wed Jul 05 19:21:26 2017 +0200
@@ -32,7 +32,6 @@
 
 import java.lang.ref.WeakReference;
 
-import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 
 import sun.util.logging.PlatformLogger;
@@ -251,7 +250,7 @@
         if (target != null && (c = target.getBackground()) != null) {
             // We need a version of setBackground that does not call repaint !!
             // and one that does not get overridden. The problem is that in postInit
-            // we call setBackground and we dont have all the stuff initialized to
+            // we call setBackground and we don't have all the stuff initialized to
             // do a full paint for most peers. So we cannot call setBackground in postInit.
             // instead we need to call xSetBackground.
             xSetBackground(c);
@@ -437,7 +436,7 @@
 
     // We need a version of setBackground that does not call repaint !!
     // and one that does not get overridden. The problem is that in postInit
-    // we call setBackground and we dont have all the stuff initialized to
+    // we call setBackground and we don't have all the stuff initialized to
     // do a full paint for most peers. So we cannot call setBackground in postInit.
     final public void xSetBackground(Color c) {
         XToolkit.awtLock();
@@ -491,33 +490,31 @@
     public boolean isEmbedded() {
         return embedded;
     }
-    public  void repaint(int x,int y, int width, int height) {
+
+    public final void repaint(int x, int y, int width, int height) {
         if (!isVisible() || getWidth() == 0 || getHeight() == 0) {
             return;
         }
         Graphics g = getGraphics();
         if (g != null) {
             try {
-                g.setClip(x,y,width,height);
-                paint(g);
+                g.setClip(x, y, width, height);
+                if (SunToolkit.isDispatchThreadForAppContext(getTarget())) {
+                    paint(g); // The native and target will be painted in place.
+                } else {
+                    paintPeer(g);
+                    postPaintEvent(target, x, y, width, height);
+                }
             } finally {
                 g.dispose();
             }
         }
     }
+
     void repaint() {
-        if (!isVisible() || getWidth() == 0 || getHeight() == 0) {
-            return;
-        }
-        final Graphics g = getGraphics();
-        if (g != null) {
-            try {
-                paint(g);
-            } finally {
-                g.dispose();
-            }
-        }
+        repaint(0, 0, getWidth(), getHeight());
     }
+
     public void paint(final Graphics g) {
         // paint peer
         paintPeer(g);
@@ -558,11 +555,11 @@
             && compAccessor.getWidth(target) != 0
             && compAccessor.getHeight(target) != 0)
         {
-            handleExposeEvent(target, x, y, w, h);
+            postPaintEvent(target, x, y, w, h);
         }
     }
 
-    public void handleExposeEvent(Component target, int x, int y, int w, int h) {
+    public void postPaintEvent(Component target, int x, int y, int w, int h) {
         PaintEvent event = PaintEventDispatcher.getPaintEventDispatcher().
             createPaintEvent(target, x, y, w, h);
         if (event != null) {
--- a/jdk/src/solaris/classes/sun/awt/X11GraphicsConfig.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11GraphicsConfig.java	Wed Jul 05 19:21:26 2017 +0200
@@ -95,7 +95,7 @@
     }
 
     /*
-     * Note this method is currently here for backward compatability
+     * Note this method is currently here for backward compatibility
      * as this was the method used in jdk 1.2 beta4 to create the
      * X11GraphicsConfig objects. Java3D code had called this method
      * explicitly so without this, if a user tries to use JDK1.2 fcs
--- a/jdk/src/solaris/classes/sun/font/FontConfigManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/font/FontConfigManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -108,10 +108,6 @@
     public FontConfigManager() {
     }
 
-    public static String[] getFontConfigNames() {
-        return fontConfigNames;
-    }
-
     /* Called from code that needs to know what are the AA settings
      * that apps using FC would pick up for the default desktop font.
      * Note apps can change the default desktop font. etc, so this
@@ -182,7 +178,6 @@
             t0 = System.nanoTime();
         }
 
-        String[] fontConfigNames = FontConfigManager.getFontConfigNames();
         FcCompFont[] fontArr = new FcCompFont[fontConfigNames.length];
 
         for (int i = 0; i< fontArr.length; i++) {
--- a/jdk/src/solaris/classes/sun/font/XMap.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/font/XMap.java	Wed Jul 05 19:21:26 2017 +0200
@@ -204,7 +204,7 @@
             try {
                 int cbLen = 0;
                 int bbLen = 0;
-                // Since we dont support surrogates in any X11 encoding, skip
+                // Since we don't support surrogates in any X11 encoding, skip
                 // the surrogate area, otherwise the sequence of "Oxdbff0xdc00"
                 // will accidently cause the surrogate-aware nio charset to treat
                 // them as a legal pair and then undesirablly skip 2 "chars"
--- a/jdk/src/solaris/classes/sun/java2d/jules/JulesAATileGenerator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/jules/JulesAATileGenerator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -212,9 +212,9 @@
 
     /*
      * Optimization for large fills. Foutunatly cairo does generate an y-sorted
-     * list of trapezoids. This makes it quite simple to check wether a tile is
-     * fully covered by traps by: - Checking wether the tile is fully covered by
-     * traps vertically (trap 2 starts where trap 1 ended) - Checking wether all
+     * list of trapezoids. This makes it quite simple to check whether a tile is
+     * fully covered by traps by: - Checking whether the tile is fully covered by
+     * traps vertically (trap 2 starts where trap 1 ended) - Checking whether all
      * traps cover the tile horizontally This also works, when a single tile
      * coveres the whole tile.
      */
@@ -231,7 +231,7 @@
         int tileEndX = tileStartX + TILE_SIZE_FP;
         int tileEndY = tileStartY + TILE_SIZE_FP;
 
-        // Check wether first tile covers the beginning of the tile vertically
+        // Check whether first tile covers the beginning of the tile vertically
         int firstTop = traps.getTop(trapList.getInt(0));
         int firstBottom = traps.getBottom(trapList.getInt(0));
         if (firstTop > tileStartY || firstBottom < tileStartY) {
--- a/jdk/src/solaris/classes/sun/java2d/xr/MaskTileManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/MaskTileManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -76,8 +76,9 @@
     public void fillMask(XRSurfaceData dst) {
 
         boolean maskRequired = xrMgr.maskRequired();
+        boolean maskEvaluated = XRUtils.isMaskEvaluated(xrMgr.compRule);
 
-        if (maskRequired) {
+        if (maskRequired && maskEvaluated) {
             mainTile.calculateDirtyAreas();
             DirtyRegion dirtyArea = mainTile.getDirtyArea().cloneRegion();
             mainTile.translate(-dirtyArea.x, -dirtyArea.y);
@@ -106,7 +107,15 @@
                 }
             }
         } else {
-            xrMgr.XRRenderRectangles(dst, mainTile.getRects());
+            /*
+             * If a mask would be required to store geometry (maskRequired)
+             * composition has to be done rectangle-by-rectagle.
+             */
+            if(xrMgr.isSolidPaintActive()) {
+                xrMgr.XRRenderRectangles(dst, mainTile.getRects());
+            } else {
+                xrMgr.XRCompositeRectangles(dst, mainTile.getRects());
+            }
         }
 
         mainTile.reset();
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRBackend.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRBackend.java	Wed Jul 05 19:21:26 2017 +0200
@@ -100,14 +100,13 @@
                                      int xSrc, int ySrc, int xDst, int yDst,
                                      int glyphset, GrowableEltArray elts);
 
-    public int createRadialGradient(Point2D inner, Point2D outer,
+    public int createRadialGradient(float centerX, float centerY,
                                     float innerRadius, float outerRadius,
                                     float[] fractions, int[] pixels,
-                                    int repeat, AffineTransform transform);
+                                    int repeat);
 
     public int createLinearGradient(Point2D p1, Point2D p2, float[] fractions,
-                                    int[] pixels, int repeat,
-                                     AffineTransform transform);
+                                    int[] pixels, int repeat);
 
     public void setGCMode(long gc, boolean copy);
 
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRBackendNative.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRBackendNative.java	Wed Jul 05 19:21:26 2017 +0200
@@ -105,17 +105,14 @@
         XRCreateLinearGradientPaintNative(float[] fractionsArray,
                                           short[] pixelsArray,
                                           int x1, int y1, int x2, int y2,
-                                          int numStops, int repeat,
-                                          int m00, int m01, int m02,
-                                           int m10, int m11, int m12);
+                                          int numStops, int repeat);
 
     private native static int
         XRCreateRadialGradientPaintNative(float[] fractionsArray,
                                           short[] pixelsArray, int numStops,
+                                          int centerX, int centerY,
                                           int innerRadius, int outerRadius,
-                                          int repeat,
-                                          int m00, int m01, int m02,
-                                          int m10, int m11, int m12);
+                                          int repeat);
 
     public native void setFilter(int picture, int filter);
 
@@ -175,40 +172,29 @@
     }
 
     public int createLinearGradient(Point2D p1, Point2D p2, float[] fractions,
-                              int[] pixels,  int repeat, AffineTransform trx) {
+                              int[] pixels,  int repeat) {
 
         short[] colorValues = getRenderColors(pixels);
         int gradient =
            XRCreateLinearGradientPaintNative(fractions, colorValues,
                 XDoubleToFixed(p1.getX()), XDoubleToFixed(p1.getY()),
                 XDoubleToFixed(p2.getX()), XDoubleToFixed(p2.getY()),
-                fractions.length, repeat,
-                XDoubleToFixed(trx.getScaleX()),
-                XDoubleToFixed(trx.getShearX()),
-                XDoubleToFixed(trx.getTranslateX()),
-                XDoubleToFixed(trx.getShearY()),
-                XDoubleToFixed(trx.getScaleY()),
-                XDoubleToFixed(trx.getTranslateY()));
+                fractions.length, repeat);
         return gradient;
     }
 
-    public int createRadialGradient(Point2D inner, Point2D outer,
+    public int createRadialGradient(float centerX, float centerY,
                                    float innerRadius, float outerRadius,
-                                   float[] fractions, int[] pixels, int repeat,
-                                   AffineTransform trx) {
+                                   float[] fractions, int[] pixels, int repeat) {
 
         short[] colorValues = getRenderColors(pixels);
         return XRCreateRadialGradientPaintNative
              (fractions, colorValues, fractions.length,
+              XDoubleToFixed(centerX),
+              XDoubleToFixed(centerY),
               XDoubleToFixed(innerRadius),
               XDoubleToFixed(outerRadius),
-              repeat,
-              XDoubleToFixed(trx.getScaleX()),
-              XDoubleToFixed(trx.getShearX()),
-              XDoubleToFixed(trx.getTranslateX()),
-              XDoubleToFixed(trx.getShearY()),
-              XDoubleToFixed(trx.getScaleY()),
-              XDoubleToFixed(trx.getTranslateY()));
+              repeat);
     }
 
     public void setGCClipRectangles(long gc, Region clip) {
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRColor.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRColor.java	Wed Jul 05 19:21:26 2017 +0200
@@ -54,6 +54,7 @@
     }
 
     public XRColor(Color color) {
+        setColorValues(color);
     }
 
     public void setColorValues(Color color) {
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRCompositeManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRCompositeManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -48,7 +48,12 @@
     private static boolean enableGradCache = true;
     private static XRCompositeManager instance;
 
-    XRSurfaceData src;
+    private final static int SOLID = 0;
+    private final static int TEXTURE = 1;
+    private final static int GRADIENT = 2;
+
+    int srcType;
+    XRSolidSrcPict solidSrc32;
     XRSurfaceData texture;
     XRSurfaceData gradient;
     int alphaMask = XRUtils.None;
@@ -84,7 +89,6 @@
 
     private XRCompositeManager(XRSurfaceData surface) {
         con = new XRBackendNative();
-        // con = XRBackendJava.getInstance();
 
         String gradProp =
             AccessController.doPrivileged(new PrivilegedAction<String>() {
@@ -109,14 +113,7 @@
     public void initResources(XRSurfaceData surface) {
         int parentXid = surface.getXid();
 
-        int solidPixmap = con.createPixmap(parentXid, 32, 1, 1);
-        int solidSrcPictXID = con.createPicture(solidPixmap,
-                XRUtils.PictStandardARGB32);
-        con.setPictureRepeat(solidSrcPictXID, XRUtils.RepeatNormal);
-        con.renderRectangle(solidSrcPictXID, XRUtils.PictOpSrc,
-                XRColor.FULL_ALPHA, 0, 0, 1, 1);
-        solidSrcPict = new XRSurfaceData.XRInternalSurfaceData(con,
-                solidSrcPictXID, null);
+        solidSrc32 = new XRSolidSrcPict(con, parentXid);
         setForeground(0);
 
         int extraAlphaMask = con.createPixmap(parentXid, 8, 1, 1);
@@ -135,9 +132,7 @@
     }
 
     public void setForeground(int pixel) {
-        solidColor.setColorValues(pixel, false);
-        con.renderRectangle(solidSrcPict.picture, XRUtils.PictOpSrc,
-                solidColor, 0, 0, 1, 1);
+        solidColor.setColorValues(pixel, true);
     }
 
     public void setGradientPaint(XRSurfaceData gradient) {
@@ -145,16 +140,16 @@
             con.freePicture(this.gradient.picture);
         }
         this.gradient = gradient;
-        src = gradient;
+        srcType = GRADIENT;
     }
 
     public void setTexturePaint(XRSurfaceData texture) {
         this.texture = texture;
-        src = texture;
+        this.srcType = TEXTURE;
     }
 
     public void XRResetPaint() {
-        src = solidSrcPict;
+        srcType = SOLID;
     }
 
     public void validateCompositeState(Composite comp, AffineTransform xform,
@@ -175,7 +170,7 @@
             validatedComp = comp;
         }
 
-        if (sg2d != null && validatedPixel != sg2d.pixel) {
+        if (sg2d != null && (validatedPixel != sg2d.pixel  || updatePaint)) {
             validatedPixel = sg2d.pixel;
             setForeground(validatedPixel);
         }
@@ -191,14 +186,14 @@
             validatedPaint = paint;
         }
 
-        if (src != solidSrcPict) {
+        if (srcType != SOLID) {
             AffineTransform at = (AffineTransform) xform.clone();
             try {
                 at.invert();
             } catch (NoninvertibleTransformException e) {
                 at.setToIdentity();
             }
-            src.validateAsSource(at, -1, -1);
+            getCurrentSource().validateAsSource(at, -1, XRUtils.ATransOpToXRQuality(sg2d.interpolationType));
         }
     }
 
@@ -234,13 +229,13 @@
 
     public boolean maskRequired() {
         return (!xorEnabled)
-                && ((src != solidSrcPict)
-                        || (src == solidSrcPict && solidColor.alpha != 0xffff) || (extraAlpha != 1.0f));
+                && ((srcType != SOLID)
+                        || (srcType == SOLID && (solidColor.alpha != 0xffff) || (extraAlpha != 1.0f)));
     }
 
     public void XRComposite(int src, int mask, int dst, int srcX, int srcY,
             int maskX, int maskY, int dstX, int dstY, int width, int height) {
-        int cachedSrc = (src == XRUtils.None) ? this.src.picture : src;
+        int cachedSrc = (src == XRUtils.None) ? getCurrentSource().picture : src;
         int cachedX = srcX;
         int cachedY = srcY;
 
@@ -276,7 +271,7 @@
         renderReferenceY = (int) Math.floor(XRUtils
                 .XFixedToDouble(renderReferenceY));
 
-        con.renderCompositeTrapezoids(compRule, src.picture,
+        con.renderCompositeTrapezoids(compRule, getCurrentSource().picture,
                 XRUtils.PictStandardA8, dst, renderReferenceX,
                 renderReferenceY, trapList);
     }
@@ -294,15 +289,46 @@
         }
     }
 
+    public void XRCompositeRectangles(XRSurfaceData dst, GrowableRectArray rects) {
+        int srcPict = getCurrentSource().picture;
+
+        for(int i=0; i < rects.getSize(); i++) {
+            int x = rects.getX(i);
+            int y = rects.getY(i);
+            int width = rects.getWidth(i);
+            int height = rects.getHeight(i);
+
+            con.renderComposite(compRule, srcPict, XRUtils.None, dst.picture, x, y, 0, 0, x, y, width, height);
+        }
+    }
+
+    protected XRSurfaceData getCurrentSource() {
+        switch(srcType) {
+        case SOLID:
+            return solidSrc32.prepareSrcPict(validatedPixel);
+        case TEXTURE:
+            return texture;
+        case GRADIENT:
+            return gradient;
+        }
+
+        return null;
+    }
+
     public void compositeBlit(XRSurfaceData src, XRSurfaceData dst, int sx,
             int sy, int dx, int dy, int w, int h) {
         con.renderComposite(compRule, src.picture, alphaMask, dst.picture, sx,
                 sy, 0, 0, dx, dy, w, h);
     }
 
-    public void compositeText(XRSurfaceData dst, int sx, int sy,
-            int glyphSet, int maskFormat, GrowableEltArray elts) {
-        con.XRenderCompositeText(compRule, src.picture, dst.picture,
+    public void compositeText(XRSurfaceData dst, int sx, int sy, int glyphSet,
+            int maskFormat, GrowableEltArray elts) {
+        /*
+         * Try to emulate the SRC blend mode with SRC_OVER.
+         * We bail out during pipe validation for cases where this is not possible.
+         */
+        byte textCompRule = (compRule != XRUtils.PictOpSrc) ? compRule : XRUtils.PictOpOver;
+        con.XRenderCompositeText(textCompRule, getCurrentSource().picture, dst.picture,
                 maskFormat, sx, sy, 0, 0, glyphSet, elts);
     }
 
@@ -315,7 +341,11 @@
     }
 
     public boolean isTexturePaintActive() {
-        return src == texture;
+        return srcType == TEXTURE;
+    }
+
+    public boolean isSolidPaintActive() {
+        return srcType == SOLID;
     }
 
     public XRColor getAlphaColor() {
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRDrawImage.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRDrawImage.java	Wed Jul 05 19:21:26 2017 +0200
@@ -38,6 +38,7 @@
  */
 
 public class XRDrawImage extends DrawImage {
+
     @Override
     protected void renderImageXform(SunGraphics2D sg, Image img,
             AffineTransform tx, int interpType, int sx1, int sy1, int sx2,
@@ -45,20 +46,24 @@
         SurfaceData dstData = sg.surfaceData;
         SurfaceData srcData = dstData.getSourceSurfaceData(img,
                 SunGraphics2D.TRANSFORM_GENERIC, sg.imageComp, bgColor);
+        int compRule = ((AlphaComposite) sg.composite).getRule();
+        float extraAlpha = ((AlphaComposite) sg.composite).getAlpha();
 
         if (srcData != null && !isBgOperation(srcData, bgColor)
-                && interpType <= AffineTransformOp.TYPE_BILINEAR) {
+                && interpType <= AffineTransformOp.TYPE_BILINEAR
+                && (XRUtils.isMaskEvaluated(XRUtils.j2dAlphaCompToXR(compRule))
+                        || (XRUtils.isTransformQuadrantRotated(tx)) && extraAlpha == 1.0f))
+                         {
             SurfaceType srcType = srcData.getSurfaceType();
             SurfaceType dstType = dstData.getSurfaceType();
 
             TransformBlit blit = TransformBlit.getFromCache(srcType,
                     sg.imageComp, dstType);
-
             if (blit != null) {
                 blit.Transform(srcData, dstData, sg.composite,
                         sg.getCompClip(), tx, interpType, sx1, sy1, 0, 0, sx2
                                 - sx1, sy2 - sy1);
-                return;
+                    return;
             }
         }
 
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRMaskBlit.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRMaskBlit.java	Wed Jul 05 19:21:26 2017 +0200
@@ -84,7 +84,7 @@
 
             int maskPict = maskBuffer.getMaskBuffer().
                          uploadMask(width, height, maskscan, maskoff, mask);
-            maskBuffer.XRComposite(x11sd.getPicture(), maskPict, x11sd.picture,
+            maskBuffer.XRComposite(x11sd.getPicture(), maskPict, x11dst.getPicture(),
                                   srcx, srcy, 0, 0, dstx, dsty, width, height);
             maskBuffer.getMaskBuffer().clearUploadMask(maskPict, width, height);
         } finally {
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java	Wed Jul 05 19:21:26 2017 +0200
@@ -178,9 +178,6 @@
         super(srcType, CompositeType.AnyAlpha, dstType);
     }
 
-    /*
-     * TODO: This breaks scales with non-integer coordinates!?!?!
-     */
     public void Scale(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx1, int sy1, int sx2, int sy2, double dx1, double dy1,
             double dx2, double dy2) {
         try {
@@ -199,19 +196,14 @@
             sy1 *= yScale;
             sy2 *= yScale;
 
+            dx1 = Math.ceil(dx1 - 0.5);
+            dy1 = Math.ceil(dy1 - 0.5);
+            dx2 = Math.ceil(dx2 - 0.5);
+            dy2 = Math.ceil(dy2 - 0.5);
+
             AffineTransform xForm = AffineTransform.getScaleInstance(1 / xScale, 1 / yScale);
 
-            x11sdSrc.validateAsSource(xForm, XRUtils.RepeatNone, XRUtils.FAST); /*
-                                                                                 * TODO:
-                                                                                 * padded
-                                                                                 * blit
-                                                                                 * required
-                                                                                 * :
-                                                                                 * -
-                                                                                 * /
-                                                                                 * ?
-                                                                                 * ?
-                                                                                 */
+            x11sdSrc.validateAsSource(xForm, XRUtils.RepeatNone, XRUtils.FAST);
             x11sdDst.maskBuffer.compositeBlit(x11sdSrc, x11sdDst, (int) sx1, (int) sy1, (int) dx1, (int) dy1, (int) (dx2 - dx1), (int) (dy2 - dy1));
         } finally {
             SunToolkit.awtUnlock();
@@ -234,43 +226,55 @@
     }
 
     /*
-     * Calculates the composite-rectangle required for transformed blits. This
-     * method is functionally equal to: Shape shp =
-     * xform.createTransformedShape(rect); Rectangle bounds = shp.getBounds();
-     * but performs significantly better.
-     * Returns true if the destination shape is parallel to x/y axis
+     * Calculates the composition-rectangle required for transformed blits.
+     * For composite operations where the composition-rectangle defines
+     * the modified destination area, coordinates are rounded.
+     * Otherwise the composition window rectangle is sized large enough
+     * to not clip away any pixels.
      */
-    protected boolean adjustCompositeBounds(AffineTransform tr, int dstx, int dsty, int width, int height) {
+    protected void adjustCompositeBounds(boolean isQuadrantRotated, AffineTransform tr,
+            int dstx, int dsty, int width, int height) {
         srcCoords[0] = dstx;
         srcCoords[1] = dsty;
         srcCoords[2] = dstx + width;
-        srcCoords[3] = dsty;
-        srcCoords[4] = dstx + width;
-        srcCoords[5] = dsty + height;
-        srcCoords[6] = dstx;
-        srcCoords[7] = dsty + height;
+        srcCoords[3] = dsty + height;
 
-        tr.transform(srcCoords, 0, dstCoords, 0, 4);
+        double minX, minY, maxX, maxY;
+        if (isQuadrantRotated) {
+            tr.transform(srcCoords, 0, dstCoords, 0, 2);
+
+            minX = Math.min(dstCoords[0], dstCoords[2]);
+            minY = Math.min(dstCoords[1], dstCoords[3]);
+            maxX = Math.max(dstCoords[0], dstCoords[2]);
+            maxY = Math.max(dstCoords[1], dstCoords[3]);
 
-        double minX = Math.min(dstCoords[0], Math.min(dstCoords[2], Math.min(dstCoords[4], dstCoords[6])));
-        double minY = Math.min(dstCoords[1], Math.min(dstCoords[3], Math.min(dstCoords[5], dstCoords[7])));
-        double maxX = Math.max(dstCoords[0], Math.max(dstCoords[2], Math.max(dstCoords[4], dstCoords[6])));
-        double maxY = Math.max(dstCoords[1], Math.max(dstCoords[3], Math.max(dstCoords[5], dstCoords[7])));
+            minX = Math.ceil(minX - 0.5);
+            minY = Math.ceil(minY - 0.5);
+            maxX = Math.ceil(maxX - 0.5);
+            maxY = Math.ceil(maxY - 0.5);
+        } else {
+            srcCoords[4] = dstx;
+            srcCoords[5] = dsty + height;
+            srcCoords[6] = dstx + width;
+            srcCoords[7] = dsty;
 
-        minX = Math.round(minX);
-        minY = Math.round(minY);
-        maxX = Math.round(maxX);
-        maxY = Math.round(maxY);
+            tr.transform(srcCoords, 0, dstCoords, 0, 4);
+
+            minX = Math.min(dstCoords[0], Math.min(dstCoords[2], Math.min(dstCoords[4], dstCoords[6])));
+            minY = Math.min(dstCoords[1], Math.min(dstCoords[3], Math.min(dstCoords[5], dstCoords[7])));
+            maxX = Math.max(dstCoords[0], Math.max(dstCoords[2], Math.max(dstCoords[4], dstCoords[6])));
+            maxY = Math.max(dstCoords[1], Math.max(dstCoords[3], Math.max(dstCoords[5], dstCoords[7])));
+
+            minX = Math.floor(minX);
+            minY = Math.floor(minY);
+            maxX = Math.ceil(maxX);
+            maxY = Math.ceil(maxY);
+        }
 
         compositeBounds.x = (int) minX;
         compositeBounds.y = (int) minY;
         compositeBounds.width = (int) (maxX - minX);
         compositeBounds.height = (int) (maxY - minY);
-
-        boolean is0or180 = (dstCoords[1] == dstCoords[3]) && (dstCoords[2] == dstCoords[4]);
-        boolean is90or270 = (dstCoords[0] == dstCoords[2]) && (dstCoords[3] == dstCoords[5]);
-
-        return is0or180 || is90or270;
     }
 
     public void Transform(SurfaceData src, SurfaceData dst, Composite comp, Region clip, AffineTransform xform,
@@ -280,9 +284,13 @@
 
             XRSurfaceData x11sdDst = (XRSurfaceData) dst;
             XRSurfaceData x11sdSrc = (XRSurfaceData) src;
+            XRCompositeManager xrMgr = XRCompositeManager.getInstance(x11sdSrc);
 
+            float extraAlpha = ((AlphaComposite) comp).getAlpha();
             int filter = XRUtils.ATransOpToXRQuality(hint);
-            boolean isAxisAligned = adjustCompositeBounds(xform, dstx, dsty, width, height);
+            boolean isQuadrantRotated = XRUtils.isTransformQuadrantRotated(xform);
+
+            adjustCompositeBounds(isQuadrantRotated, xform, dstx, dsty, width, height);
 
             x11sdDst.validateAsDestination(null, clip);
             x11sdDst.maskBuffer.validateCompositeState(comp, null, null, null);
@@ -298,21 +306,26 @@
                 trx.setToIdentity();
             }
 
-            boolean omitMask = (filter == XRUtils.FAST)
-                    || (isAxisAligned && ((AlphaComposite) comp).getAlpha() == 1.0f);
-
-            if (!omitMask) {
+            if (filter != XRUtils.FAST && (!isQuadrantRotated || extraAlpha != 1.0f)) {
                 XRMaskImage mask = x11sdSrc.maskBuffer.getMaskImage();
 
+                // For quadrant-transformed blits geometry is not stored inside the mask
+                // therefore we can use a repeating 1x1 mask for applying extra alpha.
+                int maskPicture = isQuadrantRotated ? xrMgr.getExtraAlphaMask()
+                        : mask.prepareBlitMask(x11sdDst, maskTX, width, height);
+
                 x11sdSrc.validateAsSource(trx, XRUtils.RepeatPad, filter);
-                int maskPicture = mask.prepareBlitMask(x11sdDst, maskTX, width, height);
-                x11sdDst.maskBuffer.con.renderComposite(XRCompositeManager.getInstance(x11sdSrc).getCompRule(), x11sdSrc.picture, maskPicture, x11sdDst.picture,
-                        0, 0, 0, 0, compositeBounds.x, compositeBounds.y, compositeBounds.width, compositeBounds.height);
+                x11sdDst.maskBuffer.con.renderComposite(xrMgr.getCompRule(), x11sdSrc.picture,
+                        maskPicture, x11sdDst.picture, 0, 0, 0, 0, compositeBounds.x, compositeBounds.y,
+                        compositeBounds.width, compositeBounds.height);
             } else {
                 int repeat = filter == XRUtils.FAST ? XRUtils.RepeatNone : XRUtils.RepeatPad;
 
                 x11sdSrc.validateAsSource(trx, repeat, filter);
-                x11sdDst.maskBuffer.compositeBlit(x11sdSrc, x11sdDst, 0, 0, compositeBounds.x, compositeBounds.y, compositeBounds.width, compositeBounds.height);
+
+                // compositeBlit takes care of extra alpha
+                x11sdDst.maskBuffer.compositeBlit(x11sdSrc, x11sdDst, 0, 0, compositeBounds.x,
+                        compositeBounds.y, compositeBounds.width, compositeBounds.height);
             }
         } finally {
             SunToolkit.awtUnlock();
@@ -329,9 +342,7 @@
     }
 
     public void Blit(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx, int sy, int dx, int dy, int w, int h) {
-        /*
-         * If the blit is write-only (putimge), no need for a temporary VI.
-         */
+        // If the blit is write-only (putimge), no need for a temporary VI.
         if (CompositeType.SrcOverNoEa.equals(comp) && (src.getTransparency() == Transparency.OPAQUE)) {
             Blit opaqueSwToSurfaceBlit = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, dst.getSurfaceType());
             opaqueSwToSurfaceBlit.Blit(src, dst, comp, clip, sx, sy, dx, dy, w, h);
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRPaints.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRPaints.java	Wed Jul 05 19:21:26 2017 +0200
@@ -29,10 +29,9 @@
 import java.awt.MultipleGradientPaint.*;
 import java.awt.geom.*;
 import java.awt.image.*;
-
 import sun.java2d.*;
 import sun.java2d.loops.*;
-import sun.java2d.pipe.*;
+import sun.java2d.xr.XRSurfaceData.XRInternalSurfaceData;
 
 abstract class XRPaints {
     static XRCompositeManager xrCompMan;
@@ -108,27 +107,16 @@
         void setXRPaint(SunGraphics2D sg2d, Paint pt) {
             GradientPaint paint = (GradientPaint) pt;
 
-            int[] pixels = convertToIntArgbPixels(new Color[] { paint.getColor1(), paint.getColor2() }, false);
-
-            float fractions[] = new float[2];
-            fractions[0] = 0;
-            fractions[1] = 1;
+            int repeat = paint.isCyclic() ? XRUtils.RepeatReflect : XRUtils.RepeatPad;
+            float fractions[] = {0, 1};
+            int[] pixels = convertToIntArgbPixels(new Color[] { paint.getColor1(), paint.getColor2() });
 
             Point2D pt1 = paint.getPoint1();
             Point2D pt2 = paint.getPoint2();
 
-            AffineTransform at = (AffineTransform) sg2d.transform.clone();
-            try {
-                at.invert();
-            } catch (NoninvertibleTransformException ex) {
-                at.setToIdentity();
-            }
-
-            int repeat = paint.isCyclic() ? XRUtils.RepeatReflect : XRUtils.RepeatPad;
-
             XRBackend con = xrCompMan.getBackend();
-            int gradient = con.createLinearGradient(pt1, pt2, fractions, pixels, repeat, at);
-            xrCompMan.setGradientPaint(new XRSurfaceData.XRInternalSurfaceData(con, gradient, at));
+            int gradient = con.createLinearGradient(pt1, pt2, fractions, pixels, repeat);
+            xrCompMan.setGradientPaint(new XRSurfaceData.XRInternalSurfaceData(con, gradient));
         }
     }
 
@@ -142,26 +130,22 @@
 
         @Override
         boolean isPaintValid(SunGraphics2D sg2d) {
-            return true;
+            return ((LinearGradientPaint) sg2d.getPaint()).getColorSpace() == ColorSpaceType.SRGB;
         }
 
         @Override
         void setXRPaint(SunGraphics2D sg2d, Paint pt) {
             LinearGradientPaint paint = (LinearGradientPaint) pt;
-            boolean linear = (paint.getColorSpace() == ColorSpaceType.LINEAR_RGB);
 
             Color[] colors = paint.getColors();
             Point2D pt1 = paint.getStartPoint();
             Point2D pt2 = paint.getEndPoint();
 
+            int repeat = XRUtils.getRepeatForCycleMethod(paint.getCycleMethod());
+            float[] fractions = paint.getFractions();
+            int[] pixels = convertToIntArgbPixels(colors);
 
             AffineTransform at = paint.getTransform();
-            at.preConcatenate(sg2d.transform);
-
-            int repeat = XRUtils.getRepeatForCycleMethod(paint.getCycleMethod());
-            float[] fractions = paint.getFractions();
-            int[] pixels = convertToIntArgbPixels(colors, linear);
-
             try {
                 at.invert();
             } catch (NoninvertibleTransformException ex) {
@@ -169,8 +153,10 @@
             }
 
             XRBackend con = xrCompMan.getBackend();
-            int gradient = con.createLinearGradient(pt1, pt2, fractions, pixels, repeat, at);
-            xrCompMan.setGradientPaint(new XRSurfaceData.XRInternalSurfaceData(con, gradient, at));
+            int gradient = con.createLinearGradient(pt1, pt2, fractions, pixels, repeat);
+            XRInternalSurfaceData x11sd = new XRSurfaceData.XRInternalSurfaceData(con, gradient);
+            x11sd.setStaticSrcTx(at);
+            xrCompMan.setGradientPaint(x11sd);
         }
     }
 
@@ -179,136 +165,101 @@
         @Override
         boolean isPaintValid(SunGraphics2D sg2d) {
             RadialGradientPaint grad = (RadialGradientPaint) sg2d.paint;
-            return grad.getFocusPoint().equals(grad.getCenterPoint());
+            return grad.getFocusPoint().equals(grad.getCenterPoint())
+                   && grad.getColorSpace() == ColorSpaceType.SRGB;
         }
 
         @Override
         void setXRPaint(SunGraphics2D sg2d, Paint pt) {
             RadialGradientPaint paint = (RadialGradientPaint) pt;
-            boolean linear = (paint.getColorSpace() == ColorSpaceType.LINEAR_RGB);
             Color[] colors = paint.getColors();
             Point2D center = paint.getCenterPoint();
-            Point2D focus = paint.getFocusPoint();
 
             int repeat = XRUtils.getRepeatForCycleMethod(paint.getCycleMethod());
             float[] fractions = paint.getFractions();
-            int[] pixels = convertToIntArgbPixels(colors, linear);
+            int[] pixels = convertToIntArgbPixels(colors);
             float radius = paint.getRadius();
 
-            // save original (untransformed) center and focus points
-            double cx = center.getX();
-            double cy = center.getY();
-            double fx = focus.getX();
-            double fy = focus.getY();
+            float cx = (float) center.getX();
+            float cy = (float) center.getY();
 
             AffineTransform at = paint.getTransform();
-            at.preConcatenate(sg2d.transform);
-            focus = at.transform(focus, focus);
-
-            // transform unit circle to gradient coords; we start with the
-            // unit circle (center=(0,0), focus on positive x-axis, radius=1)
-            // and then transform into gradient space
-            at.translate(cx, cy);
-            at.rotate(fx - cx, fy - cy);
-            // at.scale(radius, radius);
-
-            // invert to get mapping from device coords to unit circle
             try {
                 at.invert();
-            } catch (Exception e) {
-                at.setToScale(0.0, 0.0);
+            } catch (NoninvertibleTransformException ex) {
+                ex.printStackTrace();
             }
-            focus = at.transform(focus, focus);
-
-            // clamp the focus point so that it does not rest on, or outside
-            // of, the circumference of the gradient circle
-            fx = Math.min(focus.getX(), 0.99);
 
             XRBackend con = xrCompMan.getBackend();
-            int gradient = con.createRadialGradient(new Point2D.Float(0, 0), new Point2D.Float(0, 0), 0, radius, fractions, pixels, repeat, at);
-            xrCompMan.setGradientPaint(new XRSurfaceData.XRInternalSurfaceData(con, gradient, at));
+            int gradient = con.createRadialGradient(cx, cy, 0, radius, fractions, pixels, repeat);
+            XRInternalSurfaceData x11sd = new XRSurfaceData.XRInternalSurfaceData(con, gradient);
+            x11sd.setStaticSrcTx(at);
+            xrCompMan.setGradientPaint(x11sd);
         }
     }
 
     private static class XRTexture extends XRPaints {
 
+        private XRSurfaceData getAccSrcSurface(XRSurfaceData dstData, BufferedImage bi) {
+            // REMIND: this is a hack that attempts to cache the system
+            // memory image from the TexturePaint instance into an
+            // XRender pixmap...
+            SurfaceData srcData = dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null);
+            if (!(srcData instanceof XRSurfaceData)) {
+                srcData = dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null);
+                if (!(srcData instanceof XRSurfaceData)) {
+                    throw new InternalError("Surface not cachable");
+                }
+            }
+
+            return (XRSurfaceData) srcData;
+        }
+
         @Override
         boolean isPaintValid(SunGraphics2D sg2d) {
             TexturePaint paint = (TexturePaint) sg2d.paint;
             BufferedImage bi = paint.getImage();
             XRSurfaceData dstData = (XRSurfaceData) sg2d.getDestSurface();
 
-            SurfaceData srcData = dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null);
-            if (!(srcData instanceof XRSurfaceData)) {
-                // REMIND: this is a hack that attempts to cache the system
-                // memory image from the TexturePaint instance into an
-                // OpenGL texture...
-                srcData = dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null);
-                if (!(srcData instanceof XRSurfaceData)) {
-                    return false;
-                }
-            }
-
-            return true;
+            return getAccSrcSurface(dstData, bi) != null;
         }
 
         @Override
         void setXRPaint(SunGraphics2D sg2d, Paint pt) {
             TexturePaint paint = (TexturePaint) pt;
-
             BufferedImage bi = paint.getImage();
-            SurfaceData dstData = sg2d.surfaceData;
-            SurfaceData srcData = dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null);
+            Rectangle2D anchor = paint.getAnchorRect();
 
-            // REMIND: this hack tries to ensure that we have a cached texture
-            if (!(srcData instanceof XRSurfaceData)) {
-                srcData = dstData.getSourceSurfaceData(paint.getImage(), SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null);
-                if (!(srcData instanceof XRSurfaceData)) {
-                    throw new InternalError("Surface not cachable");
-                }
-            }
+            XRSurfaceData dstData = (XRSurfaceData) sg2d.surfaceData;
+            XRSurfaceData srcData = (XRSurfaceData) getAccSrcSurface(dstData, bi);
 
-            XRSurfaceData x11SrcData = (XRSurfaceData) srcData;
-
-            AffineTransform at = (AffineTransform) sg2d.transform.clone();
-            Rectangle2D anchor = paint.getAnchorRect();
+            AffineTransform at = new AffineTransform();
             at.translate(anchor.getX(), anchor.getY());
             at.scale(anchor.getWidth() / ((double) bi.getWidth()), anchor.getHeight() / ((double) bi.getHeight()));
 
             try {
                 at.invert();
             } catch (NoninvertibleTransformException ex) {
-                at.setToIdentity(); /* TODO: Right thing to do in this case? */
+                at.setToIdentity();
             }
+            srcData.setStaticSrcTx(at);
 
-            x11SrcData.validateAsSource(at, XRUtils.RepeatNormal, XRUtils.ATransOpToXRQuality(sg2d.interpolationType));
-            xrCompMan.setTexturePaint(((XRSurfaceData) srcData));
+            srcData.validateAsSource(at, XRUtils.RepeatNormal, XRUtils.ATransOpToXRQuality(sg2d.interpolationType));
+            xrCompMan.setTexturePaint(srcData);
         }
     }
 
-    public int[] convertToIntArgbPixels(Color[] colors, boolean linear) {
+    public int[] convertToIntArgbPixels(Color[] colors) {
         int[] pixels = new int[colors.length];
         for (int i = 0; i < colors.length; i++) {
-            pixels[i] = colorToIntArgbPixel(colors[i], linear);
+            pixels[i] = colorToIntArgbPixel(colors[i]);
         }
         return pixels;
     }
 
-    public int colorToIntArgbPixel(Color c, boolean linear) {
+    public int colorToIntArgbPixel(Color c) {
         int rgb = c.getRGB();
-
-        int a = rgb >>> 24;
-        int r = (rgb >> 16) & 0xff;
-        int g = (rgb >> 8) & 0xff;
-        int b = (rgb) & 0xff;
-        if (linear) {
-            r = BufferedPaints.convertSRGBtoLinearRGB(r);
-            g = BufferedPaints.convertSRGBtoLinearRGB(g);
-            b = BufferedPaints.convertSRGBtoLinearRGB(b);
-        }
-
-        a *= xrCompMan.getExtraAlpha();
-
-        return ((a << 24) | (r << 16) | (g << 8) | (b));
+        int a = (int) Math.round(xrCompMan.getExtraAlpha() * (rgb >>> 24));
+        return ((a << 24) | (rgb & 0x00FFFFFF));
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRSolidSrcPict.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.java2d.xr;
+
+public class XRSolidSrcPict {
+    XRBackend con;
+
+    XRSurfaceData srcPict;
+    XRColor xrCol;
+    int curPixVal = -1;
+
+    public XRSolidSrcPict(XRBackend con, int parentXid) {
+        this.con = con;
+
+        xrCol = new XRColor();
+        int solidPixmap = con.createPixmap(parentXid, 32, 1, 1);
+        int solidSrcPictXID = con.createPicture(solidPixmap, XRUtils.PictStandardARGB32);
+        con.setPictureRepeat(solidSrcPictXID, XRUtils.RepeatNormal);
+        con.renderRectangle(solidSrcPictXID, XRUtils.PictOpSrc, XRColor.FULL_ALPHA, 0, 0, 1, 1);
+        srcPict = new XRSurfaceData.XRInternalSurfaceData(con, solidSrcPictXID);
+    }
+
+    public XRSurfaceData prepareSrcPict(int pixelVal) {
+        if(pixelVal != curPixVal) {
+            xrCol.setColorValues(pixelVal, false);
+            con.renderRectangle(srcPict.picture, XRUtils.PictOpSrc, xrCol, 0, 0, 1, 1);
+            this.curPixVal = pixelVal;
+        }
+
+        return srcPict;
+    }
+
+}
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java	Wed Jul 05 19:21:26 2017 +0200
@@ -109,6 +109,7 @@
         return XRSurfaceDataProxy.createProxy(srcData, graphicsConfig);
     }
 
+    @Override
     public void validatePipe(SunGraphics2D sg2d) {
         TextPipe textpipe;
         boolean validated = false;
@@ -117,14 +118,8 @@
          * The textpipe for now can't handle TexturePaint when extra-alpha is
          * specified nore XOR mode
          */
-        if (sg2d.compositeState < SunGraphics2D.COMP_XOR &&
-            (sg2d.paintState < SunGraphics2D.PAINT_TEXTURE ||
-             sg2d.composite == null ||
-             !(sg2d.composite instanceof AlphaComposite) ||
-             ((AlphaComposite) sg2d.composite).getAlpha() == 1.0f))
+        if ((textpipe = getTextPipe(sg2d)) == null)
         {
-            textpipe = xrtextpipe;
-        } else {
             super.validatePipe(sg2d);
             textpipe = sg2d.textpipe;
             validated = true;
@@ -184,13 +179,38 @@
         sg2d.imagepipe = xrDrawImage;
     }
 
+    protected TextPipe getTextPipe(SunGraphics2D sg2d) {
+        boolean supportedPaint = sg2d.compositeState <= SunGraphics2D.COMP_ALPHA
+                && (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR || sg2d.composite == null);
+
+        boolean supportedCompOp = false;
+        if (sg2d.composite instanceof AlphaComposite) {
+            int compRule = ((AlphaComposite) sg2d.composite).getRule();
+            supportedCompOp = XRUtils.isMaskEvaluated(XRUtils.j2dAlphaCompToXR(compRule))
+                    || (compRule == AlphaComposite.SRC
+                                && sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR);
+        }
+
+        return (supportedPaint && supportedCompOp) ? xrtextpipe : null;
+    }
+
     protected MaskFill getMaskFill(SunGraphics2D sg2d) {
-        if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR &&
-            !XRPaints.isValid(sg2d))
-        {
-            return null;
+        AlphaComposite aComp = null;
+        if(sg2d.composite != null
+                && sg2d.composite instanceof AlphaComposite) {
+            aComp = (AlphaComposite) sg2d.composite;
         }
-        return super.getMaskFill(sg2d);
+
+        boolean supportedPaint = sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR
+                || XRPaints.isValid(sg2d);
+
+        boolean supportedCompOp = false;
+        if(aComp != null) {
+            int rule = aComp.getRule();
+            supportedCompOp = XRUtils.isMaskEvaluated(XRUtils.j2dAlphaCompToXR(rule));
+        }
+
+        return (supportedPaint && supportedCompOp) ?  super.getMaskFill(sg2d) : null;
     }
 
     public RenderLoops getRenderLoops(SunGraphics2D sg2d) {
@@ -395,6 +415,7 @@
 
     boolean transformInUse = false;
     AffineTransform validatedSourceTransform = new AffineTransform();
+    AffineTransform staticSrcTx = null;
     int validatedRepeat = XRUtils.RepeatNone;
     int validatedFilter = XRUtils.FAST;
 
@@ -423,13 +444,24 @@
             }
         } else if (!transformInUse ||
                    (transformInUse && !sxForm.equals(validatedSourceTransform))) {
+
             validatedSourceTransform.setTransform(sxForm.getScaleX(),
                                                   sxForm.getShearY(),
                                                   sxForm.getShearX(),
                                                   sxForm.getScaleY(),
                                                   sxForm.getTranslateX(),
                                                   sxForm.getTranslateY());
-            renderQueue.setPictureTransform(picture, validatedSourceTransform);
+
+            AffineTransform srcTransform = validatedSourceTransform;
+            if(staticSrcTx != null) {
+                // Apply static transform set when used as texture or gradient.
+                // Create a copy to not modify validatedSourceTransform as
+                // this would confuse the validation logic.
+                srcTransform = new AffineTransform(validatedSourceTransform);
+                srcTransform.preConcatenate(staticSrcTx);
+            }
+
+            renderQueue.setPictureTransform(picture, srcTransform);
             transformInUse = true;
         }
 
@@ -547,15 +579,10 @@
     }
 
     public static class XRInternalSurfaceData extends XRSurfaceData {
-        public XRInternalSurfaceData(XRBackend renderQueue, int pictXid,
-                                     AffineTransform transform) {
+        public XRInternalSurfaceData(XRBackend renderQueue, int pictXid) {
           super(renderQueue);
           this.picture = pictXid;
-          this.validatedSourceTransform = transform;
-
-          if (validatedSourceTransform != null) {
-              transformInUse = true;
-          }
+          this.transformInUse = false;
         }
 
         public boolean canSourceSendExposures(int x, int y, int w, int h) {
@@ -677,4 +704,8 @@
     public XRGraphicsConfig getGraphicsConfig() {
         return graphicsConfig;
     }
+
+    public void setStaticSrcTx(AffineTransform staticSrcTx) {
+        this.staticSrcTx = staticSrcTx;
+    }
 }
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRUtils.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRUtils.java	Wed Jul 05 19:21:26 2017 +0200
@@ -27,6 +27,7 @@
 
 import java.awt.*;
 import java.awt.MultipleGradientPaint.*;
+import java.awt.geom.AffineTransform;
 import java.awt.image.*;
 import sun.java2d.loops.*;
 import static java.awt.AlphaComposite.*;
@@ -258,4 +259,21 @@
     public static int clampToUShort(int x) {
         return (x > 65535 ? 65535 : (x < 0) ? 0 : x);
     }
+
+    public static boolean isTransformQuadrantRotated(AffineTransform tr) {
+        return ((tr.getType() & (AffineTransform.TYPE_GENERAL_ROTATION |
+                 AffineTransform.TYPE_GENERAL_TRANSFORM)) == 0);
+    }
+
+    public static boolean isMaskEvaluated(byte xrCompRule) {
+        switch (xrCompRule) {
+        case PictOpOver:
+        case PictOpOverReverse:
+        case PictOpAtop:
+        case PictOpXor:
+            return true;
+        }
+
+        return false;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/solaris/classes/sun/misc/GThreadHelper.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.misc;
+
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * This class is used to prevent multiple calling of g_thread_init ()
+ * and gdk_thread_init ().
+ *
+ * Since version 2.24 of GLib, calling g_thread_init () multiple times is
+ * allowed, but it will crash for older versions. There are two ways to
+ * find out if g_thread_init () has been called:
+ * g_thread_get_initialized (), but it was introduced in 2.20
+ * g_thread_supported (), but it is a macro and cannot be loaded with dlsym.
+ *
+ * usage:
+ * <pre>
+ * lock();
+ * try {
+ *    if (!getAndSetInitializationNeededFlag()) {
+ *        //call to g_thread_init();
+ *        //call to gdk_thread_init();
+ *    }
+ * } finally {
+ *    unlock();
+ * }
+ * </pre>
+ */
+public final class GThreadHelper {
+
+    private static final ReentrantLock LOCK = new ReentrantLock();
+    private static boolean isGThreadInitialized = false;
+
+    /**
+     * Acquires the lock.
+     */
+    public static void lock() {
+        LOCK.lock();
+    }
+
+    /**
+     * Releases the lock.
+     */
+    public static void unlock() {
+        LOCK.unlock();
+    }
+
+    /**
+     * Gets current value of initialization flag and sets it to {@code true}.
+     * MUST be called under the lock.
+     *
+     * A return value of {@code false} indicates that the calling code
+     * should call the g_thread_init() and gdk_thread_init() functions
+     * before releasing the lock.
+     *
+     * @return {@code true} if initialization has been completed.
+     */
+    public static boolean getAndSetInitializationNeededFlag() {
+        boolean ret = isGThreadInitialized;
+        isGThreadInitialized = true;
+        return ret;
+    }
+}
--- a/jdk/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/GnomeFileTypeDetector.java	Wed Jul 05 19:21:26 2017 +0200
@@ -70,12 +70,12 @@
                 // GIO may access file so need permission check
                 path.checkRead();
                 byte[] type = probeUsingGio(buffer.address());
-                return (type == null) ? null : new String(type);
+                return (type == null) ? null : Util.toString(type);
             } else {
                 byte[] type = probeUsingGnomeVfs(buffer.address());
                 if (type == null)
                     return null;
-                String s = new String(type);
+                String s = Util.toString(type);
                 return s.equals(GNOME_VFS_MIME_TYPE_UNKNOWN) ? null : s;
             }
         } finally {
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxDosFileAttributeView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxDosFileAttributeView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -51,7 +51,7 @@
     private static final String HIDDEN_NAME = "hidden";
 
     private static final String DOS_XATTR_NAME = "user.DOSATTRIB";
-    private static final byte[] DOS_XATTR_NAME_AS_BYTES = DOS_XATTR_NAME.getBytes();
+    private static final byte[] DOS_XATTR_NAME_AS_BYTES = Util.toBytes(DOS_XATTR_NAME);
 
     private static final int DOS_XATTR_READONLY = 0x01;
     private static final int DOS_XATTR_HIDDEN   = 0x02;
@@ -225,7 +225,7 @@
                 byte[] buf = new byte[len];
                 unsafe.copyMemory(null, buffer.address(), buf,
                     Unsafe.ARRAY_BYTE_BASE_OFFSET, len);
-                String value = new String(buf); // platform encoding
+                String value = Util.toString(buf);
 
                 // should be something like 0x20
                 if (value.length() >= 3 && value.startsWith("0x")) {
@@ -263,7 +263,7 @@
                 newValue &= ~flag;
             }
             if (newValue != oldValue) {
-                byte[] value = ("0x" + Integer.toHexString(newValue)).getBytes();
+                byte[] value = Util.toBytes("0x" + Integer.toHexString(newValue));
                 NativeBuffer buffer = NativeBuffers.asNativeBuffer(value);
                 try {
                     LinuxNativeDispatcher.fsetxattr(fd, DOS_XATTR_NAME_AS_BYTES,
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxFileStore.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxFileStore.java	Wed Jul 05 19:21:26 2017 +0200
@@ -98,7 +98,8 @@
             int fd = path.openForAttributeAccess(false);
             try {
                 // fgetxattr returns size if called with size==0
-                LinuxNativeDispatcher.fgetxattr(fd, "user.java".getBytes(), 0L, 0);
+                byte[] name = Util.toBytes("user.java");
+                LinuxNativeDispatcher.fgetxattr(fd, name, 0L, 0);
                 return true;
             } catch (UnixException e) {
                 // attribute does not exist
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystem.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystem.java	Wed Jul 05 19:21:26 2017 +0200
@@ -78,7 +78,7 @@
     Iterable<UnixMountEntry> getMountEntries(String fstab) {
         ArrayList<UnixMountEntry> entries = new ArrayList<>();
         try {
-            long fp = setmntent(fstab.getBytes(), "r".getBytes());
+            long fp = setmntent(Util.toBytes(fstab), Util.toBytes("r"));
             try {
                 for (;;) {
                     UnixMountEntry entry = new UnixMountEntry();
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxUserDefinedFileAttributeView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxUserDefinedFileAttributeView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -53,7 +53,7 @@
         if (name == null)
             throw new NullPointerException("'name' is null");
         name = USER_NAMESPACE + name;
-        byte[] bytes = name.getBytes();
+        byte[] bytes = Util.toBytes(name);
         if (bytes.length > XATTR_NAME_MAX) {
             throw new FileSystemException(file.getPathForExceptionMessage(),
                 null, "'" + name + "' is too big");
@@ -72,7 +72,7 @@
                 byte[] value = new byte[len];
                 unsafe.copyMemory(null, address+start, value,
                     Unsafe.ARRAY_BYTE_BASE_OFFSET, len);
-                String s = new String(value);
+                String s = Util.toString(value);
                 if (s.startsWith(USER_NAMESPACE)) {
                     s = s.substring(USER_NAMESPACE.length());
                     list.add(s);
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java	Wed Jul 05 19:21:26 2017 +0200
@@ -42,9 +42,11 @@
 class SolarisUserDefinedFileAttributeView
     extends AbstractUserDefinedFileAttributeView
 {
+    private static final byte[] HERE = { '.' };
+
     private byte[] nameAsBytes(UnixPath file, String name) throws IOException {
-        byte[] bytes = name.getBytes();
-        //  "", "." and ".." not allowed
+        byte[] bytes = Util.toBytes(name);
+        // "", "." and ".." not allowed
         if (bytes.length == 0 || bytes[0] == '.') {
             if (bytes.length <= 1 ||
                 (bytes.length == 2 && bytes[1] == '.'))
@@ -73,7 +75,7 @@
         try {
             try {
                 // open extended attribute directory
-                int dfd = openat(fd, ".".getBytes(), (O_RDONLY|O_XATTR), 0);
+                int dfd = openat(fd, HERE, (O_RDONLY|O_XATTR), 0);
                 long dp;
                 try {
                     dp = fdopendir(dfd);
@@ -87,7 +89,7 @@
                 try {
                     byte[] name;
                     while ((name = readdir(dp)) != null) {
-                        String s = new String(name);
+                        String s = Util.toString(name);
                         if (!s.equals(".") && !s.equals(".."))
                             list.add(s);
                     }
@@ -217,7 +219,7 @@
 
         int fd = file.openForAttributeAccess(followLinks);
         try {
-            int dfd = openat(fd, ".".getBytes(), (O_RDONLY|O_XATTR), 0);
+            int dfd = openat(fd, HERE, (O_RDONLY|O_XATTR), 0);
             try {
                 unlinkat(dfd, nameAsBytes(file,name), 0);
             } finally {
@@ -243,7 +245,7 @@
     static void copyExtendedAttributes(int ofd, int nfd) {
         try {
             // open extended attribute directory
-            int dfd = openat(ofd, ".".getBytes(), (O_RDONLY|O_XATTR), 0);
+            int dfd = openat(ofd, HERE, (O_RDONLY|O_XATTR), 0);
             long dp = 0L;
             try {
                 dp = fdopendir(dfd);
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisWatchService.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisWatchService.java	Wed Jul 05 19:21:26 2017 +0200
@@ -668,7 +668,7 @@
                     }
                 }
 
-                // an error occured
+                // an error occurred
                 if (ex != null) {
                     releaseChildren(key);
                     throw ex;
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixException.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixException.java	Wed Jul 05 19:21:26 2017 +0200
@@ -61,7 +61,7 @@
         if (msg != null) {
             return msg;
         } else {
-            return new String(UnixNativeDispatcher.strerror(errno()));
+            return Util.toString(UnixNativeDispatcher.strerror(errno()));
         }
     }
 
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java	Wed Jul 05 19:21:26 2017 +0200
@@ -196,7 +196,7 @@
 
     @Override
     public String toString() {
-        StringBuilder sb = new StringBuilder(new String(entry.dir()));
+        StringBuilder sb = new StringBuilder(Util.toString(entry.dir()));
         sb.append(" (");
         sb.append(entry.name());
         sb.append(")");
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystem.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystem.java	Wed Jul 05 19:21:26 2017 +0200
@@ -49,7 +49,7 @@
     // package-private
     UnixFileSystem(UnixFileSystemProvider provider, String dir) {
         this.provider = provider;
-        this.defaultDirectory = UnixPath.normalizeAndCheck(dir).getBytes();
+        this.defaultDirectory = Util.toBytes(UnixPath.normalizeAndCheck(dir));
         if (this.defaultDirectory[0] != '/') {
             throw new RuntimeException("default directory must be absolute");
         }
@@ -204,7 +204,7 @@
                 SecurityManager sm = System.getSecurityManager();
                 if (sm != null) {
                     try {
-                        sm.checkRead(new String(entry.dir()));
+                        sm.checkRead(Util.toString(entry.dir()));
                     } catch (SecurityException x) {
                         continue;
                     }
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixMountEntry.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixMountEntry.java	Wed Jul 05 19:21:26 2017 +0200
@@ -43,12 +43,12 @@
     }
 
     String name() {
-        return new String(name);
+        return Util.toString(name);
     }
 
     String fstype() {
         if (fstypeAsString == null)
-            fstypeAsString = new String(fstype);
+            fstypeAsString = Util.toString(fstype);
         return fstypeAsString;
     }
 
@@ -65,7 +65,7 @@
      */
     boolean hasOption(String requested) {
         if (optionsAsString == null)
-            optionsAsString = new String(opts);
+            optionsAsString = Util.toString(opts);
         for (String opt: Util.split(optionsAsString, ',')) {
             if (opt.equals(requested))
                 return true;
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixNativeDispatcher.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixNativeDispatcher.java	Wed Jul 05 19:21:26 2017 +0200
@@ -100,7 +100,7 @@
      */
     static long fopen(UnixPath filename, String mode) throws UnixException {
         NativeBuffer pathBuffer = copyToNativeBuffer(filename);
-        NativeBuffer modeBuffer = NativeBuffers.asNativeBuffer(mode.getBytes());
+        NativeBuffer modeBuffer = NativeBuffers.asNativeBuffer(Util.toBytes(mode));
         try {
             return fopen0(pathBuffer.address(), modeBuffer.address());
         } finally {
@@ -473,7 +473,7 @@
      * @return  passwd->pw_uid
      */
     static int getpwnam(String name) throws UnixException {
-        NativeBuffer buffer = NativeBuffers.asNativeBuffer(name.getBytes());
+        NativeBuffer buffer = NativeBuffers.asNativeBuffer(Util.toBytes(name));
         try {
             return getpwnam0(buffer.address());
         } finally {
@@ -488,7 +488,7 @@
      * @return  group->gr_name
      */
     static int getgrnam(String name) throws UnixException {
-        NativeBuffer buffer = NativeBuffers.asNativeBuffer(name.getBytes());
+        NativeBuffer buffer = NativeBuffers.asNativeBuffer(Util.toBytes(name));
         try {
             return getgrnam0(buffer.address());
         } finally {
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java	Wed Jul 05 19:21:26 2017 +0200
@@ -120,7 +120,7 @@
         SoftReference<CharsetEncoder> ref = encoder.get();
         CharsetEncoder ce = (ref != null) ? ref.get() : null;
         if (ce == null) {
-            ce = Charset.defaultCharset().newEncoder()
+            ce = Util.jnuEncoding().newEncoder()
                 .onMalformedInput(CodingErrorAction.REPORT)
                 .onUnmappableCharacter(CodingErrorAction.REPORT);
             encoder.set(new SoftReference<CharsetEncoder>(ce));
@@ -186,7 +186,7 @@
     // use this path for permission checks
     String getPathForPermissionCheck() {
         if (getFileSystem().needToResolveAgainstDefaultDirectory()) {
-            return new String(getByteArrayForSysCalls());
+            return Util.toString(getByteArrayForSysCalls());
         } else {
             return toString();
         }
@@ -493,8 +493,8 @@
 
         // first pass:
         //   1. compute length of names
-        //   2. mark all occurences of "." to ignore
-        //   3. and look for any occurences of ".."
+        //   2. mark all occurrences of "." to ignore
+        //   3. and look for any occurrences of ".."
         for (int i=0; i<count; i++) {
             int begin = offsets[i];
             int len;
@@ -517,7 +517,7 @@
             }
         }
 
-        // multiple passes to eliminate all occurences of name/..
+        // multiple passes to eliminate all occurrences of name/..
         if (hasDotDot) {
             int prevRemaining;
             do {
@@ -758,7 +758,7 @@
     public String toString() {
         // OK if two or more threads create a String
         if (stringValue == null) {
-            stringValue = fs.normalizeJavaPath(new String(path));     // platform encoding
+            stringValue = fs.normalizeJavaPath(Util.toString(path));     // platform encoding
         }
         return stringValue;
     }
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixUriUtils.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixUriUtils.java	Wed Jul 05 19:21:26 2017 +0200
@@ -56,7 +56,7 @@
         if (uri.getQuery() != null)
             throw new IllegalArgumentException("URI has a query component");
 
-        // compatability with java.io.File
+        // compatibility with java.io.File
         if (!uri.toString().startsWith("file:///"))
             return new File(uri).toPath();
 
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixUserPrincipals.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixUserPrincipals.java	Wed Jul 05 19:21:26 2017 +0200
@@ -115,7 +115,7 @@
     static User fromUid(int uid) {
         String name = null;
         try {
-            name = new String(getpwuid(uid));
+            name = Util.toString(getpwuid(uid));
         } catch (UnixException x) {
             name = Integer.toString(uid);
         }
@@ -126,7 +126,7 @@
     static Group fromGid(int gid) {
         String name = null;
         try {
-            name = new String(getgrgid(gid));
+            name = Util.toString(getgrgid(gid));
         } catch (UnixException x) {
             name = Integer.toString(gid);
         }
--- a/jdk/src/solaris/classes/sun/print/CUPSPrinter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/print/CUPSPrinter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -237,8 +237,9 @@
 
     /**
      * Get CUPS default printer using IPP.
+     * Returns 2 values - index 0 is printer name, index 1 is the uri.
      */
-    public static String getDefaultPrinter() {
+    static String[] getDefaultPrinter() {
         try {
             URL url = new URL("http", getServer(), getPort(), "");
             final HttpURLConnection urlConnection =
@@ -264,8 +265,8 @@
                     AttributeClass.ATTRIBUTES_CHARSET,
                     AttributeClass.ATTRIBUTES_NATURAL_LANGUAGE,
                     new AttributeClass("requested-attributes",
-                                       AttributeClass.TAG_KEYWORD,
-                                       "printer-name")
+                                       AttributeClass.TAG_URI,
+                                       "printer-uri")
                 };
 
                 if (IPPPrintService.writeIPPRequest(os,
@@ -273,6 +274,7 @@
                                         attCl)) {
 
                     HashMap defaultMap = null;
+                    String[] printerInfo = new String[2];
                     InputStream is = urlConnection.getInputStream();
                     HashMap[] responseMap = IPPPrintService.readIPPResponse(
                                          is);
@@ -293,21 +295,30 @@
                          * special behaviour for this built in.
                          */
                          if (UnixPrintServiceLookup.isMac()) {
-                             return UnixPrintServiceLookup.
+                             printerInfo[0] = UnixPrintServiceLookup.
                                                    getDefaultPrinterNameSysV();
+                             printerInfo[1] = null;
+                             return (String[])printerInfo.clone();
                          } else {
                              return null;
                          }
                     }
 
+
                     AttributeClass attribClass = (AttributeClass)
                         defaultMap.get("printer-name");
 
                     if (attribClass != null) {
-                        String nameStr = attribClass.getStringValue();
+                        printerInfo[0] = attribClass.getStringValue();
+                        attribClass = (AttributeClass)defaultMap.get("device-uri");
+                        if (attribClass != null) {
+                            printerInfo[1] = attribClass.getStringValue();
+                        } else {
+                            printerInfo[1] = null;
+                        }
                         os.close();
                         urlConnection.disconnect();
-                        return nameStr;
+                        return (String [])printerInfo.clone();
                     }
                 }
                 os.close();
@@ -322,7 +333,7 @@
     /**
      * Get list of all CUPS printers using IPP.
      */
-    public static String[] getAllPrinters() {
+    static String[] getAllPrinters() {
         try {
             URL url = new URL("http", getServer(), getPort(), "");
 
--- a/jdk/src/solaris/classes/sun/print/IPPPrintService.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/print/IPPPrintService.java	Wed Jul 05 19:21:26 2017 +0200
@@ -366,6 +366,7 @@
                                           " IPPPrintService, myURL="+
                                           myURL+" Exception= "+
                                           e);
+            throw new IllegalArgumentException("invalid url");
         }
 
         isCupsPrinter = isCups;
@@ -1145,6 +1146,8 @@
                 // REMIND: check attribute values
                 return (T)PDLOverrideSupported.NOT_ATTEMPTED;
             }
+        } else if (category == PrinterURI.class) {
+            return (T)(new PrinterURI(myURI));
         } else {
             return null;
         }
--- a/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	Wed Jul 05 19:21:26 2017 +0200
@@ -48,6 +48,7 @@
 import javax.print.attribute.PrintServiceAttribute;
 import javax.print.attribute.PrintServiceAttributeSet;
 import javax.print.attribute.standard.PrinterName;
+import javax.print.attribute.standard.PrinterURI;
 import java.io.File;
 import java.io.FileReader;
 import java.net.URL;
@@ -61,7 +62,7 @@
     implements BackgroundServiceLookup, Runnable {
 
     /* Remind: the current implementation is static, as its assumed
-     * its preferable to minimise creation of PrintService instances.
+     * its preferable to minimize creation of PrintService instances.
      * Later we should add logic to add/remove services on the fly which
      * will take a hit of needing to regather the list of services.
      */
@@ -203,6 +204,33 @@
         }
     }
 
+    private int addPrintServiceToList(ArrayList printerList, PrintService ps) {
+        int index = printerList.indexOf(ps);
+        // Check if PrintService with same name is already in the list.
+        if (CUPSPrinter.isCupsRunning() && index != -1) {
+            // Bug in Linux: Duplicate entry of a remote printer
+            // and treats it as local printer but it is returning wrong
+            // information when queried using IPP. Workaround is to remove it.
+            // Even CUPS ignores these entries as shown in lpstat or using
+            // their web configuration.
+            PrinterURI uri = (PrinterURI)ps.getAttribute(PrinterURI.class);
+            if (uri.getURI().getHost().equals("localhost")) {
+                IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, ignoring the new local printer: "+ps);
+                return index;  // Do not add this.
+            }
+            PrintService oldPS = (PrintService)(printerList.get(index));
+            uri = (PrinterURI)oldPS.getAttribute(PrinterURI.class);
+            if (uri.getURI().getHost().equals("localhost")) {
+                IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, removing existing local printer: "+oldPS);
+                printerList.remove(oldPS);
+            } else {
+                return index;
+            }
+        }
+        printerList.add(ps);
+        return (printerList.size() - 1);
+    }
+
 
     // refreshes "printServices"
     public synchronized void refreshServices() {
@@ -246,8 +274,7 @@
             }
             if ((defaultPrintService != null)
                 && printers[p].equals(getPrinterDestName(defaultPrintService))) {
-                printerList.add(defaultPrintService);
-                defaultIndex = printerList.size() - 1;
+                defaultIndex = addPrintServiceToList(printerList, defaultPrintService);
             } else {
                 if (printServices == null) {
                     IPPPrintService.debug_println(debugPrefix+
@@ -255,9 +282,10 @@
 
                     if (CUPSPrinter.isCupsRunning()) {
                         try {
-                            printerList.add(new IPPPrintService(printers[p],
-                                                                printerURIs[p],
-                                                                true));
+                            addPrintServiceToList(printerList,
+                                                  new IPPPrintService(printers[p],
+                                                                   printerURIs[p],
+                                                                   true));
                         } catch (Exception e) {
                             IPPPrintService.debug_println(debugPrefix+
                                                           " getAllPrinters Exception "+
@@ -282,10 +310,10 @@
                     if (j == printServices.length) {      // not found?
                         if (CUPSPrinter.isCupsRunning()) {
                             try {
-                                printerList.add(new IPPPrintService(
-                                                               printers[p],
-                                                               printerURIs[p],
-                                                               true));
+                                addPrintServiceToList(printerList,
+                                             new IPPPrintService(printers[p],
+                                                                 printerURIs[p],
+                                                                 true));
                             } catch (Exception e) {
                                 IPPPrintService.debug_println(debugPrefix+
                                                               " getAllPrinters Exception "+
@@ -312,9 +340,7 @@
 
         //if defaultService is not found in printerList
         if (defaultIndex == -1 && defaultPrintService != null) {
-            //add default to the list
-            printerList.add(defaultPrintService);
-            defaultIndex = printerList.size() - 1;
+            defaultIndex = addPrintServiceToList(printerList, defaultPrintService);
         }
 
         printServices = (PrintService[])printerList.toArray(
@@ -563,11 +589,14 @@
 
         // clear defaultPrintService
         defaultPrintService = null;
+        String psuri = null;
 
         IPPPrintService.debug_println("isRunning ? "+
                                       (CUPSPrinter.isCupsRunning()));
         if (CUPSPrinter.isCupsRunning()) {
-            defaultPrinter = CUPSPrinter.getDefaultPrinter();
+            String[] printerInfo = CUPSPrinter.getDefaultPrinter();
+            defaultPrinter = printerInfo[0];
+            psuri = printerInfo[1];
         } else {
             if (isMac() || isSysV()) {
                 defaultPrinter = getDefaultPrinterNameSysV();
@@ -590,12 +619,17 @@
         if (defaultPrintService == null) {
             if (CUPSPrinter.isCupsRunning()) {
                 try {
-                    PrintService defaultPS =
-                        new IPPPrintService(defaultPrinter,
+                    PrintService defaultPS;
+                    if (psuri != null) {
+                        defaultPS = new IPPPrintService(defaultPrinter,
+                                                        psuri, true);
+                    } else {
+                        defaultPS = new IPPPrintService(defaultPrinter,
                                             new URL("http://"+
                                                     CUPSPrinter.getServer()+":"+
                                                     CUPSPrinter.getPort()+"/"+
                                                     defaultPrinter));
+                    }
                     defaultPrintService = defaultPS;
                 } catch (Exception e) {
                 }
--- a/jdk/src/solaris/demo/jni/Poller/Poller.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/demo/jni/Poller/Poller.c	Wed Jul 05 19:21:26 2017 +0200
@@ -73,7 +73,7 @@
  *  6> Could add simpler code for pre-Solaris 7 releases which will
  *     perform slightly better on those OSs.  But again there
  *     are only modest gains to be had from these new code paths,
- *     so they've been ommitted here.
+ *     so they've been omitted here.
  *
  * Compile "cc -G -o <dest_dir>/libpoller.so -I ${JAVA_HOME}/include " \
  * -I ${JAVA_HOME}/include/solaris Poller.c" and place the <dest_dir>
--- a/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_BsdOS_ALSA_Ports.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_BsdOS_ALSA_Ports.c	Wed Jul 05 19:21:26 2017 +0200
@@ -401,7 +401,7 @@
     numControls = 0;
     elem = portMixer->elems[portIndex];
     if (snd_mixer_selem_has_playback_volume(elem) || snd_mixer_selem_has_capture_volume(elem)) {
-        /* Since we've splitted/duplicated elements with both playback and capture on the recovery
+        /* Since we've split/duplicated elements with both playback and capture on the recovery
            of elements, we now can assume that we handle only to deal with either playback or
            capture. */
         isPlayback = isPlaybackFunction(portMixer->types[portIndex]);
--- a/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_Ports.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_Ports.c	Wed Jul 05 19:21:26 2017 +0200
@@ -401,7 +401,7 @@
     numControls = 0;
     elem = portMixer->elems[portIndex];
     if (snd_mixer_selem_has_playback_volume(elem) || snd_mixer_selem_has_capture_volume(elem)) {
-        /* Since we've splitted/duplicated elements with both playback and capture on the recovery
+        /* Since we've split/duplicated elements with both playback and capture on the recovery
            of elements, we now can assume that we handle only to deal with either playback or
            capture. */
         isPlayback = isPlaybackFunction(portMixer->types[portIndex]);
--- a/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_PCM.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_PCM.c	Wed Jul 05 19:21:26 2017 +0200
@@ -371,7 +371,7 @@
         }
         AUDIO_INITINFO(&audioInfo);
         if (underrun) {
-            /* if an underrun occured, reset */
+            /* if an underrun occurred, reset */
             ERROR1("DAUDIO_Write/Read: Underrun/overflow: adjusting positionOffset by %d:\n",
                    (devBytes - info->transferedBytes));
             ERROR1("    devBytes from %d to 0, ", devBytes);
--- a/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_Utils.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_Utils.h	Wed Jul 05 19:21:26 2017 +0200
@@ -87,7 +87,7 @@
 
 /*
  * fills adDesc from the audio device given in path
- * returns 0 if an error occured
+ * returns 0 if an error occurred
  * if getNames is 0, only path and pathctl are filled
  */
 int getAudioDeviceDescription(char* path, AudioDeviceDescription* adDesc, int getNames);
--- a/jdk/src/solaris/native/java/net/NetworkInterface.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/native/java/net/NetworkInterface.c	Wed Jul 05 19:21:26 2017 +0200
@@ -170,31 +170,56 @@
 JNIEXPORT void JNICALL
 Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls) {
     ni_class = (*env)->FindClass(env,"java/net/NetworkInterface");
+    CHECK_NULL(ni_class);
     ni_class = (*env)->NewGlobalRef(env, ni_class);
+    CHECK_NULL(ni_class);
     ni_nameID = (*env)->GetFieldID(env, ni_class,"name", "Ljava/lang/String;");
+    CHECK_NULL(ni_nameID);
     ni_indexID = (*env)->GetFieldID(env, ni_class, "index", "I");
+    CHECK_NULL(ni_indexID);
     ni_addrsID = (*env)->GetFieldID(env, ni_class, "addrs", "[Ljava/net/InetAddress;");
+    CHECK_NULL(ni_addrsID);
     ni_bindsID = (*env)->GetFieldID(env, ni_class, "bindings", "[Ljava/net/InterfaceAddress;");
+    CHECK_NULL(ni_bindsID);
     ni_descID = (*env)->GetFieldID(env, ni_class, "displayName", "Ljava/lang/String;");
+    CHECK_NULL(ni_descID);
     ni_virutalID = (*env)->GetFieldID(env, ni_class, "virtual", "Z");
+    CHECK_NULL(ni_virutalID);
     ni_childsID = (*env)->GetFieldID(env, ni_class, "childs", "[Ljava/net/NetworkInterface;");
+    CHECK_NULL(ni_childsID);
     ni_parentID = (*env)->GetFieldID(env, ni_class, "parent", "Ljava/net/NetworkInterface;");
+    CHECK_NULL(ni_parentID);
     ni_ctrID = (*env)->GetMethodID(env, ni_class, "<init>", "()V");
+    CHECK_NULL(ni_ctrID);
 
     ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
+    CHECK_NULL(ni_iacls);
     ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
+    CHECK_NULL(ni_iacls);
     ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
+    CHECK_NULL(ni_ia4cls);
     ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
+    CHECK_NULL(ni_ia4cls);
     ni_ia6cls = (*env)->FindClass(env, "java/net/Inet6Address");
+    CHECK_NULL(ni_ia6cls);
     ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls);
+    CHECK_NULL(ni_ia6cls);
     ni_ibcls = (*env)->FindClass(env, "java/net/InterfaceAddress");
+    CHECK_NULL(ni_ibcls);
     ni_ibcls = (*env)->NewGlobalRef(env, ni_ibcls);
+    CHECK_NULL(ni_ibcls);
     ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
+    CHECK_NULL(ni_ia4ctrID);
     ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
+    CHECK_NULL(ni_ia6ctrID);
     ni_ibctrID = (*env)->GetMethodID(env, ni_ibcls, "<init>", "()V");
+    CHECK_NULL(ni_ibctrID);
     ni_ibaddressID = (*env)->GetFieldID(env, ni_ibcls, "address", "Ljava/net/InetAddress;");
+    CHECK_NULL(ni_ibaddressID);
     ni_ib4broadcastID = (*env)->GetFieldID(env, ni_ibcls, "broadcast", "Ljava/net/Inet4Address;");
+    CHECK_NULL(ni_ib4broadcastID);
     ni_ib4maskID = (*env)->GetFieldID(env, ni_ibcls, "maskLength", "S");
+    CHECK_NULL(ni_ib4maskID);
     ni_defaultIndexID = (*env)->GetStaticFieldID(env, ni_class, "defaultIndex", "I");
 }
 
--- a/jdk/src/solaris/native/sun/awt/awt_UNIXToolkit.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_UNIXToolkit.c	Wed Jul 05 19:21:26 2017 +0200
@@ -67,7 +67,7 @@
 Java_sun_awt_UNIXToolkit_load_1gtk(JNIEnv *env, jclass klass)
 {
 #ifndef HEADLESS
-    return (jboolean)gtk2_load();
+    return (jboolean)gtk2_load(env);
 #else
     return JNI_FALSE;
 #endif /* !HEADLESS */
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.c	Wed Jul 05 19:21:26 2017 +0200
@@ -81,7 +81,7 @@
 
 static void *gtk2_libhandle = NULL;
 static void *gthread_libhandle = NULL;
-static gboolean flag_g_thread_get_initialized = FALSE;
+
 static jmp_buf j;
 
 /* Widgets */
@@ -502,7 +502,7 @@
     fp_gtk_g_slist_length = dl_symbol("g_slist_length");
 }
 
-gboolean gtk2_load()
+gboolean gtk2_load(JNIEnv *env)
 {
     gboolean result;
     int i;
@@ -533,6 +533,7 @@
         }
 
         /* GLib */
+        fp_glib_check_version = dl_symbol("glib_check_version");
         fp_g_free = dl_symbol("g_free");
         fp_g_object_unref = dl_symbol("g_object_unref");
 
@@ -708,6 +709,9 @@
         /**
          * GLib thread system
          */
+        if (fp_glib_check_version(2, 20, 0) == NULL) {
+            fp_g_thread_get_initialized = dl_symbol_gthread("g_thread_get_initialized");
+        }
         fp_g_thread_init = dl_symbol_gthread("g_thread_init");
         fp_gdk_threads_init = dl_symbol("gdk_threads_init");
         fp_gdk_threads_enter = dl_symbol("gdk_threads_enter");
@@ -810,16 +814,33 @@
     io_handler = XSetIOErrorHandler(NULL);
 
     if (fp_gtk_check_version(2, 2, 0) == NULL) {
+        jclass clazz = (*env)->FindClass(env, "sun/misc/GThreadHelper");
+        jmethodID mid_getAndSetInitializationNeededFlag =
+                (*env)->GetStaticMethodID(env, clazz, "getAndSetInitializationNeededFlag", "()Z");
+        jmethodID mid_lock = (*env)->GetStaticMethodID(env, clazz, "lock", "()V");
+        jmethodID mid_unlock = (*env)->GetStaticMethodID(env, clazz, "unlock", "()V");
+
         // Init the thread system to use GLib in a thread-safe mode
-        if (!flag_g_thread_get_initialized) {
-            flag_g_thread_get_initialized = TRUE;
+        (*env)->CallStaticVoidMethod(env, clazz, mid_lock);
 
-            fp_g_thread_init(NULL);
+        // Calling g_thread_init() multiple times leads to crash on GLib < 2.24
+        // We can use g_thread_get_initialized () but it is available only for
+        // GLib >= 2.20. We rely on GThreadHelper for GLib < 2.20.
+        gboolean is_g_thread_get_initialized = FALSE;
+        if (fp_glib_check_version(2, 20, 0) == NULL) {
+            is_g_thread_get_initialized = fp_g_thread_get_initialized();
+        }
+
+        if (!(*env)->CallStaticBooleanMethod(env, clazz, mid_getAndSetInitializationNeededFlag)) {
+            if (!is_g_thread_get_initialized) {
+                fp_g_thread_init(NULL);
+            }
 
             //According the GTK documentation, gdk_threads_init() should be
             //called before gtk_init() or gtk_init_check()
             fp_gdk_threads_init();
         }
+        (*env)->CallStaticVoidMethod(env, clazz, mid_unlock);
     }
     result = (*fp_gtk_init_check)(NULL, NULL);
 
@@ -1231,7 +1252,7 @@
             if (init_result = (NULL == gtk2_widgets[_GTK_CONTAINER_TYPE]))
             {
                 /* There is no constructor for a container type.  I've
-                 * choosen GtkFixed container since it has a default
+                 * chosen GtkFixed container since it has a default
                  * constructor.
                  */
                 gtk2_widgets[_GTK_CONTAINER_TYPE] =
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.h	Wed Jul 05 19:21:26 2017 +0200
@@ -643,6 +643,14 @@
  */
 const char *getStrFor(JNIEnv *env, jstring value);
 
+/**
+ * Returns :
+ * NULL if the GLib library is compatible with the given version, or a string
+ * describing the version mismatch.
+ */
+gchar* (*fp_glib_check_version)(guint required_major, guint required_minor,
+                       guint required_micro);
+
 /*
  * Check whether the gtk2 library is available and meets the minimum
  * version requirement.  If the library is already loaded this method has no
@@ -663,7 +671,7 @@
  * effect and returns success.
  * Returns FALSE on failure and TRUE on success.
  */
-gboolean gtk2_load();
+gboolean gtk2_load(JNIEnv *env);
 
 /*
  * Loads fp_gtk_show_uri function pointer. This initialization is
@@ -801,6 +809,12 @@
 guint (*fp_gtk_main_level)(void);
 
 
+/**
+ * This function is available for GLIB > 2.20, so it MUST be
+ * called within (fp_glib_check_version(2, 20, 0) == NULL) check.
+ */
+gboolean (*fp_g_thread_get_initialized)(void);
+
 void (*fp_g_thread_init)(GThreadFunctions *vtable);
 void (*fp_gdk_threads_init)(void);
 void (*fp_gdk_threads_enter)(void);
--- a/jdk/src/solaris/native/sun/awt/multiVis.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/native/sun/awt/multiVis.c	Wed Jul 05 19:21:26 2017 +0200
@@ -1115,7 +1115,7 @@
                                          * to by pImageVisuals. */
     XVisualInfo ***pImageVisuals;       /* The device's image visuals. */
 {
-    XVisualInfo getVisInfo;             /* Paramters of XGetVisualInfo */
+    XVisualInfo getVisInfo;             /* Parameters of XGetVisualInfo */
     int32_t             mask;
     XVisualInfo *pVis, **pIVis;         /* Faster, local copies */
     OverlayInfo *pOVis;
--- a/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c	Wed Jul 05 19:21:26 2017 +0200
@@ -523,12 +523,10 @@
 Java_sun_java2d_xr_XRBackendNative_XRCreateLinearGradientPaintNative
     (JNIEnv *env, jclass xsd, jfloatArray fractionsArray,
      jshortArray pixelsArray, jint x1, jint y1, jint x2, jint y2,
-     jint numStops, jint repeat,
-     jint m00, jint m01, jint m02, jint m10, jint m11, jint m12) {
+     jint numStops, jint repeat) {
    jint i;
    jshort* pixels;
    jfloat* fractions;
-   XTransform tr;
    XRenderPictureAttributes pict_attr;
    Picture gradient = 0;
    XRenderColor *colors;
@@ -594,8 +592,6 @@
    (*env)->ReleasePrimitiveArrayCritical(env, fractionsArray, fractions, JNI_ABORT);
 
     if (gradient != 0) {
-        BUILD_TRANSFORM_MATRIX(tr, m00, m01, m02, m10, m11, m12);
-        XRenderSetPictureTransform (awt_display, gradient, &tr);
         pict_attr.repeat = repeat;
         XRenderChangePicture (awt_display, gradient, CPRepeat, &pict_attr);
     }
@@ -608,12 +604,11 @@
 Java_sun_java2d_xr_XRBackendNative_XRCreateRadialGradientPaintNative
     (JNIEnv *env, jclass xsd, jfloatArray fractionsArray,
      jshortArray pixelsArray, jint numStops,
-     jint innerRadius, jint outerRadius, jint repeat,
-     jint m00, jint m01, jint m02, jint m10, jint m11, jint m12) {
+     jint centerX, jint centerY,
+     jint innerRadius, jint outerRadius, jint repeat) {
    jint i;
    jshort* pixels;
    jfloat* fractions;
-   XTransform tr;
    XRenderPictureAttributes pict_attr;
    Picture gradient = 0;
    XRenderColor *colors;
@@ -637,11 +632,11 @@
        return -1; //TODO release pixels first
    }
 
-    grad.inner.x = 0;
-    grad.inner.y = 0;
+    grad.inner.x = centerX;
+    grad.inner.y = centerY;
     grad.inner.radius = innerRadius;
-    grad.outer.x = 0;
-    grad.outer.y = 0;
+    grad.outer.x = centerX;
+    grad.outer.y = centerY;
     grad.outer.radius = outerRadius;
 
     /*TODO optimized & malloc check*/
@@ -682,8 +677,6 @@
 
 
     if (gradient != 0) {
-        BUILD_TRANSFORM_MATRIX(tr, m00, m01, m02, m10, m11, m12);
-        XRenderSetPictureTransform (awt_display, gradient, &tr);
         pict_attr.repeat = repeat;
         XRenderChangePicture (awt_display, gradient, CPRepeat, &pict_attr);
     }
--- a/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -31,6 +31,7 @@
 #include "sun_net_spi_DefaultProxySelector.h"
 #include <dlfcn.h>
 #include <stdio.h>
+#include <stdlib.h>
 #if defined(__linux__) || defined(_ALLBSD_SOURCE)
 #include <string.h>
 #else
@@ -60,6 +61,10 @@
  * - /system/proxy/no_proxy_for                 list
  * - /system/proxy/gopher_host                  string
  * - /system/proxy/gopher_port                  int
+ *
+ * The following keys are not used in the new gnome 3
+ * - /system/http_proxy/use_http_proxy
+ * - /system/http_proxy/use_same_proxy
  */
 typedef void* gconf_client_get_default_func();
 typedef char* gconf_client_get_string_func(void *, char *, void**);
@@ -74,6 +79,36 @@
 gconf_init_func* my_gconf_init_func = NULL;
 g_type_init_func* my_g_type_init_func = NULL;
 
+
+/*
+ * GProxyResolver provides synchronous and asynchronous network
+ * proxy resolution. It is based on GSettings, which is the standard
+ * of Gnome 3, to get system settings.
+ *
+ * In the current implementation, GProxyResolver has a higher priority
+ * than the old GConf. And we only resolve the proxy synchronously. In
+ * the future, we can also do the asynchronous network proxy resolution
+ * if necessary.
+ *
+ */
+typedef struct _GProxyResolver GProxyResolver;
+typedef struct _GSocketConnectable GSocketConnectable;
+typedef struct GError GError;
+typedef GProxyResolver* g_proxy_resolver_get_default_func();
+typedef char** g_proxy_resolver_lookup_func();
+typedef GSocketConnectable* g_network_address_parse_uri_func();
+typedef const char* g_network_address_get_hostname_func();
+typedef unsigned short g_network_address_get_port_func();
+typedef void g_strfreev_func();
+
+static g_proxy_resolver_get_default_func* g_proxy_resolver_get_default = NULL;
+static g_proxy_resolver_lookup_func* g_proxy_resolver_lookup = NULL;
+static g_network_address_parse_uri_func* g_network_address_parse_uri = NULL;
+static g_network_address_get_hostname_func* g_network_address_get_hostname = NULL;
+static g_network_address_get_port_func* g_network_address_get_port = NULL;
+static g_strfreev_func* g_strfreev = NULL;
+
+
 static jclass proxy_class;
 static jclass isaddr_class;
 static jclass ptype_class;
@@ -83,11 +118,363 @@
 static jfieldID ptype_httpID;
 static jfieldID ptype_socksID;
 
-static int gconf_ver = 0;
+
 static void* gconf_client = NULL;
 
+static int use_gproxyResolver = 0;
+static int use_gconf = 0;
+
 #define CHECK_NULL(X) { if ((X) == NULL) fprintf (stderr,"JNI errror at line %d\n", __LINE__); }
 
+
+static int initGConf() {
+    /**
+     * Let's try to load GConf-2 library
+     */
+    if (dlopen(JNI_LIB_NAME("gconf-2"), RTLD_GLOBAL | RTLD_LAZY) != NULL ||
+        dlopen(VERSIONED_JNI_LIB_NAME("gconf-2", "4"),
+               RTLD_GLOBAL | RTLD_LAZY) != NULL)
+    {
+        /*
+         * Now let's get pointer to the functions we need.
+         */
+        my_g_type_init_func =
+                (g_type_init_func*)dlsym(RTLD_DEFAULT, "g_type_init");
+        my_get_default_func =
+                (gconf_client_get_default_func*)dlsym(RTLD_DEFAULT,
+                        "gconf_client_get_default");
+
+        if (my_g_type_init_func != NULL && my_get_default_func != NULL) {
+            /**
+             * Try to connect to GConf.
+             */
+            (*my_g_type_init_func)();
+            gconf_client = (*my_get_default_func)();
+            if (gconf_client != NULL) {
+                my_get_string_func =
+                        (gconf_client_get_string_func*)dlsym(RTLD_DEFAULT,
+                                "gconf_client_get_string");
+                my_get_int_func =
+                        (gconf_client_get_int_func*)dlsym(RTLD_DEFAULT,
+                                "gconf_client_get_int");
+                my_get_bool_func =
+                        (gconf_client_get_bool_func*)dlsym(RTLD_DEFAULT,
+                                "gconf_client_get_bool");
+                if (my_get_int_func != NULL && my_get_string_func != NULL &&
+                        my_get_bool_func != NULL)
+                {
+                    /**
+                     * We did get all we need. Let's enable the System Proxy Settings.
+                     */
+                    return 1;
+                }
+            }
+        }
+    }
+    return 0;
+}
+
+static jobject getProxyByGConf(JNIEnv *env, const char* cproto,
+                               const char* chost)
+{
+    char *phost = NULL;
+    char *mode = NULL;
+    int pport = 0;
+    int use_proxy = 0;
+    int use_same_proxy = 0;
+    jobject isa = NULL;
+    jobject proxy = NULL;
+    jobject type_proxy = NULL;
+
+    // We only check manual proxy configurations
+    mode =  (*my_get_string_func)(gconf_client, "/system/proxy/mode", NULL);
+    if (mode && !strcasecmp(mode, "manual")) {
+        /*
+         * Even though /system/http_proxy/use_same_proxy is no longer used,
+         * its value is set to false in gnome 3. So it is not harmful to check
+         * it first in case jdk is used with an old gnome.
+         */
+        use_same_proxy = (*my_get_bool_func)(gconf_client, "/system/http_proxy/use_same_proxy", NULL);
+        if (use_same_proxy) {
+            phost = (*my_get_string_func)(gconf_client, "/system/http_proxy/host", NULL);
+            pport = (*my_get_int_func)(gconf_client, "/system/http_proxy/port", NULL);
+            use_proxy = (phost != NULL && pport != 0);
+            if (use_proxy)
+                type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID);
+        }
+
+        if (!use_proxy) {
+            /**
+             * HTTP:
+             * /system/http_proxy/use_http_proxy (boolean) - it's no longer used
+             * /system/http_proxy/host (string)
+             * /system/http_proxy/port (integer)
+             */
+            if (strcasecmp(cproto, "http") == 0) {
+                phost = (*my_get_string_func)(gconf_client, "/system/http_proxy/host", NULL);
+                pport = (*my_get_int_func)(gconf_client, "/system/http_proxy/port", NULL);
+                use_proxy = (phost != NULL && pport != 0);
+                if (use_proxy)
+                    type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID);
+            }
+
+            /**
+             * HTTPS:
+             * /system/proxy/mode (string) [ "manual" means use proxy settings ]
+             * /system/proxy/secure_host (string)
+             * /system/proxy/secure_port (integer)
+             */
+            if (strcasecmp(cproto, "https") == 0) {
+                phost = (*my_get_string_func)(gconf_client, "/system/proxy/secure_host", NULL);
+                pport = (*my_get_int_func)(gconf_client, "/system/proxy/secure_port", NULL);
+                use_proxy = (phost != NULL && pport != 0);
+                if (use_proxy)
+                    type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID);
+            }
+
+            /**
+             * FTP:
+             * /system/proxy/mode (string) [ "manual" means use proxy settings ]
+             * /system/proxy/ftp_host (string)
+             * /system/proxy/ftp_port (integer)
+             */
+            if (strcasecmp(cproto, "ftp") == 0) {
+                phost = (*my_get_string_func)(gconf_client, "/system/proxy/ftp_host", NULL);
+                pport = (*my_get_int_func)(gconf_client, "/system/proxy/ftp_port", NULL);
+                use_proxy = (phost != NULL && pport != 0);
+                if (use_proxy)
+                    type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID);
+            }
+
+            /**
+             * GOPHER:
+             * /system/proxy/mode (string) [ "manual" means use proxy settings ]
+             * /system/proxy/gopher_host (string)
+             * /system/proxy/gopher_port (integer)
+             */
+            if (strcasecmp(cproto, "gopher") == 0) {
+                phost = (*my_get_string_func)(gconf_client, "/system/proxy/gopher_host", NULL);
+                pport = (*my_get_int_func)(gconf_client, "/system/proxy/gopher_port", NULL);
+                use_proxy = (phost != NULL && pport != 0);
+                if (use_proxy)
+                    type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID);
+            }
+
+            /**
+             * SOCKS:
+             * /system/proxy/mode (string) [ "manual" means use proxy settings ]
+             * /system/proxy/socks_host (string)
+             * /system/proxy/socks_port (integer)
+             */
+            if (strcasecmp(cproto, "socks") == 0) {
+                phost = (*my_get_string_func)(gconf_client, "/system/proxy/socks_host", NULL);
+                pport = (*my_get_int_func)(gconf_client, "/system/proxy/socks_port", NULL);
+                use_proxy = (phost != NULL && pport != 0);
+                if (use_proxy)
+                    type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_socksID);
+            }
+        }
+    }
+
+    if (use_proxy) {
+        jstring jhost;
+        char *noproxyfor;
+        char *s;
+
+        /**
+         * check for the exclude list (aka "No Proxy For" list).
+         * It's a list of comma separated suffixes (e.g. domain name).
+         */
+        noproxyfor = (*my_get_string_func)(gconf_client, "/system/proxy/no_proxy_for", NULL);
+        if (noproxyfor != NULL) {
+            char *tmpbuf[512];
+            s = strtok_r(noproxyfor, ", ", tmpbuf);
+
+            while (s != NULL && strlen(s) <= strlen(chost)) {
+                if (strcasecmp(chost+(strlen(chost) - strlen(s)), s) == 0) {
+                    /**
+                     * the URL host name matches with one of the sufixes,
+                     * therefore we have to use a direct connection.
+                     */
+                    use_proxy = 0;
+                    break;
+                }
+                s = strtok_r(NULL, ", ", tmpbuf);
+            }
+        }
+        if (use_proxy) {
+            CHECK_NULL(type_proxy);
+            jhost = (*env)->NewStringUTF(env, phost);
+            isa = (*env)->CallStaticObjectMethod(env, isaddr_class, isaddr_createUnresolvedID, jhost, pport);
+            proxy = (*env)->NewObject(env, proxy_class, proxy_ctrID, type_proxy, isa);
+        }
+    }
+
+    return proxy;
+}
+
+static int initGProxyResolver() {
+    void *gio_handle;
+
+    gio_handle = dlopen("libgio-2.0.so", RTLD_LAZY);
+    if (!gio_handle) {
+        gio_handle = dlopen("libgio-2.0.so.0", RTLD_LAZY);
+        if (!gio_handle) {
+            return 0;
+        }
+    }
+
+    my_g_type_init_func = (g_type_init_func*)dlsym(gio_handle, "g_type_init");
+
+    g_proxy_resolver_get_default =
+            (g_proxy_resolver_get_default_func*)dlsym(gio_handle,
+                    "g_proxy_resolver_get_default");
+
+    g_proxy_resolver_lookup =
+            (g_proxy_resolver_lookup_func*)dlsym(gio_handle,
+                    "g_proxy_resolver_lookup");
+
+    g_network_address_parse_uri =
+            (g_network_address_parse_uri_func*)dlsym(gio_handle,
+                    "g_network_address_parse_uri");
+
+    g_network_address_get_hostname =
+            (g_network_address_get_hostname_func*)dlsym(gio_handle,
+                    "g_network_address_get_hostname");
+
+    g_network_address_get_port =
+            (g_network_address_get_port_func*)dlsym(gio_handle,
+                    "g_network_address_get_port");
+
+    g_strfreev = (g_strfreev_func*)dlsym(gio_handle, "g_strfreev");
+
+    if (!my_g_type_init_func ||
+        !g_proxy_resolver_get_default ||
+        !g_proxy_resolver_lookup ||
+        !g_network_address_parse_uri ||
+        !g_network_address_get_hostname ||
+        !g_network_address_get_port ||
+        !g_strfreev)
+    {
+        dlclose(gio_handle);
+        return 0;
+    }
+
+    (*my_g_type_init_func)();
+    return 1;
+}
+
+static jobject getProxyByGProxyResolver(JNIEnv *env, const char* cproto,
+                                        const char* chost)
+{
+    GProxyResolver* resolver = NULL;
+    char** proxies = NULL;
+    GError *error = NULL;
+
+    size_t protoLen = 0;
+    size_t hostLen = 0;
+    char* uri = NULL;
+
+    jobject objProxy = NULL;
+
+    resolver = (*g_proxy_resolver_get_default)();
+    if (resolver == NULL) {
+        return NULL;
+    }
+
+    // Construct the uri, cproto + "://" + chost
+    protoLen = strlen(cproto);
+    hostLen = strlen(chost);
+    uri = malloc(protoLen + hostLen + 4);
+    if (!uri) {
+        // Out of memory
+        return NULL;
+    }
+    memcpy(uri, cproto, protoLen);
+    memcpy(uri + protoLen, "://", 3);
+    memcpy(uri + protoLen + 3, chost, hostLen + 1);
+
+    /*
+     * Looks into the system proxy configuration to determine what proxy,
+     * if any, to use to connect to uri. The returned proxy URIs are of
+     * the form <protocol>://[user[:password]@]host:port or direct://,
+     * where <protocol> could be http, rtsp, socks or other proxying protocol.
+     * direct:// is used when no proxy is needed.
+     */
+    proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error);
+    free(uri);
+
+    if (proxies) {
+        if (!error) {
+            int i;
+            for(i = 0; proxies[i] && !objProxy; i++) {
+                if (strcmp(proxies[i], "direct://")) {
+                    GSocketConnectable* conn =
+                            (*g_network_address_parse_uri)(proxies[i], 0,
+                                                           &error);
+                    if (conn && !error) {
+                        const char* phost = NULL;
+                        unsigned short pport = 0;
+                        phost = (*g_network_address_get_hostname)(conn);
+                        pport = (*g_network_address_get_port)(conn);
+                        if (phost && pport > 0) {
+                            jobject type_proxy = NULL;
+                            jstring jhost = NULL;
+                            jobject isa = NULL;
+                            jfieldID ptype_ID = ptype_httpID;
+                            if (!strncmp(proxies[i], "socks", 5)) {
+                                ptype_ID = ptype_socksID;
+                            }
+
+                            type_proxy = (*env)->GetStaticObjectField(env,
+                                    ptype_class, ptype_ID);
+                            CHECK_NULL(type_proxy);
+                            jhost = (*env)->NewStringUTF(env, phost);
+                            CHECK_NULL(jhost);
+                            isa = (*env)->CallStaticObjectMethod(env,
+                                    isaddr_class, isaddr_createUnresolvedID,
+                                    jhost, pport);
+                            CHECK_NULL(isa);
+                            objProxy = (*env)->NewObject(env, proxy_class,
+                                    proxy_ctrID, type_proxy, isa);
+                        }
+                    }
+                }
+            }
+        }
+        (*g_strfreev)(proxies);
+    }
+
+    return objProxy;
+}
+
+static void initJavaClass(JNIEnv *env) {
+    jclass cls = NULL;
+    CHECK_NULL(cls = (*env)->FindClass(env,"java/net/Proxy"));
+    proxy_class = (*env)->NewGlobalRef(env, cls);
+    CHECK_NULL(cls = (*env)->FindClass(env,"java/net/Proxy$Type"));
+    ptype_class = (*env)->NewGlobalRef(env, cls);
+    CHECK_NULL(cls = (*env)->FindClass(env, "java/net/InetSocketAddress"));
+    isaddr_class = (*env)->NewGlobalRef(env, cls);
+    proxy_ctrID = (*env)->GetMethodID(env, proxy_class, "<init>",
+            "(Ljava/net/Proxy$Type;Ljava/net/SocketAddress;)V");
+    CHECK_NULL(proxy_ctrID);
+    pr_no_proxyID = (*env)->GetStaticFieldID(env, proxy_class, "NO_PROXY",
+            "Ljava/net/Proxy;");
+    CHECK_NULL(pr_no_proxyID);
+    ptype_httpID = (*env)->GetStaticFieldID(env, ptype_class, "HTTP",
+            "Ljava/net/Proxy$Type;");
+    CHECK_NULL(ptype_httpID);
+    ptype_socksID = (*env)->GetStaticFieldID(env, ptype_class, "SOCKS",
+            "Ljava/net/Proxy$Type;");
+    CHECK_NULL(ptype_socksID);
+    isaddr_createUnresolvedID = (*env)->GetStaticMethodID(env, isaddr_class,
+            "createUnresolved",
+            "(Ljava/lang/String;I)Ljava/net/InetSocketAddress;");
+    CHECK_NULL(isaddr_createUnresolvedID);
+}
+
+
 /*
  * Class:     sun_net_spi_DefaultProxySelector
  * Method:    init
@@ -95,57 +482,17 @@
  */
 JNIEXPORT jboolean JNICALL
 Java_sun_net_spi_DefaultProxySelector_init(JNIEnv *env, jclass clazz) {
-  jclass cls = NULL;
-  CHECK_NULL(cls = (*env)->FindClass(env,"java/net/Proxy"));
-  proxy_class = (*env)->NewGlobalRef(env, cls);
-  CHECK_NULL(cls = (*env)->FindClass(env,"java/net/Proxy$Type"));
-  ptype_class = (*env)->NewGlobalRef(env, cls);
-  CHECK_NULL(cls = (*env)->FindClass(env, "java/net/InetSocketAddress"));
-  isaddr_class = (*env)->NewGlobalRef(env, cls);
-  proxy_ctrID = (*env)->GetMethodID(env, proxy_class, "<init>", "(Ljava/net/Proxy$Type;Ljava/net/SocketAddress;)V");
-  pr_no_proxyID = (*env)->GetStaticFieldID(env, proxy_class, "NO_PROXY", "Ljava/net/Proxy;");
-  ptype_httpID = (*env)->GetStaticFieldID(env, ptype_class, "HTTP", "Ljava/net/Proxy$Type;");
-  ptype_socksID = (*env)->GetStaticFieldID(env, ptype_class, "SOCKS", "Ljava/net/Proxy$Type;");
-  isaddr_createUnresolvedID = (*env)->GetStaticMethodID(env, isaddr_class, "createUnresolved", "(Ljava/lang/String;I)Ljava/net/InetSocketAddress;");
+    use_gproxyResolver = initGProxyResolver();
+    if (!use_gproxyResolver)
+        use_gconf = initGConf();
 
-  /**
-   * Let's try to load le GConf-2 library
-   */
-  if (dlopen(JNI_LIB_NAME("gconf-2"), RTLD_GLOBAL | RTLD_LAZY) != NULL ||
-      dlopen(VERSIONED_JNI_LIB_NAME("gconf-2", "4"),
-             RTLD_GLOBAL | RTLD_LAZY) != NULL) {
-    gconf_ver = 2;
-  }
-  if (gconf_ver > 0) {
-    /*
-     * Now let's get pointer to the functions we need.
-     */
-    my_g_type_init_func = (g_type_init_func*) dlsym(RTLD_DEFAULT, "g_type_init");
-    my_get_default_func = (gconf_client_get_default_func*) dlsym(RTLD_DEFAULT, "gconf_client_get_default");
-    if (my_g_type_init_func != NULL && my_get_default_func != NULL) {
-      /**
-       * Try to connect to GConf.
-       */
-      (*my_g_type_init_func)();
-      gconf_client = (*my_get_default_func)();
-      if (gconf_client != NULL) {
-        my_get_string_func = (gconf_client_get_string_func*) dlsym(RTLD_DEFAULT, "gconf_client_get_string");
-        my_get_int_func = (gconf_client_get_int_func*) dlsym(RTLD_DEFAULT, "gconf_client_get_int");
-        my_get_bool_func = (gconf_client_get_bool_func*) dlsym(RTLD_DEFAULT, "gconf_client_get_bool");
-        if (my_get_int_func != NULL && my_get_string_func != NULL &&
-            my_get_bool_func != NULL) {
-          /**
-           * We did get all we need. Let's enable the System Proxy Settings.
-           */
-          return JNI_TRUE;
-        }
-      }
-    }
-  }
-  return JNI_FALSE;
+    if (use_gproxyResolver || use_gconf) {
+        initJavaClass(env);
+        return JNI_TRUE;
+    } else
+        return JNI_FALSE;
 }
 
-
 /*
  * Class:     sun_net_spi_DefaultProxySelector
  * Method:    getSystemProxy
@@ -157,179 +504,35 @@
                                                      jstring proto,
                                                      jstring host)
 {
-  char *phost = NULL;
-  char *mode = NULL;
-  int pport = 0;
-  int use_proxy = 0;
-  int use_same_proxy = 0;
-  const char* urlhost;
-  jobject isa = NULL;
-  jobject proxy = NULL;
-  jobject type_proxy = NULL;
-  jobject no_proxy = NULL;
-  const char *cproto;
-  jboolean isCopy;
-
-  if (gconf_ver > 0) {
-    if (gconf_client == NULL) {
-      (*my_g_type_init_func)();
-      gconf_client = (*my_get_default_func)();
-    }
-    if (gconf_client != NULL) {
-      cproto = (*env)->GetStringUTFChars(env, proto, &isCopy);
-      if (cproto != NULL) {
-        /**
-         * We will have to check protocol by protocol as they do use different
-         * entries.
-         */
-
-        use_same_proxy = (*my_get_bool_func)(gconf_client, "/system/http_proxy/use_same_proxy", NULL);
-        if (use_same_proxy) {
-          use_proxy = (*my_get_bool_func)(gconf_client, "/system/http_proxy/use_http_proxy", NULL);
-          if (use_proxy) {
-            phost = (*my_get_string_func)(gconf_client, "/system/http_proxy/host", NULL);
-            pport = (*my_get_int_func)(gconf_client, "/system/http_proxy/port", NULL);
-          }
-        }
+    const char* cproto;
+    const char* chost;
 
-        /**
-         * HTTP:
-         * /system/http_proxy/use_http_proxy (boolean)
-         * /system/http_proxy/host (string)
-         * /system/http_proxy/port (integer)
-         */
-        if (strcasecmp(cproto, "http") == 0) {
-          use_proxy = (*my_get_bool_func)(gconf_client, "/system/http_proxy/use_http_proxy", NULL);
-          if (use_proxy) {
-            if (!use_same_proxy) {
-              phost = (*my_get_string_func)(gconf_client, "/system/http_proxy/host", NULL);
-              pport = (*my_get_int_func)(gconf_client, "/system/http_proxy/port", NULL);
-            }
-            CHECK_NULL(type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID));
-          }
-        }
+    jboolean isProtoCopy;
+    jboolean isHostCopy;
 
-        /**
-         * HTTPS:
-         * /system/proxy/mode (string) [ "manual" means use proxy settings ]
-         * /system/proxy/secure_host (string)
-         * /system/proxy/secure_port (integer)
-         */
-        if (strcasecmp(cproto, "https") == 0) {
-          mode =  (*my_get_string_func)(gconf_client, "/system/proxy/mode", NULL);
-          if (mode != NULL && (strcasecmp(mode,"manual") == 0)) {
-            if (!use_same_proxy) {
-              phost = (*my_get_string_func)(gconf_client, "/system/proxy/secure_host", NULL);
-              pport = (*my_get_int_func)(gconf_client, "/system/proxy/secure_port", NULL);
-            }
-            use_proxy = (phost != NULL);
-            if (use_proxy)
-              type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID);
-          }
-        }
+    jobject proxy = NULL;
+
+    cproto = (*env)->GetStringUTFChars(env, proto, &isProtoCopy);
 
-        /**
-         * FTP:
-         * /system/proxy/mode (string) [ "manual" means use proxy settings ]
-         * /system/proxy/ftp_host (string)
-         * /system/proxy/ftp_port (integer)
-         */
-        if (strcasecmp(cproto, "ftp") == 0) {
-          mode =  (*my_get_string_func)(gconf_client, "/system/proxy/mode", NULL);
-          if (mode != NULL && (strcasecmp(mode,"manual") == 0)) {
-            if (!use_same_proxy) {
-              phost = (*my_get_string_func)(gconf_client, "/system/proxy/ftp_host", NULL);
-              pport = (*my_get_int_func)(gconf_client, "/system/proxy/ftp_port", NULL);
-            }
-            use_proxy = (phost != NULL);
-            if (use_proxy)
-              type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID);
-          }
-        }
-
-        /**
-         * GOPHER:
-         * /system/proxy/mode (string) [ "manual" means use proxy settings ]
-         * /system/proxy/gopher_host (string)
-         * /system/proxy/gopher_port (integer)
-         */
-        if (strcasecmp(cproto, "gopher") == 0) {
-          mode =  (*my_get_string_func)(gconf_client, "/system/proxy/mode", NULL);
-          if (mode != NULL && (strcasecmp(mode,"manual") == 0)) {
-            if (!use_same_proxy) {
-              phost = (*my_get_string_func)(gconf_client, "/system/proxy/gopher_host", NULL);
-              pport = (*my_get_int_func)(gconf_client, "/system/proxy/gopher_port", NULL);
-            }
-            use_proxy = (phost != NULL);
-            if (use_proxy)
-              type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_httpID);
-          }
-        }
+    if (cproto != NULL && (use_gproxyResolver || use_gconf)) {
+        chost = (*env)->GetStringUTFChars(env, host, &isHostCopy);
+        if (chost != NULL) {
+            if (use_gproxyResolver)
+                proxy = getProxyByGProxyResolver(env, cproto, chost);
+            else if (use_gconf)
+                proxy = getProxyByGConf(env, cproto, chost);
 
-        /**
-         * SOCKS:
-         * /system/proxy/mode (string) [ "manual" means use proxy settings ]
-         * /system/proxy/socks_host (string)
-         * /system/proxy/socks_port (integer)
-         */
-        if (strcasecmp(cproto, "socks") == 0) {
-          mode =  (*my_get_string_func)(gconf_client, "/system/proxy/mode", NULL);
-          if (mode != NULL && (strcasecmp(mode,"manual") == 0)) {
-            if (!use_same_proxy) {
-              phost = (*my_get_string_func)(gconf_client, "/system/proxy/socks_host", NULL);
-              pport = (*my_get_int_func)(gconf_client, "/system/proxy/socks_port", NULL);
-            }
-            use_proxy = (phost != NULL);
-            if (use_proxy)
-              type_proxy = (*env)->GetStaticObjectField(env, ptype_class, ptype_socksID);
-          }
+            if (isHostCopy == JNI_TRUE)
+                (*env)->ReleaseStringUTFChars(env, host, chost);
         }
-
-        if (isCopy == JNI_TRUE)
-          (*env)->ReleaseStringUTFChars(env, proto, cproto);
-
-        if (use_proxy && (phost != NULL)) {
-          jstring jhost;
-          char *noproxyfor;
-          char *s;
+        if (isProtoCopy == JNI_TRUE)
+            (*env)->ReleaseStringUTFChars(env, proto, cproto);
+    }
 
-          /**
-           * check for the exclude list (aka "No Proxy For" list).
-           * It's a list of comma separated suffixes (e.g. domain name).
-           */
-          noproxyfor = (*my_get_string_func)(gconf_client, "/system/proxy/no_proxy_for", NULL);
-          if (noproxyfor != NULL) {
-            char *tmpbuf[512];
+    if (proxy == NULL) {
+        CHECK_NULL(proxy = (*env)->GetStaticObjectField(env, proxy_class,
+                                                        pr_no_proxyID));
+    }
+    return proxy;
+}
 
-            s = strtok_r(noproxyfor, ", ", tmpbuf);
-            urlhost = (*env)->GetStringUTFChars(env, host, &isCopy);
-            if (urlhost != NULL) {
-              while (s != NULL && strlen(s) <= strlen(urlhost)) {
-                if (strcasecmp(urlhost+(strlen(urlhost) - strlen(s)), s) == 0) {
-                  /**
-                   * the URL host name matches with one of the sufixes,
-                   * therefore we have to use a direct connection.
-                   */
-                  use_proxy = 0;
-                  break;
-                }
-                s = strtok_r(NULL, ", ", tmpbuf);
-              }
-              if (isCopy == JNI_TRUE)
-                (*env)->ReleaseStringUTFChars(env, host, urlhost);
-            }
-          }
-          if (use_proxy) {
-            jhost = (*env)->NewStringUTF(env, phost);
-            isa = (*env)->CallStaticObjectMethod(env, isaddr_class, isaddr_createUnresolvedID, jhost, pport);
-            proxy = (*env)->NewObject(env, proxy_class, proxy_ctrID, type_proxy, isa);
-            return proxy;
-          }
-        }
-      }
-    }
-  }
-
-  CHECK_NULL(no_proxy = (*env)->GetStaticObjectField(env, proxy_class, pr_no_proxyID));
-  return no_proxy;
-}
--- a/jdk/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h	Wed Jul 05 19:21:26 2017 +0200
@@ -317,8 +317,8 @@
 #endif
 
 /*
- * Enhanced messaging has been added to accomodate newer devices which have
- * more advanced capabilites, such as dedicated secure co-processors which
+ * Enhanced messaging has been added to accommodate newer devices which have
+ * more advanced capabilities, such as dedicated secure co-processors which
  * can stream and encrypt data over USB. In order to used enhanced messaging
  * you must define PCSCLITE_ENHANCED_MESSAGING in the framework(library),
  * the daemon, and your application
@@ -332,7 +332,7 @@
 /*
  * The message and buffer sizes must be multiples of 16.
  * The max message size must be at least large enough
- * to accomodate the transmit_struct
+ * to accommodate the transmit_struct
  */
 #define PCSCLITE_MAX_MESSAGE_SIZE       (1<<17) /* enhanced (128K) msg len */
 #define MAX_BUFFER_SIZE                 (1<<15) /* enhanced (32K) Tx/Rx Buffer */
--- a/jdk/src/solaris/native/sun/xawt/awt_Desktop.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/solaris/native/sun/xawt/awt_Desktop.c	Wed Jul 05 19:21:26 2017 +0200
@@ -42,7 +42,7 @@
         return JNI_TRUE;
     }
 
-    if (gtk2_load() && gtk2_show_uri_load()) {
+    if (gtk2_load(env) && gtk2_show_uri_load()) {
         gtk_has_been_loaded = TRUE;
         return JNI_TRUE;
     } else if (gnome_load()) {
--- a/jdk/src/windows/classes/com/sun/tools/jdi/SharedMemoryAttachingConnector.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/classes/com/sun/tools/jdi/SharedMemoryAttachingConnector.java	Wed Jul 05 19:21:26 2017 +0200
@@ -50,7 +50,7 @@
 
         transport = new Transport() {
             public String name() {
-                return "dt_shmem";              // for compatability reasons
+                return "dt_shmem";              // for compatibility reasons
             }
         };
     }
--- a/jdk/src/windows/classes/com/sun/tools/jdi/SharedMemoryListeningConnector.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/classes/com/sun/tools/jdi/SharedMemoryListeningConnector.java	Wed Jul 05 19:21:26 2017 +0200
@@ -49,7 +49,7 @@
 
         transport = new Transport() {
             public String name() {
-                return "dt_shmem";              // compatability
+                return "dt_shmem";              // compatibility
             }
         };
     }
--- a/jdk/src/windows/classes/java/net/DefaultInterface.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/classes/java/net/DefaultInterface.java	Wed Jul 05 19:21:26 2017 +0200
@@ -26,7 +26,7 @@
 package java.net;
 
 /**
- * Choose a network inteface to be the default for
+ * Choose a network interface to be the default for
  * outgoing IPv6 traffic that does not specify a scope_id (and which needs one).
  *
  * Platforms that do not require a default interface may return null
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1108,4 +1108,8 @@
     }
 
     private native void setZOrder(long above);
+
+    public boolean isLightweightFramePeer() {
+        return false;
+    }
 }
--- a/jdk/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -90,4 +90,8 @@
     public void updateCursorImmediately() {
         SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
     }
+
+    public boolean isLightweightFramePeer() {
+        return true;
+    }
 }
--- a/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WPathGraphics.java	Wed Jul 05 19:21:26 2017 +0200
@@ -870,7 +870,7 @@
      * drawn using GDI to the printer context.
      *
      * @param   img     The image to be drawn.
-     * @param   xform   Used to tranform the image before drawing.
+     * @param   xform   Used to transform the image before drawing.
      *                  This can be null.
      * @param   bgcolor This color is drawn where the image has transparent
      *                  pixels. If this parameter is null then the
--- a/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java	Wed Jul 05 19:21:26 2017 +0200
@@ -183,10 +183,6 @@
     /**
      * Values must match those defined in wingdi.h & commdlg.h
      */
-    private static final int PD_ALLPAGES = 0x00000000;
-    private static final int PD_SELECTION = 0x00000001;
-    private static final int PD_PAGENUMS = 0x00000002;
-    private static final int PD_NOSELECTION = 0x00000004;
     private static final int PD_COLLATE = 0x00000010;
     private static final int PD_PRINTTOFILE = 0x00000020;
     private static final int DM_ORIENTATION   = 0x00000001;
@@ -1639,63 +1635,7 @@
         }
     }
 
-    //returns 1-based index for "From" page
-    private final int getFromPageAttrib() {
-        if (attributes != null) {
-            PageRanges pageRangesAttr =
-                (PageRanges)attributes.get(PageRanges.class);
-            if (pageRangesAttr != null) {
-                int[][] range = pageRangesAttr.getMembers();
-                return range[0][0];
-            }
-        }
-        return getMinPageAttrib();
-    }
 
-    //returns 1-based index for "To" page
-    private final int getToPageAttrib() {
-        if (attributes != null) {
-            PageRanges pageRangesAttr =
-                (PageRanges)attributes.get(PageRanges.class);
-            if (pageRangesAttr != null) {
-                int[][] range = pageRangesAttr.getMembers();
-                return range[range.length-1][1];
-            }
-        }
-        return getMaxPageAttrib();
-    }
-
-    private final int getMinPageAttrib() {
-        if (attributes != null) {
-            SunMinMaxPage s =
-                (SunMinMaxPage)attributes.get(SunMinMaxPage.class);
-            if (s != null) {
-                return s.getMin();
-            }
-        }
-        return 1;
-    }
-
-    private final int getMaxPageAttrib() {
-        if (attributes != null) {
-            SunMinMaxPage s =
-                (SunMinMaxPage)attributes.get(SunMinMaxPage.class);
-            if (s != null) {
-                return s.getMax();
-            }
-        }
-
-        Pageable pageable = getPageable();
-        if (pageable != null) {
-            int numPages = pageable.getNumberOfPages();
-            if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) {
-                numPages = MAX_UNKNOWN_PAGES;
-            }
-            return  ((numPages == 0) ? 1 : numPages);
-        }
-
-        return Integer.MAX_VALUE;
-    }
 
     private final boolean getDestAttrib() {
         return (mDestination != null);
@@ -1847,20 +1787,7 @@
         return mAttMediaTray;
     }
 
-    private final int getSelectAttrib() {
-        if (attributes != null) {
-            SunPageSelection pages =
-                (SunPageSelection)attributes.get(SunPageSelection.class);
-            if (pages == SunPageSelection.RANGE) {
-                return PD_PAGENUMS;
-            } else if (pages == SunPageSelection.SELECTION) {
-                return PD_SELECTION;
-            } else if (pages ==  SunPageSelection.ALL) {
-                return PD_ALLPAGES;
-            }
-        }
-        return PD_NOSELECTION;
-    }
+
 
     private final boolean getPrintToFileEnabled() {
         SecurityManager security = System.getSecurityManager();
--- a/jdk/src/windows/classes/sun/awt/windows/WRobotPeer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WRobotPeer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -56,9 +56,9 @@
     public native void keyRelease( int keycode );
 
     public int getRGBPixel(int x, int y) {
-        return getRGBPixelImpl(x, y);
+         // See 7002846: that's ineffective, but works correctly with non-opaque windows
+        return getRGBPixels(new Rectangle(x, y, 1, 1))[0];
     }
-    public native int getRGBPixelImpl(int x, int y);
 
     public int [] getRGBPixels(Rectangle bounds) {
         int pixelArray[] = new int[bounds.width*bounds.height];
--- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -252,6 +252,13 @@
                 updateWindow(true);
             }
         }
+
+        // See https://javafx-jira.kenai.com/browse/RT-32570
+        WComponentPeer owner = getNativeParent();
+        if (owner != null && owner.isLightweightFramePeer()) {
+            Rectangle b = getBounds();
+            handleExpose(0, 0, b.width, b.height);
+        }
     }
 
     // Synchronize the insets members (here & in helper) with actual window
--- a/jdk/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java	Wed Jul 05 19:21:26 2017 +0200
@@ -709,7 +709,7 @@
 }
 
 /**
- * This general Blit implemenation converts any source surface to an
+ * This general Blit implementation converts any source surface to an
  * intermediate IntArgbPre surface, and then uses the more specific
  * IntArgbPre->D3DSurface/Texture loop to get the intermediate
  * (premultiplied) surface down to D3D.
--- a/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java	Wed Jul 05 19:21:26 2017 +0200
@@ -219,7 +219,7 @@
         // Number of helper threads, that did not finish yet.
         private int threadsToFinish;
 
-        // IOException which occured during the last run.
+        // IOException which occurred during the last run.
         IOException exception = null;
 
         // Called before polling.
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsPath.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsPath.java	Wed Jul 05 19:21:26 2017 +0200
@@ -429,7 +429,7 @@
         boolean[] ignore = new boolean[count];      // true => ignore name
         int remaining = count;                      // number of names remaining
 
-        // multiple passes to eliminate all occurences of "." and "name/.."
+        // multiple passes to eliminate all occurrences of "." and "name/.."
         int prevRemaining;
         do {
             prevRemaining = remaining;
--- a/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/classes/sun/security/krb5/internal/tools/Klist.java	Wed Jul 05 19:21:26 2017 +0200
@@ -58,7 +58,7 @@
      * The main program that can be invoked at command line.
      * <br>Usage: klist
      * [[-c] [-f] [-e] [-a [-n]]] [-k [-t] [-K]] [name]
-     * -c specifes that credential cache is to be listed
+     * -c specifies that credential cache is to be listed
      * -k specifies that key tab is to be listed
      * name name of the credentials cache or keytab
      * <br>available options for credential caches:
--- a/jdk/src/windows/native/java/io/canonicalize_md.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/java/io/canonicalize_md.c	Wed Jul 05 19:21:26 2017 +0200
@@ -161,7 +161,7 @@
 {
     char *p = start;
     while (*p) {
-        if ((p = strchr(p, '.')) == NULL) // find next occurence of '.'
+        if ((p = strchr(p, '.')) == NULL) // find next occurrence of '.'
             return 0; // no more dots
         p++; // next char
         while ((*p) == '.') // go to the end of dots
@@ -184,7 +184,7 @@
         p = p + 4;
 
     while (*p) {
-        if ((p = wcschr(p, L'.')) == NULL) // find next occurence of '.'
+        if ((p = wcschr(p, L'.')) == NULL) // find next occurrence of '.'
             return 0; // no more dots
         p++; // next char
         while ((*p) == L'.') // go to the end of dots
--- a/jdk/src/windows/native/java/net/DualStackPlainSocketImpl.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/java/net/DualStackPlainSocketImpl.c	Wed Jul 05 19:21:26 2017 +0200
@@ -172,7 +172,7 @@
     }
 
     /*
-     * Socket is writable or error occured. On some Windows editions
+     * Socket is writable or error occurred. On some Windows editions
      * the socket will appear writable when the connect fails so we
      * check for error rather than writable.
      */
--- a/jdk/src/windows/native/java/net/Inet6AddressImpl.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/java/net/Inet6AddressImpl.c	Wed Jul 05 19:21:26 2017 +0200
@@ -131,18 +131,20 @@
 
     error = getaddrinfo(hostname, NULL, &hints, &res);
 
-    if (WSAGetLastError() == WSATRY_AGAIN) {
-        NET_ThrowByNameWithLastError(env,
-                                     JNU_JAVANETPKG "UnknownHostException",
-                                     hostname);
-        JNU_ReleaseStringPlatformChars(env, host, hostname);
-        return NULL;
-    } else if (error) {
-        /* report error */
-        JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
-                        (char *)hostname);
-        JNU_ReleaseStringPlatformChars(env, host, hostname);
-        return NULL;
+    if (error) {
+        if (WSAGetLastError() == WSATRY_AGAIN) {
+            NET_ThrowByNameWithLastError(env,
+                                         JNU_JAVANETPKG "UnknownHostException",
+                                         hostname);
+            JNU_ReleaseStringPlatformChars(env, host, hostname);
+            return NULL;
+        } else {
+            /* report error */
+            JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
+                            (char *)hostname);
+            JNU_ReleaseStringPlatformChars(env, host, hostname);
+            return NULL;
+        }
     } else {
         int i = 0;
         int inetCount = 0, inet6Count = 0, inetIndex, inet6Index;
--- a/jdk/src/windows/native/java/net/NetworkInterface.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/java/net/NetworkInterface.c	Wed Jul 05 19:21:26 2017 +0200
@@ -500,32 +500,52 @@
      * Get the various JNI ids that we require
      */
     ni_class = (*env)->NewGlobalRef(env, cls);
+    CHECK_NULL(ni_class);
     ni_nameID = (*env)->GetFieldID(env, ni_class, "name", "Ljava/lang/String;");
+    CHECK_NULL(ni_nameID);
     ni_displayNameID = (*env)->GetFieldID(env, ni_class, "displayName", "Ljava/lang/String;");
+    CHECK_NULL(ni_displayNameID);
     ni_indexID = (*env)->GetFieldID(env, ni_class, "index", "I");
+    CHECK_NULL(ni_indexID);
     ni_addrsID = (*env)->GetFieldID(env, ni_class, "addrs", "[Ljava/net/InetAddress;");
+    CHECK_NULL(ni_addrsID);
     ni_bindsID = (*env)->GetFieldID(env, ni_class, "bindings", "[Ljava/net/InterfaceAddress;");
+    CHECK_NULL(ni_bindsID);
     ni_childsID = (*env)->GetFieldID(env, ni_class, "childs", "[Ljava/net/NetworkInterface;");
+    CHECK_NULL(ni_childsID);
     ni_ctor = (*env)->GetMethodID(env, ni_class, "<init>", "()V");
+    CHECK_NULL(ni_ctor);
 
     ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
+    CHECK_NULL(ni_iacls);
     ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
+    CHECK_NULL(ni_iacls);
 
     ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
+    CHECK_NULL(ni_ia4cls);
     ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
+    CHECK_NULL(ni_ia4cls);
     ni_ia4Ctor = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
+    CHECK_NULL(ni_ia4Ctor);
 
     ni_ia6cls = (*env)->FindClass(env, "java/net/Inet6Address");
+    CHECK_NULL(ni_ia6cls);
     ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls);
+    CHECK_NULL(ni_ia6cls);
     ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
+    CHECK_NULL(ni_ia6ctrID);
 
     ni_ibcls = (*env)->FindClass(env, "java/net/InterfaceAddress");
+    CHECK_NULL(ni_ibcls);
     ni_ibcls = (*env)->NewGlobalRef(env, ni_ibcls);
+    CHECK_NULL(ni_ibcls);
     ni_ibctrID = (*env)->GetMethodID(env, ni_ibcls, "<init>", "()V");
+    CHECK_NULL(ni_ibctrID);
     ni_ibaddressID = (*env)->GetFieldID(env, ni_ibcls, "address", "Ljava/net/InetAddress;");
+    CHECK_NULL(ni_ibaddressID);
     ni_ibbroadcastID = (*env)->GetFieldID(env, ni_ibcls, "broadcast", "Ljava/net/Inet4Address;");
+    CHECK_NULL(ni_ibbroadcastID);
     ni_ibmaskID = (*env)->GetFieldID(env, ni_ibcls, "maskLength", "S");
-
 }
 
 /*
--- a/jdk/src/windows/native/java/net/icmp.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/java/net/icmp.h	Wed Jul 05 19:21:26 2017 +0200
@@ -40,7 +40,7 @@
         short   ip_len;                 /* total length */
         unsigned short ip_id;                   /* identification */
         short   ip_off;                 /* fragment offset field */
-#define IP_DF 0x4000                    /* dont fragment flag */
+#define IP_DF 0x4000                    /* don't fragment flag */
 #define IP_MF 0x2000                    /* more fragments flag */
         unsigned char   ip_ttl;                 /* time to live */
         unsigned char   ip_p;                   /* protocol */
--- a/jdk/src/windows/native/sun/font/fontpath.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/font/fontpath.c	Wed Jul 05 19:21:26 2017 +0200
@@ -371,7 +371,7 @@
  * However if a program "installed" a font in the registry the key may
  * not include that. We could also try to "pass" fonts which have no "(..)"
  * at the end. But that turns out to pass a few .FON files that MS supply.
- * If there's no parenthesised type string, we could next try to infer
+ * If there's no parenthesized type string, we could next try to infer
  * the file type from the file name extension. Since the MS entries that
  * have no type string are very few, and have odd names like "MS-DOS CP 437"
  * and would never return a Java Font anyway its currently OK to put these
--- a/jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h	Wed Jul 05 19:21:26 2017 +0200
@@ -53,26 +53,73 @@
 
     // Intel HD
     // Clarkdale (Desktop) GMA HD Lines
-    { 0x8086, 0x0042, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0042, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0042, D_VERSION(6,14,10,5394), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0042, D_VERSION(8,15,10,2993), OS_VISTA | OS_WINDOWS7 },
     // Arrandale (Mobile) GMA HD Lines
-    { 0x8086, 0x0046, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0046, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    // Sandy Bridge GMA HD Lines
-    { 0x8086, 0x0102, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0102, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0106, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0106, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0112, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0112, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0116, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0116, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0122, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0122, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0126, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0126, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x010A, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x010A, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0046, D_VERSION(6,14,10,5394), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0046, D_VERSION(8,15,10,2993), OS_VISTA | OS_WINDOWS7 },
+
+    // Sandy Bridge HD Graphics 3000/2000
+    { 0x8086, 0x0102, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0102, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0106, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0106, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0112, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0112, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0116, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0116, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0122, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0122, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0126, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0126, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x010A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x010A, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
+
+    // Ivy Bridge
+    { 0x8086, 0x0162, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0162, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0166, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0166, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x016A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x016A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0152, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0152, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0156, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0156, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x015A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x015A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+
+    // Haswell
+    { 0x8086, 0x0402, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0402, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0406, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0406, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0412, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0412, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0416, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0416, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x041E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x041E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x040A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x040A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x041A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x041A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0A06, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0A06, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0A16, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0A16, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0A26, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0A26, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0A2E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0A2E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0A1E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0A1E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0A0E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0A0E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0D26, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0D26, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0D22, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0D22, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
 
     // Reason: workaround for 6620073, 6612195
     // Intel 740
@@ -123,33 +170,33 @@
     { 0x8086, 0x2A13, NO_VERSION, OS_ALL },
 
     // Eaglelake (Desktop) GMA 4500 Lines
-    { 0x8086, 0x2E42, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E42, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2E43, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E43, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2E92, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E92, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2E93, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E93, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2E12, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E12, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2E13, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E13, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E42, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E42, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E43, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E43, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E92, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E92, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E93, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E93, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E12, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E12, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E13, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E13, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
     // Eaglelake (Desktop) GMA X4500 Lines
-    { 0x8086, 0x2E32, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E32, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2E33, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E33, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2E22, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E22, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E32, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E32, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E33, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E33, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E22, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E22, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
     // Eaglelake (Desktop) GMA X4500HD Lines
-    { 0x8086, 0x2E23, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E23, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E23, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E23, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
     // Cantiga (Mobile) GMA 4500MHD Lines
-    { 0x8086, 0x2A42, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2A42, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2A43, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2A43, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2A42, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2A42, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2A43, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2A43, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
 
     // ATI Mobility Radeon X1600, X1400, X1450, X1300, X1350
     // Reason: workaround for 6613066, 6687166
--- a/jdk/src/windows/native/sun/java2d/d3d/D3DTextRenderer.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/java2d/d3d/D3DTextRenderer.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -444,7 +444,7 @@
             } else if (remainingWidth < ginfo->width) {
                 // in some cases, the x-advance may be slightly smaller
                 // than the actual width of the glyph; if so, adjust our
-                // estimate so that we can accomodate the entire glyph
+                // estimate so that we can accommodate the entire glyph
                 remainingWidth = ginfo->width;
             }
         } else {
--- a/jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -161,7 +161,7 @@
                 // yet created the byteGrayPalette, create it now and copy
                 // it into our temporary bmi structure.
                 // REMIND: byteGrayPalette is a leak since we do not have
-                // a mechansim to free it up.  This should be fine, since it
+                // a mechanism to free it up.  This should be fine, since it
                 // is only 256 bytes for any process and only gets malloc'd
                 // when using ByteGray surfaces.  Eventually, we should use
                 // the new Disposer mechanism to delete this native memory.
--- a/jdk/src/windows/native/sun/java2d/windows/GDIRenderer.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/java2d/windows/GDIRenderer.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -68,7 +68,7 @@
 
     // Fix for 4298688 - draw(Line) and Polygon omit last pixel
     // We will need to add a point if we need to close it off or
-    // if we need to fix the endpoint to accomodate the Windows
+    // if we need to fix the endpoint to accommodate the Windows
     // habit of never drawing the last pixel of a Polyline.  Note
     // that if the polyline is already closed then neither fix
     // is needed because the last pixel is also the first pixel
--- a/jdk/src/windows/native/sun/nio/ch/SocketChannelImpl.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/nio/ch/SocketChannelImpl.c	Wed Jul 05 19:21:26 2017 +0200
@@ -97,7 +97,7 @@
     }
 
     /*
-     * Socket is writable or error occured. On some Windows editions
+     * Socket is writable or error occurred. On some Windows editions
      * the socket will appear writable when the connect fails so we
      * check for error rather than writable.
      */
--- a/jdk/src/windows/native/sun/nio/ch/SocketDispatcher.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/nio/ch/SocketDispatcher.c	Wed Jul 05 19:21:26 2017 +0200
@@ -192,45 +192,66 @@
                                          jobject fdo, jlong address, jint len)
 {
     /* set up */
-    int i = 0;
+    int next_index, next_offset, ret=0;
     DWORD written = 0;
     jint fd = fdval(env, fdo);
     struct iovec *iovp = (struct iovec *)address;
     WSABUF *bufs = malloc(len * sizeof(WSABUF));
-    jint rem = MAX_BUFFER_SIZE;
+    jlong count = 0;
 
     if (bufs == 0) {
         JNU_ThrowOutOfMemoryError(env, 0);
         return IOS_THROWN;
     }
 
-    /* copy iovec into WSABUF */
-    for(i=0; i<len; i++) {
-        jint iov_len = iovp[i].iov_len;
-        if (iov_len > rem)
-            iov_len = rem;
-        bufs[i].buf = (char *)iovp[i].iov_base;
-        bufs[i].len = (u_long)iov_len;
-        rem -= iov_len;
-        if (rem == 0) {
-            len = i+1;
+    // next buffer and offset to consume
+    next_index = 0;
+    next_offset = 0;
+
+    while (next_index  < len) {
+        DWORD buf_count = 0;
+
+        /* Prepare the WSABUF array to a maximum total size of MAX_BUFFER_SIZE */
+        jint rem = MAX_BUFFER_SIZE;
+        while (next_index < len && rem > 0) {
+            jint iov_len = iovp[next_index].iov_len - next_offset;
+            char* ptr = (char *)iovp[next_index].iov_base;
+            ptr += next_offset;
+            if (iov_len > rem) {
+                iov_len = rem;
+                next_offset += rem;
+            } else {
+                next_index ++;
+                next_offset = 0;
+            }
+
+            bufs[buf_count].buf = ptr;
+            bufs[buf_count].len = (u_long)iov_len;
+            buf_count++;
+
+            rem -= iov_len;
+        }
+
+        /* write the buffers */
+        ret = WSASend((SOCKET)fd,           /* Socket */
+                              bufs,         /* pointers to the buffers */
+                              buf_count,    /* number of buffers to process */
+                              &written,     /* receives number of bytes written */
+                              0,            /* no flags */
+                              0,            /* no overlapped sockets */
+                              0);           /* no completion routine */
+
+        if (ret == SOCKET_ERROR) {
             break;
         }
+
+        count += written;
     }
 
-    /* read into the buffers */
-    i = WSASend((SOCKET)fd, /* Socket */
-            bufs,           /* pointers to the buffers */
-            (DWORD)len,     /* number of buffers to process */
-            &written,       /* receives number of bytes written */
-            0,              /* no flags */
-            0,              /* no overlapped sockets */
-            0);             /* no completion routine */
-
     /* clean up */
     free(bufs);
 
-    if (i != 0) {
+    if (ret == SOCKET_ERROR && count == 0) {
         int theErr = (jint)WSAGetLastError();
         if (theErr == WSAEWOULDBLOCK) {
             return IOS_UNAVAILABLE;
@@ -239,7 +260,7 @@
         return IOS_THROWN;
     }
 
-    return convertLongReturnVal(env, (jlong)written, JNI_FALSE);
+    return convertLongReturnVal(env, count, JNI_FALSE);
 }
 
 JNIEXPORT void JNICALL
--- a/jdk/src/windows/native/sun/security/krb5/NativeCreds.c	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/security/krb5/NativeCreds.c	Wed Jul 05 19:21:26 2017 +0200
@@ -725,7 +725,7 @@
         return GetLastError();
 
     //
-    // Concatenate the target prefix with the previous reponse's
+    // Concatenate the target prefix with the previous response's
     // target domain.
     //
 
--- a/jdk/src/windows/native/sun/windows/ThemeReader.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/windows/ThemeReader.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -35,7 +35,7 @@
 //
 // These type definitions have been imported from UxTheme.h
 // They have been imported instead of including them, because
-// currently we dont require Platform SDK for building J2SE and
+// currently we don't require Platform SDK for building J2SE and
 // VC6 includes do not have UxTheme.h. When we move to VC7
 // we should remove these imports and just include
 //
--- a/jdk/src/windows/native/sun/windows/awt_BitmapUtil.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_BitmapUtil.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -359,7 +359,7 @@
 
 /**
  * Creates a 32 bit ARGB bitmap. Returns the bitmap handle. The *bitmapBits
- * contains the pointer to the bitmap data or NULL if an error occured.
+ * contains the pointer to the bitmap data or NULL if an error occurred.
  */
 HBITMAP BitmapUtil::CreateARGBBitmap(int width, int height, void ** bitmapBitsPtr)
 {
--- a/jdk/src/windows/native/sun/windows/awt_Choice.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Choice.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -243,7 +243,7 @@
     RECT    rcWindow;
 
     ::GetWindowRect(GetHWnd(), &rcWindow);
-    // resize the drop down to accomodate added/removed items
+    // resize the drop down to accommodate added/removed items
     int     totalHeight = GetTotalHeight();
     ::SetWindowPos(GetHWnd(), NULL,
                     0, 0, rcWindow.right - rcWindow.left, totalHeight,
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -281,7 +281,7 @@
 void AwtComponent::Dispose()
 {
     // NOTE: in case the component/toplevel was focused, Java should
-    // have already taken care of proper transfering it or clearing.
+    // have already taken care of proper transferring it or clearing.
 
     if (m_hdwp != NULL) {
     // end any deferred window positioning, regardless
@@ -2164,7 +2164,7 @@
     // Fix 4530093: Don't Validate if can't actually paint
     if (m_peerObject == NULL || !m_callbacksEnabled) {
 
-        // Fix 4745222: If we dont ValidateRgn,  windows will keep sending
+        // Fix 4745222: If we don't ValidateRgn,  windows will keep sending
         // WM_PAINT messages until we do. This causes java to go into
         // a tight loop that increases CPU to 100% and starves main
         // thread which needs to complete initialization, but cant.
--- a/jdk/src/windows/native/sun/windows/awt_Dialog.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Dialog.h	Wed Jul 05 19:21:26 2017 +0200
@@ -127,7 +127,7 @@
     // dialog to front
     static LRESULT CALLBACK MouseHookProc(int code,
                                           WPARAM wParam, LPARAM lParam);
-    // WM_MOUSE hook procedure used in modality, similiar to
+    // WM_MOUSE hook procedure used in modality, similar to
     // MouseHookProc but installed on non-toolkit threads, for
     // example on browser's thread when running in Java Plugin
     static LRESULT CALLBACK MouseHookProc_NonTT(int code,
--- a/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -1524,7 +1524,7 @@
 
     FILETIME now; ::CoFileTimeNow(&now); m_statstg.atime = now;
 
-    return STG_E_CANTSAVE; // dont support writing
+    return STG_E_CANTSAVE; // don't support writing
 
     CATCH_BAD_ALLOC_RET(E_OUTOFMEMORY);
 }
--- a/jdk/src/windows/native/sun/windows/awt_Font.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Font.h	Wed Jul 05 19:21:26 2017 +0200
@@ -242,7 +242,7 @@
     */
 
 private:
-    /* The array of assocated font handles */
+    /* The array of associated font handles */
     HFONT* m_hFont;
     /* The number of handles. */
     int    m_hFontNum;
--- a/jdk/src/windows/native/sun/windows/awt_InputTextInfor.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_InputTextInfor.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -277,7 +277,7 @@
        have to merge. Or if the current composing string size is 0, we don't have to merge either.
 
        So in clusion, the three conditions not not merge are:
-       1. no commited string
+       1. no committed string
        2. m_pResultTextInfor points to NULL
        3. the current string size is 0;
 
--- a/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -948,7 +948,7 @@
     // This may happen in other cases too, but was observed for the above.
     // To get a DC compatible with this devmode we should really call
     // CreateDC() again to get a DC for the devmode we are using.
-    // The changes for that are a lot more risk, so to minimise that
+    // The changes for that are a lot more risk, so to minimize that
     // risk, assume its not LANDSCAPE unless width > height, even if the
     // devmode says its LANDSCAPE.
     // if the values were obtained from a rotated device, swap.
--- a/jdk/src/windows/native/sun/windows/awt_Robot.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Robot.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -192,15 +192,6 @@
     return value;
 }
 
-jint AwtRobot::GetRGBPixel( jint x, jint y)
-{
-    HDC hdc = ::CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
-    COLORREF ref = ::GetPixel( hdc, x, y );
-    ::DeleteDC(hdc);
-    jint value = WinToJavaPixel(GetRValue(ref), GetGValue(ref), GetBValue(ref));
-    return value;
-}
-
 void AwtRobot::GetRGBPixels(jint x, jint y, jint width, jint height, jintArray pixelArray)
 {
     DASSERT(width > 0 && height > 0);
@@ -403,15 +394,6 @@
     CATCH_BAD_ALLOC;
 }
 
-JNIEXPORT jint JNICALL Java_sun_awt_windows_WRobotPeer_getRGBPixelImpl(
-    JNIEnv * env, jobject self, jint x, jint y)
-{
-    TRY;
-
-    return AwtRobot::GetRobot(self)->GetRGBPixel(x, y);
-
-    CATCH_BAD_ALLOC_RET(0);
-}
 JNIEXPORT void JNICALL Java_sun_awt_windows_WRobotPeer_getRGBPixels(
     JNIEnv *env, jobject self, jint x, jint y, jint width, jint height, jintArray pixelArray)
 {
--- a/jdk/src/windows/native/sun/windows/awt_Robot.h	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Robot.h	Wed Jul 05 19:21:26 2017 +0200
@@ -44,7 +44,6 @@
         void MouseWheel(jint wheelAmt);
         jint getNumberOfButtons();
 
-        jint GetRGBPixel( jint x, jint y);
         void GetRGBPixels(jint x, jint y, jint width, jint height, jintArray pixelArray);
 
         void KeyPress( jint key );
--- a/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -348,7 +348,7 @@
 }
 
 /*
- * If this Paste is occuring because of a synthetic Java event (e.g.,
+ * If this Paste is occurring because of a synthetic Java event (e.g.,
  * a synthesized <CTRL>-V KeyEvent), then verify that the TextComponent
  * has permission to access the Clipboard before pasting. If permission
  * is denied, we should throw a SecurityException, but currently do not
--- a/jdk/src/windows/native/sun/windows/awt_Window.cpp	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Window.cpp	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -1878,11 +1878,28 @@
                 AwtWindow::sm_resizing = TRUE;
                 mr = WmSysCommand(wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
                 if (mr != mrConsume) {
+                    // Perform size-move loop here
                     AwtWindow::DefWindowProc(message, wParam, lParam);
                 }
                 AwtWindow::sm_resizing = FALSE;
                 if (!AwtToolkit::GetInstance().IsDynamicLayoutActive()) {
                     WindowResized();
+                } else {
+                    /*
+                     * 8016356: check whether window snapping occurred after
+                     * resizing, i.e. GetWindowRect() returns the real
+                     * (snapped) window rectangle, e.g. (179, 0)-(483, 1040),
+                     * but GetWindowPlacement() returns the rectangle of
+                     * normal window position, e.g. (179, 189)-(483, 445) and
+                     * they are different. If so, send ComponentResized event.
+                     */
+                    WINDOWPLACEMENT wp;
+                    ::GetWindowPlacement(GetHWnd(), &wp);
+                    RECT rc;
+                    ::GetWindowRect(GetHWnd(), &rc);
+                    if (!::EqualRect(&rc, &wp.rcNormalPosition)) {
+                        WindowResized();
+                    }
                 }
                 mr = mrConsume;
             }
--- a/jdk/test/ProblemList.txt	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/ProblemList.txt	Wed Jul 05 19:21:26 2017 +0200
@@ -134,10 +134,6 @@
 # 8021230
 java/lang/ThreadLocal/ThreadLocalSupplierTest.java              generic-all
 
-# 8023201
-java/lang/instrument/RetransformBigClass.sh                     generic-all
-java/lang/instrument/RedefineBigClass.sh                        generic-all
-
 # 8026502
 java/lang/invoke/MethodHandleConstants.java                     generic-all
 
@@ -186,9 +182,6 @@
 # Filed 7036666
 com/sun/net/httpserver/Test9a.java                              generic-all
 
-# 7079145 java/net/ipv6tests/UdpTest.java hang at IPv6 only data exchange
-java/net/ipv6tests/UdpTest.java                                 linux-all
-
 # 7102670
 java/net/InetAddress/CheckJNI.java                              linux-all
 
@@ -273,14 +266,8 @@
 sun/security/pkcs11/Secmod/AddPrivateKey.java			linux-all
 sun/security/pkcs11/Secmod/TrustAnchors.java 			linux-all
 
-# 7041639, Solaris DSA keypair generation bug (Note: jdk_util also affected)
+# 7041639, Solaris DSA keypair generation bug
 java/security/KeyPairGenerator/SolarisShortDSA.java             solaris-all
-sun/security/tools/jarsigner/onlymanifest.sh                    solaris-all
-sun/security/tools/jarsigner/ts.sh                              solaris-all
-sun/security/tools/keytool/emptysubject.sh                      solaris-all
-sun/security/tools/keytool/importreadall.sh                     solaris-all
-sun/security/tools/keytool/readjar.sh                           solaris-all
-sun/security/tools/keytool/selfissued.sh                        solaris-all
 sun/security/tools/keytool/standard.sh                          solaris-all
 
 # 8000439: NPG: REGRESSION : sun/security/krb5/auto/MaxRetries.java fails with timeout
@@ -348,7 +335,7 @@
 # Filed 6772009
 java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all
 
-# 7041639, Solaris DSA keypair generation bug
-java/util/TimeZone/TimeZoneDatePermissionCheck.sh               solaris-all
+# 8026772: test/sun/util/resources/TimeZone/Bug6317929.java failing
+sun/util/resources/TimeZone/Bug6317929.java                     generic-all
 
 ############################################################################
--- a/jdk/test/TEST.groups	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/TEST.groups	Wed Jul 05 19:21:26 2017 +0200
@@ -325,7 +325,8 @@
   jdk/lambda/separate/Compiler.java \
   sun/management/jdp/JdpTest.sh \
   sun/management/jmxremote/bootstrap/JvmstatCountersTest.java \
-  sun/management/jmxremote/bootstrap/LocalManagementTest.sh \
+  sun/management/jmxremote/bootstrap/LocalManagementTest.java \
+  sun/management/jmxremote/bootstrap/CustomLauncherTest.java \
   sun/misc/JarIndex/metaInfFilenames/Basic.java \
   sun/misc/JarIndex/JarIndexMergeForClassLoaderTest.java \
   sun/reflect/CallerSensitive/CallerSensitiveFinder.java \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/corba/5036554/JavaBug.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package bug;
+
+public class JavaBug {
+    public static void main(String[] args) {
+        try {
+            org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
+            org.omg.CORBA.Any any = orb.create_any();
+            myStringHelper.insert(any, "hello");
+            System.out.println("Any: " + myStringHelper.extract(any));
+        } catch( Exception e ) {
+            e.printStackTrace();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/corba/5036554/README	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+Bug # 5036554 unmarshal error on CORBA alias type in CORBA any
+
+Platform : ALL 
+
+Testcase directory :  <.../corba>
+
+Test Procedure : <STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
+Step 1: create a file bug.idl with the following content:
+
+// IDL file bug.idl
+module bug {
+    typedef string myString;
+};
+
+Step 2: Translate bug.idl with the command: idlj bug.idl
+This will create the file bug/myStringHelper.java
+
+Step 3:
+Create the file JavaBug.java in directory bug with the following content:
+
+// Java file JavaBug.java
+package bug;
+
+public class JavaBug {
+    public static void main(String[] args) {
+        try {
+            org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
+            org.omg.CORBA.Any any = orb.create_any();
+            myStringHelper.insert(any, "hello");
+            System.out.println("Any: " + myStringHelper.extract(any));
+        } catch( Exception e ) {
+            e.printStackTrace();
+        }
+    }
+}  
+
+Step 4:
+Compile all java files with the command: javac -d . bug\*.java
+
+Step 5:
+Execute the program with the command: java -cp . bug/JavaBug
+
+Step 6: Note the null pointer exception in the the output!
+
+
+Without Fix behaviour :  <java.lang.NullPointerException
+        at com.sun.corba.se.internal.corba.TCUtility.unmarshalIn(TCUtility.java:290)
+        at com.sun.corba.se.internal.corba.AnyImpl.read_value(AnyImpl.java:561)
+        at bug.myStringHelper.insert(myStringHelper.java:20)
+        at bug.JavaBug.main(JavaBug.java:8)>
+        
+With Fix behaviour :  <The output message printed on the console: "Any: hello">
+
+Other Comments :  <Test case is automated.>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/corba/5036554/TestCorbaBug.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,112 @@
+#!/bin/sh
+#
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# @test  
+# @bug 5036554 6357706
+# @summary unmarshal error on CORBA alias type in CORBA any
+# @run shell TestCorbaBug.sh
+
+if [ "${TESTSRC}" = "" ]
+then TESTSRC=.
+fi
+
+if [ "${TESTJAVA}" = "" ]
+then
+  PARENT=`dirname \`which java\``
+  TESTJAVA=`dirname ${PARENT}`
+  echo "TESTJAVA not set, selecting " ${TESTJAVA}
+  echo "If this is incorrect, try setting the variable manually."
+fi
+
+if [ "${TESTCLASSES}" = "" ]
+then
+  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+
+# set platform-dependent variables
+OS=`uname -s`
+case "$OS" in
+  SunOS | Linux | Darwin )
+    PS=":"
+    FS="/"
+    ;;
+  CYGWIN* )
+    PS=";"
+    FS="/"
+    ;;
+  Windows* )
+    PS=";"
+    FS="\\"
+    ;;
+  * )
+    echo "Unrecognized system!"
+    exit 1;
+    ;;
+esac
+
+CLASSPATH=.${PS}${TESTCLASSES}; export CLASSPATH
+
+THIS_DIR=`pwd`
+
+${TESTJAVA}${FS}bin${FS}java -version
+
+mkdir bug
+
+cp ${TESTSRC}${FS}bug.idl .
+${TESTJAVA}${FS}bin${FS}idlj bug.idl
+
+cp ${TESTSRC}${FS}JavaBug.java bug
+
+chmod -fR 777 bug
+
+${TESTJAVA}${FS}bin${FS}javac -d . bug${FS}*.java
+
+${TESTJAVA}${FS}bin${FS}java -cp . bug/JavaBug > test.out 2>&1 
+
+grep "NullPointerException" test.out
+
+ERROR=$?
+
+cat test.out
+
+if [ $ERROR = 0 ]
+then
+    echo "Test Failed"
+    exit 1
+fi
+
+grep "Any: hello" test.out
+
+STATUS=$?
+
+if [ $STATUS = 0 ]
+then
+    echo "Test Passed"
+    exit 0
+else
+    echo "Invalid output"
+    cat test.out
+    exit 2
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/corba/5036554/bug.idl	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,4 @@
+// IDL file bug.idl
+module bug {
+    typedef string myString;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8016551
+ * @summary JMenuItem in WindowsLookAndFeel can't paint default icons
+ * @author Leonid Romanov
+ * @run main bug8016551
+ */
+
+import javax.swing.*;
+import java.awt.Graphics;
+import java.awt.Toolkit;
+import sun.awt.SunToolkit;
+
+public class bug8016551 {
+    private static volatile RuntimeException exception = null;
+
+    public static void main(String[] args) throws Exception {
+        try {
+            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
+        } catch (Exception e) {
+            // We intentionally allow the test to run with other l&f
+        }
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    Icon icon = UIManager.getIcon("InternalFrame.closeIcon");
+                    if (icon == null) {
+                        return;
+                    }
+
+                    JMenuItem item = new TestMenuItem(icon);
+                    JFrame f = new JFrame();
+                    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                    f.getContentPane().add(item);
+                    f.pack();
+                    f.setVisible(true);
+                } catch (ClassCastException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+
+        SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
+        tk.realSync();
+
+        if (exception != null) {
+            throw exception;
+        }
+    }
+
+    static class TestMenuItem extends JMenuItem {
+        TestMenuItem(Icon icon) {
+            super(icon);
+        }
+
+        @Override
+        public void paint(Graphics g) {
+            try {
+                super.paint(g);
+            } catch (RuntimeException e) {
+                exception = e;
+            }
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/GetUninitializedStringValue.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ *  @test
+ *  @bug 8021897
+ *  @summary Test getting the value for an uninitialized String object
+ *
+ *  @author Staffan Larsen
+ *
+ *  @run build TestScaffold VMConnection TargetListener TargetAdapter
+ *  @run compile -g GetUninitializedStringValue.java
+ *  @run main GetUninitializedStringValue
+ */
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.StackFrame;
+import com.sun.jdi.StringReference;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.event.BreakpointEvent;
+
+ /********** target program **********/
+
+class GetUninitializedStringValueTarg {
+    public static void main(String[] args) {
+        new String("foo");
+        System.out.println("Goodbye from GetUninitializedStringValueTarg!");
+    }
+}
+
+ /********** test program **********/
+
+public class GetUninitializedStringValue extends TestScaffold {
+    ReferenceType targetClass;
+    ThreadReference mainThread;
+
+    GetUninitializedStringValue (String args[]) {
+        super(args);
+    }
+
+    public static void main(String[] args)
+        throws Exception
+    {
+        new GetUninitializedStringValue (args).startTests();
+    }
+
+    /********** test core **********/
+
+    protected void runTests()
+        throws Exception
+    {
+        /*
+         * Run to String.<init>
+         */
+        startUp("GetUninitializedStringValueTarg");
+        BreakpointEvent bpe = resumeTo("java.lang.String", "<init>", "(Ljava/lang/String;)V");
+
+        /*
+         * We've arrived. Look at 'this' - it will be uninitialized (the value field will not be set yet).
+         */
+        StackFrame frame = bpe.thread().frame(0);
+        StringReference sr = (StringReference)frame.thisObject();
+        if (!sr.value().equals("")) {
+            throw new Exception("Unexpected value for the uninitialized String");
+        }
+
+        /*
+         * resume the target listening for events
+         */
+        listenUntilVMDisconnect();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/LambdaBreakpointTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/********** LINE NUMBER SENSITIVE! *****************************************************************/
+
+/**
+ *  @test
+ *  @summary Test setting breakpoints on lambda calls
+ *
+ *  @author Staffan Larsen
+ *
+ *  @run build TestScaffold VMConnection TargetListener TargetAdapter
+ *  @run compile -g LambdaBreakpointTest.java
+ *  @run main LambdaBreakpointTest
+ */
+import java.util.List;
+
+import com.sun.jdi.LocalVariable;
+import com.sun.jdi.Location;
+import com.sun.jdi.Method;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.StackFrame;
+import com.sun.jdi.StringReference;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.event.BreakpointEvent;
+import com.sun.jdi.event.StepEvent;
+
+ /********** target program **********/
+
+class LambdaBreakpointTestTarg {
+
+    static int[] breakpointLines = {
+            62, 66, 63, 64, 65, 67
+    };
+
+    public static void main(String[] args) {
+        test();
+    }
+
+    private static void test() {
+        Runnable r = () -> {                          // B1: L62
+            String from = "lambda";                   // B3: L63
+            System.out.println("Hello from " + from); // B4: L64
+        };                                            // B5: L65
+        r.run();                                      // B2: L66
+        System.out.println("Goodbye.");               // B6: L67
+    }
+}
+
+
+ /********** test program **********/
+
+public class LambdaBreakpointTest extends TestScaffold {
+
+    LambdaBreakpointTest (String args[]) {
+        super(args);
+    }
+
+    public static void main(String[] args)
+        throws Exception
+    {
+        new LambdaBreakpointTest (args).startTests();
+    }
+
+    /********** test core **********/
+
+    protected void runTests()
+        throws Exception
+    {
+        startToMain("LambdaBreakpointTestTarg");
+
+        // Put a breakpoint on each location in the order they should happen
+        for (int line : LambdaBreakpointTestTarg.breakpointLines) {
+            System.out.println("Running to line: " + line);
+            BreakpointEvent be = resumeTo("LambdaBreakpointTestTarg", line);
+            int stoppedAt = be.location().lineNumber();
+            System.out.println("Stopped at line: " + stoppedAt);
+            if (stoppedAt != line) {
+                throw new Exception("Stopped on the wrong line: "
+                        + stoppedAt + " != " + line);
+            }
+        }
+
+        /*
+         * resume the target listening for events
+         */
+        listenUntilVMDisconnect();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/LambdaStepTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ *  @test
+ *  @summary Test stepping through lambdas
+ *
+ *  @author Staffan Larsen
+ *
+ *  @run build TestScaffold VMConnection TargetListener TargetAdapter
+ *  @run compile -g LambdaStepTest.java
+ *  @run main LambdaStepTest
+ */
+import com.sun.jdi.LocalVariable;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.StackFrame;
+import com.sun.jdi.StringReference;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.event.BreakpointEvent;
+import com.sun.jdi.event.StepEvent;
+
+ /********** target program **********/
+
+interface DefaultTest {
+    default void defaultMethod() {
+        String from = "default";
+        System.out.println("Hello from " + from);
+    }
+}
+class LambdaStepTestTarg implements DefaultTest {
+    private void test() {
+        String from = "test";
+        System.out.println("Hello from " + from);
+    }
+    private static void instanceTest() {
+        LambdaStepTestTarg l = new LambdaStepTestTarg();
+        l.test();
+    }
+    private static void lambdaTest() {
+        Runnable r = () -> {
+            String from = "lambda";
+            System.out.println("Hello from " + from);
+        };
+        r.run();
+    }
+    private static void defaultTest() {
+        LambdaStepTestTarg l = new LambdaStepTestTarg();
+        l.defaultMethod();
+    }
+    public static void main(String[] args) {
+        instanceTest();
+        lambdaTest();
+        defaultTest();
+        System.out.println("Goodbye from LambdaStepTestTarg!");
+    }
+}
+
+
+ /********** test program **********/
+
+public class LambdaStepTest extends TestScaffold {
+    LambdaStepTest (String args[]) {
+        super(args);
+    }
+
+    public static void main(String[] args)
+        throws Exception
+    {
+        new LambdaStepTest (args).startTests();
+    }
+
+    /********** test core **********/
+
+    protected void runTests()
+        throws Exception
+    {
+        // ## Normal instance method
+
+        BreakpointEvent bpe = startTo("LambdaStepTestTarg", "instanceTest", "()V");
+        ThreadReference thread = bpe.thread();
+
+        // step over allocation
+        StepEvent se = stepOverLine(thread);
+        System.out.println(se.thread().frame(0));
+
+        // step into test();
+        se = stepIntoLine(thread);
+        System.out.println(se.thread().frame(0));
+
+        // step over variable initialization
+        se = stepOverLine(thread);
+        System.out.println(se.thread().frame(0));
+
+        // get value of variable "from"
+        StackFrame frame = se.thread().frame(0);
+        LocalVariable lv = frame.visibleVariableByName("from");
+        System.out.println(lv);
+        StringReference sr = (StringReference) frame.getValue(lv);
+        if (!sr.value().equals("test")) {
+            throw new Exception("Unexpected variable value in instanceTest: "+sr.value());
+        }
+
+
+        // ## Lambda method
+
+        bpe = resumeTo("LambdaStepTestTarg", "lambdaTest", "()V");
+        thread = bpe.thread();
+
+        // step over allocation
+        se = stepOverLine(thread);
+        System.out.println(se.thread().frame(0));
+
+        // step into run() of the lambda
+        se = stepIntoLine(thread);
+        System.out.println(se.thread().frame(0));
+
+        // step over variable initialization
+        se = stepOverLine(thread);
+        System.out.println(se.thread().frame(0));
+
+        // get value of variable "from"
+        frame = se.thread().frame(0);
+        lv = frame.visibleVariableByName("from");
+        System.out.println(lv);
+        sr = (StringReference) frame.getValue(lv);
+        if (!sr.value().equals("lambda")) {
+            throw new Exception("Unexpected variable value in lambdaTest: "+sr.value());
+        }
+
+
+        // ## Default method
+
+        bpe = resumeTo("LambdaStepTestTarg", "defaultTest", "()V");
+        thread = bpe.thread();
+
+        // step over allocation
+        se = stepOverLine(thread);
+        System.out.println(se.thread().frame(0));
+
+        // step into defaultMethod()
+        se = stepIntoLine(thread);
+        System.out.println(se.thread().frame(0));
+
+        // step over variable initialization
+        se = stepOverLine(thread);
+        System.out.println(se.thread().frame(0));
+
+        // get value of variable "from"
+        frame = se.thread().frame(0);
+        lv = frame.visibleVariableByName("from");
+        System.out.println(lv);
+        sr = (StringReference) frame.getValue(lv);
+        if (!sr.value().equals("default")) {
+            throw new Exception("Unexpected variable value in lambdaTest: "+sr.value());
+        }
+
+
+        /*
+         * resume the target listening for events
+         */
+        listenUntilVMDisconnect();
+
+    }
+}
--- a/jdk/test/com/sun/jdi/MethodEntryExitEvents.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/com/sun/jdi/MethodEntryExitEvents.java	Wed Jul 05 19:21:26 2017 +0200
@@ -108,14 +108,11 @@
     final int expectedExitCount = 1 + (15 * 3);
     int methodExitCount = 0;
 
-    /*
-     * Class patterns for which we don't want events (copied
-     * from the "Trace.java" example):
-     *     http://java.sun.com/javase/technologies/core/toolsapis/jpda/
-     */
-    private String[] excludes = {"java.*", "javax.*", "sun.*",
-                                 "com.sun.*", "com.oracle.*",
-                                 "oracle.*", "jdk.internal.*"};
+    // Classes which we are interested in
+    private List includes = Arrays.asList(new String[] {
+        "MethodEntryExitEventsDebugee",
+        "t2"
+    });
 
     MethodEntryExitEvents (String args[]) {
         super(args);
@@ -161,6 +158,10 @@
         str.disable();
     }
     public void methodEntered(MethodEntryEvent event) {
+        if (!includes.contains(event.method().declaringType().name())) {
+            return;
+        }
+
         if (! finishedCounting) {
             // We have to count the entry to loopComplete, but
             // not the exit
@@ -176,6 +177,10 @@
     }
 
     public void methodExited(MethodExitEvent event) {
+        if (!includes.contains(event.method().declaringType().name())) {
+            return;
+        }
+
         if (! finishedCounting){
             methodExitCount++;
             System.out.print  (" Method exit  number: ");
@@ -214,6 +219,10 @@
         connect((String[]) argList.toArray(args2));
         waitForVMStart();
 
+        // Determine main thread
+        ClassPrepareEvent e = resumeToPrepareOf("MethodEntryExitEventsDebugee");
+        mainThread = e.thread();
+
         try {
 
             /*
@@ -223,6 +232,7 @@
                 eventRequestManager().createExceptionRequest(null, // refType (null == all instances)
                                                              true, // notifyCaught
                                                              true);// notifyUncaught
+            exceptionRequest.addThreadFilter(mainThread);
             exceptionRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL);
             exceptionRequest.enable();
 
@@ -231,9 +241,7 @@
              */
             MethodEntryRequest entryRequest =
                eventRequestManager().createMethodEntryRequest();
-            for (int i=0; i<excludes.length; ++i) {
-                entryRequest.addClassExclusionFilter(excludes[i]);
-            }
+            entryRequest.addThreadFilter(mainThread);
             entryRequest.setSuspendPolicy(sessionSuspendPolicy);
             entryRequest.enable();
 
@@ -242,10 +250,7 @@
              */
             MethodExitRequest exitRequest =
                 eventRequestManager().createMethodExitRequest();
-
-            for (int i=0; i<excludes.length; ++i) {
-                exitRequest.addClassExclusionFilter(excludes[i]);
-            }
+            exitRequest.addThreadFilter(mainThread);
             exitRequest.setSuspendPolicy(sessionSuspendPolicy);
             exitRequest.enable();
 
--- a/jdk/test/com/sun/jdi/MethodExitReturnValuesTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/com/sun/jdi/MethodExitReturnValuesTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -209,18 +209,13 @@
 
 
 public class MethodExitReturnValuesTest extends TestScaffold {
-
-    /*
-     * Class patterns for which we don't want events (copied
-     * from the "Trace.java" example):
-     *     http://java.sun.com/javase/technologies/core/toolsapis/jpda/
-     */
-    private String[] excludes = {
-        "javax.*",
-        "sun.*",
-        "com.sun.*",
-        "com.oracle.*",
-        "oracle.*"};
+    // Classes which we are interested in
+    private List includes = Arrays.asList(new String[] {
+        "MethodExitReturnValuesTarg",
+        "java.lang.reflect.Array",
+        "java.lang.StrictMath",
+        "java.lang.String"
+    });
 
     static VirtualMachineManager vmm ;
     ClassType targetClass;
@@ -487,6 +482,11 @@
     // This is the MethodExitEvent handler.
     public void methodExited(MethodExitEvent event) {
         String origMethodName = event.method().name();
+
+        if (!includes.contains(event.method().declaringType().name())) {
+            return;
+        }
+
         if (vmm.majorInterfaceVersion() >= 1 &&
             vmm.minorInterfaceVersion() >= 6 &&
             vm().canGetMethodReturnValues()) {
@@ -560,10 +560,8 @@
          */
         MethodExitRequest exitRequest =
             eventRequestManager().createMethodExitRequest();
+        exitRequest.addThreadFilter(mainThread);
 
-        for (int i=0; i<excludes.length; ++i) {
-            exitRequest.addClassExclusionFilter(excludes[i]);
-        }
         int sessionSuspendPolicy = EventRequest.SUSPEND_ALL;
         //sessionSuspendPolicy = EventRequest.SUSPEND_EVENT_THREAD;
         //sessionSuspendPolicy = EventRequest.SUSPEND_NONE;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/NullThreadGroupNameTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ *  @test
+ *  @bug 7105883
+ *  @summary Ensure that JDWP doesn't crash with a null thread group name
+ *
+ *  @run build TestScaffold VMConnection TargetListener TargetAdapter
+ *  @run main NullThreadGroupNameTest
+ */
+import com.sun.jdi.*;
+import com.sun.jdi.connect.*;
+import com.sun.jdi.event.*;
+import com.sun.jdi.request.*;
+import com.sun.jdi.VMDisconnectedException;
+import java.util.concurrent.CountDownLatch;
+import java.util.*;
+
+class DebugTarget {
+    public final static String DEBUG_THREAD_NAME = "DebugThread";
+
+    public static void main(String[] args) throws Exception {
+        DebugThread thread = new DebugThread();
+        thread.start();
+        thread.runningLatch.await();
+        breakpointHere();
+        thread.breakpointLatch.countDown();
+    }
+
+    public static void breakpointHere() {
+        System.out.println("Breakpoint finished!");
+    }
+
+    static class DebugThread extends Thread {
+        final CountDownLatch runningLatch = new CountDownLatch(1);
+        final CountDownLatch breakpointLatch = new CountDownLatch(1);
+
+        public DebugThread() {
+            super(new ThreadGroup(null), DEBUG_THREAD_NAME);
+        }
+
+        public void run() {
+            runningLatch.countDown();
+            try {
+                breakpointLatch.await();
+            } catch (InterruptedException ie) {
+                ie.printStackTrace();
+            }
+        }
+    }
+}
+
+public class NullThreadGroupNameTest extends TestScaffold {
+
+    NullThreadGroupNameTest(String args[]) {
+        super(args);
+    }
+
+    public static void main(String[] args) throws Exception {
+        new NullThreadGroupNameTest(args).startTests();
+    }
+
+    protected void runTests() throws Exception {
+        startTo("DebugTarget", "breakpointHere", "()V");
+
+        ThreadReference thread = findThread(DebugTarget.DEBUG_THREAD_NAME);
+        assertThreadGroupName(thread.threadGroup(), "");
+
+        listenUntilVMDisconnect();
+    }
+
+    private ThreadReference findThread(String name) {
+        for (ThreadReference thread : vm().allThreads()) {
+            if (name.equals(thread.name())) {
+                return thread;
+            }
+        }
+        throw new NoSuchElementException("Couldn't find " + name);
+    }
+
+    private void assertThreadGroupName(ThreadGroupReference threadGroup, String expectedName) {
+        try {
+            String name = threadGroup.name();
+            if (!expectedName.equals(name)) {
+                throw new AssertionError("Unexpected thread group name '" + name + "'");
+            }
+        } catch (VMDisconnectedException vmde) {
+            throw new AssertionError("Likely JVM crash with null thread group name", vmde);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jmx/snmp/NoInfoLeakTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8026028
+ * @summary Tests no leak of internal info
+ * @author Shanliang JIANG
+ * @run clean NoInfoLeakTest
+ * @run build NoInfoLeakTest
+ * @run main NoInfoLeakTest
+ */
+
+import com.sun.jmx.snmp.SnmpString;
+import com.sun.jmx.snmp.agent.SnmpMib;
+import com.sun.jmx.snmp.agent.SnmpMibTable;
+import com.sun.jmx.snmp.daemon.CommunicatorServer;
+import com.sun.jmx.snmp.daemon.SnmpAdaptorServer;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+public class NoInfoLeakTest {
+    public static void main(String[] args) throws Exception {
+        boolean ok = true;
+        ok &= snmpStringTest();
+        ok &= snmpMibTest();
+        ok &= communicatorServerTest();
+
+        if (!ok) {
+            throw new RuntimeException("Some tests are failed!");
+        }
+    }
+
+    private static boolean snmpStringTest() {
+        System.out.println("\n---NoInfoLeakTest-snmpStringTest: testing the method byteValue()...");
+        boolean passed = true;
+
+        byte[] mine = new byte[]{1,1,1,};
+        SnmpString ss = new SnmpString(mine);
+        byte[] got = ss.byteValue();
+        got[0]=0;
+
+        if (ss.byteValue()[0] == 0) {
+            System.err.println("Failed: SnmpString.byteValue() returns an internal mutable object value");
+            passed = false;
+        } else {
+            System.out.println("---NoInfoLeakTest-snmpStringTest done.");
+        }
+        return passed;
+    }
+
+    private static boolean snmpMibTest() {
+        boolean passed = true;
+        System.out.println("\n---NoInfoLeakTest-snmpMibTest: testing the method "
+                + "SnmpMib.getRootOid()...");
+        SnmpMib mib = new MySnmpMib();
+
+        if (mib.getRootOid() == mib.getRootOid()) {
+            System.err.println("Failed: SnmpMib.getRootOid() returns an internal"
+                    + " mutable object value "+mib.getRootOid());
+        } else {
+            System.out.println("---NoInfoLeakTest-snmpMibTest done.");
+        }
+        return passed;
+    }
+
+    private static boolean communicatorServerTest() {
+        boolean passed = true;
+        System.out.println("\n---NoInfoLeakTest-communicatorServerTest: testing the method CommunicatorServer.getNotificationInfo()...");
+        CommunicatorServer server = new SnmpAdaptorServer();
+        MBeanNotificationInfo[] notifs = server.getNotificationInfo();
+
+        assert notifs.length > 0 && notifs[0] != null; // the current implementation ensures this
+        notifs[0] = null;
+        if (server.getNotificationInfo()[0] == null) {
+            System.err.println("Failed: CommunicatorServer.getNotificationInfo()"
+                    + " returns an internal mutable object value");
+            passed = false;
+        } else {
+            System.out.println("---NoInfoLeakTest-communicatorServerTest done.");
+        }
+        return passed;
+    }
+
+    private static class MySnmpMib extends SnmpMib {
+        @Override
+        public void registerTableMeta(String name, SnmpMibTable table) {
+            throw new UnsupportedOperationException("Not supported yet.");
+        }
+
+        @Override
+        public SnmpMibTable getRegisteredTableMeta(String name) {
+            throw new UnsupportedOperationException("Not supported yet.");
+        }
+
+        @Override
+        public void init() throws IllegalAccessException {
+            throw new UnsupportedOperationException("Not supported yet.");
+        }
+
+        @Override
+        public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
+            throw new UnsupportedOperationException("Not supported yet.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Frame/MaximizedByPlatform/MaximizedByPlatform.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8026143
+ * @summary [macosx] Maximized state could be inconsistent between peer and frame
+ * @author Petr Pchelko
+ * @run main MaximizedByPlatform
+ */
+
+import sun.awt.OSInfo;
+import sun.awt.SunToolkit;
+
+import java.awt.*;
+
+public class MaximizedByPlatform {
+    private static Frame frame;
+    private static Rectangle availableScreenBounds;
+
+    public static void main(String[] args) {
+        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+            // Test only for macosx. Pass
+            return;
+        }
+
+        availableScreenBounds = getAvailableScreenBounds();
+
+        // Test 1. The maximized state is set in setBounds
+        try {
+            frame = new Frame();
+            frame.setBounds(100, 100, 100, 100);
+            frame.setVisible(true);
+
+            ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+
+            frame.setBounds(availableScreenBounds.x, availableScreenBounds.y,
+                    availableScreenBounds.width, availableScreenBounds.height);
+
+            ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+
+            if (frame.getExtendedState() != Frame.MAXIMIZED_BOTH) {
+                throw new RuntimeException("Maximized state was not set for frame in setBounds");
+            }
+        } finally {
+            frame.dispose();
+        }
+
+
+        // Test 2. The maximized state is set in setVisible
+        try {
+            frame = new Frame();
+            frame.setBounds(availableScreenBounds.x, availableScreenBounds.y,
+                    availableScreenBounds.width + 100, availableScreenBounds.height);
+            frame.setVisible(true);
+
+            ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+
+            if (frame.getExtendedState() != Frame.MAXIMIZED_BOTH) {
+                throw new RuntimeException("Maximized state was not set for frame in setVisible");
+            }
+        } finally {
+            frame.dispose();
+        }
+    }
+
+    private static Rectangle getAvailableScreenBounds() {
+        final Toolkit toolkit = Toolkit.getDefaultToolkit();
+        final GraphicsEnvironment graphicsEnvironment =
+                GraphicsEnvironment.getLocalGraphicsEnvironment();
+        final GraphicsDevice graphicsDevice =
+                graphicsEnvironment.getDefaultScreenDevice();
+
+        final Dimension screenSize = toolkit.getScreenSize();
+        final Insets screenInsets = toolkit.getScreenInsets(
+                graphicsDevice.getDefaultConfiguration());
+
+        final Rectangle availableScreenBounds = new Rectangle(screenSize);
+
+        availableScreenBounds.x += screenInsets.left;
+        availableScreenBounds.y += screenInsets.top;
+        availableScreenBounds.width -= (screenInsets.left + screenInsets.right);
+        availableScreenBounds.height -= (screenInsets.top + screenInsets.bottom);
+        return availableScreenBounds;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FullScreen/8013581/bug8013581.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8013581
+ * @summary [macosx] Key Bindings break with awt GraphicsEnvironment setFullScreenWindow
+ * @author leonid.romanov@oracle.com
+ * @run main bug8013581
+ */
+
+import sun.awt.*;
+import java.awt.*;
+import java.awt.event.*;
+
+public class bug8013581 {
+    private static Frame frame;
+    private static volatile int listenerCallCounter = 0;
+
+    public static void main(String[] args) throws Exception {
+        final GraphicsEnvironment ge = GraphicsEnvironment
+                .getLocalGraphicsEnvironment();
+        final GraphicsDevice[] devices = ge.getScreenDevices();
+
+        final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
+        final Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        createAndShowGUI();
+        toolkit.realSync();
+
+        Exception error = null;
+        for (final GraphicsDevice device : devices) {
+            if (!device.isFullScreenSupported()) {
+                continue;
+            }
+
+            device.setFullScreenWindow(frame);
+            sleep();
+
+            robot.keyPress(KeyEvent.VK_A);
+            robot.keyRelease(KeyEvent.VK_A);
+            toolkit.realSync();
+
+            device.setFullScreenWindow(null);
+            sleep();
+
+            if (listenerCallCounter != 2) {
+                error = new Exception("Test failed: KeyListener called " + listenerCallCounter + " times instead of 2!");
+                break;
+            }
+
+            listenerCallCounter = 0;
+        }
+
+        frame.dispose();
+
+        if (error != null) {
+            throw error;
+        }
+     }
+
+    private static void createAndShowGUI() {
+        frame = new Frame("Test");
+        frame.addKeyListener(new KeyAdapter() {
+            @Override
+            public void keyPressed(KeyEvent e) {
+                listenerCallCounter++;
+            }
+
+            @Override
+            public void keyReleased(KeyEvent e) {
+                listenerCallCounter++;
+            }
+        });
+
+        frame.setUndecorated(true);
+        frame.setVisible(true);
+    }
+
+    private static void sleep() {
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        try {
+            Thread.sleep(2000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GradientPaint/GradientTransformTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.MultipleGradientPaint.*;
+import java.awt.geom.*;
+import java.awt.image.*;
+
+/**
+ * @test
+ * @bug 8023483
+ * @summary tests if the transform-parameter is applied correctly when creating
+ *          a gradient.
+ * @author ceisserer
+ */
+public class GradientTransformTest extends Frame {
+    BufferedImage srcImg;
+    Image dstImg;
+
+    public GradientTransformTest() {
+        srcImg = createSrcImage();
+        dstImg = getGraphicsConfiguration().createCompatibleVolatileImage(20,
+                20);
+    }
+
+    protected void renderToVI(BufferedImage src, Image dst) {
+        Graphics2D g = (Graphics2D) dst.getGraphics();
+
+        g.setColor(Color.WHITE);
+        g.fillRect(0, 0, dst.getWidth(null), dst.getHeight(null));
+
+        AffineTransform at = new AffineTransform();
+        at.translate(-100, 0);
+
+        g.setPaint(new LinearGradientPaint(new Point2D.Float(100, 0),
+                new Point2D.Float(120, 0), new float[] { 0.0f, 0.75f, 1.0f },
+                new Color[] { Color.red, Color.green, Color.blue },
+                CycleMethod.NO_CYCLE, ColorSpaceType.SRGB, at));
+
+        g.fillRect(-10, -10, 30, 30);
+    }
+
+    public void paint(Graphics g1) {
+        Graphics2D g = (Graphics2D) g1;
+        renderToVI(createSrcImage(), dstImg);
+        g.drawImage(dstImg, 20, 20, null);
+    }
+
+    public void showFrame() {
+        setSize(500, 500);
+        setVisible(true);
+    }
+
+    public void test() {
+        renderToVI(createSrcImage(), dstImg);
+
+        BufferedImage validationImg = new BufferedImage(20, 20,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics2D valG = (Graphics2D) validationImg.getGraphics();
+        valG.drawImage(dstImg, 0, 0, null);
+
+        // Loop over all pixel, and count the different pixel values
+        // encountered.
+        boolean gradientTranslated = false;
+        for (int x = 0; x < validationImg.getWidth() && !gradientTranslated; x++) {
+            for (int y = 0; y < validationImg.getHeight()
+                    && !gradientTranslated; y++) {
+                int rgb = validationImg.getRGB(x, y);
+                if (rgb != -65279) {
+                    gradientTranslated = true;
+                }
+            }
+        }
+
+        if (gradientTranslated) {
+            System.out.println("Passed!");
+        } else {
+            throw new RuntimeException("Test FAILED!");
+        }
+    }
+
+    protected BufferedImage createSrcImage() {
+        BufferedImage bi = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g = (Graphics2D) bi.getGraphics();
+        g.setColor(Color.YELLOW);
+        g.fillRect(0, 0, 10, 10);
+        g.setColor(Color.black);
+        g.drawLine(0, 0, 10, 10);
+        return bi;
+    }
+
+    public static void main(String[] args) throws Exception {
+        boolean show = (args.length > 0 && "-show".equals(args[0]));
+        final GradientTransformTest t = new GradientTransformTest();
+
+        if (show) {
+            EventQueue.invokeAndWait(new Runnable() {
+                public void run() {
+                    t.showFrame();
+                }
+            });
+        } else {
+            t.test();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GradientPaint/LinearColorSpaceGradientTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.MultipleGradientPaint.*;
+import java.awt.geom.*;
+import java.awt.image.*;
+
+/**
+ * @test
+ * @bug 8023483
+ * @summary tests wether the colorspace-parameter is applied correctly when
+ *          creating a gradient.
+ * @author ceisserer
+ */
+public class LinearColorSpaceGradientTest extends Frame {
+    BufferedImage srcImg;
+    Image dstImg;
+
+    public LinearColorSpaceGradientTest() {
+        srcImg = createSrcImage();
+        dstImg = getGraphicsConfiguration().createCompatibleVolatileImage(20,
+                20);
+    }
+
+    protected void renderToVI(BufferedImage src, Image dst) {
+        Graphics2D g = (Graphics2D) dst.getGraphics();
+
+        g.setColor(Color.WHITE);
+        g.fillRect(0, 0, dst.getWidth(null), dst.getHeight(null));
+
+        AffineTransform at = new AffineTransform();
+        g.setPaint(new LinearGradientPaint(new Point2D.Float(0, 0),
+                new Point2D.Float(20, 0), new float[] { 0.0f, 1.0f },
+                new Color[] { Color.green, Color.blue }, CycleMethod.NO_CYCLE,
+                ColorSpaceType.LINEAR_RGB, at));
+
+        g.fillRect(-10, -10, 30, 30);
+    }
+
+    public void paint(Graphics g1) {
+        Graphics2D g = (Graphics2D) g1;
+        renderToVI(createSrcImage(), dstImg);
+        g.drawImage(dstImg, 20, 20, null);
+    }
+
+    public void showFrame() {
+        setSize(500, 500);
+        setVisible(true);
+    }
+
+    public void test() {
+        renderToVI(createSrcImage(), dstImg);
+
+        BufferedImage validationImg = new BufferedImage(20, 20,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics2D valG = (Graphics2D) validationImg.getGraphics();
+        valG.drawImage(dstImg, 0, 0, null);
+
+        int b = validationImg.getRGB(10, 10) & 0x000000FF;
+
+        if (b > 150) {
+            System.out.println("Passed!");
+        } else {
+            throw new RuntimeException("Test FAILED!");
+        }
+    }
+
+    protected BufferedImage createSrcImage() {
+        BufferedImage bi = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g = (Graphics2D) bi.getGraphics();
+        g.setColor(Color.YELLOW);
+        g.fillRect(0, 0, 10, 10);
+        g.setColor(Color.black);
+        g.drawLine(0, 0, 10, 10);
+        return bi;
+    }
+
+    public static void main(String[] args) throws Exception {
+        boolean show = (args.length > 0 && "-show".equals(args[0]));
+
+        final LinearColorSpaceGradientTest t = new LinearColorSpaceGradientTest();
+        if (show) {
+            EventQueue.invokeAndWait(new Runnable() {
+                public void run() {
+                    t.showFrame();
+                }
+            });
+        } else {
+            t.test();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/InputMethods/DiacriticsTest/DiacriticsTest.html	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,45 @@
+<!--
+Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+
+<html>
+<head>
+<title> DiacriticsTest </title>
+</head>
+<body>
+<applet code="DiacriticsTest.class" width=350 height=200></applet>
+
+Test run requires the following keyboard layouts to be installed:
+Linux OS: English (US, alternative international)
+Windows OS: Hungarian
+
+To test JDK-8000423 fix (Linux only!):
+please switch to US alternative international layout and try to type diacritics
+(using the following combinations: `+e; `+u; etc.)
+
+To test JDK-7197619 fix (Windows only!):
+please switch to Hungarian keyboard layout and try to type diacritics 
+(Ctrl+Alt+2 e; Ctrl+Alt+2 E)
+
+If you can do that then the test is passed; otherwise failed.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/InputMethods/DiacriticsTest/DiacriticsTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+  @test
+  @bug 8000423 7197619 8025649
+  @summary Check if diacritical signs could be typed for TextArea and TextField
+  @run applet/manual=yesno DiacriticsTest.html
+*/
+
+
+import java.applet.Applet;
+import java.awt.*;
+import javax.swing.JPanel;
+
+
+public class DiacriticsTest extends Applet {
+
+    public void init() {
+        this.setLayout(new BorderLayout());
+    }
+
+    public void start() {
+
+        setSize(350, 200);
+
+        JPanel panel = new JPanel();
+        panel.setLayout(new GridLayout(2, 1));
+
+        TextArea txtArea = new TextArea();
+        panel.add(txtArea);
+
+        TextField txtField = new TextField();
+        panel.add(txtField);
+
+        add(panel, BorderLayout.CENTER);
+
+        validate();
+        setVisible(true);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.html	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,43 @@
+<html>
+<!--
+  Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ 
+  This code is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License version 2 only, as
+  published by the Free Software Foundation.
+ 
+  This code is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  version 2 for more details (a copy is included in the LICENSE file that
+  accompanied this code).
+ 
+  You should have received a copy of the GNU General Public License version
+  2 along with this work; if not, write to the Free Software Foundation,
+  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ 
+  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+  or visit www.oracle.com if you need additional information or have any
+  questions.
+ -->
+<!--  
+  @test
+  @bug 6299858
+  @summary PIT. Focused border not shown on List if selected item is removed, XToolkit
+  @author Dmitry.Cherepanov@SUN.COM area=awt.list
+  @run applet FirstItemRemoveTest.html
+  -->
+<head>
+<title>  </title>
+</head>
+<body>
+
+<h1>FirstItemRemoveTest<br>Bug ID: 6299858 </h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="FirstItemRemoveTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  test
+  @bug 6299858 7124338
+  @summary PIT. Focused border not shown on List if selected item is removed, XToolkit
+  @author Dmitry.Cherepanov@SUN.COM area=awt.list
+  @run applet FirstItemRemoveTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+
+public class FirstItemRemoveTest extends Applet
+{
+    List list = new List(4, false);
+    Panel panel = new Panel();
+
+    public void init()
+    {
+        list.add("000");
+        list.add("111");
+        list.add("222");
+        list.add("333");
+        list.add("444");
+        list.add("555");
+
+        panel.setLayout(new FlowLayout ());
+        panel.add(list);
+
+        this.add(panel);
+        this.setLayout (new FlowLayout ());
+    }//End  init()
+
+    public void start ()
+    {
+        setSize (200,200);
+        setVisible(true);
+        validate();
+
+        test();
+    }// start()
+
+    private void test(){
+
+        if (sun.awt.OSInfo.getOSType() == sun.awt.OSInfo.OSType.MACOSX) {
+            System.err.println("Skipped. This test is not for OS X.");
+            return;
+        }
+
+        Robot r;
+        try {
+            r = new Robot();
+        } catch(AWTException e) {
+            throw new RuntimeException(e.getMessage());
+        }
+
+        // Removing first item in order to reproduce incorrect behaviour
+        r.delay(1000);
+        list.remove(0);
+        r.delay(1000);
+
+        // Request focus to list
+        Point loc = this.getLocationOnScreen();
+        r.delay(1000);
+
+        r.mouseMove(loc.x+10, loc.y+10);
+        r.delay(10);
+        r.mousePress(InputEvent.BUTTON1_MASK);
+        r.delay(10);
+        r.mouseRelease(InputEvent.BUTTON1_MASK);
+        r.delay(1000);
+
+        list.requestFocusInWindow();
+        r.delay(1000);
+        r.waitForIdle();
+        if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != list){
+            throw new RuntimeException("Test failed - list isn't focus owner.");
+        }
+
+        // The focus index should be set to first item after removing
+        // So if we press VK_SPACE then the selected item will be equals 0.
+        r.delay(100);
+        r.keyPress(KeyEvent.VK_SPACE);
+        r.delay(10);
+        r.keyRelease(KeyEvent.VK_SPACE);
+        r.delay(1000);
+        r.waitForIdle();
+
+        int selectedIndex = list.getSelectedIndex();
+        if (selectedIndex != 0){
+            throw new RuntimeException("Test failed. list.getSelectedIndex() = "+selectedIndex);
+        }
+
+    }
+
+}// class AutomaticAppletTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Paint/ButtonRepaint.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.*;
+import java.awt.peer.ButtonPeer;
+
+/**
+ * @test
+ * @bug 7090424
+ * @author Sergey Bylokhov
+ */
+public final class ButtonRepaint extends Button {
+
+    public static void main(final String[] args) {
+        for (int i = 0; i < 10; ++i) {
+            final Frame frame = new Frame();
+            frame.setSize(300, 300);
+            frame.setLocationRelativeTo(null);
+            ButtonRepaint button = new ButtonRepaint();
+            frame.add(button);
+            frame.setVisible(true);
+            sleep();
+            button.test();
+            frame.dispose();
+        }
+    }
+
+    private static void sleep() {
+        try {
+            Thread.sleep(2000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+
+    @Override
+    public void paint(final Graphics g) {
+        super.paint(g);
+        if (!EventQueue.isDispatchThread()) {
+            throw new RuntimeException("Wrong thread");
+        }
+        test();
+    }
+
+    void test() {
+        setLabel("");
+        setLabel(null);
+        setLabel(getLabel());
+        ((ButtonPeer) getPeer()).setLabel("");
+        ((ButtonPeer) getPeer()).setLabel(null);
+        ((ButtonPeer) getPeer()).setLabel(getLabel());
+
+        setFont(null);
+        setFont(getFont());
+        getPeer().setFont(getFont());
+
+        setBackground(null);
+        setBackground(getBackground());
+        getPeer().setBackground(getBackground());
+
+        setForeground(null);
+        setForeground(getForeground());
+        getPeer().setForeground(getForeground());
+
+        setEnabled(isEnabled());
+        getPeer().setEnabled(isEnabled());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Paint/CheckboxRepaint.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.peer.CheckboxPeer;
+
+/**
+ * @test
+ * @bug 7090424
+ * @author Sergey Bylokhov
+ */
+public final class CheckboxRepaint extends Checkbox {
+
+    public static void main(final String[] args) {
+        for (int i = 0; i < 10; ++i) {
+            final Frame frame = new Frame();
+            frame.setSize(300, 300);
+            frame.setLocationRelativeTo(null);
+            CheckboxRepaint checkbox = new CheckboxRepaint();
+            frame.add(checkbox);
+            frame.setVisible(true);
+            sleep();
+            checkbox.test();
+            frame.dispose();
+        }
+    }
+
+    private static void sleep() {
+        try {
+            Thread.sleep(2000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+
+    @Override
+    public void paint(final Graphics g) {
+        super.paint(g);
+        if (!EventQueue.isDispatchThread()) {
+            throw new RuntimeException("Wrong thread");
+        }
+        test();
+    }
+
+    void test() {
+        setState(getState());
+        ((CheckboxPeer) getPeer()).setState(getState());
+
+        setCheckboxGroup(getCheckboxGroup());
+        ((CheckboxPeer) getPeer()).setCheckboxGroup(getCheckboxGroup());
+
+        setLabel("");
+        setLabel(null);
+        setLabel(getLabel());
+        ((CheckboxPeer) getPeer()).setLabel("");
+        ((CheckboxPeer) getPeer()).setLabel(null);
+        ((CheckboxPeer) getPeer()).setLabel(getLabel());
+
+        setFont(null);
+        setFont(getFont());
+        getPeer().setFont(getFont());
+
+        setBackground(null);
+        setBackground(getBackground());
+        getPeer().setBackground(getBackground());
+
+        setForeground(null);
+        setForeground(getForeground());
+        getPeer().setForeground(getForeground());
+
+        setEnabled(isEnabled());
+        getPeer().setEnabled(isEnabled());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Paint/ExposeOnEDT.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import sun.awt.SunToolkit;
+
+import java.awt.*;
+
+/**
+ * @test
+ * @bug 7090424
+ * @author Sergey Bylokhov
+ * @run main ExposeOnEDT
+ */
+public final class ExposeOnEDT {
+
+    private static final Button buttonStub = new Button() {
+        @Override
+        public void paint(final Graphics g) {
+            buttonPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Canvas canvasStub = new Canvas() {
+        @Override
+        public void paint(final Graphics g) {
+            canvasPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Checkbox checkboxStub = new Checkbox() {
+        @Override
+        public void paint(final Graphics g) {
+            checkboxPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Choice choiceStub = new Choice() {
+        @Override
+        public void paint(final Graphics g) {
+            choicePainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Component lwComponentStub = new Component() {
+        @Override
+        public void paint(final Graphics g) {
+            lwPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Container containerStub = new Container() {
+        @Override
+        public void paint(final Graphics g) {
+            containerPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Frame frame = new Frame() {
+        @Override
+        public void paint(final Graphics g) {
+            super.paint(g);
+            framePainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Label labelStub = new Label() {
+        @Override
+        public void paint(final Graphics g) {
+            labelPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final List listStub = new List() {
+        @Override
+        public void paint(final Graphics g) {
+            listPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Panel panelStub = new Panel() {
+        @Override
+        public void paint(final Graphics g) {
+            panelPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final Scrollbar scrollbarStub = new Scrollbar() {
+        @Override
+        public void paint(final Graphics g) {
+            scrollbarPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final ScrollPane scrollPaneStub = new ScrollPane() {
+        @Override
+        public void paint(final Graphics g) {
+            scrollPanePainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final TextArea textAreaStub = new TextArea() {
+        @Override
+        public void paint(final Graphics g) {
+            textAreaPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static final TextField textFieldStub = new TextField() {
+        @Override
+        public void paint(final Graphics g) {
+            textFieldPainted = true;
+            if (!EventQueue.isDispatchThread()) {
+                throw new RuntimeException("Wrong thread");
+            }
+        }
+    };
+    private static volatile boolean lwPainted;
+    private static volatile boolean buttonPainted;
+    private static volatile boolean canvasPainted;
+    private static volatile boolean checkboxPainted;
+    private static volatile boolean choicePainted;
+    private static volatile boolean containerPainted;
+    private static volatile boolean framePainted;
+    private static volatile boolean labelPainted;
+    private static volatile boolean listPainted;
+    private static volatile boolean panelPainted;
+    private static volatile boolean scrollbarPainted;
+    private static volatile boolean scrollPanePainted;
+    private static volatile boolean textAreaPainted;
+    private static volatile boolean textFieldPainted;
+
+    public static void main(final String[] args) throws Exception {
+        //Frame initialisation
+        frame.setLayout(new GridLayout());
+        frame.setSize(new Dimension(200, 200));
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+        sleep();
+
+        frame.add(buttonStub);
+        frame.add(canvasStub);
+        frame.add(checkboxStub);
+        frame.add(choiceStub);
+        frame.add(lwComponentStub);
+        frame.add(containerStub);
+        frame.add(labelStub);
+        frame.add(listStub);
+        frame.add(panelStub);
+        frame.add(scrollbarStub);
+        frame.add(scrollPaneStub);
+        frame.add(textAreaStub);
+        frame.add(textFieldStub);
+        frame.validate();
+        sleep();
+
+        // Force expose event from the native system.
+        initPaintedFlags();
+        frame.setSize(300, 300);
+        frame.validate();
+        sleep();
+
+        //Check results.
+        validation();
+
+        cleanup();
+    }
+
+    private static void initPaintedFlags() {
+        lwPainted = false;
+        buttonPainted = false;
+        canvasPainted = false;
+        checkboxPainted = false;
+        choicePainted = false;
+        containerPainted = false;
+        framePainted = false;
+        labelPainted = false;
+        listPainted = false;
+        panelPainted = false;
+        scrollbarPainted = false;
+        scrollPanePainted = false;
+        textAreaPainted = false;
+        textFieldPainted = false;
+    }
+
+    private static void validation() {
+        if (!buttonPainted) {
+            fail("Paint is not called a Button ");
+        }
+        if (!canvasPainted) {
+            fail("Paint is not called a Canvas ");
+        }
+        if (!checkboxPainted) {
+            fail("Paint is not called a Checkbox ");
+        }
+        if (!choicePainted) {
+            fail("Paint is not called a Choice ");
+        }
+        if (!lwPainted) {
+            fail("Paint is not called on a lightweight");
+        }
+        if (!containerPainted) {
+            fail("Paint is not called on a Container");
+        }
+        if (!labelPainted) {
+            fail("Paint is not called on a Label");
+        }
+        if (!listPainted) {
+            fail("Paint is not called on a List");
+        }
+        if (!panelPainted) {
+            fail("Paint is not called on a Panel");
+        }
+        if (!scrollbarPainted) {
+            fail("Paint is not called on a Scrollbar");
+        }
+        if (!scrollPanePainted) {
+            fail("Paint is not called on a ScrollPane");
+        }
+        if (!textAreaPainted) {
+            fail("Paint is not called on a TextArea");
+        }
+        if (!textFieldPainted) {
+            fail("Paint is not called on a TextField");
+        }
+        if (!framePainted) {
+            fail("Paint is not called on a Frame when paintAll()");
+        }
+    }
+
+    private static void sleep() {
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        try {
+            Thread.sleep(1000L);
+        } catch (InterruptedException ignored) {
+        }
+    }
+
+    private static void fail(final String message) {
+        cleanup();
+        throw new RuntimeException(message);
+    }
+
+    private static void cleanup() {
+        frame.dispose();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Paint/LabelRepaint.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Label;
+import java.awt.peer.LabelPeer;
+
+/**
+ * @test
+ * @bug 7090424
+ * @author Sergey Bylokhov
+ */
+public final class LabelRepaint extends Label {
+
+    public static void main(final String[] args) {
+        for (int i = 0; i < 10; ++i) {
+            final Frame frame = new Frame();
+            frame.setSize(300, 300);
+            frame.setLocationRelativeTo(null);
+            LabelRepaint label = new LabelRepaint();
+            frame.add(label);
+            frame.setVisible(true);
+            sleep();
+            label.test();
+            frame.dispose();
+        }
+    }
+
+    private static void sleep() {
+        try {
+            Thread.sleep(2000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+
+    @Override
+    public void paint(final Graphics g) {
+        super.paint(g);
+        if (!EventQueue.isDispatchThread()) {
+            throw new RuntimeException("Wrong thread");
+        }
+        test();
+    }
+
+    void test() {
+        setAlignment(getAlignment());
+        ((LabelPeer) getPeer()).setAlignment(getAlignment());
+
+        setText("");
+        setText(null);
+        setText(getText());
+        ((LabelPeer) getPeer()).setText("");
+        ((LabelPeer) getPeer()).setText(null);
+        ((LabelPeer) getPeer()).setText(getText());
+
+        setFont(null);
+        setFont(getFont());
+        getPeer().setFont(getFont());
+
+        setBackground(null);
+        setBackground(getBackground());
+        getPeer().setBackground(getBackground());
+
+        setForeground(null);
+        setForeground(getForeground());
+        getPeer().setForeground(getForeground());
+
+        setEnabled(isEnabled());
+        getPeer().setEnabled(isEnabled());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Paint/ListRepaint.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.List;
+import java.awt.peer.ListPeer;
+
+/**
+ * @test
+ * @bug 7090424
+ * @author Sergey Bylokhov
+ */
+public final class ListRepaint extends List {
+
+    public static void main(final String[] args) {
+        for (int i = 0; i < 10; ++i) {
+            final Frame frame = new Frame();
+            frame.setSize(300, 300);
+            frame.setLocationRelativeTo(null);
+            ListRepaint list = new ListRepaint();
+            list.add("1");
+            list.add("2");
+            list.add("3");
+            list.add("4");
+            list.select(0);
+            frame.add(list);
+            frame.setVisible(true);
+            sleep();
+            list.test();
+            frame.dispose();
+        }
+    }
+
+    private static void sleep() {
+        try {
+            Thread.sleep(2000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+
+    @Override
+    public void paint(final Graphics g) {
+        super.paint(g);
+        if (!EventQueue.isDispatchThread()) {
+            throw new RuntimeException("Wrong thread");
+        }
+        test();
+    }
+
+    void test() {
+        select(0);
+        ((ListPeer) getPeer()).select(getSelectedIndex());
+
+        setFont(null);
+        setFont(getFont());
+        getPeer().setFont(getFont());
+
+        setBackground(null);
+        setBackground(getBackground());
+        getPeer().setBackground(getBackground());
+
+        setForeground(null);
+        setForeground(getForeground());
+        getPeer().setForeground(getForeground());
+
+        setEnabled(isEnabled());
+        getPeer().setEnabled(isEnabled());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Paint/bug8024864.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8024864
+ * @summary [macosx] Problems with rendering of controls
+ * @author Petr Pchelko
+ * @library ../regtesthelpers
+ * @build Util
+ * @run main bug8024864
+ */
+
+import javax.swing.*;
+import java.awt.*;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class bug8024864
+{
+    private static final int REPEATS = 30;
+
+    private static volatile JFrame frame;
+
+    private static void showTestUI() {
+        frame = new JFrame();
+        frame.setBackground(Color.green);
+        JPanel p = new JPanel();
+        p.setBackground(Color.red);
+        JLabel l = new JLabel("Test!");
+        p.add(l);
+        frame.add(p);
+        frame.pack();
+        frame.setLocation(100,100);
+        frame.setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception
+    {
+        Robot r = new Robot();
+        for (int i = 0; i < REPEATS; i++) {
+            try {
+                SwingUtilities.invokeAndWait(bug8024864::showTestUI);
+                //Thread.sleep(100);
+                Util.waitTillShown(frame);
+                Util.waitForIdle(r);
+
+                Dimension frameSize = frame.getSize();
+                Point loc = new Point(frameSize.width - 5, frameSize.height - 5);
+                SwingUtilities.convertPointToScreen(loc, frame);
+                Color c = r.getPixelColor(loc.x, loc.y);
+
+                if (c.getGreen() > 200) {
+                    throw new RuntimeException("TEST FAILED. Unexpected pixel color " + c);
+                }
+
+            } finally {
+                if (frame != null) {
+                    frame.dispose();
+                }
+                Util.waitForIdle(r);
+            }
+        }
+    }
+}
--- a/jdk/test/java/awt/PrintJob/SaveDialogTitleTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/awt/PrintJob/SaveDialogTitleTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,8 @@
 
 /*
  * @test
- * @bug 4851363
- * @summary Tests the save to file dialog has a title
+ * @bug 4851363 8025988 8025990
+ * @summary Tests the save to file dialog has a title.
  * @run main/manual=yesno/othervm SaveDialogTitleTest
  */
 
@@ -37,12 +37,21 @@
         System.out.print("Once the dialog appears, press OK and the ");
         System.out.print("Save to File dialog should appear and it ");
         System.out.println("must have a window title else the test fails.");
+        System.out.println("To test 8025988: Range should be selected with pages 3 to 8.");
+        System.out.println("To test 8025990: Paper should be Legal and in Landscape.");
         Toolkit tk = Toolkit.getDefaultToolkit();
         JobAttributes jobAttributes = new JobAttributes();
         jobAttributes.setDestination(JobAttributes.DestinationType.FILE);
+        jobAttributes.setDefaultSelection(JobAttributes.DefaultSelectionType.RANGE);
+        jobAttributes.setPageRanges(new int[][]{new int[]{3,8}});
+        PageAttributes page = new PageAttributes();
+        page.setMedia(PageAttributes.MediaType.LEGAL);
+        page.setOrientationRequested(PageAttributes.
+                                        OrientationRequestedType.LANDSCAPE);
+
         PrintJob printJob =
             tk.getPrintJob(new Frame(), "Save Title Test",
-                           jobAttributes, null);
+                           jobAttributes, page);
         if (printJob != null) { // in case user cancels.
           printJob.end();
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/8027025/Test8027025.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8027025
+ * @summary [macosx] getLocationOnScreen returns 0 if parent invisible
+ * @author Petr Pchelko
+ * @run main Test8027025
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.concurrent.atomic.AtomicReference;
+
+public class Test8027025 {
+
+    private static Frame frame;
+    private static Window window;
+
+    public static void main(String[] args) throws Exception {
+        try {
+            SwingUtilities.invokeAndWait(() -> {
+                frame = new Frame("Dummy Frame");
+                window = new Window(frame);
+                window.setSize(200, 200);
+                window.setLocationRelativeTo(frame);
+                window.setVisible(true);
+            });
+
+            ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+
+            AtomicReference<Point> point = new AtomicReference<>();
+            SwingUtilities.invokeAndWait(() -> point.set(window.getLocationOnScreen()));
+
+            if (point.get().getX() == 0 || point.get().getY() == 0) {
+                throw new RuntimeException("Test failed. The location was not set");
+            }
+        } finally {
+            if (frame != null) {
+                frame.dispose();
+            }
+            if (window != null) {
+                window.dispose();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/OwnedWindowsSerialization/OwnedWindowsSerialization.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import java.awt.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+/* @test
+ * @bug 8027152
+ * @summary Checks that ownedWindowList is serialized and deserialized properly and alwaysOnTop works after deserialization
+ * @author Petr Pchelko
+ * @run main OwnedWindowsSerialization
+ */
+public class OwnedWindowsSerialization {
+
+    private static final String TOP_FRAME_LABEL = "Top Frame";
+    private static final String DIALOG_LABEL = "Dialog";
+    private static final String SUBDIALOG_LABEL = "Subdialog";
+
+    private static volatile Frame topFrame;
+    private static volatile Dialog dialog;
+    private static volatile Dialog subDialog;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            topFrame = new Frame(TOP_FRAME_LABEL);
+            topFrame.setAlwaysOnTop(true);
+            dialog = new Dialog(topFrame, DIALOG_LABEL);
+            subDialog = new Dialog(dialog, SUBDIALOG_LABEL);
+        });
+
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+
+        if (!topFrame.isAlwaysOnTop() || !dialog.isAlwaysOnTop() || !subDialog.isAlwaysOnTop()) {
+            throw new RuntimeException("TEST FAILED: AlwaysOnTop was not set properly");
+        }
+
+        //Serialize
+        byte[] serializedObject;
+        try (ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+             ObjectOutputStream outputStream = new ObjectOutputStream(bytes)) {
+            outputStream.writeObject(topFrame);
+            outputStream.flush();
+            serializedObject = bytes.toByteArray();
+        }
+
+        if (serializedObject == null) {
+            throw new RuntimeException("FAILED: Serialized byte array in null");
+        }
+
+        //Deserialize
+        Frame deserializedFrame;
+        try (ObjectInputStream inputStream = new ObjectInputStream(new ByteArrayInputStream(serializedObject))) {
+            deserializedFrame = (Frame) inputStream.readObject();
+        }
+
+        //Check the state of the deserialized objects
+        if (!TOP_FRAME_LABEL.equals(deserializedFrame.getTitle())) {
+            throw new RuntimeException("FAILED: Top frame deserialized incorrectly");
+        }
+
+        if (!deserializedFrame.isAlwaysOnTop()) {
+            throw new RuntimeException("FAILED: Top frame alwaysOnTop not set after deserialization");
+        }
+
+        Window[] topOwnedWindows = topFrame.getOwnedWindows();
+        if (topOwnedWindows.length != 1 || !DIALOG_LABEL.equals(((Dialog) topOwnedWindows[0]).getTitle())) {
+            throw new RuntimeException("FAILED: Dialog deserialized incorrectly");
+        }
+
+        if (!topOwnedWindows[0].isAlwaysOnTop()) {
+            throw new RuntimeException("FAILED: Dialog alwaysOnTop not set after deserialization");
+        }
+
+        Window dialog = topOwnedWindows[0];
+        Window[] dialogOwnedWindows = dialog.getOwnedWindows();
+        if (dialogOwnedWindows.length != 1 || !SUBDIALOG_LABEL.equals(((Dialog) dialogOwnedWindows[0]).getTitle())) {
+            throw new RuntimeException("FAILED: Subdialog deserialized incorrectly");
+        }
+
+        if (!dialogOwnedWindows[0].isAlwaysOnTop()) {
+            throw new RuntimeException("FAILED: Subdialog alwaysOnTop not set after deserialization");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/WindowGCInFullScreen/WindowGCInFullScreen.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Color;
+import java.awt.Frame;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.swing.SwingUtilities;
+
+/**
+ * @test
+ * @bug 8019591
+ * @author Sergey Bylokhov
+ */
+public class WindowGCInFullScreen {
+
+    public static void main(final String[] args)
+            throws InvocationTargetException, InterruptedException {
+        SwingUtilities.invokeAndWait(() -> {
+            final GraphicsDevice[] devices =
+                    GraphicsEnvironment.getLocalGraphicsEnvironment()
+                                       .getScreenDevices();
+            final Frame frame = new Frame();
+            frame.setBackground(Color.GREEN);
+            frame.setUndecorated(true);
+            frame.setSize(100, 100);
+            frame.setLocationRelativeTo(null);
+            frame.setVisible(true);
+            sleep();
+            for (final GraphicsDevice gd : devices) {
+                try {
+                    gd.setFullScreenWindow(frame);
+                    if (gd.getFullScreenWindow() != frame) {
+                        throw new RuntimeException("Wrong window");
+                    }
+                    if (frame.getGraphicsConfiguration().getDevice() != gd) {
+                        throw new RuntimeException("Wrong new GraphicsDevice");
+                    }
+                } finally {
+                    // cleaning up
+                    gd.setFullScreenWindow(null);
+                }
+            }
+            frame.dispose();
+        });
+    }
+
+    private static void sleep() {
+        try {
+            Thread.sleep(1000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/KeyEvent/8020209/bug8020209.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8020209
+ * @summary [macosx] Mac OS X key event confusion for "COMMAND PLUS"
+ * @author leonid.romanov@oracle.com
+ * @run main bug8020209
+ */
+
+import sun.awt.*;
+import java.awt.*;
+import java.awt.event.*;
+
+public class bug8020209 {
+    static volatile int listenerCallCounter = 0;
+
+    static AWTKeyStroke keyStrokes[] = {
+        AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_DECIMAL,  InputEvent.META_MASK),
+        AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_EQUALS,   InputEvent.META_MASK),
+        AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_ESCAPE,   InputEvent.CTRL_MASK),
+    };
+
+    public static void main(String[] args) throws Exception {
+        if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) {
+            System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
+            return;
+        }
+
+        System.setProperty("apple.laf.useScreenMenuBar", "true");
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        createAndShowGUI();
+        toolkit.realSync();
+
+        for (int i = 0; i < keyStrokes.length; ++i) {
+            AWTKeyStroke ks = keyStrokes[i];
+
+            int modKeyCode = getModKeyCode(ks.getModifiers());
+            robot.keyPress(modKeyCode);
+
+            robot.keyPress(ks.getKeyCode());
+            robot.keyRelease(ks.getKeyCode());
+
+            robot.keyRelease(modKeyCode);
+
+            toolkit.realSync();
+
+            if (listenerCallCounter != 4) {
+                throw new Exception("Test failed: KeyListener for '" + ks.toString() +
+                        "' called " + listenerCallCounter + " times instead of 4!");
+            }
+
+            listenerCallCounter = 0;
+        }
+
+    }
+
+    private static void createAndShowGUI() {
+        Frame frame = new Frame("Test");
+        frame.addKeyListener(new KeyAdapter() {
+            @Override
+            public void keyPressed(KeyEvent e) {
+                listenerCallCounter++;
+            }
+
+            @Override
+            public void keyReleased(KeyEvent e) {
+                listenerCallCounter++;
+            }
+        });
+
+        frame.pack();
+        frame.setVisible(true);
+    }
+
+    private static int getModKeyCode(int mod) {
+        if ((mod & (InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK)) != 0) {
+            return KeyEvent.VK_SHIFT;
+        }
+
+        if ((mod & (InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK)) != 0) {
+            return KeyEvent.VK_CONTROL;
+        }
+
+        if ((mod & (InputEvent.ALT_DOWN_MASK | InputEvent.ALT_MASK)) != 0) {
+            return KeyEvent.VK_ALT;
+        }
+
+        if ((mod & (InputEvent.META_DOWN_MASK | InputEvent.META_MASK)) != 0) {
+            return KeyEvent.VK_META;
+        }
+
+        return 0;
+    }
+}
--- a/jdk/test/java/awt/print/PrinterJob/PrintLatinCJKTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/awt/print/PrinterJob/PrintLatinCJKTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 800535
+ * @bug 800535 8022536
  * @summary JDK7 Printing: CJK and Latin Text in string overlap
  * @run main/manual=yesno PrintLatinCJKTest
  */
@@ -49,6 +49,8 @@
     private PageFormat pf;
 
     static String info =
+       "To test 8022536, if a remote printer is the system default,"+
+       "it should show in the dialog as the selected printer.\n"+
        "You need a printer for this test. If you have none, let "+
        "the test pass. If there is a printer, press Print, send "+
        "the output to the printer, and examine it. It should have "+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/PrinterJob/PrintToDir.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 4973278 8015586
+   @run main PrintToDir
+   @summary Must throw exception when printing to an invalid filename - a dir.
+*/
+import java.io.*;
+import java.net.*;
+import java.awt.*;
+import java.awt.geom.*;
+import java.awt.print.*;
+import javax.print.PrintService;
+import javax.print.attribute.*;
+import javax.print.attribute.standard.*;
+import java.util.PropertyPermission;
+
+public class PrintToDir extends Frame implements Printable {
+
+    boolean firstTime = true;
+    double sx, sy;
+    Shape clip, firstClip;
+
+    TextField tf = new TextField();
+    Label tfLabel = new Label ("File Name");
+    Panel p = new Panel (new GridLayout(2,2));
+    Button b = new Button("Print");
+
+    PrintToDir() {
+        add("South", p);
+        p.add(tfLabel);
+        p.add(tf);
+        p.add(b);
+        setSize(300, 300);
+        setVisible(true);
+    }
+
+    public int print(Graphics g, PageFormat pf, int pageIndex)  {
+        Graphics2D g2 = (Graphics2D)g;
+        if (pageIndex>=1) {
+                return Printable.NO_SUCH_PAGE;
+        }
+        g2.drawString("hello world", 100, 100);
+        return Printable.PAGE_EXISTS;
+    }
+
+    void doPrintJob(String fileStr) {
+        PageAttributes pa = new PageAttributes();
+        JobAttributes ja = new JobAttributes();
+        ja.setDialog(JobAttributes.DialogType.NONE);
+        ja.setDestination(JobAttributes.DestinationType.FILE);
+        ja.setFileName(fileStr);
+        try {
+            PrintJob pjob = Toolkit.getDefaultToolkit().getPrintJob(this,
+                                        "PrintDialog Testing", ja, pa);
+            if (pjob != null) {
+                System.out.println("Printjob successfully created: " + pjob);
+                Graphics g = pjob.getGraphics();
+                this.printAll(g);
+                g.dispose();
+                pjob.end();
+            }
+            System.out.println("Printing completed");
+        } catch (IllegalArgumentException e) {
+            System.out.println("PrintJob passed.");
+            return;
+        }
+        throw new RuntimeException("PrintJob::IllegalArgumentException expected but not thrown. \nTEST FAILED");
+    }
+
+    public static void doPrinterJob(String fileStr, OrientationRequested o) {
+        PrinterJob  pj = PrinterJob.getPrinterJob();
+        PrintService ps = pj.getPrintService();
+        if (ps == null) {
+          System.out.println("No print service found.");
+          return;
+        }
+        pj.setPrintable(new PrintToDir());
+        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
+        aset.add(o);
+        File f = new File(fileStr);
+        //      f.deleteOnExit();
+        URI dest = f.toURI();
+        Destination d = new Destination(dest);
+        if (ps.isAttributeValueSupported(d, null, null)) {
+            aset.add(d);
+            try {
+                pj.print(aset);
+            } catch (PrinterException e) {
+                System.out.println("PrinterJob passed.");
+                return;
+            }
+            throw new RuntimeException("PrinterJob:PrinterException expected but not thrown. \nTEST FAILED");
+        } else {
+            System.out.println("Destination attribute is not a supported value.  PrinterJob passed.");
+        }
+    }
+
+
+    public static void main(String arg[]) {
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) {
+            System.out.println("Security manager detected");
+            try {
+                security.checkPermission(new FilePermission("<<ALL FILES>>", "read,write"));
+                security.checkPermission(new PropertyPermission("user.dir", "read"));
+            } catch (SecurityException se) {
+                System.out.println("Security requirement not obtained.  TEST PASSED");
+                return;
+            }
+        }
+        String[] testStr = {".", ""};
+        for (int i=0; i<testStr.length; i++) {
+            System.out.println("Testing file name = \""+testStr[i]+"\"");
+            doPrinterJob(testStr[i], OrientationRequested.PORTRAIT);
+            PrintToDir ptd = new PrintToDir();
+            ptd.doPrintJob(testStr[i]);
+            ptd.dispose();
+        }
+        System.out.println("TEST PASSED");
+    }
+
+}
--- a/jdk/test/java/beans/Introspector/TestTypeResolver.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/beans/Introspector/TestTypeResolver.java	Wed Jul 05 19:21:26 2017 +0200
@@ -115,6 +115,8 @@
         // by private implementations of the various Type interfaces
         if (expect.equals(t) && t.equals(expect))
             System.out.println(", as expected");
+        else if ((expect.equals(t) || t.equals(expect)) && expect.toString().equals(t.toString()))
+            System.out.println(", as workaround of the 8023301 bug");
         else {
             System.out.println(" BUT SHOULD BE " + expect);
             failedCases.add(c);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/XMLEncoder/Test8027066.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8027066
+ * @summary Tests that the same array can be encoded twice
+ * @author Anton Nashatyrev
+ */
+public class Test8027066 extends AbstractTest<String[][]> {
+    public static void main(String[] args) {
+        new Test8027066().test(true);
+    }
+
+    @Override
+    protected String[][] getObject() {
+        String[] strings = {"first", "second"};
+        String[][] arrays = {strings, strings};
+        return arrays;
+    }
+}
--- a/jdk/test/java/io/File/NulFile.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/io/File/NulFile.java	Wed Jul 05 19:21:26 2017 +0200
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 8003992
+ * @bug 8003992 8027155
  * @summary Test a file whose path name is embedded with NUL character, and
  *          ensure it is handled correctly.
  * @author Dan Xu
@@ -613,7 +613,7 @@
                 File.createTempFile(prefix, suffix, directory);
             } catch (IOException ex) {
                 String err = "Unable to create temporary file";
-                if (err.equals(ex.getMessage()))
+                if (ex.getMessage() != null && ex.getMessage().startsWith(err))
                     exceptionThrown = true;
                 else {
                     throw new RuntimeException("Get IOException with message, "
--- a/jdk/test/java/lang/ProcessBuilder/InheritIOEHandle.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/ProcessBuilder/InheritIOEHandle.java	Wed Jul 05 19:21:26 2017 +0200
@@ -35,21 +35,22 @@
 
 public class InheritIOEHandle {
     private static enum APP {
-        B, C;
+        A, B, C;
     }
-    private static File stopC = new File(".\\StopC.txt");
+
+    private static File stopC = new File("StopC.txt");
     private static String SIGNAL = "After call child process";
     private static String JAVA_EXE = System.getProperty("java.home")
-        + File.separator + "bin"
-        + File.separator + "java";
+            + File.separator + "bin"
+            + File.separator + "java";
 
     private static String[] getCommandArray(String processName) {
         String[] cmdArray = {
-            JAVA_EXE,
-            "-cp",
-            System.getProperty("java.class.path"),
-            InheritIOEHandle.class.getName(),
-            processName
+                JAVA_EXE,
+                "-cp",
+                System.getProperty("java.class.path"),
+                InheritIOEHandle.class.getName(),
+                processName
         };
         return cmdArray;
     }
@@ -59,19 +60,18 @@
             return;
         }
 
-        if (args.length > 0) {
-            APP app = APP.valueOf(args[0]);
-            switch (app) {
+        APP app = (args.length > 0) ? APP.valueOf(args[0]) : APP.A;
+        switch (app) {
+            case A:
+                performA();
+                break;
             case B:
                 performB();
                 break;
             case C:
                 performC();
                 break;
-            }
-            return;
         }
-        performA();
     }
 
     private static void performA() {
@@ -87,25 +87,40 @@
             process.getOutputStream().close();
             process.getErrorStream().close();
 
-            try (BufferedReader in = new BufferedReader( new InputStreamReader(
-                         process.getInputStream(), "utf-8")))
+            boolean isSignalReceived = false;
+            try (BufferedReader in = new BufferedReader(new InputStreamReader(
+                    process.getInputStream(), "utf-8")))
             {
                 String result;
                 while ((result = in.readLine()) != null) {
-                    if (!SIGNAL.equals(result)) {
-                        throw new Error("Catastrophe in process B! Bad output.");
+                    if (SIGNAL.equals(result)) {
+                        isSignalReceived = true;
+                        break;
+                    } else {
+                        throw new RuntimeException("Catastrophe in process B! Bad output.");
                     }
                 }
+
+            }
+            if (!isSignalReceived) {
+                throw new RuntimeException("Signal from B was not received");
             }
 
             // If JDK-7147084 is not fixed that point is unreachable.
-
+            System.out.println("Received signal from B, creating file StopC");
             // write signal file
-            stopC.createNewFile();
+            boolean isFileStopC = stopC.createNewFile();
+            if (!isFileStopC) {
+                throw new RuntimeException("Signal file StopC.txt was not created. TEST or INFRA bug");
+            }
+
+            process.waitFor();
 
             System.err.println("Read stream finished.");
         } catch (IOException ex) {
-            throw new Error("Catastrophe in process A!", ex);
+            throw new RuntimeException("Catastrophe in process A!", ex);
+        } catch (InterruptedException ex) {
+            throw new RuntimeException("A was interrupted while waiting for B", ex);
         }
     }
 
@@ -121,27 +136,31 @@
             process.getErrorStream().close();
 
             System.out.println(SIGNAL);
+            process.waitFor();
 
             // JDK-7147084 subject:
             // Process C inherits the [System.out] handle and
             // handle close in B does not finalize the streaming for A.
             // (handle reference count > 1).
         } catch (IOException ex) {
-            throw new Error("Catastrophe in process B!", ex);
+            throw new RuntimeException("Catastrophe in process B!", ex);
+        } catch (InterruptedException ex) {
+            throw new RuntimeException("B was interrupted while waiting for C", ex);
         }
     }
 
     private static void performC() {
         // If JDK-7147084 is not fixed the loop is 5min long.
-        for (int i = 0; i < 5*60; ++i) {
+        for (int i = 0; i < 5 * 60; ++i) {
             try {
                 Thread.sleep(1000);
-                // check for sucess
-                if (stopC.exists())
-                    break;
             } catch (InterruptedException ex) {
                 // that is ok. Longer sleep - better effect.
             }
+            // check for success
+            if (stopC.exists()) {
+                break;
+            }
         }
     }
 }
--- a/jdk/test/java/lang/ProcessBuilder/SiblingIOEHandle.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/ProcessBuilder/SiblingIOEHandle.java	Wed Jul 05 19:21:26 2017 +0200
@@ -37,21 +37,22 @@
 
 public class SiblingIOEHandle {
     private static enum APP {
-        B, C;
+        A, B, C;
     }
+
     private static File stopC = new File(".\\StopCs.txt");
     private static String SIGNAL = "B child reported.";
     private static String JAVA_EXE = System.getProperty("java.home")
-        + File.separator + "bin"
-        + File.separator + "java";
+            + File.separator + "bin"
+            + File.separator + "java";
 
     private static String[] getCommandArray(String processName) {
         String[] cmdArray = {
-            JAVA_EXE,
-            "-cp",
-            System.getProperty("java.class.path"),
-            SiblingIOEHandle.class.getName(),
-            processName
+                JAVA_EXE,
+                "-cp",
+                System.getProperty("java.class.path"),
+                SiblingIOEHandle.class.getName(),
+                processName
         };
         return cmdArray;
     }
@@ -61,20 +62,19 @@
             return;
         }
 
-        if (args.length > 0) {
-            APP app = APP.valueOf(args[0]);
-            switch (app) {
+        APP app = (args.length > 0) ? APP.valueOf(args[0]) : APP.A;
+        switch (app) {
+            case A:
+                performA(true);
+                performA(false);
+                break;
             case B:
                 performB();
                 break;
             case C:
                 performC();
                 break;
-            }
-            return;
         }
-        performA(true);
-        performA(false);
     }
 
     static boolean procClaunched = false;
@@ -86,6 +86,7 @@
             // that was long enough
         }
     }
+
     private static boolean waitBarrier(CyclicBarrier barrier) {
         while (true) try {
             barrier.await();
@@ -98,6 +99,36 @@
         }
     }
 
+    private static class ProcessC implements Runnable {
+        private CyclicBarrier barrier;
+        private Process processC;
+
+        public ProcessC(CyclicBarrier barrier) {
+            this.barrier = barrier;
+        }
+
+        @Override
+        public void run() {
+            try {
+                if (waitBarrier(barrier)) {
+                    waitAbit();
+                    // Run process C next to B ASAP to make an attempt
+                    // to capture the B-process IOE handles in C process.
+                    ProcessBuilder builderC = new ProcessBuilder(
+                            getCommandArray(APP.C.name()));
+                    processC = builderC.start();
+                    procClaunched = true;
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+
+        public void waitFor() throws InterruptedException {
+            processC.waitFor();
+        }
+    }
+
     private static void performA(boolean fileOut) {
         try {
             stopC.delete();
@@ -112,26 +143,13 @@
             builderB.redirectErrorStream(true);
 
             final CyclicBarrier barrier = new CyclicBarrier(2);
-            Thread procCRunner = new Thread(new Runnable() {
-                @Override public void run() {
-                    try {
-                        if (waitBarrier(barrier)) {
-                            waitAbit();
-                            // Run process C next to B ASAP to make an attempt
-                            // to capture the B-process IOE handles in C process.
-                            Runtime.getRuntime().exec(getCommandArray(APP.C.name()));
-                            procClaunched = true;
-                        }
-                    } catch (IOException ex) {
-                        ex.printStackTrace();
-                    }
-                }
-            });
+            //Create process C in a new thread
+            ProcessC processC = new ProcessC(barrier);
+            Thread procCRunner = new Thread(processC);
             procCRunner.start();
 
-
             if (!waitBarrier(barrier)) {
-                throw new Error("Catastrophe in process A! Synchronization failed.");
+                throw new RuntimeException("Catastrophe in process A! Synchronization failed.");
             }
             // Run process B first.
             Process processB = builderB.start();
@@ -144,7 +162,7 @@
             }
 
             if (!procClaunched) {
-                throw new Error("Catastrophe in process A! C was not launched.");
+                throw new RuntimeException("Catastrophe in process A! C was not launched.");
             }
 
             processB.getOutputStream().close();
@@ -154,25 +172,30 @@
                 try {
                     processB.waitFor();
                 } catch (InterruptedException ex) {
-                    throw new Error("Catastrophe in process B! B hung up.");
+                    throw new RuntimeException("Catastrophe in process B! B hung up.");
                 }
                 System.err.println("Trying to delete [outB.txt].");
                 if (!outB.delete()) {
-                    throw new Error("Greedy brother C deadlock! File share.");
+                    throw new RuntimeException("Greedy brother C deadlock! File share.");
                 }
                 System.err.println("Succeeded in delete [outB.txt].");
             } else {
                 System.err.println("Read stream start.");
-                try (BufferedReader in = new BufferedReader( new InputStreamReader(
-                             processB.getInputStream(), "utf-8")))
-                {
+                boolean isSignalReceived = false;
+                try (BufferedReader in = new BufferedReader(new InputStreamReader(
+                        processB.getInputStream(), "utf-8"))) {
                     String result;
                     while ((result = in.readLine()) != null) {
-                        if (!SIGNAL.equals(result)) {
-                            throw new Error("Catastrophe in process B! Bad output.");
+                        if (SIGNAL.equals(result)) {
+                            isSignalReceived = true;
+                        } else {
+                            throw new RuntimeException("Catastrophe in process B! Bad output.");
                         }
                     }
                 }
+                if (!isSignalReceived) {
+                    throw new RuntimeException("Signal from B was not received");
+                }
                 System.err.println("Read stream finished.");
             }
             // If JDK-6921885 is not fixed that point is unreachable.
@@ -180,8 +203,11 @@
 
             // write signal file to stop C process.
             stopC.createNewFile();
+            processC.waitFor();
         } catch (IOException ex) {
-            throw new Error("Catastrophe in process A!", ex);
+            throw new RuntimeException("Catastrophe in process A!", ex);
+        } catch (InterruptedException ex) {
+            throw new RuntimeException("Process A was interrupted while waiting for C", ex);
         }
     }
 
@@ -191,7 +217,7 @@
 
     private static void performC() {
         // If JDK-7147084 is not fixed the loop is 5min long.
-        for (int i = 0; i < 5*60; ++i) {
+        for (int i = 0; i < 5 * 60; ++i) {
             try {
                 Thread.sleep(1000);
                 // check for sucess
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/Runtime/exec/CloseRace.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8024521
+ * @summary Closing ProcessPipeInputStream at the time the process exits is racy
+ *          and leads to the data corruption.
+ * @library /lib/testlibrary
+ * @run main/othervm/timeout=80 CloseRace
+ */
+
+/**
+ * This test has a little chance to catch the race during the given default
+ * time gap of 20 seconds. To increase the time gap, set the system property
+ * CloseRaceTimeGap=N to the number of seconds.
+ * Jtreg's timeoutFactor should also be set appropriately.
+ *
+ * For example, to run the test for 10 minutes:
+ * > jtreg \
+ *       -testjdk:$(PATH_TO_TESTED_JDK) \
+ *       -timeoutFactor:10 \
+ *       -DCloseRaceTimeGap=600 \
+ *       $(PATH_TO_TESTED_JDK_SOURCE)/test/java/lang/Runtime/exec/CloseRace.java
+ */
+
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import jdk.testlibrary.OutputAnalyzer;
+import static jdk.testlibrary.ProcessTools.*;
+
+public class CloseRace {
+
+    public static void main(String args[]) throws Exception {
+        ProcessBuilder pb = createJavaProcessBuilder("-Xmx64M", "CloseRace$Child",
+                System.getProperty("CloseRaceTimeGap", "20"));
+        OutputAnalyzer oa = new OutputAnalyzer(pb.start());
+        oa.stderrShouldNotContain("java.lang.OutOfMemoryError");
+    }
+
+    public static class Child {
+        private static final String BIG_FILE = "bigfile";
+        private static final String SMALL_FILE = "smallfile";
+        private static int timeGap = 20; // seconds
+
+        public static void main(String args[]) throws Exception {
+            if (args.length > 0) {
+                try {
+                    timeGap = Integer.parseUnsignedInt(args[0]);
+                    timeGap = Integer.max(timeGap, 10);
+                    timeGap = Integer.min(timeGap, 10 * 60 * 60); // no more than 10 hours
+                } catch (NumberFormatException ignore) {}
+            }
+            try (RandomAccessFile f = new RandomAccessFile(BIG_FILE, "rw")) {
+                f.setLength(1024 * 1024 * 1024); // 1 Gb, greater than max heap size
+            }
+            try (FileOutputStream fs = new FileOutputStream(SMALL_FILE);
+                 PrintStream ps = new PrintStream(fs)) {
+                for (int i = 0; i < 128; ++i)
+                    ps.println("line of text");
+            }
+
+            List<Thread> threads = new LinkedList<>();
+            for (int i = 0; i < 99; ++i) {
+                Thread t = new Thread (new OpenLoop());
+                t.start();
+                threads.add(t);
+            }
+            Thread t2 = new Thread (new ExecLoop());
+            t2.start();
+            threads.add(t2);
+
+            Thread.sleep(timeGap);
+
+            for (Thread t : threads) {
+                t.interrupt();
+                t.join();
+            }
+        }
+
+        private static class OpenLoop implements Runnable {
+            public void run() {
+                final Path bigFilePath = Paths.get(BIG_FILE);
+                while (!Thread.interrupted()) {
+                    try (InputStream in = Files.newInputStream(bigFilePath)) {
+                        // Widen the race window by sleeping 1ms
+                        Thread.sleep(1);
+                    } catch (InterruptedException e) {
+                        break;
+                    } catch (Exception e) {
+                        System.err.println(e);
+                    }
+                }
+            }
+        }
+
+        private static class ExecLoop implements Runnable {
+            public void run() {
+                List<String> command = new ArrayList<>(
+                        Arrays.asList("/bin/cat", SMALL_FILE));
+                while (!Thread.interrupted()) {
+                    try {
+                        ProcessBuilder builder = new ProcessBuilder(command);
+                        final Process process = builder.start();
+                        InputStream is = process.getInputStream();
+                        InputStreamReader isr = new InputStreamReader(is);
+                        BufferedReader br = new BufferedReader(isr);
+                        while (br.readLine() != null) {}
+                        process.waitFor();
+                        isr.close();
+                    } catch (InterruptedException e) {
+                        break;
+                    } catch (Exception e) {
+                        System.err.println(e);
+                    }
+                }
+            }
+        }
+    }
+}
--- a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java	Wed Jul 05 19:21:26 2017 +0200
@@ -57,6 +57,7 @@
         "com.sun.jmx.",
         "com.sun.media.sound.",
         "com.sun.proxy.",
+        "com.sun.corba.se.",
         "com.sun.org.apache.bcel.internal.",
         "com.sun.org.apache.regexp.internal.",
         "com.sun.org.apache.xerces.internal.",
--- a/jdk/test/java/lang/String/ToLowerCase.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/String/ToLowerCase.java	Wed Jul 05 19:21:26 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
     @test
-    @bug 4217441 4533872 4900935
+    @bug 4217441 4533872 4900935 8020037
     @summary toLowerCase should lower-case Greek Sigma correctly depending
              on the context (final/non-final).  Also it should handle
              Locale specific (lt, tr, and az) lowercasings and supplementary
@@ -69,10 +69,11 @@
         test("\u00CD", Locale.US, "\u00ED");
         test("\u0128", Locale.US, "\u0129");
 
-        // I-dot tests (Turkish and Azeri)
+        // I-dot tests
         test("\u0130", turkish, "i");
         test("\u0130", az, "i");
-        test("\u0130", Locale.US, "i\u0307");
+        test("\u0130", lt, "i");
+        test("\u0130", Locale.US, "i");
 
         // Remove dot_above in the sequence I + dot_above (Turkish and Azeri)
         test("I\u0307", turkish, "i");
--- a/jdk/test/java/lang/Thread/ThreadStateTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/Thread/ThreadStateTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -30,7 +30,7 @@
  * @author  Mandy Chung
  *
  * @build ThreadStateTest
- * @run main ThreadStateTest
+ * @run main/othervm -Xmixed ThreadStateTest
  */
 
 import java.util.concurrent.locks.LockSupport;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/annotation/repeatingAnnotations/InheritedAssociatedAnnotations.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     8027170
+ * @summary getAnnotationsByType needs to take the class hierarchy into account
+ *          when determining which annotations are associated with a given
+ *          class.
+ * @run main InheritedAssociatedAnnotations
+ */
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.Arrays;
+
+public class InheritedAssociatedAnnotations {
+
+    public static void main(String[] args) {
+        checkAssociated(A3.class);
+        checkAssociated(B3.class);
+        checkAssociated(C3.class);
+        checkAssociated(D3.class);
+    }
+
+    private static void checkAssociated(AnnotatedElement ae) {
+        Ann[] actual = ae.getAnnotationsByType(Ann.class);
+        Ann[] expected = ae.getAnnotation(ExpectedAssociated.class).value();
+
+        if (!Arrays.equals(actual, expected)) {
+            throw new RuntimeException(String.format(
+                    "Test failed for %s: Expected %s but got %s.",
+                    ae,
+                    Arrays.toString(expected),
+                    Arrays.toString(actual)));
+        }
+    }
+
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ExpectedAssociated {
+    Ann[] value();
+}
+
+
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Repeatable(AnnCont.class)
+@interface Ann {
+    int value();
+}
+
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@interface AnnCont {
+    Ann[] value();
+}
+
+
+@Ann(10)
+class A1 {}
+
+@Ann(20)
+class A2 extends A1 {}
+
+@ExpectedAssociated({@Ann(20)})
+class A3 extends A2 {}
+
+
+@Ann(10) @Ann(11)
+class B1 {}
+
+@Ann(20)
+class B2 extends B1 {}
+
+@ExpectedAssociated({@Ann(20)})
+class B3 extends B2 {}
+
+
+@Ann(10)
+class C1 {}
+
+@Ann(20) @Ann(21)
+class C2 extends C1 {}
+
+@ExpectedAssociated({@Ann(20), @Ann(21)})
+class C3 extends C2 {}
+
+
+@Ann(10) @Ann(11)
+class D1 {}
+
+@Ann(20) @Ann(21)
+class D2 extends D1 {}
+
+@ExpectedAssociated({@Ann(20), @Ann(21)})
+class D3 extends D2 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/annotation/repeatingAnnotations/NonInheritableContainee.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8019420
+ * @summary Repeatable non-inheritable annotation types are mishandled by Core Reflection
+ */
+
+import java.util.*;
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+
+public class NonInheritableContainee {
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Repeatable(InheritedAnnotationContainer.class)
+    @interface NonInheritedAnnotationRepeated {
+        String name();
+    }
+
+    @Inherited
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface InheritedAnnotationContainer {
+        NonInheritedAnnotationRepeated[] value();
+    }
+
+    @NonInheritedAnnotationRepeated(name="A")
+    @NonInheritedAnnotationRepeated(name="B")
+    class Parent {}
+    class Sample extends Parent {}
+
+
+    public static void main(String[] args) {
+
+        Annotation[] anns = Sample.class.getAnnotationsByType(
+                NonInheritedAnnotationRepeated.class);
+
+        if (anns.length != 0)
+            throw new RuntimeException("Non-@Inherited containees should not " +
+                    "be inherited even though its container is @Inherited.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/annotation/repeatingAnnotations/OrderUnitTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     8004912
+ * @summary Unit test for order of annotations returned by get[Declared]AnnotationsByType.
+ *
+ * @run main OrderUnitTest
+ */
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+
+public class OrderUnitTest {
+
+    public static void main(String[] args) {
+        testOrder(Case1.class);
+        testOrder(Case2.class);
+    }
+
+    private static void testOrder(AnnotatedElement e) {
+        Annotation[] decl = e.getDeclaredAnnotations();
+        Foo[] declByType = e.getDeclaredAnnotationsByType(Foo.class);
+
+        if (decl[0] instanceof Foo != declByType[0].isDirect() ||
+            decl[1] instanceof Foo != declByType[1].isDirect()) {
+            throw new RuntimeException("Order of directly / indirectly present " +
+                    "annotations from getDeclaredAnnotationsByType does not " +
+                    "match order from getDeclaredAnnotations.");
+        }
+    }
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface FooContainer {
+    Foo[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(FooContainer.class)
+@interface Foo {
+    boolean isDirect();
+}
+
+
+@Foo(isDirect = true) @FooContainer({@Foo(isDirect = false)})
+class Case1 {
+}
+
+
+@FooContainer({@Foo(isDirect = false)}) @Foo(isDirect = true)
+class Case2 {
+}
--- a/jdk/test/java/lang/annotation/repeatingAnnotations/RepeatedUnitTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/annotation/repeatingAnnotations/RepeatedUnitTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     7154390 8005712 8007278
+ * @bug     7154390 8005712 8007278 8004912
  * @summary Unit test for repeated annotation reflection
  *
  * @compile RepeatedUnitTest.java subpackage/package-info.java subpackage/Container.java subpackage/Containee.java subpackage/NonRepeated.java subpackage/InheritedContainee.java subpackage/InheritedContainer.java subpackage/InheritedNonRepeated.java
@@ -51,6 +51,12 @@
         inheritedMe3();
         inheritedMe4();
 
+        inheritedMe5();    // ContainerOnSuperSingleOnSub
+        inheritedMe6();    // RepeatableOnSuperSingleOnSub
+        inheritedMe7();    // SingleAnnoOnSuperContainerOnSub
+        inheritedMe8();    // SingleOnSuperRepeatableOnSub
+
+
         // CONSTRUCTOR
         checkMultiplier(Me1.class.getConstructor(new Class[0]), 10);
 
@@ -159,6 +165,30 @@
         check(e.getAnnotationsByType(NonRepeated.class)[0].value() == 1000);
     }
 
+    static void inheritedMe5() {
+        AnnotatedElement e = Me5.class;
+        check(2 == e.getAnnotations().length);
+        check(1 == countAnnotation(e, InheritedContainee.class));
+    }
+
+    static void inheritedMe6() {
+        AnnotatedElement e = Me6.class;
+        check(2 == e.getAnnotations().length);
+        check(1 == countAnnotation(e, InheritedContainee.class));
+    }
+
+    static void inheritedMe7() {
+        AnnotatedElement e = Me7.class;
+        check(2 == e.getAnnotations().length);
+        check(2 == countAnnotation(e, InheritedContainee.class));
+    }
+
+    static void inheritedMe8() {
+        AnnotatedElement e = Me8.class;
+        check(2 == e.getAnnotations().length);
+        check(2 == countAnnotation(e, InheritedContainee.class));
+    }
+
     static void checkMultiplier(AnnotatedElement e, int m) {
         // Basic sanity of non-repeating getAnnotation(Class)
         check(e.getAnnotation(NonRepeated.class).value() == 5 * m);
@@ -252,3 +282,31 @@
 @InheritedContainee(1000) @InheritedContainee(2000) @InheritedContainee(3000) @InheritedContainee(4000)
 @Containee(1000) @Containee(2000) @Containee(3000) @Containee(4000)
 class Me4 extends Father {}
+
+
+@InheritedContainer({@InheritedContainee(1), @InheritedContainee(2)})
+class SuperOf5 {}
+
+@InheritedContainee(3)
+class Me5 extends SuperOf5{}
+
+
+@InheritedContainee(1) @InheritedContainee(2)
+class SuperOf6 {}
+
+@InheritedContainee(3)
+class Me6 extends SuperOf6 {}
+
+
+@InheritedContainee(1)
+class SuperOf7 {}
+
+@InheritedContainer({@InheritedContainee(2), @InheritedContainee(3)})
+class Me7 extends SuperOf7 {}
+
+
+@InheritedContainee(1)
+class SuperOf8 {}
+
+@InheritedContainee(2) @InheritedContainee(3)
+class Me8 extends SuperOf8 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/annotation/typeAnnotations/ConstructorReceiverTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8023651
+ * @summary Test that the receiver annotations and the return annotations of
+ *          constructors behave correctly.
+ * @run testng ConstructorReceiverTest
+ */
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.Arrays;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+public class ConstructorReceiverTest {
+    // Format is {
+    //   { Class to get ctor for,
+    //       ctor param class,
+    //       value of anno of return type,
+    //       value of anno for receiver or null if there should be no receiver anno
+    //    },
+    //    ...
+    // }
+    public static final Object[][] TESTS = {
+        { ConstructorReceiverTest.class, null, Integer.valueOf(5), null },
+        { ConstructorReceiverTest.Middle.class, ConstructorReceiverTest.class, Integer.valueOf(10), Integer.valueOf(15) },
+        { ConstructorReceiverTest.Middle.Inner.class, ConstructorReceiverTest.Middle.class, Integer.valueOf(100), Integer.valueOf(150) },
+        { ConstructorReceiverTest.Middle.Inner.Innermost.class, ConstructorReceiverTest.Middle.Inner.class, Integer.valueOf(1000), Integer.valueOf(1500) },
+        { ConstructorReceiverTest.Middle.InnerNoReceiver.class, ConstructorReceiverTest.Middle.class, Integer.valueOf(300), null },
+        { ConstructorReceiverTest.Nested.class, null, Integer.valueOf(20), null },
+        { ConstructorReceiverTest.Nested.NestedMiddle.class, ConstructorReceiverTest.Nested.class, Integer.valueOf(200), Integer.valueOf(250)},
+        { ConstructorReceiverTest.Nested.NestedMiddle.NestedInner.class, ConstructorReceiverTest.Nested.NestedMiddle.class, Integer.valueOf(2000), Integer.valueOf(2500)},
+        { ConstructorReceiverTest.Nested.NestedMiddle.NestedInnerNoReceiver.class, ConstructorReceiverTest.Nested.NestedMiddle.class, Integer.valueOf(4000), null},
+    };
+
+    @DataProvider
+    public Object[][] data() { return TESTS; }
+
+    @Test(dataProvider = "data")
+    public void testAnnotatedReciver(Class<?> toTest, Class<?> ctorParamType,
+            Integer returnVal, Integer receiverVal) throws NoSuchMethodException {
+        Constructor c;
+        if (ctorParamType == null)
+            c = toTest.getDeclaredConstructor();
+        else
+            c = toTest.getDeclaredConstructor(ctorParamType);
+
+        AnnotatedType annotatedReceiverType = c.getAnnotatedReceiverType();
+        Annotation[] receiverAnnotations = annotatedReceiverType.getAnnotations();
+
+        if (receiverVal == null) {
+            assertEquals(receiverAnnotations.length, 0, Arrays.asList(receiverAnnotations).toString() +
+                    " should be empty. Looking at 'length': ");
+            return;
+        }
+
+        assertEquals(receiverAnnotations.length, 1, "expecting a 1 element array. Looking at 'length': ");
+        assertEquals(((Annot)receiverAnnotations[0]).value(), receiverVal.intValue(), " wrong annotation found. Found " +
+                receiverAnnotations[0] +
+                " should find @Annot with value=" +
+                receiverVal);
+    }
+
+    @Test(dataProvider = "data")
+    public void testAnnotatedReturn(Class<?> toTest, Class<?> ctorParamType,
+            Integer returnVal, Integer receiverVal) throws NoSuchMethodException {
+        Constructor c;
+        if (ctorParamType == null)
+            c = toTest.getDeclaredConstructor();
+        else
+            c = toTest.getDeclaredConstructor(ctorParamType);
+
+        AnnotatedType annotatedReturnType = c.getAnnotatedReturnType();
+        Annotation[] returnAnnotations = annotatedReturnType.getAnnotations();
+
+        assertEquals(returnAnnotations.length, 1, "expecting a 1 element array. Looking at 'length': ");
+        assertEquals(((Annot)returnAnnotations[0]).value(), returnVal.intValue(), " wrong annotation found. Found " +
+                returnAnnotations[0] +
+                " should find @Annot with value=" +
+                returnVal);
+    }
+
+    @Annot(5) ConstructorReceiverTest() {}
+
+    private class Middle {
+        @Annot(10) public Middle(@Annot(15) ConstructorReceiverTest ConstructorReceiverTest.this) {}
+
+        public class Inner {
+            @Annot(100) Inner(@Annot(150) Middle Middle.this) {}
+
+            class Innermost {
+                @Annot(1000) private Innermost(@Annot(1500) Inner Inner.this) {}
+            }
+        }
+
+        class InnerNoReceiver {
+            @Annot(300) InnerNoReceiver(Middle Middle.this) {}
+        }
+    }
+
+    public static class Nested {
+        @Annot(20) public Nested() {}
+
+        class NestedMiddle {
+            @Annot(200) public NestedMiddle(@Annot(250) Nested Nested.this) {}
+
+            class NestedInner {
+                @Annot(2000) public NestedInner(@Annot(2500) NestedMiddle NestedMiddle.this) {}
+            }
+
+            class NestedInnerNoReceiver {
+                @Annot(4000) public NestedInnerNoReceiver() {}
+            }
+        }
+    }
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.TYPE_USE)
+    public static @interface Annot {
+        int value();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/NMTHelper.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import sun.management.ManagementFactoryHelper;
+import com.sun.management.DiagnosticCommandMBean;
+
+public class NMTHelper
+{
+    public static void baseline() {
+        executeDcmd("vmNativeMemory", "baseline");
+    }
+
+    // Total:  reserved=3484685KB  +293KB, committed=266629KB +293KB
+    private static Pattern totalLine = Pattern.compile("^Total:  reserved=\\d+KB  .*KB, committed=\\d+KB (.*)KB$");
+
+    public static long committedDiff() throws Exception {
+        String res = (String) executeDcmd("vmNativeMemory", "detail.diff");
+        String[] lines = res.split("\n");
+        for (String line : lines) {
+            Matcher matcher = totalLine.matcher(line);
+            if (matcher.matches()) {
+                String committed = matcher.group(1);
+                return Long.parseLong(committed);
+            }
+        }
+        throw new Exception("Could not find the Total line in the NMT output.");
+    }
+
+    private static String executeDcmd(String cmd, String ... args) {
+        DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean();
+        Object[] dcmdArgs = {args};
+        String[] signature = {String[].class.getName()};
+
+        try {
+            System.out.print("> " + cmd + " ");
+            for (String s : args) {
+                System.out.print(s + " ");
+            }
+            System.out.println(":");
+            String result = (String) dcmd.invoke(cmd, dcmdArgs, signature);
+            System.out.println(result);
+            return result;
+        } catch(Exception ex) {
+            ex.printStackTrace();
+        }
+        return null;
+    }
+}
--- a/jdk/test/java/lang/instrument/RedefineBigClass.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/instrument/RedefineBigClass.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -58,11 +58,19 @@
 JAVAC="${COMPILEJAVA}"/bin/javac
 JAVA="${TESTJAVA}"/bin/java
 
+# Does this VM support the 'detail' level of NMT?
+"${JAVA}" ${TESTVMOPTS} -XX:NativeMemoryTracking=detail -version
+if [ "$?" = 0 ]; then
+    NMT=-XX:NativeMemoryTracking=detail
+else
+    NMT=-XX:NativeMemoryTracking=summary
+fi
+
 "${JAVA}" ${TESTVMOPTS} \
-    -XX:TraceRedefineClasses=3 \
+    -XX:TraceRedefineClasses=3 ${NMT} \
     -javaagent:RedefineBigClassAgent.jar=BigClass.class \
     -classpath "${TESTCLASSES}" RedefineBigClassApp \
-    > output.log 2>&1
+    > output.log 2>&1 
 result=$?
 
 cat output.log
--- a/jdk/test/java/lang/instrument/RedefineBigClassApp.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/instrument/RedefineBigClassApp.java	Wed Jul 05 19:21:26 2017 +0200
@@ -26,16 +26,23 @@
 public class RedefineBigClassApp {
     /**
      * Memory leak is assumed, if application consumes more than specified amount of memory during its execution.
-     * The number is given in Kb.
+     * The number is given in KB.
      */
-    private static final long MEM_LEAK_THRESHOLD = 32 * 1024; // 32Mb
+    private static final long MEM_LEAK_THRESHOLD = 32 * 1024; // 32MB
 
     public static void main(String[] args) throws Exception {
         System.out.println("Creating instance of " +
             RedefineBigClassAgent.clz);
         RedefineBigClassAgent.clz.newInstance();
 
-        long vMemBefore = getVMemSize();
+        // Do a short warmup before creating the NMT baseline
+        try {
+            Thread.sleep(5 * 1000);
+        } catch (InterruptedException ie) {
+        }
+
+        NMTHelper.baseline();
+
         int count = 0;
         while (!RedefineBigClassAgent.doneRedefining) {
             System.out.println("App loop count: " + ++count);
@@ -46,39 +53,12 @@
         }
         System.out.println("App looped  " + count + " times.");
 
-        long vMemAfter = getVMemSize();
-        if (vMemBefore == 0 || vMemAfter == 0) {
-            System.err.println("WARNING: Cannot perform memory leak detection on this OS");
-        } else {
-            long vMemDelta = vMemAfter - vMemBefore;
-            if (vMemDelta > MEM_LEAK_THRESHOLD) {
-                System.err.println("FAIL: Virtual memory usage increased by " + vMemDelta + "Kb " +
-                        "(greater than " + MEM_LEAK_THRESHOLD + "Kb)");
-                System.exit(1);
-            }
-            System.err.println("PASS: Virtual memory usage increased by " + vMemDelta + "Kb " +
-                    "(not greater than " + MEM_LEAK_THRESHOLD + "Kb)");
+        long committedDiff = NMTHelper.committedDiff();
+        if (committedDiff > MEM_LEAK_THRESHOLD) {
+            throw new Exception("FAIL: Committed memory usage increased by " + committedDiff + "KB " +
+                               "(greater than " + MEM_LEAK_THRESHOLD + "KB)");
         }
-        System.exit(0);
-    }
-
-    /**
-     * Return size of virtual memory allocated to the process in Kb.
-     * Linux specific. On other platforms and in case of any errors return 0.
-     */
-    private static long getVMemSize() {
-
-        // Refer to the Linux proc(5) man page for details about /proc/self/stat file
-        //
-        // In short, this file contains status information about the current process
-        // written in one line. The fields are separated with spaces.
-        // The 23rd field is defined as 'vsize %lu   Virtual memory size in bytes'
-
-        try (FileReader fileReader = new FileReader("/proc/self/stat");
-             BufferedReader bufferedReader = new BufferedReader(fileReader)) {
-            String line = bufferedReader.readLine();
-            return Long.parseLong(line.split(" ")[22]) / 1024;
-        } catch (Exception ex) {}
-        return 0;
+        System.err.println("PASS: Committed memory usage increased by " + committedDiff + "KB " +
+                           "(not greater than " + MEM_LEAK_THRESHOLD + "KB)");
     }
 }
--- a/jdk/test/java/lang/instrument/RedefineMethodInBacktrace.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/instrument/RedefineMethodInBacktrace.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -62,6 +62,10 @@
     RedefineMethodInBacktraceTarget.java
 "${JAVAC}" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . RedefineMethodInBacktraceTarget.java
 
+cp "${TESTSRC}"/RedefineMethodInBacktraceTargetB_2.java \
+    RedefineMethodInBacktraceTargetB.java
+"${JAVAC}" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . RedefineMethodInBacktraceTargetB.java
+
 "${JAVA}" ${TESTVMOPTS} -javaagent:RedefineMethodInBacktraceAgent.jar \
     -classpath "${TESTCLASSES}" RedefineMethodInBacktraceApp > output.log 2>&1
 RUN_RESULT=$?
--- a/jdk/test/java/lang/instrument/RedefineMethodInBacktraceApp.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceApp.java	Wed Jul 05 19:21:26 2017 +0200
@@ -21,12 +21,17 @@
  * questions.
  */
 
+import com.sun.management.DiagnosticCommandMBean;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
 import java.lang.instrument.ClassDefinition;
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.util.concurrent.CountDownLatch;
+import sun.management.ManagementFactoryHelper;
 
 /**
  * When an exception is thrown, the JVM collects just enough information
@@ -49,8 +54,12 @@
         System.exit(0);
     }
 
+    public static CountDownLatch stop = new CountDownLatch(1);
+    public static CountDownLatch called = new CountDownLatch(1);
+
     private void doTest() throws Exception {
         doMethodInBacktraceTest();
+        doMethodInBacktraceTestB();
     }
 
     private void doMethodInBacktraceTest() throws Exception {
@@ -63,6 +72,36 @@
         touchRedefinedMethodInBacktrace(t);
     }
 
+    private void doMethodInBacktraceTestB() throws Exception {
+        // Start a thread which blocks in method
+        Thread t = new Thread(RedefineMethodInBacktraceTargetB::methodToRedefine);
+        t.setDaemon(true);
+        t.start();
+
+        // Wait here until the new thread is in the method we want to redefine
+        called.await();
+
+        // Now redefine the class while the method is still on the stack of the new thread
+        doRedefine(RedefineMethodInBacktraceTargetB.class);
+
+        // Do thread dumps in two different ways (to exercise different code paths)
+        // while the old class is still on the stack
+
+        ThreadInfo[] tis = ManagementFactory.getThreadMXBean().dumpAllThreads(false, false);
+        for(ThreadInfo ti : tis) {
+            System.out.println(ti);
+        }
+
+        String[] threadPrintArgs = {};
+        Object[] dcmdArgs = {threadPrintArgs};
+        String[] signature = {String[].class.getName()};
+        DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean();
+        System.out.println(dcmd.invoke("threadPrint", dcmdArgs, signature));
+
+        // release the thread
+        stop.countDown();
+    }
+
     private static Throwable getThrowableFromMethodToRedefine() throws Exception {
         Class<RedefineMethodInBacktraceTarget> c =
                 RedefineMethodInBacktraceTarget.class;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTargetB.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * The first version of this class. The second version is in
+ * RedefineMethodInBacktraceTargetB_2.java.
+ */
+public class RedefineMethodInBacktraceTargetB {
+    public static void methodToRedefine() {
+        try {
+            // signal that we are here
+            RedefineMethodInBacktraceApp.called.countDown();
+
+            // wait until test is done
+            RedefineMethodInBacktraceApp.stop.await();
+        } catch (InterruptedException ex) {
+            // ignore, test will fail
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTargetB_2.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * This is the second version of this class. The first version is in
+ * RedefineMethodInBacktraceTargetB.java.
+ */
+public class RedefineMethodInBacktraceTargetB {
+    public static void methodToRedefine() {
+    }
+}
--- a/jdk/test/java/lang/instrument/RetransformBigClass.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/instrument/RetransformBigClass.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -58,8 +58,16 @@
 JAVAC="${COMPILEJAVA}"/bin/javac
 JAVA="${TESTJAVA}"/bin/java
 
+# Does this VM support the 'detail' level of NMT?
+"${JAVA}" ${TESTVMOPTS} -XX:NativeMemoryTracking=detail -version
+if [ "$?" = 0 ]; then
+    NMT=-XX:NativeMemoryTracking=detail
+else
+    NMT=-XX:NativeMemoryTracking=summary
+fi
+
 "${JAVA}" ${TESTVMOPTS} \
-    -XX:TraceRedefineClasses=3 \
+    -XX:TraceRedefineClasses=3 ${NMT} \
     -javaagent:RetransformBigClassAgent.jar=BigClass.class \
     -classpath "${TESTCLASSES}" RetransformBigClassApp \
     > output.log 2>&1
--- a/jdk/test/java/lang/instrument/RetransformBigClassApp.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/instrument/RetransformBigClassApp.java	Wed Jul 05 19:21:26 2017 +0200
@@ -26,16 +26,23 @@
 public class RetransformBigClassApp {
     /**
      * Memory leak is assumed, if application consumes more than specified amount of memory during its execution.
-     * The number is given in Kb.
+     * The number is given in KB.
      */
-    private static final long MEM_LEAK_THRESHOLD = 32 * 1024; // 32Mb
+    private static final long MEM_LEAK_THRESHOLD = 32 * 1024; // 32MB
 
     public static void main(String[] args) throws Exception {
         System.out.println("Creating instance of " +
             RetransformBigClassAgent.clz);
         RetransformBigClassAgent.clz.newInstance();
 
-        long vMemBefore = getVMemSize();
+        // Do a short warmup before creating the NMT baseline
+        try {
+            Thread.sleep(5 * 1000);
+        } catch (InterruptedException ie) {
+        }
+
+        NMTHelper.baseline();
+
         int count = 0;
         while (!RetransformBigClassAgent.doneRetransforming) {
             System.out.println("App loop count: " + ++count);
@@ -46,39 +53,12 @@
         }
         System.out.println("App looped  " + count + " times.");
 
-        long vMemAfter = getVMemSize();
-        if (vMemBefore == 0 || vMemAfter == 0) {
-            System.err.println("WARNING: Cannot perform memory leak detection on this OS");
-        } else {
-            long vMemDelta = vMemAfter - vMemBefore;
-            if (vMemDelta > MEM_LEAK_THRESHOLD) {
-                System.err.println("FAIL: Virtual memory usage increased by " + vMemDelta + "Kb " +
-                        "(greater than " + MEM_LEAK_THRESHOLD + "Kb)");
-                System.exit(1);
-            }
-            System.err.println("PASS: Virtual memory usage increased by " + vMemDelta + "Kb " +
-                    "(not greater than " + MEM_LEAK_THRESHOLD + "Kb)");
+        long committedDiff = NMTHelper.committedDiff();
+        if (committedDiff > MEM_LEAK_THRESHOLD) {
+            throw new Exception("FAIL: Committed memory usage increased by " + committedDiff + "KB " +
+                               "(greater than " + MEM_LEAK_THRESHOLD + "KB)");
         }
-        System.exit(0);
-    }
-
-    /**
-     * Return size of virtual memory allocated to the process in Kb.
-     * Linux specific. On other platforms and in case of any errors return 0.
-     */
-    private static long getVMemSize() {
-
-        // Refer to the Linux proc(5) man page for details about /proc/self/stat file
-        //
-        // In short, this file contains status information about the current process
-        // written in one line. The fields are separated with spaces.
-        // The 23rd field is defined as 'vsize %lu   Virtual memory size in bytes'
-
-        try (FileReader fileReader = new FileReader("/proc/self/stat");
-             BufferedReader bufferedReader = new BufferedReader(fileReader)) {
-            String line = bufferedReader.readLine();
-            return Long.parseLong(line.split(" ")[22]) / 1024;
-        } catch (Exception ex) {}
-        return 0;
+        System.err.println("PASS: Committed memory usage increased by " + committedDiff + "KB " +
+                           "(not greater than " + MEM_LEAK_THRESHOLD + "KB)");
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/lambda/DupIntf.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8025868
+ * @summary Lambda class can be generated with duplicate interfaces (ClassFormatError)
+ * @run main DupIntf
+ */
+
+interface SAM<P1> {
+    P1 m();
+}
+
+interface Other { }
+
+public class DupIntf {
+    public static void main(String argv[]) {
+        SAM<?> sam = (SAM<?> & Other) () -> "Pass.";
+        System.out.println(sam.m());
+    }
+}
--- a/jdk/test/java/lang/management/ClassLoadingMXBean/LoadCounts.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/management/ClassLoadingMXBean/LoadCounts.java	Wed Jul 05 19:21:26 2017 +0200
@@ -28,10 +28,10 @@
  *                             ClassLoadingMXBean.getTotalLoadedClassCount()
  *                             ClassLoadingMXBean.getUnloadedClassCount()
  * @author  Alexei Guibadoulline
+ * @run main/othervm LoadCounts
  */
 
 import java.lang.management.*;
-import java.util.*;
 
 public class LoadCounts {
     private static ClassLoadingMXBean mbean
@@ -55,13 +55,15 @@
             throw new RuntimeException("getLoadedClassCount() > "
                                      + "getTotalLoadedClassCount()");
 
-        if (classesNowPrev + 4 != classesNow)
+        if (classesNowPrev + 4 > classesNow)
             throw new RuntimeException("Number of loaded classes is "
+                                     + "expected to be at least "
                                      + (classesNowPrev + 4) + ", but "
                                      + "MBean.getLoadedClassCount() returned "
                                      + classesNow);
-        if (classesTotalPrev + 4 != classesTotal)
+        if (classesTotalPrev + 4 > classesTotal)
             throw new RuntimeException("Total number of loaded classes is "
+                                     + "expected to be at least "
                                      + (classesTotalPrev + 4) + ", but "
                                      + "MBean.getTotalLoadedClassCount() "
                                      + "returned " + classesTotal);
@@ -95,13 +97,15 @@
 
         // Expected 2 classes got loaded since they are loaded by
         // same defining class loader
-        if (classesNowPrev + 2 != classesNow)
-            throw new RuntimeException("Expected Number of loaded classes is "
+        if (classesNowPrev + 2 > classesNow)
+            throw new RuntimeException("Number of loaded classes is "
+                                     + "expected to be at least "
                                      + (classesNowPrev + 4) + ", but "
                                      + "MBean.getLoadedClassCount() returned "
                                      + classesNow);
-        if (classesTotalPrev + 2 != classesTotal)
+        if (classesTotalPrev + 2 > classesTotal)
             throw new RuntimeException("Total number of loaded classes is "
+                                     + "expected to be at least "
                                      + (classesTotalPrev + 4) + ", but "
                                      + "MBean.getTotalLoadedClassCount() "
                                      + "returned " + classesTotal);
--- a/jdk/test/java/lang/management/ManagementFactory/ProxyTypeMapping.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/management/ManagementFactory/ProxyTypeMapping.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -36,7 +36,6 @@
 import static java.lang.management.ManagementFactory.*;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import com.sun.management.GcInfo;
 
 public class ProxyTypeMapping {
@@ -162,23 +161,23 @@
     }
 
     private static void checkMemoryUsage() throws Exception {
-        // sanity check to have non-zero usage
+        // sanity check to have non-negative usage
         MemoryUsage u1 = memory.getHeapMemoryUsage();
         MemoryUsage u2 = memory.getNonHeapMemoryUsage();
         MemoryUsage u3 = heapPool.getUsage();
         MemoryUsage u4 = nonHeapPool.getUsage();
-        if (u1.getCommitted() <= 0 ||
-            u2.getCommitted() <= 0 ||
-            u3.getCommitted() <= 0 ||
-            u4.getCommitted() <= 0) {
+        if (u1.getCommitted() < 0 ||
+            u2.getCommitted() < 0 ||
+            u3.getCommitted() < 0 ||
+            u4.getCommitted() < 0) {
             throw new RuntimeException("TEST FAILED: " +
-                " expected non-zero committed usage");
+                " expected non-negative committed usage");
         }
         memory.gc();
         MemoryUsage u5 = heapPool.getCollectionUsage();
-        if (u5.getCommitted() <= 0) {
+        if (u5.getCommitted() < 0) {
             throw new RuntimeException("TEST FAILED: " +
-                " expected non-zero committed collected usage");
+                " expected non-negative committed collected usage");
         }
     }
 
--- a/jdk/test/java/lang/management/ManagementFactory/ValidateOpenTypes.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/management/ManagementFactory/ValidateOpenTypes.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug     5024531
- * @summary Validata open types mapped for the MXBeans in the platform
+ * @summary Validate open types mapped for the MXBeans in the platform
  *          MBeanServer.
  * @author  Mandy Chung
  *
@@ -38,7 +38,6 @@
 import static java.lang.management.ManagementFactory.*;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import com.sun.management.GcInfo;
 
 public class ValidateOpenTypes {
@@ -178,23 +177,23 @@
     }
 
     private static void checkMemoryUsage() throws Exception {
-        // sanity check to have non-zero usage
+        // sanity check to have non-negative usage
         Object u1 = server.getAttribute(memory, "HeapMemoryUsage");
         Object u2 = server.getAttribute(memory, "NonHeapMemoryUsage");
         Object u3 = server.getAttribute(heapPool, "Usage");
         Object u4 = server.getAttribute(nonHeapPool, "Usage");
-        if (getCommitted(u1) <= 0 ||
-            getCommitted(u2) <= 0 ||
-            getCommitted(u3) <= 0 ||
-            getCommitted(u4) <= 0) {
+        if (getCommitted(u1) < 0 ||
+            getCommitted(u2) < 0 ||
+            getCommitted(u3) < 0 ||
+            getCommitted(u4) < 0) {
             throw new RuntimeException("TEST FAILED: " +
-                " expected non-zero committed usage");
+                " expected non-negative committed usage");
         }
         server.invoke(memory, "gc", new Object[0], new String[0]);
         Object u5 = server.getAttribute(heapPool, "CollectionUsage");
-        if (getCommitted(u5) <= 0) {
+        if (getCommitted(u5) < 0) {
             throw new RuntimeException("TEST FAILED: " +
-                " expected non-zero committed collected usage");
+                " expected non-negative committed collected usage");
         }
     }
 
--- a/jdk/test/java/lang/management/MemoryPoolMXBean/ThresholdTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/management/MemoryPoolMXBean/ThresholdTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -28,7 +28,7 @@
  *          MemoryPoolMXBean.isCollectionThresholdExceeded().
  * @author  Mandy Chung
  *
- * @run main ThresholdTest
+ * @run main/othervm ThresholdTest
  */
 
 import java.lang.management.*;
@@ -36,6 +36,9 @@
 
 public class ThresholdTest {
     public static void main(String args[]) throws Exception {
+        long[] bigObject = new long[1000000];
+
+        System.gc(); // force an initial full-gc
         List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
         try {
             for (MemoryPoolMXBean p : pools) {
@@ -82,6 +85,10 @@
         }
 
         p.setUsageThreshold(1);
+        // force a full gc to minimize the likelihood of running GC
+        // between getting the usage and checking the threshold
+        System.gc();
+
         MemoryUsage u = p.getUsage();
         if (u.getUsed() >= 1) {
             if (!p.isUsageThresholdExceeded()) {
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadBlockedCount.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadBlockedCount.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -32,7 +32,6 @@
  */
 
 import java.lang.management.*;
-import java.util.concurrent.locks.LockSupport;
 
 public class ThreadBlockedCount {
     final static long EXPECTED_BLOCKED_COUNT = 3;
@@ -101,6 +100,7 @@
                         System.err.println("Unexpected exception.");
                         e.printStackTrace(System.err);
                         testFailed = true;
+                        break;
                     }
                 }
 
@@ -127,6 +127,7 @@
                         System.err.println("Unexpected exception.");
                         e.printStackTrace(System.err);
                         testFailed = true;
+                        break;
                     }
                 }
 
@@ -153,6 +154,7 @@
                         System.err.println("Unexpected exception.");
                         e.printStackTrace(System.err);
                         testFailed = true;
+                        break;
                     }
                 }
 
@@ -166,15 +168,25 @@
                 }
             }
 
-            // Check the mbean now
-            ThreadInfo ti = mbean.getThreadInfo(Thread.currentThread().
-                                                getId());
-            long count = ti.getBlockedCount();
-
+            // wait for the thread stats to be updated for 10 seconds
+            for (int i = 0; i < 100; i++) {
+                if (getBlockedCount() == EXPECTED_BLOCKED_COUNT) {
+                    return;
+                }
+                try {
+                    Thread.sleep(100);
+                } catch (InterruptedException e) {
+                    System.err.println("Unexpected exception.");
+                    e.printStackTrace(System.err);
+                    testFailed = true;
+                    return;
+                }
+            }
+            long count = getBlockedCount();
             if (count != EXPECTED_BLOCKED_COUNT) {
                 System.err.println("TEST FAILED: Blocked thread has " + count +
-                                   " blocked counts. Expected " +
-                                   EXPECTED_BLOCKED_COUNT);
+                                    " blocked counts. Expected " +
+                                    EXPECTED_BLOCKED_COUNT);
                 testFailed = true;
             }
         } // run()
@@ -195,6 +207,7 @@
                     System.err.println("Unexpected exception.");
                     e.printStackTrace(System.err);
                     testFailed = true;
+                    break;
                 }
                 ThreadInfo info = mbean.getThreadInfo(blocked.getId());
                 threadBlocked = (info.getThreadState() == Thread.State.BLOCKED);
@@ -233,4 +246,13 @@
 
         } // run()
     } // BlockedThread
+
+    private static long getBlockedCount() {
+        long count;
+        // Check the mbean now
+        ThreadInfo ti = mbean.getThreadInfo(Thread.currentThread().
+                getId());
+        count = ti.getBlockedCount();
+        return count;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/reflect/AnnotatedElement/TestAnnotatedElementDefaults.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,339 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8005294
+ * @summary Check behavior of default methods of AnnotatedElement
+ * @author Joseph D. Darcy
+ */
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+/**
+ * For annotation type tokens including, null, DirectlyPresent.class,
+ * IndirectlyPresent.class, etc. the behavior of
+ * AnnotedElementDelegate.foo(arg) is compared for equality to
+ * baseAnnotatedElement.foo(arg) on various kinds of annotated
+ * elements.
+ */
+public class TestAnnotatedElementDefaults {
+    public static void main(String... args) throws SecurityException {
+        int failures = 0;
+
+        for (AnnotatedElement annotElement : elementsToTest()) {
+            System.out.println(annotElement);
+            AnnotatedElementDelegate delegate = new AnnotatedElementDelegate(annotElement);
+            failures += testNullHandling(delegate);
+            for (Class<? extends Annotation> annotType : annotationsToTest()) {
+                failures += AnnotatedElementDelegate.testDelegate(delegate, annotType);
+            }
+        }
+
+        if (failures > 0) {
+            System.err.printf("%d failures%n", failures);
+            throw new RuntimeException();
+        }
+    }
+
+    private static List<AnnotatedElement> elementsToTest() {
+        List<AnnotatedElement> annotatedElements = new ArrayList<>();
+        annotatedElements.add(TestClass1Super.class);
+        annotatedElements.add(TestClass1.class);
+        for (Method method : TestClass1.class.getDeclaredMethods()) {
+            annotatedElements.add(method);
+        }
+        return annotatedElements;
+    }
+
+    private static List<Class<? extends Annotation>> annotationsToTest() {
+        List<Class<? extends Annotation>> annotations = new ArrayList<>();
+        annotations.add(Missing.class);
+
+        annotations.add(MissingRepeatable.class);
+
+        annotations.add(DirectlyPresent.class);
+
+        annotations.add(IndirectlyPresent.class);
+        annotations.add(IndirectlyPresentContainer.class);
+
+        annotations.add(DirectlyAndIndirectlyPresent.class);
+        annotations.add(DirectlyAndIndirectlyPresentContainer.class);
+
+        annotations.add(AssociatedDirectOnSuperClass.class);
+        annotations.add(AssociatedDirectOnSuperClassContainer.class);
+
+        annotations.add(AssociatedDirectOnSuperClassIndirectOnSubclass.class);
+        annotations.add(AssociatedDirectOnSuperClassIndirectOnSubclassContainer.class);
+
+        annotations.add(AssociatedIndirectOnSuperClassDirectOnSubclass.class);
+        annotations.add(AssociatedIndirectOnSuperClassDirectOnSubclassContainer.class);
+        return annotations;
+    }
+
+    private static int testNullHandling(AnnotatedElementDelegate delegate) {
+        int failures = 0;
+        try {
+            Object result = delegate.getDeclaredAnnotationsByType(null);
+            failures++;
+        } catch (NullPointerException npe) {
+            ; // Expected
+        }
+
+        try {
+            Object result = delegate.getAnnotationsByType(null);
+            failures++;
+        } catch (NullPointerException npe) {
+            ; // Expected
+        }
+
+        try {
+            Object result = delegate.getDeclaredAnnotation(null);
+            failures++;
+        } catch (NullPointerException npe) {
+            ; // Expected
+        }
+
+        return failures;
+    }
+
+}
+
+// -----------------------------------------------------
+
+@AssociatedDirectOnSuperClass(123)
+@AssociatedIndirectOnSuperClass(234) @AssociatedIndirectOnSuperClass(345)
+@AssociatedDirectOnSuperClassIndirectOnSubclass(987)
+@AssociatedIndirectOnSuperClassDirectOnSubclass(1111) @AssociatedIndirectOnSuperClassDirectOnSubclass(2222)
+class TestClass1Super {}
+
+@DirectlyPresent(1)
+@IndirectlyPresent(10) @IndirectlyPresent(11)
+@AssociatedDirectOnSuperClassIndirectOnSubclass(876) @AssociatedDirectOnSuperClassIndirectOnSubclass(765)
+@AssociatedIndirectOnSuperClassDirectOnSubclass(3333)
+class TestClass1 extends TestClass1Super {
+
+    @DirectlyPresent(2)
+    @IndirectlyPresentContainer({@IndirectlyPresent(12)})
+    @DirectlyAndIndirectlyPresentContainer({@DirectlyAndIndirectlyPresent(84), @DirectlyAndIndirectlyPresent(96)})
+    public void foo() {return ;}
+
+    @IndirectlyPresentContainer({})
+    @DirectlyAndIndirectlyPresentContainer({@DirectlyAndIndirectlyPresent(11), @DirectlyAndIndirectlyPresent(22)})
+    @DirectlyAndIndirectlyPresent(33)
+    public void bar()  {return ;}
+}
+
+// -----------------------------------------------------
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Missing {
+    int value();
+}
+
+// -----------------------------------------------------
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(MissingRepeatableContainer.class)
+@interface MissingRepeatable {
+    int value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface MissingRepeatableContainer {
+    MissingRepeatable[] value();
+}
+
+// -----------------------------------------------------
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface DirectlyPresent {
+    int value();
+}
+
+// -----------------------------------------------------
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(IndirectlyPresentContainer.class)
+@interface IndirectlyPresent {
+    int value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface IndirectlyPresentContainer {
+    IndirectlyPresent[] value();
+}
+
+// -----------------------------------------------------
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(DirectlyAndIndirectlyPresentContainer.class)
+@interface DirectlyAndIndirectlyPresent {
+    int value();
+
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface DirectlyAndIndirectlyPresentContainer {
+    DirectlyAndIndirectlyPresent[] value();
+}
+
+// -----------------------------------------------------
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(AssociatedDirectOnSuperClassContainer.class)
+@interface AssociatedDirectOnSuperClass {
+    int value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface AssociatedDirectOnSuperClassContainer {
+    AssociatedDirectOnSuperClass[] value();
+}
+
+// -----------------------------------------------------
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(AssociatedIndirectOnSuperClassContainer.class)
+@interface AssociatedIndirectOnSuperClass {
+    int value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface AssociatedIndirectOnSuperClassContainer {
+    AssociatedIndirectOnSuperClass[] value();
+}
+
+// -----------------------------------------------------
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(AssociatedDirectOnSuperClassIndirectOnSubclassContainer.class)
+@interface  AssociatedDirectOnSuperClassIndirectOnSubclass {
+    int value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface AssociatedDirectOnSuperClassIndirectOnSubclassContainer {
+    AssociatedDirectOnSuperClassIndirectOnSubclass[] value();
+}
+
+// -----------------------------------------------------
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(AssociatedIndirectOnSuperClassDirectOnSubclassContainer.class)
+@interface  AssociatedIndirectOnSuperClassDirectOnSubclass {
+    int value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface AssociatedIndirectOnSuperClassDirectOnSubclassContainer {
+    AssociatedIndirectOnSuperClassDirectOnSubclass[] value();
+}
+
+// -----------------------------------------------------
+
+/**
+ * Helper class to ease calling the default methods of {@code
+ * AnnotatedElement} and comparing the results to other
+ * implementation.
+ */
+class AnnotatedElementDelegate implements AnnotatedElement {
+    private AnnotatedElement base;
+
+    public AnnotatedElementDelegate(AnnotatedElement base) {
+        Objects.requireNonNull(base);
+        this.base = base;
+    }
+
+    // Delegate to base implemenetation of AnnotatedElement methods
+    // without defaults.
+    @Override
+    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
+        return base.getAnnotation(annotationClass);
+    }
+
+    @Override
+    public Annotation[] getAnnotations() {
+        return base.getAnnotations();
+    }
+
+    @Override
+    public Annotation[] getDeclaredAnnotations() {
+        return base.getDeclaredAnnotations();
+    }
+
+    public AnnotatedElement getBase() {
+        return base;
+    }
+
+    static int testDelegate(AnnotatedElementDelegate delegate,
+                            Class<? extends Annotation> annotationClass) {
+        int failures = 0;
+        AnnotatedElement base = delegate.getBase();
+
+        // System.out.println("\tTesting " + delegate + "\ton\t" + annotationClass);
+
+        // <T extends Annotation> T[] getDeclaredAnnotationsByType(Class<T> annotationClass)
+        failures += annotationArrayCheck(delegate.getDeclaredAnnotationsByType(annotationClass),
+                                         base.getDeclaredAnnotationsByType(annotationClass),
+                                         annotationClass,
+                                         "Equality failure on getDeclaredAnnotationsByType(%s) on %s)%n");
+
+        // <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass)
+        failures += annotationArrayCheck(delegate.getAnnotationsByType(annotationClass),
+                                         base.getAnnotationsByType(annotationClass),
+                                         annotationClass,
+                                         "Equality failure on getAnnotationsByType(%s) on %s)%n");
+
+        // <T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass)
+        if (!Objects.equals(delegate.getDeclaredAnnotation(annotationClass),
+                            base.getDeclaredAnnotation(annotationClass))) {
+            failures++;
+            System.err.printf("Equality failure on getDeclaredAnnotation(%s) on %s)%n",
+                              annotationClass, delegate);
+        }
+        return failures;
+    }
+    private static <T extends Annotation> int annotationArrayCheck(T[] delegate,
+                                                           T[] base,
+                                                           Class<? extends Annotation> annotationClass,
+                                                           String message) {
+        int failures = 0;
+
+        if (!Objects.deepEquals(delegate,base)) {
+            failures = 1;
+
+            System.err.printf(message,
+                              annotationClass,
+                              delegate);
+
+            System.err.println("Base result:\t" + Arrays.toString(base));
+            System.err.println("Delegate result:\t " + Arrays.toString(delegate));
+            System.err.println();
+        }
+
+        return failures;
+    }
+}
--- a/jdk/test/java/lang/reflect/DefaultStaticTest/DefaultStaticInvokeTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/reflect/DefaultStaticTest/DefaultStaticInvokeTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -44,30 +44,86 @@
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.fail;
 import org.testng.annotations.Test;
 
 import static helper.Mod.*;
 import static helper.Declared.*;
 import helper.Mod;
 
+
 public class DefaultStaticInvokeTest {
 
+    // getMethods(): Make sure getMethods returns the expected methods.
     @Test(dataProvider = "testCasesAll",
             dataProviderClass = DefaultStaticTestData.class)
     public void testGetMethods(String testTarget, Object param)
             throws Exception {
-        // test the methods retrieved by getMethods()
         testMethods(ALL_METHODS, testTarget, param);
     }
 
+
+    // getDeclaredMethods(): Make sure getDeclaredMethods returns the expected methods.
     @Test(dataProvider = "testCasesAll",
             dataProviderClass = DefaultStaticTestData.class)
     public void testGetDeclaredMethods(String testTarget, Object param)
             throws Exception {
-        // test the methods retrieved by getDeclaredMethods()
         testMethods(DECLARED_ONLY, testTarget, param);
     }
 
+
+    // getMethod(): Make sure that getMethod finds all methods it should find.
+    @Test(dataProvider = "testCasesAll",
+            dataProviderClass = DefaultStaticTestData.class)
+    public void testGetMethod(String testTarget, Object param)
+            throws Exception {
+
+        Class<?> typeUnderTest = Class.forName(testTarget);
+
+        MethodDesc[] descs = typeUnderTest.getAnnotationsByType(MethodDesc.class);
+
+        for (MethodDesc desc : descs) {
+            assertTrue(isFoundByGetMethod(typeUnderTest,
+                                          desc.name(),
+                                          argTypes(param)));
+        }
+    }
+
+
+    // getMethod(): Make sure that getMethod does *not* find certain methods.
+    @Test(dataProvider = "testCasesAll",
+            dataProviderClass = DefaultStaticTestData.class)
+    public void testGetMethodSuperInterfaces(String testTarget, Object param)
+            throws Exception {
+
+        // Make sure static methods in superinterfaces are not found (unless the type under
+        // test declares a static method with the same signature).
+
+        Class<?> typeUnderTest = Class.forName(testTarget);
+
+        for (Class<?> interfaze : typeUnderTest.getInterfaces()) {
+
+            for (MethodDesc desc : interfaze.getAnnotationsByType(MethodDesc.class)) {
+
+                boolean isStatic = desc.mod() == STATIC;
+
+                boolean declaredInThisType = isMethodDeclared(typeUnderTest,
+                                                              desc.name());
+
+                boolean expectedToBeFound = !isStatic || declaredInThisType;
+
+                if (expectedToBeFound)
+                    continue; // already tested in testGetMethod()
+
+                assertFalse(isFoundByGetMethod(typeUnderTest,
+                                               desc.name(),
+                                               argTypes(param)));
+            }
+        }
+    }
+
+
+    // Method.invoke(): Make sure Method.invoke returns the expected value.
     @Test(dataProvider = "testCasesAll",
             dataProviderClass = DefaultStaticTestData.class)
     public void testMethodInvoke(String testTarget, Object param)
@@ -78,11 +134,13 @@
         // test the method retrieved by Class.getMethod(String, Object[])
         for (MethodDesc toTest : expectedMethods) {
             String name = toTest.name();
-            Method m = getTestMethod(typeUnderTest, name, param);
+            Method m = typeUnderTest.getMethod(name, argTypes(param));
             testThisMethod(toTest, m, typeUnderTest, param);
         }
     }
 
+
+    // MethodHandle.invoke(): Make sure MethodHandle.invoke returns the expected value.
     @Test(dataProvider = "testCasesAll",
             dataProviderClass = DefaultStaticTestData.class)
     public void testMethodHandleInvoke(String testTarget, Object param)
@@ -116,6 +174,7 @@
 
     }
 
+    // Lookup.findStatic / .findVirtual: Make sure IllegalAccessException is thrown as expected.
     @Test(dataProvider = "testClasses",
             dataProviderClass = DefaultStaticTestData.class)
     public void testIAE(String testTarget, Object param)
@@ -128,7 +187,7 @@
             String mName = toTest.name();
             Mod mod = toTest.mod();
             if (mod != STATIC && typeUnderTest.isInterface()) {
-                return;
+                continue;
             }
             Exception caught = null;
             try {
@@ -136,10 +195,12 @@
             } catch (Exception e) {
                 caught = e;
             }
-            assertTrue(caught != null);
+            assertNotNull(caught);
             assertEquals(caught.getClass(), IllegalAccessException.class);
         }
     }
+
+
     private static final String[] OBJECT_METHOD_NAMES = {
         "equals",
         "hashCode",
@@ -192,15 +253,15 @@
                 myMethods.put(mName, m);
             }
         }
-        assertEquals(expectedMethods.length, myMethods.size());
+
+        assertEquals(myMethods.size(), expectedMethods.length);
 
         for (MethodDesc toTest : expectedMethods) {
 
             String name = toTest.name();
-            Method candidate = myMethods.get(name);
+            Method candidate = myMethods.remove(name);
 
             assertNotNull(candidate);
-            myMethods.remove(name);
 
             testThisMethod(toTest, candidate, typeUnderTest, param);
 
@@ -210,6 +271,7 @@
         assertTrue(myMethods.isEmpty());
     }
 
+
     private void testThisMethod(MethodDesc toTest, Method method,
             Class<?> typeUnderTest, Object param) throws Exception {
         // Test modifiers, and invoke
@@ -256,37 +318,52 @@
                 assertFalse(method.isDefault());
                 break;
             default:
-                assertFalse(true); //this should never happen
+                fail(); //this should never happen
                 break;
         }
 
     }
 
+
+    private boolean isMethodDeclared(Class<?> type, String name) {
+        MethodDesc[] methDescs = type.getAnnotationsByType(MethodDesc.class);
+        for (MethodDesc desc : methDescs) {
+            if (desc.declared() == YES && desc.name().equals(name))
+                return true;
+        }
+        return false;
+    }
+
+
+    private boolean isFoundByGetMethod(Class<?> c, String method, Class<?>... argTypes) {
+        try {
+            c.getMethod(method, argTypes);
+            return true;
+        } catch (NoSuchMethodException notFound) {
+            return false;
+        }
+    }
+
+
+    private Class<?>[] argTypes(Object param) {
+        return param == null ? new Class[0] : new Class[] { Object.class };
+    }
+
+
     private Object tryInvoke(Method m, Class<?> receiverType, Object param)
             throws Exception {
         Object receiver = receiverType == null ? null : receiverType.newInstance();
-        Object result = null;
-        if (param == null) {
-            result = m.invoke(receiver);
-        } else {
-            result = m.invoke(receiver, param);
-        }
-        return result;
+        Object[] args = param == null ? new Object[0] : new Object[] { param };
+        return m.invoke(receiver, args);
     }
 
-    private Method getTestMethod(Class clazz, String methodName, Object param)
-            throws NoSuchMethodException {
-        Class[] paramsType = (param != null)
-                ? new Class[]{Object.class}
-                : new Class[]{};
-        return clazz.getMethod(methodName, paramsType);
-    }
 
     private MethodHandle getTestMH(Class clazz, String methodName, Object param)
             throws Exception {
         return getTestMH(clazz, methodName, param, false);
     }
 
+
     private MethodHandle getTestMH(Class clazz, String methodName,
             Object param, boolean isNegativeTest)
             throws Exception {
--- a/jdk/test/java/lang/reflect/DefaultStaticTest/DefaultStaticTestData.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/lang/reflect/DefaultStaticTest/DefaultStaticTestData.java	Wed Jul 05 19:21:26 2017 +0200
@@ -172,7 +172,7 @@
 
 @MethodDesc(name = "defaultMethod", retval = "TestIF8.TestClass8", mod = DEFAULT, declared = NO)
 class TestClass8<T> implements TestIF8<T> {
-};
+}
 
 @MethodDesc(name = "defaultMethod", retval = "TestIF9.defaultMethod", mod = DEFAULT, declared = YES)
 interface TestIF9 extends TestIF1 {
@@ -218,7 +218,6 @@
 }
 
 @MethodDesc(name = "defaultMethod", retval = "TestIF12.defaultMethod", mod = DEFAULT, declared = YES)
-@MethodDesc(name = "staticMethod", retval = "TestIF2.staticMethod", mod = STATIC, declared = NO)
 interface TestIF12 extends TestIF2 {
 
     default String defaultMethod() {
@@ -299,7 +298,7 @@
 
 @MethodDesc(name = "defaultMethod", retval = "TestIF16.defaultMethod", mod = DEFAULT, declared = NO)
 class TestClass16 implements TestIF16 {
-};
+}
 
 @MethodDesc(name = "defaultMethod", retval = "TestIF17.defaultMethod", mod = DEFAULT, declared = YES)
 @MethodDesc(name = "staticMethod", retval = "TestIF17.staticMethod", mod = STATIC, declared = YES)
@@ -318,6 +317,12 @@
 class TestClass17 implements TestIF17 {
 }
 
+
+@MethodDesc(name = "defaultMethod", retval = "TestIF17.defaultMethod", mod = DEFAULT, declared = NO)
+class TestClass18 extends TestClass17 {
+}
+
+
 @Retention(RetentionPolicy.RUNTIME)
 @Repeatable(MethodDescs.class)
 @interface MethodDesc {
@@ -332,6 +337,41 @@
     MethodDesc[] value();
 }
 
+//Diamond Case for static method
+@MethodDesc(name = "staticMethod", retval = "TestIF2A.staticMethod", mod = STATIC, declared = YES)
+interface TestIF2A extends TestIF2 {
+    static String staticMethod() {
+        return "TestIF2A.staticMethod";
+    }
+}
+
+@MethodDesc(name = "method", retval = "", mod = ABSTRACT, declared = YES)
+interface TestIF2B extends TestIF2 {
+    String method();
+}
+
+@MethodDesc(name = "method", retval = "", mod = ABSTRACT, declared = YES)
+interface TestIF18 extends TestIF10, TestIF2A {
+    String method();
+}
+
+@MethodDesc(name = "method", retval = "", mod = ABSTRACT, declared = NO)
+@MethodDesc(name = "defaultMethod", retval = "TestIF12.defaultMethod", mod = DEFAULT, declared = NO)
+interface TestIF19 extends TestIF12, TestIF2B {
+}
+
+@MethodDesc(name = "staticMethod", retval = "TestIF20.staticMethod", mod = STATIC, declared = YES)
+@MethodDesc(name = "defaultMethod", retval = "TestIF12.defaultMethod", mod = DEFAULT, declared = NO)
+interface TestIF20 extends TestIF12, TestIF2A {
+    static String staticMethod() {
+        return "TestIF20.staticMethod";
+    }
+}
+
+@MethodDesc(name = "method", retval = "", mod = ABSTRACT, declared = NO)
+interface TestIF21 extends TestIF2A, TestIF2B {
+}
+
 public class DefaultStaticTestData {
 
     /**
@@ -343,22 +383,23 @@
     static Object[][] testClasses() {
         return new Object[][]{
             {"TestClass1", null},
-            //{"TestClass2", null}, @ignore due to JDK-8009411
+            {"TestClass2", null},
             {"TestClass3", null},
-            //{"TestClass4", null}, @ignore due to JDK-8009411
-            //{"TestClass5", null}, @ignore due to JDK-8009411
-            //{"TestClass6", null}, @ignore due to JDK-8009411
+            {"TestClass4", null},
+            {"TestClass5", null},
+            {"TestClass6", null},
             {"TestClass7", "TestIF7.TestClass7"},
             {"TestClass8", "TestIF8.TestClass8"},
             {"TestClass9", null},
             {"TestClass91", null},
-            //{"TestClass11", null}, @ignore due to JDK-8009411
-            //{"TestClass12", null}, @ignore due to JDK-8009411
+            {"TestClass11", null},
+            {"TestClass12", null},
             {"TestClass13", null},
             {"TestClass14", null},
             {"TestClass15", null},
-            {"TestClass16", null}
-        //{"TestClass17", null} @ignore due to JDK-8009411
+            {"TestClass16", null},
+            {"TestClass17", null},
+            {"TestClass18", null},
         };
     }
 
@@ -372,6 +413,8 @@
         return new Object[][]{
             {"TestIF1", null},
             {"TestIF2", null},
+            {"TestIF2A", null},
+            {"TestIF2B", null},
             {"TestIF3", null},
             {"TestIF4", null},
             {"TestIF5", null},
@@ -388,7 +431,12 @@
             {"TestIF1D", null},
             {"TestIF15", null},
             {"TestIF16", null},
-            {"TestIF17", null},};
+            {"TestIF17", null},
+            {"TestIF18", null},
+            {"TestIF19", null},
+            {"TestIF20", null},
+            {"TestIF21", null},
+        };
     }
 
     @DataProvider
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/reflect/Method/InterfaceStatic/StaticInterfaceMethodInWayOfDefault.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8009411
+ * @summary Test that a static method on an interface doesn't hide a default
+ *          method with the same name and signature in a separate compilation
+ *          scenario.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.concurrent.Callable;
+
+import sun.misc.IOUtils;
+
+public class StaticInterfaceMethodInWayOfDefault {
+    public interface A_v1 {
+    }
+
+    public interface A_v2 {
+        default void m() {
+            System.err.println("A.m() called");
+        }
+    }
+
+    public interface B  extends A_v1 {
+        static void m() {
+            System.err.println("B.m() called");
+        }
+    }
+
+    public interface C_v1 extends B {
+        default void m() {
+            System.err.println("C.m() called");
+        }
+    }
+
+    public interface C_v2 extends B {
+    }
+
+    public static class TestTask implements Callable<String> {
+        @Override
+        public String call() {
+            try {
+                Method m = C_v1.class.getMethod("m", (Class<?>[])null);
+                return  m.getDeclaringClass().getSimpleName();
+            } catch (NoSuchMethodException e) {
+                System.err.println("Couldn't find method");
+                return "ERROR";
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        int errors = 0;
+        Callable<String> v1Task = new TestTask();
+
+        ClassLoader v2Loader = new V2ClassLoader(
+            StaticInterfaceMethodInWayOfDefault.class.getClassLoader());
+        Callable<String> v2Task = (Callable<String>) Class.forName(
+            TestTask.class.getName(),
+            true,
+            v2Loader).newInstance();
+
+        System.err.println("Running using _v1 classes:");
+        String res = v1Task.call();
+        if(!res.equals("C_v1")) {
+            System.err.println("Got wrong method, expecting C_v1, got: " + res);
+            errors++;
+        }
+
+        System.err.println("Running using _v2 classes:");
+        res = v2Task.call();
+        if(!res.equals("A_v1")) {
+            System.err.println("Got wrong method, expecting A_v1, got: " + res);
+            errors++;
+        }
+
+        if (errors != 0)
+            throw new RuntimeException("Errors found, check log for details");
+    }
+
+    /**
+     * A ClassLoader implementation that loads alternative implementations of
+     * classes. If class name ends with "_v1" it locates instead a class with
+     * name ending with "_v2" and loads that class instead.
+     */
+    static class V2ClassLoader extends ClassLoader {
+        V2ClassLoader(ClassLoader parent) {
+            super(parent);
+        }
+
+        @Override
+        protected Class<?> loadClass(String name, boolean resolve)
+            throws ClassNotFoundException {
+            if (name.indexOf('.') < 0) { // root package is our class
+                synchronized (getClassLoadingLock(name)) {
+                    // First, check if the class has already been loaded
+                    Class<?> c = findLoadedClass(name);
+                    if (c == null) {
+                        c = findClass(name);
+                    }
+                    if (resolve) {
+                        resolveClass(c);
+                    }
+                    return c;
+                }
+            }
+            else { // not our class
+                return super.loadClass(name, resolve);
+            }
+        }
+
+        @Override
+        protected Class<?> findClass(String name)
+            throws ClassNotFoundException {
+            // special class name -> replace it with alternative name
+            if (name.endsWith("_v1")) {
+                String altName = name.substring(0, name.length() - 3) + "_v2";
+                String altPath = altName.replace('.', '/').concat(".class");
+                try (InputStream is = getResourceAsStream(altPath)) {
+                    if (is != null) {
+                        byte[] bytes = IOUtils.readFully(is, -1, true);
+                        // patch class bytes to contain original name
+                        for (int i = 0; i < bytes.length - 2; i++) {
+                            if (bytes[i] == '_' &&
+                                bytes[i + 1] == 'v' &&
+                                bytes[i + 2] == '2') {
+                                bytes[i + 2] = '1';
+                            }
+                        }
+                        return defineClass(name, bytes, 0, bytes.length);
+                    }
+                    else {
+                        throw new ClassNotFoundException(name);
+                    }
+                }
+                catch (IOException e) {
+                    throw new ClassNotFoundException(name, e);
+                }
+            }
+            else { // not special class name -> just load the class
+                String path = name.replace('.', '/').concat(".class");
+                try (InputStream is = getResourceAsStream(path)) {
+                    if (is != null) {
+                        byte[] bytes = IOUtils.readFully(is, -1, true);
+                        return defineClass(name, bytes, 0, bytes.length);
+                    }
+                    else {
+                        throw new ClassNotFoundException(name);
+                    }
+                }
+                catch (IOException e) {
+                    throw new ClassNotFoundException(name, e);
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/math/BigInteger/BitLengthOverflow.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @ test
+ * @bug 6910473
+ * @summary Test that bitLength() is not negative
+ * @author Dmitry Nadezhin
+ */
+import java.math.BigInteger;
+
+public class BitLengthOverflow {
+
+    public static void main(String[] args) {
+
+        try {
+            BigInteger x = BigInteger.ONE.shiftLeft(Integer.MAX_VALUE); // x = pow(2,Integer.MAX_VALUE)
+            if (x.bitLength() != (1L << 31))
+                throw new RuntimeException("Incorrect bitLength() " + x.bitLength());
+            System.out.println("Surprisingly passed with correct bitLength() " + x.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+            System.out.println("Overflow is reported by ArithmeticException, as expected");
+        } catch (OutOfMemoryError e) {
+            // possible
+            System.out.println("OutOfMemoryError");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/math/BigInteger/DivisionOverflow.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 8022780
+ * @summary Test division of large values
+ * @author Dmitry Nadezhin
+ */
+import java.math.BigInteger;
+
+public class DivisionOverflow {
+
+    public static void main(String[] args) {
+        try {
+            BigInteger a = BigInteger.ONE.shiftLeft(2147483646);
+            BigInteger b = BigInteger.ONE.shiftLeft(1568);
+            BigInteger[] qr = a.divideAndRemainder(b);
+            BigInteger q = qr[0];
+            BigInteger r = qr[1];
+            if (!r.equals(BigInteger.ZERO))
+                throw new RuntimeException("Incorrect singum() of remainder " + r.signum());
+            if (q.bitLength() != 2147482079)
+                throw new RuntimeException("Incorrect bitLength() of quotient " + q.bitLength());
+            System.out.println("Division of large values passed without overflow.");
+        } catch (OutOfMemoryError e) {
+            // possible
+            System.out.println("OutOfMemoryError");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/math/BigInteger/DoubleValueOverflow.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @ test
+ * @bug 8021203
+ * @summary Test that doubleValue() doesn't overflow
+ * @author Dmitry Nadezhin
+ */
+import java.math.BigInteger;
+
+public class DoubleValueOverflow {
+
+    public static void main(String[] args) {
+
+        try {
+            BigInteger x = BigInteger.valueOf(2).shiftLeft(Integer.MAX_VALUE); // x = pow(2,pow(2,31))
+            if (x.doubleValue() != Double.POSITIVE_INFINITY)
+                throw new RuntimeException("Incorrect doubleValue() " + x.doubleValue());
+            System.out.println("Passed with correct result");
+        } catch (ArithmeticException e) {
+            // expected
+            System.out.println("Overflow is reported by ArithmeticException, as expected");
+        } catch (OutOfMemoryError e) {
+            // possible
+            System.out.println("OutOfMemoryError");
+        }
+    }
+}
--- a/jdk/test/java/math/BigInteger/ExtremeShiftingTests.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/math/BigInteger/ExtremeShiftingTests.java	Wed Jul 05 19:21:26 2017 +0200
@@ -27,22 +27,41 @@
  * @summary Tests of shiftLeft and shiftRight on Integer.MIN_VALUE
  * @author Joseph D. Darcy
  */
+import java.math.BigInteger;
 import static java.math.BigInteger.*;
 
 public class ExtremeShiftingTests {
     public static void main(String... args) {
+        BigInteger bi = ONE.shiftLeft(Integer.MIN_VALUE);
+        if (!bi.equals(ZERO))
+            throw new RuntimeException("1 << " + Integer.MIN_VALUE);
+
+        bi = ZERO.shiftLeft(Integer.MIN_VALUE);
+        if (!bi.equals(ZERO))
+            throw new RuntimeException("0 << " + Integer.MIN_VALUE);
+
+        bi = BigInteger.valueOf(-1);
+        bi = bi.shiftLeft(Integer.MIN_VALUE);
+        if (!bi.equals(BigInteger.valueOf(-1)))
+            throw new RuntimeException("-1 << " + Integer.MIN_VALUE);
+
         try {
-            ONE.shiftLeft(Integer.MIN_VALUE);
-            throw new RuntimeException("Should not reach here.");
+            ONE.shiftRight(Integer.MIN_VALUE);
+            throw new RuntimeException("1 >> " + Integer.MIN_VALUE);
         } catch (ArithmeticException ae) {
             ; // Expected
         }
 
+        bi = ZERO.shiftRight(Integer.MIN_VALUE);
+        if (!bi.equals(ZERO))
+            throw new RuntimeException("0 >> " + Integer.MIN_VALUE);
+
         try {
-            ONE.shiftRight(Integer.MIN_VALUE);
-            throw new RuntimeException("Should not reach here.");
+            BigInteger.valueOf(-1).shiftRight(Integer.MIN_VALUE);
+            throw new RuntimeException("-1 >> " + Integer.MIN_VALUE);
         } catch (ArithmeticException ae) {
             ; // Expected
         }
+
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/math/BigInteger/StringConstructorOverflow.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @ test
+ * @bug 8021204
+ * @summary Test constructor BigInteger(String val, int radix) on very long string
+ * @author Dmitry Nadezhin
+ */
+import java.math.BigInteger;
+
+public class StringConstructorOverflow {
+
+    // String with hexadecimal value pow(2,pow(2,34))+1
+    private static String makeLongHexString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append('1');
+        for (int i = 0; i < (1 << 30) - 1; i++) {
+            sb.append('0');
+        }
+        sb.append('1');
+        return sb.toString();
+    }
+
+    public static void main(String[] args) {
+        try {
+            BigInteger bi = new BigInteger(makeLongHexString(), 16);
+            if (bi.compareTo(BigInteger.ONE) <= 0)
+                throw new RuntimeException("Incorrect result " + bi.toString());
+        } catch (ArithmeticException e) {
+            // expected
+            System.out.println("Overflow is reported by ArithmeticException, as expected");
+        } catch (OutOfMemoryError e) {
+            // possible
+            System.out.println("OutOfMemoryError");
+            System.out.println("Run jtreg with -javaoption:-Xmx8g");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/math/BigInteger/SymmetricRangeTests.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,662 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This test is intentionally ignored because of huge memory requirements
+ * @ test
+ * @run main/timeout=180/othervm -Xmx8g SymmetricRangeTests
+ * @bug 6910473 8021204 8021203 9005933
+ * @summary Test range of BigInteger values
+ * @author Dmitry Nadezhin
+ */
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Arrays;
+import java.util.Random;
+import java.math.BigInteger;
+
+public class SymmetricRangeTests {
+
+    private static final BigInteger MAX_VALUE = makeMaxValue();
+    private static final BigInteger MIN_VALUE = MAX_VALUE.negate();
+
+    private static BigInteger makeMaxValue() {
+        byte[] ba = new byte[1 << 28];
+        Arrays.fill(ba, (byte) 0xFF);
+        ba[0] = (byte) 0x7F;
+        return new BigInteger(ba);
+    }
+
+    private static void check(String msg, BigInteger actual, BigInteger expected) {
+        if (!actual.equals(expected)) {
+            throw new RuntimeException(msg + ".bitLength()=" + actual.bitLength());
+        }
+    }
+
+    private static void check(String msg, double actual, double expected) {
+        if (actual != expected) {
+            throw new RuntimeException(msg + "=" + actual);
+        }
+    }
+
+    private static void check(String msg, float actual, float expected) {
+        if (actual != expected) {
+            throw new RuntimeException(msg + "=" + actual);
+        }
+    }
+
+    private static void check(String msg, long actual, long expected) {
+        if (actual != expected) {
+            throw new RuntimeException(msg + "=" + actual);
+        }
+    }
+
+    private static void check(String msg, int actual, int expected) {
+        if (actual != expected) {
+            throw new RuntimeException(msg + "=" + actual);
+        }
+    }
+
+    private static void testOverflowInMakePositive() {
+        System.out.println("Testing overflow in BigInteger.makePositive");
+        byte[] ba = new byte[Integer.MAX_VALUE - 2];
+        ba[0] = (byte) 0x80;
+        try {
+            BigInteger actual = new BigInteger(ba);
+            throw new RuntimeException("new BigInteger(ba).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testBug8021204() {
+        System.out.println("Testing Bug 8021204");
+        StringBuilder sb = new StringBuilder();
+        sb.append('1');
+        for (int i = 0; i < (1 << 30) - 1; i++) {
+            sb.append('0');
+        }
+        sb.append('1');
+        String s = sb.toString();
+        sb = null;
+        try {
+            BigInteger actual = new BigInteger(s, 16);
+            throw new RuntimeException("new BigInteger(\"1000...001\").bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testOverflowInBitSieve() {
+        System.out.println("Testing overflow in BitSieve.sieveSingle");
+        int bitLength = (5 << 27) - 1;
+        try {
+            Random rnd = new Random();
+            BigInteger actual = new BigInteger(bitLength, 0, rnd);
+            throw new RuntimeException("new BigInteger(bitLength, 0, null).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+        try {
+            BigInteger bi = BigInteger.ONE.shiftLeft(bitLength - 1).subtract(BigInteger.ONE);
+            BigInteger actual = bi.nextProbablePrime();
+            throw new RuntimeException("bi.nextActualPrime().bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testAdd() {
+        System.out.println("Testing BigInteger.add");
+        try {
+            BigInteger actual = MAX_VALUE.add(BigInteger.ONE);
+            throw new RuntimeException("BigInteger.MAX_VALUE.add(BigInteger.ONE).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testSubtract() {
+        System.out.println("Testing BigInteger.subtract");
+        try {
+            BigInteger actual = MIN_VALUE.subtract(BigInteger.ONE);
+            throw new RuntimeException("BigInteger.MIN_VALUE.subtract(BigInteger.ONE).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testMultiply() {
+        System.out.println("Testing BigInteger.multiply");
+        int py = 2000;
+        int px = Integer.MAX_VALUE - py;
+        BigInteger x = BigInteger.ONE.shiftLeft(px);
+        BigInteger y = BigInteger.ONE.shiftLeft(py);
+        try {
+            BigInteger actual = x.multiply(y);
+            throw new RuntimeException("(1 << " + px + " ) * (1 << " + py + ").bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testDivide() {
+        System.out.println("Testing BigInteger.divide");
+        check("BigInteger.MIN_VALUE.divide(BigInteger.valueOf(-1))",
+                MIN_VALUE.divide(BigInteger.valueOf(-1)), MAX_VALUE);
+        check("BigInteger.MIN_VALUE.divide(BigInteger.ONE)",
+                MIN_VALUE.divide(BigInteger.ONE), MIN_VALUE);
+    }
+
+    private static void testDivideAndRemainder(String msg, BigInteger dividend, BigInteger divisor,
+            BigInteger expectedQuotent, BigInteger expectedRemainder) {
+        BigInteger[] qr = dividend.divideAndRemainder(divisor);
+        check(msg + "[0]", qr[0], expectedQuotent);
+        check(msg + "[1]", qr[1], expectedRemainder);
+    }
+
+    private static void testDivideAndRemainder() {
+        System.out.println("Testing BigInteger.divideAndRemainder");
+        testDivideAndRemainder("BigInteger.MIN_VALUE.divideAndRemainder(BigInteger.valueOf(-1))",
+                MIN_VALUE, BigInteger.valueOf(-1),
+                MAX_VALUE,
+                BigInteger.ZERO);
+    }
+
+    private static void testBug9005933() {
+        System.out.println("Testing Bug 9005933");
+        int dividendPow = 2147483646;
+        int divisorPow = 1568;
+        BigInteger dividend = BigInteger.ONE.shiftLeft(dividendPow);
+        BigInteger divisor = BigInteger.ONE.shiftLeft(divisorPow);
+        testDivideAndRemainder("(1 << " + dividendPow + ").divideAndRemainder(1 << " + divisorPow + ")",
+                dividend, divisor,
+                BigInteger.ONE.shiftLeft(dividendPow - divisorPow),
+                BigInteger.ZERO);
+    }
+
+    private static void testRemainder() {
+        System.out.println("Testing BigInteger.remainder");
+        check("BigInteger.MIN_VALUE.remainder(BigInteger.valueOf(-1))",
+                MIN_VALUE.remainder(BigInteger.valueOf(-1)), BigInteger.ZERO);
+    }
+
+    private static void testPow() {
+        System.out.println("Testing BigInteger.pow");
+        check("BigInteger.MIN_VALUE.pow(1)",
+                MIN_VALUE.pow(1), MIN_VALUE);
+        try {
+            BigInteger actual = BigInteger.valueOf(4).pow(Integer.MAX_VALUE);
+            throw new RuntimeException("BigInteger.valueOf(4).pow(Integer.MAX_VALUE).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testGcd() {
+        System.out.println("Testing BigInteger.gcd");
+        check("BigInteger.MIN_VALUE.gcd(BigInteger.MIN_VALUE)",
+                MIN_VALUE.gcd(MIN_VALUE), MAX_VALUE);
+        check("BigInteger.MIN_VALUE.gcd(BigInteger.ZERO)",
+                MIN_VALUE.gcd(BigInteger.ZERO), MAX_VALUE);
+        check("BigInteger.ZERO.gcd(MIN_VALUE)",
+                BigInteger.ZERO.gcd(MIN_VALUE), MAX_VALUE);
+    }
+
+    private static void testAbs() {
+        System.out.println("Testing BigInteger.abs");
+        check("BigInteger.MIN_VALUE.abs()",
+                MIN_VALUE.abs(), MAX_VALUE);
+        check("BigInteger.MAX_VALUE.abs()",
+                MAX_VALUE.abs(), MAX_VALUE);
+    }
+
+    private static void testNegate() {
+        System.out.println("Testing BigInteger.negate");
+        check("BigInteger.MIN_VALUE.negate()",
+                MIN_VALUE.negate(), MAX_VALUE);
+        check("BigInteger.MAX_VALUE.negate()",
+                MAX_VALUE.negate(), MIN_VALUE);
+    }
+
+    private static void testMod() {
+        System.out.println("Testing BigInteger.mod");
+        check("BigInteger.MIN_VALUE.mod(BigInteger.MAX_VALUE)",
+                MIN_VALUE.mod(MAX_VALUE), BigInteger.ZERO);
+        check("BigInteger.MAX_VALUE.mod(BigInteger.MAX_VALUE)",
+                MIN_VALUE.mod(MAX_VALUE), BigInteger.ZERO);
+    }
+
+    private static void testModPow() {
+        System.out.println("Testing BigInteger.modPow");
+        BigInteger x = BigInteger.valueOf(3);
+        BigInteger m = BigInteger.valueOf(-4).subtract(MIN_VALUE);
+        check("BigInteger.valueOf(3).modPow(BigInteger.ONE, m)",
+                x.modPow(BigInteger.ONE, m), x);
+    }
+
+    // slow test
+    private static void testModInverse() {
+        System.out.println("Testing BigInteger.modInverse");
+        check("BigInteger.MIN_VALUE.modInverse(BigInteger.MAX_VALUE)",
+                MIN_VALUE.modInverse(MAX_VALUE), MAX_VALUE.subtract(BigInteger.ONE));
+    }
+
+    private static void testShiftLeft() {
+        System.out.println("Testing BigInteger.shiftLeft");
+        try {
+            BigInteger actual = MIN_VALUE.shiftLeft(1);
+            throw new RuntimeException("BigInteger.MIN_VALUE.shiftLeft(1).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+        try {
+            BigInteger actual = MAX_VALUE.shiftLeft(1);
+            throw new RuntimeException("BigInteger.MAX_VALUE.shiftLeft(1).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testShiftRight() {
+        System.out.println("Testing BigInteger.shiftRight");
+        try {
+            BigInteger actual = MIN_VALUE.shiftRight(-1);
+            throw new RuntimeException("BigInteger.MIN_VALUE.shiftRight(-1).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+        try {
+            BigInteger actual = MAX_VALUE.shiftRight(-1);
+            throw new RuntimeException("BigInteger.MAX_VALUE.shiftRight(-1).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testAnd() {
+        System.out.println("Testing BigInteger.and");
+        check("BigInteger.MIN_VALUE.and(BigInteger.MIN_VALUE)",
+                MIN_VALUE.and(MIN_VALUE), MIN_VALUE);
+        check("BigInteger.MAX_VALUE.and(BigInteger.MAX_VALUE)",
+                MAX_VALUE.and(MAX_VALUE), MAX_VALUE);
+        check("BigInteger.MIN_VALUE.and(BigInteger.MAX_VALUE)",
+                MIN_VALUE.and(MAX_VALUE), BigInteger.ONE);
+        try {
+            BigInteger actual = MIN_VALUE.and(BigInteger.valueOf(-2));
+            throw new RuntimeException("BigInteger.MIN_VALUE.and(-2)).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testOr() {
+        System.out.println("Testing BigInteger.or");
+        check("BigInteger.MIN_VALUE.or(BigInteger.MIN_VALUE)",
+                MIN_VALUE.or(MIN_VALUE), MIN_VALUE);
+        check("BigInteger.MAX_VALUE.or(BigInteger.MAX_VALUE)",
+                MAX_VALUE.or(MAX_VALUE), MAX_VALUE);
+        check("BigInteger.MIN_VALUE.and(BigInteger.MAX_VALUE)",
+                MIN_VALUE.or(MAX_VALUE), BigInteger.valueOf(-1));
+    }
+
+    private static void testXor() {
+        System.out.println("Testing BigInteger.xor");
+        check("BigInteger.MIN_VALUE.xor(BigInteger.MIN_VALUE)",
+                MIN_VALUE.xor(MIN_VALUE), BigInteger.ZERO);
+        check("BigInteger.MAX_VALUE.xor(BigInteger.MAX_VALUE)",
+                MAX_VALUE.xor(MAX_VALUE), BigInteger.ZERO);
+        check("BigInteger.MIN_VALUE.xor(BigInteger.MAX_VALUE)",
+                MIN_VALUE.xor(MAX_VALUE), BigInteger.valueOf(-2));
+        try {
+            BigInteger actual = MIN_VALUE.xor(BigInteger.ONE);
+            throw new RuntimeException("BigInteger.MIN_VALUE.xor(BigInteger.ONE)).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testNot() {
+        System.out.println("Testing BigInteger.not");
+        check("BigInteger.MIN_VALUE.not()",
+                MIN_VALUE.not(), MAX_VALUE.subtract(BigInteger.ONE));
+        try {
+            BigInteger actual = MAX_VALUE.not();
+            throw new RuntimeException("BigInteger.MAX_VALUE.not()).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testSetBit() {
+        System.out.println("Testing BigInteger.setBit");
+        check("BigInteger.MIN_VALUE.setBit(" + Integer.MAX_VALUE + ")",
+                MIN_VALUE.setBit(Integer.MAX_VALUE), MIN_VALUE);
+        try {
+            BigInteger actual = MAX_VALUE.setBit(Integer.MAX_VALUE);
+            throw new RuntimeException("BigInteger.MAX_VALUE.setBit(" + Integer.MAX_VALUE + ").bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testClearBit() {
+        System.out.println("Testing BigInteger.clearBit");
+        check("BigInteger.MAX_VALUE.clearBit(" + Integer.MAX_VALUE + ")",
+                MAX_VALUE.clearBit(Integer.MAX_VALUE), MAX_VALUE);
+        try {
+            BigInteger actual = MIN_VALUE.clearBit(Integer.MAX_VALUE);
+            throw new RuntimeException("BigInteger.MIN_VALUE.clearBit(" + Integer.MAX_VALUE + ").bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+        try {
+            BigInteger actual = MIN_VALUE.clearBit(0);
+            throw new RuntimeException("BigInteger.MIN_VALUE.clearBit(0).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testFlipBit() {
+        System.out.println("Testing BigInteger.flipBit");
+        try {
+            BigInteger actual = MIN_VALUE.flipBit(Integer.MAX_VALUE);
+            throw new RuntimeException("BigInteger.MIN_VALUE.flipBit(" + Integer.MAX_VALUE + ").bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+        try {
+            BigInteger actual = MIN_VALUE.flipBit(0);
+            throw new RuntimeException("BigInteger.MIN_VALUE.flipBit(0).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+        try {
+            BigInteger actual = MAX_VALUE.flipBit(Integer.MAX_VALUE);
+            throw new RuntimeException("BigInteger.MAX_VALUE.flipBit(" + Integer.MAX_VALUE + ").bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testGetLowestSetBit() {
+        System.out.println("Testing BigInteger.getLowestSetBit");
+        check("BigInteger.MIN_VALUE.getLowestSetBit()",
+                MIN_VALUE.getLowestSetBit(), 0);
+        check("BigInteger.MAX_VALUE.getLowestSetBit()",
+                MAX_VALUE.getLowestSetBit(), 0);
+    }
+
+    private static void testBitLength() {
+        System.out.println("Testing BigInteger.bitLength");
+        check("BigInteger.MIN_NEXT.bitLength()",
+                MIN_VALUE.bitLength(), Integer.MAX_VALUE);
+        check("BigInteger.MAX_VALUE.bitLength()",
+                MAX_VALUE.bitLength(), Integer.MAX_VALUE);
+    }
+
+    private static void testBitCount() {
+        System.out.println("Testing BigInteger.bitCount");
+        check("BigInteger.MIN_VALUE.bitCount()",
+                MIN_VALUE.bitCount(), Integer.MAX_VALUE - 1);
+        check("BigInteger.MAX_VALUE.bitCount()",
+                MAX_VALUE.bitCount(), Integer.MAX_VALUE);
+    }
+
+    private static void testToString(String msg, int radix, BigInteger bi, int length, String startsWith, char c) {
+        String s = bi.toString(radix);
+        if (s.length() != length) {
+            throw new RuntimeException(msg + ".length=" + s.length());
+        }
+        if (!s.startsWith(startsWith)) {
+            throw new RuntimeException(msg + "[0]=" + s.substring(0, startsWith.length()));
+        }
+        for (int i = startsWith.length(); i < s.length(); i++) {
+            if (s.charAt(i) != c) {
+                throw new RuntimeException(msg + "[" + i + "]='" + s.charAt(i) + "'");
+            }
+        }
+    }
+
+    private static void testToString() {
+        System.out.println("Testing BigInteger.toString");
+        testToString("BigInteger.MIN_VALUE.toString(16)=", 16,
+                BigInteger.valueOf(-1).shiftLeft(Integer.MAX_VALUE - 1),
+                (1 << 29) + 1, "-4", '0');
+    }
+
+    private static void testToByteArrayWithConstructor(String msg, BigInteger bi, int length, byte msb, byte b, byte lsb) {
+        byte[] ba = bi.toByteArray();
+        if (ba.length != length) {
+            throw new RuntimeException(msg + ".length=" + ba.length);
+        }
+        if (ba[0] != msb) {
+            throw new RuntimeException(msg + "[0]=" + ba[0]);
+        }
+        for (int i = 1; i < ba.length - 1; i++) {
+            if (ba[i] != b) {
+                throw new RuntimeException(msg + "[" + i + "]=" + ba[i]);
+            }
+        }
+        if (ba[ba.length - 1] != lsb) {
+            throw new RuntimeException(msg + "[" + (ba.length - 1) + "]=" + ba[ba.length - 1]);
+        }
+        BigInteger actual = new BigInteger(ba);
+        if (!actual.equals(bi)) {
+            throw new RuntimeException(msg + ".bitLength()=" + actual.bitLength());
+        }
+    }
+
+    private static void testToByteArrayWithConstructor() {
+        System.out.println("Testing BigInteger.toByteArray with constructor");
+        testToByteArrayWithConstructor("BigInteger.MIN_VALUE.toByteArray()",
+                MIN_VALUE, (1 << 28), (byte) 0x80, (byte) 0x00, (byte) 0x01);
+        testToByteArrayWithConstructor("BigInteger.MAX_VALUE.toByteArray()",
+                MAX_VALUE, (1 << 28), (byte) 0x7f, (byte) 0xff, (byte) 0xff);
+
+        byte[] ba = new byte[1 << 28];
+        ba[0] = (byte) 0x80;
+        try {
+            BigInteger actual = new BigInteger(-1, ba);
+            throw new RuntimeException("new BigInteger(-1, ba).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+        try {
+            BigInteger actual = new BigInteger(1, ba);
+            throw new RuntimeException("new BigInteger(1, ba).bitLength()=" + actual.bitLength());
+        } catch (ArithmeticException e) {
+            // expected
+        }
+    }
+
+    private static void testIntValue() {
+        System.out.println("Testing BigInteger.intValue");
+        check("BigInteger.MIN_VALUE.intValue()",
+                MIN_VALUE.intValue(), 1);
+        check("BigInteger.MAX_VALUE.floatValue()",
+                MAX_VALUE.intValue(), -1);
+    }
+
+    private static void testLongValue() {
+        System.out.println("Testing BigInteger.longValue");
+        check("BigInteger.MIN_VALUE.longValue()",
+                MIN_VALUE.longValue(), 1L);
+        check("BigInteger.MAX_VALUE.longValue()",
+                MAX_VALUE.longValue(), -1L);
+    }
+
+    private static void testFloatValue() {
+        System.out.println("Testing BigInteger.floatValue, Bug 8021203");
+        check("BigInteger.MIN_VALUE_.floatValue()",
+                MIN_VALUE.floatValue(), Float.NEGATIVE_INFINITY);
+        check("BigInteger.MAX_VALUE.floatValue()",
+                MAX_VALUE.floatValue(), Float.POSITIVE_INFINITY);
+    }
+
+    private static void testDoubleValue() {
+        System.out.println("Testing BigInteger.doubleValue, Bug 8021203");
+        check("BigInteger.MIN_VALUE.doubleValue()",
+                MIN_VALUE.doubleValue(), Double.NEGATIVE_INFINITY);
+        check("BigInteger.MAX_VALUE.doubleValue()",
+                MAX_VALUE.doubleValue(), Double.POSITIVE_INFINITY);
+    }
+
+    private static void testSerialization(String msg, BigInteger bi) {
+        try {
+            ByteArrayOutputStream baOut = new ByteArrayOutputStream((1 << 28) + 1000);
+            ObjectOutputStream out = new ObjectOutputStream(baOut);
+            out.writeObject(bi);
+            out.close();
+            out = null;
+            byte[] ba = baOut.toByteArray();
+            baOut = null;
+            ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(ba));
+            BigInteger actual = (BigInteger) in.readObject();
+            if (!actual.equals(bi)) {
+                throw new RuntimeException(msg + ".bitLength()=" + actual.bitLength());
+            }
+        } catch (IOException | ClassNotFoundException e) {
+            throw new RuntimeException(msg + " raised exception ", e);
+        }
+    }
+
+    private static void testSerialization() {
+        System.out.println("Testing BigInteger serialization");
+        testSerialization("BigInteger.MIN_VALUE.intValue()",
+                MIN_VALUE);
+        testSerialization("BigInteger.MAX_VALUE.floatValue()",
+                MAX_VALUE);
+    }
+
+    private static void testLongValueExact() {
+        System.out.println("Testing BigInteger.longValueExact");
+        try {
+            long actual = MIN_VALUE.longValueExact();
+            throw new RuntimeException("BigInteger.MIN_VALUE.longValueExact()= " + actual);
+        } catch (ArithmeticException e) {
+            // excpected
+        }
+        try {
+            long actual = MAX_VALUE.longValueExact();
+            throw new RuntimeException("BigInteger.MAX_VALUE.longValueExact()= " + actual);
+        } catch (ArithmeticException e) {
+            // excpected
+        }
+    }
+
+    private static void testIntValueExact() {
+        System.out.println("Testing BigInteger.intValueExact");
+        try {
+            long actual = MIN_VALUE.intValueExact();
+            throw new RuntimeException("BigInteger.MIN_VALUE.intValueExact()= " + actual);
+        } catch (ArithmeticException e) {
+            // excpected
+        }
+        try {
+            long actual = MAX_VALUE.intValueExact();
+            throw new RuntimeException("BigInteger.MAX_VALUE.intValueExact()= " + actual);
+        } catch (ArithmeticException e) {
+            // excpected
+        }
+    }
+
+    private static void testShortValueExact() {
+        System.out.println("Testing BigInteger.shortValueExact");
+        try {
+            long actual = MIN_VALUE.shortValueExact();
+            throw new RuntimeException("BigInteger.MIN_VALUE.shortValueExact()= " + actual);
+        } catch (ArithmeticException e) {
+            // excpected
+        }
+        try {
+            long actual = MAX_VALUE.shortValueExact();
+            throw new RuntimeException("BigInteger.MAX_VALUE.shortValueExact()= " + actual);
+        } catch (ArithmeticException e) {
+            // excpected
+        }
+    }
+
+    private static void testByteValueExact() {
+        System.out.println("Testing BigInteger.byteValueExact");
+        try {
+            long actual = MIN_VALUE.byteValueExact();
+            throw new RuntimeException("BigInteger.MIN_VALUE.byteValueExact()= " + actual);
+        } catch (ArithmeticException e) {
+            // excpected
+        }
+        try {
+            long actual = MAX_VALUE.byteValueExact();
+            throw new RuntimeException("BigInteger.MAX_VALUE.byteValueExact()= " + actual);
+        } catch (ArithmeticException e) {
+            // excpected
+        }
+    }
+
+    public static void main(String... args) {
+        testOverflowInMakePositive();
+        testBug8021204();
+        testOverflowInBitSieve();
+        testAdd();
+        testSubtract();
+        testMultiply();
+        testDivide();
+        testDivideAndRemainder();
+        testBug9005933();
+        testRemainder();
+        testPow();
+        testGcd();
+        testAbs();
+        testNegate();
+        testMod();
+        testModPow();
+//        testModInverse();
+        testShiftLeft();
+        testShiftRight();
+        testAnd();
+        testOr();
+        testXor();
+        testNot();
+        testSetBit();
+        testClearBit();
+        testFlipBit();
+        testGetLowestSetBit();
+        testBitLength();
+        testBitCount();
+        testToString();
+        testToByteArrayWithConstructor();
+        testIntValue();
+        testLongValue();
+        testFloatValue();
+        testDoubleValue();
+        testSerialization();
+        testLongValueExact();
+        testIntValueExact();
+        testShortValueExact();
+        testByteValueExact();
+    }
+}
--- a/jdk/test/java/net/Authenticator/B4769350.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/net/Authenticator/B4769350.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -23,9 +23,7 @@
 
 /**
  * @test
- * @bug 4769350
- * @library ../../../sun/net/www/httptest/
- * @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction AbstractCallback
+ * @bug 4769350 8017779
  * @run main/othervm B4769350 server
  * @run main/othervm B4769350 proxy
  * @summary proxy authentication username and password caching only works in serial case
@@ -34,8 +32,17 @@
  * tests may already have invoked the HTTP handler.
  */
 
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
 import java.io.*;
 import java.net.*;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 public class B4769350 {
 
@@ -43,13 +50,12 @@
     static boolean error = false;
 
     static void read (InputStream is) throws IOException {
-        int c;
-        while ((c=is.read()) != -1) {
+        while (is.read() != -1) {
             //System.out.write (c);
         }
     }
 
-    static class Client extends Thread {
+     static class Client extends Thread {
         String authority, path;
         boolean allowerror;
 
@@ -64,8 +70,8 @@
             try {
                 URI u = new URI ("http", authority, path, null, null);
                 URL url = u.toURL();
-                URLConnection urlc = url.openConnection ();
-                InputStream is = urlc.getInputStream ();
+                URLConnection urlc = url.openConnection();
+                InputStream is = urlc.getInputStream();
                 read (is);
                 is.close();
             } catch (URISyntaxException  e) {
@@ -73,7 +79,8 @@
                 error = true;
             } catch (IOException e) {
                 if (!allowerror) {
-                    System.out.println (Thread.currentThread().getName() + " " + e);
+                    System.out.println (Thread.currentThread().getName()
+                            + " " + e);
                     e.printStackTrace();
                     error = true;
                 }
@@ -81,55 +88,58 @@
         }
     }
 
-    static class CallBack extends AbstractCallback {
-
-        void errorReply (HttpTransaction req, String reply) throws IOException {
-            req.addResponseHeader ("Connection", "close");
-            req.addResponseHeader ("WWW-Authenticate", reply);
-            req.sendResponse (401, "Unauthorized");
-            req.orderlyClose();
-        }
+    class Server implements AutoCloseable {
+        HttpServer server;
+        Executor executor;
+        CyclicBarrier t1Cond1;
+        CyclicBarrier t1Cond2;
 
-        void proxyReply (HttpTransaction req, String reply) throws IOException {
-            req.addResponseHeader ("Proxy-Authenticate", reply);
-            req.sendResponse (407, "Proxy Authentication Required");
-        }
-
-        void okReply (HttpTransaction req) throws IOException {
-            req.addResponseHeader ("Connection", "close");
-            req.setResponseEntityBody ("Hello .");
-            req.sendResponse (200, "Ok");
-            req.orderlyClose();
+        public String getAddress() {
+            return server.getAddress().getHostName();
         }
 
-        public void request (HttpTransaction req, int count) {
+        public void startServer() {
+            InetSocketAddress addr = new InetSocketAddress(0);
+
             try {
-                URI uri = req.getRequestURI();
-                String path = uri.getPath();
-                if (path.endsWith ("/t1a")) {
-                    doT1a (req, count);
-                } else if (path.endsWith ("/t1b")) {
-                    doT1b (req, count);
-                } else if (path.endsWith ("/t1c")) {
-                    doT1c (req, count);
-                } else if (path.endsWith ("/t1d")) {
-                    doT1d (req, count);
-                } else if (path.endsWith ("/t2a")) {
-                    doT2a (req, count);
-                } else if (path.endsWith ("/t2b")) {
-                    doT2b (req, count);
-                } else if (path.endsWith ("/t3a")) {
-                    doT3a (req, count);
-                } else if (path.endsWith ("/t3b")) {
-                    doT3bc (req, count);
-                } else if (path.endsWith ("/t3c")) {
-                    doT3bc (req, count);
-                } else {
-                   System.out.println ("unexpected request URI");
-                }
-            } catch (IOException e) {
-                e.printStackTrace();
+                server = HttpServer.create(addr, 0);
+            } catch (IOException ioe) {
+                throw new RuntimeException("Server could not be created");
             }
+            executor = Executors.newFixedThreadPool(10);
+            server.setExecutor(executor);
+            server.createContext("/test/realm1/t1a",
+                    new AuthenticationHandlerT1a() );
+            server.createContext("/test/realm2/t1b",
+                    new AuthenticationHandlerT1b());
+            server.createContext("/test/realm1/t1c",
+                    new AuthenticationHandlerT1c());
+            server.createContext("/test/realm2/t1d",
+                    new AuthenticationHandlerT1d());
+            server.createContext("/test/realm3/t2a",
+                    new AuthenticationHandlerT2a());
+            server.createContext("/test/realm3/t2b",
+                    new AuthenticationHandlerT2b());
+            server.createContext("/test/realm4/t3a",
+                    new AuthenticationHandlerT3a());
+            server.createContext("/test/realm4/t3b",
+                    new AuthenticationHandlerT3bc());
+            server.createContext("/test/realm4/t3c",
+                    new AuthenticationHandlerT3bc());
+            t1Cond1 = new CyclicBarrier(2);
+            t1Cond2 = new CyclicBarrier(2);
+            server.start();
+        }
+
+        public int getPort() {
+            return server.getAddress().getPort();
+        }
+
+        public void close() {
+            if (executor != null)
+                ((ExecutorService)executor).shutdownNow();
+            if (server != null)
+                server.stop(0);
         }
 
         /* T1 tests the client by sending 4 requests to 2 different realms
@@ -138,90 +148,158 @@
          * the second requests should be executed without calling the authenticator.
          * The test succeeds if the authenticator was only called twice.
          */
-        void doT1a (HttpTransaction req, int count) throws IOException {
-            switch (count) {
-            case 0:
-                errorReply (req, "Basic realm=\"realm1\"");
-                TestHttpServer.rendezvous ("one", 2);
-                break;
-            case 1:
-                TestHttpServer.waitForCondition ("cond2");
-                okReply (req);
-                break;
-            default:
-                System.out.println ("Unexpected request");
+        class AuthenticationHandlerT1a implements HttpHandler
+        {
+            volatile int count = -1;
+
+            @Override
+            public void handle(HttpExchange exchange) throws IOException {
+                count++;
+                try {
+                    switch(count) {
+                        case 0:
+                            AuthenticationHandler.errorReply(exchange,
+                                    "Basic realm=\"realm1\"");
+                            break;
+                        case 1:
+                            t1Cond1.await();
+                            t1cond2latch.await();
+                            AuthenticationHandler.okReply(exchange);
+                            break;
+                        default:
+                            System.out.println ("Unexpected request");
+                    }
+                } catch (InterruptedException |
+                                 BrokenBarrierException e)
+                        {
+                            throw new RuntimeException(e);
+                        }
+            }
+        }
+
+        class AuthenticationHandlerT1b implements HttpHandler
+        {
+            volatile int count = -1;
+
+            @Override
+            public void handle(HttpExchange exchange) throws IOException {
+                count++;
+                try {
+                    switch(count) {
+                        case 0:
+                            AuthenticationHandler.errorReply(exchange,
+                                    "Basic realm=\"realm2\"");
+                            break;
+                        case 1:
+                            t1Cond1.await();
+                            t1cond1latch.countDown();
+                            t1cond2latch.await();
+                            AuthenticationHandler.okReply(exchange);
+                            break;
+                        default:
+                            System.out.println ("Unexpected request");
+                    }
+                } catch (InterruptedException | BrokenBarrierException e) {
+                    throw new RuntimeException(e);
+                }
             }
         }
 
+        class AuthenticationHandlerT1c implements HttpHandler
+        {
+            volatile int count = -1;
 
-        void doT1b (HttpTransaction req, int count) throws IOException {
-            switch (count) {
-            case 0:
-                errorReply (req, "Basic realm=\"realm2\"");
-                TestHttpServer.rendezvous ("one", 2);
-                TestHttpServer.setCondition ("cond1");
-                break;
-            case 1:
-                TestHttpServer.waitForCondition ("cond2");
-                okReply (req);
-                break;
-            default:
-                System.out.println ("Unexpected request");
+            @Override
+            public void handle(HttpExchange exchange) throws IOException {
+                count++;
+                switch(count) {
+                    case 0:
+                        AuthenticationHandler.errorReply(exchange,
+                                "Basic realm=\"realm1\"");
+                        try {
+                            t1Cond2.await();
+                        } catch (InterruptedException |
+                                 BrokenBarrierException e)
+                        {
+                            throw new RuntimeException(e);
+                        }
+                        break;
+                    case 1:
+                        AuthenticationHandler.okReply(exchange);
+                        break;
+                    default:
+                        System.out.println ("Unexpected request");
+                }
             }
         }
 
-        void doT1c (HttpTransaction req, int count) throws IOException {
-            switch (count) {
-            case 0:
-                errorReply (req, "Basic realm=\"realm1\"");
-                TestHttpServer.rendezvous ("two", 2);
-                break;
-            case 1:
-                okReply (req);
-                break;
-            default:
-                System.out.println ("Unexpected request");
+        class AuthenticationHandlerT1d implements HttpHandler
+        {
+            volatile int count = -1;
+
+            @Override
+            public void handle(HttpExchange exchange) throws IOException {
+                count++;
+                switch(count) {
+                    case 0:
+                        AuthenticationHandler.errorReply(exchange,
+                                "Basic realm=\"realm2\"");
+                        try {
+                            t1Cond2.await();
+                        } catch (InterruptedException |
+                                 BrokenBarrierException e)
+                        {
+                            throw new RuntimeException(e);
+                        }
+                        t1cond2latch.countDown();
+                        break;
+                    case 1:
+                        AuthenticationHandler.okReply(exchange);
+                        break;
+                    default:
+                        System.out.println ("Unexpected request");
+                }
             }
         }
 
-        void doT1d (HttpTransaction req, int count) throws IOException {
-            switch (count) {
-            case 0:
-                errorReply (req, "Basic realm=\"realm2\"");
-                TestHttpServer.rendezvous ("two", 2);
-                TestHttpServer.setCondition ("cond2");
-                break;
-            case 1:
-                okReply (req);
-                break;
-            default:
-                System.out.println ("Unexpected request");
-            }
-        }
-
-
         /* T2 tests to check that if initial authentication fails, the second will
          * succeed, and the authenticator is called twice
          */
 
-        void doT2a (HttpTransaction req, int count) throws IOException {
-            /* This will be called several times */
-            if (count == 1) {
-                TestHttpServer.setCondition ("T2cond1");
+        class AuthenticationHandlerT2a implements HttpHandler
+        {
+            volatile int count = -1;
+
+            @Override
+            public void handle(HttpExchange exchange) throws IOException {
+                count++;
+                if (count == 1) {
+                    t2condlatch.countDown();
+                }
+                AuthenticationHandler.errorReply(exchange,
+                        "Basic realm=\"realm3\"");
+
             }
-            errorReply (req, "Basic realm=\"realm3\"");
         }
 
-        void doT2b (HttpTransaction req, int count) throws IOException {
-            switch (count) {
-            case 0:
-                errorReply (req, "Basic realm=\"realm3\"");
-                break;
-            case 1:
-                okReply (req);
-                break;
-            default:
-                System.out.println ("Unexpected request");
+         class AuthenticationHandlerT2b implements HttpHandler
+        {
+            volatile int count = -1;
+
+            @Override
+            public void handle(HttpExchange exchange) throws IOException {
+                count++;
+                switch(count) {
+                    case 0:
+                        AuthenticationHandler.errorReply(exchange,
+                                "Basic realm=\"realm3\"");
+                        break;
+                    case 1:
+                        AuthenticationHandler.okReply(exchange);
+                        break;
+                    default:
+                        System.out.println ("Unexpected request");
+                }
             }
         }
 
@@ -229,63 +307,117 @@
          * resource at same time. Authenticator should be called once for server
          * and once for proxy
          */
-        void doT3a (HttpTransaction req, int count) throws IOException {
-            switch (count) {
-            case 0:
-                proxyReply (req, "Basic realm=\"proxy\"");
-                TestHttpServer.setCondition ("T3cond1");
-                break;
-            case 1:
-                errorReply (req, "Basic realm=\"realm4\"");
-                break;
-            case 2:
-                okReply (req);
-                break;
-            default:
-                System.out.println ("Unexpected request");
+
+        class AuthenticationHandlerT3a implements HttpHandler
+        {
+            volatile int count = -1;
+
+            @Override
+            public void handle(HttpExchange exchange) throws IOException {
+                count++;
+                switch(count) {
+                    case 0:
+                        AuthenticationHandler.proxyReply(exchange,
+                                "Basic realm=\"proxy\"");
+                        break;
+                    case 1:
+                        t3cond1.countDown();
+                        AuthenticationHandler.errorReply(exchange,
+                                "Basic realm=\"realm4\"");
+                        break;
+                    case 2:
+                        AuthenticationHandler.okReply(exchange);
+                        break;
+                    default:
+                        System.out.println ("Unexpected request");
+                }
             }
         }
 
-        void doT3bc (HttpTransaction req, int count) throws IOException {
-            switch (count) {
-            case 0:
-                proxyReply (req, "Basic realm=\"proxy\"");
-                break;
-            case 1:
-                okReply (req);
-                break;
-            default:
-                System.out.println ("Unexpected request");
+        class AuthenticationHandlerT3bc implements HttpHandler
+        {
+            volatile int count = -1;
+
+            @Override
+            public void handle(HttpExchange exchange) throws IOException {
+                count++;
+                switch(count) {
+                    case 0:
+                        AuthenticationHandler.proxyReply(exchange,
+                                "Basic realm=\"proxy\"");
+                        break;
+                    case 1:
+                        AuthenticationHandler.okReply(exchange);
+                        break;
+                    default:
+                        System.out.println ("Unexpected request");
+                }
             }
         }
-    };
+    }
+
+    static class AuthenticationHandler {
+        static void errorReply(HttpExchange exchange, String reply)
+                throws IOException
+        {
+            exchange.getResponseHeaders().add("Connection", "close");
+            exchange.getResponseHeaders().add("WWW-Authenticate", reply);
+            exchange.sendResponseHeaders(401, 0);
+            exchange.close();
+        }
 
-    static TestHttpServer server;
+        static void proxyReply (HttpExchange exchange, String reply)
+                throws IOException
+        {
+            exchange.getResponseHeaders().add("Proxy-Authenticate", reply);
+            exchange.sendResponseHeaders(407, 0);
+        }
+
+        static void okReply (HttpExchange exchange) throws IOException {
+            exchange.getResponseHeaders().add("Connection", "close");
+            String response = "Hello .";
+            exchange.sendResponseHeaders(200, response.getBytes().length);
+            OutputStream os = exchange.getResponseBody();
+            os.write(response.getBytes());
+            os.close();
+            exchange.close();
+        }
+    }
+
+    static Server server;
     static MyAuthenticator auth = new MyAuthenticator ();
 
     static int redirects = 4;
 
     static Client c1,c2,c3,c4,c5,c6,c7,c8,c9;
 
-    static void doServerTests (String authority) throws Exception {
+    static CountDownLatch t1cond1latch;
+    static CountDownLatch t1cond2latch;
+    static CountDownLatch t2condlatch;
+    static CountDownLatch t3cond1;
+
+    static void doServerTests (String authority, Server server) throws Exception
+    {
         System.out.println ("Doing Server tests");
         System.out.println ("T1");
         c1 = new Client (authority, "/test/realm1/t1a", false);
         c2 = new Client (authority, "/test/realm2/t1b", false);
         c3 = new Client (authority, "/test/realm1/t1c", false);
         c4 = new Client (authority, "/test/realm2/t1d", false);
-
+        t1cond1latch = new CountDownLatch(1);
+        t1cond2latch = new CountDownLatch(1);
         c1.start(); c2.start();
-        TestHttpServer.waitForCondition ("cond1");
+        t1cond1latch.await();
         c3.start(); c4.start();
         c1.join(); c2.join(); c3.join(); c4.join();
 
         int f = auth.getCount();
         if (f != 2) {
-            except ("Authenticator was called "+f+" times. Should be 2");
+            except ("Authenticator was called "+f+" times. Should be 2",
+                    server);
         }
         if (error) {
-            except ("error occurred");
+            except ("error occurred", server);
         }
 
         auth.resetCount();
@@ -293,73 +425,71 @@
 
         c5 = new Client (authority, "/test/realm3/t2a", true);
         c6 = new Client (authority, "/test/realm3/t2b", false);
+        t2condlatch = new CountDownLatch(1);
         c5.start ();
-        TestHttpServer.waitForCondition ("T2cond1");
+        t2condlatch.await();
         c6.start ();
         c5.join(); c6.join();
 
         f = auth.getCount();
         if (f != redirects+1) {
-            except ("Authenticator was called "+f+" times. Should be: " + redirects+1);
+            except ("Authenticator was called "+f+" times. Should be: "
+                    + redirects+1, server);
         }
         if (error) {
-            except ("error occurred");
+            except ("error occurred", server);
         }
     }
 
-    static void doProxyTests (String authority) throws Exception {
+    static void doProxyTests (String authority, Server server) throws Exception
+    {
         System.out.println ("Doing Proxy tests");
         c7 = new Client (authority, "/test/realm4/t3a", false);
         c8 = new Client (authority, "/test/realm4/t3b", false);
         c9 = new Client (authority, "/test/realm4/t3c", false);
+        t3cond1 = new CountDownLatch(1);
         c7.start ();
-        TestHttpServer.waitForCondition ("T3cond1");
+        t3cond1.await();
         c8.start ();
         c9.start ();
         c7.join(); c8.join(); c9.join();
 
         int f = auth.getCount();
         if (f != 2) {
-            except ("Authenticator was called "+f+" times. Should be: " + 2);
+            except ("Authenticator was called "+f+" times. Should be: " + 2,
+                    server);
         }
         if (error) {
-            except ("error occurred");
+            except ("error occurred", server);
         }
     }
 
     public static void main (String[] args) throws Exception {
+        new B4769350().runTest(args[0].equals ("proxy"));
+    }
+
+    public void runTest(boolean proxy) throws Exception {
         System.setProperty ("http.maxRedirects", Integer.toString (redirects));
         System.setProperty ("http.auth.serializeRequests", "true");
         Authenticator.setDefault (auth);
-        boolean proxy = args[0].equals ("proxy");
-        try {
-            server = new TestHttpServer (new CallBack(), 10, 1, 0);
-            System.out.println ("Server: listening on port: " + server.getLocalPort());
+        try (Server server = new Server()) {
+            server.startServer();
+            System.out.println ("Server: listening on port: "
+                    + server.getPort());
             if (proxy) {
                 System.setProperty ("http.proxyHost", "localhost");
-                System.setProperty ("http.proxyPort",Integer.toString(server.getLocalPort()));
-                doProxyTests ("www.foo.com");
+                System.setProperty ("http.proxyPort",
+                        Integer.toString(server.getPort()));
+                doProxyTests ("www.foo.com", server);
             } else {
-                doServerTests ("localhost:"+server.getLocalPort());
+                doServerTests ("localhost:"+server.getPort(), server);
             }
-            server.terminate();
+        }
 
-        } catch (Exception e) {
-            if (server != null) {
-                server.terminate();
-            }
-            throw e;
-        }
     }
 
-    static void pause (int millis) {
-        try {
-            Thread.sleep (millis);
-        } catch (InterruptedException e) {}
-    }
-
-    public static void except (String s) {
-        server.terminate();
+    public static void except (String s, Server server) {
+        server.close();
         throw new RuntimeException (s);
     }
 
@@ -368,13 +498,10 @@
             super ();
         }
 
-        int count = 0;
+        volatile int count = 0;
 
+        @Override
         public PasswordAuthentication getPasswordAuthentication () {
-            //System.out.println ("Authenticator called: " + getRequestingPrompt());
-            //try {
-                //Thread.sleep (1000);
-            //} catch (InterruptedException e) {}
             PasswordAuthentication pw;
             pw = new PasswordAuthentication ("user", "pass1".toCharArray());
             count ++;
@@ -386,7 +513,8 @@
         }
 
         public int getCount () {
-            return (count);
+            return count;
         }
     }
 }
+
--- a/jdk/test/java/net/CookieHandler/TestHttpCookie.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/net/CookieHandler/TestHttpCookie.java	Wed Jul 05 19:21:26 2017 +0200
@@ -24,7 +24,7 @@
 /**
  * @test
  * @summary Unit test for java.net.HttpCookie
- * @bug 6244040 6277796 6277801 6277808 6294071 6692802 6790677 6901170
+ * @bug 6244040 6277796 6277801 6277808 6294071 6692802 6790677 6901170 8020758
  * @author Edward Wang
  */
 
@@ -381,6 +381,9 @@
         // CR 6692802: HttpOnly flag
         test("set-cookie: CUSTOMER=WILE_E_COYOTE;HttpOnly").httpOnly(true);
         test("set-cookie: CUSTOMER=WILE_E_COYOTE").httpOnly(false);
+
+        // space disallowed in name (both Netscape and RFC2965)
+        test("set-cookie: CUST OMER=WILE_E_COYOTE").nil();
     }
 
     static void header(String prompt) {
--- a/jdk/test/java/net/NetworkInterface/MemLeakTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* @test
- * @bug 8022584
- * @summary Some NetworkInterface methods can leak native memory
- * @run main/othervm/timeout=700 MemLeakTest
- */
-
-/* Note: the test can cause a memory leak that's why othervm option is required
- */
-
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.util.Collection;
-import java.util.Collections;
-
-public class MemLeakTest {
-
-    /**
-     * Memory leak is assumed, if application consumes more than specified amount of memory during its execution.
-     * The number is given in Kb.
-     */
-    private static final long MEM_LEAK_THRESHOLD = 32 * 1024; // 32Mb
-
-    public static void main(String[] args)
-            throws Exception {
-
-        if (!System.getProperty("os.name").equals("Linux")) {
-            System.out.println("Test only runs on Linux");
-            return;
-        }
-
-        // warm up
-        accessNetInterfaces(3);
-
-        long vMemBefore = getVMemSize();
-        accessNetInterfaces(500_000);
-        long vMemAfter = getVMemSize();
-
-        long vMemDelta = vMemAfter - vMemBefore;
-        if (vMemDelta > MEM_LEAK_THRESHOLD) {
-            throw new Exception("FAIL: Virtual memory usage increased by " + vMemDelta + "Kb " +
-                    "(greater than " + MEM_LEAK_THRESHOLD + "Kb)");
-        }
-
-        System.out.println("PASS: Virtual memory usage increased by " + vMemDelta + "Kb " +
-                "(not greater than " + MEM_LEAK_THRESHOLD + "Kb)");
-    }
-
-    private static void accessNetInterfaces(int times) {
-        try {
-            Collection<NetworkInterface> interfaces =
-                    Collections.list(NetworkInterface.getNetworkInterfaces());
-            for (int i = 0; i != times; ++i) {
-                for (NetworkInterface netInterface : interfaces) {
-                    netInterface.getMTU();
-                    netInterface.isLoopback();
-                    netInterface.isUp();
-                    netInterface.isPointToPoint();
-                    netInterface.supportsMulticast();
-                }
-            }
-        } catch (SocketException ignore) {}
-    }
-
-    /**
-     * Returns size of virtual memory allocated to the process in Kb.
-     * Linux specific. On other platforms and in case of any errors returns 0.
-     */
-    private static long getVMemSize() {
-
-        // Refer to the Linux proc(5) man page for details about /proc/self/stat file
-        //
-        // In short, this file contains status information about the current process
-        // written in one line. The fields are separated with spaces.
-        // The 23rd field is defined as 'vsize %lu   Virtual memory size in bytes'
-
-        try (FileReader fileReader = new FileReader("/proc/self/stat");
-             BufferedReader bufferedReader = new BufferedReader(fileReader)) {
-            String line = bufferedReader.readLine();
-            return Long.parseLong(line.split(" ")[22]) / 1024;
-        } catch (Exception ignore) {}
-        return 0;
-    }
-}
--- a/jdk/test/java/net/ProxySelector/SystemProxies.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/net/ProxySelector/SystemProxies.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,29 +33,39 @@
 
 public class SystemProxies {
 
-    static final String uriAuthority = "myMachine/";
+    static final String[] uriAuthority = { "myMachine/", "local", "localhost",
+                                           "127.0.0.1", "127.0.0.123",
+                                           "127.0.2.2", "127.3.3.3",
+                                           "128.0.0.1" };
     static final ProxySelector proxySel = ProxySelector.getDefault();
 
     public static void main(String[] args) {
         if (! "true".equals(System.getProperty("java.net.useSystemProxies"))) {
-            System.out.println("Usage: java -Djava.net.useSystemProxies SystemProxies");
+            System.out.println("Usage: java -Djava.net.useSystemProxies=true SystemProxies");
             return;
         }
 
         printProxies("http://");
         printProxies("https://");
         printProxies("ftp://");
+        printProxies("none://");
+        printProxies("gopher://");
+        printProxies("rtsp://");
+        printProxies("socket://");
     }
 
     static void printProxies(String proto) {
-        String uriStr =  proto + uriAuthority;
-        try {
-            List<Proxy> proxies = proxySel.select(new URI(uriStr));
-            System.out.println("Proxies returned for " + uriStr);
-            for (Proxy proxy : proxies)
-                System.out.println("\t" + proxy);
-        } catch (URISyntaxException e) {
-            System.err.println(e);
+        System.out.println("Protocol:" + proto);
+        for (String uri : uriAuthority) {
+            String uriStr =  proto + uri;
+            try {
+                List<Proxy> proxies = proxySel.select(new URI(uriStr));
+                System.out.println("\tProxies returned for " + uriStr);
+                for (Proxy proxy : proxies)
+                    System.out.println("\t\t" + proxy);
+            } catch (URISyntaxException e) {
+                System.err.println(e);
+            }
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/NullURLTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7179567
+ * @summary Test that URLClassLoader public constructors and factory methods
+ * throw NullPointerException when appropriate.
+ *
+ * Tests whether URLClassLoader public constructors and factory methods throw
+ * appropriate NullPointerExceptions for 1) a null URL array parameter, and
+ * 2) a non-null URL array containing a null element.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.jar.JarFile;
+
+public class NullURLTest {
+    JarFile jarFile;
+
+    public static void main(String[] args) throws Throwable {
+        new NullURLTest();
+    }
+
+    NullURLTest() throws Throwable {
+        File local = new File(System.getProperty("test.src", "."), "jars");
+        String path = "jar:file:"
+                + local.getPath()
+                + "/class_path_test.jar!/Foo.class";
+
+        URL validURL = new URL(path);
+        URL[] validURLArray = new URL[] { validURL, validURL };
+        URL[] invalidURLArray = new URL[] { validURL, null };
+
+        int failures = 0;
+        URLClassLoader loader;
+
+        try {
+            loader = new URLClassLoader(validURLArray);
+        } catch (Throwable t) {
+            System.err.println("URLClassLoader(validURLArray) threw " + t);
+            failures++;
+        }
+        try {
+            loader = new URLClassLoader(null);
+            System.err.println("URLClassLoader(null) did not throw NPE");
+            failures++;
+        } catch (NullPointerException e) {
+            // expected
+        }
+        // This section should be uncommented if 8026517 is fixed.
+//        try {
+//            loader = new URLClassLoader(invalidURLArray);
+//            System.err.println("URLClassLoader(invalidURLArray) did not throw NPE");
+//            failures++;
+//        } catch (NullPointerException e) {
+//            // expected
+//        }
+
+        try {
+            loader = new URLClassLoader(validURLArray, null);
+        } catch (Throwable t) {
+            System.err.println("URLClassLoader(validURLArray, null) threw " + t);
+            failures++;
+        }
+        try {
+            loader = new URLClassLoader(null, null);
+            System.err.println("URLClassLoader(null, null) did not throw NPE");
+            failures++;
+        } catch (NullPointerException e) {
+            // expected
+        }
+        // This section should be uncommented if 8026517 is fixed.
+//        try {
+//            loader = new URLClassLoader(invalidURLArray, null);
+//            System.err.println("URLClassLoader(invalidURLArray, null) did not throw NPE");
+//            failures++;
+//        } catch (NullPointerException e) {
+//            // expected
+//        }
+
+        try {
+            loader = new URLClassLoader(validURLArray, null, null);
+        } catch (Throwable t) {
+            System.err.println("URLClassLoader(validURLArray, null, null) threw " + t);
+            failures++;
+        }
+        try {
+            loader = new URLClassLoader(null, null, null);
+            System.err.println("URLClassLoader(null, null, null) did not throw NPE");
+            failures++;
+        } catch (NullPointerException e) {
+            // expected
+        }
+        // This section should be uncommented if 8026517 is fixed.
+//        try {
+//            loader = new URLClassLoader(invalidURLArray, null, null);
+//            System.err.println("URLClassLoader(invalidURLArray, null, null) did not throw NPE");
+//            failures++;
+//        } catch (NullPointerException e) {
+//            // expected
+//        }
+
+        try {
+            loader = URLClassLoader.newInstance(validURLArray);
+        } catch (Throwable t) {
+            System.err.println("URLClassLoader.newInstance(validURLArray) threw " + t);
+            failures++;
+        }
+        try {
+            loader = URLClassLoader.newInstance(null);
+            System.err.println("URLClassLoader.newInstance(null) did not throw NPE");
+            failures++;
+        } catch (NullPointerException e) {
+            // expected
+        }
+        // This section should be uncommented if 8026517 is fixed.
+//        try {
+//            loader = URLClassLoader.newInstance(invalidURLArray);
+//            System.err.println("URLClassLoader.newInstance(invalidURLArray) did not throw NPE");
+//            failures++;
+//        } catch (NullPointerException e) {
+//            // expected
+//        }
+
+        try {
+            loader = URLClassLoader.newInstance(validURLArray, null);
+        } catch (Throwable t) {
+            System.err.println("URLClassLoader.newInstance(validURLArray, null) threw " + t);
+            failures++;
+        }
+        try {
+            loader = URLClassLoader.newInstance(null, null);
+            System.err.println("URLClassLoader.newInstance(null, null) did not throw NPE");
+            failures++;
+        } catch (NullPointerException e) {
+            // expected
+        }
+        // This section should be uncommented if 8026517 is fixed.
+//        try {
+//            loader = URLClassLoader.newInstance(invalidURLArray, null);
+//            System.err.println("URLClassLoader.newInstance(invalidURLArray, null) did not throw NPE");
+//            failures++;
+//        } catch (NullPointerException e) {
+//            // expected
+//        }
+
+        if (failures != 0) {
+            throw new Exception("URLClassLoader NullURLTest had "+failures+" failures!");
+        }
+    }
+}
--- a/jdk/test/java/net/URLPermission/URLPermissionTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/net/URLPermission/URLPermissionTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -26,7 +26,7 @@
 
 /**
  * @test
- * @bug 8010464
+ * @bug 8010464 8027570
  */
 
 public class URLPermissionTest {
@@ -110,6 +110,28 @@
         return new ActionImpliesTest(arg1, arg2, expected);
     }
 
+    static class HashCodeTest extends Test {
+        String arg1, arg2;
+        int hash;
+
+        HashCodeTest(String arg1, String arg2, int hash) {
+            this.arg1 = arg1;
+            this.arg2 = arg2;
+            this.hash = hash;
+        }
+
+        @Override
+        boolean execute() {
+            URLPermission p = new URLPermission(arg1, arg2);
+            int h = p.hashCode();
+            return h == hash;
+        }
+    }
+
+    static HashCodeTest hashtest(String arg1, String arg2, int expected) {
+        return new HashCodeTest(arg1, arg2, expected);
+    }
+
     static class URLEqualityTest extends Test {
         String arg1, arg2;
 
@@ -178,6 +200,11 @@
         extest("http:")
     };
 
+    static Test[] hashTests = {
+        hashtest("http://www.foo.com/path", "GET:X-Foo", 388644203),
+        hashtest("http:*", "*:*", 3255810)
+    };
+
     static Test[] pathImplies2 = {
         imtest("http://[FE80::]:99", "http://[fe80:0::]:99", true),
 
@@ -326,6 +353,17 @@
 
         }
 
+        for (int i=0; i<hashTests.length; i++) {
+            HashCodeTest test = (HashCodeTest)hashTests[i];
+            boolean result = test.execute();
+            if (!result) {
+                System.out.printf ("test failed: %s %s %d\n", test.arg1, test.arg2, test.hash);
+                failed = true;
+            } else {
+                System.out.println ("hash test " + i + " OK");
+            }
+        }
+
         for (int i=0; i<exceptionTests.length; i++) {
             ExTest test = (ExTest)exceptionTests[i];
             boolean result = test.execute();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLPermission/nstest/LookupTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @compile -XDignore.symbol.file=true SimpleNameService.java
+ *                                     SimpleNameServiceDescriptor.java
+ * @run main/othervm/timeout=200 -Dsun.net.spi.nameservice.provider.1=simple,sun LookupTest
+ */
+
+/**
+ * This is a simple smoke test of the HttpURLPermission mechanism, which
+ * checks for either IOException (due to unknown host) or SecurityException
+ * due to lack of permission to connect
+ */
+
+import java.net.*;
+import java.io.*;
+
+public class LookupTest {
+
+    static void test(
+        String url, boolean throwsSecException, boolean throwsIOException)
+    {
+        try {
+            URL u = new URL(url);
+            System.err.println ("Connecting to " + u);
+            URLConnection urlc = u.openConnection();
+            InputStream is = urlc.getInputStream();
+        } catch (SecurityException e) {
+            if (!throwsSecException) {
+                throw new RuntimeException ("(1) was not expecting " + e);
+            }
+            return;
+        } catch (IOException ioe) {
+            if (!throwsIOException) {
+                throw new RuntimeException ("(2) was not expecting " + ioe);
+            }
+            return;
+        }
+        if (throwsSecException || throwsIOException) {
+            System.err.printf ("was expecting a %s\n", throwsSecException ?
+                "security exception" : "IOException");
+            throw new RuntimeException("was expecting an exception");
+        }
+    }
+
+    public static void main(String args[]) throws Exception {
+        SimpleNameService.put("allowedAndFound.com", "127.0.0.1");
+        SimpleNameService.put("notAllowedButFound.com", "99.99.99.99");
+        // name "notAllowedAndNotFound.com" is not in map
+        // name "allowedButNotfound.com" is not in map
+        startServer();
+
+        String policyFileName = "file://" + System.getProperty("test.src", ".") + "/policy";
+        System.err.println ("policy = " + policyFileName);
+
+        System.setProperty("java.security.policy", policyFileName);
+
+        System.setSecurityManager(new SecurityManager());
+
+        test("http://allowedAndFound.com:50100/foo", false, false);
+
+        test("http://notAllowedButFound.com:50100/foo", true, false);
+
+        test("http://allowedButNotfound.com:50100/foo", false, true);
+
+        test("http://notAllowedAndNotFound.com:50100/foo", true, false);
+    }
+
+    static Thread server;
+    static ServerSocket serverSocket;
+
+    static class Server extends Thread {
+        public void run() {
+            byte[] buf = new byte[1000];
+            try {
+                while (true) {
+                    Socket s = serverSocket.accept();
+                    InputStream i = s.getInputStream();
+                    i.read(buf);
+                    OutputStream o = s.getOutputStream();
+                    String rsp = "HTTP/1.1 200 Ok\r\n" +
+                        "Connection: close\r\nContent-length: 0\r\n\r\n";
+                    o.write(rsp.getBytes());
+                    o.close();
+                }
+            } catch (IOException e) {
+                return;
+            }
+            }
+    }
+
+    static void startServer() {
+        try {
+            serverSocket = new ServerSocket(50100);
+            server = new Server();
+            server.start();
+        } catch (Exception e) {
+            throw new RuntimeException ("Test failed to initialize");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLPermission/nstest/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,22 @@
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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.
+
+SimpleNameServiceDescriptor    # name service provider descriptor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLPermission/nstest/SimpleNameService.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/*
+ * A simple name service based on an in-memory HashMap.
+ */
+import java.net.UnknownHostException;
+import java.net.InetAddress;
+import sun.net.spi.nameservice.*;
+import java.util.*;
+
+public final class SimpleNameService implements NameService {
+
+    private static LinkedHashMap hosts = new LinkedHashMap();
+
+    private static String addrToString(byte addr[]) {
+        return Byte.toString(addr[0]) + "." +
+               Byte.toString(addr[1]) + "." +
+               Byte.toString(addr[2]) + "." +
+               Byte.toString(addr[3]);
+    }
+
+    // ------------
+
+    public static void put(String host, String addr) {
+        hosts.put(host, addr);
+    }
+
+    public static void put(String host, byte addr[]) {
+        hosts.put(host, addrToString(addr));
+    }
+
+    public static void remove(String host) {
+        hosts.remove(host);
+    }
+
+    public static int entries () {
+        return hosts.size();
+    }
+
+    public static int lookupCalls() {
+        return lookupCalls;
+    }
+
+    static int lookupCalls = 0;
+
+    // ------------
+
+    public SimpleNameService() throws Exception {
+    }
+
+    public InetAddress[] lookupAllHostAddr(String host) throws UnknownHostException {
+
+        lookupCalls ++;
+
+        String value = (String)hosts.get(host);
+        if (value == null) {
+            throw new UnknownHostException(host);
+        }
+        StringTokenizer st = new StringTokenizer(value, ".");
+        byte addr[] = new byte[4];
+        for (int i=0; i<4; i++) {
+            addr[i] = (byte)Integer.parseInt(st.nextToken());
+        }
+        InetAddress[] res = new InetAddress[1];
+        res[0] = InetAddress.getByAddress(host, addr);
+        return res;
+    }
+
+    public String getHostByAddr(byte[] addr) throws UnknownHostException {
+        String addrString = addrToString(addr);
+        Iterator i = hosts.keySet().iterator();
+        while (i.hasNext()) {
+            String host = (String)i.next();
+            String value = (String)hosts.get(host);
+            if (value.equals(addrString)) {
+                return host;
+            }
+        }
+        throw new UnknownHostException();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLPermission/nstest/SimpleNameServiceDescriptor.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+/*
+ * Descriptor for the simple name service
+ */
+import sun.net.spi.nameservice.*;
+
+public final class SimpleNameServiceDescriptor implements NameServiceDescriptor {
+    /**
+     * Create a new instance of the corresponding name service.
+     */
+    public NameService createNameService() throws Exception {
+        return new SimpleNameService();
+    }
+
+    /**
+     * Returns this service provider's name
+     *
+     */
+    public String getProviderName() {
+        return "sun";
+    }
+
+    /**
+     * Returns this name service type
+     * "dns" "nis" etc
+     */
+    public String getType() {
+        return "simple";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLPermission/nstest/policy	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,41 @@
+//
+// Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+//
+// This code is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License version 2 only, as
+// published by the Free Software Foundation.
+//
+// This code is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// version 2 for more details (a copy is included in the LICENSE file that
+// accompanied this code).
+//
+// You should have received a copy of the GNU General Public License version
+// 2 along with this work; if not, write to the Free Software Foundation,
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+// or visit www.oracle.com if you need additional information or have any
+// questions.
+//
+
+grant {
+    permission java.net.URLPermission "http://allowedAndFound.com:50100/-", "*:*";
+    permission java.net.URLPermission "http://allowedButNotfound.com:50100/-", "*:*";
+
+    // needed for HttpServer
+    permission "java.net.SocketPermission" "localhost:1024-", "resolve,accept";
+};
+
+// Normal permissions that aren't granted when run under jtreg
+
+grant codeBase "file:${{java.ext.dirs}}/*" {
+        permission java.security.AllPermission;
+};
+
+grant codeBase "file:${{java.home}}/jre/lib/rt.jar" {
+        permission java.security.AllPermission;
+};
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/channels/FileChannel/InterruptMapDeadlock.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8024833
+ * @summary Tests interruption of threads mapping sections of a file channel in
+ *   an attempt to deadlock due to nesting of begin calls.
+ */
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.*;
+import java.nio.channels.FileChannel.MapMode;
+import java.nio.file.*;
+import java.util.concurrent.Semaphore;
+import static java.nio.file.StandardOpenOption.*;
+
+public class InterruptMapDeadlock {
+
+    static class Mapper extends Thread {
+        final FileChannel fc;
+        final Semaphore gate;
+        volatile Exception exception;
+
+        Mapper(FileChannel fc, Semaphore gate) {
+            this.fc = fc;
+            this.gate = gate;
+        }
+
+        @Override
+        public void run() {
+            try {
+                gate.acquireUninterruptibly();
+                fc.map(MapMode.READ_ONLY, 0, 1);
+                throw new Exception("Map succeeded");
+            } catch (IOException x) {
+                System.out.println(x.getClass() + " (expected)");
+            } catch (Exception unexpected) {
+                this.exception = unexpected;
+            }
+        }
+
+        Exception exception() {
+            return exception;
+        }
+
+        static Mapper startMapper(FileChannel fc, Semaphore gate) {
+            Mapper r = new Mapper(fc, gate);
+            r.setDaemon(true);
+            r.start();
+            return r;
+        }
+    }
+
+    static class Interruptor extends Thread {
+
+        final Mapper[] mappers;
+        final Semaphore gate;
+
+        Interruptor(Mapper[] mappers, Semaphore gate) {
+            this.mappers = mappers;
+            this.gate = gate;
+        }
+
+        public void run() {
+            gate.release(mappers.length);
+            for (Mapper m : mappers) {
+                m.interrupt();
+            }
+        }
+    }
+    // the number of mapper threads to start
+    private static final int MAPPER_COUNT = 4;
+
+    public static void main(String[] args) throws Exception {
+        Path file = Paths.get("data.txt");
+        FileChannel.open(file, CREATE, TRUNCATE_EXISTING, WRITE).close();
+
+        Mapper[] mappers = new Mapper[MAPPER_COUNT];
+
+        for (int i=1; i<=20; i++) {
+            System.out.format("Iteration: %s%n", i);
+
+            FileChannel fc = FileChannel.open(file);
+            boolean failed = false;
+
+            Semaphore gate = new Semaphore(0);
+            // start mapper threads
+            for (int j=0; j<MAPPER_COUNT; j++) {
+                mappers[j] = Mapper.startMapper(fc, gate);
+            }
+
+            // interrupt and wait for the mappers to terminate
+            Interruptor interruptor = new Interruptor(mappers, gate);
+            interruptor.start();
+            try {
+                interruptor.join(10000);
+                if (interruptor.isAlive()) {
+                    System.err.println("Interruptor thread did not terminate:");
+                    Throwable t = new Exception("Stack trace");
+                    t.setStackTrace(interruptor.getStackTrace());
+                    t.printStackTrace();
+                    failed = true;
+                }
+            } catch (InterruptedException x) {
+                System.err.println("Main thread was interrupted");
+                failed = true;
+            }
+
+            for (Mapper m: mappers) {
+                try {
+                    m.join(10000);
+                    Exception e = m.exception();
+                    if (e != null) {
+                        System.err.println("Mapper thread failed with: " + e);
+                        failed = true;
+                    } else if (m.isAlive()) {
+                        System.err.println("Mapper thread did not terminate:");
+                        Throwable t = new Exception("Stack trace");
+                        t.setStackTrace(m.getStackTrace());
+                        t.printStackTrace();
+                        failed = true;
+                    }
+                } catch (InterruptedException x) {
+                    System.err.println("Main thread was interrupted");
+                    failed = true;
+                }
+            }
+
+            if (failed)
+                throw new RuntimeException("Test failed - see log for details");
+            else
+                fc.close();
+        }
+    }
+}
--- a/jdk/test/java/nio/channels/SocketChannel/ShortWrite.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/nio/channels/SocketChannel/ShortWrite.java	Wed Jul 05 19:21:26 2017 +0200
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 7176630
+ * @bug 7176630 7074436
  * @summary Check for short writes on SocketChannels configured in blocking mode
  */
 
@@ -38,11 +38,12 @@
     static final Random rand = new Random();
 
     /**
-     * Returns a checksum on the remaining bytes in the given buffer.
+     * Returns a checksum on the remaining bytes in the given buffers.
      */
-    static long computeChecksum(ByteBuffer bb) {
+    static long computeChecksum(ByteBuffer... bufs) {
         CRC32 crc32 = new CRC32();
-        crc32.update(bb);
+        for (int i=0; i<bufs.length; i++)
+            crc32.update(bufs[i]);
         return crc32.getValue();
     }
 
@@ -71,15 +72,15 @@
     }
 
     /**
-     * Run test with a write of the given number of bytes.
+     * Exercise write(ByteBuffer) with given number of bytes.
      */
-    static void test(ExecutorService pool,
-                     SocketChannel source,
-                     SocketChannel sink,
-                     int size)
+    static void test1(ExecutorService pool,
+                      SocketChannel source,
+                      SocketChannel sink,
+                      int size)
         throws Exception
     {
-        System.out.println(size);
+        System.out.println("write(ByteBuffer), size=" + size);
 
         // random bytes in the buffer
         ByteBuffer buf = ByteBuffer.allocate(size);
@@ -101,6 +102,47 @@
             throw new RuntimeException("Checksum did not match");
     }
 
+    /**
+     * Exercise write(ByteBuffer[]) with buffers of the given sizes.
+     */
+    static void testN(ExecutorService pool,
+                      SocketChannel source,
+                      SocketChannel sink,
+                      int... sizes)
+        throws Exception
+    {
+        System.out.print("write(ByteBuffer[]), sizes=");
+        for (int size: sizes)
+            System.out.print(size + " ");
+        System.out.println();
+
+        int total = 0;
+        int len = sizes.length;
+        ByteBuffer[] bufs = new ByteBuffer[len];
+        for (int i=0; i<len; i++) {
+            int size = sizes[i];
+            ByteBuffer buf = ByteBuffer.allocate(size);
+            rand.nextBytes(buf.array());
+            bufs[i] = buf;
+            total += size;
+        }
+
+        // submit task to read the bytes
+        Future<Long> result = pool.submit(new Reader(sink, total));
+
+        // write the bytes
+        long n = source.write(bufs);
+        if (n != total)
+            throw new RuntimeException("Short write detected");
+
+        // check the bytes that were received match
+        for (int i=0; i<len; i++)
+            bufs[i].rewind();
+        long expected = computeChecksum(bufs);
+        long actual = result.get();
+        if (actual != expected)
+            throw new RuntimeException("Checksum did not match");
+    }
 
     public static void main(String[] args) throws Exception {
         ExecutorService pool = Executors.newSingleThreadExecutor();
@@ -114,17 +156,47 @@
                 try (SocketChannel source = SocketChannel.open(sa);
                      SocketChannel sink = ssc.accept())
                 {
-                    // run tests on sizes around 128k as that is the problem
-                    // area on Windows.
+                    // Exercise write(BufferBuffer) on sizes around 128k
                     int BOUNDARY = 128 * 1024;
                     for (int size=(BOUNDARY-2); size<=(BOUNDARY+2); size++) {
-                        test(pool, source, sink, size);
+                        test1(pool, source, sink, size);
+                    }
+
+                    // Exercise write(BufferBuffer) on random sizes
+                    for (int i=0; i<20; i++) {
+                        int size = rand.nextInt(1024*1024);
+                        test1(pool, source, sink, size);
                     }
 
-                    // run tests on random sizes
+                    // Exercise write(BufferBuffer[]) on sizes around 128k
+                    for (int i=BOUNDARY-2; i<=BOUNDARY+2; i++) {
+                        testN(pool, source, sink, i);
+                        testN(pool, source, sink, 0, i);
+                        testN(pool, source, sink, i, 0);
+                        for (int j=BOUNDARY-2; j<=BOUNDARY+2; j++) {
+                            testN(pool, source, sink, i, j);
+                            testN(pool, source, sink, 0, i, j);
+                            testN(pool, source, sink, i, 0, j);
+                            testN(pool, source, sink, i, j, 0);
+                            for (int k=BOUNDARY-2; k<=BOUNDARY+2; k++) {
+                                testN(pool, source, sink, i, j, k);
+                                testN(pool, source, sink, 0, i, j, k);
+                                testN(pool, source, sink, i, 0, j, k);
+                                testN(pool, source, sink, i, j, 0, k);
+                                testN(pool, source, sink, i, j, k, 0);
+                            }
+                        }
+                    }
+
+                    // Exercise write(BufferBuffer[]) on random sizes
+                    // (assumes IOV_MAX >= 8)
                     for (int i=0; i<20; i++) {
-                        int size = rand.nextInt(1024*1024);
-                        test(pool, source, sink, size);
+                        int n = rand.nextInt(9);
+                        int[] sizes = new int[n];
+                        for (int j=0; j<n; j++) {
+                            sizes[j] = rand.nextInt(1024*1024);
+                        }
+                        testN(pool, source, sink, sizes);
                     }
                 }
             }
--- a/jdk/test/java/nio/file/Files/StreamTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/nio/file/Files/StreamTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -23,6 +23,7 @@
 
 /* @test
  * @bug 8006884 8019526
+ * @library ..
  * @build PassThroughFileSystem FaultyFileSystem
  * @run testng StreamTest
  * @summary Unit test for java.nio.file.Files methods that return a Stream
--- a/jdk/test/java/security/Signature/SignatureGetAlgorithm.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/security/Signature/SignatureGetAlgorithm.java	Wed Jul 05 19:21:26 2017 +0200
@@ -49,7 +49,7 @@
 
     public static class TestProvider extends Provider {
         TestProvider() {
-            super("test", 1.0, "test");
+            super("testSignatureGetAlgorithm", 1.0, "test Signatures");
             put("Signature.MySignatureAlg",
                 "SignatureGetAlgorithm$MySignatureAlg");
         }
--- a/jdk/test/java/security/cert/PKIXRevocationChecker/UnitTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/security/cert/PKIXRevocationChecker/UnitTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 6854712 7171570 8010748
+ * @bug 6854712 7171570 8010748 8025287
  * @summary Basic unit test for PKIXRevocationChecker
  */
 
@@ -44,6 +44,8 @@
         CertPathChecker cpc = cpv.getRevocationChecker();
         PKIXRevocationChecker prc = (PKIXRevocationChecker)cpc;
 
+        prc.init(false);
+
         System.out.println("Testing that get methods return null or " +
                            "empty lists/sets/maps");
         requireNull(prc.getOcspResponder(), "getOcspResponder()");
--- a/jdk/test/java/time/tck/java/time/TCKZoneId.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/time/tck/java/time/TCKZoneId.java	Wed Jul 05 19:21:26 2017 +0200
@@ -94,47 +94,6 @@
 public class TCKZoneId extends AbstractTCKTest {
 
     //-----------------------------------------------------------------------
-    // OLD_SHORT_IDS
-    //-----------------------------------------------------------------------
-    public void test_constant_OLD_IDS_PRE_2005() {
-        Map<String, String> ids = ZoneId.OLD_SHORT_IDS;
-        assertEquals(ids.get("EST"), "America/New_York");
-        assertEquals(ids.get("MST"), "America/Denver");
-        assertEquals(ids.get("HST"), "Pacific/Honolulu");
-        assertEquals(ids.get("ACT"), "Australia/Darwin");
-        assertEquals(ids.get("AET"), "Australia/Sydney");
-        assertEquals(ids.get("AGT"), "America/Argentina/Buenos_Aires");
-        assertEquals(ids.get("ART"), "Africa/Cairo");
-        assertEquals(ids.get("AST"), "America/Anchorage");
-        assertEquals(ids.get("BET"), "America/Sao_Paulo");
-        assertEquals(ids.get("BST"), "Asia/Dhaka");
-        assertEquals(ids.get("CAT"), "Africa/Harare");
-        assertEquals(ids.get("CNT"), "America/St_Johns");
-        assertEquals(ids.get("CST"), "America/Chicago");
-        assertEquals(ids.get("CTT"), "Asia/Shanghai");
-        assertEquals(ids.get("EAT"), "Africa/Addis_Ababa");
-        assertEquals(ids.get("ECT"), "Europe/Paris");
-        assertEquals(ids.get("IET"), "America/Indiana/Indianapolis");
-        assertEquals(ids.get("IST"), "Asia/Kolkata");
-        assertEquals(ids.get("JST"), "Asia/Tokyo");
-        assertEquals(ids.get("MIT"), "Pacific/Apia");
-        assertEquals(ids.get("NET"), "Asia/Yerevan");
-        assertEquals(ids.get("NST"), "Pacific/Auckland");
-        assertEquals(ids.get("PLT"), "Asia/Karachi");
-        assertEquals(ids.get("PNT"), "America/Phoenix");
-        assertEquals(ids.get("PRT"), "America/Puerto_Rico");
-        assertEquals(ids.get("PST"), "America/Los_Angeles");
-        assertEquals(ids.get("SST"), "Pacific/Guadalcanal");
-        assertEquals(ids.get("VST"), "Asia/Ho_Chi_Minh");
-    }
-
-    @Test(expectedExceptions=UnsupportedOperationException.class)
-    public void test_constant_OLD_IDS_PRE_2005_immutable() {
-        Map<String, String> ids = ZoneId.OLD_SHORT_IDS;
-        ids.clear();
-    }
-
-    //-----------------------------------------------------------------------
     // SHORT_IDS
     //-----------------------------------------------------------------------
     public void test_constant_OLD_IDS_POST_2005() {
--- a/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java	Wed Jul 05 19:21:26 2017 +0200
@@ -59,9 +59,6 @@
  */
 package tck.java.time.serial;
 
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-import tck.java.time.AbstractTCKTest;
 
 import java.io.ByteArrayOutputStream;
 import java.io.DataOutputStream;
@@ -69,6 +66,10 @@
 import java.time.OffsetDateTime;
 import java.time.ZoneOffset;
 
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import tck.java.time.AbstractTCKTest;
+
 /**
  * Test OffsetDateTime serialization.
  */
@@ -96,11 +97,6 @@
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         try (DataOutputStream dos = new DataOutputStream(baos) ) {
             dos.writeByte(10);       // java.time.Ser.OFFSET_DATE_TIME_TYPE
-        }
-        byte[] bytes = baos.toByteArray();
-        ByteArrayOutputStream baosDateTime = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baosDateTime) ) {
-            dos.writeByte(5);
             dos.writeInt(2012);
             dos.writeByte(9);
             dos.writeByte(16);
@@ -108,17 +104,11 @@
             dos.writeByte(17);
             dos.writeByte(59);
             dos.writeInt(464_000_000);
-        }
-        byte[] bytesDateTime = baosDateTime.toByteArray();
-        ByteArrayOutputStream baosOffset = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baosOffset) ) {
-            dos.writeByte(8);
             dos.writeByte(4);  // quarter hours stored: 3600 / 900
         }
-        byte[] bytesOffset = baosOffset.toByteArray();
+        byte[] bytes = baos.toByteArray();
         LocalDateTime ldt = LocalDateTime.of(2012, 9, 16, 22, 17, 59, 464_000_000);
-        assertSerializedBySer(OffsetDateTime.of(ldt, ZoneOffset.ofHours(1)), bytes, bytesDateTime, bytesOffset);
+        assertSerializedBySer(OffsetDateTime.of(ldt, ZoneOffset.ofHours(1)), bytes);
     }
 
-
 }
--- a/jdk/test/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java	Wed Jul 05 19:21:26 2017 +0200
@@ -97,25 +97,14 @@
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         try (DataOutputStream dos = new DataOutputStream(baos) ) {
             dos.writeByte(9);       // java.time.Ser.OFFSET_TIME_TYPE
-        }
-        byte[] bytes = baos.toByteArray();
-        ByteArrayOutputStream baosTime = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baosTime) ) {
-            dos.writeByte(4);
             dos.writeByte(22);
             dos.writeByte(17);
             dos.writeByte(59);
             dos.writeInt(464_000_000);
-        }
-        byte[] bytesTime = baosTime.toByteArray();
-        ByteArrayOutputStream baosOffset = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(baosOffset) ) {
-            dos.writeByte(8);
             dos.writeByte(4);  // quarter hours stored: 3600 / 900
         }
-        byte[] bytesOffset = baosOffset.toByteArray();
-        assertSerializedBySer(OffsetTime.of(22, 17, 59, 464_000_000, ZoneOffset.ofHours(1)), bytes,
-                bytesTime, bytesOffset);
+        byte[] bytes = baos.toByteArray();
+        assertSerializedBySer(OffsetTime.of(22, 17, 59, 464_000_000, ZoneOffset.ofHours(1)), bytes);
     }
 
 
--- a/jdk/test/java/time/test/java/time/format/TestReducedParser.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/time/test/java/time/format/TestReducedParser.java	Wed Jul 05 19:21:26 2017 +0200
@@ -78,10 +78,12 @@
 import java.time.chrono.JapaneseChronology;
 import java.time.chrono.MinguoChronology;
 import java.time.chrono.ThaiBuddhistChronology;
+import java.time.chrono.ThaiBuddhistDate;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatterBuilder;
 import java.time.temporal.TemporalAccessor;
 import java.time.temporal.TemporalField;
+import java.time.temporal.TemporalQueries;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
@@ -443,6 +445,52 @@
 
     }
 
+    @Test
+    public void test_reducedWithLateChronoChange() {
+        ThaiBuddhistDate date = ThaiBuddhistDate.of(2543, 1, 1);
+        DateTimeFormatter df
+                = new DateTimeFormatterBuilder()
+                        .appendValueReduced(YEAR, 2, 2, LocalDate.of(2000, 1, 1))
+                        .appendLiteral(" ")
+                        .appendChronologyId()
+                .toFormatter();
+        int expected = date.get(YEAR);
+        String input = df.format(date);
+
+        ParsePosition pos = new ParsePosition(0);
+        TemporalAccessor parsed = df.parseUnresolved(input, pos);
+        assertEquals(pos.getIndex(), input.length(), "Input not parsed completely");
+        assertEquals(pos.getErrorIndex(), -1, "Error index should be -1 (no-error)");
+        int actual = parsed.get(YEAR);
+        assertEquals(actual, expected,
+                String.format("Wrong date parsed, chrono: %s, input: %s",
+                parsed.query(TemporalQueries.chronology()), input));
+
+    }
+
+    @Test
+    public void test_reducedWithLateChronoChangeTwice() {
+        DateTimeFormatter df
+                = new DateTimeFormatterBuilder()
+                        .appendValueReduced(YEAR, 2, 2, LocalDate.of(2000, 1, 1))
+                        .appendLiteral(" ")
+                        .appendChronologyId()
+                        .appendLiteral(" ")
+                        .appendChronologyId()
+                .toFormatter();
+        int expected = 2044;
+        String input = "44 ThaiBuddhist ISO";
+        ParsePosition pos = new ParsePosition(0);
+        TemporalAccessor parsed = df.parseUnresolved(input, pos);
+        assertEquals(pos.getIndex(), input.length(), "Input not parsed completely: " + pos);
+        assertEquals(pos.getErrorIndex(), -1, "Error index should be -1 (no-error)");
+        int actual = parsed.get(YEAR);
+        assertEquals(actual, expected,
+                String.format("Wrong date parsed, chrono: %s, input: %s",
+                parsed.query(TemporalQueries.chronology()), input));
+
+    }
+
     //-----------------------------------------------------------------------
     // Class to structure the test data
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java	Wed Jul 05 19:21:26 2017 +0200
@@ -112,13 +112,13 @@
     }
 
     private static Set<ZoneId> preferred = new HashSet<>(Arrays.asList(new ZoneId[] {
-        ZoneId.of("EST"),
+        ZoneId.of("EST", ZoneId.SHORT_IDS),
         ZoneId.of("Asia/Taipei"),
         ZoneId.of("CET"),
     }));
 
     private static Set<ZoneId> preferred_s = new HashSet<>(Arrays.asList(new ZoneId[] {
-         ZoneId.of("EST"),
+         ZoneId.of("EST", ZoneId.SHORT_IDS),
          ZoneId.of("CET"),
          ZoneId.of("Australia/South"),
          ZoneId.of("Australia/West"),
@@ -131,7 +131,7 @@
     Object[][] data_preferredZones() {
         return new Object[][] {
             {"America/New_York", "Eastern Standard Time", none,      Locale.ENGLISH, TextStyle.FULL},
-            {"EST",              "Eastern Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
+//          {"EST",              "Eastern Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
             {"Europe/Paris",     "Central European Time", none,      Locale.ENGLISH, TextStyle.FULL},
             {"CET",              "Central European Time", preferred, Locale.ENGLISH, TextStyle.FULL},
             {"Asia/Shanghai",    "China Standard Time",   none,      Locale.ENGLISH, TextStyle.FULL},
--- a/jdk/test/java/util/Base64/Base64GetEncoderTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/util/Base64/Base64GetEncoderTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -41,7 +41,7 @@
 public class Base64GetEncoderTest {
 
     public static void main(String args[]) throws Throwable {
-        final Base64.Encoder encoder = Base64.getEncoder(0, "$$$".getBytes(US_ASCII));
+        final Base64.Encoder encoder = Base64.getMimeEncoder(0, "$$$".getBytes(US_ASCII));
 
         testEncodeToString(encoder);
 
--- a/jdk/test/java/util/Base64/TestBase64.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/util/Base64/TestBase64.java	Wed Jul 05 19:21:26 2017 +0200
@@ -23,7 +23,7 @@
 
 /**
  * @test 4235519 8004212 8005394 8007298 8006295 8006315 8006530 8007379 8008925
- *       8014217
+ *       8014217 8025003
  * @summary tests java.util.Base64
  */
 
@@ -60,13 +60,13 @@
         byte[] nl_3 = new byte[] {'\n', '\r', '\n'};
         for (int i = 0; i < 10; i++) {
             int len = rnd.nextInt(200) + 4;
-            test(Base64.getEncoder(len, nl_1),
+            test(Base64.getMimeEncoder(len, nl_1),
                  Base64.getMimeDecoder(),
                  numRuns, numBytes);
-            test(Base64.getEncoder(len, nl_2),
+            test(Base64.getMimeEncoder(len, nl_2),
                  Base64.getMimeDecoder(),
                  numRuns, numBytes);
-            test(Base64.getEncoder(len, nl_3),
+            test(Base64.getMimeEncoder(len, nl_3),
                  Base64.getMimeDecoder(),
                  numRuns, numBytes);
         }
@@ -74,16 +74,16 @@
         testNull(Base64.getEncoder());
         testNull(Base64.getUrlEncoder());
         testNull(Base64.getMimeEncoder());
-        testNull(Base64.getEncoder(10, new byte[]{'\n'}));
+        testNull(Base64.getMimeEncoder(10, new byte[]{'\n'}));
         testNull(Base64.getDecoder());
         testNull(Base64.getUrlDecoder());
         testNull(Base64.getMimeDecoder());
-        checkNull(new Runnable() { public void run() { Base64.getEncoder(10, null); }});
+        checkNull(new Runnable() { public void run() { Base64.getMimeEncoder(10, null); }});
 
         testIOE(Base64.getEncoder());
         testIOE(Base64.getUrlEncoder());
         testIOE(Base64.getMimeEncoder());
-        testIOE(Base64.getEncoder(10, new byte[]{'\n'}));
+        testIOE(Base64.getMimeEncoder(10, new byte[]{'\n'}));
 
         byte[] src = new byte[1024];
         new Random().nextBytes(src);
@@ -93,7 +93,7 @@
         testIOE(Base64.getUrlDecoder(), Base64.getUrlEncoder().encode(src));
 
         // illegal line separator
-        checkIAE(new Runnable() { public void run() { Base64.getEncoder(10, new byte[]{'\r', 'N'}); }});
+        checkIAE(new Runnable() { public void run() { Base64.getMimeEncoder(10, new byte[]{'\r', 'N'}); }});
 
         // illegal base64 character
         decoded[2] = (byte)0xe0;
@@ -109,8 +109,6 @@
             Base64.getDecoder().decode(ByteBuffer.wrap(decoded), ByteBuffer.allocateDirect(1024)); }});
 
         // illegal ending unit
-        checkIAE(new Runnable() { public void run() { Base64.getMimeDecoder().decode("$=#"); }});
-
         checkIOE(new Testable() { public void test() throws IOException {
                                      byte[] bytes = "AA=".getBytes("ASCII");
                                      try (InputStream stream =
@@ -129,6 +127,10 @@
         testDecodeUnpadded();
         // test mime decoding with ignored character after padding
         testDecodeIgnoredAfterPadding();
+
+        // lenient mode for ending unit
+        testLenientPadding();
+
     }
 
     private static sun.misc.BASE64Encoder sunmisc = new sun.misc.BASE64Encoder();
@@ -436,6 +438,48 @@
         }
     }
 
+    private static void testLenientPadding() throws Throwable {
+        String[] data = new String[] {
+            "=",         "",        // unnecessary padding
+            "QUJD=",     "ABC",     //"ABC".encode() -> "QUJD"
+
+            "QQ=",       "A",       // incomplete padding
+            "QQ=N",      "A",       // incorrect padding
+            "QQ=?",      "A",
+            "QUJDQQ=",   "ABCA",
+            "QUJDQQ=N",  "ABCA",
+            "QUJDQQ=?",  "ABCA",
+
+            "QUI=X",     "AB",      // incorrect padding
+            "QUI=?",     "AB",      // incorrect padding
+        };
+        Base64.Decoder dec = Base64.getMimeDecoder();
+
+        for (int i = 0; i < data.length; i += 2) {
+            byte[] src = data[i].getBytes("ASCII");
+            byte[] expected = data[i + 1].getBytes("ASCII");
+            // decode(byte[])
+            byte[] ret = dec.decode(src);
+            checkEqual(ret, expected, "lenient padding decoding failed!");
+
+            // decode(String)
+            ret = dec.decode(data[i]);
+            checkEqual(ret, expected, "lenient padding decoding failed!");
+
+            // decode(ByteBuffer)
+            ByteBuffer srcBB = ByteBuffer.wrap(src);
+            ByteBuffer retBB = dec.decode(srcBB);
+            checkEqual(srcBB.remaining(), 0, "lenient padding decoding failed!");
+            checkEqual(Arrays.copyOf(retBB.array(), retBB.remaining()),
+                       expected, "lenient padding decoding failed!");
+
+            // wrap.decode(byte[])
+            ret = new byte[10];
+            int n = dec.wrap(new ByteArrayInputStream(src)).read(ret);
+            checkEqual(Arrays.copyOf(ret, n), expected, "lenient padding decoding failed!");
+        }
+    }
+
     private static void  testDecodeUnpadded() throws Throwable {
         byte[] srcA = new byte[] { 'Q', 'Q' };
         byte[] srcAA = new byte[] { 'Q', 'Q', 'E'};
--- a/jdk/test/java/util/Base64/TestBase64Golden.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/util/Base64/TestBase64Golden.java	Wed Jul 05 19:21:26 2017 +0200
@@ -230,7 +230,7 @@
             46, -97, -35, -44, 127, -60, -39, -4, -112, 34, -57, 47, -14, 67,
             40, 18, 90, -59, 68, 112, 23, 121, -91, 94, 35, 49, 104, 17, 30,
             -80, -104, -3, -53, 27, 38, -72, -47, 113, -52, 18, 5, -126 };
-        Encoder encoder = Base64.getEncoder(49, new byte[] { 0x7e });
+        Encoder encoder = Base64.getMimeEncoder(49, new byte[] { 0x7e });
         byte[] encoded = encoder.encode(src);
         Decoder decoder = Base64.getMimeDecoder();
         byte[] decoded = decoder.decode(encoded);
--- a/jdk/test/java/util/Calendar/JavatimeTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/util/Calendar/JavatimeTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -114,14 +114,14 @@
                 zidStr.equals("MST")) {
                 continue;
             }
-            ZoneId zid = ZoneId.of(zidStr, ZoneId.OLD_SHORT_IDS);
+            ZoneId zid = ZoneId.of(zidStr, ZoneId.SHORT_IDS);
             if (!zid.equals(TimeZone.getTimeZone(zid).toZoneId())) {
                 throw new RuntimeException("FAILED: zid -> tz -> zid :" + zidStr);
             }
             TimeZone tz = TimeZone.getTimeZone(zidStr);
             // no round-trip for alias and "GMT"
             if (!tz.equals(TimeZone.getTimeZone(tz.toZoneId())) &&
-                !ZoneId.OLD_SHORT_IDS.containsKey(zidStr) &&
+                !ZoneId.SHORT_IDS.containsKey(zidStr) &&
                 !zidStr.startsWith("GMT")) {
                 throw new RuntimeException("FAILED: tz -> zid -> tz :" + zidStr);
             }
--- a/jdk/test/java/util/Map/Defaults.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/util/Map/Defaults.java	Wed Jul 05 19:21:26 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8010122 8004518 8024331
+ * @bug 8010122 8004518 8024331 8024688
  * @summary Test Map default methods
  * @author Mike Duigou
  * @run testng Defaults
@@ -36,8 +36,8 @@
 import java.util.Collections;
 import java.util.EnumMap;
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.HashSet;
-import java.util.Hashtable;
 import java.util.IdentityHashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -288,19 +288,11 @@
         assertSame(map.get(EXTRA_KEY), EXTRA_VALUE);
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
-    public void testComputeIfAbsentNPEHashMap() {
-        Object value = new HashMap().computeIfAbsent(KEYS[1], null);
-    }
-
-    @Test(expectedExceptions = {NullPointerException.class})
-    public void testComputeIfAbsentNPEHashtable() {
-        Object value = new Hashtable().computeIfAbsent(KEYS[1], null);
-    }
-
-    @Test(expectedExceptions = {NullPointerException.class})
-    public void testComputeIfAbsentNPETreeMap() {
-        Object value = new TreeMap().computeIfAbsent(KEYS[1], null);
+    @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=all values=all")
+    public void testComputeIfAbsentNullFunction(String description, Map<IntegerEnum, String> map) {
+        assertThrows( () -> { map.computeIfAbsent(KEYS[1], null);},
+                NullPointerException.class,
+                "Should throw NPE");
     }
 
     @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=withNull values=withNull")
@@ -343,22 +335,14 @@
         assertSame(map.get(EXTRA_KEY), null);
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
-    public void testComputeIfPresentNPEHashMap() {
-        Object value = new HashMap().computeIfPresent(KEYS[1], null);
+    @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=all values=all")
+    public void testComputeIfPresentNullFunction(String description, Map<IntegerEnum, String> map) {
+        assertThrows( () -> { map.computeIfPresent(KEYS[1], null);},
+                NullPointerException.class,
+                "Should throw NPE");
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
-    public void testComputeIfPresentNPEHashtable() {
-        Object value = new Hashtable().computeIfPresent(KEYS[1], null);
-    }
-
-    @Test(expectedExceptions = {NullPointerException.class})
-    public void testComputeIfPresentNPETreeMap() {
-        Object value = new TreeMap().computeIfPresent(KEYS[1], null);
-    }
-
-    @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=withNull values=withNull")
+     @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=withNull values=withNull")
     public void testComputeNulls(String description, Map<IntegerEnum, String> map) {
         assertTrue(map.containsKey(null), "null key absent");
         assertNull(map.get(null), "value not null");
@@ -444,78 +428,86 @@
         assertSame(map.get(EXTRA_KEY), EXTRA_VALUE);
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
-    public void testComputeNPEHashMap() {
-        Object value = new HashMap().compute(KEYS[1], null);
-    }
-
-    @Test(expectedExceptions = {NullPointerException.class})
-    public void testComputeNPEHashtable() {
-        Object value = new Hashtable().compute(KEYS[1], null);
+    @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=all values=all")
+    public void testComputeNullFunction(String description, Map<IntegerEnum, String> map) {
+        assertThrows( () -> { map.compute(KEYS[1], null);},
+                NullPointerException.class,
+                "Should throw NPE");
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
-    public void testComputeNPETreeMap() {
-        Object value = new TreeMap().compute(KEYS[1], null);
-    }
+    @Test(dataProvider = "MergeCases")
+    private void testMerge(String description, Map<IntegerEnum, String> map, Merging.Value oldValue, Merging.Value newValue, Merging.Merger merger, Merging.Value put, Merging.Value result) {
+            // add and check initial conditions.
+            switch(oldValue) {
+                case ABSENT :
+                    map.remove(EXTRA_KEY);
+                    assertFalse(map.containsKey(EXTRA_KEY), "key not absent");
+                    break;
+                case NULL :
+                    map.put(EXTRA_KEY, null);
+                    assertTrue(map.containsKey(EXTRA_KEY), "key absent");
+                    assertNull(map.get(EXTRA_KEY), "wrong value");
+                    break;
+                case OLDVALUE :
+                    map.put(EXTRA_KEY, VALUES[1]);
+                    assertTrue(map.containsKey(EXTRA_KEY), "key absent");
+                    assertSame(map.get(EXTRA_KEY), VALUES[1], "wrong value");
+                    break;
+                default:
+                    fail("unexpected old value");
+            }
+
+            String returned = map.merge(EXTRA_KEY,
+                newValue == Merging.Value.NULL ? (String) null : VALUES[2],
+                merger
+                );
+
+            // check result
 
-    @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=withNull values=withNull")
-    public void testMergeNulls(String description, Map<IntegerEnum, String> map) {
-        assertTrue(map.containsKey(null), "null key absent");
-        assertNull(map.get(null), "value not null");
-        assertSame(map.merge(null, EXTRA_VALUE, (v, vv) -> {
-            assertNull(v);
-            assertSame(vv, EXTRA_VALUE);
-            return vv;
-        }), EXTRA_VALUE, description);
-        assertTrue(map.containsKey(null));
-        assertSame(map.get(null), EXTRA_VALUE, description);
+            switch(result) {
+                case NULL :
+                    assertNull(returned, "wrong value");
+                    break;
+                case NEWVALUE :
+                    assertSame(returned, VALUES[2], "wrong value");
+                    break;
+                case RESULT :
+                    assertSame(returned, VALUES[3], "wrong value");
+                    break;
+                default:
+                    fail("unexpected new value");
+            }
+
+            // check map
+            switch(put) {
+                case ABSENT :
+                    assertFalse(map.containsKey(EXTRA_KEY), "key not absent");
+                    break;
+                case NULL :
+                    assertTrue(map.containsKey(EXTRA_KEY), "key absent");
+                    assertNull(map.get(EXTRA_KEY), "wrong value");
+                    break;
+                case NEWVALUE :
+                    assertTrue(map.containsKey(EXTRA_KEY), "key absent");
+                    assertSame(map.get(EXTRA_KEY), VALUES[2], "wrong value");
+                    break;
+                case RESULT :
+                    assertTrue(map.containsKey(EXTRA_KEY), "key absent");
+                    assertSame(map.get(EXTRA_KEY), VALUES[3], "wrong value");
+                    break;
+                default:
+                    fail("unexpected new value");
+            }
     }
 
     @Test(dataProvider = "Map<IntegerEnum,String> rw=true keys=all values=all")
-    public void testMerge(String description, Map<IntegerEnum, String> map) {
-        assertTrue(map.containsKey(KEYS[1]));
-        Object value = map.get(KEYS[1]);
-        assertTrue(null == value || value == VALUES[1], description + String.valueOf(value));
-        assertSame(map.merge(KEYS[1], EXTRA_VALUE, (v, vv) -> {
-            assertSame(v, value);
-            assertSame(vv, EXTRA_VALUE);
-            return vv;
-        }), EXTRA_VALUE, description);
-        assertSame(map.get(KEYS[1]), EXTRA_VALUE, description);
-        assertNull(map.merge(KEYS[1], EXTRA_VALUE, (v, vv) -> {
-            assertSame(v, EXTRA_VALUE);
-            assertSame(vv, EXTRA_VALUE);
-            return null;
-        }), description);
-        assertFalse(map.containsKey(KEYS[1]));
-
-        assertFalse(map.containsKey(EXTRA_KEY));
-        assertSame(map.merge(EXTRA_KEY, EXTRA_VALUE, (v, vv) -> {
-            assertNull(v);
-            assertSame(vv, EXTRA_VALUE);
-            return EXTRA_VALUE;
-        }), EXTRA_VALUE);
-        assertTrue(map.containsKey(EXTRA_KEY));
-        assertSame(map.get(EXTRA_KEY), EXTRA_VALUE);
+    public void testMergeNullMerger(String description, Map<IntegerEnum, String> map) {
+        assertThrows( () -> { map.merge(KEYS[1], VALUES[1], null);},
+                NullPointerException.class,
+                "Should throw NPE");
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
-    public void testMergeNPEHashMap() {
-        Object value = new HashMap().merge(KEYS[1], VALUES[1], null);
-    }
-
-    @Test(expectedExceptions = {NullPointerException.class})
-    public void testMergeNPEHashtable() {
-        Object value = new Hashtable().merge(KEYS[1], VALUES[1], null);
-    }
-
-    @Test(expectedExceptions = {NullPointerException.class})
-    public void testMergeNPETreeMap() {
-        Object value = new TreeMap().merge(KEYS[1], VALUES[1], null);
-    }
-
-    enum IntegerEnum {
+    public enum IntegerEnum {
 
         e0, e1, e2, e3, e4, e5, e6, e7, e8, e9,
         e10, e11, e12, e13, e14, e15, e16, e17, e18, e19,
@@ -715,6 +707,89 @@
         return result;
     }
 
+    static class Merging {
+        public enum Value {
+            ABSENT,
+            NULL,
+            OLDVALUE,
+            NEWVALUE,
+            RESULT
+        }
+
+        public enum Merger implements BiFunction<String,String,String> {
+            UNUSED {
+                public String apply(String oldValue, String newValue) {
+                    fail("should not be called");
+                    return null;
+                }
+            },
+            NULL {
+                public String apply(String oldValue, String newValue) {
+                    return null;
+                }
+            },
+            RESULT {
+                public String apply(String oldValue, String newValue) {
+                    return VALUES[3];
+                }
+            },
+        }
+    }
+
+    @DataProvider(name = "MergeCases", parallel = true)
+    public Iterator<Object[]> mergeCasesProvider() {
+        Collection<Object[]> cases = new ArrayList<>();
+
+        cases.addAll(makeMergeTestCases());
+        cases.addAll(makeMergeNullValueTestCases());
+
+        return cases.iterator();
+    }
+
+    static Collection<Object[]> makeMergeTestCases() {
+        Collection<Object[]> cases = new ArrayList<>();
+
+        for( Object[] mapParams : makeAllRWMaps() ) {
+            cases.add(new Object[] { mapParams[0], mapParams[1], Merging.Value.ABSENT, Merging.Value.NEWVALUE, Merging.Merger.UNUSED, Merging.Value.NEWVALUE, Merging.Value.NEWVALUE });
+        }
+
+        for( Object[] mapParams : makeAllRWMaps() ) {
+            cases.add(new Object[] { mapParams[0], mapParams[1], Merging.Value.OLDVALUE, Merging.Value.NEWVALUE, Merging.Merger.NULL, Merging.Value.ABSENT, Merging.Value.NULL });
+        }
+
+        for( Object[] mapParams : makeAllRWMaps() ) {
+            cases.add(new Object[] { mapParams[0], mapParams[1], Merging.Value.OLDVALUE, Merging.Value.NEWVALUE, Merging.Merger.RESULT, Merging.Value.RESULT, Merging.Value.RESULT });
+        }
+
+        return cases;
+    }
+
+    static Collection<Object[]> makeMergeNullValueTestCases() {
+        Collection<Object[]> cases = new ArrayList<>();
+
+        for( Object[] mapParams : makeAllRWMapsWithNulls() ) {
+            cases.add(new Object[] { mapParams[0], mapParams[1], Merging.Value.OLDVALUE, Merging.Value.NULL, Merging.Merger.NULL, Merging.Value.ABSENT, Merging.Value.NULL });
+        }
+
+        for( Object[] mapParams : makeAllRWMapsWithNulls() ) {
+            cases.add(new Object[] { mapParams[0], mapParams[1], Merging.Value.OLDVALUE, Merging.Value.NULL, Merging.Merger.RESULT, Merging.Value.RESULT, Merging.Value.RESULT });
+        }
+
+        for( Object[] mapParams : makeAllRWMapsWithNulls() ) {
+            cases.add(new Object[] { mapParams[0], mapParams[1], Merging.Value.ABSENT, Merging.Value.NULL, Merging.Merger.UNUSED, Merging.Value.ABSENT, Merging.Value.NULL });
+        }
+
+        for( Object[] mapParams : makeAllRWMapsWithNulls() ) {
+            cases.add(new Object[] { mapParams[0], mapParams[1], Merging.Value.NULL, Merging.Value.NULL, Merging.Merger.UNUSED, Merging.Value.ABSENT, Merging.Value.NULL });
+        }
+
+        for( Object[] mapParams : makeAllRWMapsWithNulls() ) {
+            cases.add(new Object[] { mapParams[0], mapParams[1], Merging.Value.NULL, Merging.Value.NEWVALUE, Merging.Merger.UNUSED, Merging.Value.NEWVALUE, Merging.Value.NEWVALUE });
+        }
+
+        return cases;
+    }
+
     public interface Thrower<T extends Throwable> {
 
         public void run() throws T;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Properties/LoadAndStoreXMLWithDefaults.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+
+/**
+ * @test
+ * @bug 8016344
+ * @summary checks that Properties.storeToXML only stores properties locally
+ *          defined on the Properties object, excluding those that are inherited.
+ * @author danielfuchs
+ */
+public class LoadAndStoreXMLWithDefaults {
+
+    public static enum StoreMethod {
+        // Note: this case will test the default provider when available,
+        //       and the basic provider when it's not.
+        PROPERTIES {
+            @Override
+            public String writeToXML(Properties p) throws IOException {
+                final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                p.storeToXML(baos, "Test 8016344");
+                return baos.toString();
+            }
+            @Override
+            public Properties loadFromXML(String xml, Properties defaults)
+                    throws IOException {
+                final ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes("UTF-8"));
+                Properties p = new Properties(defaults);
+                p.loadFromXML(bais);
+                return p;
+            }
+        },
+        // Note: this case always test the basic provider, which is always available.
+        //       so sometimes it's just a dup with the previous case...
+        BASICPROVIDER {
+            @Override
+            public String writeToXML(Properties p) throws IOException {
+                final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                jdk.internal.util.xml.BasicXmlPropertiesProvider provider =
+                        new  jdk.internal.util.xml.BasicXmlPropertiesProvider();
+                provider.store(p, baos, "Test 8016344", "UTF-8");
+                return baos.toString();
+            }
+            @Override
+            public Properties loadFromXML(String xml, Properties defaults)
+                    throws IOException {
+                final ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes("UTF-8"));
+                Properties p = new Properties(defaults);
+                jdk.internal.util.xml.BasicXmlPropertiesProvider provider =
+                        new  jdk.internal.util.xml.BasicXmlPropertiesProvider();
+                provider.load(p, bais);
+                return p;
+            }
+        };
+        public abstract String writeToXML(Properties p) throws IOException;
+        public abstract Properties loadFromXML(String xml, Properties defaults)
+                    throws IOException;
+        public String displayName() {
+            switch(this) {
+                case PROPERTIES: return "Properties.storeToXML";
+                case BASICPROVIDER: return "BasicXmlPropertiesProvider.store";
+                default:
+                    throw new UnsupportedOperationException(this.name());
+            }
+        }
+    }
+
+    static enum Objects { OBJ1, OBJ2, OBJ3 };
+
+    public static void main(String[] args) throws IOException {
+        Properties p1 = new Properties();
+        p1.setProperty("p1.prop", "prop1-p1");
+        p1.setProperty("p1.and.p2.prop", "prop2-p1");
+        p1.setProperty("p1.and.p2.and.p3.prop", "prop3-p1");
+        Properties p2 = new Properties(p1);
+        p2.setProperty("p2.prop", "prop4-p2");
+        p2.setProperty("p1.and.p2.prop", "prop5-p2");
+        p2.setProperty("p1.and.p2.and.p3.prop", "prop6-p2");
+        p2.setProperty("p2.and.p3.prop", "prop7-p2");
+        Properties p3 = new Properties(p2);
+        p3.setProperty("p3.prop", "prop8-p3");
+        p3.setProperty("p1.and.p2.and.p3.prop", "prop9-p3");
+        p3.setProperty("p2.and.p3.prop", "prop10-p3");
+
+        for (StoreMethod m : StoreMethod.values()) {
+            System.out.println("Testing with " + m.displayName());
+            Properties P1 = m.loadFromXML(m.writeToXML(p1), null);
+            Properties P2 = m.loadFromXML(m.writeToXML(p2), P1);
+            Properties P3 = m.loadFromXML(m.writeToXML(p3), P2);
+
+            testResults(m, p1, P1, p2, P2, p3, P3);
+
+            // Now check that properties whose keys or values are objects
+            // are skipped.
+
+            System.out.println("Testing with " + m.displayName() + " and Objects");
+            P1.put("p1.object.prop", Objects.OBJ1);
+            P1.put(Objects.OBJ1, "p1.object.prop");
+            P1.put("p2.object.prop", "p2.object.prop");
+            P2.put("p2.object.prop", Objects.OBJ2);
+            P2.put(Objects.OBJ2, "p2.object.prop");
+            P3.put("p3.object.prop", Objects.OBJ3);
+            P3.put(Objects.OBJ3, "p3.object.prop");
+
+            Properties PP1 = m.loadFromXML(m.writeToXML(P1), null);
+            Properties PP2 = m.loadFromXML(m.writeToXML(P2), PP1);
+            Properties PP3 = m.loadFromXML(m.writeToXML(P3), PP2);
+
+            p1.setProperty("p2.object.prop", "p2.object.prop");
+            try {
+                testResults(m, p1, PP1, p2, PP2, p3, PP3);
+            } finally {
+                p1.remove("p2.object.prop");
+            }
+        }
+    }
+
+    public static void testResults(StoreMethod m, Properties... pps) {
+        for (int i=0 ; i < pps.length ; i += 2) {
+            if (!pps[i].equals(pps[i+1])) {
+                System.err.println(m.displayName() +": P" + (i/2+1)
+                        + " Reloaded properties differ from original");
+                System.err.println("\toriginal: " + pps[i]);
+                System.err.println("\treloaded: " + pps[i+1]);
+                throw new RuntimeException(m.displayName() +": P" + (i/2+1)
+                        + " Reloaded properties differ from original");
+            }
+            if (!pps[i].keySet().equals(pps[i+1].keySet())) {
+                System.err.println(m.displayName() +": P" + (i/2+1)
+                        + " Reloaded property names differ from original");
+                System.err.println("\toriginal: " + pps[i].keySet());
+                System.err.println("\treloaded: " + pps[i+1].keySet());
+                throw new RuntimeException(m.displayName() +": P" + (i/2+1)
+                        + " Reloaded property names differ from original");
+            }
+            if (!pps[i].stringPropertyNames().equals(pps[i+1].stringPropertyNames())) {
+                System.err.println(m.displayName() +": P" + (i/2+1)
+                        + " Reloaded string property names differ from original");
+                System.err.println("\toriginal: " + pps[i].stringPropertyNames());
+                System.err.println("\treloaded: " + pps[i+1].stringPropertyNames());
+                throw new RuntimeException(m.displayName() +": P" + (i/2+1)
+                        + " Reloaded string property names differ from original");
+            }
+        }
+    }
+
+}
--- a/jdk/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -40,6 +40,7 @@
 ${COMPILEJAVA}/bin/keytool ${TESTTOOLVMOPTS} -genkeypair -alias testcert \
   -keystore ${TESTCLASSES}/timezonedatetest.store \
   -storepass testpass -validity 360 \
+  -keyalg rsa \
   -dname "cn=Mark Wildebeest, ou=FreeSoft, o=Red Hat, c=NL" \
   -keypass testpass
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/concurrent/atomic/Serial.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8026344
+ * @summary Exercise classes in j.u.c.atomic that use serialization proxies
+ */
+
+import java.util.concurrent.atomic.DoubleAdder;
+import java.util.concurrent.atomic.DoubleAccumulator;
+import java.util.concurrent.atomic.LongAdder;
+import java.util.concurrent.atomic.LongAccumulator;
+import java.util.function.DoubleBinaryOperator;
+import java.util.function.LongBinaryOperator;
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.Serializable;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.IOException;
+
+/**
+ * Basic test to exercise the j.u.c.atomic classes that use serialization
+ * proxies.
+ */
+
+public class Serial {
+
+    public static void main(String[] args) {
+        testDoubleAdder();
+        testDoubleAccumulator();
+        testLongAdder();
+        testLongAccumulator();
+    }
+
+    static void testDoubleAdder() {
+        DoubleAdder a = new DoubleAdder();
+        a.add(20.1d);
+        DoubleAdder result = echo(a);
+        if (result.doubleValue() != a.doubleValue())
+            throw new RuntimeException("Unexpected doubleValue");
+
+        checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
+    }
+
+    static void testDoubleAccumulator() {
+        DoubleBinaryOperator plus = (DoubleBinaryOperator & Serializable) (x, y) -> x + y;
+        DoubleAccumulator a = new DoubleAccumulator(plus, 13.9d);
+        a.accumulate(17.5d);
+        DoubleAccumulator result = echo(a);
+        if (result.get() != a.get())
+            throw new RuntimeException("Unexpected value");
+        a.reset();
+        result.reset();
+        if (result.get() != a.get())
+            throw new RuntimeException("Unexpected value after reset");
+
+        checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAccumulator$SerializationProxy");
+    }
+
+    static void testLongAdder() {
+        LongAdder a = new LongAdder();
+        a.add(45);
+        LongAdder result = echo(a);
+        if (result.longValue() != a.longValue())
+            throw new RuntimeException("Unexpected longValue");
+
+        checkSerialClassName(a, "java.util.concurrent.atomic.LongAdder$SerializationProxy");
+    }
+
+    static void testLongAccumulator() {
+        LongBinaryOperator plus = (LongBinaryOperator & Serializable) (x, y) -> x + y;
+        LongAccumulator a = new LongAccumulator(plus, -2);
+        a.accumulate(34);
+        LongAccumulator result = echo(a);
+        if (result.get() != a.get())
+            throw new RuntimeException("Unexpected value");
+        a.reset();
+        result.reset();
+        if (result.get() != a.get())
+            throw new RuntimeException("Unexpected value after reset");
+
+        checkSerialClassName(a, "java.util.concurrent.atomic.LongAccumulator$SerializationProxy");
+    }
+
+    /**
+     * Serialize the given object, returning the reconstituted object.
+     */
+    @SuppressWarnings("unchecked")
+    static <T extends Serializable> T echo(T obj) {
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        try (ObjectOutputStream oos = new ObjectOutputStream(out)) {
+            oos.writeObject(obj);
+        } catch (IOException e) {
+            throw new RuntimeException("Serialization failed: " + e);
+        }
+        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+        try (ObjectInputStream ois = new ObjectInputStream(in)) {
+            return (T) ois.readObject();
+        } catch (IOException | ClassNotFoundException e) {
+            throw new RuntimeException("Deserialization failed: " + e);
+        }
+    }
+
+    /**
+     * Checks that the given object serializes to the expected class.
+     */
+    static void checkSerialClassName(Serializable obj, String expected) {
+        String cn = serialClassName(obj);
+        if (!cn.equals(expected))
+            throw new RuntimeException(obj.getClass() + " serialized as " + cn
+                + ", expected " + expected);
+    }
+
+    /**
+     * Returns the class name that the given object serializes as.
+     */
+    static String serialClassName(Serializable obj) {
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        try (ObjectOutputStream oos = new ObjectOutputStream(out)) {
+            oos.writeObject(obj);
+        } catch (IOException e) {
+            throw new RuntimeException("Serialization failed: " + e);
+        }
+        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+        try (DataInputStream dis = new DataInputStream(in)) {
+            dis.readShort();      // STREAM_MAGIC
+            dis.readShort();      // STREAM_VERSION
+            dis.readByte();       // TC_OBJECT
+            dis.readByte();       // TC_CLASSDESC
+            return dis.readUTF(); // className
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
--- a/jdk/test/java/util/jar/JarInputStream/ExtraFileInMetaInf.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/util/jar/JarInputStream/ExtraFileInMetaInf.java	Wed Jul 05 19:21:26 2017 +0200
@@ -49,7 +49,7 @@
         new File("ks").delete();
         sun.security.tools.keytool.Main.main(
                 ("-keystore ks -storepass changeit -keypass changeit " +
-                        "-alias a -dname CN=A -genkeypair").split(" "));
+                        "-keyalg rsa -alias a -dname CN=A -genkeypair").split(" "));
         sun.security.tools.jarsigner.Main.main(
                 "-keystore ks -storepass changeit x.jar a".split(" "));
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/AnonymousLogger/TestAnonymousLogger.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.LinkedHashSet;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.logging.Filter;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+import java.util.logging.SimpleFormatter;
+
+/**
+ * @test
+ * @bug 8026863
+ * @summary checks that anonymous logger setters work as expected when a
+ *          security manager is set, and checks that getters return expected
+ *          values.
+ * @run main/othervm TestAnonymousLogger
+ */
+public class TestAnonymousLogger {
+
+    final public static class TestHandler extends Handler {
+        @Override
+        public void publish(LogRecord record) {
+            System.out.println(new SimpleFormatter().format(record));
+        }
+        @Override
+        public void flush() {
+            System.out.flush();
+        }
+        @Override
+        public void close() {
+            flush();
+        }
+    }
+
+    final public static class TestFilter implements Filter {
+        @Override
+        public boolean isLoggable(LogRecord record) {
+            return true;
+        }
+    }
+
+    final public static class TestBundle extends ResourceBundle {
+        Set<String> keys = Collections.synchronizedSet(new LinkedHashSet<>());
+        @Override
+        protected Object handleGetObject(String key) {
+            keys.add(key);
+            return "[LOCALIZED] "+key;
+        }
+        @Override
+        public Enumeration<String> getKeys() {
+            return Collections.enumeration(keys);
+        }
+    }
+
+    public static void main(String[] args) {
+        System.setSecurityManager(new SecurityManager());
+        Logger anonymous = Logger.getAnonymousLogger();
+
+        final TestHandler handler = new TestHandler();
+        final TestFilter filter = new TestFilter();
+        final ResourceBundle bundle = ResourceBundle.getBundle(TestBundle.class.getName());
+        anonymous.setLevel(Level.FINEST);
+        anonymous.addHandler(handler);
+        anonymous.setFilter(filter);
+        anonymous.setUseParentHandlers(true);
+        anonymous.setResourceBundle(bundle);
+
+        if (anonymous.getLevel() != Level.FINEST) {
+            throw new RuntimeException("Unexpected level: " + anonymous.getLevel());
+        } else {
+            System.out.println("Got expected level: " + anonymous.getLevel());
+        }
+        if (!Arrays.asList(anonymous.getHandlers()).contains(handler)) {
+            throw new RuntimeException("Expected handler not found in: "
+                    + Arrays.asList(anonymous.getHandlers()));
+        } else {
+            System.out.println("Got expected handler in: " + Arrays.asList(anonymous.getHandlers()));
+        }
+        if (anonymous.getFilter() != filter) {
+            throw new RuntimeException("Unexpected filter: " + anonymous.getFilter());
+        } else {
+            System.out.println("Got expected filter: " + anonymous.getFilter());
+        }
+        if (!anonymous.getUseParentHandlers()) {
+            throw new RuntimeException("Unexpected flag: " + anonymous.getUseParentHandlers());
+        } else {
+            System.out.println("Got expected flag: " + anonymous.getUseParentHandlers());
+        }
+        if (anonymous.getResourceBundle() != bundle) {
+            throw new RuntimeException("Unexpected bundle: " + anonymous.getResourceBundle());
+        } else {
+            System.out.println("Got expected bundle: " + anonymous.getResourceBundle());
+        }
+        try {
+            anonymous.setParent(Logger.getLogger("foo.bar"));
+            throw new RuntimeException("Expected SecurityException not raised!");
+        } catch (SecurityException x) {
+            System.out.println("Got expected exception: " + x);
+        }
+        if (anonymous.getParent() != Logger.getLogger("")) {
+            throw new RuntimeException("Unexpected parent: " + anonymous.getParent());
+        } else {
+            System.out.println("Got expected parent: " + anonymous.getParent());
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.security.Permission;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.logging.LoggingPermission;
+
+
+
+/**
+ * @test
+ * @bug 8023163
+ * @summary checks that Logger.getLogger("").setLevel() is working correctly.
+ * @build TestRootLoggerLevel
+ * @run main/othervm -Dtest.security=on TestRootLoggerLevel
+ * @run main/othervm -Dtest.security=off TestRootLoggerLevel
+ * @author danielfuchs
+ */
+public class TestRootLoggerLevel {
+
+    public static enum Loggers {
+        ROOT("", "root"),
+        GLOBAL(Logger.GLOBAL_LOGGER_NAME);
+
+        private final String name;
+        private final String displayName;
+        Loggers(String name) {
+            this(name, name);
+        }
+        Loggers(String name, String displayName) {
+            this.name = name;
+            this.displayName = displayName;
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        for (Loggers log : Loggers.values()) {
+            System.out.println(log.displayName + ": "
+                    + Logger.getLogger(log.name)
+                    + ": " + Logger.getLogger(log.name).getLevel());
+        }
+
+        if ("on".equals(System.getProperty("test.security","on"))) {
+            System.out.println("*** SecurityManager is ON");
+            Policy.setPolicy(new SimplePolicy());
+
+            System.setSecurityManager(new SecurityManager());
+        } else {
+            System.out.println("*** SecurityManager is OFF");
+        }
+
+        // Before the fix, setting the root logger level here had only
+        // a transient effect...
+        for (Loggers log : Loggers.values()) {
+            System.out.println("Logger.getLogger(\""
+                    + log.name
+                    + "\").setLevel(Level.FINEST);");
+            Logger.getLogger(log.name).setLevel(Level.FINEST);
+            System.out.println(log.displayName + ": "
+                    + Logger.getLogger(log.name)
+                    + ": " + Logger.getLogger(log.name).getLevel());
+
+            // At this point - the root logger should have a level which is
+            // FINEST - just check it here for sanity.
+            if (Logger.getLogger(log.name).getLevel() != Level.FINEST) {
+                throw new RuntimeException("Logger " + log.displayName
+                        + " level should be FINEST: "
+                        + Logger.getLogger(log.name).getLevel());
+            }
+        }
+        // Initializing some PlatformLogger caused the root logger
+        // level to be reset to INFO.
+        //
+        final Object platformLogger =
+                sun.util.logging.PlatformLogger.getLogger("java.foo");
+        System.out.println("Got platform logger: " + platformLogger);
+
+        for (Loggers log : Loggers.values()) {
+            // Check that the root logger still has the FINEST value assigned
+            // to it earlier.
+            System.out.println(log.displayName + ": "
+                    + Logger.getLogger(log.name)
+                    + ": " + Logger.getLogger(log.name).getLevel());
+
+            if (Logger.getLogger(log.name).getLevel() != Level.FINEST) {
+                throw new RuntimeException("Logger " + log.displayName
+                        + " level should be FINEST: "
+                        + Logger.getLogger(log.name).getLevel());
+            }
+        }
+
+     }
+
+    private static final class SimplePolicy extends Policy {
+        private final Permissions perms;
+
+        private static final Permissions permissions(Permission... perms) {
+            Permissions permissions = new Permissions();
+            for (Permission perm : perms) {
+                permissions.add(perm);
+            }
+            return permissions;
+        }
+
+        SimplePolicy() {
+            this(permissions(new LoggingPermission("control", null),
+                    new RuntimePermission("accessClassInPackage.sun.util.logging")
+            ));
+        }
+
+        SimplePolicy(Permissions perms) {
+            this.perms = perms;
+        }
+
+        @Override
+        public boolean implies(ProtectionDomain domain, Permission permission) {
+            return perms.implies(permission);
+        }
+
+    }
+
+}
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/lang/invoke/SerializedLambdaTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/lang/invoke/SerializedLambdaTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -22,9 +22,18 @@
  */
 package org.openjdk.tests.java.lang.invoke;
 
-import org.testng.annotations.Test;
-
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.NotSerializableException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.invoke.CallSite;
+import java.lang.invoke.LambdaMetafactory;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicLong;
@@ -34,6 +43,8 @@
 import java.util.function.Predicate;
 import java.util.function.Supplier;
 
+import org.testng.annotations.Test;
+
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
@@ -277,4 +288,66 @@
         LongConsumer lc = (LongConsumer & Serializable) a::addAndGet;
         assertSerial(lc, plc -> { plc.accept(3); });
     }
+
+    // Tests of direct use of metafactories
+
+    private static boolean foo(Object s) { return s != null && ((String) s).length() > 0; }
+    private static final MethodType predicateMT = MethodType.methodType(boolean.class, Object.class);
+    private static final MethodType stringPredicateMT = MethodType.methodType(boolean.class, String.class);
+    private static final Consumer<Predicate<String>> fooAsserter = x -> {
+        assertTrue(x.test("foo"));
+        assertFalse(x.test(""));
+        assertFalse(x.test(null));
+    };
+
+    // standard MF: nonserializable supertype
+    public void testDirectStdNonser() throws Throwable {
+        MethodHandle fooMH = MethodHandles.lookup().findStatic(SerializedLambdaTest.class, "foo", predicateMT);
+
+        // Standard metafactory, non-serializable target: not serializable
+        CallSite cs = LambdaMetafactory.metafactory(MethodHandles.lookup(),
+                                                    "test", MethodType.methodType(Predicate.class),
+                                                    predicateMT, fooMH, stringPredicateMT);
+        Predicate<String> p = (Predicate<String>) cs.getTarget().invokeExact();
+        assertNotSerial(p, fooAsserter);
+    }
+
+    // standard MF: serializable supertype
+    public void testDirectStdSer() throws Throwable {
+        MethodHandle fooMH = MethodHandles.lookup().findStatic(SerializedLambdaTest.class, "foo", predicateMT);
+
+        // Standard metafactory, serializable target: not serializable
+        CallSite cs = LambdaMetafactory.metafactory(MethodHandles.lookup(),
+                                                    "test", MethodType.methodType(SerPredicate.class),
+                                                    predicateMT, fooMH, stringPredicateMT);
+        assertNotSerial((SerPredicate<String>) cs.getTarget().invokeExact(), fooAsserter);
+    }
+
+    // alt MF: nonserializable supertype
+    public void testAltStdNonser() throws Throwable {
+        MethodHandle fooMH = MethodHandles.lookup().findStatic(SerializedLambdaTest.class, "foo", predicateMT);
+
+        // Alt metafactory, non-serializable target: not serializable
+        CallSite cs = LambdaMetafactory.altMetafactory(MethodHandles.lookup(),
+                                                       "test", MethodType.methodType(Predicate.class),
+                                                       predicateMT, fooMH, stringPredicateMT, 0);
+        assertNotSerial((Predicate<String>) cs.getTarget().invokeExact(), fooAsserter);
+    }
+
+    // alt MF: serializable supertype
+    public void testAltStdSer() throws Throwable {
+        MethodHandle fooMH = MethodHandles.lookup().findStatic(SerializedLambdaTest.class, "foo", predicateMT);
+
+        // Alt metafactory, serializable target, no FLAG_SERIALIZABLE: not serializable
+        CallSite cs = LambdaMetafactory.altMetafactory(MethodHandles.lookup(),
+                                                       "test", MethodType.methodType(SerPredicate.class),
+                                                       predicateMT, fooMH, stringPredicateMT, 0);
+        assertNotSerial((SerPredicate<String>) cs.getTarget().invokeExact(), fooAsserter);
+
+        // Alt metafactory, serializable marker, no FLAG_SERIALIZABLE: not serializable
+        cs = LambdaMetafactory.altMetafactory(MethodHandles.lookup(),
+                                              "test", MethodType.methodType(Predicate.class),
+                                              predicateMT, fooMH, stringPredicateMT, LambdaMetafactory.FLAG_MARKERS, 1, Serializable.class);
+        assertNotSerial((Predicate<String>) cs.getTarget().invokeExact(), fooAsserter);
+    }
 }
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/DistinctOpTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/DistinctOpTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -28,8 +28,10 @@
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Optional;
 import java.util.Spliterator;
 import java.util.Spliterators;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.stream.*;
 
 import static java.util.stream.LambdaTestHelpers.*;
@@ -48,6 +50,17 @@
         assertCountSum(countTo(10).stream().distinct(), 10, 55);
     }
 
+    public void testWithUnorderedInfiniteStream() {
+        // These tests should short-circuit, otherwise will fail with a time-out
+        // or an OOME
+
+        Integer one = Stream.iterate(1, i -> i + 1).unordered().parallel().distinct().findAny().get();
+        assertEquals(one.intValue(), 1);
+
+        Optional<Integer> oi = ThreadLocalRandom.current().ints().boxed().parallel().distinct().findAny();
+        assertTrue(oi.isPresent());
+    }
+
     @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
     public void testOp(String name, TestData.OfRef<Integer> data) {
         Collection<Integer> result = exerciseOpsInt(data, Stream::distinct, IntStream::distinct, LongStream::distinct, DoubleStream::distinct);
--- a/jdk/test/java/util/zip/GZIP/GZIPInZip.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/java/util/zip/GZIP/GZIPInZip.java	Wed Jul 05 19:21:26 2017 +0200
@@ -22,15 +22,14 @@
  */
 
 /* @test
- * @bug 7021870 8023431
+ * @bug 7021870 8023431 8026756
  * @summary Reading last gzip chain member must not close the input stream.
  *          Garbage following gzip entry must be ignored.
  */
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
 import java.util.zip.GZIPInputStream;
 import java.util.zip.GZIPOutputStream;
 import java.util.zip.ZipEntry;
@@ -40,9 +39,9 @@
 
 public class GZIPInZip {
 
-    private static volatile Throwable trouble;
+    public static void main(String[] args)
+            throws Throwable {
 
-    public static void main(String[] args) throws Throwable {
         doTest(false, false);
         doTest(false, true);
         doTest(true, false);
@@ -53,63 +52,46 @@
                                final boolean limitGISBuff)
             throws Throwable {
 
-        final PipedOutputStream pos = new PipedOutputStream();
-        final PipedInputStream pis = new PipedInputStream(pos);
+        byte[] buf;
+
+        try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
+             ZipOutputStream zos = new ZipOutputStream(baos)) {
+
+            final byte[] xbuf = { 'x' };
 
-        Thread compressor = new Thread() {
-            public void run() {
-                final byte[] xbuf = { 'x' };
-                try (ZipOutputStream zos = new ZipOutputStream(pos)) {
+            zos.putNextEntry(new ZipEntry("a.gz"));
+            GZIPOutputStream gos1 = new GZIPOutputStream(zos);
+            gos1.write(xbuf);
+            gos1.finish();
+            if (appendGarbage)
+                zos.write(xbuf);
+            zos.closeEntry();
 
-                    zos.putNextEntry(new ZipEntry("a.gz"));
-                    try (GZIPOutputStream gos1 = new GZIPOutputStream(zos)) {
-                        gos1.write(xbuf);
-                        gos1.finish();
-                    }
-                    if (appendGarbage)
-                        zos.write(xbuf);
+            zos.putNextEntry(new ZipEntry("b.gz"));
+            GZIPOutputStream gos2 = new GZIPOutputStream(zos);
+            gos2.write(xbuf);
+            gos2.finish();
+            zos.closeEntry();
 
-                    zos.closeEntry();
+            zos.flush();
+            buf = baos.toByteArray();
+        }
 
-                    zos.putNextEntry(new ZipEntry("b.gz"));
-                    try (GZIPOutputStream gos2 = new GZIPOutputStream(zos)) {
-                        gos2.write(xbuf);
-                        gos2.finish();
-                    }
-                    zos.closeEntry();
+        try (ByteArrayInputStream bais = new ByteArrayInputStream(buf);
+             ZipInputStream zis = new ZipInputStream(bais)) {
 
-                } catch (Throwable t) {
-                    trouble = t;
-                }
+            zis.getNextEntry();
+            GZIPInputStream gis1 = limitGISBuff ?
+                    new GZIPInputStream(zis, 4) :
+                    new GZIPInputStream(zis);
+            // try to read more than the entry has
+            gis1.skip(2);
+
+            try {
+                zis.getNextEntry();
+            } catch (IOException e) {
+                throw new RuntimeException("ZIP stream was prematurely closed", e);
             }
-        };
-
-        Thread uncompressor = new Thread() {
-            public void run() {
-                try (ZipInputStream zis = new ZipInputStream(pis)) {
-                    zis.getNextEntry();
-                    try (InputStream gis = limitGISBuff ?
-                            new GZIPInputStream(zis, 4) :
-                            new GZIPInputStream(zis)) {
-                        // try to read more than the entry has
-                        gis.skip(2);
-                    }
-
-                    try {
-                        zis.getNextEntry();
-                    } catch (IOException e) {
-                        throw new AssertionError("ZIP stream was prematurely closed");
-                    }
-                } catch (Throwable t) {
-                    trouble = t;
-                }
-            }
-        };
-
-        compressor.start(); uncompressor.start();
-        compressor.join();  uncompressor.join();
-
-        if (trouble != null)
-            throw trouble;
+        }
     }
 }
--- a/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,49 +25,48 @@
  * @test
  * @summary NPE IN RMIConnector.connect
  * @bug 6984520
+ * @library /java/rmi/testlibrary
  * @run clean RMIConnector_NPETest
+ * @run build TestLibrary RMID
  * @run build RMIConnector_NPETest
  * @run main RMIConnector_NPETest
  */
-
-import java.io.*;
-import java.lang.management.*;
-import java.rmi.registry.*;
+import java.io.IOException;
 import javax.management.*;
-import javax.management.remote.*;
 import javax.management.remote.rmi.*;
 
-public class RMIConnector_NPETest  {
-
+public class RMIConnector_NPETest {
     public static void main(String argv[]) throws Exception {
-        boolean testFailed = false;
-        String rmidCmd = System.getProperty("java.home") + File.separator +
-            "bin" + File.separator + "rmid -port 3333";
-        String stopRmidCmd = System.getProperty("java.home") + File.separator +
-                "bin" + File.separator + "rmid -stop -port 3333";
-    try {
-        //start an rmid daemon and give it some time
-        System.out.println("Starting rmid");
-        Runtime.getRuntime().exec(rmidCmd);
-        Thread.sleep(5000);
+        RMID rmid = RMID.createRMID();
+        rmid.start();
+        int rmidPort = rmid.getPort();
+        Exception failureCause = null;
+        RMIConnector agent = null;
 
-        MBeanServer mbs = MBeanServerFactory.createMBeanServer();
-        RMIJRMPServerImpl rmiserver = new RMIJRMPServerImpl(3333, null, null, null);
-        rmiserver.setMBeanServer(mbs);
-        RMIConnector agent = new RMIConnector(rmiserver, null);
-        agent.connect();
-    } catch(NullPointerException npe) {
-        npe.printStackTrace();
-        testFailed = true;
-    } catch (Exception e) {
-        // OK
-    } finally {
-        System.out.println("Stopping rmid");
-        Runtime.getRuntime().exec(stopRmidCmd);
+        try {
+            MBeanServer mbs = MBeanServerFactory.createMBeanServer();
+            RMIJRMPServerImpl rmiserver = new RMIJRMPServerImpl(rmidPort, null, null, null);
+            rmiserver.setMBeanServer(mbs);
+            agent = new RMIConnector(rmiserver, null);
+            agent.connect();
+        } catch (NullPointerException npe) {
+            failureCause = npe;
+        } catch (Exception e) {
+            // OK
+        } finally {
+            if (agent != null) {
+                try {
+                    agent.close();
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+            rmid.shutdown(rmidPort);
         }
 
-    if(testFailed)
-        throw new Exception("Test failed");
+        if (failureCause != null) {
+            TestLibrary.bomb("Test failed", failureCause);
+        }
 
     }
-}
+}
\ No newline at end of file
--- a/jdk/test/javax/management/remote/mandatory/notif/NotSerializableNotifTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotSerializableNotifTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -33,8 +33,8 @@
 
 // java imports
 //
-import java.io.IOException;
 import java.net.MalformedURLException;
+import java.util.Map;
 
 // JMX imports
 //
@@ -44,7 +44,7 @@
 import javax.management.remote.JMXServiceURL;
 
 public class NotSerializableNotifTest {
-    private static MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
+    private static final MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
     private static ObjectName emitter;
     private static int port = 2468;
 
@@ -52,9 +52,19 @@
 
     private static final int sentNotifs = 10;
 
+    private static double timeoutFactor = 1.0;
+    private static final double defaultTimeout = 10;
+
     public static void main(String[] args) throws Exception {
         System.out.println(">>> Test to send a not serializable notification");
 
+        String timeoutVal = System.getProperty("test.timeout.factor");
+        if (timeoutVal != null) {
+            timeoutFactor = Double.parseDouble(
+                System.getProperty("test.timeout.factor")
+            );
+        }
+
         // IIOP fails on JDK1.4, see 5034318
         final String v = System.getProperty("java.version");
         float f = Float.parseFloat(v.substring(0, 3));
@@ -136,7 +146,8 @@
 
         // waiting ...
         synchronized (listener) {
-            for (int i=0; i<10; i++) {
+            int top = (int)Math.ceil(timeoutFactor * defaultTimeout);
+            for (int i=0; i<top; i++) {
                 if (listener.received() < sentNotifs) {
                     listener.wait(1000);
                 } else {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/print/TextFlavorTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 6334074 8022536
+  @summary test supported text flavors reported properly
+  @run main TextFlavorTest
+*/
+
+import javax.print.*;
+import javax.print.attribute.standard.*;
+import javax.print.attribute.*;
+import java.io.*;
+
+public class TextFlavorTest {
+
+    public static void main(String[] args) throws Exception {
+
+        PrintService service[] =
+            PrintServiceLookup.lookupPrintServices(null, null);
+
+        if (service.length == 0) {
+            System.out.println("No print service found.");
+            return;
+        }
+
+        for (int y = 0; y < service.length; y ++) {
+            DocFlavor flavors[] = service[y].getSupportedDocFlavors();
+            if (flavors == null) continue;
+            for (int x = 0; x < flavors.length; x ++) {
+                if (!service[y].isDocFlavorSupported(flavors[x])) {
+                    String msg = "DocFlavor " + flavors[x] +
+                        " is not supported by service "+ service[y];
+                    throw new RuntimeException(msg);
+                }
+            }
+        }
+        System.out.println("Test passed.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/sampled/FileReader/ReadersExceptions.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.UnsupportedAudioFileException;
+
+/**
+ * @test
+ * @bug 7058662 7058666 7058672
+ * @author Sergey Bylokhov
+ */
+public final class ReadersExceptions {
+
+    // empty channels
+    static byte[] wrongAIFFCh =
+            {0x46, 0x4f, 0x52, 0x4d, // AiffFileFormat.AIFF_MAGIC
+             0, 0, 0, 0, // length
+             0, 0, 0, 0, // iffType
+             0x43, 0x4f, 0x4d, 0x4d, // chunkName
+             0, 0, 0, 100, // chunkLen
+             0, 0, // channels
+             0, 0, 0, 0, //
+             0, 10  // sampleSize
+                    , 0, 0, 0, 0};
+    // empty sampleSize
+    static byte[] wrongAIFFSSL =
+            {0x46, 0x4f, 0x52, 0x4d, //AiffFileFormat.AIFF_MAGIC
+             0, 0, 0, 0, // length
+             0, 0, 0, 0, // iffType
+             0x43, 0x4f, 0x4d, 0x4d, // chunkName
+             0, 0, 0, 100, // chunkLen
+             0, 10, // channels
+             0, 0, 0, 0, //
+             0, 0  // sampleSize
+                    , 0, 0, 0, 0};
+    // big sampleSize
+    static byte[] wrongAIFFSSH =
+            {0x46, 0x4f, 0x52, 0x4d, //AiffFileFormat.AIFF_MAGIC
+             0, 0, 0, 0, // length
+             0, 0, 0, 0, // iffType
+             0x43, 0x4f, 0x4d, 0x4d, // chunkName
+             0, 0, 0, 100, // chunkLen
+             0, 10, // channels
+             0, 0, 0, 0, //
+             0, 33  // sampleSize
+                    , 0, 0, 0, 0};
+    // empty channels
+    static byte[] wrongAUCh =
+            {0x2e, 0x73, 0x6e, 0x64,//AiffFileFormat.AU_SUN_MAGIC
+             0, 0, 0, 0, // headerSize
+             0, 0, 0, 0, // dataSize
+             0, 0, 0, 1, // encoding_local AuFileFormat.AU_ULAW_8
+             0, 0, 0, 0, // sampleRate
+             0, 0, 0, 0 // channels
+            };
+    // empty channels
+    static byte[] wrongWAVCh =
+            {0x52, 0x49, 0x46, 0x46, // WaveFileFormat.RIFF_MAGIC
+             1, 1, 1, 1, // fileLength
+             0x57, 0x41, 0x56, 0x45, //  waveMagic
+             0x66, 0x6d, 0x74, 0x20, // FMT_MAGIC
+             3, 0, 0, 0, // length
+             1, 0, // wav_type  WAVE_FORMAT_PCM
+             0, 0, // channels
+             0, 0, 0, 0, // sampleRate
+             0, 0, 0, 0, // avgBytesPerSec
+             0, 0, // blockAlign
+             1, 0, // sampleSizeInBits
+             0x64, 0x61, 0x74, 0x61, // WaveFileFormat.DATA_MAGIC
+             0, 0, 0, 0, // dataLength
+            };
+    // empty sampleSizeInBits
+    static byte[] wrongWAVSSB =
+            {0x52, 0x49, 0x46, 0x46, // WaveFileFormat.RIFF_MAGIC
+             1, 1, 1, 1, // fileLength
+             0x57, 0x41, 0x56, 0x45, //  waveMagic
+             0x66, 0x6d, 0x74, 0x20, // FMT_MAGIC
+             3, 0, 0, 0, // length
+             1, 0, // wav_type  WAVE_FORMAT_PCM
+             1, 0, // channels
+             0, 0, 0, 0, // sampleRate
+             0, 0, 0, 0, // avgBytesPerSec
+             0, 0, // blockAlign
+             0, 0, // sampleSizeInBits
+             0x64, 0x61, 0x74, 0x61, // WaveFileFormat.DATA_MAGIC
+             0, 0, 0, 0, // dataLength
+            };
+
+    public static void main(final String[] args) throws IOException {
+        test(wrongAIFFCh);
+        test(wrongAIFFSSL);
+        test(wrongAIFFSSH);
+        test(wrongAUCh);
+        test(wrongWAVCh);
+        test(wrongWAVSSB);
+    }
+
+    private static void test(final byte[] buffer) throws IOException {
+        final InputStream is = new ByteArrayInputStream(buffer);
+        try {
+            AudioSystem.getAudioFileFormat(is);
+        } catch (UnsupportedAudioFileException ignored) {
+            // Expected.
+            return;
+        }
+        throw new RuntimeException("Test Failed");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JInternalFrame/8020708/bug8020708.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.util.Locale;
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8020708
+ * @author Alexander Scherbatiy
+ * @summary NLS: mnemonics missing in SwingSet2/JInternalFrame demo
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main bug8020708
+ */
+public class bug8020708 {
+
+    private static final Locale[] SUPPORTED_LOCALES = {
+        Locale.ENGLISH,
+        new Locale("de"),
+        new Locale("es"),
+        new Locale("fr"),
+        new Locale("it"),
+        new Locale("ja"),
+        new Locale("ko"),
+        new Locale("pt", "BR"),
+        new Locale("sv"),
+        new Locale("zh", "CN"),
+        new Locale("zh", "TW")
+    };
+    private static final String[] LOOK_AND_FEELS = {
+        "Nimbus",
+        "Windows",
+        "Motif"
+    };
+    private static JInternalFrame internalFrame;
+    private static JFrame frame;
+
+    public static void main(String[] args) throws Exception {
+        for (Locale locale : SUPPORTED_LOCALES) {
+            for (String laf : LOOK_AND_FEELS) {
+                Locale.setDefault(locale);
+                if (!installLookAndFeel(laf)) {
+                    continue;
+                }
+                testInternalFrameMnemonic();
+            }
+        }
+    }
+
+    static void testInternalFrameMnemonic() throws Exception {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frame = new JFrame("Test");
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                frame.setSize(300, 200);
+
+                JDesktopPane desktop = new JDesktopPane();
+                internalFrame = new JInternalFrame("Test");
+                internalFrame.setSize(200, 100);
+                internalFrame.setClosable(true);
+                desktop.add(internalFrame);
+                internalFrame.setVisible(true);
+                internalFrame.setMaximizable(true);
+
+                frame.getContentPane().add(desktop);
+                frame.setVisible(true);
+            }
+        });
+
+        toolkit.realSync();
+
+        Point clickPoint = Util.getCenterPoint(internalFrame);
+        robot.mouseMove(clickPoint.x, clickPoint.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        toolkit.realSync();
+
+        Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_SPACE);
+        toolkit.realSync();
+
+        Util.hitKeys(robot, KeyEvent.VK_C);
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                if (internalFrame.isVisible()) {
+                    throw new RuntimeException("Close mnemonic does not work");
+                }
+                frame.dispose();
+            }
+        });
+    }
+
+    static final boolean installLookAndFeel(String lafName) throws Exception {
+        UIManager.LookAndFeelInfo[] infos = UIManager.getInstalledLookAndFeels();
+        for (UIManager.LookAndFeelInfo info : infos) {
+            if (info.getClassName().contains(lafName)) {
+                UIManager.setLookAndFeel(info.getClassName());
+                return true;
+            }
+        }
+        return false;
+    }
+}
--- a/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -35,13 +35,14 @@
 import javax.swing.*;
 
 public class ActionListenerCalledTwiceTest {
-    static String menuItems[] = { "Item1", "Item2", "Item3", "Item4", "Item5" };
+    static String menuItems[] = { "Item1", "Item2", "Item3", "Item4", "Item5", "Item6" };
     static KeyStroke keyStrokes[] = {
         KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.META_MASK),
         KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
         KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.SHIFT_MASK),
         KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.META_MASK),
-        KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK)
+        KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK),
+        KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.META_MASK)
     };
 
     static volatile int listenerCallCounter = 0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/html/8005391/bug8005391.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.CharArrayReader;
+import java.io.CharArrayWriter;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+
+/**
+ * @test
+ * @bug 8005391
+ * @author Alexander Shusherov
+ * @summary Floating behavior of HTMLEditorKit parser
+ * @run main bug8005391
+ */
+public class bug8005391 {
+
+    private static final String htmlDoc = "<html><body><tt><a href='one'>1</a>2</tt></body></html>";
+
+    public static void main(String[] args) throws Exception {
+        int N = 10;
+
+        for (int i = 0; i < N; i++) {
+            HTMLEditorKit kit = new HTMLEditorKit();
+            Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator");
+            HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance();
+            HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument();
+            HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0);
+            parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true);
+            htmlReader.flush();
+            CharArrayWriter writer = new CharArrayWriter(1000);
+            kit.write(writer, doc, 0, doc.getLength());
+            writer.flush();
+
+            String result = writer.toString();
+            if (!result.contains("<tt><a")) {
+                throw new RuntimeException("The <a> and <tt> tags are swapped");
+            }
+        }
+    }
+}
\ No newline at end of file
--- a/jdk/test/javax/xml/jaxp/parsers/8022548/XOMParserTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/javax/xml/jaxp/parsers/8022548/XOMParserTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -65,7 +65,7 @@
 
             String inFilename = filePath + "/JDK8022548.xml";
             String xslFilename = filePath + "/JDK8022548.xsl";
-            String outFilename = filePath + "/JDK8022548.out";
+            String outFilename = "JDK8022548.out";
 
             StringWriter sw = new StringWriter();
             // Create transformer factory
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/transform/jdk8004476/SecureProcessingTest.xml	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<helloWorld/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/transform/jdk8004476/TestBase.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+import java.security.Policy;
+
+/**
+ *
+ *
+ * @author huizhe.wang@oracle.com
+ */
+public class TestBase {
+    public static boolean isWindows = false;
+    static {
+        if (System.getProperty("os.name").indexOf("Windows")>-1) {
+            isWindows = true;
+        }
+    };
+
+    String filepath;
+    boolean hasSM;
+    String curDir;
+    Policy origPolicy;
+    String testName;
+    static String errMessage;
+
+    int passed = 0, failed = 0;
+
+    /**
+     * Creates a new instance of StreamReader
+     */
+    public TestBase(String name) {
+        testName = name;
+    }
+
+    //junit @Override
+    protected void setUp() {
+        if (System.getSecurityManager() != null) {
+            hasSM = true;
+            System.setSecurityManager(null);
+        }
+
+        filepath = System.getProperty("test.src");
+        if (filepath == null) {
+            //current directory
+            filepath = System.getProperty("user.dir");
+        }
+        origPolicy = Policy.getPolicy();
+
+    }
+
+    //junit @Override
+    public void tearDown() {
+        // turn off security manager and restore policy
+        System.setSecurityManager(null);
+        Policy.setPolicy(origPolicy);
+        if (hasSM) {
+            System.setSecurityManager(new SecurityManager());
+        }
+        System.out.println("\nNumber of tests passed: " + passed);
+        System.out.println("Number of tests failed: " + failed + "\n");
+
+        if (errMessage != null ) {
+            throw new RuntimeException(errMessage);
+        }
+    }
+
+    void fail(String errMsg) {
+        if (errMessage == null) {
+            errMessage = errMsg;
+        } else {
+            errMessage = errMessage + "\n" + errMsg;
+        }
+        failed++;
+    }
+
+    void success(String msg) {
+        passed++;
+        System.out.println(msg);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/transform/jdk8004476/XPathExFuncTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/**
+ * @test
+ * @bug 8004476
+ * @summary test XPath extension functions
+ * @run main/othervm XPathExFuncTest
+ */
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.security.AllPermission;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.Iterator;
+import java.util.List;
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+import javax.xml.xpath.XPathFactoryConfigurationException;
+import javax.xml.xpath.XPathFunction;
+import javax.xml.xpath.XPathFunctionException;
+import javax.xml.xpath.XPathFunctionResolver;
+import org.w3c.dom.Document;
+
+/**
+ * test XPath extension functions
+ *
+ * @author huizhe.wang@oracle.com
+ */
+public class XPathExFuncTest extends TestBase {
+
+    final static String ENABLE_EXTENSION_FUNCTIONS = "http://www.oracle.com/xml/jaxp/properties/enableExtensionFunctions";
+    final static String CLASSNAME = "DocumentBuilderFactoryImpl";
+    final String XPATH_EXPRESSION = "ext:helloWorld()";
+
+    /**
+     * Creates a new instance of StreamReader
+     */
+    public XPathExFuncTest(String name) {
+        super(name);
+    }
+    boolean hasSM;
+    String xslFile, xslFileId;
+    String xmlFile, xmlFileId;
+
+    protected void setUp() {
+        super.setUp();
+        xmlFile = filepath + "/SecureProcessingTest.xml";
+
+    }
+
+    /**
+     * @param args the command line arguments
+     */
+    public static void main(String[] args) {
+        XPathExFuncTest test = new XPathExFuncTest("OneTest");
+        test.setUp();
+
+        test.testExtFunc();
+        test.testExtFuncNotAllowed();
+        test.testEnableExtFunc();
+        test.tearDown();
+
+    }
+
+    /**
+     * by default, extension function is enabled
+     */
+    public void testExtFunc() {
+
+        try {
+            evaluate(false);
+            System.out.println("testExtFunc: OK");
+        } catch (XPathFactoryConfigurationException e) {
+            fail(e.getMessage());
+        } catch (XPathExpressionException e) {
+            fail(e.getMessage());
+        }
+    }
+
+    /**
+     * Security is enabled, extension function not allowed
+     */
+    public void testExtFuncNotAllowed() {
+        Policy p = new SimplePolicy(new AllPermission());
+        Policy.setPolicy(p);
+        System.setSecurityManager(new SecurityManager());
+
+        try {
+            evaluate(false);
+        } catch (XPathFactoryConfigurationException e) {
+            fail(e.getMessage());
+        } catch (XPathExpressionException ex) {
+            //expected since extension function is disallowed
+            System.out.println("testExtFuncNotAllowed: OK");
+        } finally {
+            System.setSecurityManager(null);
+        }
+    }
+
+    /**
+     * Security is enabled, use new feature: enableExtensionFunctions
+     */
+    public void testEnableExtFunc() {
+        Policy p = new SimplePolicy(new AllPermission());
+        Policy.setPolicy(p);
+        System.setSecurityManager(new SecurityManager());
+
+
+        try {
+            evaluate(true);
+            System.out.println("testEnableExt: OK");
+        } catch (XPathFactoryConfigurationException e) {
+            fail(e.getMessage());
+        } catch (XPathExpressionException e) {
+            fail(e.getMessage());
+        } finally {
+            System.setSecurityManager(null);
+        }
+    }
+
+    Document getDocument() {
+        // the xml source
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder documentBuilder = null;
+        Document document = null;
+
+        try {
+            documentBuilder = documentBuilderFactory.newDocumentBuilder();
+            InputStream xmlStream = new FileInputStream(xmlFile);
+            document = documentBuilder.parse(xmlStream);
+        } catch (Exception e) {
+            fail(e.toString());
+        }
+        return document;
+    }
+
+    void evaluate(boolean enableExt) throws XPathFactoryConfigurationException, XPathExpressionException {
+        Document document = getDocument();
+
+        XPathFactory xPathFactory = XPathFactory.newInstance();
+        /**
+         * Use of the extension function 'http://exslt.org/strings:tokenize' is
+         * not allowed when the secure processing feature is set to true.
+         * Attempt to use the new property to enable extension function
+         */
+        if (enableExt) {
+            boolean isExtensionSupported = enableExtensionFunction(xPathFactory);
+        }
+
+        xPathFactory.setXPathFunctionResolver(new MyXPathFunctionResolver());
+        if (System.getSecurityManager() == null) {
+            xPathFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+        }
+
+        XPath xPath = xPathFactory.newXPath();
+        xPath.setNamespaceContext(new MyNamespaceContext());
+
+        String xPathResult = xPath.evaluate(XPATH_EXPRESSION, document);
+        System.out.println(
+                "XPath result (enableExtensionFunction == " + enableExt + ") = \""
+                + xPathResult
+                + "\"");
+    }
+
+    public class MyXPathFunctionResolver
+            implements XPathFunctionResolver {
+
+        public XPathFunction resolveFunction(QName functionName, int arity) {
+
+            // not a real ewsolver, always return a default XPathFunction
+            return new MyXPathFunction();
+        }
+    }
+
+    public class MyXPathFunction
+            implements XPathFunction {
+
+        public Object evaluate(List list) throws XPathFunctionException {
+
+            return "Hello World";
+        }
+    }
+
+    public class MyNamespaceContext implements NamespaceContext {
+
+        public String getNamespaceURI(String prefix) {
+            if (prefix == null) {
+                throw new IllegalArgumentException("The prefix cannot be null.");
+            }
+
+            if (prefix.equals("ext")) {
+                return "http://ext.com";
+            } else {
+                return null;
+            }
+        }
+
+        public String getPrefix(String namespace) {
+
+            if (namespace == null) {
+                throw new IllegalArgumentException("The namespace uri cannot be null.");
+            }
+
+            if (namespace.equals("http://ext.com")) {
+                return "ext";
+            } else {
+                return null;
+            }
+        }
+
+        public Iterator getPrefixes(String namespace) {
+            return null;
+        }
+    }
+
+    boolean enableExtensionFunction(XPathFactory factory) {
+        boolean isSupported = true;
+        try {
+            factory.setFeature(ENABLE_EXTENSION_FUNCTIONS, true);
+        } catch (XPathFactoryConfigurationException ex) {
+            isSupported = false;
+        }
+        return isSupported;
+    }
+
+    class SimplePolicy extends Policy {
+
+        private final Permissions perms;
+
+        public SimplePolicy(Permission... permissions) {
+            perms = new Permissions();
+            for (Permission permission : permissions) {
+                perms.add(permission);
+            }
+        }
+
+        @Override
+        public PermissionCollection getPermissions(CodeSource cs) {
+            return perms;
+        }
+
+        @Override
+        public PermissionCollection getPermissions(ProtectionDomain pd) {
+            return perms;
+        }
+
+        @Override
+        public boolean implies(ProtectionDomain pd, Permission p) {
+            return perms.implies(p);
+        }
+
+        //for older jdk
+        @Override
+        public void refresh() {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/transform/jdk8004476/XSLTExFuncTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/**
+ * @test
+ * @bug 8004476
+ * @summary test XSLT extension functions
+ * @run main/othervm XSLTExFuncTest
+ */
+
+import java.io.StringWriter;
+import java.security.AllPermission;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import javax.xml.transform.*;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import org.xml.sax.InputSource;
+
+/**
+ * test XSLT extension functions
+ *
+ * @author huizhe.wang@oracle.com
+ */
+public class XSLTExFuncTest extends TestBase {
+
+    final static String ENABLE_EXTENSION_FUNCTIONS = "http://www.oracle.com/xml/jaxp/properties/enableExtensionFunctions";
+    final static String CLASSNAME = "DocumentBuilderFactoryImpl";
+
+    /**
+     * Creates a new instance of StreamReader
+     */
+    public XSLTExFuncTest(String name) {
+        super(name);
+    }
+    boolean hasSM;
+    String xslFile, xslFileId;
+    String xmlFile, xmlFileId;
+
+    protected void setUp() {
+        super.setUp();
+        xmlFile = filepath + "/tokenize.xml";
+        xslFile = filepath + "/tokenize.xsl";
+
+        /**
+         * if (isWindows) { xslFile = "/" + xslFile; }
+         *
+         */
+        xslFileId = "file://" + xslFile;
+    }
+
+    /**
+     * @param args the command line arguments
+     */
+    public static void main(String[] args) {
+        XSLTExFuncTest test = new XSLTExFuncTest("OneTest");
+        test.setUp();
+
+        test.testExtFunc();
+        test.testExtFuncNotAllowed();
+        test.testEnableExtFunc();
+        test.testTemplatesEnableExtFunc();
+        test.tearDown();
+
+    }
+
+    /**
+     * by default, extension function is enabled
+     */
+    public void testExtFunc() {
+        TransformerFactory factory = TransformerFactory.newInstance();
+
+        try {
+            transform(factory);
+            System.out.println("testExtFunc: OK");
+        } catch (TransformerConfigurationException e) {
+            fail(e.getMessage());
+        } catch (TransformerException ex) {
+            fail(ex.getMessage());
+        }
+    }
+
+    /**
+     * Security is enabled, extension function not allowed
+     */
+    public void testExtFuncNotAllowed() {
+        Policy p = new SimplePolicy(new AllPermission());
+        Policy.setPolicy(p);
+        System.setSecurityManager(new SecurityManager());
+        TransformerFactory factory = TransformerFactory.newInstance();
+
+        try {
+            transform(factory);
+        } catch (TransformerConfigurationException e) {
+            fail(e.getMessage());
+        } catch (TransformerException ex) {
+            //expected since extension function is disallowed
+            System.out.println("testExtFuncNotAllowed: OK");
+        } finally {
+            System.setSecurityManager(null);
+        }
+    }
+
+    /**
+     * Security is enabled, use new feature: enableExtensionFunctions
+     */
+    public void testEnableExtFunc() {
+        Policy p = new SimplePolicy(new AllPermission());
+        Policy.setPolicy(p);
+        System.setSecurityManager(new SecurityManager());
+        TransformerFactory factory = TransformerFactory.newInstance();
+
+        /**
+         * Use of the extension function 'http://exslt.org/strings:tokenize' is
+         * not allowed when the secure processing feature is set to true.
+         * Attempt to use the new property to enable extension function
+         */
+        boolean isExtensionSupported = enableExtensionFunction(factory);
+
+        try {
+            transform(factory);
+            System.out.println("testEnableExt: OK");
+        } catch (TransformerConfigurationException e) {
+            fail(e.getMessage());
+        } catch (TransformerException e) {
+            fail(e.getMessage());
+        } finally {
+            System.setSecurityManager(null);
+        }
+    }
+
+    /**
+     * use Templates template = factory.newTemplates(new StreamSource( new
+     * FileInputStream(xslFilename))); // Use the template to create a
+     * transformer Transformer xformer = template.newTransformer();
+     *
+     * @param factory
+     * @return
+     */
+    /**
+     * Security is enabled, use new feature: enableExtensionFunctions Use the
+     * template to create a transformer
+     */
+    public void testTemplatesEnableExtFunc() {
+        Policy p = new SimplePolicy(new AllPermission());
+        Policy.setPolicy(p);
+        System.setSecurityManager(new SecurityManager());
+        TransformerFactory factory = TransformerFactory.newInstance();
+
+        /**
+         * Use of the extension function 'http://exslt.org/strings:tokenize' is
+         * not allowed when the secure processing feature is set to true.
+         * Attempt to use the new property to enable extension function
+         */
+        boolean isExtensionSupported = enableExtensionFunction(factory);
+
+        try {
+            SAXSource xslSource = new SAXSource(new InputSource(xslFile));
+            xslSource.setSystemId(xslFileId);
+            Templates template = factory.newTemplates(xslSource);
+            Transformer transformer = template.newTransformer();
+            StringWriter stringResult = new StringWriter();
+            Result result = new StreamResult(stringResult);
+            transformer.transform(new SAXSource(new InputSource(xmlFile)), result);
+            System.out.println("testTemplatesEnableExtFunc: OK");
+        } catch (TransformerConfigurationException e) {
+            fail(e.getMessage());
+        } catch (TransformerException e) {
+            fail(e.getMessage());
+        } finally {
+            System.setSecurityManager(null);
+        }
+    }
+
+    boolean enableExtensionFunction(TransformerFactory factory) {
+        boolean isSupported = true;
+        try {
+            factory.setFeature(ENABLE_EXTENSION_FUNCTIONS, true);
+        } catch (TransformerConfigurationException ex) {
+            isSupported = false;
+        }
+        return isSupported;
+    }
+
+    void transform(TransformerFactory factory) throws TransformerConfigurationException, TransformerException {
+        SAXSource xslSource = new SAXSource(new InputSource(xslFile));
+        xslSource.setSystemId(xslFileId);
+        Transformer transformer = factory.newTransformer(xslSource);
+        StringWriter stringResult = new StringWriter();
+        Result result = new StreamResult(stringResult);
+        transformer.transform(new SAXSource(new InputSource(xmlFile)), result);
+    }
+
+    class SimplePolicy extends Policy {
+
+        private final Permissions perms;
+
+        public SimplePolicy(Permission... permissions) {
+            perms = new Permissions();
+            for (Permission permission : permissions) {
+                perms.add(permission);
+            }
+        }
+
+        @Override
+        public PermissionCollection getPermissions(CodeSource cs) {
+            return perms;
+        }
+
+        @Override
+        public PermissionCollection getPermissions(ProtectionDomain pd) {
+            return perms;
+        }
+
+        @Override
+        public boolean implies(ProtectionDomain pd, Permission p) {
+            return perms.implies(p);
+        }
+
+        //for older jdk
+        @Override
+        public void refresh() {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/transform/jdk8004476/tokenize.xml	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<html>
+<a>
+   <b>Is this EXSLT? No. no</b>
+   <c>Is this EXSLT? No. no</c>
+</a>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/transform/jdk8004476/tokenize.xsl	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+                xmlns:str="http://exslt.org/strings"
+                xmlns:xalan="http://xml.apache.org/xalan"
+                version="1.0">
+<xsl:template match="a">
+   <xsl:apply-templates />
+</xsl:template>
+<xsl:template match="//a/c">
+   <xsl:value-of select="." />
+ -
+      <xsl:value-of select="str:tokenize(string(.), ' ')" />
+   <xsl:value-of select="str:tokenize(string(.), '')" />
+   <xsl:for-each select="str:tokenize(string(.), ' ')">
+      <xsl:value-of select="." />
+   </xsl:for-each>
+   <xsl:apply-templates select="*" />
+</xsl:template>
+<xsl:template match="//a/b">
+   <xsl:value-of select="." />
+ -
+      <xsl:value-of select="xalan:tokenize(string(.), ' ')" />
+   <xsl:value-of select="xalan:tokenize(string(.), '')" />
+   <xsl:for-each select="xalan:tokenize(string(.), ' ')">
+      <xsl:value-of select="." />
+   </xsl:for-each>
+   <xsl:apply-templates select="*" />
+</xsl:template>
+
+</xsl:stylesheet>
--- a/jdk/test/javax/xml/ws/clientjar/TestWsImport.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/javax/xml/ws/clientjar/TestWsImport.java	Wed Jul 05 19:21:26 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8016271
+ * @bug 8016271 8026405
  * @summary wsimport -clientjar does not create portable jar on windows due to hardcoded '\'
  * @run main/othervm TestWsImport
  */
@@ -77,14 +77,14 @@
             String address = "http://localhost:" + port + "/hello";
 
             Service service = Service.create(new URL(address + "?wsdl"),
-                new QName("http://test/jaxws/sample/",
-                "TestService"));
+                new QName("http://test/jaxws/sample/", "TestService"));
 
             String[] wsargs = {
                 wsimport,
                 "-p",
                 "wstest",
                 "-J-Djavax.xml.accessExternalSchema=all",
+                "-J-Dcom.sun.tools.internal.ws.Invoker.noSystemProxies=true",
                 address + "?wsdl",
                 "-clientjar",
                 "wsjar.jar"
--- a/jdk/test/jdk/lambda/vm/DefaultMethodsTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,637 +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.
- *
- * This code is free software; you can redistribute 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 vm;
-
-import java.lang.reflect.*;
-import java.util.*;
-import java.io.File;
-import java.io.IOException;
-
-import org.testng.annotations.Test;
-import separate.*;
-import separate.Compiler;
-
-import static org.testng.Assert.*;
-import static separate.SourceModel.*;
-import static separate.SourceModel.Class;
-
-@Test(groups = "vm")
-public class DefaultMethodsTest extends TestHarness {
-    public DefaultMethodsTest() {
-        super(false, false);
-    }
-
-    /**
-     * class C { public int m() { return 22; } }
-     *
-     * TEST: C c = new C(); c.m() == 22
-     */
-    public void testHarnessInvokeVirtual() {
-        Class C = new Class("C", ConcreteMethod.std("22"));
-        assertInvokeVirtualEquals(22, C);
-    }
-
-    /**
-     * interface I { int m(); }
-     * class C implements I { public int m() { return 33; } }
-     *
-     * TEST: I i = new C(); i.m() == 33;
-     */
-    public void testHarnessInvokeInterface() {
-        Interface I = new Interface("I", AbstractMethod.std());
-        Class C = new Class("C", I, ConcreteMethod.std("33"));
-        assertInvokeInterfaceEquals(33, C, I);
-    }
-
-    /**
-     * class C {}
-     *
-     * TEST: C c = new C(); c.m() throws NoSuchMethod
-     */
-    public void testHarnessThrows() {
-        Class C = new Class("C");
-        assertThrows(NoSuchMethodError.class, C);
-    }
-
-    /**
-     * interface I { int m() default { return 44; } }
-     * class C implements I {}
-     *
-     * TEST: C c = new C(); c.m() == 44;
-     * TEST: I i = new C(); i.m() == 44;
-     */
-    public void testBasicDefault() {
-        Interface I = new Interface("I", DefaultMethod.std("44"));
-        Class C = new Class("C", I);
-
-        assertInvokeVirtualEquals(44, C);
-        assertInvokeInterfaceEquals(44, C, I);
-    }
-
-    /**
-     * interface I { default int m() { return 44; } }
-     * interface J extends I {}
-     * interface K extends J {}
-     * class C implements K {}
-     *
-     * TEST: C c = new C(); c.m() == 44;
-     * TEST: I i = new C(); i.m() == 44;
-     */
-    public void testFarDefault() {
-        Interface I = new Interface("I", DefaultMethod.std("44"));
-        Interface J = new Interface("J", I);
-        Interface K = new Interface("K", J);
-        Class C = new Class("C", K);
-
-        assertInvokeVirtualEquals(44, C);
-        assertInvokeInterfaceEquals(44, C, K);
-    }
-
-    /**
-     * interface I { int m(); }
-     * interface J extends I { default int m() { return 44; } }
-     * interface K extends J {}
-     * class C implements K {}
-     *
-     * TEST: C c = new C(); c.m() == 44;
-     * TEST: K k = new C(); k.m() == 44;
-     */
-    public void testOverrideAbstract() {
-        Interface I = new Interface("I", AbstractMethod.std());
-        Interface J = new Interface("J", I, DefaultMethod.std("44"));
-        Interface K = new Interface("K", J);
-        Class C = new Class("C", K);
-
-        assertInvokeVirtualEquals(44, C);
-        assertInvokeInterfaceEquals(44, C, K);
-    }
-
-    /**
-     * interface I { int m() default { return 44; } }
-     * class C implements I { public int m() { return 55; } }
-     *
-     * TEST: C c = new C(); c.m() == 55;
-     * TEST: I i = new C(); i.m() == 55;
-     */
-    public void testExisting() {
-        Interface I = new Interface("I", DefaultMethod.std("44"));
-        Class C = new Class("C", I, ConcreteMethod.std("55"));
-
-        assertInvokeVirtualEquals(55, C);
-        assertInvokeInterfaceEquals(55, C, I);
-    }
-
-    /**
-     * interface I { default int m() { return 99; } }
-     * class B implements I {}
-     * class C extends B {}
-     *
-     * TEST: C c = new C(); c.m() == 99;
-     * TEST: I i = new C(); i.m() == 99;
-     */
-    public void testInherited() {
-        Interface I = new Interface("I", DefaultMethod.std("99"));
-        Class B = new Class("B", I);
-        Class C = new Class("C", B);
-
-        assertInvokeVirtualEquals(99, C);
-        assertInvokeInterfaceEquals(99, C, I);
-    }
-
-    /**
-     * interface I { default int m() { return 99; } }
-     * class C { public int m() { return 11; } }
-     * class D extends C implements I {}
-     *
-     * TEST: D d = new D(); d.m() == 11;
-     * TEST: I i = new D(); i.m() == 11;
-     */
-    public void testExistingInherited() {
-        Interface I = new Interface("I", DefaultMethod.std("99"));
-        Class C = new Class("C", ConcreteMethod.std("11"));
-        Class D = new Class("D", C, I);
-
-        assertInvokeVirtualEquals(11, D);
-        assertInvokeInterfaceEquals(11, D, I);
-    }
-
-    /**
-     * interface I { default int m() { return 44; } }
-     * class C implements I { public int m() { return 11; } }
-     * class D extends C { public int m() { return 22; } }
-     *
-     * TEST: D d = new D(); d.m() == 22;
-     * TEST: I i = new D(); i.m() == 22;
-     */
-    void testExistingInheritedOverride() {
-        Interface I = new Interface("I", DefaultMethod.std("99"));
-        Class C = new Class("C", I, ConcreteMethod.std("11"));
-        Class D = new Class("D", C, ConcreteMethod.std("22"));
-
-        assertInvokeVirtualEquals(22, D);
-        assertInvokeInterfaceEquals(22, D, I);
-    }
-
-    /**
-     * interface I { default int m() { return 99; } }
-     * interface J { defaultint m() { return 88; } }
-     * class C implements I { public int m() { return 11; } }
-     * class D extends C { public int m() { return 22; } }
-     * class E extends D implements J {}
-     *
-     * TEST: E e = new E(); e.m() == 22;
-     * TEST: J j = new E(); j.m() == 22;
-     */
-    public void testExistingInheritedPlusDefault() {
-        Interface I = new Interface("I", DefaultMethod.std("99"));
-        Interface J = new Interface("J", DefaultMethod.std("88"));
-        Class C = new Class("C", I, ConcreteMethod.std("11"));
-        Class D = new Class("D", C, ConcreteMethod.std("22"));
-        Class E = new Class("E", D, J);
-
-        assertInvokeVirtualEquals(22, E);
-        assertInvokeInterfaceEquals(22, E, J);
-    }
-
-    /**
-     * interface I { default int m() { return 99; } }
-     * class B implements I {}
-     * class C extends B { public int m() { return 77; } }
-     *
-     * TEST: C c = new C(); c.m() == 77;
-     * TEST: I i = new C(); i.m() == 77;
-     */
-    public void testInheritedWithConcrete() {
-        Interface I = new Interface("I", DefaultMethod.std("99"));
-        Class B = new Class("B", I);
-        Class C = new Class("C", B, ConcreteMethod.std("77"));
-
-        assertInvokeVirtualEquals(77, C);
-        assertInvokeInterfaceEquals(77, C, I);
-    }
-
-    /**
-     * interface I { default int m() { return 99; } }
-     * class B implements I {}
-     * class C extends B implements I { public int m() { return 66; } }
-     *
-     * TEST: C c = new C(); c.m() == 66;
-     * TEST: I i = new C(); i.m() == 66;
-     */
-    public void testInheritedWithConcreteAndImpl() {
-        Interface I = new Interface("I", DefaultMethod.std("99"));
-        Class B = new Class("B", I);
-        Class C = new Class("C", B, I, ConcreteMethod.std("66"));
-
-        assertInvokeVirtualEquals(66, C);
-        assertInvokeInterfaceEquals(66, C, I);
-    }
-
-    /**
-     * interface I { default int m() { return 99; } }
-     * interface J { default int m() { return 88; } }
-     * class C implements I, J {}
-     *
-     * TEST: C c = new C(); c.m() throws AME
-     */
-    public void testConflict() {
-        // debugTest();
-        Interface I = new Interface("I", DefaultMethod.std("99"));
-        Interface J = new Interface("J", DefaultMethod.std("88"));
-        Class C = new Class("C", I, J);
-
-        assertThrows(AbstractMethodError.class, C);
-    }
-
-    /**
-     * interface I { int m(); }
-     * interface J { default int m() { return 88; } }
-     * class C implements I, J {}
-     *
-     * TEST: C c = new C(); c.m() throws AME
-     */
-    public void testAmbiguousReabstract() {
-        Interface I = new Interface("I", AbstractMethod.std());
-        Interface J = new Interface("J", DefaultMethod.std("88"));
-        Class C = new Class("C", I, J);
-
-        assertThrows(AbstractMethodError.class, C);
-    }
-
-    /**
-     * interface I { default int m() { return 99; } }
-     * interface J extends I { }
-     * interface K extends I { }
-     * class C implements J, K {}
-     *
-     * TEST: C c = new C(); c.m() == 99
-     * TEST: J j = new C(); j.m() == 99
-     * TEST: K k = new C(); k.m() == 99
-     * TEST: I i = new C(); i.m() == 99
-     */
-    public void testDiamond() {
-        Interface I = new Interface("I", DefaultMethod.std("99"));
-        Interface J = new Interface("J", I);
-        Interface K = new Interface("K", I);
-        Class C = new Class("C", J, K);
-
-        assertInvokeVirtualEquals(99, C);
-        assertInvokeInterfaceEquals(99, C, J);
-        assertInvokeInterfaceEquals(99, C, K);
-        assertInvokeInterfaceEquals(99, C, I);
-    }
-
-    /**
-     * interface I { default int m() { return 99; } }
-     * interface J extends I { }
-     * interface K extends I { }
-     * interface L extends I { }
-     * interface M extends I { }
-     * class C implements I, J, K, L, M {}
-     *
-     * TEST: C c = new C(); c.m() == 99
-     * TEST: J j = new C(); j.m() == 99
-     * TEST: K k = new C(); k.m() == 99
-     * TEST: I i = new C(); i.m() == 99
-     * TEST: L l = new C(); l.m() == 99
-     * TEST: M m = new C(); m.m() == 99
-     */
-    public void testExpandedDiamond() {
-        Interface I = new Interface("I", DefaultMethod.std("99"));
-        Interface J = new Interface("J", I);
-        Interface K = new Interface("K", I);
-        Interface L = new Interface("L", I);
-        Interface M = new Interface("M", L);
-        Class C = new Class("C", I, J, K, L, M);
-
-        assertInvokeVirtualEquals(99, C);
-        assertInvokeInterfaceEquals(99, C, J);
-        assertInvokeInterfaceEquals(99, C, K);
-        assertInvokeInterfaceEquals(99, C, I);
-        assertInvokeInterfaceEquals(99, C, L);
-        assertInvokeInterfaceEquals(99, C, M);
-    }
-
-    /**
-     * interface I { int m() default { return 99; } }
-     * interface J extends I { int m(); }
-     * class C implements J {}
-     *
-     * TEST: C c = new C(); c.m() throws AME
-     */
-    public void testReabstract() {
-        Interface I = new Interface("I", DefaultMethod.std("99"));
-        Interface J = new Interface("J", I, AbstractMethod.std());
-        Class C = new Class("C", J);
-
-        assertThrows(AbstractMethodError.class, C);
-    }
-
-    /**
-     * interface I { default int m() { return 88; } }
-     * interface J extends I { default int m() { return 99; } }
-     * class C implements J {}
-     *
-     * TEST: C c = new C(); c.m() == 99;
-     * TEST: J j = new C(); j.m() == 99;
-     * TEST: I i = new C(); i.m() == 99;
-     */
-    public void testShadow() {
-        Interface I = new Interface("I", DefaultMethod.std("88"));
-        Interface J = new Interface("J", I, DefaultMethod.std("99"));
-        Class C = new Class("C", J);
-
-        assertInvokeVirtualEquals(99, C);
-        assertInvokeInterfaceEquals(99, C, J);
-        assertInvokeInterfaceEquals(99, C, I);
-    }
-
-    /**
-     * interface I { default int m() { return 88; } }
-     * interface J extends I { default int m() { return 99; } }
-     * class C implements I, J {}
-     *
-     * TEST: C c = new C(); c.m() == 99;
-     * TEST: J j = new C(); j.m() == 99;
-     * TEST: I i = new C(); i.m() == 99;
-     */
-    public void testDisqualified() {
-        Interface I = new Interface("I", DefaultMethod.std("88"));
-        Interface J = new Interface("J", I, DefaultMethod.std("99"));
-        Class C = new Class("C", I, J);
-
-        assertInvokeVirtualEquals(99, C);
-        assertInvokeInterfaceEquals(99, C, J);
-        assertInvokeInterfaceEquals(99, C, I);
-    }
-
-    /**
-     * interface I { default int m() { return 99; } }
-     * class C implements I {}
-     *
-     * TEST: C.class.getMethod("m").invoke(new C()) == 99
-     */
-    public void testReflectCall() {
-        Interface I = new Interface("I", DefaultMethod.std("99"));
-        //workaround accessibility issue when loading C with DirectedClassLoader
-        I.addAccessFlag(AccessFlag.PUBLIC);
-        Class C = new Class("C", I);
-
-        Compiler.Flags[] flags = this.verbose ?
-            new Compiler.Flags[] { Compiler.Flags.VERBOSE } :
-            new Compiler.Flags[] {};
-        Compiler compiler = new Compiler(flags);
-        java.lang.Class<?> cls = null;
-        try {
-            cls = compiler.compileAndLoad(C);
-        } catch (ClassNotFoundException e) {
-            fail("Could not load class");
-        }
-
-        java.lang.reflect.Method method = null;
-        try {
-            method = cls.getMethod(stdMethodName);
-        } catch (NoSuchMethodException e) {
-            fail("Could not find method in class");
-        }
-        assertNotNull(method);
-
-        Object c = null;
-        try {
-            c = cls.newInstance();
-        } catch (InstantiationException | IllegalAccessException e) {
-            fail("Could not create instance of class");
-        }
-        assertNotNull(c);
-
-        Integer res = null;
-        try {
-            res = (Integer)method.invoke(c);
-        } catch (IllegalAccessException |
-                 java.lang.reflect.InvocationTargetException e) {
-            fail("Could not invoke default instance method");
-        }
-        assertNotNull(res);
-
-        assertEquals(res.intValue(), 99);
-
-        compiler.cleanup();
-    }
-
-
-    /**
-     * interface J { default int m() { return 88; } }
-     * interface I extends J { default int m() { return J.super.m(); } }
-     * class C implements I {}
-     *
-     * TEST: C c = new C(); c.m() == 88;
-     * TEST: I i = new C(); i.m() == 88;
-     */
-    public void testSuperBasic() {
-        // debugTest();
-
-        Interface J = new Interface("J", DefaultMethod.std("88"));
-        Interface I = new Interface("I", J, new DefaultMethod(
-            "int", stdMethodName, "return J.super.m();"));
-        I.addCompilationDependency(J.findMethod(stdMethodName));
-        Class C = new Class("C", I);
-
-        assertInvokeVirtualEquals(88, C);
-        assertInvokeInterfaceEquals(88, C, I);
-    }
-
-    /**
-     * interface K { int m() default { return 99; } }
-     * interface L { int m() default { return 101; } }
-     * interface J extends K, L {}
-     * interface I extends J, K { int m() default { J.super.m(); } }
-     * class C implements I {}
-     *
-     * TEST: C c = new C(); c.m() throws AME
-     * TODO: add case for K k = new C(); k.m() throws AME
-     */
-    public void testSuperConflict() {
-        // debugTest();
-
-        Interface K = new Interface("K", DefaultMethod.std("99"));
-        Interface L = new Interface("L", DefaultMethod.std("101"));
-        Interface J = new Interface("J", K, L);
-        Interface I = new Interface("I", J, K, new DefaultMethod(
-            "int", stdMethodName, "return J.super.m();"));
-        Interface Jstub = new Interface("J", DefaultMethod.std("-1"));
-        I.addCompilationDependency(Jstub);
-        I.addCompilationDependency(Jstub.findMethod(stdMethodName));
-        Class C = new Class("C", I);
-
-        assertThrows(AbstractMethodError.class, C);
-    }
-
-    /**
-     * interface I { default int m() { return 99; } }
-     * interface J extends I { default int m() { return 55; } }
-     * class C implements I, J { public int m() { return I.super.m(); } }
-     *
-     * TEST: C c = new C(); c.m() throws AME
-     * TODO: add case for J j = new C(); j.m() throws AME
-     */
-    public void testSuperDisqual() {
-        Interface I = new Interface("I", DefaultMethod.std("99"));
-        Interface J = new Interface("J", I, DefaultMethod.std("55"));
-        Class C = new Class("C", I, J,
-            new ConcreteMethod("int", stdMethodName, "return I.super.m();",
-                AccessFlag.PUBLIC));
-        C.addCompilationDependency(I.findMethod(stdMethodName));
-
-        assertThrows(AbstractMethodError.class, C);
-    }
-
-    /**
-     * interface J { int m(); }
-     * interface I extends J { default int m() { return J.super.m(); } }
-     * class C implements I {}
-     *
-     * TEST: C c = new C(); c.m() throws AME
-     * TODO: add case for I i = new C(); i.m() throws AME
-     */
-    public void testSuperNull() {
-        Interface J = new Interface("J", AbstractMethod.std());
-        Interface I = new Interface("I", J, new DefaultMethod(
-            "int", stdMethodName, "return J.super.m();"));
-        Interface Jstub = new Interface("J", DefaultMethod.std("99"));
-        I.addCompilationDependency(Jstub);
-        I.addCompilationDependency(Jstub.findMethod(stdMethodName));
-        Class C = new Class("C", I);
-
-        assertThrows(AbstractMethodError.class, C);
-    }
-
-    /**
-     * interface J<T> { default int m(T t) { return 88; } }
-     * interface I extends J<String> {
-     *     int m(String s) default { return J.super.m(); }
-     * }
-     * class C implements I {}
-     *
-     * TEST: I i = new C(); i.m("") == 88;
-     */
-    public void testSuperGeneric() {
-        Interface J = new Interface("J", new TypeParameter("T"),
-            new DefaultMethod("int", stdMethodName, "return 88;",
-                new MethodParameter("T", "t")));
-        Interface I = new Interface("I", J.with("String"),
-            new DefaultMethod("int", stdMethodName, "return J.super.m(s);",
-                new MethodParameter("String", "s")));
-        I.addCompilationDependency(J.findMethod(stdMethodName));
-        Class C = new Class("C", I);
-
-        AbstractMethod pm = new AbstractMethod("int", stdMethodName,
-            new MethodParameter("String", "s"));
-
-        assertInvokeInterfaceEquals(
-            new Integer(88), C, new Extends(I), pm, "\"\"");
-    }
-
-    /**
-     * interface I<T> { int m(T t) default { return 44; } }
-     * interface J extends I<String> { int m(String s) default { return 55; } }
-     * class C implements I<String>, J {
-     *     public int m(String s) { return I.super.m(s); }
-     * }
-     *
-     * TEST: C c = new C(); c.m("string") throws AME
-     */
-    public void testSuperGenericDisqual() {
-        MethodParameter t = new MethodParameter("T", "t");
-        MethodParameter s = new MethodParameter("String", "s");
-
-        Interface I = new Interface("I", new TypeParameter("T"),
-            new DefaultMethod("int", stdMethodName, "return 44;", t));
-        Interface J = new Interface("J", I.with("String"),
-            new DefaultMethod("int", stdMethodName, "return 55;", s));
-        Class C = new Class("C", I.with("String"), J,
-            new ConcreteMethod("int", stdMethodName,
-                "return I.super.m(s);", AccessFlag.PUBLIC, s));
-        C.addCompilationDependency(I.findMethod(stdMethodName));
-
-        assertThrows(AbstractMethodError.class, C,
-            new ConcreteMethod(
-                "int", stdMethodName, "return -1;", AccessFlag.PUBLIC, s),
-            "-1", "\"string\"");
-    }
-
-    /**
-     * interface I { default Integer m() { return new Integer(88); } }
-     * class C { int m() { return 99; } }
-     * class D extends C implements I {}
-     * class S { Object foo() { return (new D()).m(); } // link sig: ()LInteger;
-     * TEST: S s = new S(); s.foo() == new Integer(88)
-     */
-    public void testNoCovarNoBridge() {
-        Interface I = new Interface("I", new DefaultMethod(
-            "Integer", "m", "return new Integer(88);"));
-        Class C = new Class("C", new ConcreteMethod(
-            "int", "m", "return 99;", AccessFlag.PUBLIC));
-        Class D = new Class("D", I, C);
-
-        ConcreteMethod DstubMethod = new ConcreteMethod(
-            "Integer", "m", "return null;", AccessFlag.PUBLIC);
-        Class Dstub = new Class("D", DstubMethod);
-
-        ConcreteMethod toCall = new ConcreteMethod(
-            "Object", "foo", "return (new D()).m();", AccessFlag.PUBLIC);
-        Class S = new Class("S", D, toCall);
-        S.addCompilationDependency(Dstub);
-        S.addCompilationDependency(DstubMethod);
-
-        assertInvokeVirtualEquals(new Integer(88), S, toCall, "null");
-    }
-
-    /**
-     * interface J { int m(); }
-     * interface I extends J { default int m() { return 99; } }
-     * class B implements J {}
-     * class C extends B implements I {}
-     * TEST: C c = new C(); c.m() == 99
-     *
-     * The point of this test is that B does not get default method analysis,
-     * and C does not generate any new miranda methods in the vtable.
-     * It verifies that default method analysis occurs when mirandas have been
-     * inherited and the supertypes don't have any overpass methods.
-     */
-    public void testNoNewMiranda() {
-        Interface J = new Interface("J", AbstractMethod.std());
-        Interface I = new Interface("I", J, DefaultMethod.std("99"));
-        Class B = new Class("B", J);
-        Class C = new Class("C", B, I);
-        assertInvokeVirtualEquals(99, C);
-    }
-
-    public void testStrictfpDefault() {
-        try {
-            java.lang.Class.forName("vm.StrictfpDefault");
-        } catch (Exception e) {
-            fail("Could not load class", e);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Asserts.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,395 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.testlibrary;
+
+/**
+ * Asserts that can be used for verifying assumptions in tests.
+ *
+ * An assertion will throw a {@link RuntimeException} if the assertion isn't
+ * valid.  All the asserts can be imported into a test by using a static
+ * import:
+ *
+ * <pre>
+ * {@code
+ * import static com.oracle.java.testlibrary.Asserts.*;
+ * }
+ *
+ * Always provide a message describing the assumption if the line number of the
+ * failing assertion isn't enough to understand why the assumption failed. For
+ * example, if the assertion is in a loop or in a method that is called
+ * multiple times, then the line number won't provide enough context to
+ * understand the failure.
+ * </pre>
+ */
+public class Asserts {
+
+    /**
+     * Shorthand for {@link #assertLessThan(T, T)}.
+     *
+     * @see #assertLessThan(T, T)
+     */
+    public static <T extends Comparable<T>> void assertLT(T lhs, T rhs) {
+        assertLessThan(lhs, rhs);
+    }
+
+    /**
+     * Shorthand for {@link #assertLessThan(T, T, String)}.
+     *
+     * @see #assertLessThan(T, T, String)
+     */
+    public static <T extends Comparable<T>> void assertLT(T lhs, T rhs, String msg) {
+        assertLessThan(lhs, rhs, msg);
+    }
+
+    /**
+     * Calls {@link #assertLessThan(T, T, String)} with a default message.
+     *
+     * @see #assertLessThan(T, T, String)
+     */
+    public static <T extends Comparable<T>> void assertLessThan(T lhs, T rhs) {
+        String msg = "Expected that " + format(lhs) + " < " + format(rhs);
+        assertLessThan(lhs, rhs, msg);
+    }
+
+    /**
+     * Asserts that {@code lhs} is less than {@code rhs}.
+     *
+     * @param lhs The left hand side of the comparison.
+     * @param rhs The right hand side of the comparison.
+     * @param msg A description of the assumption.
+     * @throws RuntimeException if the assertion isn't valid.
+     */
+    public static <T extends Comparable<T>>void assertLessThan(T lhs, T rhs, String msg) {
+        assertTrue(compare(lhs, rhs, msg) < 0, msg);
+    }
+
+    /**
+     * Shorthand for {@link #assertLessThanOrEqual(T, T)}.
+     *
+     * @see #assertLessThanOrEqual(T, T)
+     */
+    public static <T extends Comparable<T>> void assertLTE(T lhs, T rhs) {
+        assertLessThanOrEqual(lhs, rhs);
+    }
+
+    /**
+     * Shorthand for {@link #assertLessThanOrEqual(T, T, String)}.
+     *
+     * @see #assertLessThanOrEqual(T, T, String)
+     */
+    public static <T extends Comparable<T>> void assertLTE(T lhs, T rhs, String msg) {
+        assertLessThanOrEqual(lhs, rhs, msg);
+    }
+
+    /**
+     * Calls {@link #assertLessThanOrEqual(T, T, String)} with a default message.
+     *
+     * @see #assertLessThanOrEqual(T, T, String)
+     */
+    public static <T extends Comparable<T>> void assertLessThanOrEqual(T lhs, T rhs) {
+        String msg = "Expected that " + format(lhs) + " <= " + format(rhs);
+        assertLessThanOrEqual(lhs, rhs, msg);
+    }
+
+    /**
+     * Asserts that {@code lhs} is less than or equal to {@code rhs}.
+     *
+     * @param lhs The left hand side of the comparison.
+     * @param rhs The right hand side of the comparison.
+     * @param msg A description of the assumption.
+     * @throws RuntimeException if the assertion isn't valid.
+     */
+    public static <T extends Comparable<T>> void assertLessThanOrEqual(T lhs, T rhs, String msg) {
+        assertTrue(compare(lhs, rhs, msg) <= 0, msg);
+    }
+
+    /**
+     * Shorthand for {@link #assertEquals(T, T)}.
+     *
+     * @see #assertEquals(T, T)
+     */
+    public static void assertEQ(Object lhs, Object rhs) {
+        assertEquals(lhs, rhs);
+    }
+
+    /**
+     * Shorthand for {@link #assertEquals(T, T, String)}.
+     *
+     * @see #assertEquals(T, T, String)
+     */
+    public static void assertEQ(Object lhs, Object rhs, String msg) {
+        assertEquals(lhs, rhs, msg);
+    }
+
+    /**
+     * Calls {@link #assertEquals(T, T, String)} with a default message.
+     *
+     * @see #assertEquals(T, T, String)
+     */
+    public static void assertEquals(Object lhs, Object rhs) {
+        String msg = "Expected " + format(lhs) + " to equal " + format(rhs);
+        assertEquals(lhs, rhs, msg);
+    }
+
+    /**
+     * Asserts that {@code lhs} is equal to {@code rhs}.
+     *
+     * @param lhs The left hand side of the comparison.
+     * @param rhs The right hand side of the comparison.
+     * @param msg A description of the assumption.
+     * @throws RuntimeException if the assertion isn't valid.
+     */
+    public static void assertEquals(Object lhs, Object rhs, String msg) {
+        if (lhs == null) {
+            if (rhs != null) {
+                error(msg);
+            }
+        } else {
+            assertTrue(lhs.equals(rhs), msg);
+        }
+    }
+
+    /**
+     * Shorthand for {@link #assertGreaterThanOrEqual(T, T)}.
+     *
+     * @see #assertGreaterThanOrEqual(T, T)
+     */
+    public static <T extends Comparable<T>> void assertGTE(T lhs, T rhs) {
+        assertGreaterThanOrEqual(lhs, rhs);
+    }
+
+    /**
+     * Shorthand for {@link #assertGreaterThanOrEqual(T, T, String)}.
+     *
+     * @see #assertGreaterThanOrEqual(T, T, String)
+     */
+    public static <T extends Comparable<T>> void assertGTE(T lhs, T rhs, String msg) {
+        assertGreaterThanOrEqual(lhs, rhs, msg);
+    }
+
+    /**
+     * Calls {@link #assertGreaterThanOrEqual(T, T, String)} with a default message.
+     *
+     * @see #assertGreaterThanOrEqual(T, T, String)
+     */
+    public static <T extends Comparable<T>> void assertGreaterThanOrEqual(T lhs, T rhs) {
+        String msg = "Expected that " + format(lhs) + " >= " + format(rhs);
+        assertGreaterThanOrEqual(lhs, rhs, msg);
+    }
+
+    /**
+     * Asserts that {@code lhs} is greater than or equal to {@code rhs}.
+     *
+     * @param lhs The left hand side of the comparison.
+     * @param rhs The right hand side of the comparison.
+     * @param msg A description of the assumption.
+     * @throws RuntimeException if the assertion isn't valid.
+     */
+    public static <T extends Comparable<T>> void assertGreaterThanOrEqual(T lhs, T rhs, String msg) {
+        assertTrue(compare(lhs, rhs, msg) >= 0, msg);
+    }
+
+    /**
+     * Shorthand for {@link #assertGreaterThan(T, T)}.
+     *
+     * @see #assertGreaterThan(T, T)
+     */
+    public static <T extends Comparable<T>> void assertGT(T lhs, T rhs) {
+        assertGreaterThan(lhs, rhs);
+    }
+
+    /**
+     * Shorthand for {@link #assertGreaterThan(T, T, String)}.
+     *
+     * @see #assertGreaterThan(T, T, String)
+     */
+    public static <T extends Comparable<T>> void assertGT(T lhs, T rhs, String msg) {
+        assertGreaterThan(lhs, rhs, msg);
+    }
+
+    /**
+     * Calls {@link #assertGreaterThan(T, T, String)} with a default message.
+     *
+     * @see #assertGreaterThan(T, T, String)
+     */
+    public static <T extends Comparable<T>> void assertGreaterThan(T lhs, T rhs) {
+        String msg = "Expected that " + format(lhs) + " > " + format(rhs);
+        assertGreaterThan(lhs, rhs, msg);
+    }
+
+    /**
+     * Asserts that {@code lhs} is greater than {@code rhs}.
+     *
+     * @param lhs The left hand side of the comparison.
+     * @param rhs The right hand side of the comparison.
+     * @param msg A description of the assumption.
+     * @throws RuntimeException if the assertion isn't valid.
+     */
+    public static <T extends Comparable<T>> void assertGreaterThan(T lhs, T rhs, String msg) {
+        assertTrue(compare(lhs, rhs, msg) > 0, msg);
+    }
+
+    /**
+     * Shorthand for {@link #assertNotEquals(T, T)}.
+     *
+     * @see #assertNotEquals(T, T)
+     */
+    public static void assertNE(Object lhs, Object rhs) {
+        assertNotEquals(lhs, rhs);
+    }
+
+    /**
+     * Shorthand for {@link #assertNotEquals(T, T, String)}.
+     *
+     * @see #assertNotEquals(T, T, String)
+     */
+    public static void assertNE(Object lhs, Object rhs, String msg) {
+        assertNotEquals(lhs, rhs, msg);
+    }
+
+    /**
+     * Calls {@link #assertNotEquals(T, T, String)} with a default message.
+     *
+     * @see #assertNotEquals(T, T, String)
+     */
+    public static void assertNotEquals(Object lhs, Object rhs) {
+        String msg = "Expected " + format(lhs) + " to not equal " + format(rhs);
+        assertNotEquals(lhs, rhs, msg);
+    }
+
+    /**
+     * Asserts that {@code lhs} is not equal to {@code rhs}.
+     *
+     * @param lhs The left hand side of the comparison.
+     * @param rhs The right hand side of the comparison.
+     * @param msg A description of the assumption.
+     * @throws RuntimeException if the assertion isn't valid.
+     */
+    public static void assertNotEquals(Object lhs, Object rhs, String msg) {
+        if (lhs == null) {
+            if (rhs == null) {
+                error(msg);
+            }
+        } else {
+            assertFalse(lhs.equals(rhs), msg);
+        }
+    }
+
+    /**
+     * Calls {@link #assertNull(Object, String)} with a default message.
+     *
+     * @see #assertNull(Object, String)
+     */
+    public static void assertNull(Object o) {
+        assertNull(o, "Expected " + format(o) + " to be null");
+    }
+
+    /**
+     * Asserts that {@code o} is null.
+     *
+     * @param o The reference assumed to be null.
+     * @param msg A description of the assumption.
+     * @throws RuntimeException if the assertion isn't valid.
+     */
+    public static void assertNull(Object o, String msg) {
+        assertEquals(o, null, msg);
+    }
+
+    /**
+     * Calls {@link #assertNotNull(Object, String)} with a default message.
+     *
+     * @see #assertNotNull(Object, String)
+     */
+    public static void assertNotNull(Object o) {
+        assertNotNull(o, "Expected non null reference");
+    }
+
+    /**
+     * Asserts that {@code o} is <i>not</i> null.
+     *
+     * @param o The reference assumed <i>not</i> to be null,
+     * @param msg A description of the assumption.
+     * @throws RuntimeException if the assertion isn't valid.
+     */
+    public static void assertNotNull(Object o, String msg) {
+        assertNotEquals(o, null, msg);
+    }
+
+    /**
+     * Calls {@link #assertFalse(boolean, String)} with a default message.
+     *
+     * @see #assertFalse(boolean, String)
+     */
+    public static void assertFalse(boolean value) {
+        assertFalse(value, "Expected value to be false");
+    }
+
+    /**
+     * Asserts that {@code value} is {@code false}.
+     *
+     * @param value The value assumed to be false.
+     * @param msg A description of the assumption.
+     * @throws RuntimeException if the assertion isn't valid.
+     */
+    public static void assertFalse(boolean value, String msg) {
+        assertTrue(!value, msg);
+    }
+
+    /**
+     * Calls {@link #assertTrue(boolean, String)} with a default message.
+     *
+     * @see #assertTrue(boolean, String)
+     */
+    public static void assertTrue(boolean value) {
+        assertTrue(value, "Expected value to be true");
+    }
+
+    /**
+     * Asserts that {@code value} is {@code true}.
+     *
+     * @param value The value assumed to be true.
+     * @param msg A description of the assumption.
+     * @throws RuntimeException if the assertion isn't valid.
+     */
+    public static void assertTrue(boolean value, String msg) {
+        if (!value) {
+            error(msg);
+        }
+    }
+
+    private static <T extends Comparable<T>> int compare(T lhs, T rhs, String msg) {
+        assertNotNull(lhs, msg);
+        assertNotNull(rhs, msg);
+        return lhs.compareTo(rhs);
+    }
+
+    private static String format(Object o) {
+        return o == null? "null" : o.toString();
+    }
+
+    private static void error(String msg) {
+        throw new RuntimeException(msg);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.testlibrary;
+
+import java.io.FileNotFoundException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public final class JDKToolFinder {
+
+    private JDKToolFinder() {
+    }
+
+    /**
+     * Returns the full path to an executable in jdk/bin based on System
+     * property {@code test.jdk} or {@code compile.jdk} (both are set by the jtreg test suite)
+     *
+     * @return Full path to an executable in jdk/bin
+     */
+    public static String getJDKTool(String tool) {
+
+        // First try to find the executable in test.jdk
+        try {
+            return getTool(tool, "test.jdk");
+        } catch (FileNotFoundException e) {
+
+        }
+
+        // Now see if it's available in compile.jdk
+        try {
+            return getTool(tool, "compile.jdk");
+        } catch (FileNotFoundException e) {
+            throw new RuntimeException("Failed to find " + tool +
+                    ", looked in test.jdk (" + System.getProperty("test.jdk") +
+                    ") and compile.jdk (" + System.getProperty("compile.jdk") + ")");
+        }
+    }
+
+    /**
+     * Returns the full path to an executable in jdk/bin based on System
+     * property {@code compile.jdk}
+     *
+     * @return Full path to an executable in jdk/bin
+     */
+    public static String getCompileJDKTool(String tool) {
+        try {
+            return getTool(tool, "compile.jdk");
+        } catch (FileNotFoundException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Returns the full path to an executable in jdk/bin based on System
+     * property {@code test.jdk}
+     *
+     * @return Full path to an executable in jdk/bin
+     */
+    public static String getTestJDKTool(String tool) {
+        try {
+            return getTool(tool, "test.jdk");
+        } catch (FileNotFoundException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private static String getTool(String tool, String property) throws FileNotFoundException {
+        String jdkPath = System.getProperty(property);
+
+        if (jdkPath == null) {
+            throw new RuntimeException(
+                    "System property '" + property + "' not set. This property is normally set by jtreg. "
+                    + "When running test separately, set this property using '-D" + property + "=/path/to/jdk'.");
+        }
+
+        Path toolName = Paths.get("bin", tool + (Platform.isWindows() ? ".exe" : ""));
+
+        Path jdkTool = Paths.get(jdkPath, toolName.toString());
+        if (!jdkTool.toFile().exists()) {
+            throw new FileNotFoundException("Could not find file " + jdkTool.toAbsolutePath());
+        }
+
+        return jdkTool.toAbsolutePath().toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.testlibrary;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * A utility for constructing command lines for starting JDK tool processes.
+ *
+ * The JDKToolLauncher can in particular be combined with a
+ * java.lang.ProcessBuilder to easily run a JDK tool. For example, the following
+ * code run {@code jmap -heap} against a process with GC logging turned on for
+ * the {@code jmap} process:
+ *
+ * <pre>
+ * {@code
+ * JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
+ *                                       .addVMArg("-XX:+PrintGC");
+ *                                       .addVMArg("-XX:+PrintGCDetails")
+ *                                       .addToolArg("-heap")
+ *                                       .addToolArg(pid);
+ * ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
+ * Process p = pb.start();
+ * }
+ * </pre>
+ */
+public class JDKToolLauncher {
+    private final String executable;
+    private final List<String> vmArgs = new ArrayList<String>();
+    private final List<String> toolArgs = new ArrayList<String>();
+
+    private JDKToolLauncher(String tool, boolean useCompilerJDK) {
+        if (useCompilerJDK) {
+            executable = JDKToolFinder.getJDKTool(tool);
+        } else {
+            executable = JDKToolFinder.getTestJDKTool(tool);
+        }
+        vmArgs.addAll(Arrays.asList(ProcessTools.getPlatformSpecificVMArgs()));
+    }
+
+    /**
+     * Creates a new JDKToolLauncher for the specified tool. Using tools path
+     * from the compiler JDK.
+     *
+     * @param tool
+     *            The name of the tool
+     * @return A new JDKToolLauncher
+     */
+    public static JDKToolLauncher create(String tool) {
+        return new JDKToolLauncher(tool, true);
+    }
+
+    /**
+     * Creates a new JDKToolLauncher for the specified tool in the Tested JDK.
+     *
+     * @param tool
+     *            The name of the tool
+     *
+     * @return A new JDKToolLauncher
+     */
+    public static JDKToolLauncher createUsingTestJDK(String tool) {
+        return new JDKToolLauncher(tool, false);
+    }
+
+    /**
+     * Adds an argument to the JVM running the tool.
+     *
+     * The JVM arguments are passed to the underlying JVM running the tool.
+     * Arguments will automatically be prepended with "-J".
+     *
+     * Any platform specific arguments required for running the tool are
+     * automatically added.
+     *
+     *
+     * @param arg
+     *            The argument to VM running the tool
+     * @return The JDKToolLauncher instance
+     */
+    public JDKToolLauncher addVMArg(String arg) {
+        vmArgs.add(arg);
+        return this;
+    }
+
+    /**
+     * Adds an argument to the tool.
+     *
+     * @param arg
+     *            The argument to the tool
+     * @return The JDKToolLauncher instance
+     */
+    public JDKToolLauncher addToolArg(String arg) {
+        toolArgs.add(arg);
+        return this;
+    }
+
+    /**
+     * Returns the command that can be used for running the tool.
+     *
+     * @return An array whose elements are the arguments of the command.
+     */
+    public String[] getCommand() {
+        List<String> command = new ArrayList<String>();
+        command.add(executable);
+        // Add -J in front of all vmArgs
+        for (String arg : vmArgs) {
+            command.add("-J" + arg);
+        }
+        command.addAll(toolArgs);
+        return command.toArray(new String[command.size()]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.testlibrary;
+
+public class Platform {
+    private static final String osName      = System.getProperty("os.name");
+    private static final String dataModel   = System.getProperty("sun.arch.data.model");
+    private static final String vmVersion   = System.getProperty("java.vm.version");
+    private static final String osArch      = System.getProperty("os.arch");
+
+    public static boolean is32bit() {
+        return dataModel.equals("32");
+    }
+
+    public static boolean is64bit() {
+        return dataModel.equals("64");
+    }
+
+    public static boolean isSolaris() {
+        return isOs("sunos");
+    }
+
+    public static boolean isWindows() {
+        return isOs("win");
+    }
+
+    public static boolean isOSX() {
+        return isOs("mac");
+    }
+
+    public static boolean isLinux() {
+        return isOs("linux");
+    }
+
+    private static boolean isOs(String osname) {
+        return osName.toLowerCase().startsWith(osname.toLowerCase());
+    }
+
+    public static String getOsName() {
+        return osName;
+    }
+
+    public static boolean isDebugBuild() {
+        return vmVersion.toLowerCase().contains("debug");
+    }
+
+    public static String getVMVersion() {
+        return vmVersion;
+    }
+
+    // Returns true for sparc and sparcv9.
+    public static boolean isSparc() {
+        return isArch("sparc");
+    }
+
+    public static boolean isARM() {
+        return isArch("arm");
+    }
+
+    public static boolean isPPC() {
+        return isArch("ppc");
+    }
+
+    public static boolean isX86() {
+        // On Linux it's 'i386', Windows 'x86'
+        return (isArch("i386") || isArch("x86"));
+    }
+
+    public static boolean isX64() {
+        // On OSX it's 'x86_64' and on other (Linux, Windows and Solaris) platforms it's 'amd64'
+        return (isArch("amd64") || isArch("x86_64"));
+    }
+
+    private static boolean isArch(String archname) {
+        return osArch.toLowerCase().startsWith(archname.toLowerCase());
+    }
+
+    public static String getOsArch() {
+        return osArch;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.testlibrary;
+
+import static jdk.testlibrary.Asserts.assertNotEquals;
+import static jdk.testlibrary.Asserts.assertTrue;
+
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * The helper class for starting and stopping {@link Process} in a separate thread.
+ */
+public class ProcessThread extends TestThread {
+
+    /**
+     * Creates a new {@code ProcessThread} object.
+     *
+     * @param cmd The list of program and its arguments to pass to {@link ProcessBuilder}
+     */
+    public ProcessThread(List<String> cmd) {
+        super(new ProcessRunnable(cmd));
+    }
+
+    /**
+     * Creates a new {@code ProcessThread} object.
+     *
+     * @param cmd The string array of program and its arguments to pass to {@link ProcessBuilder}
+     */
+    public ProcessThread(String... cmd) {
+        super(new ProcessRunnable(cmd));
+    }
+
+    /**
+     * Creates a new {@code ProcessThread} object.
+     *
+     * @param threadName The name of thread
+     * @param cmd The list of program and its arguments to pass to {@link ProcessBuilder}
+     */
+    public ProcessThread(String threadName, List<String> cmd) {
+        super(new ProcessRunnable(cmd), threadName);
+    }
+
+    /**
+     * Creates a new {@code ProcessThread} object.
+     *
+     * @param threadName The name of thread
+     * @param cmd The string array of program and its arguments to pass to {@link ProcessBuilder}
+     */
+    public ProcessThread(String threadName, String... cmd) {
+        super(new ProcessRunnable(cmd), threadName);
+    }
+
+    /**
+     * Stops {@link Process} started by {@code ProcessRunnable}.
+     *
+     * @throws InterruptedException
+     */
+    public void stopProcess() throws InterruptedException {
+        ((ProcessRunnable) getRunnable()).stopProcess();
+    }
+
+    /**
+     * {@link Runnable} interface for starting and stopping {@link Process}.
+     */
+    static class ProcessRunnable extends XRun {
+
+        private final ProcessBuilder processBuilder;
+        private final CountDownLatch latch;
+        private volatile Process process;
+
+        /**
+         * Creates a new {@code ProcessRunnable} object.
+         *
+         * @param cmd The list of program and its arguments to to pass to {@link ProcessBuilder}
+         */
+        public ProcessRunnable(List<String> cmd) {
+            super();
+            this.processBuilder = new ProcessBuilder(cmd);
+            this.latch = new CountDownLatch(1);
+        }
+
+        /**
+         * Creates a new {@code ProcessRunnable} object.
+         *
+         * @param cmd The string array of program and its arguments to to pass to {@link ProcessBuilder}
+         */
+        public ProcessRunnable(String... cmd) {
+            super();
+            this.processBuilder = new ProcessBuilder(cmd);
+            this.latch = new CountDownLatch(1);
+        }
+
+        /**
+         * Starts the process in {@code ProcessThread}.
+         * All exceptions which occurs here will be caught and stored in {@code ProcessThread}.
+         *
+         * see {@link XRun}
+         */
+        @Override
+        public void xrun() throws Throwable {
+            this.process = processBuilder.start();
+            // Release when process is started
+            latch.countDown();
+
+            // Will block...
+            OutputAnalyzer output = new OutputAnalyzer(this.process);
+
+            assertTrue(output.getOutput().isEmpty(), "Should get an empty output, got: "
+                        + Utils.NEW_LINE + output.getOutput());
+            assertNotEquals(output.getExitValue(), 0,
+                    "Process exited with unexpected exit code");
+        }
+
+        /**
+         * Stops the process.
+         *
+         * @throws InterruptedException
+         */
+        public void stopProcess() throws InterruptedException {
+            // Wait until process is started
+            latch.await();
+            if (this.process != null) {
+                this.process.destroy();
+            }
+        }
+
+    }
+
+}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java	Wed Jul 05 19:21:26 2017 +0200
@@ -25,24 +25,127 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.io.PrintWriter;
 import java.lang.management.ManagementFactory;
 import java.lang.management.RuntimeMXBean;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.Phaser;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.function.Predicate;
 
 import sun.management.VMManagement;
 
 public final class ProcessTools {
+    private static final class LineForwarder extends StreamPumper.LinePump {
+        private final PrintStream ps;
+        private final String prefix;
+        LineForwarder(String prefix, PrintStream os) {
+            this.ps = os;
+            this.prefix = prefix;
+        }
+        @Override
+        protected void processLine(String line) {
+            ps.println("[" + prefix + "] " + line);
+        }
+    }
 
     private ProcessTools() {
     }
 
     /**
+     * <p>Starts a process from its builder.</p>
+     * <span>The default redirects of STDOUT and STDERR are started</span>
+     * @param name The process name
+     * @param processBuilder The process builder
+     * @return Returns the initialized process
+     * @throws IOException
+     */
+    public static Process startProcess(String name,
+                                       ProcessBuilder processBuilder)
+    throws IOException {
+        Process p = null;
+        try {
+            p = startProcess(name, processBuilder, null, -1, TimeUnit.NANOSECONDS);
+        } catch (InterruptedException | TimeoutException e) {
+            // can't ever happen
+        }
+        return p;
+    }
+
+    /**
+     * <p>Starts a process from its builder.</p>
+     * <span>The default redirects of STDOUT and STDERR are started</span>
+     * <p>
+     * It is possible to wait for the process to get to a warmed-up state
+     * via {@linkplain Predicate} condition on the STDOUT
+     * </p>
+     * @param name The process name
+     * @param processBuilder The process builder
+     * @param linePredicate The {@linkplain Predicate} to use on the STDOUT
+     *                      Used to determine the moment the target app is
+     *                      properly warmed-up.
+     *                      It can be null - in that case the warmup is skipped.
+     * @param timeout The timeout for the warmup waiting
+     * @param unit The timeout {@linkplain TimeUnit}
+     * @return Returns the initialized {@linkplain Process}
+     * @throws IOException
+     * @throws InterruptedException
+     * @throws TimeoutException
+     */
+    public static Process startProcess(String name,
+                                       ProcessBuilder processBuilder,
+                                       final Predicate<String> linePredicate,
+                                       long timeout,
+                                       TimeUnit unit)
+    throws IOException, InterruptedException, TimeoutException {
+        Process p = processBuilder.start();
+        StreamPumper stdout = new StreamPumper(p.getInputStream());
+        StreamPumper stderr = new StreamPumper(p.getErrorStream());
+
+        stdout.addPump(new LineForwarder(name, System.out));
+        stderr.addPump(new LineForwarder(name, System.err));
+        final Phaser phs = new Phaser(1);
+        if (linePredicate != null) {
+            stdout.addPump(new StreamPumper.LinePump() {
+                @Override
+                protected void processLine(String line) {
+                    if (linePredicate.test(line)) {
+                        if (phs.getRegisteredParties() > 0) {
+                            phs.arriveAndDeregister();
+                        }
+                    }
+                }
+            });
+        }
+        Future<Void> stdoutTask = stdout.process();
+        Future<Void> stderrTask = stderr.process();
+
+        try {
+            if (timeout > -1) {
+                phs.awaitAdvanceInterruptibly(0, timeout, unit);
+            }
+        } catch (TimeoutException | InterruptedException e) {
+            stdoutTask.cancel(true);
+            stderrTask.cancel(true);
+            throw e;
+        }
+
+        return p;
+    }
+
+    /**
      * Pumps stdout and stderr from running the process into a String.
      *
-     * @param processHandler
+     * @param processBuilder
      *            ProcessHandler to run.
      * @return Output from process.
      * @throws IOException
@@ -69,22 +172,19 @@
                 stdoutBuffer);
         StreamPumper errPumper = new StreamPumper(process.getErrorStream(),
                 stderrBuffer);
-        Thread outPumperThread = new Thread(outPumper);
-        Thread errPumperThread = new Thread(errPumper);
 
-        outPumperThread.setDaemon(true);
-        errPumperThread.setDaemon(true);
-
-        outPumperThread.start();
-        errPumperThread.start();
+        Future<Void> outTask = outPumper.process();
+        Future<Void> errTask = errPumper.process();
 
         try {
             process.waitFor();
-            outPumperThread.join();
-            errPumperThread.join();
+            outTask.get();
+            errTask.get();
         } catch (InterruptedException e) {
             Thread.currentThread().interrupt();
             return null;
+        } catch (ExecutionException e) {
+            throw new IOException(e);
         }
 
         return new OutputBuffer(stdoutBuffer.toString(),
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/StreamPumper.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/StreamPumper.java	Wed Jul 05 19:21:26 2017 +0200
@@ -23,16 +23,65 @@
 
 package jdk.testlibrary;
 
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.OutputStream;
 import java.io.InputStream;
 import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 public final class StreamPumper implements Runnable {
 
     private static final int BUF_SIZE = 256;
 
-    private final OutputStream out;
+    /**
+     * Pump will be called by the StreamPumper to process the incoming data
+     */
+    abstract public static class Pump {
+        abstract void register(StreamPumper d);
+    }
+
+    /**
+     * OutputStream -> Pump adapter
+     */
+    final public static class StreamPump extends Pump {
+        private final OutputStream out;
+        public StreamPump(OutputStream out) {
+            this.out = out;
+        }
+
+        @Override
+        void register(StreamPumper sp) {
+            sp.addOutputStream(out);
+        }
+    }
+
+    /**
+     * Used to process the incoming data line-by-line
+     */
+    abstract public static class LinePump extends Pump {
+        @Override
+        final void register(StreamPumper sp) {
+            sp.addLineProcessor(this);
+        }
+
+        abstract protected void processLine(String line);
+    }
+
     private final InputStream in;
+    private final Set<OutputStream> outStreams = new HashSet<>();
+    private final Set<LinePump> linePumps = new HashSet<>();
+
+    private final AtomicBoolean processing = new AtomicBoolean(false);
+    private final FutureTask<Void> processingTask = new FutureTask(this, null);
+
+    public StreamPumper(InputStream in) {
+        this.in = in;
+    }
 
     /**
      * Create a StreamPumper that reads from in and writes to out.
@@ -43,8 +92,8 @@
      *            The stream to write to.
      */
     public StreamPumper(InputStream in, OutputStream out) {
-        this.in = in;
-        this.out = out;
+        this(in);
+        this.addOutputStream(out);
     }
 
     /**
@@ -54,25 +103,97 @@
      */
     @Override
     public void run() {
-        int length;
-        InputStream localIn = in;
-        OutputStream localOut = out;
-        byte[] buffer = new byte[BUF_SIZE];
+        try (BufferedInputStream is = new BufferedInputStream(in)) {
+            ByteArrayOutputStream lineBos = new ByteArrayOutputStream();
+            byte[] buf = new byte[BUF_SIZE];
+            int len = 0;
+            int linelen = 0;
+
+            while ((len = is.read(buf)) > 0 && !Thread.interrupted()) {
+                for(OutputStream out : outStreams) {
+                    out.write(buf, 0, len);
+                }
+                if (!linePumps.isEmpty()) {
+                    int i = 0;
+                    int lastcrlf = -1;
+                    while (i < len) {
+                        if (buf[i] == '\n' || buf[i] == '\r') {
+                            int bufLinelen = i - lastcrlf - 1;
+                            if (bufLinelen > 0) {
+                                lineBos.write(buf, lastcrlf + 1, bufLinelen);
+                            }
+                            linelen += bufLinelen;
 
-        try {
-            while ((length = localIn.read(buffer)) > 0 && !Thread.interrupted()) {
-                localOut.write(buffer, 0, length);
+                            if (linelen > 0) {
+                                lineBos.flush();
+                                final String line = lineBos.toString();
+                                linePumps.stream().forEach((lp) -> {
+                                    lp.processLine(line);
+                                });
+                                lineBos.reset();
+                                linelen = 0;
+                            }
+                            lastcrlf = i;
+                        }
+
+                        i++;
+                    }
+                    if (lastcrlf == -1) {
+                        lineBos.write(buf, 0, len);
+                        linelen += len;
+                    } else if (lastcrlf < len - 1) {
+                        lineBos.write(buf, lastcrlf + 1, len - lastcrlf - 1);
+                        linelen += len - lastcrlf - 1;
+                    }
+                }
             }
+
         } catch (IOException e) {
-            // Just abort if something like this happens.
             e.printStackTrace();
         } finally {
+            for(OutputStream out : outStreams) {
+                try {
+                    out.flush();
+                } catch (IOException e) {}
+            }
             try {
-                localOut.flush();
                 in.close();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
+            } catch (IOException e) {}
         }
     }
+
+    final void addOutputStream(OutputStream out) {
+        outStreams.add(out);
+    }
+
+    final void addLineProcessor(LinePump lp) {
+        linePumps.add(lp);
+    }
+
+    final public StreamPumper addPump(Pump ... pump) {
+        if (processing.get()) {
+            throw new IllegalStateException("Can not modify pumper while " +
+                                            "processing is in progress");
+        }
+        for(Pump p : pump) {
+            p.register(this);
+        }
+        return this;
+    }
+
+    final public Future<Void> process() {
+        if (!processing.compareAndSet(false, true)) {
+            throw new IllegalStateException("Can not re-run the processing");
+        }
+        Thread t = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                processingTask.run();
+            }
+        });
+        t.setDaemon(true);
+        t.start();
+
+        return processingTask;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/TestThread.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.testlibrary;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+import java.util.concurrent.TimeoutException;
+
+/**
+ * Thread which catches exceptions thrown during the execution
+ * and stores them for later analysis.
+ *
+ * <pre>
+ * {@code
+ * TestThread thread = new TestThread(new XRun() {
+ *      public void run() {
+ *      // do something
+ *      }
+ * });
+ * thread.start();
+ * // do something
+ * Throwable uncaught = thread.getUncaught();
+ * }
+ * </pre>
+ */
+public class TestThread extends Thread {
+
+    private final Runnable runnable;
+    private volatile Throwable uncaught;
+
+    /**
+     * Returns {@link Runnable} the thread has been created with.
+     *
+     * @return The object whose {@code run} method is called
+     */
+    public Runnable getRunnable() {
+        return runnable;
+    }
+
+    /**
+     * Creates a new {@code TestThread} object.
+     *
+     * @param target The object whose {@code run} method is called
+     * @param name The thread name
+     */
+    public TestThread(Runnable target, String name) {
+        super(target, name);
+        this.runnable = target;
+    }
+
+    /**
+     * Creates a new {@code TestThread} object.
+     *
+     * @param target The object whose {@code run} method is called
+     */
+    public TestThread(Runnable target) {
+        super(target);
+        this.runnable = target;
+    }
+
+    /**
+     * Creates a new {@code TestThread} object.
+     *
+     * @param group The thread group
+     * @param target The object whose {@code run} method is called
+     * @param name The thread name
+     * @param stackSize Stack size
+     */
+    public TestThread(ThreadGroup group, Runnable target, String name,
+            long stackSize) {
+        super(group, target, name, stackSize);
+        this.runnable = target;
+    }
+
+    /**
+     * Creates a new {@code TestThread} object.
+     *
+     * @param group The thread group
+     * @param target The object whose {@code run} method is called
+     * @param name The thread name
+     */
+    public TestThread(ThreadGroup group, Runnable target, String name) {
+        super(group, target, name);
+        this.runnable = target;
+    }
+
+    /**
+     * Creates a new {@code TestThread} object.
+     *
+     * @param group The thread group
+     * @param target The object whose {@code run} method is called
+     */
+    public TestThread(ThreadGroup group, Runnable target) {
+        super(group, target);
+        this.runnable = target;
+    }
+
+    /**
+     * The thread executor.
+     */
+    @Override
+    public void run() {
+        try {
+            super.run();
+        } catch (Throwable t) {
+            uncaught = t;
+        }
+    }
+
+    /**
+     * Returns exception caught during the execution.
+     *
+     * @return {@link Throwable}
+     */
+    public Throwable getUncaught() {
+        return uncaught;
+    }
+
+    /**
+     * Waits for {@link TestThread} to die
+     * and throws exception caught during the execution.
+     *
+     * @throws InterruptedException
+     * @throws Throwable
+     */
+    public void joinAndThrow() throws InterruptedException, Throwable {
+        join();
+        if (uncaught != null) {
+            throw uncaught;
+        }
+    }
+
+    /**
+     * Waits during {@code timeout} for {@link TestThread} to die
+     * and throws exception caught during the execution.
+     *
+     * @param timeout The time to wait in milliseconds
+     * @throws InterruptedException
+     * @throws Throwable
+     */
+    public void joinAndThrow(long timeout) throws InterruptedException,
+            Throwable {
+        join(timeout);
+        if (isAlive()) {
+            throw new TimeoutException();
+        }
+        if (uncaught != null) {
+            throw uncaught;
+        }
+    }
+
+    /**
+     * Waits for {@link TestThread} to die
+     * and returns exception caught during the execution.
+     *
+     * @return Exception caught during the execution
+     * @throws InterruptedException
+     */
+    public Throwable joinAndReturn() throws InterruptedException {
+        join();
+        if (uncaught != null) {
+            return uncaught;
+        }
+        return null;
+    }
+
+    /**
+     * Waits during {@code timeout} for {@link TestThread} to die
+     * and returns exception caught during the execution.
+     *
+     * @param timeout The time to wait in milliseconds
+     * @return Exception caught during the execution
+     * @throws InterruptedException
+     */
+    public Throwable joinAndReturn(long timeout) throws InterruptedException {
+        join(timeout);
+        if (isAlive()) {
+            return new TimeoutException();
+        }
+        if (uncaught != null) {
+            return uncaught;
+        }
+        return null;
+    }
+
+    /**
+     * Waits until {@link TestThread} is in the certain {@link State}
+     * and blocking on {@code object}.
+     *
+     * @param state The thread state
+     * @param object The object to block on
+     */
+    public void waitUntilBlockingOnObject(Thread.State state, Object object) {
+        String want = object == null ? null : object.getClass().getName() + '@'
+                + Integer.toHexString(System.identityHashCode(object));
+        ThreadMXBean tmx = ManagementFactory.getThreadMXBean();
+        while (isAlive()) {
+            ThreadInfo ti = tmx.getThreadInfo(getId());
+            if (ti.getThreadState() == state
+                    && (want == null || want.equals(ti.getLockName()))) {
+                return;
+            }
+            try {
+                Thread.sleep(1);
+            } catch (InterruptedException e) {
+            }
+        }
+    }
+
+    /**
+     * Waits until {@link TestThread} is in native.
+     */
+    public void waitUntilInNative() {
+        ThreadMXBean tmx = ManagementFactory.getThreadMXBean();
+        while (isAlive()) {
+            ThreadInfo ti = tmx.getThreadInfo(getId());
+            if (ti.isInNative()) {
+                return;
+            }
+            try {
+                Thread.sleep(1);
+            } catch (InterruptedException e) {
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.testlibrary;
+
+import static jdk.testlibrary.Asserts.assertTrue;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Common library for various test helper functions.
+ */
+public final class Utils {
+
+    /**
+     * Returns the sequence used by operating system to separate lines.
+     */
+    public static final String NEW_LINE = System.getProperty("line.separator");
+
+    /**
+     * Returns the value of 'test.vm.opts'system property.
+     */
+    public static final String VM_OPTIONS = System.getProperty("test.vm.opts", "");
+
+
+    private Utils() {
+        // Private constructor to prevent class instantiation
+    }
+
+    /**
+     * Returns the list of VM options.
+     *
+     * @return List of VM options
+     */
+    public static List<String> getVmOptions() {
+        return getVmOptions(false);
+    }
+
+    /**
+     * Returns the list of VM options with -J prefix.
+     *
+     * @return The list of VM options with -J prefix
+     */
+    public static List<String> getForwardVmOptions() {
+        return getVmOptions(true);
+    }
+
+    private static List<String> getVmOptions(boolean forward) {
+        List<String> optionsList = new ArrayList<>();
+        String options = VM_OPTIONS.trim();
+        if (!options.isEmpty()) {
+            options = options.replaceAll("\\s+", " ");
+            for (String option : options.split(" ")) {
+                if (forward) {
+                    optionsList.add("-J" + option);
+                } else {
+                    optionsList.add(option);
+                }
+            }
+        }
+
+        return optionsList;
+    }
+
+    /**
+     * Returns the free port on the local host.
+     * The function will spin until a valid port number is found.
+     *
+     * @return The port number
+     * @throws InterruptedException if any thread has interrupted the current thread
+     * @throws IOException if an I/O error occurs when opening the socket
+     */
+    public static int getFreePort() throws InterruptedException, IOException {
+        int port = -1;
+
+        while (port <= 0) {
+            Thread.sleep(100);
+
+            ServerSocket serverSocket = null;
+            try {
+                serverSocket = new ServerSocket(0);
+                port = serverSocket.getLocalPort();
+            } finally {
+                serverSocket.close();
+            }
+        }
+
+        return port;
+    }
+
+    /**
+     * Returns the name of the local host.
+     *
+     * @return The host name
+     * @throws UnknownHostException if IP address of a host could not be determined
+     */
+    public static String getHostname() throws UnknownHostException {
+        InetAddress inetAddress = InetAddress.getLocalHost();
+        String hostName = inetAddress.getHostName();
+
+        assertTrue((hostName != null && !hostName.isEmpty()),
+                "Cannot get hostname");
+
+        return hostName;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/XRun.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.testlibrary;
+
+/**
+ * This type serves no other purpose than to simply allow automatically running
+ * something in a thread, and have all exceptions propagated to
+ * RuntimeExceptions, which are thrown up to thread, which in turn should
+ * probably be a {@link TestThread} to they are stored.
+ */
+public abstract class XRun implements Runnable {
+
+    /**
+     * Invokes {@code xrun()} and throws all exceptions caught in it
+     * up to the thread.
+     */
+    public final void run() {
+        try {
+            xrun();
+        } catch (Error e) {
+            throw e;
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Throwable e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Override this method to implement what to run in the thread.
+     *
+     * @throws Throwable
+     */
+    protected abstract void xrun() throws Throwable;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/awt/AppContext/MultiThread/MultiThreadTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8019623
+ * @summary Tests that AppContext.getAppContext() works correctly in multi-threads scenario.
+ * @author Leonid Romanov
+ */
+
+import sun.awt.AppContext;
+
+public class MultiThreadTest {
+    private static final int NUM_THREADS = 2;
+
+    private static AppContextGetter[] getters = new AppContextGetter[NUM_THREADS];
+
+    public static void main(String[] args) {
+        createAndStartThreads();
+        compareAppContexts();
+    }
+
+    private static void createAndStartThreads() {
+        ThreadGroup systemGroup = getSystemThreadGroup();
+        for (int i = 0; i < NUM_THREADS; ++i) {
+            ThreadGroup tg = new ThreadGroup(systemGroup, "AppContextGetter" + i);
+            getters[i] = new AppContextGetter(tg);
+        }
+
+        for (int i = 0; i < NUM_THREADS; ++i) {
+            getters[i].start();
+        }
+
+        for (int i = 0; i < NUM_THREADS; ++i) {
+            try {
+                getters[i].join();
+            } catch (InterruptedException e) {
+                // ignore
+            }
+        }
+    }
+
+    private static ThreadGroup getSystemThreadGroup() {
+        ThreadGroup currentThreadGroup =
+                Thread.currentThread().getThreadGroup();
+        ThreadGroup parentThreadGroup = currentThreadGroup.getParent();
+        while (parentThreadGroup != null) {
+            currentThreadGroup = parentThreadGroup;
+            parentThreadGroup = currentThreadGroup.getParent();
+        }
+
+        return currentThreadGroup;
+    }
+
+    private static void compareAppContexts() {
+        AppContext ctx = getters[0].getAppContext();
+        for (int i = 1; i < NUM_THREADS; ++i) {
+            if (!ctx.equals(getters[i].getAppContext())) {
+                throw new RuntimeException("Unexpected AppContexts difference, could be a race condition");
+            }
+        }
+    }
+
+    private static class AppContextGetter extends Thread {
+        private AppContext appContext;
+
+        public AppContextGetter(ThreadGroup tg) {
+            super(tg, tg.getName());
+        }
+
+        AppContext getAppContext() {
+            return appContext;
+        }
+
+        @Override
+        public void run() {
+            appContext = AppContext.getAppContext();
+        }
+    }
+}
--- a/jdk/test/sun/java2d/DirectX/TransformedPaintTest/TransformedPaintTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/java2d/DirectX/TransformedPaintTest/TransformedPaintTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6689025
+ * @bug 6689025 8023483
  * @summary Tests that transformed Paints are rendered correctly
  * @author Dmitri.Trembovetski@sun.com: area=Graphics
  * @run main/othervm TransformedPaintTest
--- a/jdk/test/sun/management/jdp/JdpClient.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/management/jdp/JdpClient.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -35,8 +35,10 @@
 import java.nio.channels.Selector;
 import java.util.Collections;
 import java.util.Enumeration;
+import java.util.Map;
 import sun.management.jdp.JdpException;
 import sun.management.jdp.JdpJmxPacket;
+import sun.management.jdp.JdpPacketReader;
 
 public class JdpClient {
 
@@ -47,6 +49,31 @@
         private static int maxPacketCount = 1;
         private static int maxEmptyPacketCount = 10;
 
+        private void get(Map<?,?> map, String key)
+            throws JdpException {
+
+            if (map.get(key) == null) {
+                  throw new JdpException("Test failed, packet field " + key + " missed");
+            }
+        }
+
+        private void checkFieldPresence(JdpJmxPacket p)
+            throws IOException, JdpException {
+
+            byte[] b = p.getPacketData();
+
+            JdpPacketReader reader = new JdpPacketReader(b);
+            Map<String,String> pMap = reader.getDiscoveryDataAsMap();
+
+            get(pMap, JdpJmxPacket.UUID_KEY);
+            get(pMap, JdpJmxPacket.MAIN_CLASS_KEY);
+            get(pMap, JdpJmxPacket.JMX_SERVICE_URL_KEY);
+            // get(pMap, JdpJmxPacket.INSTANCE_NAME_KEY);
+            get(pMap, JdpJmxPacket.PROCESS_ID_KEY);
+            get(pMap, JdpJmxPacket.BROADCAST_INTERVAL_KEY);
+            get(pMap, JdpJmxPacket.RMI_HOSTNAME_KEY);
+        }
+
 
         PacketListener(DatagramChannel channel) {
             this.channel = channel;
@@ -67,6 +94,8 @@
                 try {
                     while (true) {
 
+                        // Use tcpdump -U -w - -s 1400 -c 2 -vv port 7095
+                        // to verify that correct packet being sent
                         sel.selectedKeys().clear();
                         buf.rewind();
 
@@ -87,10 +116,10 @@
                         buf.flip();
                         byte[] dgramData = new byte[buf.remaining()];
                         buf.get(dgramData);
-
                         try {
                             JdpJmxPacket packet = new JdpJmxPacket(dgramData);
                             JdpDoSomething.printJdpPacket(packet);
+                            checkFieldPresence(packet);
                             if(++count > maxPacketCount){
                                    break;
                             }
--- a/jdk/test/sun/management/jdp/JdpDoSomething.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/management/jdp/JdpDoSomething.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -32,7 +32,7 @@
 public class JdpDoSomething {
 
     private static final String lockFileName = "JdpDoSomething.lck";
-    private static final boolean verbose=false;
+    private static final boolean verbose = false;
 
     public static boolean getVerbose(){
         return verbose;
@@ -52,6 +52,9 @@
             System.out.println("Jmx: " + p.getJmxServiceUrl());
             System.out.println("Main: " + p.getMainClass());
             System.out.println("InstanceName: " + p.getInstanceName());
+            System.out.println("ProccessId: " + p.getProcessId());
+            System.out.println("BroadcastInterval: " + p.getBroadcastInterval());
+            System.out.println("Rmi Hostname: " + p.getRmiHostname());
 
             System.out.flush();
         }
--- a/jdk/test/sun/management/jdp/JdpTest.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/management/jdp/JdpTest.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -1,6 +1,6 @@
 #!/bin/sh -x
 
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -56,7 +56,7 @@
 
     if [ ! -d ${_testclasses} ]
     then
-	  mkdir -p ${_testclasses}
+       mkdir -p ${_testclasses}
     fi
 
     rm -f ${_testclasses}/*.class
@@ -64,7 +64,7 @@
     # Compile testcase
     ${COMPILEJAVA}/bin/javac -XDignore.symbol.file -d ${_testclasses} \
                                              JdpUnitTest.java \
-                                             JdpDoSomething.java  \
+                                             JdpDoSomething.java \
                                              JdpClient.java
 
 
@@ -84,10 +84,10 @@
   ${TESTJAVA}/bin/java -server $* -cp ${_testclasses} ${testappname}  >> ${_logname} 2>&1 &
  _last_pid=$!
 
-# wait until VM is actually starts. 
+# wait until VM is actually starts.
 # please note, if vm doesn't start for some reason
 # jtreg kills the test by timeout. Don't file a bug.
-  cnt=1 
+  cnt=1
   while true
   do
     npid=`_get_pid`
@@ -135,7 +135,6 @@
     -Dcom.sun.management.jdp.port=${_port} \
     -Dcom.sun.management.jdp.address=${_ip} \
   JdpClient
-
 }
 
 
@@ -156,18 +155,20 @@
     _echo "**** Test one ****"
 
     _app_start JdpUnitTest \
-    -Dcom.sun.management.jdp.port=${_port} \
-    -Dcom.sun.management.jdp.address=${_ip} \
-    -Dcom.sun.management.jdp.pause=5
+        -Dcom.sun.management.jdp.port=${_port} \
+        -Dcom.sun.management.jdp.address=${_ip} \
+        -Dcom.sun.management.jdp.name=testme \
+        -Djava.rmi.server.hostname=localhost \
+        -Dcom.sun.management.jdp.pause=5
 
     res=`_testme`
 
     case "${res}" in
      OK*)
-	_echo "Passed"
+        _echo "Passed"
      ;;
      *)
-	_echo "Failed!"
+        _echo "Failed!"
      ;;
     esac
 
@@ -179,21 +180,23 @@
     _echo "**** Test two ****"
 
     _app_start JdpDoSomething \
-     -Dcom.sun.management.jdp.port=${_port} \
-     -Dcom.sun.management.jdp.address=${_ip} \
-     -Dcom.sun.management.jdp.pause=5 \
-     -Dcom.sun.management.jmxremote.port=${_jmxport} \
-     -Dcom.sun.management.jmxremote.authenticate=false \
-     -Dcom.sun.management.jmxremote.ssl=false
+        -Dcom.sun.management.jdp.port=${_port} \
+        -Dcom.sun.management.jdp.address=${_ip} \
+        -Dcom.sun.management.jdp.pause=5 \
+        -Dcom.sun.management.jdp.name=testme \
+        -Djava.rmi.server.hostname=localhost \
+        -Dcom.sun.management.jmxremote.port=${_jmxport} \
+        -Dcom.sun.management.jmxremote.authenticate=false \
+        -Dcom.sun.management.jmxremote.ssl=false
 
     res=`_testme`
 
     case "${res}" in
      OK*)
-	_echo "Passed"
+        _echo "Passed"
      ;;
      *)
-	_echo "Failed!"
+        _echo "Failed!"
      ;;
     esac
 
@@ -210,6 +213,7 @@
                 jdp.port=${_port} \
                 jdp.address=${_ip} \
                 jdp.pause=5 \
+                jdp.name=jcmdtest \
                 jmxremote.port=${_jmxport} \
                 jmxremote.authenticate=false \
                 jmxremote.ssl=false
@@ -218,10 +222,10 @@
 
     case "${res}" in
      OK*)
-	_echo "Passed"
+        _echo "Passed"
      ;;
      *)
-	_echo "Failed!"
+        _echo "Failed!"
      ;;
     esac
 
@@ -233,19 +237,21 @@
     _echo "**** Test four ****"
 
     _app_start JdpDoSomething \
-     -Dcom.sun.management.jmxremote.autodiscovery=true \
-     -Dcom.sun.management.jmxremote.port=${_jmxport} \
-     -Dcom.sun.management.jmxremote.authenticate=false \
-     -Dcom.sun.management.jmxremote.ssl=false
+        -Dcom.sun.management.jmxremote.autodiscovery=true \
+        -Dcom.sun.management.jdp.name=testme \
+        -Djava.rmi.server.hostname=localhost \
+        -Dcom.sun.management.jmxremote.port=${_jmxport} \
+        -Dcom.sun.management.jmxremote.authenticate=false \
+        -Dcom.sun.management.jmxremote.ssl=false
 
     res=`_testme`
 
     case "${res}" in
      OK*)
-	_echo "Passed"
+        _echo "Passed"
      ;;
      *)
-	_echo "Failed!"
+        _echo "Failed!"
      ;;
     esac
 
@@ -269,10 +275,10 @@
 
     case "${res}" in
      OK*)
-	_echo "Passed"
+        _echo "Passed"
      ;;
      *)
-	_echo "Failed!"
+        _echo "Failed!"
      ;;
     esac
 
@@ -300,28 +306,28 @@
 
 for parm in "$@"
 do
-   case $parm in
-  --verbose)      _verbose=yes  ;;
-  --jtreg)        _jtreg=yes    ;;
-  --no-compile)   _compile=no   ;;
-  --testsuite=*)  _testsuite=`_echo $parm | sed "s,^--.*=\(.*\),\1,"`  ;;
-  *)
-     echo "Undefined parameter $parm. Try --help for help"
-     exit
-   ;;
- esac
+  case $parm in
+      --verbose)      _verbose=yes  ;;
+      --jtreg)        _jtreg=yes    ;;
+      --no-compile)   _compile=no   ;;
+      --testsuite=*)  _testsuite=`_echo $parm | sed "s,^--.*=\(.*\),\1,"`  ;;
+      *)
+        echo "Undefined parameter $parm. Try --help for help"
+        exit
+      ;;
+  esac
 done
 
 if [ "${_compile}" = "yes" ]
 then
- _do_compile
+  _do_compile
 fi
 
 if [ "${_jtreg}" = "yes" ]
 then
- _testclasses=${TESTCLASSES}
- _testsrc=${TESTSRC}
- _logname="output.txt"
+  _testclasses=${TESTCLASSES}
+  _testsrc=${TESTSRC}
+  _logname="output.txt"
 fi
 
 # Make sure _tesclasses is absolute path
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import jdk.testlibrary.JdkFinder;
+import jdk.testlibrary.ProcessTools;
+
+/**
+ * @test
+ * @bug 6434402 8004926
+ * @library /lib/testlibrary
+ * @build TestManager TestApplication CustomLauncherTest
+ * @run main CustomLauncherTest
+ * @author Jaroslav Bachorik
+ */
+public class CustomLauncherTest {
+    private static final  String TEST_CLASSES = System.getProperty("test.classes");
+    private static final  String TEST_JDK = System.getProperty("test.jdk");
+
+    private static final  String TEST_SRC = System.getProperty("test.src");
+    private static final  String OSNAME = System.getProperty("os.name");
+    private static final  String ARCH;
+    private static final  String LIBARCH;
+
+    static {
+        // magic with os.arch
+        String osarch = System.getProperty("os.arch");
+        switch (osarch) {
+            case "i386":
+            case "i486":
+            case "i586":
+            case "i686":
+            case "i786":
+            case "i886":
+            case "i986": {
+                ARCH = "i586";
+                break;
+            }
+            case "x86_64":
+            case "amd64": {
+                ARCH = "amd64";
+                break;
+            }
+            default: {
+                ARCH = osarch;
+            }
+        }
+        LIBARCH = ARCH.equals("i586") ? "i386" : ARCH;
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (TEST_CLASSES == null || TEST_CLASSES.isEmpty()) {
+            System.out.println("Test is designed to be run from jtreg only");
+            return;
+        }
+
+        String PLATFORM = "";
+        switch (OSNAME.toLowerCase()) {
+            case "linux": {
+                PLATFORM = "linux";
+                break;
+            }
+            case "sunos": {
+                PLATFORM = "solaris";
+                break;
+            }
+            default: {
+                System.out.println("Test not designed to run on this operating " +
+                                   "system (" + OSNAME + "), skipping...");
+                return;
+            }
+        }
+
+        String LAUNCHER = TEST_SRC + File.separator + PLATFORM + "-" + ARCH +
+                          File.separator + "launcher";
+
+        final FileSystem FS = FileSystems.getDefault();
+        final boolean hasLauncher = Files.isExecutable(FS.getPath(LAUNCHER));
+        if (!hasLauncher) {
+            System.out.println("Launcher [" + LAUNCHER + "] does not exist. Skipping the test.");
+            return;
+        }
+
+        Path libjvmPath = findLibjvm(FS);
+        if (libjvmPath == null) {
+            throw new Error("Unable to locate 'libjvm.so' in " + TEST_JDK);
+        }
+
+        Process serverPrc = null, clientPrc = null;
+
+        try {
+            System.out.println("Starting custom launcher:");
+            System.out.println("=========================");
+            System.out.println("  launcher  : " + LAUNCHER);
+            System.out.println("  libjvm    : " + libjvmPath.toString());
+            System.out.println("  classpath : " + TEST_CLASSES);
+            ProcessBuilder server = new ProcessBuilder(LAUNCHER, libjvmPath.toString(), TEST_CLASSES, "TestApplication");
+
+            final AtomicReference<String> port = new AtomicReference<>();
+            final AtomicReference<String> pid = new AtomicReference<>();
+
+            serverPrc = ProcessTools.startProcess(
+                "Launcher",
+                server,
+                (String line) -> {
+                    if (line.startsWith("port:")) {
+                         port.set(line.split("\\:")[1]);
+                     } else  if (line.startsWith("pid:")) {
+                         pid.set(line.split("\\:")[1]);
+                     } else if (line.startsWith("waiting")) {
+                         return true;
+                     }
+                     return false;
+                },
+                5,
+                TimeUnit.SECONDS
+            );
+
+            System.out.println("Attaching test manager:");
+            System.out.println("=========================");
+            System.out.println("  PID           : " + pid.get());
+            System.out.println("  shutdown port : " + port.get());
+
+            ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
+                "-cp",
+                TEST_CLASSES +
+                    File.pathSeparator +
+                    TEST_JDK +
+                    File.separator +
+                    "lib" +
+                    File.separator +
+                    "tools.jar",
+                "TestManager",
+                pid.get(),
+                port.get(),
+                "true"
+            );
+
+            clientPrc = ProcessTools.startProcess(
+                "TestManager",
+                client,
+                (String line) -> line.startsWith("Starting TestManager for PID"),
+                10,
+                TimeUnit.SECONDS
+            );
+
+            int clientExitCode = clientPrc.waitFor();
+            int serverExitCode = serverPrc.waitFor();
+
+            if (clientExitCode != 0 || serverExitCode != 0) {
+                throw new Error("Test failed");
+            }
+        } finally {
+            if (clientPrc != null) {
+                clientPrc.destroy();
+                clientPrc.waitFor();
+            }
+            if (serverPrc != null) {
+                serverPrc.destroy();
+                serverPrc.waitFor();
+            }
+        }
+    }
+
+    private static Path findLibjvm(FileSystem FS) {
+        Path libjvmPath = findLibjvm(FS.getPath(TEST_JDK, "jre", "lib", LIBARCH));
+        if (libjvmPath == null) {
+            libjvmPath = findLibjvm(FS.getPath(TEST_JDK, "lib", LIBARCH));
+        }
+        return libjvmPath;
+    }
+
+    private static Path findLibjvm(Path libPath) {
+        // ARCH/libjvm.so -> ARCH/server/libjvm.so -> ARCH/client/libjvm.so
+        Path libjvmPath = libPath.resolve("libjvm.so");
+        if (isFileOk(libjvmPath)) {
+            return libjvmPath;
+        }
+        libjvmPath = libPath.resolve("server/libjvm.so");
+        if (isFileOk(libjvmPath)) {
+            return libjvmPath;
+        }
+        libjvmPath = libPath.resolve("client/libjvm.so");
+        if (isFileOk(libPath)) {
+            return libjvmPath;
+        }
+
+        return null;
+    }
+
+    private static boolean isFileOk(Path path) {
+        return Files.isRegularFile(path) && Files.isReadable(path);
+    }
+}
--- a/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.sh	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute 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 6434402
-# @summary Start an application using a custom launcher and check that
-#          a management tool can connect.
-#
-# @build TestManager TestApplication
-# @run shell CustomLauncherTest.sh
-
-#
-# Check we are run from jtreg
-#
-if [ -z "${TESTCLASSES}" ]; then
-    echo "Test is designed to be run from jtreg only"
-    exit 0
-fi
-
-#
-# For now this test passes silently on Windows - this means the test only
-# has to locate libjvm.so. Also $! is not reliable on some releases of MKS.
-#{
-OS=`uname -s`
-if [ "$OS" != "Linux" -a "$OS" != "SunOS" ]; then
-    echo "Test not designed to run on this operating system, skipping..."
-    exit 0
-fi
-
-#
-# Locate the custom launcher for this platform
-#
-PLATFORM=unknown
-ARCH=unknown
-if [ "$OS" = "SunOS" ]; then
-    PLATFORM=solaris
-    case "`uname -p`" in
-	i[3-9]86)
-	    ARCH=i586
-	    ;;
-	sparc)
-	    ARCH=sparc
-	    ;;
-    esac
-else
-    PLATFORM=linux
-    case "`uname -m`" in
-	i[3-6]86)
-	    ARCH=i586
-	    ;;
-	x86_64)
-	    ARCH=amd64
-	    ;;
-    esac
-fi
-
-
-#
-# On x86 the native libraries are in lib/i386 for
-# compatability reasons
-#
-if [ "$ARCH" = "i586" ]; then
-    LIBARCH="i386"
-else
-    LIBARCH=$ARCH
-fi
-
-
-#
-# Check that a custom launcher exists for this platform
-#
-LAUNCHER="${TESTSRC}/${PLATFORM}-${ARCH}/launcher"
-if [ ! -x "${LAUNCHER}" ]; then
-    echo "${LAUNCHER} not found"
-    exit 0
-fi
-
-# 
-# Locate the libjvm.so library 
-#
-JVMLIB="${TESTJAVA}/jre/lib/${LIBARCH}/client/libjvm.so"
-if [ ! -f "${JVMLIB}" ]; then
-    JVMLIB="${TESTJAVA}/jre/lib/${LIBARCH}/server/libjvm.so"
-    if [ ! -f "${JVMLIB}" ]; then
-	JVMLIB="${TESTJAVA}/lib/${LIBARCH}/client/libjvm.so"
-	if [ ! -f "${JVMLIB}" ]; then
-	    JVMLIB="${TESTJAVA}/lib/${LIBARCH}/serevr/libjvm.so"
-	    if [ ! -f "${JVMLIB}" ]; then
-		echo "Unable to locate libjvm.so in ${TESTJAVA}"
-		exit 1
-	    fi
-	fi
-    fi
-fi
-
-#
-# Start the VM
-#
-outputfile=${TESTCLASSES}/Test.out
-rm -f ${outputfile}
-
-echo ''
-echo "Starting custom launcher..."
-echo " launcher: ${LAUNCHER}"
-echo "   libjvm: ${JVMLIB}"
-echo "classpath: ${TESTCLASSES}"
-
-
-${LAUNCHER} ${JVMLIB} ${TESTCLASSES} TestApplication > ${outputfile} &
-pid=$!
-
-# Wait for managed VM to startup (although this looks like a potentially
-# infinate loop, the framework will eventually kill it)
-echo "Waiting for TestAppication to test..."
-attempts=0
-while true; do
-    sleep 1
-    port=`tail -1 ${outputfile}`
-    if [ ! -z "$port" ]; then
-	# In case of errors wait time for output to be flushed
-	sleep 1
-	cat ${outputfile}
-	break
-    fi
-    attempts=`expr $attempts + 1`
-    echo "Waiting $attempts second(s) ..."
-done
-
-# Start the manager - this should connect to VM
-${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTCLASSES}:${TESTJAVA}/lib/tools.jar \
-  TestManager $pid $port true
-if [ $? != 0 ]; then 
-    echo "Test failed"
-    exit 1
-fi
-exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,242 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * @test
+ * @library /lib/testlibrary
+ * @bug 5016507 6173612 6319776 6342019 6484550 8004926
+ * @summary Start a managed VM and test that a management tool can connect
+ *          without connection or username/password details.
+ *          TestManager will attempt a connection to the address obtained from
+ *          both agent properties and jvmstat buffer.
+ * @build TestManager TestApplication
+ * @run main/timeout=300 LocalManagementTest
+ */
+
+import jdk.testlibrary.ProcessTools;
+
+public class LocalManagementTest {
+    private static final  String TEST_CLASSES = System.getProperty("test.classes");
+    private static final  String TEST_JDK = System.getProperty("test.jdk");
+
+    public static void main(String[] args) throws Exception {
+        int failures = 0;
+        for(Method m : LocalManagementTest.class.getDeclaredMethods()) {
+            if (Modifier.isStatic(m.getModifiers()) &&
+                m.getName().startsWith("test")) {
+                m.setAccessible(true);
+                try {
+                    System.out.println(m.getName());
+                    System.out.println("==========");
+                    Boolean rslt = (Boolean)m.invoke(null);
+                    if (!rslt) {
+                        System.err.println(m.getName() + " failed");
+                        failures++;
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    failures++;
+                }
+            }
+        }
+        if (failures > 0) {
+            throw new Error("Test failed");
+        }
+    }
+
+    private static boolean test1() throws Exception {
+        return doTest("-Dcom.sun.management.jmxremote");
+    }
+
+    private static boolean test2() throws Exception {
+        Path agentPath = findAgent();
+        if (agentPath != null) {
+            String agent = agentPath.toString();
+            return doTest("-javaagent:" + agent);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * no args (blank) - manager should attach and start agent
+     */
+    private static boolean test3() throws Exception {
+        return doTest(null);
+    }
+
+    /**
+     * sanity check arguments to management-agent.jar
+     */
+    private static boolean test4() throws Exception {
+        Path agentPath = findAgent();
+        if (agentPath != null) {
+            ProcessBuilder builder = ProcessTools.createJavaProcessBuilder(
+                "-javaagent:" + agentPath.toString() +
+                "=com.sun.management.jmxremote.port=7775," +
+                "com.sun.management.jmxremote.authenticate=false," +
+                "com.sun.management.jmxremote.ssl=false",
+                "-cp",
+                TEST_CLASSES,
+                "TestApplication",
+                "-exit"
+            );
+
+            Process prc = null;
+            try {
+                prc = ProcessTools.startProcess(
+                    "TestApplication",
+                    builder
+                );
+                int exitCode = prc.waitFor();
+                return exitCode == 0;
+            } finally {
+                if (prc != null) {
+                    prc.destroy();
+                    prc.waitFor();
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * use DNS-only name service
+     */
+    private static boolean test5() throws Exception {
+        return doTest("-Dsun.net.spi.namservice.provider.1=\"dns,sun\"");
+    }
+
+    private static Path findAgent() {
+        FileSystem FS = FileSystems.getDefault();
+        Path agentPath = FS.getPath(
+            TEST_JDK, "jre", "lib", "management-agent.jar"
+        );
+        if (!isFileOk(agentPath)) {
+            agentPath = FS.getPath(
+                TEST_JDK, "lib", "management-agent.jar"
+            );
+        }
+        if (!isFileOk(agentPath)) {
+            System.err.println("Can not locate management-agent.jar");
+            return null;
+        }
+        return agentPath;
+    }
+
+    private static boolean isFileOk(Path path) {
+        return Files.isRegularFile(path) && Files.isReadable(path);
+    }
+
+    private static boolean doTest(String arg) throws Exception {
+        List<String> args = new ArrayList<>();
+        args.add("-cp");
+        args.add(TEST_CLASSES);
+
+        if (arg != null) {
+            args.add(arg);
+        }
+        args.add("TestApplication");
+        ProcessBuilder server = ProcessTools.createJavaProcessBuilder(
+            args.toArray(new String[args.size()])
+        );
+
+        Process serverPrc = null, clientPrc = null;
+        try {
+            final AtomicReference<String> port = new AtomicReference<>();
+            final AtomicReference<String> pid = new AtomicReference<>();
+
+            serverPrc = ProcessTools.startProcess(
+                "TestApplication",
+                server,
+                (String line) -> {
+                    if (line.startsWith("port:")) {
+                         port.set(line.split("\\:")[1]);
+                     } else  if (line.startsWith("pid:")) {
+                         pid.set(line.split("\\:")[1]);
+                     } else if (line.startsWith("waiting")) {
+                         return true;
+                     }
+                     return false;
+                },
+                5,
+                TimeUnit.SECONDS
+            );
+
+            System.out.println("Attaching test manager:");
+            System.out.println("=========================");
+            System.out.println("  PID           : " + pid.get());
+            System.out.println("  shutdown port : " + port.get());
+
+            ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
+                "-cp",
+                TEST_CLASSES +
+                    File.pathSeparator +
+                    TEST_JDK +
+                    File.separator +
+                    "lib" +
+                    File.separator +
+                    "tools.jar",
+                "TestManager",
+                pid.get(),
+                port.get(),
+                "true"
+            );
+
+            clientPrc = ProcessTools.startProcess(
+                "TestManager",
+                client,
+                (String line) -> line.startsWith("Starting TestManager for PID"),
+                10,
+                TimeUnit.SECONDS
+            );
+
+            int clientExitCode = clientPrc.waitFor();
+            int serverExitCode = serverPrc.waitFor();
+            return clientExitCode == 0 && serverExitCode == 0;
+        } finally {
+            if (clientPrc != null) {
+                System.out.println("Stopping process " + clientPrc);
+                clientPrc.destroy();
+                clientPrc.waitFor();
+            }
+            if (serverPrc != null) {
+                System.out.println("Stopping process " + serverPrc);
+                serverPrc.destroy();
+                serverPrc.waitFor();
+            }
+        }
+    }
+}
\ No newline at end of file
--- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.sh	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute 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 5016507 6173612 6319776 6342019 6484550
-# @summary Start a managed VM and test that a management tool can connect
-#          without connection or username/password details.
-#          TestManager will attempt a connection to the address obtained from 
-#          both agent properties and jvmstat buffer.
-#
-# @build TestManager TestApplication
-# @run shell/timeout=300 LocalManagementTest.sh
-
-
-doTest()
-{
-    echo ''
-
-    outputfile=${TESTCLASSES}/Test.out
-    rm -f ${outputfile}
-
-    # Start VM with given options
-    echo "+ $JAVA ${TESTVMOPTS} $1 Test"
-    $JAVA ${TESTVMOPTS} $1 TestApplication > ${outputfile}&
-    pid=$!
- 
-    # Wait for managed VM to startup
-    echo "Waiting for VM to startup..."
-    attempts=0
-    while true; do
-        sleep 1
-  	port=`tail -1 ${outputfile}`
-  	if [ ! -z "$port" ]; then
-     	    # In case of errors wait time for output to be flushed
-     	    sleep 1
-     	    cat ${outputfile}
-     	    break
-	fi
-      attempts=`expr $attempts + 1`
-      echo "Waiting $attempts second(s) ..."
-    done
-
-    # Start the manager - this should connect to VM
-    sh -xc "$JAVA ${TESTVMOPTS} -classpath ${TESTCLASSES}:${TESTJAVA}/lib/tools.jar \
-        TestManager $pid $port"  2>&1
-    if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-}
-
-
-# Check we are run from jtreg
-if [ -z "${TESTCLASSES}" ]; then
-    echo "Test is designed to be run from jtreg only"
-    exit 0
-fi
-
-# For now this test passes silently on Windows - there are 2 reasons
-# to skip it :-
-#
-# 1. No jstat instrumentation buffers if FAT32 so need
-#    -XX:+PerfBypassFileSystemCheck 
-# 2. $! is used to get the pid of the created process but it's not
-#    reliable on older versions of MKS. Also negative pids are returned
-#    on Windows 98.
-
-os=`uname -s`
-if [ "$os" != "Linux" -a "$os" != "SunOS" ]; then
-    echo "Test not designed to run on this operating system, skipping..."
-    exit 0
-fi
-
-JAVA=${TESTJAVA}/bin/java
-CLASSPATH=${TESTCLASSES}
-export CLASSPATH
-
-failures=0
-
-# Test 1 
-doTest "-Dcom.sun.management.jmxremote" 
-
-# Test 2
-AGENT="${TESTJAVA}/jre/lib/management-agent.jar"
-if [ ! -f ${AGENT} ]; then
-  AGENT="${TESTJAVA}/lib/management-agent.jar"
-fi
-doTest "-javaagent:${AGENT}" 
-
-# Test 3 - no args (blank) - manager should attach and start agent
-doTest " " 
-
-# Test 4 - sanity check arguments to management-agent.jar
-echo ' '
-sh -xc "${JAVA} ${TESTVMOPTS} -javaagent:${AGENT}=com.sun.management.jmxremote.port=7775,\
-com.sun.management.jmxremote.authenticate=false,com.sun.management.jmxremote.ssl=false \
-  TestApplication -exit" 2>&1
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-# Test 5 - use DNS-only name service
-doTest "-Dsun.net.spi.namservice.provider.1=\"dns,sun\"" 
-
-#
-# Results
-#
-echo ''
-if [ $failures -gt 0 ];
-  then echo "$failures test(s) failed";
-  else echo "All test(s) passed"; fi
-exit $failures
-
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,14 +24,15 @@
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.InputStream;
 import java.io.FilenameFilter;
 import java.io.IOException;
+import java.net.BindException;
+import java.net.ServerSocket;
+import java.rmi.server.ExportException;
 
 import java.util.Properties;
 import java.util.Iterator;
 import java.util.Set;
-import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
@@ -54,7 +55,7 @@
  * bootstrap & connection test will fail.</p>
  *
  * <p>The rmi port number can be specified with the "rmi.port" system property.
- * If not, this test will use 12424</p>
+ * If not, this test will use the first available port</p>
  *
  * <p>When called with some argument, the main() will interprete its args to
  * be Java M&M configuration file names. The filenames are expected to end
@@ -69,7 +70,8 @@
  * <p>Debug traces are logged in "sun.management.test"</p>
  **/
 public class RmiBootstrapTest {
-
+    // the number of consecutive ports to test for availability
+    private static final int PORT_TEST_LEN = 800;
     static TestLogger log =
         new TestLogger("RmiBootstrapTest");
 
@@ -78,6 +80,7 @@
      * to avoid falling into "port number already in use" problems.
      **/
     static int testPort = 0;
+    static int basePort = 0;
 
     /**
      * Default values for RMI configuration properties.
@@ -624,7 +627,7 @@
      * eventually cleans up by calling ConnectorBootstrap.terminate().
      * @return null if the test succeeds, an error message otherwise.
      **/
-    private String testConfiguration(File file,int port) {
+    private String testConfiguration(File file,int port) throws BindException {
 
         final String path;
         try {
@@ -644,7 +647,7 @@
         System.out.println("***");
 
         System.setProperty("com.sun.management.jmxremote.port",
-                           Integer.toString(port));
+                            Integer.toString(port));
         if (path != null)
             System.setProperty("com.sun.management.config.file", path);
         else
@@ -661,6 +664,11 @@
         try {
             cs = ConnectorBootstrap.initialize();
         } catch (AgentConfigurationError x) {
+            if (x.getCause() instanceof ExportException) {
+                if (x.getCause().getCause() instanceof BindException) {
+                    throw (BindException)x.getCause().getCause();
+                }
+            }
             final String err = "Failed to initialize connector:" +
                 "\n\tcom.sun.management.jmxremote.port=" + port +
                 ((path!=null)?"\n\tcom.sun.management.config.file="+path:
@@ -713,7 +721,15 @@
      * @return null if the test succeeds, an error message otherwise.
      **/
     private String testConfigurationKo(File conf,int port) {
-        final String errStr = testConfiguration(conf,port+testPort++);
+        String errStr = null;
+        for (int i = 0; i < PORT_TEST_LEN; i++) {
+            try {
+                errStr = testConfiguration(conf,port+testPort++);
+                break;
+            } catch (BindException e) {
+                // port conflict; try another port
+            }
+        }
         if (errStr == null) {
             return "Configuration " +
                 conf + " should have failed!";
@@ -733,11 +749,21 @@
      **/
     private String testConfigurationFile(String fileName) {
         File file = new File(fileName);
-        final String portStr = System.getProperty("rmi.port","12424");
-        final int port       = Integer.parseInt(portStr);
+        final String portStr = System.getProperty("rmi.port",null);
+        final int port       = portStr != null ?
+                                Integer.parseInt(portStr) : basePort;
 
         if (fileName.endsWith("ok.properties")) {
-            return testConfiguration(file,port+testPort++);
+            String errStr = null;
+            for (int i = 0; i < PORT_TEST_LEN; i++) {
+                try {
+                    errStr = testConfiguration(file,port+testPort++);
+                    return errStr;
+                } catch (BindException e) {
+                    // port conflict; try another port
+                }
+            }
+            return "Can not locate available port";
         }
         if (fileName.endsWith("ko.properties")) {
             return testConfigurationKo(file,port+testPort++);
@@ -752,8 +778,9 @@
      * @throws RuntimeException if the test fails.
      **/
     public void runko() {
-        final String portStr = System.getProperty("rmi.port","12424");
-        final int port       = Integer.parseInt(portStr);
+        final String portStr = System.getProperty("rmi.port",null);
+        final int port       = portStr != null ?
+                                Integer.parseInt(portStr) : basePort;
         final File[] conf = findConfigurationFilesKo();
         if ((conf == null)||(conf.length == 0))
             throw new RuntimeException("No configuration found");
@@ -774,15 +801,23 @@
      * @throws RuntimeException if the test fails.
      **/
     public void runok() {
-        final String portStr = System.getProperty("rmi.port","12424");
-        final int port       = Integer.parseInt(portStr);
+        final String portStr = System.getProperty("rmi.port",null);
+        final int port       = portStr != null ?
+                                Integer.parseInt(portStr) : basePort;
         final File[] conf = findConfigurationFilesOk();
         if ((conf == null)||(conf.length == 0))
             throw new RuntimeException("No configuration found");
 
-        String errStr;
+        String errStr = null;
         for (int i=0;i<conf.length;i++) {
-            errStr = testConfiguration(conf[i],port+testPort++);
+            for (int j = 0; j < PORT_TEST_LEN; i++) {
+                try {
+                    errStr = testConfiguration(conf[i],port+testPort++);
+                    break;
+                } catch (BindException e) {
+                    // port conflict; try another port
+                }
+            }
             if (errStr != null) {
                 throw new RuntimeException(errStr);
             }
@@ -835,7 +870,8 @@
      * Calls run(args[]).
      * exit(1) if the test fails.
      **/
-    public static void main(String args[]) {
+    public static void main(String args[]) throws Exception {
+        setupBasePort();
         RmiBootstrapTest manager = new RmiBootstrapTest();
         try {
             manager.run(args);
@@ -850,4 +886,9 @@
         System.out.println("**** Test  RmiBootstrap Passed ****");
     }
 
+    private static void setupBasePort() throws IOException {
+        try (ServerSocket s = new ServerSocket(0)) {
+            basePort = s.getLocalPort() + 1;
+        }
+    }
 }
--- a/jdk/test/sun/management/jmxremote/bootstrap/TestApplication.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/TestApplication.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,14 +24,18 @@
 /*
  *
  *
- * A test "application" used by unit test LocalManagementTest.sh. This
- * application binds to some random port, prints the port number to
- * standard output, waits for somebody to connect, and then shuts down.
+ * A test "application" used by unit tests -
+ *   LocalManagementTest.java, CustomLauncherTest.java.
+ * This application binds to some random port, prints its pid and
+ * the port number to standard output, waits for somebody to connect,
+ * and then shuts down.
  */
 import java.io.IOException;
 import java.net.ServerSocket;
 import java.net.Socket;
 
+import jdk.testlibrary.ProcessTools;
+
 public class TestApplication {
     public static void main(String[] args) throws IOException {
         // Some tests require the application to exit immediately
@@ -43,8 +47,17 @@
         ServerSocket ss = new ServerSocket(0);
         int port = ss.getLocalPort();
 
-        // signal test that we are started - do not remove this line!!
-        System.out.println(port);
+        int pid = -1;
+        try {
+            pid = ProcessTools.getProcessId();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        // signal test that we are started - do not remove these lines!!
+        System.out.println("port:" + port);
+        System.out.println("pid:" + pid);
+        System.out.println("waiting for the manager ...");
         System.out.flush();
 
         // wait for manager to connect
--- a/jdk/test/sun/management/jmxremote/bootstrap/TestManager.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/TestManager.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,8 @@
 /*
  *
  *
- * A test "management tool" used by unit test LocalManagementTest.sh.
+ * A test "management tool" used by unit tests -
+ *   LocalManagementTest.java, CustomLauncherTest.java
  *
  * Usage:    java TestManager <pid> <port>
  *
@@ -32,8 +33,6 @@
  * TCP port is used to shutdown the application.
  */
 import javax.management.MBeanServerConnection;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.ObjectName;
 import javax.management.remote.JMXServiceURL;
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXConnector;
@@ -43,7 +42,6 @@
 import java.net.InetSocketAddress;
 import java.io.File;
 import java.io.IOException;
-import java.util.Properties;
 
 // Sun specific
 import com.sun.tools.attach.VirtualMachine;
@@ -111,6 +109,8 @@
         "com.sun.management.jmxremote.localConnectorAddress";
     public static void main(String[] args) throws Exception {
         String pid = args[0]; // pid as a string
+        System.out.println("Starting TestManager for PID = " + pid);
+        System.out.flush();
         VirtualMachine vm = VirtualMachine.attach(pid);
 
         String agentPropLocalConnectorAddress = (String)
@@ -140,7 +140,6 @@
         System.out.println("Testing the connector address from jvmstat buffer");
         connect(pid, jvmstatLocalConnectorAddress);
 
-
         // Shutdown application
         int port = Integer.parseInt(args[1]);
         System.out.println("Shutdown process via TCP port: " + port);
Binary file jdk/test/sun/management/jmxremote/bootstrap/linux-amd64/launcher has changed
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -551,6 +551,11 @@
  esac 
 done
 
+if [ "${COMPILEJAVA}" = "" ]
+then 
+  COMPILEJAVA=${TESTJAVA}
+fi
+
 if [ ${_compile} = "yes" ]
 then
  _compile
--- a/jdk/test/sun/nio/cs/TestIBMBugs.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/nio/cs/TestIBMBugs.java	Wed Jul 05 19:21:26 2017 +0200
@@ -147,16 +147,17 @@
     }
 
     private static void bug6569191 () throws Exception {
-        byte[] bs = new byte[] { (byte)0x81, (byte)0xad,
-                                 (byte)0x81, (byte)0xae,
-                                 (byte)0x81, (byte)0xaf,
-                                 (byte)0x81, (byte)0xb0,
-                                 (byte)0x85, (byte)0x81,
-                                 (byte)0x85, (byte)0x87,
-                                 (byte)0x85, (byte)0xe0,
-                                 (byte)0x85, (byte)0xf0 };
+        byte[] bs = new byte[] { (byte)0x81, (byte)0xad,  // fffd ff6d
+                                 (byte)0x81, (byte)0xae,  // fffd ff6e
+                                 (byte)0x81, (byte)0xaf,  // fffd ff6f
+                                 (byte)0x81, (byte)0xb0,  // fffd ff70
+                                 (byte)0x85, (byte)0x81,  // fffd ->
+                                 (byte)0x85, (byte)0x87,  // 2266 ->
+                                 (byte)0x85, (byte)0xe0,  // 32a4 ->
+                                 (byte)0x85, (byte)0xf0 };// 7165 fffd
         String s = new String(bs, "Cp943");
-        if (!"\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd"
+        // see DoubleByte for how the unmappables are handled
+        if (!"\ufffd\uff6d\ufffd\uff6e\ufffd\uff6f\ufffd\uff70\ufffd\u2266\u32a4\u7165\ufffd"
             .equals(s))
             throw new Exception("Cp943 failed");
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/nio/cs/TestUnmappable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8008386
+ * @summary (cs) Unmappable leading should be decoded to replacement.
+ *          Tests for Shift_JIS and MS932 decoding
+ * @run main TestUnmappable
+ */
+
+import java.nio.*;
+import java.nio.charset.*;
+
+public class TestUnmappable {
+    public static void main(String args[]) throws Exception {
+
+        // illegal leading character test
+        byte[][] inputBytes = {
+                               // Shift_JIS
+                               {(byte)0xce, (byte)0xa0, (byte)0xce, (byte)0x7a},
+                               // MS932
+                               {(byte)0x3c, (byte)0x21, (byte)0x2d, (byte)0x2d,
+                                (byte)0xe5, (byte)0xaf, (byte)0xbe, (byte)0xe5,
+                                (byte)0xbf, (byte)0x9c, (byte)0x2d, (byte)0x2d,
+                                (byte)0x3e, (byte)0xd,  (byte)0xa },
+                               {(byte)0x81, (byte)0xad},
+                               // PCK
+                               {(byte)0xef, (byte)0x90},
+                               {(byte)0x91, (byte)0xfd}
+                              };
+
+        String[] charsets = { "Shift_JIS", "MS932", "PCK" };
+        String[] expectedStrings = {
+                                    // Shift_JIS
+                                    "0xce 0x3f 0xce 0x7a ",
+                                    // MS932
+                                    "0x3c 0x21 0x2d 0x2d 0xe5 0xaf 0xbe 0xe5 0xbf " +
+                                    "0x3f 0x2d 0x2d 0x3e 0xd 0xa ",
+                                    "0x3f 0xad ",
+                                    // PCK
+                                    "0x3f 0x3f ",
+                                    "0x3f "};
+
+        for (int i = 0; i < charsets.length; i++) {
+            String ret = new String(inputBytes[i], charsets[i]);
+            String bString = getByteString(ret.getBytes(Charset.forName(charsets[i])));
+            if (expectedStrings[i].length() != bString.length()
+               || ! expectedStrings[i].equals(bString)){
+                throw new Exception("ByteToChar for " + charsets[i]
+                    + " does not work correctly.\n" +
+                    "Expected: " + expectedStrings[i] + "\n" +
+                    "Received: " + bString);
+            }
+        }
+    }
+
+    private static String getByteString(byte[] bytes) {
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < bytes.length; i++) {
+            sb.append("0x" + Integer.toHexString((int)(bytes[i] & 0xFF)) + " ");
+        }
+        return sb.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/reflect/Reflection/GetCallerClassWithDepth.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8025799
+ * @summary sun.reflect.Reflection.getCallerClass(int)
+ * @run main GetCallerClassWithDepth
+ */
+
+public class GetCallerClassWithDepth {
+    public static void main(String[] args) throws Exception {
+        Class<?> c = Test.test();
+        assertEquals(c, GetCallerClassWithDepth.class);
+        Class<?> caller = Test.caller();
+        assertEquals(caller, GetCallerClassWithDepth.class);
+        Test.selfTest();
+
+        try {
+            sun.reflect.Reflection.getCallerClass(-1);
+            throw new RuntimeException("getCallerClass(-1) should fail");
+        } catch (Error e) {
+            System.out.println("Expected: " + e.getMessage());
+        }
+    }
+
+    public Class<?> getCallerClass() {
+        // 0: Reflection 1: getCallerClass 2: Test.test 3: main
+        return sun.reflect.Reflection.getCallerClass(3);
+    }
+
+    static void assertEquals(Class<?> c, Class<?> expected) {
+        if (c != expected) {
+            throw new RuntimeException("Incorrect caller: " + c);
+        }
+    }
+
+    static class Test {
+        // Returns the caller of this method
+        public static Class<?> test() {
+            return new GetCallerClassWithDepth().getCallerClass();
+        }
+
+        // Returns the caller of this method
+        public static Class<?> caller() {
+            // 0: Reflection 1: Test.caller 2: main
+            return sun.reflect.Reflection.getCallerClass(2);
+        }
+        public static void selfTest() {
+            // 0: Reflection 1: Test.selfTest
+            Class<?> c = sun.reflect.Reflection.getCallerClass(1);
+            assertEquals(c, Test.class);
+            Inner1.deep();
+        }
+
+        static class Inner1 {
+            static void deep() {
+                 deeper();
+            }
+            static void deeper() {
+                 Inner2.deepest();
+            }
+            static class Inner2 {
+                static void deepest() {
+                    // 0: Reflection 1: deepest 2: deeper 3: deep 4: Test.selfTest
+                    Class<?> c = sun.reflect.Reflection.getCallerClass(4);
+                    assertEquals(c, Test.class);
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/rmi/transport/proxy/DisableHttpDefaultValue.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8023862
+ * @summary Verify that the default value of the java.rmi.server.disableHttp
+ *          has been changed from false to true.
+ * @compile -XDignore.symbol.file DisableHttpDefaultValue.java
+ *
+ * @run main/othervm                                     DisableHttpDefaultValue true
+ * @run main/othervm -Djava.rmi.server.disableHttp       DisableHttpDefaultValue false
+ * @run main/othervm -Djava.rmi.server.disableHttp=false DisableHttpDefaultValue false
+ * @run main/othervm -Djava.rmi.server.disableHttp=xyzzy DisableHttpDefaultValue false
+ * @run main/othervm -Djava.rmi.server.disableHttp=true  DisableHttpDefaultValue true
+ */
+
+import sun.rmi.transport.proxy.RMIMasterSocketFactory;
+
+public class DisableHttpDefaultValue {
+    /**
+     * Subclass RMIMasterSocketFactory to get access to
+     * protected field altFactoryList. This list has a
+     * zero size if proxying is disabled.
+     */
+    static class SocketFactory extends RMIMasterSocketFactory {
+        boolean proxyDisabled() {
+            return altFactoryList.size() == 0;
+        }
+    }
+
+    /**
+     * Takes a single arg, which is the expected boolean value of
+     * java.rmi.server.disableHttp.
+     */
+    public static void main(String[] args) throws Exception {
+        // Force there to be a proxy host, so that we are able to
+        // tell whether proxying is enabled or disabled.
+        System.setProperty("http.proxyHost", "proxy.example.com");
+
+        String propval = System.getProperty("java.rmi.server.disableHttp");
+        String propdisp = (propval == null) ? "null" : ("\"" + propval + "\"");
+        boolean expected = Boolean.parseBoolean(args[0]);
+        boolean actual = new SocketFactory().proxyDisabled();
+        System.out.printf("### prop=%s exp=%s act=%s%n", propdisp, expected, actual);
+        if (expected != actual)
+            throw new AssertionError();
+    }
+}
--- a/jdk/test/sun/security/pkcs12/PKCS12SameKeyId.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/pkcs12/PKCS12SameKeyId.java	Wed Jul 05 19:21:26 2017 +0200
@@ -60,7 +60,7 @@
         for (int i=0; i<SIZE; i++) {
             System.err.print(".");
             String cmd = "-keystore " + JKSFILE
-                    + " -storepass changeit -keypass changeit "
+                    + " -storepass changeit -keypass changeit -keyalg rsa "
                     + "-genkeypair -alias p" + i + " -dname CN=" + i;
             sun.security.tools.keytool.Main.main(cmd.split(" "));
         }
--- a/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java	Wed Jul 05 19:21:26 2017 +0200
@@ -185,7 +185,7 @@
             DerOutputStream tstInfo2 = new DerOutputStream();
             tstInfo2.putOctetString(tstInfo.toByteArray());
 
-            Signature sig = Signature.getInstance("SHA1withDSA");
+            Signature sig = Signature.getInstance("SHA1withRSA");
             sig.initSign((PrivateKey)(ks.getKey(
                     alias, "changeit".toCharArray())));
             sig.update(tstInfo.toByteArray());
--- a/jdk/test/sun/security/tools/jarsigner/checkusage.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/checkusage.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -45,7 +45,7 @@
     ;;
 esac
 
-KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit"
+KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keyalg rsa"
 JAR=$TESTJAVA${FS}bin${FS}jar
 JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner"
 
--- a/jdk/test/sun/security/tools/jarsigner/collator.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/collator.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -47,7 +47,7 @@
 JFILE=collator.jar
 
 KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit \
-        -keystore $KS"
+        -keyalg rsa -keystore $KS"
 JAR=$TESTJAVA${FS}bin${FS}jar
 JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner -keystore $KS -storepass changeit"
 
--- a/jdk/test/sun/security/tools/jarsigner/crl.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/crl.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -45,7 +45,7 @@
 
 KS=crl.jks
 
-KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS"
+KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS -keyalg rsa"
 
 rm $KS 2> /dev/null
 
--- a/jdk/test/sun/security/tools/jarsigner/jvindex.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/jvindex.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -47,7 +47,7 @@
 JFILE=jvindex.jar
 
 KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit \
-        -keystore $KS"
+        -keystore $KS -keyalg rsa"
 JAR=$TESTJAVA${FS}bin${FS}jar
 JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner -keystore $KS -storepass changeit"
 
--- a/jdk/test/sun/security/tools/jarsigner/newsize7.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/newsize7.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -51,7 +51,7 @@
 
 KSFILE=ns7.jks
 
-KT="${TESTJAVA}${FS}bin${FS}keytool -keystore ns7.jks -storepass changeit -keypass changeit"
+KT="${TESTJAVA}${FS}bin${FS}keytool -keystore ns7.jks -storepass changeit -keypass changeit -keyalg rsa"
 JAR="${TESTJAVA}${FS}bin${FS}jar"
 JS="${TESTJAVA}${FS}bin${FS}jarsigner -keystore ns7.jks -storepass changeit"
 
--- a/jdk/test/sun/security/tools/jarsigner/onlymanifest.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/onlymanifest.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -46,7 +46,7 @@
 JFILE=onlymanifest.jar
 
 KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit \
-        -keystore $KS"
+        -keystore $KS -keyalg rsa"
 JAR=$TESTJAVA${FS}bin${FS}jar
 JARSIGNER=$TESTJAVA${FS}bin${FS}jarsigner
 
--- a/jdk/test/sun/security/tools/jarsigner/passtype.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/passtype.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -45,7 +45,7 @@
 KS=pt.jks
 JFILE=pt.jar
 
-KT="$TESTJAVA${FS}bin${FS}keytool -keystore $KS -validity 300"
+KT="$TESTJAVA${FS}bin${FS}keytool -keystore $KS -validity 300 -keyalg rsa"
 JAR=$TESTJAVA${FS}bin${FS}jar
 JARSIGNER=$TESTJAVA${FS}bin${FS}jarsigner
 
--- a/jdk/test/sun/security/tools/jarsigner/samename.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/samename.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -47,7 +47,7 @@
 KS=samename.jks
 JFILE=em.jar
 
-KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS"
+KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS -keyalg rsa"
 JAR=$TESTJAVA${FS}bin${FS}jar
 JARSIGNER=$TESTJAVA${FS}bin${FS}jarsigner
 
--- a/jdk/test/sun/security/tools/jarsigner/ts.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/ts.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -53,7 +53,7 @@
 JAR="${TESTJAVA}${FS}bin${FS}jar"
 JAVA="${TESTJAVA}${FS}bin${FS}java"
 JAVAC="${TESTJAVA}${FS}bin${FS}javac"
-KT="${TESTJAVA}${FS}bin${FS}keytool -keystore tsks -storepass changeit -keypass changeit"
+KT="${TESTJAVA}${FS}bin${FS}keytool -keystore tsks -storepass changeit -keypass changeit -keyalg rsa"
 
 rm tsks
 echo Nothing > A
--- a/jdk/test/sun/security/tools/keytool/CloseFile.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/keytool/CloseFile.java	Wed Jul 05 19:21:26 2017 +0200
@@ -59,7 +59,7 @@
     }
 
     static void run(String s) throws Exception {
-        sun.security.tools.keytool.Main.main((s+" -debug").split(" "));
+        sun.security.tools.keytool.Main.main((s+" -debug -keyalg rsa").split(" "));
     }
     static void remove(String filename, boolean check) {
         new File(filename).delete();
--- a/jdk/test/sun/security/tools/keytool/ListKeychainStore.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/keytool/ListKeychainStore.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -71,6 +71,7 @@
         -storetype PKCS12 \
         -keystore $TEMPORARY_P12 \
         -storepass $PWD \
+        -keyalg rsa \
         -dname "CN=$i,OU=$i,O=$i,ST=$i,C=US" \
         -alias 7133495-$i
 
--- a/jdk/test/sun/security/tools/keytool/StartDateTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/keytool/StartDateTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -49,7 +49,7 @@
         new File("jks").delete();
 
         run("-keystore jks -storetype jks -storepass changeit -keypass changeit -alias me " +
-                "-genkeypair -dname CN=Haha -startdate +1y");
+                "-keyalg rsa -genkeypair -dname CN=Haha -startdate +1y");
         cal.setTime(getIssueDate());
         System.out.println(cal);
         if (cal.get(Calendar.YEAR) != year + 1) {
--- a/jdk/test/sun/security/tools/keytool/UnknownAndUnparseable.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/keytool/UnknownAndUnparseable.java	Wed Jul 05 19:21:26 2017 +0200
@@ -43,7 +43,7 @@
         // Create a cert with an unknown extension: 1.2.3.4, and an invalid
         // KeyUsage extension
         String genkey = s
-                + "-genkeypair -alias a -dname CN=A -ext 1.2.3.4=1234 "
+                + "-genkeypair -alias a -dname CN=A -ext 1.2.3.4=1234 -keyalg rsa "
                 + "-ext " + PKIXExtensions.KeyUsage_Id.toString() + "=5678";
         sun.security.tools.keytool.Main.main(genkey.split(" "));
 
--- a/jdk/test/sun/security/tools/keytool/emptysubject.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/keytool/emptysubject.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -45,7 +45,7 @@
 esac
 
 KS=emptysubject.jks
-KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS"
+KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS -keyalg rsa"
 
 rm $KS
 
--- a/jdk/test/sun/security/tools/keytool/importreadall.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/keytool/importreadall.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -49,7 +49,7 @@
     ;;
 esac
 
-KEYTOOL="${TESTJAVA}${FS}bin${FS}keytool -keystore importreadall.jks -storepass changeit -keypass changeit"
+KEYTOOL="${TESTJAVA}${FS}bin${FS}keytool -keystore importreadall.jks -storepass changeit -keypass changeit -keyalg rsa"
 
 # In case the test is run twice in the same directory
 
--- a/jdk/test/sun/security/tools/keytool/p12importks.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/keytool/p12importks.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -50,7 +50,7 @@
 
 rm jks 2> /dev/null
 $KT -genkeypair -keystore jks -storetype jks -alias me -dname CN=Me \
-	-storepass pass1111 -keypass pass1111 || exit 11
+	-keyalg rsa -storepass pass1111 -keypass pass1111 || exit 11
 
 # Cannot only change storepass
 rm p12 2> /dev/null
@@ -85,7 +85,7 @@
 
 rm jks 2> /dev/null
 $KT -genkeypair -keystore jks -storetype jks -alias me -dname CN=Me \
-	-storepass pass1111 -keypass pass2222 || exit 21
+	-keyalg rsa -storepass pass1111 -keypass pass2222 || exit 21
 
 # Can use old keypass as new storepass so new storepass and keypass are same
 rm p12 2> /dev/null
--- a/jdk/test/sun/security/tools/keytool/readjar.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/keytool/readjar.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -46,7 +46,7 @@
 KS=readjar.jks
 rm $KS
 $TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS}  -storepass changeit -keypass changeit -keystore $KS \
-        -alias x -dname CN=X -genkeypair
+        -keyalg rsa -alias x -dname CN=X -genkeypair
 $COMPILEJAVA${FS}bin${FS}jar ${TESTTOOLVMOPTS} cvf readjar.jar $KS
 $COMPILEJAVA${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS} -storepass changeit -keystore $KS readjar.jar x
 
--- a/jdk/test/sun/security/tools/keytool/selfissued.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/keytool/selfissued.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -45,7 +45,7 @@
 esac
 
 KS=selfsigned.jks
-KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS"
+KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS -keyalg rsa"
 
 rm $KS
 
--- a/jdk/test/sun/security/tools/keytool/trystore.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/tools/keytool/trystore.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -43,7 +43,7 @@
 
 rm trystore.jks 2> /dev/null
 
-KEYTOOL="${TESTJAVA}${FS}bin${FS}keytool -storetype jks -keystore trystore.jks"
+KEYTOOL="${TESTJAVA}${FS}bin${FS}keytool -storetype jks -keystore trystore.jks -keyalg rsa"
 $KEYTOOL -genkeypair -alias a -dname CN=A -storepass changeit -keypass changeit
 $KEYTOOL -genkeypair -alias b -dname CN=B -storepass changeit -keypass changeit
 
--- a/jdk/test/sun/security/validator/certreplace.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/validator/certreplace.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -48,7 +48,7 @@
 esac
 
 KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit \
-    -keypass changeit -keystore certreplace.jks"
+    -keypass changeit -keystore certreplace.jks -keyalg rsa"
 JAVAC=$COMPILEJAVA${FS}bin${FS}javac
 JAVA=$TESTJAVA${FS}bin${FS}java
 
--- a/jdk/test/sun/security/validator/samedn.sh	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/security/validator/samedn.sh	Wed Jul 05 19:21:26 2017 +0200
@@ -48,7 +48,7 @@
 esac
 
 KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit \
-    -keypass changeit -keystore samedn.jks"
+    -keypass changeit -keystore samedn.jks -keyalg rsa"
 JAVAC=$COMPILEJAVA${FS}bin${FS}javac
 JAVA=$TESTJAVA${FS}bin${FS}java
 
--- a/jdk/test/sun/text/resources/LocaleData	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/text/resources/LocaleData	Wed Jul 05 19:21:26 2017 +0200
@@ -7681,3 +7681,9 @@
 
 # bug 8021121
 CurrencyNames/lv_LV/EUR=\u20AC
+
+# bug # 6192407
+LocaleNames/ko/PT=\ud3ec\ub974\ud22c\uce7c
+
+# bug 6931564
+LocaleNames/sv/ZA=Sydafrika
--- a/jdk/test/sun/text/resources/LocaleDataTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/text/resources/LocaleDataTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -35,7 +35,7 @@
  *      6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787
  *      6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495
  *      7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509
- *      7114053 7074882 7040556 8013836 8021121
+ *      7114053 7074882 7040556 8013836 8021121 6192407 6931564
  * @summary Verify locale data
  *
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jstatd/JstatGCUtilParser.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.Arrays;
+
+import jdk.testlibrary.Utils;
+import static jdk.testlibrary.Asserts.*;
+
+/**
+ * The helper class for parsing following output from command 'jstat -gcutil':
+ *
+ *  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT     GCT
+ *  100.00   0.00  64.68  13.17  73.39  33.46      2    0.003     1    0.156    0.158
+ *  100.00   0.00  76.54  13.17  73.39  33.46      2    0.003     1    0.156    0.158
+ *  100.00   0.00  83.49  13.17  73.39  33.46      2    0.003     1    0.156    0.158
+ *  100.00   0.00  84.53  13.17  73.39  33.46      2    0.003     1    0.156    0.158
+ *  100.00   0.00  85.57  13.17  73.39  33.46      2    0.003     1    0.156    0.158
+ *
+ *  It will be verified that numerical values have defined types and are reasonable,
+ *  for example percentage should fit within 0-100 interval.
+ */
+public class JstatGCUtilParser {
+
+    public enum GcStatisticsType {
+        INTEGER, DOUBLE, PERCENTAGE, PERCENTAGE_OR_DASH;
+    }
+
+    public enum GcStatistics {
+        S0(GcStatisticsType.PERCENTAGE),
+        S1(GcStatisticsType.PERCENTAGE),
+        E(GcStatisticsType.PERCENTAGE),
+        O(GcStatisticsType.PERCENTAGE),
+        M(GcStatisticsType.PERCENTAGE),
+        CCS(GcStatisticsType.PERCENTAGE_OR_DASH),
+        YGC(GcStatisticsType.INTEGER),
+        YGCT(GcStatisticsType.DOUBLE),
+        FGC(GcStatisticsType.INTEGER),
+        FGCT(GcStatisticsType.DOUBLE),
+        GCT(GcStatisticsType.DOUBLE);
+
+        private final GcStatisticsType type;
+
+        private GcStatistics(GcStatisticsType type) {
+            this.type = type;
+        }
+
+        private GcStatisticsType getType() {
+            return type;
+        }
+
+        public static boolean isHeadline(String... valueArray) {
+            if (valueArray.length != values().length) {
+                return false;
+            }
+            int headersCount = 0;
+            for (int i = 0; i < values().length; i++) {
+                if (valueArray[i].equals(values()[i].toString())) {
+                    headersCount++;
+                }
+            }
+            if (headersCount != values().length) {
+                return false;
+            }
+            return true;
+        }
+
+        private static void verifyLength(String... valueArray) throws Exception {
+            assertEquals(valueArray.length, values().length,
+                    "Invalid number of data columns: " + Arrays.toString(valueArray));
+        }
+
+        public static void verify(String... valueArray) throws Exception {
+            verifyLength(valueArray);
+            for (int i = 0; i < values().length; i++) {
+                GcStatisticsType type = values()[i].getType();
+                String value = valueArray[i].trim();
+                if (type.equals(GcStatisticsType.INTEGER)) {
+                    Integer.parseInt(value);
+                    break;
+                }
+                if (type.equals(GcStatisticsType.DOUBLE)) {
+                    Double.parseDouble(value);
+                    break;
+                }
+                if (type.equals(GcStatisticsType.PERCENTAGE_OR_DASH) &&
+                        value.equals("-")) {
+                    break;
+                }
+                double percentage = Double.parseDouble(value);
+                assertTrue(0 <= percentage && percentage <= 100,
+                        "Not a percentage: " + value);
+            }
+        }
+
+    }
+
+    private final String output;
+
+    public JstatGCUtilParser(String output) {
+        this.output = output;
+    }
+
+    public String getOutput() {
+        return output;
+    }
+
+    /**
+     * The function will discard any lines that come before the header line.
+     * This can happen if the JVM outputs a warning message for some reason
+     * before running jstat.
+     */
+    public void parse(int samples) throws Exception {
+        boolean headlineFound = false;
+        int datalineCount = 0;
+
+        String[] lines = output.split(Utils.NEW_LINE);
+        for (String line : lines) {
+            line = line.replaceAll("\\s+", " ").trim();
+            String[] valueArray = line.split(" ");
+
+            if (!headlineFound) {
+                headlineFound = GcStatistics.isHeadline(valueArray);
+                continue;
+            }
+
+            GcStatistics.verify(valueArray);
+            datalineCount++;
+        }
+
+        assertTrue(headlineFound, "No or invalid headline found, expected: " +
+                Utils.NEW_LINE + Arrays.toString(GcStatistics.values()).replaceAll(",", " "));
+        assertEquals(samples, datalineCount,
+                "Expected " + samples + " samples, got " + datalineCount);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jstatd/JstatdTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,356 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.net.UnknownHostException;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.util.Arrays;
+
+import static jdk.testlibrary.Asserts.*;
+import jdk.testlibrary.JDKToolLauncher;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessThread;
+import jdk.testlibrary.TestThread;
+import jdk.testlibrary.Utils;
+
+/**
+ * The base class for tests of jstatd.
+ *
+ * The test sequence for TestJstatdDefaults for example is:
+ * <pre>
+ * {@code
+ * // start jstatd process
+ * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy
+ *
+ * // run jps and verify its output
+ * jps -J-XX:+UsePerfData hostname
+ *
+ * // run jstat and verify its output
+ * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil pid@hostname 250 5
+ *
+ * // stop jstatd process and verify that no unexpected exceptions have been thrown
+ * }
+ * </pre>
+ */
+public final class JstatdTest {
+
+    /**
+     * jstat gcutil option: takes JSTAT_GCUTIL_SAMPLES samples at
+     * JSTAT_GCUTIL_INTERVAL_MS millisecond intervals
+     */
+    private static final int JSTAT_GCUTIL_SAMPLES = 5;
+    private static final int JSTAT_GCUTIL_INTERVAL_MS = 250;
+    private static final String JPS_OUTPUT_REGEX = "^\\d+\\s*.*";
+
+    private boolean useDefaultPort = true;
+    private String port;
+    private String serverName;
+    private String jstatdPid;
+    private boolean withExternalRegistry = false;
+
+    public void setServerName(String serverName) {
+        this.serverName = serverName;
+    }
+
+    public void setUseDefaultPort(boolean useDefaultPort) {
+        this.useDefaultPort = useDefaultPort;
+    }
+
+    public void setWithExternalRegistry(boolean withExternalRegistry) {
+        this.withExternalRegistry = withExternalRegistry;
+    }
+
+    /**
+     * Parse pid from jps output
+     */
+    private String parsePid(String tool, OutputAnalyzer output) throws Exception {
+        String[] lines = output.getOutput().split(Utils.NEW_LINE);
+        String pid = null;
+        int count = 0;
+        String processName = tool;
+        if (tool == "rmiregistry") {
+            processName = "registryimpl";
+        }
+        for (String line : lines) {
+            if (line.toLowerCase().matches("^\\d+\\s{1}" + processName + "$")) {
+                pid = line.split(" ")[0];
+                count++;
+            }
+        }
+        if (count > 1) {
+            throw new Exception("Expected one " + tool
+                    + " process, got " + count + ". Test will be canceled.");
+        }
+
+        return pid;
+    }
+
+    private String getToolPid(String tool)
+            throws Exception {
+        OutputAnalyzer output = runJps();
+        return parsePid(tool, output);
+    }
+
+    private String waitOnTool(String tool, TestThread thread) throws Throwable {
+        while (true) {
+            String pid = getToolPid(tool);
+
+            if (pid != null) {
+                System.out.println(tool + " pid: " + pid);
+                return pid;
+            }
+
+            Throwable t = thread.getUncaught();
+            if (t != null) {
+                if (t.getMessage().contains(
+                        "java.rmi.server.ExportException: Port already in use")) {
+                    System.out.println("Port already in use. Trying to restart with a new one...");
+                    Thread.sleep(100);
+                    return null;
+                } else {
+                    // Something unexpected has happened
+                    throw new Throwable(t);
+                }
+            }
+
+            System.out.println("Waiting until " + tool + " is running...");
+            Thread.sleep(100);
+        }
+    }
+
+    private void log(String caption, String... cmd) {
+        System.out.println(Utils.NEW_LINE + caption + ":");
+        System.out.println(Arrays.toString(cmd).replace(",", ""));
+    }
+
+    private String getDestination() throws UnknownHostException {
+        String option = Utils.getHostname();
+        if (port != null) {
+            option += ":" + port;
+        }
+        if (serverName != null) {
+            option += "/" + serverName;
+        }
+        return option;
+    }
+
+    /**
+     * Depending on test settings command line can look like:
+     *
+     * jps -J-XX:+UsePerfData hostname
+     * jps -J-XX:+UsePerfData hostname:port
+     * jps -J-XX:+UsePerfData hostname/serverName
+     * jps -J-XX:+UsePerfData hostname:port/serverName
+     */
+    private OutputAnalyzer runJps() throws Exception {
+        JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps");
+        launcher.addVMArg("-XX:+UsePerfData");
+        launcher.addToolArg(getDestination());
+
+        String[] cmd = launcher.getCommand();
+        log("Start jps", cmd);
+
+        ProcessBuilder processBuilder = new ProcessBuilder(cmd);
+        OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
+        System.out.println(output.getOutput());
+
+        return output;
+    }
+
+    /**
+     * Verifies output form jps contains pids and programs' name information.
+     * The function will discard any lines that come before the first line with pid.
+     * This can happen if the JVM outputs a warning message for some reason
+     * before running jps.
+     *
+     * The output can look like:
+     * 35536 Jstatd
+     * 35417 Main
+     * 31103 org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
+     */
+    private void verifyJpsOutput(OutputAnalyzer output) throws Exception {
+        output.shouldHaveExitValue(0);
+        assertFalse(output.getOutput().isEmpty(), "Output should not be empty");
+
+        boolean foundFirstLineWithPid = false;
+        String[] lines = output.getOutput().split(Utils.NEW_LINE);
+        for (String line : lines) {
+            if (!foundFirstLineWithPid) {
+                foundFirstLineWithPid = line.matches(JPS_OUTPUT_REGEX);
+                continue;
+            }
+            assertTrue(line.matches(JPS_OUTPUT_REGEX),
+                    "Output does not match the pattern" + Utils.NEW_LINE + line);
+        }
+        assertTrue(foundFirstLineWithPid, "Invalid output");
+    }
+
+    /**
+     * Depending on test settings command line can look like:
+     *
+     * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil pid@hostname 250 5
+     * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil pid@hostname:port 250 5
+     * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil pid@hostname/serverName 250 5
+     * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil pid@hostname:port/serverName 250 5
+     */
+    private OutputAnalyzer runJstat() throws Exception {
+        JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstat");
+        launcher.addVMArg("-XX:+UsePerfData");
+        launcher.addVMArg("-Duser.language=en");
+        launcher.addToolArg("-gcutil");
+        launcher.addToolArg(jstatdPid + "@" + getDestination());
+        launcher.addToolArg(Integer.toString(JSTAT_GCUTIL_INTERVAL_MS));
+        launcher.addToolArg(Integer.toString(JSTAT_GCUTIL_SAMPLES));
+
+        String[] cmd = launcher.getCommand();
+        log("Start jstat", cmd);
+
+        ProcessBuilder processBuilder = new ProcessBuilder(cmd);
+        OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
+        System.out.println(output.getOutput());
+
+        return output;
+    }
+
+    private void verifyJstatOutput(OutputAnalyzer output)
+            throws Exception {
+        output.shouldHaveExitValue(0);
+        assertFalse(output.getOutput().isEmpty(), "Output should not be empty");
+
+        JstatGCUtilParser gcUtilParser = new JstatGCUtilParser(
+                output.getOutput());
+        gcUtilParser.parse(JSTAT_GCUTIL_SAMPLES);
+    }
+
+    private void runToolsAndVerify() throws Exception {
+        OutputAnalyzer output = runJps();
+        verifyJpsOutput(output);
+
+        output = runJstat();
+        verifyJstatOutput(output);
+    }
+
+    private Registry startRegistry()
+            throws InterruptedException, RemoteException {
+        Registry registry = null;
+        try {
+            System.out.println("Start rmiregistry on port " + port);
+            registry = LocateRegistry
+                    .createRegistry(Integer.parseInt(port));
+        } catch (RemoteException e) {
+            if (e.getMessage().contains("Port already in use")) {
+                System.out.println("Port already in use. Trying to restart with a new one...");
+                Thread.sleep(100);
+                return null;
+            } else {
+                throw e;
+            }
+        }
+        return registry;
+    }
+
+    private void cleanUpThread(ProcessThread thread) throws Throwable {
+        if (thread != null) {
+            thread.stopProcess();
+            thread.joinAndThrow();
+        }
+    }
+
+    /**
+     * Depending on test settings command line can look like:
+     *
+     * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy
+     * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port
+     * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -n serverName
+     * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port -n serverName
+     */
+    private String[] getJstatdCmd() throws UnknownHostException {
+        JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd");
+        launcher.addVMArg("-XX:+UsePerfData");
+        String testSrc = System.getProperty("test.src");
+        File policy = new File(testSrc, "all.policy");
+        launcher.addVMArg("-Djava.security.policy=" + policy.getAbsolutePath());
+        if (port != null) {
+            launcher.addToolArg("-p");
+            launcher.addToolArg(port);
+        }
+        if (serverName != null) {
+            launcher.addToolArg("-n");
+            launcher.addToolArg(serverName);
+        }
+
+        String[] cmd = launcher.getCommand();
+        log("Start jstatd", cmd);
+        return cmd;
+    }
+
+    private ProcessThread tryToSetupJstatdProcess() throws Throwable {
+        ProcessThread jstatdThread = new ProcessThread("Jstatd-Thread",
+                getJstatdCmd());
+        try {
+            jstatdThread.start();
+            // Make sure jstatd is up and running
+            jstatdPid = waitOnTool("jstatd", jstatdThread);
+            if (jstatdPid == null) {
+                // The port is already in use. Cancel and try with new one.
+                jstatdThread.stopProcess();
+                jstatdThread.join();
+                return null;
+            }
+        } catch (Throwable t) {
+            // Something went wrong in the product - clean up!
+            cleanUpThread(jstatdThread);
+            throw t;
+        }
+
+        return jstatdThread;
+    }
+
+    public void doTest() throws Throwable {
+        ProcessThread jstatdThread = null;
+        try {
+            while (jstatdThread == null) {
+                if (!useDefaultPort || withExternalRegistry) {
+                    port = Integer.toString(Utils.getFreePort());
+                }
+
+                if (withExternalRegistry) {
+                    Registry registry = startRegistry();
+                    if (registry == null) {
+                        // The port is already in use. Cancel and try with new one.
+                        continue;
+                    }
+                }
+
+                jstatdThread = tryToSetupJstatdProcess();
+            }
+
+            runToolsAndVerify();
+        } finally {
+            cleanUpThread(jstatdThread);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jstatd/TestJstatdDefaults.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4990825
+ * @library /lib/testlibrary
+ * @build JstatdTest JstatGCUtilParser
+ * @run main/timeout=60 TestJstatdDefaults
+ */
+public class TestJstatdDefaults {
+
+    public static void main(String[] args) throws Throwable {
+        JstatdTest test = new JstatdTest();
+        test.doTest();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4990825 7092186
+ * @library /lib/testlibrary
+ * @build JstatdTest JstatGCUtilParser
+ * @run main/timeout=60 TestJstatdExternalRegistry
+ */
+public class TestJstatdExternalRegistry {
+
+    public static void main(String[] args) throws Throwable {
+        JstatdTest test = new JstatdTest();
+        test.setWithExternalRegistry(true);
+        test.doTest();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jstatd/TestJstatdPort.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4990825
+ * @library /lib/testlibrary
+ * @build JstatdTest JstatGCUtilParser
+ * @run main/timeout=60 TestJstatdPort
+ */
+public class TestJstatdPort {
+
+    public static void main(String[] args) throws Throwable {
+        JstatdTest test = new JstatdTest();
+        test.setUseDefaultPort(false);
+        test.doTest();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jstatd/TestJstatdPortAndServer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4990825
+ * @library /lib/testlibrary
+ * @build JstatdTest JstatGCUtilParser
+ * @run main/timeout=60 TestJstatdPortAndServer
+ */
+public class TestJstatdPortAndServer {
+
+    public static void main(String[] args) throws Throwable {
+        JstatdTest test = new JstatdTest();
+        test.setUseDefaultPort(false);
+        test.setServerName("TestJstatdServer");
+        test.doTest();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jstatd/TestJstatdServer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4990825
+ * @library /lib/testlibrary
+ * @build JstatdTest JstatGCUtilParser
+ * @run main/timeout=60 TestJstatdServer
+ */
+public class TestJstatdServer {
+
+    public static void main(String[] args) throws Throwable {
+        JstatdTest test = new JstatdTest();
+        test.setServerName("TestJstatdServer");
+        test.doTest();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jstatd/TestJstatdUsage.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.testlibrary.JDKToolLauncher;
+import jdk.testlibrary.OutputAnalyzer;
+
+/*
+ * @test
+ * @bug 4990825
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.JDKToolLauncher jdk.testlibrary.OutputAnalyzer
+ * @run main TestJstatdUsage
+ */
+public class TestJstatdUsage {
+
+    public static void main(String[] args) throws Exception {
+        testUsage("-help");
+        testUsage("-?");
+    }
+
+    private static void testUsage(String option) throws Exception {
+        JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd");
+        launcher.addToolArg(option);
+        ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
+        OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
+
+        output.shouldContain("usage: jstatd [-nr] [-p port] [-n rminame]");
+        output.shouldHaveExitValue(1);
+    }
+
+}
--- a/jdk/test/sun/tools/jstatd/jpsOutput1.awk	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#
-BEGIN	{
-	    totallines=0; matched=0
-	}
-
-/^[0-9]+ [a-z|A-Z][a-z|A-Z|0-9|\$|\.]*$/	{
-	    matched++;
-	}
-
-/^[0-9]+ -- .*$/	{
-	    matched++;
-	}
-
-/^[0-9]+ $/	{
-	    matched++;
-	}
-
-	{ totallines++; print $0 }
-
-END	{
-	    if ((totallines > 0) && (matched == totallines)) {
-	        exit 0
-	    }
-	    else {
-	        exit 1
-	    }
-	}
--- a/jdk/test/sun/tools/jstatd/jstatGcutilOutput1.awk	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#
-# matching the following output specified as a pattern that verifies
-# that the numerical values conform to a specific pattern, rather than
-# specific values.
-#
-#  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT     GCT   
-#  0.00 100.00  56.99   7.81  95.03  87.56      1    0.009     0    0.000    0.009
-#  0.00 100.00  63.64   7.81  95.03  87.56      1    0.009     0    0.000    0.009
-#  0.00 100.00  64.68   7.81  95.03  87.56      1    0.009     0    0.000    0.009
-#  0.00 100.00  65.73   7.81  95.03  87.56      1    0.009     0    0.000    0.009
-#  0.00 100.00  67.22   7.81  95.03  87.56      1    0.009     0    0.000    0.009
-
-BEGIN	{
-	    headerlines=0; datalines=0; totallines=0
-	}
-
-/^  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT     GCT   $/	{
-	    headerlines++;
-	}
-
-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*([0-9]+\.[0-9]+)|-[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/	{
-	    datalines++;
-	}
-
-	{ totallines++; print $0 }
-
-END	{
-	    if ((headerlines == 1) && (datalines == 5) && (totallines == 6)) {
-	        exit 0
-            }
-            else {
-	        exit 1
-            }
-	}
--- a/jdk/test/sun/tools/jstatd/jstatdDefaults.sh	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4990825
-# @run shell/timeout=60 jstatdDefaults.sh
-# @summary Test functionality of 'jstatd &'
-
-. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
-
-setup
-verify_os
-
-cleanup() {
-  kill_proc ${JSTATD_PID}
-}
-
-trap 'cleanup' 0 HUP INT QUIT TERM
-
-JSTATD="${TESTJAVA}/bin/jstatd"
-JPS="${TESTJAVA}/bin/jps"
-JSTAT="${TESTJAVA}/bin/jstat"
-
-HOSTNAME=`uname -n`
-
-JSTATD_OUT="jstatd_$$.out"
-
-${JSTATD} -J-XX:+UsePerfData -J-Djava.security.policy=${TESTSRC}/all.policy 2>&1 > ${JSTATD_OUT} &
-JSTATD_PID=$!
-
-echo "jstatd started as pid ${JSTATD_PID}"
-sleep 3
-
-${JPS} -J-XX:+UsePerfData ${HOSTNAME} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk
-
-if [ $? -ne 0 ]
-then
-    echo "Output of jps differs from expected output. Failed."
-    cleanup
-    exit 1
-fi
-
-${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_PID}@${HOSTNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
-RC=$?
-
-if [ ${RC} -ne 0 ]
-then
-    echo "jstat output differs from expected output"
-fi
-
-if [ -s ${JSTATD_OUT} ]
-then
-    echo "jstatd generated the following, unexpected output:"
-    RC=1
-fi
-
-cleanup
-
-exit ${RC}
--- a/jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4990825 7092186
-# @run shell/timeout=90 jstatdExternalRegistry.sh
-# @summary Test functionality of 'jstatd -p<port>&' with an external RMI registry
-
-. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
-
-setup
-verify_os
-
-cleanup() {
-  kill_proc ${RMIREGISTRY_PID}
-  kill_proc ${JSTATD_PID}
-}
-
-trap 'cleanup' 0 HUP INT QUIT TERM
-
-RMIREGISTRY="${TESTJAVA}/bin/rmiregistry"
-JSTATD="${TESTJAVA}/bin/jstatd"
-JPS="${TESTJAVA}/bin/jps"
-JSTAT="${TESTJAVA}/bin/jstat"
-
-HOSTNAME=`uname -n`
-PORT=`freePort`
-if [ "${PORT}" = "0" ] ; then
-  echo "Cannot get free port"
-  exit 1
-fi
-
-RMIREGISTRY_OUT="rmiregistry_$$.out"
-JSTATD_OUT="jstatd_$$.out"
-
-${RMIREGISTRY} -J-XX:+UsePerfData ${PORT} > ${RMIREGISTRY_OUT} 2>&1 &
-RMIREGISTRY_PID=$!
-
-echo "rmiregistry started on port ${PORT} as pid ${RMIREGISTRY_PID}"
-sleep 3
-
-${JSTATD} -J-XX:+UsePerfData -J-Djava.security.policy=${TESTSRC}/all.policy -p ${PORT} > ${JSTATD_OUT} 2>&1 &
-JSTATD_PID=$!
-
-echo "jstatd started as pid ${JSTATD_PID}"
-sleep 3
-
-${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk
-
-if [ $? -ne 0 ]
-then
-    echo "Output of jps differs from expected output. Failed."
-    exit 1
-fi
-
-${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
-RC=$?
-
-if [ ${RC} -ne 0 ]
-then
-    echo "jstat output differs from expected output"
-fi
-
-if [ -s ${JSTATD_OUT} ]
-then
-    echo "jstatd generated unexpected output: see ${JSTATD_OUT}"
-    RC=1
-fi
-
-if [ -s ${RMIREGISTRY_OUT} ]
-then
-    echo "rmiregistry generated unexpected output: see ${RMIREGISTRY_OUT}"
-    RC=1
-fi
-
-exit ${RC}
--- a/jdk/test/sun/tools/jstatd/jstatdPort.sh	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4990825
-# @run shell/timeout=60 jstatdPort.sh
-# @summary Test functionality of 'jstatd -p <port>&'
-
-. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
-
-setup
-verify_os
-
-cleanup() {
-  kill_proc ${JSTATD_PID}
-}
-
-trap 'cleanup' 0 HUP INT QUIT TERM
-
-JSTATD="${TESTJAVA}/bin/jstatd"
-JPS="${TESTJAVA}/bin/jps"
-JSTAT="${TESTJAVA}/bin/jstat"
-
-HOSTNAME=`uname -n`
-PORT=`freePort`
-if [ "${PORT}" = "0" ] ; then
-  echo "Cannot get free port"
-  exit 1
-fi
-
-JSTATD_OUT="jstatd_$$.out"
-
-${JSTATD} -J-XX:+UsePerfData -J-Djava.security.policy=${TESTSRC}/all.policy -p ${PORT} 2>&1 > ${JSTATD_OUT} &
-JSTATD_PID=$!
-
-echo "jstatd started as pid ${JSTATD_PID} on port ${PORT}"
-sleep 3
-
-${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT} 2>&1 | tee jps.out | awk -f ${TESTSRC}/jpsOutput1.awk
-
-if [ $? -ne 0 ]
-then
-    echo "Output of jps differs from expected output. Failed."
-    cleanup
-    exit 1
-fi
-
-${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
-RC=$?
-
-if [ ${RC} -ne 0 ]
-then
-    echo "jstat output differs from expected output"
-fi
-
-if [ -s ${JSTATD_OUT} ]
-then
-    echo "jstatd generated the following, unexpected output:"
-    RC=1
-fi
-
-cleanup
-
-exit ${RC}
--- a/jdk/test/sun/tools/jstatd/jstatdServerName.sh	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4990825
-# @run shell/timeout=90 jstatdServerName.sh
-# @summary Test functionality of 'jstatd -p <port> -n <servername>&'
-
-. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
-
-setup
-verify_os
-
-cleanup() {
-  kill_proc ${JSTATD_1_PID}
-  kill_proc ${JSTATD_2_PID}
-}
-
-trap 'cleanup' 0 HUP INT QUIT TERM
-
-JSTATD="${TESTJAVA}/bin/jstatd"
-JPS="${TESTJAVA}/bin/jps"
-JSTAT="${TESTJAVA}/bin/jstat"
-
-HOSTNAME=`uname -n`
-PORT_1=`freePort`
-if [ "${PORT_1}" = "0" ] ; then
-  echo "ERROR: No free port"
-  exit 1
-fi
-PORT_2=`expr ${PORT_1} '+' 1`
-SERVERNAME="SecondJstatdServer"
-
-JSTATD_1_OUT="jstatd_$$_1.out"
-JSTATD_2_OUT="jstatd_$$_2.out"
-
-${JSTATD} -J-XX:+UsePerfData -J-Djava.security.policy=${TESTSRC}/all.policy -p ${PORT_1} 2>&1 > ${JSTATD_1_OUT} &
-JSTATD_1_PID=$!
-
-echo "first jstatd started as pid ${JSTATD_1_PID} on port ${PORT_1} with default server name"
-sleep 3
-
-${JSTATD} -J-XX:+UsePerfData -J-Djava.security.policy=${TESTSRC}/all.policy -p ${PORT_2} -n ${SERVERNAME} 2>&1 > ${JSTATD_2_OUT} &
-JSTATD_2_PID=$!
-
-echo "second jstatd started as pid ${JSTATD_2_PID} on port ${PORT_2} with name ${SERVERNAME}"
-sleep 3
-
-echo "running: ${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT_1}"
-${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT_1} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk
-
-if [ $? -ne 0 ]
-then
-    echo "Output of jps differs from expected output. Failed."
-    cleanup
-    exit 1
-fi
-
-echo "running: ${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT_2}/${SERVERNAME}"
-${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT_2}/${SERVERNAME} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk
-
-if [ $? -ne 0 ]
-then
-    echo "Output of jps differs from expected output. Failed."
-    cleanup
-    exit 1
-fi
-
-echo "running: ${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5"
-${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
-RC=$?
-
-if [ ${RC} -ne 0 ]
-then
-    echo "jstat output differs from expected output"
-fi
-
-echo "running: ${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5"
-${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
-RC=$?
-
-if [ ${RC} -ne 0 ]
-then
-    echo "jstat output differs from expected output"
-fi
-
-if [ -s ${JSTATD_1_OUT} ]
-then
-    echo "first jstatd generated the following, unexpected output:"
-    RC=1
-fi
-
-if [ -s ${JSTATD_2_OUT} ]
-then
-    echo "second jstatd generated the following, unexpected output:"
-    RC=1
-fi
-
-cleanup
-
-exit ${RC}
--- a/jdk/test/sun/tools/jstatd/jstatdUsage1.sh	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-#
-# Copyright (c) 2004, 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.
-#
-
-# @test
-# @bug 4990825
-# @run shell jstatdUsage1.sh
-# @summary Test that output of 'jstatd -help' matches the usage.out file
-
-. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
-
-setup
-
-JSTATD="${TESTJAVA}/bin/jstatd"
-
-JSTATD_1_OUT="jstatd_$$_1.out"
-JSTATD_2_OUT="jstatd_$$_2.out"
-
-${JSTATD} -? > ${JSTATD_1_OUT} 2>&1
-
-diff -w ${JSTATD_1_OUT} ${TESTSRC}/usage.out
-if [ $? != 0 ]
-then
-  echo "Output of jstatd -? differs from expected output. Failed."
-  exit 1
-fi
-
-${JSTATD} -help > ${JSTATD_2_OUT} 2>&1
-
-diff -w ${JSTATD_2_OUT} ${TESTSRC}/usage.out
-if [ $? != 0 ]
-then
-  echo "Output of jstatd -help differs from expected output. Failed."
-  exit 1
-fi
-
-exit 0
--- a/jdk/test/sun/tools/jstatd/usage.out	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-usage: jstatd [-nr] [-p port] [-n rminame]
--- a/jdk/test/sun/util/resources/TimeZone/Bug6317929.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/sun/util/resources/TimeZone/Bug6317929.java	Wed Jul 05 19:21:26 2017 +0200
@@ -130,12 +130,12 @@
                                        "(New South Wales)\"");
         tzLocale = locales2Test[1];
         if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals
-           ("\u00d6stliche Normalzeit (New South Wales)"))
+           ("Eastern Normalzeit (Neus\u00fcdwales)"))
             throw new RuntimeException("\n" + tzLocale + ": LONG, " +
                                        "non-daylight saving name for " +
                                        "Australia/Currie should be " +
-                                       "\"\u00d6stliche Normalzeit " +
-                                       "(New South Wales)\"");
+                                       "\"Eastern Normalzeit " +
+                                       "(Neus\u00fcdwales)\"");
         tzLocale = locales2Test[2];
         if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals
            ("Hora est\u00e1ndar Oriental (Nueva Gales del Sur)"))
@@ -154,53 +154,53 @@
                                        "(Nouvelle-Galles du Sud)\"");
         tzLocale = locales2Test[4];
         if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals
-           ("Ora solare dell'Australia orientale (Nuovo Galles del Sud)"))
+           ("Ora standard dell'Australia orientale (Nuovo Galles del Sud)"))
             throw new RuntimeException("\n" + tzLocale + ": LONG, " +
                                        "non-daylight saving name for " +
                                        "Australia/Currie should be " +
-                                       "\"Ora solare dell'Australia orientale " +
+                                       "\"Ora standard dell'Australia orientale " +
                                        "(Nuovo Galles del Sud)\"");
         tzLocale = locales2Test[5];
         if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals
-           ("\u6771\u90e8\u6a19\u6e96\u6642 " +
-            "(\u30cb\u30e5\u30fc\u30b5\u30a6\u30b9\u30a6\u30a7\u30fc\u30eb\u30ba)"))
+           ("\u6771\u90E8\u6A19\u6E96\u6642" +
+            "(\u30CB\u30E5\u30FC\u30B5\u30A6\u30B9\u30A6\u30A7\u30FC\u30EB\u30BA)"))
             throw new RuntimeException("\n" + tzLocale + ": LONG, " +
                                        "non-daylight saving name for " +
                                        "Australia/Currie should be " +
-                                       "\"\u6771\u90e8\u6a19\u6e96\u6642 " +
-                                       "(\u30cb\u30e5\u30fc\u30b5\u30a6\u30b9" +
-                                       "\u30a6\u30a7\u30fc\u30eb\u30ba)\"");
+                                       "\"\u6771\u90E8\u6A19\u6E96\u6642" +
+                                       "(\u30CB\u30E5\u30FC\u30B5\u30A6\u30B9" +
+                                       "\u30A6\u30A7\u30FC\u30EB\u30BA)\"");
         tzLocale = locales2Test[6];
         if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals
-           ("\ub3d9\ubd80 \ud45c\uc900\uc2dc(\ub274 \uc0ac\uc6b0\uc2a4 \uc6e8\uc77c\uc988)"))
+           ("\uB3D9\uBD80 \uD45C\uC900\uC2DC(\uB274\uC0AC\uC6B0\uC2A4\uC6E8\uC77C\uC988)"))
             throw new RuntimeException("\n" + tzLocale + ": LONG, " +
                                        "non-daylight saving name for " +
                                        "Australia/Currie should be " +
-                                       "\"\ub3d9\ubd80 \ud45c\uc900\uc2dc" +
-                                       "(\ub274 \uc0ac\uc6b0\uc2a4 \uc6e8\uc77c\uc988)\"");
+                                       "\"\uB3D9\uBD80 \uD45C\uC900\uC2DC" +
+                                       "(\uB274\uC0AC\uC6B0\uC2A4\uC6E8\uC77C\uC988)\"");
         tzLocale = locales2Test[7];
         if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals
-           ("Eastern, normaltid (Nya Sydwales)"))
+           ("\u00D6stlig standardtid (New South Wales)"))
             throw new RuntimeException("\n" + tzLocale + ": LONG, " +
                                        "non-daylight saving name for " +
                                        "Australia/Currie should be " +
-                                       "\"Eastern, normaltid " +
-                                       "(Nya Sydwales)\"");
+                                       "\"\u00D6stlig standardtid " +
+                                       "(New South Wales)\"");
         tzLocale = locales2Test[8];
         if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals
-           ("\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4\uff08\u65b0\u5357\u5a01\u5c14\u65af\uff09"))
+           ("\u4E1C\u90E8\u6807\u51C6\u65F6\u95F4 (\u65B0\u5357\u5A01\u5C14\u65AF)"))
             throw new RuntimeException("\n" + tzLocale + ": LONG, " +
                                        "non-daylight saving name for " +
                                        "Australia/Currie should be " +
-                                       "\"\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4 " +
-                                       "\uff08\u65b0\u5357\u5a01\u5c14\u65af\uff09\"");
+                                       "\"\u4E1C\u90E8\u6807\u51C6\u65F6\u95F4 " +
+                                       "(\u65B0\u5357\u5A01\u5C14\u65AF)\"");
         tzLocale = locales2Test[9];
         if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals
-           ("\u6771\u65b9\u6a19\u6e96\u6642\u9593 (\u65b0\u5357\u5a01\u723e\u65af)"))
+           ("\u6771\u90E8\u6A19\u6E96\u6642\u9593 (\u65B0\u5357\u5A01\u723E\u65AF)"))
             throw new RuntimeException("\n" + tzLocale + ": LONG, " +
                                        "non-daylight saving name for " +
                                        "Australia/Currie should be " +
-                                       "\"\u6771\u65b9\u6a19\u6e96\u6642\u9593 " +
-                                       "(\u65b0\u5357\u5a01\u723e\u65af)\"");
+                                       "\"\u6771\u90E8\u6A19\u6E96\u6642\u9593 " +
+                                       "(\u65B0\u5357\u5A01\u723E\u65AF)\"");
    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/normalize/TestNormal.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @run main/timeout=600 TestNormal
+ * @bug 8020802
+ * @summary Need an ability to create jar files that are invariant to the pack200 packing/unpacking
+ * @author Alexander Zuev
+ */
+
+import java.io.*;
+import java.util.Collections;
+import java.util.Properties;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+public class TestNormal {
+    private static String FS = File.separator;
+
+    public static void main(String args[]) throws Exception {
+        Properties p = System.getProperties();
+        String java_home = p.getProperty("test.jdk");
+        String dtjar = java_home + File.separator + "lib"
+                + File.separator + "dt.jar";
+
+        File folder = new File("dt");
+        if (folder.exists()) {
+            delete(folder);
+        }
+        folder.mkdir();
+
+        try {
+            extractJar(new JarFile(dtjar), folder);
+            execJavaCommand(java_home, "jar cnf normalized.jar -C dt .");
+            execJavaCommand(java_home, "jar cf original.jar -C dt .");
+            execJavaCommand(java_home, "pack200 -r repacked.jar original.jar");
+            compareJars(new JarFile("normalized.jar"), new JarFile("repacked.jar"));
+        } finally {
+            String[] cleanupList = {"dt", "normalized.jar", "original.jar", "repacked.jar"};
+            for (String s : cleanupList) {
+                delete(new File(s));
+            }
+        }
+    }
+
+    public static void execJavaCommand(String java_home, String cmd) throws Exception {
+        Process proc = Runtime.getRuntime().exec(java_home + FS + "bin" + FS + cmd);
+        String s;
+        BufferedReader stdInput =
+                new BufferedReader(new InputStreamReader(proc.getInputStream()));
+        BufferedReader stdError =
+                new BufferedReader(new InputStreamReader(proc.getErrorStream()));
+        while ((s = stdInput.readLine()) != null) {
+            System.out.println(s);
+        }
+        while ((s = stdError.readLine()) != null) {
+            System.err.println(s);
+        }
+    }
+
+    public static void compareJars(JarFile jf1, JarFile jf2) throws Exception {
+        try {
+            if (jf1.size() != jf2.size()) {
+                throw new Exception("Jars " + jf1.getName() + " and " + jf2.getName()
+                        + " have different number of entries");
+            }
+            for (JarEntry elem1 : Collections.list(jf1.entries())) {
+                JarEntry elem2 = jf2.getJarEntry(elem1.getName());
+                if (elem2 == null) {
+                    throw new Exception("Element " + elem1.getName() + " is missing from " + jf2.getName());
+                }
+                if (!elem1.isDirectory() && elem1.getCrc() != elem2.getCrc()) {
+                    throw new Exception("The crc of " + elem1.getName() + " is different.");
+                }
+            }
+        } finally {
+            jf1.close();
+            jf2.close();
+        }
+    }
+
+    public static void extractJar(JarFile jf, File where) throws Exception {
+        for (JarEntry file : Collections.list(jf.entries())) {
+            File out = new File(where, file.getName());
+            if (file.isDirectory()) {
+                out.mkdirs();
+                continue;
+            }
+            File parent = out.getParentFile();
+            if (parent != null && !parent.exists()) {
+                parent.mkdirs();
+            }
+            InputStream is = null;
+            OutputStream os = null;
+            try {
+                is = jf.getInputStream(file);
+                os = new FileOutputStream(out);
+                while (is.available() > 0) {
+                    os.write(is.read());
+                }
+            } finally {
+                if (is != null) {
+                    is.close();
+                }
+                if (os != null) {
+                    os.close();
+                }
+            }
+        }
+    }
+
+    static void delete(File f) throws IOException {
+        if (!f.exists()) {
+            return;
+        }
+        if (f.isDirectory()) {
+            for (File c : f.listFiles()) {
+                delete(c);
+            }
+        }
+        if (!f.delete()) {
+            throw new FileNotFoundException("Failed to delete file: " + f);
+        }
+    }
+}
--- a/jdk/test/tools/launcher/VersionCheck.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/jdk/test/tools/launcher/VersionCheck.java	Wed Jul 05 19:21:26 2017 +0200
@@ -50,6 +50,7 @@
         "javaws",
         "jcontrol",
         "jmc",
+        "jmc.ini",
         "jvisualvm",
         "packager",
         "unpack200",
@@ -74,6 +75,7 @@
         "jinfo",
         "jmap",
         "jmc",
+        "jmc.ini",
         "jps",
         "jrunscript",
         "jjs",
--- a/nashorn/.hgtags	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/.hgtags	Wed Jul 05 19:21:26 2017 +0200
@@ -223,3 +223,4 @@
 75fd3486e584f20475c064a2cd4d01ac6406a511 jdk8-b111
 6a4fdb3bb4e34af4c5bb8db467bb01e13b1a7e31 jdk8-b112
 676cd7bf5e092356f7ee2116c8cf88cdc12377c7 jdk8-b113
+79f7b79bf97b71c9b5c9b103dbdef5f269eeb86d jdk8-b114
--- a/nashorn/make/build.xml	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/make/build.xml	Wed Jul 05 19:21:26 2017 +0200
@@ -46,6 +46,16 @@
     <available property="asm.available" classname="jdk.internal.org.objectweb.asm.Type"/>
     <!-- check if testng.jar is avaiable -->
     <available property="testng.available" file="${file.reference.testng.jar}"/>
+    <!-- check if Jemmy ang testng.jar are avaiable -->
+    <condition property="jemmy.jfx.testng.available" value="true">
+      <and> 
+        <available file="${file.reference.jemmyfx.jar}"/>
+        <available file="${file.reference.jemmycore.jar}"/>
+        <available file="${file.reference.jemmyawtinput.jar}"/>
+        <available file="${file.reference.jfxrt.jar}"/>
+        <isset property="testng.available"/>
+      </and>
+    </condition>
 
     <!-- enable/disable make code coverage -->
     <condition property="cc.enabled">
@@ -351,6 +361,31 @@
       </java>
   </target>
 
+  <target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available">
+    <echo message="WARNING: Jemmy or JavaFX or TestNG not available, will not run tests. Please copy testng.jar, JemmyCore.jar, JemmyFX.jar, JemmyAWTInput.jar under test${file.separator}lib directory. And make sure you have jfxrt.jar in ${java.home}${file.separator}lib${file.separator}ext dir."/>
+  </target>
+
+  <target name="testjfx" depends="jar, check-jemmy.jfx.testng, compile-test" if="jemmy.jfx.testng.available">
+    <fileset id="test.classes" dir="${build.test.classes.dir}">
+       <include name="**/framework/*Test.class"/>
+    </fileset>
+    
+    <copy file="${file.reference.jfxrt.jar}" todir="dist"/>
+    
+    <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}"/>
+      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
+      <propertyset>
+        <propertyref prefix="testjfx-test-sys-prop."/>
+        <mapper from="testjfx-test-sys-prop.*" to="*" type="glob"/>
+      </propertyset>
+      <classpath>
+          <pathelement path="${testjfx.run.test.classpath}"/>
+      </classpath>
+    </testng>
+  </target>
+  
   <target name="test262" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
     <fileset id="test.classes" dir="${build.test.classes.dir}">
        <include name="**/framework/*Test.class"/>
--- a/nashorn/make/project.properties	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/make/project.properties	Wed Jul 05 19:21:26 2017 +0200
@@ -118,6 +118,7 @@
 test.external.dir=test/script/external
 test262.dir=${test.external.dir}/test262
 test262.suite.dir=${test262.dir}/test/suite
+testjfx.dir=${test.script.dir}/jfx
 
 test-sys-prop.test.dir=${test.dir}
 test-sys-prop.test.js.roots=${test.basic.dir} ${test.error.dir} ${test.sandbox.dir} ${test.trusted.dir}
@@ -208,6 +209,32 @@
     ${test262.dir}/test/harness/framework.js \
     ${test262.dir}/test/harness/sta.js
 
+# testjfx test root
+testjfx-test-sys-prop.test.js.roots=${testjfx.dir}   
+
+# execute testjfx tests in shared nashorn context or not?
+testjfx-test-sys-prop.test.js.shared.context=false
+
+# framework root for our script tests
+testjfx-test-sys-prop.test.js.framework=\
+    -fx \
+    ${test.script.dir}${file.separator}jfx.js
+
+file.reference.jemmyfx.jar=test${file.separator}lib${file.separator}JemmyFX.jar
+file.reference.jemmycore.jar=test${file.separator}lib${file.separator}JemmyCore.jar
+file.reference.jemmyawtinput.jar=test${file.separator}lib${file.separator}JemmyAWTInput.jar
+file.reference.jfxrt.jar=${java.home}${file.separator}lib${file.separator}ext${file.separator}jfxrt.jar
+testjfx.run.test.classpath=\
+    ${file.reference.jemmyfx.jar}${path.separator}\
+    ${file.reference.jemmycore.jar}${path.separator}\
+    ${file.reference.jemmyawtinput.jar}${path.separator}\
+    ${file.reference.testng.jar}${path.separator}\
+    ${nashorn.internal.tests.jar}${path.separator}\
+    ${nashorn.api.tests.jar}    
+
+# testjfx VM options for script tests with @fork option
+testjfx-test-sys-prop.test.fork.jvm.options=${run.test.jvmargs.main} -Xmx${run.test.xmx} -cp ${testjfx.run.test.classpath}
+
 run.test.classpath=\
     ${file.reference.testng.jar}:\
     ${nashorn.internal.tests.jar}:\
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/api/scripting/AbstractJSObject.java	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,254 @@
+/*
+ * 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.  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 jdk.nashorn.api.scripting;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * This is the base class for nashorn ScriptObjectMirror class.
+ *
+ * This class can also be subclassed by an arbitrary Java class. Nashorn will
+ * treat objects of such classes just like nashorn script objects. Usual nashorn
+ * operations like obj[i], obj.foo, obj.func(), delete obj.foo will be glued
+ * to appropriate method call of this class.
+ */
+public abstract class AbstractJSObject implements JSObject {
+    /**
+     * Call this object as a JavaScript function. This is equivalent to
+     * 'func.apply(thiz, args)' in JavaScript.
+     *
+     * @param thiz 'this' object to be passed to the function
+     * @param args arguments to method
+     * @return result of call
+     */
+    @Override
+    public Object call(final Object thiz, final Object... args) {
+        throw new UnsupportedOperationException("call");
+    }
+
+    /**
+     * Call this 'constructor' JavaScript function to create a new object.
+     * This is equivalent to 'new func(arg1, arg2...)' in JavaScript.
+     *
+     * @param args arguments to method
+     * @return result of constructor call
+     */
+    @Override
+    public Object newObject(final Object... args) {
+        throw new UnsupportedOperationException("newObject");
+    }
+
+    /**
+     * Evaluate a JavaScript expression.
+     *
+     * @param s JavaScript expression to evaluate
+     * @return evaluation result
+     */
+    @Override
+    public Object eval(final String s) {
+        throw new UnsupportedOperationException("eval");
+    }
+
+    /**
+     * Retrieves a named member of this JavaScript object.
+     *
+     * @param name of member
+     * @return member
+     */
+    @Override
+    public Object getMember(final String name) {
+        return null;
+    }
+
+    /**
+     * Retrieves an indexed member of this JavaScript object.
+     *
+     * @param index index slot to retrieve
+     * @return member
+     */
+    @Override
+    public Object getSlot(final int index) {
+        return null;
+    }
+
+    /**
+     * Does this object have a named member?
+     *
+     * @param name name of member
+     * @return true if this object has a member of the given name
+     */
+    @Override
+    public boolean hasMember(final String name) {
+        return false;
+    }
+
+    /**
+     * Does this object have a indexed property?
+     *
+     * @param slot index to check
+     * @return true if this object has a slot
+     */
+    @Override
+    public boolean hasSlot(final int slot) {
+        return false;
+    }
+
+    /**
+     * Remove a named member from this JavaScript object
+     *
+     * @param name name of the member
+     */
+    @Override
+    public void removeMember(final String name) {
+        //empty
+    }
+
+    /**
+     * Set a named member in this JavaScript object
+     *
+     * @param name  name of the member
+     * @param value value of the member
+     */
+    @Override
+    public void setMember(final String name, final Object value) {
+        //empty
+    }
+
+    /**
+     * Set an indexed member in this JavaScript object
+     *
+     * @param index index of the member slot
+     * @param value value of the member
+     */
+    @Override
+    public void setSlot(final int index, final Object value) {
+        //empty
+    }
+
+    // property and value iteration
+
+    /**
+     * Returns the set of all property names of this object.
+     *
+     * @return set of property names
+     */
+    @Override
+    @SuppressWarnings("unchecked")
+    public Set<String> keySet() {
+        return Collections.EMPTY_SET;
+    }
+
+    /**
+     * Returns the set of all property values of this object.
+     *
+     * @return set of property values.
+     */
+    @Override
+    @SuppressWarnings("unchecked")
+    public Collection<Object> values() {
+        return Collections.EMPTY_SET;
+    }
+
+    // JavaScript instanceof check
+
+    /**
+     * Checking whether the given object is an instance of 'this' object.
+     *
+     * @param instance instace to check
+     * @return true if the given 'instance' is an instance of this 'function' object
+     */
+    @Override
+    public boolean isInstance(final Object instance) {
+        return false;
+    }
+
+    /**
+     * Checking whether this object is an instance of the given 'clazz' object.
+     *
+     * @param clazz clazz to check
+     * @return true if this object is an instance of the given 'clazz'
+     */
+    @Override
+    public boolean isInstanceOf(final Object clazz) {
+        if (clazz instanceof JSObject) {
+            return ((JSObject)clazz).isInstance(this);
+        }
+
+        return false;
+    }
+
+    /**
+     * ECMA [[Class]] property
+     *
+     * @return ECMA [[Class]] property value of this object
+     */
+    @Override
+    public String getClassName() {
+        return getClass().getName();
+    }
+
+    /**
+     * Is this a function object?
+     *
+     * @return if this mirror wraps a ECMAScript function instance
+     */
+    @Override
+    public boolean isFunction() {
+        return false;
+    }
+
+    /**
+     * Is this a 'use strict' function object?
+     *
+     * @return true if this mirror represents a ECMAScript 'use strict' function
+     */
+    @Override
+    public boolean isStrictFunction() {
+        return false;
+    }
+
+    /**
+     * Is this an array object?
+     *
+     * @return if this mirror wraps a ECMAScript array object
+     */
+    @Override
+    public boolean isArray() {
+        return false;
+    }
+
+    /**
+     * Returns this object's numeric value.
+     *
+     * @return this object's numeric value.
+     */
+    @Override
+    public double toNumber() {
+        return Double.NaN;
+    }
+}
--- a/nashorn/src/jdk/nashorn/api/scripting/JSObject.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/api/scripting/JSObject.java	Wed Jul 05 19:21:26 2017 +0200
@@ -30,14 +30,12 @@
 import java.util.Set;
 
 /**
- * This is the base class for nashorn ScriptObjectMirror class.
- *
- * This class can also be subclassed by an arbitrary Java class. Nashorn will
+ * This interface can be implemented by an arbitrary Java class. Nashorn will
  * treat objects of such classes just like nashorn script objects. Usual nashorn
  * operations like obj[i], obj.foo, obj.func(), delete obj.foo will be glued
- * to appropriate method call of this class.
+ * to appropriate method call of this interface.
  */
-public abstract class JSObject {
+public interface JSObject {
     /**
      * Call this object as a JavaScript function. This is equivalent to
      * 'func.apply(thiz, args)' in JavaScript.
@@ -46,9 +44,7 @@
      * @param args arguments to method
      * @return result of call
      */
-    public Object call(final Object thiz, final Object... args) {
-        throw new UnsupportedOperationException("call");
-    }
+    public Object call(final Object thiz, final Object... args);
 
     /**
      * Call this 'constructor' JavaScript function to create a new object.
@@ -57,9 +53,7 @@
      * @param args arguments to method
      * @return result of constructor call
      */
-    public Object newObject(final Object... args) {
-        throw new UnsupportedOperationException("newObject");
-    }
+    public Object newObject(final Object... args);
 
     /**
      * Evaluate a JavaScript expression.
@@ -67,20 +61,7 @@
      * @param s JavaScript expression to evaluate
      * @return evaluation result
      */
-    public Object eval(final String s) {
-        throw new UnsupportedOperationException("eval");
-    }
-
-    /**
-     * Call a JavaScript function member of this object.
-     *
-     * @param name name of the member function to call
-     * @param args arguments to be passed to the member function
-     * @return result of call
-     */
-    public Object callMember(final String name, final Object... args) {
-        throw new UnsupportedOperationException("call");
-    }
+    public Object eval(final String s);
 
     /**
      * Retrieves a named member of this JavaScript object.
@@ -88,9 +69,7 @@
      * @param name of member
      * @return member
      */
-    public Object getMember(final String name) {
-        return null;
-    }
+    public Object getMember(final String name);
 
     /**
      * Retrieves an indexed member of this JavaScript object.
@@ -98,9 +77,7 @@
      * @param index index slot to retrieve
      * @return member
      */
-    public Object getSlot(final int index) {
-        return null;
-    }
+    public Object getSlot(final int index);
 
     /**
      * Does this object have a named member?
@@ -108,9 +85,7 @@
      * @param name name of member
      * @return true if this object has a member of the given name
      */
-    public boolean hasMember(final String name) {
-        return false;
-    }
+    public boolean hasMember(final String name);
 
     /**
      * Does this object have a indexed property?
@@ -118,18 +93,14 @@
      * @param slot index to check
      * @return true if this object has a slot
      */
-    public boolean hasSlot(final int slot) {
-        return false;
-    }
+    public boolean hasSlot(final int slot);
 
     /**
      * Remove a named member from this JavaScript object
      *
      * @param name name of the member
      */
-    public void removeMember(final String name) {
-        //empty
-    }
+    public void removeMember(final String name);
 
     /**
      * Set a named member in this JavaScript object
@@ -137,9 +108,7 @@
      * @param name  name of the member
      * @param value value of the member
      */
-    public void setMember(final String name, final Object value) {
-        //empty
-    }
+    public void setMember(final String name, final Object value);
 
     /**
      * Set an indexed member in this JavaScript object
@@ -147,9 +116,7 @@
      * @param index index of the member slot
      * @param value value of the member
      */
-    public void setSlot(final int index, final Object value) {
-        //empty
-    }
+    public void setSlot(final int index, final Object value);
 
     // property and value iteration
 
@@ -158,20 +125,14 @@
      *
      * @return set of property names
      */
-    @SuppressWarnings("unchecked")
-    public Set<String> keySet() {
-        return Collections.EMPTY_SET;
-    }
+    public Set<String> keySet();
 
     /**
      * Returns the set of all property values of this object.
      *
      * @return set of property values.
      */
-    @SuppressWarnings("unchecked")
-    public Collection<Object> values() {
-        return Collections.EMPTY_SET;
-    }
+    public Collection<Object> values();
 
     // JavaScript instanceof check
 
@@ -181,9 +142,7 @@
      * @param instance instace to check
      * @return true if the given 'instance' is an instance of this 'function' object
      */
-    public boolean isInstance(final Object instance) {
-        return false;
-    }
+    public boolean isInstance(final Object instance);
 
     /**
      * Checking whether this object is an instance of the given 'clazz' object.
@@ -191,47 +150,40 @@
      * @param clazz clazz to check
      * @return true if this object is an instance of the given 'clazz'
      */
-    public boolean isInstanceOf(final Object clazz) {
-        if (clazz instanceof JSObject) {
-            return ((JSObject)clazz).isInstance(this);
-        }
-
-        return false;
-    }
+    public boolean isInstanceOf(final Object clazz);
 
     /**
      * ECMA [[Class]] property
      *
      * @return ECMA [[Class]] property value of this object
      */
-    public String getClassName() {
-        return getClass().getName();
-    }
+    public String getClassName();
 
     /**
      * Is this a function object?
      *
      * @return if this mirror wraps a ECMAScript function instance
      */
-    public boolean isFunction() {
-        return false;
-    }
+    public boolean isFunction();
 
     /**
      * Is this a 'use strict' function object?
      *
      * @return true if this mirror represents a ECMAScript 'use strict' function
      */
-    public boolean isStrictFunction() {
-        return false;
-    }
+    public boolean isStrictFunction();
 
     /**
      * Is this an array object?
      *
      * @return if this mirror wraps a ECMAScript array object
      */
-    public boolean isArray() {
-        return false;
-    }
+    public boolean isArray();
+
+    /**
+     * Returns this object's numeric value.
+     *
+     * @return this object's numeric value.
+     */
+    public double toNumber();
 }
--- a/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Wed Jul 05 19:21:26 2017 +0200
@@ -43,6 +43,7 @@
 import javax.script.Bindings;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.GlobalObject;
+import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
@@ -50,7 +51,7 @@
 /**
  * Mirror object that wraps a given Nashorn Script object.
  */
-public final class ScriptObjectMirror extends JSObject implements Bindings {
+public final class ScriptObjectMirror extends AbstractJSObject implements Bindings {
     private static AccessControlContext getContextAccCtxt() {
         final Permissions perms = new Permissions();
         perms.add(new RuntimePermission(Context.NASHORN_GET_CONTEXT));
@@ -161,7 +162,6 @@
         });
     }
 
-    @Override
     public Object callMember(final String functionName, final Object... args) {
         functionName.getClass(); // null check
         final ScriptObject oldGlobal = Context.getGlobal();
@@ -705,4 +705,13 @@
             }
         }
     }
+
+    @Override
+    public double toNumber() {
+        return inGlobal(new Callable<Double>() {
+            @Override public Double call() {
+                return JSType.toNumber(sobj);
+            }
+        });
+    }
 }
--- a/nashorn/src/jdk/nashorn/internal/codegen/BranchOptimizer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/codegen/BranchOptimizer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -72,8 +72,7 @@
         }
 
         // convert to boolean
-        codegen.load(unaryNode);
-        method.convert(Type.BOOLEAN);
+        codegen.load(unaryNode, Type.BOOLEAN);
         if (state) {
             method.ifne(label);
         } else {
@@ -146,8 +145,7 @@
             break;
         }
 
-        codegen.load(binaryNode);
-        method.convert(Type.BOOLEAN);
+        codegen.load(binaryNode, Type.BOOLEAN);
         if (state) {
             method.ifne(label);
         } else {
@@ -169,8 +167,7 @@
             }
         }
 
-        codegen.load(node);
-        method.convert(Type.BOOLEAN);
+        codegen.load(node, Type.BOOLEAN);
         if (state) {
             method.ifne(label);
         } else {
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -359,8 +359,11 @@
         return load(node, node.hasType() ? node.getType() : null, false);
     }
 
-    private static boolean safeLiteral(final Expression rhs) {
-        return rhs instanceof LiteralNode && !(rhs instanceof ArrayLiteralNode);
+    // Test whether conversion from source to target involves a call of ES 9.1 ToPrimitive
+    // with possible side effects from calling an object's toString or valueOf methods.
+    private boolean noToPrimitiveConversion(final Type source, final Type target) {
+        // Object to boolean conversion does not cause ToPrimitive call
+        return source.isJSPrimitive() || !target.isJSPrimitive() || target.isBoolean();
     }
 
     MethodEmitter loadBinaryOperands(final Expression lhs, final Expression rhs, final Type type) {
@@ -374,25 +377,19 @@
         // can combine a LOAD with a CONVERT operation (e.g. use a dynamic getter with the conversion target type as its
         // return value). What we do here is reorder LOAD RIGHT and CONVERT LEFT when possible; it is possible only when
         // we can prove that executing CONVERT LEFT can't have a side effect that changes the value of LOAD RIGHT.
-        // Basically, if we know that either LEFT is not an object, or RIGHT is a constant literal, then we can do the
+        // Basically, if we know that either LEFT already is a primitive value, or does not have to be converted to
+        // a primitive value, or RIGHT is an expression that loads without side effects, then we can do the
         // reordering and collapse LOAD/CONVERT into a single operation; otherwise we need to do the more costly
         // separate operations to preserve specification semantics.
-        final Type lhsType = lhs.getType();
-        if (lhsType.isObject() && !safeLiteral(rhs)) {
-            // Can't reorder. Load and convert separately.
-            load(lhs, lhsType, baseAlreadyOnStack);
-            load(rhs, rhs.getType(), false);
-            // Avoid empty SWAP, SWAP bytecode sequence if CONVERT LEFT is a no-op
-            if (!lhsType.isEquivalentTo(type)) {
-                method.swap();
-                method.convert(type);
-                method.swap();
-            }
-            method.convert(type);
-        } else {
+        if (noToPrimitiveConversion(lhs.getType(), type) || rhs.isLocal()) {
             // Can reorder. Combine load and convert into single operations.
             load(lhs, type, baseAlreadyOnStack);
             load(rhs, type, false);
+        } else {
+            // Can't reorder. Load and convert separately.
+            load(lhs, lhs.getType(), baseAlreadyOnStack);
+            load(rhs, rhs.getType(), false);
+            method.swap().convert(type).swap().convert(type);
         }
 
         return method;
@@ -402,7 +399,7 @@
         return loadBinaryOperands(node.lhs(), node.rhs(), node.getType(), false);
     }
 
-    private MethodEmitter load(final Expression node, final Type type) {
+    MethodEmitter load(final Expression node, final Type type) {
         return load(node, type, false);
     }
 
@@ -432,7 +429,7 @@
             @Override
             public boolean enterAccessNode(final AccessNode accessNode) {
                 if (!baseAlreadyOnStack) {
-                    load(accessNode.getBase()).convert(Type.OBJECT);
+                    load(accessNode.getBase(), Type.OBJECT);
                 }
                 assert method.peekType().isObject();
                 method.dynamicGet(type, accessNode.getProperty().getName(), getCallSiteFlags(), accessNode.isFunction());
@@ -442,7 +439,7 @@
             @Override
             public boolean enterIndexNode(final IndexNode indexNode) {
                 if (!baseAlreadyOnStack) {
-                    load(indexNode.getBase()).convert(Type.OBJECT);
+                    load(indexNode.getBase(), Type.OBJECT);
                     load(indexNode.getIndex());
                 }
                 method.dynamicGetIndex(type, getCallSiteFlags(), indexNode.isFunction());
@@ -632,11 +629,13 @@
         final Type[] params = signature == null ? null : Type.getMethodArguments(signature);
         for (final Expression arg : args) {
             assert arg != null;
-            load(arg);
             if (n >= argCount) {
+                load(arg);
                 method.pop(); // we had to load the arg for its side effects
             } else if (params != null) {
-                method.convert(params[n]);
+                load(arg, params[n]);
+            } else {
+                load(arg);
             }
             n++;
         }
@@ -707,6 +706,12 @@
                 final CallNode.EvalArgs evalArgs = callNode.getEvalArgs();
                 // load evaluated code
                 load(evalArgs.getCode(), Type.OBJECT);
+                // load second and subsequent args for side-effect
+                final List<Expression> args = callNode.getArgs();
+                final int numArgs = args.size();
+                for (int i = 1; i < numArgs; i++) {
+                    load(args.get(i)).pop();
+                }
                 // special/extra 'eval' arguments
                 load(evalArgs.getThis());
                 method.load(evalArgs.getLocation());
@@ -1277,7 +1282,7 @@
         for (int i = 0; i < args.size(); i++) {
             method.dup();
             method.load(i);
-            load(args.get(i)).convert(Type.OBJECT); //has to be upcast to object or we fail
+            load(args.get(i), Type.OBJECT); //has to be upcast to object or we fail
             method.arraystore();
         }
 
@@ -1719,7 +1724,7 @@
         }
 
         for (final Expression arg : args) {
-            load(arg).convert(Type.OBJECT);
+            load(arg, Type.OBJECT);
         }
 
         method.invokestatic(
@@ -2105,7 +2110,7 @@
 
             if (exceptionCondition != null) {
                 next = new Label("next");
-                load(exceptionCondition).convert(Type.BOOLEAN).ifeq(next);
+                load(exceptionCondition, Type.BOOLEAN).ifeq(next);
             } else {
                 next = null;
             }
@@ -2352,7 +2357,7 @@
         final List<Expression> args   = callNode.getArgs();
 
         // Load function reference.
-        load(callNode.getFunction()).convert(Type.OBJECT); // must detect type error
+        load(callNode.getFunction(), Type.OBJECT); // must detect type error
 
         method.dynamicNew(1 + loadArgs(args), getCallSiteFlags());
         method.store(unaryNode.getSymbol());
@@ -2383,7 +2388,7 @@
     @Override
     public boolean enterSUB(final UnaryNode unaryNode) {
         assert unaryNode.getType().isNumeric();
-        load(unaryNode.rhs()).convert(unaryNode.getType()).neg().store(unaryNode.getSymbol());
+        load(unaryNode.rhs(), unaryNode.getType()).neg().store(unaryNode.getSymbol());
         return false;
     }
 
@@ -2424,7 +2429,7 @@
 
         final Label skip = new Label("skip");
 
-        load(lhs).convert(Type.OBJECT).dup().convert(Type.BOOLEAN);
+        load(lhs, Type.OBJECT).dup().convert(Type.BOOLEAN);
 
         if (binaryNode.tokenType() == TokenType.AND) {
             method.ifeq(skip);
@@ -2433,7 +2438,7 @@
         }
 
         method.pop();
-        load(rhs).convert(Type.OBJECT);
+        load(rhs, Type.OBJECT);
         method.label(skip);
         method.store(binaryNode.getSymbol());
 
--- a/nashorn/src/jdk/nashorn/internal/codegen/Lower.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Lower.java	Wed Jul 05 19:21:26 2017 +0200
@@ -88,12 +88,12 @@
     private static final DebugLogger LOG = new DebugLogger("lower");
 
     // needed only to get unique eval id
-    private final CodeInstaller installer;
+    private final CodeInstaller<?> installer;
 
     /**
      * Constructor.
      */
-    Lower(final CodeInstaller installer) {
+    Lower(final CodeInstaller<?> installer) {
         super(new BlockLexicalContext() {
 
             @Override
--- a/nashorn/src/jdk/nashorn/internal/codegen/SpillObjectCreator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/codegen/SpillObjectCreator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -32,7 +32,6 @@
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
-
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.Expression;
 import jdk.nashorn.internal.ir.LiteralNode;
@@ -143,7 +142,7 @@
                 method.dup();
                 method.getField(Type.getInternalName(ScriptObject.class), "spill", Type.OBJECT_ARRAY.getDescriptor());
                 method.load(property.getSlot());
-                codegen.load(values.get(i)).convert(OBJECT);
+                codegen.load(values.get(i), OBJECT);
                 method.arraystore();
             }
         }
--- a/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java	Wed Jul 05 19:21:26 2017 +0200
@@ -292,6 +292,16 @@
     }
 
     /**
+     * Determines whether this type represents an primitive type according to the ECMAScript specification,
+     * which includes Boolean, Number, and String.
+     *
+     * @return true if a JavaScript primitive type, false otherwise.
+     */
+    public boolean isJSPrimitive() {
+        return !isObject() || isString();
+    }
+
+    /**
      * Determines whether a type is the BOOLEAN type
      * @return true if BOOLEAN, false otherwise
      */
@@ -443,7 +453,7 @@
         } else if (type0.isArray() != type1.isArray()) {
             //array and non array is always object, widest(Object[], int) NEVER returns Object[], which has most weight. that does not make sense
             return Type.OBJECT;
-        } else if (type0.isObject() && type1.isObject() && ((ObjectType)type0).getTypeClass() != ((ObjectType)type1).getTypeClass()) {
+        } else if (type0.isObject() && type1.isObject() && type0.getTypeClass() != type1.getTypeClass()) {
             // Object<type=String> and Object<type=ScriptFunction> will produce Object
             // TODO: maybe find most specific common superclass?
             return Type.OBJECT;
--- a/nashorn/src/jdk/nashorn/internal/ir/BinaryNode.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/ir/BinaryNode.java	Wed Jul 05 19:21:26 2017 +0200
@@ -90,6 +90,9 @@
             return Type.LONG;
         case ASSIGN_SAR:
         case ASSIGN_SHL:
+        case BIT_AND:
+        case BIT_OR:
+        case BIT_XOR:
         case ASSIGN_BIT_AND:
         case ASSIGN_BIT_OR:
         case ASSIGN_BIT_XOR:
@@ -170,6 +173,42 @@
     }
 
     @Override
+    public boolean isLocal() {
+        switch (tokenType()) {
+        case SAR:
+        case SHL:
+        case SHR:
+        case BIT_AND:
+        case BIT_OR:
+        case BIT_XOR:
+        case ADD:
+        case DIV:
+        case MOD:
+        case MUL:
+        case SUB:
+            return lhs.isLocal() && lhs.getType().isJSPrimitive()
+                && rhs.isLocal() && rhs.getType().isJSPrimitive();
+        case ASSIGN_ADD:
+        case ASSIGN_BIT_AND:
+        case ASSIGN_BIT_OR:
+        case ASSIGN_BIT_XOR:
+        case ASSIGN_DIV:
+        case ASSIGN_MOD:
+        case ASSIGN_MUL:
+        case ASSIGN_SAR:
+        case ASSIGN_SHL:
+        case ASSIGN_SHR:
+        case ASSIGN_SUB:
+            return lhs instanceof IdentNode && lhs.isLocal() && lhs.getType().isJSPrimitive()
+                    && rhs.isLocal() && rhs.getType().isJSPrimitive();
+        case ASSIGN:
+            return lhs instanceof IdentNode && lhs.isLocal() && rhs.isLocal();
+        default:
+            return false;
+        }
+    }
+
+    @Override
     public void toString(final StringBuilder sb) {
         final TokenType type = tokenType();
 
--- a/nashorn/src/jdk/nashorn/internal/ir/Expression.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/ir/Expression.java	Wed Jul 05 19:21:26 2017 +0200
@@ -96,4 +96,16 @@
         assert hasType() : this + " has no type";
         return symbol.getSymbolType();
     }
+
+    /**
+     * Returns {@code true} if this expression depends exclusively on state that is constant
+     * or local to the currently running function and thus inaccessible to other functions.
+     * This implies that a local expression must not call any other functions (neither directly
+     * nor implicitly through a getter, setter, or object-to-primitive type conversion).
+     *
+     * @return true if this expression does not depend on state shared with other functions.
+     */
+    public boolean isLocal() {
+        return false;
+    }
 }
--- a/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java	Wed Jul 05 19:21:26 2017 +0200
@@ -138,6 +138,11 @@
         return getName();
     }
 
+    @Override
+    public boolean isLocal() {
+        return !getSymbol().isScope();
+    }
+
     /**
      * Check if this IdentNode is a property name
      * @return true if this is a property name
--- a/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java	Wed Jul 05 19:21:26 2017 +0200
@@ -275,6 +275,11 @@
         public boolean isTrue() {
             return JSType.toBoolean(value);
         }
+
+        @Override
+        public boolean isLocal() {
+            return true;
+        }
     }
 
     @Immutable
--- a/nashorn/src/jdk/nashorn/internal/ir/TernaryNode.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/ir/TernaryNode.java	Wed Jul 05 19:21:26 2017 +0200
@@ -109,6 +109,13 @@
         }
     }
 
+    @Override
+    public boolean isLocal() {
+        return getTest().isLocal()
+                && getTrueExpression().isLocal()
+                && getFalseExpression().isLocal();
+    }
+
     /**
      * Get the test expression for this ternary expression, i.e. "x" in x ? y : z
      * @return the test expression
--- a/nashorn/src/jdk/nashorn/internal/ir/UnaryNode.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/ir/UnaryNode.java	Wed Jul 05 19:21:26 2017 +0200
@@ -129,6 +129,26 @@
     }
 
     @Override
+    public boolean isLocal() {
+        switch (tokenType()) {
+            case NEW:
+                return false;
+            case ADD:
+            case SUB:
+            case NOT:
+            case BIT_NOT:
+                return rhs.isLocal() && rhs.getType().isJSPrimitive();
+            case DECPOSTFIX:
+            case DECPREFIX:
+            case INCPOSTFIX:
+            case INCPREFIX:
+                return rhs instanceof IdentNode && rhs.isLocal() && rhs.getType().isJSPrimitive();
+            default:
+                return rhs.isLocal();
+        }
+    }
+
+    @Override
     public void toString(final StringBuilder sb) {
         toString(sb, new Runnable() {
             @Override
--- a/nashorn/src/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java	Wed Jul 05 19:21:26 2017 +0200
@@ -25,10 +25,10 @@
 
 package jdk.nashorn.internal.ir.debug;
 
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryPoolMXBean;
 import java.lang.reflect.Array;
 import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
@@ -51,9 +51,9 @@
  * switch, it can not detect
  * this fact and will report incorrect sizes, as it will presume the default JVM
  * behavior.
- *
- * @author Attila Szegedi
  */
+
+@SuppressWarnings("StaticNonFinalUsedInInitialization")
 public class ObjectSizeCalculator {
 
     /**
@@ -368,6 +368,29 @@
                 type.getName());
     }
 
+    // ALERT: java.lang.management is not available in compact 1.  We need
+    // to use reflection to soft link test memory statistics.
+
+    static Class<?>  managementFactory    = null;
+    static Class<?>  memoryPoolMXBean     = null;
+    static Class<?>  memoryUsage          = null;
+    static Method    getMemoryPoolMXBeans = null;
+    static Method    getUsage             = null;
+    static Method    getMax               = null;
+    static {
+        try {
+            managementFactory    = Class.forName("java.lang.management.ManagementFactory");
+            memoryPoolMXBean     = Class.forName("java.lang.management.MemoryPoolMXBean");
+            memoryUsage          = Class.forName("java.lang.management.MemoryUsage");
+
+            getMemoryPoolMXBeans = managementFactory.getMethod("getMemoryPoolMXBeans");
+            getUsage             = memoryPoolMXBean.getMethod("getUsage");
+            getMax               = memoryUsage.getMethod("getMax");
+        } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
+            // Pass thru, asserts when attempting to use.
+        }
+    }
+
     /**
      * Return the current memory usage
      * @return current memory usage derived from system configuration
@@ -409,9 +432,33 @@
                 strVmVersion.indexOf('.')));
         if (vmVersion >= 17) {
             long maxMemory = 0;
-            for (MemoryPoolMXBean mp : ManagementFactory.getMemoryPoolMXBeans()) {
-                maxMemory += mp.getUsage().getMax();
+
+            /*
+               See ALERT above.  The reflection code below duplicates the following
+               sequence, and avoids hard coding of java.lang.management.
+
+               for (MemoryPoolMXBean mp : ManagementFactory.getMemoryPoolMXBeans()) {
+                   maxMemory += mp.getUsage().getMax();
+               }
+            */
+
+            if (getMemoryPoolMXBeans == null) {
+                throw new AssertionError("java.lang.management not available in compact 1");
             }
+
+            try {
+                final List<?> memoryPoolMXBeans = (List<?>)getMemoryPoolMXBeans.invoke(managementFactory);
+                for (final Object mp : memoryPoolMXBeans) {
+                    final Object usage = getUsage.invoke(mp);
+                    final Object max = getMax.invoke(usage);
+                    maxMemory += ((Long)max).longValue();
+                }
+            } catch (IllegalAccessException |
+                     IllegalArgumentException |
+                     InvocationTargetException ex) {
+                throw new AssertionError("java.lang.management not available in compact 1");
+            }
+
             if (maxMemory < 30L * 1024 * 1024 * 1024) {
                 // HotSpot 17.0 and above use compressed OOPs below 30GB of RAM total
                 // for all memory pools (yes, including code cache).
--- a/nashorn/src/jdk/nashorn/internal/objects/Global.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java	Wed Jul 05 19:21:26 2017 +0200
@@ -1665,9 +1665,9 @@
         final ScriptObject stringPrototype = getStringPrototype();
         stringPrototype.addOwnProperty("length", Attribute.NON_ENUMERABLE_CONSTANT, 0.0);
 
-        // add Array.prototype.length
+        // set isArray flag on Array.prototype
         final ScriptObject arrayPrototype = getArrayPrototype();
-        arrayPrototype.addOwnProperty("length", Attribute.NOT_ENUMERABLE|Attribute.NOT_CONFIGURABLE, 0.0);
+        arrayPrototype.setIsArray();
 
         this.DEFAULT_DATE = new NativeDate(Double.NaN, this);
 
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Wed Jul 05 19:21:26 2017 +0200
@@ -372,9 +372,7 @@
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
     public static Object isArray(final Object self, final Object arg) {
-        return isArray(arg) || (arg == Global.instance().getArrayPrototype())
-                || (arg instanceof NativeRegExpExecResult)
-                || (arg instanceof JSObject && ((JSObject)arg).isArray());
+        return isArray(arg) || (arg instanceof JSObject && ((JSObject)arg).isArray());
     }
 
     /**
@@ -403,6 +401,26 @@
         }
     }
 
+    /**
+     * Prototype length getter
+     * @param self self reference
+     * @return the length of the object
+     */
+    @Getter(name = "length", where = Where.PROTOTYPE, attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
+    public static Object getProtoLength(final Object self) {
+        return length(self);  // Same as instance getter but we can't make nasgen use the same method for prototype
+    }
+
+    /**
+     * Prototype length setter
+     * @param self   self reference
+     * @param length new length property
+     */
+    @Setter(name = "length", where = Where.PROTOTYPE, attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
+    public static void setProtoLength(final Object self, final Object length) {
+        length(self, length);  // Same as instance setter but we can't make nasgen use the same method for prototype
+    }
+
     static long validLength(final Object length, final boolean reject) {
         final double doubleLength = JSType.toNumber(length);
         if (!Double.isNaN(doubleLength) && JSType.isRepresentableAsLong(doubleLength)) {
@@ -1007,19 +1025,42 @@
         final long actualStart = relativeStart < 0 ? Math.max(len + relativeStart, 0) : Math.min(relativeStart, len);
         final long actualDeleteCount = Math.min(Math.max(JSType.toLong(deleteCount), 0), len - actualStart);
 
-        final NativeArray array = new NativeArray(actualDeleteCount);
+        NativeArray returnValue;
+
+        if (actualStart <= Integer.MAX_VALUE && actualDeleteCount <= Integer.MAX_VALUE && bulkable(sobj)) {
+            try {
+                returnValue =  new NativeArray(sobj.getArray().fastSplice((int)actualStart, (int)actualDeleteCount, items.length));
 
-        for (long k = 0; k < actualDeleteCount; k++) {
-            final long from = actualStart + k;
+                // Since this is a dense bulkable array we can use faster defineOwnProperty to copy new elements
+                int k = (int) actualStart;
+                for (int i = 0; i < items.length; i++, k++) {
+                    sobj.defineOwnProperty(k, items[i]);
+                }
+            } catch (UnsupportedOperationException uoe) {
+                returnValue = slowSplice(sobj, actualStart, actualDeleteCount, items, len);
+            }
+        } else {
+            returnValue = slowSplice(sobj, actualStart, actualDeleteCount, items, len);
+        }
+
+        return returnValue;
+    }
+
+    private static NativeArray slowSplice(final ScriptObject sobj, final long start, final long deleteCount, final Object[] items, final long len) {
+
+        final NativeArray array = new NativeArray(deleteCount);
+
+        for (long k = 0; k < deleteCount; k++) {
+            final long from = start + k;
 
             if (sobj.has(from)) {
                 array.defineOwnProperty(ArrayIndex.getArrayIndex(k), sobj.get(from));
             }
         }
 
-        if (items.length < actualDeleteCount) {
-            for (long k = actualStart; k < (len - actualDeleteCount); k++) {
-                final long from = k + actualDeleteCount;
+        if (items.length < deleteCount) {
+            for (long k = start; k < (len - deleteCount); k++) {
+                final long from = k + deleteCount;
                 final long to   = k + items.length;
 
                 if (sobj.has(from)) {
@@ -1029,12 +1070,12 @@
                 }
             }
 
-            for (long k = len; k > (len - actualDeleteCount + items.length); k--) {
+            for (long k = len; k > (len - deleteCount + items.length); k--) {
                 sobj.delete(k - 1, true);
             }
-        } else if (items.length > actualDeleteCount) {
-            for (long k = len - actualDeleteCount; k > actualStart; k--) {
-                final long from = k + actualDeleteCount - 1;
+        } else if (items.length > deleteCount) {
+            for (long k = len - deleteCount; k > start; k--) {
+                final long from = k + deleteCount - 1;
                 final long to   = k + items.length - 1;
 
                 if (sobj.has(from)) {
@@ -1046,12 +1087,12 @@
             }
         }
 
-        long k = actualStart;
+        long k = start;
         for (int i = 0; i < items.length; i++, k++) {
             sobj.set(k, items[i], true);
         }
 
-        final long newLength = len - actualDeleteCount + items.length;
+        final long newLength = len - deleteCount + items.length;
         sobj.set("length", newLength, true);
 
         return array;
@@ -1122,12 +1163,16 @@
         try {
             final ScriptObject sobj = (ScriptObject)Global.toObject(self);
             final long         len  = JSType.toUint32(sobj.getLength());
-            final long         n    = JSType.toLong(fromIndex);
-
-            if (len == 0 || n >= len) {
+            if (len == 0) {
                 return -1;
             }
 
+            final long         n = JSType.toLong(fromIndex);
+            if (n >= len) {
+                return -1;
+            }
+
+
             for (long k = Math.max(0, (n < 0) ? (len - Math.abs(n)) : n); k < len; k++) {
                 if (sobj.has(k)) {
                     if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) {
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -629,7 +629,8 @@
                     // to name. Probably not a big deal, but if we can ever make it leaner, it'd be nice.
                     return new GuardedInvocation(MH.dropArguments(MH.constant(Object.class,
                             func.makeBoundFunction(this, new Object[] { name })), 0, Object.class),
-                            adaptee.getMap().getProtoGetSwitchPoint(adaptee.getProto(), __call__), testJSAdaptor(adaptee, null, null, null));
+                            adaptee.getMap().getProtoGetSwitchPoint(adaptee.getProto(), __call__),
+                            testJSAdaptor(adaptee, null, null, null));
                 }
             }
             throw typeError("no.such.function", desc.getNameToken(2), ScriptRuntime.safeToString(this));
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeString.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeString.java	Wed Jul 05 19:21:26 2017 +0200
@@ -505,7 +505,7 @@
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE)
     public static Object charAt(final Object self, final Object pos) {
-        return charAt(self, JSType.toInteger(pos));
+        return charAtImpl(checkObjectToString(self), JSType.toInteger(pos));
     }
 
     /**
@@ -527,7 +527,10 @@
      */
     @SpecializedFunction
     public static String charAt(final Object self, final int pos) {
-        final String str = checkObjectToString(self);
+        return charAtImpl(checkObjectToString(self), pos);
+    }
+
+    private static String charAtImpl(final String str, final int pos) {
         return (pos < 0 || pos >= str.length()) ? "" : String.valueOf(str.charAt(pos));
     }
 
@@ -539,7 +542,7 @@
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE)
     public static Object charCodeAt(final Object self, final Object pos) {
-        return charCodeAt(self, JSType.toInteger(pos));
+        return charCodeAtImpl(checkObjectToString(self), JSType.toInteger(pos));
     }
 
     /**
@@ -561,7 +564,10 @@
      */
     @SpecializedFunction
     public static double charCodeAt(final Object self, final int pos) {
-        final String str = checkObjectToString(self);
+        return charCodeAtImpl(checkObjectToString(self), pos);
+    }
+
+    private static double charCodeAtImpl(final String str, final int pos) {
         return (pos < 0 || pos >= str.length()) ? Double.NaN :  str.charAt(pos);
     }
 
--- a/nashorn/src/jdk/nashorn/internal/parser/Lexer.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/parser/Lexer.java	Wed Jul 05 19:21:26 2017 +0200
@@ -47,7 +47,6 @@
 import jdk.nashorn.internal.runtime.ECMAErrors;
 import jdk.nashorn.internal.runtime.ErrorManager;
 import jdk.nashorn.internal.runtime.JSErrorType;
-import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ParserException;
 import jdk.nashorn.internal.runtime.Source;
 import jdk.nashorn.internal.runtime.options.Options;
@@ -1054,16 +1053,6 @@
     }
 
     /**
-     * Convert string to number.
-     *
-     * @param valueString String to convert.
-     * @return Converted number.
-     */
-    private static Number valueOf(final String valueString) throws NumberFormatException {
-        return JSType.narrowestIntegerRepresentation(Double.valueOf(valueString));
-    }
-
-    /**
      * Scan a number.
      */
     protected void scanNumber() {
@@ -1623,7 +1612,7 @@
         case HEXADECIMAL:
             return Lexer.valueOf(source.getString(start + 2, len - 2), 16); // number
         case FLOATING:
-            return Lexer.valueOf(source.getString(start, len)); // number
+            return Double.valueOf(source.getString(start, len)); // number
         case STRING:
             return source.getString(start, len); // String
         case ESCSTRING:
--- a/nashorn/src/jdk/nashorn/internal/runtime/CompiledFunctions.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/CompiledFunctions.java	Wed Jul 05 19:21:26 2017 +0200
@@ -24,6 +24,7 @@
  */
 package jdk.nashorn.internal.runtime;
 
+import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodType;
 import java.util.Iterator;
 import java.util.TreeSet;
@@ -35,6 +36,8 @@
 @SuppressWarnings("serial")
 final class CompiledFunctions extends TreeSet<CompiledFunction> {
 
+    private CompiledFunction generic;
+
     CompiledFunction best(final MethodType type) {
         final Iterator<CompiledFunction> iter = iterator();
         while (iter.hasNext()) {
@@ -43,13 +46,10 @@
                 return next;
             }
         }
-        return mostGeneric();
+        return generic();
     }
 
     boolean needsCallee() {
-        for (final CompiledFunction inv : this) {
-            assert ScriptFunctionData.needsCallee(inv.getInvoker()) == ScriptFunctionData.needsCallee(mostGeneric().getInvoker());
-        }
         return ScriptFunctionData.needsCallee(mostGeneric().getInvoker());
     }
 
@@ -57,6 +57,48 @@
         return last();
     }
 
+    CompiledFunction generic() {
+        CompiledFunction gen = this.generic;
+        if (gen == null) {
+            gen = this.generic = makeGeneric(mostGeneric());
+        }
+        return gen;
+    }
+
+    private static CompiledFunction makeGeneric(final CompiledFunction func) {
+        final MethodHandle invoker = composeGenericMethod(func.getInvoker());
+        final MethodHandle constructor = func.hasConstructor() ? composeGenericMethod(func.getConstructor()) : null;
+        return new CompiledFunction(invoker.type(), invoker, constructor);
+    }
+
+    /**
+     * Takes a method handle, and returns a potentially different method handle that can be used in
+     * {@code ScriptFunction#invoke(Object, Object...)} or {code ScriptFunction#construct(Object, Object...)}.
+     * The returned method handle will be sure to return {@code Object}, and will have all its parameters turned into
+     * {@code Object} as well, except for the following ones:
+     * <ul>
+     *   <li>a last parameter of type {@code Object[]} which is used for vararg functions,</li>
+     *   <li>the first argument, which is forced to be {@link ScriptFunction}, in case the function receives itself
+     *   (callee) as an argument.</li>
+     * </ul>
+     *
+     * @param mh the original method handle
+     *
+     * @return the new handle, conforming to the rules above.
+     */
+    private static MethodHandle composeGenericMethod(final MethodHandle mh) {
+        final MethodType type = mh.type();
+        final boolean isVarArg = ScriptFunctionData.isVarArg(mh);
+        final int paramCount = isVarArg ? type.parameterCount() - 1 : type.parameterCount();
+
+        MethodType newType = MethodType.genericMethodType(paramCount, isVarArg);
+
+        if (ScriptFunctionData.needsCallee(mh)) {
+            newType = newType.changeParameterType(0, ScriptFunction.class);
+        }
+        return type.equals(newType) ? mh : mh.asType(newType);
+    }
+
     /**
      * Is the given type even more specific than this entire list? That means
      * we have an opportunity for more specific versions of the method
--- a/nashorn/src/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java	Wed Jul 05 19:21:26 2017 +0200
@@ -40,7 +40,7 @@
      *
      * @param name          name
      * @param arity         arity
-     * @param list          precompiled code
+     * @param functions     precompiled code
      * @param isStrict      strict
      * @param isBuiltin     builtin
      * @param isConstructor constructor
@@ -73,12 +73,13 @@
     }
 
     private void addInvoker(final MethodHandle mh) {
-        boolean needsCallee = needsCallee(mh);
         if (isConstructor(mh)) {
-            //only nasgen constructors: (boolean, self, args) are subject to binding a boolean newObj. isConstructor
-            //is too conservative a check. However, isConstructor(mh) always implies isConstructor param
+            // only nasgen constructors: (boolean, self, args) are subject to binding a boolean newObj. isConstructor
+            // is too conservative a check. However, isConstructor(mh) always implies isConstructor param
             assert isConstructor();
-            code.add(new CompiledFunction(mh.type(), MH.insertArguments(mh, 0, false), composeConstructor(MH.insertArguments(mh, 0, true), needsCallee))); //make sure callee state can be determined when we reach constructor
+            final MethodHandle invoker = MH.insertArguments(mh, 0, false);
+            final MethodHandle constructor = composeConstructor(MH.insertArguments(mh, 0, true));
+            code.add(new CompiledFunction(mh.type(), invoker, constructor));
         } else {
             code.add(new CompiledFunction(mh.type(), mh));
         }
--- a/nashorn/src/jdk/nashorn/internal/runtime/JSType.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSType.java	Wed Jul 05 19:21:26 2017 +0200
@@ -210,26 +210,6 @@
     }
 
     /**
-     * Get the smallest integer representation of a number. Returns an Integer
-     * for something that is int representable, and Long for something that
-     * is long representable. If the number needs to be a double, this is an
-     * identity function
-     *
-     * @param number number to check
-     *
-     * @return Number instanceof the narrowest possible integer representation for number
-     */
-    public static Number narrowestIntegerRepresentation(final double number) {
-        if (isRepresentableAsInt(number)) {
-            return (int)number;
-        } else if (isRepresentableAsLong(number)) {
-            return (long)number;
-        } else {
-            return number;
-        }
-    }
-
-    /**
      * Check whether an object is primitive
      *
      * @param obj an object
@@ -266,12 +246,11 @@
      * @return the primitive form of the object
      */
     public static Object toPrimitive(final Object obj, final Class<?> hint) {
-        if (!(obj instanceof ScriptObject)) {
-            return obj;
-        }
+        return obj instanceof ScriptObject ? toPrimitive((ScriptObject)obj, hint) : obj;
+    }
 
-        final ScriptObject sobj   = (ScriptObject)obj;
-        final Object       result = sobj.getDefaultValue(hint);
+    private static Object toPrimitive(final ScriptObject sobj, final Class<?> hint) {
+        final Object result = sobj.getDefaultValue(hint);
 
         if (!isPrimitive(result)) {
             throw typeError("bad.default.value", result.toString());
@@ -495,6 +474,19 @@
         return toNumberGeneric(obj);
     }
 
+
+    /**
+     * JavaScript compliant conversion of Object to number
+     * See ECMA 9.3 ToNumber
+     *
+     * @param obj  an object
+     *
+     * @return a number
+     */
+    public static double toNumber(final ScriptObject obj) {
+        return toNumber(toPrimitive(obj, Number.class));
+    }
+
     /**
      * Digit representation for a character
      *
@@ -1048,7 +1040,11 @@
         }
 
         if (obj instanceof ScriptObject) {
-            return toNumber(toPrimitive(obj, Number.class));
+            return toNumber((ScriptObject)obj);
+        }
+
+        if (obj instanceof JSObject) {
+            return ((JSObject)obj).toNumber();
         }
 
         return Double.NaN;
--- a/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java	Wed Jul 05 19:21:26 2017 +0200
@@ -33,6 +33,7 @@
 import java.util.RandomAccess;
 import java.util.concurrent.Callable;
 import jdk.nashorn.api.scripting.JSObject;
+import jdk.nashorn.api.scripting.ScriptObjectMirror;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
 import jdk.nashorn.internal.runtime.linker.InvokeByName;
 
@@ -135,7 +136,8 @@
      */
     public static ListAdapter create(final Object obj) {
         if (obj instanceof ScriptObject) {
-            return new ScriptObjectListAdapter((ScriptObject)obj);
+            final Object mirror = ScriptObjectMirror.wrap(obj, Context.getGlobal());
+            return new JSObjectListAdapter((JSObject)mirror);
         } else if (obj instanceof JSObject) {
             return new JSObjectListAdapter((JSObject)obj);
         } else {
--- a/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java	Wed Jul 05 19:21:26 2017 +0200
@@ -26,6 +26,8 @@
 package jdk.nashorn.internal.runtime;
 
 import static jdk.nashorn.internal.runtime.PropertyHashMap.EMPTY_HASHMAP;
+import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndex;
+import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex;
 
 import java.lang.invoke.SwitchPoint;
 import java.lang.ref.WeakReference;
@@ -50,6 +52,8 @@
 public final class PropertyMap implements Iterable<Object>, PropertyListener {
     /** Used for non extensible PropertyMaps, negative logic as the normal case is extensible. See {@link ScriptObject#preventExtensions()} */
     public static final int NOT_EXTENSIBLE        = 0b0000_0001;
+    /** Does this map contain valid array keys? */
+    public static final int CONTAINS_ARRAY_KEYS   = 0b0000_0010;
     /** This mask is used to preserve certain flags when cloning the PropertyMap. Others should not be copied */
     private static final int CLONEABLE_FLAGS_MASK = 0b0000_1111;
     /** Has a listener been added to this property map. This flag is not copied when cloning a map. See {@link PropertyListener} */
@@ -91,12 +95,16 @@
      * @param fieldCount   Number of fields in use.
      * @param fieldMaximum Number of fields available.
      * @param spillLength  Number of spill slots used.
+     * @param containsArrayKeys True if properties contain numeric keys
      */
-    private PropertyMap(final PropertyHashMap properties, final int fieldCount, final int fieldMaximum, final int spillLength) {
+    private PropertyMap(final PropertyHashMap properties, final int fieldCount, final int fieldMaximum, final int spillLength, final boolean containsArrayKeys) {
         this.properties   = properties;
         this.fieldCount   = fieldCount;
         this.fieldMaximum = fieldMaximum;
         this.spillLength  = spillLength;
+        if (containsArrayKeys) {
+            setContainsArrayKeys();
+        }
 
         if (Context.DEBUG) {
             count++;
@@ -104,15 +112,6 @@
     }
 
     /**
-     * Constructor.
-     *
-     * @param properties A {@link PropertyHashMap} with initial contents.
-     */
-    private PropertyMap(final PropertyHashMap properties) {
-        this(properties, 0, 0, 0);
-    }
-
-    /**
      * Cloning constructor.
      *
      * @param propertyMap Existing property map.
@@ -152,12 +151,15 @@
         if (Context.DEBUG) {
             duplicatedCount++;
         }
-        return new PropertyMap(this.properties);
+        return new PropertyMap(this.properties, 0, 0, 0, containsArrayKeys());
     }
 
     /**
      * Public property map allocator.
      *
+     * <p>It is the caller's responsibility to make sure that {@code properties} does not contain
+     * properties with keys that are valid array indices.</p>
+     *
      * @param properties   Collection of initial properties.
      * @param fieldCount   Number of fields in use.
      * @param fieldMaximum Number of fields available.
@@ -166,11 +168,15 @@
      */
     public static PropertyMap newMap(final Collection<Property> properties, final int fieldCount, final int fieldMaximum,  final int spillLength) {
         PropertyHashMap newProperties = EMPTY_HASHMAP.immutableAdd(properties);
-        return new PropertyMap(newProperties, fieldCount, fieldMaximum, spillLength);
+        return new PropertyMap(newProperties, fieldCount, fieldMaximum, spillLength, false);
     }
 
     /**
      * Public property map allocator. Used by nasgen generated code.
+     *
+     * <p>It is the caller's responsibility to make sure that {@code properties} does not contain
+     * properties with keys that are valid array indices.</p>
+     *
      * @param properties Collection of initial properties.
      * @return New {@link PropertyMap}.
      */
@@ -184,7 +190,7 @@
      * @return New empty {@link PropertyMap}.
      */
     public static PropertyMap newMap() {
-        return new PropertyMap(EMPTY_HASHMAP);
+        return new PropertyMap(EMPTY_HASHMAP, 0, 0, 0, false);
     }
 
     /**
@@ -294,6 +300,9 @@
             if(!property.isSpill()) {
                 newMap.fieldCount = Math.max(newMap.fieldCount, property.getSlot() + 1);
             }
+            if (isValidArrayIndex(getArrayIndex(property.getKey()))) {
+                newMap.setContainsArrayKeys();
+            }
 
             newMap.spillLength += property.getSpillCount();
         }
@@ -408,6 +417,9 @@
 
         final PropertyMap newMap = new PropertyMap(this, newProperties);
         for (final Property property : otherProperties) {
+            if (isValidArrayIndex(getArrayIndex(property.getKey()))) {
+                newMap.setContainsArrayKeys();
+            }
             newMap.spillLength += property.getSpillCount();
         }
 
@@ -700,6 +712,22 @@
     }
 
     /**
+     * Check if this map contains properties with valid array keys
+     *
+     * @return {@code true} if this map contains properties with valid array keys
+     */
+    public final boolean containsArrayKeys() {
+        return (flags & CONTAINS_ARRAY_KEYS) != 0;
+    }
+
+    /**
+     * Flag this object as having array keys in defined properties
+     */
+    private void setContainsArrayKeys() {
+        flags |= CONTAINS_ARRAY_KEYS;
+    }
+
+    /**
      * Check whether a {@link PropertyListener} has been added to this map.
      *
      * @return {@code true} if {@link PropertyListener} exists
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java	Wed Jul 05 19:21:26 2017 +0200
@@ -213,13 +213,13 @@
      */
     public final MethodHandle getGenericInvoker() {
         ensureCodeGenerated();
-        return composeGenericMethod(code.mostGeneric().getInvoker());
+        return code.generic().getInvoker();
     }
 
     final MethodHandle getGenericConstructor() {
         ensureCodeGenerated();
-        ensureConstructor(code.mostGeneric());
-        return composeGenericMethod(code.mostGeneric().getConstructor());
+        ensureConstructor(code.generic());
+        return code.generic().getConstructor();
     }
 
     private CompiledFunction getBest(final MethodType callSiteType) {
@@ -267,18 +267,17 @@
     }
 
     /**
-     * Compose a constructor given a primordial constructor handle
+     * Compose a constructor given a primordial constructor handle.
      *
-     * @param ctor         primordial constructor handle
-     * @param needsCallee  do we need to pass a callee
-     *
+     * @param ctor primordial constructor handle
      * @return the composed constructor
      */
-    protected MethodHandle composeConstructor(final MethodHandle ctor, final boolean needsCallee) {
+    protected MethodHandle composeConstructor(final MethodHandle ctor) {
         // If it was (callee, this, args...), permute it to (this, callee, args...). We're doing this because having
         // "this" in the first argument position is what allows the elegant folded composition of
         // (newFilter x constructor x allocator) further down below in the code. Also, ensure the composite constructor
         // always returns Object.
+        final boolean needsCallee = needsCallee(ctor);
         MethodHandle composedCtor = needsCallee ? swapCalleeAndThis(ctor) : ctor;
 
         composedCtor = changeReturnTypeToObject(composedCtor);
@@ -472,33 +471,6 @@
     }
 
     /**
-     * Takes a method handle, and returns a potentially different method handle that can be used in
-     * {@code ScriptFunction#invoke(Object, Object...)} or {code ScriptFunction#construct(Object, Object...)}.
-     * The returned method handle will be sure to return {@code Object}, and will have all its parameters turned into
-     * {@code Object} as well, except for the following ones:
-     * <ul>
-     *   <li>a last parameter of type {@code Object[]} which is used for vararg functions,</li>
-     *   <li>the first argument, which is forced to be {@link ScriptFunction}, in case the function receives itself
-     *   (callee) as an argument.</li>
-     * </ul>
-     *
-     * @param mh the original method handle
-     *
-     * @return the new handle, conforming to the rules above.
-     */
-    protected MethodHandle composeGenericMethod(final MethodHandle mh) {
-        final MethodType type = mh.type();
-        MethodType newType = type.generic();
-        if (isVarArg(mh)) {
-            newType = newType.changeParameterType(type.parameterCount() - 1, Object[].class);
-        }
-        if (needsCallee(mh)) {
-            newType = newType.changeParameterType(0, ScriptFunction.class);
-        }
-        return type.equals(newType) ? mh : mh.asType(newType);
-    }
-
-    /**
      * Execute this script function.
      *
      * @param self  Target object.
@@ -508,10 +480,9 @@
      * @throws Throwable if there is an exception/error with the invocation or thrown from it
      */
     Object invoke(final ScriptFunction fn, final Object self, final Object... arguments) throws Throwable {
-        final MethodHandle mh = getGenericInvoker();
-
-        final Object       selfObj    = convertThisObject(self);
-        final Object[]     args       = arguments == null ? ScriptRuntime.EMPTY_ARRAY : arguments;
+        final MethodHandle mh  = getGenericInvoker();
+        final Object   selfObj = convertThisObject(self);
+        final Object[] args    = arguments == null ? ScriptRuntime.EMPTY_ARRAY : arguments;
 
         if (isVarArg(mh)) {
             if (needsCallee(mh)) {
@@ -531,6 +502,12 @@
                 return mh.invokeExact(fn, selfObj, getArg(args, 0), getArg(args, 1));
             case 5:
                 return mh.invokeExact(fn, selfObj, getArg(args, 0), getArg(args, 1), getArg(args, 2));
+            case 6:
+                return mh.invokeExact(fn, selfObj, getArg(args, 0), getArg(args, 1), getArg(args, 2), getArg(args, 3));
+            case 7:
+                return mh.invokeExact(fn, selfObj, getArg(args, 0), getArg(args, 1), getArg(args, 2), getArg(args, 3), getArg(args, 4));
+            case 8:
+                return mh.invokeExact(fn, selfObj, getArg(args, 0), getArg(args, 1), getArg(args, 2), getArg(args, 3), getArg(args, 4), getArg(args, 5));
             default:
                 return mh.invokeWithArguments(withArguments(fn, selfObj, paramCount, args));
             }
@@ -545,15 +522,20 @@
             return mh.invokeExact(selfObj, getArg(args, 0), getArg(args, 1));
         case 4:
             return mh.invokeExact(selfObj, getArg(args, 0), getArg(args, 1), getArg(args, 2));
+        case 5:
+            return mh.invokeExact(selfObj, getArg(args, 0), getArg(args, 1), getArg(args, 2), getArg(args, 3));
+        case 6:
+            return mh.invokeExact(selfObj, getArg(args, 0), getArg(args, 1), getArg(args, 2), getArg(args, 3), getArg(args, 4));
+        case 7:
+            return mh.invokeExact(selfObj, getArg(args, 0), getArg(args, 1), getArg(args, 2), getArg(args, 3), getArg(args, 4), getArg(args, 5));
         default:
             return mh.invokeWithArguments(withArguments(null, selfObj, paramCount, args));
         }
     }
 
     Object construct(final ScriptFunction fn, final Object... arguments) throws Throwable {
-        final MethodHandle mh = getGenericConstructor();
-
-        final Object[]     args       = arguments == null ? ScriptRuntime.EMPTY_ARRAY : arguments;
+        final MethodHandle mh   = getGenericConstructor();
+        final Object[]     args = arguments == null ? ScriptRuntime.EMPTY_ARRAY : arguments;
 
         if (isVarArg(mh)) {
             if (needsCallee(mh)) {
@@ -573,6 +555,12 @@
                 return mh.invokeExact(fn, getArg(args, 0), getArg(args, 1));
             case 4:
                 return mh.invokeExact(fn, getArg(args, 0), getArg(args, 1), getArg(args, 2));
+            case 5:
+                return mh.invokeExact(fn, getArg(args, 0), getArg(args, 1), getArg(args, 2), getArg(args, 3));
+            case 6:
+                return mh.invokeExact(fn, getArg(args, 0), getArg(args, 1), getArg(args, 2), getArg(args, 3), getArg(args, 4));
+            case 7:
+                return mh.invokeExact(fn, getArg(args, 0), getArg(args, 1), getArg(args, 2), getArg(args, 3), getArg(args, 4), getArg(args, 5));
             default:
                 return mh.invokeWithArguments(withArguments(fn, paramCount, args));
             }
@@ -587,6 +575,12 @@
             return mh.invokeExact(getArg(args, 0), getArg(args, 1));
         case 3:
             return mh.invokeExact(getArg(args, 0), getArg(args, 1), getArg(args, 2));
+        case 4:
+            return mh.invokeExact(getArg(args, 0), getArg(args, 1), getArg(args, 2), getArg(args, 3));
+        case 5:
+            return mh.invokeExact(getArg(args, 0), getArg(args, 1), getArg(args, 2), getArg(args, 3), getArg(args, 4));
+        case 6:
+            return mh.invokeExact(getArg(args, 0), getArg(args, 1), getArg(args, 2), getArg(args, 3), getArg(args, 4), getArg(args, 5));
         default:
             return mh.invokeWithArguments(withArguments(null, paramCount, args));
         }
@@ -664,20 +658,21 @@
      * @return the adapted handle
      */
     private static MethodHandle changeReturnTypeToObject(final MethodHandle mh) {
-        return MH.asType(mh, mh.type().changeReturnType(Object.class));
+        final MethodType type = mh.type();
+        return (type.returnType() == Object.class) ? mh : MH.asType(mh, type.changeReturnType(Object.class));
     }
 
     private void ensureConstructor(final CompiledFunction inv) {
         if (!inv.hasConstructor()) {
-            inv.setConstructor(composeConstructor(inv.getInvoker(), needsCallee(inv.getInvoker())));
+            inv.setConstructor(composeConstructor(inv.getInvoker()));
         }
     }
 
     /**
-     * Heuristic to figure out if the method handle has a callee argument. If it's type is either
-     * {@code (boolean, ScriptFunction, ...)} or {@code (ScriptFunction, ...)}, then we'll assume it has
-     * a callee argument. We need this as the constructor above is not passed this information, and can't just blindly
-     * assume it's false (notably, it's being invoked for creation of new scripts, and scripts have scopes, therefore
+     * Heuristic to figure out if the method handle has a callee argument. If it's type is
+     * {@code (ScriptFunction, ...)}, then we'll assume it has a callee argument. We need this as
+     * the constructor above is not passed this information, and can't just blindly assume it's false
+     * (notably, it's being invoked for creation of new scripts, and scripts have scopes, therefore
      * they also always receive a callee).
      *
      * @param mh the examined method handle
@@ -685,18 +680,8 @@
      * @return true if the method handle expects a callee, false otherwise
      */
     protected static boolean needsCallee(final MethodHandle mh) {
-        final MethodType type   = mh.type();
-        final int        length = type.parameterCount();
-
-        if (length == 0) {
-            return false;
-        }
-
-        if (type.parameterType(0) == ScriptFunction.class) {
-            return true;
-        }
-
-        return length > 1 && type.parameterType(0) == boolean.class && type.parameterType(1) == ScriptFunction.class;
+        final MethodType type = mh.type();
+        return (type.parameterCount() > 0 && type.parameterType(0) == ScriptFunction.class);
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptLoader.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptLoader.java	Wed Jul 05 19:21:26 2017 +0200
@@ -52,24 +52,10 @@
     @Override
     protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
         checkPackageAccess(name);
-        try {
-            return super.loadClass(name, resolve);
-        } catch (final ClassNotFoundException | SecurityException e) {
-            // We'll get ClassNotFoundException for Nashorn 'struct' classes.
-            // Also, we'll get SecurityException for jdk.nashorn.internal.*
-            // classes. So, load these using to context's 'shared' loader.
-            // All these classes start with "jdk.nashorn.internal." prefix.
-            try {
-                if (name.startsWith(NASHORN_PKG_PREFIX)) {
-                    return context.getSharedLoader().loadClass(name);
-                }
-            } catch (final ClassNotFoundException ignored) {
-                //ignored
-            }
-
-            // throw the original exception from here
-            throw e;
+        if (name.startsWith(NASHORN_PKG_PREFIX)) {
+            return context.getSharedLoader().loadClass(name);
         }
+        return super.loadClass(name, resolve);
     }
 
     // package-private and private stuff below this point
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Wed Jul 05 19:21:26 2017 +0200
@@ -508,7 +508,7 @@
             if (property == null) {
                 // promoting an arrayData value to actual property
                 addOwnProperty(key, propFlags, value);
-                removeArraySlot(key);
+                checkIntegerKey(key);
             } else {
                 // Now set the new flags
                 modifyOwnProperty(property, propFlags);
@@ -594,7 +594,7 @@
      * @param index key for property
      * @param value value to define
      */
-    protected final void defineOwnProperty(final int index, final Object value) {
+    public final void defineOwnProperty(final int index, final Object value) {
         assert isValidArrayIndex(index) : "invalid array index";
         final long longIndex = ArrayIndex.toLongIndex(index);
         if (longIndex >= getArray().length()) {
@@ -616,15 +616,6 @@
         }
     }
 
-    private void removeArraySlot(final String key) {
-        final int index = getArrayIndex(key);
-        final ArrayData array = getArray();
-
-        if (array.has(index)) {
-            setArray(array.delete(index));
-        }
-    }
-
     /**
       * Add a new property to the object.
       *
@@ -1203,21 +1194,10 @@
      * Check if this ScriptObject has array entries. This means that someone has
      * set values with numeric keys in the object.
      *
-     * Note: this can be O(n) up to the array length
-     *
      * @return true if array entries exists.
      */
     public boolean hasArrayEntries() {
-        final ArrayData array = getArray();
-        final long length = array.length();
-
-        for (long i = 0; i < length; i++) {
-            if (array.has((int)i)) {
-                return true;
-            }
-        }
-
-        return false;
+        return getArray().length() > 0 || getMap().containsArrayKeys();
     }
 
     /**
@@ -2356,8 +2336,29 @@
        }
 
        if (newLength < arrayLength) {
-           setArray(getArray().shrink(newLength));
-           getArray().setLength(newLength);
+           long actualLength = newLength;
+
+           // Check for numeric keys in property map and delete them or adjust length, depending on whether
+           // they're defined as configurable. See ES5 #15.4.5.2
+           if (getMap().containsArrayKeys()) {
+
+               for (long l = arrayLength - 1; l >= newLength; l--) {
+                   final FindProperty find = findProperty(JSType.toString(l), false);
+
+                   if (find != null) {
+
+                       if (find.getProperty().isConfigurable()) {
+                           deleteOwnProperty(find.getProperty());
+                       } else {
+                           actualLength = l + 1;
+                           break;
+                       }
+                   }
+               }
+           }
+
+           setArray(getArray().shrink(actualLength));
+           getArray().setLength(actualLength);
        }
     }
 
@@ -2680,7 +2681,7 @@
         final long oldLength = getArray().length();
         final long longIndex = index & JSType.MAX_UINT;
 
-        if (!getArray().has(index)) {
+        if (getMap().containsArrayKeys()) {
             final String key = JSType.toString(longIndex);
             final FindProperty find = findProperty(key, true);
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObjectListAdapter.java	Thu Oct 31 16:46:43 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * 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.  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 jdk.nashorn.internal.runtime;
-
-/**
- * A ListAdapter that can wrap a ScriptObject.
- */
-public final class ScriptObjectListAdapter extends ListAdapter {
-    /**
-     * Creates a new list wrapper for the specified ScriptObject.
-     * @param obj script the object to wrap
-     */
-    public ScriptObjectListAdapter(final ScriptObject obj) {
-        super(obj);
-    }
-
-    @Override
-    public int size() {
-        return JSType.toInt32(((ScriptObject)obj).getLength());
-    }
-
-    @Override
-    protected Object getAt(int index) {
-        return ((ScriptObject)obj).get(index);
-    }
-
-    @Override
-    protected void setAt(int index, Object element) {
-        ((ScriptObject)obj).set(index, element, false);
-    }
-}
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Wed Jul 05 19:21:26 2017 +0200
@@ -47,6 +47,7 @@
 import jdk.nashorn.api.scripting.ScriptObjectMirror;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
 import jdk.nashorn.internal.ir.debug.JSONWriter;
+import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.parser.Lexer;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
 
@@ -258,6 +259,11 @@
             return ((Map<?,?>)obj).keySet().iterator();
         }
 
+        final Object wrapped = Global.instance().wrapAsObject(obj);
+        if (wrapped instanceof ScriptObject) {
+            return ((ScriptObject)wrapped).propertyIterator();
+        }
+
         return Collections.emptyIterator();
     }
 
@@ -336,6 +342,11 @@
             return ((Iterable<?>)obj).iterator();
         }
 
+        final Object wrapped = Global.instance().wrapAsObject(obj);
+        if (wrapped instanceof ScriptObject) {
+            return ((ScriptObject)wrapped).valueIterator();
+        }
+
         return Collections.emptyIterator();
     }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptingFunctions.java	Wed Jul 05 19:21:26 2017 +0200
@@ -190,7 +190,7 @@
                 char buffer[] = new char[1024];
                 try (final InputStreamReader inputStream = new InputStreamReader(process.getErrorStream())) {
                     for (int length; (length = inputStream.read(buffer, 0, buffer.length)) != -1; ) {
-                        outBuffer.append(buffer, 0, length);
+                        errBuffer.append(buffer, 0, length);
                     }
                 } catch (IOException ex) {
                     exception[1] = ex;
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Wed Jul 05 19:21:26 2017 +0200
@@ -461,7 +461,23 @@
      */
     public abstract ArrayData slice(long from, long to);
 
-    private static Class<?> widestType(final Object... items) {
+    /**
+     * Fast splice operation. This just modifies the array according to the number of
+     * elements added and deleted but does not insert the added elements. Throws
+     * {@code UnsupportedOperationException} if fast splice operation is not supported
+     * for this class or arguments.
+     *
+     * @param start start index of splice operation
+     * @param removed number of removed elements
+     * @param added number of added elements
+     * @throws UnsupportedOperationException if fast splice is not supported for the class or arguments.
+     */
+    public ArrayData fastSplice(final int start, final int removed, final int added) throws UnsupportedOperationException {
+        throw new UnsupportedOperationException();
+    }
+
+
+    static Class<?> widestType(final Object... items) {
         assert items.length > 0;
 
         Class<?> widest = Integer.class;
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/IntArrayData.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/IntArrayData.java	Wed Jul 05 19:21:26 2017 +0200
@@ -269,4 +269,32 @@
 
         return new IntArrayData(Arrays.copyOfRange(array, (int)from, (int)to), (int)newLength);
     }
+
+    @Override
+    public ArrayData fastSplice(final int start, final int removed, final int added) throws UnsupportedOperationException {
+        final long oldLength = length();
+        final long newLength = oldLength - removed + added;
+        if (newLength > SparseArrayData.MAX_DENSE_LENGTH && newLength > array.length) {
+            throw new UnsupportedOperationException();
+        }
+        final ArrayData returnValue = (removed == 0) ?
+                EMPTY_ARRAY : new IntArrayData(Arrays.copyOfRange(array, start, start + removed), removed);
+
+        if (newLength != oldLength) {
+            final int[] newArray;
+
+            if (newLength > array.length) {
+                newArray = new int[ArrayData.nextSize((int)newLength)];
+                System.arraycopy(array, 0, newArray, 0, start);
+            } else {
+                newArray = array;
+            }
+
+            System.arraycopy(array, start + removed, newArray, start + added, (int)(oldLength - start - removed));
+            array = newArray;
+            setLength(newLength);
+        }
+
+        return returnValue;
+    }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/LongArrayData.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/LongArrayData.java	Wed Jul 05 19:21:26 2017 +0200
@@ -92,7 +92,7 @@
 
     @Override
     public ArrayData convert(final Class<?> type) {
-        if (type == Long.class) {
+        if (type == Integer.class || type == Long.class) {
             return this;
         }
         final int length = (int) length();
@@ -238,4 +238,32 @@
         final long newLength = to - start;
         return new LongArrayData(Arrays.copyOfRange(array, (int)from, (int)to), (int)newLength);
     }
+
+    @Override
+    public ArrayData fastSplice(final int start, final int removed, final int added) throws UnsupportedOperationException {
+        final long oldLength = length();
+        final long newLength = oldLength - removed + added;
+        if (newLength > SparseArrayData.MAX_DENSE_LENGTH && newLength > array.length) {
+            throw new UnsupportedOperationException();
+        }
+        final ArrayData returnValue = (removed == 0) ?
+                EMPTY_ARRAY : new LongArrayData(Arrays.copyOfRange(array, start, start + removed), removed);
+
+        if (newLength != oldLength) {
+            final long[] newArray;
+
+            if (newLength > array.length) {
+                newArray = new long[ArrayData.nextSize((int)newLength)];
+                System.arraycopy(array, 0, newArray, 0, start);
+            } else {
+                newArray = array;
+            }
+
+            System.arraycopy(array, start + removed, newArray, start + added, (int)(oldLength - start - removed));
+            array = newArray;
+            setLength(newLength);
+        }
+
+        return returnValue;
+    }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java	Wed Jul 05 19:21:26 2017 +0200
@@ -218,4 +218,32 @@
         final long newLength = to - start;
         return new NumberArrayData(Arrays.copyOfRange(array, (int)from, (int)to), (int)newLength);
     }
+
+    @Override
+    public ArrayData fastSplice(final int start, final int removed, final int added) throws UnsupportedOperationException {
+        final long oldLength = length();
+        final long newLength = oldLength - removed + added;
+        if (newLength > SparseArrayData.MAX_DENSE_LENGTH && newLength > array.length) {
+            throw new UnsupportedOperationException();
+        }
+        final ArrayData returnValue = (removed == 0) ?
+                EMPTY_ARRAY : new NumberArrayData(Arrays.copyOfRange(array, start, start + removed), removed);
+
+        if (newLength != oldLength) {
+            final double[] newArray;
+
+            if (newLength > array.length) {
+                newArray = new double[ArrayData.nextSize((int)newLength)];
+                System.arraycopy(array, 0, newArray, 0, start);
+            } else {
+                newArray = array;
+            }
+
+            System.arraycopy(array, start + removed, newArray, start + added, (int)(oldLength - start - removed));
+            array = newArray;
+            setLength(newLength);
+        }
+
+        return returnValue;
+    }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java	Wed Jul 05 19:21:26 2017 +0200
@@ -206,4 +206,32 @@
         final long newLength = to - start;
         return new ObjectArrayData(Arrays.copyOfRange(array, (int)from, (int)to), (int)newLength);
     }
+
+    @Override
+    public ArrayData fastSplice(final int start, final int removed, final int added) throws UnsupportedOperationException {
+        final long oldLength = length();
+        final long newLength = oldLength - removed + added;
+        if (newLength > SparseArrayData.MAX_DENSE_LENGTH && newLength > array.length) {
+            throw new UnsupportedOperationException();
+        }
+        final ArrayData returnValue = (removed == 0) ?
+                EMPTY_ARRAY : new ObjectArrayData(Arrays.copyOfRange(array, start, start + removed), removed);
+
+        if (newLength != oldLength) {
+            final Object[] newArray;
+
+            if (newLength > array.length) {
+                newArray = new Object[ArrayData.nextSize((int)newLength)];
+                System.arraycopy(array, 0, newArray, 0, start);
+            } else {
+                newArray = array;
+            }
+
+            System.arraycopy(array, start + removed, newArray, start + added, (int)(oldLength - start - removed));
+            array = newArray;
+            setLength(newLength);
+        }
+
+        return returnValue;
+    }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Wed Jul 05 19:21:26 2017 +0200
@@ -25,25 +25,28 @@
 
 package jdk.nashorn.internal.runtime.linker;
 
-import jdk.nashorn.internal.lookup.MethodHandleFunctionality;
-import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
+import java.util.HashMap;
+import java.util.Map;
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.linker.GuardingTypeConverterFactory;
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.internal.dynalink.linker.LinkerServices;
 import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
 import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
+import jdk.nashorn.api.scripting.JSObject;
+import jdk.nashorn.internal.lookup.MethodHandleFactory;
+import jdk.nashorn.internal.lookup.MethodHandleFunctionality;
 import jdk.nashorn.internal.runtime.JSType;
-import jdk.nashorn.api.scripting.JSObject;
 
 /**
  * A Dynalink linker to handle web browser built-in JS (DOM etc.) objects as well
  * as ScriptObjects from other Nashorn contexts.
  */
-final class JSObjectLinker implements TypeBasedGuardingDynamicLinker {
+final class JSObjectLinker implements TypeBasedGuardingDynamicLinker, GuardingTypeConverterFactory {
     @Override
     public boolean canLinkType(final Class<?> type) {
         return canLinkTypeStatic(type);
@@ -75,6 +78,22 @@
         return Bootstrap.asType(inv, linkerServices, desc);
     }
 
+    @Override
+    public GuardedInvocation convertToType(final Class<?> sourceType, final Class<?> targetType) throws Exception {
+        final boolean sourceIsAlwaysJSObject = JSObject.class.isAssignableFrom(sourceType);
+        if(!sourceIsAlwaysJSObject && !sourceType.isAssignableFrom(JSObject.class)) {
+            return null;
+        }
+
+        final MethodHandle converter = CONVERTERS.get(targetType);
+        if(converter == null) {
+            return null;
+        }
+
+        return new GuardedInvocation(converter, sourceIsAlwaysJSObject ? null : IS_JSOBJECT_GUARD).asType(MethodType.methodType(targetType, sourceType));
+    }
+
+
     private static GuardedInvocation lookup(final CallSiteDescriptor desc) {
         final String operator = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0);
         final int c = desc.getNameTokenCount();
@@ -87,9 +106,7 @@
             case "setElem":
                 return c > 2 ? findSetMethod(desc) : findSetIndexMethod();
             case "call":
-                return findCallMethod(desc, operator);
-            case "callMethod":
-                return findCallMethodMethod(desc, operator);
+                return findCallMethod(desc);
             case "new":
                 return findNewMethod(desc);
             default:
@@ -115,14 +132,7 @@
         return new GuardedInvocation(JSOBJECTLINKER_PUT, null, IS_JSOBJECT_GUARD);
     }
 
-    private static GuardedInvocation findCallMethodMethod(final CallSiteDescriptor desc, final String operator) {
-        final String methodName = desc.getNameToken(2);
-        MethodHandle func = MH.insertArguments(JSOBJECT_CALLMEMBER, 1, methodName);
-        func = MH.asCollector(func, Object[].class, desc.getMethodType().parameterCount() - 1);
-        return new GuardedInvocation(func, null, IS_JSOBJECT_GUARD);
-    }
-
-    private static GuardedInvocation findCallMethod(final CallSiteDescriptor desc, final String operator) {
+    private static GuardedInvocation findCallMethod(final CallSiteDescriptor desc) {
         final MethodHandle func = MH.asCollector(JSOBJECT_CALL, Object[].class, desc.getMethodType().parameterCount() - 2);
         return new GuardedInvocation(func, null, IS_JSOBJECT_GUARD);
     }
@@ -163,6 +173,25 @@
         }
     }
 
+    @SuppressWarnings("unused")
+    private static int toInt32(final JSObject obj) {
+        return JSType.toInt32(toNumber(obj));
+    }
+
+    @SuppressWarnings("unused")
+    private static long toInt64(final JSObject obj) {
+        return JSType.toInt64(toNumber(obj));
+    }
+
+    private static double toNumber(final JSObject obj) {
+        return obj == null ? 0 : obj.toNumber();
+    }
+
+    @SuppressWarnings("unused")
+    private static boolean toBoolean(final JSObject obj) {
+        return obj != null;
+    }
+
     private static int getIndex(final Number n) {
         final double value = n.doubleValue();
         return JSType.isRepresentableAsInt(value) ? (int)value : -1;
@@ -178,27 +207,31 @@
     // method handles of JSObject class
     private static final MethodHandle JSOBJECT_GETMEMBER  = findJSObjectMH("getMember", Object.class, String.class);
     private static final MethodHandle JSOBJECT_SETMEMBER  = findJSObjectMH("setMember", Void.TYPE, String.class, Object.class);
-    private static final MethodHandle JSOBJECT_CALLMEMBER = findJSObjectMH("callMember", Object.class, String.class, Object[].class);
     private static final MethodHandle JSOBJECT_CALL       = findJSObjectMH("call", Object.class, Object.class, Object[].class);
     private static final MethodHandle JSOBJECT_NEW        = findJSObjectMH("newObject", Object.class, Object[].class);
 
+    private static final Map<Class<?>, MethodHandle> CONVERTERS = new HashMap<>();
+    static {
+        CONVERTERS.put(boolean.class, findOwnMH("toBoolean", boolean.class, JSObject.class));
+        CONVERTERS.put(int.class, findOwnMH("toInt32", int.class, JSObject.class));
+        CONVERTERS.put(long.class, findOwnMH("toInt64", long.class, JSObject.class));
+        CONVERTERS.put(double.class, findOwnMH("toNumber", double.class, JSObject.class));
+    }
+
     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        final Class<?>   own = JSObjectLinker.class;
-        final MethodType mt  = MH.type(rtype, types);
-        try {
-            return MH.findStatic(MethodHandles.lookup(), own, name, mt);
-        } catch (final MethodHandleFactory.LookupException e) {
-            return MH.findVirtual(MethodHandles.lookup(), own, name, mt);
-        }
+        return findMH(name, JSObjectLinker.class, rtype, types);
     }
 
     private static MethodHandle findJSObjectMH(final String name, final Class<?> rtype, final Class<?>... types) {
-        final Class<?>   own = JSObject.class;
+        return findMH(name, JSObject.class, rtype, types);
+    }
+
+    private static MethodHandle findMH(final String name, final Class<?> target, final Class<?> rtype, final Class<?>... types) {
         final MethodType mt  = MH.type(rtype, types);
         try {
-            return MH.findVirtual(MethodHandles.publicLookup(), own, name, mt);
+            return MH.findStatic(MethodHandles.lookup(), target, name, mt);
         } catch (final MethodHandleFactory.LookupException e) {
-            return MH.findVirtual(MethodHandles.lookup(), own, name, mt);
+            return MH.findVirtual(MethodHandles.lookup(), target, name, mt);
         }
     }
 }
--- a/nashorn/src/overview.html	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/src/overview.html	Wed Jul 05 19:21:26 2017 +0200
@@ -108,6 +108,6 @@
 <h2>Other non-standard built-in objects</h2>
 In addition to {@code Java}, Nashorn also exposes some other non-standard built-in objects:
 <a href="jdk/nashorn/internal/objects/NativeJSAdapter.html">{@code JSAdapter}</a>,
-<a href="jdk/nashorn/internal/objects/NativeJavaImporter.html">{@code JavaImporter},
+<a href="jdk/nashorn/internal/objects/NativeJavaImporter.html">{@code JavaImporter}</a>,
 <a href="jdk/nashorn/internal/runtime/NativeJavaPackage.html">{@code Packages}.</a>
 </body>
--- a/nashorn/test/examples/array-micro.js	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/test/examples/array-micro.js	Wed Jul 05 19:21:26 2017 +0200
@@ -90,6 +90,24 @@
     array[6] = 6;
 });
 
+bench("push", function() {
+    var arr = [1, 2, 3];
+    arr.push(4);
+    arr.push(5);
+    arr.push(6);
+});
+
+bench("pop", function() {
+    var arr = [1, 2, 3];
+    arr.pop();
+    arr.pop();
+    arr.pop();
+});
+
+bench("splice", function() {
+    [1, 2, 3].splice(0, 2, 5, 6, 7);
+});
+
 var all = function(e) { return true; };
 var none = function(e) { return false; };
 
--- a/nashorn/test/script/basic/JDK-8024847.js	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/test/script/basic/JDK-8024847.js	Wed Jul 05 19:21:26 2017 +0200
@@ -100,3 +100,9 @@
 var jlist = Java.to(obj, java.util.List);
 print(jlist instanceof java.util.List);
 print(jlist);
+
+var obj = new JSObject() {
+    toNumber: function() { return 42; }
+};
+
+print(32 + obj);
--- a/nashorn/test/script/basic/JDK-8024847.js.EXPECTED	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/test/script/basic/JDK-8024847.js.EXPECTED	Wed Jul 05 19:21:26 2017 +0200
@@ -10,3 +10,4 @@
 [hello, world]
 true
 [nashorn, js]
+74
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026161.js	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,32 @@
+/*
+ * 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-8026161: Don't narrow floating-point literals in the lexer
+ *
+ * @test
+ * @run
+ */
+
+print(new java.awt.Color(1, 1, 1)) // creates Color[r=1,g=1,b=1]
+print(new java.awt.Color(1.0, 1.0, 1.0)) // Color[r=255,g=255,b=255]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026161.js.EXPECTED	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,2 @@
+java.awt.Color[r=1,g=1,b=1]
+java.awt.Color[r=255,g=255,b=255]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026701.js	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,72 @@
+/*
+ * 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-8026701: Array.prototype.splice is slow on dense arrays
+ *
+ * @test
+ * @run
+ */
+
+function testSplice(arr, e1, e2, e3) {
+    try {
+        print(arr);
+        print(arr.splice(3, 0, e1, e2, e3));
+        print(arr);
+        print(arr.splice(2, 3));
+        print(arr);
+        print(arr.splice(2, 3, arr[2], arr[3], arr[4]));
+        print(arr);
+        print(arr.splice(20, 10));
+        print(arr);
+        print(arr.splice(arr.length, 0, e1, e2, e3));
+        print(arr);
+        print(arr.splice(0, 2, arr[0], arr[1], arr[2], arr[3]));
+        print(arr);
+    } catch (error) {
+        print(error);
+    }
+}
+
+function convert(array, type) {
+    return (typeof Java === "undefined") ? array : Java.from(Java.to(array, type));
+}
+
+// run some splice tests on all dense array implementations
+testSplice([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], -1, -2, -3);
+testSplice(convert([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], "long[]"), -1, -2, -3);
+testSplice(convert([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], "double[]"), -1, -2, -3);
+testSplice(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"], -1, -2, -3);
+
+// test array conversion during splice
+testSplice([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], -1, "-2", "-3");
+testSplice([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], -1, -2.5, -3.5);
+testSplice(convert([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], "long[]"), -1, "-2", "-3");
+testSplice(convert([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], "long[]"), -1, -2.5, -3.5);
+testSplice(convert([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], "double[]"), -1, "-2", "-3");
+
+// test combination with defined elements
+testSplice(Object.defineProperty([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 5, {value: 13}), -1, -2, -3);
+testSplice(Object.defineProperty([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 5, {value: 13, writable: false}), -1, -2, -3);
+testSplice(Object.defineProperty([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 5, {value: 13, configurable: false}), -1, -2, -3);
+testSplice(Object.defineProperty([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 5, {value: 13, writable: false, configurable: false}), -1, -2, -3);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026701.js.EXPECTED	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,147 @@
+1,2,3,4,5,6,7,8,9,10
+
+1,2,3,-1,-2,-3,4,5,6,7,8,9,10
+3,-1,-2
+1,2,-3,4,5,6,7,8,9,10
+-3,4,5
+1,2,-3,4,5,6,7,8,9,10
+
+1,2,-3,4,5,6,7,8,9,10
+
+1,2,-3,4,5,6,7,8,9,10,-1,-2,-3
+1,2
+1,2,-3,4,-3,4,5,6,7,8,9,10,-1,-2,-3
+1,2,3,4,5,6,7,8,9,10
+
+1,2,3,-1,-2,-3,4,5,6,7,8,9,10
+3,-1,-2
+1,2,-3,4,5,6,7,8,9,10
+-3,4,5
+1,2,-3,4,5,6,7,8,9,10
+
+1,2,-3,4,5,6,7,8,9,10
+
+1,2,-3,4,5,6,7,8,9,10,-1,-2,-3
+1,2
+1,2,-3,4,-3,4,5,6,7,8,9,10,-1,-2,-3
+1,2,3,4,5,6,7,8,9,10
+
+1,2,3,-1,-2,-3,4,5,6,7,8,9,10
+3,-1,-2
+1,2,-3,4,5,6,7,8,9,10
+-3,4,5
+1,2,-3,4,5,6,7,8,9,10
+
+1,2,-3,4,5,6,7,8,9,10
+
+1,2,-3,4,5,6,7,8,9,10,-1,-2,-3
+1,2
+1,2,-3,4,-3,4,5,6,7,8,9,10,-1,-2,-3
+1,2,3,4,5,6,7,8,9,10
+
+1,2,3,-1,-2,-3,4,5,6,7,8,9,10
+3,-1,-2
+1,2,-3,4,5,6,7,8,9,10
+-3,4,5
+1,2,-3,4,5,6,7,8,9,10
+
+1,2,-3,4,5,6,7,8,9,10
+
+1,2,-3,4,5,6,7,8,9,10,-1,-2,-3
+1,2
+1,2,-3,4,-3,4,5,6,7,8,9,10,-1,-2,-3
+1,2,3,4,5,6,7,8,9,10
+
+1,2,3,-1,-2,-3,4,5,6,7,8,9,10
+3,-1,-2
+1,2,-3,4,5,6,7,8,9,10
+-3,4,5
+1,2,-3,4,5,6,7,8,9,10
+
+1,2,-3,4,5,6,7,8,9,10
+
+1,2,-3,4,5,6,7,8,9,10,-1,-2,-3
+1,2
+1,2,-3,4,-3,4,5,6,7,8,9,10,-1,-2,-3
+1,2,3,4,5,6,7,8,9,10
+
+1,2,3,-1,-2.5,-3.5,4,5,6,7,8,9,10
+3,-1,-2.5
+1,2,-3.5,4,5,6,7,8,9,10
+-3.5,4,5
+1,2,-3.5,4,5,6,7,8,9,10
+
+1,2,-3.5,4,5,6,7,8,9,10
+
+1,2,-3.5,4,5,6,7,8,9,10,-1,-2.5,-3.5
+1,2
+1,2,-3.5,4,-3.5,4,5,6,7,8,9,10,-1,-2.5,-3.5
+1,2,3,4,5,6,7,8,9,10
+
+1,2,3,-1,-2,-3,4,5,6,7,8,9,10
+3,-1,-2
+1,2,-3,4,5,6,7,8,9,10
+-3,4,5
+1,2,-3,4,5,6,7,8,9,10
+
+1,2,-3,4,5,6,7,8,9,10
+
+1,2,-3,4,5,6,7,8,9,10,-1,-2,-3
+1,2
+1,2,-3,4,-3,4,5,6,7,8,9,10,-1,-2,-3
+1,2,3,4,5,6,7,8,9,10
+
+1,2,3,-1,-2.5,-3.5,4,5,6,7,8,9,10
+3,-1,-2.5
+1,2,-3.5,4,5,6,7,8,9,10
+-3.5,4,5
+1,2,-3.5,4,5,6,7,8,9,10
+
+1,2,-3.5,4,5,6,7,8,9,10
+
+1,2,-3.5,4,5,6,7,8,9,10,-1,-2.5,-3.5
+1,2
+1,2,-3.5,4,-3.5,4,5,6,7,8,9,10,-1,-2.5,-3.5
+1,2,3,4,5,6,7,8,9,10
+
+1,2,3,-1,-2,-3,4,5,6,7,8,9,10
+3,-1,-2
+1,2,-3,4,5,6,7,8,9,10
+-3,4,5
+1,2,-3,4,5,6,7,8,9,10
+
+1,2,-3,4,5,6,7,8,9,10
+
+1,2,-3,4,5,6,7,8,9,10,-1,-2,-3
+1,2
+1,2,-3,4,-3,4,5,6,7,8,9,10,-1,-2,-3
+1,2,3,4,5,13,7,8,9,10
+
+1,2,3,-1,-2,-3,4,5,13,7,8,9,10
+3,-1,-2
+1,2,-3,4,5,13,7,8,9,10
+-3,4,5
+1,2,-3,4,5,13,7,8,9,10
+
+1,2,-3,4,5,13,7,8,9,10
+
+1,2,-3,4,5,13,7,8,9,10,-1,-2,-3
+1,2
+1,2,-3,4,-3,4,5,13,7,8,9,10,-1,-2,-3
+1,2,3,4,5,13,7,8,9,10
+TypeError: "5" is not a writable property of [object Array]
+1,2,3,4,5,13,7,8,9,10
+
+1,2,3,-1,-2,-3,4,5,13,7,8,9,10
+3,-1,-2
+1,2,-3,4,5,13,7,8,9,10
+-3,4,5
+1,2,-3,4,5,13,7,8,9,10
+
+1,2,-3,4,5,13,7,8,9,10
+
+1,2,-3,4,5,13,7,8,9,10,-1,-2,-3
+1,2
+1,2,-3,4,-3,4,5,13,7,8,9,10,-1,-2,-3
+1,2,3,4,5,13,7,8,9,10
+TypeError: "5" is not a writable property of [object Array]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026805.js	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,49 @@
+/*
+ * 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-8026805: Array.prototype.length doesn't work as expected
+ *
+ * @test
+ * @run
+ */
+
+if (Array.prototype.length !== 0) {
+    throw new Error("Initial length not 0");
+}
+
+Array.prototype[3] = 1;
+
+if (Array.prototype.length !== 4) {
+    throw new Error("length not updated to 4");
+}
+
+Array.prototype.length = 0;
+
+if (Array.prototype.length !== 0) {
+    throw new Error("length not reset to 0");
+}
+
+if (3 in Array.prototype) {
+    throw new Error("array element not deleted");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026858.js	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,66 @@
+/*
+ * 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-8026858: Array length does not handle defined properties correctly
+ *
+ * @test
+ * @run
+ */
+
+var arr = [];
+
+Object.defineProperty(arr, "3", {value: 1 /* configurable: false */});
+
+if (arr[3] != 1) {
+    throw new Error("arr[3] not defined");
+}
+
+if (arr.length !== 4) {
+    throw new Error("Array length not updated to 4");
+}
+
+Object.defineProperty(arr, "5", {value: 1, configurable: true});
+
+if (arr[5] != 1) {
+    throw new Error("arr[5] not defined");
+}
+
+if (arr.length !== 6) {
+    throw new Error("Array length not updated to 4");
+}
+
+arr.length = 0;
+
+if (5 in arr) {
+    throw new Error("configurable element was not deleted");
+}
+
+if (arr[3] != 1) {
+    throw new Error("non-configurable element was deleted");
+}
+
+if (arr.length !== 4) {
+    throw new Error("Array length not set");
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026955.js	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,51 @@
+/*
+ * 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-8026955: for-in should convert primitive values to object
+ *
+ * @test
+ * @run
+ */
+
+Object.prototype[4] = "world";
+String.prototype[3] = "hello";
+Number.prototype[3] = "hello";
+Boolean.prototype[3] = "hello";
+
+function testForIn(x) {
+    for (var i in x) {
+        print(i, x[i]);
+    }
+    for each (var i in x) {
+        print(i);
+    }
+}
+
+testForIn("abc");
+testForIn(false);
+testForIn(3);
+testForIn(null);
+testForIn();
+testForIn(String.prototype);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026955.js.EXPECTED	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,22 @@
+0 a
+1 b
+2 c
+3 hello
+4 world
+a
+b
+c
+hello
+world
+3 hello
+4 world
+hello
+world
+3 hello
+4 world
+hello
+world
+3 hello
+4 world
+hello
+world
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8027016.js	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,42 @@
+/*
+ * 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-8027016: Array.prototype.indexOf should return -1 when array is of length zero
+ *
+ * @test
+ * @run
+ */
+
+var res = [].indexOf(null, {valueOf:function(){throw "not reached"}});
+if (res != -1) {
+    fail("expected -1 on indexOf on empty array");
+}
+
+// add index beyond length check as well
+
+res = [].indexOf(null, 1);
+if (res != -1) {
+    fail("expected -1 on indexOf on empty array");
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8027024.js	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,58 @@
+/*
+ * 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-8027024: String.prototype.charAt and charCodeAt do not evaluate 'self' and 'pos' arguments in right order 
+ *
+ * @test
+ * @run
+ */
+
+
+String.prototype.charAt.call(
+    {
+        toString: function() {
+            print("charAt.self.toString");
+        }
+    },
+
+    {
+        valueOf: function() {
+            print("charAt.pos.valueOf");
+        }
+    }
+);
+
+String.prototype.charCodeAt.call(
+    {
+        toString: function() {
+            print("charCodeAt.self.toString");
+        }
+    },
+
+    {
+        valueOf: function() {
+            print("charCodeAt.pos.valueOf");
+        }
+    }
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8027024.js.EXPECTED	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,4 @@
+charAt.self.toString
+charAt.pos.valueOf
+charCodeAt.self.toString
+charCodeAt.pos.valueOf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8027042.js	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,58 @@
+/*
+ * 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-8027042: Evaluation order for binary operators can be improved
+ *
+ * @test
+ * @run
+ */
+
+// var with getter side effect
+Object.defineProperty(this, "a", { get: function() {print("get a"); return 1; }});
+
+// var with both getter and conversion side effect
+Object.defineProperty(this, "b", { get: function() {print("get b"); return {valueOf: function() { print("conv b"); return 10; }}; }});
+
+(function() {
+    // var with toPrimitive conversion side effect
+    var c = {valueOf: function() { print("conv c"); return 100; }};
+
+    print(b + (c + a));
+    print(b + (c + b));
+    print(b + (a + b));
+    print(b + (b + c));
+    print(b + (b + c));
+    print(b + (c + (a - b)));
+    print(b + (c + (c - b)));
+    print(b + (c + (b - c)));
+    print(b + (b + (a ? 2 : 3)));
+    print(b + (b + (b ? 2 : 3)));
+    print(b + (b + (c ? 2 : 3)));
+    print(b + ((-c) + (-a)));
+    print(b + ((-c) + (-b)));
+    print(b + ((-c) + (-c)));
+    try { print(b + new a); } catch (e) {}
+    try { print(b + new b); } catch (e) {}
+    try { print(b + new c); } catch (e) {}
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8027042.js.EXPECTED	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,88 @@
+get b
+get a
+conv c
+conv b
+111
+get b
+get b
+conv c
+conv b
+conv b
+120
+get b
+get a
+get b
+conv b
+conv b
+21
+get b
+get b
+conv b
+conv c
+conv b
+120
+get b
+get b
+conv b
+conv c
+conv b
+120
+get b
+get a
+get b
+conv b
+conv c
+conv b
+101
+get b
+get b
+conv c
+conv b
+conv c
+conv b
+200
+get b
+get b
+conv b
+conv c
+conv c
+conv b
+20
+get b
+get b
+get a
+conv b
+conv b
+22
+get b
+get b
+get b
+conv b
+conv b
+22
+get b
+get b
+conv b
+conv b
+22
+get b
+conv c
+get a
+conv b
+-91
+get b
+conv c
+get b
+conv b
+conv b
+-100
+get b
+conv c
+conv c
+conv b
+-190
+get b
+get a
+get b
+get b
+get b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8027562.js	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,39 @@
+/*
+ * 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-8027562: eval should load second and subsequent arguments for side effect
+ *
+ * @test
+ * @run
+ */
+
+try {
+    eval("", x);
+    fail("should have thrown ReferenceError for 'x'");
+} catch (e) {
+    if (! (e instanceof ReferenceError)) {
+        fail("Expected ReferenceError, got " + e);
+    }
+    print(e);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8027562.js.EXPECTED	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,1 @@
+ReferenceError: "x" is not defined
--- a/nashorn/test/script/basic/NASHORN-397.js	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/test/script/basic/NASHORN-397.js	Wed Jul 05 19:21:26 2017 +0200
@@ -35,11 +35,8 @@
     fail("typeof(5).x is not 'number'");
 }
 
-// It is function because PrintStream implements Closeable, which is
-// marked with @FunctionalInterface. Yes, this means calling a stream
-// like "stream()" closes it.
-if (typeof (java.lang.System.out) != 'function') {
-    fail("typeof java.lang.System.out is not 'object'");
+if (typeof (java.net.Proxy.NO_PROXY) != 'object') {
+    fail("typeof java.net.Proxy.NO_PROXY is not 'object'");
 }
 
 if (typeof (java.lang.Math.PI) != 'number') {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/jfx.js	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Base library for JavaFX canvas run by Nashorn testing.
+ * @subtest
+ * 
+ * 
+ */
+
+var System               = Java.type("java.lang.System");
+var AWTImage             = Java.type("org.jemmy.image.AWTImage");
+var PNGDecoder           = Java.type("org.jemmy.image.PNGDecoder");
+var JemmyFxRoot          = Java.type("org.jemmy.fx.Root");
+var AWTRobotCapturer     = Java.type("org.jemmy.image.AWTRobotCapturer");
+var ByWindowType         = Java.type("org.jemmy.fx.ByWindowType");
+var Scene                = Java.type("javafx.scene.Scene");
+var Stage                = Java.type("javafx.stage.Stage");
+var File                 = Java.type("java.io.File");
+var Timer                = Java.type("java.util.Timer");
+var TimerTask            = Java.type("java.util.TimerTask");
+var OSInfo               = Java.type("sun.awt.OSInfo");
+var OSType               = Java.type("sun.awt.OSInfo.OSType");
+var StringBuffer         = Java.type("java.lang.StringBuffer");
+
+var WAIT = 2000;
+var TESTNAME = "test";
+var fsep = System.getProperty("file.separator");
+
+function checkImageAndExit() {
+    var raceTimer = new Timer(true);
+    var timerTask = new TimerTask() {
+        run: function run() {
+            var tmpdir = System.getProperty("java.io.tmpdir");
+            var timenow = (new Date()).getTime();
+            makeScreenShot(tmpdir + fsep + "screenshot" + timenow +".png");
+            var dupImg = isDuplicateImages(tmpdir + fsep + "screenshot" + timenow +".png", __DIR__ + "jfx" + fsep + TESTNAME + fsep + "golden");
+            (new File(mpdir + fsep + "screenshot" + timenow +".png")).delete();
+            if (!dupImg) System.err.println("ERROR: screenshot does not match golden image");
+            exit(0);
+        }
+    };
+    raceTimer.schedule(timerTask, WAIT);
+}
+
+function makeScreenShot(shootToImg) {
+   JemmyFxRoot.ROOT.getEnvironment().setImageCapturer(new AWTRobotCapturer());
+   var wrap = JemmyFxRoot.ROOT.lookup(new ByWindowType($STAGE.class)).lookup(Scene.class).wrap(0);
+   var imageJemmy = wrap.getScreenImage();
+   imageJemmy.save(shootToImg);
+}
+
+function isDuplicateImages(file1, file2) {
+    var f1 = new File(file1);
+    var f2;
+    var sb = new StringBuffer(file2);
+    if (OSInfo.getOSType() == OSType.WINDOWS) {
+        f2 = new File(sb.append(fsep + "windows.png").toString());
+    } else if (OSInfo.getOSType() == OSType.LINUX) {
+        f2 = new File(sb.append(fsep + "linux.png").toString());
+    } else if (OSInfo.getOSType() == OSType.MACOSX) {
+        f2 = new File(sb.append(fsep + "macosx.png").toString());
+    }
+    print(f1.getAbsolutePath());
+    print(f2.getAbsolutePath());
+    if (f1.exists() && f2.exists()) {
+        var image1 = new AWTImage(PNGDecoder.decode(f1.getAbsolutePath()));
+        var image2 = new AWTImage(PNGDecoder.decode(f2.getAbsolutePath()));
+        return image1.compareTo(image2) == null ? true : false;
+    }
+    return false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/jfx/flyingimage.js	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Testing JavaFX canvas run by Nashorn.
+ *
+ * @test/nocompare
+ * @run
+ * @fork
+ */
+
+TESTNAME = "flyingimage";
+
+var Image                = Java.type("javafx.scene.image.Image");
+var Color                = Java.type("javafx.scene.paint.Color");
+var Canvas               = Java.type("javafx.scene.canvas.Canvas");
+var BorderPane           = Java.type("javafx.scene.layout.BorderPane");
+var StackPane            = Java.type("javafx.scene.layout.StackPane");
+var Font                 = Java.type("javafx.scene.text.Font");
+var FontSmoothingType    = Java.type("javafx.scene.text.FontSmoothingType");
+var Text                 = Java.type("javafx.scene.text.Text");
+
+var WIDTH = 800;
+var HEIGHT = 600;
+var canvas = new Canvas(WIDTH, HEIGHT);
+function fileToURL(file) {
+    return new File(file).toURI().toURL().toExternalForm();
+}
+var imageUrl = fileToURL(__DIR__ + "flyingimage/flyingimage.png");
+var img = new Image(imageUrl);
+var font = new Font("Arial", 16);
+var t = 0;
+var isFrameRendered = false;
+function renderFrame() {
+    var gc = canvas.graphicsContext2D;
+    gc.setFill(Color.web("#cccccc"));
+    gc.fillRect(0, 0, WIDTH, HEIGHT);
+    gc.setStroke(Color.web("#000000"));
+    gc.setLineWidth(1);
+    gc.strokeRect(5, 5, WIDTH - 10, HEIGHT - 10);
+    var c = 200;
+    var msc= 0.5 * HEIGHT / img.height;
+    var sp0 = 0.003;
+    for (var h = 0; h < c; h++, t++) {
+        gc.setTransform(1, 0, 0, 1, 0, 0);
+        var yh = h / (c - 1);
+        gc.translate((0.5 + Math.sin(t * sp0 + h * 0.1) / 3) * WIDTH, 25 + (HEIGHT * 3 / 4 - 40) * (yh * yh));
+        var sc = 30 / img.height + msc * yh * yh;
+        gc.rotate(90 * Math.sin(t * sp0 + h * 0.1 + Math.PI));
+        gc.scale(sc, sc);
+        gc.drawImage(img, -img.width / 2, -img.height / 2);
+     }
+    gc.setTransform(1, 0, 0, 1, 0, 0);
+    isFrameRendered = true;
+}
+var stack = new StackPane();
+var pane = new BorderPane();
+
+pane.setCenter(canvas);
+stack.getChildren().add(pane);
+$STAGE.scene = new Scene(stack);
+renderFrame();
+checkImageAndExit();
Binary file nashorn/test/script/jfx/flyingimage/flyingimage.png has changed
Binary file nashorn/test/script/jfx/flyingimage/golden/linux.png has changed
Binary file nashorn/test/script/jfx/flyingimage/golden/macosx.png has changed
Binary file nashorn/test/script/jfx/flyingimage/golden/windows.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/jfx/kaleidoscope.js	Wed Jul 05 19:21:26 2017 +0200
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Testing JavaFX canvas run by Nashorn.
+ *
+ * @test/nocompare
+ * @run
+ * @fork
+ */
+
+TESTNAME = "kaleidoscope";
+WAIT = 4000;
+
+var Paint                = Java.type("javafx.scene.paint.Paint");
+var Canvas               = Java.type("javafx.scene.canvas.Canvas");
+var BorderPane           = Java.type("javafx.scene.layout.BorderPane");
+var StackPane            = Java.type("javafx.scene.layout.StackPane");
+var StrokeLineCap        = Java.type("javafx.scene.shape.StrokeLineCap");
+        
+var WIDTH = 800;
+var HEIGHT = 600;
+var canvas = new Canvas(WIDTH, HEIGHT);
+var context = canvas.graphicsContext2D;
+
+var x,y;
+var p_x,p_y;
+var a=0;
+var b=0;
+var angle=Math.PI/180*8;
+var color=0;
+var limit1=Math.PI*1.5;
+var limit2=Math.PI*1.79;
+var c=new Array(6);
+var d=new Array(6);
+var r,e;
+var fade;
+var prv_x,prv_y,prv_x2,prv_y2;
+
+function renderFrame() {
+	a=0.2*angle;
+	b=0.7*angle;
+	r=0;
+	fade=32;
+	for(var i=0;i<6;i++)
+		{
+		c[i]=1.0/(i+1)/2;
+		d[i]=1.0/(i+1)/2;
+		}
+	radius=Math.round((WIDTH+HEIGHT)/8);
+	e=radius*0.2;
+	p_x=Math.round(WIDTH/2);
+	p_y=Math.round(HEIGHT/2);
+	x=(radius*c[0])*Math.cos(a*d[1])+(radius*c[2])*Math.sin(a*d[3])+(radius*c[4])*Math.sin(a*d[5]);
+	y=(radius*c[5])*Math.sin(a*d[4])+(radius*c[3])*Math.cos(a*d[2])+(radius*c[1])*Math.cos(a*d[0]);
+    for (i = 0; i < 800; i++) {
+        anim();
+    }
+}
+
+function anim() {
+	var a1=Math.cos(a*2);
+	var a2=Math.cos(a*4);
+	var a3=Math.cos(a);
+	var a4=Math.sin(a);
+	if(b>limit1&&b<limit2) {
+		r+=radius*0.02*a1;
+		prv_x=x;
+		prv_y=y;
+		x=prv_x2+r*a3;
+		y=prv_y2+r*a4;
+	} else {
+		prv_x=x;
+		prv_y=y;
+		prv_x2=x;
+		prv_y2=y;
+		x=(radius*c[0])*Math.cos(a*d[1])+(radius*c[2])*Math.sin(a*d[3])+(radius*c[4])*Math.sin(a*d[5]);
+		y=(radius*c[5])*Math.sin(a*d[4])+(radius*c[3])*Math.cos(a*d[2])+(radius*c[1])*Math.cos(a*d[0]);
+	}
+	var c3=16*Math.cos(a*10);
+	var c1=Math.floor(56*Math.cos(a*angle*4)+c3);
+	var c2=Math.floor(56*Math.sin(a*angle*4)-c3);
+	context.lineCap=StrokeLineCap.ROUND;
+	context.setStroke(Paint.valueOf('rgba('+(192+c1)+','+(192+c2)+','+(192-c1)+','+(0.01-0.005*-a1)+')'));
+	context.lineWidth=e*1.4+e*0.8*a3;
+	draw_line(p_x,p_y,prv_x,prv_y,x,y);
+	context.lineWidth=e+e*0.8*a3;
+	draw_line(p_x,p_y,prv_x,prv_y,x,y);
+	context.setStroke(Paint.valueOf('rgba('+(192+c1)+','+(192+c2)+','+(192-c1)+','+(0.06-0.03*-a1)+')'));
+	context.lineWidth=e*0.6+e*0.35*a3;
+	draw_line(p_x,p_y,prv_x,prv_y,x,y);
+	context.setStroke(Paint.valueOf('rgba(0,0,0,0.06)'));
+	context.lineWidth=e*0.4+e*0.225*a3;
+	draw_line(p_x,p_y,prv_x,prv_y,x,y);
+	context.setStroke(Paint.valueOf('rgba('+(192+c1)+','+(192+c2)+','+(192-c1)+','+(0.1-0.075*-a1)+')'));
+	context.lineWidth=e*0.2+e*0.1*a3;
+	draw_line(p_x,p_y,prv_x,prv_y,x,y);
+	context.setStroke(Paint.valueOf('rgba(255,255,255,0.4)'));
+	context.lineWidth=e*(0.1-0.05*-a2);
+	draw_line(p_x,p_y,prv_x,prv_y,x,y);
+	a+=angle*Math.cos(b);
+	b+=angle*0.1;
+}
+
+function draw_line(x,y,x1,y1,x2,y2) {
+	context.beginPath();
+	context.moveTo(x+x1,y+y1);
+	context.lineTo(x+x2,y+y2);
+	context.moveTo(x-x1,y+y1);
+	context.lineTo(x-x2,y+y2);
+	context.moveTo(x-x1,y-y1);
+	context.lineTo(x-x2,y-y2);
+	context.moveTo(x+x1,y-y1);
+	context.lineTo(x+x2,y-y2);
+	context.moveTo(x+y1,y+x1);
+	context.lineTo(x+y2,y+x2);
+	context.moveTo(x-y1,y+x1);
+	context.lineTo(x-y2,y+x2);
+	context.moveTo(x-y1,y-x1);
+	context.lineTo(x-y2,y-x2);
+	context.moveTo(x+y1,y-x1);
+	context.lineTo(x+y2,y-x2);
+	context.moveTo(x,y+x2);
+	context.lineTo(x,y+x1);
+	context.moveTo(x,y-x2);
+	context.lineTo(x,y-x1);
+	context.moveTo(x+x2,y);
+	context.lineTo(x+x1,y);
+	context.moveTo(x-x2,y);
+	context.lineTo(x-x1,y);
+	context.stroke();
+	context.closePath();
+}
+
+var stack = new StackPane();
+var pane = new BorderPane();
+
+pane.setCenter(canvas);
+stack.getChildren().add(pane);
+$STAGE.scene = new Scene(stack);
+renderFrame();
+checkImageAndExit();
\ No newline at end of file
Binary file nashorn/test/script/jfx/kaleidoscope/golden/linux.png has changed
Binary file nashorn/test/script/jfx/kaleidoscope/golden/macosx.png has changed
Binary file nashorn/test/script/jfx/kaleidoscope/golden/windows.png has changed
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -412,7 +412,7 @@
 
     @Test
     public void accessMethodMixedWithEllipsis() throws ScriptException {
-        assertArrayEquals(new Object[] { "Hello", 10, true, -100500, 80 }, (Object[])e.eval("o.methodMixedWithEllipsis('Hello', 10, true, -100500,80.0);"));
+        assertArrayEquals(new Object[] { "Hello", 10, true, -100500, 80d }, (Object[])e.eval("o.methodMixedWithEllipsis('Hello', 10, true, -100500,80.0);"));
         assertArrayEquals(new Object[] { "Nashorn", 15 }, (Object[])e.eval("o.methodMixedWithEllipsis('Nashorn',15);"));
     }
 
@@ -431,8 +431,8 @@
 
     @Test
     public void accessMethodDoubleVSintOverloaded() throws ScriptException {
-        assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(0.0);"));
-        assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(1000.0);"));
+        assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(0.0);"));
+        assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(1000.0);"));
         assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(0.01);"));
         assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(100.02);"));
         assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(0);"));
--- a/nashorn/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -46,7 +46,7 @@
  * JSObject implementations.
  */
 public class PluggableJSObjectTest {
-    public static class MapWrapperObject extends JSObject {
+    public static class MapWrapperObject extends AbstractJSObject {
         private final HashMap<String, Object> map = new LinkedHashMap<>();
 
         public HashMap<String, Object> getMap() {
@@ -109,7 +109,7 @@
         }
     }
 
-    public static class BufferObject extends JSObject {
+    public static class BufferObject extends AbstractJSObject {
         private final IntBuffer buf;
 
         public BufferObject(int size) {
@@ -170,7 +170,7 @@
         }
     }
 
-    public static class Adder extends JSObject {
+    public static class Adder extends AbstractJSObject {
         @Override
         public Object call(Object thiz, Object... args) {
             double res = 0.0;
@@ -202,7 +202,7 @@
         }
     }
 
-    public static class Factory extends JSObject {
+    public static class Factory extends AbstractJSObject {
         @Override
         public Object newObject(Object... args) {
             return new HashMap<Object, Object>();
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java	Thu Oct 31 16:46:43 2013 -0700
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java	Wed Jul 05 19:21:26 2017 +0200
@@ -129,7 +129,7 @@
         final ScriptEngine e = m.getEngineByName("nashorn");
         try {
             e.eval("var obj = { '1': 'world', func: function() { return this.bar; }, bar: 'hello' }");
-            JSObject obj = (JSObject) e.get("obj");
+            ScriptObjectMirror obj = (ScriptObjectMirror) e.get("obj");
 
             // try basic get on existing properties
             if (!obj.getMember("bar").equals("hello")) {