Merge
authorduke
Wed, 05 Jul 2017 23:16:15 +0200
changeset 44714 2604fd725a3d
parent 44713 16e5fb0c8ba4 (current diff)
parent 44711 af3c856d50b6 (diff)
child 44717 c5579ebd7223
Merge
jdk/test/java/net/MulticastSocket/JoinGroup.java
jdk/test/java/net/MulticastSocket/Leave.java
--- a/.hgtags-top-repo	Sat Apr 22 00:21:46 2017 +0000
+++ b/.hgtags-top-repo	Wed Jul 05 23:16:15 2017 +0200
@@ -409,3 +409,4 @@
 c38c6b270ccc8e2b86d1631bcf42248241b54d2c jdk-9+163
 7810f75d016a52e32295c4233009de5ca90e31af jdk-9+164
 aff4f339acd40942d3dab499846b52acd87b3af1 jdk-9+165
+ba5b16c9c6d80632b61959a33d424b1c3398ce62 jdk-9+166
--- a/common/conf/jib-profiles.js	Sat Apr 22 00:21:46 2017 +0000
+++ b/common/conf/jib-profiles.js	Wed Jul 05 23:16:15 2017 +0200
@@ -231,7 +231,8 @@
     // List of the main profile names used for iteration
     common.main_profile_names = [
         "linux-x64", "linux-x86", "macosx-x64", "solaris-x64",
-        "solaris-sparcv9", "windows-x64", "windows-x86"
+        "solaris-sparcv9", "windows-x64", "windows-x86",
+        "linux-arm64", "linux-arm-vfp-hflt", "linux-arm-vfp-hflt-dyn"
     ];
 
     // These are the base setttings for all the main build profiles.
@@ -391,7 +392,7 @@
     // on such hardware.
     if (input.build_cpu == "sparcv9") {
        var cpu_brand = $EXEC("bash -c \"kstat -m cpu_info | grep brand | head -n1 | awk '{ print \$2 }'\"");
-       if (cpu_brand.trim() == 'SPARC-M7') {
+       if (cpu_brand.trim().match('SPARC-.7')) {
            boot_jdk_revision = "8u20";
            boot_jdk_subdirpart = "1.8.0_20";
        }
@@ -471,8 +472,43 @@
             build_cpu: "x64",
             dependencies: ["devkit", "freetype"],
             configure_args: concat(common.configure_args_32bit),
+        },
+
+        "linux-arm64": {
+            target_os: "linux",
+            target_cpu: "aarch64",
+            build_cpu: "x64",
+            dependencies: ["devkit", "build_devkit", "cups", "headless_stubs"],
+            configure_args: [
+                "--with-cpu-port=arm64",
+                "--with-jvm-variants=server",
+                "--openjdk-target=aarch64-linux-gnu",
+                "--enable-headless-only"
+            ],
+        },
+
+        "linux-arm-vfp-hflt": {
+            target_os: "linux",
+            target_cpu: "arm",
+            build_cpu: "x64",
+            dependencies: ["devkit", "build_devkit", "cups"],
+            configure_args: [
+                "--with-jvm-variants=minimal1,client",
+                "--with-x=" + input.get("devkit", "install_path") + "/arm-linux-gnueabihf/libc/usr/X11R6-PI",
+                "--openjdk-target=arm-linux-gnueabihf",
+                "--with-abi-profile=arm-vfp-hflt"
+            ],
+        },
+
+        // Special version of the SE profile adjusted to be testable on arm64 hardware.
+        "linux-arm-vfp-hflt-dyn": {
+            configure_args: "--with-stdc++lib=dynamic"
         }
     };
