changeset 47406:378efa95df46

Merge
author prr
date Thu, 28 Sep 2017 09:13:27 -0700
parents bf712ea57bb0 cd02250e9370
children 9d5b6fa13d83
files doc/nashorn/genshelldoc.js make/launcher/Launcher-jdk.policytool.gmk src/bsd/doc/man/ja/policytool.1 src/bsd/doc/man/policytool.1 src/java.base/unix/native/libjava/FileInputStream_md.c src/java.base/unix/native/libjava/RandomAccessFile_md.c src/java.base/windows/native/libjava/FileInputStream_md.c src/java.base/windows/native/libjava/RandomAccessFile_md.c src/jdk.jshell/share/classes/jdk/jshell/VarTypePrinter.java src/jdk.policytool/share/classes/module-info.java src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources.java src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_de.java src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_es.java src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_fr.java src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_it.java src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_ja.java src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_ko.java src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_pt_BR.java src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_sv.java src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_CN.java src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_HK.java src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_TW.java src/linux/doc/man/ja/policytool.1 src/linux/doc/man/policytool.1 src/sample/nashorn/disassemble.js src/solaris/doc/sun/man/man1/ja/policytool.1 src/solaris/doc/sun/man/man1/policytool.1 test/jdk/java/lang/ClassLoader/getdotresource.sh test/jdk/java/lang/ClassLoader/resource.jar test/jdk/sun/security/tools/policytool/Alias.html test/jdk/sun/security/tools/policytool/Alias.java test/jdk/sun/security/tools/policytool/Alias.sh test/jdk/sun/security/tools/policytool/ChangeUI.html test/jdk/sun/security/tools/policytool/ChangeUI.java test/jdk/sun/security/tools/policytool/ChangeUI.sh test/jdk/sun/security/tools/policytool/OpenPolicy.html test/jdk/sun/security/tools/policytool/OpenPolicy.java test/jdk/sun/security/tools/policytool/OpenPolicy.sh test/jdk/sun/security/tools/policytool/SaveAs.html test/jdk/sun/security/tools/policytool/SaveAs.java test/jdk/sun/security/tools/policytool/SaveAs.sh test/jdk/sun/security/tools/policytool/UpdatePermissions.html test/jdk/sun/security/tools/policytool/UpdatePermissions.java test/jdk/sun/security/tools/policytool/UpdatePermissions.sh test/jdk/sun/security/tools/policytool/UsePolicy.html test/jdk/sun/security/tools/policytool/UsePolicy.java test/jdk/sun/security/tools/policytool/UsePolicy.sh test/jdk/sun/security/tools/policytool/i18n.html test/jdk/sun/security/tools/policytool/i18n.java test/jdk/sun/security/tools/policytool/i18n.sh test/nashorn/script/currently-failing/JDK-8055034.js test/nashorn/script/currently-failing/JDK-8055034.js.EXPECTED
diffstat 399 files changed, 7812 insertions(+), 10896 deletions(-) [+]
line wrap: on
line diff
--- a/bin/unshuffle_list.txt	Tue Sep 26 10:46:23 2017 +0530
+++ b/bin/unshuffle_list.txt	Thu Sep 28 09:13:27 2017 -0700
@@ -88,7 +88,6 @@
 src/jdk.naming.rmi : jdk/src/jdk.naming.rmi
 src/jdk.net : jdk/src/jdk.net
 src/jdk.pack : jdk/src/jdk.pack
-src/jdk.policytool : jdk/src/jdk.policytool
 src/jdk.rmic : corba/src/jdk.rmic  jdk/src/jdk.rmic
 src/jdk.scripting.nashorn : nashorn/src/jdk.scripting.nashorn
 src/jdk.scripting.nashorn.shell : nashorn/src/jdk.scripting.nashorn.shell
--- a/doc/nashorn/genshelldoc.js	Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * Generate HTML documentation for shell tool. Re-run this tool to regenerate
- * html doc when you change options.
- *
- * Usage:
- *
- *     jjs -scripting genshelldoc.js > shell.html
- */
-
-var Options = Packages.jdk.nashorn.internal.runtime.options.Options;
-var title = "Nashorn command line shell tool";
-
-print(<<PREFIX
-<html>
-<head>
-<title>
-${title}
-</title>
-</head>
-<body>
-<h1>Usage</h1>
-<p>
-<code>
-<b>jjs &lt;options&gt; &lt;script-files&gt; [ -- &lt;script-arguments&gt; ]</b>
-</code>
-</p>
-
-<h1>${title} options</h1>
-
-<table border="0">
-<tr>
-<th>name</th>
-<th>type</th>
-<th>default</th>
-<th>description</th>
-</tr>
-PREFIX);
-
-for each (opt in Options.validOptions) {
-
-var isTimezone = (opt.type == "timezone");
-var defValue = opt.defaultValue;
-if (defValue == null) {
-    defValue = "&lt;none&gt;";
-}
-
-if (isTimezone) {
-    // don't output current user's timezone
-    defValue = "&lt;default-timezone&gt;"
-}
-
-print(<<ROW
-  <tr>
-  <td><b>${opt.name} ${opt.shortName == null? "" : opt.shortName}</b></td>
-  <td>${opt.type}</td>
-  <td>${defValue}</td>
-  <td>${opt.description}</td>
-  </tr>
-ROW);
-
-}
-
-print(<<SUFFIX
-</table>
-</body>
-</html>
-SUFFIX);
--- a/make/BuildNashorn.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/BuildNashorn.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -41,7 +41,7 @@
 $(eval $(call SetupJavaCompiler, GENERATE_NEWBYTECODE_DEBUG, \
     JVM := $(JAVA_JAVAC), \
     JAVAC := $(NEW_JAVAC), \
-    FLAGS := -g -source 9 -target 9 --upgrade-module-path "$(JDK_OUTPUTDIR)/modules/" \
+    FLAGS := -g -source 10 -target 10 --upgrade-module-path "$(JDK_OUTPUTDIR)/modules/" \
          --system none --module-source-path $(call GetModuleSrcPath), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
--- a/make/Bundles.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/Bundles.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -56,7 +56,7 @@
     $$(eval $1_$$d_RELATIVE_FILES := $$$$(patsubst $$d/%, %, \
         $$$$(filter $$d/%, $$$$($1_FILES)))) \
     $$(eval $1_$$d_LIST_FILE := \
-        $(SUPPORT_OUTPUTDIR)/bundles/_$1_$$$$(subst /,_,$$$$(patsubst $(OUTPUT_ROOT)/%,%,$$d)_files)) \
+        $(SUPPORT_OUTPUTDIR)/bundles/_$1_$$$$(subst /,_,$$$$(patsubst $(OUTPUTDIR)/%,%,$$d)_files)) \
   )
 
   ifneq ($$(filter %.tar.gz, $$($1_BUNDLE_NAME)), )
--- a/make/CopyImportModules.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/CopyImportModules.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -62,10 +62,10 @@
         FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \
     ))
 
-    # Use relative links if the import dir is inside the OUTPUT_ROOT, otherwise
+    # Use relative links if the import dir is inside the OUTPUTDIR, otherwise
     # copy to avoid having automated systems following symlinks when deleting files,
     # or risk invalidating the build output from external changes.
-    ifeq ($(filter $(OUTPUT_ROOT)/%, $(LIBS_DIR)), )
+    ifeq ($(filter $(OUTPUTDIR)/%, $(LIBS_DIR)), )
       LINK_MACRO := install-file
       LOG_ACTION := Copying
     else
--- a/make/CreateBuildJdkCopy.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/CreateBuildJdkCopy.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -54,7 +54,7 @@
 ################################################################################
 
 $(eval $(call SetupCopyFiles, COPY_SUPPORT_HEADERS, \
-    SRC := $(BUILD_OUTPUT), \
+    SRC := $(OUTPUTDIR), \
     DEST := $(BUILDJDK_OUTPUTDIR), \
     FILES := $(call CacheFind, $(wildcard \
         $(addprefix $(SUPPORT_OUTPUTDIR)/headers/, $(MODULES_TO_COPY)))), \
@@ -65,7 +65,7 @@
 ################################################################################
 
 $(eval $(call SetupCopyFiles, COPY_JDK_LIB_FILES, \
-    SRC := $(BUILD_OUTPUT), \
+    SRC := $(OUTPUTDIR), \
     DEST := $(BUILDJDK_OUTPUTDIR), \
     FILES := $(JDK_OUTPUTDIR)/lib/tzdb.dat, \
 ))
--- a/make/CreateJmods.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/CreateJmods.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -130,7 +130,7 @@
 # Create jmods in a temp dir and then move them into place to keep the
 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
 $(JMODS_DIR)/$(MODULE).jmod: $(DEPS)
-	$(call LogWarn, Creating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+	$(call LogWarn, Creating $(patsubst $(OUTPUTDIR)/%, %, $@))
 	$(call MakeDir, $(JMODS_DIR) $(JMODS_TEMPDIR))
 	$(RM) $@ $(JMODS_TEMPDIR)/$(notdir $@)
 	$(JMOD) create \
--- a/make/Docs.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/Docs.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -532,7 +532,7 @@
 # Optional target which bundles all generated javadocs into a zip archive.
 
 JAVADOC_ZIP_NAME := jdk-$(VERSION_STRING)-docs.zip
-JAVADOC_ZIP_FILE := $(OUTPUT_ROOT)/bundles/$(JAVADOC_ZIP_NAME)
+JAVADOC_ZIP_FILE := $(OUTPUTDIR)/bundles/$(JAVADOC_ZIP_NAME)
 
 $(eval $(call SetupZipArchive, BUILD_JAVADOC_ZIP, \
     SRC := $(DOCS_OUTPUTDIR), \
--- a/make/GenerateLinkOptData.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/GenerateLinkOptData.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -59,8 +59,8 @@
 
 $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR)
 	$(call MakeDir, $(LINK_OPT_DIR))
-	$(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
-	$(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $(JLI_TRACE_FILE)))
+	$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@))
+	$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $(JLI_TRACE_FILE)))
 	$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@ \
 	    -Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true \
 	    -cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
--- a/make/Images.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/Images.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -223,7 +223,6 @@
       jstack.1 \
       jstat.1 \
       jstatd.1 \
-      policytool.1 \
       rmic.1 \
       schemagen.1 \
       serialver.1 \
@@ -248,38 +247,38 @@
   endif
 
   $(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
-	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(install-file)
 
   $(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
-	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(install-file)
 
   $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(install-file)
 
   $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(install-file)
 
   ifeq ($(OPENJDK_TARGET_OS), solaris)
     $(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(call LogInfo, Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+	$(call LogInfo, Converting $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(install-file)
 
     $(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(call LogInfo, Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+	$(call LogInfo, Converting $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(install-file)
   endif
 
   ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
     $(JRE_IMAGE_DIR)/man/ja:
-	$(call LogInfo, Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+	$(call LogInfo, Creating $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
 
     $(JDK_IMAGE_DIR)/man/ja:
-	$(call LogInfo, Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+	$(call LogInfo, Creating $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
   endif
 
@@ -313,7 +312,7 @@
 # src.zip
 
 $(JDK_IMAGE_DIR)/lib/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
-	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(install-file)
 
 JDK_TARGETS += $(JDK_IMAGE_DIR)/lib/src.zip
@@ -355,14 +354,14 @@
   GCOV_FIND_EXPR := -type f -name "*.gcno"
 
   $(eval $(call SetupCopyFiles,COPY_HOTSPOT_GCOV_GCNO, \
-      SRC := $(OUTPUT_ROOT), \
+      SRC := $(OUTPUTDIR), \
       DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \
       FILES := $(shell $(FIND) $(HOTSPOT_OUTPUTDIR) $(GCOV_FIND_EXPR))))
 
   SYMBOLS_TARGETS += $(COPY_HOTSPOT_GCOV_GCNO)
 
   $(eval $(call SetupCopyFiles,COPY_JDK_GCOV_GCNO, \
-      SRC := $(OUTPUT_ROOT), \
+      SRC := $(OUTPUTDIR), \
       DEST := $(SYMBOLS_IMAGE_DIR)/gcov, \
       FILES := $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/native $(GCOV_FIND_EXPR))))
 
--- a/make/Init.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/Init.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -265,7 +265,7 @@
         else
 	  $(ECHO) "Re-running configure using default settings"
         endif
-	( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \
+	( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \
 	    $(BASH) $(CONFIGURE_CMD) $(CONFIGURE_COMMAND_LINE) )
 
   ##############################################################################
--- a/make/InitSupport.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/InitSupport.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -349,8 +349,8 @@
   include $(TOPDIR)/make/common/MakeBase.gmk
 
   # Define basic logging setup
-  BUILD_LOG := $(OUTPUT_ROOT)/build.log
-  BUILD_PROFILE_LOG := $(OUTPUT_ROOT)/build-profile.log
+  BUILD_LOG := $(OUTPUTDIR)/build.log
+  BUILD_PROFILE_LOG := $(OUTPUTDIR)/build-profile.log
 
   BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2) && wait
 
@@ -383,7 +383,7 @@
   # FAIL can be set to false to have the return value of compare be ignored.
   define ParseCompareBuild
     ifneq ($$(COMPARE_BUILD), )
-      COMPARE_BUILD_OUTPUT_ROOT := $(TOPDIR)/build/compare-build/$(CONF_NAME)
+      COMPARE_BUILD_OUTPUTDIR := $(TOPDIR)/build/compare-build/$(CONF_NAME)
       COMPARE_BUILD_FAIL := true
 
       ifneq ($$(findstring :, $$(COMPARE_BUILD)), )
@@ -443,16 +443,16 @@
         # Move the first build away temporarily
 	$(RM) -r $(TOPDIR)/build/.compare-build-temp
 	$(MKDIR) -p $(TOPDIR)/build/.compare-build-temp
-	$(MV) $(OUTPUT_ROOT) $(TOPDIR)/build/.compare-build-temp
+	$(MV) $(OUTPUTDIR) $(TOPDIR)/build/.compare-build-temp
         # Restore an old compare-build, or create a new compare-build directory.
-	if test -d $(COMPARE_BUILD_OUTPUT_ROOT); then \
-	  $(MV) $(COMPARE_BUILD_OUTPUT_ROOT) $(OUTPUT_ROOT); \
+	if test -d $(COMPARE_BUILD_OUTPUTDIR); then \
+	  $(MV) $(COMPARE_BUILD_OUTPUTDIR) $(OUTPUTDIR); \
 	else \
-	  $(MKDIR) -p $(OUTPUT_ROOT); \
+	  $(MKDIR) -p $(OUTPUTDIR); \
 	fi
         # Re-run configure with the same arguments (and possibly some additional),
         # must be done after patching.
-	( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \
+	( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \
 	    $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) $(COMPARE_BUILD_CONF))
   endef
 
@@ -462,8 +462,8 @@
 	$(if $(COMPARE_BUILD_PATCH), $(PATCH) -R -p1 < $(COMPARE_BUILD_PATCH))
         # Move this build away and restore the original build
 	$(MKDIR) -p $(TOPDIR)/build/compare-build
-	$(MV) $(OUTPUT_ROOT) $(COMPARE_BUILD_OUTPUT_ROOT)
-	$(MV) $(TOPDIR)/build/.compare-build-temp/$(CONF_NAME) $(OUTPUT_ROOT)
+	$(MV) $(OUTPUTDIR) $(COMPARE_BUILD_OUTPUTDIR)
+	$(MV) $(TOPDIR)/build/.compare-build-temp/$(CONF_NAME) $(OUTPUTDIR)
 	$(RM) -r $(TOPDIR)/build/.compare-build-temp
   endef
 
@@ -472,11 +472,11 @@
         # Compare first and second build. Ignore any error code from compare.sh.
 	$(ECHO) "Comparing between comparison rebuild (this/new) and baseline (other/old)"
 	$(if $(COMPARE_BUILD_COMP_DIR), \
-	  +(cd $(COMPARE_BUILD_OUTPUT_ROOT) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
-	      -2dirs $(COMPARE_BUILD_OUTPUT_ROOT)/$(COMPARE_BUILD_COMP_DIR) \
-	      $(OUTPUT_ROOT)/$(COMPARE_BUILD_COMP_DIR) $(COMPARE_BUILD_IGNORE_RESULT)), \
-	  +(cd $(COMPARE_BUILD_OUTPUT_ROOT) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
-	      -o $(OUTPUT_ROOT) $(COMPARE_BUILD_IGNORE_RESULT)) \
+	  +(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
+	      -2dirs $(COMPARE_BUILD_OUTPUTDIR)/$(COMPARE_BUILD_COMP_DIR) \
+	      $(OUTPUTDIR)/$(COMPARE_BUILD_COMP_DIR) $(COMPARE_BUILD_IGNORE_RESULT)), \
+	  +(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
+	      -o $(OUTPUTDIR) $(COMPARE_BUILD_IGNORE_RESULT)) \
 	)
   endef
 
--- a/make/Jprt.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/Jprt.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -94,7 +94,7 @@
   # Just fake the main bundle to satisfy JPRT
   jprt_bundle: $(JPRT_TARGET)
 	@$(call TargetEnter)
-	$(MKDIR) -p $(BUILD_OUTPUT)/bundles
+	$(MKDIR) -p $(OUTPUTDIR)/bundles
 	$(CD) $(TOPDIR) && $(TAR) cf - README | $(GZIP) > \
 	    $(JPRT_ARCHIVE_BUNDLE)
 	@$(call TargetExit)
--- a/make/MacBundles.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/MacBundles.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -57,23 +57,23 @@
 
   # Copy empty directories (jre/lib/applet).
   $(JDK_MACOSX_CONTENTS_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
-	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(MKDIR) -p $(@D)
 	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
 
   $(JRE_MACOSX_CONTENTS_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
-	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(MKDIR) -p $(@D)
 	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
 
   $(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
-	$(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+	$(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../Home/lib/jli/libjli.dylib $@
 
   $(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
-	$(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+	$(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../Home/lib/jli/libjli.dylib $@
--- a/make/Main.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/Main.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -928,7 +928,7 @@
 
 demos: demos-jdk
 
-# The "exploded image" is a locally runnable JDK in $(BUILD_OUTPUT)/jdk.
+# The "exploded image" is a locally runnable JDK in $(OUTPUTDIR)/jdk.
 exploded-image-base: $(ALL_MODULES)
 exploded-image: exploded-image-base release-file
 # When cross compiling, no need to optimize the exploded image since it won't
@@ -957,7 +957,7 @@
 
 mac-bundles: mac-bundles-jdk
 
-# The $(BUILD_OUTPUT)/images directory contain the resulting deliverables,
+# The $(OUTPUTDIR)/images directory contain the resulting deliverables,
 # and in line with this, our targets for creating these are named *-image[s].
 
 # This target builds the product images, e.g. the JRE and JDK image
@@ -1048,7 +1048,7 @@
 
 # Remove everything, except the output from configure.
 clean: $(CLEAN_DIR_TARGETS)
-	($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*)
+	($(CD) $(OUTPUTDIR) && $(RM) -r build*.log*)
 	$(ECHO) Cleaned all build artifacts.
 
 clean-docs:
@@ -1081,14 +1081,14 @@
 # Remove everything, including configure configuration. If the output
 # directory was created by configure and now becomes empty, remove it as well.
 dist-clean: clean
-	($(CD) $(OUTPUT_ROOT) && \
+	($(CD) $(OUTPUTDIR) && \
 	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
-	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
-	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
+	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUTDIR))), \
+	  if test "x`$(LS) $(OUTPUTDIR)`" != x; then \
 	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
 	  else \
 	    ($(CD) $(TOPDIR) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
-	        && $(RM) -r $(OUTPUT_ROOT)) \
+	        && $(RM) -r $(OUTPUTDIR)) \
 	  fi \
 	)
 	$(ECHO) Cleaned everything, you will have to re-run configure.
--- a/make/MainSupport.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/MainSupport.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -36,7 +36,7 @@
 	($(CD) $(TOPDIR)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \
 	    JT_HOME=$(JT_HOME) PRODUCT_HOME=$(strip $2) \
 	    TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \
-	    ALT_OUTPUTDIR=$(OUTPUT_ROOT) TEST_JOBS=$(TEST_JOBS) \
+	    ALT_OUTPUTDIR=$(OUTPUTDIR) TEST_JOBS=$(TEST_JOBS) \
 	    JT_JAVA=$(BOOT_JDK) JIB_JAR=$(JIB_JAR) \
 	    JOBS=$(JOBS) $1) || true
 endef
@@ -54,7 +54,7 @@
 define CleanDir
 	@$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
 	@$(PRINTF) "\n" $(LOG_DEBUG)
-	($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
+	($(CD) $(OUTPUTDIR) && $(RM) -r $1)
 	@$(PRINTF) " done\n"
 endef
 
--- a/make/ReleaseFile.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/ReleaseFile.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -54,7 +54,7 @@
 
 # Param 1 - The file containing the MODULES list
 define prepare-info-file
-  $(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
+  $(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%,%,$@))
   $(call MakeDir, $(@D))
   $(RM) $@
 endef
--- a/make/RunTests.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/RunTests.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -38,8 +38,8 @@
 # Hook to include the corresponding custom file, if present.
 $(eval $(call IncludeCustomExtension, , RunTests.gmk))
 
-TEST_RESULTS_DIR := $(BUILD_OUTPUT)/test-results
-TEST_SUPPORT_DIR := $(BUILD_OUTPUT)/test-support
+TEST_RESULTS_DIR := $(OUTPUTDIR)/test-results
+TEST_SUPPORT_DIR := $(OUTPUTDIR)/test-support
 
 
 ################################################################################
@@ -392,20 +392,27 @@
 	$$(call LogWarn, Finished running test '$$($1_TEST)')
 	$$(call LogWarn, Test report is stored in $$(strip \
 	    $$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR))))
-	$$(eval $1_PASSED := $$(shell $$(AWK) '{ gsub(/[,;]/, ""); \
-	    for (i=1; i<=NF; i++) { if ($$$$i == "passed:") \
-	    print $$$$(i+1) } }' $$($1_RESULT_FILE)))
-	$$(if $$($1_PASSED), , $$(eval $1_PASSED := 0))
-	$$(eval $1_FAILED := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \
-	    for (i=1; i<=NF; i++) { if ($$$$i == "failed:") \
-	    print $$$$(i+1) } }' $$($1_RESULT_FILE)))
-	$$(if $$($1_FAILED), , $$(eval $1_FAILED := 0))
-	$$(eval $1_ERROR := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \
-	    for (i=1; i<=NF; i++) { if ($$$$i == "error:") \
-	    print $$$$(i+1) } }' $$($1_RESULT_FILE)))
-	$$(if $$($1_ERROR), , $$(eval $1_ERROR := 0))
-	$$(eval $1_TOTAL := $$(shell \
-	    $$(EXPR) $$($1_PASSED) + $$($1_FAILED) + $$($1_ERROR)))
+	$$(if  $$(wildcard $$($1_RESULT_FILE)), \
+	  $$(eval $1_PASSED := $$(shell $$(AWK) '{ gsub(/[,;]/, ""); \
+	      for (i=1; i<=NF; i++) { if ($$$$i == "passed:") \
+	      print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
+	  $$(if $$($1_PASSED), , $$(eval $1_PASSED := 0)) \
+	  $$(eval $1_FAILED := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \
+	      for (i=1; i<=NF; i++) { if ($$$$i == "failed:") \
+	      print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
+	  $$(if $$($1_FAILED), , $$(eval $1_FAILED := 0)) \
+	  $$(eval $1_ERROR := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \
+	      for (i=1; i<=NF; i++) { if ($$$$i == "error:") \
+	      print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
+	  $$(if $$($1_ERROR), , $$(eval $1_ERROR := 0)) \
+	  $$(eval $1_TOTAL := $$(shell \
+	      $$(EXPR) $$($1_PASSED) + $$($1_FAILED) + $$($1_ERROR))) \
+	, \
+	  $$(eval $1_PASSED := 0) \
+	  $$(eval $1_FAILED := 0) \
+	  $$(eval $1_ERROR := 1) \
+	  $$(eval $1_TOTAL := 1) \
+	)
 
   $1: run-test-$1 parse-test-$1
 
--- a/make/autoconf/Makefile.in	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/Makefile.in	Thu Sep 28 09:13:27 2017 -0700
@@ -23,5 +23,5 @@
 
 # This Makefile was generated by configure @DATE_WHEN_CONFIGURED@
 # GENERATED FILE, DO NOT EDIT
-SPEC:=@OUTPUT_ROOT@/spec.gmk
+SPEC:=@OUTPUTDIR@/spec.gmk
 include @TOPDIR@/Makefile
--- a/make/autoconf/basics.m4	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/basics.m4	Thu Sep 28 09:13:27 2017 -0700
@@ -568,8 +568,6 @@
   # We can only call BASIC_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS.
   BASIC_FIXUP_PATH(CURDIR)
   BASIC_FIXUP_PATH(TOPDIR)
-  # SRC_ROOT is a traditional alias for TOPDIR.
-  SRC_ROOT=$TOPDIR
 
   # Calculate a canonical version of TOPDIR for string comparisons
   CANONICAL_TOPDIR=$TOPDIR
@@ -770,13 +768,13 @@
       [ CONF_NAME=${with_conf_name} ])
   AC_ARG_WITH(output-base-dir, [AS_HELP_STRING([--with-output-base-dir],
       [override the default output base directory @<:@./build@:>@])],
-      [ OUTPUT_BASE=${with_output_base_dir} ], [ OUTPUT_BASE="$SRC_ROOT/build" ] )
+      [ OUTPUT_BASE=${with_output_base_dir} ], [ OUTPUT_BASE="$TOPDIR/build" ] )
 
   # Test from where we are running configure, in or outside of src root.
   AC_MSG_CHECKING([where to store configuration])
-  if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \
-      || test "x$CURDIR" = "x$SRC_ROOT/make/autoconf" \
-      || test "x$CURDIR" = "x$SRC_ROOT/make" ; then
+  if test "x$CURDIR" = "x$TOPDIR" || test "x$CURDIR" = "x$TOPDIR/common" \
+      || test "x$CURDIR" = "x$TOPDIR/make/autoconf" \
+      || test "x$CURDIR" = "x$TOPDIR/make" ; then
     # We are running configure from the src root.
     # Create a default ./build/target-variant-debuglevel output root.
     if test "x${CONF_NAME}" = x; then
@@ -785,10 +783,10 @@
     else
       AC_MSG_RESULT([in build directory with custom name])
     fi
-    OUTPUT_ROOT="${OUTPUT_BASE}/${CONF_NAME}"
-    $MKDIR -p "$OUTPUT_ROOT"
-    if test ! -d "$OUTPUT_ROOT"; then
-      AC_MSG_ERROR([Could not create build directory $OUTPUT_ROOT])
+    OUTPUTDIR="${OUTPUT_BASE}/${CONF_NAME}"
+    $MKDIR -p "$OUTPUTDIR"
+    if test ! -d "$OUTPUTDIR"; then
+      AC_MSG_ERROR([Could not create build directory $OUTPUTDIR])
     fi
   else
     # We are running configure from outside of the src dir.
@@ -796,18 +794,18 @@
     # If configuration is situated in normal build directory, just use the build
     # directory name as configuration name, otherwise use the complete path.
     if test "x${CONF_NAME}" = x; then
-      CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"`
+      CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${TOPDIR}/build/!!"`
     fi
-    OUTPUT_ROOT="$CURDIR"
+    OUTPUTDIR="$CURDIR"
     AC_MSG_RESULT([in current directory])
 
     # WARNING: This might be a bad thing to do. You need to be sure you want to
     # have a configuration in this directory. Do some sanity checks!
 
-    if test ! -e "$OUTPUT_ROOT/spec.gmk"; then
+    if test ! -e "$OUTPUTDIR/spec.gmk"; then
       # If we have a spec.gmk, we have run here before and we are OK. Otherwise, check for
       # other files
-      files_present=`$LS $OUTPUT_ROOT`
+      files_present=`$LS $OUTPUTDIR`
       # Configure has already touched config.log and confdefs.h in the current dir when this check
       # is performed.
       filtered_files=`$ECHO "$files_present" \
@@ -822,7 +820,7 @@
         AC_MSG_NOTICE([(as opposed to creating a configuration in <src_root>/build/<conf-name>).])
         AC_MSG_NOTICE([However, this directory is not empty. This is not allowed, since it could])
         AC_MSG_NOTICE([seriously mess up just about everything.])
-        AC_MSG_NOTICE([Try 'cd $SRC_ROOT' and restart configure])
+        AC_MSG_NOTICE([Try 'cd $TOPDIR' and restart configure])
         AC_MSG_NOTICE([(or create a new empty directory and cd to it).])
         AC_MSG_ERROR([Will not continue creating configuration in $CURDIR])
       fi
@@ -831,29 +829,29 @@
   AC_MSG_CHECKING([what configuration name to use])
   AC_MSG_RESULT([$CONF_NAME])
 
-  BASIC_FIXUP_PATH(OUTPUT_ROOT)
+  BASIC_FIXUP_PATH(OUTPUTDIR)
 
-  CONFIGURESUPPORT_OUTPUTDIR="$OUTPUT_ROOT/configure-support"
+  CONFIGURESUPPORT_OUTPUTDIR="$OUTPUTDIR/configure-support"
   $MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR"
 
-  SPEC="$OUTPUT_ROOT/spec.gmk"
+  SPEC="$OUTPUTDIR/spec.gmk"
   AC_SUBST(SPEC)
   AC_SUBST(CONF_NAME)
-  AC_SUBST(OUTPUT_ROOT)
+  AC_SUBST(OUTPUTDIR)
   AC_SUBST(CONFIGURESUPPORT_OUTPUTDIR)
 
   # The spec.gmk file contains all variables for the make system.
-  AC_CONFIG_FILES([$OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in])
+  AC_CONFIG_FILES([$OUTPUTDIR/spec.gmk:$AUTOCONF_DIR/spec.gmk.in])
   # The bootcycle-spec.gmk file contains support for boot cycle builds.
-  AC_CONFIG_FILES([$OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in])
+  AC_CONFIG_FILES([$OUTPUTDIR/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in])
   # The buildjdk-spec.gmk file contains support for building a buildjdk when cross compiling.
-  AC_CONFIG_FILES([$OUTPUT_ROOT/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in])
+  AC_CONFIG_FILES([$OUTPUTDIR/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in])
   # The compare.sh is used to compare the build output to other builds.
-  AC_CONFIG_FILES([$OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in])
+  AC_CONFIG_FILES([$OUTPUTDIR/compare.sh:$AUTOCONF_DIR/compare.sh.in])
   # The generated Makefile knows where the spec.gmk is and where the source is.
-  # You can run make from the OUTPUT_ROOT, or from the top-level Makefile
+  # You can run make from the OUTPUTDIR, or from the top-level Makefile
   # which will look for generated configurations
-  AC_CONFIG_FILES([$OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in])
+  AC_CONFIG_FILES([$OUTPUTDIR/Makefile:$AUTOCONF_DIR/Makefile.in])
 ])
 
 #%%% Simple tools %%%
@@ -1173,7 +1171,7 @@
 AC_DEFUN_ONCE([BASIC_CHECK_SRC_PERMS],
 [
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    file_to_test="$SRC_ROOT/LICENSE"
+    file_to_test="$TOPDIR/LICENSE"
     if test `$STAT -c '%a' "$file_to_test"` -lt 400; then
       AC_MSG_ERROR([Bad file permissions on src files. This is usually caused by cloning the repositories with a non cygwin hg in a directory not created in cygwin.])
     fi
@@ -1186,7 +1184,7 @@
   BASIC_CHECK_LEFTOVER_OVERRIDDEN
 
   AC_MSG_CHECKING([if build directory is on local disk])
-  BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUT_ROOT,
+  BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUTDIR,
       [OUTPUT_DIR_IS_LOCAL="yes"],
       [OUTPUT_DIR_IS_LOCAL="no"])
   AC_MSG_RESULT($OUTPUT_DIR_IS_LOCAL)
@@ -1198,7 +1196,7 @@
 
   # Before generating output files, test if they exist. If they do, this is a reconfigure.
   # Since we can't properly handle the dependencies for this, warn the user about the situation
-  if test -e $OUTPUT_ROOT/spec.gmk; then
+  if test -e $OUTPUTDIR/spec.gmk; then
     IS_RECONFIGURE=yes
   else
     IS_RECONFIGURE=no
@@ -1269,18 +1267,18 @@
   fi
 
   # Rotate our log file (configure.log)
-  if test -e "$OUTPUT_ROOT/configure.log.old"; then
-    $RM -f "$OUTPUT_ROOT/configure.log.old"
+  if test -e "$OUTPUTDIR/configure.log.old"; then
+    $RM -f "$OUTPUTDIR/configure.log.old"
   fi
-  if test -e "$OUTPUT_ROOT/configure.log"; then
-    $MV -f "$OUTPUT_ROOT/configure.log" "$OUTPUT_ROOT/configure.log.old" 2> /dev/null
+  if test -e "$OUTPUTDIR/configure.log"; then
+    $MV -f "$OUTPUTDIR/configure.log" "$OUTPUTDIR/configure.log.old" 2> /dev/null
   fi
 
   # Move configure.log from current directory to the build output root
   if test -e ./configure.log; then
-    $MV -f ./configure.log "$OUTPUT_ROOT/configure.log" 2> /dev/null
+    $MV -f ./configure.log "$OUTPUTDIR/configure.log" 2> /dev/null
   fi
 
   # Make the compare script executable
-  $CHMOD +x $OUTPUT_ROOT/compare.sh
+  $CHMOD +x $OUTPUTDIR/compare.sh
 ])
--- a/make/autoconf/basics_windows.m4	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/basics_windows.m4	Thu Sep 28 09:13:27 2017 -0700
@@ -382,7 +382,7 @@
   FIXPATH=
   if test "x$OPENJDK_BUILD_OS" = xwindows; then
     AC_MSG_CHECKING([if fixpath can be created])
-    FIXPATH_SRC="$SRC_ROOT/make/src/native/fixpath.c"
+    FIXPATH_SRC="$TOPDIR/make/src/native/fixpath.c"
     FIXPATH_BIN="$CONFIGURESUPPORT_OUTPUTDIR/bin/fixpath.exe"
     FIXPATH_DIR="$CONFIGURESUPPORT_OUTPUTDIR/fixpath"
     if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
--- a/make/autoconf/boot-jdk.m4	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/boot-jdk.m4	Thu Sep 28 09:13:27 2017 -0700
@@ -77,10 +77,10 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          [FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`]
+          [FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`]
           if test "x$FOUND_CORRECT_VERSION" = x; then
             AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
-            AC_MSG_NOTICE([(Your Boot JDK must be version 8 or 9)])
+            AC_MSG_NOTICE([(Your Boot JDK must be version 8, 9 or 10)])
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -469,10 +469,10 @@
         BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
         # Extra M4 quote needed to protect [] in grep expression.
-        [FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"'`]
+        [FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"'`]
         if test "x$FOUND_CORRECT_VERSION" = x; then
           AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring])
-          AC_MSG_NOTICE([(Your Build JDK must be version 9)])
+          AC_MSG_NOTICE([(Your Build JDK must be version 10)])
           BUILD_JDK_FOUND=no
         else
           # We're done!
--- a/make/autoconf/bootcycle-spec.gmk.in	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/bootcycle-spec.gmk.in	Thu Sep 28 09:13:27 2017 -0700
@@ -48,9 +48,9 @@
 BOOT_JDK := $(JDK_IMAGE_DIR)
 
 # The bootcycle build has a different output directory
-OLD_BUILD_OUTPUT:=@BUILD_OUTPUT@
-BUILD_OUTPUT:=$(OLD_BUILD_OUTPUT)/bootcycle-build
-SJAVAC_SERVER_DIR:=$(patsubst $(OLD_BUILD_OUTPUT)%, $(BUILD_OUTPUT)%, $(SJAVAC_SERVER_DIR))
+OLD_OUTPUTDIR:=@OUTPUTDIR@
+OUTPUTDIR:=$(OLD_OUTPUTDIR)/bootcycle-build
+SJAVAC_SERVER_DIR:=$(patsubst $(OLD_OUTPUTDIR)%, $(OUTPUTDIR)%, $(SJAVAC_SERVER_DIR))
 
 JAVA_CMD:=$(BOOT_JDK)/bin/java
 JAVAC_CMD:=$(BOOT_JDK)/bin/javac
--- a/make/autoconf/buildjdk-spec.gmk.in	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/buildjdk-spec.gmk.in	Thu Sep 28 09:13:27 2017 -0700
@@ -43,10 +43,10 @@
 SYSROOT_LDFLAGS := @BUILD_SYSROOT_LDFLAGS@
 
 # These directories should not be moved to BUILDJDK_OUTPUTDIR
-HOTSPOT_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(HOTSPOT_OUTPUTDIR))
-SUPPORT_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(SUPPORT_OUTPUTDIR))
-JDK_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(JDK_OUTPUTDIR))
-IMAGES_OUTPUTDIR := $(patsubst $(BUILD_OUTPUT)%,$(BUILDJDK_OUTPUTDIR)%,$(IMAGES_OUTPUTDIR))
+HOTSPOT_OUTPUTDIR := $(patsubst $(OUTPUTDIR)%,$(BUILDJDK_OUTPUTDIR)%,$(HOTSPOT_OUTPUTDIR))
+SUPPORT_OUTPUTDIR := $(patsubst $(OUTPUTDIR)%,$(BUILDJDK_OUTPUTDIR)%,$(SUPPORT_OUTPUTDIR))
+JDK_OUTPUTDIR := $(patsubst $(OUTPUTDIR)%,$(BUILDJDK_OUTPUTDIR)%,$(JDK_OUTPUTDIR))
+IMAGES_OUTPUTDIR := $(patsubst $(OUTPUTDIR)%,$(BUILDJDK_OUTPUTDIR)%,$(IMAGES_OUTPUTDIR))
 
 OPENJDK_BUILD_CPU_LEGACY := @OPENJDK_BUILD_CPU_LEGACY@
 OPENJDK_BUILD_CPU_LEGACY_LIB := @OPENJDK_BUILD_CPU_LEGACY_LIB@
--- a/make/autoconf/compare.sh.in	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/compare.sh.in	Thu Sep 28 09:13:27 2017 -0700
@@ -69,15 +69,15 @@
 export UNPACK200="@FIXPATH@ @BOOT_JDK@/bin/unpack200"
 export UNARCHIVE="@UNZIP@ -q -o"
 
-export SRC_ROOT="@TOPDIR@"
-export OUTPUT_ROOT="@OUTPUT_ROOT@"
+export TOPDIR="@TOPDIR@"
+export OUTPUTDIR="@OUTPUTDIR@"
 
 if [ "@COMPILE_TYPE@" != "cross" ]; then
-    export JAVAP="@FIXPATH@ $OUTPUT_ROOT/jdk/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
-    export JIMAGE="@FIXPATH@ $OUTPUT_ROOT/jdk/bin/jimage"
+    export JAVAP="@FIXPATH@ $OUTPUTDIR/jdk/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
+    export JIMAGE="@FIXPATH@ $OUTPUTDIR/jdk/bin/jimage"
 elif [ "@CREATE_BUILDJDK@" = "true" ]; then
-    export JAVAP="@FIXPATH@ $OUTPUT_ROOT/buildjdk/jdk/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
-    export JIMAGE="@FIXPATH@ $OUTPUT_ROOT/buildjdk/jdk/bin/jimage"
+    export JAVAP="@FIXPATH@ $OUTPUTDIR/buildjdk/jdk/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
+    export JIMAGE="@FIXPATH@ $OUTPUTDIR/buildjdk/jdk/bin/jimage"
 else
     export JAVAP="@FIXPATH@ @BUILD_JDK@/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
     export JIMAGE="@FIXPATH@ @BUILD_JDK@/bin/jimage"
@@ -88,16 +88,16 @@
 fi
 
 # Now locate the main script and run it.
-REAL_COMPARE_SCRIPT="$SRC_ROOT/make/scripts/compare.sh"
+REAL_COMPARE_SCRIPT="$TOPDIR/make/scripts/compare.sh"
 if [ ! -e "$REAL_COMPARE_SCRIPT" ]; then
   echo "Error: Cannot locate compare script, it should have been in $REAL_COMPARE_SCRIPT"
   exit 1
 fi
 
 # Rotate logs
-$RM $OUTPUT_ROOT/compare.log.old 2> /dev/null
-$MV $OUTPUT_ROOT/compare.log $OUTPUT_ROOT/compare.log.old 2> /dev/null
+$RM $OUTPUTDIR/compare.log.old 2> /dev/null
+$MV $OUTPUTDIR/compare.log $OUTPUTDIR/compare.log.old 2> /dev/null
 
 export SCRIPT_DIR="$( cd "$( dirname "$0" )" > /dev/null && pwd )"
 
-$BASH $SRC_ROOT/make/scripts/logger.sh $OUTPUT_ROOT/compare.log $BASH "$REAL_COMPARE_SCRIPT" "$@"
+$BASH $TOPDIR/make/scripts/logger.sh $OUTPUTDIR/compare.log $BASH "$REAL_COMPARE_SCRIPT" "$@"
--- a/make/autoconf/flags.m4	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/flags.m4	Thu Sep 28 09:13:27 2017 -0700
@@ -1311,9 +1311,10 @@
   $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDK}"
 
   $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
+  $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${LDFLAGS_NO_EXEC_STACK}"
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
     $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
-        -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
+        -libpath:${OUTPUTDIR}/support/modules_libs/java.base"
     $2JDKLIB_LIBS=""
   else
     $2JAVA_BASE_LDFLAGS="${$2JAVA_BASE_LDFLAGS} \
@@ -1388,6 +1389,7 @@
   AC_SUBST($2JDKEXE_LIBS)
   AC_SUBST($2LDFLAGS_CXX_JDK)
   AC_SUBST($2LDFLAGS_HASH_STYLE)
+  AC_SUBST($2LDFLAGS_NO_EXEC_STACK)
 
   AC_SUBST($2JVM_CFLAGS)
   AC_SUBST($2JVM_LDFLAGS)
--- a/make/autoconf/generated-configure.sh	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/generated-configure.sh	Thu Sep 28 09:13:27 2017 -0700
@@ -723,6 +723,7 @@
 OPENJDK_BUILD_JVM_ASFLAGS
 OPENJDK_BUILD_JVM_LDFLAGS
 OPENJDK_BUILD_JVM_CFLAGS
+OPENJDK_BUILD_LDFLAGS_NO_EXEC_STACK
 OPENJDK_BUILD_LDFLAGS_HASH_STYLE
 OPENJDK_BUILD_LDFLAGS_CXX_JDK
 OPENJDK_BUILD_JDKEXE_LIBS
@@ -738,6 +739,7 @@
 JVM_ASFLAGS
 JVM_LDFLAGS
 JVM_CFLAGS
+LDFLAGS_NO_EXEC_STACK
 LDFLAGS_HASH_STYLE
 LDFLAGS_CXX_JDK
 JDKEXE_LIBS
@@ -870,13 +872,6 @@
 IMPORT_MODULES_LIBS
 IMPORT_MODULES_CMDS
 IMPORT_MODULES_CLASSES
-BUILD_OUTPUT
-NASHORN_TOPDIR
-HOTSPOT_TOPDIR
-JAXWS_TOPDIR
-JAXP_TOPDIR
-CORBA_TOPDIR
-LANGTOOLS_TOPDIR
 EXTERNAL_BUILDJDK
 BUILD_JDK
 CREATE_BUILDJDK
@@ -958,7 +953,7 @@
 MAKE
 PKGHANDLER
 CONFIGURESUPPORT_OUTPUTDIR
-OUTPUT_ROOT
+OUTPUTDIR
 CONF_NAME
 SPEC
 SDKROOT
@@ -1162,17 +1157,6 @@
 with_version_patch
 with_boot_jdk
 with_build_jdk
-with_add_source_root
-with_override_source_root
-with_adds_and_overrides
-with_override_langtools
-with_override_corba
-with_override_jaxp
-with_override_jaxws
-with_override_hotspot
-with_override_nashorn
-with_override_jdk
-with_import_hotspot
 with_import_modules
 enable_static_build
 with_toolchain_type
@@ -2093,31 +2077,6 @@
   --with-boot-jdk         path to Boot JDK (used to bootstrap build) [probed]
   --with-build-jdk        path to JDK of same version as is being built[the
                           newly built JDK]
-  --with-add-source-root  Deprecated. Option is kept for backwards
-                          compatibility and is ignored
-  --with-override-source-root
-                          Deprecated. Option is kept for backwards
-                          compatibility and is ignored
-  --with-adds-and-overrides
-                          Deprecated. Option is kept for backwards
-                          compatibility and is ignored
-  --with-override-langtools
-                          Deprecated. Option is kept for backwards
-                          compatibility and is ignored
-  --with-override-corba   Deprecated. Option is kept for backwards
-                          compatibility and is ignored
-  --with-override-jaxp    Deprecated. Option is kept for backwards
-                          compatibility and is ignored
-  --with-override-jaxws   Deprecated. Option is kept for backwards
-                          compatibility and is ignored
-  --with-override-hotspot Deprecated. Option is kept for backwards
-                          compatibility and is ignored
-  --with-override-nashorn Deprecated. Option is kept for backwards
-                          compatibility and is ignored
-  --with-override-jdk     Deprecated. Option is kept for backwards
-                          compatibility and is ignored
-  --with-import_hotspot   Deprecated. Option is kept for backwards
-                          compatibility and is ignored
   --with-import-modules   import a set of prebuilt modules either as a zip
                           file or an exploded directory
   --with-toolchain-type   the toolchain type (or family) to use, use '--help'
@@ -4890,7 +4849,7 @@
 
 
 #
-# 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
@@ -4916,10 +4875,6 @@
 
 
 
-
-
-
-
 ################################################################################
 # Define a mechanism for importing extra prebuilt modules
 #
@@ -5162,7 +5117,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1505235832
+DATE_WHEN_GENERATED=1506397140
 
 ###############################################################################
 #
@@ -16850,8 +16805,6 @@
     fi
   fi
 
-  # SRC_ROOT is a traditional alias for TOPDIR.
-  SRC_ROOT=$TOPDIR
 
   # Calculate a canonical version of TOPDIR for string comparisons
   CANONICAL_TOPDIR=$TOPDIR
@@ -17605,16 +17558,16 @@
 if test "${with_output_base_dir+set}" = set; then :
   withval=$with_output_base_dir;  OUTPUT_BASE=${with_output_base_dir}
 else
-   OUTPUT_BASE="$SRC_ROOT/build"
+   OUTPUT_BASE="$TOPDIR/build"
 fi
 
 
   # Test from where we are running configure, in or outside of src root.
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to store configuration" >&5
 $as_echo_n "checking where to store configuration... " >&6; }
-  if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" \
-      || test "x$CURDIR" = "x$SRC_ROOT/make/autoconf" \
-      || test "x$CURDIR" = "x$SRC_ROOT/make" ; then
+  if test "x$CURDIR" = "x$TOPDIR" || test "x$CURDIR" = "x$TOPDIR/common" \
+      || test "x$CURDIR" = "x$TOPDIR/make/autoconf" \
+      || test "x$CURDIR" = "x$TOPDIR/make" ; then
     # We are running configure from the src root.
     # Create a default ./build/target-variant-debuglevel output root.
     if test "x${CONF_NAME}" = x; then
@@ -17625,10 +17578,10 @@
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: in build directory with custom name" >&5
 $as_echo "in build directory with custom name" >&6; }
     fi
-    OUTPUT_ROOT="${OUTPUT_BASE}/${CONF_NAME}"
-    $MKDIR -p "$OUTPUT_ROOT"
-    if test ! -d "$OUTPUT_ROOT"; then
-      as_fn_error $? "Could not create build directory $OUTPUT_ROOT" "$LINENO" 5
+    OUTPUTDIR="${OUTPUT_BASE}/${CONF_NAME}"
+    $MKDIR -p "$OUTPUTDIR"
+    if test ! -d "$OUTPUTDIR"; then
+      as_fn_error $? "Could not create build directory $OUTPUTDIR" "$LINENO" 5
     fi
   else
     # We are running configure from outside of the src dir.
@@ -17636,19 +17589,19 @@
     # If configuration is situated in normal build directory, just use the build
     # directory name as configuration name, otherwise use the complete path.
     if test "x${CONF_NAME}" = x; then
-      CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"`
-    fi
-    OUTPUT_ROOT="$CURDIR"
+      CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${TOPDIR}/build/!!"`
+    fi
+    OUTPUTDIR="$CURDIR"
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: in current directory" >&5
 $as_echo "in current directory" >&6; }
 
     # WARNING: This might be a bad thing to do. You need to be sure you want to
     # have a configuration in this directory. Do some sanity checks!
 
-    if test ! -e "$OUTPUT_ROOT/spec.gmk"; then
+    if test ! -e "$OUTPUTDIR/spec.gmk"; then
       # If we have a spec.gmk, we have run here before and we are OK. Otherwise, check for
       # other files
-      files_present=`$LS $OUTPUT_ROOT`
+      files_present=`$LS $OUTPUTDIR`
       # Configure has already touched config.log and confdefs.h in the current dir when this check
       # is performed.
       filtered_files=`$ECHO "$files_present" \
@@ -17668,8 +17621,8 @@
 $as_echo "$as_me: However, this directory is not empty. This is not allowed, since it could" >&6;}
         { $as_echo "$as_me:${as_lineno-$LINENO}: seriously mess up just about everything." >&5
 $as_echo "$as_me: seriously mess up just about everything." >&6;}
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Try 'cd $SRC_ROOT' and restart configure" >&5
-$as_echo "$as_me: Try 'cd $SRC_ROOT' and restart configure" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Try 'cd $TOPDIR' and restart configure" >&5
+$as_echo "$as_me: Try 'cd $TOPDIR' and restart configure" >&6;}
         { $as_echo "$as_me:${as_lineno-$LINENO}: (or create a new empty directory and cd to it)." >&5
 $as_echo "$as_me: (or create a new empty directory and cd to it)." >&6;}
         as_fn_error $? "Will not continue creating configuration in $CURDIR" "$LINENO" 5
@@ -17684,161 +17637,161 @@
 
   # Only process if variable expands to non-empty
 
-  if test "x$OUTPUT_ROOT" != x; then
-    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-
-  # Input might be given as Windows format, start by converting to
-  # unix format.
-  path="$OUTPUT_ROOT"
-  new_path=`$CYGPATH -u "$path"`
-
-  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
-  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
-  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
-  # "foo.exe" is OK but "foo" is an error.
-  #
-  # This test is therefore slightly more accurate than "test -f" to check for file precense.
-  # It is also a way to make sure we got the proper file name for the real test later on.
-  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
-  if test "x$test_shortpath" = x; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OUTPUT_ROOT, which resolves as \"$path\", is invalid." >&5
-$as_echo "$as_me: The path of OUTPUT_ROOT, which resolves as \"$path\", is invalid." >&6;}
-    as_fn_error $? "Cannot locate the the path of OUTPUT_ROOT" "$LINENO" 5
-  fi
-
-  # Call helper function which possibly converts this using DOS-style short mode.
-  # If so, the updated path is stored in $new_path.
-
-  input_path="$new_path"
-  # Check if we need to convert this using DOS-style short mode. If the path
-  # contains just simple characters, use it. Otherwise (spaces, weird characters),
-  # take no chances and rewrite it.
-  # Note: m4 eats our [], so we need to use [ and ] instead.
-  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
-  if test "x$has_forbidden_chars" != x; then
-    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
-    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
-    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
-    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
-      # Going to short mode and back again did indeed matter. Since short mode is
-      # case insensitive, let's make it lowercase to improve readability.
-      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-      # Now convert it back to Unix-style (cygpath)
-      input_path=`$CYGPATH -u "$shortmode_path"`
-      new_path="$input_path"
-    fi
-  fi
-
-  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
-  if test "x$test_cygdrive_prefix" = x; then
-    # As a simple fix, exclude /usr/bin since it's not a real path.
-    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
-      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
-      # a path prefixed by /cygdrive for fixpath to work.
-      new_path="$CYGWIN_ROOT_PATH$input_path"
-    fi
-  fi
-
-
-  if test "x$path" != "x$new_path"; then
-    OUTPUT_ROOT="$new_path"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OUTPUT_ROOT to \"$new_path\"" >&5
-$as_echo "$as_me: Rewriting OUTPUT_ROOT to \"$new_path\"" >&6;}
-  fi
-
-    elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-
-  path="$OUTPUT_ROOT"
-  has_colon=`$ECHO $path | $GREP ^.:`
-  new_path="$path"
-  if test "x$has_colon" = x; then
-    # Not in mixed or Windows style, start by that.
-    new_path=`cmd //c echo $path`
-  fi
-
-
-  input_path="$new_path"
-  # Check if we need to convert this using DOS-style short mode. If the path
-  # contains just simple characters, use it. Otherwise (spaces, weird characters),
-  # take no chances and rewrite it.
-  # Note: m4 eats our [], so we need to use [ and ] instead.
-  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
-  if test "x$has_forbidden_chars" != x; then
-    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
-    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-  fi
-
-
-  windows_path="$new_path"
-  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    unix_path=`$CYGPATH -u "$windows_path"`
-    new_path="$unix_path"
-  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
-    new_path="$unix_path"
-  fi
-
-  if test "x$path" != "x$new_path"; then
-    OUTPUT_ROOT="$new_path"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OUTPUT_ROOT to \"$new_path\"" >&5
-$as_echo "$as_me: Rewriting OUTPUT_ROOT to \"$new_path\"" >&6;}
-  fi
-
-  # Save the first 10 bytes of this path to the storage, so fixpath can work.
-  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
-
-    else
-      # We're on a unix platform. Hooray! :)
-      path="$OUTPUT_ROOT"
-      has_space=`$ECHO "$path" | $GREP " "`
-      if test "x$has_space" != x; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OUTPUT_ROOT, which resolves as \"$path\", is invalid." >&5
-$as_echo "$as_me: The path of OUTPUT_ROOT, which resolves as \"$path\", is invalid." >&6;}
-        as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
-      fi
-
-      # Use eval to expand a potential ~
-      eval path="$path"
-      if test ! -f "$path" && test ! -d "$path"; then
-        as_fn_error $? "The path of OUTPUT_ROOT, which resolves as \"$path\", is not found." "$LINENO" 5
-      fi
-
-      if test -d "$path"; then
-        OUTPUT_ROOT="`cd "$path"; $THEPWDCMD -L`"
-      else
-        dir="`$DIRNAME "$path"`"
-        base="`$BASENAME "$path"`"
-        OUTPUT_ROOT="`cd "$dir"; $THEPWDCMD -L`/$base"
-      fi
-    fi
-  fi
-
-
-  CONFIGURESUPPORT_OUTPUTDIR="$OUTPUT_ROOT/configure-support"
+  if test "x$OUTPUTDIR" != x; then
+    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  path="$OUTPUTDIR"
+  new_path=`$CYGPATH -u "$path"`
+
+  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+  # "foo.exe" is OK but "foo" is an error.
+  #
+  # This test is therefore slightly more accurate than "test -f" to check for file precense.
+  # It is also a way to make sure we got the proper file name for the real test later on.
+  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+  if test "x$test_shortpath" = x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OUTPUTDIR, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of OUTPUTDIR, which resolves as \"$path\", is invalid." >&6;}
+    as_fn_error $? "Cannot locate the the path of OUTPUTDIR" "$LINENO" 5
+  fi
+
+  # Call helper function which possibly converts this using DOS-style short mode.
+  # If so, the updated path is stored in $new_path.
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+      # Going to short mode and back again did indeed matter. Since short mode is
+      # case insensitive, let's make it lowercase to improve readability.
+      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+      # Now convert it back to Unix-style (cygpath)
+      input_path=`$CYGPATH -u "$shortmode_path"`
+      new_path="$input_path"
+    fi
+  fi
+
+  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+  if test "x$test_cygdrive_prefix" = x; then
+    # As a simple fix, exclude /usr/bin since it's not a real path.
+    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+      # a path prefixed by /cygdrive for fixpath to work.
+      new_path="$CYGWIN_ROOT_PATH$input_path"
+    fi
+  fi
+
+
+  if test "x$path" != "x$new_path"; then
+    OUTPUTDIR="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OUTPUTDIR to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting OUTPUTDIR to \"$new_path\"" >&6;}
+  fi
+
+    elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+  path="$OUTPUTDIR"
+  has_colon=`$ECHO $path | $GREP ^.:`
+  new_path="$path"
+  if test "x$has_colon" = x; then
+    # Not in mixed or Windows style, start by that.
+    new_path=`cmd //c echo $path`
+  fi
+
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+  fi
+
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+  if test "x$path" != "x$new_path"; then
+    OUTPUTDIR="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OUTPUTDIR to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting OUTPUTDIR to \"$new_path\"" >&6;}
+  fi
+
+  # Save the first 10 bytes of this path to the storage, so fixpath can work.
+  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+    else
+      # We're on a unix platform. Hooray! :)
+      path="$OUTPUTDIR"
+      has_space=`$ECHO "$path" | $GREP " "`
+      if test "x$has_space" != x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OUTPUTDIR, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of OUTPUTDIR, which resolves as \"$path\", is invalid." >&6;}
+        as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+      fi
+
+      # Use eval to expand a potential ~
+      eval path="$path"
+      if test ! -f "$path" && test ! -d "$path"; then
+        as_fn_error $? "The path of OUTPUTDIR, which resolves as \"$path\", is not found." "$LINENO" 5
+      fi
+
+      if test -d "$path"; then
+        OUTPUTDIR="`cd "$path"; $THEPWDCMD -L`"
+      else
+        dir="`$DIRNAME "$path"`"
+        base="`$BASENAME "$path"`"
+        OUTPUTDIR="`cd "$dir"; $THEPWDCMD -L`/$base"
+      fi
+    fi
+  fi
+
+
+  CONFIGURESUPPORT_OUTPUTDIR="$OUTPUTDIR/configure-support"
   $MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR"
 
-  SPEC="$OUTPUT_ROOT/spec.gmk"
+  SPEC="$OUTPUTDIR/spec.gmk"
 
 
 
 
 
   # The spec.gmk file contains all variables for the make system.
-  ac_config_files="$ac_config_files $OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in"
+  ac_config_files="$ac_config_files $OUTPUTDIR/spec.gmk:$AUTOCONF_DIR/spec.gmk.in"
 
   # The bootcycle-spec.gmk file contains support for boot cycle builds.
-  ac_config_files="$ac_config_files $OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in"
+  ac_config_files="$ac_config_files $OUTPUTDIR/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in"
 
   # The buildjdk-spec.gmk file contains support for building a buildjdk when cross compiling.
-  ac_config_files="$ac_config_files $OUTPUT_ROOT/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in"
+  ac_config_files="$ac_config_files $OUTPUTDIR/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in"
 
   # The compare.sh is used to compare the build output to other builds.
-  ac_config_files="$ac_config_files $OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in"
+  ac_config_files="$ac_config_files $OUTPUTDIR/compare.sh:$AUTOCONF_DIR/compare.sh.in"
 
   # The generated Makefile knows where the spec.gmk is and where the source is.
-  # You can run make from the OUTPUT_ROOT, or from the top-level Makefile
+  # You can run make from the OUTPUTDIR, or from the top-level Makefile
   # which will look for generated configurations
-  ac_config_files="$ac_config_files $OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in"
+  ac_config_files="$ac_config_files $OUTPUTDIR/Makefile:$AUTOCONF_DIR/Makefile.in"
 
 
 
@@ -25129,8 +25082,20 @@
   withval=$with_cacerts_file;
 fi
 
-  if test "x$with_cacerts_file" != x; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cacerts file" >&5
+$as_echo_n "checking for cacerts file... " >&6; }
+  if test "x$with_cacerts_file" == x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5
+$as_echo "default" >&6; }
+  else
     CACERTS_FILE=$with_cacerts_file
+    if test ! -f "$CACERTS_FILE"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: fail" >&5
+$as_echo "fail" >&6; }
+      as_fn_error $? "Specified cacerts file \"$CACERTS_FILE\" does not exist" "$LINENO" 5
+    fi
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CACERTS_FILE" >&5
+$as_echo "$CACERTS_FILE" >&6; }
   fi
 
 
