changeset 47636:3c844d64ec91 lvti

Automatic merge with default
author mcimadamore
date Thu, 02 Nov 2017 22:05:26 +0100
parents 12cf5db2090f 9a3682829bbb
children 4907f462bec0
files src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties test/langtools/tools/javac/diags/examples/PatchModuleWithRelease/PatchModuleWithRelease.java test/langtools/tools/javac/diags/examples/PatchModuleWithRelease/patchmodule/java.base/java/lang/Test.java
diffstat 127 files changed, 1915 insertions(+), 655 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Oct 26 22:05:30 2017 +0200
+++ b/.hgtags	Thu Nov 02 22:05:26 2017 +0100
@@ -453,3 +453,4 @@
 1129253d3bc728a2963ba411ab9dd1adf358fb6b jdk-10+26
 b87d7b5d5dedc1185e5929470f945b7378cdb3ad jdk-10+27
 92f08900cb3c0d694e5c529a676c1c9e5909193f jdk-10+28
+a6e591e12f122768f675428e1e5a838fd0e9c7ec jdk-10+29
--- a/make/autoconf/basics.m4	Thu Oct 26 22:05:30 2017 +0200
+++ b/make/autoconf/basics.m4	Thu Nov 02 22:05:26 2017 +0100
@@ -639,6 +639,14 @@
         elif test -d "$DEVKIT_ROOT/$host/sys-root"; then
           SYSROOT="$DEVKIT_ROOT/$host/sys-root"
         fi
+
+        if test "x$DEVKIT_ROOT" != x; then
+          DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib"
+          if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+            DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib64"
+          fi
+          AC_SUBST(DEVKIT_LIB_DIR)
+        fi
       ]
   )
 
--- a/make/autoconf/configure.ac	Thu Oct 26 22:05:30 2017 +0200
+++ b/make/autoconf/configure.ac	Thu Nov 02 22:05:26 2017 +0100
@@ -1,5 +1,5 @@
 SRC#
-# 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
@@ -203,6 +203,9 @@
 JDKOPT_SETUP_DEBUG_SYMBOLS
 JDKOPT_SETUP_CODE_COVERAGE
 
+# AddressSanitizer
+JDKOPT_SETUP_ADDRESS_SANITIZER
+
 # Need toolchain to setup dtrace
 HOTSPOT_SETUP_DTRACE
 HOTSPOT_ENABLE_DISABLE_AOT
--- a/make/autoconf/generated-configure.sh	Thu Oct 26 22:05:30 2017 +0200
+++ b/make/autoconf/generated-configure.sh	Thu Nov 02 22:05:26 2017 +0100
@@ -704,6 +704,7 @@
 BUILD_GTEST
 ENABLE_CDS
 ENABLE_AOT
+ASAN_ENABLED
 GCOV_ENABLED
 ZIP_EXTERNAL_DEBUG_SYMBOLS
 COPY_DEBUG_SYMBOLS
@@ -958,6 +959,7 @@
 SPEC
 SDKROOT
 XCODEBUILD
+DEVKIT_LIB_DIR
 JVM_VARIANT_MAIN
 VALID_JVM_VARIANTS
 JVM_VARIANTS
@@ -1171,6 +1173,7 @@
 enable_debug_symbols
 enable_zip_debug_info
 enable_native_coverage
+enable_asan
 enable_dtrace
 enable_aot
 enable_cds
@@ -1976,6 +1979,7 @@
   --enable-native-coverage
                           enable native compilation with code coverage
                           data[disabled]
+  --enable-asan           enable AddressSanitizer if possible [disabled]
   --enable-dtrace[=yes/no/auto]
                           enable dtrace. Default is auto, where dtrace is
                           enabled if all dependencies are present.
@@ -4403,6 +4407,12 @@
 #
 
 
+###############################################################################
+#
+# AddressSanitizer
+#
+
+
 ################################################################################
 #
 # Static build support.  When enabled will generate static
@@ -5115,7 +5125,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1509013542
+DATE_WHEN_GENERATED=1509128484
 
 ###############################################################################
 #
@@ -17273,6 +17283,14 @@
           SYSROOT="$DEVKIT_ROOT/$host/sys-root"
         fi
 
+        if test "x$DEVKIT_ROOT" != x; then
+          DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib"
+          if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+            DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib64"
+          fi
+
+        fi
+
 
 fi
 
@@ -54169,6 +54187,49 @@
 
 
 
+# AddressSanitizer
+
+  # Check whether --enable-asan was given.
+if test "${enable_asan+set}" = set; then :
+  enableval=$enable_asan;
+fi
+
+  ASAN_ENABLED="no"
+  if test "x$enable_asan" = "xyes"; then
+    case $TOOLCHAIN_TYPE in
+      gcc | clang)
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking if asan is enabled" >&5
+$as_echo_n "checking if asan is enabled... " >&6; }
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+        ASAN_CFLAGS="-fsanitize=address -fno-omit-frame-pointer"
+        ASAN_LDFLAGS="-fsanitize=address"
+        JVM_CFLAGS="$JVM_CFLAGS $ASAN_CFLAGS"
+        JVM_LDFLAGS="$JVM_LDFLAGS $ASAN_LDFLAGS"
+        CFLAGS_JDKLIB="$CFLAGS_JDKLIB $ASAN_CFLAGS"
+        CFLAGS_JDKEXE="$CFLAGS_JDKEXE $ASAN_CFLAGS"
+        CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $ASAN_CFLAGS"
+        CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $ASAN_CFLAGS"
+        LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $ASAN_LDFLAGS"
+        LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $ASAN_LDFLAGS"
+        ASAN_ENABLED="yes"
+        ;;
+      *)
+        as_fn_error $? "--enable-asan only works with toolchain type gcc or clang" "$LINENO" 5
+        ;;
+    esac
+  elif test "x$enable_asan" = "xno"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if asan is enabled" >&5
+$as_echo_n "checking if asan is enabled... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  elif test "x$enable_asan" != "x"; then
+    as_fn_error $? "--enable-asan can only be assigned \"yes\" or \"no\"" "$LINENO" 5
+  fi
+
+
+
+
 # Need toolchain to setup dtrace
 
   # Test for dtrace dependencies
--- a/make/autoconf/jdk-options.m4	Thu Oct 26 22:05:30 2017 +0200
+++ b/make/autoconf/jdk-options.m4	Thu Nov 02 22:05:26 2017 +0100
@@ -399,6 +399,46 @@
   AC_SUBST(GCOV_ENABLED)
 ])
 
+###############################################################################
+#
+# AddressSanitizer
+#
+AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
+[
+  AC_ARG_ENABLE(asan, [AS_HELP_STRING([--enable-asan],
+      [enable AddressSanitizer if possible @<:@disabled@:>@])])
+  ASAN_ENABLED="no"
+  if test "x$enable_asan" = "xyes"; then
+    case $TOOLCHAIN_TYPE in
+      gcc | clang)
+        AC_MSG_CHECKING([if asan is enabled])
+        AC_MSG_RESULT([yes])
+        ASAN_CFLAGS="-fsanitize=address -fno-omit-frame-pointer"
+        ASAN_LDFLAGS="-fsanitize=address"
+        JVM_CFLAGS="$JVM_CFLAGS $ASAN_CFLAGS"
+        JVM_LDFLAGS="$JVM_LDFLAGS $ASAN_LDFLAGS"
+        CFLAGS_JDKLIB="$CFLAGS_JDKLIB $ASAN_CFLAGS"
+        CFLAGS_JDKEXE="$CFLAGS_JDKEXE $ASAN_CFLAGS"
+        CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $ASAN_CFLAGS"
+        CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $ASAN_CFLAGS"
+        LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $ASAN_LDFLAGS"
+        LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $ASAN_LDFLAGS"
+        ASAN_ENABLED="yes"
+        ;;
+      *)
+        AC_MSG_ERROR([--enable-asan only works with toolchain type gcc or clang])
+        ;;
+    esac
+  elif test "x$enable_asan" = "xno"; then
+    AC_MSG_CHECKING([if asan is enabled])
+    AC_MSG_RESULT([no])
+  elif test "x$enable_asan" != "x"; then
+    AC_MSG_ERROR([--enable-asan can only be assigned "yes" or "no"])
+  fi
+
+  AC_SUBST(ASAN_ENABLED)
+])
+
 ################################################################################
 #
 # Static build support.  When enabled will generate static
--- a/make/autoconf/spec.gmk.in	Thu Oct 26 22:05:30 2017 +0200
+++ b/make/autoconf/spec.gmk.in	Thu Nov 02 22:05:26 2017 +0100
@@ -312,6 +312,16 @@
 
 GCOV_ENABLED=@GCOV_ENABLED@
 
+# AddressSanitizer
+export ASAN_ENABLED:=@ASAN_ENABLED@
+export DEVKIT_LIB_DIR:=@DEVKIT_LIB_DIR@
+ifeq ($(ASAN_ENABLED), yes)
+  export ASAN_OPTIONS="handle_segv=0 detect_leaks=0"
+  ifneq ($(DEVKIT_LIB_DIR),)
+    export LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(DEVKIT_LIB_DIR)
+  endif
+endif
+
 # Necessary additional compiler flags to compile X11
 X_CFLAGS:=@X_CFLAGS@
 X_LIBS:=@X_LIBS@
--- a/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, 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
@@ -36,6 +36,7 @@
 import java.util.ResourceBundle.Control;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import java.util.stream.Collectors;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 import org.xml.sax.SAXNotRecognizedException;
@@ -217,6 +218,7 @@
 
         List<Bundle> bundles = readBundleList();
         convertBundles(bundles);
