diff --git a/.hgtags b/.hgtags index aff0e450d6c..722db7c026c 100644 --- a/.hgtags +++ b/.hgtags @@ -453,3 +453,4 @@ e5357aa85dadacc6562175ff74714fecfb4470cf jdk-10+22 1129253d3bc728a2963ba411ab9dd1adf358fb6b jdk-10+26 b87d7b5d5dedc1185e5929470f945b7378cdb3ad jdk-10+27 92f08900cb3c0d694e5c529a676c1c9e5909193f jdk-10+28 +a6e591e12f122768f675428e1e5a838fd0e9c7ec jdk-10+29 diff --git a/make/Docs.gmk b/make/Docs.gmk index d46c54470c3..f37b6ebf649 100644 --- a/make/Docs.gmk +++ b/make/Docs.gmk @@ -64,7 +64,7 @@ MODULES_SOURCE_PATH := $(call PathList, $(call GetModuleSrcPath) \ JAVADOC_BASE_URL := http://www.oracle.com/pls/topic/lookup?ctx=javase9&id=homepage BUG_SUBMIT_URL := http://bugreport.java.com/bugreport/ COPYRIGHT_URL := {@docroot}/../legal/copyright.html -LICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java9speclicense.html +LICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java10speclicense.html REDISTRIBUTION_URL := http://www.oracle.com/technetwork/java/redist-137594.html # In order to get a specific ordering it's necessary to specify the total diff --git a/make/Images.gmk b/make/Images.gmk index 5d1c94181cc..aa342d1d31d 100644 --- a/make/Images.gmk +++ b/make/Images.gmk @@ -432,8 +432,8 @@ $(eval $(call IncludeCustomExtension, Images-post.gmk)) $(JRE_TARGETS): $(TOOL_JRE_TARGETS) $(JDK_TARGETS): $(TOOL_JDK_TARGETS) -jdk: $(JDK_TARGETS) -jre: $(JRE_TARGETS) +jdk: $(TOOL_JDK_TARGETS) $(JDK_TARGETS) +jre: $(TOOL_JRE_TARGETS) $(JRE_TARGETS) symbols: $(SYMBOLS_TARGETS) all: jdk jre symbols diff --git a/make/Init.gmk b/make/Init.gmk index bfefd815292..ce3264f8900 100644 --- a/make/Init.gmk +++ b/make/Init.gmk @@ -223,9 +223,6 @@ else # HAS_SPEC=true # Our helper functions. include $(TOPDIR)/make/InitSupport.gmk - # Verify that the spec file we included seems okay. - $(eval $(call CheckSpecSanity)) - # Parse COMPARE_BUILD (for makefile development) $(eval $(call ParseCompareBuild)) diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk index 857e338890b..4f574e5b642 100644 --- a/make/InitSupport.gmk +++ b/make/InitSupport.gmk @@ -359,23 +359,6 @@ else # $(HAS_SPEC)=true BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2) && wait - # Sanity check the spec file, so it matches this source code - define CheckSpecSanity - ifneq ($$(ACTUAL_TOPDIR), $$(TOPDIR)) - ifneq ($$(ACTUAL_TOPDIR), $$(ORIGINAL_TOPDIR)) - ifneq ($$(ACTUAL_TOPDIR), $$(CANONICAL_TOPDIR)) - $$(info Error: SPEC mismatch! Current working directory) - $$(info $$(ACTUAL_TOPDIR)) - $$(info does not match either TOPDIR, ORIGINAL_TOPDIR or CANONICAL_TOPDIR) - $$(info $$(TOPDIR)) - $$(info $$(ORIGINAL_TOPDIR)) - $$(info $$(CANONICAL_TOPDIR)) - $$(error Cannot continue) - endif - endif - endif - endef - # Parse COMPARE_BUILD into COMPARE_BUILD_* # Syntax: COMPARE_BUILD=CONF=:PATCH=: # MAKE=:COMP_OPTS=: diff --git a/make/autoconf/basics.m4 b/make/autoconf/basics.m4 index 94601311645..7d5d47a3cf7 100644 --- a/make/autoconf/basics.m4 +++ b/make/autoconf/basics.m4 @@ -561,19 +561,10 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS], AC_MSG_RESULT([$TOPDIR]) AC_SUBST(TOPDIR) - # Save the original version of TOPDIR for string comparisons - ORIGINAL_TOPDIR="$TOPDIR" - AC_SUBST(ORIGINAL_TOPDIR) - # We can only call BASIC_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS. BASIC_FIXUP_PATH(CURDIR) BASIC_FIXUP_PATH(TOPDIR) - # Calculate a canonical version of TOPDIR for string comparisons - CANONICAL_TOPDIR=$TOPDIR - BASIC_REMOVE_SYMBOLIC_LINKS([CANONICAL_TOPDIR]) - AC_SUBST(CANONICAL_TOPDIR) - # Locate the directory of this script. AUTOCONF_DIR=$TOPDIR/make/autoconf @@ -648,6 +639,14 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], 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 ] ) diff --git a/make/autoconf/configure.ac b/make/autoconf/configure.ac index 65398af0a61..26946f38152 100644 --- a/make/autoconf/configure.ac +++ b/make/autoconf/configure.ac @@ -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 @@ FLAGS_SETUP_COMPILER_FLAGS_MISC 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 diff --git a/make/autoconf/generated-configure.sh b/make/autoconf/generated-configure.sh index a5a947494eb..26561660e09 100644 --- a/make/autoconf/generated-configure.sh +++ b/make/autoconf/generated-configure.sh @@ -705,6 +705,7 @@ FIXPATH BUILD_GTEST ENABLE_CDS ENABLE_AOT +ASAN_ENABLED GCOV_ENABLED ZIP_EXTERNAL_DEBUG_SYMBOLS COPY_DEBUG_SYMBOLS @@ -959,6 +960,7 @@ CONF_NAME SPEC SDKROOT XCODEBUILD +DEVKIT_LIB_DIR JVM_VARIANT_MAIN VALID_JVM_VARIANTS JVM_VARIANTS @@ -966,8 +968,6 @@ DEBUG_LEVEL HOTSPOT_DEBUG_LEVEL JDK_VARIANT USERNAME -CANONICAL_TOPDIR -ORIGINAL_TOPDIR TOPDIR PATH_SEP HOTSPOT_BUILD_CPU_DEFINE @@ -1174,6 +1174,7 @@ with_native_debug_symbols enable_debug_symbols enable_zip_debug_info enable_native_coverage +enable_asan enable_dtrace enable_aot enable_cds @@ -1981,6 +1982,7 @@ Optional Features: --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. @@ -4416,6 +4418,12 @@ VALID_JVM_VARIANTS="server client minimal core zero zeroshark custom" # +############################################################################### +# +# AddressSanitizer +# + + ################################################################################ # # Static build support. When enabled will generate static @@ -5158,7 +5166,7 @@ VS_SDK_PLATFORM_NAME_2013= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1508961024 +DATE_WHEN_GENERATED=1509128484 ############################################################################### # @@ -16577,10 +16585,6 @@ $as_echo_n "checking for top-level directory... " >&6; } $as_echo "$TOPDIR" >&6; } - # Save the original version of TOPDIR for string comparisons - ORIGINAL_TOPDIR="$TOPDIR" - - # We can only call BASIC_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS. # Only process if variable expands to non-empty @@ -16847,58 +16851,6 @@ $as_echo "$as_me: The path of TOPDIR, which resolves as \"$path\", is invalid." fi - # Calculate a canonical version of TOPDIR for string comparisons - CANONICAL_TOPDIR=$TOPDIR - - if test "x$OPENJDK_BUILD_OS" != xwindows; then - # Follow a chain of symbolic links. Use readlink - # where it exists, else fall back to horribly - # complicated shell code. - if test "x$READLINK_TESTED" != yes; then - # On MacOSX there is a readlink tool with a different - # purpose than the GNU readlink tool. Check the found readlink. - ISGNU=`$READLINK --version 2>&1 | $GREP GNU` - if test "x$ISGNU" = x; then - # A readlink that we do not know how to use. - # Are there other non-GNU readlinks out there? - READLINK_TESTED=yes - READLINK= - fi - fi - - if test "x$READLINK" != x; then - CANONICAL_TOPDIR=`$READLINK -f $CANONICAL_TOPDIR` - else - # Save the current directory for restoring afterwards - STARTDIR=$PWD - COUNTER=0 - sym_link_dir=`$DIRNAME $CANONICAL_TOPDIR` - sym_link_file=`$BASENAME $CANONICAL_TOPDIR` - cd $sym_link_dir - # Use -P flag to resolve symlinks in directories. - cd `$THEPWDCMD -P` - sym_link_dir=`$THEPWDCMD -P` - # Resolve file symlinks - while test $COUNTER -lt 20; do - ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` - if test "x$ISLINK" == x; then - # This is not a symbolic link! We are done! - break - fi - # Again resolve directory symlinks since the target of the just found - # link could be in a different directory - cd `$DIRNAME $ISLINK` - sym_link_dir=`$THEPWDCMD -P` - sym_link_file=`$BASENAME $ISLINK` - let COUNTER=COUNTER+1 - done - cd $STARTDIR - CANONICAL_TOPDIR=$sym_link_dir/$sym_link_file - fi - fi - - - # Locate the directory of this script. AUTOCONF_DIR=$TOPDIR/make/autoconf @@ -17372,6 +17324,14 @@ $as_echo "$DEVKIT_ROOT" >&6; } 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 @@ -54268,6 +54228,49 @@ $as_echo "no" >&6; } +# 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 diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index ccd82239c1a..fb4849e70b0 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -399,6 +399,46 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE], 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 diff --git a/make/autoconf/spec.gmk.in b/make/autoconf/spec.gmk.in index 7b2807eea7e..06deccd8e31 100644 --- a/make/autoconf/spec.gmk.in +++ b/make/autoconf/spec.gmk.in @@ -127,9 +127,6 @@ SYSROOT_LDFLAGS := @SYSROOT_LDFLAGS@ # The top-level directory of the source repository TOPDIR:=@TOPDIR@ -# These two versions of TOPDIR are used in string comparisons -ORIGINAL_TOPDIR:=@ORIGINAL_TOPDIR@ -CANONICAL_TOPDIR:=@CANONICAL_TOPDIR@ IMPORT_MODULES_CLASSES:=@IMPORT_MODULES_CLASSES@ @@ -315,6 +312,16 @@ UNLIMITED_CRYPTO=@UNLIMITED_CRYPTO@ 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@ diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk index 047ad3c8337..04cafcd115c 100644 --- a/make/common/Modules.gmk +++ b/make/common/Modules.gmk @@ -249,10 +249,10 @@ SPEC_SUBDIRS += share/specs # configuration. # Param 1 - Module to find for, set to * for finding all FindAllModuleInfos = \ - $(wildcard \ + $(sort $(wildcard \ $(foreach sub, $(SRC_SUBDIRS), \ $(patsubst %,%/$(strip $1)/$(sub)/module-info.java, $(TOP_SRC_DIRS))) \ - $(patsubst %,%/$(strip $1)/module-info.java, $(IMPORT_MODULES_SRC))) + $(patsubst %,%/$(strip $1)/module-info.java, $(IMPORT_MODULES_SRC)))) # Find module-info.java files in the specific source dir # Param 1 - Src dir to find module-info.java files in diff --git a/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java b/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java index 22ff322c804..8743efcb5ac 100644 --- a/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java +++ b/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java @@ -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.*; 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 @@ public class CLDRConverter { List bundles = readBundleList(); convertBundles(bundles); + convertBundles(addedBundles); } private static void usage() { @@ -293,14 +295,7 @@ public class CLDRConverter { if (fileName.endsWith(".xml")) { String id = fileName.substring(0, fileName.indexOf('.')); Locale cldrLoc = Locale.forLanguageTag(toLanguageTag(id)); - List 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 @@ public class CLDRConverter { } private static final Map> cldrBundles = new HashMap<>(); + // this list will contain additional bundles to be generated for Region dependent Data. + private static List addedBundles = new ArrayList<>(); + + private static Map> 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 calendarDataFields = Set.of("firstDayOfWeek", "minimalDaysInFirstWeek"); static Map getCLDRBundle(String id) throws Exception { Map bundle = cldrBundles.get(id); @@ -411,16 +423,85 @@ public class CLDRConverter { parserLikelySubtags.parse(fileLikelySubtags, handlerLikelySubtags); } - private static void convertBundles(List bundles) throws Exception { - // For generating information on supported locales. - Map> 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<>()); + /** + * 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 targetMap, String id) { + if ((CLDRConverter.getScript(id) != "") + && (CLDRConverter.getCountryCode(id) != "")) { + Map 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 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 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 getCandidateLocales(Locale cldrLoc) { + List 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 bundles) throws Exception { // parent locales map. The mappings are put in base metaInfo file // for now. if (isBaseModule) { @@ -433,6 +514,8 @@ public class CLDRConverter { Map targetMap = bundle.getTargetMap(); + // check if new region DependentBundle needs to be generated for this Locale. + checkRegionDependentBundle(targetMap, bundle.getID()); EnumSet bundleTypes = bundle.getBundleTypes(); if (bundle.isRoot()) { @@ -573,6 +656,14 @@ public class CLDRConverter { 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 { static KeyComparator INSTANCE = new KeyComparator(); diff --git a/src/java.base/share/classes/java/io/FileInputStream.java b/src/java.base/share/classes/java/io/FileInputStream.java index 6cc2adb5559..5dfe71907fe 100644 --- a/src/java.base/share/classes/java/io/FileInputStream.java +++ b/src/java.base/share/classes/java/io/FileInputStream.java @@ -385,7 +385,8 @@ class FileInputStream extends InputStream synchronized (this) { fc = this.channel; if (fc == null) { - this.channel = fc = FileChannelImpl.open(fd, path, true, false, this); + this.channel = fc = FileChannelImpl.open(fd, path, true, + false, false, this); if (closed) { try { // possible race with close(), benign since diff --git a/src/java.base/share/classes/java/io/FileOutputStream.java b/src/java.base/share/classes/java/io/FileOutputStream.java index 00d9f82c2dc..f9c1baa3518 100644 --- a/src/java.base/share/classes/java/io/FileOutputStream.java +++ b/src/java.base/share/classes/java/io/FileOutputStream.java @@ -410,7 +410,8 @@ class FileOutputStream extends OutputStream synchronized (this) { fc = this.channel; if (fc == null) { - this.channel = fc = FileChannelImpl.open(fd, path, false, true, this); + this.channel = fc = FileChannelImpl.open(fd, path, false, + true, false, this); if (closed) { try { // possible race with close(), benign since diff --git a/src/java.base/share/classes/java/io/FilePermission.java b/src/java.base/share/classes/java/io/FilePermission.java index 39cded53b27..0cdb660145f 100644 --- a/src/java.base/share/classes/java/io/FilePermission.java +++ b/src/java.base/share/classes/java/io/FilePermission.java @@ -698,7 +698,7 @@ public final class FilePermission extends Permission implements Serializable { 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 @@ public final class FilePermission extends Permission implements Serializable { } 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; diff --git a/src/java.base/share/classes/java/io/RandomAccessFile.java b/src/java.base/share/classes/java/io/RandomAccessFile.java index 53c041a5830..5c946d1d715 100644 --- a/src/java.base/share/classes/java/io/RandomAccessFile.java +++ b/src/java.base/share/classes/java/io/RandomAccessFile.java @@ -298,7 +298,8 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { synchronized (this) { fc = this.channel; if (fc == null) { - this.channel = fc = FileChannelImpl.open(fd, path, true, rw, this); + this.channel = fc = FileChannelImpl.open(fd, path, true, + rw, false, this); if (closed.get()) { try { fc.close(); diff --git a/src/java.base/share/classes/java/lang/String.java b/src/java.base/share/classes/java/lang/String.java index 4d30846bfa3..db55267ee83 100644 --- a/src/java.base/share/classes/java/lang/String.java +++ b/src/java.base/share/classes/java/lang/String.java @@ -2664,6 +2664,7 @@ public final class String * point is passed through uninterpreted. * * @return an IntStream of char values from this sequence + * @since 9 */ @Override public IntStream chars() { @@ -2683,6 +2684,7 @@ public final class String * {@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() { diff --git a/src/java.base/share/classes/java/lang/System.java b/src/java.base/share/classes/java/lang/System.java index 8388dce7562..86ec3c5cad3 100644 --- a/src/java.base/share/classes/java/lang/System.java +++ b/src/java.base/share/classes/java/lang/System.java @@ -1937,7 +1937,7 @@ public final class System { // 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 diff --git a/src/java.base/share/classes/java/lang/WeakPairMap.java b/src/java.base/share/classes/java/lang/WeakPairMap.java index 1e4e12767b3..0e521dc901a 100644 --- a/src/java.base/share/classes/java/lang/WeakPairMap.java +++ b/src/java.base/share/classes/java/lang/WeakPairMap.java @@ -88,7 +88,7 @@ final class WeakPairMap { * Maps the specified key pair to the specified value in this WeakPairMap. * Neither the keys nor the value can be null. *

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 diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java index 60092d33d73..8b9c0ec9cc2 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java @@ -765,7 +765,7 @@ public abstract class MethodHandle { * In every other case, all conversions are applied pairwise, * 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. *

diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java index 348a15921f0..bf3b30443a6 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java @@ -1196,7 +1196,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; 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. diff --git a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java index de811921c7a..72feb9f1ca0 100644 --- a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java +++ b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java @@ -194,8 +194,8 @@ public final class StringConcatFactory { 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 @@ public final class StringConcatFactory { *

Then the following linkage invariants must hold: * *

    - *
  • The parameter count in {@code concatType} is less than or equal to 200
  • - * + *
  • The number of parameter slots in {@code concatType} is + * less than or equal to 200
  • *
  • The return type in {@code concatType} is assignable from {@link java.lang.String}
  • *
* @@ -487,8 +487,8 @@ public final class StringConcatFactory { *

Then the following linkage invariants must hold: * *

    - *
  • The parameter count in {@code concatType} is less than or equal to - * 200
  • + *
  • The number of parameter slots in {@code concatType} is less than + * or equal to 200
  • * *
  • The parameter count in {@code concatType} equals to number of \1 tags * in {@code recipe}
  • @@ -613,9 +613,9 @@ public final class StringConcatFactory { 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); } diff --git a/src/java.base/share/classes/java/lang/invoke/VarHandle.java b/src/java.base/share/classes/java/lang/invoke/VarHandle.java index 9f24c2907a4..5194d6ee981 100644 --- a/src/java.base/share/classes/java/lang/invoke/VarHandle.java +++ b/src/java.base/share/classes/java/lang/invoke/VarHandle.java @@ -205,7 +205,7 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError; * and {@code double} on 32-bit platforms. * *

    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 by its access mode even if that field is declared * {@code volatile}. When mixed access is performed extreme care should be @@ -423,7 +423,7 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError; * {@link java.lang.invoke.MethodHandles#varHandleInvoker}. * *

    Interoperation between VarHandles and Java generics

    - * 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 diff --git a/src/java.base/share/classes/java/net/DatagramSocket.java b/src/java.base/share/classes/java/net/DatagramSocket.java index 7a447cb0acd..43e42e38042 100644 --- a/src/java.base/share/classes/java/net/DatagramSocket.java +++ b/src/java.base/share/classes/java/net/DatagramSocket.java @@ -988,7 +988,7 @@ class DatagramSocket implements java.io.Closeable { /** * 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 diff --git a/src/java.base/share/classes/java/net/Inet4Address.java b/src/java.base/share/classes/java/net/Inet4Address.java index 25c5ab41224..daf7d86bc05 100644 --- a/src/java.base/share/classes/java/net/Inet4Address.java +++ b/src/java.base/share/classes/java/net/Inet4Address.java @@ -143,7 +143,7 @@ class Inet4Address extends InetAddress { /** * 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; diff --git a/src/java.base/share/classes/java/net/SocketImpl.java b/src/java.base/share/classes/java/net/SocketImpl.java index 60fe083445a..1c2060c7f15 100644 --- a/src/java.base/share/classes/java/net/SocketImpl.java +++ b/src/java.base/share/classes/java/net/SocketImpl.java @@ -333,7 +333,7 @@ public abstract class SocketImpl implements SocketOptions { * 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 diff --git a/src/java.base/share/classes/java/net/SocksSocketImpl.java b/src/java.base/share/classes/java/net/SocksSocketImpl.java index f8ea9ce6c16..3fe64a9c849 100644 --- a/src/java.base/share/classes/java/net/SocksSocketImpl.java +++ b/src/java.base/share/classes/java/net/SocksSocketImpl.java @@ -657,7 +657,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { /** * 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. diff --git a/src/java.base/share/classes/java/net/URLConnection.java b/src/java.base/share/classes/java/net/URLConnection.java index a5c30df3d4b..2b52e07e921 100644 --- a/src/java.base/share/classes/java/net/URLConnection.java +++ b/src/java.base/share/classes/java/net/URLConnection.java @@ -785,7 +785,7 @@ public abstract class URLConnection { * 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. diff --git a/src/java.base/share/classes/java/nio/channels/AsynchronousFileChannel.java b/src/java.base/share/classes/java/nio/channels/AsynchronousFileChannel.java index 0c0d0e6d3b5..26d2313f5f8 100644 --- a/src/java.base/share/classes/java/nio/channels/AsynchronousFileChannel.java +++ b/src/java.base/share/classes/java/nio/channels/AsynchronousFileChannel.java @@ -165,7 +165,7 @@ public abstract class AsynchronousFileChannel * * {@link StandardOpenOption#DELETE_ON_CLOSE DELETE_ON_CLOSE} * When this option is present then the implementation makes a - * best effort attempt to delete the file when closed by the + * best effort attempt to delete the file when closed by * the {@link #close close} method. If the {@code close} method is not * invoked then a best effort attempt is made to delete the file * when the Java virtual machine terminates. diff --git a/src/java.base/share/classes/java/nio/channels/FileChannel.java b/src/java.base/share/classes/java/nio/channels/FileChannel.java index 9ee447dbaf6..4463e5a5d82 100644 --- a/src/java.base/share/classes/java/nio/channels/FileChannel.java +++ b/src/java.base/share/classes/java/nio/channels/FileChannel.java @@ -216,7 +216,7 @@ public abstract class FileChannel * * {@link StandardOpenOption#DELETE_ON_CLOSE DELETE_ON_CLOSE} * When this option is present then the implementation makes a - * best effort attempt to delete the file when closed by the + * best effort attempt to delete the file when closed by * the {@link #close close} method. If the {@code close} method is not * invoked then a best effort attempt is made to delete the file * when the Java virtual machine terminates. diff --git a/src/java.base/share/classes/java/nio/file/Files.java b/src/java.base/share/classes/java/nio/file/Files.java index f5dbba9c358..5c0e3712524 100644 --- a/src/java.base/share/classes/java/nio/file/Files.java +++ b/src/java.base/share/classes/java/nio/file/Files.java @@ -3301,7 +3301,7 @@ public final class Files { } /** - * 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 diff --git a/src/java.base/share/classes/java/security/KeyPairGenerator.java b/src/java.base/share/classes/java/security/KeyPairGenerator.java index cd9a0a51263..eee081ae51e 100644 --- a/src/java.base/share/classes/java/security/KeyPairGenerator.java +++ b/src/java.base/share/classes/java/security/KeyPairGenerator.java @@ -84,7 +84,7 @@ import sun.security.util.Debug; * exists (e.g., so-called community parameters 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 diff --git a/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java b/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java index f734fdd9d02..ebf044919a4 100644 --- a/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java +++ b/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java @@ -4775,7 +4775,7 @@ public final class DateTimeFormatterBuilder { //----------------------------------------------------------------------- /** * 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. diff --git a/src/java.base/share/classes/java/time/temporal/WeekFields.java b/src/java.base/share/classes/java/time/temporal/WeekFields.java index 60478772d9f..0046bef9b68 100644 --- a/src/java.base/share/classes/java/time/temporal/WeekFields.java +++ b/src/java.base/share/classes/java/time/temporal/WeekFields.java @@ -311,7 +311,7 @@ public final class WeekFields implements Serializable { * the new month or year. *

    * 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 diff --git a/src/java.base/share/classes/java/util/Base64.java b/src/java.base/share/classes/java/util/Base64.java index 43e3d0690cd..0973a63844c 100644 --- a/src/java.base/share/classes/java/util/Base64.java +++ b/src/java.base/share/classes/java/util/Base64.java @@ -56,7 +56,7 @@ import java.nio.charset.StandardCharsets; * base64 alphabet.

    * *
  • MIME - *

    Uses the "The Base64 Alphabet" as specified in Table 1 of + *

    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 diff --git a/src/java.base/share/classes/java/util/EventObject.java b/src/java.base/share/classes/java/util/EventObject.java index 99f58eb434e..ff89754a185 100644 --- a/src/java.base/share/classes/java/util/EventObject.java +++ b/src/java.base/share/classes/java/util/EventObject.java @@ -43,13 +43,13 @@ public class EventObject implements java.io.Serializable { /** * 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 @@ public class EventObject implements java.io.Serializable { /** * 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 @@ public class EventObject implements java.io.Serializable { /** * 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 + "]"; diff --git a/src/java.base/share/classes/java/util/FormattableFlags.java b/src/java.base/share/classes/java/util/FormattableFlags.java index 6c9962c3dba..92c020f9991 100644 --- a/src/java.base/share/classes/java/util/FormattableFlags.java +++ b/src/java.base/share/classes/java/util/FormattableFlags.java @@ -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. diff --git a/src/java.base/share/classes/java/util/Locale.java b/src/java.base/share/classes/java/util/Locale.java index 825ba8b8ff5..3bca8916052 100644 --- a/src/java.base/share/classes/java/util/Locale.java +++ b/src/java.base/share/classes/java/util/Locale.java @@ -1909,7 +1909,7 @@ public final class Locale implements Cloneable, Serializable { * 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: *

    * language (script, country, variant)
    diff --git a/src/java.base/share/classes/java/util/Properties.java b/src/java.base/share/classes/java/util/Properties.java index fd7ee9ce6b3..1ae9a49a028 100644 --- a/src/java.base/share/classes/java/util/Properties.java +++ b/src/java.base/share/classes/java/util/Properties.java @@ -122,6 +122,10 @@ import jdk.internal.util.xml.PropertiesDefaultHandler; *

    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 @@ class Properties extends Hashtable { * simple read operations. Writes and bulk operations remain synchronized, * as in Hashtable. */ - private transient ConcurrentHashMap map = - new ConcurrentHashMap<>(8); + private transient ConcurrentHashMap 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; } diff --git a/src/java.base/share/classes/java/util/ResourceBundle.java b/src/java.base/share/classes/java/util/ResourceBundle.java index 1e8141fe14b..b361ceefff4 100644 --- a/src/java.base/share/classes/java/util/ResourceBundle.java +++ b/src/java.base/share/classes/java/util/ResourceBundle.java @@ -2743,7 +2743,7 @@ public abstract class ResourceBundle { * of multiple subtags separated by underscore, generate candidate * Locales by omitting the variant subtags one by one, then * insert them after every occurrence of Locales 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 V1 and V2: * *

      diff --git a/src/java.base/share/classes/java/util/ServiceLoader.java b/src/java.base/share/classes/java/util/ServiceLoader.java index 75d1157c74a..1f2e0e82f8e 100644 --- a/src/java.base/share/classes/java/util/ServiceLoader.java +++ b/src/java.base/share/classes/java/util/ServiceLoader.java @@ -1409,7 +1409,7 @@ public final class ServiceLoader * *

      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 Errors section + * of the reasons specified in the Errors section * above then {@link ServiceConfigurationError} is thrown by whatever method * caused the service provider to be loaded.

      * diff --git a/src/java.base/share/classes/javax/security/auth/Policy.java b/src/java.base/share/classes/javax/security/auth/Policy.java index cc153b59f05..f95732c4840 100644 --- a/src/java.base/share/classes/javax/security/auth/Policy.java +++ b/src/java.base/share/classes/javax/security/auth/Policy.java @@ -134,7 +134,7 @@ import sun.security.util.Debug; * 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: *
        *      public PermissionCollection getPermissions
      @@ -152,11 +152,12 @@ import sun.security.util.Debug;
        *
        * 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;
      diff --git a/src/java.base/share/classes/javax/security/auth/SubjectDomainCombiner.java b/src/java.base/share/classes/javax/security/auth/SubjectDomainCombiner.java
      index b80cec126a5..97ace14095d 100644
      --- a/src/java.base/share/classes/javax/security/auth/SubjectDomainCombiner.java
      +++ b/src/java.base/share/classes/javax/security/auth/SubjectDomainCombiner.java
      @@ -29,7 +29,6 @@ import java.security.AccessController;
       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 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
               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 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
               if (!allowCaching) {
                   java.security.AccessController.doPrivileged
                       (new PrivilegedAction() {
      -                    @SuppressWarnings("deprecation")
      +                    @SuppressWarnings({"deprecation", "removal"})
                           public Void run() {
                               // Call refresh only caching is disallowed
                               javax.security.auth.Policy.getPolicy().refresh();
      @@ -374,7 +373,7 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
                               PermissionCollection newPerms =
                                   java.security.AccessController.doPrivileged
                                   (new PrivilegedAction() {
      -                            @SuppressWarnings("deprecation")
      +                            @SuppressWarnings({"deprecation", "removal"})
                                   public PermissionCollection run() {
                                       return
                                           javax.security.auth.Policy.getPolicy().getPermissions
      diff --git a/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java b/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java
      index b78a23d0be6..ee98b92ea63 100644
      --- a/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java
      +++ b/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java
      @@ -238,7 +238,7 @@ public final class BootstrapLogger implements Logger, PlatformLogger.Bridge,
           // 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 {
      diff --git a/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java b/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java
      index df580eaf9c7..856ee4c23b8 100644
      --- a/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java
      +++ b/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java
      @@ -66,7 +66,7 @@ import jdk.internal.perf.PerfCounter;
        * -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 {
      diff --git a/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java b/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java
      index 804f5eb4527..1f9d94ca1d9 100644
      --- a/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java
      +++ b/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java
      @@ -74,7 +74,7 @@ public class ModuleHashesBuilder {
            * the outgoing edges from M to non-candidate modules.
            */
           public Map computeHashes(Set 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 builder = new Graph.Builder<>();
               Deque deque = new ArrayDeque<>(configuration.modules());
      diff --git a/src/java.base/share/classes/jdk/internal/module/Resources.java b/src/java.base/share/classes/jdk/internal/module/Resources.java
      index 53865742dbe..d224d1aba84 100644
      --- a/src/java.base/share/classes/jdk/internal/module/Resources.java
      +++ b/src/java.base/share/classes/jdk/internal/module/Resources.java
      @@ -56,7 +56,7 @@ public final class Resources {
           /**
            * Derive a package name 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) {
      diff --git a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Frame.java b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Frame.java
      index 811b74c7242..bb7ff8f5147 100644
      --- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Frame.java
      +++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Frame.java
      @@ -192,7 +192,7 @@ final class Frame {
           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.
            */
      diff --git a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
      index 17e158541cc..7fb8321b5d2 100644
      --- a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
      +++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
      @@ -2888,7 +2888,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
                   /*
                    * 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
      diff --git a/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java b/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java
      index eb99c534ee7..5e48758bac0 100644
      --- a/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java
      +++ b/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java
      @@ -140,13 +140,6 @@ public class FileChannelImpl
       
           // Used by FileInputStream.getChannel(), FileOutputStream.getChannel
           // and RandomAccessFile.getChannel()
      -    public static FileChannel open(FileDescriptor fd, String path,
      -                                   boolean readable, boolean writable,
      -                                   Object parent)
      -    {
      -        return new FileChannelImpl(fd, path, readable, writable, false, parent);
      -    }
      -
           public static FileChannel open(FileDescriptor fd, String path,
                                          boolean readable, boolean writable,
                                          boolean direct, Object parent)
      diff --git a/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java b/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
      index faca5e3b041..ed650d41033 100644
      --- a/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
      +++ b/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
      @@ -66,7 +66,7 @@ public class ParameterizedTypeImpl implements ParameterizedType {
           /**
            * 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
      diff --git a/src/java.base/share/classes/sun/security/provider/AuthPolicyFile.java b/src/java.base/share/classes/sun/security/provider/AuthPolicyFile.java
      index 05150c95145..46cdcd9b092 100644
      --- a/src/java.base/share/classes/sun/security/provider/AuthPolicyFile.java
      +++ b/src/java.base/share/classes/sun/security/provider/AuthPolicyFile.java
      @@ -65,6 +65,7 @@ import sun.security.util.PropertyExpander;
        *             This class is entirely deprecated.
        */
       @Deprecated
      +@SuppressWarnings("removal")
       public class AuthPolicyFile extends javax.security.auth.Policy {
       
           static final ResourceBundle rb =
      @@ -410,7 +411,7 @@ public class AuthPolicyFile extends javax.security.auth.Policy {
                               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(
      diff --git a/src/java.base/share/classes/sun/security/provider/PolicyFile.java b/src/java.base/share/classes/sun/security/provider/PolicyFile.java
      index 55dd4da474a..3319f91a7c0 100644
      --- a/src/java.base/share/classes/sun/security/provider/PolicyFile.java
      +++ b/src/java.base/share/classes/sun/security/provider/PolicyFile.java
      @@ -789,7 +789,7 @@ public class PolicyFile extends java.security.Policy {
                               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(
      diff --git a/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java b/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java
      index 26a3d4e3f89..2b01b05e104 100644
      --- a/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java
      +++ b/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java
      @@ -154,7 +154,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
            *
            * @param codesource the CodeSource to compare against.
            *
      -     * @return true if this SubjectCodeSource implies the
      +     * @return true if this SubjectCodeSource implies
            *          the specified CodeSource.
            */
           public boolean implies(CodeSource codesource) {
      diff --git a/src/java.base/share/classes/sun/security/provider/certpath/ResponderId.java b/src/java.base/share/classes/sun/security/provider/certpath/ResponderId.java
      index f67786e432c..b6551cc9403 100644
      --- a/src/java.base/share/classes/sun/security/provider/certpath/ResponderId.java
      +++ b/src/java.base/share/classes/sun/security/provider/certpath/ResponderId.java
      @@ -119,7 +119,7 @@ public final class ResponderId {
            * 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.
      diff --git a/src/java.base/share/classes/sun/security/provider/certpath/SunCertPathBuilderException.java b/src/java.base/share/classes/sun/security/provider/certpath/SunCertPathBuilderException.java
      index 8ba440d5181..db896a78f17 100644
      --- a/src/java.base/share/classes/sun/security/provider/certpath/SunCertPathBuilderException.java
      +++ b/src/java.base/share/classes/sun/security/provider/certpath/SunCertPathBuilderException.java
      @@ -94,7 +94,7 @@ public class SunCertPathBuilderException extends CertPathBuilderException {
           }
       
           /**
      -     * Creates a SunCertPathBuilderException withe the specified
      +     * Creates a SunCertPathBuilderException with the specified
            * detail message and adjacency list.
            *
            * @param msg the detail message
      diff --git a/src/java.base/share/classes/sun/security/ssl/CertStatusReqItemV2.java b/src/java.base/share/classes/sun/security/ssl/CertStatusReqItemV2.java
      index 1f4ee77c92f..b44c20f72cc 100644
      --- a/src/java.base/share/classes/sun/security/ssl/CertStatusReqItemV2.java
      +++ b/src/java.base/share/classes/sun/security/ssl/CertStatusReqItemV2.java
      @@ -145,7 +145,7 @@ final class CertStatusReqItemV2 {
            * @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;
           }
      diff --git a/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java b/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java
      index fa680715874..0fd69d5635a 100644
      --- a/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java
      +++ b/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java
      @@ -539,7 +539,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
       
                       // 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);
                   }
      diff --git a/src/java.base/share/classes/sun/security/ssl/MAC.java b/src/java.base/share/classes/sun/security/ssl/MAC.java
      index 20c73db6b01..250e97fbc0f 100644
      --- a/src/java.base/share/classes/sun/security/ssl/MAC.java
      +++ b/src/java.base/share/classes/sun/security/ssl/MAC.java
      @@ -188,7 +188,7 @@ final class MAC extends Authenticator {
            * @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
            */
      diff --git a/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java b/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java
      index 5681a7de1f4..6685d754a1b 100644
      --- a/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java
      +++ b/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java
      @@ -333,7 +333,7 @@ final class TrustStoreManager {
               }
       
               /**
      -         * 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 {
      diff --git a/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java b/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java
      index 9c2826c16dd..5a459267130 100644
      --- a/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java
      +++ b/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java
      @@ -724,7 +724,8 @@ public class SignatureFileVerifier {
                   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) {
      diff --git a/src/java.base/share/classes/sun/security/x509/X509CertImpl.java b/src/java.base/share/classes/sun/security/x509/X509CertImpl.java
      index 8d3ccff9b3a..91b482493f0 100644
      --- a/src/java.base/share/classes/sun/security/x509/X509CertImpl.java
      +++ b/src/java.base/share/classes/sun/security/x509/X509CertImpl.java
      @@ -1485,7 +1485,7 @@ public class X509CertImpl extends X509Certificate implements DerEncoder {
           }
       
           /**
      -     * 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.
            */
      diff --git a/src/java.base/share/classes/sun/text/normalizer/Trie2.java b/src/java.base/share/classes/sun/text/normalizer/Trie2.java
      index 32e237bb8f3..5d57f08a85d 100644
      --- a/src/java.base/share/classes/sun/text/normalizer/Trie2.java
      +++ b/src/java.base/share/classes/sun/text/normalizer/Trie2.java
      @@ -592,7 +592,7 @@ abstract class Trie2 implements Iterable {
               //   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;
       
      diff --git a/src/java.base/share/classes/sun/util/logging/PlatformLogger.java b/src/java.base/share/classes/sun/util/logging/PlatformLogger.java
      index e8df610c4c1..07c6878c151 100644
      --- a/src/java.base/share/classes/sun/util/logging/PlatformLogger.java
      +++ b/src/java.base/share/classes/sun/util/logging/PlatformLogger.java
      @@ -45,7 +45,7 @@ import jdk.internal.logger.LoggerWrapper;
        *
        * 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),
      diff --git a/src/java.base/unix/classes/sun/nio/fs/UnixChannelFactory.java b/src/java.base/unix/classes/sun/nio/fs/UnixChannelFactory.java
      index 30454ae8c25..37113d4ca92 100644
      --- a/src/java.base/unix/classes/sun/nio/fs/UnixChannelFactory.java
      +++ b/src/java.base/unix/classes/sun/nio/fs/UnixChannelFactory.java
      @@ -110,7 +110,7 @@ class UnixChannelFactory {
           static FileChannel newFileChannel(int fd, String path, boolean reading, boolean writing) {
               FileDescriptor fdObj = new FileDescriptor();
               fdAccess.set(fdObj, fd);
      -        return FileChannelImpl.open(fdObj, path, reading, writing, null);
      +        return FileChannelImpl.open(fdObj, path, reading, writing, false, null);
           }
       
           /**
      diff --git a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
      index a15950e9caa..2e962a2f4ab 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java
      @@ -183,7 +183,6 @@ public enum SourceVersion {
                       case "10":
                           return RELEASE_10;
                       case "9":
      -                case "1.9":
                           return RELEASE_9;
                       case "1.8":
                           return RELEASE_8;
      diff --git a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java
      index 6edba8ea15f..7e8f070b442 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java
      @@ -75,7 +75,7 @@ public abstract class AbstractAnnotationValueVisitor6
            * @deprecated Release 6 is obsolete; update to a visitor for a newer
            * release level.
            */
      -    @Deprecated
      +    @Deprecated(since="9")
           protected AbstractAnnotationValueVisitor6() {}
       
           /**
      diff --git a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java
      index 7901f85d409..6e644d2a631 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java
      @@ -75,7 +75,7 @@ public abstract class AbstractElementVisitor6 implements ElementVisitor implements TypeVisitor {
            * @deprecated Release 6 is obsolete; update to a visitor for a newer
            * release level.
            */
      -    @Deprecated
      +    @Deprecated(since="9")
           protected AbstractTypeVisitor6() {}
       
           /**
      diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java
      index 4913665bfa7..2aa646b428e 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java
      @@ -91,7 +91,7 @@ public class ElementKindVisitor6
            * @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 @@ public class ElementKindVisitor6
            * @deprecated Release 6 is obsolete; update to a visitor for a newer
            * release level.
            */
      -    @Deprecated
      +    @Deprecated(since="9")
           protected ElementKindVisitor6(R defaultValue) {
               super(defaultValue);
           }
      diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java
      index 7140f8bd59d..f4ef050c20d 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java
      @@ -106,7 +106,7 @@ public class ElementScanner6 extends AbstractElementVisitor6 {
            * @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 @@ public class ElementScanner6 extends AbstractElementVisitor6 {
            * @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;
           }
      diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor6.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor6.java
      index 9d33023db95..e6ec0d15b81 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor6.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor6.java
      @@ -92,7 +92,7 @@ public class SimpleAnnotationValueVisitor6
            * @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 @@ public class SimpleAnnotationValueVisitor6
            * @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;
      diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java
      index 8d20148b211..e7e97d0dd8b 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java
      @@ -94,7 +94,7 @@ public class SimpleElementVisitor6 extends AbstractElementVisitor6 {
            * @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 @@ public class SimpleElementVisitor6 extends AbstractElementVisitor6 {
            * @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;
           }
      diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java
      index b29062d5c8c..44d55c7bede 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java
      @@ -94,7 +94,7 @@ public class SimpleTypeVisitor6 extends AbstractTypeVisitor6 {
            * @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 @@ public class SimpleTypeVisitor6 extends AbstractTypeVisitor6 {
            * @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;
           }
      diff --git a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java
      index 2270dd0d350..347779b4e10 100644
      --- a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java
      +++ b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java
      @@ -85,7 +85,7 @@ public class TypeKindVisitor6 extends SimpleTypeVisitor6 {
            * @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 @@ public class TypeKindVisitor6 extends SimpleTypeVisitor6 {
            * @deprecated Release 6 is obsolete; update to a visitor for a newer
            * release level.
            */
      -    @Deprecated
      +    @Deprecated(since="9")
           protected TypeKindVisitor6(R defaultValue) {
               super(defaultValue);
           }
      diff --git a/src/java.compiler/share/classes/javax/tools/ToolProvider.java b/src/java.compiler/share/classes/javax/tools/ToolProvider.java
      index 91203e18996..1c7d0455a1e 100644
      --- a/src/java.compiler/share/classes/javax/tools/ToolProvider.java
      +++ b/src/java.compiler/share/classes/javax/tools/ToolProvider.java
      @@ -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 @@ public class ToolProvider {
            * 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;
           }
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Utility.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Utility.java
      index fffa6cae984..7da4bc88510 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Utility.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/Utility.java
      @@ -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 @@ public abstract class Utility {
            * @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();
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELFactory.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELFactory.java
      index 929d2832a34..7149cd29503 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELFactory.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELFactory.java
      @@ -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 @@ class BCELFactory extends EmptyVisitor {
       
       
           @Override
      +    @SuppressWarnings("fallthrough") // by design for case Const.ANEWARRAY
           public void visitAllocationInstruction( final AllocationInstruction i ) {
               Type type;
               if (i instanceof CPInstruction) {
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Message.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Message.java
      index cda255f0fca..71dc212dc40 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Message.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Message.java
      @@ -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 @@ final class Message extends Instruction {
               return Type.Void;
           }
       
      +    @SuppressWarnings("fallthrough") // at default
           public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
               final ConstantPoolGen cpg = classGen.getConstantPool();
               final InstructionList il = methodGen.getInstructionList();
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Step.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Step.java
      index 7ce3fa72eb0..35819b4fc97 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Step.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Step.java
      @@ -232,6 +232,7 @@ final class Step extends RelativeLocationPath {
               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) {
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Whitespace.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Whitespace.java
      index d6cd37c0e61..f33d8fd343d 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Whitespace.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Whitespace.java
      @@ -191,6 +191,7 @@ final class Whitespace extends TopLevelElement {
            * 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 rules,
                                                               WhitespaceRule rule) {
               for (WhitespaceRule currentRule : rules) {
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathLexer.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathLexer.java
      index 623b3f81417..6cb022649af 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathLexer.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathLexer.java
      @@ -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 @@ class XPathLexer implements com.sun.java_cup.internal.runtime.Scanner {
                * 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 @@ class XPathLexer implements com.sun.java_cup.internal.runtime.Scanner {
       ":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
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java
      index c1554f3c0af..0e5c7aa44ca 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathParser.java
      @@ -1591,13 +1591,13 @@ class parser_actions {
                   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 @@ class parser_actions {
                   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 @@ class parser_actions {
                   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);
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java
      index a78e1f8458b..623bfe389af 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/SAXImpl.java
      @@ -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 @@ public final class SAXImpl extends SAX2DTM2
                           // 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
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/TransletOutputHandlerFactory.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/TransletOutputHandlerFactory.java
      index 6ebdc780edb..985d6080578 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/TransletOutputHandlerFactory.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/TransletOutputHandlerFactory.java
      @@ -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 @@ public class TransletOutputHandlerFactory {
               _indentNumber = value;
           }
       
      +    @SuppressWarnings("fallthrough")  // intentional at case STAX, SAX
           public SerializationHandler getSerializationHandler()
               throws IOException, ParserConfigurationException
           {
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentTypeImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentTypeImpl.java
      index abdc94054a3..be164613472 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentTypeImpl.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentTypeImpl.java
      @@ -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 @@ public class DeferredDocumentTypeImpl
                           if (((DocumentImpl)getOwnerDocument()).allowGrammarAccess){
                               insertBefore(node, last);
                               last = node;
      -                        break;
                           }
      +                    break;
                       }
       
                       // NOTE: Should never get here! -Ac
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDElementTraverser.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDElementTraverser.java
      index 9ee9159cbb9..136daad8dcf 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDElementTraverser.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDElementTraverser.java
      @@ -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 @@ class XSDElementTraverser extends XSDAbstractTraverser {
                               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)) {
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java
      index a3cbdc7055b..1b5c5074647 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java
      @@ -3025,6 +3025,7 @@ public class XSDHandler {
               return newComponents;
           }
       
      +    @SuppressWarnings("fallthrough")
           private void expandRelatedComponents(XSObject component,ListcomponentList, Map> dependencies) {
               short componentType = component.getType();
               switch (componentType) {
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/AbstractDOMParser.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/AbstractDOMParser.java
      index 980faf76d71..3bad4eec47f 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/AbstractDOMParser.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/AbstractDOMParser.java
      @@ -600,6 +600,7 @@ public class AbstractDOMParser extends AbstractXMLDocumentParser {
            *
            * @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 @@ public class AbstractDOMParser extends AbstractXMLDocumentParser {
            *
            * @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 @@ public class AbstractDOMParser extends AbstractXMLDocumentParser {
            *
            * @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 @@ public class AbstractDOMParser extends AbstractXMLDocumentParser {
            * 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
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/DTMDocumentImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/DTMDocumentImpl.java
      index 999c3fc01b3..ea8fed859ef 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/DTMDocumentImpl.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/DTMDocumentImpl.java
      @@ -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 @@ implements DTM, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler
                * @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);
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/dom2dtm/DOM2DTM.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/dom2dtm/DOM2DTM.java
      index 1f11bba000c..af5155d9c1c 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/dom2dtm/DOM2DTM.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/dom2dtm/DOM2DTM.java
      @@ -1651,6 +1651,7 @@ public class DOM2DTM extends DTMDefaultBaseIterators
          * @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)
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java
      index ce088660144..8b65f445dcd 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java
      @@ -1020,6 +1020,7 @@ public abstract class BaseMarkupSerializer
            * @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
           {
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/FilterExprWalker.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/FilterExprWalker.java
      index d4f1c42ef83..8c9eabcd20a 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/FilterExprWalker.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/FilterExprWalker.java
      @@ -62,6 +62,7 @@ public class FilterExprWalker extends AxesWalker
          *
          * @throws javax.xml.transform.TransformerException
          */
      +  @SuppressWarnings("fallthrough")
         public void init(Compiler compiler, int opPos, int stepType)
                 throws javax.xml.transform.TransformerException
         {
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/MatchPatternIterator.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/MatchPatternIterator.java
      index 7a4a5934ee5..881893c66c8 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/MatchPatternIterator.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/MatchPatternIterator.java
      @@ -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 @@ public class MatchPatternIterator extends LocPathIterator
               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);
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/WalkerFactory.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/WalkerFactory.java
      index 2f20645a847..e02c19efff5 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/WalkerFactory.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/WalkerFactory.java
      @@ -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 @@ public class WalkerFactory
          *
          * @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 @@ public class WalkerFactory
             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 @@ public class WalkerFactory
          *
          * @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
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/Lexer.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/Lexer.java
      index ec790fca565..449c453cf11 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/Lexer.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/Lexer.java
      @@ -106,6 +106,7 @@ class Lexer
          *
          * @throws javax.xml.transform.TransformerException
          */
      +  @SuppressWarnings("fallthrough") // on purpose at case '-', '(' and default
         void tokenize(String pat, List targetStrings)
                 throws javax.xml.transform.TransformerException
         {
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/patterns/ContextMatchStepPattern.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/patterns/ContextMatchStepPattern.java
      index 19976d1c3a5..7a4ceb41778 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/patterns/ContextMatchStepPattern.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/patterns/ContextMatchStepPattern.java
      @@ -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 @@ public class ContextMatchStepPattern extends StepPattern
           if (xctxt.getIteratorRoot() == xctxt.getCurrentNode())
             return getStaticScore();
           else
      -      return this.SCORE_NONE;
      +      return NodeTest.SCORE_NONE;
         }
       
         /**
      diff --git a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/patterns/StepPattern.java b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/patterns/StepPattern.java
      index 4c7293d32d3..7f6bd66f86c 100644
      --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/patterns/StepPattern.java
      +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/patterns/StepPattern.java
      @@ -116,7 +116,7 @@ public class StepPattern extends NodeTest implements SubContextList, ExpressionO
             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;
      diff --git a/src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.java b/src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.java
      index ad38d4fe830..45f3c181ff9 100644
      --- a/src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.java
      +++ b/src/java.xml/share/classes/org/xml/sax/helpers/ParserAdapter.java
      @@ -586,7 +586,7 @@ public class ParserAdapter implements XMLReader, DocumentHandler
                                   // 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 ("", "",
      diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
      index 4be03fdfc1d..f0d37f1de52 100644
      --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
      +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
      @@ -292,8 +292,8 @@ public class Types {
               @Override
               public Type visitTypeVar(TypeVar t, ProjectionKind pkind) {
                   if (vars.contains(t)) {
      -                try {
      -                    if (seen.add(t)) {
      +                if (seen.add(t)) {
      +                    try {
                               final Type bound;
                               switch (pkind) {
                                   case UPWARDS:
      @@ -309,12 +309,13 @@ public class Types {
                                       return null;
                               }
                               return bound.map(this, pkind);
      -                    } else {
      -                        //cycle
      -                        return syms.objectType;
      +                    } finally {
      +                        seen.remove(t);
                           }
      -                } finally {
      -                    seen.remove(t);
      +                } else {
      +                    //cycle
      +                    return pkind == ProjectionKind.UPWARDS ?
      +                            syms.objectType : syms.botType;
                       }
                   } else {
                       return t;
      diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java
      index 590266591ad..f79f109b2e6 100644
      --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java
      +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java
      @@ -58,12 +58,10 @@ import com.sun.tools.javac.tree.TreeScanner;
       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 @@ public class Analyzer {
           final DeferredAttr deferredAttr;
           final ArgumentAttr argumentAttr;
           final TreeMaker make;
      -    final Names names;
      +    final AnalyzerCopier copier;
           private final boolean allowDiamondWithAnonymousClassCreation;
       
           final EnumSet analyzerModes;
      @@ -124,7 +122,7 @@ public class Analyzer {
               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 @@ public class Analyzer {
               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 rewrite(S oldTree);
       
               /**
                * Entry-point for comparing results and generating diagnostics.
                */
               abstract void process(S oldTree, T newTree, boolean hasErrors);
      -
           }
       
           /**
      @@ -233,11 +230,14 @@ public class Analyzer {
               }
       
               @Override
      -        JCNewClass map(JCNewClass oldTree, JCNewClass newTree) {
      -            if (newTree.clazz.hasTag(TYPEAPPLY)) {
      -                ((JCTypeApply)newTree.clazz).arguments = List.nil();
      +        List 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 @@ public class Analyzer {
                   }
       
               @Override
      -        JCLambda map (JCNewClass oldTree, JCNewClass newTree){
      -            JCMethodDecl md = (JCMethodDecl)decls(newTree.def).head;
      +        List rewrite(JCNewClass oldTree){
      +            JCMethodDecl md = (JCMethodDecl)decls(oldTree.def).head;
                   List 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 @@ public class Analyzer {
                           tree.typeargs.nonEmpty();
               }
               @Override
      -        JCMethodInvocation map (JCMethodInvocation oldTree, JCMethodInvocation newTree){
      -            newTree.typeargs = List.nil();
      -            return newTree;
      +        List 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 @@ public class Analyzer {
               /**
                * 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 @@ public class Analyzer {
               /**
                * 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 @@ public class Analyzer {
                           attr.canInferLocalVarType(tree) == null;
               }
               @Override
      -        JCVariableDecl map(JCVariableDecl oldTree, JCVariableDecl newTree){
      -            return mapVar(oldTree, newTree);
      +        List rewrite(JCVariableDecl oldTree) {
      +            return List.of(rewriteVarType(oldTree));
               }
               @Override
               void process(JCVariableDecl oldTree, JCVariableDecl newTree, boolean hasErrors){
      @@ -410,10 +415,11 @@ public class Analyzer {
                   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 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 @@ public class Analyzer {
            * and speculatively type-check the rewritten code to compare results against previously attributed code.
            */
           void analyze(JCStatement statement, Env 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 @@ public class Analyzer {
               /**
                * 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 @@ public class Analyzer {
            */
           DeferredAnalysisHelper flushDeferredHelper = new DeferredAnalysisHelper() {
               @Override
      -        public void queue(AnalysisContext context) {
      +        public void queue(RewritingContext rewriting) {
                   //do nothing
               }
       
      @@ -508,12 +515,12 @@ public class Analyzer {
            */
           DeferredAnalysisHelper queueDeferredHelper = new DeferredAnalysisHelper() {
       
      -        Map> Q = new HashMap<>();
      +        Map> Q = new HashMap<>();
       
               @Override
      -        public void queue(AnalysisContext context) {
      -            ArrayList s = Q.computeIfAbsent(context.env.enclClass.sym.outermostClass(), k -> new ArrayList<>());
      -            s.add(context);
      +        public void queue(RewritingContext rewriting) {
      +            ArrayList s = Q.computeIfAbsent(rewriting.env.enclClass.sym.outermostClass(), k -> new ArrayList<>());
      +            s.add(rewriting);
               }
       
               @Override
      @@ -522,9 +529,9 @@ public class Analyzer {
                       DeferredAnalysisHelper prevHelper = deferredAnalysisHelper;
                       try {
                           deferredAnalysisHelper = flushDeferredHelper;
      -                    ArrayList s = Q.get(flushEnv.enclClass.sym.outermostClass());
      -                    while (s != null && !s.isEmpty()) {
      -                        doAnalysis(s.remove(0));
      +                    ArrayList rewritings = Q.get(flushEnv.enclClass.sym.outermostClass());
      +                    while (rewritings != null && !rewritings.isEmpty()) {
      +                        doAnalysis(rewritings.remove(0));
                           }
                       } finally {
                           deferredAnalysisHelper = prevHelper;
      @@ -535,28 +542,24 @@ public class Analyzer {
       
           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();
      @@ -567,66 +570,23 @@ public class Analyzer {
               deferredAnalysisHelper.flush(flushEnv);
           }
       
      -    /**
      -     * 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 env;
      -
      -        AnalysisContext(JCTree tree, Env 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> treesToAnalyzer = new HashMap<>();
      -
      -        /** Map from original AST nodes to rewritten AST nodes */
      -        Map treeMap = new HashMap<>();
      -
      -        /** Errors in rewritten tree */
      -        ListBuffer 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 rewritings = new ListBuffer<>();
      +        JCTree originalTree;
      +        Env env;
       
      -        /** context */
      -        AnalysisContext context;
      +        StatementScanner(JCTree originalTree, Env 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 @@ public class Analyzer {
                           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 @@ public class Analyzer {
               }
           }
       
      +    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 env;
      +        // the corresponding analyzer
      +        StatementAnalyzer analyzer;
      +
      +        RewritingContext(
      +                JCTree originalTree,
      +                JCTree oldTree,
      +                JCTree replacement,
      +                StatementAnalyzer analyzer,
      +                Env 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 {
      +    class AnalyzerCopier extends TreeCopier {
       
      -        AnalysisContext context;
      -
      -        TreeMapper(AnalysisContext context) {
      +        public AnalyzerCopier() {
                   super(make);
      -            this.context = context;
      -        }
      -
      -        @Override
      -        @SuppressWarnings("unchecked")
      -        public  Z copy(Z tree, Void _unused) {
      -            Z newTree = super.copy(tree, _unused);
      -            StatementAnalyzer 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 @@ public class Analyzer {
                   return newNewClazz;
               }
           }
      +
      +   class TreeRewriter extends AnalyzerCopier {
      +
      +        RewritingContext rewriting;
      +
      +        TreeRewriter(RewritingContext rewriting) {
      +            this.rewriting = rewriting;
      +        }
      +
      +        @Override
      +        @SuppressWarnings("unchecked")
      +        public  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;
      +        }
      +    }
       }
      diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java
      index 12d4e1ba380..34106ec3897 100644
      --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java
      +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java
      @@ -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 @@ public class Main {
           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 @@ public class Main {
           private boolean signerSelfSigned = false;
       
           private Throwable chainNotValidatedReason = null;
      +    private Throwable tsaChainNotValidatedReason = null;
       
           private boolean seeWeak = false;
       
      @@ -266,7 +276,8 @@ public class Main {
       
               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 @@ public class Main {
                   if (notSignedByAlias || aliasNotInStore) {
                       exitCode |= 32;
                   }
      +            if (tsaChainNotValidated) {
      +                exitCode |= 64;
      +            }
                   if (exitCode != 0) {
                       System.exit(exitCode);
                   }
      @@ -864,6 +878,9 @@ public class Main {
                       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 @@ public class Main {
                                   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 @@ public class Main {
                       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 @@ public class Main {
       
                           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 @@ public class Main {
                                       "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 @@ public class Main {
           private static MessageFormat expiredTimeForm = null;
           private static MessageFormat expiringTimeForm = null;
       
      -    /*
      -     * Display some details about a certificate:
      +    /**
      +     * Returns a string about a certificate:
            *
            * []  [", " ] [" ("  ")"]
            * [ | ]
      +     * []
            *
      -     * 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 @@ public class Main {
                   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 @@ public class Main {
                           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 @@ public class Main {
                           certStr.append(validityTimeForm.format(source));
                       }
                   } catch (CertificateExpiredException cee) {
      -                hasExpiredCert = true;
      +                if (!isTsCert) hasExpiredCert = true;
       
                       if (expiredTimeForm == null) {
                           expiredTimeForm = new MessageFormat(
      @@ -1179,7 +1217,7 @@ public class Main {
                       certStr.append(expiredTimeForm.format(source));
       
                   } catch (CertificateNotYetValidException cnyve) {
      -                notYetValidCert = true;
      +                if (!isTsCert) notYetValidCert = true;
       
                       if (notYetTimeForm == null) {
                           notYetTimeForm = new MessageFormat(
      @@ -1398,7 +1436,7 @@ public class Main {
                           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 @@ public class Main {
                   }
               }
       
      +        // 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 @@ public class Main {
                   }
       
                   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 @@ public class Main {
       
                       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 @@ public class Main {
           /**
            * 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 @@ public class Main {
               // 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 @@ public class Main {
               }
           }
       
      -    void getAliasInfo(String alias) {
      +    void getAliasInfo(String alias) throws Exception {
       
               Key key = null;
       
      @@ -1887,10 +1974,11 @@ public class Main {
       
                   // 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 @@ public class Main {
               System.exit(1);
           }
       
      -    void validateCertChain(List certs) throws Exception {
      +    /**
      +     * Validates a cert chain.
      +     *
      +     * @param parameter this might be a timestamp
      +     */
      +    void validateCertChain(String variant, List 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) {
      diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java
      index ebdd79d792e..23f7f578ca3 100644
      --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java
      +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java
      @@ -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 @@ public class Resources extends java.util.ListResourceBundle {
               {"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 @@ public class Resources extends java.util.ListResourceBundle {
               {"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 @@ public class Resources extends java.util.ListResourceBundle {
                        "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: "},
      diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
      index ba0c19b9581..8a6e6f2cda2 100644
      --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
      +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
      @@ -36,7 +36,6 @@ import javax.lang.model.element.TypeParameterElement;
       import javax.lang.model.type.TypeMirror;
       
       import com.sun.source.doctree.DocTree;
      -import jdk.javadoc.internal.doclets.formats.html.TableHeader;
       import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
       import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
       import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
      @@ -44,6 +43,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
       import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
       import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
       import jdk.javadoc.internal.doclets.toolkit.Content;
      +import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
       import jdk.javadoc.internal.doclets.toolkit.Resources;
       import jdk.javadoc.internal.doclets.toolkit.taglets.DeprecatedTaglet;
       import jdk.javadoc.internal.doclets.toolkit.util.MethodTypes;
      @@ -65,7 +65,7 @@ import static javax.lang.model.element.Modifier.*;
        * @author Jamie Ho (Re-write)
        * @author Bhavesh Patel (Modified)
        */
      -public abstract class AbstractMemberWriter {
      +public abstract class AbstractMemberWriter implements MemberSummaryWriter {
       
           protected final HtmlConfiguration configuration;
           protected final Utils utils;
      @@ -519,7 +519,8 @@ public abstract class AbstractMemberWriter {
            * @param counter the counter for determining id and style for the table row
            */
           public void addMemberSummary(TypeElement tElement, Element member,
      -            List firstSentenceTags, List tableContents, int counter) {
      +            List firstSentenceTags, List tableContents, int counter,
      +            VisibleMemberMap.Kind vmmKind) {
               HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
               tdSummaryType.addStyle(HtmlStyle.colFirst);
               writer.addSummaryType(this, member, tdSummaryType);
      @@ -532,7 +533,8 @@ public abstract class AbstractMemberWriter {
               tdDesc.addStyle(HtmlStyle.colLast);
               writer.addSummaryLinkComment(this, member, firstSentenceTags, tdDesc);
               tr.addContent(tdDesc);
      -        if (utils.isMethod(member) && !utils.isAnnotationType(member) && !utils.isProperty(name(member))) {
      +        if (utils.isMethod(member) && !utils.isAnnotationType(member)
      +                && vmmKind != VisibleMemberMap.Kind.PROPERTIES) {
                   int methodType = utils.isStatic(member) ? MethodTypes.STATIC.tableTabs().value() :
                           MethodTypes.INSTANCE.tableTabs().value();
                   if (utils.isInterface(member.getEnclosingElement())) {
      diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
      index c7d5833212e..f10f2d52f79 100644
      --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
      +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
      @@ -292,11 +292,11 @@ public class PackageWriterImpl extends HtmlDocletWriter
                   Content tbody = new HtmlTree(HtmlTag.TBODY);
                   boolean altColor = false;
                   for (TypeElement klass : classes) {
      -                altColor = !altColor;
                       if (!utils.isCoreClass(klass) ||
                           !configuration.isGeneratedDoc(klass)) {
                           continue;
                       }
      +                altColor = !altColor;
                       Content classContent = getLink(new LinkInfoImpl(
                               configuration, LinkInfoImpl.Kind.PACKAGE, klass));
                       Content thClass = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, classContent);
      diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/MemberSummaryWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/MemberSummaryWriter.java
      index 415de482e73..f2bb8e34604 100644
      --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/MemberSummaryWriter.java
      +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/MemberSummaryWriter.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -32,6 +32,7 @@ import javax.lang.model.element.Element;
       import javax.lang.model.element.TypeElement;
       
       import com.sun.source.doctree.DocTree;
      +import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
       
       /**
        * The interface for writing member summary output.
      @@ -77,7 +78,8 @@ public interface MemberSummaryWriter {
            * @param counter the counter for determining id and style for the table row
            */
           public void addMemberSummary(TypeElement typeElement, Element member,
      -            List firstSentenceTags, List tableContents, int counter);
      +            List firstSentenceTags, List tableContents, int counter,
      +            VisibleMemberMap.Kind vmmKind);
       
           /**
            * Get the inherited member summary header for the given class.
      diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
      index 27062768010..79d583ebf1e 100644
      --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
      +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
      @@ -356,7 +356,7 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
                           }
                       }
                       writer.addMemberSummary(typeElement, member, firstSentenceTags,
      -                        tableContents, counter);
      +                        tableContents, counter, visibleMemberMap.kind);
                       counter++;
                   }
                   summaryTreeList.add(writer.getSummaryTableTree(typeElement, tableContents));
      diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
      index 24e1545e8e8..1258442d0bf 100644
      --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
      +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
      @@ -895,8 +895,8 @@ public class Utils {
                   }
                   VisibleMemberMap vmm = configuration.getVisibleMemberMap(te,
                           VisibleMemberMap.Kind.METHODS);
      -            List methods = vmm.getMembers(te);
      -            for (ExecutableElement ee : ElementFilter.methodsIn(methods)) {
      +            for (Element e : vmm.getMembers(te)) {
      +                ExecutableElement ee = (ExecutableElement)e;
                       if (configuration.workArounds.overrides(method, ee, origin) &&
                               !isSimpleOverride(ee)) {
                           return ee;
      diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java
      index 6b2933e5635..0a362e22952 100644
      --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java
      +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java
      @@ -272,9 +272,20 @@ public class VisibleMemberMap {
               return result;
           }
       
      +    // Cache to improve performance
      +    private HashMap overridenMethodCache = new HashMap<>();
      +
           private boolean hasOverridden(ExecutableElement method) {
      +        return overridenMethodCache.computeIfAbsent(method, m -> hasOverriddenCompute(m));
      +    }
      +
      +    private boolean hasOverriddenCompute(ExecutableElement method) {
      +        if (kind != Kind.METHODS) {
      +            throw new AssertionError("Unexpected kind: " + kind);
      +        }
               for (TypeElement t : visibleClasses) {
      -            for (ExecutableElement inheritedMethod : ElementFilter.methodsIn(classMap.get(t).members)) {
      +            for (Element member : classMap.get(t).members) {
      +                ExecutableElement inheritedMethod = (ExecutableElement)member;
                       if (utils.elementUtils.overrides(method, inheritedMethod, t)) {
                           return true;
                       }
      diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java
      index 7d2e73de826..e8cb2d7a52b 100644
      --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java
      +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java
      @@ -27,7 +27,9 @@ package jdk.tools.jlink.internal;
       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 final class Jlink {
            */
           public static final class JlinkConfiguration {
       
      -        private final List modulepaths;
               private final Path output;
               private final Set modules;
      -        private final Set limitmods;
               private final ByteOrder endian;
               private final ModuleFinder finder;
       
      @@ -157,33 +157,18 @@ public final class Jlink {
                * 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 modulepaths,
                                         Set modules,
      -                                  Set 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 getModulepaths() {
      -            return modulepaths;
      +            this.finder = finder;
               }
       
               /**
      @@ -207,13 +192,6 @@ public final class Jlink {
                   return modules;
               }
       
      -        /**
      -         * @return the limitmods
      -         */
      -        public Set getLimitmods() {
      -            return limitmods;
      -        }
      -
               /**
                * Returns {@link ModuleFinder} that finds all observable modules
                * for this jlink configuration.
      @@ -244,37 +222,16 @@ public final class Jlink {
                                                        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();
               }
      diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
      index 3559b05120b..a30089d4d7f 100644
      --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
      +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
      @@ -251,9 +251,18 @@ public class JlinkTask {
                       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 @@ public class JlinkTask {
               Set 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 @@ public class JlinkTask {
                   }
               }
       
      +        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 @@ public class JlinkTask {
               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 @@ public class JlinkTask {
                                                      Set limitMods,
                                                      Set 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;
           }
      diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/packager/AppRuntimeImageBuilder.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/packager/AppRuntimeImageBuilder.java
      index 3632ccb16c0..af78a300a94 100644
      --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/packager/AppRuntimeImageBuilder.java
      +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/packager/AppRuntimeImageBuilder.java
      @@ -96,10 +96,10 @@ public final class AppRuntimeImageBuilder {
               // 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 plugins = new ArrayList();
      diff --git a/src/sample/nashorn/bad_patterns.js b/src/sample/nashorn/bad_patterns.js
      new file mode 100644
      index 00000000000..9d880b79e3f
      --- /dev/null
      +++ b/src/sample/nashorn/bad_patterns.js
      @@ -0,0 +1,68 @@
      +/*
      + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
      + *
      + * Redistribution and use in source and binary forms, with or without
      + * modification, are permitted provided that the following conditions
      + * are met:
      + *
      + *   - Redistributions of source code must retain the above copyright
      + *     notice, this list of conditions and the following disclaimer.
      + *
      + *   - Redistributions in binary form must reproduce the above copyright
      + *     notice, this list of conditions and the following disclaimer in the
      + *     documentation and/or other materials provided with the distribution.
      + *
      + *   - Neither the name of Oracle nor the names of its
      + *     contributors may be used to endorse or promote products derived
      + *     from this software without specific prior written permission.
      + *
      + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
      + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
      + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
      + * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
      + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
      + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
      + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
      + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
      + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
      + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      + */
      +
      +/**
      + * This is a test script file for staticchecker.js.
      + *
      + * Usage:
      + *    jjs --language=es6 staticcheker.js -- bad_patterns.js
      + */
      +var obj = {}
      +obj.__proto__ = null;
      +
      +with(obj) {}
      +
      +delete obj;
      +
      +eval("print('hello')")
      +
      +Object = null
      +JavaImporter = undefined
      +
      +function func() {}
      +
      +func.prototype.x = 44;
      +
      +Object.prototype.foo = "hello";
      +
      +String.prototype.bar = function() {}
      +
      +try {
      +   eval("***");
      +} catch(e) {}
      +
      +try {
      +   eval("***");
      +} catch(e) { ; }
      +
      +try {
      +   eval("***");
      +} catch(e) { print(e) }
      diff --git a/src/sample/nashorn/staticchecker.js b/src/sample/nashorn/staticchecker.js
      new file mode 100644
      index 00000000000..d12d4c7e895
      --- /dev/null
      +++ b/src/sample/nashorn/staticchecker.js
      @@ -0,0 +1,207 @@
      +/*
      + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
      + *
      + * Redistribution and use in source and binary forms, with or without
      + * modification, are permitted provided that the following conditions
      + * are met:
      + *
      + *   - Redistributions of source code must retain the above copyright
      + *     notice, this list of conditions and the following disclaimer.
      + *
      + *   - Redistributions in binary form must reproduce the above copyright
      + *     notice, this list of conditions and the following disclaimer in the
      + *     documentation and/or other materials provided with the distribution.
      + *
      + *   - Neither the name of Oracle nor the names of its
      + *     contributors may be used to endorse or promote products derived
      + *     from this software without specific prior written permission.
      + *
      + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
      + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
      + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
      + * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
      + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
      + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
      + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
      + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
      + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
      + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      + */
      +
      +// Usage: jjs --language=es6 staticchecker.js -- 
      +//    or  jjs --language=es6 staticchecker.js -- 
      +// default argument is the current directory
      +
      +if (arguments.length == 0) {
      +    arguments[0] = ".";
      +}
      +
      +const File = Java.type("java.io.File");
      +const file = new File(arguments[0]);
      +if (!file.exists()) {
      +    print(arguments[0] + " is neither a file nor a directory");
      +    exit(1);
      +}
      +
      +// A simple static checker for javascript best practices.
      +// static checks performed are:
      +//
      +// *  __proto__ magic property is bad (non-standard)
      +// * 'with' statements are bad
      +// * 'eval' calls are bad
      +// * 'delete foo' (scope variable delete) is bad
      +// * assignment to standard globals is bad (eg. Object = "hello")
      +// * assignment to property on standard prototype is bad (eg. String.prototype.foo = 45)
      +// * exception swallow (empty catch block in try-catch statements)
      +
      +const Files = Java.type("java.nio.file.Files");
      +const EmptyStatementTree = Java.type("jdk.nashorn.api.tree.EmptyStatementTree");
      +const IdentifierTree = Java.type("jdk.nashorn.api.tree.IdentifierTree");
      +const MemberSelectTree = Java.type("jdk.nashorn.api.tree.MemberSelectTree");
      +const Parser = Java.type("jdk.nashorn.api.tree.Parser");
      +const SimpleTreeVisitor = Java.type("jdk.nashorn.api.tree.SimpleTreeVisitorES6");
      +const Tree = Java.type("jdk.nashorn.api.tree.Tree");
      +
      +const parser = Parser.create("-scripting", "--language=es6");
      +
      +// capture standard global upfront
      +const globals = new Set();
      +for (let name of Object.getOwnPropertyNames(this)) {
      +    globals.add(name);
      +}
      +
      +const checkFile = function(file) {
      +    print("Parsing " + file);
      +    const ast = parser.parse(file, print);
      +    if (!ast) {
      +        print("FAILED to parse: " + file);
      +        return;
      +    }
      +
      +    const checker = new (Java.extend(SimpleTreeVisitor)) {
      +        lineMap: null,
      +
      +        printWarning(node, msg) {
      +            var pos = node.startPosition;
      +            var line = this.lineMap.getLineNumber(pos);
      +            var column = this.lineMap.getColumnNumber(pos);
      +            print(`WARNING: ${msg} in ${file} @ ${line}:${column}`);
      +        },
      +        
      +        printWithWarning(node) {
      +            this.printWarning(node, "'with' usage");
      +        },
      +
      +        printProtoWarning(node) {
      +            this.printWarning(node, "__proto__ usage");
      +        },
      +
      +        printScopeDeleteWarning(node, varName) {
      +            this.printWarning(node, `delete ${varName}`);
      +        },
      +
      +        hasOnlyEmptyStats(stats) {
      +            const itr = stats.iterator();
      +            while (itr.hasNext()) {
      +                if (! (itr.next() instanceof EmptyStatementTree)) {
      +                    return false;
      +                }
      +            }
      +
      +            return true;
      +        },
      +
      +        checkProto(node, name) {
      +            if (name == "__proto__") {
      +                this.printProtoWarning(node);
      +            }
      +        },
      +
      +        checkAssignment(lhs) {
      +            if (lhs instanceof IdentifierTree && globals.has(lhs.name)) {
      +                this.printWarning(lhs, `assignment to standard global "${lhs.name}"`);
      +            } else if (lhs instanceof MemberSelectTree) {
      +                const expr = lhs.expression;
      +                if (expr instanceof MemberSelectTree &&
      +                    expr.expression instanceof IdentifierTree &&
      +                    globals.has(expr.expression.name) && 
      +                    "prototype" == expr.identifier) {
      +                    this.printWarning(lhs, 
      +                        `property set "${expr.expression.name}.prototype.${lhs.identifier}"`);
      +                }
      +            }
      +        },
      +
      +        visitAssignment(node, extra) {
      +            this.checkAssignment(node.variable);
      +            Java.super(checker).visitAssignment(node, extra);
      +        },
      +
      +        visitCatch(node, extra) {
      +            var stats = node.block.statements;
      +            if (stats.empty || this.hasOnlyEmptyStats(stats)) {
      +                this.printWarning(node, "exception swallow");
      +            }
      +            Java.super(checker).visitCatch(node, extra);
      +        },
      +
      +        visitCompilationUnit(node, extra) {
      +            this.lineMap = node.lineMap;
      +            Java.super(checker).visitCompilationUnit(node, extra);
      +        },
      +
      +        visitFunctionCall(node, extra) {
      +           var func = node.functionSelect;
      +           if (func instanceof IdentifierTree && func.name == "eval") {
      +               this.printWarning(node, "eval call found");
      +           }
      +           Java.super(checker).visitFunctionCall(node, extra);
      +        },
      +
      +        visitIdentifier(node, extra) {
      +            this.checkProto(node, node.name);
      +            Java.super(checker).visitIdentifier(node, extra);
      +        },
      +
      +        visitMemberSelect(node, extra) {
      +            this.checkProto(node, node.identifier);
      +            Java.super(checker).visitMemberSelect(node, extra);
      +        },
      +
      +        visitProperty(node, extra) {
      +            this.checkProto(node, node.key);
      +            Java.super(checker).visitProperty(node, extra);
      +        },
      +
      +        visitUnary(node, extra) {
      +            if (node.kind == Tree.Kind.DELETE &&
      +                node.expression instanceof IdentifierTree) {
      +                this.printScopeDeleteWarning(node, node.expression.name);
      +            }
      +            Java.super(checker).visitUnary(node, extra);
      +        },
      +
      +        visitWith(node, extra) {
      +            this.printWithWarning(node);
      +            Java.super(checker).visitWith(node, extra);
      +        }
      +    };
      +
      +    try {
      +        ast.accept(checker, null);
      +    } catch (e) {
      +        print(e);
      +        if (e.printStackTrace) e.printStackTrace();
      +        if (e.stack) print(e.stack);
      +    }
      +}
      +
      +if (file.isDirectory()) {
      +    Files.walk(file.toPath())
      +        .filter(function(p) Files.isRegularFile(p))
      +        .filter(function(p) p.toFile().name.endsWith('.js'))
      +        .forEach(checkFile);
      +} else {
      +    checkFile(file);
      +}
      diff --git a/test/TestCommon.gmk b/test/TestCommon.gmk
      index 39d2d18c8f2..aff29249184 100644
      --- a/test/TestCommon.gmk
      +++ b/test/TestCommon.gmk
      @@ -188,6 +188,16 @@ ifneq ($(ARCHIVE_BUNDLE), )
         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
      diff --git a/test/java/util/Calendar/Bug8185841.java b/test/java/util/Calendar/Bug8185841.java
      new file mode 100644
      index 00000000000..bb795512a6e
      --- /dev/null
      +++ b/test/java/util/Calendar/Bug8185841.java
      @@ -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 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 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 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 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 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 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 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 ");
      +        }
      +    }
      +}
      diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt
      index f44476a8035..46b23227d90 100644
      --- a/test/jdk/ProblemList.txt
      +++ b/test/jdk/ProblemList.txt
      @@ -316,8 +316,12 @@ sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java              8184042 macosx-a
       
       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
      +
       ############################################################################
      diff --git a/test/jdk/java/lang/invoke/StringConcatFactory/BasicTest.java b/test/jdk/java/lang/invoke/StringConcatFactory/BasicTest.java
      new file mode 100644
      index 00000000000..262ce1c8f12
      --- /dev/null
      +++ b/test/jdk/java/lang/invoke/StringConcatFactory/BasicTest.java
      @@ -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;
      +        }
      +    }
      +}
      diff --git a/test/jdk/java/nio/channels/FileChannel/directio/ReadDirect.java b/test/jdk/java/nio/channels/FileChannel/directio/ReadDirect.java
      index c8d6af4261e..6d57f0ace39 100644
      --- a/test/jdk/java/nio/channels/FileChannel/directio/ReadDirect.java
      +++ b/test/jdk/java/nio/channels/FileChannel/directio/ReadDirect.java
      @@ -177,7 +177,12 @@ public class ReadDirect {
                       }
                   }
       
      -            randomNumber = generator.nextInt(100);
      +            // The size of the test FileChannel is 100*charsPerGroup.
      +            // As the channel bytes will be scattered into two buffers
      +            // each of size charsPerGroup, the offset cannot be greater
      +            // than 98*charsPerGroup, so the value of randomNumber must
      +            // be in the range [0,98], i.e., 0 <= randomNumber < 99.
      +            randomNumber = generator.nextInt(99);
                   long offset =  randomNumber * charsPerGroup;
                   fc.position(offset);
                   fc.read(dests, 1, 2);
      diff --git a/test/jdk/java/rmi/testlibrary/TestSocketFactory.java b/test/jdk/java/rmi/testlibrary/TestSocketFactory.java
      index 338a39901d5..eae805641c7 100644
      --- a/test/jdk/java/rmi/testlibrary/TestSocketFactory.java
      +++ b/test/jdk/java/rmi/testlibrary/TestSocketFactory.java
      @@ -249,18 +249,22 @@ public class TestSocketFactory extends RMISocketFactory
               /**
                * 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 @@ public class TestSocketFactory extends RMISocketFactory
                       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;
               }
      diff --git a/test/jdk/java/util/Properties/InitialCapacity.java b/test/jdk/java/util/Properties/InitialCapacity.java
      new file mode 100644
      index 00000000000..81e5421bbef
      --- /dev/null
      +++ b/test/jdk/java/util/Properties/InitialCapacity.java
      @@ -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); }
      +}
      diff --git a/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java b/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java
      index dac7d43923f..f0774029606 100644
      --- a/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java
      +++ b/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java
      @@ -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.KeyStore;
       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 @@ import sun.security.x509.X500Name;
       
       /*
        * @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 @@ public class TimestampCheck {
               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 @@ public class TimestampCheck {
                       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 @@ public class TimestampCheck {
       
                   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 @@ public class TimestampCheck {
                           "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 @@ public class TimestampCheck {
       
               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 @@ public class TimestampCheck {
                               .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 @@ public class TimestampCheck {
                       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 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 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 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 @@ public class TimestampCheck {
                       .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 @@ public class TimestampCheck {
               }
           }
       
      -    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 @@ public class TimestampCheck {
                       .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 @@ public class TimestampCheck {
           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 @@ public class TimestampCheck {
           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 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 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 @@ public class TimestampCheck {
           }
       
           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 @@ public class TimestampCheck {
           }
       
           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(" "));
           }
      diff --git a/test/jdk/sun/security/tools/jarsigner/Warning.java b/test/jdk/sun/security/tools/jarsigner/Warning.java
      index a2dfd582f95..0ab562593cb 100644
      --- a/test/jdk/sun/security/tools/jarsigner/Warning.java
      +++ b/test/jdk/sun/security/tools/jarsigner/Warning.java
      @@ -83,14 +83,14 @@ public class Warning {
       
               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();
      diff --git a/test/jdk/sun/security/tools/jarsigner/checkusage.sh b/test/jdk/sun/security/tools/jarsigner/checkusage.sh
      index beac7883ba4..9940c46bdab 100644
      --- a/test/jdk/sun/security/tools/jarsigner/checkusage.sh
      +++ b/test/jdk/sun/security/tools/jarsigner/checkusage.sh
      @@ -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 @@ echo $RESULT
       #[ $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 @@ echo $RESULT
       #[ $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=$?
      diff --git a/test/jdk/sun/security/tools/jarsigner/warnings/Test.java b/test/jdk/sun/security/tools/jarsigner/warnings/Test.java
      index 2e0d34ee238..0490cad686b 100644
      --- a/test/jdk/sun/security/tools/jarsigner/warnings/Test.java
      +++ b/test/jdk/sun/security/tools/jarsigner/warnings/Test.java
      @@ -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 @@ public abstract class Test {
       
           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 @@ public abstract class Test {
                   + "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.";
      diff --git a/test/jdk/sun/security/tools/jarsigner/weaksize.sh b/test/jdk/sun/security/tools/jarsigner/weaksize.sh
      index f5ddd71e736..b612e385107 100644
      --- a/test/jdk/sun/security/tools/jarsigner/weaksize.sh
      +++ b/test/jdk/sun/security/tools/jarsigner/weaksize.sh
      @@ -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 @@ $KT -certreq -alias signer | \
       $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
      diff --git a/test/jdk/sun/text/resources/LocaleData.cldr b/test/jdk/sun/text/resources/LocaleData.cldr
      index 4b348430e19..ad4bcadd020 100644
      --- a/test/jdk/sun/text/resources/LocaleData.cldr
      +++ b/test/jdk/sun/text/resources/LocaleData.cldr
      @@ -8300,3 +8300,82 @@ FormatData/kea/latn.NumberElements/0=,
       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
      diff --git a/test/jdk/sun/text/resources/LocaleDataTest.java b/test/jdk/sun/text/resources/LocaleDataTest.java
      index 3c900e318f8..1549b65d911 100644
      --- a/test/jdk/sun/text/resources/LocaleDataTest.java
      +++ b/test/jdk/sun/text/resources/LocaleDataTest.java
      @@ -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
      diff --git a/test/jdk/tools/jlink/IntegrationTest.java b/test/jdk/tools/jlink/IntegrationTest.java
      index 1218fad9f27..bf23080bce2 100644
      --- a/test/jdk/tools/jlink/IntegrationTest.java
      +++ b/test/jdk/tools/jlink/IntegrationTest.java
      @@ -39,6 +39,7 @@ import java.util.Properties;
       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 @@ public class IntegrationTest {
               Set 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 lst = new ArrayList<>();
       
      diff --git a/test/jdk/tools/jlink/JLinkTest.java b/test/jdk/tools/jlink/JLinkTest.java
      index 64b220710e5..502ff461003 100644
      --- a/test/jdk/tools/jlink/JLinkTest.java
      +++ b/test/jdk/tools/jlink/JLinkTest.java
      @@ -42,6 +42,7 @@ import tests.JImageGenerator;
       /*
        * @test
        * @summary Test image creation
      + * @bug 8189777
        * @author Jean-Francois Denise
        * @library ../lib
        * @modules java.base/jdk.internal.jimage
      @@ -105,6 +106,37 @@ public class JLinkTest {
                   }
               }
       
      +        {
      +            // 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()
      @@ -122,6 +154,17 @@ public class JLinkTest {
                           .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");
               }
       
               {
      diff --git a/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java b/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java
      index 6766a1df256..c6863202991 100644
      --- a/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java
      +++ b/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java
      @@ -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 @@ import tests.Result;
       
       /*
        * @test
      - * @bug 8152143 8152704 8155649 8165804
      + * @bug 8152143 8152704 8155649 8165804 8185841
        * @summary IncludeLocalesPlugin tests
        * @author Naoto Sato
        * @library ../../lib
      @@ -231,7 +231,7 @@ public class IncludeLocalesPluginTest {
                       "/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 @@ public class IncludeLocalesPluginTest {
                       "/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"),
                   "",
               },
       
      diff --git a/test/jdk/tools/lib/tests/Helper.java b/test/jdk/tools/lib/tests/Helper.java
      index 5ab2eff8451..022370440c6 100644
      --- a/test/jdk/tools/lib/tests/Helper.java
      +++ b/test/jdk/tools/lib/tests/Helper.java
      @@ -136,7 +136,11 @@ public class Helper {
           }
       
           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();
      diff --git a/test/langtools/jdk/javadoc/doclet/testGroupName/TestGroupName.java b/test/langtools/jdk/javadoc/doclet/testGroupName/TestGroupName.java
      new file mode 100644
      index 00000000000..68a0cfb5584
      --- /dev/null
      +++ b/test/langtools/jdk/javadoc/doclet/testGroupName/TestGroupName.java
      @@ -0,0 +1,108 @@
      +/*
      + * 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 8190003
      + * @summary Special characters in group names should be escaped
      + * @library /tools/lib ../lib
      + * @modules jdk.javadoc/jdk.javadoc.internal.tool
      + * @build toolbox.ToolBox JavadocTester
      + * @run main TestGroupName
      + */
      +
      +import java.io.IOException;
      +import java.nio.file.Path;
      +import java.nio.file.Paths;
      +
      +import toolbox.*;
      +
      +public class TestGroupName extends JavadocTester {
      +
      +    public final ToolBox tb;
      +    public static void main(String... args) throws Exception {
      +        TestGroupName tester = new TestGroupName();
      +        tester.runTests(m -> new Object[] { Paths.get(m.getName()) });
      +    }
      +
      +    public TestGroupName() {
      +        tb = new ToolBox();
      +    }
      +
      +    @Test
      +    public void testPackageGroups(Path base) throws IOException {
      +        Path src = base.resolve("src");
      +        tb.writeJavaFiles(src,
      +                "package p1; public class C1 { }",
      +                "package p2; public class C2 { }",
      +                "package p3; public class C3 { }");
      +
      +        javadoc("-d", base.resolve("out").toString(),
      +                "-sourcepath", src.toString(),
      +                "-group", "abc < & > def", "p1",
      +                "p1", "p2", "p3");
      +        checkExit(Exit.OK);
      +
      +        checkOutput("overview-summary.html", true,
      +                "abc < & > def");
      +
      +        checkOutput("overview-summary.html", false,
      +                "abc < & > def");
      +    }
      +
      +    @Test
      +    public void testModuleGroups(Path base) throws IOException {
      +        Path src = base.resolve("src");
      +        tb.writeJavaFiles(src.resolve("ma"),
      +                "module ma { exports pa1; }",
      +                "package pa1; public class CA1 { }",
      +                "package pa2; public class CA2 { }",
      +                "package pa3; public class CA3 { }");
      +
      +        tb.writeJavaFiles(src.resolve("mb"),
      +                "module mb { exports pb1; }",
      +                "package pb1; public class CB1 { }",
      +                "package pb2; public class CB2 { }",
      +                "package pb3; public class CB3 { }");
      +
      +        tb.writeJavaFiles(src.resolve("mc"),
      +                "module mc { exports pc1; }",
      +                "package pc1; public class CC1 { }",
      +                "package pc2; public class CC2 { }",
      +                "package pc3; public class CC3 { }");
      +
      +        javadoc("-d", base.resolve("out").toString(),
      +                "--module-source-path", src.toString(),
      +                "-group", "abc < & > def", "ma",
      +                "--module", "ma,mb,mc");
      +
      +        checkExit(Exit.OK);
      +
      +        checkOutput("overview-summary.html", true,
      +                "abc < & > def");
      +
      +        checkOutput("overview-summary.html", false,
      +                "abc < & > def");
      +    }
      +}
      +
      diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSummary/TestPackageSummary.java b/test/langtools/jdk/javadoc/doclet/testPackageSummary/TestPackageSummary.java
      new file mode 100644
      index 00000000000..df43f2bd316
      --- /dev/null
      +++ b/test/langtools/jdk/javadoc/doclet/testPackageSummary/TestPackageSummary.java
      @@ -0,0 +1,75 @@
      +/*
      + * 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 8189841
      + * @summary Error in alternate row coloring in package-summary files
      + * @library  ../lib/
      + * @modules jdk.javadoc/jdk.javadoc.internal.tool
      + * @build    JavadocTester TestPackageSummary
      + * @run main TestPackageSummary
      + */
      +
      +public class TestPackageSummary extends JavadocTester {
      +
      +    public static void main(String... args) throws Exception {
      +        TestPackageSummary tester = new TestPackageSummary();
      +        tester.runTests();
      +    }
      +
      +    @Test
      +    void testStripes() {
      +        javadoc("-d", "out",
      +                "-sourcepath", testSrc,
      +                "pkg");
      +        checkExit(Exit.OK);
      +
      +        checkOutput("pkg/package-summary.html", true,
      +                "\n"
      +                + "\n"
      +                + "C0\n"
      +                + " \n"
      +                + "\n"
      +                + "\n"
      +                + "C1\n"
      +                + " \n"
      +                + "\n"
      +                + "\n"
      +                + "C2\n"
      +                + " \n"
      +                + "\n"
      +                + "\n"
      +                + "C3\n"
      +                + " \n"
      +                + "\n"
      +                + "\n"
      +                + "C4\n"
      +                + " \n"
      +                + "\n"
      +                + "\n"
      +        );
      +    }
      +}
      +
      diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C0.java b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C0.java
      new file mode 100644
      index 00000000000..7284ea1a8c5
      --- /dev/null
      +++ b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C0.java
      @@ -0,0 +1,29 @@
      +/*
      + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
      + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      + *
      + * This code is free software; you can redistribute it and/or modify it
      + * under the terms of the GNU General Public License version 2 only, as
      + * published by the Free Software Foundation.
      + *
      + * This code is distributed in the hope that it will be useful, but WITHOUT
      + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      + * version 2 for more details (a copy is included in the LICENSE file that
      + * accompanied this code).
      + *
      + * You should have received a copy of the GNU General Public License version
      + * 2 along with this work; if not, write to the Free Software Foundation,
      + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
      + *
      + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
      + * or visit www.oracle.com if you need additional information or have any
      + * questions.
      + */
      +
      +package pkg;
      +
      +public class C0 {
      +  // no inner classes
      +}
      +
      diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C1.java b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C1.java
      new file mode 100644
      index 00000000000..48dc0ff5949
      --- /dev/null
      +++ b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C1.java
      @@ -0,0 +1,29 @@
      +/*
      + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
      + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      + *
      + * This code is free software; you can redistribute it and/or modify it
      + * under the terms of the GNU General Public License version 2 only, as
      + * published by the Free Software Foundation.
      + *
      + * This code is distributed in the hope that it will be useful, but WITHOUT
      + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      + * version 2 for more details (a copy is included in the LICENSE file that
      + * accompanied this code).
      + *
      + * You should have received a copy of the GNU General Public License version
      + * 2 along with this work; if not, write to the Free Software Foundation,
      + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
      + *
      + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
      + * or visit www.oracle.com if you need additional information or have any
      + * questions.
      + */
      +
      +package pkg;
      +
      +public class C1 {
      +  public class Inner1 { }
      +}
      +
      diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C2.java b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C2.java
      new file mode 100644
      index 00000000000..b7937355f4c
      --- /dev/null
      +++ b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C2.java
      @@ -0,0 +1,30 @@
      +/*
      + * 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 pkg;
      +
      +public class C2 {
      +  public class Inner1 { }
      +  public class Inner2 { }
      +}
      +
      diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C3.java b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C3.java
      new file mode 100644
      index 00000000000..b6b0e038311
      --- /dev/null
      +++ b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C3.java
      @@ -0,0 +1,31 @@
      +/*
      + * 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 pkg;
      +
      +public class C3 {
      +  public class Inner1 { }
      +  public class Inner2 { }
      +  public class Inner3 { }
      +}
      +
      diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C4.java b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C4.java
      new file mode 100644
      index 00000000000..2d711cdef52
      --- /dev/null
      +++ b/test/langtools/jdk/javadoc/doclet/testPackageSummary/pkg/C4.java
      @@ -0,0 +1,32 @@
      +/*
      + * 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 pkg;
      +
      +public class C4 {
      +  public class Inner1 { }
      +  public class Inner2 { }
      +  public class Inner3 { }
      +  public class Inner4 { }
      +}
      +
      diff --git a/test/langtools/jdk/javadoc/doclet/testProperty/TestProperty.java b/test/langtools/jdk/javadoc/doclet/testProperty/TestProperty.java
      index 69eec3a504c..033482dfd71 100644
      --- a/test/langtools/jdk/javadoc/doclet/testProperty/TestProperty.java
      +++ b/test/langtools/jdk/javadoc/doclet/testProperty/TestProperty.java
      @@ -23,7 +23,7 @@
       
       /*
        * @test
      - * @bug      8176231
      + * @bug      8176231 8189843
        * @summary  Test JavaFX property.
        * @library  ../lib/
        * @modules jdk.javadoc/jdk.javadoc.internal.tool
      @@ -71,7 +71,23 @@ public class TestProperty extends JavadocTester {
                       + "
      getBad(), \n" + "" + "setBad(MyObj[])
      \n" - + "" + + "", + + // id should not be used in the property table + "\n" + + "ObjectProperty<MyObj[]>\n" + + "" + + "bad", + + // id should be used in the method table + "\n" + + "ObjectProperty<MyObj[]>\n" + + "" + + "badProperty()" ); checkOutput("pkg/MyClassT.html", true, diff --git a/test/langtools/tools/javac/lvti/harness/NonDenotableTest.java b/test/langtools/tools/javac/lvti/harness/NonDenotableTest.java index 940da65043e..a05a00ffa83 100644 --- a/test/langtools/tools/javac/lvti/harness/NonDenotableTest.java +++ b/test/langtools/tools/javac/lvti/harness/NonDenotableTest.java @@ -25,7 +25,7 @@ /* * @test - * @bug 8177466 + * @bug 8177466 8189838 * @summary Add compiler support for local variable type-inference * @modules jdk.compiler/com.sun.source.tree * jdk.compiler/com.sun.source.util @@ -50,6 +50,7 @@ class NonDenotableTest { static final String LIST_EXT_COMP_UNB = "java.util.List>"; static final String LIST_SUP_COMP_UNB = "java.util.List>"; static final String INT_INTEGER_DOUBLE = "#INT(java.lang.Number,java.lang.Comparable>)"; + static final String SEL_INT_ENUM_SEL = "NonDenotableTest.Selector,NonDenotableTest.Selector)>"; void testExtends() { @InferredType(LIST_EXT) @@ -120,6 +121,14 @@ class NonDenotableTest { for (@InferredType(INT_INTEGER_DOUBLE) var s2 : listOf(choose(1, 1L))) { break; } } + void testIntersection(Selector s) { + @InferredType(SEL_INT_ENUM_SEL) + var c = s; + for (@InferredType(SEL_INT_ENUM_SEL) var s2 = s ; ;) { break; } + for (@InferredType(SEL_INT_ENUM_SEL) var s2 : arrayOf(s)) { break; } + for (@InferredType(SEL_INT_ENUM_SEL) var s2 : listOf(s)) { break; } + } + List extString() { return null; } List supString() { return null; } List unbString() { return null; } @@ -145,4 +154,6 @@ class NonDenotableTest { Z[] arrayOf(Z z) { return null; } Z choose(Z z1, Z z2) { return z1; } + + interface Selector & Selector> {} } diff --git a/test/langtools/tools/javac/tree/NoPrivateTypesExported.java b/test/langtools/tools/javac/tree/NoPrivateTypesExported.java index 38b6b964463..2f8b51f0a30 100644 --- a/test/langtools/tools/javac/tree/NoPrivateTypesExported.java +++ b/test/langtools/tools/javac/tree/NoPrivateTypesExported.java @@ -206,6 +206,33 @@ public class NoPrivateTypesExported extends JavacTestingAbstractProcessor { } 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); diff --git a/test/lib/jdk/test/lib/SecurityTools.java b/test/lib/jdk/test/lib/SecurityTools.java index 8e8e6cf83ed..eb5f5018fdd 100644 --- a/test/lib/jdk/test/lib/SecurityTools.java +++ b/test/lib/jdk/test/lib/SecurityTools.java @@ -52,10 +52,7 @@ public class SecurityTools { 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 @@ public class SecurityTools { 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 class SecurityTools { public static OutputAnalyzer jarsigner(List 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 diff --git a/test/lib/jdk/test/lib/util/JarUtils.java b/test/lib/jdk/test/lib/util/JarUtils.java index 76705f5395c..bc752d96a91 100644 --- a/test/lib/jdk/test/lib/util/JarUtils.java +++ b/test/lib/jdk/test/lib/util/JarUtils.java @@ -27,9 +27,13 @@ import java.io.FileInputStream; 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 final class JarUtils { */ public static void updateJar(String src, String dest, String... files) throws IOException { + Map 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 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 updatedFiles = new ArrayList<>(); try (JarFile srcJarFile = new JarFile(src)) { Enumeration 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 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()); + } + } + } }