@@ -25700,12 +25665,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -25902,12 +25867,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -26092,12 +26057,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -26281,12 +26246,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -26470,12 +26435,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -26650,12 +26615,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -26981,12 +26946,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -27312,12 +27277,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -27530,12 +27495,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -27713,12 +27678,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -27924,12 +27889,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -28107,12 +28072,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -28318,12 +28283,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -28501,12 +28466,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -28712,12 +28677,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -28895,12 +28860,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -29093,12 +29058,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -29274,12 +29239,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -29473,12 +29438,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -29654,12 +29619,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -29852,12 +29817,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -30033,12 +29998,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -30232,12 +30197,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -30413,12 +30378,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -30593,12 +30558,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -31568,12 +31533,12 @@
         BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
         # Extra M4 quote needed to protect [] in grep expression.
-        FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"'`
+        FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"'`
         if test "x$FOUND_CORRECT_VERSION" = x; then
           { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Build JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Build JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring" >&6;}
-          { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Build JDK must be version 9)" >&5
-$as_echo "$as_me: (Your Build JDK must be version 9)" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Build JDK must be version 10)" >&5
+$as_echo "$as_me: (Your Build JDK must be version 10)" >&6;}
           BUILD_JDK_FOUND=no
         else
           # We're done!
@@ -31769,130 +31734,11 @@
 ###############################################################################
 
 
+  OUTPUTDIR="$OUTPUTDIR"
+
+  JDK_OUTPUTDIR="$OUTPUTDIR/jdk"
+
   # Where are the sources.
-  LANGTOOLS_TOPDIR="$SRC_ROOT/langtools"
-  CORBA_TOPDIR="$SRC_ROOT/corba"
-  JAXP_TOPDIR="$SRC_ROOT/jaxp"
-  JAXWS_TOPDIR="$SRC_ROOT/jaxws"
-  HOTSPOT_TOPDIR="$SRC_ROOT/hotspot"
-  NASHORN_TOPDIR="$SRC_ROOT/nashorn"
-  JDK_TOPDIR="$SRC_ROOT/jdk"
-
-
-
-
-
-
-
-
-
-  # This feature is no longer supported.
-
-
-
-# Check whether --with-add-source-root was given.
-if test "${with_add_source_root+set}" = set; then :
-  withval=$with_add_source_root; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-add-source-root is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-add-source-root is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-source-root was given.
-if test "${with_override_source_root+set}" = set; then :
-  withval=$with_override_source_root; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-source-root is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-source-root is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-adds-and-overrides was given.
-if test "${with_adds_and_overrides+set}" = set; then :
-  withval=$with_adds_and_overrides; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-adds-and-overrides is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-adds-and-overrides is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-langtools was given.
-if test "${with_override_langtools+set}" = set; then :
-  withval=$with_override_langtools; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-langtools is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-langtools is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-corba was given.
-if test "${with_override_corba+set}" = set; then :
-  withval=$with_override_corba; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-corba is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-corba is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-jaxp was given.
-if test "${with_override_jaxp+set}" = set; then :
-  withval=$with_override_jaxp; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-jaxp is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-jaxp is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-jaxws was given.
-if test "${with_override_jaxws+set}" = set; then :
-  withval=$with_override_jaxws; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-jaxws is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-jaxws is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-hotspot was given.
-if test "${with_override_hotspot+set}" = set; then :
-  withval=$with_override_hotspot; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-hotspot is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-hotspot is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-nashorn was given.
-if test "${with_override_nashorn+set}" = set; then :
-  withval=$with_override_nashorn; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-nashorn is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-nashorn is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-# Check whether --with-override-jdk was given.
-if test "${with_override_jdk+set}" = set; then :
-  withval=$with_override_jdk; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-override-jdk is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-override-jdk is deprecated and will be ignored." >&2;}
-fi
-
-
-
-
-  BUILD_OUTPUT="$OUTPUT_ROOT"
-
-  JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
-
-
-
-# Check whether --with-import_hotspot was given.
-if test "${with_import_hotspot+set}" = set; then :
-  withval=$with_import_hotspot; { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --with-import_hotspot is deprecated and will be ignored." >&5
-$as_echo "$as_me: WARNING: Option --with-import_hotspot is deprecated and will be ignored." >&2;}
-fi
-
-
 
 
 
@@ -48915,6 +48761,138 @@
   elif test "x$with_jtreg" != xyes && test "x$with_jtreg" != x; then
     # An explicit path is specified, use it.
     JT_HOME="$with_jtreg"
+
+  # Only process if variable expands to non-empty
+
+  if test "x$JT_HOME" != x; then
+    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  path="$JT_HOME"
+  new_path=`$CYGPATH -u "$path"`
+
+  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+  # "foo.exe" is OK but "foo" is an error.
+  #
+  # This test is therefore slightly more accurate than "test -f" to check for file precense.
+  # It is also a way to make sure we got the proper file name for the real test later on.
+  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+  if test "x$test_shortpath" = x; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;}
+    as_fn_error $? "Cannot locate the the path of JT_HOME" "$LINENO" 5
+  fi
+
+  # Call helper function which possibly converts this using DOS-style short mode.
+  # If so, the updated path is stored in $new_path.
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+      # Going to short mode and back again did indeed matter. Since short mode is
+      # case insensitive, let's make it lowercase to improve readability.
+      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+      # Now convert it back to Unix-style (cygpath)
+      input_path=`$CYGPATH -u "$shortmode_path"`
+      new_path="$input_path"
+    fi
+  fi
+
+  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+  if test "x$test_cygdrive_prefix" = x; then
+    # As a simple fix, exclude /usr/bin since it's not a real path.
+    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+      # a path prefixed by /cygdrive for fixpath to work.
+      new_path="$CYGWIN_ROOT_PATH$input_path"
+    fi
+  fi
+
+
+  if test "x$path" != "x$new_path"; then
+    JT_HOME="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JT_HOME to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;}
+  fi
+
+    elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+  path="$JT_HOME"
+  has_colon=`$ECHO $path | $GREP ^.:`
+  new_path="$path"
+  if test "x$has_colon" = x; then
+    # Not in mixed or Windows style, start by that.
+    new_path=`cmd //c echo $path`
+  fi
+
+
+  input_path="$new_path"
+  # Check if we need to convert this using DOS-style short mode. If the path
+  # contains just simple characters, use it. Otherwise (spaces, weird characters),
+  # take no chances and rewrite it.
+  # Note: m4 eats our [], so we need to use [ and ] instead.
+  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+  if test "x$has_forbidden_chars" != x; then
+    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+  fi
+
+
+  windows_path="$new_path"
+  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+    unix_path=`$CYGPATH -u "$windows_path"`
+    new_path="$unix_path"
+  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+    new_path="$unix_path"
+  fi
+
+  if test "x$path" != "x$new_path"; then
+    JT_HOME="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JT_HOME to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;}
+  fi
+
+  # Save the first 10 bytes of this path to the storage, so fixpath can work.
+  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+    else
+      # We're on a unix platform. Hooray! :)
+      path="$JT_HOME"
+      has_space=`$ECHO "$path" | $GREP " "`
+      if test "x$has_space" != x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;}
+        as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+      fi
+
+      # Use eval to expand a potential ~
+      eval path="$path"
+      if test ! -f "$path" && test ! -d "$path"; then
+        as_fn_error $? "The path of JT_HOME, which resolves as \"$path\", is not found." "$LINENO" 5
+      fi
+
+      if test -d "$path"; then
+        JT_HOME="`cd "$path"; $THEPWDCMD -L`"
+      else
+        dir="`$DIRNAME "$path"`"
+        base="`$BASENAME "$path"`"
+        JT_HOME="`cd "$dir"; $THEPWDCMD -L`/$base"
+      fi
+    fi
+  fi
+
     if test ! -d "$JT_HOME"; then
       as_fn_error $? "jtreg home directory from --with-jtreg=$with_jtreg does not exist" "$LINENO" 5
     fi
@@ -52048,9 +52026,10 @@
   LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
 
   LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
+  LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${LDFLAGS_NO_EXEC_STACK}"
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
     JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \
-        -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
+        -libpath:${OUTPUTDIR}/support/modules_libs/java.base"
     JDKLIB_LIBS=""
   else
     JAVA_BASE_LDFLAGS="${JAVA_BASE_LDFLAGS} \
@@ -52133,6 +52112,7 @@
 
 
 
+
   # Special extras...
   if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     if test "x$OPENJDK_BUILD_CPU_ARCH" = "xsparc"; then
@@ -52927,9 +52907,10 @@
   OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDK}"
 
   OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS}"
+  OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} ${LDFLAGS_NO_EXEC_STACK}"
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
     OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \
-        -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
+        -libpath:${OUTPUTDIR}/support/modules_libs/java.base"
     OPENJDK_BUILD_JDKLIB_LIBS=""
   else
     OPENJDK_BUILD_JAVA_BASE_LDFLAGS="${OPENJDK_BUILD_JAVA_BASE_LDFLAGS} \
@@ -53012,6 +52993,7 @@
 
 
 
+
   # Tests are only ever compiled for TARGET
   # Flags for compiling test libraries
   CFLAGS_TESTLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
@@ -54311,7 +54293,7 @@
   if test "x$OPENJDK_BUILD_OS" = xwindows; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fixpath can be created" >&5
 $as_echo_n "checking if fixpath can be created... " >&6; }
-    FIXPATH_SRC="$SRC_ROOT/make/src/native/fixpath.c"
+    FIXPATH_SRC="$TOPDIR/make/src/native/fixpath.c"
     FIXPATH_BIN="$CONFIGURESUPPORT_OUTPUTDIR/bin/fixpath.exe"
     FIXPATH_DIR="$CONFIGURESUPPORT_OUTPUTDIR/fixpath"
     if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
@@ -67681,7 +67663,7 @@
 # Check for some common pitfalls
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-    file_to_test="$SRC_ROOT/LICENSE"
+    file_to_test="$TOPDIR/LICENSE"
     if test `$STAT -c '%a' "$file_to_test"` -lt 400; then
       as_fn_error $? "Bad file permissions on src files. This is usually caused by cloning the repositories with a non cygwin hg in a directory not created in cygwin." "$LINENO" 5
     fi
@@ -67717,7 +67699,7 @@
       OUTPUT_DIR_IS_LOCAL="yes"
     fi
   else
-    if $DF -l $OUTPUT_ROOT > /dev/null 2>&1; then
+    if $DF -l $OUTPUTDIR > /dev/null 2>&1; then
       OUTPUT_DIR_IS_LOCAL="yes"
     else
       OUTPUT_DIR_IS_LOCAL="no"
@@ -67734,7 +67716,7 @@
 
   # Before generating output files, test if they exist. If they do, this is a reconfigure.
   # Since we can't properly handle the dependencies for this, warn the user about the situation
-  if test -e $OUTPUT_ROOT/spec.gmk; then
+  if test -e $OUTPUTDIR/spec.gmk; then
     IS_RECONFIGURE=yes
   else
     IS_RECONFIGURE=no
@@ -68484,11 +68466,11 @@
 for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
-    "$OUTPUT_ROOT/spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in" ;;
-    "$OUTPUT_ROOT/bootcycle-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in" ;;
-    "$OUTPUT_ROOT/buildjdk-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in" ;;
-    "$OUTPUT_ROOT/compare.sh") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in" ;;
-    "$OUTPUT_ROOT/Makefile") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in" ;;
+    "$OUTPUTDIR/spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUTDIR/spec.gmk:$AUTOCONF_DIR/spec.gmk.in" ;;
+    "$OUTPUTDIR/bootcycle-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUTDIR/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in" ;;
+    "$OUTPUTDIR/buildjdk-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUTDIR/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in" ;;
+    "$OUTPUTDIR/compare.sh") CONFIG_FILES="$CONFIG_FILES $OUTPUTDIR/compare.sh:$AUTOCONF_DIR/compare.sh.in" ;;
+    "$OUTPUTDIR/Makefile") CONFIG_FILES="$CONFIG_FILES $OUTPUTDIR/Makefile:$AUTOCONF_DIR/Makefile.in" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
@@ -68948,20 +68930,20 @@
   fi
 
   # Rotate our log file (configure.log)
-  if test -e "$OUTPUT_ROOT/configure.log.old"; then
-    $RM -f "$OUTPUT_ROOT/configure.log.old"
-  fi
-  if test -e "$OUTPUT_ROOT/configure.log"; then
-    $MV -f "$OUTPUT_ROOT/configure.log" "$OUTPUT_ROOT/configure.log.old" 2> /dev/null
+  if test -e "$OUTPUTDIR/configure.log.old"; then
+    $RM -f "$OUTPUTDIR/configure.log.old"
+  fi
+  if test -e "$OUTPUTDIR/configure.log"; then
+    $MV -f "$OUTPUTDIR/configure.log" "$OUTPUTDIR/configure.log.old" 2> /dev/null
   fi
 
   # Move configure.log from current directory to the build output root
   if test -e ./configure.log; then
-    $MV -f ./configure.log "$OUTPUT_ROOT/configure.log" 2> /dev/null
+    $MV -f ./configure.log "$OUTPUTDIR/configure.log" 2> /dev/null
   fi
 
   # Make the compare script executable
-  $CHMOD +x $OUTPUT_ROOT/compare.sh
+  $CHMOD +x $OUTPUTDIR/compare.sh
 
 
 # Finally output some useful information to the user
@@ -68972,15 +68954,15 @@
   printf "====================================================\n"
   if test "x$no_create" != "xyes"; then
     if test "x$IS_RECONFIGURE" != "xyes"; then
-      printf "A new configuration has been successfully created in\n%s\n" "$OUTPUT_ROOT"
-    else
-      printf "The existing configuration has been successfully updated in\n%s\n" "$OUTPUT_ROOT"
+      printf "A new configuration has been successfully created in\n%s\n" "$OUTPUTDIR"
+    else
+      printf "The existing configuration has been successfully updated in\n%s\n" "$OUTPUTDIR"
     fi
   else
     if test "x$IS_RECONFIGURE" != "xyes"; then
       printf "A configuration has been successfully checked but not created\n"
     else
-      printf "The existing configuration has been successfully checked in\n%s\n" "$OUTPUT_ROOT"
+      printf "The existing configuration has been successfully checked in\n%s\n" "$OUTPUTDIR"
     fi
   fi
   if test "x$CONFIGURE_COMMAND_LINE" != x; then