+        convertBundles(addedBundles);
     }
 
     private static void usage() {
@@ -293,14 +295,7 @@
                 if (fileName.endsWith(".xml")) {
                     String id = fileName.substring(0, fileName.indexOf('.'));
                     Locale cldrLoc = Locale.forLanguageTag(toLanguageTag(id));
-                    List<Locale> candList = applyParentLocales("", defCon.getCandidateLocales("", cldrLoc));
-                    StringBuilder sb = new StringBuilder();
-                    for (Locale loc : candList) {
-                        if (!loc.equals(Locale.ROOT)) {
-                            sb.append(toLocaleName(loc.toLanguageTag()));
-                            sb.append(",");
-                        }
-                    }
+                    StringBuilder sb = getCandLocales(cldrLoc);
                     if (sb.indexOf("root") == -1) {
                         sb.append("root");
                     }
@@ -319,6 +314,23 @@
     }
 
     private static final Map<String, Map<String, Object>> cldrBundles = new HashMap<>();
+    // this list will contain additional bundles to be generated for Region dependent Data.
+    private static List<Bundle> addedBundles = new ArrayList<>();
+
+    private static Map<String, SortedSet<String>> metaInfo = new HashMap<>();
+
+    static {
+        // For generating information on supported locales.
+        metaInfo.put("LocaleNames", new TreeSet<>());
+        metaInfo.put("CurrencyNames", new TreeSet<>());
+        metaInfo.put("TimeZoneNames", new TreeSet<>());
+        metaInfo.put("CalendarData", new TreeSet<>());
+        metaInfo.put("FormatData", new TreeSet<>());
+        metaInfo.put("AvailableLocales", new TreeSet<>());
+    }
+
+
+    private static Set<String> calendarDataFields = Set.of("firstDayOfWeek", "minimalDaysInFirstWeek");
 
     static Map<String, Object> getCLDRBundle(String id) throws Exception {
         Map<String, Object> bundle = cldrBundles.get(id);
@@ -411,16 +423,85 @@
         parserLikelySubtags.parse(fileLikelySubtags, handlerLikelySubtags);
     }
 
+    /**
+     * This method will check if a new region dependent Bundle needs to be
+     * generated for this Locale id and targetMap. New Bundle will be generated
+     * when Locale id has non empty script and country code and targetMap
+     * contains region dependent data. This method will also remove region
+     * dependent data from this targetMap after candidate locales check. E.g. It
+     * will call genRegionDependentBundle() in case of az_Latn_AZ locale and
+     * remove region dependent data from this targetMap so that az_Latn_AZ
+     * bundle will not be created. For az_Cyrl_AZ, new Bundle will be generated
+     * but region dependent data will not be removed from targetMap as its candidate
+     * locales are [az_Cyrl_AZ, az_Cyrl, root], which does not include az_AZ for
+     * fallback.
+     *
+     */
+
+    private static void checkRegionDependentBundle(Map<String, Object> targetMap, String id) {
+        if ((CLDRConverter.getScript(id) != "")
+                && (CLDRConverter.getCountryCode(id) != "")) {
+            Map<String, Object> regionDepDataMap = targetMap
+                    .keySet()
+                    .stream()
+                    .filter(calendarDataFields::contains)
+                    .collect(Collectors.toMap(k -> k, targetMap::get));
+            if (!regionDepDataMap.isEmpty()) {
+                Locale cldrLoc = new Locale(CLDRConverter.getLanguageCode(id),
+                                            CLDRConverter.getCountryCode(id));
+                genRegionDependentBundle(regionDepDataMap, cldrLoc);
+                if (checkCandidateLocales(id, cldrLoc)) {
+                    // Remove matchedKeys from this targetMap only if checkCandidateLocales() returns true.
+                    regionDepDataMap.keySet().forEach(targetMap::remove);
+                }
+            }
+        }
+    }
+    /**
+     * This method will generate a new Bundle for region dependent data,
+     * minimalDaysInFirstWeek and firstDayOfWeek. Newly generated Bundle will be added
+     * to addedBundles list.
+     */
+    private static void genRegionDependentBundle(Map<String, Object> targetMap, Locale cldrLoc) {
+        String localeId = cldrLoc.toString();
+        StringBuilder sb = getCandLocales(cldrLoc);
+        if (sb.indexOf(localeId) == -1) {
+            sb.append(localeId);
+        }
+        Bundle bundle = new Bundle(localeId, sb.toString(), null, null);
+        cldrBundles.put(localeId, targetMap);
+        addedBundles.add(bundle);
+    }
+
+    private static StringBuilder getCandLocales(Locale cldrLoc) {
+        List<Locale> candList = getCandidateLocales(cldrLoc);
+        StringBuilder sb = new StringBuilder();
+        for (Locale loc : candList) {
+            if (!loc.equals(Locale.ROOT)) {
+                sb.append(toLocaleName(loc.toLanguageTag()));
+                sb.append(",");
+            }
+        }
+        return sb;
+    }
+
+    private static List<Locale> getCandidateLocales(Locale cldrLoc) {
+        List<Locale> candList = new ArrayList<>();
+        candList = applyParentLocales("", defCon.getCandidateLocales("",  cldrLoc));
+        return candList;
+    }
+
+    /**
+     * This method will return true, if for a given locale, its language and
+     * country specific locale will exist in runtime lookup path. E.g. it will
+     * return true for bs_Latn_BA.
+     */
+    private static boolean checkCandidateLocales(String id, Locale cldrLoc) {
+        return(getCandidateLocales(Locale.forLanguageTag(id.replaceAll("_", "-")))
+                .contains(cldrLoc));
+    }
+
     private static void convertBundles(List<Bundle> bundles) throws Exception {
-        // For generating information on supported locales.
-        Map<String, SortedSet<String>> metaInfo = new HashMap<>();
-        metaInfo.put("LocaleNames", new TreeSet<>());
-        metaInfo.put("CurrencyNames", new TreeSet<>());
-        metaInfo.put("TimeZoneNames", new TreeSet<>());
-        metaInfo.put("CalendarData", new TreeSet<>());
-        metaInfo.put("FormatData", new TreeSet<>());
-        metaInfo.put("AvailableLocales", new TreeSet<>());
-
         // parent locales map. The mappings are put in base metaInfo file
         // for now.
         if (isBaseModule) {
@@ -433,6 +514,8 @@
 
             Map<String, Object> targetMap = bundle.getTargetMap();
 
+            // check if new region DependentBundle needs to be generated for this Locale.
+            checkRegionDependentBundle(targetMap, bundle.getID());
             EnumSet<Bundle.Type> bundleTypes = bundle.getBundleTypes();
 
             if (bundle.isRoot()) {
@@ -573,6 +656,14 @@
         return Locale.forLanguageTag(id.replaceAll("_", "-")).getCountry();
     }
 
+    /*
+     * Returns the script portion of the given id.
+     * If id is "root", "" is returned.
+     */
+    static String getScript(String id) {
+        return "root".equals(id) ? "" : Locale.forLanguageTag(id.replaceAll("_", "-")).getScript();
+    }
+
     private static class KeyComparator implements Comparator<String> {
         static KeyComparator INSTANCE = new KeyComparator();
 
--- a/src/java.base/share/classes/java/io/FilePermission.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/io/FilePermission.java	Thu Nov 02 22:05:26 2017 +0100
@@ -698,7 +698,7 @@
             if (p2.equals(EMPTY_PATH)) {
                 return 0;
             } else if (p2.getName(0).equals(DOTDOT_PATH)) {
-                // "." contains p2 iif p2 has no "..". Since a
+                // "." contains p2 iff p2 has no "..". Since
                 // a normalized path can only have 0 or more
                 // ".." at the beginning. We only need to look
                 // at the head.
@@ -711,7 +711,7 @@
         } 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 "..".
+                // "." is inside p1 iff p1 is 1 or more "..".
                 // For the same reason above, we only need to
                 // look at the tail.
                 return -1;
--- a/src/java.base/share/classes/java/lang/String.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/lang/String.java	Thu Nov 02 22:05:26 2017 +0100
@@ -2664,6 +2664,7 @@
      * point</a> is passed through uninterpreted.
      *
      * @return an IntStream of char values from this sequence
+     * @since 9
      */
     @Override
     public IntStream chars() {
@@ -2683,6 +2684,7 @@
      * {@code int} values which are then passed to the stream.
      *
      * @return an IntStream of Unicode code points from this sequence
+     * @since 9
      */
     @Override
     public IntStream codePoints() {
--- a/src/java.base/share/classes/java/lang/System.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/lang/System.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1937,7 +1937,7 @@
         // initialization. So make sure the "props" is available at the
         // very beginning of the initialization and all system properties to
         // be put into it directly.
-        props = new Properties();
+        props = new Properties(84);
         initProperties(props);  // initialized by the VM
 
         // There are certain system configurations that may be controlled by
--- a/src/java.base/share/classes/java/lang/WeakPairMap.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/lang/WeakPairMap.java	Thu Nov 02 22:05:26 2017 +0100
@@ -88,7 +88,7 @@
      * Maps the specified key pair to the specified value in this WeakPairMap.
      * Neither the keys nor the value can be null.
      * <p>The value can be retrieved by calling the {@link #get} method
-     * with the the same keys (compared by identity).
+     * with the same keys (compared by identity).
      *
      * @param k1 the 1st of the pair of keys with which the specified value is to
      *           be associated
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Thu Nov 02 22:05:26 2017 +0100
@@ -765,7 +765,7 @@
      * In every other case, all conversions are applied <em>pairwise</em>,
      * which means that each argument or return value is converted to
      * exactly one argument or return value (or no return value).
-     * The applied conversions are defined by consulting the
+     * The applied conversions are defined by consulting
      * the corresponding component types of the old and new
      * method handle types.
      * <p>
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1196,7 +1196,7 @@
 
         static
         MethodHandle bindCaller(MethodHandle mh, Class<?> hostClass) {
-            // Code in the the boot layer should now be careful while creating method handles or
+            // Code in the boot layer should now be careful while creating method handles or
             // functional interface instances created from method references to @CallerSensitive  methods,
             // it needs to be ensured the handles or interface instances are kept safe and are not passed
             // from the boot layer to untrusted code.
--- a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Thu Nov 02 22:05:26 2017 +0100
@@ -194,8 +194,8 @@
     static {
         // In case we need to double-back onto the StringConcatFactory during this
         // static initialization, make sure we have the reasonable defaults to complete
-        // the static initialization properly. After that, actual users would use the
-        // the proper values we have read from the the properties.
+        // the static initialization properly. After that, actual users would use
+        // the proper values we have read from the properties.
         STRATEGY = DEFAULT_STRATEGY;
         // CACHE_ENABLE = false; // implied
         // CACHE = null;         // implied
@@ -398,8 +398,8 @@
      * <p>Then the following linkage invariants must hold:
      *
      * <ul>
-     *     <li>The parameter count in {@code concatType} is less than or equal to 200</li>
-     *
+     *     <li>The number of parameter slots in {@code concatType} is
+     *         less than or equal to 200</li>
      *     <li>The return type in {@code concatType} is assignable from {@link java.lang.String}</li>
      * </ul>
      *
@@ -487,8 +487,8 @@
      * <p>Then the following linkage invariants must hold:
      *
      * <ul>
-     *   <li>The parameter count in {@code concatType} is less than or equal to
-     *   200</li>
+     *   <li>The number of parameter slots in {@code concatType} is less than
+     *       or equal to 200</li>
      *
      *   <li>The parameter count in {@code concatType} equals to number of \1 tags
      *   in {@code recipe}</li>
@@ -613,9 +613,9 @@
                             concatType.returnType());
         }
 
-        if (concatType.parameterCount() > MAX_INDY_CONCAT_ARG_SLOTS) {
+        if (concatType.parameterSlotCount() > MAX_INDY_CONCAT_ARG_SLOTS) {
             throw new StringConcatException("Too many concat argument slots: " +
-                    concatType.parameterCount() +
+                    concatType.parameterSlotCount() +
                     ", can only accept " +
                     MAX_INDY_CONCAT_ARG_SLOTS);
         }
--- a/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Thu Nov 02 22:05:26 2017 +0100
@@ -205,7 +205,7 @@
  * and {@code double} on 32-bit platforms.
  *
  * <p>Access modes will override any memory ordering effects specified at
- * the declaration site of a variable.  For example, a VarHandle accessing a
+ * the declaration site of a variable.  For example, a VarHandle accessing
  * a field using the {@code get} access mode will access the field as
  * specified <em>by its access mode</em> even if that field is declared
  * {@code volatile}.  When mixed access is performed extreme care should be
@@ -423,7 +423,7 @@
  * {@link java.lang.invoke.MethodHandles#varHandleInvoker}.
  *
  * <h1>Interoperation between VarHandles and Java generics</h1>
- * A VarHandle can be obtained for a variable, such as a a field, which is
+ * A VarHandle can be obtained for a variable, such as a field, which is
  * declared with Java generic types.  As with the Core Reflection API, the
  * VarHandle's variable type will be constructed from the erasure of the
  * source-level type.  When a VarHandle access mode method is invoked, the
--- a/src/java.base/share/classes/java/net/DatagramSocket.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/net/DatagramSocket.java	Thu Nov 02 22:05:26 2017 +0100
@@ -988,7 +988,7 @@
 
     /**
      * Sets the SO_RCVBUF option to the specified value for this
-     * {@code DatagramSocket}. The SO_RCVBUF option is used by the
+     * {@code DatagramSocket}. The SO_RCVBUF option is used by
      * the network implementation as a hint to size the underlying
      * network I/O buffers. The SO_RCVBUF setting may also be used
      * by the network implementation to determine the maximum size
--- a/src/java.base/share/classes/java/net/Inet4Address.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/net/Inet4Address.java	Thu Nov 02 22:05:26 2017 +0100
@@ -143,7 +143,7 @@
         /**
          * Prior to 1.4 an InetAddress was created with a family
          * based on the platform AF_INET value (usually 2).
-         * For compatibility reasons we must therefore write the
+         * For compatibility reasons we must therefore write
          * the InetAddress with this family.
          */
         inet.holder().family = 2;
--- a/src/java.base/share/classes/java/net/SocketImpl.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/net/SocketImpl.java	Thu Nov 02 22:05:26 2017 +0100
@@ -333,7 +333,7 @@
      * latency, and low latency above short connection time, then it could
      * invoke this method with the values {@code (0, 1, 2)}.
      *
-     * By default, this method does nothing, unless it is overridden in a
+     * By default, this method does nothing, unless it is overridden in
      * a sub-class.
      *
      * @param  connectionTime
--- a/src/java.base/share/classes/java/net/SocksSocketImpl.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/net/SocksSocketImpl.java	Thu Nov 02 22:05:26 2017 +0100
@@ -657,7 +657,7 @@
 
     /**
      * Sends the Bind request to the SOCKS proxy. In the SOCKS protocol, bind
-     * means "accept incoming connection from", so the SocketAddress is the
+     * means "accept incoming connection from", so the SocketAddress is
      * the one of the host we do accept connection from.
      *
      * @param      saddr   the Socket address of the remote host.
--- a/src/java.base/share/classes/java/net/URLConnection.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/net/URLConnection.java	Thu Nov 02 22:05:26 2017 +0100
@@ -785,7 +785,7 @@
      * required to make the connection. By default, this method
      * returns {@code java.security.AllPermission}. Subclasses
      * should override this method and return the permission
-     * that best represents the permission required to make a
+     * that best represents the permission required to make
      * a connection to the URL. For example, a {@code URLConnection}
      * representing a {@code file:} URL would return a
      * {@code java.io.FilePermission} object.
--- a/src/java.base/share/classes/java/nio/channels/AsynchronousFileChannel.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/nio/channels/AsynchronousFileChannel.java	Thu Nov 02 22:05:26 2017 +0100
@@ -165,7 +165,7 @@
      * <tr>
      *   <th scope="row" > {@link StandardOpenOption#DELETE_ON_CLOSE DELETE_ON_CLOSE} </th>
      *   <td> When this option is present then the implementation makes a
-     *   <em>best effort</em> attempt to delete the file when closed by the
+     *   <em>best effort</em> attempt to delete the file when closed by
      *   the {@link #close close} method. If the {@code close} method is not
      *   invoked then a <em>best effort</em> attempt is made to delete the file
      *   when the Java virtual machine terminates. </td>
--- a/src/java.base/share/classes/java/nio/channels/FileChannel.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/nio/channels/FileChannel.java	Thu Nov 02 22:05:26 2017 +0100
@@ -216,7 +216,7 @@
      * <tr>
      *   <th scope="row" > {@link StandardOpenOption#DELETE_ON_CLOSE DELETE_ON_CLOSE} </th>
      *   <td> When this option is present then the implementation makes a
-     *   <em>best effort</em> attempt to delete the file when closed by the
+     *   <em>best effort</em> attempt to delete the file when closed by
      *   the {@link #close close} method. If the {@code close} method is not
      *   invoked then a <em>best effort</em> attempt is made to delete the file
      *   when the Java virtual machine terminates. </td>
--- a/src/java.base/share/classes/java/nio/file/Files.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/nio/file/Files.java	Thu Nov 02 22:05:26 2017 +0100
@@ -3301,7 +3301,7 @@
     }
 
     /**
-     * Writes bytes to a file. The {@code options} parameter specifies how the
+     * Writes bytes to a file. The {@code options} parameter specifies how
      * the file is created or opened. If no options are present then this method
      * works as if the {@link StandardOpenOption#CREATE CREATE}, {@link
      * StandardOpenOption#TRUNCATE_EXISTING TRUNCATE_EXISTING}, and {@link
--- a/src/java.base/share/classes/java/security/KeyPairGenerator.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/security/KeyPairGenerator.java	Thu Nov 02 22:05:26 2017 +0100
@@ -84,7 +84,7 @@
  * exists (e.g., so-called <i>community parameters</i> in DSA), there are two
  * {@link #initialize(java.security.spec.AlgorithmParameterSpec)
  * initialize} methods that have an {@code AlgorithmParameterSpec}
- * argument. One also has a {@code SecureRandom} argument, while the
+ * argument. One also has a {@code SecureRandom} argument, while
  * the other uses the {@code SecureRandom}
  * implementation of the highest-priority installed provider as the source
  * of randomness. (If none of the installed providers supply an implementation
--- a/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Thu Nov 02 22:05:26 2017 +0100
@@ -4775,7 +4775,7 @@
     //-----------------------------------------------------------------------
     /**
      * Prints or parses a localized pattern from a localized field.
-     * The specific formatter and parameters is not selected until the
+     * The specific formatter and parameters is not selected until
      * the field is to be printed or parsed.
      * The locale is needed to select the proper WeekFields from which
      * the field for day-of-week, week-of-month, or week-of-year is selected.
--- a/src/java.base/share/classes/java/time/temporal/WeekFields.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/time/temporal/WeekFields.java	Thu Nov 02 22:05:26 2017 +0100
@@ -311,7 +311,7 @@
      * the new month or year.
      * <p>
      * WeekFields instances are singletons; for each unique combination
-     * of {@code firstDayOfWeek} and {@code minimalDaysInFirstWeek} the
+     * of {@code firstDayOfWeek} and {@code minimalDaysInFirstWeek}
      * the same instance will be returned.
      *
      * @param firstDayOfWeek  the first day of the week, not null
--- a/src/java.base/share/classes/java/util/Base64.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/util/Base64.java	Thu Nov 02 22:05:26 2017 +0100
@@ -56,7 +56,7 @@
  *     base64 alphabet.</p></li>
  *
  * <li><a id="mime"><b>MIME</b></a>
- * <p> Uses the "The Base64 Alphabet" as specified in Table 1 of
+ * <p> Uses "The Base64 Alphabet" as specified in Table 1 of
  *     RFC 2045 for encoding and decoding operation. The encoded output
  *     must be represented in lines of no more than 76 characters each
  *     and uses a carriage return {@code '\r'} followed immediately by
--- a/src/java.base/share/classes/java/util/DoubleSummaryStatistics.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/util/DoubleSummaryStatistics.java	Thu Nov 02 22:05:26 2017 +0100
@@ -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
@@ -26,6 +26,7 @@
 
 import java.util.function.DoubleConsumer;
 import java.util.stream.Collector;
+import java.util.stream.DoubleStream;
 
 /**
  * A state object for collecting statistics such as count, min, max, sum, and
@@ -69,13 +70,66 @@
     private double max = Double.NEGATIVE_INFINITY;
 
     /**
-     * Construct an empty instance with zero count, zero sum,
+     * Constructs an empty instance with zero count, zero sum,
      * {@code Double.POSITIVE_INFINITY} min, {@code Double.NEGATIVE_INFINITY}
      * max and zero average.
      */
     public DoubleSummaryStatistics() { }
 
     /**
+     * Constructs a non-empty instance with the specified {@code count},
+     * {@code min}, {@code max}, and {@code sum}.
+     *
+     * <p>If {@code count} is zero then the remaining arguments are ignored and
+     * an empty instance is constructed.
+     *
+     * <p>If the arguments are inconsistent then an {@code IllegalArgumentException}
+     * is thrown.  The necessary consistent argument conditions are:
+     * <ul>
+     *   <li>{@code count >= 0}</li>
+     *   <li>{@code (min <= max && !isNaN(sum)) || (isNaN(min) && isNaN(max) && isNaN(sum))}</li>
+     * </ul>
+     * @apiNote
+     * The enforcement of argument correctness means that the retrieved set of
+     * recorded values obtained from a {@code DoubleSummaryStatistics} source
+     * instance may not be a legal set of arguments for this constructor due to
+     * arithmetic overflow of the source's recorded count of values.
+     * The consistent argument conditions are not sufficient to prevent the
+     * creation of an internally inconsistent instance.  An example of such a
+     * state would be an instance with: {@code count} = 2, {@code min} = 1,
+     * {@code max} = 2, and {@code sum} = 0.
+     *
+     * @param count the count of values
+     * @param min the minimum value
+     * @param max the maximum value
+     * @param sum the sum of all values
+     * @throws IllegalArgumentException if the arguments are inconsistent
+     * @since 10
+     */
+    public DoubleSummaryStatistics(long count, double min, double max, double sum)
+            throws IllegalArgumentException {
+        if (count < 0L) {
+            throw new IllegalArgumentException("Negative count value");
+        } else if (count > 0L) {
+            if (min > max)
+                throw new IllegalArgumentException("Minimum greater than maximum");
+
+            // All NaN or non NaN
+            var ncount = DoubleStream.of(min, max, sum).filter(Double::isNaN).count();
+            if (ncount > 0 && ncount < 3)
+                throw new IllegalArgumentException("Some, not all, of the minimum, maximum, or sum is NaN");
+
+            this.count = count;
+            this.sum = sum;
+            this.simpleSum = sum;
+            this.sumCompensation = 0.0d;
+            this.min = min;
+            this.max = max;
+        }
+        // Use default field values if count == 0
+    }
+
+    /**
      * Records another value into the summary information.
      *
      * @param value the input value
--- a/src/java.base/share/classes/java/util/EventObject.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/util/EventObject.java	Thu Nov 02 22:05:26 2017 +0100
@@ -43,13 +43,13 @@
     /**
      * The object on which the Event initially occurred.
      */
-    protected transient Object  source;
+    protected transient Object source;
 
     /**
      * Constructs a prototypical Event.
      *
-     * @param    source    The object on which the Event initially occurred.
-     * @exception  IllegalArgumentException  if source is null.
+     * @param source the object on which the Event initially occurred
+     * @throws IllegalArgumentException if source is null
      */
     public EventObject(Object source) {
         if (source == null)
@@ -61,7 +61,7 @@
     /**
      * The object on which the Event initially occurred.
      *
-     * @return   The object on which the Event initially occurred.
+     * @return the object on which the Event initially occurred
      */
     public Object getSource() {
         return source;
@@ -70,7 +70,7 @@
     /**
      * Returns a String representation of this EventObject.
      *
-     * @return  A a String representation of this EventObject.
+     * @return a String representation of this EventObject
      */
     public String toString() {
         return getClass().getName() + "[source=" + source + "]";
--- a/src/java.base/share/classes/java/util/FormattableFlags.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/util/FormattableFlags.java	Thu Nov 02 22:05:26 2017 +0100
@@ -26,7 +26,7 @@
 package java.util;
 
 /**
- * FomattableFlags are passed to the {@link Formattable#formatTo
+ * FormattableFlags are passed to the {@link Formattable#formatTo
  * Formattable.formatTo()} method and modify the output format for {@linkplain
  * Formattable Formattables}.  Implementations of {@link Formattable} are
  * responsible for interpreting and validating any flags.
--- a/src/java.base/share/classes/java/util/IntSummaryStatistics.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/util/IntSummaryStatistics.java	Thu Nov 02 22:05:26 2017 +0100
@@ -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
@@ -69,13 +69,58 @@
     private int max = Integer.MIN_VALUE;
 
     /**
-     * Construct an empty instance with zero count, zero sum,
+     * Constructs an empty instance with zero count, zero sum,
      * {@code Integer.MAX_VALUE} min, {@code Integer.MIN_VALUE} max and zero
      * average.
      */
     public IntSummaryStatistics() { }
 
     /**
+     * Constructs a non-empty instance with the specified {@code count},
+     * {@code min}, {@code max}, and {@code sum}.
+     *
+     * <p>If {@code count} is zero then the remaining arguments are ignored and
+     * an empty instance is constructed.
+     *
+     * <p>If the arguments are inconsistent then an {@code IllegalArgumentException}
+     * is thrown.  The necessary consistent argument conditions are:
+     * <ul>
+     *   <li>{@code count >= 0}</li>
+     *   <li>{@code min <= max}</li>
+     * </ul>
+     * @apiNote
+     * The enforcement of argument correctness means that the retrieved set of
+     * recorded values obtained from a {@code IntSummaryStatistics} source
+     * instance may not be a legal set of arguments for this constructor due to
+     * arithmetic overflow of the source's recorded count of values.
+     * The consistent argument conditions are not sufficient to prevent the
+     * creation of an internally inconsistent instance.  An example of such a
+     * state would be an instance with: {@code count} = 2, {@code min} = 1,
+     * {@code max} = 2, and {@code sum} = 0.
+     *
+     * @param count the count of values
+     * @param min the minimum value
+     * @param max the maximum value
+     * @param sum the sum of all values
+     * @throws IllegalArgumentException if the arguments are inconsistent
+     * @since 10
+     */
+    public IntSummaryStatistics(long count, int min, int max, long sum)
+            throws IllegalArgumentException {
+        if (count < 0L) {
+            throw new IllegalArgumentException("Negative count value");
+        } else if (count > 0L) {
+            if (min > max) throw new IllegalArgumentException("Minimum greater than maximum");
+
+            this.count = count;
+            this.sum = sum;
+            this.min = min;
+            this.max = max;
+        }
+        // Use default field values if count == 0
+    }
+
+    /**
      * Records a new value into the summary information
      *
      * @param value the input value
--- a/src/java.base/share/classes/java/util/Locale.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/util/Locale.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1909,7 +1909,7 @@
      * Returns a name for the locale that is appropriate for display to the
      * user. This will be the values returned by getDisplayLanguage(),
      * getDisplayScript(), getDisplayCountry(), and getDisplayVariant() assembled
-     * into a single string. The the non-empty values are used in order,
+     * into a single string. The non-empty values are used in order,
      * with the second and subsequent names in parentheses.  For example:
      * <blockquote>
      * language (script, country, variant)<br>
--- a/src/java.base/share/classes/java/util/LongSummaryStatistics.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/util/LongSummaryStatistics.java	Thu Nov 02 22:05:26 2017 +0100
@@ -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
@@ -70,13 +70,58 @@
     private long max = Long.MIN_VALUE;
 
     /**
-     * Construct an empty instance with zero count, zero sum,
+     * Constructs an empty instance with zero count, zero sum,
      * {@code Long.MAX_VALUE} min, {@code Long.MIN_VALUE} max and zero
      * average.
      */
     public LongSummaryStatistics() { }
 
     /**
+     * Constructs a non-empty instance with the specified {@code count},
+     * {@code min}, {@code max}, and {@code sum}.
+     *
+     * <p>If {@code count} is zero then the remaining arguments are ignored and
+     * an empty instance is constructed.
+     *
+     * <p>If the arguments are inconsistent then an {@code IllegalArgumentException}
+     * is thrown.  The necessary consistent argument conditions are:
+     * <ul>
+     *   <li>{@code count >= 0}</li>
+     *   <li>{@code min <= max}</li>
+     * </ul>
+     * @apiNote
+     * The enforcement of argument correctness means that the retrieved set of
+     * recorded values obtained from a {@code LongSummaryStatistics} source
+     * instance may not be a legal set of arguments for this constructor due to
+     * arithmetic overflow of the source's recorded count of values.
+     * The consistent argument conditions are not sufficient to prevent the
+     * creation of an internally inconsistent instance.  An example of such a
+     * state would be an instance with: {@code count} = 2, {@code min} = 1,
+     * {@code max} = 2, and {@code sum} = 0.
+     *
+     * @param count the count of values
+     * @param min the minimum value
+     * @param max the maximum value
+     * @param sum the sum of all values
+     * @throws IllegalArgumentException if the arguments are inconsistent
+     * @since 10
+     */
+    public LongSummaryStatistics(long count, long min, long max, long sum)
+            throws IllegalArgumentException {
+        if (count < 0L) {
+            throw new IllegalArgumentException("Negative count value");
+        } else if (count > 0L) {
+            if (min > max) throw new IllegalArgumentException("Minimum greater than maximum");
+
+            this.count = count;
+            this.sum = sum;
+            this.min = min;
+            this.max = max;
+        }
+        // Use default field values if count == 0
+    }
+
+    /**
      * Records a new {@code int} value into the summary information.
      *
      * @param value the input value
--- a/src/java.base/share/classes/java/util/Properties.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/util/Properties.java	Thu Nov 02 22:05:26 2017 +0100
@@ -122,6 +122,10 @@
  * <p>This class is thread-safe: multiple threads can share a single
  * {@code Properties} object without the need for external synchronization.
  *
+ * @apiNote
+ * The {@code Properties} class does not inherit the concept of a load factor
+ * from its superclass, {@code Hashtable}.
+ *
  * @author  Arthur van Hoff
  * @author  Michael McCloskey
  * @author  Xueming Shen
@@ -148,25 +152,49 @@
      * simple read operations.  Writes and bulk operations remain synchronized,
      * as in Hashtable.
      */
-    private transient ConcurrentHashMap<Object, Object> map =
-            new ConcurrentHashMap<>(8);
+    private transient ConcurrentHashMap<Object, Object> map;
 
     /**
      * Creates an empty property list with no default values.
+     *
+     * @implNote The initial capacity of a {@code Properties} object created
+     * with this constructor is unspecified.
      */
     public Properties() {
-        this(null);
+        this(null, 8);
+    }
+
+    /**
+     * Creates an empty property list with no default values, and with an
+     * initial size accommodating the specified number of elements without the
+     * need to dynamically resize.
+     *
+     * @param  initialCapacity the {@code Properties} will be sized to
+     *         accommodate this many elements
+     * @throws IllegalArgumentException if the initial capacity is less than
+     *         zero.
+     */
+    public Properties(int initialCapacity) {
+        this(null, initialCapacity);
     }
 
     /**
      * Creates an empty property list with the specified defaults.
      *
+     * @implNote The initial capacity of a {@code Properties} object created
+     * with this constructor is unspecified.
+     *
      * @param   defaults   the defaults.
      */
     public Properties(Properties defaults) {
+        this(defaults, 8);
+    }
+
+    private Properties(Properties defaults, int initialCapacity) {
         // use package-private constructor to
         // initialize unused fields with dummy values
         super((Void) null);
+        map = new ConcurrentHashMap<>(initialCapacity);
         this.defaults = defaults;
     }
 
--- a/src/java.base/share/classes/java/util/ResourceBundle.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/util/ResourceBundle.java	Thu Nov 02 22:05:26 2017 +0100
@@ -2743,7 +2743,7 @@
          * of multiple subtags separated by underscore, generate candidate
          * <code>Locale</code>s by omitting the variant subtags one by one, then
          * insert them after every occurrence of <code> Locale</code>s with the
-         * full variant value in the original list.  For example, if the
+         * full variant value in the original list.  For example, if
          * the variant consists of two subtags <em>V1</em> and <em>V2</em>:
          *
          * <ul>
--- a/src/java.base/share/classes/java/util/ServiceLoader.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/java/util/ServiceLoader.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1409,7 +1409,7 @@
      *
      * <p> To achieve laziness the actual work of locating providers is done
      * when processing the stream. If a service provider cannot be loaded for any
-     * of the the reasons specified in the <a href="#errors">Errors</a> section
+     * of the reasons specified in the <a href="#errors">Errors</a> section
      * above then {@link ServiceConfigurationError} is thrown by whatever method
      * caused the service provider to be loaded. </p>
      *
--- a/src/java.base/share/classes/javax/security/auth/Policy.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/javax/security/auth/Policy.java	Thu Nov 02 22:05:26 2017 +0100
@@ -134,7 +134,7 @@
  * setting the value of the {@code auth.policy.provider} security property to
  * the fully qualified name of the desired {@code Policy} implementation class.
  *
- * @deprecated  as of JDK version 1.4 -- Replaced by java.security.Policy.
+ * @deprecated  Replaced by java.security.Policy.
  *              java.security.Policy has a method:
  * <pre>
  *      public PermissionCollection getPermissions
@@ -152,11 +152,12 @@
  *
  * These two APIs provide callers the means to query the
  * Policy for Principal-based Permission entries.
+ * This class is subject to removal in a future version of Java SE.
  *
  * @since 1.4
  * @see java.security.Security security properties
  */
-@Deprecated(since="1.4")
+@Deprecated(since="1.4", forRemoval=true)
 public abstract class Policy {
 
     private static Policy policy;
--- a/src/java.base/share/classes/javax/security/auth/SubjectDomainCombiner.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/javax/security/auth/SubjectDomainCombiner.java	Thu Nov 02 22:05:26 2017 +0100
@@ -29,7 +29,6 @@
 import java.security.Permission;
 import java.security.Permissions;
 import java.security.PermissionCollection;
-import java.security.Policy;
 import java.security.Principal;
 import java.security.PrivilegedAction;
 import java.security.ProtectionDomain;
@@ -57,7 +56,7 @@
         sun.security.util.Debug.getInstance("combiner",
                                         "\t[SubjectDomainCombiner]");
 
-    @SuppressWarnings("deprecation")
+    @SuppressWarnings({"deprecation", "removal"})
     // Note: check only at classloading time, not dynamically during combine()
     private static final boolean useJavaxPolicy =
         javax.security.auth.Policy.isCustomPolicySet(debug);
@@ -303,7 +302,7 @@
         if (!allowCaching) {
             java.security.AccessController.doPrivileged
                 (new PrivilegedAction<Void>() {
-                    @SuppressWarnings("deprecation")
+                    @SuppressWarnings({"deprecation", "removal"})
                     public Void run() {
                         // Call refresh only caching is disallowed
                         javax.security.auth.Policy.getPolicy().refresh();
@@ -374,7 +373,7 @@
                         PermissionCollection newPerms =
                             java.security.AccessController.doPrivileged
                             (new PrivilegedAction<PermissionCollection>() {
-                            @SuppressWarnings("deprecation")
+                            @SuppressWarnings({"deprecation", "removal"})
                             public PermissionCollection run() {
                                 return
                                     javax.security.auth.Policy.getPolicy().getPermissions
--- a/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java	Thu Nov 02 22:05:26 2017 +0100
@@ -238,7 +238,7 @@
     // This way we could simply do things like:
     //    push((logger) -> logger.log(level, msg));
     // Unfortunately, if we come to here it means we are in the bootsraping
-    // phase where using lambdas is not safe yet - so we have to use a
+    // phase where using lambdas is not safe yet - so we have to use
     // a data object instead...
     //
     static final class LogEvent {
--- a/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java	Thu Nov 02 22:05:26 2017 +0100
@@ -66,7 +66,7 @@
  * -m and --add-modules options. The modules are located on a module path that
  * is constructed from the upgrade module path, system modules, and application
  * module path. The Configuration is instantiated as the boot layer with each
- * module in the the configuration defined to a class loader.
+ * module in the configuration defined to a class loader.
  */
 
 public final class ModuleBootstrap {
--- a/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java	Thu Nov 02 22:05:26 2017 +0100
@@ -74,7 +74,7 @@
      * the outgoing edges from M to non-candidate modules.
      */
     public Map<String, ModuleHashes> computeHashes(Set<String> roots) {
-        // build a graph containing the the packaged modules and
+        // build a graph containing the packaged modules and
         // its transitive dependences matching --hash-modules
         Graph.Builder<String> builder = new Graph.Builder<>();
         Deque<ResolvedModule> deque = new ArrayDeque<>(configuration.modules());
--- a/src/java.base/share/classes/jdk/internal/module/Resources.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/jdk/internal/module/Resources.java	Thu Nov 02 22:05:26 2017 +0100
@@ -56,7 +56,7 @@
     /**
      * Derive a <em>package name</em> for a resource. The package name
      * returned by this method may not be a legal package name. This method
-     * returns null if the the resource name ends with a "/" (a directory)
+     * returns null if the resource name ends with a "/" (a directory)
      * or the resource name does not contain a "/".
      */
     public static String toPackageName(String name) {
--- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Frame.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Frame.java	Thu Nov 02 22:05:26 2017 +0100
@@ -192,7 +192,7 @@
     private static final int LOCAL = 0x2000000;
 
     /**
-     * Kind of the the types that are relative to the stack of an input stack
+     * Kind of the types that are relative to the stack of an input stack
      * map frame. The value of such types is a position relatively to the top of
      * this stack.
      */
--- a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Thu Nov 02 22:05:26 2017 +0100
@@ -2888,7 +2888,7 @@
             /*
              * If we have an input stream this means we received a response
              * from the server. That stream may have been read to EOF and
-             * dependening on the stream type may already be closed or the
+             * depending on the stream type may already be closed or
              * the http client may be returned to the keep-alive cache.
              * If the http client has been returned to the keep-alive cache
              * it may be closed (idle timeout) or may be allocated to
--- a/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java	Thu Nov 02 22:05:26 2017 +0100
@@ -66,7 +66,7 @@
     /**
      * Static factory. Given a (generic) class, actual type arguments
      * and an owner type, creates a parameterized type.
-     * This class can be instantiated with a a raw type that does not
+     * This class can be instantiated with a raw type that does not
      * represent a generic type, provided the list of actual type
      * arguments is empty.
      * If the ownerType argument is null, the declaring class of the
--- a/src/java.base/share/classes/sun/security/provider/AuthPolicyFile.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/security/provider/AuthPolicyFile.java	Thu Nov 02 22:05:26 2017 +0100
@@ -65,6 +65,7 @@
  *             This class is entirely deprecated.
  */
 @Deprecated
+@SuppressWarnings("removal")
 public class AuthPolicyFile extends javax.security.auth.Policy {
 
     static final ResourceBundle rb =
@@ -410,7 +411,7 @@
                         certs = null;
                     }
 
-                    // only add if we had no signer or we had a
+                    // only add if we had no signer or we had
                     // a signer and found the keys for it.
                     if (certs != null || pe.signedBy == null) {
                             Permission perm = new UnresolvedPermission(
--- a/src/java.base/share/classes/sun/security/provider/PolicyFile.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/security/provider/PolicyFile.java	Thu Nov 02 22:05:26 2017 +0100
@@ -789,7 +789,7 @@
                         certs = null;
                     }
 
-                    // only add if we had no signer or we had a
+                    // only add if we had no signer or we had
                     // a signer and found the keys for it.
                     if (certs != null || pe.signedBy == null) {
                         Permission perm = new UnresolvedPermission(
--- a/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java	Thu Nov 02 22:05:26 2017 +0100
@@ -154,7 +154,7 @@
      *
      * @param codesource the <code>CodeSource</code> to compare against.
      *
-     * @return true if this <code>SubjectCodeSource</code> implies the
+     * @return true if this <code>SubjectCodeSource</code> implies
      *          the specified <code>CodeSource</code>.
      */
     public boolean implies(CodeSource codesource) {
--- a/src/java.base/share/classes/sun/security/provider/certpath/ResponderId.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/security/provider/certpath/ResponderId.java	Thu Nov 02 22:05:26 2017 +0100
@@ -119,7 +119,7 @@
      * When encoded in DER this object will use the byKey option, a
      * SHA-1 hash of the responder's public key.
      *
-     * @param pubKey the the OCSP responder's public key
+     * @param pubKey the OCSP responder's public key
      *
      * @throws IOException if the internal DER-encoding of the
      *      {@code KeyIdentifier} fails.
--- a/src/java.base/share/classes/sun/security/provider/certpath/SunCertPathBuilderException.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/security/provider/certpath/SunCertPathBuilderException.java	Thu Nov 02 22:05:26 2017 +0100
@@ -94,7 +94,7 @@
     }
 
     /**
-     * Creates a <code>SunCertPathBuilderException</code> withe the specified
+     * Creates a <code>SunCertPathBuilderException</code> with the specified
      * detail message and adjacency list.
      *
      * @param msg the detail message
--- a/src/java.base/share/classes/sun/security/ssl/CertStatusReqItemV2.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/security/ssl/CertStatusReqItemV2.java	Thu Nov 02 22:05:26 2017 +0100
@@ -145,7 +145,7 @@
      * @return the encoded length of this {@code CertStatusReqItemV2}
      */
     int length() {
-        // The length is the the status type (1 byte) + the request length
+        // The length is the status type (1 byte) + the request length
         // field (2 bytes) + the StatusRequest data length.
         return request.length() + 3;
     }
--- a/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java	Thu Nov 02 22:05:26 2017 +0100
@@ -539,7 +539,7 @@
 
                 // Should be repacked for suitable fragment length.
                 //
-                // Note that the acquiring processes will reassemble the
+                // Note that the acquiring processes will reassemble
                 // the fragments later.
                 return compareToSequence(o.recordEpoch, o.recordSeq);
             }
--- a/src/java.base/share/classes/sun/security/ssl/MAC.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/security/ssl/MAC.java	Thu Nov 02 22:05:26 2017 +0100
@@ -188,7 +188,7 @@
      * @param type record type
      * @param bb a ByteBuffer in which the position and limit
      *        demarcate the data to be MAC'd.
-     * @param isSimulated if true, simulate the the MAC computation
+     * @param isSimulated if true, simulate the MAC computation
      *
      * @return the MAC result
      */
--- a/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java	Thu Nov 02 22:05:26 2017 +0100
@@ -333,7 +333,7 @@
         }
 
         /**
-         * Load the the KeyStore as described in the specified descriptor.
+         * Load the KeyStore as described in the specified descriptor.
          */
         private static KeyStore loadKeyStore(
                 TrustStoreDescriptor descriptor) throws Exception {
--- a/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java	Thu Nov 02 22:05:26 2017 +0100
@@ -724,7 +724,8 @@
             if (signers == null) {
                 signers = new ArrayList<>();
             }
-            // Append the new code signer
+            // Append the new code signer. If timestamp is invalid, this
+            // jar will be treated as unsigned.
             signers.add(new CodeSigner(certChain, info.getTimestamp()));
 
             if (debug != null) {
--- a/src/java.base/share/classes/sun/security/x509/X509CertImpl.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/security/x509/X509CertImpl.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1485,7 +1485,7 @@
     }
 
     /**
-     * Get the certificate constraints path length from the
+     * Get the certificate constraints path length from
      * the critical BasicConstraints extension, (oid = 2.5.29.19).
      * @return the length of the constraint.
      */
--- a/src/java.base/share/classes/sun/text/normalizer/Trie2.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/text/normalizer/Trie2.java	Thu Nov 02 22:05:26 2017 +0100
@@ -592,7 +592,7 @@
         //   may be lower when iterating over the code points for a single lead surrogate.
         private int            limitCP;
 
-        // True while iterating over the the Trie2 values for code points.
+        // True while iterating over the Trie2 values for code points.
         // False while iterating over the alternate values for lead surrogates.
         private boolean        doingCodePoints = true;
 
--- a/src/java.base/share/classes/sun/util/logging/PlatformLogger.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.base/share/classes/sun/util/logging/PlatformLogger.java	Thu Nov 02 22:05:26 2017 +0100
@@ -45,7 +45,7 @@
  *
  * If the logging facility is not enabled, the platform loggers
  * will output log messages per the default logging configuration
- * (see below). In this implementation, it does not log the
+ * (see below). In this implementation, it does not log
  * the stack frame information issuing the log message.
  *
  * When the logging facility is enabled (at startup or runtime),
--- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java	Thu Nov 02 22:05:26 2017 +0100
@@ -183,7 +183,6 @@
                 case "10":
                     return RELEASE_10;
                 case "9":
-                case "1.9":
                     return RELEASE_9;
                 case "1.8":
                     return RELEASE_8;
--- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java	Thu Nov 02 22:05:26 2017 +0100
@@ -75,7 +75,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected AbstractAnnotationValueVisitor6() {}
 
     /**
--- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java	Thu Nov 02 22:05:26 2017 +0100
@@ -75,7 +75,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected AbstractElementVisitor6(){}
 
     /**
--- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java	Thu Nov 02 22:05:26 2017 +0100
@@ -74,7 +74,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected AbstractTypeVisitor6() {}
 
     /**
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java	Thu Nov 02 22:05:26 2017 +0100
@@ -91,7 +91,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected ElementKindVisitor6() {
         super(null);
     }
@@ -104,7 +104,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected ElementKindVisitor6(R defaultValue) {
         super(defaultValue);
     }
--- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java	Thu Nov 02 22:05:26 2017 +0100
@@ -106,7 +106,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected ElementScanner6(){
         DEFAULT_VALUE = null;
     }
@@ -119,7 +119,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected ElementScanner6(R defaultValue){
         DEFAULT_VALUE = defaultValue;
     }
--- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor6.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor6.java	Thu Nov 02 22:05:26 2017 +0100
@@ -92,7 +92,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected SimpleAnnotationValueVisitor6() {
         super();
         DEFAULT_VALUE = null;
@@ -106,7 +106,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected SimpleAnnotationValueVisitor6(R defaultValue) {
         super();
         DEFAULT_VALUE = defaultValue;
--- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java	Thu Nov 02 22:05:26 2017 +0100
@@ -94,7 +94,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected SimpleElementVisitor6(){
         DEFAULT_VALUE = null;
     }
@@ -107,7 +107,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected SimpleElementVisitor6(R defaultValue){
         DEFAULT_VALUE = defaultValue;
     }
--- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java	Thu Nov 02 22:05:26 2017 +0100
@@ -94,7 +94,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected SimpleTypeVisitor6(){
         DEFAULT_VALUE = null;
     }
@@ -107,7 +107,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected SimpleTypeVisitor6(R defaultValue){
         DEFAULT_VALUE = defaultValue;
     }
--- a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java	Thu Nov 02 22:05:26 2017 +0100
@@ -85,7 +85,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected TypeKindVisitor6() {
         super(null);
     }
@@ -99,7 +99,7 @@
      * @deprecated Release 6 is obsolete; update to a visitor for a newer
      * release level.
      */
-    @Deprecated
+    @Deprecated(since="9")
     protected TypeKindVisitor6(R defaultValue) {
         super(defaultValue);
     }
--- a/src/java.compiler/share/classes/javax/tools/ToolProvider.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.compiler/share/classes/javax/tools/ToolProvider.java	Thu Nov 02 22:05:26 2017 +0100
@@ -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
@@ -96,7 +96,7 @@
      * locate system tools as well as user-installed tools.
      * @return a class loader, or {@code null}
      */
-    @Deprecated
+    @Deprecated(since="9")
     public static ClassLoader getSystemToolClassLoader() {
         return null;
     }
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Utility.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Utility.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,6 +1,6 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Oct 2017
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -181,6 +181,7 @@
      * @throws IOException if a failure from reading from the bytes argument
      * occurs
      */
+    @SuppressWarnings("fallthrough") // by design for case Const.INSTANCEOF
     public static String codeToString(final ByteSequence bytes, final ConstantPool constant_pool,
             final boolean verbose) throws IOException {
         final short opcode = (short) bytes.readUnsignedByte();
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELFactory.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELFactory.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,6 +1,6 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Oct 2017
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -175,6 +175,7 @@
 
 
     @Override
+    @SuppressWarnings("fallthrough") // by design for case Const.ANEWARRAY
     public void visitAllocationInstruction( final AllocationInstruction i ) {
         Type type;
         if (i instanceof CPInstruction) {
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Message.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Message.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,6 +1,6 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Oct 2017
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -54,6 +54,7 @@
         return Type.Void;
     }
 
+    @SuppressWarnings("fallthrough") // at default
     public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
         final ConstantPoolGen cpg = classGen.getConstantPool();
         final InstructionList il = methodGen.getInstructionList();
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Step.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Step.java	Thu Nov 02 22:05:26 2017 +0100
@@ -232,6 +232,7 @@
         translateStep(classGen, methodGen, hasPredicates() ? _predicates.size() - 1 : -1);
     }
 
+    @SuppressWarnings("fallthrough") // at case NodeTest.ANODE and NodeTest.ELEMENT
     private void translateStep(ClassGenerator classGen,
                                MethodGenerator methodGen,
                                int predicateIndex) {
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Whitespace.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Whitespace.java	Thu Nov 02 22:05:26 2017 +0100
@@ -191,6 +191,7 @@
      * Scans through the rules vector and looks for a rule of higher
      * priority that contradicts the current rule.
      */
+    @SuppressWarnings("fallthrough") // case RULE_NAMESPACE
     private static WhitespaceRule findContradictingRule(List<WhitespaceRule> rules,
                                                         WhitespaceRule rule) {
         for (WhitespaceRule currentRule : rules) {
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathLexer.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathLexer.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Oct 2017
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -73,6 +74,7 @@
          * name instead of a keyword (Jira-1912). Look two tokens behind
          * to desambiguate expressions like "* and *" or "and * and".
          */
+        @SuppressWarnings("fallthrough")
         Symbol disambiguateOperator(int ss) throws Exception {
             switch (last) {
             case sym.STAR:
@@ -745,6 +747,7 @@
 ":13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:" +
 "4,232,184:8,-1:2,184:10,-1:3,76,184,76:3");
 
+        @SuppressWarnings("fallthrough") // at case 18 and -1
         public com.sun.java_cup.internal.runtime.Symbol next_token ()
                 throws java.io.IOException,
 Exception
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1591,13 +1591,13 @@
             RESULT = new CurrentCall(fname);
           }
           else if (fname == parser.getQNameIgnoreDefaultNs("number")) {
-            RESULT = new NumberCall(fname, parser.EmptyArgs);
+            RESULT = new NumberCall(fname, XPathParser.EmptyArgs);
           }
           else if (fname == parser.getQNameIgnoreDefaultNs("string")) {
-            RESULT = new StringCall(fname, parser.EmptyArgs);
+            RESULT = new StringCall(fname, XPathParser.EmptyArgs);
           }
           else if (fname == parser.getQNameIgnoreDefaultNs("concat")) {
-            RESULT = new ConcatCall(fname, parser.EmptyArgs);
+            RESULT = new ConcatCall(fname, XPathParser.EmptyArgs);
           }
           else if (fname == parser.getQNameIgnoreDefaultNs("true")) {
             RESULT = new BooleanExpr(true);
@@ -1609,10 +1609,10 @@
             RESULT = new NameCall(fname);
           }
           else if (fname == parser.getQNameIgnoreDefaultNs("generate-id")) {
-            RESULT = new GenerateIdCall(fname, parser.EmptyArgs);
+            RESULT = new GenerateIdCall(fname, XPathParser.EmptyArgs);
           }
           else if (fname == parser.getQNameIgnoreDefaultNs("string-length")) {
-            RESULT = new StringLengthCall(fname, parser.EmptyArgs);
+            RESULT = new StringLengthCall(fname, XPathParser.EmptyArgs);
           }
           else if (fname == parser.getQNameIgnoreDefaultNs("position")) {
             RESULT = new PositionCall(fname);
@@ -1627,7 +1627,7 @@
             RESULT = new NamespaceUriCall(fname);
           }
           else {
-            RESULT = new FunctionCall(fname, parser.EmptyArgs);
+            RESULT = new FunctionCall(fname, XPathParser.EmptyArgs);
           }
 
               parser_result = new Symbol(16/*FunctionCall*/, (parser_stack.get(parser_top-2)).left, (parser_stack.get(parser_top-0)).right, RESULT);
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Oct 2017
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -1278,11 +1279,13 @@
                     // For "attribute::p:*", the principal node kind is
                     // attribute
                     m_baseIterator = getAxisIterator(axis);
+                    break;
                 }
                 case Axis.NAMESPACE: {
                     // This covers "namespace::p:*".  It is syntactically
                     // correct, though it doesn't make much sense.
                     m_baseIterator = getAxisIterator(axis);
+                    break;
                 }
                 default: {
                     // In all other cases, the principal node kind is
--- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/TransletOutputHandlerFactory.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/TransletOutputHandlerFactory.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,6 +1,6 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Oct 2017
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -145,6 +145,7 @@
         _indentNumber = value;
     }
 
+    @SuppressWarnings("fallthrough")  // intentional at case STAX, SAX
     public SerializationHandler getSerializationHandler()
         throws IOException, ParserConfigurationException
     {
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentTypeImpl.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentTypeImpl.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,6 +1,6 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Oct 2017
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -161,8 +161,8 @@
                     if (((DocumentImpl)getOwnerDocument()).allowGrammarAccess){
                         insertBefore(node, last);
                         last = node;
-                        break;
                     }
+                    break;
                 }
 
                 // NOTE: Should never get here! -Ac
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDElementTraverser.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDElementTraverser.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,6 +1,6 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Oct 2017
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -439,7 +439,7 @@
                         fSchemaHandler.checkForDuplicateNames(
                                 (schemaDoc.fTargetNamespace == null) ? ","+DOMUtil.getAttrValue(child, SchemaSymbols.ATT_NAME)
                                         : schemaDoc.fTargetNamespace+","+ DOMUtil.getAttrValue(child, SchemaSymbols.ATT_NAME),
-                                        fSchemaHandler.ATTRIBUTE_TYPE, fSchemaHandler.getIDRegistry(), fSchemaHandler.getIDRegistry_sub(),
+                                        XSDHandler.ATTRIBUTE_TYPE, fSchemaHandler.getIDRegistry(), fSchemaHandler.getIDRegistry_sub(),
                                         child, schemaDoc);
                     }
                 } else if (childName.equals(SchemaSymbols.ELT_KEYREF)) {
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java	Thu Nov 02 22:05:26 2017 +0100
@@ -3025,6 +3025,7 @@
         return newComponents;
     }
 
+    @SuppressWarnings("fallthrough")
     private void expandRelatedComponents(XSObject component,List<XSObject>componentList, Map<String, List<String>> dependencies) {
         short componentType = component.getType();
         switch (componentType) {
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/AbstractDOMParser.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/AbstractDOMParser.java	Thu Nov 02 22:05:26 2017 +0100
@@ -600,6 +600,7 @@
      *
      * @throws XNIException Thrown by application to signal an error.
      */
+    @SuppressWarnings("fallthrough") // by design at case LSParserFilter.FILTER_SKIP
     public void comment (XMLString text, Augmentations augs) throws XNIException {
         if (fInDTD) {
             if (fInternalSubset != null && !fInDTDExternalSubset) {
@@ -673,6 +674,7 @@
      *
      * @throws XNIException Thrown by handler to signal an error.
      */
+    @SuppressWarnings("fallthrough") // by design at case LSParserFilter.FILTER_REJECT
     public void processingInstruction (String target, XMLString data, Augmentations augs)
     throws XNIException {
 
@@ -1416,6 +1418,7 @@
      *
      * @throws XNIException Thrown by handler to signal an error.
      */
+    @SuppressWarnings("fallthrough") // by design at case LSParserFilter.FILTER_REJECT
     public void endCDATA (Augmentations augs) throws XNIException {
 
         fInCDATASection = false;
@@ -2596,6 +2599,7 @@
      * or removed fFistChunk must be set to true, otherwise some data can be lost.
      *
      */
+    @SuppressWarnings("fallthrough") // by design at case LSParserFilter.FILTER_REJECT
     protected void  setCharacterData (boolean sawChars){
 
         // handle character data
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/DTMDocumentImpl.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/DTMDocumentImpl.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,6 +1,6 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Oct 2017
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -1697,6 +1697,7 @@
          * @return String Value of this node, or null if not
          * meaningful for this node type.
          */
+        @SuppressWarnings("fallthrough")
         public String getNodeValue(int nodeHandle)
         {
                 nodes.readSlot(nodeHandle, gotslot);
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/dom2dtm/DOM2DTM.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/dom2dtm/DOM2DTM.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1651,6 +1651,7 @@
    * @param node Node whose subtree is to be walked, gathering the
    * contents of all Text or CDATASection nodes.
    */
+  @SuppressWarnings("fallthrough")
   protected static void dispatchNodeData(Node node,
                                          org.xml.sax.ContentHandler ch,
                                          int depth)
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1020,6 +1020,7 @@
      * @throws IOException An I/O exception occured while
      *   serializing
      */
+    @SuppressWarnings("fallthrough") // by design at case Node.DOCUMENT_FRAGMENT_NODE
     protected void serializeNode( Node node )
         throws IOException
     {
--- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/FilterExprWalker.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/FilterExprWalker.java	Thu Nov 02 22:05:26 2017 +0100
@@ -62,6 +62,7 @@
    *
    * @throws javax.xml.transform.TransformerException
    */
+  @SuppressWarnings("fallthrough")
   public void init(Compiler compiler, int opPos, int stepType)
           throws javax.xml.transform.TransformerException
   {
--- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/MatchPatternIterator.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/MatchPatternIterator.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,6 +1,6 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Oct 2017
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -299,7 +299,7 @@
         System.out.println(", "+m_cdtm.getNodeName(n));
         // if(m_cdtm.getNodeName(n).equals("near-east"))
         System.out.println("pattern: "+m_pattern.toString());
-        m_pattern.debugWhatToShow(m_pattern.getWhatToShow());
+        NodeTest.debugWhatToShow(m_pattern.getWhatToShow());
       }
 
       XObject score = m_pattern.execute(xctxt);
--- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/WalkerFactory.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/WalkerFactory.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,6 +1,6 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Oct 2017
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -554,6 +554,7 @@
    *
    * @throws javax.xml.transform.TransformerException
    */
+  @SuppressWarnings("fallthrough") // by design at case OpCodes.FROM_DESCENDANTS
   private static boolean isOptimizableForDescendantIterator(
           Compiler compiler, int stepOpCodePos, int stepIndex)
             throws javax.xml.transform.TransformerException
@@ -1102,7 +1103,7 @@
       System.out.print(", predAxis: " + Axis.getNames(ai.getAxis()));
       System.out.print(", what: ");
       System.out.print("    ");
-      ai.debugWhatToShow(ai.getWhatToShow());
+      NodeTest.debugWhatToShow(ai.getWhatToShow());
     }
 
     int argLen = compiler.getFirstPredicateOpPos(opPos);
@@ -1621,6 +1622,7 @@
    *
    * @throws javax.xml.transform.TransformerException
    */
+  @SuppressWarnings("fallthrough") // by design at case OpCodes.FROM_ROOT
   private static boolean isNaturalDocOrder(
           Compiler compiler, int stepOpCodePos, int stepIndex, int analysis)
             throws javax.xml.transform.TransformerException
--- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/Lexer.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/Lexer.java	Thu Nov 02 22:05:26 2017 +0100
@@ -106,6 +106,7 @@
    *
    * @throws javax.xml.transform.TransformerException
    */
+  @SuppressWarnings("fallthrough") // on purpose at case '-', '(' and default
   void tokenize(String pat, List<String> targetStrings)
           throws javax.xml.transform.TransformerException
   {
--- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/patterns/ContextMatchStepPattern.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/patterns/ContextMatchStepPattern.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,6 +1,6 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * @LastModified: Oct 2017
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -65,7 +65,7 @@
     if (xctxt.getIteratorRoot() == xctxt.getCurrentNode())
       return getStaticScore();
     else
-      return this.SCORE_NONE;
+      return NodeTest.SCORE_NONE;
   }
 
   /**
--- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/patterns/StepPattern.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/patterns/StepPattern.java	Thu Nov 02 22:05:26 2017 +0100
@@ -116,7 +116,7 @@
       m_targetString = PsuedoNames.PSEUDONAME_ROOT;
       break;
     case DTMFilter.SHOW_ELEMENT :
-      if (this.WILD == m_name)
+      if (WILD.equals(m_name))
         m_targetString = PsuedoNames.PSEUDONAME_ANY;
       else
         m_targetString = m_name;
--- a/src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.java	Thu Nov 02 22:05:26 2017 +0100
@@ -586,7 +586,7 @@
                             // note funky case:  localname can be null
                             // when declaring the default prefix, and
                             // yet the uri isn't null.
-                            atts.addAttribute (nsSupport.XMLNS, prefix,
+                            atts.addAttribute (NamespaceSupport.XMLNS, prefix,
                                     attQName.intern(), type, value);
                         else
                             atts.addAttribute ("", "",
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Thu Nov 02 22:05:26 2017 +0100
@@ -58,12 +58,10 @@
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
-import com.sun.tools.javac.util.JCDiagnostic;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Options;
 
 import java.util.EnumSet;
@@ -104,7 +102,7 @@
     final DeferredAttr deferredAttr;
     final ArgumentAttr argumentAttr;
     final TreeMaker make;
-    final Names names;
+    final AnalyzerCopier copier;
     private final boolean allowDiamondWithAnonymousClassCreation;
 
     final EnumSet<AnalyzerMode> analyzerModes;
@@ -124,7 +122,7 @@
         deferredAttr = DeferredAttr.instance(context);
         argumentAttr = ArgumentAttr.instance(context);
         make = TreeMaker.instance(context);
-        names = Names.instance(context);
+        copier = new AnalyzerCopier();
         Options options = Options.instance(context);
         String findOpt = options.get("find");
         //parse modes
@@ -205,15 +203,14 @@
         abstract boolean match(S tree);
 
         /**
-         * Rewrite a given AST node into a new one
+         * Rewrite a given AST node into a new one(s)
          */
-        abstract T map(S oldTree, S newTree);
+        abstract List<T> rewrite(S oldTree);
 
         /**
          * Entry-point for comparing results and generating diagnostics.
          */
         abstract void process(S oldTree, T newTree, boolean hasErrors);
-
     }
 
     /**
@@ -233,11 +230,14 @@
         }
 
         @Override
-        JCNewClass map(JCNewClass oldTree, JCNewClass newTree) {
-            if (newTree.clazz.hasTag(TYPEAPPLY)) {
-                ((JCTypeApply)newTree.clazz).arguments = List.nil();
+        List<JCNewClass> rewrite(JCNewClass oldTree) {
+            if (oldTree.clazz.hasTag(TYPEAPPLY)) {
+                JCNewClass nc = copier.copy(oldTree);
+                ((JCTypeApply)nc.clazz).arguments = List.nil();
+                return List.of(nc);
+            } else {
+                return List.of(oldTree);
             }
-            return newTree;
         }
 
         @Override
@@ -301,12 +301,14 @@
             }
 
         @Override
-        JCLambda map (JCNewClass oldTree, JCNewClass newTree){
-            JCMethodDecl md = (JCMethodDecl)decls(newTree.def).head;
+        List<JCLambda> rewrite(JCNewClass oldTree){
+            JCMethodDecl md = (JCMethodDecl)decls(oldTree.def).head;
             List<JCVariableDecl> params = md.params;
             JCBlock body = md.body;
-            return make.Lambda(params, body);
+            JCLambda newTree = make.Lambda(params, body);
+            return List.of(newTree);
         }
+
         @Override
         void process (JCNewClass oldTree, JCLambda newTree, boolean hasErrors){
             if (!hasErrors) {
@@ -330,10 +332,12 @@
                     tree.typeargs.nonEmpty();
         }
         @Override
-        JCMethodInvocation map (JCMethodInvocation oldTree, JCMethodInvocation newTree){
-            newTree.typeargs = List.nil();
-            return newTree;
+        List<JCMethodInvocation> rewrite(JCMethodInvocation oldTree){
+            JCMethodInvocation app = copier.copy(oldTree);
+            app.typeargs = List.nil();
+            return List.of(app);
         }
+
         @Override
         void process (JCMethodInvocation oldTree, JCMethodInvocation newTree, boolean hasErrors){
             if (!hasErrors) {
@@ -355,7 +359,8 @@
         /**
          * Map a variable tree into a new declaration using implicit type.
          */
-        JCVariableDecl mapVar(JCVariableDecl oldTree, JCVariableDecl newTree){
+        JCVariableDecl rewriteVarType(JCVariableDecl oldTree) {
+            JCVariableDecl newTree = copier.copy(oldTree);
             newTree.vartype = null;
             return newTree;
         }
@@ -363,7 +368,7 @@
         /**
          * Analyze results of local variable inference.
          */
-        void processVar(JCVariableDecl oldTree, JCVariableDecl newTree, boolean hasErrors){
+        void processVar(JCVariableDecl oldTree, JCVariableDecl newTree, boolean hasErrors) {
             if (!hasErrors) {
                 if (types.isSameType(oldTree.type, newTree.type)) {
                     log.warning(oldTree, Warnings.LocalRedundantType);
@@ -387,8 +392,8 @@
                     attr.canInferLocalVarType(tree) == null;
         }
         @Override
-        JCVariableDecl map(JCVariableDecl oldTree, JCVariableDecl newTree){
-            return mapVar(oldTree, newTree);
+        List<JCVariableDecl> rewrite(JCVariableDecl oldTree) {
+            return List.of(rewriteVarType(oldTree));
         }
         @Override
         void process(JCVariableDecl oldTree, JCVariableDecl newTree, boolean hasErrors){
@@ -410,10 +415,11 @@
             return !tree.var.isImplicitlyTyped();
         }
         @Override
-        JCEnhancedForLoop map(JCEnhancedForLoop oldTree, JCEnhancedForLoop newTree){
-            newTree.var = mapVar(oldTree.var, newTree.var);
-            newTree.body = make.Block(0, List.nil()); //ignore body for analysis purpose
-            return newTree;
+        List<JCEnhancedForLoop> rewrite(JCEnhancedForLoop oldTree) {
+            JCEnhancedForLoop newTree = copier.copy(oldTree);
+            newTree.var = rewriteVarType(oldTree.var);
+            newTree.body = make.Block(0, List.nil());
+            return List.of(newTree);
         }
         @Override
         void process(JCEnhancedForLoop oldTree, JCEnhancedForLoop newTree, boolean hasErrors){
@@ -464,12 +470,13 @@
      * and speculatively type-check the rewritten code to compare results against previously attributed code.
      */
     void analyze(JCStatement statement, Env<AttrContext> env) {
-        AnalysisContext context = new AnalysisContext(statement, env);
-        StatementScanner statementScanner = new StatementScanner(context);
-        statementScanner.scan(statement);
+        StatementScanner statementScanner = new StatementScanner(statement, env);
+        statementScanner.scan();
 
-        if (!context.treesToAnalyzer.isEmpty()) {
-            deferredAnalysisHelper.queue(context);
+        if (!statementScanner.rewritings.isEmpty()) {
+            for (RewritingContext rewriting : statementScanner.rewritings) {
+                deferredAnalysisHelper.queue(rewriting);
+            }
         }
     }
 
@@ -480,7 +487,7 @@
         /**
          * Add a new analysis task to the queue.
          */
-        void queue(AnalysisContext context);
+        void queue(RewritingContext rewriting);
         /**
          * Flush queue with given attribution env.
          */
@@ -492,7 +499,7 @@
      */
     DeferredAnalysisHelper flushDeferredHelper = new DeferredAnalysisHelper() {
         @Override
-        public void queue(AnalysisContext context) {
+        public void queue(RewritingContext rewriting) {
             //do nothing
         }
 
@@ -508,12 +515,12 @@
      */
     DeferredAnalysisHelper queueDeferredHelper = new DeferredAnalysisHelper() {
 
-        Map<ClassSymbol, ArrayList<AnalysisContext>> Q = new HashMap<>();
+        Map<ClassSymbol, ArrayList<RewritingContext>> Q = new HashMap<>();
 
         @Override
-        public void queue(AnalysisContext context) {
-            ArrayList<AnalysisContext> s = Q.computeIfAbsent(context.env.enclClass.sym.outermostClass(), k -> new ArrayList<>());
-            s.add(context);
+        public void queue(RewritingContext rewriting) {
+            ArrayList<RewritingContext> s = Q.computeIfAbsent(rewriting.env.enclClass.sym.outermostClass(), k -> new ArrayList<>());
+            s.add(rewriting);
         }
 
         @Override
@@ -522,9 +529,9 @@
                 DeferredAnalysisHelper prevHelper = deferredAnalysisHelper;
                 try {
                     deferredAnalysisHelper = flushDeferredHelper;
-                    ArrayList<AnalysisContext> s = Q.get(flushEnv.enclClass.sym.outermostClass());
-                    while (s != null && !s.isEmpty()) {
-                        doAnalysis(s.remove(0));
+                    ArrayList<RewritingContext> rewritings = Q.get(flushEnv.enclClass.sym.outermostClass());
+                    while (rewritings != null && !rewritings.isEmpty()) {
+                        doAnalysis(rewritings.remove(0));
                     }
                 } finally {
                     deferredAnalysisHelper = prevHelper;
@@ -535,28 +542,24 @@
 
     DeferredAnalysisHelper deferredAnalysisHelper = queueDeferredHelper;
 
-    void doAnalysis(AnalysisContext context) {
+    void doAnalysis(RewritingContext rewriting) {
         DiagnosticSource prevSource = log.currentSource();
         LocalCacheContext localCacheContext = argumentAttr.withLocalCacheContext();
         try {
-            log.useSource(context.env.toplevel.getSourceFile());
+            log.useSource(rewriting.env.toplevel.getSourceFile());
 
-            JCStatement treeToAnalyze = (JCStatement)context.tree;
-            if (context.env.info.scope.owner.kind == Kind.TYP) {
+            JCStatement treeToAnalyze = (JCStatement)rewriting.originalTree;
+            if (rewriting.env.info.scope.owner.kind == Kind.TYP) {
                 //add a block to hoist potential dangling variable declarations
-                treeToAnalyze = make.Block(Flags.SYNTHETIC, List.of((JCStatement)context.tree));
+                treeToAnalyze = make.Block(Flags.SYNTHETIC, List.of((JCStatement)rewriting.originalTree));
             }
 
-            TreeMapper treeMapper = new TreeMapper(context);
             //TODO: to further refine the analysis, try all rewriting combinations
-            deferredAttr.attribSpeculative(treeToAnalyze, context.env, attr.statInfo, treeMapper,
-                    t -> new AnalyzeDeferredDiagHandler(context), argumentAttr.withLocalCacheContext());
-            context.treeMap.entrySet().forEach(e -> {
-                context.treesToAnalyzer.get(e.getKey())
-                        .process(e.getKey(), e.getValue(), context.errors.nonEmpty());
-            });
+            deferredAttr.attribSpeculative(treeToAnalyze, rewriting.env, attr.statInfo, new TreeRewriter(rewriting),
+                    t -> rewriting.diagHandler(), argumentAttr.withLocalCacheContext());
+            rewriting.analyzer.process(rewriting.oldTree, rewriting.replacement, rewriting.erroneous);
         } catch (Throwable ex) {
-            Assert.error("Analyzer error when processing: " + context.tree);
+            Assert.error("Analyzer error when processing: " + rewriting.originalTree);
         } finally {
             log.useSource(prevSource.getFile());
             localCacheContext.leave();
@@ -568,65 +571,22 @@
     }
 
     /**
-     * Simple deferred diagnostic handler which filters out all messages and keep track of errors.
-     */
-    class AnalyzeDeferredDiagHandler extends Log.DeferredDiagnosticHandler {
-        AnalysisContext context;
-
-        public AnalyzeDeferredDiagHandler(AnalysisContext context) {
-            super(log, d -> {
-                if (d.getType() == DiagnosticType.ERROR) {
-                    context.errors.add(d);
-                }
-                return true;
-            });
-            this.context = context;
-        }
-    }
-
-    /**
-     * This class is used to pass around contextual information bewteen analyzer classes, such as
-     * trees to be rewritten, errors occurred during the speculative attribution step, etc.
-     */
-    class AnalysisContext {
-
-        JCTree tree;
-
-        Env<AttrContext> env;
-
-        AnalysisContext(JCTree tree, Env<AttrContext> env) {
-            this.tree = tree;
-            this.env = attr.copyEnv(env);
-            /*  this is a temporary workaround that should be removed once we have a truly independent
-             *  clone operation
-             */
-            if (tree.hasTag(VARDEF)) {
-                // avoid redefinition clashes
-                this.env.info.scope.remove(((JCVariableDecl)tree).sym);
-            }
-        }
-
-        /** Map from trees to analyzers. */
-        Map<JCTree, StatementAnalyzer<JCTree, JCTree>> treesToAnalyzer = new HashMap<>();
-
-        /** Map from original AST nodes to rewritten AST nodes */
-        Map<JCTree, JCTree> treeMap = new HashMap<>();
-
-        /** Errors in rewritten tree */
-        ListBuffer<JCDiagnostic> errors = new ListBuffer<>();
-    }
-
-    /**
      * Subclass of {@link com.sun.tools.javac.tree.TreeScanner} which visit AST-nodes w/o crossing
      * statement boundaries.
      */
     class StatementScanner extends TreeScanner {
+        /** Tree rewritings (generated by analyzers). */
+        ListBuffer<RewritingContext> rewritings = new ListBuffer<>();
+        JCTree originalTree;
+        Env<AttrContext> env;
 
-        /** context */
-        AnalysisContext context;
+        StatementScanner(JCTree originalTree, Env<AttrContext> env) {
+            this.originalTree = originalTree;
+            this.env = attr.copyEnv(env);
+        }
 
-        StatementScanner(AnalysisContext context) {
-            this.context = context;
+        public void scan() {
+            scan(originalTree);
         }
 
         @Override
@@ -637,7 +597,9 @@
                     if (analyzer.isEnabled() &&
                             tree.hasTag(analyzer.tag) &&
                             analyzer.match(tree)) {
-                        context.treesToAnalyzer.put(tree, analyzer);
+                        for (JCTree t : analyzer.rewrite(tree)) {
+                            rewritings.add(new RewritingContext(originalTree, tree, t, analyzer, env));
+                        }
                         break; //TODO: cover cases where multiple matching analyzers are found
                     }
                 }
@@ -705,28 +667,60 @@
         }
     }
 
+    class RewritingContext {
+        // the whole tree being analyzed
+        JCTree originalTree;
+        // a subtree, old tree, that will be rewritten
+        JCTree oldTree;
+        // the replacement for the old tree
+        JCTree replacement;
+        // did the compiler find any error
+        boolean erroneous;
+        // the env
+        Env<AttrContext> env;
+        // the corresponding analyzer
+        StatementAnalyzer<JCTree, JCTree> analyzer;
+
+        RewritingContext(
+                JCTree originalTree,
+                JCTree oldTree,
+                JCTree replacement,
+                StatementAnalyzer<JCTree, JCTree> analyzer,
+                Env<AttrContext> env) {
+            this.originalTree = originalTree;
+            this.oldTree = oldTree;
+            this.replacement = replacement;
+            this.analyzer = analyzer;
+            this.env = attr.copyEnv(env);
+            /*  this is a temporary workaround that should be removed once we have a truly independent
+             *  clone operation
+             */
+            if (originalTree.hasTag(VARDEF)) {
+                // avoid redefinition clashes
+                this.env.info.scope.remove(((JCVariableDecl)originalTree).sym);
+            }
+        }
+
+        /**
+         * Simple deferred diagnostic handler which filters out all messages and keep track of errors.
+         */
+        Log.DeferredDiagnosticHandler diagHandler() {
+            return new Log.DeferredDiagnosticHandler(log, d -> {
+                if (d.getType() == DiagnosticType.ERROR) {
+                    erroneous = true;
+                }
+                return true;
+            });
+        }
+    }
+
     /**
      * Subclass of TreeCopier that maps nodes matched by analyzers onto new AST nodes.
      */
-    class TreeMapper extends TreeCopier<Void> {
+    class AnalyzerCopier extends TreeCopier<Void> {
 
-        AnalysisContext context;
-
-        TreeMapper(AnalysisContext context) {
+        public AnalyzerCopier() {
             super(make);
-            this.context = context;
-        }
-
-        @Override
-        @SuppressWarnings("unchecked")
-        public <Z extends JCTree> Z copy(Z tree, Void _unused) {
-            Z newTree = super.copy(tree, _unused);
-            StatementAnalyzer<JCTree, JCTree> analyzer = context.treesToAnalyzer.get(tree);
-            if (analyzer != null) {
-                newTree = (Z)analyzer.map(tree, newTree);
-                context.treeMap.put(tree, newTree);
-            }
-            return newTree;
         }
 
         @Override @DefinedBy(Api.COMPILER_TREE)
@@ -753,4 +747,24 @@
             return newNewClazz;
         }
     }
+
+   class TreeRewriter extends AnalyzerCopier {
+
+        RewritingContext rewriting;
+
+        TreeRewriter(RewritingContext rewriting) {
+            this.rewriting = rewriting;
+        }
+
+        @Override
+        @SuppressWarnings("unchecked")
+        public <Z extends JCTree> Z copy(Z tree, Void _unused) {
+            Z newTree = super.copy(tree, null);
+            if (tree != null && tree == rewriting.oldTree) {
+                Assert.checkNonNull(rewriting.replacement);
+                newTree = (Z)rewriting.replacement;
+            }
+            return newTree;
+        }
+    }
 }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1473,11 +1473,6 @@
                 d.packge.modle = msym;
             }
         }
-
-        if (!allowAccessIntoSystem && (msym.flags() & Flags.SYSTEM_MODULE) != 0 &&
-            msym.patchLocation != null) {
-            log.error(Errors.PatchModuleWithRelease(msym));
-        }
     }
 
     private Set<ModuleSymbol> retrieveRequiresTransitive(ModuleSymbol msym) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Nov 02 22:05:26 2017 +0100
@@ -3129,10 +3129,6 @@
 compiler.err.add.reads.with.release=\
     adding read edges for system module {0} is not allowed with --release
 
-# 0: symbol
-compiler.err.patch.module.with.release=\
-    patching system module {0} is not allowed in combination with --release
-
 compiler.warn.addopens.ignored=\
     --add-opens has no effect at compile time
 
--- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java	Thu Nov 02 22:05:26 2017 +0100
@@ -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
@@ -162,11 +162,20 @@
     private boolean noTimestamp = false;
     private Date expireDate = new Date(0L);     // used in noTimestamp warning
 
-    // Severe warnings
+    // Severe warnings.
+
+    // jarsigner used to check signer cert chain validity and key usages
+    // itself and set various warnings. Later CertPath validation is
+    // added but chainNotValidated is only flagged when no other existing
+    // warnings are set. TSA cert chain check is added separately and
+    // only tsaChainNotValidated is set, i.e. has no affect on hasExpiredCert,
+    // notYetValidCert, or any badXyzUsage.
+
     private int weakAlg = 0; // 1. digestalg, 2. sigalg, 4. tsadigestalg
     private boolean hasExpiredCert = false;
     private boolean notYetValidCert = false;
     private boolean chainNotValidated = false;
+    private boolean tsaChainNotValidated = false;
     private boolean notSignedByAlias = false;
     private boolean aliasNotInStore = false;
     private boolean hasUnsignedEntry = false;
@@ -176,6 +185,7 @@
     private boolean signerSelfSigned = false;
 
     private Throwable chainNotValidatedReason = null;
+    private Throwable tsaChainNotValidatedReason = null;
 
     private boolean seeWeak = false;
 
@@ -266,7 +276,8 @@
 
         if (strict) {
             int exitCode = 0;
-            if (weakAlg != 0 || chainNotValidated || hasExpiredCert || notYetValidCert || signerSelfSigned) {
+            if (weakAlg != 0 || chainNotValidated
+                    || hasExpiredCert || notYetValidCert || signerSelfSigned) {
                 exitCode |= 4;
             }
             if (badKeyUsage || badExtendedKeyUsage || badNetscapeCertType) {
@@ -278,6 +289,9 @@
             if (notSignedByAlias || aliasNotInStore) {
                 exitCode |= 32;
             }
+            if (tsaChainNotValidated) {
+                exitCode |= 64;
+            }
             if (exitCode != 0) {
                 System.exit(exitCode);
             }
@@ -864,6 +878,9 @@
                 signerSelfSigned = false;
             }
 
+            // If there is a time stamp block inside the PKCS7 block file
+            boolean hasTimestampBlock = false;
+
             // Even if the verbose option is not specified, all out strings
             // must be generated so seeWeak can be updated.
             if (!digestMap.isEmpty()
@@ -892,6 +909,7 @@
                             PublicKey key = signer.getPublicKey();
                             PKCS7 tsToken = si.getTsToken();
                             if (tsToken != null) {
+                                hasTimestampBlock = true;
                                 SignerInfo tsSi = tsToken.getSignerInfos()[0];
                                 X509Certificate tsSigner = tsSi.getCertificate(tsToken);
                                 byte[] encTsTokenInfo = tsToken.getContentInfo().getData();
@@ -967,7 +985,7 @@
                 if (badKeyUsage || badExtendedKeyUsage || badNetscapeCertType ||
                         notYetValidCert || chainNotValidated || hasExpiredCert ||
                         hasUnsignedEntry || signerSelfSigned || (weakAlg != 0) ||
-                        aliasNotInStore || notSignedByAlias) {
+                        aliasNotInStore || notSignedByAlias || tsaChainNotValidated) {
 
                     if (strict) {
                         System.out.println(rb.getString("jar.verified.with.signer.errors."));
@@ -1019,10 +1037,16 @@
 
                     if (chainNotValidated) {
                         System.out.println(String.format(
-                                rb.getString("This.jar.contains.entries.whose.certificate.chain.is.not.validated.reason.1"),
+                                rb.getString("This.jar.contains.entries.whose.certificate.chain.is.invalid.reason.1"),
                                 chainNotValidatedReason.getLocalizedMessage()));
                     }
 
+                    if (tsaChainNotValidated) {
+                        System.out.println(String.format(
+                                rb.getString("This.jar.contains.entries.whose.tsa.certificate.chain.is.invalid.reason.1"),
+                                tsaChainNotValidatedReason.getLocalizedMessage()));
+                    }
+
                     if (notSignedByAlias) {
                         System.out.println(
                                 rb.getString("This.jar.contains.signed.entries.which.is.not.signed.by.the.specified.alias.es."));
@@ -1050,8 +1074,15 @@
                                 "This.jar.contains.entries.whose.signer.certificate.will.expire.within.six.months."));
                     }
                     if (noTimestamp) {
-                        System.out.println(
-                                String.format(rb.getString("no.timestamp.verifying"), expireDate));
+                        if (hasTimestampBlock) {
+                            // JarSigner API has not seen the timestamp,
+                            // might have ignored it due to weak alg, etc.
+                            System.out.println(
+                                    String.format(rb.getString("bad.timestamp.verifying"), expireDate));
+                        } else {
+                            System.out.println(
+                                    String.format(rb.getString("no.timestamp.verifying"), expireDate));
+                        }
                     }
                 }
                 if (warningAppeared || errorAppeared) {
@@ -1106,16 +1137,23 @@
     private static MessageFormat expiredTimeForm = null;
     private static MessageFormat expiringTimeForm = null;
 
-    /*
-     * Display some details about a certificate:
+    /**
+     * Returns a string about a certificate:
      *
      * [<tab>] <cert-type> [", " <subject-DN>] [" (" <keystore-entry-alias> ")"]
      * [<validity-period> | <expiry-warning>]
+     * [<key-usage-warning>]
      *
-     * Note: no newline character at the end
+     * Note: no newline character at the end.
+     *
+     * When isTsCert is true, this method sets global flags like hasExpiredCert,
+     * notYetValidCert, badKeyUsage, badExtendedKeyUsage, badNetscapeCertType.
+     *
+     * @param isTsCert true if c is in the TSA cert chain, false otherwise.
+     * @param checkUsage true to check code signer keyUsage
      */
-    String printCert(String tab, Certificate c, boolean checkValidityPeriod,
-        Date timestamp, boolean checkUsage) {
+    String printCert(boolean isTsCert, String tab, Certificate c,
+        Date timestamp, boolean checkUsage) throws Exception {
 
         StringBuilder certStr = new StringBuilder();
         String space = rb.getString("SPACE");
@@ -1135,7 +1173,7 @@
             certStr.append(space).append(alias);
         }
 
-        if (checkValidityPeriod && x509Cert != null) {
+        if (x509Cert != null) {
 
             certStr.append("\n").append(tab).append("[");
             Date notAfter = x509Cert.getNotAfter();
@@ -1148,7 +1186,7 @@
                     x509Cert.checkValidity();
                     // test if cert will expire within six months
                     if (notAfter.getTime() < System.currentTimeMillis() + SIX_MONTHS) {
-                        hasExpiringCert = true;
+                        if (!isTsCert) hasExpiringCert = true;
                         if (expiringTimeForm == null) {
                             expiringTimeForm = new MessageFormat(
                                 rb.getString("certificate.will.expire.on"));
@@ -1169,7 +1207,7 @@
                     certStr.append(validityTimeForm.format(source));
                 }
             } catch (CertificateExpiredException cee) {
-                hasExpiredCert = true;
+                if (!isTsCert) hasExpiredCert = true;
 
                 if (expiredTimeForm == null) {
                     expiredTimeForm = new MessageFormat(
@@ -1179,7 +1217,7 @@
                 certStr.append(expiredTimeForm.format(source));
 
             } catch (CertificateNotYetValidException cnyve) {
-                notYetValidCert = true;
+                if (!isTsCert) notYetValidCert = true;
 
                 if (notYetTimeForm == null) {
                     notYetTimeForm = new MessageFormat(
@@ -1398,7 +1436,7 @@
                     System.out.println(rb.getString("TSA.location.") + tsaUrl);
                 } else if (tsaCert != null) {
                     System.out.println(rb.getString("TSA.certificate.") +
-                            printCert("", tsaCert, false, null, false));
+                            printCert(true, "", tsaCert, null, false));
                 }
             }
             builder.tsa(tsaURI);
@@ -1458,6 +1496,30 @@
             }
         }
 
+        // The JarSigner API always accepts the timestamp received.
+        // We need to extract the certs from the signed jar to
+        // validate it.
+        if (!noTimestamp) {
+            try (JarFile check = new JarFile(signedJarFile)) {
+                PKCS7 p7 = new PKCS7(check.getInputStream(check.getEntry(
+                        "META-INF/" + sigfile + "." + privateKey.getAlgorithm())));
+                SignerInfo si = p7.getSignerInfos()[0];
+                PKCS7 tsToken = si.getTsToken();
+                SignerInfo tsSi = tsToken.getSignerInfos()[0];
+                try {
+                    validateCertChain(Validator.VAR_TSA_SERVER,
+                            tsSi.getCertificateChain(tsToken), null);
+                } catch (Exception e) {
+                    tsaChainNotValidated = true;
+                    tsaChainNotValidatedReason = e;
+                }
+            } catch (Exception e) {
+                if (debug) {
+                    e.printStackTrace();
+                }
+            }
+        }
+
         // no IOException thrown in the follow try clause, so disable
         // the try clause.
         // try {
@@ -1487,8 +1549,10 @@
             }
 
             boolean warningAppeared = false;
-            if (weakAlg != 0 || badKeyUsage || badExtendedKeyUsage || badNetscapeCertType ||
-                    notYetValidCert || chainNotValidated || hasExpiredCert || signerSelfSigned) {
+            if (weakAlg != 0 || badKeyUsage || badExtendedKeyUsage
+                    || badNetscapeCertType || notYetValidCert
+                    || chainNotValidated || tsaChainNotValidated
+                    || hasExpiredCert || signerSelfSigned) {
                 if (strict) {
                     System.out.println(rb.getString("jar.signed.with.signer.errors."));
                     System.out.println();
@@ -1525,10 +1589,16 @@
 
                 if (chainNotValidated) {
                     System.out.println(String.format(
-                            rb.getString("The.signer.s.certificate.chain.is.not.validated.reason.1"),
+                            rb.getString("The.signer.s.certificate.chain.is.invalid.reason.1"),
                             chainNotValidatedReason.getLocalizedMessage()));
                 }
 
+                if (tsaChainNotValidated) {
+                    System.out.println(String.format(
+                            rb.getString("The.tsa.certificate.chain.is.invalid.reason.1"),
+                            tsaChainNotValidatedReason.getLocalizedMessage()));
+                }
+
                 if (signerSelfSigned) {
                     System.out.println(
                             rb.getString("The.signer.s.certificate.is.self.signed."));
@@ -1600,7 +1670,7 @@
     /**
      * Returns a string of singer info, with a newline at the end
      */
-    private String signerInfo(CodeSigner signer, String tab) {
+    private String signerInfo(CodeSigner signer, String tab) throws Exception {
         if (cacheForSignerInfo.containsKey(signer)) {
             return cacheForSignerInfo.get(signer);
         }
@@ -1620,18 +1690,35 @@
         // display the certificate(sb). The first one is end-entity cert and
         // its KeyUsage should be checked.
         boolean first = true;
+        sb.append(tab).append(rb.getString("...Signer")).append('\n');
         for (Certificate c : certs) {
-            sb.append(printCert(tab, c, true, timestamp, first));
+            sb.append(printCert(false, tab, c, timestamp, first));
             sb.append('\n');
             first = false;
         }
         try {
-            validateCertChain(certs);
+            validateCertChain(Validator.VAR_CODE_SIGNING, certs, ts);
         } catch (Exception e) {
             chainNotValidated = true;
             chainNotValidatedReason = e;
-            sb.append(tab).append(rb.getString(".CertPath.not.validated."))
-                    .append(e.getLocalizedMessage()).append("]\n"); // TODO
+            sb.append(tab).append(rb.getString(".Invalid.certificate.chain."))
+                    .append(e.getLocalizedMessage()).append("]\n");
+        }
+        if (ts != null) {
+            sb.append(tab).append(rb.getString("...TSA")).append('\n');
+            for (Certificate c : ts.getSignerCertPath().getCertificates()) {
+                sb.append(printCert(true, tab, c, timestamp, false));
+                sb.append('\n');
+            }
+            try {
+                validateCertChain(Validator.VAR_TSA_SERVER,
+                        ts.getSignerCertPath().getCertificates(), null);
+            } catch (Exception e) {
+                tsaChainNotValidated = true;
+                tsaChainNotValidatedReason = e;
+                sb.append(tab).append(rb.getString(".Invalid.TSA.certificate.chain."))
+                        .append(e.getLocalizedMessage()).append("]\n");
+            }
         }
         if (certs.size() == 1
                 && KeyStoreUtil.isSelfSigned((X509Certificate)certs.get(0))) {
@@ -1841,7 +1928,7 @@
         }
     }
 
-    void getAliasInfo(String alias) {
+    void getAliasInfo(String alias) throws Exception {
 
         Key key = null;
 
@@ -1887,10 +1974,11 @@
 
             // We don't meant to print anything, the next call
             // checks validity and keyUsage etc
-            printCert("", certChain[0], true, null, true);
+            printCert(false, "", certChain[0], null, true);
 
             try {
-                validateCertChain(Arrays.asList(certChain));
+                validateCertChain(Validator.VAR_CODE_SIGNING,
+                        Arrays.asList(certChain), null);
             } catch (Exception e) {
                 chainNotValidated = true;
                 chainNotValidatedReason = e;
@@ -1949,17 +2037,31 @@
         System.exit(1);
     }
 
-    void validateCertChain(List<? extends Certificate> certs) throws Exception {
+    /**
+     * Validates a cert chain.
+     *
+     * @param parameter this might be a timestamp
+     */
+    void validateCertChain(String variant, List<? extends Certificate> certs,
+                           Object parameter)
+            throws Exception {
         try {
             Validator.getInstance(Validator.TYPE_PKIX,
-                    Validator.VAR_CODE_SIGNING,
+                    variant,
                     pkixParameters)
-                    .validate(certs.toArray(new X509Certificate[certs.size()]));
+                    .validate(certs.toArray(new X509Certificate[certs.size()]),
+                            null, parameter);
         } catch (Exception e) {
             if (debug) {
                 e.printStackTrace();
             }
-            if (e instanceof ValidatorException) {
+
+            // Exception might be dismissed if another warning flag
+            // is already set by printCert. This is only done for
+            // code signing certs.
+
+            if (variant.equals(Validator.VAR_CODE_SIGNING) &&
+                    e instanceof ValidatorException) {
                 // Throw cause if it's CertPathValidatorException,
                 if (e.getCause() != null &&
                         e.getCause() instanceof CertPathValidatorException) {
--- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -207,7 +207,8 @@
         {"certificate.is.not.valid.until",
                 "certificate is not valid until {0}"},
         {"certificate.will.expire.on", "certificate will expire on {0}"},
-        {".CertPath.not.validated.", "[CertPath not validated: "},
+        {".Invalid.certificate.chain.", "[Invalid certificate chain: "},
+        {".Invalid.TSA.certificate.chain.", "[Invalid TSA certificate chain: "},
         {"requesting.a.signature.timestamp",
                 "requesting a signature timestamp"},
         {"TSA.location.", "TSA location: "},
@@ -224,6 +225,8 @@
         {"entry.was.signed.on", "entry was signed on {0}"},
         {"Warning.", "Warning: "},
         {"Error.", "Error: "},
+        {"...Signer", ">>> Signer"},
+        {"...TSA", ">>> TSA"},
         {"This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked.",
                 "This jar contains unsigned entries which have not been integrity-checked. "},
         {"This.jar.contains.entries.whose.signer.certificate.has.expired.",
@@ -258,20 +261,26 @@
                  "This jar contains entries whose signer certificate's NetscapeCertType extension doesn't allow code signing."},
         {".{0}.extension.does.not.support.code.signing.",
                  "[{0} extension does not support code signing]"},
-        {"The.signer.s.certificate.chain.is.not.validated.reason.1",
-                "The signer's certificate chain is not validated. Reason: %s"},
+        {"The.signer.s.certificate.chain.is.invalid.reason.1",
+                "The signer's certificate chain is invalid. Reason: %s"},
+        {"The.tsa.certificate.chain.is.invalid.reason.1",
+                "The TSA certificate chain is invalid. Reason: %s"},
         {"The.signer.s.certificate.is.self.signed.",
                 "The signer's certificate is self-signed."},
         {"The.1.algorithm.specified.for.the.2.option.is.considered.a.security.risk.",
                 "The %1$s algorithm specified for the %2$s option is considered a security risk."},
         {"The.1.signing.key.has.a.keysize.of.2.which.is.considered.a.security.risk.",
                 "The %s signing key has a keysize of %d which is considered a security risk."},
-        {"This.jar.contains.entries.whose.certificate.chain.is.not.validated.reason.1",
-                 "This jar contains entries whose certificate chain is not validated. Reason: %s"},
+        {"This.jar.contains.entries.whose.certificate.chain.is.invalid.reason.1",
+                 "This jar contains entries whose certificate chain is invalid. Reason: %s"},
+        {"This.jar.contains.entries.whose.tsa.certificate.chain.is.invalid.reason.1",
+                "This jar contains entries whose TSA certificate chain is invalid. Reason: %s"},
         {"no.timestamp.signing",
                 "No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (%1$tY-%1$tm-%1$td)."},
         {"no.timestamp.verifying",
                 "This jar contains signatures that do not include a timestamp. Without a timestamp, users may not be able to validate this jar after any of the signer certificates expire (as early as %1$tY-%1$tm-%1$td)."},
+        {"bad.timestamp.verifying",
+                "This jar contains signatures that include an invalid timestamp. Without a valid timestamp, users may not be able to validate this jar after any of the signer certificates expire (as early as %1$tY-%1$tm-%1$td).\nRerun jarsigner with -J-Djava.security.debug=jar for more information."},
         {"Unknown.password.type.", "Unknown password type: "},
         {"Cannot.find.environment.variable.",
                 "Cannot find environment variable: "},
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java	Thu Nov 02 22:05:26 2017 +0100
@@ -27,7 +27,9 @@
 import java.lang.module.Configuration;
 import java.lang.module.ModuleFinder;
 import java.nio.ByteOrder;
+import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -146,10 +148,8 @@
      */
     public static final class JlinkConfiguration {
 
-        private final List<Path> modulepaths;
         private final Path output;
         private final Set<String> modules;
-        private final Set<String> limitmods;
         private final ByteOrder endian;
         private final ModuleFinder finder;
 
@@ -157,33 +157,18 @@
          * jlink configuration,
          *
          * @param output Output directory, must not exist.
-         * @param modulepaths Modules paths
          * @param modules The possibly-empty set of root modules to resolve
-         * @param limitmods Limit the universe of observable modules
          * @param endian Jimage byte order. Native order by default
+         * @param finder the ModuleFinder for this configuration
          */
         public JlinkConfiguration(Path output,
-                                  List<Path> modulepaths,
                                   Set<String> modules,
-                                  Set<String> limitmods,
-                                  ByteOrder endian) {
-            if (Objects.requireNonNull(modulepaths).isEmpty()) {
-                throw new IllegalArgumentException("Empty module path");
-            }
-
+                                  ByteOrder endian,
+                                  ModuleFinder finder) {
             this.output = output;
-            this.modulepaths = modulepaths;
             this.modules = Objects.requireNonNull(modules);
-            this.limitmods = Objects.requireNonNull(limitmods);
             this.endian = Objects.requireNonNull(endian);
-            this.finder = moduleFinder();
-        }
-
-        /**
-         * @return the modulepaths
-         */
-        public List<Path> getModulepaths() {
-            return modulepaths;
+            this.finder = finder;
         }
 
         /**
@@ -208,13 +193,6 @@
         }
 
         /**
-         * @return the limitmods
-         */
-        public Set<String> getLimitmods() {
-            return limitmods;
-        }
-
-        /**
          * Returns {@link ModuleFinder} that finds all observable modules
          * for this jlink configuration.
          */
@@ -244,37 +222,16 @@
                                                  modules);
         }
 
-        private ModuleFinder moduleFinder() {
-            Path[] entries = modulepaths.toArray(new Path[0]);
-            ModuleFinder finder = ModulePath.of(Runtime.version(), true, entries);
-            if (!limitmods.isEmpty()) {
-                finder = JlinkTask.limitFinder(finder, limitmods, modules);
-            }
-            return finder;
-        }
-
         @Override
         public String toString() {
             StringBuilder builder = new StringBuilder();
 
             builder.append("output=").append(output).append("\n");
-            StringBuilder pathsBuilder = new StringBuilder();
-            for (Path p : modulepaths) {
-                pathsBuilder.append(p).append(",");
-            }
-            builder.append("modulepaths=").append(pathsBuilder).append("\n");
-
             StringBuilder modsBuilder = new StringBuilder();
             for (String p : modules) {
                 modsBuilder.append(p).append(",");
             }
             builder.append("modules=").append(modsBuilder).append("\n");
-
-            StringBuilder limitsBuilder = new StringBuilder();
-            for (String p : limitmods) {
-                limitsBuilder.append(p).append(",");
-            }
-            builder.append("limitmodules=").append(limitsBuilder).append("\n");
             builder.append("endian=").append(endian).append("\n");
             return builder.toString();
         }
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java	Thu Nov 02 22:05:26 2017 +0100
@@ -251,9 +251,18 @@
                 return EXIT_OK;
             }
 
+
             if (options.modulePath.isEmpty()) {
-                throw taskHelper.newBadArgs("err.modulepath.must.be.specified")
-                                .showUsage(true);
+                // no --module-path specified - try to set $JAVA_HOME/jmods if that exists
+                Path jmods = getDefaultModulePath();
+                if (jmods != null) {
+                    options.modulePath.add(jmods);
+                }
+
+                if (options.modulePath.isEmpty()) {
+                     throw taskHelper.newBadArgs("err.modulepath.must.be.specified")
+                                 .showUsage(true);
+                }
             }
 
             JlinkConfiguration config = initJlinkConfig();
@@ -347,14 +356,7 @@
         Set<String> roots = new HashSet<>();
         for (String mod : options.addMods) {
             if (mod.equals(ALL_MODULE_PATH)) {
-                Path[] entries = options.modulePath.toArray(new Path[0]);
-                ModuleFinder finder = ModulePath.of(Runtime.version(), true, entries);
-                if (!options.limitMods.isEmpty()) {
-                    // finder for the observable modules specified in
-                    // the --module-path and --limit-modules options
-                    finder = limitFinder(finder, options.limitMods, Collections.emptySet());
-                }
-
+                ModuleFinder finder = newModuleFinder(options.modulePath, options.limitMods, Set.of());
                 // all observable modules are roots
                 finder.findAll()
                       .stream()
@@ -366,11 +368,19 @@
             }
         }
 
+        ModuleFinder finder = newModuleFinder(options.modulePath, options.limitMods, roots);
+        if (!finder.find("java.base").isPresent()) {
+            Path defModPath = getDefaultModulePath();
+            if (defModPath != null) {
+                options.modulePath.add(defModPath);
+            }
+            finder = newModuleFinder(options.modulePath, options.limitMods, roots);
+        }
+
         return new JlinkConfiguration(options.output,
-                                      options.modulePath,
                                       roots,
-                                      options.limitMods,
-                                      options.endian);
+                                      options.endian,
+                                      finder);
     }
 
     private void createImage(JlinkConfiguration config) throws Exception {
@@ -398,6 +408,14 @@
         stack.operate(imageProvider);
     }
 
+    /**
+     * @return the system module path or null
+     */
+    public static Path getDefaultModulePath() {
+        Path jmods = Paths.get(System.getProperty("java.home"), "jmods");
+        return Files.isDirectory(jmods)? jmods : null;
+    }
+
     /*
      * Returns a module finder of the given module path that limits
      * the observable modules to those in the transitive closure of
@@ -408,12 +426,15 @@
                                                Set<String> limitMods,
                                                Set<String> roots)
     {
+        if (Objects.requireNonNull(paths).isEmpty()) {
+             throw new IllegalArgumentException("Empty module path");
+        }
         Path[] entries = paths.toArray(new Path[0]);
         ModuleFinder finder = ModulePath.of(Runtime.version(), true, entries);
 
         // if limitmods is specified then limit the universe
-        if (!limitMods.isEmpty()) {
-            finder = limitFinder(finder, limitMods, roots);
+        if (limitMods != null && !limitMods.isEmpty()) {
+            finder = limitFinder(finder, limitMods, Objects.requireNonNull(roots));
         }
         return finder;
     }
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/packager/AppRuntimeImageBuilder.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/packager/AppRuntimeImageBuilder.java	Thu Nov 02 22:05:26 2017 +0100
@@ -96,10 +96,10 @@
         // jlink main arguments
         Jlink.JlinkConfiguration jlinkConfig =
             new Jlink.JlinkConfiguration(new File("").toPath(), // Unused
-                                         modulePath,
                                          addModules,
-                                         limitModules,
-                                         ByteOrder.nativeOrder());
+                                         ByteOrder.nativeOrder(),
+                                         moduleFinder(modulePath,
+                                             limitModules, addModules));
 
         // plugin configuration
         List<Plugin> plugins = new ArrayList<Plugin>();
--- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java	Thu Nov 02 22:05:26 2017 +0100
@@ -237,7 +237,11 @@
                                              .distinct()
                                              .count() == 2;
                 boolean tooManyItems = suggestions.size() > in.getAutoprintThreshold();
-                CompletionTask ordinaryCompletion = new OrdinaryCompletionTask(suggestions, anchor[0], !command && !doc.isEmpty(), hasSmart);
+                CompletionTask ordinaryCompletion =
+                        new OrdinaryCompletionTask(suggestions,
+                                                   anchor[0],
+                                                   !command && !doc.isEmpty(),
+                                                   hasBoth);
                 CompletionTask allCompletion = new AllSuggestionsCompletionTask(suggestions, anchor[0]);
 
                 todo = new ArrayList<>();
@@ -439,16 +443,16 @@
         private final List<Suggestion> suggestions;
         private final int anchor;
         private final boolean cont;
-        private final boolean smart;
+        private final boolean showSmart;
 
         public OrdinaryCompletionTask(List<Suggestion> suggestions,
                                       int anchor,
                                       boolean cont,
-                                      boolean smart) {
+                                      boolean showSmart) {
             this.suggestions = suggestions;
             this.anchor = anchor;
             this.cont = cont;
-            this.smart = smart;
+            this.showSmart = showSmart;
         }
 
         @Override
@@ -460,7 +464,7 @@
         public Result perform(String text, int cursor) throws IOException {
             List<CharSequence> toShow;
 
-            if (smart) {
+            if (showSmart) {
                 toShow =
                     suggestions.stream()
                                .filter(Suggestion::matchesType)
@@ -487,7 +491,7 @@
             String prefixStr = prefix.orElse("").substring(cursor - anchor);
             in.putString(prefixStr);
 
-            boolean showItems = toShow.size() > 1 || smart;
+            boolean showItems = toShow.size() > 1 || showSmart;
 
             if (showItems) {
                 in.println();
@@ -495,7 +499,7 @@
             }
 
             if (!prefixStr.isEmpty())
-                return showItems ? Result.SKIP : Result.SKIP_NOREPAINT;
+                return showItems ? Result.FINISH : Result.SKIP_NOREPAINT;
 
             return cont ? Result.CONTINUE : Result.FINISH;
         }
--- a/test/TestCommon.gmk	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/TestCommon.gmk	Thu Nov 02 22:05:26 2017 +0100
@@ -188,6 +188,16 @@
   CLEAN_ARCHIVE_BUNDLE = @$(RM) $(ARCHIVE_BUNDLE)
 endif
 
+# AddressSanitizer
+ifeq ($(ASAN_ENABLED), yes)
+  export ASAN_OPTIONS="handle_segv=0 detect_leaks=0"
+  JTREG_BASIC_OPTIONS += -e:ASAN_OPTIONS=$(ASAN_OPTIONS)
+  ifneq ($(DEVKIT_LIB_DIR),)
+    export LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(DEVKIT_LIB_DIR)
+    JTREG_BASIC_OPTIONS += -e:LD_LIBRARY_PATH=$(LD_LIBRARY_PATH)
+  endif
+endif
+
 # important results files
 SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt")
 STATS_TXT_NAME = Stats.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/Calendar/Bug8185841.java	Thu Nov 02 22:05:26 2017 +0100
@@ -0,0 +1,278 @@
+/*
+ * 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 8185841
+ * @summary Test that Region dependent Bundles are added/removed correctly.
+ * @modules jdk.localedata
+ */
+
+ /*
+This test is dependent on a particular version of CLDR.
+ */
+import java.net.URI;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+public class Bug8185841 {
+    // Golden data for Region dependent Bundles in CLDR29.
+
+    private static final Set<String> expectedBundles
+            = Set.of("CalendarData_af_NA.class", "CalendarData_af_ZA.class", "CalendarData_agq_CM.class",
+                    "CalendarData_ak_GH.class", "CalendarData_am_ET.class", "CalendarData_ar_AE.class",
+                    "CalendarData_ar_BH.class", "CalendarData_ar_DJ.class", "CalendarData_ar_DZ.class",
+                    "CalendarData_ar_EG.class", "CalendarData_ar_EH.class", "CalendarData_ar_ER.class",
+                    "CalendarData_ar_IL.class", "CalendarData_ar_IQ.class", "CalendarData_ar_JO.class",
+                    "CalendarData_ar_KM.class", "CalendarData_ar_KW.class", "CalendarData_ar_LB.class",
+                    "CalendarData_ar_LY.class", "CalendarData_ar_MA.class", "CalendarData_ar_MR.class",
+                    "CalendarData_ar_OM.class", "CalendarData_ar_PS.class", "CalendarData_ar_QA.class",
+                    "CalendarData_ar_SA.class", "CalendarData_ar_SD.class", "CalendarData_ar_SO.class",
+                    "CalendarData_ar_SS.class", "CalendarData_ar_SY.class", "CalendarData_ar_TD.class",
+                    "CalendarData_ar_TN.class", "CalendarData_ar_YE.class", "CalendarData_as_IN.class",
+                    "CalendarData_asa_TZ.class", "CalendarData_ast_ES.class", "CalendarData_az_AZ.class",
+                    "CalendarData_az_Cyrl_AZ.class", "CalendarData_bas_CM.class", "CalendarData_be_BY.class",
+                    "CalendarData_bem_ZM.class", "CalendarData_bez_TZ.class", "CalendarData_bg_BG.class",
+                    "CalendarData_bm_ML.class", "CalendarData_bn_BD.class", "CalendarData_bn_IN.class",
+                    "CalendarData_bo_CN.class", "CalendarData_bo_IN.class", "CalendarData_br_FR.class",
+                    "CalendarData_brx_IN.class", "CalendarData_bs_BA.class", "CalendarData_bs_Cyrl_BA.class",
+                    "CalendarData_ca_AD.class", "CalendarData_ca_ES.class", "CalendarData_ca_FR.class",
+                    "CalendarData_ca_IT.class", "CalendarData_ce_RU.class", "CalendarData_cgg_UG.class",
+                    "CalendarData_chr_US.class", "CalendarData_ckb_IQ.class", "CalendarData_ckb_IR.class",
+                    "CalendarData_cs_CZ.class", "CalendarData_cu_RU.class", "CalendarData_cy_GB.class",
+                    "CalendarData_da_DK.class", "CalendarData_da_GL.class", "CalendarData_dav_KE.class",
+                    "CalendarData_de_AT.class", "CalendarData_de_BE.class", "CalendarData_de_CH.class",
+                    "CalendarData_de_DE.class", "CalendarData_de_LI.class", "CalendarData_de_LU.class",
+                    "CalendarData_dje_NE.class", "CalendarData_dsb_DE.class", "CalendarData_dua_CM.class",
+                    "CalendarData_dyo_SN.class", "CalendarData_dz_BT.class", "CalendarData_ebu_KE.class",
+                    "CalendarData_ee_GH.class", "CalendarData_ee_TG.class", "CalendarData_el_CY.class",
+                    "CalendarData_el_GR.class", "CalendarData_en_AG.class", "CalendarData_en_AI.class",
+                    "CalendarData_en_AS.class", "CalendarData_en_AT.class", "CalendarData_en_AU.class",
+                    "CalendarData_en_BB.class", "CalendarData_en_BE.class", "CalendarData_en_BI.class",
+                    "CalendarData_en_BM.class", "CalendarData_en_BS.class", "CalendarData_en_BW.class",
+                    "CalendarData_en_BZ.class", "CalendarData_en_CA.class", "CalendarData_en_CC.class",
+                    "CalendarData_en_CH.class", "CalendarData_en_CK.class", "CalendarData_en_CM.class",
+                    "CalendarData_en_CX.class", "CalendarData_en_CY.class", "CalendarData_en_DE.class",
+                    "CalendarData_en_DG.class", "CalendarData_en_DK.class", "CalendarData_en_DM.class",
+                    "CalendarData_en_ER.class", "CalendarData_en_FI.class", "CalendarData_en_FJ.class",
+                    "CalendarData_en_FK.class", "CalendarData_en_FM.class", "CalendarData_en_GB.class",
+                    "CalendarData_en_GD.class", "CalendarData_en_GG.class", "CalendarData_en_GH.class",
+                    "CalendarData_en_GI.class", "CalendarData_en_GM.class", "CalendarData_en_GU.class",
+                    "CalendarData_en_GY.class", "CalendarData_en_HK.class", "CalendarData_en_IE.class",
+                    "CalendarData_en_IL.class", "CalendarData_en_IM.class", "CalendarData_en_IN.class",
+                    "CalendarData_en_IO.class", "CalendarData_en_JE.class", "CalendarData_en_JM.class",
+                    "CalendarData_en_KE.class", "CalendarData_en_KI.class", "CalendarData_en_KN.class",
+                    "CalendarData_en_KY.class", "CalendarData_en_LC.class", "CalendarData_en_LR.class",
+                    "CalendarData_en_LS.class", "CalendarData_en_MG.class", "CalendarData_en_MH.class",
+                    "CalendarData_en_MO.class", "CalendarData_en_MP.class", "CalendarData_en_MS.class",
+                    "CalendarData_en_MT.class", "CalendarData_en_MU.class", "CalendarData_en_MW.class",
+                    "CalendarData_en_MY.class", "CalendarData_en_NA.class", "CalendarData_en_NF.class",
+                    "CalendarData_en_NG.class", "CalendarData_en_NL.class", "CalendarData_en_NR.class",
+                    "CalendarData_en_NU.class", "CalendarData_en_NZ.class", "CalendarData_en_PG.class",
+                    "CalendarData_en_PH.class", "CalendarData_en_PK.class", "CalendarData_en_PN.class",
+                    "CalendarData_en_PR.class", "CalendarData_en_PW.class", "CalendarData_en_RW.class",
+                    "CalendarData_en_SB.class", "CalendarData_en_SC.class", "CalendarData_en_SD.class",
+                    "CalendarData_en_SE.class", "CalendarData_en_SG.class", "CalendarData_en_SH.class",
+                    "CalendarData_en_SI.class", "CalendarData_en_SL.class", "CalendarData_en_SS.class",
+                    "CalendarData_en_SX.class", "CalendarData_en_SZ.class", "CalendarData_en_TC.class",
+                    "CalendarData_en_TK.class", "CalendarData_en_TO.class", "CalendarData_en_TT.class",
+                    "CalendarData_en_TV.class", "CalendarData_en_TZ.class", "CalendarData_en_UG.class",
+                    "CalendarData_en_UM.class", "CalendarData_en_VC.class", "CalendarData_en_VG.class",
+                    "CalendarData_en_VI.class", "CalendarData_en_VU.class", "CalendarData_en_WS.class",
+                    "CalendarData_en_ZA.class", "CalendarData_en_ZM.class", "CalendarData_en_ZW.class",
+                    "CalendarData_es_AR.class", "CalendarData_es_BO.class", "CalendarData_es_BR.class",
+                    "CalendarData_es_CL.class", "CalendarData_es_CO.class", "CalendarData_es_CR.class",
+                    "CalendarData_es_CU.class", "CalendarData_es_DO.class", "CalendarData_es_EA.class",
+                    "CalendarData_es_EC.class", "CalendarData_es_ES.class", "CalendarData_es_GQ.class",
+                    "CalendarData_es_GT.class", "CalendarData_es_HN.class", "CalendarData_es_IC.class",
+                    "CalendarData_es_MX.class", "CalendarData_es_NI.class", "CalendarData_es_PA.class",
+                    "CalendarData_es_PE.class", "CalendarData_es_PH.class", "CalendarData_es_PR.class",
+                    "CalendarData_es_PY.class", "CalendarData_es_SV.class", "CalendarData_es_US.class",
+                    "CalendarData_es_UY.class", "CalendarData_es_VE.class", "CalendarData_et_EE.class",
+                    "CalendarData_eu_ES.class", "CalendarData_ewo_CM.class", "CalendarData_fa_AF.class",
+                    "CalendarData_fa_IR.class", "CalendarData_ff_CM.class", "CalendarData_ff_GN.class",
+                    "CalendarData_ff_MR.class", "CalendarData_ff_SN.class", "CalendarData_fi_FI.class",
+                    "CalendarData_fil_PH.class", "CalendarData_fo_DK.class", "CalendarData_fo_FO.class",
+                    "CalendarData_fr_BE.class", "CalendarData_fr_BF.class", "CalendarData_fr_BI.class",
+                    "CalendarData_fr_BJ.class", "CalendarData_fr_BL.class", "CalendarData_fr_CA.class",
+                    "CalendarData_fr_CD.class", "CalendarData_fr_CF.class", "CalendarData_fr_CG.class",
+                    "CalendarData_fr_CH.class", "CalendarData_fr_CI.class", "CalendarData_fr_CM.class",
+                    "CalendarData_fr_DJ.class", "CalendarData_fr_DZ.class", "CalendarData_fr_FR.class",
+                    "CalendarData_fr_GA.class", "CalendarData_fr_GF.class", "CalendarData_fr_GN.class",
+                    "CalendarData_fr_GP.class", "CalendarData_fr_GQ.class", "CalendarData_fr_HT.class",
+                    "CalendarData_fr_KM.class", "CalendarData_fr_LU.class", "CalendarData_fr_MA.class",
+                    "CalendarData_fr_MC.class", "CalendarData_fr_MF.class", "CalendarData_fr_MG.class",
+                    "CalendarData_fr_ML.class", "CalendarData_fr_MQ.class", "CalendarData_fr_MR.class",
+                    "CalendarData_fr_MU.class", "CalendarData_fr_NC.class", "CalendarData_fr_NE.class",
+                    "CalendarData_fr_PF.class", "CalendarData_fr_PM.class", "CalendarData_fr_RE.class",
+                    "CalendarData_fr_RW.class", "CalendarData_fr_SC.class", "CalendarData_fr_SN.class",
+                    "CalendarData_fr_SY.class", "CalendarData_fr_TD.class", "CalendarData_fr_TG.class",
+                    "CalendarData_fr_TN.class", "CalendarData_fr_VU.class", "CalendarData_fr_WF.class",
+                    "CalendarData_fr_YT.class", "CalendarData_fur_IT.class", "CalendarData_fy_NL.class",
+                    "CalendarData_ga_IE.class", "CalendarData_gd_GB.class", "CalendarData_gl_ES.class",
+                    "CalendarData_gsw_CH.class", "CalendarData_gsw_FR.class", "CalendarData_gsw_LI.class",
+                    "CalendarData_gu_IN.class", "CalendarData_guz_KE.class", "CalendarData_gv_IM.class",
+                    "CalendarData_ha_GH.class", "CalendarData_ha_NE.class", "CalendarData_ha_NG.class",
+                    "CalendarData_haw_US.class", "CalendarData_hi_IN.class", "CalendarData_hr_BA.class",
+                    "CalendarData_hr_HR.class", "CalendarData_hsb_DE.class", "CalendarData_hu_HU.class",
+                    "CalendarData_hy_AM.class", "CalendarData_ig_NG.class", "CalendarData_ii_CN.class",
+                    "CalendarData_in_ID.class", "CalendarData_is_IS.class", "CalendarData_it_CH.class",
+                    "CalendarData_it_IT.class", "CalendarData_it_SM.class", "CalendarData_iw_IL.class",
+                    "CalendarData_ja_JP.class", "CalendarData_jgo_CM.class", "CalendarData_jmc_TZ.class",
+                    "CalendarData_ka_GE.class", "CalendarData_kab_DZ.class", "CalendarData_kam_KE.class",
+                    "CalendarData_kde_TZ.class", "CalendarData_kea_CV.class", "CalendarData_khq_ML.class",
+                    "CalendarData_ki_KE.class", "CalendarData_kk_KZ.class", "CalendarData_kkj_CM.class",
+                    "CalendarData_kl_GL.class", "CalendarData_kln_KE.class", "CalendarData_km_KH.class",
+                    "CalendarData_kn_IN.class", "CalendarData_ko_KP.class", "CalendarData_ko_KR.class",
+                    "CalendarData_kok_IN.class", "CalendarData_ks_IN.class", "CalendarData_ksb_TZ.class",
+                    "CalendarData_ksf_CM.class", "CalendarData_ksh_DE.class", "CalendarData_kw_GB.class",
+                    "CalendarData_ky_KG.class", "CalendarData_lag_TZ.class", "CalendarData_lb_LU.class",
+                    "CalendarData_lg_UG.class", "CalendarData_lkt_US.class", "CalendarData_ln_AO.class",
+                    "CalendarData_ln_CD.class", "CalendarData_ln_CF.class", "CalendarData_ln_CG.class",
+                    "CalendarData_lo_LA.class", "CalendarData_lrc_IQ.class", "CalendarData_lrc_IR.class",
+                    "CalendarData_lt_LT.class", "CalendarData_lu_CD.class", "CalendarData_luo_KE.class",
+                    "CalendarData_luy_KE.class", "CalendarData_lv_LV.class", "CalendarData_mas_KE.class",
+                    "CalendarData_mas_TZ.class", "CalendarData_mer_KE.class", "CalendarData_mfe_MU.class",
+                    "CalendarData_mg_MG.class", "CalendarData_mgh_MZ.class", "CalendarData_mgo_CM.class",
+                    "CalendarData_mk_MK.class", "CalendarData_ml_IN.class", "CalendarData_mn_MN.class",
+                    "CalendarData_mr_IN.class", "CalendarData_ms_BN.class", "CalendarData_ms_MY.class",
+                    "CalendarData_ms_SG.class", "CalendarData_mt_MT.class", "CalendarData_mua_CM.class",
+                    "CalendarData_my_MM.class", "CalendarData_mzn_IR.class", "CalendarData_naq_NA.class",
+                    "CalendarData_nb_NO.class", "CalendarData_nb_SJ.class", "CalendarData_nd_ZW.class",
+                    "CalendarData_ne_IN.class", "CalendarData_ne_NP.class", "CalendarData_nl_AW.class",
+                    "CalendarData_nl_BE.class", "CalendarData_nl_BQ.class", "CalendarData_nl_CW.class",
+                    "CalendarData_nl_NL.class", "CalendarData_nl_SR.class", "CalendarData_nl_SX.class",
+                    "CalendarData_nmg_CM.class", "CalendarData_nnh_CM.class", "CalendarData_nus_SS.class",
+                    "CalendarData_nyn_UG.class", "CalendarData_om_ET.class", "CalendarData_om_KE.class",
+                    "CalendarData_or_IN.class", "CalendarData_os_GE.class", "CalendarData_os_RU.class",
+                    "CalendarData_pa_Arab_PK.class", "CalendarData_pa_IN.class", "CalendarData_pa_PK.class",
+                    "CalendarData_pl_PL.class", "CalendarData_ps_AF.class", "CalendarData_pt_AO.class",
+                    "CalendarData_pt_BR.class", "CalendarData_pt_CV.class", "CalendarData_pt_GQ.class",
+                    "CalendarData_pt_GW.class", "CalendarData_pt_MO.class", "CalendarData_pt_MZ.class",
+                    "CalendarData_pt_PT.class", "CalendarData_pt_ST.class", "CalendarData_pt_TL.class",
+                    "CalendarData_qu_BO.class", "CalendarData_qu_EC.class", "CalendarData_qu_PE.class",
+                    "CalendarData_rm_CH.class", "CalendarData_rn_BI.class", "CalendarData_ro_MD.class",
+                    "CalendarData_ro_RO.class", "CalendarData_rof_TZ.class", "CalendarData_ru_BY.class",
+                    "CalendarData_ru_KG.class", "CalendarData_ru_KZ.class", "CalendarData_ru_MD.class",
+                    "CalendarData_ru_RU.class", "CalendarData_ru_UA.class", "CalendarData_rw_RW.class",
+                    "CalendarData_rwk_TZ.class", "CalendarData_sah_RU.class", "CalendarData_saq_KE.class",
+                    "CalendarData_sbp_TZ.class", "CalendarData_se_FI.class", "CalendarData_se_NO.class",
+                    "CalendarData_se_SE.class", "CalendarData_seh_MZ.class", "CalendarData_ses_ML.class",
+                    "CalendarData_sg_CF.class", "CalendarData_shi_Latn_MA.class", "CalendarData_shi_MA.class",
+                    "CalendarData_si_LK.class", "CalendarData_sk_SK.class", "CalendarData_sl_SI.class",
+                    "CalendarData_smn_FI.class", "CalendarData_sn_ZW.class", "CalendarData_so_DJ.class",
+                    "CalendarData_so_ET.class", "CalendarData_so_KE.class", "CalendarData_so_SO.class",
+                    "CalendarData_sq_AL.class", "CalendarData_sq_MK.class", "CalendarData_sq_XK.class",
+                    "CalendarData_sr_BA.class", "CalendarData_sr_Latn_BA.class", "CalendarData_sr_Latn_ME.class",
+                    "CalendarData_sr_Latn_RS.class", "CalendarData_sr_Latn_XK.class", "CalendarData_sr_ME.class",
+                    "CalendarData_sr_RS.class", "CalendarData_sr_XK.class", "CalendarData_sv_AX.class",
+                    "CalendarData_sv_FI.class", "CalendarData_sv_SE.class", "CalendarData_sw_CD.class",
+                    "CalendarData_sw_KE.class", "CalendarData_sw_TZ.class", "CalendarData_sw_UG.class",
+                    "CalendarData_ta_IN.class", "CalendarData_ta_LK.class", "CalendarData_ta_MY.class",
+                    "CalendarData_ta_SG.class", "CalendarData_te_IN.class", "CalendarData_teo_KE.class",
+                    "CalendarData_teo_UG.class", "CalendarData_th_TH.class", "CalendarData_ti_ER.class",
+                    "CalendarData_ti_ET.class", "CalendarData_tk_TM.class", "CalendarData_to_TO.class",
+                    "CalendarData_tr_CY.class", "CalendarData_tr_TR.class", "CalendarData_twq_NE.class",
+                    "CalendarData_tzm_MA.class", "CalendarData_ug_CN.class", "CalendarData_uk_UA.class",
+                    "CalendarData_ur_IN.class", "CalendarData_ur_PK.class", "CalendarData_uz_AF.class",
+                    "CalendarData_uz_Arab_AF.class", "CalendarData_uz_Cyrl_UZ.class", "CalendarData_uz_UZ.class",
+                    "CalendarData_vai_LR.class", "CalendarData_vai_Latn_LR.class", "CalendarData_vi_VN.class",
+                    "CalendarData_vun_TZ.class", "CalendarData_wae_CH.class", "CalendarData_xog_UG.class",
+                    "CalendarData_yav_CM.class", "CalendarData_yo_BJ.class", "CalendarData_yo_NG.class",
+                    "CalendarData_yue_HK.class", "CalendarData_zgh_MA.class", "CalendarData_zh_CN.class",
+                    "CalendarData_zh_HK.class", "CalendarData_zh_Hant_HK.class", "CalendarData_zh_Hant_TW.class",
+                    "CalendarData_zh_MO.class", "CalendarData_zh_SG.class", "CalendarData_zh_TW.class", "CalendarData_zu_ZA.class");
+
+    private static Set<String> removedBundles = Set.of(
+            "CalendarData_az_Latn_AZ.class", "CalendarData_bs_Latn_BA.class",
+            "CalendarData_pa_Guru_IN.class", "CalendarData_shi_Tfng_MA.class",
+            "CalendarData_sr_Cyrl_BA.class", "CalendarData_sr_Cyrl_ME.class",
+            "CalendarData_sr_Cyrl_RS.class", "CalendarData_sr_Cyrl_XK.class",
+            "CalendarData_uz_Latn_UZ.class", "CalendarData_vai_Vaii_LR.class",
+            "CalendarData_zh_Hans_CN.class", "CalendarData_zh_Hans_HK.class",
+            "CalendarData_zh_Hans_MO.class", "CalendarData_zh_Hans_SG.class");
+
+    private static Set<String> addedBundles = Set.of(
+            "CalendarData_az_AZ.class", "CalendarData_bs_BA.class",
+            "CalendarData_pa_IN.class", "CalendarData_pa_PK.class",
+            "CalendarData_shi_MA.class", "CalendarData_sr_BA.class",
+            "CalendarData_sr_ME.class", "CalendarData_sr_RS.class",
+            "CalendarData_sr_XK.class", "CalendarData_uz_UZ.class",
+            "CalendarData_uz_AF.class", "CalendarData_vai_LR.class",
+            "CalendarData_zh_CN.class", "CalendarData_zh_HK.class",
+            "CalendarData_zh_MO.class", "CalendarData_zh_SG.class", "CalendarData_zh_TW.class");
+
+    private static Set<String> retrievedBundles = Collections.EMPTY_SET;
+
+    public static void main(String[] args) throws Exception {
+        FileSystem fs = FileSystems.newFileSystem(URI.create("jrt:/"),
+                Collections.emptyMap());
+        Path path = fs.getPath("/", "modules", "jdk.localedata", "sun/util/resources/cldr/ext");
+        retrievedBundles = Files.walk(path)
+                                .map(p -> p.getFileName().toString())
+                                .filter(p -> p.startsWith("CalendarData_"))
+                                .collect(Collectors.toSet());
+        if (!retrievedBundles.equals(expectedBundles)) {
+            checkAddedBundles();
+            checkRemovedBundles();
+            Set<String> retrievedBundlesSet = new HashSet<>(retrievedBundles);
+            retrievedBundlesSet.removeAll(expectedBundles);
+            throw new RuntimeException("Unexpected "
+                    + " bundles " + retrievedBundlesSet + " are present in jdk.localedata module ");
+
+        }
+    }
+
+    /**
+     * This method checks that bundles which have been additionally generated
+     * are present in jdk.localedata module.
+     */
+    private static void checkAddedBundles() {
+        Set<String> addedBundlesSet = new HashSet<>(addedBundles);
+        addedBundlesSet.removeAll(retrievedBundles);
+        if (!addedBundlesSet.isEmpty()) {
+            throw new RuntimeException("expected CalendarData"
+                    + " bundles " + addedBundlesSet + " are not present in jdk.localedata module ");
+        }
+
+    }
+
+    /**
+     * This method checks that bundles which have been removed are not present
+     * in jdk.localedata module.
+     */
+    private static void checkRemovedBundles() {
+        Set<String> unexpectedBundles = removedBundles.stream().
+                filter(retrievedBundles::contains).collect(Collectors.toSet());
+        if (!unexpectedBundles.isEmpty()) {
+            throw new RuntimeException("Unexpected CalendarData"
+                    + " bundles " + unexpectedBundles + " are present in jdk.localedata module ");
+        }
+    }
+}
--- a/test/jdk/ProblemList.txt	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/jdk/ProblemList.txt	Thu Nov 02 22:05:26 2017 +0100
@@ -316,8 +316,12 @@
 
 com/sun/jndi/ldap/DeadSSLLdapTimeoutTest.java                   8169942 linux-i586,macosx-all,windows-x64
 
-javax/rmi/PortableRemoteObject/8146975/RmiIiopReturnValueTest.java 8169737 linux-all
-
+javax/rmi/PortableRemoteObject/8146975/RmiIiopReturnValueTest.java 8169737 generic-all
+ 
 org/omg/CORBA/OrbPropertiesTest.java			        8175177 generic-all
 
+javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java       8080643 generic-all
+
+javax/rmi/ssl/SSLSocketParametersTest.sh                        8162906 generic-all
+
 ############################################################################
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/invoke/StringConcatFactory/BasicTest.java	Thu Nov 02 22:05:26 2017 +0100
@@ -0,0 +1,102 @@
+/*
+ * 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 8187089
+ * @run main BasicTest
+ */
+
+import java.lang.invoke.*;
+import java.util.Arrays;
+
+public class BasicTest {
+    static final int MAX_PARAM_SLOTS = 200;
+    static int exceedMaxParamSlots = 0;
+    public static void main(String[] args) throws Throwable {
+        int expectionTestCases = 0;
+
+        Class<?>[] types = new Class<?>[200];
+        Arrays.fill(types, int.class);
+        test(MethodType.methodType(String.class, types));
+
+        types = new Class<?>[100];
+        Arrays.fill(types, long.class);
+        test(MethodType.methodType(String.class, types));
+
+        // test cases exceeding 200 parameter slots
+        expectionTestCases++;
+        types = new Class<?>[101];
+        Arrays.fill(types, 0, 50, long.class);
+        Arrays.fill(types, 50, 100, double.class);
+        types[100] = int.class;
+        test(MethodType.methodType(String.class, types));
+
+        expectionTestCases++;
+        types = new Class<?>[201];
+        Arrays.fill(types, int.class);
+        test(MethodType.methodType(String.class, types));
+
+        if (exceedMaxParamSlots != expectionTestCases) {
+            throw new RuntimeException("expected one test case exceeding 200 param slots");
+        }
+    }
+
+    /**
+     * Tests if StringConcatException is thrown if the given concatType
+     * has more than 200 parameter slots
+     */
+    static void test(MethodType concatType) throws StringConcatException {
+        String recipe = "";
+        int slots = 0;
+        for (Class<?> c : concatType.parameterList()) {
+            recipe += "\1";
+            slots++;
+            if (c == double.class || c == long.class) {
+                slots++;
+            }
+        }
+        if (slots > MAX_PARAM_SLOTS) {
+            exceedMaxParamSlots++;
+        }
+        System.out.format("Test %s parameter slots%n", slots);
+        try {
+            StringConcatFactory.makeConcat(MethodHandles.lookup(), "name", concatType);
+            if (slots > MAX_PARAM_SLOTS) {
+                throw new RuntimeException("StringConcatException not thrown");
+            }
+        } catch (StringConcatException e) {
+            if (slots <= MAX_PARAM_SLOTS) throw e;
+        }
+
+        try {
+            StringConcatFactory.makeConcatWithConstants(MethodHandles.lookup(), "name",
+                                                        concatType, recipe);
+            if (slots > MAX_PARAM_SLOTS) {
+                throw new RuntimeException("StringConcatException not thrown");
+            }
+        } catch (StringConcatException e) {
+            if (slots <= MAX_PARAM_SLOTS) throw e;
+        }
+    }
+}
--- a/test/jdk/java/rmi/testlibrary/TestSocketFactory.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/jdk/java/rmi/testlibrary/TestSocketFactory.java	Thu Nov 02 22:05:26 2017 +0100
@@ -249,18 +249,22 @@
         /**
          * Set the trigger, match, and replacement bytes.
          * The trigger, match, and replacements are propagated to the
-         * MatchReplaceOutputStream.
+         * MatchReplaceOutputStream, if it has been created.
          *
          * @param triggerBytes array of bytes to use as a trigger, may be zero length
          * @param matchBytes bytes to match after the trigger has been seen
          * @param replaceBytes bytes to replace the matched bytes
          */
-        public void setMatchReplaceBytes(byte[] triggerBytes, byte[] matchBytes,
+        public synchronized void setMatchReplaceBytes(byte[] triggerBytes, byte[] matchBytes,
                                          byte[] replaceBytes) {
             this.triggerBytes = triggerBytes;
             this.matchBytes = matchBytes;
             this.replaceBytes = replaceBytes;
-            out.setMatchReplaceBytes(triggerBytes, matchBytes, replaceBytes);
+            if (out != null) {
+                out.setMatchReplaceBytes(triggerBytes, matchBytes, replaceBytes);
+            } else {
+                DEBUG("InterposeSocket.setMatchReplaceBytes with out == null%n");
+            }
         }
 
         @Override
@@ -360,7 +364,7 @@
                 String name = Thread.currentThread().getName() + ": "
                         + socket.getLocalPort() + " <  " + socket.getPort();
                 in = new LoggingInputStream(in, name, inLogStream);
-                DEBUG("Created new InterposeInputStream: %s%n", name);
+                DEBUG("Created new LoggingInputStream: %s%n", name);
             }
             return in;
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/Properties/InitialCapacity.java	Thu Nov 02 22:05:26 2017 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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 java.util.Properties;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8189319
+ * @summary Test that Properties(int initialCapacity) throws exceptions (or
+            doesn't) as expected
+ * @run testng InitialCapacity
+ */
+public class InitialCapacity {
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void negativeInitCap() { Properties p = new Properties(-1); }
+
+    @Test
+    public void positiveInitCap() { Properties p = new Properties(10); }
+}
--- a/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/CollectAndSummaryStatisticsTest.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/CollectAndSummaryStatisticsTest.java	Thu Nov 02 22:05:26 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, 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
@@ -24,7 +24,7 @@
 /*
  * @test
  * @summary primtive stream collection with summary statistics
- * @bug 8044047
+ * @bug 8044047 8178117
  */
 
 package org.openjdk.tests.java.util.stream;
@@ -91,11 +91,19 @@
         instances.add(countTo(1000).stream().mapToInt(i -> i).collect(IntSummaryStatistics::new,
                                                                       IntSummaryStatistics::accept,
                                                                       IntSummaryStatistics::combine));
+        instances.add(countTo(1000).stream().mapToInt(i -> i).collect(() -> new IntSummaryStatistics(0, -1, 1001, 2),
+                                                                      IntSummaryStatistics::accept,
+                                                                      IntSummaryStatistics::combine));
         instances.add(countTo(1000).parallelStream().collect(Collectors.summarizingInt(i -> i)));
         instances.add(countTo(1000).parallelStream().mapToInt(i -> i).summaryStatistics());
         instances.add(countTo(1000).parallelStream().mapToInt(i -> i).collect(IntSummaryStatistics::new,
                                                                               IntSummaryStatistics::accept,
                                                                               IntSummaryStatistics::combine));
+        instances.add(countTo(1000).parallelStream().mapToInt(i -> i).collect(() -> new IntSummaryStatistics(0, -1, 1001, 2),
+                                                                              IntSummaryStatistics::accept,
+                                                                              IntSummaryStatistics::combine));
+        IntSummaryStatistics original = instances.get(0);
+        instances.add(new IntSummaryStatistics(original.getCount(), original.getMin(), original.getMax(), original.getSum()));
 
         for (IntSummaryStatistics stats : instances) {
             assertEquals(stats.getCount(), 1000);
@@ -104,6 +112,9 @@
             assertEquals(stats.getMax(), 1000);
             assertEquals(stats.getMin(), 1);
         }
+
+        expectThrows(IllegalArgumentException.class, () -> new IntSummaryStatistics(-1, 0, 0, 0));
+        expectThrows(IllegalArgumentException.class, () -> new IntSummaryStatistics(1, 3, 2, 0));
     }
 
 
@@ -114,11 +125,19 @@
         instances.add(countTo(1000).stream().mapToLong(i -> i).collect(LongSummaryStatistics::new,
                                                                        LongSummaryStatistics::accept,
                                                                        LongSummaryStatistics::combine));
+        instances.add(countTo(1000).stream().mapToInt(i -> i).collect(() -> new LongSummaryStatistics(0, -1, 1001, 2),
+                                                                      LongSummaryStatistics::accept,
+                                                                      LongSummaryStatistics::combine));
         instances.add(countTo(1000).parallelStream().collect(Collectors.summarizingLong(i -> i)));
         instances.add(countTo(1000).parallelStream().mapToLong(i -> i).summaryStatistics());
         instances.add(countTo(1000).parallelStream().mapToLong(i -> i).collect(LongSummaryStatistics::new,
                                                                                LongSummaryStatistics::accept,
                                                                                LongSummaryStatistics::combine));
+        instances.add(countTo(1000).parallelStream().mapToInt(i -> i).collect(() -> new LongSummaryStatistics(0, -1, 1001, 2),
+                                                                              LongSummaryStatistics::accept,
+                                                                              LongSummaryStatistics::combine));
+        LongSummaryStatistics original = instances.get(0);
+        instances.add(new LongSummaryStatistics(original.getCount(), original.getMin(), original.getMax(), original.getSum()));
 
         for (LongSummaryStatistics stats : instances) {
             assertEquals(stats.getCount(), 1000);
@@ -127,6 +146,9 @@
             assertEquals(stats.getMax(), 1000L);
             assertEquals(stats.getMin(), 1L);
         }
+
+        expectThrows(IllegalArgumentException.class, () -> new LongSummaryStatistics(-1, 0, 0, 0));
+        expectThrows(IllegalArgumentException.class, () -> new LongSummaryStatistics(1, 3, 2, 0));
     }
 
     public void testDoubleStatistics() {
@@ -136,11 +158,19 @@
         instances.add(countTo(1000).stream().mapToDouble(i -> i).collect(DoubleSummaryStatistics::new,
                                                                          DoubleSummaryStatistics::accept,
                                                                          DoubleSummaryStatistics::combine));
+        instances.add(countTo(1000).stream().mapToInt(i -> i).collect(() -> new DoubleSummaryStatistics(0, -1, 1001, 2),
+                                                                      DoubleSummaryStatistics::accept,
+                                                                      DoubleSummaryStatistics::combine));
         instances.add(countTo(1000).parallelStream().collect(Collectors.summarizingDouble(i -> i)));
         instances.add(countTo(1000).parallelStream().mapToDouble(i -> i).summaryStatistics());
         instances.add(countTo(1000).parallelStream().mapToDouble(i -> i).collect(DoubleSummaryStatistics::new,
                                                                                  DoubleSummaryStatistics::accept,
                                                                                  DoubleSummaryStatistics::combine));
+        instances.add(countTo(1000).parallelStream().mapToInt(i -> i).collect(() -> new DoubleSummaryStatistics(0, -1, 1001, 2),
+                                                                              DoubleSummaryStatistics::accept,
+                                                                              DoubleSummaryStatistics::combine));
+        DoubleSummaryStatistics original = instances.get(0);
+        instances.add(new DoubleSummaryStatistics(original.getCount(), original.getMin(), original.getMax(), original.getSum()));
 
         for (DoubleSummaryStatistics stats : instances) {
             assertEquals(stats.getCount(), 1000);
@@ -149,5 +179,18 @@
             assertEquals(stats.getMax(), 1000.0);
             assertEquals(stats.getMin(), 1.0);
         }
+
+        expectThrows(IllegalArgumentException.class, () -> new DoubleSummaryStatistics(-1, 0, 0, 0));
+        expectThrows(IllegalArgumentException.class, () -> new DoubleSummaryStatistics(1, 3, 2, 0));
+        double[] values = {1.0, Double.NaN};
+        for (var min : values) {
+            for (var max : values) {
+                for (var sum : values) {
+                    if (Double.isNaN(min) && Double.isNaN(max) && Double.isNaN(sum)) continue;
+                    if (!Double.isNaN(min) && !Double.isNaN(max) && !Double.isNaN(sum)) continue;
+                    expectThrows(IllegalArgumentException.class, () -> new DoubleSummaryStatistics(1, min, max, sum));
+                }
+            }
+        }
     }
 }
--- a/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java	Thu Nov 02 22:05:26 2017 +0100
@@ -22,6 +22,8 @@
  */
 
 import com.sun.net.httpserver.*;
+
+import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
@@ -35,16 +37,17 @@
 import java.security.PrivateKey;
 import java.security.Signature;
 import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.List;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.*;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
 import jdk.test.lib.SecurityTools;
-import jdk.testlibrary.*;
+import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.util.JarUtils;
 import sun.security.pkcs.ContentInfo;
 import sun.security.pkcs.PKCS7;
@@ -59,7 +62,7 @@
 
 /*
  * @test
- * @bug 6543842 6543440 6939248 8009636 8024302 8163304 8169911
+ * @bug 6543842 6543440 6939248 8009636 8024302 8163304 8169911 8180289
  * @summary checking response of timestamp
  * @modules java.base/sun.security.pkcs
  *          java.base/sun.security.timestamp
@@ -123,12 +126,12 @@
         byte[] sign(byte[] input, String path) throws Exception {
 
             DerValue value = new DerValue(input);
-            System.err.println("\nIncoming Request\n===================");
-            System.err.println("Version: " + value.data.getInteger());
+            System.out.println("\nIncoming Request\n===================");
+            System.out.println("Version: " + value.data.getInteger());
             DerValue messageImprint = value.data.getDerValue();
             AlgorithmId aid = AlgorithmId.parse(
                     messageImprint.data.getDerValue());
-            System.err.println("AlgorithmId: " + aid);
+            System.out.println("AlgorithmId: " + aid);
 
             ObjectIdentifier policyId = new ObjectIdentifier(defaultPolicyId);
             BigInteger nonce = null;
@@ -136,23 +139,22 @@
                 DerValue v = value.data.getDerValue();
                 if (v.tag == DerValue.tag_Integer) {
                     nonce = v.getBigInteger();
-                    System.err.println("nonce: " + nonce);
+                    System.out.println("nonce: " + nonce);
                 } else if (v.tag == DerValue.tag_Boolean) {
-                    System.err.println("certReq: " + v.getBoolean());
+                    System.out.println("certReq: " + v.getBoolean());
                 } else if (v.tag == DerValue.tag_ObjectId) {
                     policyId = v.getOID();
-                    System.err.println("PolicyID: " + policyId);
+                    System.out.println("PolicyID: " + policyId);
                 }
             }
 
-            System.err.println("\nResponse\n===================");
+            System.out.println("\nResponse\n===================");
             KeyStore ks = KeyStore.getInstance(
                     new File(keystore), "changeit".toCharArray());
 
-            String alias = "ts";
-            if (path.startsWith("bad") || path.equals("weak")) {
-                alias = "ts" + path;
-            }
+            // If path starts with "ts", use the TSA it points to.
+            // Otherwise, always use "ts".
+            String alias = path.startsWith("ts") ? path : "ts";
 
             if (path.equals("diffpolicy")) {
                 policyId = new ObjectIdentifier(defaultPolicyId);
@@ -199,8 +201,11 @@
 
             tst.putInteger(1);
 
-            Calendar cal = Calendar.getInstance();
-            tst.putGeneralizedTime(cal.getTime());
+            Instant instant = Instant.now();
+            if (path.equals("tsold")) {
+                instant = instant.minus(20, ChronoUnit.DAYS);
+            }
+            tst.putGeneralizedTime(Date.from(instant));
 
             if (path.equals("diffnonce")) {
                 tst.putInteger(1234);
@@ -227,10 +232,10 @@
                     "1.2.840.113549.1.9.16.1.4"),
                     new DerValue(tstInfo2.toByteArray()));
 
-            System.err.println("Signing...");
-            System.err.println(new X500Name(signer
+            System.out.println("Signing...");
+            System.out.println(new X500Name(signer
                     .getIssuerX500Principal().getName()));
-            System.err.println(signer.getSerialNumber());
+            System.out.println(signer.getSerialNumber());
 
             SignerInfo signerInfo = new SignerInfo(
                     new X500Name(signer.getIssuerX500Principal().getName()),
@@ -303,23 +308,51 @@
 
         prepare();
 
-        try (Handler tsa = Handler.init(0, "tsks");) {
+        try (Handler tsa = Handler.init(0, "ks");) {
             tsa.start();
             int port = tsa.getPort();
             host = "http://localhost:" + port + "/";
 
             if (args.length == 0) {         // Run this test
-                sign("none")
+
+                sign("normal")
+                        .shouldNotContain("Warning")
+                        .shouldHaveExitValue(0);
+
+                verify("normal.jar")
+                        .shouldNotContain("Warning")
+                        .shouldHaveExitValue(0);
+
+                // Simulate signing at a previous date:
+                // 1. tsold will create a timestamp of 20 days ago.
+                // 2. oldsigner expired 10 days ago.
+                // jarsigner will show a warning at signing.
+                signVerbose("tsold", "unsigned.jar", "tsold.jar", "oldsigner")
+                        .shouldHaveExitValue(4);
+
+                // It verifies perfectly.
+                verify("tsold.jar", "-verbose", "-certs")
+                        .shouldNotContain("Warning")
+                        .shouldHaveExitValue(0);
+
+                signVerbose(null, "unsigned.jar", "none.jar", "signer")
                         .shouldContain("is not timestamped")
                         .shouldHaveExitValue(0);
 
-                sign("badku")
-                        .shouldHaveExitValue(0);
+                signVerbose(null, "unsigned.jar", "badku.jar", "badku")
+                        .shouldHaveExitValue(8);
                 checkBadKU("badku.jar");
 
-                sign("normal")
-                        .shouldNotContain("is not timestamped")
-                        .shouldHaveExitValue(0);
+                // 8180289: unvalidated TSA cert chain
+                sign("tsnoca")
+                        .shouldContain("TSA certificate chain is invalid")
+                        .shouldHaveExitValue(64);
+
+                verify("tsnoca.jar", "-verbose", "-certs")
+                        .shouldHaveExitValue(64)
+                        .shouldContain("jar verified")
+                        .shouldContain("Invalid TSA certificate chain")
+                        .shouldContain("TSA certificate chain is invalid");
 
                 sign("nononce")
                         .shouldHaveExitValue(1);
@@ -331,11 +364,11 @@
                         .shouldHaveExitValue(1);
                 sign("fullchain")
                         .shouldHaveExitValue(0);   // Success, 6543440 solved.
-                sign("bad1")
+                sign("tsbad1")
                         .shouldHaveExitValue(1);
-                sign("bad2")
+                sign("tsbad2")
                         .shouldHaveExitValue(1);
-                sign("bad3")
+                sign("tsbad3")
                         .shouldHaveExitValue(1);
                 sign("nocert")
                         .shouldHaveExitValue(1);
@@ -347,116 +380,173 @@
                 sign("diffpolicy", "-tsapolicyid", "1.2.3")
                         .shouldHaveExitValue(1);
 
-                sign("tsaalg", "-tsadigestalg", "SHA")
+                sign("sha1alg", "-tsadigestalg", "SHA")
                         .shouldHaveExitValue(0);
-                checkTimestamp("tsaalg.jar", defaultPolicyId, "SHA-1");
+                checkTimestamp("sha1alg.jar", defaultPolicyId, "SHA-1");
 
-                sign("weak", "-digestalg", "MD5",
+                sign("tsweak", "-digestalg", "MD5",
                                 "-sigalg", "MD5withRSA", "-tsadigestalg", "MD5")
-                        .shouldHaveExitValue(0)
+                        .shouldHaveExitValue(68)
                         .shouldMatch("MD5.*-digestalg.*risk")
                         .shouldMatch("MD5.*-tsadigestalg.*risk")
                         .shouldMatch("MD5withRSA.*-sigalg.*risk");
-                checkWeak("weak.jar");
+                checkWeak("tsweak.jar");
 
-                signWithAliasAndTsa("halfWeak", "old.jar", "old", "-digestalg", "MD5")
-                        .shouldHaveExitValue(0);
+                signVerbose("tsweak", "unsigned.jar", "tsweak2.jar", "signer")
+                        .shouldHaveExitValue(64)
+                        .shouldContain("TSA certificate chain is invalid");
+
+                // Weak timestamp is an error and jar treated unsigned
+                verify("tsweak2.jar", "-verbose")
+                        .shouldHaveExitValue(16)
+                        .shouldContain("treated as unsigned")
+                        .shouldMatch("Timestamp.*512.*weak");
+
+                signVerbose("normal", "unsigned.jar", "halfWeak.jar", "signer",
+                        "-digestalg", "MD5")
+                        .shouldHaveExitValue(4);
                 checkHalfWeak("halfWeak.jar");
 
                 // sign with DSA key
-                signWithAliasAndTsa("sign1", "old.jar", "dsakey")
+                signVerbose("normal", "unsigned.jar", "sign1.jar", "dsakey")
                         .shouldHaveExitValue(0);
                 // sign with RSAkeysize < 1024
-                signWithAliasAndTsa("sign2", "sign1.jar", "weakkeysize")
-                        .shouldHaveExitValue(0);
+                signVerbose("normal", "sign1.jar", "sign2.jar", "weakkeysize")
+                        .shouldHaveExitValue(4);
                 checkMultiple("sign2.jar");
 
                 // When .SF or .RSA is missing or invalid
                 checkMissingOrInvalidFiles("normal.jar");
+
+                if (Files.exists(Paths.get("ts2.cert"))) {
+                    checkInvalidTsaCertKeyUsage();
+                }
             } else {                        // Run as a standalone server
-                System.err.println("Press Enter to quit server");
+                System.out.println("Press Enter to quit server");
                 System.in.read();
             }
         }
     }
 
+    private static void checkInvalidTsaCertKeyUsage() throws Exception {
+
+        // Hack: Rewrite the TSA cert inside normal.jar into ts2.jar.
+
+        // Both the cert and the serial number must be rewritten.
+        byte[] tsCert = Files.readAllBytes(Paths.get("ts.cert"));
+        byte[] ts2Cert = Files.readAllBytes(Paths.get("ts2.cert"));
+        byte[] tsSerial = getCert(tsCert)
+                .getSerialNumber().toByteArray();
+        byte[] ts2Serial = getCert(ts2Cert)
+                .getSerialNumber().toByteArray();
+
+        byte[] oldBlock;
+        try (JarFile normal = new JarFile("normal.jar")) {
+            oldBlock = normal.getInputStream(
+                    normal.getJarEntry("META-INF/SIGNER.RSA")).readAllBytes();
+        }
+
+        JarUtils.updateJar("normal.jar", "ts2.jar",
+                Map.of("META-INF/SIGNER.RSA",
+                        updateBytes(updateBytes(oldBlock, tsCert, ts2Cert),
+                                tsSerial, ts2Serial)));
+
+        verify("ts2.jar", "-verbose", "-certs")
+                .shouldHaveExitValue(64)
+                .shouldContain("jar verified")
+                .shouldContain("Invalid TSA certificate chain: Extended key usage does not permit use for TSA server");
+    }
+
+    public static X509Certificate getCert(byte[] data)
+            throws CertificateException, IOException {
+        return (X509Certificate)
+                CertificateFactory.getInstance("X.509")
+                        .generateCertificate(new ByteArrayInputStream(data));
+    }
+
+    private static byte[] updateBytes(byte[] old, byte[] from, byte[] to) {
+        int pos = 0;
+        while (true) {
+            if (pos + from.length > old.length) {
+                return null;
+            }
+            if (Arrays.equals(Arrays.copyOfRange(old, pos, pos+from.length), from)) {
+                byte[] result = old.clone();
+                System.arraycopy(to, 0, result, pos, from.length);
+                return result;
+            }
+            pos++;
+        }
+    }
+
     private static void checkMissingOrInvalidFiles(String s)
             throws Throwable {
-        JarUtils.updateJar(s, "1.jar", "-", "META-INF/OLD.SF");
+
+        JarUtils.updateJar(s, "1.jar", Map.of("META-INF/SIGNER.SF", Boolean.FALSE));
         verify("1.jar", "-verbose")
-                .shouldHaveExitValue(0)
+                .shouldHaveExitValue(16)
                 .shouldContain("treated as unsigned")
-                .shouldContain("Missing signature-related file META-INF/OLD.SF");
-        JarUtils.updateJar(s, "2.jar", "-", "META-INF/OLD.RSA");
+                .shouldContain("Missing signature-related file META-INF/SIGNER.SF");
+        JarUtils.updateJar(s, "2.jar", Map.of("META-INF/SIGNER.RSA", Boolean.FALSE));
         verify("2.jar", "-verbose")
-                .shouldHaveExitValue(0)
+                .shouldHaveExitValue(16)
                 .shouldContain("treated as unsigned")
-                .shouldContain("Missing block file for signature-related file META-INF/OLD.SF");
-        JarUtils.updateJar(s, "3.jar", "META-INF/OLD.SF");
+                .shouldContain("Missing block file for signature-related file META-INF/SIGNER.SF");
+        JarUtils.updateJar(s, "3.jar", Map.of("META-INF/SIGNER.SF", "dummy"));
         verify("3.jar", "-verbose")
-                .shouldHaveExitValue(0)
+                .shouldHaveExitValue(16)
                 .shouldContain("treated as unsigned")
-                .shouldContain("Unparsable signature-related file META-INF/OLD.SF");
-        JarUtils.updateJar(s, "4.jar", "META-INF/OLD.RSA");
+                .shouldContain("Unparsable signature-related file META-INF/SIGNER.SF");
+        JarUtils.updateJar(s, "4.jar", Map.of("META-INF/SIGNER.RSA", "dummy"));
         verify("4.jar", "-verbose")
-                .shouldHaveExitValue(0)
+                .shouldHaveExitValue(16)
                 .shouldContain("treated as unsigned")
-                .shouldContain("Unparsable signature-related file META-INF/OLD.RSA");
+                .shouldContain("Unparsable signature-related file META-INF/SIGNER.RSA");
     }
 
     static OutputAnalyzer jarsigner(List<String> extra)
-            throws Throwable {
-        JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jarsigner")
-                .addVMArg("-Duser.language=en")
-                .addVMArg("-Duser.country=US")
-                .addToolArg("-keystore")
-                .addToolArg("tsks")
-                .addToolArg("-storepass")
-                .addToolArg("changeit");
-        for (String s : extra) {
-            if (s.startsWith("-J")) {
-                launcher.addVMArg(s.substring(2));
-            } else {
-                launcher.addToolArg(s);
-            }
-        }
-        return ProcessTools.executeCommand(launcher.getCommand());
+            throws Exception {
+        List<String> args = new ArrayList<>(
+                List.of("-keystore", "ks", "-storepass", "changeit"));
+        args.addAll(extra);
+        return SecurityTools.jarsigner(args);
     }
 
     static OutputAnalyzer verify(String file, String... extra)
-            throws Throwable {
+            throws Exception {
         List<String> args = new ArrayList<>();
         args.add("-verify");
+        args.add("-strict");
         args.add(file);
         args.addAll(Arrays.asList(extra));
         return jarsigner(args);
     }
 
-    static void checkBadKU(String file) throws Throwable {
+    static void checkBadKU(String file) throws Exception {
         verify(file)
-                .shouldHaveExitValue(0)
+                .shouldHaveExitValue(16)
                 .shouldContain("treated as unsigned")
                 .shouldContain("re-run jarsigner with debug enabled");
         verify(file, "-verbose")
-                .shouldHaveExitValue(0)
+                .shouldHaveExitValue(16)
                 .shouldContain("Signed by")
                 .shouldContain("treated as unsigned")
                 .shouldContain("re-run jarsigner with debug enabled");
         verify(file, "-J-Djava.security.debug=jar")
-                .shouldHaveExitValue(0)
+                .shouldHaveExitValue(16)
                 .shouldContain("SignatureException: Key usage restricted")
                 .shouldContain("treated as unsigned")
                 .shouldContain("re-run jarsigner with debug enabled");
     }
 
-    static void checkWeak(String file) throws Throwable {
+    static void checkWeak(String file) throws Exception {
         verify(file)
-                .shouldHaveExitValue(0)
+                .shouldHaveExitValue(16)
                 .shouldContain("treated as unsigned")
                 .shouldMatch("weak algorithm that is now disabled.")
                 .shouldMatch("Re-run jarsigner with the -verbose option for more details");
         verify(file, "-verbose")
-                .shouldHaveExitValue(0)
+                .shouldHaveExitValue(16)
                 .shouldContain("treated as unsigned")
                 .shouldMatch("weak algorithm that is now disabled by")
                 .shouldMatch("Digest algorithm: .*weak")
@@ -465,14 +555,14 @@
                 .shouldNotMatch("Timestamp signature algorithm: .*weak.*weak")
                 .shouldMatch("Timestamp signature algorithm: .*key.*weak");
         verify(file, "-J-Djava.security.debug=jar")
-                .shouldHaveExitValue(0)
+                .shouldHaveExitValue(16)
                 .shouldMatch("SignatureException:.*disabled");
 
         // For 8171319: keytool should print out warnings when reading or
         //              generating cert/cert req using weak algorithms.
         // Must call keytool the command, otherwise doPrintCert() might not
         // be able to reset "jdk.certpath.disabledAlgorithms".
-        String sout = SecurityTools.keytool("-printcert -jarfile weak.jar")
+        String sout = SecurityTools.keytool("-printcert -jarfile " + file)
                 .stderrShouldContain("The TSA certificate uses a 512-bit RSA key" +
                         " which is considered a security risk.")
                 .getStdout();
@@ -481,14 +571,14 @@
         }
     }
 
-    static void checkHalfWeak(String file) throws Throwable {
+    static void checkHalfWeak(String file) throws Exception {
         verify(file)
-                .shouldHaveExitValue(0)
+                .shouldHaveExitValue(16)
                 .shouldContain("treated as unsigned")
                 .shouldMatch("weak algorithm that is now disabled.")
                 .shouldMatch("Re-run jarsigner with the -verbose option for more details");
         verify(file, "-verbose")
-                .shouldHaveExitValue(0)
+                .shouldHaveExitValue(16)
                 .shouldContain("treated as unsigned")
                 .shouldMatch("weak algorithm that is now disabled by")
                 .shouldMatch("Digest algorithm: .*weak")
@@ -498,7 +588,7 @@
                 .shouldNotMatch("Timestamp signature algorithm: .*key.*weak");
      }
 
-    static void checkMultiple(String file) throws Throwable {
+    static void checkMultiple(String file) throws Exception {
         verify(file)
                 .shouldHaveExitValue(0)
                 .shouldContain("jar verified");
@@ -515,7 +605,7 @@
     static void checkTimestamp(String file, String policyId, String digestAlg)
             throws Exception {
         try (JarFile jf = new JarFile(file)) {
-            JarEntry je = jf.getJarEntry("META-INF/OLD.RSA");
+            JarEntry je = jf.getJarEntry("META-INF/SIGNER.RSA");
             try (InputStream is = jf.getInputStream(je)) {
                 byte[] content = is.readAllBytes();
                 PKCS7 p7 = new PKCS7(content);
@@ -541,22 +631,32 @@
     static int which = 0;
 
     /**
+     * Sign with a TSA path. Always use alias "signer" to sign "unsigned.jar".
+     * The signed jar name is always path.jar.
+     *
      * @param extra more args given to jarsigner
      */
     static OutputAnalyzer sign(String path, String... extra)
-            throws Throwable {
-        String alias = path.equals("badku") ? "badku" : "old";
-        return signWithAliasAndTsa(path, "old.jar", alias, extra);
+            throws Exception {
+        return signVerbose(
+                path,
+                "unsigned.jar",
+                path + ".jar",
+                "signer",
+                extra);
     }
 
-    static OutputAnalyzer signWithAliasAndTsa (String path, String jar,
-            String alias, String...extra) throws Throwable {
+    static OutputAnalyzer signVerbose(
+            String path,    // TSA URL path
+            String oldJar,
+            String newJar,
+            String alias,   // signer
+            String...extra) throws Exception {
         which++;
-        System.err.println("\n>> Test #" + which + ": " + Arrays.toString(extra));
-        List<String> args = List.of("-J-Djava.security.egd=file:/dev/./urandom",
-                "-debug", "-signedjar", path + ".jar", jar, alias);
-        args = new ArrayList<>(args);
-        if (!path.equals("none") && !path.equals("badku")) {
+        System.out.println("\n>> Test #" + which);
+        List<String> args = new ArrayList<>(List.of(
+                "-strict", "-verbose", "-debug", "-signedjar", newJar, oldJar, alias));
+        if (path != null) {
             args.add("-tsa");
             args.add(host + path);
         }
@@ -565,24 +665,50 @@
     }
 
     static void prepare() throws Exception {
-        JarUtils.createJar("old.jar", "A");
-        Files.deleteIfExists(Paths.get("tsks"));
-        keytool("-alias ca -genkeypair -ext bc -dname CN=CA");
-        keytool("-alias old -genkeypair -dname CN=old");
+        JarUtils.createJar("unsigned.jar", "A");
+        Files.deleteIfExists(Paths.get("ks"));
+        keytool("-alias signer -genkeypair -ext bc -dname CN=signer");
+        keytool("-alias oldsigner -genkeypair -dname CN=oldsigner");
         keytool("-alias dsakey -genkeypair -keyalg DSA -dname CN=dsakey");
         keytool("-alias weakkeysize -genkeypair -keysize 512 -dname CN=weakkeysize");
         keytool("-alias badku -genkeypair -dname CN=badku");
         keytool("-alias ts -genkeypair -dname CN=ts");
-        keytool("-alias tsweak -genkeypair -keysize 512 -dname CN=tsbad1");
+        keytool("-alias tsold -genkeypair -dname CN=tsold");
+        keytool("-alias tsweak -genkeypair -keysize 512 -dname CN=tsweak");
         keytool("-alias tsbad1 -genkeypair -dname CN=tsbad1");
         keytool("-alias tsbad2 -genkeypair -dname CN=tsbad2");
         keytool("-alias tsbad3 -genkeypair -dname CN=tsbad3");
+        keytool("-alias tsnoca -genkeypair -dname CN=tsnoca");
 
-        gencert("old");
+        // tsnoca's issuer will be removed from keystore later
+        keytool("-alias ca -genkeypair -ext bc -dname CN=CA");
+        gencert("tsnoca", "-ext eku:critical=ts");
+        keytool("-delete -alias ca");
+        keytool("-alias ca -genkeypair -ext bc -dname CN=CA -startdate -40d");
+
+        gencert("signer");
+        gencert("oldsigner", "-startdate -30d -validity 20");
         gencert("dsakey");
         gencert("weakkeysize");
         gencert("badku", "-ext ku:critical=keyAgreement");
         gencert("ts", "-ext eku:critical=ts");
+
+
+        // Issue another cert for "ts" with a different EKU.
+        // Length should be the same. Try several times.
+        keytool("-gencert -alias ca -infile ts.req -outfile ts2.cert " +
+                "-ext eku:critical=1.3.6.1.5.5.7.3.9");
+        for (int i = 0; i < 5; i++) {
+            if (Files.size(Paths.get("ts.cert")) != Files.size(Paths.get("ts2.cert"))) {
+                Files.delete(Paths.get("ts2.cert"));
+                System.out.println("Warning: cannot create same length");
+            } else {
+                break;
+            }
+        }
+
+        gencert("tsold", "-ext eku:critical=ts -startdate -40d -validity 45");
+
         gencert("tsweak", "-ext eku:critical=ts");
         gencert("tsbad1");
         gencert("tsbad2", "-ext eku=ts");
@@ -601,7 +727,7 @@
     }
 
     static void keytool(String cmd) throws Exception {
-        cmd = "-keystore tsks -storepass changeit -keypass changeit " +
+        cmd = "-keystore ks -storepass changeit -keypass changeit " +
                 "-keyalg rsa -validity 200 " + cmd;
         sun.security.tools.keytool.Main.main(cmd.split(" "));
     }
--- a/test/jdk/sun/security/tools/jarsigner/Warning.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/jdk/sun/security/tools/jarsigner/Warning.java	Thu Nov 02 22:05:26 2017 +0100
@@ -83,14 +83,14 @@
 
         issueCert("b", "-sigalg MD5withRSA");
         run("jarsigner", "a.jar b")
-                .shouldMatch("chain is not validated. Reason:.*MD5withRSA");
+                .shouldMatch("chain is invalid. Reason:.*MD5withRSA");
 
         recreateJar();
 
         newCert("c", "-keysize 512");
         issueCert("c");
         run("jarsigner", "a.jar c")
-                .shouldContain("chain is not validated. " +
+                .shouldContain("chain is invalid. " +
                         "Reason: Algorithm constraints check failed");
 
         recreateJar();
--- a/test/jdk/sun/security/tools/jarsigner/checkusage.sh	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/jdk/sun/security/tools/jarsigner/checkusage.sh	Thu Nov 02 22:05:26 2017 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 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
@@ -91,7 +91,7 @@
 #[ $RESULT = 0 ] || exit 2
 
 # Test 3: When no keystore is specified, the error is only
-# "chain not validated"
+# "chain invalid"
 
 $JARSIGNER -strict -verify a.jar
 RESULT=$?
@@ -99,7 +99,7 @@
 #[ $RESULT = 4 ] || exit 3
 
 # Test 4: When unrelated keystore is specified, the error is
-# "chain not validated" and "not alias in keystore"
+# "chain invalid" and "not alias in keystore"
 
 $JARSIGNER -keystore unrelated.jks -strict -verify a.jar
 RESULT=$?
--- a/test/jdk/sun/security/tools/jarsigner/warnings/Test.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/jdk/sun/security/tools/jarsigner/warnings/Test.java	Thu Nov 02 22:05:26 2017 +0100
@@ -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
@@ -63,7 +63,7 @@
 
     static final String CHAIN_NOT_VALIDATED_VERIFYING_WARNING
             = "This jar contains entries "
-            + "whose certificate chain is not validated.";
+            + "whose certificate chain is invalid.";
 
     static final String ALIAS_NOT_IN_STORE_VERIFYING_WARNING
             = "This jar contains signed entries "
@@ -95,7 +95,7 @@
             + "doesn't allow code signing.";
 
     static final String CHAIN_NOT_VALIDATED_SIGNING_WARNING
-            = "The signer's certificate chain is not validated.";
+            = "The signer's certificate chain is invalid.";
 
     static final String HAS_EXPIRING_CERT_SIGNING_WARNING
             = "The signer certificate will expire within six months.";
--- a/test/jdk/sun/security/tools/jarsigner/weaksize.sh	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/jdk/sun/security/tools/jarsigner/weaksize.sh	Thu Nov 02 22:05:26 2017 +0100
@@ -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
@@ -54,9 +54,9 @@
 $JAR cvf a.jar ks
 
 # We always trust a TrustedCertificateEntry
-$JS a.jar ca | grep "chain is not validated" && exit 1
+$JS a.jar ca | grep "chain is invalid" && exit 1
 
 # An end-entity cert must follow algorithm constraints
-$JS a.jar signer | grep "chain is not validated" || exit 2
+$JS a.jar signer | grep "chain is invalid" || exit 2
 
 exit 0
--- a/test/jdk/sun/text/resources/LocaleData.cldr	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/jdk/sun/text/resources/LocaleData.cldr	Thu Nov 02 22:05:26 2017 +0100
@@ -8300,3 +8300,82 @@
 FormatData/kea/latn.NumberElements/1=\u00a0
 FormatData/kea_CV/latn.NumberElements/0=,
 FormatData/kea_CV/latn.NumberElements/1=\u00a0
+
+# bug #8185841
+
+CalendarData/az-Latn-AZ/firstDayOfWeek=2
+CalendarData/az-Latn-AZ/minimalDaysInFirstWeek=1
+CalendarData/az-Cyrl-AZ/firstDayOfWeek=2
+CalendarData/az-Cyrl-AZ/minimalDaysInFirstWeek=1
+CalendarData/az_AZ/firstDayOfWeek=2
+CalendarData/az-AZ/minimalDaysInFirstWeek=1
+CalendarData/bs-Cyrl-BA/firstDayOfWeek=2
+CalendarData/bs-Cyrl-BA/minimalDaysInFirstWeek=1
+CalendarData/bs_BA/firstDayOfWeek=2
+CalendarData/bs_BA/minimalDaysInFirstWeek=1
+CalendarData/pa-Arab-PK/firstDayOfWeek=1
+CalendarData/pa-Arab-PK/minimalDaysInFirstWeek=1
+CalendarData/pa_PK/firstDayOfWeek=1
+CalendarData/pa_PK/minimalDaysInFirstWeek=1
+CalendarData/pa-Guru-IN/firstDayOfWeek=1
+CalendarData/pa-Guru-IN/minimalDaysInFirstWeek=1
+CalendarData/pa_IN/firstDayOfWeek=1
+CalendarData/pa_IN/minimalDaysInFirstWeek=1
+CalendarData/shi-Latn-MA/firstDayOfWeek=7
+CalendarData/shi-Latn-MA/minimalDaysInFirstWeek=1
+CalendarData/shi-Tfng-MA/firstDayOfWeek=7
+CalendarData/shi-Tfng-MA/minimalDaysInFirstWeek=1
+CalendarData/shi_MA/firstDayOfWeek=7
+CalendarData/shi_MA/minimalDaysInFirstWeek=1
+CalendarData/sr-Cyrl-BA/firstDayOfWeek=2
+CalendarData/sr-Cyrl-BA/minimalDaysInFirstWeek=1
+CalendarData/sr-Cyrl-ME/firstDayOfWeek=2
+CalendarData/sr-Cyrl-ME/minimalDaysInFirstWeek=1
+CalendarData/sr-Cyrl-RS/firstDayOfWeek=2
+CalendarData/sr-Cyrl-RS/minimalDaysInFirstWeek=1
+CalendarData/sr-Cyrl-XK/firstDayOfWeek=2
+CalendarData/sr-Cyrl-XK/minimalDaysInFirstWeek=1
+CalendarData/sr_RS/firstDayOfWeek=2
+CalendarData/sr_RS/minimalDaysInFirstWeek=1
+CalendarData/sr_BA/firstDayOfWeek=2
+CalendarData/sr_BA/minimalDaysInFirstWeek=1
+CalendarData/sr_ME/firstDayOfWeek=2
+CalendarData/sr_ME/minimalDaysInFirstWeek=1
+CalendarData/sr_XK/firstDayOfWeek=2
+CalendarData/sr_XK/minimalDaysInFirstWeek=1
+CalendarData/uz-Arab-AF/firstDayOfWeek=7
+CalendarData/uz-Arab-AF/minimalDaysInFirstWeek=1
+CalendarData/uz-Cyrl-UZ/firstDayOfWeek=2
+CalendarData/uz-Cyrl-UZ/minimalDaysInFirstWeek=1
+CalendarData/uz-Latn-UZ/firstDayOfWeek=2
+CalendarData/uz-Latn-UZ/minimalDaysInFirstWeek=1
+CalendarData/vai-Latn-LR/firstDayOfWeek=2
+CalendarData/vai-Latn-LR/minimalDaysInFirstWeek=1
+CalendarData/vai-Vaii-LR/firstDayOfWeek=2
+CalendarData/vai-Vaii-LR/minimalDaysInFirstWeek=1
+CalendarData/vai_LR/firstDayOfWeek=2
+CalendarData/vai_LR/minimalDaysInFirstWeek=1
+CalendarData/uz_UZ/firstDayOfWeek=2
+CalendarData/uz_UZ/minimalDaysInFirstWeek=1
+CalendarData/zh_CN/firstDayOfWeek=1
+CalendarData/zh_CN/minimalDaysInFirstWeek=1
+CalendarData/zh-Hans-CN/minimalDaysInFirstWeek=1
+CalendarData/zh-Hans-CN/firstDayOfWeek=1
+CalendarData/zh-Hans-HK/firstDayOfWeek=1
+CalendarData/zh-Hans-HK/minimalDaysInFirstWeek=1
+CalendarData/zh-Hans-MO/minimalDaysInFirstWeek=1
+CalendarData/zh-Hans-MO/firstDayOfWeek=1
+CalendarData/zh-Hans-SG/firstDayOfWeek=1
+CalendarData/zh-Hans-SG/minimalDaysInFirstWeek=1
+CalendarData/zh-Hant-HK/minimalDaysInFirstWeek=1
+CalendarData/zh-Hant-HK/firstDayOfWeek=1
+CalendarData/zh-Hant-TW/minimalDaysInFirstWeek=1
+CalendarData/zh-Hant-TW/firstDayOfWeek=1
+CalendarData/zh_HK/minimalDaysInFirstWeek=1
+CalendarData/zh_HK/firstDayOfWeek=1
+CalendarData/zh_MO/minimalDaysInFirstWeek=1
+CalendarData/zh_MO/firstDayOfWeek=1
+CalendarData/zh_SG/minimalDaysInFirstWeek=1
+CalendarData/zh_SG/firstDayOfWeek=1
+CalendarData/zh_TW/firstDayOfWeek=1
+CalendarData/zh_TW/minimalDaysInFirstWeek=1
--- a/test/jdk/sun/text/resources/LocaleDataTest.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/jdk/sun/text/resources/LocaleDataTest.java	Thu Nov 02 22:05:26 2017 +0100
@@ -37,7 +37,7 @@
  *      7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509
  *      7114053 7074882 7040556 8008577 8013836 8021121 6192407 6931564 8027695
  *      8017142 8037343 8055222 8042126 8074791 8075173 8080774 8129361 8134916
- *      8145136 8145952 8164784 8037111 8081643 7037368 8178872
+ *      8145136 8145952 8164784 8037111 8081643 7037368 8178872 8185841
  * @summary Verify locale data
  * @modules java.base/sun.util.resources
  * @modules jdk.localedata
--- a/test/jdk/tools/jlink/IntegrationTest.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/jdk/tools/jlink/IntegrationTest.java	Thu Nov 02 22:05:26 2017 +0100
@@ -39,6 +39,7 @@
 import java.util.Set;
 import java.util.function.Function;
 import jdk.tools.jlink.internal.Jlink;
+import jdk.tools.jlink.internal.JlinkTask;
 import jdk.tools.jlink.builder.DefaultImageBuilder;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolBuilder;
@@ -159,7 +160,8 @@
         Set<String> limits = new HashSet<>();
         limits.add("java.management");
         JlinkConfiguration config = new Jlink.JlinkConfiguration(output,
-                modulePaths, mods, limits, ByteOrder.nativeOrder());
+                mods, ByteOrder.nativeOrder(),
+                JlinkTask.newModuleFinder(modulePaths, limits, mods));
 
         List<Plugin> lst = new ArrayList<>();
 
--- a/test/jdk/tools/jlink/JLinkTest.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/jdk/tools/jlink/JLinkTest.java	Thu Nov 02 22:05:26 2017 +0100
@@ -42,6 +42,7 @@
 /*
  * @test
  * @summary Test image creation
+ * @bug 8189777
  * @author Jean-Francois Denise
  * @library ../lib
  * @modules java.base/jdk.internal.jimage
@@ -106,6 +107,37 @@
         }
 
         {
+            // No --module-path specified. $JAVA_HOME/jmods should be assumed.
+            // The following should succeed as it uses only system modules.
+            String imageDir = "bug818977-no-modulepath";
+            JImageGenerator.getJLinkTask()
+                    .output(helper.createNewImageDir(imageDir))
+                    .addMods("jdk.scripting.nashorn")
+                    .call().assertSuccess();
+        }
+
+        {
+            // invalid --module-path specified. java.base not found it it.
+            // $JAVA_HOME/jmods should be added automatically.
+            // The following should succeed as it uses only system modules.
+            String imageDir = "bug8189777-invalid-modulepath";
+            JImageGenerator.getJLinkTask()
+                    .modulePath("does_not_exist_path")
+                    .output(helper.createNewImageDir(imageDir))
+                    .addMods("jdk.scripting.nashorn")
+                    .call().assertSuccess();
+        }
+
+        {
+            // No --module-path specified. --add-modules ALL-MODULE-PATH specified.
+            String imageDir = "bug8189777-all-module-path";
+            JImageGenerator.getJLinkTask()
+                    .output(helper.createNewImageDir(imageDir))
+                    .addMods("ALL-MODULE-PATH")
+                    .call().assertSuccess();
+        }
+
+        {
             String moduleName = "bug8134651";
             JImageGenerator.getJLinkTask()
                     .modulePath(helper.defaultModulePath())
@@ -122,6 +154,17 @@
                     .output(helper.createNewImageDir(moduleName))
                     .addMods("leaf1")
                     .call().assertFailure("Error: no value given for --module-path");
+            // do not include standard module path - should be added automatically
+            JImageGenerator.getJLinkTask()
+                    .modulePath(helper.defaultModulePath(false))
+                    .output(helper.createNewImageDir(moduleName))
+                    .addMods("leaf1")
+                    .call().assertSuccess();
+            // no --module-path. default sys mod path is assumed - but that won't contain 'leaf1' module
+            JImageGenerator.getJLinkTask()
+                    .output(helper.createNewImageDir(moduleName))
+                    .addMods("leaf1")
+                    .call().assertFailure("Error: Module leaf1 not found");
         }
 
         {
--- a/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java	Thu Nov 02 22:05:26 2017 +0100
@@ -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
@@ -40,7 +40,7 @@
 
 /*
  * @test
- * @bug 8152143 8152704 8155649 8165804
+ * @bug 8152143 8152704 8155649 8165804 8185841
  * @summary IncludeLocalesPlugin tests
  * @author Naoto Sato
  * @library ../../lib
@@ -231,7 +231,7 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_IN.class",
                 "/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_kok_IN.class",
-                "/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_pa_Guru_IN.class"),
+                "/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_pa_IN.class"),
             List.of(
                 "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/thai_dict",
@@ -327,7 +327,7 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"),
             List.of(
                 "(root)", "en", "en_US", "en_US_POSIX", "zh", "zh__#Hans", "zh_CN",
-                "zh_CN_#Hans", "zh_HK_#Hans", "zh_MO_#Hans", "zh_SG", "zh_SG_#Hans"),
+                "zh_HK", "zh_MO", "zh_CN_#Hans", "zh_HK_#Hans", "zh_MO_#Hans", "zh_SG", "zh_SG_#Hans"),
             "",
         },
 
--- a/test/jdk/tools/lib/tests/Helper.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/jdk/tools/lib/tests/Helper.java	Thu Nov 02 22:05:26 2017 +0100
@@ -136,7 +136,11 @@
     }
 
     public String defaultModulePath() {
-        return stdjmods.toAbsolutePath().toString() + File.pathSeparator
+        return defaultModulePath(true);
+    }
+
+    public String defaultModulePath(boolean includeStdMods) {
+        return (includeStdMods? stdjmods.toAbsolutePath().toString() : "") + File.pathSeparator
                 + jmods.toAbsolutePath().toString() + File.pathSeparator
                 + jars.toAbsolutePath().toString() + File.pathSeparator
                 + explodedmodsclasses.toAbsolutePath().toString();
--- a/test/langtools/jdk/jshell/ToolTabCommandTest.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/langtools/jdk/jshell/ToolTabCommandTest.java	Thu Nov 02 22:05:26 2017 +0100
@@ -84,10 +84,6 @@
             inputSink.write("\u0003/env \011");
             waitOutput(out, "\u0005/env -\n" +
                             "-add-exports    -add-modules    -class-path     -module-path    \n" +
-                            "\r\u0005/env -");
-
-            inputSink.write("\011");
-            waitOutput(out, "-add-exports    -add-modules    -class-path     -module-path    \n" +
                             "\n" +
                             Pattern.quote(getResource("jshell.console.see.synopsis")) + "\n" +
                             "\r\u0005/env -");
--- a/test/langtools/jdk/jshell/ToolTabSnippetTest.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/langtools/jdk/jshell/ToolTabSnippetTest.java	Thu Nov 02 22:05:26 2017 +0100
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 8177076 8185426
+ * @bug 8177076 8185426 8189595
  * @modules
  *     jdk.compiler/com.sun.tools.javac.api
  *     jdk.compiler/com.sun.tools.javac.main
@@ -227,6 +227,31 @@
         });
     }
 
+    public void testNoRepeat() throws Exception {
+        doRunTest((inputSink, out) -> {
+            inputSink.write("String xyzAA;\n");
+            waitOutput(out, "\u0005");
+
+            //xyz<tab>
+            inputSink.write("String s = xyz\011");
+            waitOutput(out, "^String s = xyzAA");
+            inputSink.write(".");
+            waitOutput(out, "^\\.");
+
+            inputSink.write("\u0003");
+            waitOutput(out, "\u0005");
+
+            inputSink.write("double xyzAB;\n");
+            waitOutput(out, "\u0005");
+
+            //xyz<tab>
+            inputSink.write("String s = xyz\011");
+            String allCompletions =
+                    Pattern.quote(getResource("jshell.console.completion.all.completions"));
+            waitOutput(out, ".*xyzAA.*" + allCompletions + ".*\u0005String s = xyzA");
+        });
+    }
+
     private Path prepareZip() {
         String clazz1 =
                 "package jshelltest;\n" +
--- a/test/langtools/tools/javac/diags/examples/PatchModuleWithRelease/PatchModuleWithRelease.java	Thu Oct 26 22:05:30 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-
-// key: compiler.err.patch.module.with.release
-// options: --release 9
-
-class PatchModuleWithRelease {
-}
--- a/test/langtools/tools/javac/diags/examples/PatchModuleWithRelease/patchmodule/java.base/java/lang/Test.java	Thu Oct 26 22:05:30 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * 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 java.lang;
-
-class Test {
-}
--- a/test/langtools/tools/javac/options/release/ReleaseOptionUnsupported.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/langtools/tools/javac/options/release/ReleaseOptionUnsupported.java	Thu Nov 02 22:05:26 2017 +0100
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 8178152
+ * @bug 8178152 8187681
  * @summary Verify unsupported modules and module options handling.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
@@ -263,35 +263,19 @@
         tb.createDirectories(patch);
 
         new JavacTask(tb)
-                .options("-XDrawDiagnostics",
-                         "--patch-module", "java.base=" + patch)
+                .options("--patch-module", "java.base=" + patch)
                 .outdir(classes)
                 .files(tb.findJavaFiles(src))
                 .run(Expect.SUCCESS)
-                .writeAll()
-                .getOutputLines(Task.OutputKind.DIRECT);
+                .writeAll();
 
-        List<String> log;
-        List<String> expected;
-
-        log = new JavacTask(tb)
-                .options("-XDrawDiagnostics",
-                         "--patch-module", "java.base=" + patch,
+        new JavacTask(tb)
+                .options("--patch-module", "java.base=" + patch,
                          "--release", Target.DEFAULT.multiReleaseValue())
                 .outdir(classes)
                 .files(tb.findJavaFiles(src))
-                .run(Expect.FAIL)
-                .writeAll()
-                .getOutputLines(Task.OutputKind.DIRECT);
-
-        expected = Arrays.asList(
-                "- compiler.err.patch.module.with.release: java.base",
-                "1 error"
-        );
-
-        if (!expected.equals(log)) {
-            throw new AssertionError("Unexpected output: " + log);
-        }
+                .run(Expect.SUCCESS)
+                .writeAll();
 
         //OK to patch a non-system module:
         tb.createDirectories(classes);
--- a/test/langtools/tools/javac/tree/NoPrivateTypesExported.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/langtools/tools/javac/tree/NoPrivateTypesExported.java	Thu Nov 02 22:05:26 2017 +0100
@@ -206,6 +206,33 @@
                 }
                 return null;
             }
+            @Override public Void visitBoolean(boolean b, Void p) {
+                return null;
+            }
+            @Override public Void visitByte(byte b, Void p) {
+                return null;
+            }
+            @Override public Void visitChar(char c, Void p) {
+                return null;
+            }
+            @Override public Void visitDouble(double d, Void p) {
+                return null;
+            }
+            @Override public Void visitFloat(float f, Void p) {
+                return null;
+            }
+            @Override public Void visitInt(int i, Void p) {
+                return null;
+            }
+            @Override public Void visitLong(long i, Void p) {
+                return null;
+            }
+            @Override public Void visitShort(short s, Void p) {
+                return null;
+            }
+            @Override public Void visitString(String s, Void p) {
+                return null;
+            }
             @Override protected Void defaultAction(Object o, Void p) {
                 error("Unexpected AnnotationValue: " + o.toString());
                 return super.defaultAction(o, p);
--- a/test/lib/jdk/test/lib/SecurityTools.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/lib/jdk/test/lib/SecurityTools.java	Thu Nov 02 22:05:26 2017 +0100
@@ -52,10 +52,7 @@
                 launcher.addToolArg(arg);
             }
         }
-        String[] cmds = launcher.getCommand();
-        String cmdLine = Arrays.stream(cmds).collect(Collectors.joining(" "));
-        System.out.println("Command line: [" + cmdLine + "]");
-        return new ProcessBuilder(cmds);
+        return new ProcessBuilder(launcher.getCommand());
     }
 
     // keytool
@@ -72,7 +69,7 @@
         pb.redirectInput(ProcessBuilder.Redirect.from(new File(RESPONSE_FILE)));
 
         try {
-            return ProcessTools.executeProcess(pb);
+            return execute(pb);
         } finally {
             Files.delete(p);
         }
@@ -102,8 +99,21 @@
 
     public static OutputAnalyzer jarsigner(List<String> args)
             throws Exception {
-        return ProcessTools.executeProcess(
-                getProcessBuilder("jarsigner", args));
+        return execute(getProcessBuilder("jarsigner", args));
+    }
+
+    private static OutputAnalyzer execute(ProcessBuilder pb) throws Exception {
+        try {
+            OutputAnalyzer oa = ProcessTools.executeCommand(pb);
+            System.out.println("Exit value: " + oa.getExitValue());
+            return oa;
+        } catch (Throwable t) {
+            if (t instanceof Exception) {
+                throw (Exception) t;
+            } else {
+                throw new Exception(t);
+            }
+        }
     }
 
     // Only call this if there is no white space in every argument
--- a/test/lib/jdk/test/lib/util/JarUtils.java	Thu Oct 26 22:05:30 2017 +0200
+++ b/test/lib/jdk/test/lib/util/JarUtils.java	Thu Nov 02 22:05:26 2017 +0100
@@ -27,9 +27,13 @@
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.util.ArrayList;
+import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Enumeration;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.jar.JarOutputStream;
@@ -79,70 +83,93 @@
      */
     public static void updateJar(String src, String dest, String... files)
             throws IOException {
+        Map<String,Object> changes = new HashMap<>();
+        boolean update = true;
+        for (String file : files) {
+            if (file.equals("-")) {
+                update = false;
+            } else if (update) {
+                try {
+                    Path p = Paths.get(file);
+                    if (Files.exists(p)) {
+                        changes.put(file, p);
+                    } else {
+                        changes.put(file, file);
+                    }
+                } catch (InvalidPathException e) {
+                    // Fallback if file not a valid Path.
+                    changes.put(file, file);
+                }
+            } else {
+                changes.put(file, Boolean.FALSE);
+            }
+        }
+        updateJar(src, dest, changes);
+    }
+
+    /**
+     * Update content of a jar file.
+     *
+     * @param src the original jar file name
+     * @param dest the new jar file name
+     * @param changes a map of changes, key is jar entry name, value is content.
+     *                Value can be Path, byte[] or String. If key exists in
+     *                src but value is Boolean FALSE. The entry is removed.
+     *                Existing entries in src not a key is unmodified.
+     * @throws IOException
+     */
+    public static void updateJar(String src, String dest,
+                                 Map<String,Object> changes)
+            throws IOException {
+
+        // What if input changes is immutable?
+        changes = new HashMap<>(changes);
+
+        System.out.printf("Creating %s from %s...\n", dest, src);
         try (JarOutputStream jos = new JarOutputStream(
                 new FileOutputStream(dest))) {
 
-            // copy each old entry into destination unless the entry name
-            // is in the updated list
-            List<String> updatedFiles = new ArrayList<>();
             try (JarFile srcJarFile = new JarFile(src)) {
                 Enumeration<JarEntry> entries = srcJarFile.entries();
                 while (entries.hasMoreElements()) {
                     JarEntry entry = entries.nextElement();
                     String name = entry.getName();
-                    boolean found = false;
-                    boolean update = true;
-                    for (String file : files) {
-                        if (file.equals("-")) {
-                            update = false;
-                        } else if (name.equals(file)) {
-                            updatedFiles.add(file);
-                            found = true;
-                            break;
-                        }
-                    }
-
-                    if (found) {
-                        if (update) {
-                            System.out.println(String.format("Updating %s with %s",
-                                    dest, name));
-                            jos.putNextEntry(new JarEntry(name));
-                            try (FileInputStream fis = new FileInputStream(name)) {
-                                fis.transferTo(jos);
-                            } catch (FileNotFoundException e) {
-                                jos.write(name.getBytes());
-                            }
-                        } else {
-                            System.out.println(String.format("Removing %s from %s",
-                                    name, dest));
-                        }
+                    if (changes.containsKey(name)) {
+                        System.out.println(String.format("- Update %s", name));
+                        updateEntry(jos, name, changes.get(name));
+                        changes.remove(name);
                     } else {
-                        System.out.println(String.format("Copying %s to %s",
-                                name, dest));
+                        System.out.println(String.format("- Copy %s", name));
                         jos.putNextEntry(entry);
                         srcJarFile.getInputStream(entry).transferTo(jos);
                     }
                 }
             }
-
-            // append new files
-            for (String file : files) {
-                if (file.equals("-")) {
-                    break;
-                }
-                if (!updatedFiles.contains(file)) {
-                    System.out.println(String.format("Adding %s with %s",
-                            dest, file));
-                    jos.putNextEntry(new JarEntry(file));
-                    try (FileInputStream fis = new FileInputStream(file)) {
-                        fis.transferTo(jos);
-                    } catch (FileNotFoundException e) {
-                        jos.write(file.getBytes());
-                    }
-                }
+            for (Map.Entry<String, Object> e : changes.entrySet()) {
+                System.out.println(String.format("- Add %s", e.getKey()));
+                updateEntry(jos, e.getKey(), e.getValue());
             }
         }
         System.out.println();
     }
 
+    private static void updateEntry(JarOutputStream jos, String name, Object content)
+           throws IOException {
+        if (content instanceof Boolean) {
+            if (((Boolean) content).booleanValue()) {
+                throw new RuntimeException("Boolean value must be FALSE");
+            }
+        } else {
+            jos.putNextEntry(new JarEntry(name));
+            if (content instanceof Path) {
+                Files.newInputStream((Path) content).transferTo(jos);
+            } else if (content instanceof byte[]) {
+                jos.write((byte[]) content);
+            } else if (content instanceof String) {
+                jos.write(((String) content).getBytes());
+            } else {
+                throw new RuntimeException("Unknown type " + content.getClass());
+            }
+        }
+    }
 }