+    // Let linux-arm-vfp-hflt-dyn inherit everything from linux-arm-vfp-hflt
+    profiles["linux-arm-vfp-hflt-dyn"] = concatObjects(
+        profiles["linux-arm-vfp-hflt-dyn"], profiles["linux-arm-vfp-hflt"]);
+
     // Add the base settings to all the main profiles
     common.main_profile_names.forEach(function (name) {
         profiles[name] = concatObjects(common.main_profile_base, profiles[name]);
@@ -584,7 +620,7 @@
     var testOnlyProfilesPrebuilt = {
         "run-test-prebuilt": {
             src: "src.conf",
-            dependencies: [ "jtreg", "gnumake", testedProfile + ".jdk",
+            dependencies: [ "jtreg", "gnumake", "boot_jdk", testedProfile + ".jdk",
                 testedProfile + ".test", "src.full"
             ],
             work_dir: input.get("src.full", "install_path") + "/test",
@@ -658,16 +694,28 @@
         "windows-x86": {
             platform: "windows-x86",
             demo_ext: "zip"
+        },
+       "linux-arm64": {
+            platform: "linux-arm64-vfp-hflt",
+            demo_ext: "tar.gz"
+        },
+        "linux-arm-vfp-hflt": {
+            platform: "linux-arm32-vfp-hflt",
+            demo_ext: "tar.gz"
+        },
+        "linux-arm-vfp-hflt-dyn": {
+            platform: "linux-arm32-vfp-hflt-dyn",
+            demo_ext: "tar.gz"
         }
     }
     // Generate common artifacts for all main profiles
-    common.main_profile_names.forEach(function (name) {
+    Object.keys(artifactData).forEach(function (name) {
         profiles[name] = concatObjects(profiles[name],
             common.main_profile_artifacts(artifactData[name].platform, artifactData[name].demo_ext));
     });
 
     // Generate common artifacts for all debug profiles
-    common.main_profile_names.forEach(function (name) {
+    Object.keys(artifactData).forEach(function (name) {
         var debugName = name + common.debug_suffix;
         profiles[debugName] = concatObjects(profiles[debugName],
             common.debug_profile_artifacts(artifactData[name].platform));
@@ -839,7 +887,11 @@
         macosx_x64: "Xcode6.3-MacOSX10.9+1.0",
         solaris_x64: "SS12u4-Solaris11u1+1.0",
         solaris_sparcv9: "SS12u4-Solaris11u1+1.0",
-        windows_x64: "VS2013SP4+1.0"
+        windows_x64: "VS2013SP4+1.0",
+        linux_aarch64: "gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux+1.0",
+        linux_arm: (input.profile != null && input.profile.indexOf("hflt") >= 0
+                    ? "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0"
+                    : "arm-linaro-4.7+1.0")
     };
 
     var devkit_platform = (input.target_cpu == "x86"
--- a/corba/.hgtags	Sat Apr 22 00:21:46 2017 +0000
+++ b/corba/.hgtags	Wed Jul 05 23:16:15 2017 +0200
@@ -409,3 +409,4 @@
 493011dee80e51c2a2b064d049183c047df36d80 jdk-9+163
 965bbae3072702f7c0d95c240523b65e6bb19261 jdk-9+164
 a510b2201154abdd12ede42788086b5283bfb9a6 jdk-9+165
+934c18145915b06d3fcc0de1a30f91f5aab8a192 jdk-9+166
--- a/hotspot/.hgtags	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/.hgtags	Wed Jul 05 23:16:15 2017 +0200
@@ -569,3 +569,4 @@
 983fe207555724d98f4876991e1cbafbcf2733e8 jdk-9+163
 0af429be8bbaeaaf0cb838e9af28c953dda6a9c8 jdk-9+164
 c92c6416ca03b1464d5ed99cf6201e52b5ba0a70 jdk-9+165
+560d7aa083a24b6a56443feb8de0f40435d33aa9 jdk-9+166
--- a/hotspot/src/cpu/s390/vm/c1_Runtime1_s390.cpp	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/src/cpu/s390/vm/c1_Runtime1_s390.cpp	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2016 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
--- a/hotspot/src/share/vm/oops/metadata.hpp	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/src/share/vm/oops/metadata.hpp	Wed Jul 05 23:16:15 2017 +0200
@@ -47,6 +47,7 @@
   virtual bool is_method()             const volatile { return false; }
   virtual bool is_methodData()         const volatile { return false; }
   virtual bool is_constantPool()       const volatile { return false; }
+  virtual bool is_methodCounters()     const volatile { return false; }
 
   virtual const char* internal_name()  const = 0;
 
--- a/hotspot/src/share/vm/oops/methodCounters.cpp	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/src/share/vm/oops/methodCounters.cpp	Wed Jul 05 23:16:15 2017 +0200
@@ -73,3 +73,11 @@
 #endif
 }
 
+
+void MethodCounters::print_value_on(outputStream* st) const {
+  assert(is_methodCounters(), "must be methodCounters");
+  st->print("method counters");
+  print_address_on(st);
+}
+
+
--- a/hotspot/src/share/vm/oops/methodCounters.hpp	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/src/share/vm/oops/methodCounters.hpp	Wed Jul 05 23:16:15 2017 +0200
@@ -30,7 +30,7 @@
 #include "interpreter/invocationCounter.hpp"
 #include "runtime/arguments.hpp"
 
-class MethodCounters: public MetaspaceObj {
+class MethodCounters : public Metadata {
  friend class VMStructs;
  friend class JVMCIVMStructs;
  private:
@@ -109,10 +109,11 @@
   }
 
  public:
+  virtual bool is_methodCounters() const volatile { return true; }
+
   static MethodCounters* allocate(methodHandle mh, TRAPS);
 
   void deallocate_contents(ClassLoaderData* loader_data) {}
-  DEBUG_ONLY(bool on_stack() { return false; })  // for template
 
   AOT_ONLY(Method* method() const { return _method; })
 
@@ -120,8 +121,6 @@
     return align_size_up(sizeof(MethodCounters), wordSize) / wordSize;
   }
 
-  bool is_klass() const { return false; }
-
   void clear_counters();
 
 #if defined(COMPILER2) || INCLUDE_JVMCI
@@ -253,5 +252,9 @@
   static ByteSize backedge_mask_offset() {
     return byte_offset_of(MethodCounters, _backedge_mask);
   }
+
+  virtual const char* internal_name() const { return "{method counters}"; }
+  virtual void print_value_on(outputStream* st) const;
+
 };
 #endif //SHARE_VM_OOPS_METHODCOUNTERS_HPP
--- a/hotspot/src/share/vm/opto/library_call.cpp	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1668,6 +1668,9 @@
   }
 
   Node* adr = array_element_address(value, index, T_CHAR);
+  if (adr->is_top()) {
+    return false;
+  }
   if (is_store) {
     (void) store_to_memory(control(), adr, ch, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered,
                            false, false, true /* mismatched */);
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.cpp	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.cpp	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.hpp	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.hpp	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Wed Jul 05 23:16:15 2017 +0200
@@ -189,19 +189,6 @@
   assert(vf->is_compiled_frame(), "Wrong frame type");
   chunk->push(compiledVFrame::cast(vf));
 
-  ScopeDesc* trap_scope = chunk->at(0)->scope();
-  Handle exceptionObject;
-  if (trap_scope->rethrow_exception()) {
-    if (PrintDeoptimizationDetails) {
-      tty->print_cr("Exception to be rethrown in the interpreter for method %s::%s at bci %d", trap_scope->method()->method_holder()->name()->as_C_string(), trap_scope->method()->name()->as_C_string(), trap_scope->bci());
-    }
-    GrowableArray<ScopeValue*>* expressions = trap_scope->expressions();
-    guarantee(expressions != NULL && expressions->length() > 0, "must have exception to throw");
-    ScopeValue* topOfStack = expressions->top();
-    exceptionObject = StackValue::create_stack_value(&deoptee, &map, topOfStack)->get_obj();
-    assert(exceptionObject() != NULL, "exception oop can not be null");
-  }
-
   bool realloc_failures = false;
 
 #if defined(COMPILER2) || INCLUDE_JVMCI
@@ -296,6 +283,19 @@
 #endif // INCLUDE_JVMCI
 #endif // COMPILER2 || INCLUDE_JVMCI
 
+  ScopeDesc* trap_scope = chunk->at(0)->scope();
+  Handle exceptionObject;
+  if (trap_scope->rethrow_exception()) {
+    if (PrintDeoptimizationDetails) {
+      tty->print_cr("Exception to be rethrown in the interpreter for method %s::%s at bci %d", trap_scope->method()->method_holder()->name()->as_C_string(), trap_scope->method()->name()->as_C_string(), trap_scope->bci());
+    }
+    GrowableArray<ScopeValue*>* expressions = trap_scope->expressions();
+    guarantee(expressions != NULL && expressions->length() > 0, "must have exception to throw");
+    ScopeValue* topOfStack = expressions->top();
+    exceptionObject = StackValue::create_stack_value(&deoptee, &map, topOfStack)->get_obj();
+    guarantee(exceptionObject() != NULL, "exception oop can not be null");
+  }
+
   // Ensure that no safepoint is taken after pointers have been stored
   // in fields of rematerialized objects.  If a safepoint occurs from here on
   // out the java state residing in the vframeArray will be missed.
--- a/hotspot/test/compiler/ciReplay/SABase.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/compiler/ciReplay/SABase.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -141,7 +141,7 @@
         if (Platform.isSolaris()) {
             try {
                 OutputAnalyzer oa = ProcessTools.executeProcess("coreadm", "-p", "core",
-                        "" + ProcessHandle.current().getPid());
+                        "" + ProcessHandle.current().pid());
                 oa.shouldHaveExitValue(0);
             } catch (Throwable t) {
                 throw new Error("Can't launch coreadm: " + t, t);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/string/TestStringUTF16IntrinsicRangeChecks.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,320 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 8158168
+ * @summary Verifies that callers of StringUTF16 intrinsics throw array out of bounds exceptions.
+ * @library /compiler/patches /test/lib
+ * @build java.base/java.lang.Helper
+ * @run main/othervm -Xbatch -XX:CompileThreshold=100 -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_getCharStringU,_putCharStringU compiler.intrinsics.string.TestStringUTF16IntrinsicRangeChecks
+ * @run main/othervm -Xbatch -XX:CompileThreshold=100 -esa -ea -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_getCharStringU,_putCharStringU compiler.intrinsics.string.TestStringUTF16IntrinsicRangeChecks
+ */
+package compiler.intrinsics.string;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+
+public class TestStringUTF16IntrinsicRangeChecks {
+
+    public static void main(String[] args) throws Exception {
+        byte[] val = new byte[2];
+        byte[] b4  = new byte[4];
+        char[] c4  = new char[4];
+        String s4 = new String(c4);
+        byte[] valHigh = new byte[2];
+        byte[] valLow  = new byte[2];
+        Helper.putCharSB(valHigh, 0, Character.MIN_HIGH_SURROGATE);
+        Helper.putCharSB(valLow,  0, Character.MIN_LOW_SURROGATE);
+
+        for (int i = 0; i < 1000; ++i) {
+            getChars((int)1234, -5, -5 + 4, val);
+            getChars((int)1234, -1, -1 + 4, val);
+            getChars((int)1234,  0,  0 + 4, val);
+            getChars((int)1234,  1,  1 + 4, val);
+
+            getChars((long)1234, -5, -5 + 4, val);
+            getChars((long)1234, -1, -1 + 4, val);
+            getChars((long)1234,  0,  0 + 4, val);
+            getChars((long)1234,  1,  1 + 4, val);
+
+            byte[] val2 = Arrays.copyOf(val, val.length);
+            putCharSB(val2, -1, '!');
+            putCharSB(val2,  1, '!');
+
+            byte[] val4 = Arrays.copyOf(b4, b4.length);
+            char[] c2  = new char[2];
+            String s2 = new String(c2);
+
+            putCharsSB(val4, -3, c2, 0, 2);
+            putCharsSB(val4, -1, c2, 0, 2);
+            putCharsSB(val4,  0, c4, 0, 4);
+            putCharsSB(val4,  1, c2, 0, 2);
+            putCharsSB(val4, -3, s2, 0, 2);
+            putCharsSB(val4, -1, s2, 0, 2);
+            putCharsSB(val4,  0, s4, 0, 4);
+            putCharsSB(val4,  1, s2, 0, 2);
+
+            codePointAtSB(valHigh, -1, 1);
+            codePointAtSB(valHigh, -1, 2);
+            codePointAtSB(valHigh,  0, 2);
+            codePointAtSB(valHigh,  1, 2);
+
+            codePointBeforeSB(valLow,  0);
+            codePointBeforeSB(valLow, -1);
+            codePointBeforeSB(valLow,  2);
+
+            if (Helper.codePointCountSB(valHigh, 0, 1) != 1) {
+                throw new AssertionError("codePointCountSB");
+            }
+            if (Helper.codePointCountSB(valLow, 0, 1) != 1) {
+                throw new AssertionError("codePointCountSB");
+            }
+            codePointCountSB(valHigh, -1, 0);
+            codePointCountSB(valHigh, -1, 2);
+            codePointCountSB(valHigh,  0, 2);
+
+            charAt(val, -1);
+            charAt(val,  1);
+
+            contentEquals(b4, val, -1);
+            contentEquals(b4, val,  2);
+            contentEquals(val, s4,  2);
+            contentEquals(val, s4, -1);
+
+            StringBuilder sb = new StringBuilder();
+            sb.append((String)null).append(true).append(false);
+            if (!sb.toString().equals("nulltruefalse")) {
+                throw new AssertionError("append");
+            }
+
+            putCharsAt(val2, -1, '1', '2', '3', '4');
+            putCharsAt(val2,  0, '1', '2', '3', '4');
+            putCharsAt(val2,  2, '1', '2', '3', '4');
+            putCharsAt(val2, -1, '1', '2', '3', '4', '5');
+            putCharsAt(val2,  0, '1', '2', '3', '4', '5');
+            putCharsAt(val2,  2, '1', '2', '3', '4', '5');
+
+            reverse(valHigh, -1);
+            reverse(valHigh,  2);
+            reverse(valLow,  -1);
+            reverse(valLow,   2);
+
+            byte[] d4 = new byte[4];
+            inflate(b4, 0, d4, -1, 2);
+            inflate(b4, 0, d4,  3, 2);
+            inflate(b4, 0, d4,  4, 1);
+
+            byte[] b0 = new byte[0];
+            byte[] b1 = new byte[1];
+            byte[] b2 = new byte[2];
+            byte[] t1 = new byte[] {1};
+            byte[] t2 = new byte[] {1, 2};
+            byte[] t4 = new byte[] {1, 2, 3, 4};
+            indexOf(b1,  1, t2,  1, 0);
+            indexOf(b2,  1, t1,  1, 0);
+            indexOf(b2,  2, t2,  1, 0);
+            indexOf(b2,  1, t2,  2, 0);
+            indexOf(b2, -1, t2,  1, 0);
+            indexOf(b2,  1, t2, -1, 0);
+            indexOf(b2,  1, t2,  1, 1);
+
+            indexOfLatin1(b1,  1, t1,  1, 0);
+            indexOfLatin1(b2,  2, t1,  1, 0);
+            indexOfLatin1(b2,  1, b0,  1, 0);
+            indexOfLatin1(b2,  1, t1,  2, 0);
+            indexOfLatin1(b2, -1, t1,  1, 0);
+            indexOfLatin1(b2,  2, t1,  1, 0);
+            indexOfLatin1(b2,  1, t1, -1, 0);
+            indexOfLatin1(b2,  1, t1,  2, 0);
+
+            lastIndexOf(b1, t2, 1, 0);
+            lastIndexOf(b2, t4, 2, 0);
+            lastIndexOf(b2, t2, 1, 0);
+            lastIndexOf(b2, t2, 1, 1);
+
+            lastIndexOfLatin1(b1, t1, 1, 0);
+            lastIndexOfLatin1(b2, t2, 2, 0);
+            lastIndexOfLatin1(b2, t1, 1, 0);
+            lastIndexOfLatin1(b2, t1, 1, 1);
+        }
+    }
+
+    static void getChars(int i, int begin, int end, byte[] value) {
+        try {
+            Helper.getChars(i, begin, end, value);
+            throw new AssertionError("getChars");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void getChars(long l, int begin, int end, byte[] value) {
+        try {
+            Helper.getChars(l, begin, end, value);
+            throw new AssertionError("getChars");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void putCharSB(byte[] val, int index, int c) {
+        try {
+            Helper.putCharSB(val, index, c);
+            throw new AssertionError("putCharSB");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void putCharsSB(byte[] val, int index, char[] ca, int off, int end) {
+        try {
+            Helper.putCharsSB(val, index, ca, off, end);
+            throw new AssertionError("putCharsSB");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void putCharsSB(byte[] val, int index, CharSequence s, int off, int end) {
+        try {
+            Helper.putCharsSB(val, index, s, off, end);
+            throw new AssertionError("putCharsSB");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void codePointAtSB(byte[] val, int index, int end) {
+        try {
+            Helper.codePointAtSB(val, index, end);
+            throw new AssertionError("codePointAtSB");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void codePointBeforeSB(byte[] val, int index) {
+        try {
+            Helper.codePointBeforeSB(val, index);
+            throw new AssertionError("codePointBeforeSB");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void codePointCountSB(byte[] val, int beginIndex, int endIndex) {
+        try {
+            Helper.codePointCountSB(val, beginIndex, endIndex);
+            throw new AssertionError("codePointCountSB");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void charAt(byte[] v, int index) {
+        try {
+            Helper.charAt(v, index);
+            throw new AssertionError("charAt");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void contentEquals(byte[] v1, byte[] v2, int len) {
+        try {
+            Helper.contentEquals(v1, v2, len);
+            throw new AssertionError("contentEquals");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void contentEquals(byte[] v, CharSequence cs, int len) {
+        try {
+            Helper.contentEquals(v, cs, len);
+            throw new AssertionError("contentEquals");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void putCharsAt(byte[] v, int i, char c1, char c2, char c3, char c4) {
+        try {
+            Helper.putCharsAt(v, i, c1, c2, c3, c4);
+            throw new AssertionError("putCharsAt");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void putCharsAt(byte[] v, int i, char c1, char c2, char c3, char c4, char c5) {
+        try {
+            Helper.putCharsAt(v, i, c1, c2, c3, c4, c5);
+            throw new AssertionError("putCharsAt");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void reverse(byte[] v, int len) {
+        try {
+            Helper.reverse(v, len);
+            throw new AssertionError("reverse");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void inflate(byte[] v1, int o1, byte[] v2, int o2, int len) {
+        try {
+            Helper.inflate(v1, o1, v2, o2, len);
+            throw new AssertionError("inflate");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void indexOf(byte[] v1, int l1, byte[] v2, int l2, int from) {
+        try {
+            if (Helper.indexOf(v1, l1, v2, l2, from) != -1) {
+                throw new AssertionError("indexOf");
+            }
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void lastIndexOf(byte[] v1, byte[] v2, int l2, int from) {
+        try {
+            if (Helper.lastIndexOf(v1, v2, l2, from) != -1) {
+                throw new AssertionError("lastIndexOf");
+            }
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void indexOfLatin1(byte[] v1, int l1, byte[] v2, int l2, int from) {
+        try {
+            if (Helper.indexOfLatin1(v1, l1, v2, l2, from) != -1) {
+                throw new AssertionError("indexOfLatin1");
+            }
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void lastIndexOfLatin1(byte[] v1, byte[] v2, int l2, int from) {
+        try {
+            if (Helper.lastIndexOfLatin1(v1, v2, l2, from) != -1) {
+                throw new AssertionError("lastIndexOfLatin1");
+            }
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+}
--- a/hotspot/test/compiler/patches/java.base/java/lang/Helper.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/compiler/patches/java.base/java/lang/Helper.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,4 +73,84 @@
         StringUTF16.getChars(value, srcBegin, srcEnd, dst, dstBegin);
         return dst;
     }
+
+    public static void putCharSB(byte[] val, int index, int c) {
+        StringUTF16.putCharSB(val, index, c);
+    }
+
+    public static void putCharsSB(byte[] val, int index, char[] ca, int off, int end) {
+        StringUTF16.putCharsSB(val, index, ca, off, end);
+    }
+
+    public static void putCharsSB(byte[] val, int index, CharSequence s, int off, int end) {
+        StringUTF16.putCharsSB(val, index, s, off, end);
+    }
+
+    public static int codePointAtSB(byte[] val, int index, int end) {
+        return StringUTF16.codePointAtSB(val, index, end);
+    }
+
+    public static int codePointBeforeSB(byte[] val, int index) {
+        return StringUTF16.codePointBeforeSB(val, index);
+    }
+
+    public static int codePointCountSB(byte[] val, int beginIndex, int endIndex) {
+        return StringUTF16.codePointCountSB(val, beginIndex, endIndex);
+    }
+
+    public static int getChars(int i, int begin, int end, byte[] value) {
+        return StringUTF16.getChars(i, begin, end, value);
+    }
+
+    public static int getChars(long l, int begin, int end, byte[] value) {
+        return StringUTF16.getChars(l, begin, end, value);
+    }
+
+    public static boolean contentEquals(byte[] v1, byte[] v2, int len) {
+        return StringUTF16.contentEquals(v1, v2, len);
+    }
+
+    public static boolean contentEquals(byte[] value, CharSequence cs, int len) {
+        return StringUTF16.contentEquals(value, cs, len);
+    }
+
+    public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4) {
+        return StringUTF16.putCharsAt(value, i, c1, c2, c3, c4);
+    }
+
+    public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4, char c5) {
+        return StringUTF16.putCharsAt(value, i, c1, c2, c3, c4, c5);
+    }
+
+    public static char charAt(byte[] value, int index) {
+        return StringUTF16.charAt(value, index);
+    }
+
+    public static void reverse(byte[] value, int count) {
+        StringUTF16.reverse(value, count);
+    }
+
+    public static void inflate(byte[] src, int srcOff, byte[] dst, int dstOff, int len) {
+        StringUTF16.inflate(src, srcOff, dst, dstOff, len);
+    }
+
+    public static int indexOf(byte[] src, int srcCount,
+                                    byte[] tgt, int tgtCount, int fromIndex) {
+        return StringUTF16.indexOf(src, srcCount, tgt, tgtCount, fromIndex);
+    }
+
+    public static int indexOfLatin1(byte[] src, int srcCount,
+                                    byte[] tgt, int tgtCount, int fromIndex) {
+        return StringUTF16.indexOfLatin1(src, srcCount, tgt, tgtCount, fromIndex);
+    }
+    public static int lastIndexOf(byte[] src, byte[] tgt, int tgtCount, int fromIndex) {
+        int srcCount = StringUTF16.length(src); // ignored
+        return StringUTF16.lastIndexOf(src, srcCount, tgt, tgtCount, fromIndex);
+    }
+
+    public static int lastIndexOfLatin1(byte[] src, byte[] tgt, int tgtCount, int fromIndex) {
+        int srcCount = StringUTF16.length(src); // ignored
+        return StringUTF16.lastIndexOfLatin1(src, srcCount, tgt, tgtCount, fromIndex);
+    }
+
 }
--- a/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,7 @@
 
         // Start the process, get the pid and then wait for the test to finish
         Process process = builder.start();
-        long pid = process.getPid();
+        long pid = process.pid();
         int retval = process.waitFor();
 
         // make sure the SEGVOverflow test crashed
--- a/hotspot/test/serviceability/attach/AttachSetGetFlag.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/serviceability/attach/AttachSetGetFlag.java	Wed Jul 05 23:16:15 2017 +0200
@@ -80,7 +80,7 @@
     try {
       waitForReady(target);
 
-      int pid = (int)target.getPid();
+      int pid = (int)target.pid();
 
       HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString());
 
@@ -116,7 +116,7 @@
     try {
       waitForReady(target);
 
-      int pid = (int)target.getPid();
+      int pid = (int)target.pid();
 
       HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString());
 
--- a/hotspot/test/serviceability/sa/sadebugd/SADebugDTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/serviceability/sa/sadebugd/SADebugDTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,7 +60,7 @@
             return;
         }
 
-        long ourPid = ProcessHandle.current().getPid();
+        long ourPid = ProcessHandle.current().pid();
 
         // The string we are expecting in the debugd ouput
         String golden = String.format(GOLDEN, ourPid);
--- a/hotspot/test/serviceability/tmtools/jstack/DaemonThreadTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstack/DaemonThreadTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,7 +78,7 @@
         thread.start();
 
         // Run jstack tool and collect the output
-        JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+        JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
         ToolResults results = jstackTool.measure();
 
         // Analyze the jstack output for the correct thread type
--- a/hotspot/test/serviceability/tmtools/jstack/SpreadLockTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstack/SpreadLockTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -96,7 +96,7 @@
         debuggee.start();
 
         // Collect output from the jstack tool
-        JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+        JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
         ToolResults results1 = jstackTool.measure();
 
         // Go to method b()
--- a/hotspot/test/serviceability/tmtools/jstack/ThreadNamesTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstack/ThreadNamesTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,7 +61,7 @@
         thread.start();
 
         // Run jstack tool and collect the output
-        JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+        JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
         ToolResults results = jstackTool.measure();
 
         // Analyze the jstack output for the strange thread name
--- a/hotspot/test/serviceability/tmtools/jstack/TraveledLockTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstack/TraveledLockTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,7 @@
         debuggee.start();
 
         // Collect output from the jstack tool
-        JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+        JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
         ToolResults results1 = jstackTool.measure();
 
         // Go to method b()
--- a/hotspot/test/serviceability/tmtools/jstack/WaitNotifyThreadTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstack/WaitNotifyThreadTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -105,7 +105,7 @@
         waitThread.start();
 
         // Collect output from the jstack tool
-        JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+        JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
         ToolResults results = jstackTool.measure();
 
         // Analyze the jstack output for the patterns needed
--- a/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
     public static void main(String[] args) throws Exception {
 
         // We will be running "jstat -gc" tool
-        JstatGcCapacityTool jstatGcTool = new JstatGcCapacityTool(ProcessHandle.current().getPid());
+        JstatGcCapacityTool jstatGcTool = new JstatGcCapacityTool(ProcessHandle.current().pid());
 
         // Run once and get the  results asserting that they are reasonable
         JstatGcCapacityResults measurement1 = jstatGcTool.measure();
--- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest01.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest01.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
     public static void main(String[] args) throws Exception {
 
         // We will be running "jstat -gc" tool
-        JstatGcCauseTool jstatGcTool = new JstatGcCauseTool(ProcessHandle.current().getPid());
+        JstatGcCauseTool jstatGcTool = new JstatGcCauseTool(ProcessHandle.current().pid());
 
         // Run once and get the  results asserting that they are reasonable
         JstatGcCauseResults measurement1 = jstatGcTool.measure();
--- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest02.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest02.java	Wed Jul 05 23:16:15 2017 +0200
@@ -38,6 +38,6 @@
 public class GcCauseTest02 {
 
     public static void main(String[] args) throws Exception {
-        new GarbageProducerTest(new JstatGcCauseTool(ProcessHandle.current().getPid())).run();
+        new GarbageProducerTest(new JstatGcCauseTool(ProcessHandle.current().pid())).run();
     }
 }
--- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest03.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest03.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
     public static void main(String[] args) throws Exception {
 
         // We will be running "jstat -gc" tool
-        JstatGcCauseTool jstatGcTool = new JstatGcCauseTool(ProcessHandle.current().getPid());
+        JstatGcCauseTool jstatGcTool = new JstatGcCauseTool(ProcessHandle.current().pid());
 
         System.gc();
 
--- a/hotspot/test/serviceability/tmtools/jstat/GcNewTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcNewTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@
     public static void main(String[] args) throws Exception {
 
         // We will be running "jstat -gc" tool
-        JstatGcNewTool jstatGcTool = new JstatGcNewTool(ProcessHandle.current().getPid());
+        JstatGcNewTool jstatGcTool = new JstatGcNewTool(ProcessHandle.current().pid());
 
         // Run once and get the  results asserting that they are reasonable
         JstatGcNewResults measurement1 = jstatGcTool.measure();
--- a/hotspot/test/serviceability/tmtools/jstat/GcTest01.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcTest01.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
     public static void main(String[] args) throws Exception {
 
         // We will be running "jstat -gc" tool
-        JstatGcTool jstatGcTool = new JstatGcTool(ProcessHandle.current().getPid());
+        JstatGcTool jstatGcTool = new JstatGcTool(ProcessHandle.current().pid());
 
         // Run once and get the  results asserting that they are reasonable
         JstatGcResults measurement1 = jstatGcTool.measure();
--- a/hotspot/test/serviceability/tmtools/jstat/GcTest02.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcTest02.java	Wed Jul 05 23:16:15 2017 +0200
@@ -38,6 +38,6 @@
 public class GcTest02 {
 
     public static void main(String[] args) throws Exception {
-        new GarbageProducerTest(new JstatGcTool(ProcessHandle.current().getPid())).run();
+        new GarbageProducerTest(new JstatGcTool(ProcessHandle.current().pid())).run();
     }
 }
--- a/jdk/.hgtags	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/.hgtags	Wed Jul 05 23:16:15 2017 +0200
@@ -409,3 +409,4 @@
 50171f8c47961710cbf87aead6f03fa431d8d240 jdk-9+163
 6dea581453d7c0e767e3169cfec8b423a381e71d jdk-9+164
 a7942c3b1e59495dbf51dc7c41aab355fcd253d7 jdk-9+165
+5d2b48f1f0a322aca719b49ff02ab421705bffc7 jdk-9+166
--- a/jdk/make/data/charsetmapping/stdcs-linux	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/make/data/charsetmapping/stdcs-linux	Wed Jul 05 23:16:15 2017 +0200
@@ -24,3 +24,5 @@
 JIS_X_0212
 JIS_X_0208_Solaris
 JIS_X_0212_Solaris
+MS932
+SJIS       # SJIS must go together with MS932 to support sun.nio.cs.map
--- a/jdk/src/java.base/linux/native/libnio/ch/EPoll.c	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/linux/native/libnio/ch/EPoll.c	Wed Jul 05 23:16:15 2017 +0200
@@ -95,9 +95,3 @@
     }
     return res;
 }
-
-JNIEXPORT void JNICALL
-Java_sun_nio_ch_EPoll_close0(JNIEnv *env, jclass c, jint epfd) {
-    int res;
-    RESTARTABLE(close(epfd), res);
-}
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,10 +42,10 @@
  * @author Andreas Sterbenz
  * @since 1.4.2
  */
-final class CounterMode extends FeedbackCipher {
+class CounterMode extends FeedbackCipher {
 
     // current counter value
-    private final byte[] counter;
+    final byte[] counter;
 
     // encrypted bytes of the previous counter value
     private final byte[] encryptedCounter;
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017 Oracle and/or its affiliates. All rights reserved.
  * 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,52 +29,43 @@
 
 package com.sun.crypto.provider;
 
-import java.security.*;
-import javax.crypto.*;
+import javax.crypto.IllegalBlockSizeException;
 import static com.sun.crypto.provider.AESConstants.AES_BLOCK_SIZE;
 
 /**
  * This class represents the GCTR function defined in NIST 800-38D
- * under section 6.5. It needs to be constructed w/ an initialized
- * cipher object, and initial counter block(ICB). Given an input X
- * of arbitrary length, it processes and returns an output which has
- * the same length as X. The invariants of this class are:
- *
- * (1) The length of intialCounterBlk (and also of its clones, e.g.,
- * fields counter and counterSave) is equal to AES_BLOCK_SIZE.
- *
- * (2) After construction, the field counter never becomes null, it
- * always contains a byte array of length AES_BLOCK_SIZE.
+ * under section 6.5.  With a given cipher object and initial counter
+ * block, a counter mode operation is performed.  Blocksize is limited
+ * to 16 bytes.
  *
  * If any invariant is broken, failures can occur because the
  * AESCrypt.encryptBlock method can be intrinsified on the HotSpot VM
  * (see JDK-8067648 for details).
  *
+ * The counter mode operations can be intrinsified and parallelized
+ * by using CounterMode.implCrypt() if HotSpot VM supports it on the
+ * architecture.
+ *
  * <p>This function is used in the implementation of GCM mode.
  *
  * @since 1.8
  */
-final class GCTR {
-
-    // these fields should not change after the object has been constructed
-    private final SymmetricCipher aes;
-    private final byte[] icb;
+final class GCTR extends CounterMode {
 
-    // the current counter value
-    private byte[] counter;
-
-    // needed for save/restore calls
-    private byte[] counterSave = null;
-
-    // NOTE: cipher should already be initialized
     GCTR(SymmetricCipher cipher, byte[] initialCounterBlk) {
-        this.aes = cipher;
+        super(cipher);
         if (initialCounterBlk.length != AES_BLOCK_SIZE) {
             throw new RuntimeException("length of initial counter block (" + initialCounterBlk.length +
                                        ") not equal to AES_BLOCK_SIZE (" + AES_BLOCK_SIZE + ")");
         }
-        this.icb = initialCounterBlk;
-        this.counter = icb.clone();
+
+        iv = initialCounterBlk;
+        reset();
+    }
+
+    @Override
+    String getFeedback() {
+        return "GCTR";
     }
 
     // input must be multiples of 128-bit blocks when calling update
@@ -89,23 +80,11 @@
             throw new RuntimeException("output buffer too small");
         }
 
-        byte[] encryptedCntr = new byte[AES_BLOCK_SIZE];
-
-        int numOfCompleteBlocks = inLen / AES_BLOCK_SIZE;
-        for (int i = 0; i < numOfCompleteBlocks; i++) {
-            aes.encryptBlock(counter, 0, encryptedCntr, 0);
-            for (int n = 0; n < AES_BLOCK_SIZE; n++) {
-                int index = (i * AES_BLOCK_SIZE + n);
-                out[outOfs + index] =
-                    (byte) ((in[inOfs + index] ^ encryptedCntr[n]));
-            }
-            GaloisCounterMode.increment32(counter);
-        }
-        return inLen;
+        return encrypt(in, inOfs, inLen, out, outOfs);
     }
 
     // input can be arbitrary size when calling doFinal
-    protected int doFinal(byte[] in, int inOfs, int inLen, byte[] out,
+    int doFinal(byte[] in, int inOfs, int inLen, byte[] out,
                           int outOfs) throws IllegalBlockSizeException {
         try {
             if (inLen < 0) {
@@ -118,7 +97,7 @@
                 if (lastBlockSize != 0) {
                     // do the last partial block
                     byte[] encryptedCntr = new byte[AES_BLOCK_SIZE];
-                    aes.encryptBlock(counter, 0, encryptedCntr, 0);
+                    embeddedCipher.encryptBlock(counter, 0, encryptedCntr, 0);
                     for (int n = 0; n < lastBlockSize; n++) {
                         out[outOfs + completeBlkLen + n] =
                             (byte) ((in[inOfs + completeBlkLen + n] ^
@@ -131,28 +110,4 @@
         }
         return inLen;
     }
-
-    /**
-     * Resets the content of this object to when it's first constructed.
-     */
-    void reset() {
-        System.arraycopy(icb, 0, counter, 0, icb.length);
-        counterSave = null;
-    }
-
-    /**
-     * Save the current content of this object.
-     */
-    void save() {
-        this.counterSave = this.counter.clone();
-    }
-
-    /**
-     * Restores the content of this object to the previous saved one.
-     */
-    void restore() {
-        if (this.counterSave != null) {
-            this.counter = this.counterSave;
-        }
-    }
 }
--- a/jdk/src/java.base/share/classes/java/io/FilePermission.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/io/FilePermission.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -209,6 +209,10 @@
     private static final Path here = builtInFS.getPath(
             GetPropertyAction.privilegedGetProperty("user.dir"));
 
+    private static final Path EMPTY_PATH = builtInFS.getPath("");
+    private static final Path DASH_PATH = builtInFS.getPath("-");
+    private static final Path DOTDOT_PATH = builtInFS.getPath("..");
+
     /**
      * A private constructor that clones some and updates some,
      * always with a different name.
@@ -341,7 +345,7 @@
                         .normalize();
                 // lastName should always be non-null now
                 Path lastName = npath.getFileName();
-                if (lastName != null && lastName.toString().equals("-")) {
+                if (lastName != null && lastName.equals(DASH_PATH)) {
                     directory = true;
                     recursive = !rememberStar;
                     npath = npath.getParent();
@@ -679,23 +683,76 @@
      * @return the depth in between
      */
     private static int containsPath(Path p1, Path p2) {
-        Path p;
-        try {
-            p = p2.relativize(p1).normalize();
-            if (p.getName(0).toString().isEmpty()) {
-                return 0;
-            } else {
-                for (Path item: p) {
-                    String s = item.toString();
-                    if (!s.equals("..")) {
-                        return -1;
-                    }
-                }
-                return p.getNameCount();
-            }
-        } catch (IllegalArgumentException iae) {
+
+        // Two paths must have the same root. For example,
+        // there is no contains relation between any two of
+        // "/x", "x", "C:/x", "C:x", and "//host/share/x".
+        if (!Objects.equals(p1.getRoot(), p2.getRoot())) {
             return -1;
         }
+
+        // Empty path (i.e. "." or "") is a strange beast,
+        // because its getNameCount()==1 but getName(0) is null.
+        // It's better to deal with it separately.
+        if (p1.equals(EMPTY_PATH)) {
+            if (p2.equals(EMPTY_PATH)) {
+                return 0;
+            } else if (p2.getName(0).equals(DOTDOT_PATH)) {
+                // "." contains p2 iif p2 has no "..". Since a
+                // a normalized path can only have 0 or more
+                // ".." at the beginning. We only need to look
+                // at the head.
+                return -1;
+            } else {
+                // and the distance is p2's name count. i.e.
+                // 3 between "." and "a/b/c".
+                return p2.getNameCount();
+            }
+        } else if (p2.equals(EMPTY_PATH)) {
+            int c1 = p1.getNameCount();
+            if (!p1.getName(c1 - 1).equals(DOTDOT_PATH)) {
+                // "." is inside p1 iif p1 is 1 or more "..".
+                // For the same reason above, we only need to
+                // look at the tail.
+                return -1;
+            }
+            // and the distance is the count of ".."
+            return c1;
+        }
+
+        // Good. No more empty paths.
+
+        // Common heads are removed
+
+        int c1 = p1.getNameCount();
+        int c2 = p2.getNameCount();
+
+        int n = Math.min(c1, c2);
+        int i = 0;
+        while (i < n) {
+            if (!p1.getName(i).equals(p2.getName(i)))
+                break;
+            i++;
+        }
+
+        // for p1 containing p2, p1 must be 0-or-more "..",
+        // and p2 cannot have "..". For the same reason, we only
+        // check tail of p1 and head of p2.
+        if (i < c1 && !p1.getName(c1 - 1).equals(DOTDOT_PATH)) {
+            return -1;
+        }
+
+        if (i < c2 && p2.getName(i).equals(DOTDOT_PATH)) {
+            return -1;
+        }
+
+        // and the distance is the name counts added (after removing
+        // the common heads).
+
+        // For example: p1 = "../../..", p2 = "../a".
+        // After removing the common heads, they become "../.." and "a",
+        // and the distance is (3-1)+(2-1) = 3.
+        return c1 - i + c2 - i;
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -307,6 +307,8 @@
      *             sequence.
      */
     public int codePointAt(int index) {
+        int count = this.count;
+        byte[] value = this.value;
         checkIndex(index, count);
         if (isLatin1()) {
             return value[index] & 0xff;
@@ -560,11 +562,7 @@
             val[count++] = 'l';
             val[count++] = 'l';
         } else {
-            checkOffset(count + 4, val.length >> 1);
-            StringUTF16.putChar(val, count++, 'n');
-            StringUTF16.putChar(val, count++, 'u');
-            StringUTF16.putChar(val, count++, 'l');
-            StringUTF16.putChar(val, count++, 'l');
+            count = StringUTF16.putCharsAt(val, count, 'n', 'u', 'l', 'l');
         }
         this.count = count;
         return this;
@@ -695,18 +693,9 @@
             }
         } else {
             if (b) {
-                checkOffset(count + 4, val.length >> 1);
-                StringUTF16.putChar(val, count++, 't');
-                StringUTF16.putChar(val, count++, 'r');
-                StringUTF16.putChar(val, count++, 'u');
-                StringUTF16.putChar(val, count++, 'e');
+                count = StringUTF16.putCharsAt(val, count, 't', 'r', 'u', 'e');
             } else {
-                checkOffset(count + 5, val.length >> 1);
-                StringUTF16.putChar(val, count++, 'f');
-                StringUTF16.putChar(val, count++, 'a');
-                StringUTF16.putChar(val, count++, 'l');
-                StringUTF16.putChar(val, count++, 's');
-                StringUTF16.putChar(val, count++, 'e');
+                count = StringUTF16.putCharsAt(val, count, 'f', 'a', 'l', 's', 'e');
             }
         }
         this.count = count;
@@ -755,16 +744,15 @@
      * @return  a reference to this object.
      */
     public AbstractStringBuilder append(int i) {
+        int count = this.count;
         int spaceNeeded = count + Integer.stringSize(i);
         ensureCapacityInternal(spaceNeeded);
         if (isLatin1()) {
             Integer.getChars(i, spaceNeeded, value);
         } else {
-            byte[] val = this.value;
-            checkOffset(spaceNeeded, val.length >> 1);
-            Integer.getCharsUTF16(i, spaceNeeded, val);
+            StringUTF16.getChars(i, count, spaceNeeded, value);
         }
-        count = spaceNeeded;
+        this.count = spaceNeeded;
         return this;
     }
 
@@ -781,16 +769,15 @@
      * @return  a reference to this object.
      */
     public AbstractStringBuilder append(long l) {
+        int count = this.count;
         int spaceNeeded = count + Long.stringSize(l);
         ensureCapacityInternal(spaceNeeded);
         if (isLatin1()) {
             Long.getChars(l, spaceNeeded, value);
         } else {
-            byte[] val = this.value;
-            checkOffset(spaceNeeded, val.length >> 1);
-            Long.getCharsUTF16(l, spaceNeeded, val);
+            StringUTF16.getChars(l, count, spaceNeeded, value);
         }
-        count = spaceNeeded;
+        this.count = spaceNeeded;
         return this;
     }
 
@@ -843,6 +830,7 @@
      *             greater than {@code end}.
      */
     public AbstractStringBuilder delete(int start, int end) {
+        int count = this.count;
         if (end > count) {
             end = count;
         }
@@ -850,7 +838,7 @@
         int len = end - start;
         if (len > 0) {
             shift(end, -len);
-            count -= len;
+            this.count = count - len;
         }
         return this;
     }
@@ -925,6 +913,7 @@
      *             greater than {@code end}.
      */
     public AbstractStringBuilder replace(int start, int end, String str) {
+        int count = this.count;
         if (end > count) {
             end = count;
         }
@@ -933,7 +922,7 @@
         int newCount = count + len - (end - start);
         ensureCapacityInternal(newCount);
         shift(end, newCount - count);
-        count = newCount;
+        this.count = newCount;
         putStringAt(start, str);
         return this;
     }
@@ -1500,40 +1489,11 @@
                 val[k] = cj;
             }
         } else {
-            checkOffset(count, val.length >> 1);
-            boolean hasSurrogates = false;
-            for (int j = (n-1) >> 1; j >= 0; j--) {
-                int k = n - j;
-                char cj = StringUTF16.getChar(val, j);
-                char ck = StringUTF16.getChar(val, k);
-                StringUTF16.putChar(val, j, ck);
-                StringUTF16.putChar(val, k, cj);
-                if (Character.isSurrogate(cj) ||
-                    Character.isSurrogate(ck)) {
-                    hasSurrogates = true;
-                }
-            }
-            if (hasSurrogates) {
-                reverseAllValidSurrogatePairs(val, count);
-            }
+            StringUTF16.reverse(val, count);
         }
         return this;
     }
 
-    /** Outlined helper method for reverse() */
-    private void reverseAllValidSurrogatePairs(byte[] val, int count) {
-        for (int i = 0; i < count - 1; i++) {
-            char c2 = StringUTF16.getChar(val, i);
-            if (Character.isLowSurrogate(c2)) {
-                char c1 = StringUTF16.getChar(val, i + 1);
-                if (Character.isHighSurrogate(c1)) {
-                    StringUTF16.putChar(val, i++, c1);
-                    StringUTF16.putChar(val, i, c2);
-                }
-            }
-        }
-    }
-
     /**
      * Returns a string representing the data in this sequence.
      * A new {@code String} object is allocated and initialized to
@@ -1682,6 +1642,7 @@
     }
 
     private final void appendChars(char[] s, int off, int end) {
+        int count = this.count;
         if (isLatin1()) {
             byte[] val = this.value;
             for (int i = off, j = count; i < end; i++) {
@@ -1689,17 +1650,17 @@
                 if (StringLatin1.canEncode(c)) {
                     val[j++] = (byte)c;
                 } else {
-                    count = j;
+                    this.count = count = j;
                     inflate();
                     StringUTF16.putCharsSB(this.value, j, s, i, end);
-                    count += end - i;
+                    this.count = count + end - i;
                     return;
                 }
             }
         } else {
             StringUTF16.putCharsSB(this.value, count, s, off, end);
         }
-        count += end - off;
+        this.count = count + end - off;
     }
 
     private final void appendChars(CharSequence s, int off, int end) {
--- a/jdk/src/java.base/share/classes/java/lang/Integer.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/Integer.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -386,7 +386,7 @@
     }
 
     /** byte[]/UTF16 version    */
-    static void formatUnsignedIntUTF16(int val, int shift, byte[] buf, int offset, int len) {
+    private static void formatUnsignedIntUTF16(int val, int shift, byte[] buf, int offset, int len) {
         int charPos = offset + len;
         int radix = 1 << shift;
         int mask = radix - 1;
@@ -442,7 +442,7 @@
             return new String(buf, LATIN1);
         } else {
             byte[] buf = new byte[size * 2];
-            getCharsUTF16(i, size, buf);
+            StringUTF16.getChars(i, size, buf);
             return new String(buf, UTF16);
         }
     }
@@ -516,49 +516,6 @@
         return charPos;
     }
 
-    /**
-     * This is a variant of {@link #getChars(int, int, byte[])}, but for
-     * UTF-16 coder.
-     *
-     * @param i     value to convert
-     * @param index next index, after the least significant digit
-     * @param buf   target buffer, UTF16-coded.
-     * @return index of the most significant digit or minus sign, if present
-     */
-    static int getCharsUTF16(int i, int index, byte[] buf) {
-        int q, r;
-        int charPos = index;
-
-        boolean negative = (i < 0);
-        if (!negative) {
-            i = -i;
-        }
-
-        // Get 2 digits/iteration using ints
-        while (i <= -100) {
-            q = i / 100;
-            r = (q * 100) - i;
-            i = q;
-            StringUTF16.putChar(buf, --charPos, DigitOnes[r]);
-            StringUTF16.putChar(buf, --charPos, DigitTens[r]);
-        }
-
-        // We know there are at most two digits left at this point.
-        q = i / 10;
-        r = (q * 10) - i;
-        StringUTF16.putChar(buf, --charPos, '0' + r);
-
-        // Whatever left is the remaining digit.
-        if (q < 0) {
-            StringUTF16.putChar(buf, --charPos, '0' - q);
-        }
-
-        if (negative) {
-            StringUTF16.putChar(buf, --charPos, '-');
-        }
-        return charPos;
-    }
-
     // Left here for compatibility reasons, see JDK-8143900.
     static final int [] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999,
                                       99999999, 999999999, Integer.MAX_VALUE };
--- a/jdk/src/java.base/share/classes/java/lang/Long.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/Long.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -414,7 +414,7 @@
     }
 
     /** byte[]/UTF16 version    */
-    static void formatUnsignedLong0UTF16(long val, int shift, byte[] buf, int offset, int len) {
+    private static void formatUnsignedLong0UTF16(long val, int shift, byte[] buf, int offset, int len) {
         int charPos = offset + len;
         int radix = 1 << shift;
         int mask = radix - 1;
@@ -475,7 +475,7 @@
             return new String(buf, LATIN1);
         } else {
             byte[] buf = new byte[size * 2];
-            getCharsUTF16(i, size, buf);
+            StringUTF16.getChars(i, size, buf);
             return new String(buf, UTF16);
         }
     }
@@ -562,61 +562,6 @@
     }
 
     /**
-     * This is a variant of {@link #getChars(long, int, byte[])}, but for
-     * UTF-16 coder.
-     *
-     * @param i     value to convert
-     * @param index next index, after the least significant digit
-     * @param buf   target buffer, UTF16-coded.
-     * @return index of the most significant digit or minus sign, if present
-     */
-    static int getCharsUTF16(long i, int index, byte[] buf) {
-        long q;
-        int r;
-        int charPos = index;
-
-        boolean negative = (i < 0);
-        if (!negative) {
-            i = -i;
-        }
-
-        // Get 2 digits/iteration using longs until quotient fits into an int
-        while (i <= Integer.MIN_VALUE) {
-            q = i / 100;
-            r = (int)((q * 100) - i);
-            i = q;
-            StringUTF16.putChar(buf, --charPos, Integer.DigitOnes[r]);
-            StringUTF16.putChar(buf, --charPos, Integer.DigitTens[r]);
-        }
-
-        // Get 2 digits/iteration using ints
-        int q2;
-        int i2 = (int)i;
-        while (i2 <= -100) {
-            q2 = i2 / 100;
-            r  = (q2 * 100) - i2;
-            i2 = q2;
-            StringUTF16.putChar(buf, --charPos, Integer.DigitOnes[r]);
-            StringUTF16.putChar(buf, --charPos, Integer.DigitTens[r]);
-        }
-
-        // We know there are at most two digits left at this point.
-        q2 = i2 / 10;
-        r  = (q2 * 10) - i2;
-        StringUTF16.putChar(buf, --charPos, '0' + r);
-
-        // Whatever left is the remaining digit.
-        if (q2 < 0) {
-            StringUTF16.putChar(buf, --charPos, '0' - q2);
-        }
-
-        if (negative) {
-            StringUTF16.putChar(buf, --charPos, '-');
-        }
-        return charPos;
-    }
-
-    /**
      * Returns the string representation size for a given long value.
      *
      * @param x long value
--- a/jdk/src/java.base/share/classes/java/lang/Process.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/Process.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,10 +80,10 @@
  *
  * <p>Subclasses of Process should override the {@link #onExit()} and
  * {@link #toHandle()} methods to provide a fully functional Process including the
- * {@link #getPid() process id},
- * {@link #info() information about the process},
- * {@link #children() direct children}, and
- * {@link #descendants() direct children plus descendants of those children} of the process.
+ * {@linkplain #pid() process id},
+ * {@linkplain #info() information about the process},
+ * {@linkplain #children() direct children}, and
+ * {@linkplain #descendants() direct children plus descendants of those children} of the process.
  * Delegating to the underlying Process or ProcessHandle is typically
  * easiest and most efficient.
  *
@@ -237,14 +237,14 @@
     /**
      * Kills the process.
      * Whether the process represented by this {@code Process} object is
-     * {@link #supportsNormalTermination normally terminated} or not is
+     * {@linkplain #supportsNormalTermination normally terminated} or not is
      * implementation dependent.
      * Forcible process destruction is defined as the immediate termination of a
      * process, whereas normal termination allows the process to shut down cleanly.
      * If the process is not alive, no action is taken.
      * <p>
      * The {@link java.util.concurrent.CompletableFuture} from {@link #onExit} is
-     * {@link java.util.concurrent.CompletableFuture#complete completed}
+     * {@linkplain java.util.concurrent.CompletableFuture#complete completed}
      * when the process has terminated.
      */
     public abstract void destroy();
@@ -257,7 +257,7 @@
      * If the process is not alive, no action is taken.
      * <p>
      * The {@link java.util.concurrent.CompletableFuture} from {@link #onExit} is
-     * {@link java.util.concurrent.CompletableFuture#complete completed}
+     * {@linkplain java.util.concurrent.CompletableFuture#complete completed}
      * when the process has terminated.
      * <p>
      * Invoking this method on {@code Process} objects returned by
@@ -335,15 +335,15 @@
      *
      * @implSpec
      * The implementation of this method returns the process id as:
-     * {@link #toHandle toHandle().getPid()}.
+     * {@link #toHandle toHandle().pid()}.
      *
      * @return the native process id of the process
      * @throws UnsupportedOperationException if the Process implementation
      *         does not support this operation
      * @since 9
      */
-    public long getPid() {
-        return toHandle().getPid();
+    public long pid() {
+        return toHandle().pid();
     }
 
     /**
@@ -357,9 +357,9 @@
      * <p>
      * Calling {@code onExit().get()} waits for the process to terminate and returns
      * the Process. The future can be used to check if the process is
-     * {@link java.util.concurrent.CompletableFuture#isDone done} or to
-     * {@link java.util.concurrent.CompletableFuture#get() wait} for it to terminate.
-     * {@link java.util.concurrent.CompletableFuture#cancel(boolean) Cancelling}
+     * {@linkplain java.util.concurrent.CompletableFuture#isDone done} or to
+     * {@linkplain java.util.concurrent.CompletableFuture#get() wait} for it to terminate.
+     * {@linkplain java.util.concurrent.CompletableFuture#cancel(boolean) Cancelling}
      * the CompletableFuture does not affect the Process.
      * <p>
      * Processes returned from {@link ProcessBuilder#start} override the
@@ -389,7 +389,7 @@
      * {@code waitFor} is interrupted, the thread's interrupt status is preserved.
      * <p>
      * When {@link #waitFor()} returns successfully the CompletableFuture is
-     * {@link java.util.concurrent.CompletableFuture#complete completed} regardless
+     * {@linkplain java.util.concurrent.CompletableFuture#complete completed} regardless
      * of the exit status of the process.
      *
      * This implementation may consume a lot of memory for thread stacks if a
@@ -463,7 +463,7 @@
      * This implementation throws an instance of
      * {@link java.lang.UnsupportedOperationException} and performs no other action.
      * Subclasses should override this method to provide a ProcessHandle for the
-     * process.  The methods {@link #getPid}, {@link #info}, {@link #children},
+     * process.  The methods {@link #pid}, {@link #info}, {@link #children},
      * and {@link #descendants}, unless overridden, operate on the ProcessHandle.
      *
      * @return Returns a ProcessHandle for the Process
@@ -500,10 +500,10 @@
     /**
      * Returns a snapshot of the direct children of the process.
      * The parent of a direct child process is the process.
-     * Typically, a process that is {@link #isAlive not alive} has no children.
+     * Typically, a process that is {@linkplain #isAlive not alive} has no children.
      * <p>
      * <em>Note that processes are created and terminate asynchronously.
-     * There is no guarantee that a process is {@link #isAlive alive}.
+     * There is no guarantee that a process is {@linkplain #isAlive alive}.
      * </em>
      *
      * @implSpec
@@ -526,10 +526,10 @@
      * Returns a snapshot of the descendants of the process.
      * The descendants of a process are the children of the process
      * plus the descendants of those children, recursively.
-     * Typically, a process that is {@link #isAlive not alive} has no children.
+     * Typically, a process that is {@linkplain #isAlive not alive} has no children.
      * <p>
      * <em>Note that processes are created and terminate asynchronously.
-     * There is no guarantee that a process is {@link #isAlive alive}.
+     * There is no guarantee that a process is {@linkplain #isAlive alive}.
      * </em>
      *
      * @implSpec
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,7 +104,7 @@
      * @throws UnsupportedOperationException if the implementation
      *         does not support this operation
      */
-    long getPid();
+    long pid();
 
     /**
      * Returns an {@code Optional<ProcessHandle>} for an existing native process.
@@ -383,7 +383,7 @@
     /**
      * Returns a hash code value for this ProcessHandle.
      * The hashcode value follows the general contract for {@link Object#hashCode()}.
-     * The value is a function of the {@link #getPid getPid()} value and
+     * The value is a function of the {@link #pid pid()} value and
      * may be a function of additional information to uniquely identify the process.
      * If two ProcessHandles are equal according to the {@link #equals(Object) equals}
      * method, then calling the hashCode method on each of the two objects
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Wed Jul 05 23:16:15 2017 +0200
@@ -35,11 +35,7 @@
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
-import java.util.concurrent.ForkJoinPool;
-import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
 import java.util.stream.IntStream;
 import java.util.stream.Stream;
 
@@ -176,7 +172,7 @@
             throw new IllegalStateException("onExit for current process not allowed");
         }
 
-        return ProcessHandleImpl.completion(getPid(), false)
+        return ProcessHandleImpl.completion(pid(), false)
                 .handleAsync((exitStatus, unusedThrowable) -> this);
     }
 
@@ -259,7 +255,7 @@
      * @return the native process ID
      */
     @Override
-    public long getPid() {
+    public long pid() {
         return pid;
     }
 
--- a/jdk/src/java.base/share/classes/java/lang/String.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/String.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1064,11 +1064,7 @@
             if (!isLatin1()) {  // utf16 str and latin1 abs can never be "equal"
                 return false;
             }
-            for (int i = 0; i < len; i++) {
-                if ((char)(v1[i] & 0xff) != StringUTF16.getChar(v2, i)) {
-                    return false;
-                }
-            }
+            return StringUTF16.contentEquals(v1, v2, len);
         }
         return true;
     }
@@ -1120,10 +1116,8 @@
                 }
             }
         } else {
-            for (int i = 0; i < n; i++) {
-                if (StringUTF16.getChar(val, i) != cs.charAt(i)) {
-                    return false;
-                }
+            if (!StringUTF16.contentEquals(val, cs, n)) {
+                return false;
             }
         }
         return true;
@@ -1734,6 +1728,9 @@
         if (tgtCount == 0) {
             return fromIndex;
         }
+        if (tgtCount > srcCount) {
+            return -1;
+        }
         if (srcCoder == tgtCoder) {
             return srcCoder == LATIN1
                 ? StringLatin1.indexOf(src, srcCount, tgt, tgtCount, fromIndex)
@@ -1792,7 +1789,7 @@
      * is the string being searched for.
      *
      * @param   src         the characters being searched.
-     * @param   srcCoder  coder handles the mapping between bytes/chars
+     * @param   srcCoder    coder handles the mapping between bytes/chars
      * @param   srcCount    count of the source string.
      * @param   tgt         the characters being searched for.
      * @param   fromIndex   the index to begin searching from.
@@ -1807,12 +1804,12 @@
          * consistency, don't check for null str.
          */
         int rightIndex = srcCount - tgtCount;
+        if (fromIndex > rightIndex) {
+            fromIndex = rightIndex;
+        }
         if (fromIndex < 0) {
             return -1;
         }
-        if (fromIndex > rightIndex) {
-            fromIndex = rightIndex;
-        }
         /* Empty string always matches. */
         if (tgtCount == 0) {
             return fromIndex;
@@ -1825,31 +1822,8 @@
         if (srcCoder == LATIN1) {    // && tgtCoder == UTF16
             return -1;
         }
-                                     // srcCoder == UTF16 && tgtCoder == LATIN1
-        int min = tgtCount - 1;
-        int i = min + fromIndex;
-        int strLastIndex = tgtCount - 1;
-
-        char strLastChar = (char)(tgt[strLastIndex] & 0xff);
-    startSearchForLastChar:
-        while (true) {
-            while (i >= min && StringUTF16.getChar(src, i) != strLastChar) {
-                i--;
-            }
-            if (i < min) {
-                return -1;
-            }
-            int j = i - 1;
-            int start = j - strLastIndex;
-            int k = strLastIndex - 1;
-            while (j > start) {
-                if (StringUTF16.getChar(src, j--) != (tgt[k--] & 0xff)) {
-                    i--;
-                    continue startSearchForLastChar;
-                }
-            }
-            return start + 1;
-        }
+        // srcCoder == UTF16 && tgtCoder == LATIN1
+        return StringUTF16.lastIndexOfLatin1(src, srcCount, tgt, tgtCount, fromIndex);
     }
 
     /**
@@ -3078,7 +3052,8 @@
      */
     static void checkIndex(int index, int length) {
         if (index < 0 || index >= length) {
-            throw new StringIndexOutOfBoundsException("index " + index);
+            throw new StringIndexOutOfBoundsException("index " + index +
+                                                      ",length " + length);
         }
     }
 
@@ -3116,7 +3091,7 @@
      *          If {@code begin} is negative, {@code begin} is greater than
      *          {@code end}, or {@code end} is greater than {@code length}.
      */
-    private static void checkBoundsBeginEnd(int begin, int end, int length) {
+    static void checkBoundsBeginEnd(int begin, int end, int length) {
         if (begin < 0 || begin > end || end > length) {
             throw new StringIndexOutOfBoundsException(
                 "begin " + begin + ", end " + end + ", length " + length);
--- a/jdk/src/java.base/share/classes/java/lang/StringConcatHelper.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/StringConcatHelper.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -293,7 +293,7 @@
         if (coder == String.LATIN1) {
             return Integer.getChars(value, index, buf);
         } else {
-            return Integer.getCharsUTF16(value, index, buf);
+            return StringUTF16.getChars(value, index, buf);
         }
     }
 
@@ -311,7 +311,7 @@
         if (coder == String.LATIN1) {
             return Long.getChars(value, index, buf);
         } else {
-            return Long.getCharsUTF16(value, index, buf);
+            return StringUTF16.getChars(value, index, buf);
         }
     }
 
--- a/jdk/src/java.base/share/classes/java/lang/StringLatin1.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/StringLatin1.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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.String.LATIN1;
 import static java.lang.String.UTF16;
 import static java.lang.String.checkOffset;
-import static java.lang.String.checkBoundsOffCount;
 
 final class StringLatin1 {
 
@@ -566,11 +565,7 @@
     // inflatedCopy byte[] -> byte[]
     @HotSpotIntrinsicCandidate
     public static void inflate(byte[] src, int srcOff, byte[] dst, int dstOff, int len) {
-        // We need a range check here because 'putChar' has no checks
-        checkBoundsOffCount(dstOff << 1, len << 1, dst.length);
-        for (int i = 0; i < len; i++) {
-            StringUTF16.putChar(dst, dstOff++, src[srcOff++] & 0xff);
-        }
+        StringUTF16.inflate(src, srcOff, dst, dstOff, len);
     }
 
     static class CharsSpliterator implements Spliterator.OfInt {
--- a/jdk/src/java.base/share/classes/java/lang/StringUTF16.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/StringUTF16.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,12 +30,11 @@
 import java.util.Spliterator;
 import java.util.function.IntConsumer;
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.vm.annotation.ForceInline;
+import jdk.internal.vm.annotation.DontInline;
 
 import static java.lang.String.UTF16;
 import static java.lang.String.LATIN1;
-import static java.lang.String.checkIndex;
-import static java.lang.String.checkOffset;
-import static java.lang.String.checkBoundsOffCount;
 
 final class StringUTF16 {
 
@@ -51,33 +50,37 @@
     }
 
     @HotSpotIntrinsicCandidate
-    public static void putChar(byte[] val, int index, int c) {
+    // intrinsic performs no bounds checks
+    static void putChar(byte[] val, int index, int c) {
+        assert index >= 0 && index < length(val) : "Trusted caller missed bounds check";
         index <<= 1;
         val[index++] = (byte)(c >> HI_BYTE_SHIFT);
         val[index]   = (byte)(c >> LO_BYTE_SHIFT);
     }
 
     @HotSpotIntrinsicCandidate
-    public static char getChar(byte[] val, int index) {
+    // intrinsic performs no bounds checks
+    static char getChar(byte[] val, int index) {
+        assert index >= 0 && index < length(val) : "Trusted caller missed bounds check";
         index <<= 1;
         return (char)(((val[index++] & 0xff) << HI_BYTE_SHIFT) |
                       ((val[index]   & 0xff) << LO_BYTE_SHIFT));
     }
 
-    public static char charAt(byte[] value, int index) {
-        if (index < 0 || index >= value.length >> 1) {
-            throw new StringIndexOutOfBoundsException(index);
-        }
-        return getChar(value, index);
-    }
-
     public static int length(byte[] value) {
         return value.length >> 1;
     }
 
-    public static int codePointAt(byte[] value, int index, int end) {
+    private static int codePointAt(byte[] value, int index, int end, boolean checked) {
+        assert index < end;
+        if (checked) {
+            checkIndex(index, value);
+        }
         char c1 = getChar(value, index);
         if (Character.isHighSurrogate(c1) && ++index < end) {
+            if (checked) {
+                checkIndex(index, value);
+            }
             char c2 = getChar(value, index);
             if (Character.isLowSurrogate(c2)) {
                return Character.toCodePoint(c1, c2);
@@ -86,10 +89,22 @@
         return c1;
     }
 
-    public static int codePointBefore(byte[] value, int index) {
-        char c2 = getChar(value, --index);
+    public static int codePointAt(byte[] value, int index, int end) {
+       return codePointAt(value, index, end, false /* unchecked */);
+    }
+
+    private static int codePointBefore(byte[] value, int index, boolean checked) {
+        --index;
+        if (checked) {
+            checkIndex(index, value);
+        }
+        char c2 = getChar(value, index);
         if (Character.isLowSurrogate(c2) && index > 0) {
-            char c1 = getChar(value, --index);
+            --index;
+            if (checked) {
+                checkIndex(index, value);
+            }
+            char c1 = getChar(value, index);
             if (Character.isHighSurrogate(c1)) {
                return Character.toCodePoint(c1, c2);
             }
@@ -97,11 +112,19 @@
         return c2;
     }
 
-    public static int codePointCount(byte[] value, int beginIndex, int endIndex) {
+    public static int codePointBefore(byte[] value, int index) {
+        return codePointBefore(value, index, false /* unchecked */);
+    }
+
+    private static int codePointCount(byte[] value, int beginIndex, int endIndex, boolean checked) {
+        assert beginIndex <= endIndex;
         int count = endIndex - beginIndex;
-        for (int i = beginIndex; i < endIndex; ) {
+        int i = beginIndex;
+        if (checked && i < endIndex) {
+            checkBoundsBeginEnd(i, endIndex, value);
+        }
+        for (; i < endIndex - 1; ) {
             if (Character.isHighSurrogate(getChar(value, i++)) &&
-                i < endIndex &&
                 Character.isLowSurrogate(getChar(value, i))) {
                 count--;
                 i++;
@@ -110,6 +133,10 @@
         return count;
     }
 
+    public static int codePointCount(byte[] value, int beginIndex, int endIndex) {
+        return codePointCount(value, beginIndex, endIndex, false /* unchecked */);
+    }
+
     public static char[] toChars(byte[] value) {
         char[] dst = new char[value.length >> 1];
         getChars(value, 0, dst.length, dst, 0);
@@ -162,7 +189,7 @@
     @HotSpotIntrinsicCandidate
     public static int compress(byte[] src, int srcOff, byte[] dst, int dstOff, int len) {
         // We need a range check here because 'getChar' has no checks
-        checkBoundsOffCount(srcOff << 1, len << 1, src.length);
+        checkBoundsOffCount(srcOff, len, src);
         for (int i = 0; i < len; i++) {
             char c = getChar(src, srcOff);
             if (c > 0xFF) {
@@ -212,7 +239,7 @@
     public static void getChars(byte[] value, int srcBegin, int srcEnd, char dst[], int dstBegin) {
         // We need a range check here because 'getChar' has no checks
         if (srcBegin < srcEnd) {
-            checkBoundsOffCount(srcBegin << 1, (srcEnd - srcBegin) << 1, value.length);
+            checkBoundsOffCount(srcBegin, srcEnd - srcBegin, value);
         }
         for (int i = srcBegin; i < srcEnd; i++) {
             dst[dstBegin++] = getChar(value, i);
@@ -319,14 +346,25 @@
         if (str.length == 0) {
             return 0;
         }
-        if (value.length == 0) {
+        if (value.length < str.length) {
             return -1;
         }
-        return indexOf(value, length(value), str, length(str), 0);
+        return indexOfUnsafe(value, length(value), str, length(str), 0);
     }
 
     @HotSpotIntrinsicCandidate
     public static int indexOf(byte[] value, int valueCount, byte[] str, int strCount, int fromIndex) {
+        checkBoundsBeginEnd(fromIndex, valueCount, value);
+        checkBoundsBeginEnd(0, strCount, str);
+        return indexOfUnsafe(value, valueCount, str, strCount, fromIndex);
+    }
+
+
+    private static int indexOfUnsafe(byte[] value, int valueCount, byte[] str, int strCount, int fromIndex) {
+        assert fromIndex >= 0;
+        assert strCount > 0;
+        assert strCount <= length(str);
+        assert valueCount >= strCount;
         char first = getChar(str, 0);
         int max = (valueCount - strCount);
         for (int i = fromIndex; i <= max; i++) {
@@ -348,6 +386,7 @@
         return -1;
     }
 
+
     /**
      * Handles indexOf Latin1 substring in UTF16 string.
      */
@@ -356,14 +395,24 @@
         if (str.length == 0) {
             return 0;
         }
-        if (value.length == 0) {
+        if (length(value) < str.length) {
             return -1;
         }
-        return indexOfLatin1(value, length(value), str, str.length, 0);
+        return indexOfLatin1Unsafe(value, length(value), str, str.length, 0);
     }
 
     @HotSpotIntrinsicCandidate
     public static int indexOfLatin1(byte[] src, int srcCount, byte[] tgt, int tgtCount, int fromIndex) {
+        checkBoundsBeginEnd(fromIndex, srcCount, src);
+        String.checkBoundsBeginEnd(0, tgtCount, tgt.length);
+        return indexOfLatin1Unsafe(src, srcCount, tgt, tgtCount, fromIndex);
+    }
+
+    public static int indexOfLatin1Unsafe(byte[] src, int srcCount, byte[] tgt, int tgtCount, int fromIndex) {
+        assert fromIndex >= 0;
+        assert tgtCount > 0;
+        assert tgtCount <= tgt.length;
+        assert srcCount >= tgtCount;
         char first = (char)(tgt[0] & 0xff);
         int max = (srcCount - tgtCount);
         for (int i = fromIndex; i <= max; i++) {
@@ -389,6 +438,11 @@
 
     @HotSpotIntrinsicCandidate
     private static int indexOfChar(byte[] value, int ch, int fromIndex, int max) {
+        checkBoundsBeginEnd(fromIndex, max, value);
+        return indexOfCharUnsafe(value, ch, fromIndex, max);
+    }
+
+    private static int indexOfCharUnsafe(byte[] value, int ch, int fromIndex, int max) {
         for (int i = fromIndex; i < max; i++) {
             if (getChar(value, i) == ch) {
                 return i;
@@ -404,6 +458,7 @@
         if (Character.isValidCodePoint(ch)) {
             final char hi = Character.highSurrogate(ch);
             final char lo = Character.lowSurrogate(ch);
+            checkBoundsBeginEnd(fromIndex, max, value);
             for (int i = fromIndex; i < max - 1; i++) {
                 if (getChar(value, i) == hi && getChar(value, i + 1 ) == lo) {
                     return i;
@@ -413,13 +468,21 @@
         return -1;
     }
 
+    // srcCoder == UTF16 && tgtCoder == UTF16
     public static int lastIndexOf(byte[] src, int srcCount,
                                   byte[] tgt, int tgtCount, int fromIndex) {
+        assert fromIndex >= 0;
+        assert tgtCount > 0;
+        assert tgtCount <= length(tgt);
         int min = tgtCount - 1;
         int i = min + fromIndex;
         int strLastIndex = tgtCount - 1;
+
+        checkIndex(strLastIndex, tgt);
         char strLastChar = getChar(tgt, strLastIndex);
 
+        checkIndex(i, src);
+
     startSearchForLastChar:
         while (true) {
             while (i >= min && getChar(src, i) != strLastChar) {
@@ -509,6 +572,9 @@
     public static boolean regionMatchesCI(byte[] value, int toffset,
                                           byte[] other, int ooffset, int len) {
         int last = toffset + len;
+        assert toffset >= 0 && ooffset >= 0;
+        assert ooffset + len <= length(other);
+        assert last <= length(value);
         while (toffset < last) {
             char c1 = getChar(value, toffset++);
             char c2 = getChar(other, ooffset++);
@@ -599,6 +665,8 @@
     private static String toLowerCaseEx(String str, byte[] value,
                                         byte[] result, int first, Locale locale,
                                         boolean localeDependent) {
+        assert(result.length == value.length);
+        assert(first >= 0);
         int resultOffset = first;
         int length = value.length >> 1;
         int srcCount;
@@ -633,6 +701,8 @@
                     System.arraycopy(result, 0, result2, 0, resultOffset << 1);
                     result = result2;
                 }
+                assert resultOffset >= 0;
+                assert resultOffset + mapLen <= length(result);
                 for (int x = 0; x < mapLen; ++x) {
                     putChar(result, resultOffset++, lowerCharArray[x]);
                 }
@@ -697,6 +767,8 @@
                                         byte[] result, int first,
                                         Locale locale, boolean localeDependent)
     {
+        assert(result.length == value.length);
+        assert(first >= 0);
         int resultOffset = first;
         int length = value.length >> 1;
         int srcCount;
@@ -733,10 +805,12 @@
                     byte[] result2 = newBytesFor((result.length >> 1) + mapLen - srcCount);
                     System.arraycopy(result, 0, result2, 0, resultOffset << 1);
                     result = result2;
-                 }
-                 for (int x = 0; x < mapLen; ++x) {
+                }
+                assert resultOffset >= 0;
+                assert resultOffset + mapLen <= length(result);
+                for (int x = 0; x < mapLen; ++x) {
                     putChar(result, resultOffset++, upperCharArray[x]);
-                 }
+                }
             }
         }
         return newString(result, 0, resultOffset);
@@ -757,7 +831,7 @@
             null;
     }
 
-    public static void putChars(byte[] val, int index, char[] str, int off, int end) {
+    private static void putChars(byte[] val, int index, char[] str, int off, int end) {
         while (off < end) {
             putChar(val, index++, str[off++]);
         }
@@ -927,35 +1001,172 @@
     ////////////////////////////////////////////////////////////////
 
     public static void putCharSB(byte[] val, int index, int c) {
-        checkIndex(index, val.length >> 1);
+        checkIndex(index, val);
         putChar(val, index, c);
     }
 
     public static void putCharsSB(byte[] val, int index, char[] ca, int off, int end) {
-        checkOffset(index + end - off, val.length >> 1);
+        checkBoundsBeginEnd(index, index + end - off, val);
         putChars(val, index, ca, off, end);
     }
 
     public static void putCharsSB(byte[] val, int index, CharSequence s, int off, int end) {
-        checkOffset(index + end - off, val.length >> 1);
+        checkBoundsBeginEnd(index, index + end - off, val);
         for (int i = off; i < end; i++) {
             putChar(val, index++, s.charAt(i));
         }
     }
 
     public static int codePointAtSB(byte[] val, int index, int end) {
-        checkOffset(end, val.length >> 1);
-        return codePointAt(val, index, end);
+        return codePointAt(val, index, end, true /* checked */);
     }
 
     public static int codePointBeforeSB(byte[] val, int index) {
-        checkOffset(index, val.length >> 1);
-        return codePointBefore(val, index);
+        return codePointBefore(val, index, true /* checked */);
     }
 
     public static int codePointCountSB(byte[] val, int beginIndex, int endIndex) {
-        checkOffset(endIndex, val.length >> 1);
-        return codePointCount(val, beginIndex, endIndex);
+        return codePointCount(val, beginIndex, endIndex, true /* checked */);
+    }
+
+    public static int getChars(int i, int begin, int end, byte[] value) {
+        checkBoundsBeginEnd(begin, end, value);
+        int pos = getChars(i, end, value);
+        assert begin == pos;
+        return pos;
+    }
+
+    public static int getChars(long l, int begin, int end, byte[] value) {
+        checkBoundsBeginEnd(begin, end, value);
+        int pos = getChars(l, end, value);
+        assert begin == pos;
+        return pos;
+    }
+
+    public static boolean contentEquals(byte[] v1, byte[] v2, int len) {
+        checkBoundsOffCount(0, len, v2);
+        for (int i = 0; i < len; i++) {
+            if ((char)(v1[i] & 0xff) != getChar(v2, i)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public static boolean contentEquals(byte[] value, CharSequence cs, int len) {
+        checkOffset(len, value);
+        for (int i = 0; i < len; i++) {
+            if (getChar(value, i) != cs.charAt(i)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4) {
+        int end = i + 4;
+        checkBoundsBeginEnd(i, end, value);
+        putChar(value, i++, c1);
+        putChar(value, i++, c2);
+        putChar(value, i++, c3);
+        putChar(value, i++, c4);
+        assert(i == end);
+        return end;
+    }
+
+    public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4, char c5) {
+        int end = i + 5;
+        checkBoundsBeginEnd(i, end, value);
+        putChar(value, i++, c1);
+        putChar(value, i++, c2);
+        putChar(value, i++, c3);
+        putChar(value, i++, c4);
+        putChar(value, i++, c5);
+        assert(i == end);
+        return end;
+    }
+
+    public static char charAt(byte[] value, int index) {
+        checkIndex(index, value);
+        return getChar(value, index);
+    }
+
+    public static void reverse(byte[] val, int count) {
+        checkOffset(count, val);
+        int n = count - 1;
+        boolean hasSurrogates = false;
+        for (int j = (n-1) >> 1; j >= 0; j--) {
+            int k = n - j;
+            char cj = getChar(val, j);
+            char ck = getChar(val, k);
+            putChar(val, j, ck);
+            putChar(val, k, cj);
+            if (Character.isSurrogate(cj) ||
+                Character.isSurrogate(ck)) {
+                hasSurrogates = true;
+            }
+        }
+        if (hasSurrogates) {
+            reverseAllValidSurrogatePairs(val, count);
+        }
+    }
+
+    /** Outlined helper method for reverse() */
+    private static void reverseAllValidSurrogatePairs(byte[] val, int count) {
+        for (int i = 0; i < count - 1; i++) {
+            char c2 = getChar(val, i);
+            if (Character.isLowSurrogate(c2)) {
+                char c1 = getChar(val, i + 1);
+                if (Character.isHighSurrogate(c1)) {
+                    putChar(val, i++, c1);
+                    putChar(val, i, c2);
+                }
+            }
+        }
+    }
+
+    // inflatedCopy byte[] -> byte[]
+    public static void inflate(byte[] src, int srcOff, byte[] dst, int dstOff, int len) {
+        // We need a range check here because 'putChar' has no checks
+        checkBoundsOffCount(dstOff, len, dst);
+        for (int i = 0; i < len; i++) {
+            putChar(dst, dstOff++, src[srcOff++] & 0xff);
+        }
+    }
+
+    // srcCoder == UTF16 && tgtCoder == LATIN1
+    public static int lastIndexOfLatin1(byte[] src, int srcCount,
+                                        byte[] tgt, int tgtCount, int fromIndex) {
+        assert fromIndex >= 0;
+        assert tgtCount > 0;
+        assert tgtCount <= tgt.length;
+        int min = tgtCount - 1;
+        int i = min + fromIndex;
+        int strLastIndex = tgtCount - 1;
+
+        char strLastChar = (char)(tgt[strLastIndex] & 0xff);
+
+        checkIndex(i, src);
+
+    startSearchForLastChar:
+        while (true) {
+            while (i >= min && getChar(src, i) != strLastChar) {
+                i--;
+            }
+            if (i < min) {
+                return -1;
+            }
+            int j = i - 1;
+            int start = j - strLastIndex;
+            int k = strLastIndex - 1;
+            while (j > start) {
+                if (getChar(src, j--) != (tgt[k--] & 0xff)) {
+                    i--;
+                    continue startSearchForLastChar;
+                }
+            }
+            return start + 1;
+        }
     }
 
     ////////////////////////////////////////////////////////////////
@@ -975,4 +1186,123 @@
     }
 
     static final int MAX_LENGTH = Integer.MAX_VALUE >> 1;
+
+    // Used by trusted callers.  Assumes all necessary bounds checks have
+    // been done by the caller.
+
+    /**
+     * This is a variant of {@link Integer#getChars(int, int, byte[])}, but for
+     * UTF-16 coder.
+     *
+     * @param i     value to convert
+     * @param index next index, after the least significant digit
+     * @param buf   target buffer, UTF16-coded.
+     * @return index of the most significant digit or minus sign, if present
+     */
+    static int getChars(int i, int index, byte[] buf) {
+        int q, r;
+        int charPos = index;
+
+        boolean negative = (i < 0);
+        if (!negative) {
+            i = -i;
+        }
+
+        // Get 2 digits/iteration using ints
+        while (i <= -100) {
+            q = i / 100;
+            r = (q * 100) - i;
+            i = q;
+            putChar(buf, --charPos, Integer.DigitOnes[r]);
+            putChar(buf, --charPos, Integer.DigitTens[r]);
+        }
+
+        // We know there are at most two digits left at this point.
+        q = i / 10;
+        r = (q * 10) - i;
+        putChar(buf, --charPos, '0' + r);
+
+        // Whatever left is the remaining digit.
+        if (q < 0) {
+            putChar(buf, --charPos, '0' - q);
+        }
+
+        if (negative) {
+            putChar(buf, --charPos, '-');
+        }
+        return charPos;
+    }
+
+    /**
+     * This is a variant of {@link Long#getChars(long, int, byte[])}, but for
+     * UTF-16 coder.
+     *
+     * @param i     value to convert
+     * @param index next index, after the least significant digit
+     * @param buf   target buffer, UTF16-coded.
+     * @return index of the most significant digit or minus sign, if present
+     */
+    static int getChars(long i, int index, byte[] buf) {
+        long q;
+        int r;
+        int charPos = index;
+
+        boolean negative = (i < 0);
+        if (!negative) {
+            i = -i;
+        }
+
+        // Get 2 digits/iteration using longs until quotient fits into an int
+        while (i <= Integer.MIN_VALUE) {
+            q = i / 100;
+            r = (int)((q * 100) - i);
+            i = q;
+            putChar(buf, --charPos, Integer.DigitOnes[r]);
+            putChar(buf, --charPos, Integer.DigitTens[r]);
+        }
+
+        // Get 2 digits/iteration using ints
+        int q2;
+        int i2 = (int)i;
+        while (i2 <= -100) {
+            q2 = i2 / 100;
+            r  = (q2 * 100) - i2;
+            i2 = q2;
+            putChar(buf, --charPos, Integer.DigitOnes[r]);
+            putChar(buf, --charPos, Integer.DigitTens[r]);
+        }
+
+        // We know there are at most two digits left at this point.
+        q2 = i2 / 10;
+        r  = (q2 * 10) - i2;
+        putChar(buf, --charPos, '0' + r);
+
+        // Whatever left is the remaining digit.
+        if (q2 < 0) {
+            putChar(buf, --charPos, '0' - q2);
+        }
+
+        if (negative) {
+            putChar(buf, --charPos, '-');
+        }
+        return charPos;
+    }
+    // End of trusted methods.
+
+    public static void checkIndex(int off, byte[] val) {
+        String.checkIndex(off, length(val));
+    }
+
+    public static void checkOffset(int off, byte[] val) {
+        String.checkOffset(off, length(val));
+    }
+
+    public static void checkBoundsBeginEnd(int begin, int end, byte[] val) {
+        String.checkBoundsBeginEnd(begin, end, length(val));
+    }
+
+    public static void checkBoundsOffCount(int offset, int count, byte[] val) {
+        String.checkBoundsOffCount(offset, count, length(val));
+    }
+
 }
--- a/jdk/src/java.base/share/classes/java/lang/System.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/System.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1766,6 +1766,7 @@
      * @since   1.1
      */
     @Deprecated(since="1.2", forRemoval=true)
+    @SuppressWarnings("removal")
     public static void runFinalizersOnExit(boolean value) {
         Runtime.runFinalizersOnExit(value);
     }
--- a/jdk/src/java.base/share/classes/java/time/temporal/ValueRange.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/time/temporal/ValueRange.java	Wed Jul 05 23:16:15 2017 +0200
@@ -385,7 +385,7 @@
         }
         if (obj instanceof ValueRange) {
             ValueRange other = (ValueRange) obj;
-           return minSmallest == other.minSmallest && minLargest == other.minLargest &&
+            return minSmallest == other.minSmallest && minLargest == other.minLargest &&
                    maxSmallest == other.maxSmallest && maxLargest == other.maxLargest;
         }
         return false;
@@ -398,8 +398,9 @@
      */
     @Override
     public int hashCode() {
-        long hash = minSmallest + minLargest << 16 + minLargest >> 48 + maxSmallest << 32 +
-            maxSmallest >> 32 + maxLargest << 48 + maxLargest >> 16;
+        long hash = minSmallest + (minLargest << 16) + (minLargest >> 48) +
+                (maxSmallest << 32) + (maxSmallest >> 32) + (maxLargest << 48) +
+                (maxLargest >> 16);
         return (int) (hash ^ (hash >>> 32));
     }
 
--- a/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -617,7 +617,7 @@
     }
 
     @Override
-    public long getPid() {
+    public long pid() {
         return pid;
     }
 
--- a/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -523,7 +523,7 @@
 
     @Override
     public CompletableFuture<Process> onExit() {
-        return ProcessHandleImpl.completion(getPid(), false)
+        return ProcessHandleImpl.completion(pid(), false)
                 .handleAsync((exitStatus, unusedThrowable) -> this);
     }
 
@@ -550,8 +550,8 @@
     private static native void terminateProcess(long handle);
 
     @Override
-    public long getPid() {
-        return processHandle.getPid();
+    public long pid() {
+        return processHandle.pid();
     }
 
     private static native int getProcessId0(long handle);
@@ -572,7 +572,7 @@
     @Override
     public String toString() {
         int exitCode = getExitCodeProcess(handle);
-        return new StringBuilder("Process[pid=").append(getPid())
+        return new StringBuilder("Process[pid=").append(pid())
                 .append(", exitValue=").append(exitCode == STILL_ACTIVE ? "\"not exited\"" : exitCode)
                 .append("]").toString();
     }
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/DataFlavor.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/DataFlavor.java	Wed Jul 05 23:16:15 2017 +0200
@@ -211,6 +211,9 @@
      *     representationClass = java.awt.Image
      *     mimeType            = "image/x-java-image"
      * </pre>
+     * Will be {@code null} if {@code java.awt.Image} is not visible, the
+     * {@code java.desktop} module is not loaded, or the {@code java.desktop}
+     * module is not in the run-time image.
      */
     public static final DataFlavor imageFlavor = createConstant("image/x-java-image; class=java.awt.Image", "Image");
 
--- a/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIConstants.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIConstants.java	Wed Jul 05 23:16:15 2017 +0200
@@ -78,7 +78,7 @@
                 return "THUMB_START";
             } else if (hit == WINDOW_TITLE_BAR_HEIGHT) {
                 return "WINDOW_TITLE_BAR_HEIGHT";
-            } else if (hit == THUMB_START) {
+            } else if (hit == ANIMATION_FRAME) {
                 return "ANIMATION_FRAME";
             }
             return getClass().getSimpleName();
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/Application.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/Application.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,24 @@
 import java.awt.PopupMenu;
 import java.awt.Toolkit;
 import java.awt.Window;
-import java.awt.desktop.*;
+import java.awt.desktop.AboutHandler;
+import java.awt.desktop.AppForegroundListener;
+import java.awt.desktop.AppHiddenListener;
+import java.awt.desktop.AppReopenedListener;
+import java.awt.desktop.OpenFilesEvent;
+import java.awt.desktop.OpenFilesHandler;
+import java.awt.desktop.OpenURIEvent;
+import java.awt.desktop.OpenURIHandler;
+import java.awt.desktop.PreferencesHandler;
+import java.awt.desktop.PrintFilesEvent;
+import java.awt.desktop.PrintFilesHandler;
+import java.awt.desktop.QuitHandler;
+import java.awt.desktop.QuitResponse;
+import java.awt.desktop.QuitStrategy;
+import java.awt.desktop.ScreenSleepListener;
+import java.awt.desktop.SystemEventListener;
+import java.awt.desktop.SystemSleepListener;
+import java.awt.desktop.UserSessionListener;
 import java.beans.Beans;
 
 import javax.swing.JMenuBar;
@@ -108,10 +125,10 @@
      *
      * @see AppForegroundListener
      * @see AppHiddenListener
-     * @see AppReOpenedListener
-     * @see AppScreenSleepListener
-     * @see AppSystemSleepListener
-     * @see AppUserSessionListener
+     * @see AppReopenedListener
+     * @see ScreenSleepListener
+     * @see SystemSleepListener
+     * @see UserSessionListener
      *
      * @param listener
      * @since Java for Mac OS X 10.6 Update 3
@@ -126,10 +143,10 @@
      *
      * @see AppForegroundListener
      * @see AppHiddenListener
-     * @see AppReOpenedListener
-     * @see AppScreenSleepListener
-     * @see AppSystemSleepListener
-     * @see AppUserSessionListener
+     * @see AppReopenedListener
+     * @see ScreenSleepListener
+     * @see SystemSleepListener
+     * @see UserSessionListener
      *
      * @param listener
      * @since Java for Mac OS X 10.6 Update 3
@@ -144,7 +161,7 @@
      *
      * Setting the {@link AboutHandler} to {@code null} reverts it to the default Cocoa About window.
      *
-     * @param aboutHandler the handler to respond to the {@link AboutHandler#handleAbout()} message
+     * @param aboutHandler the handler to respond to the {@link AboutHandler#handleAbout} message
      * @since Java for Mac OS X 10.6 Update 3
      * @since Java for Mac OS X 10.5 Update 8
      */
@@ -167,7 +184,7 @@
 
     /**
      * Installs the handler which is notified when the application is asked to open a list of files.
-     * The {@link OpenFilesHandler#openFiles(AppEvent.OpenFilesEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleDocumentTypes} array present in it's Info.plist.
+     * The {@link OpenFilesHandler#openFiles(OpenFilesEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleDocumentTypes} array present in it's Info.plist.
      * See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleDocumentTypes} key to your app's Info.plist.
      *
      * @param openFileHandler
@@ -180,7 +197,7 @@
 
     /**
      * Installs the handler which is notified when the application is asked to print a list of files.
-     * The {@link PrintFilesHandler#printFiles(AppEvent.PrintFilesEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleDocumentTypes} array present in it's Info.plist.
+     * The {@link PrintFilesHandler#printFiles(PrintFilesEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleDocumentTypes} array present in it's Info.plist.
      * See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleDocumentTypes} key to your app's Info.plist.
      *
      * @param printFileHandler
@@ -193,10 +210,10 @@
 
     /**
      * Installs the handler which is notified when the application is asked to open a URL.
-     * The {@link OpenURIHandler#openURI(AppEvent.OpenURIEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleURLTypes} array present in it's Info.plist.
+     * The {@link OpenURIHandler#openURI(OpenURIEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleURLTypes} array present in it's Info.plist.
      * See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleURLTypes} key to your app's Info.plist.
      *
-     * Setting the handler to {@code null} causes all {@link OpenURIHandler#openURI(AppEvent.OpenURIEvent)} requests to be enqueued until another handler is set.
+     * Setting the handler to {@code null} causes all {@link OpenURIHandler#openURI(OpenURIEvent)} requests to be enqueued until another handler is set.
      *
      * @param openURIHandler
      * @since Java for Mac OS X 10.6 Update 3
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationAdapter.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationAdapter.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,26 @@
 
 package com.apple.eawt;
 
+import java.awt.desktop.AboutHandler;
+import java.awt.desktop.AppForegroundListener;
+import java.awt.desktop.AppHiddenListener;
+import java.awt.desktop.AppReopenedListener;
+import java.awt.desktop.OpenFilesHandler;
+import java.awt.desktop.OpenURIHandler;
+import java.awt.desktop.PreferencesHandler;
+import java.awt.desktop.PrintFilesHandler;
+import java.awt.desktop.QuitHandler;
+import java.awt.desktop.ScreenSleepListener;
+import java.awt.desktop.SystemEventListener;
+import java.awt.desktop.SystemSleepListener;
+import java.awt.desktop.UserSessionListener;
+
 /**
  * An abstract adapter class for receiving {@code ApplicationEvents}.
  *
  * ApplicationEvents are deprecated. Use individual app event listeners or handlers instead.
  *
- * @see Application#addAppEventListener(AppEventListener)
+ * @see Application#addAppEventListener(SystemEventListener)
  *
  * @see AboutHandler
  * @see PreferencesHandler
@@ -39,14 +53,14 @@
  * @see PrintFilesHandler
  * @see QuitHandler
  *
- * @see AppReOpenedListener
+ * @see AppReopenedListener
  * @see AppForegroundListener
  * @see AppHiddenListener
  * @see UserSessionListener
  * @see ScreenSleepListener
  * @see SystemSleepListener
  *
- * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReOpenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}.
+ * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReopenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}.
  * @since 1.4
  */
 @SuppressWarnings("deprecation")
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationEvent.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationEvent.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,18 @@
 
 package com.apple.eawt;
 
+import java.awt.desktop.AboutHandler;
+import java.awt.desktop.AppReopenedListener;
+import java.awt.desktop.OpenFilesHandler;
+import java.awt.desktop.PreferencesHandler;
+import java.awt.desktop.PrintFilesHandler;
+import java.awt.desktop.QuitHandler;
 import java.util.EventObject;
 
 /**
  * The class of events sent to the deprecated ApplicationListener callbacks.
  *
- * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReOpenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}
+ * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReopenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}
  * @since 1.4
  */
 @Deprecated
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationListener.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationListener.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,25 @@
 
 package com.apple.eawt;
 
+import java.awt.desktop.AboutHandler;
+import java.awt.desktop.AppForegroundListener;
+import java.awt.desktop.AppHiddenListener;
+import java.awt.desktop.AppReopenedListener;
+import java.awt.desktop.OpenFilesHandler;
+import java.awt.desktop.OpenURIHandler;
+import java.awt.desktop.PreferencesHandler;
+import java.awt.desktop.PrintFilesHandler;
+import java.awt.desktop.QuitHandler;
+import java.awt.desktop.ScreenSleepListener;
+import java.awt.desktop.SystemEventListener;
+import java.awt.desktop.SystemSleepListener;
+import java.awt.desktop.UserSessionListener;
 import java.util.EventListener;
 
 /**
  * ApplicationEvents are deprecated. Use individual AppEvent listeners or handlers instead.
  *
- * @see Application#addAppEventListener(AppEventListener)
+ * @see Application#addAppEventListener(SystemEventListener)
  *
  * @see AboutHandler
  * @see PreferencesHandler
@@ -39,7 +52,7 @@
  * @see PrintFilesHandler
  * @see QuitHandler
  *
- * @see AppReOpenedListener
+ * @see AppReopenedListener
  * @see AppForegroundListener
  * @see AppHiddenListener
  * @see UserSessionListener
@@ -47,7 +60,7 @@
  * @see SystemSleepListener
  *
  * @since 1.4
- * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReOpenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}
+ * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReopenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}
  */
 @SuppressWarnings("deprecation")
 @Deprecated
@@ -146,7 +159,7 @@
      * event is sent from another application, include that code as part of this handler.
      *
      * @param event the Reopen Application event
-     * @deprecated use {@link AppReOpenedListener}
+     * @deprecated use {@link AppReopenedListener}
      */
     @Deprecated
     public void handleReOpenApplication(ApplicationEvent event);
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenAdapter.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenAdapter.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,13 +25,15 @@
 
 package com.apple.eawt;
 
+import java.awt.Window;
+
 import com.apple.eawt.event.FullScreenEvent;
 
 /**
  * Abstract adapter class for receiving fullscreen events. This class is provided
  * as a convenience for creating listeners.
  *
- * Subclasses registered with {@link FullScreenUtilities#addFullScreenListenerTo(javax.swing.RootPaneContainer, FullScreenListener)}
+ * Subclasses registered with {@link FullScreenUtilities#addFullScreenListenerTo(Window, FullScreenListener)}
  * will receive all entering/entered/exiting/exited full screen events.
  *
  * @see FullScreenUtilities
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenListener.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenListener.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,25 +37,25 @@
 public interface FullScreenListener extends EventListener {
         /**
      * Invoked when a window has started to enter full screen.
-     * @param event containing the specific window entering full screen.
+     * @param e containing the specific window entering full screen.
      */
         public void windowEnteringFullScreen(final FullScreenEvent e);
 
         /**
      * Invoked when a window has fully entered full screen.
-     * @param event containing the specific window which has entered full screen.
+     * @param e containing the specific window which has entered full screen.
      */
         public void windowEnteredFullScreen(final FullScreenEvent e);
 
         /**
      * Invoked when a window has started to exit full screen.
-     * @param event containing the specific window exiting full screen.
+     * @param e containing the specific window exiting full screen.
      */
         public void windowExitingFullScreen(final FullScreenEvent e);
 
         /**
      * Invoked when a window has fully exited full screen.
-     * @param event containing the specific window which has exited full screen.
+     * @param e containing the specific window which has exited full screen.
      */
         public void windowExitedFullScreen(final FullScreenEvent e);
 }
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenUtilities.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenUtilities.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
 /**
  * Utility class perform animated full screen actions to top-level {@link Window}s.
  *
- * This class manages the relationship between {@link Windows}s and the {@link FullScreenListener}s
+ * This class manages the relationship between {@link Window}s and the {@link FullScreenListener}s
  * attached to them. It's design is similar to the Java SE 6u10 {@link com.sun.awt.AWTUtilities}
  * class which adds additional functionality to AWT Windows, without adding new API to the
  * {@link java.awt.Window} class.
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/MacQuitResponse.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/MacQuitResponse.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,11 +25,14 @@
 
 package com.apple.eawt;
 
+import java.awt.desktop.QuitEvent;
+import java.awt.desktop.QuitHandler;
 import java.awt.desktop.QuitResponse;
+import java.awt.desktop.QuitStrategy;
 
 /**
  * Used to respond to a request to quit the application.
- * The QuitResponse may be used after the {@link QuitHandler#handleQuitRequestWith(AppEvent.QuitEvent, MacQuitResponse)} method has returned, and may be used from any thread.
+ * The QuitResponse may be used after the {@link QuitHandler#handleQuitRequestWith(QuitEvent, QuitResponse)} method has returned, and may be used from any thread.
  *
  * @see Application#setQuitHandler(QuitHandler)
  * @see QuitHandler
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/GestureAdapter.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/GestureAdapter.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
  * Abstract adapter class for receiving gesture events. This class is provided
  * as a convenience for creating listeners.
  *
- * Subclasses registered with {@link GestureUtilities#addGestureListenerTo()}
+ * Subclasses registered with {@link GestureUtilities#addGestureListenerTo}
  * will receive all phase, magnification, rotation, and swipe events.
  *
  * @see GestureUtilities
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/GestureEvent.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/GestureEvent.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 package com.apple.eawt.event;
 
 import java.awt.*;
+import java.awt.event.InputEvent;
 
 /**
  * Abstract event all gestures inherit from.
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/GesturePhaseListener.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/GesturePhaseListener.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,13 +39,13 @@
 public interface GesturePhaseListener extends GestureListener {
     /**
      * Invoked when the user has started a continuous gesture.
-     * @param event representing the start of a continuous gesture.
+     * @param e representing the start of a continuous gesture.
      */
     public void gestureBegan(final GesturePhaseEvent e);
 
     /**
      * Invoked when the user has stopped a continuous gesture.
-     * @param event representing the end of a continuous gesture.
+     * @param e representing the end of a continuous gesture.
      */
     public void gestureEnded(final GesturePhaseEvent e);
 }
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/MagnificationListener.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/MagnificationListener.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
 public interface MagnificationListener extends GestureListener {
     /**
      * Invoked when a magnification gesture is performed by the user.
-     * @param event containing the scale of the magnification.
+     * @param e containing the scale of the magnification.
      */
     public void magnify(final MagnificationEvent e);
 }
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/RotationListener.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/RotationListener.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
 public interface RotationListener extends GestureListener {
     /**
      * Invoked when a rotation gesture is performed by the user.
-     * @param event containing an abstract measure of rotation.
+     * @param e containing an abstract measure of rotation.
      */
     public void rotate(final RotationEvent e);
 }
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/SwipeListener.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/SwipeListener.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,25 +38,25 @@
 public interface SwipeListener extends GestureListener {
     /**
      * Invoked when an upwards swipe gesture is performed by the user.
-     * @param event representing the occurrence of a swipe.
+     * @param e representing the occurrence of a swipe.
      */
     public void swipedUp(final SwipeEvent e);
 
     /**
      * Invoked when a downward swipe gesture is performed by the user.
-     * @param event representing the occurrence of a swipe.
+     * @param e representing the occurrence of a swipe.
      */
     public void swipedDown(final SwipeEvent e);
 
     /**
      * Invoked when a leftward swipe gesture is performed by the user.
-     * @param event representing the occurrence of a swipe.
+     * @param e representing the occurrence of a swipe.
      */
     public void swipedLeft(final SwipeEvent e);
 
     /**
      * Invoked when a rightward swipe gesture is performed by the user.
-     * @param event representing the occurrence of a swipe.
+     * @param e representing the occurrence of a swipe.
      */
     public void swipedRight(final SwipeEvent e);
 }
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3732,7 +3732,6 @@
          * <p>
          * This should be used if the ActionMap can be shared.
          *
-         * @param c JComponent to install the ActionMap on.
          * @param loaderClass Class object that gets loadActionMap invoked
          *                    on.
          * @param defaultsKey Key to use to defaults table to check for
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuPropertyListener.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuPropertyListener.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
 
     /**
      * This method gets called when a bound property is changed.
-     * @param evt A PropertyChangeEvent object describing the event source
+     * @param e A PropertyChangeEvent object describing the event source
      *       and the property that has changed.
      */
     public void propertyChange(final PropertyChangeEvent e) {
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -232,6 +232,7 @@
 
     private volatile boolean isInFullScreen;
     private volatile boolean isIconifyAnimationActive;
+    private volatile boolean isZoomed;
 
     private Window target;
     private LWWindowPeer peer;
@@ -506,7 +507,7 @@
 
     private boolean isMaximized() {
         return undecorated ? this.normalBounds != null
-                : CWrapper.NSWindow.isZoomed(getNSWindowPtr());
+                : isZoomed;
     }
 
     private void maximize() {
@@ -974,6 +975,7 @@
 
     protected void deliverMoveResizeEvent(int x, int y, int width, int height,
                                         boolean byUser) {
+        isZoomed = CWrapper.NSWindow.isZoomed(getNSWindowPtr());
         checkZoom();
 
         final Rectangle oldB = nativeBounds;
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m	Wed Jul 05 23:16:15 2017 +0200
@@ -376,7 +376,7 @@
     static JNF_MEMBER_CACHE(jm_getMaxPage, sjc_CPrinterJob, "getMaxPageAttrib", "()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;");
+    static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormat", "(I)Ljava/awt/print/PageFormat;");
 
     NSMutableDictionary* printingDictionary = [dst dictionary];
 
@@ -412,7 +412,7 @@
     [printingDictionary setObject:[NSNumber numberWithInteger:fromPage] forKey:NSPrintFirstPage];
     [printingDictionary setObject:[NSNumber numberWithInteger:toPage] forKey:NSPrintLastPage];
 
-    jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat); 
+    jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat, (jint)0);
     if (page != NULL) {
         javaPageFormatToNSPrintInfo(env, NULL, page, dst);
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/awt/AWTUtilities.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/awt/AWTUtilities.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 
 import java.awt.*;
 
+import javax.swing.JRootPane;
+
 import sun.awt.AWTAccessor;
 import sun.awt.SunToolkit;
 
@@ -323,7 +325,7 @@
      * is thrown.
      * <p>If the window is a {@code Frame} or a {@code Dialog}, the window must
      * be undecorated prior to enabling the per-pixel translucency effect (see
-     * {@link Frame#setUndecorated()} and/or {@link Dialog#setUndecorated()}).
+     * {@link Frame#setUndecorated} and/or {@link Dialog#setUndecorated}).
      * If the window becomes decorated through a subsequent call to the
      * corresponding {@code setUndecorated()} method, the per-pixel
      * translucency effect will be disabled and the opaque property reset to
@@ -431,7 +433,7 @@
      * </ul>
      * <p>
      * The most common example when the 'mixing-cutout' shape is needed is a
-     * glass pane component. The {@link JRootPane#setGlassPane()} method
+     * glass pane component. The {@link JRootPane#setGlassPane} method
      * automatically sets the <i>empty-shape</i> as the 'mixing-cutout' shape
      * for the given glass pane component.  If a developer needs some other
      * 'mixing-cutout' shape for the glass pane (which is rare), this must be
--- a/jdk/src/java.desktop/share/classes/com/sun/awt/SecurityWarning.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/awt/SecurityWarning.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@
      *
      * The returned value is not valid until the peer has been created. Before
      * invoking this method a developer must call the {@link Window#pack()},
-     * {@link Window#setVisible()}, or some other method that creates the peer.
+     * {@link Window#setVisible}, or some other method that creates the peer.
      *
      * @param window the window to get the security warning size for
      *
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/PaletteBuilder.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/PaletteBuilder.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -84,10 +84,8 @@
      * is unable to create approximation of {@code src}
      * and {@code canCreatePalette} returns {@code false}.
      *
-     * @see createIndexColorModel
-     *
-     * @see canCreatePalette
-     *
+     * @see #createIndexColorModel
+     * @see #canCreatePalette
      */
     public static RenderedImage createIndexedImage(RenderedImage src) {
         PaletteBuilder pb = new PaletteBuilder(src);
@@ -107,10 +105,8 @@
      * is unable to create approximation of {@code img}
      * and {@code canCreatePalette} returns {@code false}.
      *
-     * @see createIndexedImage
-     *
-     * @see canCreatePalette
-     *
+     * @see #createIndexedImage
+     * @see #canCreatePalette
      */
     public static IndexColorModel createIndexColorModel(RenderedImage img) {
         PaletteBuilder pb = new PaletteBuilder(img);
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SingleTileRenderedImage.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SingleTileRenderedImage.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
      * and a ColorModel.
      *
      * @param ras A Raster that will define tile (0, 0) of the image.
-     * @param cm A ColorModel that will serve as the image's
+     * @param colorModel A ColorModel that will serve as the image's
      *           ColorModel.
      */
     public SingleTileRenderedImage(Raster ras, ColorModel colorModel) {
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -729,7 +729,8 @@
     /**
      * Writes any extension blocks, the Image Descriptor, and the image data
      *
-     * @param iioimage The image and image metadata.
+     * @param image The image.
+     * @param imageMetadata The image metadata.
      * @param param The write parameters.
      * @param globalColorTable The Global Color Table.
      * @param sourceBounds The source region.
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -99,7 +99,7 @@
      * of the list if it is present, and any JFXX or APP2ICC marker
      * segments are subordinate to the JFIF marker segment.  This
      * list is package visible so that the writer can access it.
-     * @see #MarkerSegment
+     * @see MarkerSegment
      */
     List<MarkerSegment> markerSequence = new ArrayList<>();
 
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java	Wed Jul 05 23:16:15 2017 +0200
@@ -74,13 +74,13 @@
 
     /**
      * ImageWriteParam for JPEG writer.
-     * May be initialized by {@link #initJPEGWriter()}.
+     * May be initialized by {@link #initJPEGWriter}.
      */
     protected JPEGImageWriteParam JPEGParam = null;
 
     /**
      * The JPEG writer.
-     * May be initialized by {@link #initJPEGWriter()}.
+     * May be initialized by {@link #initJPEGWriter}.
      */
     protected ImageWriter JPEGWriter = null;
 
@@ -95,7 +95,7 @@
      * Stream metadata equivalent to a tables-only stream such as in
      * the {@code JPEGTables}. Default value is {@code null}.
      * This should be set by any subclass which sets
-     * {@link writeAbbreviatedStream} to {@code true}.
+     * {@link #writeAbbreviatedStream} to {@code true}.
      */
     protected IIOMetadata JPEGStreamMetadata = null;
 
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDecompressor.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDecompressor.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1322,7 +1322,7 @@
      * Sets the index of the planar configuration band to be decoded. This value
      * is ignored for chunky (interleaved) images.
      *
-     * @param the index of the planar band to decode
+     * @param planarBand the index of the planar band to decode
      */
     public void setPlanarBand(int planarBand) { this.planarBand = planarBand; }
 
@@ -2069,7 +2069,7 @@
      * <p> The default implementation calls {@code decodeRaw(byte[] b,
      * ...)} and copies the resulting data into {@code f}.
      *
-     * @param f a {@code double} array to be written.
+     * @param d a {@code double} array to be written.
      * @param dstOffset the starting offset in {@code f} to be
      * written.
      * @param bitsPerPixel the number of bits for each pixel.
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageWriter.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageWriter.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,8 +58,6 @@
  *
  * The encoding process may clip, subsample using the parameters
  * specified in the {@code ImageWriteParam}.
- *
- * @see com.sun.media.imageio.plugins.WBMPImageWriteParam
  */
 public class WBMPImageWriter extends ImageWriter {
     /** The output stream to write into */
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKColorType.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKColorType.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -138,9 +138,9 @@
      * arguments to scale.
      *
      * @param color Color to alter
-     * @param hFactory Amount to scale the hue
+     * @param hFactor Amount to scale the hue
      * @param lFactor Amount to scale the lightness
-     * @param sFactory Amount to sacle saturation
+     * @param sFactor Amount to sacle saturation
      * @return newly created color
      */
     static Color adjustColor(Color color, float hFactor, float lFactor,
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -82,7 +82,7 @@
      * render the text as html nor will it offset by the insets of the
      * component.
      *
-     * @param ss SynthContext
+     * @param context SynthContext
      * @param g Graphics used to render string in.
      * @param text Text to render
      * @param bounds Bounds of the text to be drawn.
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -319,7 +319,7 @@
      * insets will be placed in it, otherwise a new Insets object will be
      * created and returned.
      *
-     * @param context SynthContext identifying requestor
+     * @param state SynthContext identifying requestor
      * @param insets Where to place Insets
      * @return Insets.
      */
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifGraphicsUtils.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifGraphicsUtils.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,7 +89,6 @@
       * <b>drawStringInRect()</b> does not clip to the rectangle, but instead
       * uses this rectangle and the desired justification to compute the point
       * at which to begin drawing the text.
-      * @see #drawString
       */
     public static void drawStringInRect(Graphics g, String aString, int x, int y,
                                  int width, int height, int justification) {
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -127,7 +127,7 @@
      *
      * @param part a <code>Part</code>
      * @param state a <code>String</code>
-     * @param attributeKey a <code>String</code>
+     * @param prop a <code>String</code>
      * @return a <code>String</code> or null if key is not found
      *    in the current style
      *
@@ -172,7 +172,6 @@
 
     /** Get a named <code>Dimension</code> value from the current style
      *
-     * @param key a <code>String</code>
      * @return a <code>Dimension</code> or null if key is not found
      *    in the current style
      *
@@ -189,7 +188,6 @@
     /** Get a named <code>Point</code> (e.g. a location or an offset) value
      *  from the current style
      *
-     * @param key a <code>String</code>
      * @return a <code>Point</code> or null if key is not found
      *    in the current style
      *
@@ -205,7 +203,6 @@
 
     /** Get a named <code>Insets</code> value from the current style
      *
-     * @param key a <code>String</code>
      * @return an <code>Insets</code> object or null if key is not found
      *    in the current style
      *
@@ -223,7 +220,6 @@
 
     /** Get a named <code>Color</code> value from the current style
      *
-     * @param part a <code>Part</code>
      * @return a <code>Color</code> or null if key is not found
      *    in the current style
      */
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMixer.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMixer.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -90,7 +90,7 @@
 
     /**
      * Constructs a new AbstractMixer.
-     * @param mixer the mixer with which this line is associated
+     * @param mixerInfo the mixer with which this line is associated
      * @param controls set of supported controls
      */
     protected AbstractMixer(Mixer.Info mixerInfo,
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizer.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizer.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 
 import java.util.Map;
 
+import javax.sound.midi.MidiSystem;
 import javax.sound.midi.MidiUnavailableException;
 import javax.sound.midi.Synthesizer;
 import javax.sound.sampled.AudioFormat;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -163,7 +163,6 @@
      * rllong
      * Protected helper method to read 64 bits and changing the order of
      * each bytes.
-     * @param DataInputStream
      * @return 32 bits swapped value.
      * @exception IOException
      */
@@ -187,7 +186,6 @@
     /**
      * big2little
      * Protected helper method to swap the order of bytes in a 32 bit int
-     * @param int
      * @return 32 bits swapped value
      */
     final int big2little(int i) {
@@ -207,7 +205,6 @@
     /**
      * rlshort
      * Protected helper method to read 16 bits value. Swap high with low byte.
-     * @param DataInputStream
      * @return the swapped value.
      * @exception IOException
      */
@@ -229,7 +226,6 @@
     /**
      * big2little
      * Protected helper method to swap the order of bytes in a 16 bit short
-     * @param int
      * @return 16 bits swapped value
      */
     final short big2littleShort(short i) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileWriter.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileWriter.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,6 @@
      * rllong
      * Protected helper method to read 64 bits and changing the order of
      * each bytes.
-     * @param DataInputStream
      * @return 32 bits swapped value.
      * @exception IOException
      */
@@ -93,7 +92,6 @@
     /**
      * big2little
      * Protected helper method to swap the order of bytes in a 32 bit int
-     * @param int
      * @return 32 bits swapped value
      */
     final int big2little(int i) {
@@ -113,7 +111,6 @@
     /**
      * rlshort
      * Protected helper method to read 16 bits value. Swap high with low byte.
-     * @param DataInputStream
      * @return the swapped value.
      * @exception IOException
      */
@@ -135,7 +132,6 @@
     /**
      * big2little
      * Protected helper method to swap the order of bytes in a 16 bit short
-     * @param int
      * @return 16 bits swapped value
      */
     final short big2littleShort(short i) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/Toolkit.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/Toolkit.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +54,7 @@
 
     /**
      * Swaps bytes.
-     * @throws ArrayOutOfBoundsException if len is not a multiple of 2.
+     * @throws ArrayIndexOutOfBoundsException if len is not a multiple of 2.
      */
     static void getByteSwapped(byte[] b, int off, int len) {
 
--- a/jdk/src/java.desktop/share/classes/java/awt/Component.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,6 +58,7 @@
 import javax.accessibility.*;
 import java.applet.Applet;
 import javax.swing.JComponent;
+import javax.swing.JRootPane;
 
 import sun.awt.ComponentFactory;
 import sun.security.action.GetPropertyAction;
@@ -6232,7 +6233,7 @@
     /**
      * Indicates whether a class or its superclasses override coalesceEvents.
      * Must be called with lock on coalesceMap and privileged.
-     * @see checkCoalescing
+     * @see #checkCoalescing
      */
     private static boolean isCoalesceEventsOverriden(Class<?> clazz) {
         assert Thread.holdsLock(coalesceMap);
@@ -10406,7 +10407,7 @@
      * </ul>
      * <p>
      * The most common example when the 'mixing-cutout' shape is needed is a
-     * glass pane component. The {@link JRootPane#setGlassPane()} method
+     * glass pane component. The {@link JRootPane#setGlassPane} method
      * automatically sets the <i>empty-shape</i> as the 'mixing-cutout' shape
      * for the given glass pane component.  If a developer needs some other
      * 'mixing-cutout' shape for the glass pane (which is rare), this must be
--- a/jdk/src/java.desktop/share/classes/java/awt/Desktop.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/Desktop.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,12 @@
 
 package java.awt;
 
+import java.awt.desktop.AboutEvent;
 import java.awt.desktop.AboutHandler;
 import java.awt.desktop.OpenFilesHandler;
+import java.awt.desktop.OpenURIEvent;
 import java.awt.desktop.OpenURIHandler;
+import java.awt.desktop.PreferencesEvent;
 import java.awt.desktop.PreferencesHandler;
 import java.awt.desktop.PrintFilesHandler;
 import java.awt.desktop.QuitHandler;
@@ -42,8 +45,9 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 
+import javax.swing.JMenuBar;
+
 import sun.awt.SunToolkit;
-import javax.swing.JMenuBar;
 import sun.security.util.SecurityConstants;
 
 /**
--- a/jdk/src/java.desktop/share/classes/java/awt/Font.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/Font.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,7 @@
 import java.security.PrivilegedExceptionAction;
 import java.text.AttributedCharacterIterator.Attribute;
 import java.text.CharacterIterator;
+import java.util.EventListener;
 import java.util.Hashtable;
 import java.util.Locale;
 import java.util.Map;
--- a/jdk/src/java.desktop/share/classes/java/awt/Menu.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/Menu.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,9 @@
 import java.awt.peer.MenuPeer;
 import java.io.IOException;
 import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.Enumeration;
+import java.util.EventListener;
 import java.util.Vector;
 
 import javax.accessibility.Accessible;
--- a/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,9 @@
 import java.awt.peer.MenuBarPeer;
 import java.io.IOException;
 import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.Enumeration;
+import java.util.EventListener;
 import java.util.Vector;
 
 import javax.accessibility.Accessible;
--- a/jdk/src/java.desktop/share/classes/java/awt/PaintContext.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/PaintContext.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,10 @@
 
 package java.awt;
 
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.ColorModel;
 import java.awt.image.Raster;
-import java.awt.image.ColorModel;
 
 /**
  * The {@code PaintContext} interface defines the encapsulated
--- a/jdk/src/java.desktop/share/classes/java/awt/SystemTray.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/SystemTray.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,15 +25,17 @@
 
 package java.awt;
 
-import java.util.Vector;
+import java.awt.event.ActionListener;
 import java.awt.peer.SystemTrayPeer;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
-import sun.awt.AppContext;
-import sun.awt.SunToolkit;
-import sun.awt.HeadlessToolkit;
+import java.util.Vector;
+
 import sun.awt.AWTAccessor;
 import sun.awt.AWTPermissions;
+import sun.awt.AppContext;
+import sun.awt.HeadlessToolkit;
+import sun.awt.SunToolkit;
 
 /**
  * The {@code SystemTray} class represents the system tray for a
--- a/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -451,7 +451,7 @@
      *
      * @param s the error message
      * @param e the original exception
-     * @throws the new AWTError including the cause (the original exception)
+     * @throws AWTError the new AWTError including the cause (the original exception)
      */
     private static void newAWTError(Throwable e, String s) {
         AWTError newAWTError = new AWTError(s);
--- a/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1081,7 +1081,7 @@
      * when loading this profile.
      * If deferring is enabled, then the deferred activation
      * code will take care of access privileges.
-     * @see activateDeferredProfile()
+     * @see #activateDeferredProfile()
      */
     static ICC_Profile getDeferredInstance(ProfileDeferralInfo pdi) {
         if (!ProfileDeferralMgr.deferring) {
--- a/jdk/src/java.desktop/share/classes/java/awt/desktop/FilesEvent.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/desktop/FilesEvent.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,6 @@
     /**
      * Constructs a {@code FilesEvent}
      * @param files files
-     * @param searchTerm searchTerm
      */
     FilesEvent(final List<File> files) {
         this.files = files;
--- a/jdk/src/java.desktop/share/classes/java/awt/font/CharArrayIterator.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/font/CharArrayIterator.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
      * Sets the position to getBeginIndex() and returns the character at that
      * position.
      * @return the first character in the text, or DONE if the text is empty
-     * @see getBeginIndex
+     * @see #getBeginIndex
      */
     public char first() {
 
@@ -59,7 +59,7 @@
      * Sets the position to getEndIndex()-1 (getEndIndex() if the text is empty)
      * and returns the character at that position.
      * @return the last character in the text, or DONE if the text is empty
-     * @see getEndIndex
+     * @see #getEndIndex
      */
     public char last() {
 
@@ -76,7 +76,7 @@
      * Gets the character at the current position (as returned by getIndex()).
      * @return the character at the current position or DONE if the current
      * position is off the end of the text.
-     * @see getIndex
+     * @see #getIndex
      */
     public char current() {
 
--- a/jdk/src/java.desktop/share/classes/java/awt/peer/DesktopPeer.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/peer/DesktopPeer.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,18 +24,21 @@
  */
 package java.awt.peer;
 
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
 import java.awt.Desktop.Action;
 import java.awt.desktop.AboutHandler;
-import java.awt.desktop.SystemEventListener;
 import java.awt.desktop.OpenFilesHandler;
+import java.awt.desktop.OpenURIEvent;
 import java.awt.desktop.OpenURIHandler;
+import java.awt.desktop.PreferencesEvent;
 import java.awt.desktop.PreferencesHandler;
 import java.awt.desktop.PrintFilesHandler;
 import java.awt.desktop.QuitHandler;
 import java.awt.desktop.QuitStrategy;
+import java.awt.desktop.SystemEventListener;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+
 import javax.swing.JMenuBar;
 
 /**
@@ -162,7 +165,7 @@
      * the default behavior
      *
      * @param preferencesHandler the handler to respond to the
-     * {@link java.awt.desktop.PreferencesHandler#handlePreferences(java.awt.PreferencesEvent) }
+     * {@link java.awt.desktop.PreferencesHandler#handlePreferences(PreferencesEvent) }
      */
     default void setPreferencesHandler(final PreferencesHandler preferencesHandler) {
     }
@@ -191,7 +194,7 @@
      * open a URL.
      *
      * Setting the handler to {@code null} causes all
-     * {@link OpenURIHandler#openURI(AppEvent.OpenURIEvent)} requests to be
+     * {@link OpenURIHandler#openURI(OpenURIEvent)} requests to be
      * enqueued until another handler is set.
      *
      * @param openURIHandler handler
--- a/jdk/src/java.desktop/share/classes/java/awt/print/PrinterJob.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/print/PrinterJob.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,12 @@
 
 import java.awt.AWTError;
 import java.awt.HeadlessException;
-import java.util.Enumeration;
 
 import javax.print.DocFlavor;
 import javax.print.PrintService;
 import javax.print.PrintServiceLookup;
 import javax.print.StreamPrintServiceFactory;
+import javax.print.attribute.AttributeSet;
 import javax.print.attribute.PrintRequestAttributeSet;
 import javax.print.attribute.standard.Media;
 import javax.print.attribute.standard.MediaPrintableArea;
@@ -40,8 +40,6 @@
 import javax.print.attribute.standard.MediaSizeName;
 import javax.print.attribute.standard.OrientationRequested;
 
-import sun.security.action.GetPropertyAction;
-
 /**
  * The {@code PrinterJob} class is the principal class that controls
  * printing. An application calls methods in this class to set up a job,
--- a/jdk/src/java.desktop/share/classes/java/beans/ChangeListenerMap.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/beans/ChangeListenerMap.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,8 +39,8 @@
  * for the {@link PropertyChangeSupport PropertyChangeSupport} class
  * and the {@link VetoableChangeSupport VetoableChangeSupport} class.
  *
- * @see PropertyChangeListenerMap
- * @see VetoableChangeListenerMap
+ * @see PropertyChangeSupport.PropertyChangeListenerMap
+ * @see VetoableChangeSupport.VetoableChangeListenerMap
  *
  * @author Sergey A. Malenkov
  */
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java	Wed Jul 05 23:16:15 2017 +0200
@@ -413,7 +413,7 @@
      *
      * @see #addPropertyChangeListener
      * @see #removePropertyChangeListener
-     * @see #firePropertyChangeListener
+     * @see #firePropertyChange
      */
     private PropertyChangeSupport accessibleChangeSupport = null;
 
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaPrintableArea.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaPrintableArea.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,9 @@
  */
 package javax.print.attribute.standard;
 
+import javax.print.DocFlavor;
 import javax.print.attribute.Attribute;
+import javax.print.attribute.AttributeSet;
 import javax.print.attribute.DocAttribute;
 import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
--- a/jdk/src/java.desktop/share/classes/javax/swing/Action.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/Action.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -384,8 +384,8 @@
      * @param sender the object to check, can be null
      * @return {@code true} if the action should be performed with the sender
      *         object, must be false if the action is disabled.
-     * @see isEnabled
-     * @see setEnabled
+     * @see #isEnabled
+     * @see #setEnabled
      */
     default boolean accept(Object sender) {
         return isEnabled();
--- a/jdk/src/java.desktop/share/classes/javax/swing/ActionPropertyChangeListener.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/ActionPropertyChangeListener.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
  * a strong reference will be held to the containing class, which in most
  * cases defeats the purpose of this class.
  *
- * @param T the type of JComponent the underlying Action is attached to
+ * @param <T> the type of JComponent the underlying Action is attached to
  *
  * @author Georges Saab
  * @see AbstractButton
--- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java	Wed Jul 05 23:16:15 2017 +0200
@@ -3733,7 +3733,11 @@
          * Fire PropertyChange listener, if one is registered,
          * when focus events happen
          * @since 1.3
+         * @deprecated This class is no longer used or needed.
+         * {@code java.awt.Component.AccessibleAWTComponent} provides
+         * the same functionality and it is handled in {@Component}.
          */
+        @Deprecated
         protected class AccessibleFocusHandler implements FocusListener {
            public void focusGained(FocusEvent event) {
                if (accessibleContext != null) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1202,7 +1202,7 @@
          * on the new <code>JFormattedTextField</code>.
          *
          * @param spinner the spinner whose model <code>this</code> editor will monitor
-         * @param decimalFormatPattern the initial pattern for the
+         * @param format the initial pattern for the
          *     <code>DecimalFormat</code> object that's used to display
          *     and parse the value of the text field.
          * @exception IllegalArgumentException if the spinners model is not
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1783,7 +1783,7 @@
          *
          * @param axis may be either X_AXIS or Y_AXIS
          * @param len specifies where a break is desired in the span
-         * @param the current allocation of the view
+         * @param a the current allocation of the view
          * @return the fragment of the view that represents the given span
          *   if the view can be broken, otherwise null
          */
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/LazyActionMap.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/LazyActionMap.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,7 +73,6 @@
      * <p>
      * This should be used if the ActionMap can be shared.
      *
-     * @param c JComponent to install the ActionMap on.
      * @param loaderClass Class object that gets loadActionMap invoked
      *                    on.
      * @param defaultsKey Key to use to defaults table to check for
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFontDesktopProperty.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFontDesktopProperty.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,8 +65,6 @@
      * Creates a MetalFontDesktopProperty.
      *
      * @param key Key used in looking up desktop value.
-     * @param toolkit Toolkit used to fetch property from, can be null
-     *        in which default will be used.
      * @param type Type of font being used, corresponds to MetalTheme font
      *        type.
      */
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -338,7 +338,7 @@
      * and sets this value; the default is null, implying a native operating
      * system window title pane.
      *
-     * @param content the <code>JComponent</code> to use for the window title pane.
+     * @param titlePane the <code>JComponent</code> to use for the window title pane.
      */
     private void setTitlePane(JRootPane root, JComponent titlePane) {
         JLayeredPane layeredPane = root.getLayeredPane();
@@ -434,7 +434,7 @@
         /**
          * Returns the amount of space the layout would like to have.
          *
-         * @param the Container for which this layout manager is being used
+         * @param parent the Container for which this layout manager is being used
          * @return a Dimension object containing the layout's preferred size
          */
         public Dimension preferredLayoutSize(Container parent) {
@@ -486,7 +486,7 @@
         /**
          * Returns the minimum amount of space the layout needs.
          *
-         * @param the Container for which this layout manager is being used
+         * @param parent the Container for which this layout manager is being used
          * @return a Dimension object containing the layout's minimum size
          */
         public Dimension minimumLayoutSize(Container parent) {
@@ -537,7 +537,7 @@
         /**
          * Returns the maximum amount of space the layout can use.
          *
-         * @param the Container for which this layout manager is being used
+         * @param target the Container for which this layout manager is being used
          * @return a Dimension object containing the layout's maximum size
          */
         public Dimension maximumLayoutSize(Container target) {
@@ -601,7 +601,7 @@
          * Instructs the layout manager to perform the layout for the specified
          * container.
          *
-         * @param the Container for which this layout manager is being used
+         * @param parent the Container for which this layout manager is being used
          */
         public void layoutContainer(Container parent) {
             JRootPane root = (JRootPane) parent;
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -934,9 +934,7 @@
      * <p>The actual code path for determining the proper state is the same as
      * in Synth.</p>
      *
-     * @param ctx
      * @param lastState a 1 element array, allowing me to do pass-by-reference.
-     * @return
      */
     private RuntimeState getNextState(RuntimeState[] states,
                                       int[] lastState,
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2179,9 +2179,6 @@
 
         /**
          * Create this action with the appropriate identifier.
-         * @param nm  the name of the action, Action.NAME.
-         * @param select whether to extend the selection when
-         *  changing the caret position.
          */
         SelectWordAction() {
             super(selectWordAction);
@@ -2209,9 +2206,6 @@
 
         /**
          * Create this action with the appropriate identifier.
-         * @param nm  the name of the action, Action.NAME.
-         * @param select whether to extend the selection when
-         *  changing the caret position.
          */
         SelectLineAction() {
             super(selectLineAction);
@@ -2239,9 +2233,6 @@
 
         /**
          * Create this action with the appropriate identifier.
-         * @param nm  the name of the action, Action.NAME.
-         * @param select whether to extend the selection when
-         *  changing the caret position.
          */
         SelectParagraphAction() {
             super(selectParagraphAction);
@@ -2269,9 +2260,6 @@
 
         /**
          * Create this action with the appropriate identifier.
-         * @param nm  the name of the action, Action.NAME.
-         * @param select whether to extend the selection when
-         *  changing the caret position.
          */
         SelectAllAction() {
             super(selectAllAction);
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1797,8 +1797,6 @@
         /**
          * Pushes a new element onto the stack that represents
          * the current path.
-         * @param record Whether or not the push should be
-         *  recorded as an element change or not.
          * @param isFracture true if pushing on an element that was created
          * as the result of a fracture.
          */
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphPainter1.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphPainter1.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -198,7 +198,7 @@
      * @param v the view
      * @param p0 the location in the model where the
      *  fragment should start its representation >= 0
-     * @param pos the graphic location along the axis that the
+     * @param x the graphic location along the axis that the
      *  broken view would occupy >= 0; this may be useful for
      *  things like tab calculations
      * @param len specifies the distance into the view
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphPainter2.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphPainter2.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -193,7 +193,7 @@
      * @param v the view to find the model location to break at.
      * @param p0 the location in the model where the
      *  fragment should start it's representation >= 0.
-     * @param pos the graphic location along the axis that the
+     * @param x the graphic location along the axis that the
      *  broken view would occupy >= 0.  This may be useful for
      *  things like tab calculations.
      * @param len specifies the distance into the view
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -899,7 +899,6 @@
         /**
          * Range represented by a row in the paragraph is only
          * a subset of the total range of the paragraph element.
-         * @see View#getRange
          */
         public int getStartOffset() {
             int offs = Integer.MAX_VALUE;
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -510,8 +510,8 @@
      * Provides a mapping from the view coordinate space to the logical
      * coordinate space of the model.
      *
-     * @param fx the X coordinate &gt;= 0
-     * @param fy the Y coordinate &gt;= 0
+     * @param x the X coordinate &gt;= 0
+     * @param y the Y coordinate &gt;= 0
      * @param a the allocated region to render into
      * @return the location within the model that best represents the
      *  given point in the view &gt;= 0
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/TextLayoutStrategy.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/TextLayoutStrategy.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,9 +88,8 @@
      * Gives notification from the document that attributes were changed
      * in a location that this view is responsible for.
      *
-     * @param changes the change information from the associated document
-     * @param a the current allocation of the view
-     * @param f the factory to use to rebuild if the view has children
+     * @param e the change information from the associated document
+     * @param alloc the current allocation of the view inside of the insets.
      * @see View#changedUpdate
      */
     public void changedUpdate(FlowView fv, DocumentEvent e, Rectangle alloc) {
@@ -117,9 +116,9 @@
      * views or view fragments) and follow that with bidi reordering
      * of the unidirectional view fragments.
      *
-     * @param row the row to fill in with views.  This is assumed
+     * @param rowIndex the row to fill in with views.  This is assumed
      *   to be empty on entry.
-     * @param pos  The current position in the children of
+     * @param p0  The current position in the children of
      *   this views element from which to start.
      * @return the position to start the next row
      */
@@ -157,7 +156,7 @@
      * calculated by the LineBreakMeasurer, this is implemented
      * to do nothing.
      *
-     * @param r the row to adjust to the current layout
+     * @param rowIndex the row to adjust to the current layout
      *  span.
      * @param desiredSpan the current layout span >= 0
      * @param x the location r starts at.
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/Utilities.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/Utilities.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1245,7 +1245,7 @@
      *
      * @param v View to query
      * @param pos the position to convert &gt;= 0
-     * @param a the allocated region to render into
+     * @param alloc 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;
      *  this may be one of the following:
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/CSS.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/CSS.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -948,7 +948,6 @@
      * Returns the size of a font from the passed in string.
      *
      * @param size CSS string describing font size
-     * @param baseFontSize size to use for relative units.
      */
     float getPointSize(String size, StyleSheet ss) {
         int relSize, absSize, diff, index;
@@ -1658,8 +1657,8 @@
      * value, this method returns a CssValue object to associate with the
      * CSS attribute.
      *
-     * @param the CSS.Attribute
-     * @param a String containing the value associated HTML.Attribtue.
+     * @param cssAttr the CSS.Attribute
+     * @param htmlAttrValue a String containing the value associated HTML.Attribute.
      */
     Object getCssValue(CSS.Attribute cssAttr, String htmlAttrValue) {
         CssValue value = (CssValue)valueConvertor.get(cssAttr);
@@ -1670,7 +1669,7 @@
     /**
      * Maps an HTML.Attribute object to its appropriate CSS.Attributes.
      *
-     * @param HTML.Attribute
+     * @param hAttr HTML.Attribute
      * @return CSS.Attribute[]
      */
     private CSS.Attribute[] getCssAttribute(HTML.Attribute hAttr) {
@@ -1685,7 +1684,7 @@
      * based on the tag associated with the attribute and the
      * value of the attribute.
      *
-     * @param AttributeSet containing HTML attributes.
+     * @param tag the AttributeSet containing HTML attributes.
      * @return CSS.Attribute mapping for HTML.Attribute.ALIGN.
      */
     private CSS.Attribute getCssAlignAttribute(HTML.Tag tag,
@@ -1711,7 +1710,7 @@
     /**
      * Fetches the tag associated with the HTML AttributeSet.
      *
-     * @param  AttributeSet containing the HTML attributes.
+     * @param  htmlAttrSet the AttributeSet containing the HTML attributes.
      * @return HTML.Tag
      */
     private HTML.Tag getHTMLTag(AttributeSet htmlAttrSet) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/FormView.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/FormView.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -209,7 +209,7 @@
      * Creates a component for an &lt;INPUT&gt; element based on the
      * value of the "type" attribute.
      *
-     * @param set of attributes associated with the &lt;INPUT&gt; element.
+     * @param attr set of attributes associated with the &lt;INPUT&gt; element.
      * @param model the value of the StyleConstants.ModelAttribute
      * @return the component.
      */
@@ -653,8 +653,6 @@
      * action.
      *
      * @param buffer        the buffer that contains that data to submit
-     * @param targetElement the element that triggered the
-     *                      form submission
      */
     private void getFormData(StringBuilder buffer) {
         Element formE = getFormElement();
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/FrameView.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/FrameView.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -143,8 +143,7 @@
      * contains it is editable. And then proceeds to call
      * the superclass to do the paint().
      *
-     * @param parent View
-     * @see text.ComponentView#paint
+     * @see javax.swing.text.ComponentView#paint
      */
     public void paint(Graphics g, Shape allocation) {
 
@@ -289,8 +288,6 @@
      * firing the event to the outermost JEditorPane, this
      * method also invokes the setPage() method and explicitly
      * replaces the current document with the destination url.
-     *
-     * @param HyperlinkEvent
      */
     public void hyperlinkUpdate(HyperlinkEvent evt) {
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/NoFramesView.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/NoFramesView.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@
      * @param g the rendering surface to use
      * @param allocation the allocated region to render into
      * @see #isVisible
-     * @see text.ParagraphView#paint
+     * @see javax.swing.text.ParagraphView#paint
      */
     public void paint(Graphics g, Shape allocation) {
         Container host = getContainer();
@@ -126,7 +126,7 @@
      *           typically the view is told to render into the span
      *           that is returned, although there is no guarantee;
      *           the parent may choose to resize or break the view
-     * @see text.ParagraphView#getPreferredSpan
+     * @see javax.swing.text.ParagraphView#getPreferredSpan
      */
     public float getPreferredSpan(int axis) {
         if (!visible) {
@@ -143,7 +143,7 @@
      * @param axis may be either <code>View.X_AXIS</code> or
      *          <code>View.Y_AXIS</code>
      * @return  the minimum span the view can be rendered into
-     * @see text.ParagraphView#getMinimumSpan
+     * @see javax.swing.text.ParagraphView#getMinimumSpan
      */
     public float getMinimumSpan(int axis) {
         if (!visible) {
@@ -160,7 +160,7 @@
      * @param axis may be either <code>View.X_AXIS</code> or
      *  <code>View.Y_AXIS</code>
      * @return  the maximum span the view can be rendered into
-     * @see text.ParagraphView#getMaximumSpan
+     * @see javax.swing.text.ParagraphView#getMaximumSpan
      */
     public float getMaximumSpan(int axis) {
         if (!visible) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/Parser.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/Parser.java	Wed Jul 05 23:16:15 2017 +0200
@@ -2119,8 +2119,11 @@
             }
 
             /* To account for extra read()'s that happened */
-            for (int j = 0; j < i; j++) {
-                addString(charsToAdd[j]);
+            if (i > 0) {
+                for (int j = 0; j < i; j++) {
+                    addString(charsToAdd[j]);
+                }
+                continue;
             }
             switch (ch) {
             case -1:
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/rtf/RTFGenerator.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/rtf/RTFGenerator.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,12 +42,8 @@
  * <p>Note that this is a lossy conversion since RTF's model of
  * text does not exactly correspond with LightText's.
  *
- * @see LTAttributedText
- * @see LTRTFFilter
- * @see LTTextAcceptor
  * @see java.io.OutputStream
  */
-
 class RTFGenerator extends Object
 {
     /* These dictionaries map Colors, font names, or Style objects
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/rtf/RTFParser.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/rtf/RTFParser.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,11 +32,11 @@
  * and passes a stream of control words, text, and begin/end group
  * indications to its subclass.
  *
- * Normally programmers will only use <b>RTFFilter</b>, a subclass of this class that knows what to
+ * Normally programmers will only use <b>RTFReader</b>, a subclass of this class that knows what to
  * do with the tokens this class parses.
  *
  * @see AbstractFilter
- * @see RTFFilter
+ * @see RTFReader
  */
 abstract class RTFParser extends AbstractFilter
 {
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletSecurity.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletSecurity.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -109,7 +109,8 @@
     /**
      * get the current (first) instance of an AppletClassLoader on the stack.
      */
-    @SuppressWarnings("deprecation")
+    @SuppressWarnings({"deprecation",
+                       "removal"}) // SecurityManager.currentClassLoader()
     private AppletClassLoader currentAppletClassLoader()
     {
         // try currentClassLoader first
@@ -298,7 +299,8 @@
      * @exception  SecurityException  if the caller does not have
      *             permission to access the AWT event queue.
      */
-    @SuppressWarnings("deprecation")
+    @SuppressWarnings({"deprecation",
+                       "removal"}) //  SecurityManager.checkAwtEventQueueAccess
     public void checkAwtEventQueueAccess() {
         AppContext appContext = AppContext.getAppContext();
         AppletClassLoader appletClassLoader = currentAppletClassLoader();
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/BytePackedRaster.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/BytePackedRaster.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,14 +24,16 @@
  */
 
 package sun.awt.image;
+
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.MultiPixelPackedSampleModel;
 import java.awt.image.Raster;
-import java.awt.image.WritableRaster;
 import java.awt.image.RasterFormatException;
 import java.awt.image.SampleModel;
-import java.awt.image.MultiPixelPackedSampleModel;
-import java.awt.image.DataBufferByte;
-import java.awt.Rectangle;
-import java.awt.Point;
+import java.awt.image.WritableRaster;
 
 /**
  * This class is useful for describing 1, 2, or 4 bit image data
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -153,11 +153,11 @@
      * The specified {@code src} {@link Shape} is widened according
      * to the parameters specified by the {@link BasicStroke} object.
      * Adjustments are made to the path as appropriate for the
-     * {@link VALUE_STROKE_NORMALIZE} hint if the {@code normalize}
-     * boolean parameter is true.
+     * {@link java.awt.RenderingHints#VALUE_STROKE_NORMALIZE} hint if the
+     * {@code normalize} boolean parameter is true.
      * Adjustments are made to the path as appropriate for the
-     * {@link VALUE_ANTIALIAS_ON} hint if the {@code antialias}
-     * boolean parameter is true.
+     * {@link java.awt.RenderingHints#VALUE_ANTIALIAS_ON} hint if the
+     * {@code antialias} boolean parameter is true.
      * <p>
      * The geometry of the widened path is forwarded to the indicated
      * {@link PathConsumer2D} object as it is calculated.
--- a/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Wed Jul 05 23:16:15 2017 +0200
@@ -886,14 +886,6 @@
         }
    }
 
-   protected PageFormat getPageFormatFromAttributes() {
-       if (attributes == null || attributes.isEmpty()) {
-            return null;
-        }
-        return attributeToPageFormat(getPrintService(), this.attributes);
-   }
-
-
    /**
      * Presents the user a dialog for changing properties of the
      * print job interactively.
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp	Wed Jul 05 23:16:15 2017 +0200
@@ -239,7 +239,9 @@
 
     fullScreenExclusiveModeState = FALSE;
     m_winSizeMove = FALSE;
-    prevScaleRec = { -1, -1, -1 };
+    prevScaleRec.screen = -1;
+    prevScaleRec.scaleX = -1.0f;
+    prevScaleRec.scaleY = -1.0f;
 }
 
 AwtWindow::~AwtWindow()
--- a/jdk/src/java.se.ee/share/classes/module-info.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/java.se.ee/share/classes/module-info.java	Wed Jul 05 23:16:15 2017 +0200
@@ -32,7 +32,8 @@
  * @moduleGraph
  * @since 9
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // java.corba and other modules
 module java.se.ee {
 
     requires transitive java.se;
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 package jdk.incubator.http;
 
 import java.io.IOException;
+import java.io.UncheckedIOException;
 import java.net.InetSocketAddress;
 import java.net.ProxySelector;
 import java.net.SocketPermission;
@@ -64,6 +65,9 @@
     final HttpRequestImpl request;
     final HttpClientImpl client;
     volatile ExchangeImpl<T> exchImpl;
+    // used to record possible cancellation raised before the exchImpl
+    // has been established.
+    private volatile IOException failed;
     final List<SocketPermission> permissions = new LinkedList<>();
     final AccessControlContext acc;
     final MultiExchange<?,T> multi;
@@ -143,14 +147,80 @@
     }
 
     public void cancel() {
+        // cancel can be called concurrently before or at the same time
+        // that the exchange impl is being established.
+        // In that case we won't be able to propagate the cancellation
+        // right away
         if (exchImpl != null) {
             exchImpl.cancel();
+        } else {
+            // no impl - can't cancel impl yet.
+            // call cancel(IOException) instead which takes care
+            // of race conditions between impl/cancel.
+            cancel(new IOException("Request cancelled"));
         }
     }
 
     public void cancel(IOException cause) {
-        if (exchImpl != null) {
-            exchImpl.cancel(cause);
+        // If the impl is non null, propagate the exception right away.
+        // Otherwise record it so that it can be propagated once the
+        // exchange impl has been established.
+        ExchangeImpl<?> impl = exchImpl;
+        if (impl != null) {
+            // propagate the exception to the impl
+            impl.cancel(cause);
+        } else {
+            try {
+                // no impl yet. record the exception
+                failed = cause;
+                // now call checkCancelled to recheck the impl.
+                // if the failed state is set and the impl is not null, reset
+                // the failed state and propagate the exception to the impl.
+                checkCancelled(false);
+            } catch (IOException x) {
+                // should not happen - we passed 'false' above
+                throw new UncheckedIOException(x);
+            }
+        }
+    }
+
+    // This method will raise an exception if one was reported and if
+    // it is possible to do so. If the exception can be raised, then
+    // the failed state will be reset. Otherwise, the failed state
+    // will persist until the exception can be raised and the failed state
+    // can be cleared.
+    // Takes care of possible race conditions.
+    private void checkCancelled(boolean throwIfNoImpl) throws IOException {
+        ExchangeImpl<?> impl = null;
+        IOException cause = null;
+        if (failed != null) {
+            synchronized(this) {
+                cause = failed;
+                impl = exchImpl;
+                if (throwIfNoImpl || impl != null) {
+                    // The exception will be raised by one of the two methods
+                    // below: reset the failed state.
+                    failed = null;
+                }
+            }
+        }
+        if (cause == null) return;
+        if (impl != null) {
+            // The exception is raised by propagating it to the impl.
+            impl.cancel(cause);
+        } else if (throwIfNoImpl) {
+            // The exception is raised by throwing it immediately
+            throw cause;
+        } else {
+            Log.logTrace("Exchange: request [{0}/timeout={1}ms] no impl is set."
+                         + "\n\tCan''t cancel yet with {2}",
+                         request.uri(),
+                         request.duration() == null ? -1 :
+                         // calling duration.toMillis() can throw an exception.
+                         // this is just debugging, we don't care if it overflows.
+                         (request.duration().getSeconds() * 1000
+                          + request.duration().getNano() / 1000000),
+                         cause);
         }
     }
 
@@ -191,10 +261,26 @@
         }
     }
 
+    // get/set the exchange impl, solving race condition issues with
+    // potential concurrent calls to cancel() or cancel(IOException)
+    private void establishExchange(HttpConnection connection)
+        throws IOException, InterruptedException
+    {
+        // check if we have been cancelled first.
+        checkCancelled(true);
+        // not yet cancelled: create/get a new impl
+        exchImpl = ExchangeImpl.get(this, connection);
+        // recheck for cancelled, in case of race conditions
+        checkCancelled(true);
+        // now we're good to go. because exchImpl is no longer null
+        // cancel() will be able to propagate directly to the impl
+        // after this point.
+    }
+
     private Response responseImpl0(HttpConnection connection)
         throws IOException, InterruptedException
     {
-        exchImpl = ExchangeImpl.get(this, connection);
+        establishExchange(connection);
         exchImpl.setClientForRequest(requestProcessor);
         if (request.expectContinue()) {
             Log.logTrace("Sending Expect: 100-Continue");
@@ -257,7 +343,7 @@
 
     CompletableFuture<Response> responseAsyncImpl0(HttpConnection connection) {
         try {
-            exchImpl = ExchangeImpl.get(this, connection);
+            establishExchange(connection);
         } catch (IOException | InterruptedException e) {
             return MinimalFuture.failedFuture(e);
         }
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,9 +46,12 @@
 class Http1Exchange<T> extends ExchangeImpl<T> {
 
     final HttpRequestImpl request;        // main request
-    final List<CompletableFuture<?>> operations; // used for cancel
+    private final List<CompletableFuture<?>> operations; // used for cancel
     final Http1Request requestAction;
-    volatile Http1Response<T> response;
+    private volatile Http1Response<T> response;
+    // use to record possible cancellation raised before any operation
+    // has been initiated.
+    private IOException failed;
     final HttpConnection connection;
     final HttpClientImpl client;
     final Executor executor;
@@ -70,7 +73,7 @@
         this.request = exchange.request();
         this.client = exchange.client();
         this.executor = exchange.executor();
-        this.operations = Collections.synchronizedList(new LinkedList<>());
+        this.operations = new LinkedList<>();
         this.buffer = exchange.getBuffer();
         if (connection != null) {
             this.connection = connection;
@@ -186,9 +189,22 @@
         }
         connection.close();
         int count = 0;
-        for (CompletableFuture<?> cf : operations) {
-            cf.completeExceptionally(cause);
-            count++;
+        if (operations.isEmpty()) {
+            failed = cause;
+            Log.logTrace("Http1Exchange: request [{0}/timeout={1}ms] no pending operation."
+                         + "\n\tCan''t cancel yet with {2}",
+                         request.uri(),
+                         request.duration() == null ? -1 :
+                         // calling duration.toMillis() can throw an exception.
+                         // this is just debugging, we don't care if it overflows.
+                         (request.duration().getSeconds() * 1000
+                          + request.duration().getNano() / 1000000),
+                         cause);
+        } else {
+            for (CompletableFuture<?> cf : operations) {
+                cf.completeExceptionally(cause);
+                count++;
+            }
         }
         Log.logError("Http1Exchange.cancel: count=" + count);
     }
@@ -206,8 +222,24 @@
         CompletableFuture<Response> cf =
             connection.whenReceivingResponse()
                       .thenCompose((v) -> getResponseAsyncImpl(executor));
-
-        operations.add(cf);
+        IOException cause;
+        synchronized(this) {
+            operations.add(cf);
+            cause = failed;
+            failed = null;
+        }
+        if (cause != null) {
+            Log.logTrace("Http1Exchange: request [{0}/timeout={1}ms]"
+                         + "\n\tCompleting exceptionally with {2}\n",
+                         request.uri(),
+                         request.duration() == null ? -1 :
+                         // calling duration.toMillis() can throw an exception.
+                         // this is just debugging, we don't care if it overflows.
+                         (request.duration().getSeconds() * 1000
+                          + request.duration().getNano() / 1000000),
+                         cause);
+            cf.completeExceptionally(cause);
+        }
         return cf;
     }
 }
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientImpl.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientImpl.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -582,12 +582,14 @@
     // Timers are implemented through timed Selector.select() calls.
 
     synchronized void registerTimer(TimeoutEvent event) {
+        Log.logTrace("Registering timer {0}", event);
         timeouts.add(event);
         selmgr.wakeupSelector();
     }
 
     synchronized void cancelTimer(TimeoutEvent event) {
-        timeouts.stream().filter(e -> e == event).forEach(timeouts::remove);
+        Log.logTrace("Canceling timer {0}", event);
+        timeouts.remove(event);
     }
 
     /**
@@ -595,23 +597,61 @@
      * returns the amount of time, in milliseconds, until the next earliest
      * event. A return value of 0 means that there are no events.
      */
-    private synchronized long purgeTimeoutsAndReturnNextDeadline() {
-        if (timeouts.isEmpty())
-            return 0L;
+    private long purgeTimeoutsAndReturnNextDeadline() {
+        long diff = 0L;
+        List<TimeoutEvent> toHandle = null;
+        int remaining = 0;
+        // enter critical section to retrieve the timeout event to handle
+        synchronized(this) {
+            if (timeouts.isEmpty()) return 0L;
+
+            Instant now = Instant.now();
+            Iterator<TimeoutEvent> itr = timeouts.iterator();
+            while (itr.hasNext()) {
+                TimeoutEvent event = itr.next();
+                diff = now.until(event.deadline(), ChronoUnit.MILLIS);
+                if (diff <= 0) {
+                    itr.remove();
+                    toHandle = (toHandle == null) ? new ArrayList<>() : toHandle;
+                    toHandle.add(event);
+                } else {
+                    break;
+                }
+            }
+            remaining = timeouts.size();
+        }
 
-        Instant now = Instant.now();
-        Iterator<TimeoutEvent> itr = timeouts.iterator();
-        while (itr.hasNext()) {
-            TimeoutEvent event = itr.next();
-            long diff = now.until(event.deadline(), ChronoUnit.MILLIS);
-            if (diff <= 0) {
-                itr.remove();
-                event.handle();  // TODO: release lock.
-            } else {
-                return diff;
+        // can be useful for debugging
+        if (toHandle != null && Log.trace()) {
+            Log.logTrace("purgeTimeoutsAndReturnNextDeadline: handling "
+                    + (toHandle == null ? 0 : toHandle.size()) + " events, "
+                    + "remaining " + remaining
+                    + ", next deadline: " + (diff < 0 ? 0L : diff));
+        }
+
+        // handle timeout events out of critical section
+        if (toHandle != null) {
+            Throwable failed = null;
+            for (TimeoutEvent event : toHandle) {
+                try {
+                   Log.logTrace("Firing timer {0}", event);
+                   event.handle();
+                } catch (Error | RuntimeException e) {
+                    // Not expected. Handle remaining events then throw...
+                    // If e is an OOME or SOE it might simply trigger a new
+                    // error from here - but in this case there's not much we
+                    // could do anyway. Just let it flow...
+                    if (failed == null) failed = e;
+                    else failed.addSuppressed(e);
+                    Log.logTrace("Failed to handle event {0}: {1}", event, e);
+                }
             }
+            if (failed instanceof Error) throw (Error) failed;
+            if (failed instanceof RuntimeException) throw (RuntimeException) failed;
         }
-        return 0L;
+
+        // return time to wait until next event. 0L if there's no more events.
+        return diff < 0 ? 0L : diff;
     }
 
     // used for the connection window
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/MultiExchange.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/MultiExchange.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -357,9 +357,5 @@
         public void handle() {
             cancel(new HttpTimeoutException("request timed out"));
         }
-        @Override
-        public String toString() {
-            return "[deadline = " + deadline() + "]";
-        }
     }
 }
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +54,7 @@
  */
 class PlainHttpConnection extends HttpConnection implements AsyncConnection {
 
-    protected SocketChannel chan;
+    protected final SocketChannel chan;
     private volatile boolean connected;
     private boolean closed;
 
@@ -100,6 +100,7 @@
                 chan.finishConnect();
             } catch (IOException e) {
                 cf.completeExceptionally(e);
+                return;
             }
             connected = true;
             cf.complete(null);
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Stream.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Stream.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -670,11 +670,21 @@
 
     @Override
     CompletableFuture<Response> getResponseAsync(Executor executor) {
-        CompletableFuture<Response> cf;
+        CompletableFuture<Response> cf = null;
+        // The code below deals with race condition that can be caused when
+        // completeResponse() is being called before getResponseAsync()
         synchronized (response_cfs) {
             if (!response_cfs.isEmpty()) {
+                // This CompletableFuture was created by completeResponse().
+                // it will be already completed.
                 cf = response_cfs.remove(0);
+                // if we find a cf here it should be already completed.
+                // finding a non completed cf should not happen. just assert it.
+                assert cf.isDone() : "Removing uncompleted response: could cause code to hang!";
             } else {
+                // getResponseAsync() is called first. Create a CompletableFuture
+                // that will be completed by completeResponse() when
+                // completeResponse() is called.
                 cf = new MinimalFuture<>();
                 response_cfs.add(cf);
             }
@@ -708,7 +718,7 @@
                     cf.complete(resp);
                     response_cfs.remove(cf);
                     return;
-                }
+                } // else we found the previous response: just leave it alone.
             }
             cf = MinimalFuture.completedFuture(resp);
             Log.logTrace("Created completed future (streamid={0}): {1}",
@@ -742,10 +752,13 @@
      */
     void completeResponseExceptionally(Throwable t) {
         synchronized (response_cfs) {
-            for (CompletableFuture<Response> cf : response_cfs) {
+            // use index to avoid ConcurrentModificationException
+            // caused by removing the CF from within the loop.
+            for (int i = 0; i < response_cfs.size(); i++) {
+                CompletableFuture<Response> cf = response_cfs.get(i);
                 if (!cf.isDone()) {
                     cf.completeExceptionally(t);
-                    response_cfs.remove(cf);
+                    response_cfs.remove(i);
                     return;
                 }
             }
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/TimeoutEvent.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/TimeoutEvent.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,10 +27,11 @@
 
 import java.time.Duration;
 import java.time.Instant;
+import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * Timeout event notified by selector thread. Executes the given handler if
- * the timer not cancelled first.
+ * the timer not canceled first.
  *
  * Register with {@link HttpClientImpl#registerTimer(TimeoutEvent)}.
  *
@@ -38,6 +39,10 @@
  */
 abstract class TimeoutEvent implements Comparable<TimeoutEvent> {
 
+    private static final AtomicLong COUNTER = new AtomicLong();
+    // we use id in compareTo to make compareTo consistent with equals
+    // see TimeoutEvent::compareTo below;
+    private final long id = COUNTER.incrementAndGet();
     private final Instant deadline;
 
     TimeoutEvent(Duration duration) {
@@ -52,6 +57,24 @@
 
     @Override
     public int compareTo(TimeoutEvent other) {
-        return this.deadline.compareTo(other.deadline);
+        if (other == this) return 0;
+        // if two events have the same deadline, but are not equals, then the
+        // smaller is the one that was created before (has the smaller id).
+        // This is arbitrary and we don't really care which is smaller or
+        // greater, but we need a total order, so two events with the
+        // same deadline cannot compare == 0 if they are not equals.
+        final int compareDeadline = this.deadline.compareTo(other.deadline);
+        if (compareDeadline == 0 && !this.equals(other)) {
+            long diff = this.id - other.id; // should take care of wrap around
+            if (diff < 0) return -1;
+            else if (diff > 0) return 1;
+            else assert false : "Different events with same id and deadline";
+        }
+        return compareDeadline;
+    }
+
+    @Override
+    public String toString() {
+        return "TimeoutEvent[id=" + id + ", deadline=" + deadline + "]";
     }
 }
--- a/jdk/src/jdk.internal.jvmstat/share/classes/module-info.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/jdk.internal.jvmstat/share/classes/module-info.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,12 @@
  * questions.
  */
 
+/**
+ * Defines an internal API for monitoring a HotSpot Java Virtual Machine using
+ * its shared memory instrumentation buffer
+ *
+ * @since 9
+ */
 module jdk.internal.jvmstat {
     exports sun.jvmstat.monitor to
         jdk.attach,
--- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java	Wed Jul 05 23:16:15 2017 +0200
@@ -264,9 +264,8 @@
     }
 
     public boolean previousSnippet() {
-        for (int i = index() - 1; i >= 0; i--) {
-            if (get(i) instanceof NarrowingHistoryLine) {
-                moveTo(i);
+        while (previous()) {
+            if (current() instanceof NarrowingHistoryLine) {
                 return true;
             }
         }
@@ -275,19 +274,17 @@
     }
 
     public boolean nextSnippet() {
-        for (int i = index() + 1; i < size(); i++) {
-            if (get(i) instanceof NarrowingHistoryLine) {
-                moveTo(i);
+        boolean success = false;
+
+        while (next()) {
+            success = true;
+
+            if (current() instanceof NarrowingHistoryLine) {
                 return true;
             }
         }
 
-        if (index() < size()) {
-            moveToEnd();
-            return true;
-        }
-
-        return false;
+        return success;
     }
 
     public final void load(Iterable<? extends String> originalHistory) {
--- a/jdk/src/jdk.management/share/classes/com/sun/management/VMOption.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/jdk.management/share/classes/com/sun/management/VMOption.java	Wed Jul 05 23:16:15 2017 +0200
@@ -47,8 +47,6 @@
  * object was constructed.  The value of the VM option
  * may be changed after the {@code VMOption} object was constructed,
  *
- * @see <a href="{@docRoot}/../../../../technotes/guides/vm/index.html">
- *         Java Virtual Machine</a>
  * @author Mandy Chung
  * @since 1.6
  */
--- a/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,6 +71,7 @@
  */
 
 @Deprecated(since="9", forRemoval=true)
+@SuppressWarnings("removal")
 public class PolicyTool {
 
     // for i18n
@@ -879,7 +880,8 @@
  * The Permission contains the (Type, Name, Action) triplet.
  *
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class PolicyEntry {
 
     private CodeSource codesource;
@@ -1019,7 +1021,8 @@
 /**
  * The main window for the PolicyTool
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class ToolWindow extends JFrame {
     // use serialVersionUID from JDK 1.2.2 for interoperability
     private static final long serialVersionUID = 5682568601210376777L;
@@ -1553,7 +1556,8 @@
 /**
  * General dialog window
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class ToolDialog extends JDialog {
     // use serialVersionUID from JDK 1.2.2 for interoperability
     private static final long serialVersionUID = -372244357011301190L;
@@ -2917,7 +2921,8 @@
 /**
  * Event handler for the PolicyTool window
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class ToolWindowListener implements WindowListener {
 
     private PolicyTool tool;
@@ -2962,7 +2967,8 @@
 /**
  * Event handler for the Policy List
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class PolicyListListener extends MouseAdapter implements ActionListener {
 
     private PolicyTool tool;
@@ -2992,7 +2998,8 @@
 /**
  * Event handler for the File Menu
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class FileMenuListener implements ActionListener {
 
     private PolicyTool tool;
@@ -3091,7 +3098,8 @@
 /**
  * Event handler for the main window buttons and Edit Menu
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class MainWindowListener implements ActionListener {
 
     private PolicyTool tool;
@@ -3167,7 +3175,8 @@
  *    if edit is FALSE, then we are ADDing a new PolicyEntry,
  *    so we only need to update the GUI listing.
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class AddEntryDoneButtonListener implements ActionListener {
 
     private PolicyTool tool;
@@ -3234,7 +3243,8 @@
 /**
  * Event handler for ChangeKeyStoreOKButton button
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class ChangeKeyStoreOKButtonListener implements ActionListener {
 
     private PolicyTool tool;
@@ -3281,7 +3291,8 @@
 /**
  * Event handler for AddPrinButton button
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class AddPrinButtonListener implements ActionListener {
 
     private PolicyTool tool;
@@ -3307,7 +3318,8 @@
 /**
  * Event handler for AddPermButton button
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class AddPermButtonListener implements ActionListener {
 
     private PolicyTool tool;
@@ -3333,7 +3345,8 @@
 /**
  * Event handler for AddPrinOKButton button
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class NewPolicyPrinOKButtonListener implements ActionListener {
 
     private PolicyTool tool;
@@ -3397,7 +3410,8 @@
 /**
  * Event handler for AddPermOKButton button
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class NewPolicyPermOKButtonListener implements ActionListener {
 
     private PolicyTool tool;
@@ -3461,7 +3475,8 @@
 /**
  * Event handler for RemovePrinButton button
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class RemovePrinButtonListener implements ActionListener {
 
     private PolicyTool tool;
@@ -3497,7 +3512,8 @@
 /**
  * Event handler for RemovePermButton button
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class RemovePermButtonListener implements ActionListener {
 
     private PolicyTool tool;
@@ -3540,7 +3556,8 @@
  * GUI listing.  If the user is editing an existing PolicyEntry, we
  * update both the GUI listing and the actual PolicyEntry.
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class EditPrinButtonListener extends MouseAdapter implements ActionListener {
 
     private PolicyTool tool;
@@ -3587,7 +3604,8 @@
  * GUI listing.  If the user is editing an existing PolicyEntry, we
  * update both the GUI listing and the actual PolicyEntry.
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class EditPermButtonListener extends MouseAdapter implements ActionListener {
 
     private PolicyTool tool;
@@ -3628,7 +3646,8 @@
 /**
  * Event handler for Principal Popup Menu
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class PrincipalTypeMenuListener implements ItemListener {
 
     private ToolDialog td;
@@ -3680,7 +3699,8 @@
 /**
  * Event handler for Permission Popup Menu
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class PermissionMenuListener implements ItemListener {
 
     private ToolDialog td;
@@ -3755,7 +3775,8 @@
 /**
  * Event handler for Permission Name Popup Menu
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class PermissionNameMenuListener implements ItemListener {
 
     private ToolDialog td;
@@ -3909,7 +3930,8 @@
 /**
  * Event handler for UserSaveYes button
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class UserSaveYesButtonListener implements ActionListener {
 
     private ToolDialog us;
@@ -3964,7 +3986,8 @@
 /**
  * Event handler for UserSaveNoButton
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class UserSaveNoButtonListener implements ActionListener {
 
     private PolicyTool tool;
@@ -4013,7 +4036,8 @@
 /**
  * Event handler for ConfirmRemovePolicyEntryOKButtonListener
  */
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class ConfirmRemovePolicyEntryOKButtonListener implements ActionListener {
 
     private PolicyTool tool;
@@ -4169,7 +4193,8 @@
     }
 }
 
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class AuthPerm extends Perm {
     AuthPerm() {
         super(javax.security.auth.AuthPermission.class,
@@ -4242,7 +4267,8 @@
     }
 }
 
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class URLPerm extends Perm {
     URLPerm() {
         super(java.net.URLPermission.class,
@@ -4407,7 +4433,8 @@
     }
 }
 
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class RuntimePerm extends Perm {
     RuntimePerm() {
         super(java.lang.RuntimePermission.class,
@@ -4448,7 +4475,8 @@
     }
 }
 
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+                   "removal"}) // PolicyTool
 class SecurityPerm extends Perm {
     SecurityPerm() {
         super(java.security.SecurityPermission.class,
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/SolarisLoginModule.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/SolarisLoginModule.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,6 +66,7 @@
     private boolean debug = true;
 
     // SolarisSystem to retrieve underlying system info
+    @SuppressWarnings("removal")
     private SolarisSystem ss;
 
     // the authentication status
@@ -73,9 +74,13 @@
     private boolean commitSucceeded = false;
 
     // Underlying system info
+    @SuppressWarnings("removal")
     private SolarisPrincipal userPrincipal;
+    @SuppressWarnings("removal")
     private SolarisNumericUserPrincipal UIDPrincipal;
+    @SuppressWarnings("removal")
     private SolarisNumericGroupPrincipal GIDPrincipal;
+    @SuppressWarnings("removal")
     private LinkedList<SolarisNumericGroupPrincipal> supplementaryGroups =
                 new LinkedList<>();
 
@@ -121,6 +126,7 @@
      * @return true in all cases (this {@code LoginModule}
      *          should not be ignored).
      */
+    @SuppressWarnings("removal")
     public boolean login() throws LoginException {
 
         long[] solarisGroups = null;
@@ -234,6 +240,7 @@
      * @return false if this LoginModule's own login and/or commit attempts
      *          failed, and true otherwise.
      */
+    @SuppressWarnings("removal")
     public boolean abort() throws LoginException {
         if (debug) {
             System.out.println("\t\t[SolarisLoginModule]: " +
@@ -271,6 +278,7 @@
      * @return true in all cases (this {@code LoginModule}
      *          should not be ignored).
      */
+    @SuppressWarnings("removal")
     public boolean logout() throws LoginException {
         if (debug) {
             System.out.println("\t\t[SolarisLoginModule]: " +
--- a/jdk/src/jdk.unsupported/share/classes/sun/reflect/Reflection.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/src/jdk.unsupported/share/classes/sun/reflect/Reflection.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
      * with {@link StackWalker.StackFrame#getDeclaringClass} instead.
      */
     @Deprecated(forRemoval=true)
+    @SuppressWarnings("removal") // Reflection.getCallerClass
     public static Class<?> getCallerClass(int depth) {
         if (depth < 0)
             throw new InternalError("depth must be positive");
--- a/jdk/test/ProblemList.txt	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/ProblemList.txt	Wed Jul 05 23:16:15 2017 +0200
@@ -124,6 +124,7 @@
 # jdk_lang
 
 java/lang/StringCoding/CheckEncodings.sh                        7008363 generic-all
+java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java    8178776 generic-all
 
 jdk/internal/misc/JavaLangAccess/NewUnsafeString.java           8176188 generic-all
 
@@ -170,8 +171,6 @@
 
 java/net/DatagramSocket/SendDatagramToBadAddress.java           7143960 macosx-all
 
-java/net/httpclient/TimeoutOrdering.java                        8170940 solaris-all,windows-all
-
 ############################################################################
 
 # jdk_nio
@@ -257,8 +256,7 @@
 tools/jimage/JImageListTest.java                                8170120 generic-all
 tools/jimage/JImageVerifyTest.java                              8170120 generic-all
 
-
-tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java       8169971 windows-x64
+tools/jimage/VerifyJimage.java                                  8178776 generic-all
 
 tools/jar/multiRelease/RuntimeTest.java                         8173905 generic-all
 
--- a/jdk/test/com/sun/jdi/ProcessAttachTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/com/sun/jdi/ProcessAttachTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,13 +23,11 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.List;
 import java.util.Map;
 
 import jdk.testlibrary.ProcessTools;
 
 import com.sun.jdi.Bootstrap;
-import com.sun.jdi.ThreadReference;
 import com.sun.jdi.VirtualMachine;
 import com.sun.jdi.connect.AttachingConnector;
 import com.sun.jdi.connect.Connector;
@@ -86,7 +84,7 @@
             is.read();
 
             // Attach a debugger
-            tryDebug(p.getPid());
+            tryDebug(p.pid());
         } finally {
             p.destroyForcibly();
         }
--- a/jdk/test/java/awt/MouseInfo/JContainerMousePositionTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/awt/MouseInfo/JContainerMousePositionTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,15 +67,19 @@
         robot.waitForIdle();
 
         AtomicReference<Rectangle> frameBounds = new AtomicReference<>();
+        AtomicReference<Insets> frameInsets = new AtomicReference<>();
         AtomicReference<Dimension> button1Size = new AtomicReference<>();
         SwingUtilities.invokeAndWait(() -> {
             frameBounds.set(frame1.getBounds());
+            frameInsets.set(frame1.getInsets());
             button1Size.set(jButton1.getSize());
         });
 
 //point mouse to center of top-left Component (button1)
-        robot.mouseMove(frameBounds.get().x + button1Size.get().width / 2,
-                        frameBounds.get().y + button1Size.get().height / 2);
+        robot.mouseMove(frameBounds.get().x + frameInsets.get().left +
+                                                    button1Size.get().width / 2,
+                        frameBounds.get().y + frameInsets.get().top +
+                                                  button1Size.get().height / 2);
 
         AtomicReference<Point> pFalse = new AtomicReference<>();
         AtomicReference<Point> pTrue = new AtomicReference<>();
@@ -108,10 +112,12 @@
         System.out.println("Test stage completed: Container.getMousePosition(boolean) returned null result outside Container. Passed.");
 
 //point mouse in place free from child components (right-botton component)
-        robot.mouseMove(frameBounds.get().x + centerC4.get().x,
-                        frameBounds.get().y + centerC4.get().y);
+        robot.mouseMove(frameBounds.get().x + frameInsets.get().left +
+                                                               centerC4.get().x,
+                        frameBounds.get().y + frameInsets.get().top +
+                                                              centerC4.get().y);
 
-        robot.delay(3000);
+        robot.waitForIdle();
         SwingUtilities.invokeAndWait(() -> {
             pFalse.set(contentPane.getMousePosition(false));
             pTrue.set(frame1.getMousePosition(true));
@@ -123,7 +129,8 @@
         }
         System.out.println("Test stage completed: Container.getMousePosition(boolean) returned non-null results  inside Container. Passed.");
 
-        if (pTrue.get().x != centerC4.get().x || pTrue.get().y != centerC4.get().y) {
+        if (pTrue.get().x != frameInsets.get().left + centerC4.get().x ||
+            pTrue.get().y != frameInsets.get().top + centerC4.get().y) {
             throw new RuntimeException("Test failed: Container.getMousePosition(true) returned incorrect result inside Container.");
         }
         System.out.println("Test stage completed: Container.getMousePosition(true) returned correct result inside Container. Passed.");
--- a/jdk/test/java/awt/TextField/DisabledUndoTest/DisabledUndoTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/awt/TextField/DisabledUndoTest/DisabledUndoTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -24,7 +24,7 @@
  /*
  * @test
  * @key headful
- * @bug 4302718 6753165
+ * @bug 4302718 6753165 8177386
  * @summary verifies that undo does not work in a disabled TextField on windows
  * @requires (os.family == "windows")
  * @run main/manual DisabledUndoTest
@@ -42,12 +42,12 @@
 
     private static void init() throws Exception {
         String[] instructions
-                = {
-                    "1.Type a few symbols in the textfield.",
-                    "2.Then click the button Disable textfield to disable the textfield.",
-                    "3.Right-click on the textfield to invoke context menu and select \"Undo\".",
-                    "4.Verify that the symbols you typed are NOT undone.",
-                    "5.If they are not, press Pass, else press Fail."
+            = {
+                "1.Type a few symbols in the textfield.",
+                "2.Right-click on the textfield to invoke context menu and select \"Undo\". Make sure the typed symbol is undone.",
+                "3.Then click the button Disable textfield to disable the textfield.",
+                "4.Right-click on the textfield to invoke context menu.Verify that Undo option is disabled in context menu and you can't undo the text",
+                "5.If they are not, press Pass, else press Fail."
                 };
 
         Sysout.createDialog();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/WindowDeadlockTest/WindowDeadlockTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8176490
+ * @summary Tests that there is no hang or deadlock when the visibility
+ *      of parent and child windows is changed.
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main/timeout=20 WindowDeadlockTest
+ */
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Robot;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class WindowDeadlockTest {
+    public static void main(String[] args) throws Exception {
+        Robot robot = Util.createRobot();
+
+        Frame main = new Frame("Main");
+        main.setBounds(0, 0, 200, 100);
+        main.setVisible(true);
+
+        Dialog first = new Dialog(main, "First");
+        first.setBounds(250, 0, 200, 100);
+        first.setVisible(true);
+
+        Dialog second = new Dialog(first, "Second");
+        second.setBounds(0, 150, 200, 100);
+        second.setVisible(true);
+
+        Util.waitForIdle(robot);
+        robot.delay(2000);
+
+        Dialog third = new Dialog(first, "Third", false);
+        third.setBounds(250, 150, 200, 100);
+        third.setVisible(true);
+        first.setVisible(false); // the hang takes place here
+
+        Util.waitForIdle(robot);
+        robot.delay(2000);
+
+        third.dispose();
+        second.dispose();
+        first.dispose();
+        main.dispose();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/PageFormat/WrongPaperPrintingTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8167102
+   @summary PrintRequestAttributeSet breaks page size set using PageFormat
+   @run main/manual WrongPaperPrintingTest
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.Graphics;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.print.PageFormat;
+import java.awt.print.Paper;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.Size2DSyntax;
+import javax.print.attribute.standard.Chromaticity;
+import javax.print.attribute.standard.MediaSize;
+import javax.print.attribute.standard.MediaSizeName;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.Timer;
+import javax.swing.WindowConstants;
+
+public class WrongPaperPrintingTest implements Printable {
+    private static final CountDownLatch testEndedSignal = new CountDownLatch(1);
+    private static final int testTimeout = 300000;
+    private static volatile String testFailureMsg;
+    private static volatile boolean testPassed;
+    private static volatile boolean testFinished;
+
+    public static void main(String[] args) {
+        SwingUtilities.invokeLater(() -> createAndShowTestDialog());
+
+        try {
+            if (!testEndedSignal.await(testTimeout, TimeUnit.MILLISECONDS)) {
+                throw new RuntimeException(String.format(
+                    "Test timeout '%d ms' elapsed.", testTimeout));
+            }
+            if (!testPassed) {
+                String failureMsg = testFailureMsg;
+                if ((failureMsg != null) && (!failureMsg.trim().isEmpty())) {
+                    throw new RuntimeException(failureMsg);
+                } else {
+                    throw new RuntimeException("Test failed.");
+                }
+            }
+        } catch (InterruptedException ie) {
+            throw new RuntimeException(ie);
+        } finally {
+            testFinished = true;
+        }
+    }
+
+    private static void doTest() {
+        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
+        aset.add(Chromaticity.MONOCHROME);
+
+        MediaSize isoA5Size = MediaSize.getMediaSizeForName(MediaSizeName.ISO_A5);
+        float[] size = isoA5Size.getSize(Size2DSyntax.INCH);
+        Paper paper = new Paper();
+        paper.setSize(size[0] * 72.0, size[1] * 72.0);
+        paper.setImageableArea(0.0, 0.0, size[0] * 72.0, size[1] * 72.0);
+        PageFormat pf = new PageFormat();
+        pf.setPaper(paper);
+
+        PrinterJob job = PrinterJob.getPrinterJob();
+        job.setPrintable(new WrongPaperPrintingTest(), job.validatePage(pf));
+        if (job.printDialog()) {
+            try {
+                job.print(aset);
+            } catch (PrinterException pe) {
+                throw new RuntimeException(pe);
+            }
+        }
+    }
+
+    private static void pass() {
+        testPassed = true;
+        testEndedSignal.countDown();
+    }
+
+    private static void fail(String failureMsg) {
+        testFailureMsg = failureMsg;
+        testPassed = false;
+        testEndedSignal.countDown();
+    }
+
+    private static String convertMillisToTimeStr(int millis) {
+        if (millis < 0) {
+            return "00:00:00";
+        }
+        int hours = millis / 3600000;
+        int minutes = (millis - hours * 3600000) / 60000;
+        int seconds = (millis - hours * 3600000 - minutes * 60000) / 1000;
+        return String.format("%02d:%02d:%02d", hours, minutes, seconds);
+    }
+
+    private static void createAndShowTestDialog() {
+        String description =
+            " To run this test it is required to have a virtual PDF\r\n" +
+            " printer or any other printer supporting A5 paper size.\r\n" +
+            "\r\n" +
+            " 1. Verify that NOT A5 paper size is set as default for the\r\n" +
+            " printer to be used.\r\n" +
+            " 2. Click on \"Start Test\" button.\r\n" +
+            " 3. In the shown print dialog select the printer and click\r\n" +
+            " on \"Print\" button.\r\n" +
+            " 4. Verify that a page with a drawn rectangle is printed on\r\n" +
+            " a paper of A5 size which is (5.8 x 8.3 in) or\r\n" +
+            " (148 x 210 mm).\r\n" +
+            "\r\n" +
+            " If the printed page size is correct, click on \"PASS\"\r\n" +
+            " button, otherwise click on \"FAIL\" button.";
+
+        final JDialog dialog = new JDialog();
+        dialog.setTitle("WrongPaperPrintingTest");
+        dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+        dialog.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                dialog.dispose();
+                fail("Main dialog was closed.");
+            }
+        });
+
+        final JLabel testTimeoutLabel = new JLabel(String.format(
+            "Test timeout: %s", convertMillisToTimeStr(testTimeout)));
+        final long startTime = System.currentTimeMillis();
+        final Timer timer = new Timer(0, null);
+        timer.setDelay(1000);
+        timer.addActionListener((e) -> {
+            int leftTime = testTimeout - (int)(System.currentTimeMillis() - startTime);
+            if ((leftTime < 0) || testFinished) {
+                timer.stop();
+                dialog.dispose();
+            }
+            testTimeoutLabel.setText(String.format(
+                "Test timeout: %s", convertMillisToTimeStr(leftTime)));
+        });
+        timer.start();
+
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+
+        final JButton testButton = new JButton("Start Test");
+        final JButton passButton = new JButton("PASS");
+        final JButton failButton = new JButton("FAIL");
+        testButton.addActionListener((e) -> {
+            testButton.setEnabled(false);
+            new Thread(() -> {
+                try {
+                    doTest();
+
+                    SwingUtilities.invokeLater(() -> {
+                        passButton.setEnabled(true);
+                        failButton.setEnabled(true);
+                    });
+                } catch (Throwable t) {
+                    t.printStackTrace();
+                    dialog.dispose();
+                    fail("Exception occurred in a thread executing the test.");
+                }
+            }).start();
+        });
+        passButton.setEnabled(false);
+        passButton.addActionListener((e) -> {
+            dialog.dispose();
+            pass();
+        });
+        failButton.setEnabled(false);
+        failButton.addActionListener((e) -> {
+            dialog.dispose();
+            fail("Size of a printed page is wrong.");
+        });
+
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        JPanel labelPanel = new JPanel(new FlowLayout());
+        labelPanel.add(testTimeoutLabel);
+        mainPanel.add(labelPanel, BorderLayout.NORTH);
+        mainPanel.add(textArea, BorderLayout.CENTER);
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(testButton);
+        buttonPanel.add(passButton);
+        buttonPanel.add(failButton);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+        dialog.add(mainPanel);
+
+        dialog.pack();
+        dialog.setVisible(true);
+    }
+
+    @Override
+    public int print(Graphics g, PageFormat pf, int pageIndex)
+        throws PrinterException {
+        if (pageIndex == 0) {
+            g.setColor(Color.RED);
+            g.drawRect((int)pf.getImageableX(), (int)pf.getImageableY(),
+                (int)pf.getImageableWidth(), (int)pf.getImageableHeight());
+            return Printable.PAGE_EXISTS;
+        } else {
+            return Printable.NO_SUCH_PAGE;
+        }
+    }
+}
--- a/jdk/test/java/io/FilePermission/Correctness.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/io/FilePermission/Correctness.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,12 +89,14 @@
         //check("/-", "-");
 
         try {
-            // containsPath is broken on Windows.
             containsMethod = FilePermission.class.getDeclaredMethod(
                     "containsPath", Path.class, Path.class);
             containsMethod.setAccessible(true);
             System.out.println();
 
+            // The 1st 2 args of contains() must be normalized paths.
+            // When FilePermission::containsPath is called by implies,
+            // paths have already been normalized.
             contains("x", "x", 0);
             contains("x", "x/y", 1);
             contains("x", "x/y/z", 2);
@@ -160,7 +162,7 @@
         }
     }
 
-    static void check(String s1, String s2, boolean expected) {
+    static void check0(String s1, String s2, boolean expected) {
         FilePermission fp1 = new FilePermission(s1, "read");
         FilePermission fp2 = new FilePermission(s2, "read");
         boolean b = fp1.implies(fp2);
@@ -173,6 +175,16 @@
         }
     }
 
+    static void check(String s1, String s2, boolean expected) {
+        check0(s1, s2, expected);
+        if (isWindows) {
+            check0("C:" + s1, s2, false);
+            check0(s1, "C:" + s2, false);
+            check0("C:" + s1, "D:" + s2, false);
+            check0("C:" + s1, "C:" + s2, expected);
+        }
+    }
+
     static void check(String s1, String s2) {
         check(s1, s2, true);
     }
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -311,7 +311,7 @@
             if (action.equals("sleep")) {
                 Thread.sleep(10 * 60 * 1000L);
             } else if (action.equals("pid")) {
-                System.out.println(ProcessHandle.current().getPid());
+                System.out.println(ProcessHandle.current().pid());
             } else if (action.equals("testIO")) {
                 String expected = "standard input";
                 char[] buf = new char[expected.length()+1];
@@ -1235,7 +1235,7 @@
             Process p = pb.start();
             String s = commandOutput(p);
             long actualPid = Long.valueOf(s.trim());
-            long expectedPid = p.getPid();
+            long expectedPid = p.pid();
             equal(actualPid, expectedPid);
         } catch (Throwable t) {
             unexpected(t);
@@ -1245,7 +1245,7 @@
         // Test the default implementation of Process.getPid
         DelegatingProcess p = new DelegatingProcess(null);
         THROWS(UnsupportedOperationException.class,
-                () -> p.getPid(),
+                () -> p.pid(),
                 () -> p.toHandle(),
                 () -> p.supportsNormalTermination(),
                 () -> p.children(),
@@ -2243,7 +2243,7 @@
                 // Child process waits until it gets input
                 String s = p.toString();
                 check(s.contains("not exited"));
-                check(s.contains("pid=" + p.getPid() + ","));
+                check(s.contains("pid=" + p.pid() + ","));
 
                 new PrintStream(p.getOutputStream()).print("standard input");
                 p.getOutputStream().close();
@@ -2251,7 +2251,7 @@
                 // Check the toString after it exits
                 int exitValue = p.waitFor();
                 s = p.toString();
-                check(s.contains("pid=" + p.getPid() + ","));
+                check(s.contains("pid=" + p.pid() + ","));
                 check(s.contains("exitValue=" + exitValue) &&
                         !s.contains("not exited"));
             }
--- a/jdk/test/java/lang/ProcessBuilder/PipelineTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/lang/ProcessBuilder/PipelineTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -212,7 +212,7 @@
 
     static void print(ProcessHandle p) {
         System.out.printf("process: pid: %d, info: %s%n",
-                p.getPid(), p.info());
+                p.pid(), p.info());
     }
 
     // Check various aspects of the processes
--- a/jdk/test/java/lang/ProcessBuilder/Zombies.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/lang/ProcessBuilder/Zombies.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
             ! new File("/bin/ps").canExecute())
             return;
         System.out.println("Looks like a Unix system.");
-        long mypid = ProcessHandle.current().getPid();
+        long mypid = ProcessHandle.current().pid();
         System.out.printf("mypid: %d%n", mypid);
 
         final Runtime rt = Runtime.getRuntime();
@@ -65,7 +65,7 @@
 
         Process p = rt.exec(TrueCommand);
         ProcessHandle pp = p.toHandle().parent().orElse(null);
-        System.out.printf("%s pid: %d, parent: %s%n", TrueCommand, p.getPid(), pp);
+        System.out.printf("%s pid: %d, parent: %s%n", TrueCommand, p.pid(), pp);
         p.waitFor();
 
         // Count all the zombies that are children of this Java process
--- a/jdk/test/java/lang/ProcessHandle/Basic.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/lang/ProcessHandle/Basic.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,13 +66,13 @@
     public static void test2() {
         try {
             ProcessHandle self = ProcessHandle.current();
-            long pid = self.getPid();       // known native process id
+            long pid = self.pid();       // known native process id
             Optional<ProcessHandle> self1 = ProcessHandle.of(pid);
             assertEquals(self1.get(), self,
-                    "ProcessHandle.of(x.getPid()) should be equal getPid() %d: %d");
+                    "ProcessHandle.of(x.pid()) should be equal pid() %d: %d");
 
             Optional<ProcessHandle> ph = ProcessHandle.of(pid);
-            assertEquals(pid, ph.get().getPid());
+            assertEquals(pid, ph.get().pid());
         } finally {
             // Cleanup any left over processes
             ProcessHandle.current().children().forEach(ProcessHandle::destroy);
@@ -98,7 +98,7 @@
             Process p = new ProcessBuilder("sleep", "0").start();
             p.waitFor();
 
-            long deadPid = p.getPid();
+            long deadPid = p.pid();
             p = null;               // Forget the process
 
             Optional<ProcessHandle> t = ProcessHandle.of(deadPid);
--- a/jdk/test/java/lang/ProcessHandle/JavaChild.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/lang/ProcessHandle/JavaChild.java	Wed Jul 05 23:16:15 2017 +0200
@@ -159,7 +159,7 @@
      */
     CompletableFuture<String> forEachOutputLine(Consumer<String> consumer) {
         final CompletableFuture<String> future = new CompletableFuture<>();
-        String name = "OutputLineReader-" + getPid();
+        String name = "OutputLineReader-" + pid();
         Thread t = new Thread(() -> {
             try (BufferedReader reader = outputReader()) {
                 String line;
@@ -167,7 +167,7 @@
                     consumer.accept(line);
                 }
             } catch (IOException | RuntimeException ex) {
-                consumer.accept("IOE (" + getPid() + "):" + ex.getMessage());
+                consumer.accept("IOE (" + pid() + "):" + ex.getMessage());
                 future.completeExceptionally(ex);
             }
             future.complete("success");
@@ -327,7 +327,7 @@
                                 try {
                                     p.getOutputStream().close();
                                 } catch (IOException ie) {
-                                    sendResult("stdin_closing", p.getPid(),
+                                    sendResult("stdin_closing", p.pid(),
                                             "exception", ie.getMessage());
                                 }
                             }
@@ -352,9 +352,9 @@
                                             "children to terminate%n");
                                     children.removeAll(completedChildren);
                                     for (JavaChild c : children) {
-                                        sendResult("stdin_noterm", c.getPid());
+                                        sendResult("stdin_noterm", c.pid());
                                         System.err.printf("  Process not terminated: " +
-                                                "pid: %d%n", c.getPid());
+                                                "pid: %d%n", c.pid());
                                     }
                                     System.exit(2);
                                 }
@@ -386,11 +386,11 @@
                         System.arraycopy(args, nextArg, subargs, 0, subargs.length);
                         for (int i = 0; i < ncount; i++) {
                             JavaChild p = spawnJavaChild(subargs);
-                            sendResult(action, p.getPid());
+                            sendResult(action, p.pid());
                             p.forEachOutputLine(JavaChild::sendRaw);
                             p.onJavaChildExit().thenAccept((p1) -> {
                                 int excode = p1.exitValue();
-                                sendResult("child_exit", p1.getPid(), excode);
+                                sendResult("child_exit", p1.pid(), excode);
                                 completedChildren.add(p1);
                             });
                             children.add(p);        // Add child to spawned list
@@ -410,7 +410,7 @@
                             if (p.isAlive()) {
                                 sentCount++;
                                 // overwrite with current pid
-                                result[0] = Long.toString(p.getPid());
+                                result[0] = Long.toString(p.pid());
                                 sendResult(action, result);
                                 p.sendAction(args[nextArg], subargs);
                             }
@@ -426,7 +426,7 @@
                         // ignoring those that are not alive
                         for (JavaChild p : children) {
                             if (p.isAlive()) {
-                                sendResult(action, p.getPid());
+                                sendResult(action, p.pid());
                                 p.getOutputStream().close();
                             }
                         }
@@ -505,7 +505,7 @@
         String command;
         Object[] results;
         Event(String command, Object... results) {
-            this(self.getPid(), ++commandSeq, command, results);
+            this(self.pid(), ++commandSeq, command, results);
         }
         Event(long pid, int seq, String command, Object... results) {
             this.pid = pid;
--- a/jdk/test/java/lang/ProcessHandle/OnExitTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/lang/ProcessHandle/OnExitTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -104,7 +104,7 @@
 
             JavaChild proc = JavaChild.spawnJavaChild("stdin");
             procHandle = proc.toHandle();
-            printf(" spawned: %d%n", proc.getPid());
+            printf(" spawned: %d%n", proc.pid());
 
             proc.forEachOutputLine((s) -> {
                 String[] split = s.trim().split(" ");
@@ -235,7 +235,7 @@
                 } while (!"pid".equals(split[1]));
 
                 // Tell B to wait for A's pid
-                B.sendAction("waitpid", A.getPid());
+                B.sendAction("waitpid", A.pid());
 
                 // Wait a bit to see if B will prematurely report the termination of A
                 try {
--- a/jdk/test/java/lang/ProcessHandle/ProcessUtil.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/lang/ProcessHandle/ProcessUtil.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -199,7 +199,7 @@
      */
     static void printProcess(ProcessHandle ph, String prefix) {
         printf("%spid %s, alive: %s; parent: %s, %s%n", prefix,
-                ph.getPid(), ph.isAlive(), ph.parent(), ph.info());
+                ph.pid(), ph.isAlive(), ph.parent(), ph.info());
     }
 
     /**
--- a/jdk/test/java/lang/ProcessHandle/TreeTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/lang/ProcessHandle/TreeTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,7 +73,7 @@
         try {
             ProcessHandle self = ProcessHandle.current();
 
-            printf("self pid: %d%n", self.getPid());
+            printf("self pid: %d%n", self.pid());
             printDeep(self, "");
 
             for (int i = 0; i < MAXCHILDREN; i++) {
@@ -154,7 +154,7 @@
 
             JavaChild p1 = JavaChild.spawnJavaChild("stdin");
             ProcessHandle p1Handle = p1.toHandle();
-            printf("  p1 pid: %d%n", p1.getPid());
+            printf("  p1 pid: %d%n", p1.pid());
 
             // Gather the PIDs from the output of the spawing process
             p1.forEachOutputLine((s) -> {
@@ -206,7 +206,7 @@
             // show the complete list of children (for debug)
             List<ProcessHandle> descendants = getDescendants(p1Handle);
             printf(" descendants:  %s%n",
-                    descendants.stream().map(p -> p.getPid())
+                    descendants.stream().map(p -> p.pid())
                            .collect(Collectors.toList()));
 
             // Verify that all spawned children show up in the descendants  List
@@ -252,7 +252,7 @@
 
             JavaChild p1 = JavaChild.spawnJavaChild("stdin");
             ProcessHandle p1Handle = p1.toHandle();
-            printf(" p1: %s%n", p1.getPid());
+            printf(" p1: %s%n", p1.pid());
 
             int newChildren = 3;
             CountDownLatch spawnCount = new CountDownLatch(newChildren);
@@ -356,11 +356,11 @@
             parent[sortindex[i]] = processes[sortindex[i]].parent().orElse(null);
         }
         Arrays.sort(sortindex, (i1, i2) -> {
-            int cmp = Long.compare((parent[i1] == null ? 0L : parent[i1].getPid()),
-                    (parent[i2] == null ? 0L : parent[i2].getPid()));
+            int cmp = Long.compare((parent[i1] == null ? 0L : parent[i1].pid()),
+                    (parent[i2] == null ? 0L : parent[i2].pid()));
             if (cmp == 0) {
-                cmp = Long.compare((processes[i1] == null ? 0L : processes[i1].getPid()),
-                        (processes[i2] == null ? 0L : processes[i2].getPid()));
+                cmp = Long.compare((processes[i1] == null ? 0L : processes[i1].pid()),
+                        (processes[i2] == null ? 0L : processes[i2].pid()));
             }
             return cmp;
         });
@@ -397,7 +397,7 @@
             ProcessHandle p1Handle = p1.toHandle();
 
             printf("Spawning %d x %d x %d processes, pid: %d%n",
-                    factor, factor, factor, p1.getPid());
+                    factor, factor, factor, p1.pid());
 
             // Start the first tier of subprocesses
             p1.sendAction("spawn", factor, "stdin");
@@ -448,7 +448,7 @@
 
             List<ProcessHandle> subprocesses = getDescendants(p1Handle);
             printf(" descendants:  %s%n",
-                    subprocesses.stream().map(p -> p.getPid())
+                    subprocesses.stream().map(p -> p.pid())
                     .collect(Collectors.toList()));
 
             p1.getOutputStream().close();  // Close stdin for the controlling p1
--- a/jdk/test/java/lang/Runtime/exec/SleepyCat.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/lang/Runtime/exec/SleepyCat.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,10 +80,10 @@
             for (Process p : pids) {
                 if (p == null)
                     continue;
-                String[] pfiles = {"pfiles", Long.toString(p.getPid())};
+                String[] pfiles = {"pfiles", Long.toString(p.pid())};
                 fds = new ProcessBuilder(pfiles).inheritIO().start();
                 fds.waitFor();
-                String[] pstack = {"pstack", Long.toString(p.getPid())};
+                String[] pstack = {"pstack", Long.toString(p.pid())};
                 fds = new ProcessBuilder(pstack).inheritIO().start();
                 fds.waitFor();
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/Base.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,273 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * Base class for tests.
+ * The tests focuse on that LoggerFinder works well in jigsaw environment,
+ * i.e. make sure correct Logger can be retrieved,
+ * also verify that basic functionality of retrieved Logger's works well.
+ *
+ * Note: As the test will take long time, to avoid timeout,
+ * split it as several tests, this class is the base class for tests.
+ */
+public class Base {
+    protected static final String JAVA_HOME = System.getProperty("java.home");
+    protected static final Path JDK_IMAGE = Paths.get(JAVA_HOME);
+    protected static final Path JMODS = Paths.get(JAVA_HOME, "jmods");
+
+    protected static final String TEST_SRC = System.getProperty("test.src");
+
+    // logger client to get logger from java.base module, it should get a lazy logger
+    // which wraps the underlying real logger implementation
+    protected static final Path SRC_PATCHED_USAGE =
+            Paths.get(TEST_SRC, "patched_usage", "java.base");
+    protected static final Path DEST_PATCHED_USAGE = Paths.get("patched_usage", "java.base");
+    protected static final Path SRC_PATCHED_CLIENT = Paths.get(TEST_SRC, "patched_client");
+    protected static final Path DEST_PATCHED_CLIENT = Paths.get("patched_client");
+
+    // logger client to get logger from bootclasspath/a, it should get a lazy logger
+    // which wraps the underlying real logger implementation
+    protected static final Path SRC_BOOT_USAGE = Paths.get(TEST_SRC, "boot_usage");
+    protected static final Path DEST_BOOT_USAGE = Paths.get("boot_usage");
+    protected static final Path SRC_BOOT_CLIENT = Paths.get(TEST_SRC, "boot_client");
+    protected static final Path DEST_BOOT_CLIENT = Paths.get("boot_client");
+
+    // logger provider in named module m.l.a
+    protected static final Path SRC_NAMED_LOGGER = Paths.get(TEST_SRC, "named_logger");
+    protected static final Path DEST_NAMED_LOGGER = Paths.get("mods_named_logger");
+
+    // logger provider in unnamed module
+    protected static final Path SRC_UNNAMED_LOGGER = Paths.get(TEST_SRC, "unnamed_logger");
+    protected static final Path DEST_UNNAMED_LOGGER = Paths.get("cp_unnamed_logger");
+    protected static final Path SRC_UNNAMED_LOGGER_SERVICE_FILE =
+            SRC_UNNAMED_LOGGER.resolve("META-INF/services/java.lang.System$LoggerFinder");
+    protected static final Path DEST_UNNAMED_LOGGER_SERVICE_DIR =
+            DEST_UNNAMED_LOGGER.resolve("META-INF/services");
+    protected static final Path DEST_UNNAMED_LOGGER_SERVICE_FILE =
+            DEST_UNNAMED_LOGGER.resolve("META-INF/services/java.lang.System$LoggerFinder");
+
+    // logger client in named module m.t.a
+    protected static final Path SRC_NAMED_CLIENT = Paths.get(TEST_SRC, "named_client");
+    protected static final Path DEST_NAMED_CLIENT = Paths.get("mods_named_client");
+
+    // logger client in unnamed module
+    protected static final Path SRC_UNNAMED_CLIENT = Paths.get(TEST_SRC, "unnamed_client");
+    protected static final Path DEST_UNNAMED_CLIENT = Paths.get("cp_unnamed_client");
+
+    // customized image with only module java.base
+    protected static final Path IMAGE = Paths.get("image");
+    // customized image with java.base and logger provider module m.l.a
+    protected static final Path IMAGE_LOGGER = Paths.get("image_logger");
+    // customized image with module java.base and logger client module m.t.a
+    protected static final Path IMAGE_CLIENT = Paths.get("image_client");
+    // customized image with module java.base, logger provider module m.l.a
+    // and logger client module m.t.a
+    protected static final Path IMAGE_CLIENT_LOGGER = Paths.get("image_all");
+
+    // lazy logger class which wraps the underlying real logger implementation
+    protected static final String LAZY_LOGGER =
+            "jdk.internal.logger.LazyLoggers$JdkLazyLogger";
+    // JUL logger class which wraps java.util.logging.Logger
+    protected static final String JUL_LOGGER =
+            "sun.util.logging.internal.LoggingProviderImpl$JULWrapper";
+    // default simple logger class when no logger provider can be found
+    protected static final String SIMPLE_LOGGER =
+            "jdk.internal.logger.SimpleConsoleLogger";
+    // logger class in named module m.l.a
+    protected static final String LOGGER_A = "pkg.a.l.LoggerA";
+    // logger class in unnamed module m.l.b
+    protected static final String LOGGER_B = "pkg.b.l.LoggerB";
+
+    // logger client in named module
+    protected static final String CLIENT_A = "m.t.a/pkg.a.t.TestA";
+    // logger client in unnamed module
+    protected static final String CLIENT_B = "pkg.b.t.TestB";
+    // logger client which gets logger through boot class BootUsage
+    protected static final String BOOT_CLIENT = "BootClient";
+    // logger client which gets logger through patched class
+    // java.base/java.lang.PatchedUsage
+    protected static final String PATCHED_CLIENT = "PatchedClient";
+
+    protected void setupAllClient() throws Throwable {
+        // compiles logger client which will get logger through patched
+        // class java.base/java.lang.PatchedUsage
+        compile(SRC_BOOT_USAGE, DEST_BOOT_USAGE);
+        compile(SRC_BOOT_CLIENT, DEST_BOOT_CLIENT,
+                "--class-path", DEST_BOOT_USAGE.toString());
+
+        // compiles logger client which will get logger through boot
+        // class BootUsage
+        compile(SRC_PATCHED_USAGE, DEST_PATCHED_USAGE,
+                "--patch-module", "java.base=" + SRC_PATCHED_USAGE.toString());
+        compile(SRC_PATCHED_CLIENT, DEST_PATCHED_CLIENT,
+                "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString());
+
+        // compiles logger client in unnamed module
+        compile(SRC_UNNAMED_CLIENT, DEST_UNNAMED_CLIENT,
+                "--source-path", SRC_UNNAMED_CLIENT.toString());
+
+        // compiles logger client in named module m.t.a
+        compile(SRC_NAMED_CLIENT, DEST_NAMED_CLIENT,
+                "--module-source-path", SRC_NAMED_CLIENT.toString());
+    }
+
+    protected void setupNamedLogger() throws Throwable {
+        // compiles logger provider in named module m.l.a
+        compile(SRC_NAMED_LOGGER, DEST_NAMED_LOGGER,
+                "--module-source-path", SRC_NAMED_LOGGER.toString());
+    }
+
+    protected void setupUnnamedLogger() throws Throwable {
+        // compiles logger provider in unnamed module
+        compile(SRC_UNNAMED_LOGGER, DEST_UNNAMED_LOGGER,
+                "--source-path", SRC_UNNAMED_LOGGER.toString());
+        Files.createDirectories(DEST_UNNAMED_LOGGER_SERVICE_DIR);
+        Files.copy(SRC_UNNAMED_LOGGER_SERVICE_FILE, DEST_UNNAMED_LOGGER_SERVICE_FILE,
+                   StandardCopyOption.REPLACE_EXISTING);
+    }
+
+    protected boolean checkJMODS() throws Throwable {
+        // if $JAVA_HOME/jmods does not exist, skip below steps
+        // as there is no way to build customized images by jlink
+        if (Files.notExists(JMODS)) {
+            System.err.println("Skip tests which require image");
+            return false;
+        }
+        return true;
+    }
+
+    protected void setupJavaBaseImage() throws Throwable {
+        if (!checkJMODS()) {
+            return;
+        }
+
+        // build image with just java.base module
+        String mpath = JMODS.toString();
+        execTool("jlink",
+                "--module-path", mpath,
+                "--add-modules", "java.base",
+                "--output", IMAGE.toString());
+    }
+
+    protected void setupLoggerImage() throws Throwable {
+        if (!checkJMODS()) {
+            return;
+        }
+
+        // build image with java.base + m.l.a modules
+        String mpath = DEST_NAMED_LOGGER.toString() + File.pathSeparator + JMODS.toString();
+        execTool("jlink",
+                "--module-path", mpath,
+                "--add-modules", "m.l.a",
+                "--output", IMAGE_LOGGER.toString());
+    }
+
+    protected void setupClientImage() throws Throwable {
+        if (!checkJMODS()) {
+            return;
+        }
+
+        // build image with java.base + m.t.a modules
+        String mpath = DEST_NAMED_CLIENT.toString() + File.pathSeparator + JMODS.toString();
+        execTool("jlink",
+                "--module-path", mpath,
+                "--add-modules", "m.t.a",
+                "--output", IMAGE_CLIENT.toString());
+    }
+
+    protected void setupFullImage() throws Throwable {
+        if (!checkJMODS()) {
+            return;
+        }
+
+        // build image with java.base + m.l.a + m.t.a modules
+        String mpath = DEST_NAMED_LOGGER.toString() + File.pathSeparator
+                + DEST_NAMED_CLIENT.toString() + File.pathSeparator + JMODS.toString();
+        execTool("jlink",
+                "--module-path", mpath,
+                "--add-modules", "m.l.a,m.t.a",
+                "--output", IMAGE_CLIENT_LOGGER.toString());
+
+    }
+
+    protected static void assertTrue(boolean b) {
+        if (!b) {
+            throw new RuntimeException("expected true, but get false.");
+        }
+    }
+
+    /*
+     * run test with supplied java image which could be jdk image or customized image
+     */
+    protected void runTest(Path image, String... opts) throws Throwable {
+        String[] options = Stream.concat(Stream.of(getJava(image)), Stream.of(opts))
+                                 .toArray(String[]::new);
+
+        ProcessBuilder pb = new ProcessBuilder(options);
+        int exitValue = executeCommand(pb).outputTo(System.out)
+                                          .errorTo(System.err)
+                                          .getExitValue();
+        assertTrue(exitValue == 0);
+    }
+
+    private void compile(Path src, Path dest, String... params) throws Throwable {
+        assertTrue(CompilerUtils.compile(src, dest, params));
+    }
+
+    private String getJava(Path image) {
+        boolean isWindows = System.getProperty("os.name").startsWith("Windows");
+        Path java = image.resolve("bin").resolve(isWindows ? "java.exe" : "java");
+        if (Files.notExists(java))
+            throw new RuntimeException(java + " not found");
+        return java.toAbsolutePath().toString();
+    }
+
+    private void execTool(String tool, String... args) throws Throwable {
+        String path = JDKToolFinder.getJDKTool(tool);
+        List<String> commands = new ArrayList<>();
+        commands.add(path);
+        Stream.of(args).forEach(commands::add);
+        ProcessBuilder pb = new ProcessBuilder(commands);
+
+        int exitValue = executeCommand(pb).outputTo(System.out)
+                                          .errorTo(System.out)
+                                          .shouldNotContain("no module is recorded in hash")
+                                          .getExitValue();
+        assertTrue(exitValue == 0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * @test
+ * @modules jdk.compiler
+ * @summary Test cases which run against customized image, check the situation where
+ *            1. logger provider is the default one supplied by java.base,
+ *            2. clients are in named/unnamed module,
+ *               patched system module, or Xbootclasspath
+ *          This test does not require existence of java.logging module,
+ *          but require jdk.compiler module
+ * @library /lib/testlibrary
+ * @build Base CompilerUtils jdk.testlibrary.*
+ * @run main/othervm JDKLoggerForImageTest
+ */
+
+public class JDKLoggerForImageTest extends Base {
+
+    public static void main(String args[]) throws Throwable {
+        JDKLoggerForImageTest t = new JDKLoggerForImageTest();
+        t.setup();
+        t.test();
+    }
+
+    private void setup() throws Throwable {
+        setupAllClient();
+
+        setupJavaBaseImage();
+    }
+
+    private void test() throws Throwable {
+        if (!checkJMODS()) {
+            return;
+        }
+
+        // logger client is in named module m.t.a
+        runTest(IMAGE,
+                "--module-path", DEST_NAMED_CLIENT.toString(),
+                "-m", CLIENT_A, "system", SIMPLE_LOGGER);
+        // logger client is in unnamed module
+        runTest(IMAGE,
+                "--class-path", DEST_UNNAMED_CLIENT.toString(),
+                CLIENT_B, "system", SIMPLE_LOGGER);
+        // logger client gets logger through boot class BootUsage
+        runTest(IMAGE,
+                "-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),
+                "--class-path", DEST_BOOT_CLIENT.toString(),
+                BOOT_CLIENT, "system", SIMPLE_LOGGER);
+        // logger client gets logger through patched class
+        // java.base/java.lang.PatchedUsage
+        runTest(IMAGE,
+                "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),
+                "--class-path", DEST_PATCHED_CLIENT.toString(),
+                PATCHED_CLIENT, "system", SIMPLE_LOGGER);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * @test
+ * @modules java.logging
+ * @modules jdk.compiler
+ * @summary Test cases which run against the JDK image, check the situation where
+ *            1. logger provider is the default one supplied by the JDK,
+ *            2. clients are in named/unnamed module,
+ *               patched system module, or Xbootclasspath
+ *          This test DOES require existence of java.logging module
+ * @library /lib/testlibrary
+ * @build Base CompilerUtils jdk.testlibrary.*
+ * @run main/othervm JDKLoggerForJDKTest
+ */
+
+public class JDKLoggerForJDKTest extends Base {
+
+    public static void main(String args[]) throws Throwable {
+        JDKLoggerForJDKTest t = new JDKLoggerForJDKTest();
+        t.setup();
+        t.test();
+    }
+
+    private void setup() throws Throwable {
+        setupAllClient();
+    }
+
+    private void test() throws Throwable {
+        // logger client is in named module m.t.a
+        runTest(JDK_IMAGE,
+                "--module-path", DEST_NAMED_CLIENT.toString(),
+                "-m", CLIENT_A, "system", JUL_LOGGER);
+        // logger client is in unnamed module
+        runTest(JDK_IMAGE,
+                "--class-path", DEST_UNNAMED_CLIENT.toString(),
+                CLIENT_B, "system", JUL_LOGGER);
+        // logger client gets logger through boot class BootUsage
+        runTest(JDK_IMAGE,
+                "-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),
+                "--class-path", DEST_BOOT_CLIENT.toString(),
+                BOOT_CLIENT, "system", LAZY_LOGGER, JUL_LOGGER);
+        // logger client gets logger through patched class
+        // java.base/java.lang.PatchedUsage
+        runTest(JDK_IMAGE,
+                "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),
+                "--class-path", DEST_PATCHED_CLIENT.toString(),
+                PATCHED_CLIENT, "system", LAZY_LOGGER, JUL_LOGGER);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * @test
+ * @modules jdk.compiler
+ * @summary Test cases which run against customized image, check the situation where
+ *            1. logger providers are in the customized image too,
+ *            2. clients are in named/unnamed module, image,
+ *               patched system module, or Xbootclasspath
+ *          This test does not require existence of java.logging module,
+ *          but require jdk.compiler module
+ * @library /lib/testlibrary
+ * @build Base CompilerUtils jdk.testlibrary.*
+ * @run main/othervm LoggerInImageTest
+ */
+
+public class LoggerInImageTest extends Base {
+
+    public static void main(String args[]) throws Throwable {
+        LoggerInImageTest t = new LoggerInImageTest();
+        t.setup();
+        t.test();
+    }
+
+    private void setup() throws Throwable {
+        setupAllClient();
+
+        setupNamedLogger();
+
+        setupLoggerImage();
+        setupFullImage();
+    }
+
+    private void test() throws Throwable {
+        if (!checkJMODS()) {
+            return;
+        }
+
+        // logger client is in named module m.t.a which is also in customized image
+        runTest(IMAGE_CLIENT_LOGGER,
+                "-m", CLIENT_A, "named", LOGGER_A);
+        // logger client in named module m.t.a
+        runTest(IMAGE_LOGGER,
+                "--module-path", DEST_NAMED_CLIENT.toString(),
+                "-m", CLIENT_A, "named", LOGGER_A);
+        // logger client is in unnamed module
+        runTest(IMAGE_LOGGER,
+                "--class-path", DEST_UNNAMED_CLIENT.toString(),
+                CLIENT_B, "named", LOGGER_A);
+        // logger client gets logger through boot class BootUsage
+        runTest(IMAGE_LOGGER,
+                "-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),
+                "--class-path", DEST_BOOT_CLIENT.toString(),
+                BOOT_CLIENT, "system", LAZY_LOGGER, LOGGER_A);
+        // logger client gets logger through patched class
+        // java.base/java.lang.PatchedUsage
+        runTest(IMAGE_LOGGER,
+                "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),
+                "--class-path", DEST_PATCHED_CLIENT.toString(),
+                PATCHED_CLIENT, "system", LAZY_LOGGER, LOGGER_A);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * @test
+ * @modules jdk.compiler
+ * @summary Test cases which run against customized image, check the situation where
+ *            1. logger providers are in named module,
+ *            2. clients are in named/unnamed module, image,
+ *               patched system module, or Xbootclasspath
+ *          This test does not require existence of java.logging module,
+ *          but require jdk.compiler module
+ * @library /lib/testlibrary
+ * @build Base CompilerUtils jdk.testlibrary.*
+ * @run main/othervm NamedLoggerForImageTest
+ */
+
+public class NamedLoggerForImageTest extends Base {
+
+    public static void main(String args[]) throws Throwable {
+        NamedLoggerForImageTest t = new NamedLoggerForImageTest();
+        t.setup();
+        t.test();
+    }
+
+    private void setup() throws Throwable {
+        setupAllClient();
+
+        setupNamedLogger();
+
+        setupJavaBaseImage();
+        setupClientImage();
+    }
+
+    private void test() throws Throwable {
+        if (!checkJMODS()) {
+            return;
+        }
+
+        // logger client is in named module m.t.a
+        runTest(IMAGE,
+                "--module-path", DEST_NAMED_LOGGER.toString()
+                    + File.pathSeparator + DEST_NAMED_CLIENT.toString(),
+                "-m", CLIENT_A, "named", LOGGER_A);
+        // logger client is in unnamed module
+        runTest(IMAGE,
+                "--module-path", DEST_NAMED_LOGGER.toString(),
+                "--class-path", DEST_UNNAMED_CLIENT.toString(),
+                CLIENT_B, "named", LOGGER_A);
+        // logger client is in named module m.t.a which is in customized image
+        runTest(IMAGE_CLIENT,
+                "--module-path", DEST_NAMED_LOGGER.toString(),
+                "-m", CLIENT_A, "named", LOGGER_A);
+        // logger client gets logger through boot class BootUsage
+        runTest(IMAGE,
+                "--module-path", DEST_NAMED_LOGGER.toString(),
+                "-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),
+                "--class-path", DEST_BOOT_CLIENT.toString(),
+                BOOT_CLIENT, "system", LAZY_LOGGER, LOGGER_A);
+        // logger client gets logger through patched class
+        // java.base/java.lang.PatchedUsage
+        runTest(IMAGE,
+                "--module-path", DEST_NAMED_LOGGER.toString(),
+                "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),
+                "--class-path", DEST_PATCHED_CLIENT.toString(),
+                PATCHED_CLIENT, "system", LAZY_LOGGER, LOGGER_A);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * @test
+ * @modules jdk.compiler
+ * @summary Test cases which run against the JDK image, check the situation where
+ *            1. logger providers are in named module,
+ *            2. clients are in named/unnamed module,
+ *               patched system module, or Xbootclasspath
+ *          This test does not require existence of java.logging module,
+ *          but require jdk.compiler module
+ * @library /lib/testlibrary
+ * @build Base CompilerUtils jdk.testlibrary.*
+ * @run main/othervm NamedLoggerForJDKTest
+ */
+
+public class NamedLoggerForJDKTest extends Base {
+
+    public static void main(String args[]) throws Throwable {
+        NamedLoggerForJDKTest t = new NamedLoggerForJDKTest();
+        t.setup();
+        t.test();
+    }
+
+    private void setup() throws Throwable {
+        setupAllClient();
+
+        setupNamedLogger();
+    }
+
+    private void test() throws Throwable {
+        // logger client is in named module m.t.a
+        runTest(JDK_IMAGE,
+                "--module-path", DEST_NAMED_LOGGER.toString()
+                    + File.pathSeparator + DEST_NAMED_CLIENT.toString(),
+                "-m", CLIENT_A, "named", LOGGER_A);
+        // logger client is in unnamed module
+        runTest(JDK_IMAGE,
+                "--module-path", DEST_NAMED_LOGGER.toString(),
+                "--class-path", DEST_UNNAMED_CLIENT.toString(),
+                CLIENT_B, "named", LOGGER_A);
+        // logger client gets logger through boot class BootUsage
+        runTest(JDK_IMAGE,
+                "--module-path", DEST_NAMED_LOGGER.toString(),
+                "-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),
+                "--class-path", DEST_BOOT_CLIENT.toString(),
+                BOOT_CLIENT, "system", LAZY_LOGGER, LOGGER_A);
+        // logger client gets logger through patched class
+        // java.base/java.lang.PatchedUsage
+        runTest(JDK_IMAGE,
+                "--module-path", DEST_NAMED_LOGGER.toString(),
+                "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),
+                "--class-path", DEST_PATCHED_CLIENT.toString(),
+                PATCHED_CLIENT, "system", LAZY_LOGGER, LOGGER_A);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * @test
+ * @modules jdk.compiler
+ * @summary Test cases which run against customized image, check the situation where
+ *            1. logger providers are in unnamed module,
+ *            2. clients are in named/unnamed module, image,
+ *               patched system module, or Xbootclasspath
+ *          This test does not require existence of java.logging module,
+ *          but require jdk.compiler module
+ * @library /lib/testlibrary
+ * @build Base CompilerUtils jdk.testlibrary.*
+ * @run main/othervm UnnamedLoggerForImageTest
+ */
+
+public class UnnamedLoggerForImageTest extends Base {
+
+    public static void main(String args[]) throws Throwable {
+        UnnamedLoggerForImageTest t = new UnnamedLoggerForImageTest();
+        t.setup();
+        t.test();
+    }
+
+    private void setup() throws Throwable {
+        setupAllClient();
+
+        setupUnnamedLogger();
+
+        setupJavaBaseImage();
+        setupClientImage();
+    }
+
+    private void test() throws Throwable {
+        if (!checkJMODS()) {
+            return;
+        }
+
+        // logger client is in unnamed module
+        runTest(IMAGE,
+                "--class-path", DEST_UNNAMED_LOGGER.toString()
+                    + File.pathSeparator + DEST_UNNAMED_CLIENT.toString(),
+                CLIENT_B, "unnamed", LOGGER_B);
+        // logger client is in named module m.t.a
+        runTest(IMAGE,
+                "--class-path", DEST_UNNAMED_LOGGER.toString(),
+                "--module-path", DEST_NAMED_CLIENT.toString(),
+                "-m", CLIENT_A, "unnamed", LOGGER_B);
+        // logger client is in named module m.t.a which is in customized image
+        runTest(IMAGE_CLIENT,
+                "--class-path", DEST_UNNAMED_LOGGER.toString(),
+                "-m", CLIENT_A, "unnamed", LOGGER_B);
+        // logger client gets logger through boot class BootUsage
+        runTest(IMAGE,
+                "--class-path", DEST_UNNAMED_LOGGER.toString()
+                    + File.pathSeparator + DEST_BOOT_CLIENT.toString(),
+                "-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),
+                BOOT_CLIENT, "system", LAZY_LOGGER, LOGGER_B);
+        // logger client gets logger through patched class
+        // java.base/java.lang.PatchedUsage
+        runTest(IMAGE,
+                "--class-path", DEST_UNNAMED_LOGGER.toString()
+                    + File.pathSeparator + DEST_PATCHED_CLIENT.toString(),
+                "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),
+                PATCHED_CLIENT, "system", LAZY_LOGGER, LOGGER_B);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * @test
+ * @modules jdk.compiler
+ * @summary Test cases which run against the JDK image, check the situation where
+ *            1. logger providers are in unnamed module,
+ *            2. clients are in named/unnamed module,
+ *               patched system module, or Xbootclasspath
+ *          This test does not require existence of java.logging module,
+ *          but require jdk.compiler module
+ * @library /lib/testlibrary
+ * @build Base CompilerUtils jdk.testlibrary.*
+ * @run main/othervm UnnamedLoggerForJDKTest
+ */
+
+public class UnnamedLoggerForJDKTest extends Base {
+
+    public static void main(String args[]) throws Throwable {
+        UnnamedLoggerForJDKTest t = new UnnamedLoggerForJDKTest();
+        t.setup();
+        t.test();
+    }
+
+    private void setup() throws Throwable {
+        setupAllClient();
+
+        setupUnnamedLogger();
+    }
+
+    private void test() throws Throwable {
+        // logger client is in named module m.t.a
+        runTest(JDK_IMAGE,
+                "--class-path", DEST_UNNAMED_LOGGER.toString(),
+                "--module-path", DEST_NAMED_CLIENT.toString(),
+                "-m", CLIENT_A, "unnamed", LOGGER_B);
+        // logger client is also in unnamed module
+        runTest(JDK_IMAGE,
+                "--class-path", DEST_UNNAMED_LOGGER.toString()
+                    + File.pathSeparator + DEST_UNNAMED_CLIENT.toString(),
+                CLIENT_B, "unnamed", LOGGER_B);
+        // logger client gets logger through boot class BootUsage
+        runTest(JDK_IMAGE,
+                "--class-path", DEST_UNNAMED_LOGGER.toString()
+                    + File.pathSeparator + DEST_BOOT_CLIENT.toString(),
+                "-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),
+                BOOT_CLIENT, "system", LAZY_LOGGER, LOGGER_B);
+        // logger client gets logger through patched class
+        // java.base/java.lang.PatchedUsage
+        runTest(JDK_IMAGE,
+                "--class-path", DEST_UNNAMED_LOGGER.toString()
+                    + File.pathSeparator + DEST_PATCHED_CLIENT.toString(),
+                "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),
+                PATCHED_CLIENT, "system", LAZY_LOGGER, LOGGER_B);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/boot_client/BootClient.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.reflect.Method;
+import java.lang.System.Logger;
+import java.util.ResourceBundle;
+import java.util.ListResourceBundle;
+
+/*
+ * Tests when logger client is in Xbootclasspath
+ */
+public final class BootClient {
+
+    public static void main(String[] args) throws Exception {
+        assertTrue(args.length >= 2);
+        String loggerMode = args[0];
+        String loggerClassName = args[1];
+        String underlyingLoggerClassName = args.length >= 3 ? args[2] : null;
+
+        testLogger(loggerMode, loggerClassName, underlyingLoggerClassName);
+        testLog(underlyingLoggerClassName);
+    }
+
+    /*
+     * Tests System.getLogger(String) get expected logger.
+     */
+    private static void testLogger(String loggerMode, String loggerClassName,
+                                   String underlyingLoggerClassName) {
+        String name = "test.boot";
+        Logger logger = getLogger(name);
+        printLogger(logger);
+
+        final Module lm = logger.getClass().getModule();
+        final ClassLoader loggerCL = lm.getClassLoader();
+        if (loggerMode.equals("system")) {
+            assertTrue(lm.isNamed());
+            assertTrue(loggerCL == null);
+        } else if(loggerMode.equals("unnamed")) {
+            assertTrue(!lm.isNamed());
+            assertTrue(loggerCL != null);
+        } else {
+            throw new RuntimeException("wrong parameter");
+        }
+
+        assertTrue(loggerClassName.equals(logger.getClass().getName()));
+        if (underlyingLoggerClassName != null) {
+            String loggerName = logger.getName();
+            if (underlyingLoggerClassName.equals(
+                    "sun.util.logging.internal.LoggingProviderImpl$JULWrapper")) {
+                assertTrue(loggerName.equals(name));
+            } else {
+                assertTrue(loggerName.equals(underlyingLoggerClassName));
+            }
+        }
+    }
+
+    /*
+     * Tests Logger retrieved by System.getLogger(String, ResourceBundle) and
+     * System.getLogger(String) works well.
+     */
+    private static void testLog(String underlyingLoggerClassName) throws Exception {
+        if (underlyingLoggerClassName == null) {
+            return;
+        }
+
+        if (underlyingLoggerClassName.equals("pkg.a.l.LoggerA")
+                || underlyingLoggerClassName.equals("pkg.b.l.LoggerB")) {
+
+            String name = "test.boot.logger";
+            String plainMsg = "this is test log message #1";
+            ResourceBundle rb = new MyResourcesBoot();
+            Throwable ex = new Throwable("this is an expected exception to be logged");
+            Class<?> clazz = Class.forName(underlyingLoggerClassName);
+            Method method = clazz.getMethod("checkLog", String.class,
+                                            System.Logger.Level.class,
+                                            ResourceBundle.class, String.class,
+                                            Throwable.class, Object[].class);
+
+            Logger logger = getLogger(name);
+            printLogger(logger);
+            assertTrue(logger.getClass().getName()
+                             .equals("jdk.internal.logger.LazyLoggers$JdkLazyLogger"));
+            assertTrue(logger.getName().equals(underlyingLoggerClassName));
+            logger.log(Logger.Level.WARNING, plainMsg);
+            boolean pass = (boolean)method.invoke(null, name, Logger.Level.WARNING,
+                                                  null, plainMsg, ex, (Object)null);
+            assertTrue(pass);
+            pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+                                          rb, MyResourcesBoot.VALUE, (Throwable)null,
+                                          (Object)null);
+            assertTrue(!pass);
+
+            logger = getLogger(name, rb);
+            printLogger(logger);
+            assertTrue(logger.getClass().getName()
+                             .equals("jdk.internal.logger.LocalizedLoggerWrapper"));
+            assertTrue(logger.getName().equals(underlyingLoggerClassName));
+            logger.log(Logger.Level.INFO, MyResourcesBoot.KEY);
+            pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+                                          rb, MyResourcesBoot.VALUE, (Throwable)null,
+                                          (Object)null);
+            assertTrue(pass);
+            pass = (boolean)method.invoke(null, name, Logger.Level.WARNING,
+                                          null, plainMsg, ex, (Object)null);
+            assertTrue(pass);
+        }
+    }
+
+    private static class MyResourcesBoot extends ListResourceBundle {
+        static final String KEY = "this is the key in MyResourcesBoot";
+        static final String VALUE = "THIS IS THE VALUE IN MyResourcesBoot";
+
+        @Override
+        protected Object[][] getContents() {
+            return new Object[][] {
+                {KEY, VALUE}
+            };
+        }
+    }
+
+    private static Logger getLogger(String name) {
+        return BootUsage.getLogger(name);
+    }
+
+    private static Logger getLogger(String name, ResourceBundle rb) {
+        return BootUsage.getLogger(name, rb);
+    }
+
+    private static void printLogger(Logger logger) {
+        System.err.println("logger name: " + logger.getName()
+                           + ", logger class: " + logger.getClass());
+    }
+
+    private static void assertTrue(boolean b) {
+        if (!b) {
+            throw new RuntimeException("expected true, but get false.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/boot_usage/BootUsage.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.System.Logger;
+import java.util.ResourceBundle;
+
+/*
+ * BootUsage is put to Xbootclasspath, it will be used by
+ * BootClient to test when logger client is in boot classpath
+ */
+public final class BootUsage {
+
+    public static Logger getLogger(String name) {
+        check();
+        return System.getLogger(name);
+    }
+
+    public static Logger getLogger(String name, ResourceBundle rb) {
+        check();
+        return System.getLogger(name, rb);
+    }
+
+    private static void check() {
+        final Module m = BootUsage.class.getModule();
+        final ClassLoader moduleCL = m.getClassLoader();
+        assertTrue(!m.isNamed());
+        assertTrue(moduleCL == null);
+    }
+
+    private static void assertTrue(boolean b) {
+        if (!b) {
+            throw new RuntimeException("expected true, but get false.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/named_client/m.t.a/module-info.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+module m.t.a {
+    exports pkg.a.t;
+    uses System.LoggerFinder;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/named_client/m.t.a/pkg/a/t/TestA.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 pkg.a.t;
+
+import java.lang.reflect.Method;
+import java.lang.System.Logger;
+import java.util.ResourceBundle;
+import java.util.ListResourceBundle;
+
+/*
+ * Tests when logger client is in named module m.l.a
+ */
+public class TestA {
+
+    public static void main(String[] args) throws Exception {
+        assertTrue(args.length == 2);
+        String loggerMode = args[0];
+        String loggerClassName = args[1];
+
+        testLogger(loggerMode, loggerClassName);
+        testLog(loggerClassName);
+    }
+
+    /*
+     * Tests System.getLogger(String) get expected logger.
+     */
+    private static void testLogger(String loggerMode, String loggerClassName) {
+        final Module m = TestA.class.getModule();
+        final ClassLoader moduleCL = m.getClassLoader();
+        assertTrue(m.isNamed());
+        assertTrue(moduleCL != null);
+
+        String name = "test.a";
+        Logger logger = getLogger(name);
+        printLogger(logger);
+
+        final Module lm = logger.getClass().getModule();
+        final ClassLoader loggerCL = lm.getClassLoader();
+        if (loggerMode.equals("system")) {
+            assertTrue(lm.isNamed());
+            assertTrue(loggerCL == null);
+        } else if(loggerMode.equals("named")) {
+            assertTrue(lm.isNamed());
+            assertTrue(loggerCL != null);
+        } else if(loggerMode.equals("unnamed")) {
+            assertTrue(!lm.isNamed());
+            assertTrue(loggerCL != null);
+        } else {
+            throw new RuntimeException("wrong parameter");
+        }
+
+        assertTrue(loggerClassName.equals(logger.getClass().getName()));
+        assertTrue(!loggerClassName.equals("jdk.internal.logger.LazyLoggers$JdkLazyLogger"));
+    }
+
+    /*
+     * Tests Logger retrieved by System.getLogger(String, ResourceBundle) and
+     * System.getLogger(String) works well.
+     */
+    private static void testLog(String loggerClassName) throws Exception {
+        if (loggerClassName.equals("pkg.a.l.LoggerA")
+                || loggerClassName.equals("pkg.b.l.LoggerB")) {
+
+            String name = "test.a.A";
+            String plainMsg = "this is test log message #1";
+            ResourceBundle rb = new MyResourcesA();
+            Throwable ex = new Throwable("this is an expected exception to be logged");
+            Class<?> clazz = Class.forName(loggerClassName);
+            Method method = clazz.getMethod("checkLog", String.class,
+                                            System.Logger.Level.class,
+                                            ResourceBundle.class, String.class,
+                                            Throwable.class, Object[].class);
+
+            Logger logger = getLogger(name);
+            printLogger(logger);
+            assertTrue(logger.getClass().getName().equals(loggerClassName));
+            assertTrue(logger.getName().equals(loggerClassName));
+            logger.log(Logger.Level.WARNING, plainMsg);
+            boolean pass = (boolean)method.invoke(null, name,
+                                                  Logger.Level.WARNING,
+                                                  null, plainMsg, ex, (Object)null);
+            assertTrue(pass);
+            pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+                                          rb, MyResourcesA.VALUE, (Throwable)null,
+                                          (Object)null);
+            assertTrue(!pass);
+
+            logger = getLogger(name, rb);
+            printLogger(logger);
+            assertTrue(logger.getClass().getName()
+                             .equals("jdk.internal.logger.LocalizedLoggerWrapper"));
+            assertTrue(logger.getName().equals(loggerClassName));
+            logger.log(Logger.Level.INFO, MyResourcesA.KEY);
+            pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+                                          rb, MyResourcesA.VALUE, (Throwable)null,
+                                          (Object)null);
+            assertTrue(pass);
+            pass = (boolean)method.invoke(null, name, Logger.Level.WARNING,
+                                          null, plainMsg, ex, (Object)null);
+            assertTrue(pass);
+        }
+    }
+
+    private static class MyResourcesA extends ListResourceBundle {
+        static final String KEY = "this is the key in MyResourcesA";
+        static final String VALUE = "THIS IS THE VALUE IN MyResourcesA";
+
+        @Override
+        protected Object[][] getContents() {
+            return new Object[][] {
+                {KEY, VALUE}
+            };
+        }
+    }
+
+    private static Logger getLogger(String name) {
+        return System.getLogger(name);
+    }
+
+    private static Logger getLogger(String name, ResourceBundle rb) {
+        return System.getLogger(name, rb);
+    }
+
+    private static void printLogger(Logger logger) {
+        System.err.println("logger name: " + logger.getName()
+                           + ", logger class: " + logger.getClass());
+    }
+
+    private static void assertTrue(boolean b) {
+        if (!b) {
+            throw new RuntimeException("expected true, but get false.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/module-info.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+
+module m.l.a {
+    opens pkg.a.l;
+    provides java.lang.System.LoggerFinder with pkg.a.p.LoggerFinderA;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/pkg/a/l/LoggerA.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 pkg.a.l;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Queue;
+import java.util.ResourceBundle;
+
+public class LoggerA implements System.Logger {
+
+    // ---- test utility fields and methods ----
+
+    private static Map<String, LoggerA> map = new HashMap<>();
+
+    public static LoggerA getLogger(String name) {
+        return map.computeIfAbsent(name, (n) -> new LoggerA());
+    }
+
+    public static boolean checkLog(String name, Level level, ResourceBundle bundle,
+                                   String format, Throwable throwable, Object... params) {
+        LoggerA logger = map.get(name);
+        LogEvent event = new LogEvent(level, bundle, format, null, params);
+        for (LogEvent l : logger.queue) {
+            if (l.equals(event)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    // ---- logger implementation ----
+
+    private Queue<LogEvent> queue = new LinkedList<>();
+
+    @Override
+    public String getName() {
+        return this.getClass().getName();
+    }
+
+    @Override
+    public boolean isLoggable(Level level) {
+        return true;
+    }
+
+    @Override
+    public void log(Level level, ResourceBundle bundle, String format, Object... params) {
+        String msg = bundle != null ? bundle.getString(format) : format;
+        log(new LogEvent(level, bundle, msg, null, params));
+    }
+
+    @Override
+    public void log(Level level, ResourceBundle bundle, String format, Throwable throwable) {
+        String msg = bundle != null ? bundle.getString(format) : format;
+        log(new LogEvent(level, bundle, msg, throwable, (Object)null));
+    }
+
+    void log(LogEvent l) {
+        print(l);
+        queue.add(l);
+    }
+
+    private void print(LogEvent l) {
+        System.err.println("LoggerA Message"+ l);
+    }
+
+    public Queue<LogEvent> getLogEvent() {
+        return queue;
+    }
+
+    public static class LogEvent {
+        public LogEvent(Level level, ResourceBundle bundle, String format,
+                        Throwable throwable, Object... params) {
+            this.level = level;
+            this.bundle = bundle;
+            this.format = format;
+            this.throwable = throwable;
+            this.params = params;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (o instanceof LogEvent) {
+                LogEvent e = (LogEvent)o;
+                return level == e.level
+                    && bundle == e.bundle
+                    && format == e.format
+                    && params == e.params;
+            }
+            return false;
+        }
+
+        @Override
+        public String toString() {
+            return String.format("[level: %s, bundle: %s, format: %s, throwable: %s, object: %s]",
+                    level, bundle, format, throwable, params);
+        }
+
+        private Level level;
+        private ResourceBundle bundle;
+        private String format;
+        private Throwable throwable;
+        private Object[] params;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/pkg/a/p/LoggerFinderA.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 pkg.a.p;
+
+import pkg.a.l.LoggerA;
+
+public class LoggerFinderA extends System.LoggerFinder {
+    @Override
+    public System.Logger getLogger(String name, Module module) {
+        return LoggerA.getLogger(name);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/patched_client/PatchedClient.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.reflect.Method;
+import java.lang.System.Logger;
+import java.util.ResourceBundle;
+import java.util.ListResourceBundle;
+
+/*
+ * Tests when logger client is in patched module
+ */
+public class PatchedClient {
+
+    public static void main(String[] args) throws Exception {
+        assertTrue(args.length >= 2);
+        String loggerMode = args[0];
+        String loggerClassName = args[1];
+        String underlyingLoggerClassName = args.length >= 3 ? args[2] : null;
+
+        testLogger(loggerMode, loggerClassName, underlyingLoggerClassName);
+        testLog(underlyingLoggerClassName);
+    }
+
+    /*
+     * Tests System.getLogger(String) get expected logger.
+     */
+    private static void testLogger(String loggerMode, String loggerClassName,
+                                   String underlyingLoggerClassName) {
+        String name = "test.patched";
+        Logger logger = getLogger(name);
+        printLogger(logger);
+
+        final Module lm = logger.getClass().getModule();
+        final ClassLoader loggerCL = lm.getClassLoader();
+        if (loggerMode.equals("system")) {
+            assertTrue(lm.isNamed());
+            assertTrue(loggerCL == null);
+        } else if(loggerMode.equals("unnamed")) {
+            assertTrue(!lm.isNamed());
+            assertTrue(loggerCL != null);
+        } else {
+            throw new RuntimeException("wrong parameter");
+        }
+
+        assertTrue(loggerClassName.equals(logger.getClass().getName()));
+        if (underlyingLoggerClassName != null) {
+            String loggerName = logger.getName();
+            if (underlyingLoggerClassName.equals(
+                    "sun.util.logging.internal.LoggingProviderImpl$JULWrapper")) {
+                assertTrue(loggerName.equals(name));
+            } else {
+                assertTrue(loggerName.equals(underlyingLoggerClassName));
+            }
+        }
+    }
+
+    /*
+     * Tests Logger retrieved by System.getLogger(String, ResourceBundle) and
+     * System.getLogger(String) works well.
+     */
+    private static void testLog(String underlyingLoggerClassName) throws Exception {
+        if (underlyingLoggerClassName == null) {
+            return;
+        }
+
+        if (underlyingLoggerClassName.equals("pkg.a.l.LoggerA")
+                || underlyingLoggerClassName.equals("pkg.b.l.LoggerB")) {
+
+            String name = "test.patched.logger";
+            String plainMsg = "this is test log message #1";
+            ResourceBundle rb = new MyResourcesPatched();
+            Throwable ex = new Throwable("this is an expected exception to be logged");
+            Class<?> clazz = Class.forName(underlyingLoggerClassName);
+            Method method = clazz.getMethod("checkLog", String.class,
+                                            System.Logger.Level.class,
+                                            ResourceBundle.class, String.class,
+                                            Throwable.class, Object[].class);
+
+            Logger logger = getLogger(name);
+            printLogger(logger);
+            assertTrue(logger.getClass().getName()
+                             .equals("jdk.internal.logger.LazyLoggers$JdkLazyLogger"));
+            assertTrue(logger.getName().equals(underlyingLoggerClassName));
+            logger.log(Logger.Level.WARNING, plainMsg);
+            boolean pass = (boolean)method.invoke(null, name, Logger.Level.WARNING,
+                                                  null, plainMsg, ex, (Object)null);
+            assertTrue(pass);
+            pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+                                          rb, MyResourcesPatched.VALUE, (Throwable)null,
+                                          (Object)null);
+            assertTrue(!pass);
+
+            logger = getLogger(name, rb);
+            printLogger(logger);
+            assertTrue(logger.getClass().getName()
+                             .equals("jdk.internal.logger.LocalizedLoggerWrapper"));
+            assertTrue(logger.getName().equals(underlyingLoggerClassName));
+            logger.log(Logger.Level.INFO, MyResourcesPatched.KEY);
+            pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+                                          rb, MyResourcesPatched.VALUE, (Throwable)null,
+                                          (Object)null);
+            assertTrue(pass);
+            pass = (boolean)method.invoke(null, name, Logger.Level.WARNING,
+                                          null, plainMsg, ex, (Object)null);
+            assertTrue(pass);
+        }
+    }
+
+    private static class MyResourcesPatched extends ListResourceBundle {
+        static final String KEY = "this is the key in MyResourcesPatched";
+        static final String VALUE = "THIS IS THE VALUE IN MyResourcesPatched";
+
+        @Override
+        protected Object[][] getContents() {
+            return new Object[][] {
+                {KEY, VALUE}
+            };
+        }
+    }
+
+    private static Logger getLogger(String name) {
+        return PatchedUsage.getLogger(name);
+    }
+
+    private static Logger getLogger(String name, ResourceBundle rb) {
+        return PatchedUsage.getLogger(name, rb);
+    }
+
+    private static void printLogger(Logger logger) {
+        System.err.println("logger name: " + logger.getName()
+                           + ", logger class: " + logger.getClass());
+    }
+
+    private static void assertTrue(boolean b) {
+        if (!b) {
+            throw new RuntimeException("expected true, but get false.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/patched_usage/java.base/java/lang/PatchedUsage.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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;
+
+import java.lang.System.Logger;
+import java.util.ResourceBundle;
+
+/*
+ * PatchedUsage is patched into java.base, it will be used by
+ * PatchedClient to test when logger client is in patched module
+ */
+public class PatchedUsage {
+
+    public static Logger getLogger(String name) {
+        check();
+        return System.getLogger(name);
+    }
+
+    public static Logger getLogger(String name, ResourceBundle rb) {
+        check();
+        return System.getLogger(name, rb);
+    }
+
+    private static void check() {
+        final Module m = PatchedUsage.class.getModule();
+        final ClassLoader moduleCL = m.getClassLoader();
+        assertTrue(m.isNamed());
+        assertTrue(moduleCL == null);
+    }
+
+    private static void assertTrue(boolean b) {
+        if (!b) {
+            throw new RuntimeException("expected true, but get false.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/unnamed_client/pkg/b/t/TestB.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 pkg.b.t;
+
+import java.lang.reflect.Method;
+import java.lang.System.Logger;
+import java.util.ResourceBundle;
+import java.util.ListResourceBundle;
+
+/*
+ * Tests when logger client is in unnamed module
+ */
+public class TestB {
+
+    public static void main(String[] args) throws Exception {
+        assertTrue(args.length == 2);
+        String loggerMode = args[0];
+        String loggerClassName = args[1];
+
+        testLogger(loggerMode, loggerClassName);
+        testLog(loggerClassName);
+    }
+
+    /*
+     * Tests System.getLogger(String) get expected logger.
+     */
+    private static void testLogger(String loggerMode, String loggerClassName) {
+        final Module m = TestB.class.getModule();
+        final ClassLoader moduleCL = m.getClassLoader();
+        assertTrue(!m.isNamed());
+        assertTrue(moduleCL != null);
+
+        String name = "test.b";
+        Logger logger = getLogger(name);
+        printLogger(logger);
+
+        final Module lm = logger.getClass().getModule();
+        final ClassLoader loggerCL = lm.getClassLoader();
+        if (loggerMode.equals("system")) {
+            assertTrue(lm.isNamed());
+            assertTrue(loggerCL == null);
+        } else if(loggerMode.equals("named")) {
+            assertTrue(lm.isNamed());
+            assertTrue(loggerCL != null);
+        } else if(loggerMode.equals("unnamed")) {
+            assertTrue(!lm.isNamed());
+            assertTrue(loggerCL != null);
+        } else {
+            throw new RuntimeException("wrong parameter");
+        }
+
+        assertTrue(loggerClassName.equals(logger.getClass().getName()));
+        assertTrue(!loggerClassName.equals("jdk.internal.logger.LazyLoggers$JdkLazyLogger"));
+    }
+
+    /*
+     * Tests Logger retrieved by System.getLogger(String, ResourceBundle) and
+     * System.getLogger(String) works well.
+     */
+    private static void testLog(String loggerClassName) throws Exception {
+        if (loggerClassName.equals("pkg.a.l.LoggerA")
+                || loggerClassName.equals("pkg.b.l.LoggerB")) {
+
+            String name = "test.b.B";
+            String plainMsg = "this is test log message #1";
+            ResourceBundle rb = new MyResourcesB();
+            Throwable ex = new Throwable("this is an expected exception to be logged");
+            Class<?> clazz = Class.forName(loggerClassName);
+            Method method = clazz.getMethod("checkLog", String.class,
+                                            System.Logger.Level.class,
+                                            ResourceBundle.class, String.class,
+                                            Throwable.class, Object[].class);
+
+            Logger logger = getLogger(name);
+            printLogger(logger);
+            assertTrue(logger.getClass().getName().equals(loggerClassName));
+            assertTrue(logger.getName().equals(loggerClassName));
+            logger.log(Logger.Level.WARNING, plainMsg);
+            boolean pass = (boolean)method.invoke(null, name, Logger.Level.WARNING,
+                                                  null, plainMsg, ex, (Object)null);
+            assertTrue(pass);
+            pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+                                          rb, MyResourcesB.VALUE, (Throwable)null,
+                                          (Object)null);
+            assertTrue(!pass);
+
+            logger = getLogger(name, rb);
+            printLogger(logger);
+            assertTrue(logger.getClass().getName()
+                             .equals("jdk.internal.logger.LocalizedLoggerWrapper"));
+            assertTrue(logger.getName().equals(loggerClassName));
+            logger.log(Logger.Level.INFO, MyResourcesB.KEY);
+            pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+                                          rb, MyResourcesB.VALUE, (Throwable)null,
+                                          (Object)null);
+            assertTrue(pass);
+            pass = (boolean)method.invoke(null, name, Logger.Level.WARNING,
+                                          null, plainMsg, ex, (Object)null);
+            assertTrue(pass);
+        }
+    }
+
+    private static class MyResourcesB extends ListResourceBundle {
+        static final String KEY = "this is the key in MyResourcesB";
+        static final String VALUE = "THIS IS THE VALUE IN MyResourcesB";
+
+        @Override
+        protected Object[][] getContents() {
+            return new Object[][] {
+                {KEY, VALUE}
+            };
+        }
+    }
+
+    private static Logger getLogger(String name) {
+        return System.getLogger(name);
+    }
+
+    private static Logger getLogger(String name, ResourceBundle rb) {
+        return System.getLogger(name, rb);
+    }
+
+    private static void printLogger(Logger logger) {
+        System.err.println("logger name: " + logger.getName()
+                           + ", logger class: " + logger.getClass());
+    }
+
+    private static void assertTrue(boolean b) {
+        if (!b) {
+            throw new RuntimeException("expected true, but get false.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/unnamed_logger/META-INF/services/java.lang.System$LoggerFinder	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,1 @@
+pkg.b.p.LoggerFinderB
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/unnamed_logger/pkg/b/l/LoggerB.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 pkg.b.l;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Queue;
+import java.util.ResourceBundle;
+
+public class LoggerB implements System.Logger {
+
+    // ---- test utility fields and methods ----
+
+    private static Map<String, LoggerB> map = new HashMap<>();
+
+    public static LoggerB getLogger(String name) {
+        return map.computeIfAbsent(name, (n) -> new LoggerB());
+    }
+
+    public static boolean checkLog(String name, Level level, ResourceBundle bundle,
+                                   String format, Throwable throwable, Object... params) {
+        LoggerB logger = map.get(name);
+        LogEvent event = new LogEvent(level, bundle, format, null, params);
+        for (LogEvent l : logger.queue) {
+            if (l.equals(event)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    // ---- logger implementation ----
+
+    private Queue<LogEvent> queue = new LinkedList<>();
+
+    @Override
+    public String getName() {
+        return this.getClass().getName();
+    }
+
+    @Override
+    public boolean isLoggable(Level level) {
+        return true;
+    }
+
+    @Override
+    public void log(Level level, ResourceBundle bundle, String format, Object... params) {
+        String msg = bundle != null ? bundle.getString(format) : format;
+        log(new LogEvent(level, bundle, msg, null, params));
+    }
+
+    @Override
+    public void log(Level level, ResourceBundle bundle, String format, Throwable throwable) {
+        String msg = bundle != null ? bundle.getString(format) : format;
+        log(new LogEvent(level, bundle, msg, throwable, (Object)null));
+    }
+
+    void log(LogEvent l) {
+        print(l);
+        queue.add(l);
+    }
+
+    private void print(LogEvent l) {
+        System.err.println("LoggerB Message"+ l);
+    }
+
+    public Queue<LogEvent> getLogEvent() {
+        return queue;
+    }
+
+    public static class LogEvent {
+        public LogEvent(Level level, ResourceBundle bundle, String format,
+                        Throwable throwable, Object... params) {
+            this.level = level;
+            this.bundle = bundle;
+            this.format = format;
+            this.throwable = throwable;
+            this.params = params;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (o instanceof LogEvent) {
+                LogEvent e = (LogEvent)o;
+                return level == e.level
+                    && bundle == e.bundle
+                    && format == e.format
+                    && params == e.params;
+            }
+            return false;
+        }
+
+        private Level level;
+        private ResourceBundle bundle;
+        private String format;
+        private Throwable throwable;
+        private Object[] params;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/unnamed_logger/pkg/b/p/LoggerFinderB.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 pkg.b.p;
+
+import pkg.b.l.LoggerB;
+
+public class LoggerFinderB extends System.LoggerFinder {
+    @Override
+    public System.Logger getLogger(String name, Module module) {
+        return LoggerB.getLogger(name);
+    }
+}
--- a/jdk/test/java/net/Inet6Address/B6206527.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/net/Inet6Address/B6206527.java	Wed Jul 05 23:16:15 2017 +0200
@@ -25,10 +25,14 @@
  * @test 1.1 05/01/05
  * @bug 6206527
  * @summary "cannot assign address" when binding ServerSocket on Suse 9
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.NetworkConfiguration
+ * @run main B6206527
  */
 
 import java.net.*;
 import java.util.*;
+import jdk.testlibrary.NetworkConfiguration;
 
 public class B6206527 {
 
@@ -53,21 +57,12 @@
         ss.bind(new InetSocketAddress(addr, 0));
     }
 
-    public static Inet6Address getLocalAddr () throws Exception {
-        Enumeration e = NetworkInterface.getNetworkInterfaces();
-        while (e.hasMoreElements()) {
-            NetworkInterface ifc = (NetworkInterface) e.nextElement();
-            Enumeration addrs = ifc.getInetAddresses();
-            while (addrs.hasMoreElements()) {
-                InetAddress a = (InetAddress)addrs.nextElement();
-                if (a instanceof Inet6Address) {
-                    Inet6Address ia6 = (Inet6Address) a;
-                    if (ia6.isLinkLocalAddress()) {
-                        return ia6;
-                    }
-                }
-            }
-        }
-        return null;
+    public static Inet6Address getLocalAddr() throws Exception {
+        Optional<Inet6Address> oaddr = NetworkConfiguration.probe()
+                .ip6Addresses()
+                .filter(a -> a.isLinkLocalAddress())
+                .findFirst();
+
+        return oaddr.orElseGet(() -> null);
     }
 }
--- a/jdk/test/java/net/Inet6Address/B6558853.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/net/Inet6Address/B6558853.java	Wed Jul 05 23:16:15 2017 +0200
@@ -21,43 +21,42 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6558853
  * @summary  getHostAddress() on connections using IPv6 link-local addrs should have zone id
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.NetworkConfiguration
+ * @run main B6558853
  */
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.*;
-import java.util.Enumeration;
+import java.util.Optional;
+import jdk.testlibrary.NetworkConfiguration;
 
 public class B6558853 implements Runnable {
     private InetAddress addr = null;
     private int port = 0;
 
     public static void main(String[] args) throws Exception {
-        ServerSocket ss = new ServerSocket(0);
-        int port = ss.getLocalPort();
-        Enumeration<NetworkInterface> l = NetworkInterface.getNetworkInterfaces();
-        InetAddress dest = null;
-        while (l.hasMoreElements() && dest == null) {
-            NetworkInterface nif = l.nextElement();
-            if (!nif.isUp())
-                continue;
+        Optional<Inet6Address> oaddr = NetworkConfiguration.probe()
+                .ip6Addresses()
+                .filter(a -> a.isLinkLocalAddress())
+                .findFirst();
 
-            for (InterfaceAddress a : nif.getInterfaceAddresses()) {
-                if (a.getAddress() instanceof Inet6Address) {
-                    Inet6Address a6 = (Inet6Address) a.getAddress();
-                    if (a6.isLinkLocalAddress()) {
-                        dest = a6;
-                    }
-                    break;
-                }
-            }
+        if (!oaddr.isPresent()) {
+            System.out.println("No suitable interface found. Exiting.");
+            return;
         }
+
+        Inet6Address dest = oaddr.get();
         System.out.println("Using " + dest);
-        if (dest != null) {
+
+        try (ServerSocket ss = new ServerSocket(0)) {
+            int port = ss.getLocalPort();
             B6558853 test = new B6558853(dest, port);
             Thread thread = new Thread(test);
             thread.start();
--- a/jdk/test/java/net/InetAddress/CheckJNI.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/net/InetAddress/CheckJNI.java	Wed Jul 05 23:16:15 2017 +0200
@@ -24,11 +24,15 @@
 /* @test
    @bug 4889870 4890033
    @summary java -Xcheck:jni failing in net code on Solaris / [Datagram]Socket.getLocalAddress() failure
+   @library /lib/testlibrary
+   @build jdk.testlibrary.NetworkConfiguration
    @run main/othervm -Xcheck:jni CheckJNI
 */
 
 import java.net.*;
 import java.util.*;
+import java.util.stream.Collectors;
+import jdk.testlibrary.NetworkConfiguration;
 
 public class CheckJNI {
     static Socket s;
@@ -49,32 +53,23 @@
         dg2 = new DatagramSocket (0, InetAddress.getByName ("127.0.0.1"));
         testDatagrams (dg1, dg2);
 
-        /* Use NetworkInterface to find link local IPv6 addrs to test */
-
-        Enumeration ifs = NetworkInterface.getNetworkInterfaces();
-        server = new ServerSocket (0);
+        /* Find link local IPv6 addrs to test */
+        List<Inet6Address> addrs = NetworkConfiguration.probe()
+                .ip6Addresses()
+                .filter(Inet6Address::isLinkLocalAddress)
+                .collect(Collectors.toList());
 
-        while (ifs.hasMoreElements()) {
-            NetworkInterface nif = (NetworkInterface)ifs.nextElement();
-            if (!nif.isUp())
-                continue;
-            Enumeration addrs = nif.getInetAddresses();
-            while (addrs.hasMoreElements()) {
-                InetAddress addr = (InetAddress) addrs.nextElement();
-                if (addr instanceof Inet6Address) {
-                    Inet6Address ia6 = (Inet6Address) addr;
-                    if (ia6.isLinkLocalAddress()) {
-                        System.out.println ("Testing IPv6 Socket");
-                        s = new Socket (ia6, server.getLocalPort());
-                        s.close();
+        server = new ServerSocket(0);
+        for (Inet6Address ia6 : addrs) {
+            System.out.println("Address:" + ia6);
+            System.out.println("Testing IPv6 Socket");
+            s = new Socket(ia6, server.getLocalPort());
+            s.close();
 
-                        System.out.println ("Testing IPv6 DatagramSocket");
-                        dg1 = new DatagramSocket (0, ia6);
-                        dg2 = new DatagramSocket (0, ia6);
-                        testDatagrams (dg1, dg2);
-                    }
-                }
-            }
+            System.out.println("Testing IPv6 DatagramSocket");
+            dg1 = new DatagramSocket(0, ia6);
+            dg2 = new DatagramSocket(0, ia6);
+            testDatagrams(dg1, dg2);
         }
         server.close();
         System.out.println ("OK");
--- a/jdk/test/java/net/MulticastSocket/B6427403.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/net/MulticastSocket/B6427403.java	Wed Jul 05 23:16:15 2017 +0200
@@ -23,15 +23,12 @@
 
 /*
  * @test
- *
  * @bug 6427403
- *
  * @summary java.net.MulticastSocket.joinGroup() reports 'socket closed'
- *
  */
 import java.net.*;
 import java.io.*;
-import java.util.*;
+
 public class B6427403 {
     public static void main( String[] args ) throws IOException {
         InetAddress lh = InetAddress.getLocalHost();
@@ -39,4 +36,4 @@
         ms.joinGroup( InetAddress.getByName("224.80.80.80") );
         ms.close();
     }
-}
+}
\ No newline at end of file
--- a/jdk/test/java/net/MulticastSocket/JoinGroup.java	Sat Apr 22 00:21:46 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 4091811 4148753
- * @summary Test java.net.MulticastSocket joinGroup and leaveGroup
- *
- */
-
-import java.io.*;
-import java.net.*;
-
-
-public class JoinGroup {
-
-    public static void main(String args[]) throws Exception  {
-        MulticastSocket soc = null;
-        InetAddress sin = null;
-
-        soc = new MulticastSocket();
-        sin = InetAddress.getByName("224.80.80.80");
-        soc.joinGroup(sin);
-        soc.leaveGroup(sin);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/MulticastSocket/JoinLeave.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4091811 4148753 4102731
+ * @summary Test java.net.MulticastSocket joinGroup and leaveGroup
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.NetworkConfiguration
+ * @run main JoinLeave
+ */
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.net.InetAddress;
+import java.net.MulticastSocket;
+import java.net.NetworkInterface;
+import jdk.testlibrary.NetworkConfiguration;
+
+public class JoinLeave {
+
+    public static void main(String args[]) throws IOException  {
+        InetAddress ip4Group = InetAddress.getByName("224.80.80.80");
+        InetAddress ip6Group = InetAddress.getByName("ff02::a");
+
+        NetworkConfiguration nc = NetworkConfiguration.probe();
+        nc.ip4MulticastInterfaces().forEach(nic -> joinLeave(ip4Group, nic));
+        nc.ip6MulticastInterfaces().forEach(nic -> joinLeave(ip6Group, nic));
+    }
+
+    static void joinLeave(InetAddress group, NetworkInterface nif)
+    {
+        System.out.println("Joining:" + group + " on " + nif);
+        try (MulticastSocket soc = new MulticastSocket()) {
+            soc.setNetworkInterface(nif);
+            soc.joinGroup(group);
+            soc.leaveGroup(group);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+}
--- a/jdk/test/java/net/MulticastSocket/Leave.java	Sat Apr 22 00:21:46 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 4102731
- * @summary Test the java.net.multicastsocket.leave method
- *
- */
-
-import java.net.*;
-import java.io.*;
-
-public class Leave {
-
-    public static void main(String args[]) throws Exception {
-        MulticastSocket socket = null;
-        InetAddress mca = null;
-
-        mca = InetAddress.getByName("224.80.80.80");
-        socket = new MulticastSocket();
-        socket.joinGroup(mca);
-        socket.leaveGroup(mca);
-        socket.close();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/NetworkConfigurationProbe.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 NOT A TEST. Captures the network interface configuration.
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.NetworkConfiguration
+ * @run main NetworkConfigurationProbe
+ */
+
+import java.net.Inet4Address;
+import java.net.Inet6Address;
+import java.net.NetworkInterface;
+import jdk.testlibrary.NetworkConfiguration;
+import static java.util.stream.Collectors.joining;
+import static java.lang.System.out;
+
+/**
+ * Not a test. Captures the network interface configuration.
+ */
+public class NetworkConfigurationProbe {
+
+    public static void main(String... args) throws Exception {
+        NetworkConfiguration.printSystemConfiguration(out);
+
+        NetworkConfiguration nc = NetworkConfiguration.probe();
+        String list;
+        list = nc.ip4MulticastInterfaces()
+                  .map(NetworkInterface::getName)
+                  .collect(joining(" "));
+        out.println("ip4MulticastInterfaces: " +  list);
+
+        list = nc.ip4Addresses()
+                  .map(Inet4Address::toString)
+                  .collect(joining(" "));
+        out.println("ip4Addresses: " +  list);
+
+        list = nc.ip6MulticastInterfaces()
+                  .map(NetworkInterface::getName)
+                  .collect(joining(" "));
+        out.println("ip6MulticastInterfaces: " +  list);
+
+        list = nc.ip6Addresses()
+                  .map(Inet6Address::toString)
+                  .collect(joining(" "));
+        out.println("ip6Addresses: " +  list);
+    }
+}
--- a/jdk/test/java/net/Socket/LinkLocal.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/net/Socket/LinkLocal.java	Wed Jul 05 23:16:15 2017 +0200
@@ -26,9 +26,15 @@
  * @bug 4469866
  * @summary Connecting to a link-local IPv6 address should not
  *          causes a SocketException to be thrown.
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.NetworkConfiguration
+ * @run main LinkLocal
  */
+import jdk.testlibrary.NetworkConfiguration;
+
 import java.net.*;
-import java.util.Enumeration;
+import java.util.List;
+import java.util.stream.Collectors;
 
 public class LinkLocal {
 
@@ -134,22 +140,13 @@
          * IPv6 address.
          */
         if (args.length == 0) {
-            Enumeration nifs = NetworkInterface.getNetworkInterfaces();
-            while (nifs.hasMoreElements()) {
-                NetworkInterface ni = (NetworkInterface)nifs.nextElement();
-                if (!ni.isUp())
-                    continue;
+            List<Inet6Address> addrs = NetworkConfiguration.probe()
+                    .ip6Addresses()
+                    .filter(Inet6Address::isLinkLocalAddress)
+                    .collect(Collectors.toList());
 
-                Enumeration addrs = ni.getInetAddresses();
-                while (addrs.hasMoreElements()) {
-                    InetAddress addr = (InetAddress)addrs.nextElement();
-
-                    if (addr instanceof Inet6Address &&
-                        addr.isLinkLocalAddress()) {
-
-                        TestAddress(addr);
-                    }
-                }
+            for (Inet6Address addr : addrs) {
+                TestAddress(addr);
             }
         }
 
--- a/jdk/test/java/net/SocketPermission/SocketPermissionTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/net/SocketPermission/SocketPermissionTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -25,13 +25,17 @@
  * @test
  * @bug 8047031
  * @summary SocketPermission tests for legacy socket types
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.NetworkConfiguration
  * @run testng/othervm SocketPermissionTest
  */
+
 import java.io.IOException;
 import java.net.DatagramPacket;
 import java.net.DatagramSocket;
 import java.net.InetAddress;
 import java.net.MulticastSocket;
+import java.net.NetworkInterface;
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.SocketPermission;
@@ -44,11 +48,14 @@
 import java.security.Policy;
 import java.security.PrivilegedExceptionAction;
 import java.security.ProtectionDomain;
+import java.util.Optional;
 
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+
 import static org.testng.Assert.*;
 
+import static jdk.testlibrary.NetworkConfiguration.probe;
 import static java.nio.charset.StandardCharsets.UTF_8;
 
 public class SocketPermissionTest {
@@ -210,12 +217,17 @@
                     new SocketPermission(addr, "listen,resolve"),
                     new SocketPermission("229.227.226.221", "connect,accept"));
 
-            // Positive
-            AccessController.doPrivileged((PrivilegedExceptionAction<Void>) () -> {
-                s.joinGroup(group);
-                s.leaveGroup(group);
-                return null;
-            }, acc);
+            // Positive ( requires a functional network interface )
+            Optional<NetworkInterface> onif = probe().ip4MulticastInterfaces().findFirst();
+            if (!onif.isPresent()) {
+                s.setNetworkInterface(onif.get());
+
+                AccessController.doPrivileged((PrivilegedExceptionAction<Void>) () -> {
+                    s.joinGroup(group);
+                    s.leaveGroup(group);
+                    return null;
+                }, acc);
+            }
 
             // Negative
             try {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/httpclient/SmallTimeout.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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.IOException;
+import java.net.ServerSocket;
+import java.net.URI;
+import jdk.incubator.http.HttpClient;
+import jdk.incubator.http.HttpRequest;
+import jdk.incubator.http.HttpResponse;
+import jdk.incubator.http.HttpTimeoutException;
+import java.time.Duration;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+import static java.lang.System.out;
+import static jdk.incubator.http.HttpResponse.BodyHandler.discard;
+
+/**
+ * @test
+ * @bug 8178147
+ * @summary Ensures that small timeouts do not cause hangs due to race conditions
+ * @run main/othervm SmallTimeout
+ */
+
+// To enable logging use. Not enabled by default as it changes the dynamics
+// of the test.
+// @run main/othervm -Djdk.httpclient.HttpClient.log=all,frames:all SmallTimeout
+
+public class SmallTimeout {
+
+    static int[] TIMEOUTS = {2, 1, 3, 2, 100, 1};
+
+    // A queue for placing timed out requests so that their order can be checked.
+    static LinkedBlockingQueue<HttpRequest> queue = new LinkedBlockingQueue<>();
+
+    static volatile boolean error;
+
+    public static void main(String[] args) throws Exception {
+        HttpClient client = HttpClient.newHttpClient();
+
+        try (ServerSocket ss = new ServerSocket(0, 20)) {
+            int port = ss.getLocalPort();
+            URI uri = new URI("http://127.0.0.1:" + port + "/");
+
+            HttpRequest[] requests = new HttpRequest[TIMEOUTS.length];
+
+            out.println("--- TESTING Async");
+            for (int i = 0; i < TIMEOUTS.length; i++) {
+                requests[i] = HttpRequest.newBuilder(uri)
+                                         .timeout(Duration.ofMillis(TIMEOUTS[i]))
+                                         .GET()
+                                         .build();
+
+                final HttpRequest req = requests[i];
+                CompletableFuture<HttpResponse<Object>> response = client
+                    .sendAsync(req, discard(null))
+                    .whenComplete((HttpResponse<Object> r, Throwable t) -> {
+                        if (r != null) {
+                            out.println("Unexpected response: " + r);
+                            error = true;
+                        }
+                        if (t != null) {
+                            if (!(t.getCause() instanceof HttpTimeoutException)) {
+                                out.println("Wrong exception type:" + t.toString());
+                                Throwable c = t.getCause() == null ? t : t.getCause();
+                                c.printStackTrace();
+                                error = true;
+                            } else {
+                                out.println("Caught expected timeout: " + t.getCause());
+                            }
+                        }
+                        if (t == null && r == null) {
+                            out.println("Both response and throwable are null!");
+                            error = true;
+                        }
+                        queue.add(req);
+                    });
+            }
+            System.out.println("All requests submitted. Waiting ...");
+
+            checkReturn(requests);
+
+            if (error)
+                throw new RuntimeException("Failed. Check output");
+
+            // Repeat blocking in separate threads. Use queue to wait.
+            out.println("--- TESTING Sync");
+
+            // For running blocking response tasks
+            ExecutorService executor = Executors.newCachedThreadPool();
+
+            for (int i = 0; i < TIMEOUTS.length; i++) {
+                requests[i] = HttpRequest.newBuilder(uri)
+                                         .timeout(Duration.ofMillis(TIMEOUTS[i]))
+                                         .GET()
+                                         .build();
+
+                final HttpRequest req = requests[i];
+                executor.execute(() -> {
+                    try {
+                        client.send(req, discard(null));
+                    } catch (HttpTimeoutException e) {
+                        out.println("Caught expected timeout: " + e);
+                        queue.offer(req);
+                    } catch (IOException | InterruptedException ee) {
+                        Throwable c = ee.getCause() == null ? ee : ee.getCause();
+                        c.printStackTrace();
+                        error = true;
+                    }
+                });
+            }
+            System.out.println("All requests submitted. Waiting ...");
+
+            checkReturn(requests);
+
+            executor.shutdownNow();
+
+            if (error)
+                throw new RuntimeException("Failed. Check output");
+
+        } finally {
+            ((ExecutorService) client.executor()).shutdownNow();
+        }
+    }
+
+    static void checkReturn(HttpRequest[] requests) throws InterruptedException {
+        // wait for exceptions and check order
+        for (int j = 0; j < TIMEOUTS.length; j++) {
+            HttpRequest req = queue.take();
+            out.println("Got request from queue " + req + ", order: " + getRequest(req, requests));
+        }
+        out.println("Return ok");
+    }
+
+    /** Returns the index of the request in the array. */
+    static String getRequest(HttpRequest req, HttpRequest[] requests) {
+        for (int i=0; i<requests.length; i++) {
+            if (req == requests[i]) {
+                return "r" + i;
+            }
+        }
+        throw new AssertionError("Unknown request: " + req);
+    }
+}
--- a/jdk/test/java/net/httpclient/TimeoutOrdering.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/net/httpclient/TimeoutOrdering.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,9 @@
  * @run main/othervm TimeoutOrdering
  */
 
+// To enable logging use
+// @run main/othervm -Djdk.httpclient.HttpClient.log=all,frames:all TimeoutOrdering
+
 public class TimeoutOrdering {
 
     // The assumption is that 5 secs is sufficiently large enough, without being
@@ -81,6 +84,8 @@
                         if (t != null) {
                             if (!(t.getCause() instanceof HttpTimeoutException)) {
                                 out.println("Wrong exception type:" + t.toString());
+                                Throwable c = t.getCause() == null ? t : t.getCause();
+                                c.printStackTrace();
                                 error = true;
                             } else {
                                 out.println("Caught expected timeout: " + t.getCause());
@@ -116,6 +121,8 @@
                         out.println("Caught expected timeout: " + e);
                         queue.offer(req);
                     } catch (IOException | InterruptedException ee) {
+                        Throwable c = ee.getCause() == null ? ee : ee.getCause();
+                        c.printStackTrace();
                         error = true;
                     }
                 });
--- a/jdk/test/java/net/ipv6tests/B6521014.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/net/ipv6tests/B6521014.java	Wed Jul 05 23:16:15 2017 +0200
@@ -25,13 +25,15 @@
  * @test
  * @bug 6521014 6543428
  * @summary IOException thrown when Socket tries to bind to an local IPv6 address on SuSE Linux
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.NetworkConfiguration
+ * @run main B6521014
  */
 
-
 import java.net.*;
 import java.io.*;
 import java.util.*;
-
+import jdk.testlibrary.NetworkConfiguration;
 
 /*
  *
@@ -52,38 +54,26 @@
  */
 public class B6521014 {
 
-    static InetAddress sin;
-
-    static Inet6Address getLocalAddr () throws Exception {
-        Enumeration e = NetworkInterface.getNetworkInterfaces();
-        while (e.hasMoreElements()) {
-            NetworkInterface ifc = (NetworkInterface) e.nextElement();
-            if (!ifc.isUp())
-                continue;
-            Enumeration addrs = ifc.getInetAddresses();
-            while (addrs.hasMoreElements()) {
-                InetAddress a = (InetAddress)addrs.nextElement();
-                if (a instanceof Inet6Address) {
-                    Inet6Address ia6 = (Inet6Address) a;
-                    if (ia6.isLinkLocalAddress()) {
-                        // remove %scope suffix
-                        return (Inet6Address)InetAddress.getByAddress(ia6.getAddress());
-                    }
-                }
-            }
+    static Inet6Address removeScope(Inet6Address addr) {
+        try {
+            return (Inet6Address)InetAddress.getByAddress(addr.getAddress());
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
         }
-        return null;
     }
 
-    static void test1() throws Exception {
-        ServerSocket ssock;
-        Socket sock;
-        int port;
+    static Optional<Inet6Address> getLocalAddr() throws Exception {
+        return NetworkConfiguration.probe()
+                .ip6Addresses()
+                .filter(Inet6Address::isLinkLocalAddress)
+                .map(B6521014::removeScope)
+                .findFirst();
+    }
 
-        ssock = new ServerSocket(0);
-        port = ssock.getLocalPort();
-        sock = new Socket();
-        try {
+    static void test1(Inet6Address sin) throws Exception {
+        try (ServerSocket ssock = new ServerSocket(0);
+             Socket sock = new Socket()) {
+            int port = ssock.getLocalPort();
             sock.connect(new InetSocketAddress(sin, port), 100);
         } catch (SocketTimeoutException e) {
             // time out exception is okay
@@ -91,36 +81,29 @@
         }
     }
 
-    static void test2() throws Exception {
-        Socket sock;
-        ServerSocket ssock;
-        int port;
-
-        ssock = new ServerSocket(0);
-        ssock.setSoTimeout(100);
-        port = ssock.getLocalPort();
-        sock = new Socket();
-        sock.bind(new InetSocketAddress(sin, 0));
-        try {
+    static void test2(Inet6Address sin) throws Exception {
+        try (ServerSocket ssock = new ServerSocket(0);
+             Socket sock = new Socket()) {
+            int port = ssock.getLocalPort();
+            ssock.setSoTimeout(100);
+            sock.bind(new InetSocketAddress(sin, 0));
             sock.connect(new InetSocketAddress(sin, port), 100);
-        } catch (SocketTimeoutException e) {
+        } catch (SocketTimeoutException expected) {
             // time out exception is okay
             System.out.println("timed out when connecting.");
         }
     }
 
     public static void main(String[] args) throws Exception {
-        sin = getLocalAddr();
-        if (sin == null) {
+        Optional<Inet6Address> oaddr = getLocalAddr();
+        if (!oaddr.isPresent()) {
             System.out.println("Cannot find a link-local address.");
             return;
         }
 
-        try {
-            test1();
-            test2();
-        } catch (IOException e) {
-            throw new RuntimeException("Test failed: cannot create socket.", e);
-        }
+        Inet6Address addr = oaddr.get();
+        System.out.println("Using " + addr);
+        test1(addr);
+        test2(addr);
     }
 }
--- a/jdk/test/java/net/ipv6tests/Tests.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/net/ipv6tests/Tests.java	Wed Jul 05 23:16:15 2017 +0200
@@ -27,7 +27,10 @@
 
 public class Tests {
 
-    static boolean isWindows = System.getProperty("os.name").startsWith("Windows");
+    static final boolean isWindows =
+            System.getProperty("os.name").startsWith("Windows");
+    static final boolean isMacOS =
+            System.getProperty("os.name").contains("OS X");
 
     /**
      * performs a simple exchange of data between the two sockets
@@ -278,6 +281,8 @@
                         String dName = nic.getDisplayName();
                         if (dName != null && dName.contains("Teredo"))
                             continue;
+                    } else if (isMacOS && nic.getName().contains("awdl")) {
+                        continue;
                     }
                     try {
                         if (nic.isUp() && !nic.isLoopback())
--- a/jdk/test/java/security/SignedObject/Chain.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/security/SignedObject/Chain.java	Wed Jul 05 23:16:15 2017 +0200
@@ -33,7 +33,6 @@
 /*
  * @test
  * @bug 8050374
- * @key intermittent
  * @summary Verify a chain of signed objects
  */
 public class Chain {
--- a/jdk/test/java/util/logging/LoggingDeadlock2.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/java/util/logging/LoggingDeadlock2.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -263,7 +263,7 @@
                     sleep(ms);
                     System.err.println("Timeout reached: " + ms);
                     if (process.isAlive()) {
-                        long pid = process.getPid();
+                        long pid = process.pid();
                         ProcessBuilder jstack = new ProcessBuilder(jstackExe, String.valueOf(pid));
                         System.err.println("Dumping subprocess stack: " + pid);
                         Process p = jstack.inheritIO().start();
--- a/jdk/test/javax/sound/midi/Devices/InitializationHang.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/javax/sound/midi/Devices/InitializationHang.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,18 +24,21 @@
 import java.awt.Toolkit;
 
 import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
 
 /**
  * @test
  * @bug 8068412
- * @key headful
- * @author Sergey Bylokhov
  */
 public final class InitializationHang {
 
-    public static void main(final String[] argv) throws Exception {
-        MidiSystem.getReceiver();
-        Toolkit.getDefaultToolkit();
+    public static void main(final String[] argv) {
+        try {
+            MidiSystem.getReceiver();
+            Toolkit.getDefaultToolkit();
+        } catch (final MidiUnavailableException ignored) {
+            // the test is not applicable
+        }
     }
 }
 
--- a/jdk/test/javax/sound/midi/Sequencer/SeqRecordDoesNotCopy.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/javax/sound/midi/Sequencer/SeqRecordDoesNotCopy.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 import javax.sound.midi.MidiEvent;
 import javax.sound.midi.MidiMessage;
 import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
 import javax.sound.midi.Receiver;
 import javax.sound.midi.Sequence;
 import javax.sound.midi.Sequencer;
@@ -34,12 +35,18 @@
  * @test
  * @bug 5048381
  * @summary Sequencer doesn't create distinct messages when recording events.
- * @key headful
  */
 public class SeqRecordDoesNotCopy {
-    public static void main(String argv[]) throws Exception {
-        Sequencer s = MidiSystem.getSequencer();
-        s.open();
+
+    public static void main(String argv[]) {
+        Sequencer s = null;
+        try {
+            s = MidiSystem.getSequencer();
+            s.open();
+        } catch (final MidiUnavailableException ignored) {
+            // the test is not applicable
+            return;
+        }
         try {
             Sequence seq = new Sequence(Sequence.PPQ, 384, 2);
             s.setSequence(seq);
@@ -86,7 +93,7 @@
         } catch (Exception e) {
             System.out.println("Unexpected Exception: "+e);
             //e.printStackTrace();
-            throw new Exception("Test FAILED!");
+            throw new RuntimeException("Test FAILED!");
         } finally {
             s.close();
         }
--- a/jdk/test/javax/sound/midi/Sequencer/SeqRecordsRealTimeEvents.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/javax/sound/midi/Sequencer/SeqRecordsRealTimeEvents.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 import javax.sound.midi.MidiEvent;
 import javax.sound.midi.MidiMessage;
 import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
 import javax.sound.midi.Receiver;
 import javax.sound.midi.Sequence;
 import javax.sound.midi.Sequencer;
@@ -34,12 +35,18 @@
  * @test
  * @bug 5048381
  * @summary Sequencer records real time messages into the sequence
- * @key headful
  */
 public class SeqRecordsRealTimeEvents {
-    public static void main(String argv[]) throws Exception {
-        Sequencer s = MidiSystem.getSequencer();
-        s.open();
+
+    public static void main(String argv[]) {
+        Sequencer s = null;
+        try {
+            s = MidiSystem.getSequencer();
+            s.open();
+        } catch (final MidiUnavailableException ignored) {
+            // the test is not applicable
+            return;
+        }
         try {
             Sequence seq = new Sequence(Sequence.PPQ, 384, 2);
             s.setSequence(seq);
@@ -90,7 +97,7 @@
         } catch (Exception e) {
             System.out.println("Unexpected Exception: "+e);
             //e.printStackTrace();
-            throw new Exception("Test FAILED!");
+            throw new RuntimeException("Test FAILED!");
         } finally {
             s.close();
         }
--- a/jdk/test/javax/sound/midi/Sequencer/SeqStartRecording.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/javax/sound/midi/Sequencer/SeqStartRecording.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,25 +22,32 @@
  */
 
 import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
 import javax.sound.midi.Sequencer;
 
 /**
  * @test
  * @bug 5001943
  * @summary Sequencer.startRecording throws unexpected NPE
- * @key headful
  */
 public class SeqStartRecording {
-    public static void main(String argv[]) throws Exception {
-        Sequencer seq = MidiSystem.getSequencer();
-        seq.open();
+
+    public static void main(String argv[]) {
+        Sequencer seq = null;
+        try {
+            seq = MidiSystem.getSequencer();
+            seq.open();
+        } catch (final MidiUnavailableException ignored) {
+            // the test is not applicable
+            return;
+        }
         try {
             seq.startRecording();
             System.out.println("Test passed.");
         } catch (NullPointerException npe) {
             System.out.println("Caught NPE: "+npe);
             npe.printStackTrace();
-            throw new Exception("Test FAILED!");
+            throw new RuntimeException("Test FAILED!");
         } catch (Exception e) {
             System.out.println("Unexpected Exception: "+e);
             e.printStackTrace();
--- a/jdk/test/javax/sound/midi/Synthesizer/bug4685396.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/javax/sound/midi/Synthesizer/bug4685396.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
 
 import javax.sound.midi.Instrument;
 import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
 import javax.sound.midi.Soundbank;
 import javax.sound.midi.Synthesizer;
 
@@ -31,7 +32,6 @@
  * @bug 4685396
  * @summary Tests that Synthesizer.remapInstrument works
  * @run main bug4685396
- * @key headful
  */
 public class bug4685396 {
 
@@ -49,8 +49,7 @@
             boolean reloadInstr,    // reload all instruments?
             boolean unloadFrom,     // unload "from" instrument?
             boolean unloadTo        // unload "to" instrument?
-            ) throws Exception
-    {
+            ) throws MidiUnavailableException {
         log("Starting test: reloadInstr=" + reloadInstr
                 + ", unloadFrom=" + unloadFrom
                 + ", unloadTo=" + unloadTo
@@ -164,6 +163,9 @@
         boolean success = false;
         try {
             success = test(reloadInstr, unloadFrom, unloadTo);
+        } catch (final MidiUnavailableException ignored) {
+            // the test is not applicable
+            success = true;
         } catch (Exception ex) {
             log("Exception: " + ex.toString());
         }
@@ -171,7 +173,7 @@
         return success;
     }
 
-    public static void main(String args[]) throws Exception {
+    public static void main(String args[]) {
         boolean failed = false;
         if (!runTest(true, false, false))
             failed = true;
--- a/jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  * @bug 4946913
  * @summary DirectClip doesn't kill the thread correctly, sometimes
  * @run main/othervm ClipCloseLoss
- * @key headful
  */
 public class ClipCloseLoss {
     static int frameCount = 441000; // lets say 10 seconds
--- a/jdk/test/javax/sound/sampled/Clip/bug5070081.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/javax/sound/sampled/Clip/bug5070081.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,17 +21,19 @@
  * questions.
  */
 
+import java.util.concurrent.TimeUnit;
+
 import javax.sound.sampled.AudioFormat;
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.Clip;
 import javax.sound.sampled.DataLine;
+import javax.sound.sampled.LineUnavailableException;
 
 /*
  * @test
  * @bug 5070081
  * @summary Tests that javax.sound.sampled.Clip does not loses position through
  *          stop/start
- * @key headful
  */
 public class bug5070081 {
 
@@ -43,10 +45,15 @@
 
     static boolean test() throws Exception {
         DataLine.Info info = new DataLine.Info(Clip.class, format);
-        Clip clip = (Clip)AudioSystem.getLine(info);
-        clip.open(format, soundData, 0, soundData.length);
-
+        Clip clip = null;
         boolean bSuccess = true;
+        try {
+            clip = (Clip) AudioSystem.getLine(info);
+            clip.open(format, soundData, 0, soundData.length);
+        } catch (LineUnavailableException | IllegalArgumentException ignored) {
+            // the test is not applicable
+            return bSuccess;
+        }
 
         long nLengthMS = clip.getMicrosecondLength()/1000;
 
@@ -56,18 +63,22 @@
 
         clip.start();                               // start playing
         Thread.sleep(1000);                         // wait a sec
-        long time1 = System.currentTimeMillis();
+        long time1 = currentTimeMillis();
         long pos1 = clip.getFramePosition();        // store the position
-        System.out.println("  Position before stop: " + pos1);
         clip.stop();                                // and then stop
         long pos2 = clip.getFramePosition();        // 2nd try
-        long time2 = System.currentTimeMillis();
+        long time2 = currentTimeMillis();
+
+        System.out.println("  Position before stop: " + pos1);
         System.out.println("  Position after stop: " + pos2);
 
-        System.out.println("  d(time): " + Math.abs(time2-time1) + " ms;"
-                + "d(clip pos): " + Math.abs(pos2 - pos1) + " ms.");
+        long timeDiff = Math.abs(time2 - time1);
+        // sample rate is 22050 per second, so 22.05 per ms
+        long posDiff = (long) (Math.abs(pos2 - pos1) / 22.05);
+        System.out.println("  d(time): " + timeDiff + " ms;"
+                + "d(clip pos time): " + posDiff + " ms.");
 
-        long nDerivation = Math.abs(pos2 - pos1) - Math.abs(time2-time1);
+        long nDerivation = posDiff - timeDiff;
         // add 50 ms for deviation (delay for stopping and errors due timer precision)
         if (nDerivation > 50) {
             System.out.println("  ERROR(1): The deviation is too much: " + nDerivation + " ms");
@@ -104,4 +115,8 @@
 
         System.out.println("Test passed sucessfully");
     }
+
+    private static long currentTimeMillis() {
+        return TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
+    }
 }
--- a/jdk/test/javax/sound/sampled/DataLine/LongFramePosition.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/javax/sound/sampled/DataLine/LongFramePosition.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,6 @@
  * @test
  * @bug 5049129
  * @summary DataLine.getLongFramePosition
- * @key headful
  */
 public class LongFramePosition {
 
@@ -59,12 +58,12 @@
             } finally {
                 sdl.close();
             }
-        } catch(LineUnavailableException e){
+        } catch (LineUnavailableException | IllegalArgumentException e) {
             System.out.println(e);
             System.out.println("Cannot execute test.");
             return;
         }
-        if (failed) throw new Exception("Test FAILED!");
+        if (failed) throw new RuntimeException("Test FAILED!");
         System.out.println("Test Passed.");
     }
 }
--- a/jdk/test/javax/sound/sampled/DirectAudio/bug6372428.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/javax/sound/sampled/DirectAudio/bug6372428.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,6 @@
  * @summary playback and capture doesn't interrupt after terminating thread that
  *          calls start()
  * @run main bug6372428
- * @key headful
  */
 public class bug6372428 {
     public bug6372428() {
--- a/jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,25 +33,26 @@
  */
 
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.event.*;
 import java.awt.event.KeyEvent;
-import java.util.ArrayList;
 
 public class bug4458079 extends JFrame implements PopupMenuListener {
     public JMenu menu;
 
     static volatile boolean itemASelected = false;
     public static void main(String[] args) throws Exception {
+        Robot robot = new Robot();
+        robot.waitForIdle();
+        // move mouse outside menu to prevent auto selection
+        robot.mouseMove(100,100);
+
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 new bug4458079().createAndShowGUI();
             }
         });
-        Robot robot = new Robot();
-        robot.waitForIdle();
 
         robot.setAutoDelay(50);
 
@@ -84,6 +85,7 @@
         setSize(300, 300);
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         pack();
+        setLocationRelativeTo(null);
         setVisible(true);
     }
 
--- a/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,8 @@
     public static void main(String[] args) throws Exception {
         Robot robot = new Robot();
         robot.setAutoDelay(50);
+        // move mouse outside menu to prevent auto selection
+        robot.mouseMove(100,100);
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -147,6 +149,7 @@
         focusable = new JButton("Set Focus Here");
         frame.add(focusable);
         frame.pack();
+        frame.setLocationRelativeTo(null);
         frame.setVisible(true);
     }
 }
--- a/jdk/test/javax/swing/plaf/metal/MetalBumps/Test6657026.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/javax/swing/plaf/metal/MetalBumps/Test6657026.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,6 @@
  * @modules java.desktop/sun.awt
  */
 
-import sun.awt.SunToolkit;
-
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Font;
@@ -42,9 +40,12 @@
 import java.awt.image.BufferedImage;
 import java.awt.image.ImageObserver;
 import java.text.AttributedCharacterIterator;
-import javax.swing.Icon;
+
+import javax.swing.JToolBar;
 import javax.swing.plaf.metal.MetalBorders.ToolBarBorder;
 
+import sun.awt.SunToolkit;
+
 public class Test6657026 extends ToolBarBorder implements Runnable {
 
     public static void main(String[] args) throws Exception {
@@ -63,8 +64,8 @@
 
     private void test() {
         MyGraphics mg = new MyGraphics();
-        Icon icon = bumps;
-        icon.paintIcon(mg.component, mg, 0, 0);
+        ToolBarBorder border = new ToolBarBorder();
+        border.paintBorder(mg.component, mg, 0, 0, 10, 10);
         if (mg.image != null) {
             boolean failed = true;
             int value = mg.image.getRGB(0, 0);
@@ -86,7 +87,7 @@
 
     private static class MyGraphics extends Graphics {
 
-        private final Component component = new Component() {};
+        private final Component component = new JToolBar() {};
         private BufferedImage image;
 
         public Graphics create() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/html/parser/Parser/HtmlCommentTagParseTest/HtmlCommentTagParseTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+
+import javax.swing.*;
+import javax.swing.text.MutableAttributeSet;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+import java.io.*;
+import java.lang.reflect.InvocationTargetException;
+
+/* @test
+   @bug 8177450
+   @summary  javax.swing.text.html.parser.Parser parseScript ignores a character after commend end
+   @author Mikhail Cherkasov
+   @run main HtmlCommentTagParseTest
+*/
+public class HtmlCommentTagParseTest {
+    private static volatile boolean failed = false;
+    public static void main(String[] args) throws IOException, InvocationTargetException, InterruptedException {
+        SwingUtilities.invokeAndWait(() -> {
+                MyParser cb = new MyParser();
+                HTMLEditorKit htmlKit = new HTMLEditorKit();
+                HTMLDocument htmlDoc = (HTMLDocument)
+                        htmlKit.createDefaultDocument();
+            FileReader reader = null;
+            try {
+                reader = new FileReader(getDirURL() + "test.html");
+                htmlDoc.getParser().parse(reader, cb, true);
+                if(failed) {
+                    throw new RuntimeException("Test failed");
+                }
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+        });
+    }
+    private static String getDirURL() {
+        return new File(System.getProperty("test.src", ".")).getAbsolutePath() +
+                File.separator;
+    }
+
+    private static class MyParser extends HTMLEditorKit.ParserCallback {
+        @Override
+        public void handleError(String errorMsg, int pos) {
+            failed = errorMsg.contains("eof.script");
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/html/parser/Parser/HtmlCommentTagParseTest/test.html	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,5 @@
+<html>
+<body>
+<script><!-- --></script>
+</body>
+</html>
\ No newline at end of file
--- a/jdk/test/jdk/internal/jline/extra/HistoryTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/jdk/internal/jline/extra/HistoryTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @bug 8178821
  * @summary Test Completion
  * @modules jdk.internal.le/jdk.internal.jline
  *          jdk.internal.le/jdk.internal.jline.console
@@ -152,6 +153,15 @@
         complete.set(true);  history.add("}");
 
         previousSnippetAndAssert(history, "void test() { /*after full*/");
+        nextSnippetAndAssert(history, "");
+
+        assertFalse(history.nextSnippet());
+
+        while (history.previousSnippet())
+            ;
+
+        while (history.nextSnippet())
+            ;
     }
 
     private void previousAndAssert(EditingHistory history, String expected) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/NetworkConfiguration.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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.PrintStream;
+import java.io.UncheckedIOException;
+import java.io.IOException;
+import java.net.Inet4Address;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import static java.net.NetworkInterface.getNetworkInterfaces;
+import static java.util.Collections.list;
+
+/**
+ * Helper class for retrieving network interfaces and local addresses
+ * suitable for testing.
+ */
+public class NetworkConfiguration {
+
+    static final boolean isWindows =
+            System.getProperty("os.name").startsWith("Windows");
+    static final boolean isMacOS =
+            System.getProperty("os.name").contains("OS X");
+
+    private Map<NetworkInterface,List<Inet4Address>> ip4Interfaces;
+    private Map<NetworkInterface,List<Inet6Address>> ip6Interfaces;
+
+    private NetworkConfiguration(Map<NetworkInterface,List<Inet4Address>> ip4Interfaces,
+                                 Map<NetworkInterface,List<Inet6Address>> ip6Interfaces)
+    {
+        this.ip4Interfaces = ip4Interfaces;
+        this.ip6Interfaces = ip6Interfaces;
+    }
+
+    /**
+     * Returns a stream of interfaces suitable for functional tests.
+     */
+    public Stream<NetworkInterface> interfaces() {
+        return Stream.concat(ip4Interfaces(), ip6Interfaces())
+                     .distinct();
+    }
+
+    /**
+     * Returns a stream of interfaces suitable for IPv4 functional tests.
+     */
+    public Stream<NetworkInterface> ip4Interfaces() {
+        return ip4Interfaces.keySet().stream()
+                .filter(NetworkConfiguration::isNotExcludedInterface)
+                .filter(hasIp4Addresses);
+    }
+
+    /**
+     * Returns a stream of interfaces suitable for IPv6 functional tests.
+     */
+    public Stream<NetworkInterface> ip6Interfaces() {
+        return ip6Interfaces.keySet().stream()
+                .filter(NetworkConfiguration::isNotExcludedInterface)
+                .filter(hasIp6Addresses);
+    }
+
+    private static boolean isNotExcludedInterface(NetworkInterface nif) {
+        if (isMacOS && nif.getName().contains("awdl"))
+            return false;
+        String dName = nif.getDisplayName();
+        if (isWindows && dName != null && dName.contains("Teredo"))
+            return false;
+        return true;
+    }
+
+    private final Predicate<NetworkInterface> hasIp4Addresses = nif -> {
+        Optional<?> addr = ip4Interfaces.get(nif).stream()
+                .filter(a -> !a.isAnyLocalAddress())
+                .findAny();
+
+        return addr.isPresent();
+    };
+
+    private final Predicate<NetworkInterface> hasIp6Addresses = nif -> {
+        Optional<?> addr = ip6Interfaces.get(nif).stream()
+                .filter(a -> !a.isAnyLocalAddress())
+                .findAny();
+
+        return addr.isPresent();
+    };
+
+
+    /**
+     * Returns a stream of interfaces suitable for IPv4 multicast tests.
+     */
+    public Stream<NetworkInterface> ip4MulticastInterfaces() {
+        return ip4Interfaces().filter(supportsIp4Multicast);
+    }
+
+    /**
+     * Returns a stream of interfaces suitable for IPv6 multicast tests.
+     */
+    public Stream<NetworkInterface> ip6MulticastInterfaces() {
+        return ip6Interfaces().filter(supportsIp6Multicast);
+    }
+
+    private final Predicate<NetworkInterface> supportsIp4Multicast = nif -> {
+        try {
+            if (!nif.supportsMulticast() || nif.isLoopback())
+                return false;
+
+            Optional<?> addr = ip4Interfaces.get(nif).stream()
+                    .filter(a -> !a.isAnyLocalAddress())
+                    .findAny();
+
+            return addr.isPresent();
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    };
+
+    private final Predicate<NetworkInterface> supportsIp6Multicast = nif -> {
+        try {
+            if (!nif.supportsMulticast() || nif.isLoopback())
+                return false;
+
+            Optional<?> addr = ip6Interfaces.get(nif).stream()
+                    .filter(a -> !a.isAnyLocalAddress())
+                    .findAny();
+
+            return addr.isPresent();
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    };
+
+    /**
+     * Returns all addresses on all "functional" interfaces.
+     */
+    public Stream<InetAddress> addresses(NetworkInterface nif) {
+        return Stream.concat(ip4Interfaces.get(nif).stream(),
+                             ip6Interfaces.get(nif).stream());
+    }
+
+    /**
+     * Returns all IPv4 addresses on all "functional" interfaces.
+     */
+    public Stream<Inet4Address> ip4Addresses() {
+        return ip4Interfaces().flatMap(nif -> ip4Addresses(nif));
+    }
+
+    /**
+     * Returns all IPv6 addresses on all "functional" interfaces.
+     */
+    public Stream<Inet6Address> ip6Addresses() {
+        return ip6Interfaces().flatMap(nif -> ip6Addresses(nif));
+    }
+
+    /**
+     * Returns all IPv4 addresses the given interface.
+     */
+    public Stream<Inet4Address> ip4Addresses(NetworkInterface nif) {
+        return ip4Interfaces.get(nif).stream();
+    }
+
+    /**
+     * Returns all IPv6 addresses for the given interface.
+     */
+    public Stream<Inet6Address> ip6Addresses(NetworkInterface nif) {
+        return ip6Interfaces.get(nif).stream();
+    }
+
+    /**
+     * Return a NetworkConfiguration instance.
+     */
+    public static NetworkConfiguration probe() throws IOException {
+        Map<NetworkInterface, List<Inet4Address>> ip4Interfaces = new HashMap<>();
+        Map<NetworkInterface, List<Inet6Address>> ip6Interfaces = new HashMap<>();
+
+        List<NetworkInterface> nifs = list(getNetworkInterfaces());
+        for (NetworkInterface nif : nifs) {
+            // ignore interfaces that are down
+            if (!nif.isUp() || nif.isPointToPoint())
+                continue;
+
+            List<Inet4Address> ip4Addresses = new LinkedList<>();
+            List<Inet6Address> ip6Addresses = new LinkedList<>();
+            ip4Interfaces.put(nif, ip4Addresses);
+            ip6Interfaces.put(nif, ip6Addresses);
+            for (InetAddress addr : list(nif.getInetAddresses())) {
+                if (addr instanceof Inet4Address)
+                    ip4Addresses.add((Inet4Address)addr);
+                else if (addr instanceof Inet6Address)
+                    ip6Addresses.add((Inet6Address)addr);
+            }
+        }
+        return new NetworkConfiguration(ip4Interfaces, ip6Interfaces);
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        interfaces().forEach(nif -> sb.append(interfaceInformation(nif)));
+        return sb.toString();
+    }
+
+    /** Returns detailed information for the given interface. */
+    public static String interfaceInformation(NetworkInterface nif) {
+        StringBuilder sb = new StringBuilder();
+        try {
+            sb.append("Display name: " + nif.getDisplayName() + "\n");
+            sb.append("Name: " + nif.getName() + "\n");
+            for (InetAddress inetAddress : list(nif.getInetAddresses()))
+                sb.append("InetAddress: " + inetAddress + "\n");
+            sb.append("Up? " + nif.isUp() + "\n");
+            sb.append("Loopback? " + nif.isLoopback() + "\n");
+            sb.append("PointToPoint? " + nif.isPointToPoint() + "\n");
+            sb.append("Supports multicast? " + nif.supportsMulticast() + "\n");
+            sb.append("Virtual? " + nif.isVirtual() + "\n");
+            sb.append("Hardware address: " +
+                    Arrays.toString(nif.getHardwareAddress()) + "\n");
+            sb.append("MTU: " + nif.getMTU() + "\n");
+            sb.append("Index: " + nif.getIndex() + "\n");
+            sb.append("\n");
+            return sb.toString();
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    /** Prints all the system interface information to the give stream. */
+    public static void printSystemConfiguration(PrintStream out) {
+        try {
+            out.println("*** all system network interface configuration ***");
+            List<NetworkInterface> nifs = list(getNetworkInterfaces());
+            for (NetworkInterface nif : nifs)
+                out.print(interfaceInformation(nif));
+            out.println("*** end ***");
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 import java.io.PrintWriter;
 
 import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
 import java.util.function.Predicate;
 
 /**
@@ -195,7 +194,7 @@
          * @return The PID associated with this process runnable
          */
         public long getPid() throws InterruptedException {
-            return getProcess().getPid();
+            return getProcess().pid();
         }
 
         public void sendMessage(String message) throws InterruptedException {
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -256,7 +256,7 @@
      * @return Process id
      */
     public static long getProcessId() {
-        return ProcessHandle.current().getPid();
+        return ProcessHandle.current().pid();
     }
 
     /**
@@ -523,8 +523,8 @@
         }
 
         @Override
-        public long getPid() {
-            return p.getPid();
+        public long pid() {
+            return p.pid();
         }
 
         @Override
--- a/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -144,7 +144,7 @@
 
             System.out.println("Attaching test manager:");
             System.out.println("=========================");
-            System.out.println("  PID           : " + serverPrc.getPid());
+            System.out.println("  PID           : " + serverPrc.pid());
             System.out.println("  shutdown port : " + port.get());
 
             ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
@@ -152,7 +152,7 @@
                 TEST_CLASSPATH,
                 "--add-exports", "jdk.management.agent/jdk.internal.agent=ALL-UNNAMED",
                 "TestManager",
-                String.valueOf(serverPrc.getPid()),
+                String.valueOf(serverPrc.pid()),
                 port.get(),
                 "true"
             );
--- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -129,7 +129,7 @@
 
             System.out.println("Attaching test manager:");
             System.out.println("=========================");
-            System.out.println("  PID           : " + serverPrc.getPid());
+            System.out.println("  PID           : " + serverPrc.pid());
             System.out.println("  shutdown port : " + port.get());
 
             ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
@@ -137,7 +137,7 @@
                 TEST_CLASSPATH,
                 "--add-exports", "jdk.management.agent/jdk.internal.agent=ALL-UNNAMED",
                 "TestManager",
-                String.valueOf(serverPrc.getPid()),
+                String.valueOf(serverPrc.pid()),
                 port.get(),
                 "true"
             );
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -346,7 +346,7 @@
                         throw new BindException("Starting process failed due to " +
                                                 "the requested port not being available");
                     }
-                    pid = p.getPid();
+                    pid = p.pid();
                 } catch (TimeoutException e) {
                     if (p != null) {
                         p.destroy();
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java	Wed Jul 05 23:16:15 2017 +0200
@@ -31,9 +31,9 @@
  * @bug 6216082
  * @summary  Redirect problem with HttpsURLConnection using a proxy
  * @modules java.base/sun.net.www
- * @library ..
+ * @library .. /lib/testlibrary
  * @build HttpCallback TestHttpsServer ClosedChannelList
- *        HttpTransaction TunnelProxy
+ *        HttpTransaction TunnelProxy jdk.testlibrary.NetworkConfiguration
  * @key intermittent
  * @run main/othervm B6216082
  */
@@ -43,6 +43,8 @@
 import javax.net.ssl.*;
 import java.util.*;
 
+import jdk.testlibrary.NetworkConfiguration;
+
 public class B6216082 {
     static SimpleHttpTransaction httpTrans;
     static TestHttpsServer server;
@@ -118,21 +120,17 @@
     }
 
     public static InetAddress getNonLoAddress() throws Exception {
-        NetworkInterface loNIC = NetworkInterface.getByInetAddress(InetAddress.getByName("localhost"));
-        Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces();
-        while (nics.hasMoreElements()) {
-            NetworkInterface nic = nics.nextElement();
-            if (!nic.getName().equalsIgnoreCase(loNIC.getName())) {
-                Enumeration<InetAddress> addrs = nic.getInetAddresses();
-                while (addrs.hasMoreElements()) {
-                    InetAddress addr = addrs.nextElement();
-                    if (!addr.isLoopbackAddress())
-                        return addr;
-                }
-            }
-        }
+        InetAddress lh = InetAddress.getByName("localhost");
+        NetworkInterface loNIC = NetworkInterface.getByInetAddress(lh);
 
-        return null;
+        NetworkConfiguration nc = NetworkConfiguration.probe();
+        Optional<InetAddress> oaddr = nc.interfaces()
+                .filter(nif -> !nif.getName().equalsIgnoreCase(loNIC.getName()))
+                .flatMap(nif -> nc.addresses(nif))
+                .filter(a -> !a.isLoopbackAddress())
+                .findFirst();
+
+        return oaddr.orElseGet(() -> null);
     }
 
     public static void startHttpServer() throws IOException {
--- a/jdk/test/sun/security/krb5/auto/Basic.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/sun/security/krb5/auto/Basic.java	Wed Jul 05 23:16:15 2017 +0200
@@ -23,50 +23,18 @@
 
 /*
  * @test
- * @bug 7152176 8164437
+ * @bug 7152176
  * @summary More krb5 tests
- * @library /test/lib
  * @compile -XDignore.symbol.file Basic.java
  * @run main/othervm Basic
  */
 
-import jdk.test.lib.process.ProcessTools;
 import sun.security.jgss.GSSUtil;
 
-import java.util.List;
-import java.util.stream.Stream;
-
+// The basic krb5 test skeleton you can copy from
 public class Basic {
 
-    public static void main(String[] args) throws Throwable {
-
-        if (args.length == 0) { // jtreg launched here
-
-            // With all modules
-            test("jdk.security.jgss");
-
-            // With limited modules
-            List<String> cmd = ProcessTools.createJavaProcessBuilder().command();
-            Stream.of(jdk.internal.misc.VM.getRuntimeArguments())
-                    .filter(arg -> arg.startsWith("--add-exports=") ||
-                            arg.startsWith("--add-opens="))
-                    .forEach(cmd::add);
-            cmd.addAll(List.of(
-                    "-Dtest.src=" + System.getProperty("test.src"),
-                    "--add-modules",
-                        "java.base,java.security.jgss,jdk.security.auth",
-                    "--limit-modules",
-                        "java.security.jgss,jdk.security.auth",
-                    "Basic",
-                    "launched-limited"));
-            ProcessTools.executeCommand(cmd.toArray(new String[cmd.size()]))
-                    .shouldHaveExitValue(0);
-        } else { // Launched by ProcessTools above, with limited modules.
-            test("java.security.jgss");
-        }
-    }
-
-    static void test(String expected) throws Exception {
+    public static void main(String[] args) throws Exception {
 
         new OneKDC(null).writeJAASConf();
 
@@ -92,12 +60,5 @@
         b.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
 
         Context.handshake(s2, b);
-
-        // Bonus test for 8164437.
-        String moduleName = c.x().getClass().getModule().getName();
-        if (!moduleName.equals(expected)) {
-            throw new Exception("Expected: " + expected
-                    + ". Actual: " + moduleName);
-        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/ModuleName.java	Wed Jul 05 23:16:15 2017 +0200
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8164437
+ * @summary GSSContext type when jdk.security.jgss is not available
+ * @library /test/lib
+ * @compile -XDignore.symbol.file ModuleName.java
+ * @run main/othervm ModuleName
+ */
+
+import jdk.test.lib.process.ProcessTools;
+import sun.security.jgss.GSSUtil;
+
+import java.util.List;
+import java.util.stream.Stream;
+
+public class ModuleName {
+
+    public static void main(String[] args) throws Throwable {
+
+        if (args.length == 0) { // jtreg launched here
+
+            // With all modules
+            test("jdk.security.jgss");
+
+            // With limited modules
+            List<String> cmd = ProcessTools.createJavaProcessBuilder().command();
+            Stream.of(jdk.internal.misc.VM.getRuntimeArguments())
+                    .filter(arg -> arg.startsWith("--add-exports=") ||
+                            arg.startsWith("--add-opens="))
+                    .forEach(cmd::add);
+            cmd.addAll(List.of(
+                    "-Dtest.src=" + System.getProperty("test.src"),
+                    "--add-modules",
+                        "java.base,java.security.jgss,jdk.security.auth",
+                    "--limit-modules",
+                        "java.security.jgss,jdk.security.auth",
+                    "ModuleName",
+                    "launched-limited"));
+            ProcessTools.executeCommand(cmd.toArray(new String[cmd.size()]))
+                    .shouldHaveExitValue(0);
+        } else { // Launched by ProcessTools above, with limited modules.
+            test("java.security.jgss");
+        }
+    }
+
+    static void test(String expected) throws Exception {
+
+        new OneKDC(null).writeJAASConf();
+
+        Context c = Context.fromJAAS("client");
+        c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+
+        String moduleName = c.x().getClass().getModule().getName();
+        if (!moduleName.equals(expected)) {
+            throw new Exception("Expected: " + expected
+                    + ". Actual: " + moduleName);
+        }
+    }
+}
--- a/jdk/test/sun/tools/jps/LingeredApp.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/sun/tools/jps/LingeredApp.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -141,7 +141,7 @@
         if (appProcess == null) {
             throw new RuntimeException("Process is not alive");
         }
-        return appProcess.getPid();
+        return appProcess.pid();
     }
 
     /**
--- a/jdk/test/sun/tools/jstat/JStatInterval.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/sun/tools/jstat/JStatInterval.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,11 +36,8 @@
 import jdk.testlibrary.ProcessTools;
 import jdk.testlibrary.JDKToolLauncher;
 
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
 
 public class JStatInterval {
     private static final String READY = "READY";
@@ -88,7 +85,7 @@
             throw new Error("Unable to start the monitored application.");
         }
 
-        String pidStr = String.valueOf(app.getPid());
+        String pidStr = String.valueOf(app.pid());
         JDKToolLauncher l = JDKToolLauncher.createUsingTestJDK("jstat");
         l.addToolArg("-compiler");
         l.addToolArg(pidStr);
--- a/jdk/test/tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/jdk/test/tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,16 +26,15 @@
  * @bug 8156499
  * @summary Test image creation from Multi-Release JAR
  * @author Steve Drach
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules java.base/jdk.internal.jimage
  *          java.base/jdk.internal.module
- * @build jdk.testlibrary.FileUtils jdk.test.lib.process.*
+ * @build jdk.test.lib.process.*
  * @run testng JLinkMultiReleaseJarTest
 */
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
-import java.io.UncheckedIOException;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
@@ -54,10 +53,8 @@
 import jdk.internal.jimage.BasicImageReader;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.testlibrary.FileUtils;
 
 import org.testng.Assert;
-import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
@@ -138,23 +135,6 @@
         Assert.assertEquals(rc, 0);
     }
 
-    @AfterClass
-    public void close() throws IOException {
-        Files.walk(userdir, 1)
-                .filter(p -> !p.equals(userdir))
-                .forEach(p -> {
-                    try {
-                        if (Files.isDirectory(p)) {
-                            FileUtils.deleteFileTreeWithRetry(p);
-                        } else {
-                            FileUtils.deleteFileIfExistsWithRetry(p);
-                        }
-                    } catch (IOException x) {
-                        throw new UncheckedIOException(x);
-                    }
-                });
-    }
-
     @Test
     public void basicTest() throws Throwable {
         if (ignoreTest()) return;
--- a/make/common/SetupJavaCompilers.gmk	Sat Apr 22 00:21:46 2017 +0000
+++ b/make/common/SetupJavaCompilers.gmk	Wed Jul 05 23:16:15 2017 +0200
@@ -32,7 +32,7 @@
 
 # If warnings needs to be non-fatal for testing purposes use a command like:
 # make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
-JAVAC_WARNINGS := -Xlint:all,-removal -Werror
+JAVAC_WARNINGS := -Xlint:all -Werror
 
 # The BOOT_JAVAC setup uses the boot jdk compiler to compile the tools
 # and the interim javac, to be run by the boot jdk.
--- a/nashorn/.hgtags	Sat Apr 22 00:21:46 2017 +0000
+++ b/nashorn/.hgtags	Wed Jul 05 23:16:15 2017 +0200
@@ -400,3 +400,4 @@
 5e5e436543daea0c174d878d5e3ff8dd791e538a jdk-9+163
 b473fab09baab51a06ffba02eb06c7f5ee8578f7 jdk-9+164
 e36e62d3ea53c316f295b37bcc19867fbf510235 jdk-9+165
+5b2e7b2101c0048ba9f1df722e56611f523fdfe8 jdk-9+166
--- a/test/lib/jdk/test/lib/apps/LingeredApp.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/test/lib/jdk/test/lib/apps/LingeredApp.java	Wed Jul 05 23:16:15 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -143,7 +143,7 @@
         if (appProcess == null) {
             throw new RuntimeException("Process is not alive");
         }
-        return appProcess.getPid();
+        return appProcess.pid();
     }
 
     /**
--- a/test/lib/jdk/test/lib/process/ProcessTools.java	Sat Apr 22 00:21:46 2017 +0000
+++ b/test/lib/jdk/test/lib/process/ProcessTools.java	Wed Jul 05 23:16:15 2017 +0200
@@ -298,7 +298,7 @@
      * @return Process id
      */
     public static long getProcessId() throws Exception {
-        return ProcessHandle.current().getPid();
+        return ProcessHandle.current().pid();
     }
 
 
@@ -531,8 +531,8 @@
         }
 
         @Override
-        public long getPid() {
-            return p.getPid();
+        public long pid() {
+            return p.pid();
         }
 
         @Override