--- a/make/autoconf/help.m4	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/help.m4	Thu Sep 28 09:13:27 2017 -0700
@@ -206,15 +206,15 @@
   printf "====================================================\n"
   if test "x$no_create" != "xyes"; then
     if test "x$IS_RECONFIGURE" != "xyes"; then
-      printf "A new configuration has been successfully created in\n%s\n" "$OUTPUT_ROOT"
+      printf "A new configuration has been successfully created in\n%s\n" "$OUTPUTDIR"
     else
-      printf "The existing configuration has been successfully updated in\n%s\n" "$OUTPUT_ROOT"
+      printf "The existing configuration has been successfully updated in\n%s\n" "$OUTPUTDIR"
     fi
   else
     if test "x$IS_RECONFIGURE" != "xyes"; then
       printf "A configuration has been successfully checked but not created\n"
     else
-      printf "The existing configuration has been successfully checked in\n%s\n" "$OUTPUT_ROOT"
+      printf "The existing configuration has been successfully checked in\n%s\n" "$OUTPUTDIR"
     fi
   fi
   if test "x$CONFIGURE_COMMAND_LINE" != x; then
--- a/make/autoconf/jdk-options.m4	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/jdk-options.m4	Thu Sep 28 09:13:27 2017 -0700
@@ -206,8 +206,16 @@
   # Choose cacerts source file
   AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file],
       [specify alternative cacerts file])])
-  if test "x$with_cacerts_file" != x; then
+  AC_MSG_CHECKING([for cacerts file])
+  if test "x$with_cacerts_file" == x; then
+    AC_MSG_RESULT([default])
+  else
     CACERTS_FILE=$with_cacerts_file
+    if test ! -f "$CACERTS_FILE"; then
+      AC_MSG_RESULT([fail])
+      AC_MSG_ERROR([Specified cacerts file "$CACERTS_FILE" does not exist])
+    fi
+    AC_MSG_RESULT([$CACERTS_FILE])
   fi
   AC_SUBST(CACERTS_FILE)
 
--- a/make/autoconf/source-dirs.m4	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/source-dirs.m4	Thu Sep 28 09:13:27 2017 -0700
@@ -25,9 +25,9 @@
 
 AC_DEFUN_ONCE([SRCDIRS_SETUP_DIRS],
 [
-  BUILD_OUTPUT="$OUTPUT_ROOT"
-  AC_SUBST(BUILD_OUTPUT)
-  JDK_OUTPUTDIR="$OUTPUT_ROOT/jdk"
+  OUTPUTDIR="$OUTPUTDIR"
+  AC_SUBST(OUTPUTDIR)
+  JDK_OUTPUTDIR="$OUTPUTDIR/jdk"
 
   # Where are the sources.
   AC_SUBST(TOPDIR)
--- a/make/autoconf/spec.gmk.in	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/spec.gmk.in	Thu Sep 28 09:13:27 2017 -0700
@@ -125,14 +125,12 @@
 SYSROOT_CFLAGS := @SYSROOT_CFLAGS@
 SYSROOT_LDFLAGS := @SYSROOT_LDFLAGS@
 
-# The top-level directory of the forest (SRC_ROOT is a traditional alias)
+# 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@
-SRC_ROOT:=@TOPDIR@
 
-OUTPUT_ROOT:=@OUTPUT_ROOT@
 
 IMPORT_MODULES_CLASSES:=@IMPORT_MODULES_CLASSES@
 IMPORT_MODULES_CMDS:=@IMPORT_MODULES_CMDS@
@@ -244,29 +242,22 @@
 
 # JDK_OUTPUTDIR specifies where a working jvm is built.
 # You can run $(JDK_OUTPUTDIR)/bin/java
-# Though the layout of the contents of $(JDK_OUTPUTDIR) is not
-# yet the same as a default installation.
-#
-# When you run "make install" it will create the standardized
-# layout for the jdk and the jre inside the IMAGES_OUTPUTDIR subdir.
-# Then it will copy the contents of the jdk into the installation
-# directory.
 
-BUILD_OUTPUT:=@BUILD_OUTPUT@
+OUTPUTDIR := @OUTPUTDIR@
 # Colon left out to be able to override IMAGES_OUTPUTDIR for bootcycle-images
-SUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/support
-BUILDTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/buildtools
+SUPPORT_OUTPUTDIR=$(OUTPUTDIR)/support
+BUILDTOOLS_OUTPUTDIR=$(OUTPUTDIR)/buildtools
 
-HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
-JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
-IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
-BUNDLES_OUTPUTDIR=$(BUILD_OUTPUT)/bundles
-TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/test-make
-MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
+HOTSPOT_OUTPUTDIR=$(OUTPUTDIR)/hotspot
+JDK_OUTPUTDIR=$(OUTPUTDIR)/jdk
+IMAGES_OUTPUTDIR=$(OUTPUTDIR)/images
+BUNDLES_OUTPUTDIR=$(OUTPUTDIR)/bundles
+TESTMAKE_OUTPUTDIR=$(OUTPUTDIR)/test-make
+MAKESUPPORT_OUTPUTDIR=$(OUTPUTDIR)/make-support
 
 # This does not get overridden in a bootcycle build
 CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@
-BUILDJDK_OUTPUTDIR=$(BUILD_OUTPUT)/buildjdk
+BUILDJDK_OUTPUTDIR=$(OUTPUTDIR)/buildjdk
 
 BUILD_FAILURE_HANDLER := @BUILD_FAILURE_HANDLER@
 
@@ -396,6 +387,7 @@
 CXXFLAGS_JDKEXE:=@CXXFLAGS_JDKEXE@
 
 LDFLAGS_HASH_STYLE := @LDFLAGS_HASH_STYLE@
+LDFLAGS_NO_EXEC_STACK := @LDFLAGS_NO_EXEC_STACK@
 
 JVM_CFLAGS := @JVM_CFLAGS@
 JVM_CFLAGS_SYMBOLS := @JVM_CFLAGS_SYMBOLS@
--- a/make/autoconf/toolchain.m4	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/autoconf/toolchain.m4	Thu Sep 28 09:13:27 2017 -0700
@@ -935,6 +935,7 @@
   elif test "x$with_jtreg" != xyes && test "x$with_jtreg" != x; then
     # An explicit path is specified, use it.
     JT_HOME="$with_jtreg"
+    BASIC_FIXUP_PATH([JT_HOME])
     if test ! -d "$JT_HOME"; then
       AC_MSG_ERROR([jtreg home directory from --with-jtreg=$with_jtreg does not exist])
     fi
--- a/make/common/JarArchive.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/common/JarArchive.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -211,7 +211,7 @@
   $1_SUPDATE_CONTENTS=$(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE)
 
   # Use a slightly shorter name for logging, but with enough path to identify this jar.
-  $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR))
+  $1_NAME:=$$(subst $$(OUTPUTDIR)/,,$$($1_JAR))
 
   ifneq (,$$($1_CHECK_COMPRESS_JAR))
     $1_JAR_CREATE_OPTIONS := c0fm
--- a/make/common/MakeBase.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/common/MakeBase.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -82,7 +82,7 @@
 ### Functions for timers
 
 # Store the build times in this directory.
-BUILDTIMESDIR=$(OUTPUT_ROOT)/make-support/build-times
+BUILDTIMESDIR=$(OUTPUTDIR)/make-support/build-times
 
 # Record starting time for build of a sub repository.
 define RecordStartTime
@@ -155,7 +155,7 @@
       $(strip $(shell $(CAT) $(TOPDIR)/make/common/support/ListPathsSafely-pre-compress.incl)))
   compress_paths += \
       $(subst $(TOPDIR),X97, \
-      $(subst $(OUTPUT_ROOT),X98, \
+      $(subst $(OUTPUTDIR),X98, \
       $(subst X,X00, \
       $(subst $(SPACE),\n,$(strip $1)))))
   $(eval compress_paths += \
@@ -163,7 +163,7 @@
 
   decompress_paths=$(SED) -f $(TOPDIR)/make/common/support/ListPathsSafely-uncompress.sed \
       -e 's|X99|\\n|g' \
-      -e 's|X98|$(OUTPUT_ROOT)|g' -e 's|X97|$(TOPDIR)|g' \
+      -e 's|X98|$(OUTPUTDIR)|g' -e 's|X97|$(TOPDIR)|g' \
       -e 's|X00|X|g'
 
   ListPathsSafely_IfPrintf = \
@@ -359,11 +359,11 @@
     ifeq ($$(IS_GNU_TIME), yes)
       SHELL :=  $$(BASH) $$(TOPDIR)/make/scripts/shell-profiler.sh \
                 gnutime $$(TIME) \
-                $$(OUTPUT_ROOT)/build-profile.log $$(SHELL)
+                $$(OUTPUTDIR)/build-profile.log $$(SHELL)
     else ifneq ($$(FLOCK), )
       SHELL :=  $$(BASH) $$(TOPDIR)/make/scripts/shell-profiler.sh \
                 flock $$(FLOCK) \
-                $$(OUTPUT_ROOT)/build-profile.log $$(SHELL)
+                $$(OUTPUTDIR)/build-profile.log $$(SHELL)
     endif
   endif
 
@@ -707,7 +707,7 @@
   # 4 : Macro to call for copy operation
   # 5 : Action text to log
   $2: $1
-	$$(call LogInfo, $(strip $5) $$(patsubst $(OUTPUT_ROOT)/%,%,$$@))
+	$$(call LogInfo, $(strip $5) $$(patsubst $(OUTPUTDIR)/%,%,$$@))
 	$$($$(strip $4))
 
   $3 += $2
@@ -937,8 +937,8 @@
   $(call WriteFile, $2, $(strip $1).cmdline) \
   ( $(strip $2) > >($(TEE) $(strip $1).log) 2> >($(TEE) $(strip $1).log >&2) || \
       ( exitcode=$(DOLLAR)? && \
-      $(CP) $(strip $1).log $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(subst /,_,$(patsubst $(BUILD_OUTPUT)/%,%,$(strip $1))).log && \
-      $(CP) $(strip $1).cmdline $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(subst /,_,$(patsubst $(BUILD_OUTPUT)/%,%,$(strip $1))).cmdline && \
+      $(CP) $(strip $1).log $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(subst /,_,$(patsubst $(OUTPUTDIR)/%,%,$(strip $1))).log && \
+      $(CP) $(strip $1).cmdline $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(subst /,_,$(patsubst $(OUTPUTDIR)/%,%,$(strip $1))).cmdline && \
       exit $(DOLLAR)exitcode ) )
 
 ################################################################################
--- a/make/common/Modules.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/common/Modules.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -58,7 +58,6 @@
     java.rmi \
     java.security.sasl \
     java.xml \
-    jdk.httpserver \
     jdk.internal.vm.ci \
     jdk.management \
     jdk.management.agent \
@@ -112,6 +111,7 @@
     jdk.crypto.cryptoki \
     jdk.crypto.ec \
     jdk.dynalink \
+    jdk.httpserver \
     jdk.incubator.httpclient \
     jdk.jsobject \
     jdk.localedata \
@@ -173,7 +173,6 @@
     jdk.naming.rmi \
     jdk.net \
     jdk.pack \
-    jdk.policytool \
     jdk.rmic \
     jdk.scripting.nashorn \
     jdk.sctp \
--- a/make/common/NativeCompilation.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/common/NativeCompilation.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -751,10 +751,10 @@
   # This is a rough heuristic and may not always print accurate information.
   $$($1_BUILD_INFO): $$($1_SRCS) $$($1_COMPILE_VARDEPS_FILE)
         ifeq ($$(wildcard $$($1_TARGET)),)
-	  $(ECHO) 'Creating $$(subst $$(BUILD_OUTPUT)/,,$$($1_TARGET)) from $$(words \
+	  $(ECHO) 'Creating $$(subst $$(OUTPUTDIR)/,,$$($1_TARGET)) from $$(words \
 	      $$(filter-out %.vardeps, $$?)) file(s)'
         else
-	  $(ECHO) $$(strip 'Updating $$(subst $$(BUILD_OUTPUT)/,,$$($1_TARGET))' \
+	  $(ECHO) $$(strip 'Updating $$(subst $$(OUTPUTDIR)/,,$$($1_TARGET))' \
 	      $$(if $$(filter-out %.vardeps, $$?), \
 	        'due to $$(words $$(filter-out %.vardeps, $$?)) file(s)', \
 	      $$(if $$(filter %.vardeps, $$?), 'due to makefile changes')))
@@ -946,9 +946,9 @@
       ifeq ($$(TOOLCHAIN_TYPE), clang)
         # There is no strlen function in make, but checking path depth is a
         # reasonable approximation.
-        ifneq ($$(word 10, $$(subst /, ,$$(OUTPUT_ROOT))), )
+        ifneq ($$(word 10, $$(subst /, ,$$(OUTPUTDIR))), )
           $1_LINK_OBJS_RELATIVE := true
-          $1_ALL_OBJS_RELATIVE := $$(patsubst $$(OUTPUT_ROOT)/%, %, $$($1_ALL_OBJS))
+          $1_ALL_OBJS_RELATIVE := $$(patsubst $$(OUTPUTDIR)/%, %, $$($1_ALL_OBJS))
         endif
       endif
     endif
@@ -976,7 +976,7 @@
 		  $$($1_STRIP_CMD)
                 else
 		  $$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \
-		      $$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUT_ROOT) ; ) \
+		      $$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \
 		      $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
 		      $(LD_OUT_OPTION)$$@ $$($1_LD_OBJ_ARG) $$($1_RES) $$($1_LIBS) \
 		      $$($1_EXTRA_LIBS)) ; \
--- a/make/common/ZipArchive.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/common/ZipArchive.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -95,7 +95,7 @@
   endif
 
   # Use a slightly shorter name for logging, but with enough path to identify this zip.
-  $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
+  $1_NAME:=$$(subst $$(OUTPUTDIR)/,,$$($1_ZIP))
 
   # Now $1_ALL_SRCS should contain all sources that are going to be put into the zip.
   # I.e. the zip -i and -x options should match the filtering done in the makefile.
--- a/make/copy/Copy-java.base.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/copy/Copy-java.base.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -208,7 +208,7 @@
 CACERTS_DST := $(LIB_DST_DIR)/security/cacerts
 
 $(CACERTS_DST): $(CACERTS_FILE)
-	$(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%, %, $@))
 	$(call install-file)
 
 TARGETS += $(CACERTS_DST)
--- a/make/devkit/Makefile	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/devkit/Makefile	Thu Sep 28 09:13:27 2017 -0700
@@ -75,12 +75,12 @@
   $(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me)))
 endif
 
-OUTPUT_ROOT = $(abspath ../../build/devkit)
-RESULT = $(OUTPUT_ROOT)/result
+OUTPUTDIR = $(abspath ../../build/devkit)
+RESULT = $(OUTPUTDIR)/result
 
 submakevars = HOST=$@ BUILD=$(me) \
     RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \
-    OUTPUT_ROOT=$(OUTPUT_ROOT)
+    OUTPUTDIR=$(OUTPUTDIR)
 $(platforms) :
 	@echo 'Building compilers for $@'
 	@echo 'Targets: $(platforms)'
--- a/make/devkit/Tools.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/devkit/Tools.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -121,13 +121,13 @@
 endif
 
 # Define directories
-RESULT := $(OUTPUT_ROOT)/result
-BUILDDIR := $(OUTPUT_ROOT)/$(HOST)/$(TARGET)
+RESULT := $(OUTPUTDIR)/result
+BUILDDIR := $(OUTPUTDIR)/$(HOST)/$(TARGET)
 PREFIX := $(RESULT)/$(HOST)
 TARGETDIR := $(PREFIX)/$(TARGET)
 SYSROOT := $(TARGETDIR)/sysroot
-DOWNLOAD := $(OUTPUT_ROOT)/download
-SRCDIR := $(OUTPUT_ROOT)/src
+DOWNLOAD := $(OUTPUTDIR)/download
+SRCDIR := $(OUTPUTDIR)/src
 
 # Marker file for unpacking rpms
 rpms := $(SYSROOT)/rpms_unpacked
--- a/make/gensrc/Gensrc-jdk.charsets.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/gensrc/Gensrc-jdk.charsets.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -72,7 +72,7 @@
 
 $(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat: $(CHARSET_DATA_DIR)/sjis0213.map \
     $(BUILD_TOOLS_JDK)
-	$(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+	$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@))
 	$(call MakeDir, $(@D))
 	$(TOOL_CHARSETMAPPING) '$<' '$@' sjis0213
 
--- a/make/gensrc/GensrcIcons.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/gensrc/GensrcIcons.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -117,7 +117,7 @@
 
 
   $(GENSRC_OSX_ICONS): $(GENSRC_OSX_ICONS_SRC) $(BUILD_TOOLS_JDK)
-	$(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+	$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@))
 	$(call MakeDir, $(@D))
 	$(RM) $@ $@.tmp
 	$(ECHO) "static unsigned char sAWTIconData[] = { " >> $@.tmp
--- a/make/hotspot/ide/CreateVSProject.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/hotspot/ide/CreateVSProject.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -99,7 +99,7 @@
   # Run the ProjectCreator tool
   PROJECT_CREATOR_TOOL := $(JAVA_SMALL) -cp $(TOOLS_OUTPUTDIR) build.tools.projectcreator.ProjectCreator
 
-  IDE_OUTPUTDIR := $(BUILD_OUTPUT)/ide/hotspot-visualstudio
+  IDE_OUTPUTDIR := $(OUTPUTDIR)/ide/hotspot-visualstudio
 
   VCPROJ_FILE := $(IDE_OUTPUTDIR)/jvm.vcxproj
 
--- a/make/hotspot/lib/CompileLibjsig.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/hotspot/lib/CompileLibjsig.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
   ifeq ($(STATIC_BUILD), false)
     ifeq ($(OPENJDK_TARGET_OS), linux)
       LIBJSIG_CFLAGS := -fPIC -D_GNU_SOURCE -D_REENTRANT $(EXTRA_CFLAGS)
-      LIBJSIG_LDFLAGS := $(LDFLAGS_HASH_STYLE) $(EXTRA_CFLAGS)
+      LIBJSIG_LDFLAGS := $(LDFLAGS_HASH_STYLE) ${LDFLAGS_NO_EXEC_STACK} $(EXTRA_CFLAGS)
       LIBJSIG_LIBS := $(LIBDL)
 
       # NOTE: The old build compiled this library without -soname.
--- a/make/langtools/intellij/langtools.iml	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/langtools/intellij/langtools.iml	Thu Sep 28 09:13:27 2017 -0700
@@ -22,11 +22,7 @@
       <sourceFolder url="file://$MODULE_DIR$/src/jdk.jshell" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src/jdk.javadoc" isTestSource="false" />
       <excludeFolder url="file://$MODULE_DIR$/build" />
-      <excludeFolder url="file://$MODULE_DIR$/make" />
-      <excludeFolder url="file://$MODULE_DIR$/src" />
-      <excludeFolder url="file://$MODULE_DIR$/test" />
     </content>
-    <content url="file://$MODULE_DIR$/test/langtools"/>
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="inheritedJdk" />
   </component>
--- a/make/langtools/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/langtools/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java	Thu Sep 28 09:13:27 2017 -0700
@@ -57,8 +57,8 @@
         }
 
         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
-        List<String> options = Arrays.asList("-source", "9",
-                                             "-target", "9",
+        List<String> options = Arrays.asList("-source", "10",
+                                             "-target", "10",
                                              "-proc:only",
                                              "--system", "none",
                                              "--module-source-path", args[0],
--- a/make/launcher/Launcher-jdk.policytool.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-include LauncherCommon.gmk
-
-ifeq ($(ENABLE_HEADLESS_ONLY), false)
-  $(eval $(call SetupBuildLauncher, policytool, \
-      MAIN_CLASS := sun.security.tools.policytool.PolicyTool, \
-      LIBS_unix := $(X_LIBS), \
-  ))
-endif
--- a/make/mapfiles/libjava/mapfile-vers	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/mapfiles/libjava/mapfile-vers	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -74,17 +74,16 @@
 		JNU_ThrowStringIndexOutOfBoundsException;
 		JNU_ToString;
 
+		Java_java_io_FileDescriptor_close;
 		Java_java_io_FileDescriptor_initIDs;
 		Java_java_io_FileDescriptor_sync;
 		Java_java_io_FileDescriptor_getAppend;
 		Java_java_io_FileInputStream_available0;
-		Java_java_io_FileInputStream_close0;
 		Java_java_io_FileInputStream_initIDs;
 		Java_java_io_FileInputStream_open0;
 		Java_java_io_FileInputStream_read0;
 		Java_java_io_FileInputStream_readBytes;
 		Java_java_io_FileInputStream_skip0;
-		Java_java_io_FileOutputStream_close0;
 		Java_java_io_FileOutputStream_initIDs;
 		Java_java_io_FileOutputStream_open0;
 		Java_java_io_FileOutputStream_write;
@@ -95,7 +94,6 @@
 		Java_java_io_ObjectOutputStream_floatsToBytes;
 		Java_java_io_ObjectStreamClass_hasStaticInitializer;
 		Java_java_io_ObjectStreamClass_initNative;
-		Java_java_io_RandomAccessFile_close0;
 		Java_java_io_RandomAccessFile_getFilePointer;
 		Java_java_io_RandomAccessFile_initIDs;
 		Java_java_io_RandomAccessFile_length;
--- a/make/nashorn/build-benchmark.xml	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/nashorn/build-benchmark.xml	Thu Sep 28 09:13:27 2017 -0700
@@ -219,7 +219,8 @@
 
   <target name="-define-nashorn-task">
     <ant dir="${nashorntask.dir}" inheritAll="false"/>
-    <taskdef name="nashorn" classname="jdk.nashorn.ant.NashornTask" classpath="${nashorntask.dir}/dist/nashorntask.jar"/>
+    <taskdef name="nashorn" classname="jdk.nashorn.ant.NashornTask"
+        classpath="${nashorntask.dist.dir}/nashorntask.jar"/>
   </target>
 
   <!--
--- a/make/nashorn/build.xml	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/nashorn/build.xml	Thu Sep 28 09:13:27 2017 -0700
@@ -174,8 +174,6 @@
   <target name="compile" depends="prepare" description="Compiles nashorn">
     <javac srcdir="${dynalink.module.src.dir}"
            destdir="${dynalink.module.classes.dir}"
-           source="${javac.source}"
-           target="${javac.target}"
            debug="${javac.debug}"
            encoding="${javac.encoding}"
            includeantruntime="false" fork="true">
@@ -190,8 +188,6 @@
     </delete>
     <javac srcdir="${nashorn.module.src.dir}"
            destdir="${nashorn.module.classes.dir}"
-           source="${javac.source}"
-           target="${javac.target}"
            debug="${javac.debug}"
            encoding="${javac.encoding}"
            includeantruntime="false" fork="true">
@@ -207,8 +203,6 @@
     </delete>
     <javac srcdir="${nashorn.shell.module.src.dir}"
            destdir="${nashorn.shell.module.classes.dir}"
-           source="${javac.source}"
-           target="${javac.target}"
            debug="${javac.debug}"
            encoding="${javac.encoding}"
            includeantruntime="false" fork="true">
@@ -271,17 +265,16 @@
   <target name="javadoc" depends="jar">
     <javadoc destdir="${dist.javadoc.dir}" use="yes"
         windowtitle="${nashorn.product.name} ${nashorn.version}"
-        additionalparam="-quiet" failonerror="true" useexternalfile="true">
+        additionalparam="-quiet" failonerror="true" useexternalfile="true"> 
+      <arg value="--patch-module"/>
+      <arg value="jdk.scripting.nashorn=${basedir}/${nashorn.module.src.dir}"/>
+      <arg value="--patch-module"/>
+      <arg value="jdk.dynalink=${basedir}/${dynalink.module.src.dir}"/>
       <arg value="--module-source-path"/>
-      <arg value="${nashorn.module.src.dir}"/>
-      <arg value="--module-source-path"/>
-      <arg value="${dynalink.module.src.dir}"/>
+      <arg value="."/>
       <arg value="${javadoc.option}"/>
-      <classpath>
-        <pathelement location="${build.classes.dir}"/>
-      </classpath>
+      <fileset dir="${nashorn.module.src.dir}" includes="**/*.java"/>
       <fileset dir="${dynalink.module.src.dir}" includes="**/*.java"/>
-      <fileset dir="${nashorn.module.src.dir}" includes="**/*.java"/>
       <link href="http://docs.oracle.com/javase/8/docs/api/"/>
     </javadoc>
   </target>
@@ -290,14 +283,15 @@
   <target name="nashornapi" depends="jar">
     <mkdir dir="${dist.nashornapi.javadoc.dir}"/>
     <javadoc destdir="${dist.nashornapi.javadoc.dir}" use="yes"
-        extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}"
+        windowtitle="${nashorn.product.name} ${nashorn.version}"
         additionalparam="-quiet" failonerror="true" useexternalfile="true">
+      <arg value="--patch-module"/>
+      <arg value="jdk.scripting.nashorn=${basedir}/${nashorn.module.src.dir}"/>
+      <arg value="--patch-module"/>
+      <arg value="jdk.dynalink=${basedir}/${dynalink.module.src.dir}"/>
       <arg value="--module-source-path"/>
-      <arg value="${nashorn.module.src.dir}"/>
+      <arg value="."/>
       <arg value="${javadoc.option}"/>
-      <classpath>
-        <pathelement location="${build.classes.dir}"/>
-      </classpath>
       <fileset dir="${nashorn.module.src.dir}" includes="jdk/nashorn/api/**/*.java"/>
       <link href="http://docs.oracle.com/javase/8/docs/api/"/>
     </javadoc>
@@ -309,30 +303,22 @@
     <javadoc destdir="${dist.dynalinkapi.javadoc.dir}" use="yes"
         windowtitle="Dynalink"
         additionalparam="-quiet" failonerror="true" useexternalfile="true">
+      <arg value="--patch-module"/>
+      <arg value="jdk.scripting.nashorn=${basedir}/${nashorn.module.src.dir}"/>
+      <arg value="--patch-module"/>
+      <arg value="jdk.dynalink=${basedir}/${dynalink.module.src.dir}"/>
       <arg value="--module-source-path"/>
-      <arg value="${dynalink.module.src.dir}"/>
+      <arg value="."/>
       <arg value="${javadoc.option}"/>
-      <classpath>
-        <pathelement location="${build.classes.dir}"/>
-      </classpath>
-      <fileset dir="${dynalink.module.src.dir}" includes="**/*.java" excludes="jdk/dynalink/internal/*.java"/>
+      <fileset dir="${dynalink.module.src.dir}" includes="**/*.java"/>
       <link href="http://docs.oracle.com/javase/8/docs/api/"/>
     </javadoc>
   </target>
 
   <target name="javadocapi" depends="nashornapi, dynalinkapi"/>
 
-  <!-- generate shell.html for shell tool documentation -->
-  <target name="shelldoc" depends="jar">
-    <java classname="${nashorn.shell.tool}" dir="${basedir}" output="${dist.dir}/shell.html" failonerror="true" fork="true">
-      <jvmarg line="${nashorn.override.option}"/>
-      <arg value="-scripting"/>
-      <arg value="docs/genshelldoc.js"/>
-    </java>
-  </target>
-
   <!-- generate all docs -->
-  <target name="docs" depends="javadoc, shelldoc"/>
+  <target name="docs" depends="javadoc"/>
 
   <!-- create .zip and .tar.gz for nashorn binaries and scripts. -->
   <target name="dist" depends="jar">
@@ -350,8 +336,6 @@
     <javac srcdir="${test.src.dir}"
            destdir="${build.test.classes.dir}"
            classpath="${javac.test.classpath}"
-           source="${javac.source}"
-           target="${javac.target}"
            debug="${javac.debug}"
            encoding="${javac.encoding}"
            includeantruntime="false" fork="true">
@@ -359,7 +343,7 @@
         <compilerarg value="-Xlint:unchecked"/>
         <compilerarg value="-Xlint:deprecation"/>
         <compilerarg value="-Xdiags:verbose"/>
-        <compilerarg line="${test.module.imports}"/>
+        <compilerarg line="${test.module.imports.compile.time}"/>
     </javac>
 
     <copy todir="${build.test.classes.dir}/META-INF/services">
@@ -614,7 +598,7 @@
     </testng>
   </target>
 
-  <target name="test" depends="prepare, test-pessimistic, test-optimistic"/>
+  <target name="test" depends="prepare, javadoc, test-pessimistic, test-optimistic"/>
 
   <target name="test-optimistic" depends="jar, -test-classes-all,-test-classes-single, check-testng, check-external-tests, compile-test, generate-security-config" if="testng.available">
     <echo message="Running test suite in OPTIMISTIC mode..."/>
@@ -752,7 +736,7 @@
 
   <target name="run" depends="jar"
       description="Run the shell with a sample script">
-    <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
+    <java classname="${nashorn.shell.tool}" fork="true" dir="${basedir}/src/sample/nashorn">
         <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
         <arg value="-dump-on-error"/>
         <arg value="test.js"/>
@@ -761,7 +745,7 @@
 
   <target name="debug" depends="jar"
       description="Debug the shell with a sample script">
-    <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
+    <java classname="${nashorn.shell.tool}" fork="true" dir="${basedir}/src/sample/nashorn">
         <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
         <arg value="--print-code"/>
         <arg value="--verify-code"/>
--- a/make/nashorn/buildtools/nasgen/project.properties	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/nashorn/buildtools/nasgen/project.properties	Thu Sep 28 09:13:27 2017 -0700
@@ -24,8 +24,6 @@
 
 # source and target levels
 build.compiler=modern
-javac.source=1.7
-javac.target=1.7
 
 # This directory is removed when the project is cleaned:
 nasgen.build.dir=../../../../build/nashorn/nasgen
--- a/make/nashorn/buildtools/nashorntask/build.xml	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/nashorn/buildtools/nashorntask/build.xml	Thu Sep 28 09:13:27 2017 -0700
@@ -27,18 +27,18 @@
   </target>
 
   <target name="prepare" depends="init">
-    <mkdir dir="${build.classes.dir}"/>
-    <mkdir dir="${dist.dir}"/>
+    <mkdir dir="${nashorntask.build.classes.dir}"/>
+    <mkdir dir="${nashorntask.dist.dir}"/>
   </target>
 
   <target name="clean" depends="init">
-    <delete dir="${build.dir}"/>
-    <delete dir="${dist.dir}"/>
+    <delete dir="${nashorntask.build.dir}"/>
+    <delete dir="${nashorntask.dist.dir}"/>
   </target>
 
   <target name="compile" depends="prepare" description="Compiles the nashorn ant tag sources">
     <javac srcdir="${src.dir}"
-           destdir="${build.classes.dir}"
+           destdir="${nashorntask.build.classes.dir}"
            debug="${javac.debug}"
            includeantruntime="true">
       <compilerarg value="-Xlint:unchecked"/>
@@ -47,7 +47,7 @@
   </target>
 
   <target name="jar" depends="compile" description="Creates nashorntask.jar">
-    <jar jarfile="${dist.jar}" basedir="${build.classes.dir}"/>
+    <jar jarfile="${nashorntask.dist.jar}" basedir="${nashorntask.build.classes.dir}"/>
   </target>
 
   <target name="dist" depends="jar"/>
--- a/make/nashorn/buildtools/nashorntask/project.properties	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/nashorn/buildtools/nashorntask/project.properties	Thu Sep 28 09:13:27 2017 -0700
@@ -24,17 +24,15 @@
 
 # source and target levels
 build.compiler=modern
-javac.source=1.8
-javac.target=1.8
-
-build.classes.dir=${build.dir}/classes
 
 # This directory is removed when the project is cleaned:
-build.dir=build
+nashorntask.build.dir=../../../../build/nashorn/nashorntask
+nashorntask.build.classes.dir=${nashorntask.build.dir}/classes
+
 # This directory is removed when the project is cleaned:
-dist.dir=dist
-dist.jar=${dist.dir}/nashorntask.jar
-dist.javadoc.dir=${dist.dir}/javadoc
+nashorntask.dist.dir=${nashorntask.build.dir}/dist
+nashorntask.dist.jar=${nashorntask.dist.dir}/nashorntask.jar
+nashorntask.dist.javadoc.dir=${nashorntask.dist.dir}/javadoc
 
 javac.debug=true
 src.dir=src
--- a/make/nashorn/project.properties	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/nashorn/project.properties	Thu Sep 28 09:13:27 2017 -0700
@@ -32,8 +32,6 @@
 
 # source and target levels
 build.compiler=modern
-javac.source=1.9
-javac.target=1.9
 
 javadoc.option=\
     -tag "implSpec:a:Implementation Requirements:" \
@@ -60,7 +58,8 @@
  --patch-module jdk.dynalink=${build.classes.dir}/jdk.dynalink
 
 # project directory of <nashorn> ant task
-nashorntask.dir=buildtools/nashorntask
+nashorntask.dir=${nashorn.make.dir}/buildtools/nashorntask
+nashorntask.dist.dir=${build.dir}/nashorntask/dist
 
 # nashorn Shell tool
 nashorn.shell.tool=jdk.nashorn.tools.Shell
@@ -145,7 +144,7 @@
     ${file.reference.bsh.jar}${path.separator}\
     ${file.reference.snakeyaml.jar}
 
-test.module.imports=\
+test.module.imports.compile.time=\
     --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.ir=ALL-UNNAMED \
     --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.codegen=ALL-UNNAMED \
     --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.parser=ALL-UNNAMED \
@@ -158,7 +157,10 @@
     --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.regexp=ALL-UNNAMED \
     --add-exports jdk.scripting.nashorn/jdk.nashorn.internal.runtime.regexp.joni=ALL-UNNAMED \
     --add-exports jdk.scripting.nashorn/jdk.nashorn.tools=ALL-UNNAMED \
-    --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
+    --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED
+
+test.module.imports.runtime=\
+    ${test.module.imports.compile.time} \
     --add-opens jdk.scripting.nashorn/jdk.nashorn.internal.runtime=ALL-UNNAMED \
     --add-opens jdk.scripting.nashorn/jdk.nashorn.internal.runtime.doubleconv=ALL-UNNAMED
 
@@ -358,7 +360,7 @@
 
 run.test.jvmargs.common=\
   -server \
-  ${test.module.imports} \
+  ${test.module.imports.runtime} \
   ${run.test.jvmargs.external} \
   --add-modules jdk.scripting.nashorn.shell \
   ${nashorn.override.option} \
--- a/make/scripts/compare.sh	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/scripts/compare.sh	Thu Sep 28 09:13:27 2017 -0700
@@ -29,7 +29,7 @@
 ################################################################################
 
 # Check that we are run via the wrapper generated by configure
-if [ -z "$SRC_ROOT" ]; then
+if [ -z "$TOPDIR" ]; then
     echo "Error: You must run this script using build/[conf]/compare.sh"
     exit 1
 fi
@@ -56,7 +56,7 @@
     STAT_PRINT_SIZE="-c %s"
 fi
 
-COMPARE_EXCEPTIONS_INCLUDE="$SRC_ROOT/make/scripts/compare_exceptions.sh.incl"
+COMPARE_EXCEPTIONS_INCLUDE="$TOPDIR/make/scripts/compare_exceptions.sh.incl"
 if [ ! -e "$COMPARE_EXCEPTIONS_INCLUDE" ]; then
     echo "Error: Cannot locate the exceptions file, it should have been here: $COMPARE_EXCEPTIONS_INCLUDE"
     exit 1
--- a/make/scripts/compare_exceptions.sh.incl	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/scripts/compare_exceptions.sh.incl	Thu Sep 28 09:13:27 2017 -0700
@@ -86,7 +86,6 @@
       ./bin/keytool
       ./bin/orbd
       ./bin/pack200
-      ./bin/policytool
       ./bin/rmic
       ./bin/rmid
       ./bin/rmiregistry
@@ -219,7 +218,6 @@
       ./bin/keytool
       ./bin/orbd
       ./bin/pack200
-      ./bin/policytool
       ./bin/rmic
       ./bin/rmid
       ./bin/rmiregistry
@@ -329,7 +327,6 @@
       ./bin/keytool
       ./bin/orbd
       ./bin/pack200
-      ./bin/policytool
       ./bin/rmic
       ./bin/rmid
       ./bin/rmiregistry
@@ -422,7 +419,6 @@
       ./bin/ktab.exe
       ./bin/orbd.exe
       ./bin/pack200.exe
-      ./bin/policytool.exe
       ./bin/rmic.exe
       ./bin/rmid.exe
       ./bin/rmiregistry.exe
@@ -512,7 +508,6 @@
       ./bin/keytool
       ./bin/orbd
       ./bin/pack200
-      ./bin/policytool
       ./bin/rmic
       ./bin/rmid
       ./bin/rmiregistry
--- a/make/test/JtregNativeHotspot.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/test/JtregNativeHotspot.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -117,7 +117,7 @@
     BUILD_HOTSPOT_JTREG_EXECUTABLES_CFLAGS_exeFPRegs := -MT
 endif
 
-BUILD_HOTSPOT_JTREG_OUTPUT_DIR := $(BUILD_OUTPUT)/support/test/hotspot/jtreg/native
+BUILD_HOTSPOT_JTREG_OUTPUT_DIR := $(OUTPUTDIR)/support/test/hotspot/jtreg/native
 
 BUILD_HOTSPOT_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/hotspot/jtreg
 
--- a/make/test/JtregNativeJdk.gmk	Tue Sep 26 10:46:23 2017 +0530
+++ b/make/test/JtregNativeJdk.gmk	Thu Sep 28 09:13:27 2017 -0700
@@ -47,7 +47,7 @@
     $(TOPDIR)/test/jdk/java/lang/String/nativeEncoding \
     #
 
-BUILD_JDK_JTREG_OUTPUT_DIR := $(BUILD_OUTPUT)/support/test/jdk/jtreg/native
+BUILD_JDK_JTREG_OUTPUT_DIR := $(OUTPUTDIR)/support/test/jdk/jtreg/native
 
 BUILD_JDK_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/jdk/jtreg
 
--- a/src/bsd/doc/man/ja/policytool.1	Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-." Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
-." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-."
-." This code is free software; you can redistribute it and/or modify it
-." under the terms of the GNU General Public License version 2 only, as
-." published by the Free Software Foundation.
-."
-." This code is distributed in the hope that it will be useful, but WITHOUT
-." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-." FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-." version 2 for more details (a copy is included in the LICENSE file that
-." accompanied this code).
-."
-." You should have received a copy of the GNU General Public License version
-." 2 along with this work; if not, write to the Free Software Foundation,
-." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-."
-." Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-." or visit www.oracle.com if you need additional information or have any
-." questions.
-."
-.TH policytool 1 "07 May 2011"
-
-.LP
--- a/src/bsd/doc/man/jarsigner.1	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/bsd/doc/man/jarsigner.1	Thu Sep 28 09:13:27 2017 -0700
@@ -149,7 +149,7 @@
 .PP
 Applications can choose different types of keystore implementations from different providers, with the \f3getInstance\fR factory method in the \f3KeyStore\fR class\&. A keystore type defines the storage and data format of the keystore information and the algorithms used to protect private keys in the keystore and the integrity of the keystore itself\&. Keystore implementations of different types are not compatible\&.
 .PP
-The \f3jarsigner\fR and \f3policytool\fR commands can read file-based keystores from any location that can be specified using a URL\&. In addition, these commands can read non-file-based keystores such as those provided by MSCAPI on Windows and PKCS11 on all platforms\&.
+The \f3jarsigner\fR command can read file-based keystores from any location that can be specified using a URL\&. In addition, the command can read non-file-based keystores such as those provided by MSCAPI on Windows and PKCS11 on all platforms\&.
 .PP
 For the \f3jarsigner\fR and \f3keytool\fR commands, you can specify a keystore type at the command line with the \f3-storetype\fR option\&. For Policy Tool, you can specify a keystore type with the \fIEdit\fR command in the \fIKeyStore\fR menu\&.
 .PP
--- a/src/bsd/doc/man/keytool.1	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/bsd/doc/man/keytool.1	Thu Sep 28 09:13:27 2017 -0700
@@ -1231,7 +1231,7 @@
 
 Applications can choose different types of keystore implementations from different providers, using the \f3getInstance\fR factory method supplied in the \f3KeyStore\fR class\&. A keystore type defines the storage and data format of the keystore information, and the algorithms used to protect private/secret keys in the keystore and the integrity of the keystore\&. Keystore implementations of different types are not compatible\&.
 
-The \f3keytool\fR command works on any file-based keystore implementation\&. It treats the keystore location that is passed to it at the command line as a file name and converts it to a \f3FileInputStream\fR, from which it loads the keystore information\&.)The \f3jarsigner\fR and \f3policytool\fR commands can read a keystore from any location that can be specified with a URL\&.
+The \f3keytool\fR command works on any file-based keystore implementation\&. It treats the keystore location that is passed to it at the command line as a file name and converts it to a \f3FileInputStream\fR, from which it loads the keystore information\&.)The \f3jarsigner\fR command can read a keystore from any location that can be specified with a URL\&.
 
 For \f3keytool\fR and \f3jarsigner\fR, you can specify a keystore type at the command line, with the \f3-storetype\fR option\&. For Policy Tool, you can specify a keystore type with the \fIKeystore\fR menu\&.
 
--- a/src/bsd/doc/man/policytool.1	Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-'\" t
-.\" Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
-.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-.\"
-.\" This code is free software; you can redistribute it and/or modify it
-.\" under the terms of the GNU General Public License version 2 only, as
-.\" published by the Free Software Foundation.
-.\"
-.\" This code is distributed in the hope that it will be useful, but WITHOUT
-.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-.\" FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-.\" version 2 for more details (a copy is included in the LICENSE file that
-.\" accompanied this code).
-.\"
-.\" You should have received a copy of the GNU General Public License version
-.\" 2 along with this work; if not, write to the Free Software Foundation,
-.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-.\"
-.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-.\" or visit www.oracle.com if you need additional information or have any
-.\" questions.
-.\"
-.\"     Arch: generic
-.\"     Software: JDK 8
-.\"     Date: 03 March 2015
-.\"     SectDesc: Security Tools
-.\"     Title: policytool.1
-.\"
-.if n .pl 99999
-.TH policytool 1 "03 March 2015" "JDK 8" "Security Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el       .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-
-.SH NAME    
-policytool \- Reads and writes a plain text policy file based on user input through the utility GUI\&.
-.SH SYNOPSIS    
-.sp     
-.nf     
-
-\fBpolicytool\fR [ \fB\-file\fR ] [ \fIfilename\fR ] 
-.fi     
-.sp     
-.TP
--file
-.br
-Directs the \f3policytool\fR command to load a policy file\&.
-.TP     
-\fIfilename\fR
-The name of the file to be loaded\&.
-.PP
-\fIExamples\fR:
-.PP
-Run the policy tool administrator utility:
-.sp     
-.nf     
-\f3policytool\fP
-.fi     
-.nf     
-\f3\fP
-.fi     
-.sp     
-Run the \f3policytool\fR command and load the specified file:
-.sp     
-.nf     
-\f3policytool \-file \fImypolicyfile\fR\fP
-.fi     
-.nf     
-\f3\fP
-.fi     
-.sp     
-.SH DESCRIPTION    
-The \f3policytool\fR command calls an administrator\&'s GUI that enables system administrators to manage the contents of local policy files\&. A policy file is a plain-text file with a \f3\&.policy\fR extension, that maps remote requestors by domain, to permission objects\&. For details, see Default Policy Implementation and Policy File Syntax at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyFiles\&.html
-.SH OPTIONS    
-.TP
--file
-.br
-Directs the \f3policytool\fR command to load a policy file\&.
-.SH SEE\ ALSO    
-.TP 0.2i    
-\(bu
-Default Policy Implementation and Policy File Syntax at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyFiles\&.html
-.TP 0.2i    
-\(bu
-Policy File Creation and Management at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/PolicyGuide\&.html
-.TP 0.2i    
-\(bu
-Permissions in Java SE Development Kit (JDK) at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/permissions\&.html
-.TP 0.2i    
-\(bu
-Java Security Overview at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/overview/jsoverview\&.html
-.TP 0.2i    
-\(bu
-Java Cryptography Architecture (JCA) Reference Guide at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec\&.html
-.RE
-.br
-'pl 8.5i
-'bp
--- a/src/bsd/doc/man/serialver.1	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/bsd/doc/man/serialver.1	Thu Sep 28 09:13:27 2017 -0700
@@ -100,9 +100,6 @@
 .SH SEE\ ALSO    
 .TP 0.2i    
 \(bu
-policytool(1)
-.TP 0.2i    
-\(bu
 The \f3java\&.io\&.ObjectStream\fR class description at http://docs\&.oracle\&.com/javase/8/docs/api/java/io/ObjectStreamClass\&.html
 .RE
 .br
--- a/src/demo/share/jfc/Font2DTest/README.txt	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/demo/share/jfc/Font2DTest/README.txt	Thu Sep 28 09:13:27 2017 -0700
@@ -31,7 +31,7 @@
 
 The program will run without these properties set,
 but some of its features will be limited.
-To enable all features, please add these permissions with policytool.
+To enable all features, please add these permissions.
 
 -----------------------------------------------------------------------
 Introduction
--- a/src/hotspot/share/prims/whitebox.cpp	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/hotspot/share/prims/whitebox.cpp	Thu Sep 28 09:13:27 2017 -0700
@@ -73,6 +73,9 @@
 #include "utilities/nativeCallStack.hpp"
 #endif // INCLUDE_NMT
 
+#ifdef LINUX
+#include "utilities/elfFile.hpp"
+#endif
 
 #define SIZE_T_MAX_VALUE ((size_t) -1)
 
@@ -1823,6 +1826,20 @@
   DirectivesStack::pop(count);
 WB_END
 
+// Checks that the library libfile has the noexecstack bit set.
+WB_ENTRY(jboolean, WB_CheckLibSpecifiesNoexecstack(JNIEnv* env, jobject o, jstring libfile))
+  jboolean ret = false;
+#ifdef LINUX
+  // Can't be in VM when we call JNI.
+  ThreadToNativeFromVM ttnfv(thread);
+  const char* lf = env->GetStringUTFChars(libfile, NULL);
+  CHECK_JNI_EXCEPTION_(env, 0);
+  ret = (jboolean) ElfFile::specifies_noexecstack(lf);
+  env->ReleaseStringUTFChars(libfile, lf);
+#endif
+  return ret;
+WB_END
+
 #define CC (char*)
 
 static JNINativeMethod methods[] = {
@@ -2027,6 +2044,8 @@
                                                       (void*)&WB_GetConcurrentGCPhases},
   {CC"requestConcurrentGCPhase0", CC"(Ljava/lang/String;)Z",
                                                       (void*)&WB_RequestConcurrentGCPhase},
+  {CC"checkLibSpecifiesNoexecstack", CC"(Ljava/lang/String;)Z",
+                                                      (void*)&WB_CheckLibSpecifiesNoexecstack},
 };
 
 #undef CC
--- a/src/java.base/share/classes/java/io/FileInputStream.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/io/FileInputStream.java	Thu Sep 28 09:13:27 2017 -0700
@@ -341,7 +341,7 @@
 
         fd.closeAll(new Closeable() {
             public void close() throws IOException {
-               close0();
+               fd.close();
            }
         });
     }
@@ -403,7 +403,6 @@
 
     private static native void initIDs();
 
-    private native void close0() throws IOException;
 
     static {
         initIDs();
--- a/src/java.base/share/classes/java/io/FileOutputStream.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/io/FileOutputStream.java	Thu Sep 28 09:13:27 2017 -0700
@@ -365,7 +365,7 @@
 
         fd.closeAll(new Closeable() {
             public void close() throws IOException {
-               close0();
+               fd.close();
            }
         });
     }
@@ -458,8 +458,6 @@
         }
     }
 
-    private native void close0() throws IOException;
-
     private static native void initIDs();
 
     static {
--- a/src/java.base/share/classes/java/io/RandomAccessFile.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/io/RandomAccessFile.java	Thu Sep 28 09:13:27 2017 -0700
@@ -648,7 +648,7 @@
 
         fd.closeAll(new Closeable() {
             public void close() throws IOException {
-               close0();
+               fd.close();
            }
         });
     }
@@ -1177,8 +1177,6 @@
 
     private static native void initIDs();
 
-    private native void close0() throws IOException;
-
     static {
         initIDs();
         SharedSecrets.setJavaIORandomAccessFileAccess(new JavaIORandomAccessFileAccess()
--- a/src/java.base/share/classes/java/lang/ClassLoader.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java	Thu Sep 28 09:13:27 2017 -0700
@@ -2160,10 +2160,12 @@
      *          if a package of the given {@code name} is already
      *          defined by this class loader
      *
+     *
      * @since  1.2
      * @revised 9
      * @spec JPMS
      *
+     * @jvms 5.3 Run-time package
      * @see <a href="{@docRoot}/../specs/jar/jar.html#sealing">
      *      The JAR File Specification: Package Sealing</a>
      */
@@ -2186,17 +2188,19 @@
     }
 
     /**
-     * Returns a {@code Package} of the given <a href="#name">name</a> that has been
-     * defined by this class loader.
+     * Returns a {@code Package} of the given <a href="#name">name</a> that
+     * has been defined by this class loader.
      *
      * @param  name The <a href="#name">package name</a>
      *
-     * @return The {@code Package} of the given name defined by this class loader,
-     *         or {@code null} if not found
+     * @return The {@code Package} of the given name that has been defined
+     *         by this class loader, or {@code null} if not found
      *
      * @throws  NullPointerException
      *          if {@code name} is {@code null}.
      *
+     * @jvms 5.3 Run-time package
+     *
      * @since  9
      * @spec JPMS
      */
@@ -2211,14 +2215,18 @@
     }
 
     /**
-     * Returns all of the {@code Package}s defined by this class loader.
-     * The returned array has no duplicated {@code Package}s of the same name.
+     * Returns all of the {@code Package}s that have been defined by
+     * this class loader.  The returned array has no duplicated {@code Package}s
+     * of the same name.
      *
      * @apiNote This method returns an array rather than a {@code Set} or {@code Stream}
      *          for consistency with the existing {@link #getPackages} method.
      *
-     * @return The array of {@code Package} objects defined by this class loader;
-     *         or an zero length array if no package has been defined by this class loader.
+     * @return The array of {@code Package} objects that have been defined by
+     *         this class loader; or an zero length array if no package has been
+     *         defined by this class loader.
+     *
+     * @jvms 5.3 Run-time package
      *
      * @since  9
      * @spec JPMS
@@ -2244,7 +2252,7 @@
      * @param  name
      *         The <a href="#name">package name</a>
      *
-     * @return The {@code Package} corresponding to the given name defined by
+     * @return The {@code Package} of the given name that has been defined by
      *         this class loader or its ancestors, or {@code null} if not found.
      *
      * @throws  NullPointerException
@@ -2263,6 +2271,8 @@
      * {@link ClassLoader#getDefinedPackage} method which returns
      * a {@code Package} for the specified class loader.
      *
+     * @see ClassLoader#getDefinedPackage(String)
+     *
      * @since  1.2
      * @revised 9
      * @spec JPMS
@@ -2281,10 +2291,10 @@
     }
 
     /**
-     * Returns all of the {@code Package}s defined by this class loader
-     * and its ancestors.  The returned array may contain more than one
-     * {@code Package} object of the same package name, each defined by
-     * a different class loader in the class loader hierarchy.
+     * Returns all of the {@code Package}s that have been defined by
+     * this class loader and its ancestors.  The returned array may contain
+     * more than one {@code Package} object of the same package name, each
+     * defined by a different class loader in the class loader hierarchy.
      *
      * @apiNote The {@link #getPlatformClassLoader() platform class loader}
      * may delegate to the application class loader. In other words,
@@ -2294,8 +2304,10 @@
      * when invoked on the platform class loader, this method will not
      * return any packages defined to the application class loader.
      *
-     * @return  The array of {@code Package} objects defined by this
-     *          class loader and its ancestors
+     * @return  The array of {@code Package} objects that have been defined by
+     *          this class loader and its ancestors
+     *
+     * @see ClassLoader#getDefinedPackages()
      *
      * @since  1.2
      * @revised 9
--- a/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Thu Sep 28 09:13:27 2017 -0700
@@ -151,9 +151,9 @@
                                 } catch (InterruptedException ie) {
                                     // ignore and retry
                                 }
-                                startTime = isAlive0(pid);  // recheck if is alive
-                                if (origStart > 0 && startTime != origStart) {
-                                    // start time changed, pid is not the same process
+                                startTime = isAlive0(pid);  // recheck if it is alive
+                                if (startTime > 0 && origStart > 0 && startTime != origStart) {
+                                    // start time changed (and is not zero), pid is not the same process
                                     break;
                                 }
                             }
--- a/src/java.base/share/classes/java/lang/invoke/CallSite.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/CallSite.java	Thu Sep 28 09:13:27 2017 -0700
@@ -344,13 +344,21 @@
                         break;
                     default:
                         final int NON_SPREAD_ARG_COUNT = 3;  // (caller, name, type)
-                        if (NON_SPREAD_ARG_COUNT + argv.length > MethodType.MAX_MH_ARITY)
-                            throw new BootstrapMethodError("too many bootstrap method arguments");
-
-                        MethodType invocationType = MethodType.genericMethodType(NON_SPREAD_ARG_COUNT + argv.length);
-                        MethodHandle typedBSM = bootstrapMethod.asType(invocationType);
-                        MethodHandle spreader = invocationType.invokers().spreadInvoker(NON_SPREAD_ARG_COUNT);
-                        binding = spreader.invokeExact(typedBSM, (Object) caller, (Object) name, (Object) type, argv);
+                        final int MAX_SAFE_SIZE = MethodType.MAX_MH_ARITY / 2 - NON_SPREAD_ARG_COUNT;
+                        if (argv.length >= MAX_SAFE_SIZE) {
+                            // to be on the safe side, use invokeWithArguments which handles jumbo lists
+                            Object[] newargv = new Object[NON_SPREAD_ARG_COUNT + argv.length];
+                            newargv[0] = caller;
+                            newargv[1] = name;
+                            newargv[2] = type;
+                            System.arraycopy(argv, 0, newargv, NON_SPREAD_ARG_COUNT, argv.length);
+                            binding = bootstrapMethod.invokeWithArguments(newargv);
+                        } else {
+                            MethodType invocationType = MethodType.genericMethodType(NON_SPREAD_ARG_COUNT + argv.length);
+                            MethodHandle typedBSM = bootstrapMethod.asType(invocationType);
+                            MethodHandle spreader = invocationType.invokers().spreadInvoker(NON_SPREAD_ARG_COUNT);
+                            binding = spreader.invokeExact(typedBSM, (Object) caller, (Object) name, (Object) type, argv);
+                        }
                 }
             }
             if (binding instanceof CallSite) {
--- a/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java	Thu Sep 28 09:13:27 2017 -0700
@@ -28,6 +28,7 @@
 import java.util.Arrays;
 import static java.lang.invoke.LambdaForm.*;
 import static java.lang.invoke.LambdaForm.Kind.*;
+import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeVirtual;
 import static java.lang.invoke.MethodHandleStatics.*;
 
 /**
@@ -158,8 +159,11 @@
     static final NamedFunction NF_getTarget;
     static {
         try {
-            NF_getTarget = new NamedFunction(DelegatingMethodHandle.class
-                                             .getDeclaredMethod("getTarget"));
+            MemberName member = new MemberName(DelegatingMethodHandle.class, "getTarget",
+                    MethodType.methodType(MethodHandle.class), REF_invokeVirtual);
+            NF_getTarget = new NamedFunction(
+                    MemberName.getFactory()
+                            .resolveOrFail(REF_invokeVirtual, member, DelegatingMethodHandle.class, NoSuchMethodException.class));
         } catch (ReflectiveOperationException ex) {
             throw newInternalError(ex);
         }
--- a/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java	Thu Sep 28 09:13:27 2017 -0700
@@ -753,42 +753,38 @@
         return nf;
     }
 
+    private static final MethodType OBJ_OBJ_TYPE = MethodType.methodType(Object.class, Object.class);
+
+    private static final MethodType LONG_OBJ_TYPE = MethodType.methodType(long.class, Object.class);
+
     private static NamedFunction createFunction(byte func) {
         try {
             switch (func) {
                 case NF_internalMemberName:
-                    return new NamedFunction(DirectMethodHandle.class
-                            .getDeclaredMethod("internalMemberName", Object.class));
+                    return getNamedFunction("internalMemberName", OBJ_OBJ_TYPE);
                 case NF_internalMemberNameEnsureInit:
-                    return new NamedFunction(DirectMethodHandle.class
-                            .getDeclaredMethod("internalMemberNameEnsureInit", Object.class));
+                    return getNamedFunction("internalMemberNameEnsureInit", OBJ_OBJ_TYPE);
                 case NF_ensureInitialized:
-                    return new NamedFunction(DirectMethodHandle.class
-                            .getDeclaredMethod("ensureInitialized", Object.class));
+                    return getNamedFunction("ensureInitialized", MethodType.methodType(void.class, Object.class));
                 case NF_fieldOffset:
-                    return new NamedFunction(DirectMethodHandle.class
-                            .getDeclaredMethod("fieldOffset", Object.class));
+                    return getNamedFunction("fieldOffset", LONG_OBJ_TYPE);
                 case NF_checkBase:
-                    return new NamedFunction(DirectMethodHandle.class
-                            .getDeclaredMethod("checkBase", Object.class));
+                    return getNamedFunction("checkBase", OBJ_OBJ_TYPE);
                 case NF_staticBase:
-                    return new NamedFunction(DirectMethodHandle.class
-                            .getDeclaredMethod("staticBase", Object.class));
+                    return getNamedFunction("staticBase", OBJ_OBJ_TYPE);
                 case NF_staticOffset:
-                    return new NamedFunction(DirectMethodHandle.class
-                            .getDeclaredMethod("staticOffset", Object.class));
+                    return getNamedFunction("staticOffset", LONG_OBJ_TYPE);
                 case NF_checkCast:
-                    return new NamedFunction(DirectMethodHandle.class
-                            .getDeclaredMethod("checkCast", Object.class, Object.class));
+                    return getNamedFunction("checkCast", MethodType.methodType(Object.class, Object.class, Object.class));
                 case NF_allocateInstance:
-                    return new NamedFunction(DirectMethodHandle.class
-                            .getDeclaredMethod("allocateInstance", Object.class));
+                    return getNamedFunction("allocateInstance", OBJ_OBJ_TYPE);
                 case NF_constructorMethod:
-                    return new NamedFunction(DirectMethodHandle.class
-                            .getDeclaredMethod("constructorMethod", Object.class));
+                    return getNamedFunction("constructorMethod", OBJ_OBJ_TYPE);
                 case NF_UNSAFE:
-                    return new NamedFunction(new MemberName(MethodHandleStatics.class
-                            .getDeclaredField("UNSAFE")));
+                    MemberName member = new MemberName(MethodHandleStatics.class, "UNSAFE", Unsafe.class, REF_getField);
+                    return new NamedFunction(
+                            MemberName.getFactory()
+                                    .resolveOrFail(REF_getField, member, DirectMethodHandle.class, NoSuchMethodException.class));
                 default:
                     throw newInternalError("Unknown function: " + func);
             }
@@ -797,6 +793,15 @@
         }
     }
 
+    private static NamedFunction getNamedFunction(String name, MethodType type)
+        throws ReflectiveOperationException
+    {
+        MemberName member = new MemberName(DirectMethodHandle.class, name, type, REF_invokeStatic);
+        return new NamedFunction(
+            MemberName.getFactory()
+                .resolveOrFail(REF_invokeStatic, member, DirectMethodHandle.class, NoSuchMethodException.class));
+    }
+
     static {
         // The Holder class will contain pre-generated DirectMethodHandles resolved
         // speculatively using MemberName.getFactory().resolveOrNull. However, that
--- a/src/java.base/share/classes/java/lang/invoke/Invokers.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/Invokers.java	Thu Sep 28 09:13:27 2017 -0700
@@ -611,23 +611,17 @@
         try {
             switch (func) {
                 case NF_checkExactType:
-                    return new NamedFunction(Invokers.class
-                        .getDeclaredMethod("checkExactType", MethodHandle.class,  MethodType.class));
+                    return getNamedFunction("checkExactType", MethodType.methodType(void.class, MethodHandle.class, MethodType.class));
                 case NF_checkGenericType:
-                    return new NamedFunction(Invokers.class
-                        .getDeclaredMethod("checkGenericType", MethodHandle.class,  MethodType.class));
+                    return getNamedFunction("checkGenericType", MethodType.methodType(MethodHandle.class, MethodHandle.class, MethodType.class));
                 case NF_getCallSiteTarget:
-                    return new NamedFunction(Invokers.class
-                        .getDeclaredMethod("getCallSiteTarget", CallSite.class));
+                    return getNamedFunction("getCallSiteTarget", MethodType.methodType(MethodHandle.class, CallSite.class));
                 case NF_checkCustomized:
-                    return new NamedFunction(Invokers.class
-                        .getDeclaredMethod("checkCustomized", MethodHandle.class));
+                    return getNamedFunction("checkCustomized", MethodType.methodType(void.class, MethodHandle.class));
                 case NF_checkVarHandleGenericType:
-                    return new NamedFunction(Invokers.class
-                        .getDeclaredMethod("checkVarHandleGenericType", VarHandle.class, VarHandle.AccessDescriptor.class));
+                    return getNamedFunction("checkVarHandleGenericType", MethodType.methodType(MethodHandle.class, VarHandle.class, VarHandle.AccessDescriptor.class));
                 case NF_checkVarHandleExactType:
-                    return new NamedFunction(Invokers.class
-                        .getDeclaredMethod("checkVarHandleExactType", VarHandle.class, VarHandle.AccessDescriptor.class));
+                    return getNamedFunction("checkVarHandleExactType", MethodType.methodType(MethodHandle.class, VarHandle.class, VarHandle.AccessDescriptor.class));
                 default:
                     throw newInternalError("Unknown function: " + func);
             }
@@ -636,6 +630,15 @@
         }
     }
 
+    private static NamedFunction getNamedFunction(String name, MethodType type)
+        throws ReflectiveOperationException
+    {
+        MemberName member = new MemberName(Invokers.class, name, type, REF_invokeStatic);
+        return new NamedFunction(
+                MemberName.getFactory()
+                        .resolveOrFail(REF_invokeStatic, member, Invokers.class, NoSuchMethodException.class));
+    }
+
     private static class Lazy {
         private static final MethodHandle MH_asSpreader;
 
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Thu Sep 28 09:13:27 2017 -0700
@@ -584,10 +584,10 @@
     /*non-public*/ static native @PolymorphicSignature Object linkToInterface(Object... args) throws Throwable;
 
     /**
-     * Performs a variable arity invocation, passing the arguments in the given list
+     * Performs a variable arity invocation, passing the arguments in the given array
      * to the method handle, as if via an inexact {@link #invoke invoke} from a call site
-     * which mentions only the type {@code Object}, and whose arity is the length
-     * of the argument list.
+     * which mentions only the type {@code Object}, and whose actual argument count is the length
+     * of the argument array.
      * <p>
      * Specifically, execution proceeds as if by the following steps,
      * although the methods are not guaranteed to be called if the JVM
@@ -595,36 +595,104 @@
      * <ul>
      * <li>Determine the length of the argument array as {@code N}.
      *     For a null reference, {@code N=0}. </li>
-     * <li>Determine the general type {@code TN} of {@code N} arguments as
-     *     as {@code TN=MethodType.genericMethodType(N)}.</li>
+     * <li>Collect the {@code N} elements of the array as a logical
+     *     argument list, each argument statically typed as an {@code Object}. </li>
+     * <li>Determine, as {@code M}, the parameter count of the type of this
+     *     method handle. </li>
+     * <li>Determine the general type {@code TN} of {@code N} arguments or
+     *     {@code M} arguments, if smaller than {@code N}, as
+     *     {@code TN=MethodType.genericMethodType(Math.min(N, M))}.</li>
+     * <li>If {@code N} is greater than {@code M}, perform the following
+     *     checks and actions to shorten the logical argument list: <ul>
+     *     <li>Check that this method handle has variable arity with a
+     *         {@linkplain MethodType#lastParameterType trailing parameter}
+     *         of some array type {@code A[]}.  If not, fail with a
+     *         {@code WrongMethodTypeException}. </li>
+     *     <li>Collect the trailing elements (there are {@code N-M+1} of them)
+     *         from the logical argument list into a single array of
+     *         type {@code A[]}, using {@code asType} conversions to
+     *         convert each trailing argument to type {@code A}. </li>
+     *     <li>If any of these conversions proves impossible, fail with either
+     *         a {@code ClassCastException} if any trailing element cannot be
+     *         cast to {@code A} or a {@code NullPointerException} if any
+     *         trailing element is {@code null} and {@code A} is not a reference
+     *         type. </li>
+     *     <li>Replace the logical arguments gathered into the array of
+     *         type {@code A[]} with the array itself, thus shortening
+     *         the argument list to length {@code M}. This final argument
+     *         retains the static type {@code A[]}.</li>
+     *     <li>Adjust the type {@code TN} by changing the {@code N}th
+     *         parameter type from {@code Object} to {@code A[]}.
+     *     </ul>
      * <li>Force the original target method handle {@code MH0} to the
      *     required type, as {@code MH1 = MH0.asType(TN)}. </li>
-     * <li>Spread the array into {@code N} separate arguments {@code A0, ...}. </li>
+     * <li>Spread the argument list into {@code N} separate arguments {@code A0, ...}. </li>
      * <li>Invoke the type-adjusted method handle on the unpacked arguments:
      *     MH1.invokeExact(A0, ...). </li>
      * <li>Take the return value as an {@code Object} reference. </li>
      * </ul>
      * <p>
+     * If the target method handle has variable arity, and the argument list is longer
+     * than that arity, the excess arguments, starting at the position of the trailing
+     * array argument, will be gathered (if possible, as if by {@code asType} conversions)
+     * into an array of the appropriate type, and invocation will proceed on the
+     * shortened argument list.
+     * In this way, <em>jumbo argument lists</em> which would spread into more
+     * than 254 slots can still be processed uniformly.
+     * <p>
+     * Unlike the {@link #invoke(Object...) generic} invocation mode, which can
+     * "recycle" an array argument, passing it directly to the target method,
+     * this invocation mode <em>always</em> creates a new array parameter, even
+     * if the original array passed to {@code invokeWithArguments} would have
+     * been acceptable as a direct argument to the target method.
+     * Even if the number {@code M} of actual arguments is the arity {@code N},
+     * and the last argument is dynamically a suitable array of type {@code A[]},
+     * it will still be boxed into a new one-element array, since the call
+     * site statically types the argument as {@code Object}, not an array type.
+     * This is not a special rule for this method, but rather a regular effect
+     * of the {@linkplain #asVarargsCollector rules for variable-arity invocation}.
+     * <p>
      * Because of the action of the {@code asType} step, the following argument
      * conversions are applied as necessary:
      * <ul>
      * <li>reference casting
      * <li>unboxing
      * <li>widening primitive conversions
+     * <li>variable arity conversion
      * </ul>
      * <p>
      * The result returned by the call is boxed if it is a primitive,
      * or forced to null if the return type is void.
      * <p>
-     * This call is equivalent to the following code:
+     * Unlike the signature polymorphic methods {@code invokeExact} and {@code invoke},
+     * {@code invokeWithArguments} can be accessed normally via the Core Reflection API and JNI.
+     * It can therefore be used as a bridge between native or reflective code and method handles.
+     * @apiNote
+     * This call is approximately equivalent to the following code:
      * <blockquote><pre>{@code
+     * // for jumbo argument lists, adapt varargs explicitly:
+     * int N = (arguments == null? 0: arguments.length);
+     * int M = this.type.parameterCount();
+     * int MAX_SAFE = 127;  // 127 longs require 254 slots, which is OK
+     * if (N > MAX_SAFE && N > M && this.isVarargsCollector()) {
+     *   Class<?> arrayType = this.type().lastParameterType();
+     *   Class<?> elemType = arrayType.getComponentType();
+     *   if (elemType != null) {
+     *     Object args2 = Array.newInstance(elemType, M);
+     *     MethodHandle arraySetter = MethodHandles.arrayElementSetter(arrayType);
+     *     for (int i = 0; i < M; i++) {
+     *       arraySetter.invoke(args2, i, arguments[M-1 + i]);
+     *     }
+     *     arguments = Arrays.copyOf(arguments, M);
+     *     arguments[M-1] = args2;
+     *     return this.asFixedArity().invokeWithArguments(arguments);
+     *   }
+     * } // done with explicit varargs processing
+     *
+     * // Handle fixed arity and non-jumbo variable arity invocation.
      * MethodHandle invoker = MethodHandles.spreadInvoker(this.type(), 0);
      * Object result = invoker.invokeExact(this, arguments);
      * }</pre></blockquote>
-     * <p>
-     * Unlike the signature polymorphic methods {@code invokeExact} and {@code invoke},
-     * {@code invokeWithArguments} can be accessed normally via the Core Reflection API and JNI.
-     * It can therefore be used as a bridge between native or reflective code and method handles.
      *
      * @param arguments the arguments to pass to the target
      * @return the result returned by the target
@@ -634,20 +702,24 @@
      * @see MethodHandles#spreadInvoker
      */
     public Object invokeWithArguments(Object... arguments) throws Throwable {
+        // Note: Jumbo argument lists are handled in the variable-arity subclass.
         MethodType invocationType = MethodType.genericMethodType(arguments == null ? 0 : arguments.length);
         return invocationType.invokers().spreadInvoker(0).invokeExact(asType(invocationType), arguments);
     }
 
     /**
-     * Performs a variable arity invocation, passing the arguments in the given array
+     * Performs a variable arity invocation, passing the arguments in the given list
      * to the method handle, as if via an inexact {@link #invoke invoke} from a call site
-     * which mentions only the type {@code Object}, and whose arity is the length
-     * of the argument array.
+     * which mentions only the type {@code Object}, and whose actual argument count is the length
+     * of the argument list.
      * <p>
      * This method is also equivalent to the following code:
      * <blockquote><pre>{@code
      *   invokeWithArguments(arguments.toArray())
      * }</pre></blockquote>
+     * <p>
+     * Jumbo-sized lists are acceptable if this method handle has variable arity.
+     * See {@link #invokeWithArguments(Object[])} for details.
      *
      * @param arguments the arguments to pass to the target
      * @return the result returned by the target
@@ -987,6 +1059,16 @@
       * disturbing its variable arity property:
       * {@code mh.asType(mh.type().changeParameterType(0,int.class))
       *     .withVarargs(mh.isVarargsCollector())}
+      * <p>
+      * This call is approximately equivalent to the following code:
+      * <blockquote><pre>{@code
+      * if (makeVarargs == isVarargsCollector())
+      *   return this;
+      * else if (makeVarargs)
+      *   return asVarargsCollector(type().lastParameterType());
+      * else
+      *   return return asFixedArity();
+      * }</pre></blockquote>
       * @param makeVarargs true if the return method handle should have variable arity behavior
       * @return a method handle of the same type, with possibly adjusted variable arity behavior
       * @throws IllegalArgumentException if {@code makeVarargs} is true and
@@ -995,11 +1077,10 @@
       * @see #asVarargsCollector
       * @see #asFixedArity
      */
-     public MethodHandle withVarargs(boolean makeVarargs) {
-        if (!makeVarargs) {
-            return asFixedArity();
-        } else if (!isVarargsCollector()) {
-            return asVarargsCollector(type().lastParameterType());
+    public MethodHandle withVarargs(boolean makeVarargs) {
+        assert(!isVarargsCollector());  // subclass responsibility
+        if (makeVarargs) {
+           return asVarargsCollector(type().lastParameterType());
         } else {
             return this;
         }
@@ -1026,8 +1107,9 @@
      * <p>
      * (The array may also be a shared constant when {@code arrayLength} is zero.)
      * <p>
-     * (<em>Note:</em> The {@code arrayType} is often identical to the last
-     * parameter type of the original target.
+     * (<em>Note:</em> The {@code arrayType} is often identical to the
+     * {@linkplain MethodType#lastParameterType last parameter type}
+     * of the original target.
      * It is an explicit argument for symmetry with {@code asSpreader}, and also
      * to allow the target to use a simple {@code Object} as its last parameter type.)
      * <p>
@@ -1168,7 +1250,9 @@
      * {@code invoke} and {@code asType} requests can lead to
      * trailing positional arguments being collected into target's
      * trailing parameter.
-     * Also, the last parameter type of the adapter will be
+     * Also, the
+     * {@linkplain MethodType#lastParameterType last parameter type}
+     * of the adapter will be
      * {@code arrayType}, even if the target has a different
      * last parameter type.
      * <p>
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Thu Sep 28 09:13:27 2017 -0700
@@ -524,6 +524,12 @@
         }
 
         @Override
+        public MethodHandle withVarargs(boolean makeVarargs) {
+            if (makeVarargs)  return this;
+            return asFixedArity();
+        }
+
+        @Override
         public MethodHandle asTypeUncached(MethodType newType) {
             MethodType type = this.type();
             int collectArg = type.parameterCount() - 1;
@@ -561,6 +567,49 @@
                     : Arrays.asList(this, newType);
             return true;
         }
+
+        @Override
+        public Object invokeWithArguments(Object... arguments) throws Throwable {
+            MethodType type = this.type();
+            int argc;
+            final int MAX_SAFE = 127;  // 127 longs require 254 slots, which is safe to spread
+            if (arguments == null
+                    || (argc = arguments.length) <= MAX_SAFE
+                    || argc < type.parameterCount()) {
+                return super.invokeWithArguments(arguments);
+            }
+
+            // a jumbo invocation requires more explicit reboxing of the trailing arguments
+            int uncollected = type.parameterCount() - 1;
+            Class<?> elemType = arrayType.getComponentType();
+            int collected = argc - uncollected;
+            Object collArgs = (elemType == Object.class)
+                ? new Object[collected] : Array.newInstance(elemType, collected);
+            if (!elemType.isPrimitive()) {
+                // simple cast:  just do some casting
+                try {
+                    System.arraycopy(arguments, uncollected, collArgs, 0, collected);
+                } catch (ArrayStoreException ex) {
+                    return super.invokeWithArguments(arguments);
+                }
+            } else {
+                // corner case of flat array requires reflection (or specialized copy loop)
+                MethodHandle arraySetter = MethodHandles.arrayElementSetter(arrayType);
+                try {
+                    for (int i = 0; i < collected; i++) {
+                        arraySetter.invoke(collArgs, i, arguments[uncollected + i]);
+                    }
+                } catch (WrongMethodTypeException|ClassCastException ex) {
+                    return super.invokeWithArguments(arguments);
+                }
+            }
+
+            // chop the jumbo list down to size and call in non-varargs mode
+            Object[] newArgs = new Object[uncollected + 1];
+            System.arraycopy(arguments, 0, newArgs, 0, uncollected);
+            newArgs[uncollected] = collArgs;
+            return asFixedArity().invokeWithArguments(newArgs);
+        }
     }
 
     /** Factory method:  Spread selected argument. */
--- a/src/java.base/share/classes/java/lang/invoke/MethodType.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/MethodType.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -759,7 +759,23 @@
         return Collections.unmodifiableList(Arrays.asList(ptypes.clone()));
     }
 
-    /*non-public*/ Class<?> lastParameterType() {
+    /**
+     * Returns the last parameter type of this method type.
+     * If this type has no parameters, the sentinel value
+     * {@code void.class} is returned instead.
+     * @apiNote
+     * <p>
+     * The sentinel value is chosen so that reflective queries can be
+     * made directly against the result value.
+     * The sentinel value cannot be confused with a real parameter,
+     * since {@code void} is never acceptable as a parameter type.
+     * For variable arity invocation modes, the expression
+     * {@link Class#getComponentType lastParameterType().getComponentType()}
+     * is useful to query the type of the "varargs" parameter.
+     * @return the last parameter type if any, else {@code void.class}
+     * @since 10
+     */
+    public Class<?> lastParameterType() {
         int len = ptypes.length;
         return len == 0 ? void.class : ptypes[len-1];
     }
--- a/src/java.base/share/classes/java/lang/invoke/package-info.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/package-info.java	Thu Sep 28 09:13:27 2017 -0700
@@ -81,12 +81,19 @@
  *     in which dynamic call site occurs </li>
  * <li>a {@code String}, the method name mentioned in the call site </li>
  * <li>a {@code MethodType}, the resolved type descriptor of the call </li>
- * <li>optionally, between 1 and 251 additional static arguments taken from the constant pool </li>
+ * <li>optionally, any number of additional static arguments taken from the constant pool </li>
  * </ul>
- * Invocation is as if by
- * {@link java.lang.invoke.MethodHandle#invoke MethodHandle.invoke}.
- * The returned result must be a {@link java.lang.invoke.CallSite CallSite}
- * (or a subclass), otherwise a
+ * <p>
+ * In all cases, bootstrap method invocation is as if by
+ * {@link java.lang.invoke.MethodHandle#invokeWithArguments MethodHandle.invokeWithArguments},
+ * (This is also equivalent to
+ * {@linkplain java.lang.invoke.MethodHandle#invoke generic invocation}
+ * if the number of arguments is small enough.)
+ * <p>
+ * For an {@code invokedynamic} instruction, the
+ * returned result must be convertible to a non-null reference to a
+ * {@link java.lang.invoke.CallSite CallSite}.
+ * If the returned result cannot be converted to the expected type,
  * {@link java.lang.BootstrapMethodError BootstrapMethodError} is thrown.
  * The type of the call site's target must be exactly equal to the type
  * derived from the dynamic call site's type descriptor and passed to
@@ -150,10 +157,12 @@
  * If the {@code invokedynamic} instruction specifies one or more static arguments,
  * those values will be passed as additional arguments to the method handle.
  * (Note that because there is a limit of 255 arguments to any method,
- * at most 251 extra arguments can be supplied, since the bootstrap method
+ * at most 251 extra arguments can be supplied to a non-varargs bootstrap method,
+ * since the bootstrap method
  * handle itself and its first three arguments must also be stacked.)
- * The bootstrap method will be invoked as if by either {@code MethodHandle.invoke}
- * or {@code invokeWithArguments}.  (There is no way to tell the difference.)
+ * The bootstrap method will be invoked as if by {@code MethodHandle.invokeWithArguments}.
+ * A variable-arity bootstrap method can accept thousands of static arguments,
+ * subject only by limits imposed by the class-file format.
  * <p>
  * The normal argument conversion rules for {@code MethodHandle.invoke} apply to all stacked arguments.
  * For example, if a pushed value is a primitive type, it may be converted to a reference by boxing conversion.
@@ -194,9 +203,9 @@
  * </tbody>
  * </table>
  * The last example assumes that the extra arguments are of type
- * {@code CONSTANT_String} and {@code CONSTANT_Integer}, respectively.
+ * {@code String} and {@code Integer} (or {@code int}), respectively.
  * The second-to-last example assumes that all extra arguments are of type
- * {@code CONSTANT_String}.
+ * {@code String}.
  * The other examples work with all types of extra arguments.
  * <p>
  * As noted above, the actual method type of the bootstrap method can vary.
@@ -220,7 +229,7 @@
  * to safely and compactly encode metadata.
  * In principle, the name and extra arguments are redundant,
  * since each call site could be given its own unique bootstrap method.
- * Such a practice is likely to produce large class files and constant pools.
+ * Such a practice would be likely to produce large class files and constant pools.
  *
  * @author John Rose, JSR 292 EG
  * @since 1.7
--- a/src/java.base/share/classes/java/util/zip/ZipFile.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/java/util/zip/ZipFile.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1122,30 +1122,36 @@
                                 zerror("zip comment read failed");
                             }
                         }
-                        if (end.cenlen == ZIP64_MAGICVAL ||
-                            end.cenoff == ZIP64_MAGICVAL ||
-                            end.centot == ZIP64_MAGICCOUNT)
-                        {
-                            // need to find the zip64 end;
-                            try {
-                                byte[] loc64 = new byte[ZIP64_LOCHDR];
-                                if (readFullyAt(loc64, 0, loc64.length, end.endpos - ZIP64_LOCHDR)
-                                    != loc64.length || GETSIG(loc64) != ZIP64_LOCSIG) {
-                                    return end;
-                                }
-                                long end64pos = ZIP64_LOCOFF(loc64);
-                                byte[] end64buf = new byte[ZIP64_ENDHDR];
-                                if (readFullyAt(end64buf, 0, end64buf.length, end64pos)
-                                    != end64buf.length || GETSIG(end64buf) != ZIP64_ENDSIG) {
-                                    return end;
-                                }
-                                // end64 found, re-calcualte everything.
-                                end.cenlen = ZIP64_ENDSIZ(end64buf);
-                                end.cenoff = ZIP64_ENDOFF(end64buf);
-                                end.centot = (int)ZIP64_ENDTOT(end64buf); // assume total < 2g
-                                end.endpos = end64pos;
-                            } catch (IOException x) {}    // no zip64 loc/end
-                        }
+                        // must check for a zip64 end record; it is always permitted to be present
+                        try {
+                            byte[] loc64 = new byte[ZIP64_LOCHDR];
+                            if (end.endpos < ZIP64_LOCHDR ||
+                                readFullyAt(loc64, 0, loc64.length, end.endpos - ZIP64_LOCHDR)
+                                != loc64.length || GETSIG(loc64) != ZIP64_LOCSIG) {
+                                return end;
+                            }
+                            long end64pos = ZIP64_LOCOFF(loc64);
+                            byte[] end64buf = new byte[ZIP64_ENDHDR];
+                            if (readFullyAt(end64buf, 0, end64buf.length, end64pos)
+                                != end64buf.length || GETSIG(end64buf) != ZIP64_ENDSIG) {
+                                return end;
+                            }
+                            // end64 candidate found,
+                            long cenlen64 = ZIP64_ENDSIZ(end64buf);
+                            long cenoff64 = ZIP64_ENDOFF(end64buf);
+                            long centot64 = ZIP64_ENDTOT(end64buf);
+                            // double-check
+                            if (cenlen64 != end.cenlen && end.cenlen != ZIP64_MAGICVAL ||
+                                cenoff64 != end.cenoff && end.cenoff != ZIP64_MAGICVAL ||
+                                centot64 != end.centot && end.centot != ZIP64_MAGICCOUNT) {
+                                return end;
+                            }
+                            // to use the end64 values
+                            end.cenlen = cenlen64;
+                            end.cenoff = cenoff64;
+                            end.centot = (int)centot64; // assume total < 2g
+                            end.endpos = end64pos;
+                        } catch (IOException x) {}    // no zip64 loc/end
                         return end;
                     }
                 }
--- a/src/java.base/share/classes/jdk/internal/misc/JavaIOFileDescriptorAccess.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/jdk/internal/misc/JavaIOFileDescriptorAccess.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,12 +31,13 @@
  */
 
 public interface JavaIOFileDescriptorAccess {
-    public void set(FileDescriptor obj, int fd);
-    public int get(FileDescriptor fd);
-    public void setAppend(FileDescriptor obj, boolean append);
-    public boolean getAppend(FileDescriptor obj);
+    public void set(FileDescriptor fdo, int fd);
+    public int get(FileDescriptor fdo);
+    public void setAppend(FileDescriptor fdo, boolean append);
+    public boolean getAppend(FileDescriptor fdo);
+    public void close(FileDescriptor fdo);
 
     // Only valid on Windows
-    public void setHandle(FileDescriptor obj, long handle);
-    public long getHandle(FileDescriptor obj);
+    public void setHandle(FileDescriptor fdo, long handle);
+    public long getHandle(FileDescriptor fdo);
 }
--- a/src/java.base/share/classes/module-info.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/module-info.java	Thu Sep 28 09:13:27 2017 -0700
@@ -271,7 +271,6 @@
         java.rmi,
         java.security.jgss,
         jdk.crypto.cryptoki,
-        jdk.policytool,
         jdk.security.auth;
     exports sun.security.provider.certpath to
         java.naming;
@@ -294,7 +293,6 @@
         jdk.crypto.ec,
         jdk.crypto.cryptoki,
         jdk.jartool,
-        jdk.policytool,
         jdk.security.auth,
         jdk.security.jgss;
     exports sun.security.x509 to
--- a/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, 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
@@ -144,7 +144,7 @@
             //
             ((java.io.Closeable)parent).close();
         } else {
-            nd.close(fd);
+            fdAccess.close(fd);
         }
 
     }
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1802,7 +1802,12 @@
                 try {
                     readRecord(true);
                 } catch (SocketTimeoutException e) {
-                    // if time out, ignore the exception and continue
+                    if ((debug != null) && Debug.isOn("ssl")) {
+                        System.out.println(
+                            Thread.currentThread().getName() +
+                            ", received Exception: " + e);
+                    }
+                    fatal((byte)(-1), "Did not receive close_notify from peer", e);
                 }
             }
         } catch (IOException e) {
--- a/src/java.base/share/classes/sun/security/util/ManifestDigester.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/sun/security/util/ManifestDigester.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, 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
@@ -28,6 +28,7 @@
 import java.security.*;
 import java.util.HashMap;
 import java.io.ByteArrayOutputStream;
+import static java.nio.charset.StandardCharsets.UTF_8;
 
 /**
  * This class is used to compute digests on sections of the Manifest.
@@ -112,8 +113,6 @@
         rawBytes = bytes;
         entries = new HashMap<>();
 
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
         Position pos = new Position();
 
         if (!findSection(0, pos))
@@ -131,50 +130,41 @@
 
             if (len > 6) {
                 if (isNameAttr(bytes, start)) {
-                    StringBuilder nameBuf = new StringBuilder(sectionLen);
+                    ByteArrayOutputStream nameBuf = new ByteArrayOutputStream();
+                    nameBuf.write(bytes, start+6, len-6);
 
-                    try {
-                        nameBuf.append(
-                            new String(bytes, start+6, len-6, "UTF8"));
+                    int i = start + len;
+                    if ((i-start) < sectionLen) {
+                        if (bytes[i] == '\r') {
+                            i += 2;
+                        } else {
+                            i += 1;
+                        }
+                    }
 
-                        int i = start + len;
-                        if ((i-start) < sectionLen) {
-                            if (bytes[i] == '\r') {
-                                i += 2;
-                            } else {
-                                i += 1;
-                            }
+                    while ((i-start) < sectionLen) {
+                        if (bytes[i++] == ' ') {
+                            // name is wrapped
+                            int wrapStart = i;
+                            while (((i-start) < sectionLen)
+                                    && (bytes[i++] != '\n'));
+                            if (bytes[i-1] != '\n')
+                                return; // XXX: exception?
+                            int wrapLen;
+                            if (bytes[i-2] == '\r')
+                                wrapLen = i-wrapStart-2;
+                            else
+                                wrapLen = i-wrapStart-1;
+
+                            nameBuf.write(bytes, wrapStart, wrapLen);
+                        } else {
+                            break;
                         }
+                    }
 
-                        while ((i-start) < sectionLen) {
-                            if (bytes[i++] == ' ') {
-                                // name is wrapped
-                                int wrapStart = i;
-                                while (((i-start) < sectionLen)
-                                        && (bytes[i++] != '\n'));
-                                    if (bytes[i-1] != '\n')
-                                        return; // XXX: exception?
-                                    int wrapLen;
-                                    if (bytes[i-2] == '\r')
-                                        wrapLen = i-wrapStart-2;
-                                    else
-                                        wrapLen = i-wrapStart-1;
-
-                            nameBuf.append(new String(bytes, wrapStart,
-                                                      wrapLen, "UTF8"));
-                            } else {
-                                break;
-                            }
-                        }
-
-                        entries.put(nameBuf.toString(),
-                            new Entry(start, sectionLen, sectionLenWithBlank,
+                    entries.put(new String(nameBuf.toByteArray(), UTF_8),
+                        new Entry(start, sectionLen, sectionLenWithBlank,
                                 rawBytes));
-
-                    } catch (java.io.UnsupportedEncodingException uee) {
-                        throw new IllegalStateException(
-                            "UTF8 not available on platform");
-                    }
                 }
             }
             start = pos.startOfNext;
--- a/src/java.base/share/classes/sun/security/util/PolicyUtil.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/classes/sun/security/util/PolicyUtil.java	Thu Sep 28 09:13:27 2017 -0700
@@ -64,7 +64,7 @@
     }
 
     /**
-     * this is intended for use by policytool and the policy parser to
+     * this is intended for use by the policy parser to
      * instantiate a KeyStore from the information in the GUI/policy file
      */
     public static KeyStore getKeyStore
--- a/src/java.base/share/lib/security/default.policy	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/lib/security/default.policy	Thu Sep 28 09:13:27 2017 -0700
@@ -142,6 +142,10 @@
     permission java.security.AllPermission;
 };
 
+grant codeBase "jrt:/jdk.httpserver" {
+    permission java.security.AllPermission;
+};
+
 grant codeBase "jrt:/jdk.internal.le" {
     permission java.security.AllPermission;
 };
--- a/src/java.base/share/native/libjli/java.c	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/share/native/libjli/java.c	Thu Sep 28 09:13:27 2017 -0700
@@ -1517,6 +1517,7 @@
             }
             str = (*env)->CallStaticObjectMethod(env, cls,
                     makePlatformStringMID, USE_STDERR, ary);
+            CHECK_EXCEPTION_RETURN_VALUE(0);
             (*env)->DeleteLocalRef(env, ary);
             return str;
         }
@@ -1585,13 +1586,16 @@
 GetApplicationClass(JNIEnv *env)
 {
     jmethodID mid;
+    jclass appClass;
     jclass cls = GetLauncherHelperClass(env);
     NULL_CHECK0(cls);
     NULL_CHECK0(mid = (*env)->GetStaticMethodID(env, cls,
                 "getApplicationClass",
                 "()Ljava/lang/Class;"));
 
-    return (*env)->CallStaticObjectMethod(env, cls, mid);
+    appClass = (*env)->CallStaticObjectMethod(env, cls, mid);
+    CHECK_EXCEPTION_RETURN_VALUE(0);
+    return appClass;
 }
 
 static char* expandWildcardOnLongOpt(char* arg) {
--- a/src/java.base/unix/classes/java/io/FileDescriptor.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/unix/classes/java/io/FileDescriptor.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,16 +33,13 @@
 /**
  * Instances of the file descriptor class serve as an opaque handle
  * to the underlying machine-specific structure representing an open
- * file, an open socket, or another source or sink of bytes. The
- * main practical use for a file descriptor is to create a
- * <code>FileInputStream</code> or <code>FileOutputStream</code> to
- * contain it.
+ * file, an open socket, or another source or sink of bytes.
+ * The main practical use for a file descriptor is to create a
+ * {@link FileInputStream} or {@link FileOutputStream} to contain it.
  * <p>
  * Applications should not create their own file descriptors.
  *
  * @author  Pavani Diwanji
- * @see     java.io.FileInputStream
- * @see     java.io.FileOutputStream
  * @since   1.0
  */
 public final class FileDescriptor {
@@ -58,6 +55,45 @@
      */
     private boolean append;
 
+    static {
+        initIDs();
+    }
+
+    // Set up JavaIOFileDescriptorAccess in SharedSecrets
+    static {
+        SharedSecrets.setJavaIOFileDescriptorAccess(
+                new JavaIOFileDescriptorAccess() {
+                    public void set(FileDescriptor fdo, int fd) {
+                        fdo.fd = fd;
+                    }
+
+                    public int get(FileDescriptor fdo) {
+                        return fdo.fd;
+                    }
+
+                    public void setAppend(FileDescriptor fdo, boolean append) {
+                        fdo.append = append;
+                    }
+
+                    public boolean getAppend(FileDescriptor fdo) {
+                        return fdo.append;
+                    }
+
+                    public void close(FileDescriptor fdo) {
+                        fdo.close();
+                    }
+
+                    public void setHandle(FileDescriptor fdo, long handle) {
+                        throw new UnsupportedOperationException();
+                    }
+
+                    public long getHandle(FileDescriptor fdo) {
+                        throw new UnsupportedOperationException();
+                    }
+                }
+        );
+    }
+
     /**
      * Constructs an (invalid) FileDescriptor
      * object.
@@ -74,7 +110,7 @@
     /**
      * A handle to the standard input stream. Usually, this file
      * descriptor is not used directly, but rather via the input stream
-     * known as <code>System.in</code>.
+     * known as {@code System.in}.
      *
      * @see     java.lang.System#in
      */
@@ -83,7 +119,7 @@
     /**
      * A handle to the standard output stream. Usually, this file
      * descriptor is not used directly, but rather via the output stream
-     * known as <code>System.out</code>.
+     * known as {@code System.out}.
      * @see     java.lang.System#out
      */
     public static final FileDescriptor out = new FileDescriptor(1);
@@ -91,7 +127,7 @@
     /**
      * A handle to the standard error stream. Usually, this file
      * descriptor is not used directly, but rather via the output stream
-     * known as <code>System.err</code>.
+     * known as {@code System.err}.
      *
      * @see     java.lang.System#err
      */
@@ -100,9 +136,9 @@
     /**
      * Tests if this file descriptor object is valid.
      *
-     * @return  <code>true</code> if the file descriptor object represents a
+     * @return  {@code true} if the file descriptor object represents a
      *          valid, open file, socket, or other active I/O connection;
-     *          <code>false</code> otherwise.
+     *          {@code false} otherwise.
      */
     public boolean valid() {
         return fd != -1;
@@ -141,46 +177,18 @@
     /* This routine initializes JNI field offsets for the class */
     private static native void initIDs();
 
-    static {
-        initIDs();
-    }
-
-    // Set up JavaIOFileDescriptorAccess in SharedSecrets
-    static {
-        SharedSecrets.setJavaIOFileDescriptorAccess(
-            new JavaIOFileDescriptorAccess() {
-                public void set(FileDescriptor obj, int fd) {
-                    obj.fd = fd;
-                }
-
-                public int get(FileDescriptor obj) {
-                    return obj.fd;
-                }
-
-                public void setAppend(FileDescriptor obj, boolean append) {
-                    obj.append = append;
-                }
-
-                public boolean getAppend(FileDescriptor obj) {
-                    return obj.append;
-                }
-
-                public void setHandle(FileDescriptor obj, long handle) {
-                    throw new UnsupportedOperationException();
-                }
-
-                public long getHandle(FileDescriptor obj) {
-                    throw new UnsupportedOperationException();
-                }
-            }
-        );
-    }
-
     /**
      * Returns true, if the file was opened for appending.
      */
     private static native boolean getAppend(int fd);
 
+    /**
+     * Close the raw file descriptor or handle, if it has not already been closed
+     * and set the fd and handle to -1.
+     * Package private to allow it to be used in java.io.
+     */
+    native void close();
+
     /*
      * Package private methods to track referents.
      * If multiple streams point to the same FileDescriptor, we cycle
--- a/src/java.base/unix/classes/sun/nio/ch/FileDispatcherImpl.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/unix/classes/sun/nio/ch/FileDispatcherImpl.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, 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
@@ -28,6 +28,9 @@
 import java.io.FileDescriptor;
 import java.io.IOException;
 
+import jdk.internal.misc.JavaIOFileDescriptorAccess;
+import jdk.internal.misc.SharedSecrets;
+
 class FileDispatcherImpl extends FileDispatcher {
 
     static {
@@ -35,6 +38,9 @@
         init();
     }
 
+    private static final JavaIOFileDescriptorAccess fdAccess =
+            SharedSecrets.getJavaIOFileDescriptorAccess();
+
     FileDispatcherImpl() {
     }
 
@@ -95,7 +101,7 @@
     }
 
     void close(FileDescriptor fd) throws IOException {
-        close0(fd);
+        fdAccess.close(fd);
     }
 
     void preClose(FileDescriptor fd) throws IOException {
@@ -153,6 +159,8 @@
     static native void release0(FileDescriptor fd, long pos, long size)
         throws IOException;
 
+    // Shared with SocketDispatcher and DatagramDispatcher but
+    // NOT used by FileDispatcherImpl
     static native void close0(FileDescriptor fd) throws IOException;
 
     static native void preClose0(FileDescriptor fd) throws IOException;
--- a/src/java.base/unix/native/libjava/FileDescriptor_md.c	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/unix/native/libjava/FileDescriptor_md.c	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,3 +70,9 @@
     int flags = fcntl(fd, F_GETFL);
     return ((flags & O_APPEND) == 0) ? JNI_FALSE : JNI_TRUE;
 }
+
+// instance method close0 for FileDescriptor
+JNIEXPORT void JNICALL
+Java_java_io_FileDescriptor_close(JNIEnv *env, jobject this) {
+    fileDescriptorClose(env, this);
+}
--- a/src/java.base/unix/native/libjava/FileInputStream_md.c	Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-#include "io_util.h"
-#include "io_util_md.h"
-
-#include "java_io_FileInputStream.h"
-
-extern jfieldID fis_fd; /* id for jobject 'fd' in java.io.FileInputStream */
-
-/*********************************************************************
- * Platform specific implementation of input stream native methods
- */
-
-JNIEXPORT void JNICALL
-Java_java_io_FileInputStream_close0(JNIEnv *env, jobject this) {
-    fileClose(env, this, fis_fd);
-}
--- a/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c	Thu Sep 28 09:13:27 2017 -0700
@@ -662,7 +662,7 @@
         return -1;
     }
 
-    // Validate the pid before returning the info in case /proc/pid is racy
+    // Validate the pid before returning the info
     if (kill(pid, 0) < 0) {
         return -1;
     }
--- a/src/java.base/unix/native/libjava/RandomAccessFile_md.c	Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-#include "io_util.h"
-#include "io_util_md.h"
-
-#include "java_io_RandomAccessFile.h"
-
-extern jfieldID raf_fd; /* id for jobject 'fd' in java.io.RandomAccessFile */
-
-/*********************************************************************
- * Platform specific implementation of input stream native methods
- */
-
-JNIEXPORT void JNICALL
-Java_java_io_RandomAccessFile_close0(JNIEnv *env, jobject this) {
-    fileClose(env, this, raf_fd);
-}
--- a/src/java.base/unix/native/libjava/io_util_md.c	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/unix/native/libjava/io_util_md.c	Thu Sep 28 09:13:27 2017 -0700
@@ -124,19 +124,31 @@
 void
 fileClose(JNIEnv *env, jobject this, jfieldID fid)
 {
-    FD fd = GET_FD(this, fid);
-    if (fd == -1) {
+    jobject fileDescriptor = (*env)->GetObjectField(env, (this), (fid));
+    if (fileDescriptor == NULL) {
         return;
     }
+    fileDescriptorClose(env, fileDescriptor);
+}
 
+// Function to close the fd held by this FileDescriptor and set fd to -1.
+void
+fileDescriptorClose(JNIEnv *env, jobject this)
+{
+    FD fd = (*env)->GetIntField(env, this, IO_fd_fdID);
+    if ((*env)->ExceptionOccurred(env)) {
+        return;
+    }
     /* Set the fd to -1 before closing it so that the timing window
      * of other threads using the wrong fd (closed but recycled fd,
      * that gets re-opened with some other filename) is reduced.
      * Practically the chance of its occurance is low, however, we are
      * taking extra precaution over here.
      */
-    SET_FD(this, -1, fid);
-
+    (*env)->SetIntField(env, this, IO_fd_fdID, -1);
+    if ((*env)->ExceptionOccurred(env)) {
+        return;
+    }
     /*
      * Don't close file descriptors 0, 1, or 2. If we close these stream
      * then a subsequent file open or socket will use them. Instead we
@@ -145,7 +157,7 @@
     if (fd >= STDIN_FILENO && fd <= STDERR_FILENO) {
         int devnull = open("/dev/null", O_WRONLY);
         if (devnull < 0) {
-            SET_FD(this, fd, fid); // restore fd
+            (*env)->SetIntField(env, this, IO_fd_fdID, fd);
             JNU_ThrowIOExceptionWithLastError(env, "open /dev/null failed");
         } else {
             dup2(devnull, fd);
--- a/src/java.base/unix/native/libjava/io_util_md.h	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/unix/native/libjava/io_util_md.h	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -103,6 +103,7 @@
  * IO helper function(s)
  */
 void fileClose(JNIEnv *env, jobject this, jfieldID fid);
+void fileDescriptorClose(JNIEnv *env, jobject this);
 
 #ifdef MACOSX
 jstring newStringPlatform(JNIEnv *env, const char* str);
--- a/src/java.base/unix/native/libnet/PlainSocketImpl.c	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/unix/native/libnet/PlainSocketImpl.c	Thu Sep 28 09:13:27 2017 -0700
@@ -679,14 +679,16 @@
         }
 
         /* ECONNABORTED or EWOULDBLOCK error so adjust timeout if there is one. */
-        currNanoTime = JVM_NanoTime(env, 0);
-        nanoTimeout -= (currNanoTime - prevNanoTime);
-        if (nanoTimeout < NET_NSEC_PER_MSEC) {
-            JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
-                    "Accept timed out");
-            return;
+        if (nanoTimeout >= NET_NSEC_PER_MSEC) {
+            currNanoTime = JVM_NanoTime(env, 0);
+            nanoTimeout -= (currNanoTime - prevNanoTime);
+            if (nanoTimeout < NET_NSEC_PER_MSEC) {
+                JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
+                        "Accept timed out");
+                return;
+            }
+            prevNanoTime = currNanoTime;
         }
-        prevNanoTime = currNanoTime;
     }
 
     if (newfd < 0) {
--- a/src/java.base/windows/classes/java/io/FileDescriptor.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/windows/classes/java/io/FileDescriptor.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,12 +32,12 @@
 
 /**
  * Instances of the file descriptor class serve as an opaque handle
- * to the underlying machine-specific structure representing an
- * open file, an open socket, or another source or sink of bytes.
+ * to the underlying machine-specific structure representing an open
+ * file, an open socket, or another source or sink of bytes.
  * The main practical use for a file descriptor is to create a
  * {@link FileInputStream} or {@link FileOutputStream} to contain it.
- *
- * <p>Applications should not create their own file descriptors.
+ * <p>
+ * Applications should not create their own file descriptors.
  *
  * @author  Pavani Diwanji
  * @since   1.0
@@ -57,15 +57,6 @@
      */
     private boolean append;
 
-    /**
-     * Constructs an (invalid) FileDescriptor
-     * object.
-     */
-    public /**/ FileDescriptor() {
-        fd = -1;
-        handle = -1;
-    }
-
     static {
         initIDs();
     }
@@ -73,32 +64,45 @@
     // Set up JavaIOFileDescriptorAccess in SharedSecrets
     static {
         SharedSecrets.setJavaIOFileDescriptorAccess(
-            new JavaIOFileDescriptorAccess() {
-                public void set(FileDescriptor obj, int fd) {
-                    obj.fd = fd;
+                new JavaIOFileDescriptorAccess() {
+                    public void set(FileDescriptor fdo, int fd) {
+                        fdo.fd = fd;
+                    }
+
+                    public int get(FileDescriptor fdo) {
+                        return fdo.fd;
+                    }
+
+                    public void setAppend(FileDescriptor fdo, boolean append) {
+                        fdo.append = append;
+                    }
+
+                    public boolean getAppend(FileDescriptor fdo) {
+                        return fdo.append;
+                    }
+
+                    public void close(FileDescriptor fdo) {
+                        fdo.close();
+                    }
+
+                    public void setHandle(FileDescriptor fdo, long handle) {
+                        fdo.handle = handle;
+                    }
+
+                    public long getHandle(FileDescriptor fdo) {
+                        return fdo.handle;
+                    }
                 }
+        );
+    }
 
-                public int get(FileDescriptor obj) {
-                    return obj.fd;
-                }
-
-                public void setAppend(FileDescriptor obj, boolean append) {
-                    obj.append = append;
-                }
-
-                public boolean getAppend(FileDescriptor obj) {
-                    return obj.append;
-                }
-
-                public void setHandle(FileDescriptor obj, long handle) {
-                    obj.handle = handle;
-                }
-
-                public long getHandle(FileDescriptor obj) {
-                    return obj.handle;
-                }
-            }
-        );
+    /**
+     * Constructs an (invalid) FileDescriptor
+     * object.
+     */
+    public FileDescriptor() {
+        fd = -1;
+        handle = -1;
     }
 
     /**
@@ -135,7 +139,7 @@
      *          {@code false} otherwise.
      */
     public boolean valid() {
-        return ((handle != -1) || (fd != -1));
+        return (handle != -1) || (fd != -1);
     }
 
     /**
@@ -179,6 +183,13 @@
         return desc;
     }
 
+    /**
+     * Close the raw file descriptor or handle, if it has not already been closed
+     * and set the fd and handle to -1.
+     * Package private to allow it to be used in java.io.
+     */
+    native void close();
+
     /*
      * Package private methods to track referents.
      * If multiple streams point to the same FileDescriptor, we cycle
--- a/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java	Thu Sep 28 09:13:27 2017 -0700
@@ -104,7 +104,7 @@
     }
 
     void close(FileDescriptor fd) throws IOException {
-        close0(fd);
+        fdAccess.close(fd);
     }
 
     FileDescriptor duplicateForMapping(FileDescriptor fd) throws IOException {
--- a/src/java.base/windows/native/libjava/FileDescriptor_md.c	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/windows/native/libjava/FileDescriptor_md.c	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,3 +72,9 @@
         JNU_ThrowByName(env, "java/io/SyncFailedException", "sync failed");
     }
 }
+
+// instance method close0 for FileDescriptor
+JNIEXPORT void JNICALL
+Java_java_io_FileDescriptor_close(JNIEnv *env, jobject this) {
+    fileDescriptorClose(env, this);
+}
--- a/src/java.base/windows/native/libjava/FileInputStream_md.c	Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-
-#include "io_util.h"
-#include "io_util_md.h"
-
-#include "java_io_FileInputStream.h"
-
-extern jfieldID fis_fd; /* id for jobject 'fd' in java.io.FileInputStream */
-
-/*********************************************************************
- * Platform specific implementation of input stream native methods
- */
-
-JNIEXPORT void JNICALL
-Java_java_io_FileInputStream_close0(JNIEnv *env, jobject this) {
-    handleClose(env, this, fis_fd);
-}
--- a/src/java.base/windows/native/libjava/RandomAccessFile_md.c	Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-
-#include "io_util.h"
-#include "io_util_md.h"
-
-#include "java_io_RandomAccessFile.h"
-
-extern jfieldID raf_fd; /* id for jobject 'fd' in java.io.RandomAccessFile */
-
-/*********************************************************************
- * Platform specific implementation of input stream native methods
- */
-
-JNIEXPORT void JNICALL
-Java_java_io_RandomAccessFile_close0(JNIEnv *env, jobject this) {
-    handleClose(env, this, raf_fd);
-}
--- a/src/java.base/windows/native/libjava/io_util_md.c	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/windows/native/libjava/io_util_md.c	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -535,14 +535,28 @@
     return writeInternal(fd, buf, len, JNI_TRUE);
 }
 
-jint
+void
 handleClose(JNIEnv *env, jobject this, jfieldID fid)
 {
-    FD fd = GET_FD(this, fid);
+    jobject fileDescriptor = (*env)->GetObjectField(env, (this), (fid));
+    if (fileDescriptor == NULL) {
+        return;
+    }
+    fileDescriptorClose(env, fileDescriptor);
+}
+
+// Function to close the fd held by this FileDescriptor and set fd to -1.
+void
+fileDescriptorClose(JNIEnv *env, jobject this)
+{
+    FD fd = (*env)->GetLongField(env, this, IO_handle_fdID);
+    if ((*env)->ExceptionOccurred(env)) {
+        return;
+    }
     HANDLE h = (HANDLE)fd;
 
     if (h == INVALID_HANDLE_VALUE) {
-        return 0;
+        return;
     }
 
     /* Set the fd to -1 before closing it so that the timing window
@@ -551,12 +565,14 @@
      * Practically the chance of its occurance is low, however, we are
      * taking extra precaution over here.
      */
-    SET_FD(this, -1, fid);
+    (*env)->SetLongField(env, this, IO_handle_fdID, -1);
+    if ((*env)->ExceptionOccurred(env)) {
+        return;
+    }
 
     if (CloseHandle(h) == 0) { /* Returns zero on failure */
         JNU_ThrowIOExceptionWithLastError(env, "close failed");
     }
-    return 0;
 }
 
 jlong
--- a/src/java.base/windows/native/libjava/io_util_md.h	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.base/windows/native/libjava/io_util_md.h	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,8 @@
 JNIEXPORT jint handleRead(FD fd, void *buf, jint len);
 jint handleWrite(FD fd, const void *buf, jint len);
 jint handleAppend(FD fd, const void *buf, jint len);
-jint handleClose(JNIEnv *env, jobject this, jfieldID fid);
+void handleClose(JNIEnv *env, jobject this, jfieldID fid);
+void fileDescriptorClose(JNIEnv *env, jobject this);
 jlong handleLseek(FD fd, jlong offset, jint whence);
 
 /*
--- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java	Thu Sep 28 09:13:27 2017 -0700
@@ -216,8 +216,9 @@
      * Character#isJavaIdentifierStart(int)} returns {@code true},
      * followed only by characters for which {@link
      * Character#isJavaIdentifierPart(int)} returns {@code true}.
-     * This pattern matches regular identifiers, keywords, and the
-     * literals {@code "true"}, {@code "false"}, and {@code "null"}.
+     * This pattern matches regular identifiers, keywords, restricted
+     * keywords, and the literals {@code "true"}, {@code "false"}, and
+     * {@code "null"}.
      * The method returns {@code false} for all other strings.
      *
      * @param name the string to check
@@ -251,10 +252,13 @@
      * qualified name in the latest source version.  Unlike {@link
      * #isIdentifier isIdentifier}, this method returns {@code false}
      * for keywords, boolean literals, and the null literal.
+     * This method returns {@code true} for <i>restricted
+     * keywords</i>.
      *
      * @param name the string to check
      * @return {@code true} if this string is a
      * syntactically valid name, {@code false} otherwise.
+     * @jls 3.9 Keywords
      * @jls 6.2 Names and Identifiers
      */
     public static boolean isName(CharSequence name) {
@@ -266,11 +270,14 @@
      * qualified name in the given source version.  Unlike {@link
      * #isIdentifier isIdentifier}, this method returns {@code false}
      * for keywords, boolean literals, and the null literal.
+     * This method returns {@code true} for <i>restricted
+     * keywords</i>.
      *
      * @param name the string to check
      * @param version the version to use
      * @return {@code true} if this string is a
      * syntactically valid name, {@code false} otherwise.
+     * @jls 3.9 Keywords
      * @jls 6.2 Names and Identifiers
      * @since 9
      */
@@ -287,6 +294,8 @@
     /**
      * Returns whether or not {@code s} is a keyword, boolean literal,
      * or null literal in the latest source version.
+     * This method returns {@code false} for <i>restricted
+     * keywords</i>.
      *
      * @param s the string to check
      * @return {@code true} if {@code s} is a keyword, or boolean
@@ -302,6 +311,8 @@
     /**
      * Returns whether or not {@code s} is a keyword, boolean literal,
      * or null literal in the given source version.
+     * This method returns {@code false} for <i>restricted
+     * keywords</i>.
      *
      * @param s the string to check
      * @param version the version to use
--- a/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java	Thu Sep 28 09:13:27 2017 -0700
@@ -87,7 +87,7 @@
      *
      * @return {@code true} if this is an open module and {@code
      * false} otherwise
-     */ // TODO: add @jls to unnamed module section
+     */
     boolean isOpen();
 
     /**
@@ -96,7 +96,9 @@
      *
      * @return {@code true} if this is an unnamed module and {@code
      * false} otherwise
-     */ // TODO: add @jls to unnamed module section
+     *
+     * @jls 7.7.5 Unnamed Modules
+     */
     boolean isUnnamed();
 
     /**
--- a/src/java.desktop/share/classes/java/awt/EventQueue.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.desktop/share/classes/java/awt/EventQueue.java	Thu Sep 28 09:13:27 2017 -0700
@@ -191,6 +191,8 @@
         return eventLog;
     }
 
+    private static boolean fxAppThreadIsDispatchThread;
+
     static {
         AWTAccessor.setEventQueueAccessor(
             new AWTAccessor.EventQueueAccessor() {
@@ -227,6 +229,13 @@
                     return eventQueue.getMostRecentEventTimeImpl();
                 }
             });
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
+            public Object run() {
+                fxAppThreadIsDispatchThread =
+                        "true".equals(System.getProperty("javafx.embed.singleThread"));
+                return null;
+            }
+        });
     }
 
     /**
@@ -854,9 +863,15 @@
     private AWTEvent getCurrentEventImpl() {
         pushPopLock.lock();
         try {
+            if (fxAppThreadIsDispatchThread) {
+                return (currentEvent != null)
+                        ? currentEvent.get()
+                        : null;
+            } else {
                 return (Thread.currentThread() == dispatchThread)
-                ? currentEvent.get()
-                : null;
+                        ? currentEvent.get()
+                        : null;
+            }
         } finally {
             pushPopLock.unlock();
         }
@@ -1247,7 +1262,7 @@
     private void setCurrentEventAndMostRecentTimeImpl(AWTEvent e) {
         pushPopLock.lock();
         try {
-            if (Thread.currentThread() != dispatchThread) {
+            if (!fxAppThreadIsDispatchThread && Thread.currentThread() != dispatchThread) {
                 return;
             }
 
--- a/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp	Thu Sep 28 09:13:27 2017 -0700
@@ -898,11 +898,25 @@
       defIndices[1] = pDevMode->dmMediaType;
   }
 
-  if (pDevMode->dmFields & DM_YRESOLUTION) {
-     defIndices[2]  = pDevMode->dmYResolution;
+  /*
+   * For some printer like Brother HL-2240D series
+   * pDevMode->dmYResolution is not set in pDevMode->dmFields
+   * even though pDevMode->dmYResolution is populated
+   * via ::DocumentProperties API, so for this case
+   * we populate the resolution index in default array
+   */
+  if (pDevMode->dmFields & DM_YRESOLUTION || pDevMode->dmYResolution > 0) {
+      defIndices[2]  = pDevMode->dmYResolution;
   }
 
-  if (pDevMode->dmFields & DM_PRINTQUALITY) {
+  /*
+   * For some printer like Brother HL-2240D series
+   * pDevMode->dmPrintQuality is not set in pDevMode->dmFields
+   * even though pDevMode->dmPrintQuality is populated
+   * via ::DocumentProperties API, so for this case
+   * we populate the print quality index in default array
+   */
+  if (pDevMode->dmFields & DM_PRINTQUALITY || pDevMode->dmPrintQuality != 0) {
       defIndices[3] = pDevMode->dmPrintQuality;
   }
 
--- a/src/java.security.jgss/share/classes/sun/security/jgss/krb5/CipherHelper.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.security.jgss/share/classes/sun/security/jgss/krb5/CipherHelper.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,7 @@
 import sun.security.krb5.internal.crypto.Aes128;
 import sun.security.krb5.internal.crypto.Aes256;
 import sun.security.krb5.internal.crypto.ArcFourHmac;
+import sun.security.krb5.internal.crypto.EType;
 
 class CipherHelper {
 
@@ -77,10 +78,6 @@
     private int sgnAlg, sealAlg;
     private byte[] keybytes;
 
-    // new token format from draft-ietf-krb-wg-gssapi-cfx-07
-    // proto is used to determine new GSS token format for "newer" etypes
-    private int proto = 0;
-
     CipherHelper(EncryptionKey key) throws GSSException {
         etype = key.getEType();
         keybytes = key.getBytes();
@@ -106,7 +103,6 @@
         case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96:
             sgnAlg = -1;
             sealAlg = -1;
-            proto = 1;
             break;
 
         default:
@@ -123,8 +119,10 @@
         return sealAlg;
     }
 
+    // new token format from draft-ietf-krb-wg-gssapi-cfx-07
+    // proto is used to determine new GSS token format for "newer" etypes
     int getProto() {
-        return proto;
+        return EType.isNewer(etype) ? 1 : 0;
     }
 
     int getEType() {
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAData.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAData.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1,4 +1,5 @@
 /*
+ * 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
@@ -30,7 +31,7 @@
 
 package sun.security.krb5.internal;
 
-import sun.security.krb5.KrbException;
+import sun.security.krb5.internal.crypto.EType;
 import sun.security.util.*;
 import sun.security.krb5.Asn1Exception;
 import java.io.IOException;
@@ -172,8 +173,8 @@
             while (d2.data.available() > 0) {
                 DerValue value = d2.data.getDerValue();
                 ETypeInfo2 tmp = new ETypeInfo2(value);
-                if (tmp.getParams() == null) {
-                    // we don't support non-null s2kparams
+                if (EType.isNewer(tmp.getEType()) || tmp.getParams() == null) {
+                    // we don't support non-null s2kparams for old etypes
                     return tmp.getEType();
                 }
             }
@@ -239,8 +240,9 @@
             while (d2.data.available() > 0) {
                 DerValue value = d2.data.getDerValue();
                 ETypeInfo2 tmp = new ETypeInfo2(value);
-                if (tmp.getParams() == null && tmp.getEType() == eType) {
-                    // we don't support non-null s2kparams
+                if (tmp.getEType() == eType &&
+                        (EType.isNewer(eType) || tmp.getParams() == null)) {
+                    // we don't support non-null s2kparams for old etypes
                     return new SaltAndParams(tmp.getSalt(), tmp.getParams());
                 }
             }
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/EType.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/EType.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -301,6 +301,26 @@
         return isSupported(eTypeConst, enabledETypes);
     }
 
+    /**
+     * https://tools.ietf.org/html/rfc4120#section-3.1.3:
+     *
+     *                 A "newer" enctype is any enctype first officially
+     * specified concurrently with or subsequent to the issue of this RFC.
+     * The enctypes DES, 3DES, or RC4 and any defined in [RFC1510] are not
+     * "newer" enctypes.
+     *
+     * @param eTypeConst the encryption type
+     * @return true if "newer"
+     */
+    public static boolean isNewer(int eTypeConst) {
+        return eTypeConst != EncryptedData.ETYPE_DES_CBC_CRC &&
+                eTypeConst != EncryptedData.ETYPE_DES_CBC_MD4 &&
+                eTypeConst != EncryptedData.ETYPE_DES_CBC_MD5 &&
+                eTypeConst != EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD &&
+                eTypeConst != EncryptedData.ETYPE_ARCFOUR_HMAC &&
+                eTypeConst != EncryptedData.ETYPE_ARCFOUR_HMAC_EXP;
+    }
+
     public static String toString(int type) {
         switch (type) {
         case 0:
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java	Thu Sep 28 09:13:27 2017 -0700
@@ -308,6 +308,11 @@
      */
     public static final long HAS_RESOURCE = 1L<<56;
 
+    /**
+     * Flag for synthesized default constructors of anonymous classes that have an enclosing expression.
+     */
+    public static final long ANONCONSTR_BASED = 1L<<57;
+
     /** Modifier masks.
      */
     public static final int
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java	Thu Sep 28 09:13:27 2017 -0700
@@ -71,6 +71,7 @@
         HIDDEN(Category.RESOLUTION_TARGET),                            // not overloaded   non-target
         STATICERR(Category.RESOLUTION_TARGET),                         // overloaded?      target
         MISSING_ENCL(Category.RESOLUTION),                             // not overloaded   non-target
+        BAD_VAR(Category.RESOLUTION),                                  // not overloaded   non-target
         ABSENT_VAR(Category.RESOLUTION_TARGET, KindName.VAR),          // not overloaded   non-target
         WRONG_MTHS(Category.RESOLUTION_TARGET, KindName.METHOD),       // overloaded       target
         WRONG_MTH(Category.RESOLUTION_TARGET, KindName.METHOD),        // not overloaded   target
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Thu Sep 28 09:13:27 2017 -0700
@@ -227,6 +227,7 @@
         return compareTo(JDK1_8) <= 0;
     }
     public boolean allowPrivateInterfaceMethods() { return compareTo(JDK1_9) >= 0; }
+    public boolean allowLocalVariableTypeInference() { return compareTo(JDK1_10) >= 0; }
     public static SourceVersion toSourceVersion(Source source) {
         switch(source) {
         case JDK1_2:
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1616,6 +1616,7 @@
 
         public TypeVar(Name name, Symbol owner, Type lower) {
             super(null, TypeMetadata.EMPTY);
+            Assert.checkNonNull(lower);
             tsym = new TypeVariableSymbol(0, name, this, owner);
             this.bound = null;
             this.lower = lower;
@@ -1628,6 +1629,7 @@
         public TypeVar(TypeSymbol tsym, Type bound, Type lower,
                        TypeMetadata metadata) {
             super(tsym, metadata);
+            Assert.checkNonNull(lower);
             this.bound = bound;
             this.lower = lower;
         }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1247,7 +1247,9 @@
                 final TypeAnnotationPosition pos =
                     TypeAnnotationPosition.localVariable(currentLambda,
                                                          tree.pos);
-                separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
+                if (!tree.isImplicitlyTyped()) {
+                    separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
+                }
             } else if (tree.sym.getKind() == ElementKind.EXCEPTION_PARAMETER) {
                 final TypeAnnotationPosition pos =
                     TypeAnnotationPosition.exceptionParameter(currentLambda,
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Sep 28 09:13:27 2017 -0700
@@ -190,6 +190,245 @@
     }
     // </editor-fold>
 
+    // <editor-fold defaultstate="collapsed" desc="projections">
+
+    /**
+     * A projection kind. See {@link TypeProjection}
+     */
+    enum ProjectionKind {
+        UPWARDS() {
+            @Override
+            ProjectionKind complement() {
+                return DOWNWARDS;
+            }
+        },
+        DOWNWARDS() {
+            @Override
+            ProjectionKind complement() {
+                return UPWARDS;
+            }
+        };
+
+        abstract ProjectionKind complement();
+    }
+
+    /**
+     * This visitor performs upwards and downwards projections on types.
+     *
+     * A projection is defined as a function that takes a type T, a set of type variables V and that
+     * produces another type S.
+     *
+     * An upwards projection maps a type T into a type S such that (i) T has no variables in V,
+     * and (ii) S is an upper bound of T.
+     *
+     * A downwards projection maps a type T into a type S such that (i) T has no variables in V,
+     * and (ii) S is a lower bound of T.
+     *
+     * Note that projections are only allowed to touch variables in V. Theferore it is possible for
+     * a projection to leave its input type unchanged if it does not contain any variables in V.
+     *
+     * Moreover, note that while an upwards projection is always defined (every type as an upper bound),
+     * a downwards projection is not always defined.
+     *
+     * Examples:
+     *
+     * {@code upwards(List<#CAP1>, [#CAP1]) = List<? extends String>, where #CAP1 <: String }
+     * {@code downwards(List<#CAP2>, [#CAP2]) = List<? super String>, where #CAP2 :> String }
+     * {@code upwards(List<#CAP1>, [#CAP2]) = List<#CAP1> }
+     * {@code downwards(List<#CAP1>, [#CAP1]) = not defined }
+     */
+    class TypeProjection extends StructuralTypeMapping<ProjectionKind> {
+
+        List<Type> vars;
+        Set<Type> seen = new HashSet<>();
+
+        public TypeProjection(List<Type> vars) {
+            this.vars = vars;
+        }
+
+        @Override
+        public Type visitClassType(ClassType t, ProjectionKind pkind) {
+            if (t.isCompound()) {
+                List<Type> components = directSupertypes(t);
+                List<Type> components1 = components.map(c -> c.map(this, pkind));
+                if (components == components1) return t;
+                else return makeIntersectionType(components1);
+            } else {
+                Type outer = t.getEnclosingType();
+                Type outer1 = visit(outer, pkind);
+                List<Type> typarams = t.getTypeArguments();
+                List<Type> typarams1 = typarams.map(ta -> mapTypeArgument(ta, pkind));
+                if (typarams1.stream().anyMatch(ta -> ta.hasTag(BOT))) {
+                    //not defined
+                    return syms.botType;
+                }
+                if (outer1 == outer && typarams1 == typarams) return t;
+                else return new ClassType(outer1, typarams1, t.tsym, t.getMetadata()) {
+                    @Override
+                    protected boolean needsStripping() {
+                        return true;
+                    }
+                };
+            }
+        }
+
+        protected Type makeWildcard(Type upper, Type lower) {
+            BoundKind bk;
+            Type bound;
+            if (upper.hasTag(BOT)) {
+                upper = syms.objectType;
+            }
+            boolean isUpperObject = isSameType(upper, syms.objectType);
+            if (!lower.hasTag(BOT) && isUpperObject) {
+                bound = lower;
+                bk = SUPER;
+            } else {
+                bound = upper;
+                bk = isUpperObject ? UNBOUND : EXTENDS;
+            }
+            return new WildcardType(bound, bk, syms.boundClass);
+        }
+
+        @Override
+        public Type visitTypeVar(TypeVar t, ProjectionKind pkind) {
+            if (vars.contains(t)) {
+                try {
+                    if (seen.add(t)) {
+                        final Type bound;
+                        switch (pkind) {
+                            case UPWARDS:
+                                bound = t.getUpperBound();
+                                break;
+                            case DOWNWARDS:
+                                bound = (t.getLowerBound() == null) ?
+                                        syms.botType :
+                                        t.getLowerBound();
+                                break;
+                            default:
+                                Assert.error();
+                                return null;
+                        }
+                        return bound.map(this, pkind);
+                    } else {
+                        //cycle
+                        return syms.objectType;
+                    }
+                } finally {
+                    seen.remove(t);
+                }
+            } else {
+                return t;
+            }
+        }
+
+        @Override
+        public Type visitWildcardType(WildcardType wt, ProjectionKind pkind) {
+            switch (pkind) {
+                case UPWARDS:
+                    return wt.isExtendsBound() ?
+                            wt.type.map(this, pkind) :
+                            syms.objectType;
+                case DOWNWARDS:
+                    return wt.isSuperBound() ?
+                            wt.type.map(this, pkind) :
+                            syms.botType;
+                default:
+                    Assert.error();
+                    return null;
+            }
+        }
+
+        private Type mapTypeArgument(Type t, ProjectionKind pkind) {
+            if (!t.containsAny(vars)) {
+                return t;
+            } else if (!t.hasTag(WILDCARD) && pkind == ProjectionKind.DOWNWARDS) {
+                //not defined
+                return syms.botType;
+            } else {
+                Type upper = t.map(this, pkind);
+                Type lower = t.map(this, pkind.complement());
+                return makeWildcard(upper, lower);
+            }
+        }
+    }
+
+    /**
+     * Computes an upward projection of given type, and vars. See {@link TypeProjection}.
+     *
+     * @param t the type to be projected
+     * @param vars the set of type variables to be mapped
+     * @return the type obtained as result of the projection
+     */
+    public Type upward(Type t, List<Type> vars) {
+        return t.map(new TypeProjection(vars), ProjectionKind.UPWARDS);
+    }
+
+    /**
+     * Computes the set of captured variables mentioned in a given type. See {@link CaptureScanner}.
+     * This routine is typically used to computed the input set of variables to be used during
+     * an upwards projection (see {@link Types#upward(Type, List)}).
+     *
+     * @param t the type where occurrences of captured variables have to be found
+     * @return the set of captured variables found in t
+     */
+    public List<Type> captures(Type t) {
+        CaptureScanner cs = new CaptureScanner();
+        Set<Type> captures = new HashSet<>();
+        cs.visit(t, captures);
+        return List.from(captures);
+    }
+
+    /**
+     * This visitor scans a type recursively looking for occurrences of captured type variables.
+     */
+    class CaptureScanner extends SimpleVisitor<Void, Set<Type>> {
+
+        @Override
+        public Void visitType(Type t, Set<Type> types) {
+            return null;
+        }
+
+        @Override
+        public Void visitClassType(ClassType t, Set<Type> seen) {
+            if (t.isCompound()) {
+                directSupertypes(t).forEach(s -> visit(s, seen));
+            } else {
+                t.allparams().forEach(ta -> visit(ta, seen));
+            }
+            return null;
+        }
+
+        @Override
+        public Void visitArrayType(ArrayType t, Set<Type> seen) {
+            return visit(t.elemtype, seen);
+        }
+
+        @Override
+        public Void visitWildcardType(WildcardType t, Set<Type> seen) {
+            visit(t.type, seen);
+            return null;
+        }
+
+        @Override
+        public Void visitTypeVar(TypeVar t, Set<Type> seen) {
+            if ((t.tsym.flags() & Flags.SYNTHETIC) != 0 && seen.add(t)) {
+                visit(t.getUpperBound(), seen);
+            }
+            return null;
+        }
+
+        @Override
+        public Void visitCapturedType(CapturedType t, Set<Type> seen) {
+            if (seen.add(t)) {
+                visit(t.getUpperBound(), seen);
+                visit(t.getLowerBound(), seen);
+            }
+            return null;
+        }
+    }
+
+    // </editor-fold>
+
     // <editor-fold defaultstate="collapsed" desc="isUnbounded">
     /**
      * Checks that all the arguments to a class are unbounded
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Thu Sep 28 09:13:27 2017 -0700
@@ -83,6 +83,7 @@
 import static com.sun.tools.javac.code.Flags.GENERATEDCONSTR;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.tree.JCTree.Tag.APPLY;
+import static com.sun.tools.javac.tree.JCTree.Tag.FOREACHLOOP;
 import static com.sun.tools.javac.tree.JCTree.Tag.LABELLED;
 import static com.sun.tools.javac.tree.JCTree.Tag.METHODDEF;
 import static com.sun.tools.javac.tree.JCTree.Tag.NEWCLASS;
@@ -139,7 +140,8 @@
     enum AnalyzerMode {
         DIAMOND("diamond", Source::allowDiamond),
         LAMBDA("lambda", Source::allowLambda),
-        METHOD("method", Source::allowGraphInference);
+        METHOD("method", Source::allowGraphInference),
+        LOCAL("local", Source::allowLocalVariableTypeInference);
 
         final String opt;
         final Predicate<Source> sourceFilter;
@@ -341,11 +343,91 @@
         }
     }
 
+    /**
+     * Base class for local variable inference analyzers.
+     */
+    abstract class RedundantLocalVarTypeAnalyzerBase<X extends JCStatement> extends StatementAnalyzer<X, X> {
+
+        RedundantLocalVarTypeAnalyzerBase(JCTree.Tag tag) {
+            super(AnalyzerMode.LOCAL, tag);
+        }
+
+        /**
+         * Map a variable tree into a new declaration using implicit type.
+         */
+        JCVariableDecl mapVar(JCVariableDecl oldTree, JCVariableDecl newTree){
+            newTree.vartype = null;
+            return newTree;
+        }
+
+        /**
+         * Analyze results of local variable inference.
+         */
+        void processVar(JCVariableDecl oldTree, JCVariableDecl newTree, boolean hasErrors){
+            if (!hasErrors) {
+                if (types.isSameType(oldTree.type, newTree.type)) {
+                    log.warning(oldTree, Warnings.LocalRedundantType);
+                }
+            }
+        }
+    }
+
+    /**
+     * This analyzer checks if a local variable declaration has redundant type.
+     */
+    class RedundantLocalVarTypeAnalyzer extends RedundantLocalVarTypeAnalyzerBase<JCVariableDecl> {
+
+        RedundantLocalVarTypeAnalyzer() {
+            super(VARDEF);
+        }
+
+        boolean match(JCVariableDecl tree){
+            return tree.sym.owner.kind == Kind.MTH &&
+                    tree.init != null && !tree.isImplicitlyTyped() &&
+                    attr.canInferLocalVarType(tree) == null;
+        }
+        @Override
+        JCVariableDecl map(JCVariableDecl oldTree, JCVariableDecl newTree){
+            return mapVar(oldTree, newTree);
+        }
+        @Override
+        void process(JCVariableDecl oldTree, JCVariableDecl newTree, boolean hasErrors){
+            processVar(oldTree, newTree, hasErrors);
+        }
+    }
+
+    /**
+     * This analyzer checks if a for each variable declaration has redundant type.
+     */
+    class RedundantLocalVarTypeAnalyzerForEach extends RedundantLocalVarTypeAnalyzerBase<JCEnhancedForLoop> {
+
+        RedundantLocalVarTypeAnalyzerForEach() {
+            super(FOREACHLOOP);
+        }
+
+        @Override
+        boolean match(JCEnhancedForLoop tree){
+            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;
+        }
+        @Override
+        void process(JCEnhancedForLoop oldTree, JCEnhancedForLoop newTree, boolean hasErrors){
+            processVar(oldTree.var, newTree.var, hasErrors);
+        }
+    }
+
     @SuppressWarnings({"unchecked", "rawtypes"})
     StatementAnalyzer<JCTree, JCTree>[] analyzers = new StatementAnalyzer[] {
             new DiamondInitializer(),
             new LambdaAnalyzer(),
-            new RedundantTypeArgAnalyzer()
+            new RedundantTypeArgAnalyzer(),
+            new RedundantLocalVarTypeAnalyzer(),
+            new RedundantLocalVarTypeAnalyzerForEach()
     };
 
     /**
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Thu Sep 28 09:13:27 2017 -0700
@@ -28,9 +28,11 @@
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Attribute.Compound;
 import com.sun.tools.javac.code.Attribute.TypeCompound;
+import com.sun.tools.javac.code.Kinds.KindSelector;
 import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.TypeMetadata.Entry.Kind;
+import com.sun.tools.javac.comp.Check.CheckContext;
 import com.sun.tools.javac.resources.CompilerProperties.Errors;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.*;
@@ -602,7 +604,7 @@
     }
 
     private Attribute getAnnotationEnumValue(Type expectedElementType, JCExpression tree, Env<AttrContext> env) {
-        Type result = attr.attribExpr(tree, env, expectedElementType);
+        Type result = attr.attribTree(tree, env, annotationValueInfo(expectedElementType));
         Symbol sym = TreeInfo.symbol(tree);
         if (sym == null ||
                 TreeInfo.nonstaticSelect(tree) ||
@@ -616,7 +618,7 @@
     }
 
     private Attribute getAnnotationClassValue(Type expectedElementType, JCExpression tree, Env<AttrContext> env) {
-        Type result = attr.attribExpr(tree, env, expectedElementType);
+        Type result = attr.attribTree(tree, env, annotationValueInfo(expectedElementType));
         if (result.isErroneous()) {
             // Does it look like an unresolved class literal?
             if (TreeInfo.name(tree) == names._class &&
@@ -642,7 +644,7 @@
     }
 
     private Attribute getAnnotationPrimitiveValue(Type expectedElementType, JCExpression tree, Env<AttrContext> env) {
-        Type result = attr.attribExpr(tree, env, expectedElementType);
+        Type result = attr.attribTree(tree, env, annotationValueInfo(expectedElementType));
         if (result.isErroneous())
             return new Attribute.Error(result.getOriginalType());
         if (result.constValue() == null) {
@@ -653,6 +655,22 @@
         return new Attribute.Constant(expectedElementType, result.constValue());
     }
 
+    private Attr.ResultInfo annotationValueInfo(Type pt) {
+        return attr.unknownExprInfo.dup(pt, new AnnotationValueContext(attr.unknownExprInfo.checkContext));
+    }
+
+    class AnnotationValueContext extends Check.NestedCheckContext {
+        AnnotationValueContext(CheckContext enclosingContext) {
+            super(enclosingContext);
+        }
+
+        @Override
+        public boolean compatible(Type found, Type req, Warner warn) {
+            //handle non-final implicitly-typed vars (will be rejected later on)
+            return found.hasTag(TypeTag.NONE) || super.compatible(found, req, warn);
+        }
+    }
+
     private Attribute getAnnotationArrayValue(Type expectedElementType, JCExpression tree, Env<AttrContext> env) {
         // Special case, implicit array
         if (!tree.hasTag(NEWARRAY)) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Sep 28 09:13:27 2017 -0700
@@ -36,7 +36,6 @@
 import com.sun.source.tree.TreeVisitor;
 import com.sun.source.util.SimpleTreeVisitor;
 import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Directive.RequiresFlag;
 import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol.*;
@@ -46,7 +45,6 @@
 import com.sun.tools.javac.comp.ArgumentAttr.LocalCacheContext;
 import com.sun.tools.javac.comp.Check.CheckContext;
 import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
-import com.sun.tools.javac.comp.Infer.FreeTypeListener;
 import com.sun.tools.javac.jvm.*;
 import static com.sun.tools.javac.resources.CompilerProperties.Fragments.Diamond;
 import static com.sun.tools.javac.resources.CompilerProperties.Fragments.DiamondInvalidArg;
@@ -830,6 +828,10 @@
         final JavaFileObject prevSource = log.useSource(env.toplevel.sourcefile);
         try {
             Type itype = attribExpr(variable.init, env, type);
+            if (variable.isImplicitlyTyped()) {
+                //fixup local variable type
+                type = variable.type = variable.sym.type = chk.checkLocalVarType(variable, itype.baseType(), variable.name);
+            }
             if (itype.constValue() != null) {
                 return coerce(itype, type).constValue();
             } else {
@@ -1108,6 +1110,21 @@
                 // parameters have already been entered
                 env.info.scope.enter(tree.sym);
             } else {
+                if (tree.isImplicitlyTyped() && (tree.getModifiers().flags & PARAMETER) == 0) {
+                    if (tree.init == null) {
+                        //cannot use 'var' without initializer
+                        log.error(tree, Errors.CantInferLocalVarType(tree.name, Fragments.LocalMissingInit));
+                        tree.vartype = make.Erroneous();
+                    } else {
+                        Fragment msg = canInferLocalVarType(tree);
+                        if (msg != null) {
+                            //cannot use 'var' with initializer which require an explicit target
+                            //(e.g. lambda, method reference, array initializer).
+                            log.error(tree, Errors.CantInferLocalVarType(tree.name, msg));
+                            tree.vartype = make.Erroneous();
+                        }
+                    }
+                }
                 try {
                     annotate.blockAnnotations();
                     memberEnter.memberEnter(tree, env);
@@ -1131,7 +1148,7 @@
         boolean isImplicitLambdaParameter = env.tree.hasTag(LAMBDA) &&
                 ((JCLambda)env.tree).paramKind == JCLambda.ParameterKind.IMPLICIT &&
                 (tree.sym.flags() & PARAMETER) != 0;
-        chk.validate(tree.vartype, env, !isImplicitLambdaParameter);
+        chk.validate(tree.vartype, env, !isImplicitLambdaParameter && !tree.isImplicitlyTyped());
 
         try {
             v.getConstValue(); // ensure compile-time constant initializer is evaluated
@@ -1152,6 +1169,10 @@
                     // marking the variable as undefined.
                     initEnv.info.enclVar = v;
                     attribExpr(tree.init, initEnv, v.type);
+                    if (tree.isImplicitlyTyped()) {
+                        //fixup local variable type
+                        v.type = chk.checkLocalVarType(tree, tree.init.type.baseType(), tree.name);
+                    }
                 }
             }
             result = tree.type = v.type;
@@ -1161,6 +1182,71 @@
         }
     }
 
+    Fragment canInferLocalVarType(JCVariableDecl tree) {
+        LocalInitScanner lis = new LocalInitScanner();
+        lis.scan(tree.init);
+        return lis.badInferenceMsg;
+    }
+
+    static class LocalInitScanner extends TreeScanner {
+        Fragment badInferenceMsg = null;
+        boolean needsTarget = true;
+
+        @Override
+        public void visitNewArray(JCNewArray tree) {
+            if (tree.elemtype == null && needsTarget) {
+                badInferenceMsg = Fragments.LocalArrayMissingTarget;
+            }
+        }
+
+        @Override
+        public void visitLambda(JCLambda tree) {
+            if (needsTarget) {
+                badInferenceMsg = Fragments.LocalLambdaMissingTarget;
+            }
+        }
+
+        @Override
+        public void visitTypeCast(JCTypeCast tree) {
+            boolean prevNeedsTarget = needsTarget;
+            try {
+                needsTarget = false;
+                super.visitTypeCast(tree);
+            } finally {
+                needsTarget = prevNeedsTarget;
+            }
+        }
+
+        @Override
+        public void visitReference(JCMemberReference tree) {
+            if (needsTarget) {
+                badInferenceMsg = Fragments.LocalMrefMissingTarget;
+            }
+        }
+
+        @Override
+        public void visitNewClass(JCNewClass tree) {
+            boolean prevNeedsTarget = needsTarget;
+            try {
+                needsTarget = false;
+                super.visitNewClass(tree);
+            } finally {
+                needsTarget = prevNeedsTarget;
+            }
+        }
+
+        @Override
+        public void visitApply(JCMethodInvocation tree) {
+            boolean prevNeedsTarget = needsTarget;
+            try {
+                needsTarget = false;
+                super.visitApply(tree);
+            } finally {
+                needsTarget = prevNeedsTarget;
+            }
+        }
+    }
+
     public void visitSkip(JCSkip tree) {
         result = null;
     }
@@ -1243,7 +1329,6 @@
             //attributing the for-each expression; we mimick this by attributing
             //the for-each expression first (against original scope).
             Type exprType = types.cvarUpperBound(attribExpr(tree.expr, loopEnv));
-            attribStat(tree.var, loopEnv);
             chk.checkNonVoid(tree.pos(), exprType);
             Type elemtype = types.elemtype(exprType); // perhaps expr is an array?
             if (elemtype == null) {
@@ -1261,6 +1346,15 @@
                         : types.wildUpperBound(iterableParams.head);
                 }
             }
+            if (tree.var.isImplicitlyTyped()) {
+                Type inferredType = chk.checkLocalVarType(tree.var, elemtype, tree.var.name);
+                if (inferredType.isErroneous()) {
+                    tree.var.vartype = make.at(tree.var.vartype).Erroneous();
+                } else {
+                    tree.var.vartype = make.at(tree.var.vartype).Type(inferredType);
+                }
+            }
+            attribStat(tree.var, loopEnv);
             chk.checkType(tree.expr.pos(), elemtype, tree.var.sym.type);
             loopEnv.tree = tree; // before, we were not in loop!
             attribStat(tree.body, loopEnv);
@@ -2305,9 +2399,7 @@
                 // prefix it to the constructor arguments
                 // and delete it from the new expression
                 if (tree.encl != null && !clazztype.tsym.isInterface()) {
-                    tree.args = tree.args.prepend(makeNullCheck(tree.encl));
                     finalargtypes = argtypes.prepend(tree.encl.type);
-                    tree.encl = null;
                 } else {
                     finalargtypes = argtypes;
                 }
@@ -2381,7 +2473,8 @@
             if (pt().hasTag(ARRAY)) {
                 elemtype = types.elemtype(pt());
             } else {
-                if (!pt().hasTag(ERROR)) {
+                if (!pt().hasTag(ERROR) &&
+                        (env.info.enclVar == null || !env.info.enclVar.type.isErroneous())) {
                     log.error(tree.pos(),
                               Errors.IllegalInitializerForType(pt()));
                 }
@@ -2406,7 +2499,7 @@
     @Override
     public void visitLambda(final JCLambda that) {
         if (pt().isErroneous() || (pt().hasTag(NONE) && pt() != Type.recoveryType)) {
-            if (pt().hasTag(NONE)) {
+            if (pt().hasTag(NONE) && (env.info.enclVar == null || !env.info.enclVar.type.isErroneous())) {
                 //lambda only allowed in assignment or method invocation/cast context
                 log.error(that.pos(), Errors.UnexpectedLambda);
             }
@@ -2839,7 +2932,7 @@
     @Override
     public void visitReference(final JCMemberReference that) {
         if (pt().isErroneous() || (pt().hasTag(NONE) && pt() != Type.recoveryType)) {
-            if (pt().hasTag(NONE)) {
+            if (pt().hasTag(NONE) && (env.info.enclVar == null || !env.info.enclVar.type.isErroneous())) {
                 //method reference only allowed in assignment or method invocation/cast context
                 log.error(that.pos(), Errors.UnexpectedMref);
             }
@@ -3813,6 +3906,14 @@
                 break;
             case VAR:
                 VarSymbol v = (VarSymbol)sym;
+
+                if (env.info.enclVar != null
+                        && v.type.hasTag(NONE)) {
+                    //self reference to implicitly typed variable declaration
+                    log.error(TreeInfo.positionFor(v, env.enclClass), Errors.CantInferLocalVarType(v.name, Fragments.LocalSelfRef));
+                    return v.type = types.createErrorType(v.type);
+                }
+
                 // Test (4): if symbol is an instance field of a raw type,
                 // which is being assigned to, issue an unchecked warning if
                 // its type changes under erasure.
@@ -4137,6 +4238,9 @@
     public void visitTypeArray(JCArrayTypeTree tree) {
         Type etype = attribType(tree.elemtype, env);
         Type type = new ArrayType(etype, syms.arrayClass);
+        if (etype.isErroneous()) {
+            type = types.createErrorType(type);
+        }
         result = check(tree, type, KindSelector.TYP, resultInfo);
     }
 
@@ -4778,7 +4882,7 @@
         }
         public void visitVarDef(final JCVariableDecl tree) {
             //System.err.println("validateTypeAnnotations.visitVarDef " + tree);
-            if (tree.sym != null && tree.sym.type != null)
+            if (tree.sym != null && tree.sym.type != null && !tree.isImplicitlyTyped())
                 validateAnnotatedType(tree.vartype, tree.sym.type);
             scan(tree.mods);
             scan(tree.vartype);
@@ -4906,17 +5010,16 @@
                     repeat = false;
                 } else if (enclTr.hasTag(JCTree.Tag.WILDCARD)) {
                     JCWildcard wc = (JCWildcard) enclTr;
-                    if (wc.getKind() == JCTree.Kind.EXTENDS_WILDCARD) {
-                        validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy).getExtendsBound());
-                    } else if (wc.getKind() == JCTree.Kind.SUPER_WILDCARD) {
-                        validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy).getSuperBound());
+                    if (wc.getKind() == JCTree.Kind.EXTENDS_WILDCARD ||
+                            wc.getKind() == JCTree.Kind.SUPER_WILDCARD) {
+                        validateAnnotatedType(wc.getBound(), wc.getBound().type);
                     } else {
                         // Nothing to do for UNBOUND
                     }
                     repeat = false;
                 } else if (enclTr.hasTag(TYPEARRAY)) {
                     JCArrayTypeTree art = (JCArrayTypeTree) enclTr;
-                    validateAnnotatedType(art.getType(), ((ArrayType)enclTy).getComponentType());
+                    validateAnnotatedType(art.getType(), art.elemtype.type);
                     repeat = false;
                 } else if (enclTr.hasTag(TYPEUNION)) {
                     JCTypeUnion ut = (JCTypeUnion) enclTr;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Thu Sep 28 09:13:27 2017 -0700
@@ -843,26 +843,30 @@
     List<Type> checkDiamondDenotable(ClassType t) {
         ListBuffer<Type> buf = new ListBuffer<>();
         for (Type arg : t.allparams()) {
-            if (!diamondTypeChecker.visit(arg, null)) {
+            if (!checkDenotable(arg)) {
                 buf.append(arg);
             }
         }
         return buf.toList();
     }
+
+    boolean checkDenotable(Type t) {
+        return denotableChecker.visit(t, null);
+    }
         // where
 
         /** diamondTypeChecker: A type visitor that descends down the given type looking for non-denotable
          *  types. The visit methods return false as soon as a non-denotable type is encountered and true
          *  otherwise.
          */
-        private static final Types.SimpleVisitor<Boolean, Void> diamondTypeChecker = new Types.SimpleVisitor<Boolean, Void>() {
+        private static final Types.SimpleVisitor<Boolean, Void> denotableChecker = new Types.SimpleVisitor<Boolean, Void>() {
             @Override
             public Boolean visitType(Type t, Void s) {
                 return true;
             }
             @Override
             public Boolean visitClassType(ClassType t, Void s) {
-                if (t.isCompound()) {
+                if (t.isUnion() || t.isIntersection()) {
                     return false;
                 }
                 for (Type targ : t.allparams()) {
@@ -878,7 +882,7 @@
                 /* Any type variable mentioned in the inferred type must have been declared as a type parameter
                   (i.e cannot have been produced by inference (18.4))
                 */
-                return t.tsym.owner.type.getTypeArguments().contains(t);
+                return (t.tsym.flags() & SYNTHETIC) == 0;
             }
 
             @Override
@@ -941,6 +945,17 @@
                                   (allowPrivateSafeVarargs ? PRIVATE : 0) )) != 0);
         }
 
+    Type checkLocalVarType(DiagnosticPosition pos, Type t, Name name) {
+        //upward project the initializer type
+        t = types.upward(t, types.captures(t));
+        //check that resulting type is not the null type
+        if (t.hasTag(BOT)) {
+            log.error(pos, Errors.CantInferLocalVarType(name, Fragments.LocalCantInferNull));
+            return types.createErrorType(t);
+        }
+        return t;
+    }
+
     Type checkMethod(final Type mtype,
             final Symbol sym,
             final Env<AttrContext> env,
@@ -965,6 +980,10 @@
             formals = formals.tail.tail;
             nonInferred = nonInferred.tail.tail;
         }
+        if ((sym.flags() & ANONCONSTR_BASED) != 0) {
+            formals = formals.tail;
+            nonInferred = nonInferred.tail;
+        }
         List<JCExpression> args = argtrees;
         if (args != null) {
             //this is null when type-checking a method reference
@@ -3155,7 +3174,10 @@
                 if (s.kind == PCK)
                     return true;
             } else if (target == names.TYPE_USE) {
-                if (s.kind == TYP || s.kind == VAR ||
+                if (s.kind == VAR && s.owner.kind == MTH && s.type.hasTag(NONE)) {
+                    //cannot type annotate implictly typed locals
+                    return false;
+                } else if (s.kind == TYP || s.kind == VAR ||
                         (s.kind == MTH && !s.isConstructor() &&
                                 !s.type.getReturnType().hasTag(VOID)) ||
                         (s.kind == MTH && s.isConstructor())) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Sep 28 09:13:27 2017 -0700
@@ -529,7 +529,7 @@
             List<Type> upperBounds = uv.getBounds(InferenceBound.UPPER);
             if (Type.containsAny(upperBounds, vars)) {
                 TypeSymbol fresh_tvar = new TypeVariableSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner);
-                fresh_tvar.type = new TypeVar(fresh_tvar, types.makeIntersectionType(uv.getBounds(InferenceBound.UPPER)), null);
+                fresh_tvar.type = new TypeVar(fresh_tvar, types.makeIntersectionType(uv.getBounds(InferenceBound.UPPER)), syms.botType);
                 todo.append(uv);
                 uv.setInst(fresh_tvar.type);
             } else if (upperBounds.nonEmpty()) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Thu Sep 28 09:13:27 2017 -0700
@@ -259,7 +259,7 @@
         try {
             if (TreeInfo.isEnumInit(tree)) {
                 attr.attribIdentAsEnumType(localEnv, (JCIdent)tree.vartype);
-            } else {
+            } else if (!tree.isImplicitlyTyped()) {
                 attr.attribType(tree.vartype, localEnv);
                 if (TreeInfo.isReceiverParam(tree))
                     checkReceiver(tree, localEnv);
@@ -279,8 +279,8 @@
             tree.vartype.type = atype.makeVarargs();
         }
         WriteableScope enclScope = enter.enterScope(env);
-        VarSymbol v =
-            new VarSymbol(0, tree.name, tree.vartype.type, enclScope.owner);
+        Type vartype = tree.isImplicitlyTyped() ? Type.noType : tree.vartype.type;
+        VarSymbol v = new VarSymbol(0, tree.name, vartype, enclScope.owner);
         v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree);
         tree.sym = v;
         if (tree.init != null) {
@@ -298,7 +298,9 @@
         }
 
         annotate.annotateLater(tree.mods.annotations, localEnv, v, tree.pos());
-        annotate.queueScanTreeAndTypeAnnotate(tree.vartype, localEnv, v, tree.pos());
+        if (!tree.isImplicitlyTyped()) {
+            annotate.queueScanTreeAndTypeAnnotate(tree.vartype, localEnv, v, tree.pos());
+        }
 
         v.pos = tree.pos;
     }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Sep 28 09:13:27 2017 -0700
@@ -105,6 +105,7 @@
     public final boolean allowModules;
     public final boolean checkVarargsAccessAfterResolution;
     private final boolean compactMethodDiags;
+    private final boolean allowLocalVariableTypeInference;
     final EnumSet<VerboseResolutionMode> verboseResolutionMode;
 
     WriteableScope polymorphicSignatureScope;
@@ -136,6 +137,7 @@
         Target target = Target.instance(context);
         allowMethodHandles = target.hasMethodHandles();
         allowFunctionalInterfaceMostSpecific = source.allowFunctionalInterfaceMostSpecific();
+        allowLocalVariableTypeInference = source.allowLocalVariableTypeInference();
         checkVarargsAccessAfterResolution =
                 source.allowPostApplicabilityVarargsAccessCheck();
         polymorphicSignatureScope = WriteableScope.create(syms.noSymbol);
@@ -2325,6 +2327,10 @@
      *                   (a subset of VAL, TYP, PCK).
      */
     Symbol findIdent(Env<AttrContext> env, Name name, KindSelector kind) {
+        return checkVarType(findIdentInternal(env, name, kind), name);
+    }
+
+    Symbol findIdentInternal(Env<AttrContext> env, Name name, KindSelector kind) {
         Symbol bestSoFar = typeNotFound;
         Symbol sym;
 
@@ -2354,6 +2360,11 @@
      */
     Symbol findIdentInPackage(Env<AttrContext> env, TypeSymbol pck,
                               Name name, KindSelector kind) {
+        return checkVarType(findIdentInPackageInternal(env, pck, name, kind), name);
+    }
+
+    Symbol findIdentInPackageInternal(Env<AttrContext> env, TypeSymbol pck,
+                              Name name, KindSelector kind) {
         Name fullname = TypeSymbol.formFullName(name, pck);
         Symbol bestSoFar = typeNotFound;
         if (kind.contains(KindSelector.TYP)) {
@@ -2383,6 +2394,11 @@
      */
     Symbol findIdentInType(Env<AttrContext> env, Type site,
                            Name name, KindSelector kind) {
+        return checkVarType(findIdentInTypeInternal(env, site, name, kind), name);
+    }
+
+    Symbol findIdentInTypeInternal(Env<AttrContext> env, Type site,
+                           Name name, KindSelector kind) {
         Symbol bestSoFar = typeNotFound;
         Symbol sym;
         if (kind.contains(KindSelector.VAL)) {
@@ -2399,6 +2415,14 @@
         return bestSoFar;
     }
 
+    private Symbol checkVarType(Symbol bestSoFar, Name name) {
+        if (allowLocalVariableTypeInference && name.equals(names.var) &&
+                (bestSoFar.kind == TYP || bestSoFar.kind == ABSENT_TYP)) {
+            bestSoFar = new BadVarTypeError();
+        }
+        return bestSoFar;
+    }
+
 /* ***************************************************************************
  *  Access checking
  *  The following methods convert ResolveErrors to ErrorSymbols, issuing
@@ -3774,6 +3798,17 @@
         }
     }
 
+    class BadVarTypeError extends ResolveError {
+        BadVarTypeError() {
+            super(Kind.BAD_VAR, "bad var use");
+        }
+
+        @Override
+        JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
+            return diags.create(dkind, log.currentSource(), pos, "illegal.ref.to.var.type", name);
+        }
+    }
+
     /**
      * InvalidSymbolError error class indicating that a symbol matching a
      * given name does not exists in a given site.
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Sep 28 09:13:27 2017 -0700
@@ -72,6 +72,7 @@
     private Enter enter;
     private Types types;
     private Annotate annotate;
+    private Attr attr;
     private final Resolve resolve;
     private final CompileStates compileStates;
 
@@ -96,6 +97,7 @@
         allowInterfaceBridges = source.allowDefaultMethods();
         allowGraphInference = source.allowGraphInference();
         annotate = Annotate.instance(context);
+        attr = Attr.instance(context);
     }
 
     /** A hashtable mapping bridge methods to the pair of methods they bridge.
@@ -693,8 +695,14 @@
     }
 
     public void visitNewClass(JCNewClass tree) {
-        if (tree.encl != null)
-            tree.encl = translate(tree.encl, erasure(tree.encl.type));
+        if (tree.encl != null) {
+            if (tree.def == null) {
+                tree.encl = translate(tree.encl, erasure(tree.encl.type));
+            } else {
+                tree.args = tree.args.prepend(attr.makeNullCheck(tree.encl));
+                tree.encl = null;
+            }
+        }
 
         Type erasedConstructorType = tree.constructorType != null ?
                 erasure(tree.constructorType) :
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1030,6 +1030,9 @@
         if (c.name.isEmpty()) {
             flags |= ANONCONSTR;
         }
+        if (based) {
+            flags |= ANONCONSTR_BASED;
+        }
         Type mType = new MethodType(argtypes, null, thrown, c);
         Type initType = typarams.nonEmpty() ?
             new ForAll(typarams, mType) :
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Sep 28 09:13:27 2017 -0700
@@ -179,6 +179,7 @@
         this.allowAnnotationsAfterTypeParams = source.allowAnnotationsAfterTypeParams();
         this.allowUnderscoreIdentifier = source.allowUnderscoreIdentifier();
         this.allowPrivateInterfaceMethods = source.allowPrivateInterfaceMethods();
+        this.allowLocalVariableTypeInference = source.allowLocalVariableTypeInference();
         this.keepDocComments = keepDocComments;
         this.parseModuleInfo = parseModuleInfo;
         docComments = newDocCommentTable(keepDocComments, fac);
@@ -270,11 +271,14 @@
      */
     boolean allowThisIdent;
 
+    /** Switch: is local variable inference allowed?
+     */
+    boolean allowLocalVariableTypeInference;
+
     /** The type of the method receiver, as specified by a first "this" parameter.
      */
     JCVariableDecl receiverParam;
 
-
     /** When terms are parsed, the mode determines which is expected:
      *     mode = EXPR        : an expression
      *     mode = TYPE        : a type
@@ -808,12 +812,16 @@
      * parsing annotations.
      */
     public JCExpression parseType() {
+        return parseType(false);
+    }
+
+    public JCExpression parseType(boolean allowVar) {
         List<JCAnnotation> annotations = typeAnnotationsOpt();
-        return parseType(annotations);
+        return parseType(allowVar, annotations);
     }
 
-    public JCExpression parseType(List<JCAnnotation> annotations) {
-        JCExpression result = unannotatedType();
+    public JCExpression parseType(boolean allowVar, List<JCAnnotation> annotations) {
+        JCExpression result = unannotatedType(allowVar);
 
         if (annotations.nonEmpty()) {
             result = insertAnnotationsToMostInner(result, annotations, false);
@@ -822,10 +830,18 @@
         return result;
     }
 
-    public JCExpression unannotatedType() {
-        return term(TYPE);
+    public JCExpression unannotatedType(boolean allowVar) {
+        JCExpression result = term(TYPE);
+
+        if (!allowVar && isRestrictedLocalVarTypeName(result)) {
+            syntaxError(result.pos, "var.not.allowed.here");
+        }
+
+        return result;
     }
 
+
+
     protected JCExpression term(int newmode) {
         int prevmode = mode;
         mode = newmode;
@@ -1152,11 +1168,11 @@
                        accept(LPAREN);
                        mode = TYPE;
                        int pos1 = pos;
-                       List<JCExpression> targets = List.of(t = term3());
+                       List<JCExpression> targets = List.of(t = parseType());
                        while (token.kind == AMP) {
                            checkIntersectionTypesInCast();
                            accept(AMP);
-                           targets = targets.prepend(term3());
+                           targets = targets.prepend(parseType());
                        }
                        if (targets.length() > 1) {
                            t = toP(F.at(pos1).TypeIntersection(targets.reverse()));
@@ -1912,7 +1928,7 @@
      */
     JCExpression typeArgument() {
         List<JCAnnotation> annotations = typeAnnotationsOpt();
-        if (token.kind != QUES) return parseType(annotations);
+        if (token.kind != QUES) return parseType(false, annotations);
         int pos = token.pos;
         nextToken();
         JCExpression result;
@@ -2425,13 +2441,8 @@
                 token.kind == ENUM) {
                 return List.of(classOrInterfaceOrEnumDeclaration(mods, dc));
             } else {
-                JCExpression t = parseType();
-                ListBuffer<JCStatement> stats =
-                        variableDeclarators(mods, t, new ListBuffer<JCStatement>());
-                // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
-                accept(SEMI);
-                storeEnd(stats.last(), S.prevToken().endPos);
-                return stats.toList();
+                JCExpression t = parseType(true);
+                return localVariableDeclarations(mods, t);
             }
         }
         case ABSTRACT: case STRICTFP: {
@@ -2458,12 +2469,7 @@
                 pos = token.pos;
                 JCModifiers mods = F.at(Position.NOPOS).Modifiers(0);
                 F.at(pos);
-                ListBuffer<JCStatement> stats =
-                        variableDeclarators(mods, t, new ListBuffer<JCStatement>());
-                // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
-                accept(SEMI);
-                storeEnd(stats.last(), S.prevToken().endPos);
-                return stats.toList();
+                return localVariableDeclarations(mods, t);
             } else {
                 // This Exec is an "ExpressionStatement"; it subsumes the terminating semicolon
                 t = checkExprStat(t);
@@ -2473,6 +2479,15 @@
             }
         }
     }
+    //where
+        private List<JCStatement> localVariableDeclarations(JCModifiers mods, JCExpression type) {
+            ListBuffer<JCStatement> stats =
+                    variableDeclarators(mods, type, new ListBuffer<>(), true);
+            // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon
+            accept(SEMI);
+            storeEnd(stats.last(), S.prevToken().endPos);
+            return stats.toList();
+        }
 
     /** Statement =
      *       Block
@@ -2766,11 +2781,11 @@
         ListBuffer<JCStatement> stats = new ListBuffer<>();
         int pos = token.pos;
         if (token.kind == FINAL || token.kind == MONKEYS_AT) {
-            return variableDeclarators(optFinal(0), parseType(), stats).toList();
+            return variableDeclarators(optFinal(0), parseType(true), stats, true).toList();
         } else {
             JCExpression t = term(EXPR | TYPE);
             if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) {
-                return variableDeclarators(modifiersOpt(), t, stats).toList();
+                return variableDeclarators(modifiersOpt(), t, stats, true).toList();
             } else if ((lastmode & TYPE) != 0 && token.kind == COLON) {
                 error(pos, "bad.initializer", "for-loop");
                 return List.of((JCStatement)F.at(pos).VarDef(null, null, t, null));
@@ -2989,9 +3004,10 @@
      */
     public <T extends ListBuffer<? super JCVariableDecl>> T variableDeclarators(JCModifiers mods,
                                                                          JCExpression type,
-                                                                         T vdefs)
+                                                                         T vdefs,
+                                                                         boolean localDecl)
     {
-        return variableDeclaratorsRest(token.pos, mods, type, ident(), false, null, vdefs);
+        return variableDeclaratorsRest(token.pos, mods, type, ident(), false, null, vdefs, localDecl);
     }
 
     /** VariableDeclaratorsRest = VariableDeclaratorRest { "," VariableDeclarator }
@@ -3006,14 +3022,20 @@
                                                                      Name name,
                                                                      boolean reqInit,
                                                                      Comment dc,
-                                                                     T vdefs)
+                                                                     T vdefs,
+                                                                     boolean localDecl)
     {
-        vdefs.append(variableDeclaratorRest(pos, mods, type, name, reqInit, dc));
+        JCVariableDecl head = variableDeclaratorRest(pos, mods, type, name, reqInit, dc, localDecl);
+        boolean implicit = allowLocalVariableTypeInference && head.vartype == null;
+        vdefs.append(head);
         while (token.kind == COMMA) {
+            if (implicit) {
+                reportSyntaxError(pos, "var.not.allowed.compound");
+            }
             // All but last of multiple declarators subsume a comma
             storeEnd((JCTree)vdefs.last(), token.endPos);
             nextToken();
-            vdefs.append(variableDeclarator(mods, type, reqInit, dc));
+            vdefs.append(variableDeclarator(mods, type, reqInit, dc, localDecl));
         }
         return vdefs;
     }
@@ -3021,8 +3043,8 @@
     /** VariableDeclarator = Ident VariableDeclaratorRest
      *  ConstantDeclarator = Ident ConstantDeclaratorRest
      */
-    JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, Comment dc) {
-        return variableDeclaratorRest(token.pos, mods, type, ident(), reqInit, dc);
+    JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, Comment dc, boolean localDecl) {
+        return variableDeclaratorRest(token.pos, mods, type, ident(), reqInit, dc, localDecl);
     }
 
     /** VariableDeclaratorRest = BracketsOpt ["=" VariableInitializer]
@@ -3032,7 +3054,7 @@
      *  @param dc       The documentation comment for the variable declarations, or null.
      */
     JCVariableDecl variableDeclaratorRest(int pos, JCModifiers mods, JCExpression type, Name name,
-                                  boolean reqInit, Comment dc) {
+                                  boolean reqInit, Comment dc, boolean localDecl) {
         type = bracketsOpt(type);
         JCExpression init = null;
         if (token.kind == EQ) {
@@ -3040,12 +3062,40 @@
             init = variableInitializer();
         }
         else if (reqInit) syntaxError(token.pos, "expected", EQ);
+        JCTree elemType = TreeInfo.innermostType(type, true);
+        if (allowLocalVariableTypeInference && elemType.hasTag(IDENT)) {
+            Name typeName = ((JCIdent)elemType).name;
+            if (isRestrictedLocalVarTypeName(typeName)) {
+                if (type.hasTag(TYPEARRAY)) {
+                    //error - 'var' and arrays
+                    reportSyntaxError(pos, "var.not.allowed.array");
+                } else {
+                    //implicit type
+                    type = null;
+                }
+            }
+        }
         JCVariableDecl result =
             toP(F.at(pos).VarDef(mods, name, type, init));
         attach(result, dc);
         return result;
     }
 
+    boolean isRestrictedLocalVarTypeName(JCExpression e) {
+        switch (e.getTag()) {
+            case IDENT:
+                return isRestrictedLocalVarTypeName(((JCIdent)e).name);
+            case TYPEARRAY:
+                return isRestrictedLocalVarTypeName(((JCArrayTypeTree)e).elemtype);
+            default:
+                return false;
+        }
+    }
+
+    boolean isRestrictedLocalVarTypeName(Name name) {
+        return allowLocalVariableTypeInference && name == names.var;
+    }
+
     /** VariableDeclaratorId = Ident BracketsOpt
      */
     JCVariableDecl variableDeclaratorId(JCModifiers mods, JCExpression type) {
@@ -3111,13 +3161,13 @@
         int startPos = token.pos;
         if (token.kind == FINAL || token.kind == MONKEYS_AT) {
             JCModifiers mods = optFinal(Flags.FINAL);
-            JCExpression t = parseType();
-            return variableDeclaratorRest(token.pos, mods, t, ident(), true, null);
+            JCExpression t = parseType(true);
+            return variableDeclaratorRest(token.pos, mods, t, ident(), true, null, true);
         }
         JCExpression t = term(EXPR | TYPE);
         if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) {
             JCModifiers mods = toP(F.at(startPos).Modifiers(Flags.FINAL));
-            return variableDeclaratorRest(token.pos, mods, t, ident(), true, null);
+            return variableDeclaratorRest(token.pos, mods, t, ident(), true, null, true);
         } else {
             checkVariableInTryWithResources(startPos);
             if (!t.hasTag(IDENT) && !t.hasTag(SELECT)) {
@@ -3152,10 +3202,9 @@
             nextToken();
             JCExpression pid = qualident(false);
             accept(SEMI);
-            JCPackageDecl pd = F.at(packagePos).PackageDecl(annotations, pid);
+            JCPackageDecl pd = toP(F.at(packagePos).PackageDecl(annotations, pid));
             attach(pd, firstToken.comment(CommentStyle.JAVADOC));
             consumedToplevelDoc = true;
-            storeEnd(pd, token.pos);
             defs.append(pd);
         }
 
@@ -3398,7 +3447,7 @@
     protected JCClassDecl classDeclaration(JCModifiers mods, Comment dc) {
         int pos = token.pos;
         accept(CLASS);
-        Name name = ident();
+        Name name = typeName();
 
         List<JCTypeParameter> typarams = typeParametersOpt();
 
@@ -3419,6 +3468,15 @@
         return result;
     }
 
+    Name typeName() {
+        int pos = token.pos;
+        Name name = ident();
+        if (isRestrictedLocalVarTypeName(name)) {
+            reportSyntaxError(pos, "var.not.allowed", name);
+        }
+        return name;
+    }
+
     /** InterfaceDeclaration = INTERFACE Ident TypeParametersOpt
      *                         [EXTENDS TypeList] InterfaceBody
      *  @param mods    The modifiers starting the interface declaration
@@ -3427,7 +3485,8 @@
     protected JCClassDecl interfaceDeclaration(JCModifiers mods, Comment dc) {
         int pos = token.pos;
         accept(INTERFACE);
-        Name name = ident();
+
+        Name name = typeName();
 
         List<JCTypeParameter> typarams = typeParametersOpt();
 
@@ -3450,7 +3509,8 @@
     protected JCClassDecl enumDeclaration(JCModifiers mods, Comment dc) {
         int pos = token.pos;
         accept(ENUM);
-        Name name = ident();
+
+        Name name = typeName();
 
         List<JCExpression> implementing = List.nil();
         if (token.kind == IMPLEMENTS) {
@@ -3648,7 +3708,7 @@
                     nextToken();
                 } else {
                     // method returns types are un-annotated types
-                    type = unannotatedType();
+                    type = unannotatedType(false);
                 }
                 if (token.kind == LPAREN && !isInterface && type.hasTag(IDENT)) {
                     if (isInterface || tk.name() != className)
@@ -3668,7 +3728,7 @@
                     } else if (!isVoid && typarams.isEmpty()) {
                         List<JCTree> defs =
                             variableDeclaratorsRest(pos, mods, type, name, isInterface, dc,
-                                                    new ListBuffer<JCTree>()).toList();
+                                                    new ListBuffer<JCTree>(), false).toList();
                         accept(SEMI);
                         storeEnd(defs.last(), S.prevToken().endPos);
                         return defs;
@@ -3810,7 +3870,7 @@
     JCTypeParameter typeParameter() {
         int pos = token.pos;
         List<JCAnnotation> annos = typeAnnotationsOpt();
-        Name name = ident();
+        Name name = typeName();
         ListBuffer<JCExpression> bounds = new ListBuffer<>();
         if (token.kind == EXTENDS) {
             nextToken();
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Sep 28 09:13:27 2017 -0700
@@ -1190,6 +1190,47 @@
 compiler.err.undef.label=\
     undefined label: {0}
 
+# 0: name (type)
+compiler.err.illegal.ref.to.var.type=\
+    illegal reference to restricted type ''{0}''
+
+# 0: token
+compiler.err.var.not.allowed=\
+    ''{0}'' not allowed here\n\
+    as of release 10, ''{0}'' is a restricted local variable type and cannot be used for type declarations
+
+# 0: name (variable), 1: message segment
+compiler.err.cant.infer.local.var.type=\
+    cannot infer type for local variable {0}\n\
+    ({1})
+
+compiler.err.var.not.allowed.here=\
+    ''var'' is not allowed here
+
+compiler.err.var.not.allowed.array=\
+    ''var'' is not allowed as an element type of an array
+
+compiler.err.var.not.allowed.compound=\
+    ''var'' is not allowed in a compound declaration
+
+compiler.misc.local.cant.infer.null=\
+    variable initializer is ''null''
+
+compiler.misc.local.missing.init=\
+    cannot use ''var'' on variable without initializer
+
+compiler.misc.local.lambda.missing.target=\
+    lambda expression needs an explicit target-type
+
+compiler.misc.local.mref.missing.target=\
+    method reference needs an explicit target-type
+
+compiler.misc.local.array.missing.target=\
+    array initializer needs an explicit target-type
+
+compiler.misc.local.self.ref=\
+    cannot use ''var'' on self-referencing variable
+
 # 0: message segment, 1: unused
 compiler.err.cant.apply.diamond=\
     cannot infer type arguments for {0}
@@ -1873,6 +1914,9 @@
 compiler.warn.diamond.redundant.args=\
     Redundant type arguments in new expression (use diamond operator instead).
 
+compiler.warn.local.redundant.type=\
+    Redundant type for local variable (replace explicit type with ''var'').
+
 compiler.warn.potential.lambda.found=\
     This anonymous inner class creation can be turned into a lambda expression.
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java	Thu Sep 28 09:13:27 2017 -0700
@@ -946,6 +946,10 @@
             }
         }
 
+        public boolean isImplicitlyTyped() {
+            return vartype == null;
+        }
+
         @Override
         public void accept(Visitor v) { v.visitVarDef(this); }
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1359,7 +1359,7 @@
 
     // Prints the inner element type of a nested array
     private void printBaseElementType(JCTree tree) throws IOException {
-        printExpr(TreeInfo.innermostType(tree));
+        printExpr(TreeInfo.innermostType(tree, false));
     }
 
     // prints the brackets of a nested array in reverse order
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1136,7 +1136,7 @@
      * For an array that contains an annotated type, return that annotated type.
      * TODO: currently only used by Pretty. Describe behavior better.
      */
-    public static JCTree innermostType(JCTree type) {
+    public static JCTree innermostType(JCTree type, boolean skipAnnos) {
         JCTree lastAnnotatedType = null;
         JCTree cur = type;
         loop: while (true) {
@@ -1157,7 +1157,7 @@
                 break loop;
             }
         }
-        if (lastAnnotatedType!=null) {
+        if (!skipAnnos && lastAnnotatedType!=null) {
             return lastAnnotatedType;
         } else {
             return cur;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java	Thu Sep 28 09:13:27 2017 -0700
@@ -63,6 +63,7 @@
     public final Name _default;
     public final Name _super;
     public final Name _this;
+    public final Name var;
     public final Name exports;
     public final Name opens;
     public final Name module;
@@ -224,6 +225,7 @@
         _default = fromString("default");
         _super = fromString("super");
         _this = fromString("this");
+        var = fromString("var");
         exports = fromString("exports");
         opens = fromString("opens");
         module = fromString("module");
--- a/src/jdk.compiler/share/classes/module-info.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.compiler/share/classes/module-info.java	Thu Sep 28 09:13:27 2017 -0700
@@ -106,7 +106,8 @@
     exports com.sun.tools.javac.jvm to
         jdk.javadoc;
     exports com.sun.tools.javac.main to
-        jdk.javadoc;
+        jdk.javadoc,
+        jdk.jshell;
     exports com.sun.tools.javac.model to
         jdk.javadoc;
     exports com.sun.tools.javac.parser to
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java	Thu Sep 28 09:13:27 2017 -0700
@@ -1212,7 +1212,6 @@
 
             CallbackHandler myHandler = getCallbackHandler(handler);
             if (myHandler == null) {
-                // XXX PolicyTool is dependent on this message text
                 throw new LoginException
                         ("no password provided, and no callback handler " +
                         "available for retrieving password");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.jartool/share/classes/jdk/security/jarsigner/package-info.java	Thu Sep 28 09:13:27 2017 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * This package defines APIs for signing jar files.
+ */
+package jdk.security.jarsigner;
--- a/src/jdk.jartool/share/classes/module-info.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jartool/share/classes/module-info.java	Thu Sep 28 09:13:27 2017 -0700
@@ -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
@@ -27,6 +27,7 @@
  * Defines tools for manipulating Java Archive (JAR) files,
  * including the <em>{@index jar jar tool}</em> and
  * <em>{@index jarsigner jarsigner tool}</em> tools.
+ * This module also defines APIs for signing JAR files.
  *
  * <p> This module provides the equivalent of command-line access to
  * <em>jar</em> via the {@link java.util.spi.ToolProvider ToolProvider} SPI.
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java	Thu Sep 28 09:13:27 2017 -0700
@@ -39,6 +39,7 @@
 import javax.lang.model.type.TypeVariable;
 import javax.lang.model.util.SimpleTypeVisitor9;
 
+import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.toolkit.Content;
@@ -199,55 +200,61 @@
      */
     protected void addParameters(ExecutableElement member,
             boolean includeAnnotations, Content htmltree, int indentSize) {
-        htmltree.addContent(Contents.ZERO_WIDTH_SPACE);
-        htmltree.addContent("(");
+        Content paramTree = new ContentBuilder();
         String sep = "";
         List<? extends VariableElement> parameters = member.getParameters();
         CharSequence indent = makeSpace(indentSize + 1);
         TypeMirror rcvrType = member.getReceiverType();
         if (includeAnnotations && rcvrType != null && utils.isAnnotated(rcvrType)) {
             List<? extends AnnotationMirror> annotationMirrors = rcvrType.getAnnotationMirrors();
-            addReceiverAnnotations(member, rcvrType, annotationMirrors, htmltree);
+            addReceiverAnnotations(member, rcvrType, annotationMirrors, paramTree);
             sep = "," + DocletConstants.NL + indent;
         }
         int paramstart;
         for (paramstart = 0; paramstart < parameters.size(); paramstart++) {
-            htmltree.addContent(sep);
+            paramTree.addContent(sep);
             VariableElement param = parameters.get(paramstart);
 
             if (param.getKind() != ElementKind.INSTANCE_INIT) {
                 if (includeAnnotations) {
                     boolean foundAnnotations =
                             writer.addAnnotationInfo(indent.length(),
-                            member, param, htmltree);
+                            member, param, paramTree);
                     if (foundAnnotations) {
-                        htmltree.addContent(DocletConstants.NL);
-                        htmltree.addContent(indent);
+                        paramTree.addContent(DocletConstants.NL);
+                        paramTree.addContent(indent);
                     }
                 }
                 addParam(member, param,
-                    (paramstart == parameters.size() - 1) && member.isVarArgs(), htmltree);
+                    (paramstart == parameters.size() - 1) && member.isVarArgs(), paramTree);
                 break;
             }
         }
 
         for (int i = paramstart + 1; i < parameters.size(); i++) {
-            htmltree.addContent(",");
-            htmltree.addContent(DocletConstants.NL);
-            htmltree.addContent(indent);
+            paramTree.addContent(",");
+            paramTree.addContent(DocletConstants.NL);
+            paramTree.addContent(indent);
             if (includeAnnotations) {
                 boolean foundAnnotations =
                         writer.addAnnotationInfo(indent.length(), member, parameters.get(i),
-                        htmltree);
+                        paramTree);
                 if (foundAnnotations) {
-                    htmltree.addContent(DocletConstants.NL);
-                    htmltree.addContent(indent);
+                    paramTree.addContent(DocletConstants.NL);
+                    paramTree.addContent(indent);
                 }
             }
             addParam(member, parameters.get(i), (i == parameters.size() - 1) && member.isVarArgs(),
-                    htmltree);
+                    paramTree);
         }
-        htmltree.addContent(")");
+        if (paramTree.isEmpty()) {
+            htmltree.addContent("()");
+        } else {
+            htmltree.addContent(Contents.ZERO_WIDTH_SPACE);
+            htmltree.addContent("(");
+            htmltree.addContent(paramTree);
+            paramTree.addContent(")");
+        }
     }
 
     /**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java	Thu Sep 28 09:13:27 2017 -0700
@@ -364,7 +364,7 @@
         List<? extends DocTree> tags;
         Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(element));
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
-        div.addStyle(HtmlStyle.block);
+        div.addStyle(HtmlStyle.deprecationBlock);
         if (utils.isDeprecated(element)) {
             div.addContent(span);
             tags = utils.getBlockTags(element, DocTree.Kind.DEPRECATED);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java	Thu Sep 28 09:13:27 2017 -0700
@@ -355,7 +355,7 @@
             writer.getTagletWriterInstance(false));
         if (!output.isEmpty()) {
             Content deprecatedContent = output;
-            Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent);
+            Content div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprecatedContent);
             contentTree.addContent(div);
         }
     }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Thu Sep 28 09:13:27 2017 -0700
@@ -278,7 +278,8 @@
      */
     @Override
     public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree) {
-        annotationInfoTree.addContent(new HtmlTree(HtmlTag.BR));
+        Content hr = new HtmlTree(HtmlTag.HR);
+        annotationInfoTree.addContent(hr);
         Content pre = new HtmlTree(HtmlTag.PRE);
         addAnnotationInfo(annotationType, pre);
         pre.addContent(modifiers);
@@ -324,13 +325,11 @@
      */
     @Override
     public void addAnnotationTypeDeprecationInfo(Content annotationInfoTree) {
-        Content hr = new HtmlTree(HtmlTag.HR);
-        annotationInfoTree.addContent(hr);
         List<? extends DocTree> deprs = utils.getBlockTags(annotationType, DocTree.Kind.DEPRECATED);
         if (utils.isDeprecated(annotationType)) {
             CommentHelper ch = utils.getCommentHelper(annotationType);
             Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(annotationType));
-            Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
+            Content div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprLabel);
             if (!deprs.isEmpty()) {
 
                 List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Thu Sep 28 09:13:27 2017 -0700
@@ -293,7 +293,8 @@
      */
     @Override
     public void addClassSignature(String modifiers, Content classInfoTree) {
-        classInfoTree.addContent(new HtmlTree(HtmlTag.BR));
+        Content hr = new HtmlTree(HtmlTag.HR);
+        classInfoTree.addContent(hr);
         Content pre = new HtmlTree(HtmlTag.PRE);
         addAnnotationInfo(typeElement, pre);
         pre.addContent(modifiers);
@@ -606,12 +607,10 @@
      */
     @Override
     public void addClassDeprecationInfo(Content classInfoTree) {
-        Content hr = new HtmlTree(HtmlTag.HR);
-        classInfoTree.addContent(hr);
         List<? extends DocTree> deprs = utils.getBlockTags(typeElement, DocTree.Kind.DEPRECATED);
         if (utils.isDeprecated(typeElement)) {
             Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(typeElement));
-            Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
+            Content div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprLabel);
             if (!deprs.isEmpty()) {
                 CommentHelper ch = utils.getCommentHelper(typeElement);
                 DocTree dt = deprs.get(0);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java	Thu Sep 28 09:13:27 2017 -0700
@@ -139,11 +139,6 @@
     }
 
     @Override
-    protected Content getTypeAnnotationLink(LinkInfo linkInfo, AnnotationMirror annotation) {
-        throw new RuntimeException("Not implemented yet!");
-    }
-
-    @Override
     public Content getTypeAnnotationLinks(LinkInfo linkInfo) {
         Utils utils = ((LinkInfoImpl)linkInfo).utils;
         ContentBuilder links = new ContentBuilder();
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Thu Sep 28 09:13:27 2017 -0700
@@ -929,7 +929,7 @@
         if (utils.isDeprecated(mdle)) {
             CommentHelper ch = utils.getCommentHelper(mdle);
             HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
-            deprDiv.addStyle(HtmlStyle.deprecatedContent);
+            deprDiv.addStyle(HtmlStyle.deprecationBlock);
             Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(mdle));
             deprDiv.addContent(deprPhrase);
             if (!deprs.isEmpty()) {
@@ -1064,7 +1064,7 @@
         if (utils.isDeprecated(pkg)) {
             deprs = utils.getDeprecatedTrees(pkg);
             HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
-            deprDiv.addStyle(HtmlStyle.deprecatedContent);
+            deprDiv.addStyle(HtmlStyle.deprecationBlock);
             Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(pkg));
             deprDiv.addContent(deprPhrase);
             if (!deprs.isEmpty()) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Thu Sep 28 09:13:27 2017 -0700
@@ -171,7 +171,7 @@
         if (utils.isDeprecated(packageElement)) {
             CommentHelper ch = utils.getCommentHelper(packageElement);
             HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
-            deprDiv.addStyle(HtmlStyle.deprecatedContent);
+            deprDiv.addStyle(HtmlStyle.deprecationBlock);
             Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(packageElement));
             deprDiv.addContent(deprPhrase);
             if (!deprs.isEmpty()) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java	Thu Sep 28 09:13:27 2017 -0700
@@ -53,9 +53,9 @@
     constantsSummary,
     constantValuesContainer,
     contentContainer,
-    deprecatedContent,
     deprecatedLabel,
     deprecatedSummary,
+    deprecationBlock,
     deprecationComment,
     description,
     descfrmTypeLabel,
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java	Thu Sep 28 09:13:27 2017 -0700
@@ -147,8 +147,8 @@
             throws DocletException {
         Content annotationInfoTree = writer.getAnnotationInfoTreeHeader();
 
+        buildAnnotationTypeSignature(annotationInfoTree);
         buildDeprecationInfo(annotationInfoTree);
-        buildAnnotationTypeSignature(annotationInfoTree);
         buildAnnotationTypeDescription(annotationInfoTree);
         buildAnnotationTypeTagInfo(annotationInfoTree);
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java	Thu Sep 28 09:13:27 2017 -0700
@@ -175,8 +175,8 @@
         buildInterfaceUsageInfo(classInfoTree);
         buildNestedClassInfo(classInfoTree);
         buildFunctionalInterfaceInfo(classInfoTree);
+        buildClassSignature(classInfoTree);
         buildDeprecationInfo(classInfoTree);
-        buildClassSignature(classInfoTree);
         buildClassDescription(classInfoTree);
         buildClassTagInfo(classInfoTree);
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Thu Sep 28 09:13:27 2017 -0700
@@ -645,6 +645,17 @@
 .deprecationComment, .emphasizedPhrase, .interfaceName {
     font-style:italic;
 }
+.deprecationBlock {
+    font-size:14px;
+    font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif;
+    border-style:solid;
+    border-width:thin;
+    border-radius:10px;
+    padding:10px;
+    margin-bottom:10px;
+    margin-right:10px;
+    display:inline-block;
+}
 
 div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase,
 div.block div.block span.interfaceName {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java	Thu Sep 28 09:13:27 2017 -0700
@@ -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
@@ -223,8 +223,6 @@
      */
     protected abstract Content getTypeParameterLink(LinkInfo linkInfo, TypeMirror typeParam);
 
-    protected abstract Content getTypeAnnotationLink(LinkInfo linkInfo, AnnotationMirror annotation);
-
     /**
      * Return the links to the type parameters.
      *
@@ -282,23 +280,5 @@
         return links;
     }
 
-    public Content getTypeAnnotationLinks(LinkInfo linkInfo) {
-        Utils utils = ((LinkInfoImpl)linkInfo).utils;
-        Content links = newContent();
-        if (!utils.isAnnotated(linkInfo.type))
-            return links;
-
-        List<? extends AnnotationMirror> annotations = linkInfo.type.getAnnotationMirrors();
-        boolean needSpace = false;
-        for (AnnotationMirror anno : annotations) {
-            if (needSpace) {
-                links.addContent(" ");
-            }
-            links.addContent(getTypeAnnotationLink(linkInfo, anno));
-            needSpace = true;
-        }
-
-        links.addContent(" ");
-        return links;
-    }
+    public abstract Content getTypeAnnotationLinks(LinkInfo linkInfo);
 }
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java	Thu Sep 28 09:13:27 2017 -0700
@@ -285,7 +285,9 @@
             String mn = mref.descriptor().name();
             URI location = mref.location().orElseThrow(FileNotFoundException::new);
             ModuleDescriptor md = mref.descriptor();
-            Module.Builder builder = new Module.Builder(md, system.find(mn).isPresent());
+            // is this module from the system module path?
+            URI loc = system.find(mn).flatMap(ModuleReference::location).orElse(null);
+            boolean isSystem = location.equals(loc);
 
             final ClassFileReader reader;
             if (location.getScheme().equals("jrt")) {
@@ -293,7 +295,7 @@
             } else {
                 reader = ClassFileReader.newInstance(Paths.get(location), version);
             }
-
+            Module.Builder builder = new Module.Builder(md, isSystem);
             builder.classes(reader);
             builder.location(location);
 
--- a/src/jdk.jshell/share/classes/jdk/jshell/Eval.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/Eval.java	Thu Sep 28 09:13:27 2017 -0700
@@ -40,6 +40,7 @@
 import com.sun.source.tree.IdentifierTree;
 import com.sun.source.tree.MethodTree;
 import com.sun.source.tree.ModifiersTree;
+import com.sun.source.tree.NewClassTree;
 import com.sun.source.tree.Tree;
 import com.sun.source.tree.VariableTree;
 import com.sun.tools.javac.tree.JCTree;
@@ -59,6 +60,7 @@
 import jdk.jshell.TaskFactory.BaseTask;
 import jdk.jshell.TaskFactory.CompileTask;
 import jdk.jshell.TaskFactory.ParseTask;
+import jdk.jshell.Wrap.CompoundWrap;
 import jdk.jshell.Wrap.Range;
 import jdk.jshell.Snippet.Status;
 import jdk.jshell.spi.ExecutionControl.ClassBytecodes;
@@ -274,26 +276,119 @@
         for (Tree unitTree : units) {
             VariableTree vt = (VariableTree) unitTree;
             String name = vt.getName().toString();
-            String typeName = EvalPretty.prettyExpr((JCTree) vt.getType(), false);
+            String typeName;
+            String fullTypeName;
+            TreeDependencyScanner tds = new TreeDependencyScanner();
+            Wrap typeWrap;
+            Wrap anonDeclareWrap = null;
+            Wrap winit = null;
+            StringBuilder sbBrackets = new StringBuilder();
             Tree baseType = vt.getType();
-            TreeDependencyScanner tds = new TreeDependencyScanner();
-            tds.scan(baseType); // Not dependent on initializer
-            StringBuilder sbBrackets = new StringBuilder();
-            while (baseType instanceof ArrayTypeTree) {
-                //TODO handle annotations too
-                baseType = ((ArrayTypeTree) baseType).getType();
-                sbBrackets.append("[]");
+            if (baseType != null) {
+                tds.scan(baseType); // Not dependent on initializer
+                fullTypeName = typeName = EvalPretty.prettyExpr((JCTree) vt.getType(), false);
+                while (baseType instanceof ArrayTypeTree) {
+                    //TODO handle annotations too
+                    baseType = ((ArrayTypeTree) baseType).getType();
+                    sbBrackets.append("[]");
+                }
+                Range rtype = dis.treeToRange(baseType);
+                typeWrap = Wrap.rangeWrap(compileSource, rtype);
+            } else {
+                Tree init = vt.getInitializer();
+                if (init != null) {
+                    Range rinit = dis.treeToRange(init);
+                    String initCode = rinit.part(compileSource);
+                    ExpressionInfo ei =
+                            ExpressionToTypeInfo.localVariableTypeForInitializer(initCode, state);
+                    typeName = ei == null ? "java.lang.Object" : ei.typeName;
+                    fullTypeName = ei == null ? "java.lang.Object" : ei.fullTypeName;
+                    if (ei != null && init.getKind() == Tree.Kind.NEW_CLASS &&
+                        ((NewClassTree) init).getClassBody() != null) {
+                        NewClassTree nct = (NewClassTree) init;
+                        StringBuilder constructor = new StringBuilder();
+                        constructor.append(fullTypeName).append("(");
+                        String sep = "";
+                        if (ei.enclosingInstanceType != null) {
+                            constructor.append(ei.enclosingInstanceType);
+                            constructor.append(" encl");
+                            sep = ", ";
+                        }
+                        int idx = 0;
+                        for (String type : ei.parameterTypes) {
+                            constructor.append(sep);
+                            constructor.append(type);
+                            constructor.append(" ");
+                            constructor.append("arg" + idx++);
+                            sep = ", ";
+                        }
+                        if (ei.enclosingInstanceType != null) {
+                            constructor.append(") { encl.super (");
+                        } else {
+                            constructor.append(") { super (");
+                        }
+                        sep = "";
+                        for (int i = 0; i < idx; i++) {
+                            constructor.append(sep);
+                            constructor.append("arg" + i++);
+                            sep = ", ";
+                        }
+                        constructor.append("); }");
+                        List<? extends Tree> members = nct.getClassBody().getMembers();
+                        Range bodyRange = dis.treeListToRange(members);
+                        Wrap bodyWrap;
+
+                        if (bodyRange != null) {
+                            bodyWrap = Wrap.rangeWrap(compileSource, bodyRange);
+                        } else {
+                            bodyWrap = Wrap.simpleWrap(" ");
+                        }
+
+                        Range argRange = dis.treeListToRange(nct.getArguments());
+                        Wrap argWrap;
+
+                        if (argRange != null) {
+                            argWrap = Wrap.rangeWrap(compileSource, argRange);
+                        } else {
+                            argWrap = Wrap.simpleWrap(" ");
+                        }
+
+                        if (ei.enclosingInstanceType != null) {
+                            Range enclosingRanges =
+                                    dis.treeToRange(nct.getEnclosingExpression());
+                            Wrap enclosingWrap = Wrap.rangeWrap(compileSource, enclosingRanges);
+                            argWrap = argRange != null ? new CompoundWrap(enclosingWrap,
+                                                                          Wrap.simpleWrap(","),
+                                                                          argWrap)
+                                                       : enclosingWrap;
+                        }
+                        Wrap hwrap = Wrap.simpleWrap("public static class " + fullTypeName +
+                                                     (ei.isClass ? " extends " : " implements ") +
+                                                     typeName + " { " + constructor);
+                        anonDeclareWrap = new CompoundWrap(hwrap, bodyWrap, Wrap.simpleWrap("}"));
+                        winit = new CompoundWrap("new " + fullTypeName + "(", argWrap, ")");
+
+                        String superType = typeName;
+
+                        typeName = fullTypeName;
+                        fullTypeName = ei.isClass ? "<anonymous class extending " + superType + ">"
+                                                  : "<anonymous class implementing " + superType + ">";
+                    }
+                    tds.scan(init);
+                } else {
+                    fullTypeName = typeName = "java.lang.Object";
+                }
+                typeWrap = Wrap.identityWrap(typeName);
             }
-            Range rtype = dis.treeToRange(baseType);
             Range runit = dis.treeToRange(vt);
             runit = new Range(runit.begin, runit.end - 1);
             ExpressionTree it = vt.getInitializer();
-            Range rinit = null;
             int nameMax = runit.end - 1;
             SubKind subkind;
             if (it != null) {
                 subkind = SubKind.VAR_DECLARATION_WITH_INITIALIZER_SUBKIND;
-                rinit = dis.treeToRange(it);
+                Range rinit = dis.treeToRange(it);
+                winit = winit == null ? Wrap.rangeWrap(compileSource, rinit) : winit;
                 nameMax = rinit.begin - 1;
             } else {
                 subkind = SubKind.VAR_DECLARATION_SUBKIND;
@@ -304,10 +399,11 @@
             }
             int nameEnd = nameStart + name.length();
             Range rname = new Range(nameStart, nameEnd);
-            Wrap guts = Wrap.varWrap(compileSource, rtype, sbBrackets.toString(), rname, rinit);
-            DiagList modDiag = modifierDiagnostics(vt.getModifiers(), dis, true);
+            Wrap guts = Wrap.varWrap(compileSource, typeWrap, sbBrackets.toString(), rname,
+                                     winit, anonDeclareWrap);
+                        DiagList modDiag = modifierDiagnostics(vt.getModifiers(), dis, true);
             Snippet snip = new VarSnippet(state.keyMap.keyForVariable(name), userSource, guts,
-                    name, subkind, typeName,
+                    name, subkind, fullTypeName,
                     tds.declareReferences(), modDiag);
             snippets.add(snip);
         }
--- a/src/jdk.jshell/share/classes/jdk/jshell/ExpressionToTypeInfo.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/ExpressionToTypeInfo.java	Thu Sep 28 09:13:27 2017 -0700
@@ -29,14 +29,20 @@
 import com.sun.source.tree.ClassTree;
 import com.sun.source.tree.CompilationUnitTree;
 import com.sun.source.tree.ConditionalExpressionTree;
+import com.sun.source.tree.ExpressionStatementTree;
 import com.sun.source.tree.ExpressionTree;
+import com.sun.source.tree.MethodInvocationTree;
 import com.sun.source.tree.MethodTree;
+import com.sun.source.tree.NewClassTree;
 import com.sun.source.tree.Tree;
+import com.sun.source.tree.Tree.Kind;
+import com.sun.source.tree.VariableTree;
 import com.sun.source.util.TreePath;
 import com.sun.source.util.TreePathScanner;
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Types;
+import com.sun.tools.javac.util.List;
 import jdk.jshell.TaskFactory.AnalyzeTask;
 
 /**
@@ -63,6 +69,10 @@
     public static class ExpressionInfo {
         ExpressionTree tree;
         String typeName;
+        String fullTypeName;
+        List<String> parameterTypes;
+        String enclosingInstanceType;
+        boolean isClass;
         boolean isNonVoid;
     }
 
@@ -111,6 +121,16 @@
                 return null;
             }
         }
+
+        @Override
+        public TreePath visitVariable(VariableTree node, Boolean isTargetContext) {
+            if (isTargetContext) {
+                throw new Result(getCurrentPath());
+            } else {
+                return null;
+            }
+        }
+
     }
 
     private Type pathToType(TreePath tp) {
@@ -156,6 +176,30 @@
         }
     }
 
+    /**
+     * Entry method: get expression info corresponding to a local variable declaration if its type
+     * has been inferred automatically from the given initializer.
+     * @param code the initializer as a string
+     * @param state a JShell instance
+     * @return type information
+     */
+    public static ExpressionInfo localVariableTypeForInitializer(String code, JShell state) {
+        if (code == null || code.isEmpty()) {
+            return null;
+        }
+        try {
+            OuterWrap codeWrap = state.outerMap.wrapInTrialClass(Wrap.methodWrap("var $$$ = " + code));
+            AnalyzeTask at = state.taskFactory.new AnalyzeTask(codeWrap);
+            CompilationUnitTree cu = at.firstCuTree();
+            if (at.hasErrors() || cu == null) {
+                return null;
+            }
+            return new ExpressionToTypeInfo(at, cu, state).typeOfExpression();
+        } catch (Exception ex) {
+            return null;
+        }
+    }
+
     private ExpressionInfo typeOfExpression() {
         return treeToInfo(findExpressionPath());
     }
@@ -172,9 +216,11 @@
     private ExpressionInfo treeToInfo(TreePath tp) {
         if (tp != null) {
             Tree tree = tp.getLeaf();
-            if (tree instanceof ExpressionTree) {
+            boolean isExpression = tree instanceof ExpressionTree;
+            if (isExpression || tree.getKind() == Kind.VARIABLE) {
                 ExpressionInfo ei = new ExpressionInfo();
-                ei.tree = (ExpressionTree) tree;
+                if (isExpression)
+                    ei.tree = (ExpressionTree) tree;
                 Type type = pathToType(tp, tree);
                 if (type != null) {
                     switch (type.getKind()) {
@@ -189,27 +235,56 @@
                             break;
                         default: {
                             ei.isNonVoid = true;
-                            ei.typeName = varTypeName(type);
-                            if (ei.typeName == null) {
-                                ei.typeName = OBJECT_TYPE_NAME;
-                            }
+                            ei.typeName = varTypeName(type, false);
+                            ei.fullTypeName = varTypeName(type, true);
                             break;
                         }
                     }
                 }
+                if (tree.getKind() == Tree.Kind.VARIABLE) {
+                    Tree init = ((VariableTree) tree).getInitializer();
+                    if (init.getKind() == Tree.Kind.NEW_CLASS &&
+                        ((NewClassTree) init).getClassBody() != null) {
+                        NewClassTree nct = (NewClassTree) init;
+                        ClassTree clazz = nct.getClassBody();
+                        MethodTree constructor = (MethodTree) clazz.getMembers().get(0);
+                        ExpressionStatementTree superCallStatement =
+                                (ExpressionStatementTree) constructor.getBody().getStatements().get(0);
+                        MethodInvocationTree superCall =
+                                (MethodInvocationTree) superCallStatement.getExpression();
+                        TreePath superCallPath =
+                                at.trees().getPath(tp.getCompilationUnit(), superCall.getMethodSelect());
+                        Type constrType = pathToType(superCallPath);
+                        ei.parameterTypes = constrType.getParameterTypes()
+                                                      .stream()
+                                                      .map(t -> varTypeName(t, false))
+                                                      .collect(List.collector());
+                        if (nct.getEnclosingExpression() != null) {
+                            TreePath enclPath = new TreePath(tp, nct.getEnclosingExpression());
+                            ei.enclosingInstanceType = varTypeName(pathToType(enclPath), false);
+                        }
+                        ei.isClass = at.task.getTypes().directSupertypes(type).size() == 1;
+                    }
+                }
                 return ei;
             }
         }
         return null;
     }
 
-    private String varTypeName(Type type) {
+    private String varTypeName(Type type, boolean printIntersectionTypes) {
         try {
-            TypePrinter tp = new VarTypePrinter(at.messages(),
-                    state.maps::fullClassNameAndPackageToClass, syms, types);
-            return tp.toString(type);
+            TypePrinter tp = new TypePrinter(at.messages(),
+                    state.maps::fullClassNameAndPackageToClass, printIntersectionTypes);
+            List<Type> captures = types.captures(type);
+            String res = tp.toString(types.upward(type, captures));
+
+            if (res == null)
+                res = OBJECT_TYPE_NAME;
+
+            return res;
         } catch (Exception ex) {
-            return null;
+            return OBJECT_TYPE_NAME;
         }
     }
 
--- a/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java	Thu Sep 28 09:13:27 2017 -0700
@@ -232,7 +232,7 @@
                             //mods.flags |= Flags.STATIC;
                             List<JCTree> defs
                                     = variableDeclaratorsRest(pos, mods, t, name, false, dc,
-                                            new ListBuffer<JCTree>()).toList();
+                                            new ListBuffer<JCTree>(), true).toList();
                             accept(SEMI);
                             storeEnd(defs.last(), S.prevToken().endPos);
                             return defs;
--- a/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java	Thu Sep 28 09:13:27 2017 -0700
@@ -134,6 +134,8 @@
 
 import static java.util.stream.Collectors.joining;
 
+import javax.lang.model.type.IntersectionType;
+
 /**
  * The concrete implementation of SourceCodeAnalysis.
  * @author Robert Field
@@ -715,6 +717,13 @@
             return Collections.emptyList();
 
         switch (site.getKind()) {
+            case INTERSECTION: {
+                List<Element> result = new ArrayList<>();
+                for (TypeMirror bound : ((IntersectionType) site).getBounds()) {
+                    result.addAll(membersOf(at, bound, shouldGenerateDotClassItem));
+                }
+                return result;
+            }
             case DECLARED: {
                 TypeElement element = (TypeElement) at.getTypes().asElement(site);
                 List<Element> result = new ArrayList<>();
--- a/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java	Thu Sep 28 09:13:27 2017 -0700
@@ -61,7 +61,20 @@
 import javax.tools.FileObject;
 import jdk.jshell.MemoryFileManager.SourceMemoryJavaFileObject;
 import java.lang.Runtime.Version;
+import java.nio.CharBuffer;
 import com.sun.source.tree.Tree.Kind;
+import com.sun.tools.javac.code.Kinds;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.VarSymbol;
+import com.sun.tools.javac.parser.Parser;
+import com.sun.tools.javac.tree.JCTree.JCClassDecl;
+import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
+import com.sun.tools.javac.tree.JCTree.JCExpression;
+import com.sun.tools.javac.tree.JCTree.JCTypeCast;
+import com.sun.tools.javac.tree.JCTree.Tag;
+import com.sun.tools.javac.util.Context.Factory;
+import com.sun.tools.javac.util.Log.DiscardDiagnosticHandler;
+import jdk.jshell.Snippet.Status;
 
 /**
  * The primary interface to the compiler API.  Parsing, analysis, and
@@ -355,6 +368,7 @@
             Iterable<? extends JavaFileObject> compilationUnits = inputs
                             .map(in -> sh.sourceToFileObject(fileManager, in))
                             .collect(Collectors.toList());
+            JShellJavaCompiler.preRegister(context, state);
             this.task = (JavacTaskImpl) ((JavacTool) compiler).getTask(null,
                     fileManager, diagnostics, options, null,
                     compilationUnits, context);
@@ -464,4 +478,57 @@
         }
     }
 
+    private static final class JShellJavaCompiler extends com.sun.tools.javac.main.JavaCompiler {
+
+        public static void preRegister(Context c, JShell state) {
+            c.put(compilerKey, (Factory<com.sun.tools.javac.main.JavaCompiler>) i -> new JShellJavaCompiler(i, state));
+        }
+
+        private final JShell state;
+
+        public JShellJavaCompiler(Context context, JShell state) {
+            super(context);
+            this.state = state;
+        }
+
+        @Override
+        public void processAnnotations(com.sun.tools.javac.util.List<JCCompilationUnit> roots, Collection<String> classnames) {
+            super.processAnnotations(roots, classnames);
+            state.maps
+                 .snippetList()
+                 .stream()
+                 .filter(s -> s.status() == Status.VALID)
+                 .filter(s -> s.kind() == Snippet.Kind.VAR)
+                 .filter(s -> s.subKind() == Snippet.SubKind.VAR_DECLARATION_WITH_INITIALIZER_SUBKIND)
+                 .forEach(s -> setVariableType(roots, (VarSnippet) s));
+        }
+
+        private void setVariableType(com.sun.tools.javac.util.List<JCCompilationUnit> roots, VarSnippet s) {
+            ClassSymbol clazz = syms.getClass(syms.unnamedModule, names.fromString(s.classFullName()));
+            if (clazz == null || !clazz.isCompleted())
+                return;
+            VarSymbol field = (VarSymbol) clazz.members().findFirst(names.fromString(s.name()), sym -> sym.kind == Kinds.Kind.VAR);
+            if (field != null) {
+                JavaFileObject prev = log.useSource(null);
+                DiscardDiagnosticHandler h = new DiscardDiagnosticHandler(log);
+                try {
+                    String typeName = s.typeName();
+                    CharBuffer buf = CharBuffer.wrap(("(" + typeName +")x\u0000").toCharArray(), 0, typeName.length() + 3);
+                    Parser parser = parserFactory.newParser(buf, false, false, false);
+                    JCExpression expr = parser.parseExpression();
+                    if (expr.hasTag(Tag.TYPECAST)) {
+                        JCTypeCast tree = (JCTypeCast) expr;
+                        if (tree.clazz.hasTag(Tag.TYPEINTERSECTION)) {
+                            field.type = attr.attribType(tree.clazz,
+                                                         ((JCClassDecl) roots.head.getTypeDecls().head).sym);
+                        }
+                    }
+                } finally {
+                    log.popDiagnosticHandler(h);
+                    log.useSource(prev);
+                }
+            }
+        }
+    }
+
 }
--- a/src/jdk.jshell/share/classes/jdk/jshell/TreeDissector.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/TreeDissector.java	Thu Sep 28 09:13:27 2017 -0700
@@ -227,7 +227,7 @@
         Type typeImpl = (Type) type;
         try {
             TypePrinter tp = new TypePrinter(at.messages(),
-                    state.maps::fullClassNameAndPackageToClass);
+                    state.maps::fullClassNameAndPackageToClass, true);
             return tp.toString(typeImpl);
         } catch (Exception ex) {
             return null;
--- a/src/jdk.jshell/share/classes/jdk/jshell/TypePrinter.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/TypePrinter.java	Thu Sep 28 09:13:27 2017 -0700
@@ -32,9 +32,11 @@
 import com.sun.tools.javac.code.Symbol.PackageSymbol;
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Type.ClassType;
+import com.sun.tools.javac.code.Type.IntersectionClassType;
 import com.sun.tools.javac.util.JavacMessages;
 import java.util.Locale;
 import java.util.function.BinaryOperator;
+import java.util.stream.Collectors;
 
 /**
  * Print types in source form.
@@ -45,10 +47,14 @@
 
     private final JavacMessages messages;
     private final BinaryOperator<String> fullClassNameAndPackageToClass;
+    private final boolean printEnhancedTypes;
 
-    TypePrinter(JavacMessages messages, BinaryOperator<String> fullClassNameAndPackageToClass) {
+    TypePrinter(JavacMessages messages,
+                BinaryOperator<String> fullClassNameAndPackageToClass,
+                boolean printEnhancedTypes) {
         this.messages = messages;
         this.fullClassNameAndPackageToClass = fullClassNameAndPackageToClass;
+        this.printEnhancedTypes = printEnhancedTypes;
     }
 
     String toString(Type t) {
@@ -92,8 +98,18 @@
     protected String className(ClassType t, boolean longform, Locale locale) {
         Symbol sym = t.tsym;
         if (sym.name.length() == 0 && (sym.flags() & COMPOUND) != 0) {
-            return OBJECT;
+            if (printEnhancedTypes) {
+                return ((IntersectionClassType) t).getExplicitComponents()
+                                                  .stream()
+                                                  .map(i -> visit(i, locale))
+                                                  .collect(Collectors.joining("&"));
+            } else {
+                return OBJECT;
+            }
         } else if (sym.name.length() == 0) {
+            if (printEnhancedTypes) {
+                return t.tsym.flatName().toString().substring(t.tsym.outermostClass().flatName().length());
+            }
             // Anonymous
             String s;
             ClassType norm = (ClassType) t.tsym.type;
--- a/src/jdk.jshell/share/classes/jdk/jshell/VarTypePrinter.java	Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,265 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.jshell;
-
-import java.util.HashSet;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Type.ClassType;
-import com.sun.tools.javac.util.JavacMessages;
-import java.util.Locale;
-import java.util.Set;
-import java.util.function.BinaryOperator;
-import com.sun.tools.javac.code.BoundKind;
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Symtab;
-import com.sun.tools.javac.code.Type.CapturedType;
-import com.sun.tools.javac.code.Type.StructuralTypeMapping;
-import com.sun.tools.javac.code.Type.TypeVar;
-import com.sun.tools.javac.code.Type.WildcardType;
-import com.sun.tools.javac.code.Types;
-import com.sun.tools.javac.code.Types.SimpleVisitor;
-import com.sun.tools.javac.util.List;
-import static com.sun.tools.javac.code.BoundKind.EXTENDS;
-import static com.sun.tools.javac.code.BoundKind.SUPER;
-import static com.sun.tools.javac.code.BoundKind.UNBOUND;
-import static com.sun.tools.javac.code.Type.ArrayType;
-import static com.sun.tools.javac.code.TypeTag.BOT;
-import static com.sun.tools.javac.code.TypeTag.WILDCARD;
-
-/**
- * Print variable types in source form.
- * TypeProjection and CaptureScanner are copied from Types in the JEP-286
- * Sandbox by Maurizio.  The checks for Non-Denotable in TypePrinter are
- * cribbed from denotableChecker of the same source.
- *
- * @author Maurizio Cimadamore
- * @author Robert Field
- */
-class VarTypePrinter extends TypePrinter {
-    private static final String WILD = "?";
-
-    private final Symtab syms;
-    private final Types types;
-
-    VarTypePrinter(JavacMessages messages, BinaryOperator<String> fullClassNameAndPackageToClass,
-            Symtab syms, Types types) {
-        super(messages, fullClassNameAndPackageToClass);
-        this.syms = syms;
-        this.types = types;
-    }
-
-    @Override
-    String toString(Type t) {
-        return super.toString(upward(t));
-    }
-
-    @Override
-    public String visitTypeVar(TypeVar t, Locale locale) {
-        /* Any type variable mentioned in the inferred type must have been declared as a type parameter
-                  (i.e cannot have been produced by inference (18.4))
-         */
-        // and beyond that, there are no global type vars, so if there are any
-        // type variables left, they need to be eliminated
-        return WILD; // Non-denotable
-    }
-
-    @Override
-    public String visitCapturedType(CapturedType t, Locale locale) {
-        /* Any type variable mentioned in the inferred type must have been declared as a type parameter
-                  (i.e cannot have been produced by capture conversion (5.1.10))
-         */
-        return WILD; // Non-denotable
-    }
-
-    public Type upward(Type t) {
-        List<Type> captures = captures(t);
-        return upward(t, captures);
-    }
-
-    /************* Following from JEP-286 Types.java ***********/
-
-    public Type upward(Type t, List<Type> vars) {
-        return t.map(new TypeProjection(vars), true);
-    }
-
-    public List<Type> captures(Type t) {
-        CaptureScanner cs = new CaptureScanner();
-        Set<Type> captures = new HashSet<>();
-        cs.visit(t, captures);
-        return List.from(captures);
-    }
-
-    class CaptureScanner extends SimpleVisitor<Void, Set<Type>> {
-
-        @Override
-        public Void visitType(Type t, Set<Type> types) {
-            return null;
-        }
-
-        @Override
-        public Void visitClassType(ClassType t, Set<Type> seen) {
-            if (t.isCompound()) {
-                types.directSupertypes(t).forEach(s -> visit(s, seen));
-            } else {
-                t.allparams().forEach(ta -> visit(ta, seen));
-            }
-            return null;
-        }
-
-        @Override
-        public Void visitArrayType(ArrayType t, Set<Type> seen) {
-            return visit(t.elemtype, seen);
-        }
-
-        @Override
-        public Void visitWildcardType(WildcardType t, Set<Type> seen) {
-            visit(t.type, seen);
-            return null;
-        }
-
-        @Override
-        public Void visitTypeVar(TypeVar t, Set<Type> seen) {
-            if ((t.tsym.flags() & Flags.SYNTHETIC) != 0 && seen.add(t)) {
-                visit(t.getUpperBound(), seen);
-            }
-            return null;
-        }
-
-        @Override
-        public Void visitCapturedType(CapturedType t, Set<Type> seen) {
-            if (seen.add(t)) {
-                visit(t.getUpperBound(), seen);
-                visit(t.getLowerBound(), seen);
-            }
-            return null;
-        }
-    }
-
-    class TypeProjection extends StructuralTypeMapping<Boolean> {
-
-        List<Type> vars;
-        Set<Type> seen = new HashSet<>();
-
-        public TypeProjection(List<Type> vars) {
-            this.vars = vars;
-        }
-
-        @Override
-        public Type visitClassType(ClassType t, Boolean upward) {
-            if (upward && !t.isCompound() && t.tsym.name.isEmpty()) {
-                //lift anonymous class type to first supertype (class or interface)
-                return types.directSupertypes(t).last();
-            } else if (t.isCompound()) {
-                List<Type> components = types.directSupertypes(t);
-                List<Type> components1 = components.map(c -> c.map(this, upward));
-                if (components == components1) return t;
-                else return types.makeIntersectionType(components1);
-            } else {
-                Type outer = t.getEnclosingType();
-                Type outer1 = visit(outer, upward);
-                List<Type> typarams = t.getTypeArguments();
-                List<Type> typarams1 = typarams.map(ta -> mapTypeArgument(ta, upward));
-                if (typarams1.stream().anyMatch(ta -> ta.hasTag(BOT))) {
-                    //not defined
-                    return syms.botType;
-                }
-                if (outer1 == outer && typarams1 == typarams) return t;
-                else return new ClassType(outer1, typarams1, t.tsym, t.getMetadata()) {
-                    @Override
-                    protected boolean needsStripping() {
-                        return true;
-                    }
-                };
-            }
-        }
-
-        protected Type makeWildcard(Type upper, Type lower) {
-            BoundKind bk;
-            Type bound;
-            if (upper.hasTag(BOT)) {
-                upper = syms.objectType;
-            }
-            boolean isUpperObject = types.isSameType(upper, syms.objectType);
-            if (!lower.hasTag(BOT) && isUpperObject) {
-                bound = lower;
-                bk = SUPER;
-            } else {
-                bound = upper;
-                bk = isUpperObject ? UNBOUND : EXTENDS;
-            }
-            return new WildcardType(bound, bk, syms.boundClass);
-        }
-
-        @Override
-        public Type visitTypeVar(TypeVar t, Boolean upward) {
-            if (vars.contains(t)) {
-                try {
-                    if (seen.add(t)) {
-                        return (upward ?
-                                t.getUpperBound() :
-                                (t.getLowerBound() == null) ?
-                                        syms.botType :
-                                        t.getLowerBound())
-                                    .map(this, upward);
-                    } else {
-                        //cycle
-                        return syms.objectType;
-                    }
-                } finally {
-                    seen.remove(t);
-                }
-            } else {
-                return t;
-            }
-        }
-
-        @Override
-        public Type visitWildcardType(WildcardType wt, Boolean upward) {
-            if (upward) {
-                return wt.isExtendsBound() ?
-                        wt.type.map(this, upward) :
-                        syms.objectType;
-            } else {
-                return wt.isSuperBound() ?
-                        wt.type.map(this, upward) :
-                        syms.botType;
-            }
-        }
-
-        private Type mapTypeArgument(Type t, boolean upward) {
-            if (!t.containsAny(vars)) {
-                return t;
-            } else if (!t.hasTag(WILDCARD) && !upward) {
-                //not defined
-                return syms.botType;
-            } else {
-                Type upper = t.map(this, upward);
-                Type lower = t.map(this, !upward);
-                return makeWildcard(upper, lower);
-            }
-        }
-    }
-}
--- a/src/jdk.jshell/share/classes/jdk/jshell/Wrap.java	Tue Sep 26 10:46:23 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/Wrap.java	Thu Sep 28 09:13:27 2017 -0700
@@ -74,16 +74,15 @@
      * @param rdecl Type name and name
      * @return
      */
-    public static Wrap varWrap(String source, Range rtype, String brackets, Range rname, Range rinit) {
+    public static Wrap varWrap(String source, Wrap wtype, String brackets,
+                               Range rname, Wrap winit, Wrap anonDeclareWrap) {
         RangeWrap wname = new RangeWrap(source, rname);
-        RangeWrap wtype = new RangeWrap(source, rtype);
         Wrap wVarDecl = new VarDeclareWrap(wtype, brackets, wname);
         Wrap wmeth;
 
-        if (rinit == null) {
+        if (winit == null) {
             wmeth = new CompoundWrap(new NoWrap(" "), "   return null;\n");
         } else {
-            RangeWrap winit = new RangeWrap(source, rinit);
         // int x = y
             // int x_ = y; return x = x_;
             // decl + "_ = " + init ; + "return " + name + "=" + name + "_ ;"
@@ -93,7 +92,8 @@
             );
         }
         Wrap wInitMeth = new DoitMethodWrap(wmeth);
-        return new CompoundWrap(wVarDecl, wInitMeth);
+        return anonDeclareWrap != null ? new CompoundWrap(wVarDecl, wInitMeth, anonDeclareWrap)
+                                       : new CompoundWrap(wVarDecl, wInitMeth);
     }
 
     public static Wrap tempVarWrap(String source, String typename, String name) {
@@ -112,6 +112,14 @@
         return new NoWrap(source);
     }
 
+    public static Wrap identityWrap(String source) {
+        return new NoWrap(source);
+    }
+
+    public static Wrap rangeWrap(String source, Range range) {
+        return new RangeWrap(source, range);
+    }
+
     public static Wrap classMemberWrap(String source) {
         Wrap w = new NoWrap(source);
         return new CompoundWrap("    public static\n    ", w);
--- a/src/jdk.policytool/share/classes/module-info.java	Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * Defines the GUI tool for managing policy files
- * called <em>{@index policytool policytool}</em>.
- *
- * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
- * <dt class="simpleTagLabel">Tool Guides:
- * <dd>{@extLink policytool_tool_reference policytool}
- * </dl>
- *
- * @since 9
- * @deprecated
- */
-@Deprecated(since="9", forRemoval=true)
-module jdk.policytool {
-    requires java.desktop;
-    requires java.logging;
-    requires java.management;
-    requires java.security.jgss;
-    requires java.sql;
-    requires jdk.net;
-    requires jdk.security.jgss;
-}
--- a/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java	Tue Sep 26 10:46:23 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4588 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.tools.policytool;
-
-import java.io.*;
-import java.util.LinkedList;
-import java.util.ListIterator;
-import java.util.Vector;
-import java.util.Enumeration;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.lang.reflect.*;
-import java.text.Collator;
-import java.text.MessageFormat;
-import sun.security.util.PropertyExpander;
-import sun.security.util.PropertyExpander.ExpandException;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.FileDialog;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.Point;
-import java.awt.Toolkit;
-import java.awt.Window;
-import java.awt.event.*;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.*;
-import sun.security.provider.*;
-import sun.security.util.PolicyUtil;
-import javax.security.auth.x500.X500Principal;
-import javax.swing.*;
-import javax.swing.border.EmptyBorder;
-
-/**
- * PolicyTool may be used by users and administrators to configure the
- * overall java security policy (currently stored in the policy file).
- * Using PolicyTool administrators may add and remove policies from
- * the policy file. <p>
- *
- * @see java.security.Policy
- * @since   1.2
- * @deprecated {@code policytool} has been deprecated for removal because it
- * is rarely used, and it provides little value over editing policy
- * files using a text editor.
- */
-
-@Deprecated(since="9", forRemoval=true)
-@SuppressWarnings("removal")
-public class PolicyTool {
-
-    // for i18n
-    static final java.util.ResourceBundle rb =
-        java.util.ResourceBundle.getBundle(
-            "sun.security.tools.policytool.Resources");
-    static final Collator collator = Collator.getInstance();
-    static {
-        // this is for case insensitive string comparisons
-        collator.setStrength(Collator.PRIMARY);
-
-        // Support for Apple menu bar
-        if (System.getProperty("apple.laf.useScreenMenuBar") == null) {
-            System.setProperty("apple.laf.useScreenMenuBar", "true");
-        }
-        System.setProperty("apple.awt.application.name", getMessage("Policy.Tool"));
-
-        // Apply the system L&F if not specified with a system property.
-        if (System.getProperty("swing.defaultlaf") == null) {
-            try {
-                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-            } catch (Exception e) {
-                // ignore
-            }
-        }
-    }
-
-    // anyone can add warnings
-    Vector<String> warnings;
-    boolean newWarning = false;
-
-    // set to true if policy modified.
-    // this way upon exit we know if to ask the user to save changes
-    boolean modified = false;
-
-    private static final boolean testing = false;
-    private static final Class<?>[] TWOPARAMS = { String.class, String.class };
-    private static final Class<?>[] ONEPARAMS = { String.class };
-    private static final Class<?>[] NOPARAMS  = {};
-    /*
-     * All of the policy entries are read in from the
-     * policy file and stored here.  Updates to the policy entries
-     * using addEntry() and removeEntry() are made here.  To ultimately save
-     * the policy entries back to the policy file, the SavePolicy button
-     * must be clicked.
-     **/
-    private static String policyFileName = null;
-    private Vector<PolicyEntry> policyEntries = null;
-    private PolicyParser parser = null;
-
-    /* The public key alias information is stored here.  */
-    private KeyStore keyStore = null;