Merge
authorjwilhelm
Sat, 02 Dec 2017 06:51:10 +0100
changeset 48297 48ff95f16a16
parent 48296 3212e9bc5be7 (current diff)
parent 48042 be01bcb72309 (diff)
child 48298 40b9faefb496
Merge
src/hotspot/share/prims/jvm.cpp
src/java.base/share/classes/jdk/internal/util/jar/VersionedStream.java
src/jdk.charsets/share/classes/sun/nio/cs/ext/MS950_HKSCS.java
test/jdk/java/lang/SecurityManager/NoAWT.java
test/jdk/jdk/internal/util/jar/TestVersionedStream.java
test/langtools/tools/javac/doctree/dcapi/OverviewTest.java
--- a/.hgtags	Sat Dec 02 11:25:35 2017 +0530
+++ b/.hgtags	Sat Dec 02 06:51:10 2017 +0100
@@ -458,3 +458,4 @@
 e6278add9ff28fab70fe1cc4c1d65f7363dc9445 jdk-10+31
 a2008587c13fa05fa2dbfcb09fe987576fbedfd1 jdk-10+32
 bbd692ad4fa300ecca7939ffbe3b1d5e52a28cc6 jdk-10+33
+89deac44e51517841491ba86ff44aa82a5ca96b3 jdk-10+34
--- a/make/Bundles.gmk	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/Bundles.gmk	Sat Dec 02 06:51:10 2017 +0100
@@ -177,7 +177,7 @@
   # Create special filter rules when dealing with unzipped .dSYM directories on
   # macosx
   ifeq ($(OPENJDK_TARGET_OS), macosx)
-    ifeq ($(ZIP_DEBUGINFO_FILES), false)
+    ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), false)
       JDK_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \
           $(call containing, .dSYM/, $(patsubst $(JDK_IMAGE_DIR)/%, %, $(ALL_JDK_FILES))))
     endif
@@ -212,7 +212,7 @@
   # Create special filter rules when dealing with unzipped .dSYM directories on
   # macosx
   ifeq ($(OPENJDK_TARGET_OS), macosx)
-    ifeq ($(ZIP_DEBUGINFO_FILES), false)
+    ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), false)
       JRE_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \
           $(call containing, .dSYM/, $(patsubst $(JRE_IMAGE_DIR)/%, %, $(ALL_JRE_FILES))))
     endif
--- a/make/CompileJavaModules.gmk	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/CompileJavaModules.gmk	Sat Dec 02 06:51:10 2017 +0100
@@ -300,7 +300,9 @@
 
 ################################################################################
 
-java.xml_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
+java.xml_ADD_JAVAC_FLAGS += -Xdoclint:all/protected \
+    '-Xdoclint/package:$(call CommaList, javax.xml.catalog javax.xml.datatype \
+    javax.xml.transform javax.xml.validation javax.xml.xpath)'
 java.xml_CLEAN += .properties
 
 ################################################################################
--- a/make/InitSupport.gmk	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/InitSupport.gmk	Sat Dec 02 06:51:10 2017 +0100
@@ -47,7 +47,7 @@
 
   # Make control variables, handled by Init.gmk
   INIT_CONTROL_VARIABLES += LOG CONF CONF_NAME SPEC JOBS TEST_JOBS CONF_CHECK \
-      COMPARE_BUILD JTREG GTEST
+      COMPARE_BUILD JTREG GTEST TEST_OPTS TEST_VM_OPTS
 
   # All known make control variables
   MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER
--- a/make/Main.gmk	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/Main.gmk	Sat Dec 02 06:51:10 2017 +0100
@@ -480,8 +480,7 @@
 #
 
 prepare-test-image:
-	$(MKDIR) -p $(TEST_IMAGE_DIR)
-	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
+	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f TestImage.gmk prepare-test-image)
 
 build-test-hotspot-jtreg-native:
 	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNativeHotspot.gmk \
@@ -1049,7 +1048,7 @@
 # file.
 
 CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
-    images make-support test-make bundles buildjdk
+    images make-support test-make bundles buildjdk test-results test-support
 CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
 CLEAN_SUPPORT_DIRS += demos
 CLEAN_SUPPORT_DIR_TARGETS := $(addprefix clean-, $(CLEAN_SUPPORT_DIRS))
@@ -1094,6 +1093,8 @@
 # while classes and touch files end up in jdk.
 clean-support: clean-jdk
 
+clean-test: clean-test-results clean-test-support
+
 # Remove everything, including configure configuration. If the output
 # directory was created by configure and now becomes empty, remove it as well.
 dist-clean: clean
--- a/make/RunTests.gmk	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/RunTests.gmk	Sat Dec 02 06:51:10 2017 +0100
@@ -32,17 +32,77 @@
 # We will always run multiple tests serially
 .NOTPARALLEL:
 
+################################################################################
+# Parse global control variables
+################################################################################
+
+ifneq ($(TEST_VM_OPTS), )
+  ifneq ($(TEST_OPTS), )
+    TEST_OPTS := $(TEST_OPTS);VM_OPTIONS=$(TEST_VM_OPTS)
+  else
+    TEST_OPTS := VM_OPTIONS=$(TEST_VM_OPTS)
+  endif
+endif
+
+$(eval $(call ParseKeywordVariable, TEST_OPTS, \
+    KEYWORDS := JOBS TIMEOUT, \
+    STRING_KEYWORDS := VM_OPTIONS, \
+))
+
+# Helper function to propagate TEST_OPTS values.
+#
+# Note: No spaces are allowed around the arguments.
+# Arg $1 The variable in TEST_OPTS to propagate
+# Arg $2 The control variable to propagate it to
+define SetTestOpt
+  ifneq ($$(TEST_OPTS_$1), )
+    $2_$1 := $$(TEST_OPTS_$1)
+  endif
+endef
+
+################################################################################
 # Hook to include the corresponding custom file, if present.
 $(eval $(call IncludeCustomExtension, RunTests.gmk))
+################################################################################
 
 TEST_RESULTS_DIR := $(OUTPUTDIR)/test-results
 TEST_SUPPORT_DIR := $(OUTPUTDIR)/test-support
+TEST_SUMMARY := $(TEST_RESULTS_DIR)/test-summary.txt
+TEST_LAST_IDS := $(TEST_SUPPORT_DIR)/test-last-ids.txt
 
+ifeq ($(CUSTOM_ROOT), )
+  JTREG_TOPDIR := $(TOPDIR)
+else
+  JTREG_TOPDIR := $(CUSTOM_ROOT)
+endif
+
+JTREG_FAILURE_HANDLER_DIR := $(TEST_IMAGE_DIR)/failure_handler
+JTREG_FAILURE_HANDLER := $(JTREG_FAILURE_HANDLER_DIR)/jtregFailureHandler.jar
+
+ifneq ($(wildcard $(JTREG_FAILURE_HANDLER)), )
+  JTREG_FAILURE_HANDLER_OPTIONS := \
+      -timeoutHandlerDir:$(JTREG_FAILURE_HANDLER) \
+      -observerDir:$(JTREG_FAILURE_HANDLER) \
+      -timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
+      -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
+      -timeoutHandlerTimeout:0
+endif
 
 ################################################################################
 # Parse control variables
 ################################################################################
 
+ifneq ($(TEST_OPTS), )
+  # Inform the user
+  $(info Running tests using TEST_OPTS control variable '$(TEST_OPTS)')
+
+  $(eval $(call SetTestOpt,VM_OPTIONS,JTREG))
+  $(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
+
+  $(eval $(call SetTestOpt,JOBS,JTREG))
+  $(eval $(call SetTestOpt,TIMEOUT,JTREG))
+endif
+
 $(eval $(call ParseKeywordVariable, JTREG, \
     KEYWORDS := JOBS TIMEOUT TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM, \
     STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS, \
@@ -55,7 +115,7 @@
 
 $(eval $(call ParseKeywordVariable, GTEST, \
     KEYWORDS := REPEAT, \
-    STRING_KEYWORDS := OPTIONS, \
+    STRING_KEYWORDS := OPTIONS VM_OPTIONS, \
 ))
 
 ifneq ($(GTEST), )
@@ -84,6 +144,11 @@
 hotspot_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/hotspot/jtreg/native
 jdk_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/jdk/jtreg/native
 
+jdk_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jdk/ProblemList.txt
+jaxp_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jaxp/ProblemList.txt
+langtools_JTREG_PROBLEM_LIST += $(TOPDIR)/test/langtools/ProblemList.txt
+nashorn_JTREG_PROBLEM_LIST += $(TOPDIR)/test/nashorn/ProblemList.txt
+hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt
 
 ################################################################################
 # Parse test selection
@@ -116,17 +181,23 @@
   )
 endef
 
+# Helper function that removes the TOPDIR part
+CleanupJtregPath = \
+  $(strip $(patsubst %/, %, $(subst $(JTREG_TOPDIR)/,, $1)))
+
 # Take a partial Jtreg root path and return a full, absolute path to that Jtreg
 # root. Also support having "hotspot" as an alias for "hotspot/jtreg".
 ExpandJtregRoot = \
-  $(strip $(wildcard $(patsubst %/, %, \
+  $(call CleanupJtregPath, $(wildcard \
     $(if $(filter /%, $1), \
-      $1 \
+      $(if $(wildcard $(strip $1)/TEST.ROOT), \
+        $1 \
+      ) \
     , \
       $(filter $(addprefix %, $1), $(JTREG_TESTROOTS) $(addsuffix /, $(JTREG_TESTROOTS))) \
       $(filter $(addprefix %, $(strip $1)/jtreg), $(JTREG_TESTROOTS) $(addsuffix /, $(JTREG_TESTROOTS))) \
     ) \
-  )))
+  ))
 
 # Take a partial Jtreg test path and return a full, absolute path to that Jtreg
 # test. Also support having "hotspot" as an alias for "hotspot/jtreg".
@@ -134,14 +205,14 @@
   $(if $(call ExpandJtregRoot, $1), \
     $(call ExpandJtregRoot, $1) \
   , \
-    $(strip $(wildcard $(patsubst %/, %, \
+    $(call CleanupJtregPath, $(wildcard \
       $(if $(filter /%, $1), \
         $1 \
       , \
         $(addsuffix /$(strip $1), $(JTREG_TESTROOTS) $(TEST_BASEDIRS)) \
         $(addsuffix $(strip $(patsubst hotspot/%, /hotspot/jtreg/%, $1)), $(JTREG_TESTROOTS) $(TEST_BASEDIRS)) \
       ) \
-    ))) \
+    )) \
   )
 
 # Helper function to determine if a test specification is a Jtreg test
@@ -158,27 +229,26 @@
   $(if $(findstring :, $(TEST_NAME)), \
     $(if $(filter :%, $(TEST_NAME)), \
       $(eval TEST_GROUP := $(patsubst :%, %, $(TEST_NAME))) \
-      $(eval TEST_ROOTS := $(JTREG_TESTROOTS)) \
+      $(eval TEST_ROOTS := $(foreach test_root, $(JTREG_TESTROOTS), \
+          $(call CleanupJtregPath, $(test_root)))) \
     , \
       $(eval TEST_PATH := $(word 1, $(subst :, $(SPACE), $(TEST_NAME)))) \
       $(eval TEST_GROUP := $(word 2, $(subst :, $(SPACE), $(TEST_NAME)))) \
       $(eval TEST_ROOTS := $(call ExpandJtregRoot, $(TEST_PATH))) \
     ) \
     $(foreach test_root, $(TEST_ROOTS), \
-      $(if $(filter $(TEST_GROUP), $($(test_root)_JTREG_TEST_GROUPS)), \
+      $(if $(filter /%, $(test_root)), \
         jtreg:$(test_root):$(TEST_GROUP) \
+      , \
+        $(if $(filter $(TEST_GROUP), $($(JTREG_TOPDIR)/$(test_root)_JTREG_TEST_GROUPS)), \
+          jtreg:$(test_root):$(TEST_GROUP) \
+        ) \
       ) \
     ) \
   , \
-    $(if $(filter /%, $(TEST_NAME)), \
-      $(if $(wildcard $(TEST_NAME)), \
-        jtreg:$(TEST_NAME) \
-      ) \
-    , \
-      $(eval TEST_PATHS := $(call ExpandJtregPath, $(TEST_NAME))) \
-      $(foreach test_path, $(TEST_PATHS), \
-        jtreg:$(test_path) \
-      ) \
+    $(eval TEST_PATHS := $(call ExpandJtregPath, $(TEST_NAME))) \
+    $(foreach test_path, $(TEST_PATHS), \
+      jtreg:$(test_path) \
     ) \
   )
 endef
@@ -248,6 +318,7 @@
 define SetupRunGtestTestBody
   $1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1
   $1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1
+  $1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
 
   $1_TEST_NAME := $$(strip $$(patsubst gtest:%, %, $$($1_TEST)))
   ifneq ($$($1_TEST_NAME), all)
@@ -264,10 +335,13 @@
 	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
 	$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/gtest, \
 	    $$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/server/gtestLauncher \
-	    -jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \
-	    --gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
-	    $$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) \
-	    > >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) || true )
+	         -jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \
+	         --gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
+	         $$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \
+	        > >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \
+	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
+	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
+	)
 
   $1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/gtest.txt
 
@@ -275,15 +349,24 @@
 	$$(call LogWarn, Finished running test '$$($1_TEST)')
 	$$(call LogWarn, Test report is stored in $$(strip \
 	    $$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR))))
-	$$(eval $1_TOTAL := $$(shell $$(AWK) '/==========.* tests? from .* \
-	    test cases? ran/ { print $$$$2 }' $$($1_RESULT_FILE)))
-	$$(eval $1_PASSED := $$(shell $$(AWK) '/\[  PASSED  \] .* tests?./ \
-	    { print $$$$4 }' $$($1_RESULT_FILE)))
-	$$(eval $1_FAILED := $$(shell $$(AWK) '/\[  FAILED  \] .* tests?, \
-	    listed below/ { print $$$$4 }' $$($1_RESULT_FILE)))
-	$$(if $$($1_FAILED), , $$(eval $1_FAILED := 0))
-	$$(eval $1_ERROR := $$(shell \
-	    $$(EXPR) $$($1_TOTAL) - $$($1_PASSED) - $$($1_FAILED)))
+	$$(if $$(wildcard $$($1_RESULT_FILE)), \
+	  $$(eval $1_TOTAL := $$(shell $$(AWK) '/==========.* tests? from .* \
+	      test cases? ran/ { print $$$$2 }' $$($1_RESULT_FILE))) \
+	  $$(if $$($1_TOTAL), , $$(eval $1_TOTAL := 0)) \
+	  $$(eval $1_PASSED := $$(shell $$(AWK) '/\[  PASSED  \] .* tests?./ \
+	      { print $$$$4 }' $$($1_RESULT_FILE))) \
+	  $$(if $$($1_PASSED), , $$(eval $1_PASSED := 0)) \
+	  $$(eval $1_FAILED := $$(shell $$(AWK) '/\[  FAILED  \] .* tests?, \
+	      listed below/ { print $$$$4 }' $$($1_RESULT_FILE))) \
+	  $$(if $$($1_FAILED), , $$(eval $1_FAILED := 0)) \
+	  $$(eval $1_ERROR := $$(shell \
+	      $$(EXPR) $$($1_TOTAL) - $$($1_PASSED) - $$($1_FAILED))) \
+	, \
+	  $$(eval $1_PASSED := 0) \
+	  $$(eval $1_FAILED := 0) \
+	  $$(eval $1_ERROR := 1) \
+	  $$(eval $1_TOTAL := 1) \
+	)
 
   $1: run-test-$1 parse-test-$1
 
@@ -321,12 +404,13 @@
 define SetupRunJtregTestBody
   $1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1
   $1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1
+  $1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
 
   $1_TEST_NAME := $$(strip $$(patsubst jtreg:%, %, $$($1_TEST)))
 
   $1_COMPONENT := \
       $$(strip $$(foreach root, $$(JTREG_TESTROOTS), \
-        $$(if $$(filter $$(root)%, $$($1_TEST_NAME)), \
+        $$(if $$(filter $$(root)%, $$(JTREG_TOPDIR)/$$($1_TEST_NAME)), \
           $$(lastword $$(subst /, $$(SPACE), $$(root))) \
         ) \
       ))
@@ -350,6 +434,7 @@
   $$(eval $$(call SetJtregValue,$1,JTREG_MAX_MEM,512m))
   $$(eval $$(call SetJtregValue,$1,JTREG_NATIVEPATH))
   $$(eval $$(call SetJtregValue,$1,JTREG_BASIC_OPTIONS))
+  $$(eval $$(call SetJtregValue,$1,JTREG_PROBLEM_LIST))
 
   ifneq ($(TEST_JOBS), 0)
     # User has specified TEST_JOBS, use that as fallback default
@@ -359,11 +444,6 @@
     $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(JOBS)))
   endif
 
-  ifeq ($$(shell $$(EXPR) $$($1_JTREG_JOBS) \> 50), 1)
-    # Until CODETOOLS-7901892 is fixed, JTreg cannot handle more than 50 jobs
-    $1_JTREG_JOBS := 50
-  endif
-
   # Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since
   # we may end up with a lot of JVM's
   $1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $$(EXPR) 25 / $$($1_JTREG_JOBS))
@@ -403,11 +483,22 @@
     $1_JTREG_BASIC_OPTIONS += -nativepath:$$($1_JTREG_NATIVEPATH)
   endif
 
+  ifneq ($$($1_JTREG_PROBLEM_LIST), )
+    $1_JTREG_BASIC_OPTIONS += $$(addprefix -exclude:, $$($1_JTREG_PROBLEM_LIST))
+  endif
+
   ifneq ($$(JIB_JAR), )
     $1_JTREG_BASIC_OPTIONS += -cpa:$$(JIB_JAR)
   endif
 
-  run-test-$1:
+  ifneq ($$(JTREG_FAILURE_HANDLER_OPTIONS), )
+    $1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)"
+  endif
+
+  clean-workdir-$1:
+	$$(RM) -r $$($1_TEST_SUPPORT_DIR)
+
+  run-test-$1: clean-workdir-$1
 	$$(call LogWarn)
 	$$(call LogWarn, Running test '$$($1_TEST)')
 	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
@@ -416,11 +507,15 @@
 	        -Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \
 	        $$($1_JTREG_BASIC_OPTIONS) \
 	        -testjdk:$$(JDK_IMAGE_DIR) \
-	        -dir:$$(TOPDIR) \
+	        -dir:$$(JTREG_TOPDIR) \
 	        -reportDir:$$($1_TEST_RESULTS_DIR) \
 	        -workDir:$$($1_TEST_SUPPORT_DIR) \
 	        $$(JTREG_OPTIONS) \
-	        $$($1_TEST_NAME) || true )
+	        $$(JTREG_FAILURE_HANDLER_OPTIONS) \
+	        $$($1_TEST_NAME) \
+	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
+	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
+	)
 
   $1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/text/stats.txt
 
@@ -428,7 +523,7 @@
 	$$(call LogWarn, Finished running test '$$($1_TEST)')
 	$$(call LogWarn, Test report is stored in $$(strip \
 	    $$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR))))
-	$$(if  $$(wildcard $$($1_RESULT_FILE)), \
+	$$(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))) \
@@ -470,7 +565,7 @@
 # Now process each test to run and setup a proper make rule
 $(foreach test, $(TESTS_TO_RUN), \
   $(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \
-      $(TR) -cs '[a-z][A-Z][0-9]\n' '_')) \
+      $(TR) -cs '[a-z][A-Z][0-9]\n' '[_*1000]')) \
   $(eval ALL_TEST_IDS += $(TEST_ID)) \
   $(if $(call UseCustomTestHandler, $(test)), \
     $(eval $(call SetupRunCustomTest, $(TEST_ID), \
@@ -504,35 +599,49 @@
 TEST_FAILURE := false
 
 run-test: $(TARGETS)
-        # Print a table of the result of all tests run and their result
-	$(ECHO)
-	$(ECHO) ==============================
-	$(ECHO) Test summary
-	$(ECHO) ==============================
-	$(PRINTF) "%2s %-49s %5s %5s %5s %5s %2s\n" "  " TEST \
-	    TOTAL PASS FAIL ERROR " "
+        # Create and print a table of the result of all tests run
+	$(RM) $(TEST_SUMMARY).old 2> /dev/null
+	$(MV) $(TEST_SUMMARY) $(TEST_SUMMARY).old 2> /dev/null || true
+	$(RM) $(TEST_LAST_IDS).old 2> /dev/null
+	$(MV) $(TEST_LAST_IDS) $(TEST_LAST_IDS).old 2> /dev/null || true
+	$(ECHO) >> $(TEST_SUMMARY) ==============================
+	$(ECHO) >> $(TEST_SUMMARY) Test summary
+	$(ECHO) >> $(TEST_SUMMARY) ==============================
+	$(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5s %5s %5s %5s %2s\n" "  " \
+	    TEST TOTAL PASS FAIL ERROR " "
 	$(foreach test, $(TESTS_TO_RUN), \
 	  $(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \
-	      $(TR) -cs '[a-z][A-Z][0-9]\n' '_')) \
+	      $(TR) -cs '[a-z][A-Z][0-9]\n' '[_*1000]')) \
+	    $(ECHO) >> $(TEST_LAST_IDS) $(TEST_ID) $(NEWLINE) \
+	  $(eval NAME_PATTERN := $(shell $(ECHO) $(test) | $(TR) -c '\n' '[_*1000]')) \
+	  $(if $(filter __________________________________________________%, $(NAME_PATTERN)), \
+	    $(eval TEST_NAME := ) \
+	    $(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s\n" "  " "$(test)"  $(NEWLINE) \
+	  , \
+	    $(eval TEST_NAME := $(test)) \
+	  ) \
 	  $(if $(filter $($(TEST_ID)_PASSED), $($(TEST_ID)_TOTAL)), \
-	    $(PRINTF) "%2s %-49s %5d %5d %5d %5d %2s\n" "  " "$(test)" \
-	        $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) $($(TEST_ID)_FAILED) \
-	        $($(TEST_ID)_ERROR) "  " $(NEWLINE) \
+	    $(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5d %5d %5d %5d %2s\n" \
+	        "  " "$(TEST_NAME)" $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) \
+	        $($(TEST_ID)_FAILED) $($(TEST_ID)_ERROR) "  " $(NEWLINE) \
 	  , \
-	    $(PRINTF) "%2s %-49s %5d %5d %5d %5d %2s\n" ">>" "$(test)" \
-	        $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) $($(TEST_ID)_FAILED) \
-	        $($(TEST_ID)_ERROR) "<<" $(NEWLINE) \
+	    $(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5d %5d %5d %5d %2s\n" \
+	         ">>" "$(TEST_NAME)" $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) \
+	        $($(TEST_ID)_FAILED) $($(TEST_ID)_ERROR) "<<" $(NEWLINE) \
 	    $(eval TEST_FAILURE := true) \
 	  ) \
 	)
-	$(ECHO) ==============================
+	$(ECHO) >> $(TEST_SUMMARY) ==============================
 	$(if $(filter true, $(TEST_FAILURE)), \
-	  $(ECHO) TEST FAILURE $(NEWLINE) \
+	  $(ECHO) >> $(TEST_SUMMARY) TEST FAILURE $(NEWLINE) \
+	  $(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR) $(NEWLINE) \
 	  $(TOUCH) $(MAKESUPPORT_OUTPUTDIR)/exit-with-error \
 	, \
-	  $(ECHO) TEST SUCCESS \
+	  $(ECHO) >> $(TEST_SUMMARY) TEST SUCCESS \
 	)
 	$(ECHO)
+	$(CAT) $(TEST_SUMMARY)
+	$(ECHO)
 
 ################################################################################
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/TestImage.gmk	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,46 @@
+#
+# 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.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+############################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  FIXPATH_COPY := $(TEST_IMAGE_DIR)/bin/fixpath.exe
+
+  $(FIXPATH_COPY): $(firstword $(FIXPATH))
+	$(call install-file)
+endif
+
+prepare-test-image: $(FIXPATH_COPY)
+	$(call MakeDir, $(TEST_IMAGE_DIR))
+	$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
+
+all: prepare-test-image
+
+.PHONY: default all prepare-test-image
--- a/make/autoconf/basics.m4	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/autoconf/basics.m4	Sat Dec 02 06:51:10 2017 +0100
@@ -1092,10 +1092,6 @@
     # We can build without it.
     LDD="true"
   fi
-  BASIC_PATH_PROGS(OTOOL, otool)
-  if test "x$OTOOL" = "x"; then
-    OTOOL="true"
-  fi
   BASIC_PATH_PROGS(READELF, [greadelf readelf])
   BASIC_PATH_PROGS(DOT, dot)
   BASIC_PATH_PROGS(HG, hg)
--- a/make/autoconf/generated-configure.sh	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/autoconf/generated-configure.sh	Sat Dec 02 06:51:10 2017 +0100
@@ -818,6 +818,8 @@
 DUMPBIN
 RC
 MT
+INSTALL_NAME_TOOL
+OTOOL
 LIPO
 ac_ct_AR
 AR
@@ -932,7 +934,6 @@
 HG
 DOT
 READELF
-OTOOL
 LDD
 ZIPEXE
 UNZIP
@@ -1277,7 +1278,6 @@
 UNZIP
 ZIPEXE
 LDD
-OTOOL
 READELF
 DOT
 HG
@@ -1310,6 +1310,8 @@
 AS
 AR
 LIPO
+OTOOL
+INSTALL_NAME_TOOL
 STRIP
 NM
 GNM
@@ -2226,7 +2228,6 @@
   UNZIP       Override default value for UNZIP
   ZIPEXE      Override default value for ZIPEXE
   LDD         Override default value for LDD
-  OTOOL       Override default value for OTOOL
   READELF     Override default value for READELF
   DOT         Override default value for DOT
   HG          Override default value for HG
@@ -2260,6 +2261,9 @@
   AS          Override default value for AS
   AR          Override default value for AR
   LIPO        Override default value for LIPO
+  OTOOL       Override default value for OTOOL
+  INSTALL_NAME_TOOL
+              Override default value for INSTALL_NAME_TOOL
   STRIP       Override default value for STRIP
   NM          Override default value for NM
   GNM         Override default value for GNM
@@ -5155,7 +5159,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1511254554
+DATE_WHEN_GENERATED=1512085548
 
 ###############################################################################
 #
@@ -22126,206 +22130,6 @@
   # Publish this variable in the help.
 
 
-  if [ -z "${OTOOL+x}" ]; then
-    # The variable is not set by user, try to locate tool using the code snippet
-    for ac_prog in otool
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_OTOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $OTOOL in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_OTOOL="$OTOOL" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_OTOOL="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-OTOOL=$ac_cv_path_OTOOL
-if test -n "$OTOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
-$as_echo "$OTOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$OTOOL" && break
-done
-
-  else
-    # The variable is set, but is it from the command line or the environment?
-
-    # Try to remove the string !OTOOL! from our list.
-    try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!OTOOL!/}
-    if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
-      # If it failed, the variable was not from the command line. Ignore it,
-      # but warn the user (except for BASH, which is always set by the calling BASH).
-      if test "xOTOOL" != xBASH; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of OTOOL from the environment. Use command line variables instead." >&5
-$as_echo "$as_me: WARNING: Ignoring value of OTOOL from the environment. Use command line variables instead." >&2;}
-      fi
-      # Try to locate tool using the code snippet
-      for ac_prog in otool
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_OTOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $OTOOL in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_OTOOL="$OTOOL" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_OTOOL="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-OTOOL=$ac_cv_path_OTOOL
-if test -n "$OTOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
-$as_echo "$OTOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$OTOOL" && break
-done
-
-    else
-      # If it succeeded, then it was overridden by the user. We will use it
-      # for the tool.
-
-      # First remove it from the list of overridden variables, so we can test
-      # for unknown variables in the end.
-      CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
-
-      # Check if we try to supply an empty value
-      if test "x$OTOOL" = x; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool OTOOL= (no value)" >&5
-$as_echo "$as_me: Setting user supplied tool OTOOL= (no value)" >&6;}
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OTOOL" >&5
-$as_echo_n "checking for OTOOL... " >&6; }
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
-$as_echo "disabled" >&6; }
-      else
-        # Check if the provided tool contains a complete path.
-        tool_specified="$OTOOL"
-        tool_basename="${tool_specified##*/}"
-        if test "x$tool_basename" = "x$tool_specified"; then
-          # A command without a complete path is provided, search $PATH.
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool OTOOL=$tool_basename" >&5
-$as_echo "$as_me: Will search for user supplied tool OTOOL=$tool_basename" >&6;}
-          # Extract the first word of "$tool_basename", so it can be a program name with args.
-set dummy $tool_basename; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_OTOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $OTOOL in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_OTOOL="$OTOOL" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_OTOOL="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-OTOOL=$ac_cv_path_OTOOL
-if test -n "$OTOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
-$as_echo "$OTOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-          if test "x$OTOOL" = x; then
-            as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
-          fi
-        else
-          # Otherwise we believe it is a complete path. Use it as it is.
-          { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool OTOOL=$tool_specified" >&5
-$as_echo "$as_me: Will use user supplied tool OTOOL=$tool_specified" >&6;}
-          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OTOOL" >&5
-$as_echo_n "checking for OTOOL... " >&6; }
-          if test ! -x "$tool_specified"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
-$as_echo "not found" >&6; }
-            as_fn_error $? "User supplied tool OTOOL=$tool_specified does not exist or is not executable" "$LINENO" 5
-          fi
-          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
-$as_echo "$tool_specified" >&6; }
-        fi
-      fi
-    fi
-
-  fi
-
-
-  if test "x$OTOOL" = "x"; then
-    OTOOL="true"
-  fi
-
-
-  # Publish this variable in the help.
-
-
   if [ -z "${READELF+x}" ]; then
     # The variable is not set by user, try to locate tool using the code snippet
     for ac_prog in greadelf readelf
@@ -39588,6 +39392,986 @@
     fi
   fi
 
+
+
+
+  # Publish this variable in the help.
+
+
+  if [ -z "${OTOOL+x}" ]; then
+    # The variable is not set by user, try to locate tool using the code snippet
+    for ac_prog in otool
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_OTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $OTOOL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_OTOOL="$OTOOL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_OTOOL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+OTOOL=$ac_cv_path_OTOOL
+if test -n "$OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$OTOOL" && break
+done
+
+  else
+    # The variable is set, but is it from the command line or the environment?
+
+    # Try to remove the string !OTOOL! from our list.
+    try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!OTOOL!/}
+    if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
+      # If it failed, the variable was not from the command line. Ignore it,
+      # but warn the user (except for BASH, which is always set by the calling BASH).
+      if test "xOTOOL" != xBASH; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of OTOOL from the environment. Use command line variables instead." >&5
+$as_echo "$as_me: WARNING: Ignoring value of OTOOL from the environment. Use command line variables instead." >&2;}
+      fi
+      # Try to locate tool using the code snippet
+      for ac_prog in otool
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_OTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $OTOOL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_OTOOL="$OTOOL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_OTOOL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+OTOOL=$ac_cv_path_OTOOL
+if test -n "$OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$OTOOL" && break
+done
+
+    else
+      # If it succeeded, then it was overridden by the user. We will use it
+      # for the tool.
+
+      # First remove it from the list of overridden variables, so we can test
+      # for unknown variables in the end.
+      CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
+
+      # Check if we try to supply an empty value
+      if test "x$OTOOL" = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool OTOOL= (no value)" >&5
+$as_echo "$as_me: Setting user supplied tool OTOOL= (no value)" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OTOOL" >&5
+$as_echo_n "checking for OTOOL... " >&6; }
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
+$as_echo "disabled" >&6; }
+      else
+        # Check if the provided tool contains a complete path.
+        tool_specified="$OTOOL"
+        tool_basename="${tool_specified##*/}"
+        if test "x$tool_basename" = "x$tool_specified"; then
+          # A command without a complete path is provided, search $PATH.
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool OTOOL=$tool_basename" >&5
+$as_echo "$as_me: Will search for user supplied tool OTOOL=$tool_basename" >&6;}
+          # Extract the first word of "$tool_basename", so it can be a program name with args.
+set dummy $tool_basename; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_OTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $OTOOL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_OTOOL="$OTOOL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_OTOOL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+OTOOL=$ac_cv_path_OTOOL
+if test -n "$OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+          if test "x$OTOOL" = x; then
+            as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
+          fi
+        else
+          # Otherwise we believe it is a complete path. Use it as it is.
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool OTOOL=$tool_specified" >&5
+$as_echo "$as_me: Will use user supplied tool OTOOL=$tool_specified" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OTOOL" >&5
+$as_echo_n "checking for OTOOL... " >&6; }
+          if test ! -x "$tool_specified"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+            as_fn_error $? "User supplied tool OTOOL=$tool_specified does not exist or is not executable" "$LINENO" 5
+          fi
+          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
+$as_echo "$tool_specified" >&6; }
+        fi
+      fi
+    fi
+
+  fi
+
+
+
+  if test "x$OTOOL" = x; then
+    as_fn_error $? "Could not find required tool for OTOOL" "$LINENO" 5
+  fi
+
+
+
+  # Only process if variable expands to non-empty
+
+  if test "x$OTOOL" != x; then
+    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+  # First separate the path from the arguments. This will split at the first
+  # space.
+  complete="$OTOOL"
+  path="${complete%% *}"
+  tmp="$complete EOL"
+  arguments="${tmp#* }"
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  new_path=`$CYGPATH -u "$path"`
+
+  # Now try to locate executable using which
+  new_path=`$WHICH "$new_path" 2> /dev/null`
+  # bat and cmd files are not always considered executable in cygwin causing which
+  # to not find them
+  if test "x$new_path" = x \
+      && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+      && test "x`$LS \"$path\" 2>/dev/null`" != x; then
+    new_path=`$CYGPATH -u "$path"`
+  fi
+  if test "x$new_path" = x; then
+    # Oops. Which didn't find the executable.
+    # The splitting of arguments from the executable at a space might have been incorrect,
+    # since paths with space are more likely in Windows. Give it another try with the whole
+    # argument.
+    path="$complete"
+    arguments="EOL"
+    new_path=`$CYGPATH -u "$path"`
+    new_path=`$WHICH "$new_path" 2> /dev/null`
+    # bat and cmd files are not always considered executable in cygwin causing which
+    # to not find them
+    if test "x$new_path" = x \
+        && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+        && test "x`$LS \"$path\" 2>/dev/null`" != x; then
+      new_path=`$CYGPATH -u "$path"`
+    fi
+    if test "x$new_path" = x; then
+      # It's still not found. Now this is an unrecoverable error.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OTOOL, which resolves as \"$complete\", is not found." >&5
+$as_echo "$as_me: The path of OTOOL, which resolves as \"$complete\", is not found." >&6;}
+      has_space=`$ECHO "$complete" | $GREP " "`
+      if test "x$has_space" != x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: You might be mixing spaces in the path and extra arguments, which is not allowed." >&5
+$as_echo "$as_me: You might be mixing spaces in the path and extra arguments, which is not allowed." >&6;}
+      fi
+      as_fn_error $? "Cannot locate the the path of OTOOL" "$LINENO" 5
+    fi
+  fi
+
+  # 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 presence.
+  # 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
+    # Short path failed, file does not exist as specified.
+    # Try adding .exe or .cmd
+    if test -f "${new_path}.exe"; then
+      input_to_shortpath="${new_path}.exe"
+    elif test -f "${new_path}.cmd"; then
+      input_to_shortpath="${new_path}.cmd"
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OTOOL, which resolves as \"$new_path\", is invalid." >&5
+$as_echo "$as_me: The path of OTOOL, which resolves as \"$new_path\", is invalid." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" >&5
+$as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" >&6;}
+      as_fn_error $? "Cannot locate the the path of OTOOL" "$LINENO" 5
+    fi
+  else
+    input_to_shortpath="$new_path"
+  fi
+
+  # Call helper function which possibly converts this using DOS-style short mode.
+  # If so, the updated path is stored in $new_path.
+  new_path="$input_to_shortpath"
+
+  input_path="$input_to_shortpath"
+  # 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 $input_to_shortpath | $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
+
+  # remove trailing .exe if any
+  new_path="${new_path/%.exe/}"
+
+    elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+  # First separate the path from the arguments. This will split at the first
+  # space.
+  complete="$OTOOL"
+  path="${complete%% *}"
+  tmp="$complete EOL"
+  arguments="${tmp#* }"
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  new_path="$path"
+
+  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
+
+
+  # Now try to locate executable using which
+  new_path=`$WHICH "$new_path" 2> /dev/null`
+
+  if test "x$new_path" = x; then
+    # Oops. Which didn't find the executable.
+    # The splitting of arguments from the executable at a space might have been incorrect,
+    # since paths with space are more likely in Windows. Give it another try with the whole
+    # argument.
+    path="$complete"
+    arguments="EOL"
+    new_path="$path"
+
+  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
+
+
+    new_path=`$WHICH "$new_path" 2> /dev/null`
+    # bat and cmd files are not always considered executable in MSYS causing which
+    # to not find them
+    if test "x$new_path" = x \
+        && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+        && test "x`$LS \"$path\" 2>/dev/null`" != x; then
+      new_path="$path"
+
+  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
+
+    fi
+
+    if test "x$new_path" = x; then
+      # It's still not found. Now this is an unrecoverable error.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OTOOL, which resolves as \"$complete\", is not found." >&5
+$as_echo "$as_me: The path of OTOOL, which resolves as \"$complete\", is not found." >&6;}
+      has_space=`$ECHO "$complete" | $GREP " "`
+      if test "x$has_space" != x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: You might be mixing spaces in the path and extra arguments, which is not allowed." >&5
+$as_echo "$as_me: You might be mixing spaces in the path and extra arguments, which is not allowed." >&6;}
+      fi
+      as_fn_error $? "Cannot locate the the path of OTOOL" "$LINENO" 5
+    fi
+  fi
+
+  # Now new_path has a complete unix path to the binary
+  if test "x`$ECHO $new_path | $GREP ^/bin/`" != x; then
+    # Keep paths in /bin as-is, but remove trailing .exe if any
+    new_path="${new_path/%.exe/}"
+    # Do not save /bin paths to all_fixpath_prefixes!
+  else
+    # Not in mixed or Windows style, start by that.
+    new_path=`cmd //c echo $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 \)
+    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+  fi
+
+    # Output is in $new_path
+
+  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
+
+    # remove trailing .exe if any
+    new_path="${new_path/%.exe/}"
+
+    # 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}")
+  fi
+
+    else
+      # We're on a unix platform. Hooray! :)
+      # First separate the path from the arguments. This will split at the first
+      # space.
+      complete="$OTOOL"
+      path="${complete%% *}"
+      tmp="$complete EOL"
+      arguments="${tmp#* }"
+
+      # Cannot rely on the command "which" here since it doesn't always work.
+      is_absolute_path=`$ECHO "$path" | $GREP ^/`
+      if test -z "$is_absolute_path"; then
+        # Path to executable is not absolute. Find it.
+        IFS_save="$IFS"
+        IFS=:
+        for p in $PATH; do
+          if test -f "$p/$path" && test -x "$p/$path"; then
+            new_path="$p/$path"
+            break
+          fi
+        done
+        IFS="$IFS_save"
+      else
+        # This is an absolute path, we can use it without further modifications.
+        new_path="$path"
+      fi
+
+      if test "x$new_path" = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: The path of OTOOL, which resolves as \"$complete\", is not found." >&5
+$as_echo "$as_me: The path of OTOOL, which resolves as \"$complete\", is not found." >&6;}
+        has_space=`$ECHO "$complete" | $GREP " "`
+        if test "x$has_space" != x; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5
+$as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;}
+        fi
+        as_fn_error $? "Cannot locate the the path of OTOOL" "$LINENO" 5
+      fi
+    fi
+
+    # Now join together the path and the arguments once again
+    if test "x$arguments" != xEOL; then
+      new_complete="$new_path ${arguments% *}"
+    else
+      new_complete="$new_path"
+    fi
+
+    if test "x$complete" != "x$new_complete"; then
+      OTOOL="$new_complete"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting OTOOL to \"$new_complete\"" >&5
+$as_echo "$as_me: Rewriting OTOOL to \"$new_complete\"" >&6;}
+    fi
+  fi
+
+
+
+
+  # Publish this variable in the help.
+
+
+  if [ -z "${INSTALL_NAME_TOOL+x}" ]; then
+    # The variable is not set by user, try to locate tool using the code snippet
+    for ac_prog in install_name_tool
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_INSTALL_NAME_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $INSTALL_NAME_TOOL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_INSTALL_NAME_TOOL="$INSTALL_NAME_TOOL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_INSTALL_NAME_TOOL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+INSTALL_NAME_TOOL=$ac_cv_path_INSTALL_NAME_TOOL
+if test -n "$INSTALL_NAME_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL_NAME_TOOL" >&5
+$as_echo "$INSTALL_NAME_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$INSTALL_NAME_TOOL" && break
+done
+
+  else
+    # The variable is set, but is it from the command line or the environment?
+
+    # Try to remove the string !INSTALL_NAME_TOOL! from our list.
+    try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!INSTALL_NAME_TOOL!/}
+    if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
+      # If it failed, the variable was not from the command line. Ignore it,
+      # but warn the user (except for BASH, which is always set by the calling BASH).
+      if test "xINSTALL_NAME_TOOL" != xBASH; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of INSTALL_NAME_TOOL from the environment. Use command line variables instead." >&5
+$as_echo "$as_me: WARNING: Ignoring value of INSTALL_NAME_TOOL from the environment. Use command line variables instead." >&2;}
+      fi
+      # Try to locate tool using the code snippet
+      for ac_prog in install_name_tool
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_INSTALL_NAME_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $INSTALL_NAME_TOOL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_INSTALL_NAME_TOOL="$INSTALL_NAME_TOOL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_INSTALL_NAME_TOOL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+INSTALL_NAME_TOOL=$ac_cv_path_INSTALL_NAME_TOOL
+if test -n "$INSTALL_NAME_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL_NAME_TOOL" >&5
+$as_echo "$INSTALL_NAME_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$INSTALL_NAME_TOOL" && break
+done
+
+    else
+      # If it succeeded, then it was overridden by the user. We will use it
+      # for the tool.
+
+      # First remove it from the list of overridden variables, so we can test
+      # for unknown variables in the end.
+      CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
+
+      # Check if we try to supply an empty value
+      if test "x$INSTALL_NAME_TOOL" = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool INSTALL_NAME_TOOL= (no value)" >&5
+$as_echo "$as_me: Setting user supplied tool INSTALL_NAME_TOOL= (no value)" >&6;}
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for INSTALL_NAME_TOOL" >&5
+$as_echo_n "checking for INSTALL_NAME_TOOL... " >&6; }
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
+$as_echo "disabled" >&6; }
+      else
+        # Check if the provided tool contains a complete path.
+        tool_specified="$INSTALL_NAME_TOOL"
+        tool_basename="${tool_specified##*/}"
+        if test "x$tool_basename" = "x$tool_specified"; then
+          # A command without a complete path is provided, search $PATH.
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool INSTALL_NAME_TOOL=$tool_basename" >&5
+$as_echo "$as_me: Will search for user supplied tool INSTALL_NAME_TOOL=$tool_basename" >&6;}
+          # Extract the first word of "$tool_basename", so it can be a program name with args.
+set dummy $tool_basename; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_INSTALL_NAME_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $INSTALL_NAME_TOOL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_INSTALL_NAME_TOOL="$INSTALL_NAME_TOOL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_INSTALL_NAME_TOOL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+INSTALL_NAME_TOOL=$ac_cv_path_INSTALL_NAME_TOOL
+if test -n "$INSTALL_NAME_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL_NAME_TOOL" >&5
+$as_echo "$INSTALL_NAME_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+          if test "x$INSTALL_NAME_TOOL" = x; then
+            as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
+          fi
+        else
+          # Otherwise we believe it is a complete path. Use it as it is.
+          { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool INSTALL_NAME_TOOL=$tool_specified" >&5
+$as_echo "$as_me: Will use user supplied tool INSTALL_NAME_TOOL=$tool_specified" >&6;}
+          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for INSTALL_NAME_TOOL" >&5
+$as_echo_n "checking for INSTALL_NAME_TOOL... " >&6; }
+          if test ! -x "$tool_specified"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+            as_fn_error $? "User supplied tool INSTALL_NAME_TOOL=$tool_specified does not exist or is not executable" "$LINENO" 5
+          fi
+          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
+$as_echo "$tool_specified" >&6; }
+        fi
+      fi
+    fi
+
+  fi
+
+
+
+  if test "x$INSTALL_NAME_TOOL" = x; then
+    as_fn_error $? "Could not find required tool for INSTALL_NAME_TOOL" "$LINENO" 5
+  fi
+
+
+
+  # Only process if variable expands to non-empty
+
+  if test "x$INSTALL_NAME_TOOL" != x; then
+    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+  # First separate the path from the arguments. This will split at the first
+  # space.
+  complete="$INSTALL_NAME_TOOL"
+  path="${complete%% *}"
+  tmp="$complete EOL"
+  arguments="${tmp#* }"
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  new_path=`$CYGPATH -u "$path"`
+
+  # Now try to locate executable using which
+  new_path=`$WHICH "$new_path" 2> /dev/null`
+  # bat and cmd files are not always considered executable in cygwin causing which
+  # to not find them
+  if test "x$new_path" = x \
+      && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+      && test "x`$LS \"$path\" 2>/dev/null`" != x; then
+    new_path=`$CYGPATH -u "$path"`
+  fi
+  if test "x$new_path" = x; then
+    # Oops. Which didn't find the executable.
+    # The splitting of arguments from the executable at a space might have been incorrect,
+    # since paths with space are more likely in Windows. Give it another try with the whole
+    # argument.
+    path="$complete"
+    arguments="EOL"
+    new_path=`$CYGPATH -u "$path"`
+    new_path=`$WHICH "$new_path" 2> /dev/null`
+    # bat and cmd files are not always considered executable in cygwin causing which
+    # to not find them
+    if test "x$new_path" = x \
+        && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+        && test "x`$LS \"$path\" 2>/dev/null`" != x; then
+      new_path=`$CYGPATH -u "$path"`
+    fi
+    if test "x$new_path" = x; then
+      # It's still not found. Now this is an unrecoverable error.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of INSTALL_NAME_TOOL, which resolves as \"$complete\", is not found." >&5
+$as_echo "$as_me: The path of INSTALL_NAME_TOOL, which resolves as \"$complete\", is not found." >&6;}
+      has_space=`$ECHO "$complete" | $GREP " "`
+      if test "x$has_space" != x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: You might be mixing spaces in the path and extra arguments, which is not allowed." >&5
+$as_echo "$as_me: You might be mixing spaces in the path and extra arguments, which is not allowed." >&6;}
+      fi
+      as_fn_error $? "Cannot locate the the path of INSTALL_NAME_TOOL" "$LINENO" 5
+    fi
+  fi
+
+  # 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 presence.
+  # 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
+    # Short path failed, file does not exist as specified.
+    # Try adding .exe or .cmd
+    if test -f "${new_path}.exe"; then
+      input_to_shortpath="${new_path}.exe"
+    elif test -f "${new_path}.cmd"; then
+      input_to_shortpath="${new_path}.cmd"
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of INSTALL_NAME_TOOL, which resolves as \"$new_path\", is invalid." >&5
+$as_echo "$as_me: The path of INSTALL_NAME_TOOL, which resolves as \"$new_path\", is invalid." >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" >&5
+$as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" >&6;}
+      as_fn_error $? "Cannot locate the the path of INSTALL_NAME_TOOL" "$LINENO" 5
+    fi
+  else
+    input_to_shortpath="$new_path"
+  fi
+
+  # Call helper function which possibly converts this using DOS-style short mode.
+  # If so, the updated path is stored in $new_path.
+  new_path="$input_to_shortpath"
+
+  input_path="$input_to_shortpath"
+  # 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 $input_to_shortpath | $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
+
+  # remove trailing .exe if any
+  new_path="${new_path/%.exe/}"
+
+    elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+  # First separate the path from the arguments. This will split at the first
+  # space.
+  complete="$INSTALL_NAME_TOOL"
+  path="${complete%% *}"
+  tmp="$complete EOL"
+  arguments="${tmp#* }"
+
+  # Input might be given as Windows format, start by converting to
+  # unix format.
+  new_path="$path"
+
+  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
+
+
+  # Now try to locate executable using which
+  new_path=`$WHICH "$new_path" 2> /dev/null`
+
+  if test "x$new_path" = x; then
+    # Oops. Which didn't find the executable.
+    # The splitting of arguments from the executable at a space might have been incorrect,
+    # since paths with space are more likely in Windows. Give it another try with the whole
+    # argument.
+    path="$complete"
+    arguments="EOL"
+    new_path="$path"
+
+  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
+
+
+    new_path=`$WHICH "$new_path" 2> /dev/null`
+    # bat and cmd files are not always considered executable in MSYS causing which
+    # to not find them
+    if test "x$new_path" = x \
+        && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
+        && test "x`$LS \"$path\" 2>/dev/null`" != x; then
+      new_path="$path"
+
+  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
+
+    fi
+
+    if test "x$new_path" = x; then
+      # It's still not found. Now this is an unrecoverable error.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of INSTALL_NAME_TOOL, which resolves as \"$complete\", is not found." >&5
+$as_echo "$as_me: The path of INSTALL_NAME_TOOL, which resolves as \"$complete\", is not found." >&6;}
+      has_space=`$ECHO "$complete" | $GREP " "`
+      if test "x$has_space" != x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: You might be mixing spaces in the path and extra arguments, which is not allowed." >&5
+$as_echo "$as_me: You might be mixing spaces in the path and extra arguments, which is not allowed." >&6;}
+      fi
+      as_fn_error $? "Cannot locate the the path of INSTALL_NAME_TOOL" "$LINENO" 5
+    fi
+  fi
+
+  # Now new_path has a complete unix path to the binary
+  if test "x`$ECHO $new_path | $GREP ^/bin/`" != x; then
+    # Keep paths in /bin as-is, but remove trailing .exe if any
+    new_path="${new_path/%.exe/}"
+    # Do not save /bin paths to all_fixpath_prefixes!
+  else
+    # Not in mixed or Windows style, start by that.
+    new_path=`cmd //c echo $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 \)
+    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+  fi
+
+    # Output is in $new_path
+
+  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
+
+    # remove trailing .exe if any
+    new_path="${new_path/%.exe/}"
+
+    # 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}")
+  fi
+
+    else
+      # We're on a unix platform. Hooray! :)
+      # First separate the path from the arguments. This will split at the first
+      # space.
+      complete="$INSTALL_NAME_TOOL"
+      path="${complete%% *}"
+      tmp="$complete EOL"
+      arguments="${tmp#* }"
+
+      # Cannot rely on the command "which" here since it doesn't always work.
+      is_absolute_path=`$ECHO "$path" | $GREP ^/`
+      if test -z "$is_absolute_path"; then
+        # Path to executable is not absolute. Find it.
+        IFS_save="$IFS"
+        IFS=:
+        for p in $PATH; do
+          if test -f "$p/$path" && test -x "$p/$path"; then
+            new_path="$p/$path"
+            break
+          fi
+        done
+        IFS="$IFS_save"
+      else
+        # This is an absolute path, we can use it without further modifications.
+        new_path="$path"
+      fi
+
+      if test "x$new_path" = x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: The path of INSTALL_NAME_TOOL, which resolves as \"$complete\", is not found." >&5
+$as_echo "$as_me: The path of INSTALL_NAME_TOOL, which resolves as \"$complete\", is not found." >&6;}
+        has_space=`$ECHO "$complete" | $GREP " "`
+        if test "x$has_space" != x; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5
+$as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;}
+        fi
+        as_fn_error $? "Cannot locate the the path of INSTALL_NAME_TOOL" "$LINENO" 5
+      fi
+    fi
+
+    # Now join together the path and the arguments once again
+    if test "x$arguments" != xEOL; then
+      new_complete="$new_path ${arguments% *}"
+    else
+      new_complete="$new_path"
+    fi
+
+    if test "x$complete" != "x$new_complete"; then
+      INSTALL_NAME_TOOL="$new_complete"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting INSTALL_NAME_TOOL to \"$new_complete\"" >&5
+$as_echo "$as_me: Rewriting INSTALL_NAME_TOOL to \"$new_complete\"" >&6;}
+    fi
+  fi
+
   fi
 
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
@@ -54080,13 +54864,13 @@
 else
 
         if test "x$OPENJDK_TARGET_OS" = xaix; then
-          # AIX doesn't support 'zipped' so use 'internal' as default
+          # AIX doesn't support 'external' so use 'internal' as default
           with_native_debug_symbols="internal"
         else
           if test "x$STATIC_BUILD" = xtrue; then
             with_native_debug_symbols="none"
           else
-            with_native_debug_symbols="zipped"
+            with_native_debug_symbols="external"
           fi
         fi
 
@@ -64486,17 +65270,18 @@
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUNDLE_FREETYPE" >&5
 $as_echo "$BUNDLE_FREETYPE" >&6; }
 
-  fi # end freetype needed
-
-  FREETYPE_LICENSE=""
-  if test "x$with_freetype_license" = "xyes"; then
-    as_fn_error $? "--with-freetype-license must have a value" "$LINENO" 5
-  elif test "x$with_freetype_license" != "x"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype license" >&5
+    if test "x$BUNDLE_FREETYPE" = xyes; then
+      FREETYPE_LICENSE=""
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype license" >&5
 $as_echo_n "checking for freetype license... " >&6; }
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_freetype_license" >&5
+      if test "x$with_freetype_license" = "xyes"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+        as_fn_error $? "--with-freetype-license must have a value" "$LINENO" 5
+      elif test "x$with_freetype_license" != "x"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_freetype_license" >&5
 $as_echo "$with_freetype_license" >&6; }
-    FREETYPE_LICENSE="$with_freetype_license"
+        FREETYPE_LICENSE="$with_freetype_license"
 
   # Only process if variable expands to non-empty
 
@@ -64629,10 +65414,154 @@
     fi
   fi
 
-    if test ! -f "$FREETYPE_LICENSE"; then
-      as_fn_error $? "$FREETYPE_LICENSE cannot be found" "$LINENO" 5
-    fi
-  fi
+        if test ! -f "$FREETYPE_LICENSE"; then
+          as_fn_error $? "$FREETYPE_LICENSE cannot be found" "$LINENO" 5
+        fi
+      else
+        if test "x$with_freetype" != "x" && test -f $with_freetype/freetype.md; then
+          FREETYPE_LICENSE="$with_freetype/freetype.md"
+          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LICENSE" >&5
+$as_echo "$FREETYPE_LICENSE" >&6; }
+
+  # Only process if variable expands to non-empty
+
+  if test "x$FREETYPE_LICENSE" != 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="$FREETYPE_LICENSE"
+  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 FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&6;}
+    as_fn_error $? "Cannot locate the the path of FREETYPE_LICENSE" "$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
+    FREETYPE_LICENSE="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&6;}
+  fi
+
+    elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+  path="$FREETYPE_LICENSE"
+  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
+    FREETYPE_LICENSE="$new_path"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting FREETYPE_LICENSE 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="$FREETYPE_LICENSE"
+      has_space=`$ECHO "$path" | $GREP " "`
+      if test "x$has_space" != x; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of FREETYPE_LICENSE, 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 FREETYPE_LICENSE, which resolves as \"$path\", is not found." "$LINENO" 5
+      fi
+
+      if test -d "$path"; then
+        FREETYPE_LICENSE="`cd "$path"; $THEPWDCMD -L`"
+      else
+        dir="`$DIRNAME "$path"`"
+        base="`$BASENAME "$path"`"
+        FREETYPE_LICENSE="`cd "$dir"; $THEPWDCMD -L`/$base"
+      fi
+    fi
+  fi
+
+        else
+          { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+        fi
+      fi
+    fi
+
+  fi # end freetype needed
 
 
 
--- a/make/autoconf/jdk-options.m4	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/autoconf/jdk-options.m4	Sat Dec 02 06:51:10 2017 +0100
@@ -296,13 +296,13 @@
       ],
       [
         if test "x$OPENJDK_TARGET_OS" = xaix; then
-          # AIX doesn't support 'zipped' so use 'internal' as default
+          # AIX doesn't support 'external' so use 'internal' as default
           with_native_debug_symbols="internal"
         else
           if test "x$STATIC_BUILD" = xtrue; then
             with_native_debug_symbols="none"
           else
-            with_native_debug_symbols="zipped"
+            with_native_debug_symbols="external"
           fi
         fi
       ])
--- a/make/autoconf/lib-freetype.m4	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/autoconf/lib-freetype.m4	Sat Dec 02 06:51:10 2017 +0100
@@ -443,20 +443,31 @@
     fi
     AC_MSG_RESULT([$BUNDLE_FREETYPE])
 
-  fi # end freetype needed
+    if test "x$BUNDLE_FREETYPE" = xyes; then
+      FREETYPE_LICENSE=""
+      AC_MSG_CHECKING([for freetype license])
+      if test "x$with_freetype_license" = "xyes"; then
+        AC_MSG_RESULT([no])
+        AC_MSG_ERROR([--with-freetype-license must have a value])
+      elif test "x$with_freetype_license" != "x"; then
+        AC_MSG_RESULT([$with_freetype_license])
+        FREETYPE_LICENSE="$with_freetype_license"
+        BASIC_FIXUP_PATH(FREETYPE_LICENSE)
+        if test ! -f "$FREETYPE_LICENSE"; then
+          AC_MSG_ERROR([$FREETYPE_LICENSE cannot be found])
+        fi
+      else
+        if test "x$with_freetype" != "x" && test -f $with_freetype/freetype.md; then
+          FREETYPE_LICENSE="$with_freetype/freetype.md"
+          AC_MSG_RESULT([$FREETYPE_LICENSE])
+          BASIC_FIXUP_PATH(FREETYPE_LICENSE)
+        else
+          AC_MSG_RESULT([no])
+        fi
+      fi
+    fi
 
-  FREETYPE_LICENSE=""
-  if test "x$with_freetype_license" = "xyes"; then
-    AC_MSG_ERROR([--with-freetype-license must have a value])
-  elif test "x$with_freetype_license" != "x"; then
-    AC_MSG_CHECKING([for freetype license])
-    AC_MSG_RESULT([$with_freetype_license])
-    FREETYPE_LICENSE="$with_freetype_license"
-    BASIC_FIXUP_PATH(FREETYPE_LICENSE)
-    if test ! -f "$FREETYPE_LICENSE"; then
-      AC_MSG_ERROR([$FREETYPE_LICENSE cannot be found])
-    fi
-  fi
+  fi # end freetype needed
 
   AC_SUBST(FREETYPE_BUNDLE_LIB_PATH)
   AC_SUBST(FREETYPE_CFLAGS)
--- a/make/autoconf/spec.gmk.in	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/autoconf/spec.gmk.in	Sat Dec 02 06:51:10 2017 +0100
@@ -471,6 +471,7 @@
 STRIP:=@STRIP@
 
 LIPO:=@LIPO@
+INSTALL_NAME_TOOL:=@INSTALL_NAME_TOOL@
 
 # Options to linker to specify a mapfile.
 # (Note absence of := assignment, because we do not want to evaluate the macro body here)
@@ -565,12 +566,10 @@
 BUILD_JAVA=@FIXPATH@ $(BUILD_JDK)/bin/java $(BUILD_JAVA_FLAGS)
 
 # Interim langtools and rmic modules and arguments
-INTERIM_LANGTOOLS_BASE_MODULES := java.compiler jdk.compiler jdk.jdeps jdk.javadoc
+INTERIM_LANGTOOLS_BASE_MODULES := java.compiler jdk.compiler jdk.javadoc
 INTERIM_LANGTOOLS_MODULES := $(addsuffix .interim, $(INTERIM_LANGTOOLS_BASE_MODULES))
 INTERIM_LANGTOOLS_ADD_EXPORTS := \
     --add-exports java.base/sun.reflect.annotation=jdk.compiler.interim \
-    --add-exports java.base/jdk.internal.util.jar=jdk.jdeps.interim \
-    --add-exports java.base/jdk.internal.misc=jdk.jdeps.interim \
     #
 INTERIM_LANGTOOLS_MODULES_COMMA := $(strip $(subst $(SPACE),$(COMMA),$(strip \
     $(INTERIM_LANGTOOLS_MODULES))))
--- a/make/autoconf/toolchain.m4	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/autoconf/toolchain.m4	Sat Dec 02 06:51:10 2017 +0100
@@ -628,6 +628,10 @@
   if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
     BASIC_PATH_PROGS(LIPO, lipo)
     BASIC_FIXUP_EXECUTABLE(LIPO)
+    BASIC_REQUIRE_PROGS(OTOOL, otool)
+    BASIC_FIXUP_EXECUTABLE(OTOOL)
+    BASIC_REQUIRE_PROGS(INSTALL_NAME_TOOL, install_name_tool)
+    BASIC_FIXUP_EXECUTABLE(INSTALL_NAME_TOOL)
   fi
 
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
--- a/make/conf/jib-profiles.js	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/conf/jib-profiles.js	Sat Dec 02 06:51:10 2017 +0100
@@ -429,7 +429,7 @@
         "macosx-x64": {
             target_os: "macosx",
             target_cpu: "x64",
-            dependencies: ["devkit"],
+            dependencies: ["devkit", "freetype"],
             configure_args: concat(common.configure_args_64bit, "--with-zlib=system",
                 "--with-macosx-version-max=10.7.0"),
         },
@@ -662,21 +662,6 @@
         }
     });
 
-    // The windows ri profile needs to add the freetype license file
-    profilesRiFreetype = {
-        "windows-x86-ri": {
-            configure_args: "--with-freetype-license="
-                + input.get("freetype", "install_path")
-                + "/freetype-2.7.1-v120-x86/freetype.md"
-        },
-        "windows-x64-ri": {
-            configure_args: "--with-freetype-license="
-                + input.get("freetype", "install_path")
-                + "/freetype-2.7.1-v120-x64/freetype.md"
-        }
-    };
-    profiles = concatObjects(profiles, profilesRiFreetype);
-
     // Profiles used to run tests. Used in JPRT and Mach 5.
     var testOnlyProfiles = {
         "run-test-jprt": {
@@ -788,6 +773,12 @@
     var boot_jdk_platform = (input.build_os == "macosx" ? "osx" : input.build_os)
         + "-" + input.build_cpu;
 
+    var freetype_version = {
+        windows_x64: "2.7.1-v120+1.1",
+        windows_x86: "2.7.1-v120+1.1",
+        macosx_x64: "2.7.1-Xcode6.3-MacOSX10.9+1.0"
+    }[input.target_platform];
+
     var dependencies = {
 
         boot_jdk: {
@@ -852,7 +843,7 @@
         freetype: {
             organization: common.organization,
             ext: "tar.gz",
-            revision: "2.7.1-v120+1.0",
+            revision: freetype_version,
             module: "freetype-" + input.target_platform
         },
 
--- a/make/copy/Copy-java.desktop.gmk	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/copy/Copy-java.desktop.gmk	Sat Dec 02 06:51:10 2017 +0100
@@ -44,7 +44,8 @@
 ################################################################################
 
 ifneq ($(FREETYPE_BUNDLE_LIB_PATH), )
-  # We need to bundle the freetype library, so it will be available at runtime as well as link time.
+  # We need to bundle the freetype library, so it will be available at runtime
+  # as well as link time.
   #
   # NB: Default freetype build system uses -h linker option and
   # result .so contains hardcoded library name that is later
@@ -61,10 +62,10 @@
   #
   #TODO: rework this to avoid hardcoding library name in the makefile
   #
-  ifeq ($(OPENJDK_TARGET_OS), windows)
+  ifneq ($(filter $(OPENJDK_TARGET_OS), linux solaris), )
+    FREETYPE_TARGET_LIB := $(LIB_DST_DIR)/$(call SHARED_LIBRARY,freetype).6
+  else
     FREETYPE_TARGET_LIB := $(LIB_DST_DIR)/$(call SHARED_LIBRARY,freetype)
-  else
-    FREETYPE_TARGET_LIB := $(LIB_DST_DIR)/$(call SHARED_LIBRARY,freetype).6
   endif
 
   # We can't use $(install-file) in this rule because it preserves symbolic links and
--- a/make/data/charsetmapping/charsets	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/data/charsetmapping/charsets	Sat Dec 02 06:51:10 2017 +0100
@@ -492,7 +492,7 @@
 
 charset x-MS950-HKSCS MS950_HKSCS
     package sun.nio.cs.ext
-    type    source
+    type    template
     hisname MS950_HKSCS
     ascii   true
     alias   MS950_HKSCS          # JDK historical;
--- a/make/data/charsetmapping/stdcs-windows	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/data/charsetmapping/stdcs-windows	Sat Dec 02 06:51:10 2017 +0100
@@ -13,4 +13,5 @@
 MS936
 MS949
 MS950
+MS950_HKSCS
 MS950_HKSCS_XP
--- a/make/gendata/Gendata-jdk.compiler.gmk	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/gendata/Gendata-jdk.compiler.gmk	Sat Dec 02 06:51:10 2017 +0100
@@ -49,13 +49,13 @@
     --add-exports jdk.compiler.interim/com.sun.tools.javac.code=ALL-UNNAMED \
     --add-exports jdk.compiler.interim/com.sun.tools.javac.util=ALL-UNNAMED \
     --add-exports jdk.compiler.interim/com.sun.tools.javac.jvm=ALL-UNNAMED \
-    --add-exports jdk.jdeps.interim/com.sun.tools.classfile=ALL-UNNAMED \
     #
 
 $(eval $(call SetupJavaCompilation, COMPILE_CREATE_SYMBOLS, \
     SETUP := GENERATE_OLDBYTECODE, \
-    SRC := $(TOPDIR)/make/langtools/src/classes, \
-    INCLUDES := build/tools/symbolgenerator, \
+    SRC := $(TOPDIR)/make/langtools/src/classes \
+        $(TOPDIR)/src/jdk.jdeps/share/classes, \
+    INCLUDES := build/tools/symbolgenerator com/sun/tools/classfile, \
     BIN := $(BUILDTOOLS_OUTPUTDIR)/create_symbols, \
     ADD_JAVAC_FLAGS := $(INTERIM_LANGTOOLS_ARGS) \
         $(COMPILECREATESYMBOLS_ADD_EXPORTS), \
--- a/make/hotspot/symbols/symbols-unix	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/hotspot/symbols/symbols-unix	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
 JVM_ArrayCopy
 JVM_AssertionStatusDirectives
 JVM_CallStackWalk
-JVM_ClassDepth
-JVM_ClassLoaderDepth
 JVM_Clone
 JVM_ConstantPoolGetClassAt
 JVM_ConstantPoolGetClassAtIfLoaded
@@ -47,8 +45,6 @@
 JVM_ConstantPoolGetTagAt
 JVM_ConstantPoolGetUTF8At
 JVM_CountStackFrames
-JVM_CurrentClassLoader
-JVM_CurrentLoadedClass
 JVM_CurrentThread
 JVM_CurrentTimeMillis
 JVM_DefineClass
--- a/make/jdk/src/classes/build/tools/charsetmapping/Main.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/jdk/src/classes/build/tools/charsetmapping/Main.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,7 @@
                 new File(args[SRC_DIR], args[CHARSETS]));
             String[] osStdcs = getOSStdCSList(new File(args[SRC_DIR], args[OS]));
             boolean hasBig5_HKSCS = false;
+            boolean hasMS950_HKSCS = false;
             boolean hasMS950_HKSCS_XP = false;
             boolean hasEUC_TW = false;
             for (String name : osStdcs) {
@@ -63,6 +64,8 @@
                 }
                 if (name.equals("Big5_HKSCS")) {
                     hasBig5_HKSCS = true;
+                } else if (name.equals("MS950_HKSCS")) {
+                    hasMS950_HKSCS = true;
                 } else if (name.equals("MS950_HKSCS_XP")) {
                     hasMS950_HKSCS_XP = true;
                 } else if (name.equals("EUC_TW")) {
@@ -98,12 +101,15 @@
                          args[TEMPLATE],
                          args[OS].endsWith("windows") ? "windows" : "unix");
 
-            // HKSCSMapping2008/XP.java goes together with Big5/MS950XP_HKSCS
-            if (isStandard && hasBig5_HKSCS || isExtended && !hasBig5_HKSCS) {
+            // HKSCSMapping(2008).java goes std if one of Big5_HKSCS MS950_HKSCS
+            // is in std
+            if (isStandard && (hasBig5_HKSCS || hasMS950_HKSCS) ||
+                isExtended && !(hasBig5_HKSCS  || hasMS950_HKSCS)) {
                 HKSCS.genClass2008(args[SRC_DIR], args[DST_DIR],
                                    isStandard ? "sun.nio.cs" : "sun.nio.cs.ext",
                                    new File(args[COPYRIGHT_SRC], "HKSCS.java"));
             }
+            // HKSCS_XPMapping.java goes together with MS950XP_HKSCS
             if (isStandard && hasMS950_HKSCS_XP || isExtended && !hasMS950_HKSCS_XP) {
                 HKSCS.genClassXP(args[SRC_DIR], args[DST_DIR],
                                  isStandard ? "sun.nio.cs" : "sun.nio.cs.ext",
--- a/make/lib/Awt2dLibraries.gmk	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/lib/Awt2dLibraries.gmk	Sat Dec 02 06:51:10 2017 +0100
@@ -658,7 +658,7 @@
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
     LIBRARY := fontmanager, \
-    OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+    OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfontmanager, \
     SRC := $(LIBFONTMANAGER_SRC), \
     EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \
         AccelGlyphCache.c, \
@@ -702,6 +702,21 @@
     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfontmanager, \
 ))
 
+$(INSTALL_LIBRARIES_HERE)/$(call SHARED_LIBRARY,fontmanager): $(BUILD_LIBFONTMANAGER_TARGET)
+	$(install-file)
+        ifneq ($(FREETYPE_BUNDLE_LIB_PATH), )
+          ifeq ($(OPENJDK_TARGET_OS), macosx)
+            # If bundling freetype on macosx, we need to rewrite the rpath location
+            # in the libfontmanager library to point to the bundled location
+	    $(INSTALL_NAME_TOOL) -change \
+	        `$(OTOOL) -D $(FREETYPE_BUNDLE_LIB_PATH)/$(call SHARED_LIBRARY,freetype) | $(TAIL) -n1` \
+	        '@rpath/$(call SHARED_LIBRARY,freetype)' \
+	        $@
+          endif
+        endif
+
+BUILD_LIBFONTMANAGER += $(INSTALL_LIBRARIES_HERE)/$(call SHARED_LIBRARY,fontmanager)
+
 $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
 
 ifneq (, $(findstring $(OPENJDK_TARGET_OS), solaris aix))
--- a/make/mapfiles/libjava/mapfile-vers	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/mapfiles/libjava/mapfile-vers	Sat Dec 02 06:51:10 2017 +0100
@@ -205,10 +205,6 @@
 		Java_java_lang_Runtime_runFinalization0;
 		Java_java_lang_Runtime_totalMemory;
 		Java_java_lang_Runtime_availableProcessors;
-		Java_java_lang_SecurityManager_classDepth;
-		Java_java_lang_SecurityManager_classLoaderDepth0;
-		Java_java_lang_SecurityManager_currentClassLoader0;
-		Java_java_lang_SecurityManager_currentLoadedClass0;
 		Java_java_lang_SecurityManager_getClassContext;
 		Java_java_lang_Shutdown_halt0;
                 Java_java_lang_StackTraceElement_initStackTraceElement;
--- a/make/nashorn/build.xml	Sat Dec 02 11:25:35 2017 +0530
+++ b/make/nashorn/build.xml	Sat Dec 02 06:51:10 2017 +0100
@@ -115,11 +115,11 @@
    </target>
   
 
-  <!-- check minimum ant version required to be 1.8.4 -->
+  <!-- check minimum ant version required to be 1.9.5 -->
   <target name="check-ant-version">
-    <property name="ant.version.required" value="1.8.4"/>
+    <property name="ant.version.required" value="1.9.5"/>
     <antversion property="ant.current.version" />
-    <fail message="The current ant version, ${ant.current.version}, is too old. Please use 1.8.4 or above.">
+    <fail message="The current ant version, ${ant.current.version}, is too old. Please use 1.9.5 or above.">
         <condition>
             <not>
                 <antversion atleast="${ant.version.required}"/>
--- a/src/hotspot/share/prims/jvm.cpp	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/hotspot/share/prims/jvm.cpp	Sat Dec 02 06:51:10 2017 +0100
@@ -3129,64 +3129,6 @@
 
 // java.lang.SecurityManager ///////////////////////////////////////////////////////////////////////
 
-static bool is_trusted_frame(JavaThread* jthread, vframeStream* vfst) {
-  assert(jthread->is_Java_thread(), "must be a Java thread");
-  if (jthread->privileged_stack_top() == NULL) return false;
-  if (jthread->privileged_stack_top()->frame_id() == vfst->frame_id()) {
-    oop loader = jthread->privileged_stack_top()->class_loader();
-    if (loader == NULL) return true;
-    bool trusted = java_lang_ClassLoader::is_trusted_loader(loader);
-    if (trusted) return true;
-  }
-  return false;
-}
-
-JVM_ENTRY(jclass, JVM_CurrentLoadedClass(JNIEnv *env))
-  JVMWrapper("JVM_CurrentLoadedClass");
-  ResourceMark rm(THREAD);
-
-  for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
-    // if a method in a class in a trusted loader is in a doPrivileged, return NULL
-    bool trusted = is_trusted_frame(thread, &vfst);
-    if (trusted) return NULL;
-
-    Method* m = vfst.method();
-    if (!m->is_native()) {
-      InstanceKlass* holder = m->method_holder();
-      oop loader = holder->class_loader();
-      if (loader != NULL && !java_lang_ClassLoader::is_trusted_loader(loader)) {
-        return (jclass) JNIHandles::make_local(env, holder->java_mirror());
-      }
-    }
-  }
-  return NULL;
-JVM_END
-
-
-JVM_ENTRY(jobject, JVM_CurrentClassLoader(JNIEnv *env))
-  JVMWrapper("JVM_CurrentClassLoader");
-  ResourceMark rm(THREAD);
-
-  for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
-
-    // if a method in a class in a trusted loader is in a doPrivileged, return NULL
-    bool trusted = is_trusted_frame(thread, &vfst);
-    if (trusted) return NULL;
-
-    Method* m = vfst.method();
-    if (!m->is_native()) {
-      InstanceKlass* holder = m->method_holder();
-      assert(holder->is_klass(), "just checking");
-      oop loader = holder->class_loader();
-      if (loader != NULL && !java_lang_ClassLoader::is_trusted_loader(loader)) {
-        return JNIHandles::make_local(env, loader);
-      }
-    }
-  }
-  return NULL;
-JVM_END
-
-
 JVM_ENTRY(jobjectArray, JVM_GetClassContext(JNIEnv *env))
   JVMWrapper("JVM_GetClassContext");
   ResourceMark rm(THREAD);
@@ -3226,58 +3168,6 @@
 JVM_END
 
 
-JVM_ENTRY(jint, JVM_ClassDepth(JNIEnv *env, jstring name))
-  JVMWrapper("JVM_ClassDepth");
-  ResourceMark rm(THREAD);
-  Handle h_name (THREAD, JNIHandles::resolve_non_null(name));
-  Handle class_name_str = java_lang_String::internalize_classname(h_name, CHECK_0);
-
-  const char* str = java_lang_String::as_utf8_string(class_name_str());
-  TempNewSymbol class_name_sym = SymbolTable::probe(str, (int)strlen(str));
-  if (class_name_sym == NULL) {
-    return -1;
-  }
-
-  int depth = 0;
-
-  for(vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
-    if (!vfst.method()->is_native()) {
-      InstanceKlass* holder = vfst.method()->method_holder();
-      assert(holder->is_klass(), "just checking");
-      if (holder->name() == class_name_sym) {
-        return depth;
-      }
-      depth++;
-    }
-  }
-  return -1;
-JVM_END
-
-
-JVM_ENTRY(jint, JVM_ClassLoaderDepth(JNIEnv *env))
-  JVMWrapper("JVM_ClassLoaderDepth");
-  ResourceMark rm(THREAD);
-  int depth = 0;
-  for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
-    // if a method in a class in a trusted loader is in a doPrivileged, return -1
-    bool trusted = is_trusted_frame(thread, &vfst);
-    if (trusted) return -1;
-
-    Method* m = vfst.method();
-    if (!m->is_native()) {
-      InstanceKlass* holder = m->method_holder();
-      assert(holder->is_klass(), "just checking");
-      oop loader = holder->class_loader();
-      if (loader != NULL && !java_lang_ClassLoader::is_trusted_loader(loader)) {
-        return depth;
-      }
-      depth++;
-    }
-  }
-  return -1;
-JVM_END
-
-
 // java.lang.Package ////////////////////////////////////////////////////////////////
 
 
--- a/src/java.base/share/classes/java/lang/ClassLoader.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1813,7 +1813,7 @@
     }
 
     /**
-     * Returns the platform class loader for delegation.  All
+     * Returns the platform class loader.  All
      * <a href="#builtinLoaders">platform classes</a> are visible to
      * the platform class loader.
      *
@@ -1843,7 +1843,7 @@
     }
 
     /**
-     * Returns the system class loader for delegation.  This is the default
+     * Returns the system class loader.  This is the default
      * delegation parent for new {@code ClassLoader} instances, and is
      * typically the class loader used to start the application.
      *
@@ -1884,7 +1884,7 @@
      * the application module path then the class path defaults to
      * the current working directory.
      *
-     * @return  The system {@code ClassLoader} for delegation
+     * @return  The system {@code ClassLoader}
      *
      * @throws  SecurityException
      *          If a security manager is present, and the caller's class loader
--- a/src/java.base/share/classes/java/lang/SecurityManager.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/lang/SecurityManager.java	Sat Dec 02 06:51:10 2017 +0100
@@ -101,7 +101,7 @@
  * <code>checkPermission</code> returns quietly. If denied, a
  * <code>SecurityException</code> is thrown.
  * <p>
- * As of Java 2 SDK v1.2, the default implementation of each of the other
+ * The default implementation of each of the other
  * <code>check</code> methods in <code>SecurityManager</code> is to
  * call the <code>SecurityManager checkPermission</code> method
  * to determine if the calling thread has permission to perform the requested
@@ -197,10 +197,10 @@
  * See {@extLink security_guide_permissions
  * Permissions in the Java Development Kit (JDK)}
  * for permission-related information.
- * This document includes, for example, a table listing the various SecurityManager
+ * This document includes a table listing the various SecurityManager
  * <code>check</code> methods and the permission(s) the default
  * implementation of each such method requires.
- * It also contains a table of all the version 1.2 methods
+ * It also contains a table of the methods
  * that require permissions, and for each such method tells
  * which permission it requires.
  *
@@ -228,20 +228,7 @@
  *
  * @since   1.0
  */
-public
-class SecurityManager {
-
-    /**
-     * This field is <code>true</code> if there is a security check in
-     * progress; <code>false</code> otherwise.
-     *
-     * @deprecated This type of security checking is not recommended.
-     *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead. This field is subject to removal in a
-     *  future version of Java SE.
-     */
-    @Deprecated(since="1.2", forRemoval=true)
-    protected boolean inCheck;
+public class SecurityManager {
 
     /*
      * Have we been initialized. Effective against finalizer attacks.
@@ -262,24 +249,6 @@
     }
 
     /**
-     * Tests if there is a security check in progress.
-     *
-     * @return the value of the <code>inCheck</code> field. This field
-     *          should contain <code>true</code> if a security check is
-     *          in progress,
-     *          <code>false</code> otherwise.
-     * @see     java.lang.SecurityManager#inCheck
-     * @deprecated This type of security checking is not recommended.
-     *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead. This method is subject to removal in a
-     *  future version of Java SE.
-     */
-    @Deprecated(since="1.2", forRemoval=true)
-    public boolean getInCheck() {
-        return inCheck;
-    }
-
-    /**
      * Constructs a new <code>SecurityManager</code>.
      *
      * <p> If there is a security manager already installed, this method first
@@ -322,198 +291,6 @@
     protected native Class<?>[] getClassContext();
 
     /**
-     * Returns the class loader of the most recently executing method from
-     * a class defined using a non-system class loader. A non-system
-     * class loader is defined as being a class loader that is not equal to
-     * the system class loader (as returned
-     * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
-     * <p>
-     * This method will return
-     * <code>null</code> in the following three cases:
-     * <ol>
-     *   <li>All methods on the execution stack are from classes
-     *   defined using the system class loader or one of its ancestors.
-     *
-     *   <li>All methods on the execution stack up to the first
-     *   "privileged" caller
-     *   (see {@link java.security.AccessController#doPrivileged})
-     *   are from classes
-     *   defined using the system class loader or one of its ancestors.
-     *
-     *   <li> A call to <code>checkPermission</code> with
-     *   <code>java.security.AllPermission</code> does not
-     *   result in a SecurityException.
-     *
-     * </ol>
-     *
-     * @return  the class loader of the most recent occurrence on the stack
-     *          of a method from a class defined using a non-system class
-     *          loader.
-     *
-     * @deprecated This type of security checking is not recommended.
-     *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead. This method is subject to removal in a
-     *  future version of Java SE.
-     *
-     * @see  java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
-     * @see  #checkPermission(java.security.Permission) checkPermission
-     */
-    @Deprecated(since="1.2", forRemoval=true)
-    protected ClassLoader currentClassLoader() {
-        ClassLoader cl = currentClassLoader0();
-        if ((cl != null) && hasAllPermission())
-            cl = null;
-        return cl;
-    }
-
-    private native ClassLoader currentClassLoader0();
-
-    /**
-     * Returns the class of the most recently executing method from
-     * a class defined using a non-system class loader. A non-system
-     * class loader is defined as being a class loader that is not equal to
-     * the system class loader (as returned
-     * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
-     * <p>
-     * This method will return
-     * <code>null</code> in the following three cases:
-     * <ol>
-     *   <li>All methods on the execution stack are from classes
-     *   defined using the system class loader or one of its ancestors.
-     *
-     *   <li>All methods on the execution stack up to the first
-     *   "privileged" caller
-     *   (see {@link java.security.AccessController#doPrivileged})
-     *   are from classes
-     *   defined using the system class loader or one of its ancestors.
-     *
-     *   <li> A call to <code>checkPermission</code> with
-     *   <code>java.security.AllPermission</code> does not
-     *   result in a SecurityException.
-     *
-     * </ol>
-     *
-     * @return  the class  of the most recent occurrence on the stack
-     *          of a method from a class defined using a non-system class
-     *          loader.
-     *
-     * @deprecated This type of security checking is not recommended.
-     *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead. This method is subject to removal in a
-     *  future version of Java SE.
-     *
-     * @see  java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
-     * @see  #checkPermission(java.security.Permission) checkPermission
-     */
-    @Deprecated(since="1.2", forRemoval=true)
-    protected Class<?> currentLoadedClass() {
-        Class<?> c = currentLoadedClass0();
-        if ((c != null) && hasAllPermission())
-            c = null;
-        return c;
-    }
-
-    /**
-     * Returns the stack depth of the specified class.
-     *
-     * @param   name   the fully qualified name of the class to search for.
-     * @return  the depth on the stack frame of the first occurrence of a
-     *          method from a class with the specified name;
-     *          <code>-1</code> if such a frame cannot be found.
-     * @deprecated This type of security checking is not recommended.
-     *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead. This method is subject to removal in a
-     *  future version of Java SE.
-     */
-    @Deprecated(since="1.2", forRemoval=true)
-    protected native int classDepth(String name);
-
-    /**
-     * Returns the stack depth of the most recently executing method
-     * from a class defined using a non-system class loader.  A non-system
-     * class loader is defined as being a class loader that is not equal to
-     * the system class loader (as returned
-     * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
-     * <p>
-     * This method will return
-     * -1 in the following three cases:
-     * <ol>
-     *   <li>All methods on the execution stack are from classes
-     *   defined using the system class loader or one of its ancestors.
-     *
-     *   <li>All methods on the execution stack up to the first
-     *   "privileged" caller
-     *   (see {@link java.security.AccessController#doPrivileged})
-     *   are from classes
-     *   defined using the system class loader or one of its ancestors.
-     *
-     *   <li> A call to <code>checkPermission</code> with
-     *   <code>java.security.AllPermission</code> does not
-     *   result in a SecurityException.
-     *
-     * </ol>
-     *
-     * @return the depth on the stack frame of the most recent occurrence of
-     *          a method from a class defined using a non-system class loader.
-     *
-     * @deprecated This type of security checking is not recommended.
-     *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead. This method is subject to removal in a
-     *  future version of Java SE.
-     *
-     * @see   java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
-     * @see   #checkPermission(java.security.Permission) checkPermission
-     */
-    @Deprecated(since="1.2", forRemoval=true)
-    protected int classLoaderDepth() {
-        int depth = classLoaderDepth0();
-        if (depth != -1) {
-            if (hasAllPermission())
-                depth = -1;
-            else
-                depth--; // make sure we don't include ourself
-        }
-        return depth;
-    }
-
-    private native int classLoaderDepth0();
-
-    /**
-     * Tests if a method from a class with the specified
-     *         name is on the execution stack.
-     *
-     * @param  name   the fully qualified name of the class.
-     * @return <code>true</code> if a method from a class with the specified
-     *         name is on the execution stack; <code>false</code> otherwise.
-     * @deprecated This type of security checking is not recommended.
-     *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead. This method is subject to removal in a
-     *  future version of Java SE.
-     */
-    @Deprecated(since="1.2", forRemoval=true)
-    protected boolean inClass(String name) {
-        return classDepth(name) >= 0;
-    }
-
-    /**
-     * Basically, tests if a method from a class defined using a
-     *          class loader is on the execution stack.
-     *
-     * @return  <code>true</code> if a call to <code>currentClassLoader</code>
-     *          has a non-null return value.
-     *
-     * @deprecated This type of security checking is not recommended.
-     *  It is recommended that the <code>checkPermission</code>
-     *  call be used instead. This method is subject to removal in a
-     *  future version of Java SE.
-     * @see        #currentClassLoader() currentClassLoader
-     */
-    @Deprecated(since="1.2", forRemoval=true)
-    protected boolean inClassLoader() {
-        return currentClassLoader() != null;
-    }
-
-    /**
      * Creates an object that encapsulates the current execution
      * environment. The result of this method is used, for example, by the
      * three-argument <code>checkConnect</code> method and by the
@@ -1698,64 +1475,32 @@
     }
 
     /**
-     * Throws a <code>SecurityException</code> if the
-     * calling thread is not allowed to access members.
-     * <p>
-     * The default policy is to allow access to PUBLIC members, as well
-     * as access to classes that have the same class loader as the caller.
-     * In all other cases, this method calls <code>checkPermission</code>
-     * with the <code>RuntimePermission("accessDeclaredMembers")
-     * </code> permission.
-     * <p>
-     * If this method is overridden, then a call to
-     * <code>super.checkMemberAccess</code> cannot be made,
-     * as the default implementation of <code>checkMemberAccess</code>
-     * relies on the code being checked being at a stack depth of
-     * 4.
+     * Throws a {@code SecurityException} if the calling thread does
+     * not have {@code AllPermission}.
      *
      * @param clazz the class that reflection is to be performed on.
-     *
      * @param which type of access, PUBLIC or DECLARED.
-     *
-     * @exception  SecurityException if the caller does not have
-     *             permission to access members.
-     * @exception  NullPointerException if the <code>clazz</code> argument is
-     *             <code>null</code>.
-     *
-     * @deprecated This method relies on the caller being at a stack depth
-     *             of 4 which is error-prone and cannot be enforced by the runtime.
-     *             Users of this method should instead invoke {@link #checkPermission}
-     *             directly.
-     *             This method is subject to removal in a future version of Java SE.
-     *
-     * @see java.lang.reflect.Member
+     * @throws  SecurityException if the caller does not have
+     *          {@code AllPermission}
+     * @throws  NullPointerException if the {@code clazz} argument is
+     *          {@code null}
+     * @deprecated This method was originally used to check if the calling
+     *             thread was allowed to access members. It relied on the
+     *             caller being at a stack depth of 4 which is error-prone and
+     *             cannot be enforced by the runtime. The method has been
+     *             obsoleted and code should instead use
+     *             {@link #checkPermission} to check
+     *             {@code RuntimePermission("accessDeclaredMembers")}. This
+     *             method is subject to removal in a future version of Java SE.
      * @since 1.1
      * @see        #checkPermission(java.security.Permission) checkPermission
      */
     @Deprecated(since="1.8", forRemoval=true)
-    @CallerSensitive
     public void checkMemberAccess(Class<?> clazz, int which) {
         if (clazz == null) {
             throw new NullPointerException("class can't be null");
         }
-        if (which != Member.PUBLIC) {
-            Class<?> stack[] = getClassContext();
-            /*
-             * stack depth of 4 should be the caller of one of the
-             * methods in java.lang.Class that invoke checkMember
-             * access. The stack should look like:
-             *
-             * someCaller                        [3]
-             * java.lang.Class.someReflectionAPI [2]
-             * java.lang.Class.checkMemberAccess [1]
-             * SecurityManager.checkMemberAccess [0]
-             *
-             */
-            if ((stack.length<4) ||
-                (stack[3].getClassLoader() != clazz.getClassLoader())) {
-                checkPermission(SecurityConstants.CHECK_MEMBER_ACCESS_PERMISSION);
-            }
-        }
+        checkPermission(SecurityConstants.ALL_PERMISSION);
     }
 
     /**
@@ -1792,8 +1537,6 @@
         checkPermission(new SecurityPermission(target));
     }
 
-    private native Class<?> currentLoadedClass0();
-
     /**
      * Returns the thread group into which to instantiate any new
      * thread being created at the time this is being called.
--- a/src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java	Sat Dec 02 06:51:10 2017 +0100
@@ -263,8 +263,12 @@
      * methods from {@code Object}.
      *
      * @param caller Represents a lookup context with the accessibility
-     *               privileges of the caller.  When used with {@code invokedynamic},
-     *               this is stacked automatically by the VM.
+     *               privileges of the caller.  Specifically, the lookup context
+     *               must have
+     *               <a href="MethodHandles.Lookup.html#privacc">private access</a>
+     *               privileges.
+     *               When used with {@code invokedynamic}, this is stacked
+     *               automatically by the VM.
      * @param invokedName The name of the method to implement.  When used with
      *                    {@code invokedynamic}, this is provided by the
      *                    {@code NameAndType} of the {@code InvokeDynamic}
@@ -294,7 +298,8 @@
      *         instances of the interface named by {@code invokedType}
      * @throws LambdaConversionException If any of the linkage invariants
      *                                   described {@link LambdaMetafactory above}
-     *                                   are violated
+     *                                   are violated, or the lookup context
+     *                                   does not have private access privileges.
      */
     public static CallSite metafactory(MethodHandles.Lookup caller,
                                        String invokedName,
@@ -404,8 +409,12 @@
      * </ul>
      *
      * @param caller Represents a lookup context with the accessibility
-     *               privileges of the caller.  When used with {@code invokedynamic},
-     *               this is stacked automatically by the VM.
+     *               privileges of the caller.  Specifically, the lookup context
+     *               must have
+     *               <a href="MethodHandles.Lookup.html#privacc">private access</a>
+     *               privileges.
+     *               When used with {@code invokedynamic}, this is stacked
+     *               automatically by the VM.
      * @param invokedName The name of the method to implement.  When used with
      *                    {@code invokedynamic}, this is provided by the
      *                    {@code NameAndType} of the {@code InvokeDynamic}
@@ -429,7 +438,8 @@
      *         instances of the interface named by {@code invokedType}
      * @throws LambdaConversionException If any of the linkage invariants
      *                                   described {@link LambdaMetafactory above}
-     *                                   are violated
+     *                                   are violated, or the lookup context
+     *                                   does not have private access privileges.
      */
     public static CallSite altMetafactory(MethodHandles.Lookup caller,
                                           String invokedName,
--- a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Sat Dec 02 06:51:10 2017 +0100
@@ -385,9 +385,16 @@
      * invoked, it returns the result of String concatenation, taking all
      * function arguments passed to the linkage method as inputs for
      * concatenation. The target signature is given by {@code concatType}.
-     * The arguments are concatenated as per requirements stated in JLS 15.18.1
-     * "String Concatenation Operator +". Notably, the inputs are converted as
-     * per JLS 5.1.11 "String Conversion", and combined from left to right.
+     * For a target accepting:
+     * <ul>
+     *     <li>zero inputs, concatenation results in an empty string;</li>
+     *     <li>one input, concatenation results in the single
+     *     input converted as per JLS 5.1.11 "String Conversion"; otherwise</li>
+     *     <li>two or more inputs, the inputs are concatenated as per
+     *     requirements stated in JLS 15.18.1 "String Concatenation Operator +".
+     *     The inputs are converted as per JLS 5.1.11 "String Conversion",
+     *     and combined from left to right.</li>
+     * </ul>
      *
      * <p>Assume the linkage arguments are as follows:
      *
@@ -404,8 +411,12 @@
      * </ul>
      *
      * @param lookup   Represents a lookup context with the accessibility
-     *                 privileges of the caller.  When used with {@code
-     *                 invokedynamic}, this is stacked automatically by the VM.
+     *                 privileges of the caller. Specifically, the lookup
+     *                 context must have
+     *                 <a href="MethodHandles.Lookup.html#privacc">private access</a>
+     *                 privileges.
+     *                 When used with {@code invokedynamic}, this is stacked
+     *                 automatically by the VM.
      * @param name     The name of the method to implement. This name is
      *                 arbitrary, and has no meaning for this linkage method.
      *                 When used with {@code invokedynamic}, this is provided by
@@ -422,7 +433,8 @@
      * concatenation, with dynamic concatenation arguments described by the given
      * {@code concatType}.
      * @throws StringConcatException If any of the linkage invariants described
-     *                               here are violated.
+     *                               here are violated, or the lookup context
+     *                               does not have private access privileges.
      * @throws NullPointerException If any of the incoming arguments is null.
      *                              This will never happen when a bootstrap method
      *                              is called with invokedynamic.
@@ -452,10 +464,17 @@
      * invoked, it returns the result of String concatenation, taking all
      * function arguments and constants passed to the linkage method as inputs for
      * concatenation. The target signature is given by {@code concatType}, and
-     * does not include constants. The arguments are concatenated as per requirements
-     * stated in JLS 15.18.1 "String Concatenation Operator +". Notably, the inputs
-     * are converted as per JLS 5.1.11 "String Conversion", and combined from left
-     * to right.
+     * does not include constants.
+     * For a target accepting:
+     * <ul>
+     *     <li>zero inputs, concatenation results in an empty string;</li>
+     *     <li>one input, concatenation results in the single
+     *     input converted as per JLS 5.1.11 "String Conversion"; otherwise</li>
+     *     <li>two or more inputs, the inputs are concatenated as per
+     *     requirements stated in JLS 15.18.1 "String Concatenation Operator +".
+     *     The inputs are converted as per JLS 5.1.11 "String Conversion",
+     *     and combined from left to right.</li>
+     * </ul>
      *
      * <p>The concatenation <em>recipe</em> is a String description for the way to
      * construct a concatenated String from the arguments and constants. The
@@ -502,9 +521,12 @@
      * </ul>
      *
      * @param lookup    Represents a lookup context with the accessibility
-     *                  privileges of the caller. When used with {@code
-     *                  invokedynamic}, this is stacked automatically by the
-     *                  VM.
+     *                  privileges of the caller. Specifically, the lookup
+     *                  context must have
+     *                  <a href="MethodHandles.Lookup.html#privacc">private access</a>
+     *                  privileges.
+     *                  When used with {@code invokedynamic}, this is stacked
+     *                  automatically by the VM.
      * @param name      The name of the method to implement. This name is
      *                  arbitrary, and has no meaning for this linkage method.
      *                  When used with {@code invokedynamic}, this is provided
@@ -524,7 +546,8 @@
      * concatenation, with dynamic concatenation arguments described by the given
      * {@code concatType}.
      * @throws StringConcatException If any of the linkage invariants described
-     *                               here are violated.
+     *                               here are violated, or the lookup context
+     *                               does not have private access privileges.
      * @throws NullPointerException If any of the incoming arguments is null, or
      *                              any constant in {@code recipe} is null.
      *                              This will never happen when a bootstrap method
--- a/src/java.base/share/classes/java/security/interfaces/DSAKeyPairGenerator.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/security/interfaces/DSAKeyPairGenerator.java	Sat Dec 02 06:51:10 2017 +0100
@@ -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
@@ -32,9 +32,12 @@
  *
  * <p>The {@code initialize} methods may each be called any number
  * of times. If no {@code initialize} method is called on a
- * DSAKeyPairGenerator, the default is to generate 1024-bit keys, using
- * precomputed p, q and g parameters and an instance of SecureRandom as
- * the random bit source.
+ * DSAKeyPairGenerator, each provider that implements this interface
+ * should supply (and document) a default initialization. Note that
+ * defaults may vary across different providers. Additionally, the default
+ * value for a provider may change in a future version. Therefore, it is
+ * recommended to explicitly initialize the DSAKeyPairGenerator instead
+ * of relying on provider-specific defaults.
  *
  * <p>Users wishing to indicate DSA-specific parameters, and to generate a key
  * pair suitable for use with the DSA algorithm typically
@@ -45,12 +48,13 @@
  * KeyPairGenerator {@code getInstance} method with "DSA"
  * as its argument.
  *
- * <li>Initialize the generator by casting the result to a DSAKeyPairGenerator
- * and calling one of the
- * {@code initialize} methods from this DSAKeyPairGenerator interface.
+ * <li>Check if the returned key pair generator is an instance of
+ * DSAKeyPairGenerator before casting the result to a DSAKeyPairGenerator
+ * and calling one of the {@code initialize} methods from this
+ * DSAKeyPairGenerator interface.
  *
  * <li>Generate a key pair by calling the {@code generateKeyPair}
- * method from the KeyPairGenerator class.
+ * method of the KeyPairGenerator class.
  *
  * </ol>
  *
@@ -63,7 +67,7 @@
  * parameters.
  *
  * <p>Note: Some earlier implementations of this interface may not support
- * larger sizes of DSA parameters such as 2048 and 3072-bit.
+ * larger values of DSA parameters such as 3072-bit.
  *
  * @since 1.1
  * @see java.security.KeyPairGenerator
@@ -97,8 +101,7 @@
      * p, q and g parameters. If it is false, the method uses precomputed
      * parameters for the modulus length requested. If there are no
      * precomputed parameters for that modulus length, an exception will be
-     * thrown. It is guaranteed that there will always be
-     * default parameters for modulus lengths of 512 and 1024 bits.
+     * thrown.
      *
      * @param modlen the modulus length in bits. Valid values are any
      * multiple of 64 between 512 and 1024, inclusive, 2048, and 3072.
--- a/src/java.base/share/classes/java/text/DateFormat.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/text/DateFormat.java	Sat Dec 02 06:51:10 2017 +0100
@@ -294,28 +294,27 @@
     private static final long serialVersionUID = 7218322306649953788L;
 
     /**
-     * Overrides Format.
-     * Formats a time object into a time string. Examples of time objects
-     * are a time value expressed in milliseconds and a Date object.
-     * @param obj must be a Number or a Date.
-     * @param toAppendTo the string buffer for the returning time string.
-     * @return the string buffer passed in as toAppendTo, with formatted text appended.
-     * @param fieldPosition keeps track of the position of the field
-     * within the returned string.
-     * On input: an alignment field,
-     * if desired. On output: the offsets of the alignment field. For
-     * example, given a time text "1996.07.10 AD at 15:08:56 PDT",
-     * if the given fieldPosition is DateFormat.YEAR_FIELD, the
-     * begin index and end index of fieldPosition will be set to
-     * 0 and 4, respectively.
-     * Notice that if the same time field appears
-     * more than once in a pattern, the fieldPosition will be set for the first
-     * occurrence of that time field. For instance, formatting a Date to
-     * the time string "1 PM PDT (Pacific Daylight Time)" using the pattern
-     * "h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,
-     * the begin index and end index of fieldPosition will be set to
-     * 5 and 8, respectively, for the first occurrence of the timezone
-     * pattern character 'z'.
+     * Formats the given {@code Object} into a date-time string. The formatted
+     * string is appended to the given {@code StringBuffer}.
+     *
+     * @param obj Must be a {@code Date} or a {@code Number} representing a
+     * millisecond offset from the <a href="../util/Calendar.html#Epoch">Epoch</a>.
+     * @param toAppendTo The string buffer for the returning date-time string.
+     * @param fieldPosition keeps track on the position of the field within
+     * the returned string. For example, given a date-time text
+     * {@code "1996.07.10 AD at 15:08:56 PDT"}, if the given {@code fieldPosition}
+     * is {@link DateFormat#YEAR_FIELD}, the begin index and end index of
+     * {@code fieldPosition} will be set to 0 and 4, respectively.
+     * Notice that if the same date-time field appears more than once in a
+     * pattern, the {@code fieldPosition} will be set for the first occurrence
+     * of that date-time field. For instance, formatting a {@code Date} to the
+     * date-time string {@code "1 PM PDT (Pacific Daylight Time)"} using the
+     * pattern {@code "h a z (zzzz)"} and the alignment field
+     * {@link DateFormat#TIMEZONE_FIELD}, the begin index and end index of
+     * {@code fieldPosition} will be set to 5 and 8, respectively, for the
+     * first occurrence of the timezone pattern character {@code 'z'}.
+     * @return the string buffer passed in as {@code toAppendTo},
+     *         with formatted text appended.
      * @exception IllegalArgumentException if the {@code Format} cannot format
      *            the given {@code obj}.
      * @see java.text.Format
@@ -333,34 +332,35 @@
     }
 
     /**
-     * Formats a Date into a date/time string.
-     * @param date a Date to be formatted into a date/time string.
-     * @param toAppendTo the string buffer for the returning date/time string.
-     * @param fieldPosition keeps track of the position of the field
-     * within the returned string.
-     * On input: an alignment field,
-     * if desired. On output: the offsets of the alignment field. For
-     * example, given a time text "1996.07.10 AD at 15:08:56 PDT",
-     * if the given fieldPosition is DateFormat.YEAR_FIELD, the
-     * begin index and end index of fieldPosition will be set to
-     * 0 and 4, respectively.
-     * Notice that if the same time field appears
-     * more than once in a pattern, the fieldPosition will be set for the first
-     * occurrence of that time field. For instance, formatting a Date to
-     * the time string "1 PM PDT (Pacific Daylight Time)" using the pattern
-     * "h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,
-     * the begin index and end index of fieldPosition will be set to
-     * 5 and 8, respectively, for the first occurrence of the timezone
-     * pattern character 'z'.
-     * @return the string buffer passed in as toAppendTo, with formatted text appended.
+     * Formats a {@link Date} into a date-time string. The formatted
+     * string is appended to the given {@code StringBuffer}.
+     *
+     * @param date a Date to be formatted into a date-time string.
+     * @param toAppendTo the string buffer for the returning date-time string.
+     * @param fieldPosition keeps track on the position of the field within
+     * the returned string. For example, given a date-time text
+     * {@code "1996.07.10 AD at 15:08:56 PDT"}, if the given {@code fieldPosition}
+     * is {@link DateFormat#YEAR_FIELD}, the begin index and end index of
+     * {@code fieldPosition} will be set to 0 and 4, respectively.
+     * Notice that if the same date-time field appears more than once in a
+     * pattern, the {@code fieldPosition} will be set for the first occurrence
+     * of that date-time field. For instance, formatting a {@code Date} to the
+     * date-time string {@code "1 PM PDT (Pacific Daylight Time)"} using the
+     * pattern {@code "h a z (zzzz)"} and the alignment field
+     * {@link DateFormat#TIMEZONE_FIELD}, the begin index and end index of
+     * {@code fieldPosition} will be set to 5 and 8, respectively, for the
+     * first occurrence of the timezone pattern character {@code 'z'}.
+     * @return the string buffer passed in as {@code toAppendTo}, with formatted
+     * text appended.
      */
     public abstract StringBuffer format(Date date, StringBuffer toAppendTo,
                                         FieldPosition fieldPosition);
 
     /**
-     * Formats a Date into a date/time string.
-     * @param date the time value to be formatted into a time string.
-     * @return the formatted time string.
+      * Formats a {@link Date} into a date-time string.
+      *
+      * @param date the time value to be formatted into a date-time string.
+      * @return the formatted date-time string.
      */
     public final String format(Date date)
     {
--- a/src/java.base/share/classes/java/text/DecimalFormat.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/text/DecimalFormat.java	Sat Dec 02 06:51:10 2017 +0100
@@ -480,8 +480,14 @@
      * @param number     the number to format
      * @param toAppendTo the <code>StringBuffer</code> to which the formatted
      *                   text is to be appended
-     * @param pos        On input: an alignment field, if desired.
-     *                   On output: the offsets of the alignment field.
+     * @param pos        keeps track on the position of the field within the
+     *                   returned string. For example, for formatting a number
+     *                   {@code 1234567.89} in {@code Locale.US} locale,
+     *                   if the given {@code fieldPosition} is
+     *                   {@link NumberFormat#INTEGER_FIELD}, the begin index
+     *                   and end index of {@code fieldPosition} will be set
+     *                   to 0 and 9, respectively for the output string
+     *                   {@code 1,234,567.89}.
      * @return           the value passed in as <code>toAppendTo</code>
      * @exception        IllegalArgumentException if <code>number</code> is
      *                   null or not an instance of <code>Number</code>.
@@ -517,8 +523,14 @@
      * Formats a double to produce a string.
      * @param number    The double to format
      * @param result    where the text is to be appended
-     * @param fieldPosition    On input: an alignment field, if desired.
-     * On output: the offsets of the alignment field.
+     * @param fieldPosition    keeps track on the position of the field within
+     *                         the returned string. For example, for formatting
+     *                         a number {@code 1234567.89} in {@code Locale.US}
+     *                         locale, if the given {@code fieldPosition} is
+     *                         {@link NumberFormat#INTEGER_FIELD}, the begin index
+     *                         and end index of {@code fieldPosition} will be set
+     *                         to 0 and 9, respectively for the output string
+     *                         {@code 1,234,567.89}.
      * @exception NullPointerException if {@code result} or
      *            {@code fieldPosition} is {@code null}
      * @exception ArithmeticException if rounding is needed with rounding
@@ -637,8 +649,14 @@
      * Format a long to produce a string.
      * @param number    The long to format
      * @param result    where the text is to be appended
-     * @param fieldPosition    On input: an alignment field, if desired.
-     * On output: the offsets of the alignment field.
+     * @param fieldPosition    keeps track on the position of the field within
+     *                         the returned string. For example, for formatting
+     *                         a number {@code 123456789} in {@code Locale.US}
+     *                         locale, if the given {@code fieldPosition} is
+     *                         {@link NumberFormat#INTEGER_FIELD}, the begin index
+     *                         and end index of {@code fieldPosition} will be set
+     *                         to 0 and 11, respectively for the output string
+     *                         {@code 123,456,789}.
      * @exception       NullPointerException if {@code result} or
      *                  {@code fieldPosition} is {@code null}
      * @exception       ArithmeticException if rounding is needed with rounding
@@ -727,8 +745,14 @@
      * Formats a BigDecimal to produce a string.
      * @param number    The BigDecimal to format
      * @param result    where the text is to be appended
-     * @param fieldPosition    On input: an alignment field, if desired.
-     * On output: the offsets of the alignment field.
+     * @param fieldPosition    keeps track on the position of the field within
+     *                         the returned string. For example, for formatting
+     *                         a number {@code 1234567.89} in {@code Locale.US}
+     *                         locale, if the given {@code fieldPosition} is
+     *                         {@link NumberFormat#INTEGER_FIELD}, the begin index
+     *                         and end index of {@code fieldPosition} will be set
+     *                         to 0 and 9, respectively for the output string
+     *                         {@code 1,234,567.89}.
      * @return The formatted number string
      * @exception        ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
@@ -780,8 +804,14 @@
      * Format a BigInteger to produce a string.
      * @param number    The BigInteger to format
      * @param result    where the text is to be appended
-     * @param fieldPosition    On input: an alignment field, if desired.
-     * On output: the offsets of the alignment field.
+     * @param fieldPosition    keeps track on the position of the field within
+     *                         the returned string. For example, for formatting
+     *                         a number {@code 123456789} in {@code Locale.US}
+     *                         locale, if the given {@code fieldPosition} is
+     *                         {@link NumberFormat#INTEGER_FIELD}, the begin index
+     *                         and end index of {@code fieldPosition} will be set
+     *                         to 0 and 11, respectively for the output string
+     *                         {@code 123,456,789}.
      * @return The formatted number string
      * @exception        ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
--- a/src/java.base/share/classes/java/text/MessageFormat.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/text/MessageFormat.java	Sat Dec 02 06:51:10 2017 +0100
@@ -820,8 +820,8 @@
      *
      * @param arguments an array of objects to be formatted and substituted.
      * @param result where text is appended.
-     * @param pos On input: an alignment field, if desired.
-     *            On output: the offsets of the alignment field.
+     * @param pos keeps track on the position of the first replaced argument
+                  in the output string.
      * @return the string buffer passed in as {@code result}, with formatted
      * text appended
      * @exception IllegalArgumentException if an argument in the
@@ -868,8 +868,8 @@
      *
      * @param arguments an array of objects to be formatted and substituted.
      * @param result where text is appended.
-     * @param pos On input: an alignment field, if desired.
-     *            On output: the offsets of the alignment field.
+     * @param pos keeps track on the position of the first replaced argument
+     *            in the output string.
      * @exception IllegalArgumentException if an argument in the
      *            <code>arguments</code> array is not of the type
      *            expected by the format element(s) that use it.
@@ -1239,11 +1239,11 @@
     private int maxOffset = -1;
 
     /**
-     * Internal routine used by format. If <code>characterIterators</code> is
-     * non-null, AttributedCharacterIterator will be created from the
-     * subformats as necessary. If <code>characterIterators</code> is null
-     * and <code>fp</code> is non-null and identifies
-     * <code>Field.MESSAGE_ARGUMENT</code>, the location of
+     * Internal routine used by format. If {@code characterIterators} is
+     * {@code non-null}, AttributedCharacterIterator will be created from the
+     * subformats as necessary. If {@code characterIterators} is {@code null}
+     * and {@code fp} is {@code non-null} and identifies
+     * {@code Field.ARGUMENT} as the field attribute, the location of
      * the first replaced argument will be set in it.
      *
      * @exception IllegalArgumentException if an argument in the
--- a/src/java.base/share/classes/java/text/NumberFormat.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/text/NumberFormat.java	Sat Dec 02 06:51:10 2017 +0100
@@ -240,8 +240,14 @@
      * @param number     the number to format
      * @param toAppendTo the <code>StringBuffer</code> to which the formatted
      *                   text is to be appended
-     * @param pos        On input: an alignment field, if desired.
-     *                   On output: the offsets of the alignment field.
+     * @param pos        keeps track on the position of the field within the
+     *                   returned string. For example, for formatting a number
+     *                   {@code 1234567.89} in {@code Locale.US} locale,
+     *                   if the given {@code fieldPosition} is
+     *                   {@link NumberFormat#INTEGER_FIELD}, the begin index
+     *                   and end index of {@code fieldPosition} will be set
+     *                   to 0 and 9, respectively for the output string
+     *                   {@code 1,234,567.89}.
      * @return           the value passed in as <code>toAppendTo</code>
      * @exception        IllegalArgumentException if <code>number</code> is
      *                   null or not an instance of <code>Number</code>.
@@ -342,7 +348,14 @@
      * @param number     the double number to format
      * @param toAppendTo the StringBuffer to which the formatted text is to be
      *                   appended
-     * @param pos        the field position
+     * @param pos        keeps track on the position of the field within the
+     *                   returned string. For example, for formatting a number
+     *                   {@code 1234567.89} in {@code Locale.US} locale,
+     *                   if the given {@code fieldPosition} is
+     *                   {@link NumberFormat#INTEGER_FIELD}, the begin index
+     *                   and end index of {@code fieldPosition} will be set
+     *                   to 0 and 9, respectively for the output string
+     *                   {@code 1,234,567.89}.
      * @return the formatted StringBuffer
      * @exception        ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
@@ -358,7 +371,14 @@
      * @param number     the long number to format
      * @param toAppendTo the StringBuffer to which the formatted text is to be
      *                   appended
-     * @param pos        the field position
+     * @param pos        keeps track on the position of the field within the
+     *                   returned string. For example, for formatting a number
+     *                   {@code 123456789} in {@code Locale.US} locale,
+     *                   if the given {@code fieldPosition} is
+     *                   {@link NumberFormat#INTEGER_FIELD}, the begin index
+     *                   and end index of {@code fieldPosition} will be set
+     *                   to 0 and 11, respectively for the output string
+     *                   {@code 123,456,789}.
      * @return the formatted StringBuffer
      * @exception        ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
--- a/src/java.base/share/classes/java/text/SimpleDateFormat.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/text/SimpleDateFormat.java	Sat Dec 02 06:51:10 2017 +0100
@@ -942,8 +942,19 @@
      *
      * @param date the date-time value to be formatted into a date-time string.
      * @param toAppendTo where the new date-time text is to be appended.
-     * @param pos the formatting position. On input: an alignment field,
-     * if desired. On output: the offsets of the alignment field.
+     * @param pos keeps track on the position of the field within
+     * the returned string. For example, given a date-time text
+     * {@code "1996.07.10 AD at 15:08:56 PDT"}, if the given {@code fieldPosition}
+     * is {@link DateFormat#YEAR_FIELD}, the begin index and end index of
+     * {@code fieldPosition} will be set to 0 and 4, respectively.
+     * Notice that if the same date-time field appears more than once in a
+     * pattern, the {@code fieldPosition} will be set for the first occurrence
+     * of that date-time field. For instance, formatting a {@code Date} to the
+     * date-time string {@code "1 PM PDT (Pacific Daylight Time)"} using the
+     * pattern {@code "h a z (zzzz)"} and the alignment field
+     * {@link DateFormat#TIMEZONE_FIELD}, the begin index and end index of
+     * {@code fieldPosition} will be set to 5 and 8, respectively, for the
+     * first occurrence of the timezone pattern character {@code 'z'}.
      * @return the formatted date-time string.
      * @exception NullPointerException if any of the parameters is {@code null}.
      */
--- a/src/java.base/share/classes/java/util/Collection.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/util/Collection.java	Sat Dec 02 06:51:10 2017 +0100
@@ -192,7 +192,8 @@
      * Returns an array containing all of the elements in this collection.
      * If this collection makes any guarantees as to what order its elements
      * are returned by its iterator, this method must return the elements in
-     * the same order.
+     * the same order. The returned array's {@linkplain Class#getComponentType
+     * runtime component type} is {@code Object}.
      *
      * <p>The returned array will be "safe" in that no references to it are
      * maintained by this collection.  (In other words, this method must
@@ -202,7 +203,8 @@
      * <p>This method acts as bridge between array-based and collection-based
      * APIs.
      *
-     * @return an array containing all of the elements in this collection
+     * @return an array, whose {@linkplain Class#getComponentType runtime component
+     * type} is {@code Object}, containing all of the elements in this collection
      */
     Object[] toArray();
 
@@ -239,14 +241,14 @@
      * Note that {@code toArray(new Object[0])} is identical in function to
      * {@code toArray()}.
      *
-     * @param <T> the runtime type of the array to contain the collection
+     * @param <T> the component type of the array to contain the collection
      * @param a the array into which the elements of this collection are to be
      *        stored, if it is big enough; otherwise, a new array of the same
      *        runtime type is allocated for this purpose.
      * @return an array containing all of the elements in this collection
-     * @throws ArrayStoreException if the runtime type of the specified array
-     *         is not a supertype of the runtime type of every element in
-     *         this collection
+     * @throws ArrayStoreException if the runtime type of any element in this
+     *         collection is not assignable to the {@linkplain Class#getComponentType
+     *         runtime component type} of the specified array
      * @throws NullPointerException if the specified array is null
      */
     <T> T[] toArray(T[] a);
--- a/src/java.base/share/classes/java/util/jar/JarEntry.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/util/jar/JarEntry.java	Sat Dec 02 06:51:10 2017 +0100
@@ -128,4 +128,25 @@
     public CodeSigner[] getCodeSigners() {
         return signers == null ? null : signers.clone();
     }
+
+    /**
+     * Returns the real name of this {@code JarEntry}.
+     *
+     * If this {@code JarEntry} is an entry of a
+     * <a href="JarFile.html#multirelease">multi-release jar file</a> and the
+     * {@code JarFile} is configured to be processed as such, the name returned
+     * by this method is the path name of the versioned entry that the
+     * {@code JarEntry} represents, rather than the path name of the base entry
+     * that {@link #getName()} returns. If the {@code JarEntry} does not represent
+     * a versioned entry of a multi-release {@code JarFile} or the {@code JarFile}
+     * is not configured for processing a multi-release jar file, this method
+     * returns the same name that {@link #getName()} returns.
+     *
+     * @return the real name of the JarEntry
+     *
+     * @since 10
+     */
+    public String getRealName() {
+        return super.getName();
+    }
 }
--- a/src/java.base/share/classes/java/util/jar/JarFile.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/util/jar/JarFile.java	Sat Dec 02 06:51:10 2017 +0100
@@ -26,6 +26,7 @@
 package java.util.jar;
 
 import jdk.internal.misc.SharedSecrets;
+import jdk.internal.misc.JavaUtilZipFileAccess;
 import sun.security.action.GetPropertyAction;
 import sun.security.util.ManifestEntryVerifier;
 import sun.security.util.SignatureFileVerifier;
@@ -45,10 +46,12 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.Objects;
 import java.util.Spliterator;
 import java.util.Spliterators;
+import java.util.stream.Collector;
 import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
 import java.util.zip.ZipEntry;
@@ -163,9 +166,13 @@
     // true if manifest checked for special attributes
     private volatile boolean hasCheckedSpecialAttributes;
 
+    private static final JavaUtilZipFileAccess JUZFA;
+
     static {
         // Set up JavaUtilJarAccess in SharedSecrets
         SharedSecrets.setJavaUtilJarAccess(new JavaUtilJarAccessImpl());
+        // Get JavaUtilZipFileAccess from SharedSecrets
+        JUZFA = jdk.internal.misc.SharedSecrets.getJavaUtilZipFileAccess();
         // multi-release jar file versions >= 9
         BASE_VERSION = Runtime.Version.parse(Integer.toString(8));
         BASE_VERSION_MAJOR = BASE_VERSION.major();
@@ -424,8 +431,7 @@
     }
 
     private String[] getMetaInfEntryNames() {
-        return jdk.internal.misc.SharedSecrets.getJavaUtilZipFileAccess()
-                                              .getMetaInfEntryNames((ZipFile)this);
+        return JUZFA.getMetaInfEntryNames((ZipFile)this);
     }
 
     /**
@@ -497,47 +503,11 @@
      * </div>
      */
     public ZipEntry getEntry(String name) {
-        ZipEntry ze = super.getEntry(name);
-        if (ze != null) {
-            return new JarFileEntry(ze);
-        }
-        // no matching base entry, but maybe there is a versioned entry,
-        // like a new private class
+        JarFileEntry je = getEntry0(name);
         if (isMultiRelease()) {
-            ze = new ZipEntry(name);
-            ZipEntry vze = getVersionedEntry(ze);
-            if (ze != vze) {
-                return new JarFileEntry(name, vze);
-            }
+            return getVersionedEntry(name, je);
         }
-        return null;
-    }
-
-    private class JarEntryIterator implements Enumeration<JarEntry>,
-            Iterator<JarEntry>
-    {
-        final Enumeration<? extends ZipEntry> e = JarFile.super.entries();
-
-        public boolean hasNext() {
-            return e.hasMoreElements();
-        }
-
-        public JarEntry next() {
-            ZipEntry ze = e.nextElement();
-            return new JarFileEntry(ze.getName(), ze);
-        }
-
-        public boolean hasMoreElements() {
-            return hasNext();
-        }
-
-        public JarEntry nextElement() {
-            return next();
-        }
-
-        public Iterator<JarEntry> asIterator() {
-            return this;
-        }
+        return je;
     }
 
     /**
@@ -548,7 +518,7 @@
      *         may be thrown if the jar file has been closed
      */
     public Enumeration<JarEntry> entries() {
-        return new JarEntryIterator();
+        return JUZFA.entries(this, JarFileEntry::new);
     }
 
     /**
@@ -561,68 +531,100 @@
      * @since 1.8
      */
     public Stream<JarEntry> stream() {
-        return StreamSupport.stream(Spliterators.spliterator(
-                new JarEntryIterator(), size(),
-                Spliterator.ORDERED | Spliterator.DISTINCT |
-                        Spliterator.IMMUTABLE | Spliterator.NONNULL), false);
-    }
-
-    private ZipEntry searchForVersionedEntry(final int version, String name) {
-        ZipEntry vze = null;
-        String sname = "/" + name;
-        int i = version;
-        while (i > BASE_VERSION_MAJOR) {
-            vze = super.getEntry(META_INF_VERSIONS + i + sname);
-            if (vze != null) break;
-            i--;
-        }
-        return vze;
-    }
-
-    private ZipEntry getVersionedEntry(ZipEntry ze) {
-        ZipEntry vze = null;
-        if (BASE_VERSION_MAJOR < versionMajor) {
-            String name = ze.getName();
-            if (!name.startsWith(META_INF)) {
-                vze = searchForVersionedEntry(versionMajor, name);
-            }
-        }
-        return vze == null ? ze : vze;
+        return JUZFA.stream(this, JarFileEntry::new);
     }
 
     /**
-     * Returns the real name of a {@code JarEntry}.  If this {@code JarFile} is
-     * a multi-release jar file and is configured to be processed as such, the
-     * name returned by this method is the path name of the versioned entry
-     * that the {@code JarEntry} represents, rather than the path name of the
-     * base entry that {@link JarEntry#getName()} returns.  If the
-     * {@code JarEntry} does not represent a versioned entry, or the
-     * jar file is not a multi-release jar file or {@code JarFile} is not
-     * configured for processing a multi-release jar file, this method returns
-     * the same name that {@link JarEntry#getName()} returns.
+     * Returns a {@code Stream} of the versioned jar file entries.
+     *
+     * <p>If this {@code JarFile} is a multi-release jar file and is configured to
+     * be processed as such, then an entry in the stream is the latest versioned entry
+     * associated with the corresponding base entry name. The maximum version of the
+     * latest versioned entry is the version returned by {@link #getVersion()}.
+     * The returned stream may include an entry that only exists as a versioned entry.
+     *
+     * If the jar file is not a multi-release jar file or the {@code JarFile} is not
+     * configured for processing a multi-release jar file, this method returns the
+     * same stream that {@link #stream()} returns.
      *
-     * @param entry the JarEntry
-     * @return the real name of the JarEntry
-     * @since 9
+     * @return stream of versioned entries
+     * @since 10
+     */
+    public Stream<JarEntry> versionedStream() {
+
+        if (isMultiRelease()) {
+            return JUZFA.entryNameStream(this).map(this::getBasename)
+                                              .filter(Objects::nonNull)
+                                              .distinct()
+                                              .map(this::getJarEntry);
+        }
+        return stream();
+    }
+
+    /*
+     * Invokes {@ZipFile}'s getEntry to Return a {@code JarFileEntry} for the
+     * given entry name or {@code null} if not found.
      */
+    private JarFileEntry getEntry0(String name) {
+        return (JarFileEntry)JUZFA.getEntry(this, name, JarFileEntry::new);
+    }
+
+    private String getBasename(String name) {
+        if (name.startsWith(META_INF_VERSIONS)) {
+            int off = META_INF_VERSIONS.length();
+            int index = name.indexOf('/', off);
+            try {
+                // filter out dir META-INF/versions/ and META-INF/versions/*/
+                // and any entry with version > 'version'
+                if (index == -1 || index == (name.length() - 1) ||
+                    Integer.parseInt(name, off, index, 10) > versionMajor) {
+                    return null;
+                }
+            } catch (NumberFormatException x) {
+                return null; // remove malformed entries silently
+            }
+            // map to its base name
+            return name.substring(index + 1);
+        }
+        return name;
+    }
+
+    private JarEntry getVersionedEntry(String name, JarEntry je) {
+        if (BASE_VERSION_MAJOR < versionMajor) {
+            if (!name.startsWith(META_INF)) {
+                // search for versioned entry
+                int v = versionMajor;
+                while (v > BASE_VERSION_MAJOR) {
+                    JarFileEntry vje = getEntry0(META_INF_VERSIONS + v + "/" + name);
+                    if (vje != null) {
+                        return vje.withBasename(name);
+                    }
+                    v--;
+                }
+            }
+        }
+        return je;
+    }
+
+    // placeholder for now
     String getRealName(JarEntry entry) {
-        if (entry instanceof JarFileEntry) {
-            return ((JarFileEntry)entry).realName();
-        }
-        return entry.getName();
+        return entry.getRealName();
     }
 
     private class JarFileEntry extends JarEntry {
-        final private String name;
+        private String basename;
 
-        JarFileEntry(ZipEntry ze) {
-            super(isMultiRelease() ? getVersionedEntry(ze) : ze);
-            this.name = ze.getName();
+        JarFileEntry(String name) {
+            super(name);
+            this.basename = name;
         }
+
         JarFileEntry(String name, ZipEntry vze) {
             super(vze);
-            this.name = name;
+            this.basename = name;
         }
+
+        @Override
         public Attributes getAttributes() throws IOException {
             Manifest man = JarFile.this.getManifest();
             if (man != null) {
@@ -631,6 +633,8 @@
                 return null;
             }
         }
+
+        @Override
         public Certificate[] getCertificates() {
             try {
                 maybeInstantiateVerifier();
@@ -642,6 +646,8 @@
             }
             return certs == null ? null : certs.clone();
         }
+
+        @Override
         public CodeSigner[] getCodeSigners() {
             try {
                 maybeInstantiateVerifier();
@@ -653,20 +659,30 @@
             }
             return signers == null ? null : signers.clone();
         }
-        JarFileEntry realEntry() {
-            if (isMultiRelease() && versionMajor != BASE_VERSION_MAJOR) {
-                String entryName = super.getName();
-                return entryName.equals(this.name) ? this : new JarFileEntry(entryName, this);
-            }
-            return this;
-        }
-        String realName() {
+
+        @Override
+        public String getRealName() {
             return super.getName();
         }
 
         @Override
         public String getName() {
-            return name;
+            return basename;
+        }
+
+        JarFileEntry realEntry() {
+            if (isMultiRelease() && versionMajor != BASE_VERSION_MAJOR) {
+                String entryName = super.getName();
+                return entryName == basename || entryName.equals(basename) ?
+                        this : new JarFileEntry(entryName, this);
+            }
+            return this;
+        }
+
+        // changes the basename, returns "this"
+        JarFileEntry withBasename(String name) {
+            basename = name;
+            return this;
         }
     }
 
@@ -704,7 +720,6 @@
         }
     }
 
-
     /*
      * Initializes the verifier object by reading all the manifest
      * entries and passing them to the verifier.
@@ -904,7 +919,7 @@
     private JarEntry getManEntry() {
         if (manEntry == null) {
             // First look up manifest entry using standard name
-            ZipEntry manEntry = super.getEntry(MANIFEST_NAME);
+            JarEntry manEntry = getEntry0(MANIFEST_NAME);
             if (manEntry == null) {
                 // If not found, then iterate through all the "META-INF/"
                 // entries to find a match.
@@ -912,15 +927,13 @@
                 if (names != null) {
                     for (String name : names) {
                         if (MANIFEST_NAME.equals(name.toUpperCase(Locale.ENGLISH))) {
-                            manEntry = super.getEntry(name);
+                            manEntry = getEntry0(name);
                             break;
                         }
                     }
                 }
             }
-            this.manEntry = (manEntry == null)
-                    ? null
-                    : new JarFileEntry(manEntry.getName(), manEntry);
+            this.manEntry = manEntry;
         }
         return manEntry;
     }
@@ -1032,8 +1045,32 @@
         }
     }
 
-    JarEntry newEntry(ZipEntry ze) {
-        return new JarFileEntry(ze);
+    /*
+     * Returns a versioned {@code JarFileEntry} for the given entry,
+     * if there is one. Otherwise returns the original entry. This
+     * is invoked by the {@code entries2} for verifier.
+     */
+    JarEntry newEntry(JarEntry je) {
+        if (isMultiRelease()) {
+            return getVersionedEntry(je.getName(), je);
+        }
+        return je;
+    }
+
+    /*
+     * Returns a versioned {@code JarFileEntry} for the given entry
+     * name, if there is one. Otherwise returns a {@code JarFileEntry}
+     * with the given name. It is invoked from JarVerifier's entries2
+     * for {@code singers}.
+     */
+    JarEntry newEntry(String name) {
+        if (isMultiRelease()) {
+            JarEntry vje = getVersionedEntry(name, (JarEntry)null);
+            if (vje != null) {
+                return vje;
+            }
+        }
+        return new JarFileEntry(name);
     }
 
     Enumeration<String> entryNames(CodeSource[] cs) {
@@ -1077,35 +1114,37 @@
     Enumeration<JarEntry> entries2() {
         ensureInitialization();
         if (jv != null) {
-            return jv.entries2(this, super.entries());
+            return jv.entries2(this, JUZFA.entries(JarFile.this,
+                                                   JarFileEntry::new));
         }
 
         // screen out entries which are never signed
-        final Enumeration<? extends ZipEntry> enum_ = super.entries();
+        final var unfilteredEntries = JUZFA.entries(JarFile.this, JarFileEntry::new);
+
         return new Enumeration<>() {
 
-            ZipEntry entry;
+            JarEntry entry;
 
             public boolean hasMoreElements() {
                 if (entry != null) {
                     return true;
                 }
-                while (enum_.hasMoreElements()) {
-                    ZipEntry ze = enum_.nextElement();
-                    if (JarVerifier.isSigningRelated(ze.getName())) {
+                while (unfilteredEntries.hasMoreElements()) {
+                    JarEntry je = unfilteredEntries.nextElement();
+                    if (JarVerifier.isSigningRelated(je.getName())) {
                         continue;
                     }
-                    entry = ze;
+                    entry = je;
                     return true;
                 }
                 return false;
             }
 
-            public JarFileEntry nextElement() {
+            public JarEntry nextElement() {
                 if (hasMoreElements()) {
-                    ZipEntry ze = entry;
+                    JarEntry je = entry;
                     entry = null;
-                    return new JarFileEntry(ze);
+                    return newEntry(je);
                 }
                 throw new NoSuchElementException();
             }
--- a/src/java.base/share/classes/java/util/jar/JarVerifier.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/util/jar/JarVerifier.java	Sat Dec 02 06:51:10 2017 +0100
@@ -724,10 +724,10 @@
      * Like entries() but screens out internal JAR mechanism entries
      * and includes signed entries with no ZIP data.
      */
-    public Enumeration<JarEntry> entries2(final JarFile jar, Enumeration<? extends ZipEntry> e) {
+    public Enumeration<JarEntry> entries2(final JarFile jar, Enumeration<JarEntry> e) {
         final Map<String, CodeSigner[]> map = new HashMap<>();
         map.putAll(signerMap());
-        final Enumeration<? extends ZipEntry> enum_ = e;
+        final Enumeration<JarEntry> enum_ = e;
         return new Enumeration<>() {
 
             Enumeration<String> signers = null;
@@ -738,11 +738,11 @@
                     return true;
                 }
                 while (enum_.hasMoreElements()) {
-                    ZipEntry ze = enum_.nextElement();
-                    if (JarVerifier.isSigningRelated(ze.getName())) {
+                    JarEntry je = enum_.nextElement();
+                    if (JarVerifier.isSigningRelated(je.getName())) {
                         continue;
                     }
-                    entry = jar.newEntry(ze);
+                    entry = jar.newEntry(je);
                     return true;
                 }
                 if (signers == null) {
@@ -750,7 +750,7 @@
                 }
                 while (signers.hasMoreElements()) {
                     String name = signers.nextElement();
-                    entry = jar.newEntry(new ZipEntry(name));
+                    entry = jar.newEntry(name);
                     return true;
                 }
 
--- a/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java	Sat Dec 02 06:51:10 2017 +0100
@@ -60,8 +60,4 @@
     public List<Object> getManifestDigests(JarFile jar) {
         return jar.getManifestDigests();
     }
-
-    public String getRealName(JarFile jar, JarEntry entry) {
-        return jar.getRealName(entry);
-    }
 }
--- a/src/java.base/share/classes/java/util/stream/DoubleStream.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/util/stream/DoubleStream.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1089,11 +1089,27 @@
      * streams is parallel.  When the resulting stream is closed, the close
      * handlers for both input streams are invoked.
      *
+     * <p>This method operates on the two input streams and binds each stream
+     * to its source.  As a result subsequent modifications to an input stream
+     * source may not be reflected in the concatenated stream result.
+     *
      * @implNote
      * Use caution when constructing streams from repeated concatenation.
      * Accessing an element of a deeply concatenated stream can result in deep
      * call chains, or even {@code StackOverflowError}.
      *
+     * @apiNote
+     * To preserve optimization opportunities this method binds each stream to
+     * its source and accepts only two streams as parameters.  For example, the
+     * exact size of the concatenated stream source can be computed if the exact
+     * size of each input stream source is known.
+     * To concatenate more streams without binding, or without nested calls to
+     * this method, try creating a stream of streams and flat-mapping with the
+     * identity function, for example:
+     * <pre>{@code
+     *     DoubleStream concat = Stream.of(s1, s2, s3, s4).flatMapToDouble(s -> s);
+     * }</pre>
+     *
      * @param a the first stream
      * @param b the second stream
      * @return the concatenation of the two input streams
--- a/src/java.base/share/classes/java/util/stream/IntStream.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/util/stream/IntStream.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1081,11 +1081,27 @@
      * streams is parallel.  When the resulting stream is closed, the close
      * handlers for both input streams are invoked.
      *
+     * <p>This method operates on the two input streams and binds each stream
+     * to its source.  As a result subsequent modifications to an input stream
+     * source may not be reflected in the concatenated stream result.
+     *
      * @implNote
      * Use caution when constructing streams from repeated concatenation.
      * Accessing an element of a deeply concatenated stream can result in deep
      * call chains, or even {@code StackOverflowError}.
      *
+     * @apiNote
+     * To preserve optimization opportunities this method binds each stream to
+     * its source and accepts only two streams as parameters.  For example, the
+     * exact size of the concatenated stream source can be computed if the exact
+     * size of each input stream source is known.
+     * To concatenate more streams without binding, or without nested calls to
+     * this method, try creating a stream of streams and flat-mapping with the
+     * identity function, for example:
+     * <pre>{@code
+     *     IntStream concat = Stream.of(s1, s2, s3, s4).flatMapToInt(s -> s);
+     * }</pre>
+     *
      * @param a the first stream
      * @param b the second stream
      * @return the concatenation of the two input streams
--- a/src/java.base/share/classes/java/util/stream/LongStream.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/util/stream/LongStream.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1086,11 +1086,27 @@
      * streams is parallel.  When the resulting stream is closed, the close
      * handlers for both input streams are invoked.
      *
+     * <p>This method operates on the two input streams and binds each stream
+     * to its source.  As a result subsequent modifications to an input stream
+     * source may not be reflected in the concatenated stream result.
+     *
      * @implNote
      * Use caution when constructing streams from repeated concatenation.
      * Accessing an element of a deeply concatenated stream can result in deep
      * call chains, or even {@code StackOverflowError}.
      *
+     * @apiNote
+     * To preserve optimization opportunities this method binds each stream to
+     * its source and accepts only two streams as parameters.  For example, the
+     * exact size of the concatenated stream source can be computed if the exact
+     * size of each input stream source is known.
+     * To concatenate more streams without binding, or without nested calls to
+     * this method, try creating a stream of streams and flat-mapping with the
+     * identity function, for example:
+     * <pre>{@code
+     *     LongStream concat = Stream.of(s1, s2, s3, s4).flatMapToLong(s -> s);
+     * }</pre>
+     *
      * @param a the first stream
      * @param b the second stream
      * @return the concatenation of the two input streams
--- a/src/java.base/share/classes/java/util/stream/Stream.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/util/stream/Stream.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1341,6 +1341,10 @@
      * streams is parallel.  When the resulting stream is closed, the close
      * handlers for both input streams are invoked.
      *
+     * <p>This method operates on the two input streams and binds each stream
+     * to its source.  As a result subsequent modifications to an input stream
+     * source may not be reflected in the concatenated stream result.
+     *
      * @implNote
      * Use caution when constructing streams from repeated concatenation.
      * Accessing an element of a deeply concatenated stream can result in deep
@@ -1349,6 +1353,18 @@
      * <p>Subsequent changes to the sequential/parallel execution mode of the
      * returned stream are not guaranteed to be propagated to the input streams.
      *
+     * @apiNote
+     * To preserve optimization opportunities this method binds each stream to
+     * its source and accepts only two streams as parameters.  For example, the
+     * exact size of the concatenated stream source can be computed if the exact
+     * size of each input stream source is known.
+     * To concatenate more streams without binding, or without nested calls to
+     * this method, try creating a stream of streams and flat-mapping with the
+     * identity function, for example:
+     * <pre>{@code
+     *     Stream<T> concat = Stream.of(s1, s2, s3, s4).flatMap(s -> s);
+     * }</pre>
+     *
      * @param <T> The type of stream elements
      * @param a the first stream
      * @param b the second stream
--- a/src/java.base/share/classes/java/util/zip/ZipCoder.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/util/zip/ZipCoder.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,34 @@
 
 final class ZipCoder {
 
+    private static boolean isASCII(byte[] ba, int off, int len) {
+        for (int i = off; i < off + len; i++) {
+            if (ba[i] < 0)
+                return false;
+        }
+        return true;
+    }
+
+    private static boolean hasReplaceChar(byte[] ba) {
+        for (int i = 0; i < ba.length; i++) {
+            if (ba[i] == (byte)'?')
+                return true;
+        }
+        return false;
+    }
+
     String toString(byte[] ba, int off, int length) {
+
+        // fastpath for UTF-8 cs and ascii only name, leverage the
+        // compact string impl to avoid the unnecessary char[] copy/
+        // paste. A temporary workaround before we have better approach,
+        // such as a String constructor that throws exception for
+        // malformed and/or unmappable characters, instead of silently
+        // replacing with repl char
+        if (isUTF8 && isASCII(ba, off, length)) {
+            return new String(ba, off, length, cs);
+        }
+
         CharsetDecoder cd = decoder().reset();
         int len = (int)(length * cd.maxCharsPerByte());
         char[] ca = new char[len];
@@ -78,6 +105,15 @@
     }
 
     byte[] getBytes(String s) {
+        if (isUTF8) {
+            // fastpath for UTF8. should only occur when the string
+            // has malformed surrogates. A postscan should still be
+            // faster and use less memory.
+            byte[] ba = s.getBytes(cs);
+            if (!hasReplaceChar(ba)) {
+                return ba;
+            }
+        }
         CharsetEncoder ce = encoder().reset();
         char[] ca = s.toCharArray();
         int len = (int)(ca.length * ce.maxBytesPerChar());
--- a/src/java.base/share/classes/java/util/zip/ZipFile.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/java/util/zip/ZipFile.java	Sat Dec 02 06:51:10 2017 +0100
@@ -50,11 +50,15 @@
 import java.util.Spliterator;
 import java.util.Spliterators;
 import java.util.WeakHashMap;
+
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.IntFunction;
+import java.util.jar.JarEntry;
 import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
 import jdk.internal.misc.JavaUtilZipFileAccess;
 import jdk.internal.misc.SharedSecrets;
-import jdk.internal.misc.JavaIORandomAccessFileAccess;
 import jdk.internal.misc.VM;
 import jdk.internal.perf.PerfCounter;
 
@@ -296,13 +300,27 @@
      * @throws IllegalStateException if the zip file has been closed
      */
     public ZipEntry getEntry(String name) {
+        return getEntry(name, ZipEntry::new);
+    }
+
+    /*
+     * Returns the zip file entry for the specified name, or null
+     * if not found.
+     *
+     * @param name the name of the entry
+     * @param func the function that creates the returned entry
+     *
+     * @return the zip file entry, or null if not found
+     * @throws IllegalStateException if the zip file has been closed
+     */
+    private ZipEntry getEntry(String name, Function<String, ? extends ZipEntry> func) {
         Objects.requireNonNull(name, "name");
         synchronized (this) {
             ensureOpen();
             byte[] bname = zc.getBytes(name);
             int pos = zsrc.getEntryPos(bname, true);
             if (pos != -1) {
-                return getZipEntry(name, bname, pos);
+                return getZipEntry(name, bname, pos, func);
             }
         }
         return null;
@@ -374,12 +392,10 @@
     private class ZipFileInflaterInputStream extends InflaterInputStream {
         private volatile boolean closeRequested;
         private boolean eof = false;
-        private final ZipFileInputStream zfin;
 
         ZipFileInflaterInputStream(ZipFileInputStream zfin, Inflater inf,
                 int size) {
             super(zfin, inf, size);
-            this.zfin = zfin;
         }
 
         public void close() throws IOException {
@@ -416,7 +432,7 @@
         public int available() throws IOException {
             if (closeRequested)
                 return 0;
-            long avail = zfin.size() - inf.getBytesWritten();
+            long avail = ((ZipFileInputStream)in).size() - inf.getBytesWritten();
             return (avail > (long) Integer.MAX_VALUE ?
                     Integer.MAX_VALUE : (int) avail);
         }
@@ -466,41 +482,48 @@
         return name;
     }
 
-    private class ZipEntryIterator implements Enumeration<ZipEntry>, Iterator<ZipEntry> {
+    private class ZipEntryIterator<T extends ZipEntry>
+            implements Enumeration<T>, Iterator<T> {
+
         private int i = 0;
         private final int entryCount;
+        private final Function<String, T> gen;
 
-        public ZipEntryIterator() {
-            synchronized (ZipFile.this) {
-                ensureOpen();
-                this.entryCount = zsrc.total;
-            }
+        public ZipEntryIterator(int entryCount, Function<String, T> gen) {
+            this.entryCount = entryCount;
+            this.gen = gen;
         }
 
+        @Override
         public boolean hasMoreElements() {
             return hasNext();
         }
 
+        @Override
         public boolean hasNext() {
             return i < entryCount;
         }
 
-        public ZipEntry nextElement() {
+        @Override
+        public T nextElement() {
             return next();
         }
 
-        public ZipEntry next() {
+        @Override
+        @SuppressWarnings("unchecked")
+        public T  next() {
             synchronized (ZipFile.this) {
                 ensureOpen();
                 if (!hasNext()) {
                     throw new NoSuchElementException();
                 }
                 // each "entry" has 3 ints in table entries
-                return getZipEntry(null, null, zsrc.getEntryPos(i++ * 3));
+                return (T)getZipEntry(null, null, zsrc.getEntryPos(i++ * 3), gen);
             }
         }
 
-        public Iterator<ZipEntry> asIterator() {
+        @Override
+        public Iterator<T> asIterator() {
             return this;
         }
     }
@@ -511,11 +534,51 @@
      * @throws IllegalStateException if the zip file has been closed
      */
     public Enumeration<? extends ZipEntry> entries() {
-        return new ZipEntryIterator();
+        synchronized (this) {
+            ensureOpen();
+            return new ZipEntryIterator<ZipEntry>(zsrc.total, ZipEntry::new);
+        }
+    }
+
+    private Enumeration<JarEntry> entries(Function<String, JarEntry> func) {
+        synchronized (this) {
+            ensureOpen();
+            return new ZipEntryIterator<JarEntry>(zsrc.total, func);
+        }
+    }
+
+    private class EntrySpliterator<T> extends Spliterators.AbstractSpliterator<T> {
+        private int index;
+        private final int fence;
+        private final IntFunction<T> gen;
+
+        EntrySpliterator(int index, int fence, IntFunction<T> gen) {
+            super((long)fence,
+                  Spliterator.ORDERED | Spliterator.DISTINCT | Spliterator.IMMUTABLE |
+                  Spliterator.NONNULL);
+            this.index = index;
+            this.fence = fence;
+            this.gen = gen;
+        }
+
+        @Override
+        public boolean tryAdvance(Consumer<? super T> action) {
+            if (action == null)
+                throw new NullPointerException();
+            if (index >= 0 && index < fence) {
+                synchronized (ZipFile.this) {
+                    ensureOpen();
+                    action.accept(gen.apply(zsrc.getEntryPos(index++ * 3)));
+                }
+                return true;
+            }
+            return false;
+        }
     }
 
     /**
      * Returns an ordered {@code Stream} over the ZIP file entries.
+     *
      * Entries appear in the {@code Stream} in the order they appear in
      * the central directory of the ZIP file.
      *
@@ -524,17 +587,68 @@
      * @since 1.8
      */
     public Stream<? extends ZipEntry> stream() {
-        return StreamSupport.stream(Spliterators.spliterator(
-                new ZipEntryIterator(), size(),
-                Spliterator.ORDERED | Spliterator.DISTINCT |
-                        Spliterator.IMMUTABLE | Spliterator.NONNULL), false);
+        synchronized (this) {
+            ensureOpen();
+            return StreamSupport.stream(new EntrySpliterator<>(0, zsrc.total,
+                pos -> getZipEntry(null, null, pos, ZipEntry::new)), false);
+       }
+    }
+
+    private String getEntryName(int pos) {
+        byte[] cen = zsrc.cen;
+        int nlen = CENNAM(cen, pos);
+        int clen = CENCOM(cen, pos);
+        int flag = CENFLG(cen, pos);
+        if (!zc.isUTF8() && (flag & EFS) != 0) {
+            return zc.toStringUTF8(cen, pos + CENHDR, nlen);
+        } else {
+            return zc.toString(cen, pos + CENHDR, nlen);
+        }
+    }
+
+    /*
+     * Returns an ordered {@code Stream} over the zip file entry names.
+     *
+     * Entry names appear in the {@code Stream} in the order they appear in
+     * the central directory of the ZIP file.
+     *
+     * @return an ordered {@code Stream} of entry names in this zip file
+     * @throws IllegalStateException if the zip file has been closed
+     * @since 10
+     */
+    private Stream<String> entryNameStream() {
+        synchronized (this) {
+            ensureOpen();
+            return StreamSupport.stream(
+                new EntrySpliterator<>(0, zsrc.total, this::getEntryName), false);
+        }
+    }
+
+    /*
+     * Returns an ordered {@code Stream} over the zip file entries.
+     *
+     * Entries appear in the {@code Stream} in the order they appear in
+     * the central directory of the jar file.
+     *
+     * @param func the function that creates the returned entry
+     * @return an ordered {@code Stream} of entries in this zip file
+     * @throws IllegalStateException if the zip file has been closed
+     * @since 10
+     */
+    private Stream<JarEntry> stream(Function<String, JarEntry> func) {
+        synchronized (this) {
+            ensureOpen();
+            return StreamSupport.stream(new EntrySpliterator<>(0, zsrc.total,
+                pos -> (JarEntry)getZipEntry(null, null, pos, func)), false);
+        }
     }
 
     private String lastEntryName;
     private int lastEntryPos;
 
     /* Checks ensureOpen() before invoke this method */
-    private ZipEntry getZipEntry(String name, byte[] bname, int pos) {
+    private ZipEntry getZipEntry(String name, byte[] bname, int pos,
+                                 Function<String, ? extends ZipEntry> func) {
         byte[] cen = zsrc.cen;
         int nlen = CENNAM(cen, pos);
         int elen = CENEXT(cen, pos);
@@ -551,7 +665,7 @@
                 name = zc.toString(cen, pos + CENHDR, nlen);
             }
         }
-        ZipEntry e = new ZipEntry(name);
+        ZipEntry e = func.apply(name);    //ZipEntry e = new ZipEntry(name);
         e.flag = flag;
         e.xdostime = CENTIM(cen, pos);
         e.crc = CENCRC(cen, pos);
@@ -791,7 +905,6 @@
 
         public long skip(long n) throws IOException {
             synchronized (ZipFile.this) {
-                ensureOpenOrZipException();
                 initDataOffset();
                 if (n > rem) {
                     n = rem;
@@ -857,12 +970,33 @@
     static {
         SharedSecrets.setJavaUtilZipFileAccess(
             new JavaUtilZipFileAccess() {
+                @Override
                 public boolean startsWithLocHeader(ZipFile zip) {
                     return zip.zsrc.startsWithLoc;
                 }
+                @Override
                 public String[] getMetaInfEntryNames(ZipFile zip) {
                     return zip.getMetaInfEntryNames();
                 }
+                @Override
+                public JarEntry getEntry(ZipFile zip, String name,
+                    Function<String, JarEntry> func) {
+                    return (JarEntry)zip.getEntry(name, func);
+                }
+                @Override
+                public Enumeration<JarEntry> entries(ZipFile zip,
+                    Function<String, JarEntry> func) {
+                    return zip.entries(func);
+                }
+                @Override
+                public Stream<JarEntry> stream(ZipFile zip,
+                    Function<String, JarEntry> func) {
+                    return zip.stream(func);
+                }
+                @Override
+                public Stream<String> entryNameStream(ZipFile zip) {
+                    return zip.entryNameStream();
+                }
              }
         );
         isWindows = VM.getSavedProperty("os.name").contains("Windows");
--- a/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java	Sat Dec 02 06:51:10 2017 +0100
@@ -274,7 +274,7 @@
         if (o.path.length() == 0) {
             return this;
         }
-        StringBuilder sb = new StringBuilder(path.length() + o.path.length());
+        StringBuilder sb = new StringBuilder(path.length() + o.path.length() + 1);
         sb.append(path);
         if (path.charAt(path.length() - 1) != '/')
             sb.append('/');
@@ -478,12 +478,15 @@
 
     // Remove DotSlash(./) and resolve DotDot (..) components
     private String getResolved() {
-        if (path.length() == 0) {
+        int length = path.length();
+        if (length == 0 || (path.indexOf("./") == -1 && path.charAt(length - 1) != '.')) {
             return path;
+        } else {
+            return resolvePath();
         }
-        if (path.indexOf('.') == -1) {
-            return path;
-        }
+    }
+
+    private String resolvePath() {
         int length = path.length();
         char[] to = new char[length];
         int nc = getNameCount();
--- a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java	Sat Dec 02 06:51:10 2017 +0100
@@ -834,7 +834,7 @@
             try {
                 String nm;
                 if (jar.isMultiRelease()) {
-                    nm = SharedSecrets.javaUtilJarAccess().getRealName(jar, entry);
+                    nm = entry.getRealName();
                 } else {
                     nm = name;
                 }
--- a/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java	Sat Dec 02 06:51:10 2017 +0100
@@ -41,5 +41,4 @@
     public Enumeration<JarEntry> entries2(JarFile jar);
     public void setEagerValidation(JarFile jar, boolean eager);
     public List<Object> getManifestDigests(JarFile jar);
-    public String getRealName(JarFile jar, JarEntry entry);
 }
--- a/src/java.base/share/classes/jdk/internal/misc/JavaUtilZipFileAccess.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/jdk/internal/misc/JavaUtilZipFileAccess.java	Sat Dec 02 06:51:10 2017 +0100
@@ -25,10 +25,19 @@
 
 package jdk.internal.misc;
 
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.function.Function;
+import java.util.jar.JarEntry;
+import java.util.stream.Stream;
 import java.util.zip.ZipFile;
 
 public interface JavaUtilZipFileAccess {
     public boolean startsWithLocHeader(ZipFile zip);
     public String[] getMetaInfEntryNames(ZipFile zip);
+    public JarEntry getEntry(ZipFile zip, String name, Function<String, JarEntry> func);
+    public Enumeration<JarEntry> entries(ZipFile zip, Function<String, JarEntry> func);
+    public Stream<JarEntry> stream(ZipFile zip, Function<String, JarEntry> func);
+    public Stream<String> entryNameStream(ZipFile zip);
 }
 
--- a/src/java.base/share/classes/jdk/internal/module/ModulePath.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/jdk/internal/module/ModulePath.java	Sat Dec 02 06:51:10 2017 +0100
@@ -66,8 +66,6 @@
 import jdk.internal.jmod.JmodFile;
 import jdk.internal.jmod.JmodFile.Section;
 import jdk.internal.perf.PerfCounter;
-import jdk.internal.util.jar.VersionedStream;
-
 
 /**
  * A {@code ModuleFinder} that locates modules on the file system by searching
@@ -515,7 +513,7 @@
             builder.version(vs);
 
         // scan the names of the entries in the JAR file
-        Map<Boolean, Set<String>> map = VersionedStream.stream(jf)
+        Map<Boolean, Set<String>> map = jf.versionedStream()
                 .filter(e -> !e.isDirectory())
                 .map(JarEntry::getName)
                 .filter(e -> (e.endsWith(".class") ^ e.startsWith(SERVICES_PREFIX)))
@@ -615,7 +613,7 @@
     }
 
     private Set<String> jarPackages(JarFile jf) {
-        return VersionedStream.stream(jf)
+        return jf.versionedStream()
                 .filter(e -> !e.isDirectory())
                 .map(JarEntry::getName)
                 .map(this::toPackageName)
--- a/src/java.base/share/classes/jdk/internal/module/ModuleReferences.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/jdk/internal/module/ModuleReferences.java	Sat Dec 02 06:51:10 2017 +0100
@@ -50,9 +50,7 @@
 import java.util.zip.ZipFile;
 
 import jdk.internal.jmod.JmodFile;
-import jdk.internal.misc.SharedSecrets;
 import jdk.internal.module.ModuleHashes.HashSupplier;
-import jdk.internal.util.jar.VersionedStream;
 import sun.net.www.ParseUtil;
 
 
@@ -250,7 +248,7 @@
             JarEntry je = getEntry(name);
             if (je != null) {
                 if (jf.isMultiRelease())
-                    name = SharedSecrets.javaUtilJarAccess().getRealName(jf, je);
+                    name = je.getRealName();
                 if (je.isDirectory() && !name.endsWith("/"))
                     name += "/";
                 String encodedPath = ParseUtil.encodePath(name, false);
@@ -274,7 +272,7 @@
         @Override
         Stream<String> implList() throws IOException {
             // take snapshot to avoid async close
-            List<String> names = VersionedStream.stream(jf)
+            List<String> names = jf.versionedStream()
                     .map(JarEntry::getName)
                     .collect(Collectors.toList());
             return names.stream();
--- a/src/java.base/share/classes/jdk/internal/util/jar/VersionedStream.java	Sat Dec 02 11:25:35 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +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.internal.util.jar;
-
-import java.util.Objects;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.stream.Stream;
-
-public class VersionedStream {
-    private static final String META_INF_VERSIONS = "META-INF/versions/";
-
-    /**
-     * Returns a stream of versioned entries, derived from the base names of
-     * all entries in a multi-release {@code JarFile} that are present either in
-     * the base directory or in any versioned directory with a version number
-     * less than or equal to the {@code Runtime.Version::major} that the
-     * {@code JarFile} was opened with.  These versioned entries are aliases
-     * for the real entries -- i.e. the names are base names and the content
-     * may come from a versioned directory entry.  If the {@code jarFile} is not
-     * a multi-release jar, a stream of all entries is returned.
-     *
-     * @param jf the input JarFile
-     * @return stream of entries
-     * @since 9
-     */
-    public static Stream<JarEntry> stream(JarFile jf) {
-        if (jf.isMultiRelease()) {
-            int version = jf.getVersion().major();
-            return jf.stream()
-                    .map(je -> getBaseSuffix(je, version))
-                    .filter(Objects::nonNull)
-                    .distinct()
-                    .map(jf::getJarEntry);
-        }
-        return jf.stream();
-    }
-
-    private static String getBaseSuffix(JarEntry je, int version) {
-        String name = je.getName();
-        if (name.startsWith(META_INF_VERSIONS)) {
-            int len = META_INF_VERSIONS.length();
-            int index = name.indexOf('/', len);
-            if (index == -1 || index == (name.length() - 1)) {
-                // filter out META-INF/versions/* and META-INF/versions/*/
-                return null;
-            }
-            try {
-                if (Integer.parseInt(name, len, index, 10) > version) {
-                    // not an integer
-                    return null;
-                }
-            } catch (NumberFormatException x) {
-                // silently remove malformed entries
-                return null;
-            }
-            // We know name looks like META-INF/versions/*/*
-            return name.substring(index + 1);
-        }
-        return name;
-    }
-}
--- a/src/java.base/share/classes/module-info.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/classes/module-info.java	Sat Dec 02 06:51:10 2017 +0100
@@ -210,9 +210,7 @@
         jdk.internal.vm.ci,
         jdk.incubator.httpclient;
     exports jdk.internal.util.jar to
-        jdk.jartool,
-        jdk.jdeps,
-        jdk.jlink;
+        jdk.jartool;
     exports sun.net to
         jdk.incubator.httpclient;
     exports sun.net.ext to
--- a/src/java.base/share/native/include/jvm.h	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/native/include/jvm.h	Sat Dec 02 06:51:10 2017 +0100
@@ -262,21 +262,9 @@
 /*
  * java.lang.SecurityManager
  */
-JNIEXPORT jclass JNICALL
-JVM_CurrentLoadedClass(JNIEnv *env);
-
-JNIEXPORT jobject JNICALL
-JVM_CurrentClassLoader(JNIEnv *env);
-
 JNIEXPORT jobjectArray JNICALL
 JVM_GetClassContext(JNIEnv *env);
 
-JNIEXPORT jint JNICALL
-JVM_ClassDepth(JNIEnv *env, jstring name);
-
-JNIEXPORT jint JNICALL
-JVM_ClassLoaderDepth(JNIEnv *env);
-
 /*
  * java.lang.Package
  */
--- a/src/java.base/share/native/libjava/SecurityManager.c	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.base/share/native/libjava/SecurityManager.c	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, 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
@@ -76,53 +76,3 @@
 
     return JVM_GetClassContext(env);
 }
-
-JNIEXPORT jclass JNICALL
-Java_java_lang_SecurityManager_currentLoadedClass0(JNIEnv *env, jobject this)
-{
-    /* Make sure the security manager instance is initialized */
-    if (!check(env, this)) {
-        return NULL;            /* exception */
-    }
-
-    return JVM_CurrentLoadedClass(env);
-}
-
-JNIEXPORT jobject JNICALL
-Java_java_lang_SecurityManager_currentClassLoader0(JNIEnv *env, jobject this)
-{
-    /* Make sure the security manager instance is initialized */
-    if (!check(env, this)) {
-        return NULL;            /* exception */
-    }
-
-    return JVM_CurrentClassLoader(env);
-}
-
-JNIEXPORT jint JNICALL
-Java_java_lang_SecurityManager_classDepth(JNIEnv *env, jobject this,
-                                          jstring name)
-{
-    /* Make sure the security manager instance is initialized */
-    if (!check(env, this)) {
-        return -1;              /* exception */
-    }
-
-    if (name == NULL) {
-      JNU_ThrowNullPointerException(env, 0);
-      return -1;
-    }
-
-    return JVM_ClassDepth(env, name);
-}
-
-JNIEXPORT jint JNICALL
-Java_java_lang_SecurityManager_classLoaderDepth0(JNIEnv *env, jobject this)
-{
-    /* Make sure the security manager instance is initialized */
-    if (!check(env, this)) {
-        return -1;              /* exception */
-    }
-
-    return JVM_ClassLoaderDepth(env);
-}
--- a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java	Sat Dec 02 06:51:10 2017 +0100
@@ -257,7 +257,7 @@
      *
      * @implSpec This implementation dispatches to the visit method for
      * the specific {@linkplain TypeKind kind} of pseudo-type:
-     * {@code VOID}, {@code PACKAGE}, or {@code NONE}.
+     * {@code VOID}, {@code PACKAGE}, {@code MODULE}, or {@code NONE}.
      *
      * @param t {@inheritDoc}
      * @param p {@inheritDoc}
@@ -273,6 +273,9 @@
         case PACKAGE:
             return visitNoTypeAsPackage(t, p);
 
+        case MODULE:
+            return visitNoTypeAsModule(t, p);
+
         case NONE:
             return visitNoTypeAsNone(t, p);
 
@@ -308,6 +311,21 @@
     }
 
     /**
+     * Visits a {@link TypeKind#MODULE MODULE} pseudo-type.
+     *
+     * @implSpec This implementation calls {@code visitUnknown}.
+     *
+     * @param t the type to visit
+     * @param p a visitor-specified parameter
+     * @return  the result of {@code visitUnknown}
+     *
+     * @since 10
+     */
+    public R visitNoTypeAsModule(NoType t, P p) {
+        return visitUnknown(t, p);
+    }
+
+    /**
      * Visits a {@link TypeKind#NONE NONE} pseudo-type.
      *
      * @implSpec This implementation calls {@code defaultAction}.
--- a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java	Sat Dec 02 06:51:10 2017 +0100
@@ -93,4 +93,20 @@
     protected TypeKindVisitor9(R defaultValue) {
         super(defaultValue);
     }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @implSpec This implementation calls {@code defaultAction}.
+     *
+     * @param t {@inheritDoc}
+     * @param p {@inheritDoc}
+     * @return  the result of {@code defaultAction}
+     *
+     * @since 10
+     */
+    @Override
+    public R visitNoTypeAsModule(NoType t, P p) {
+        return defaultAction(t, p);
+    }
 }
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaFileSystemModel.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaFileSystemModel.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, 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
@@ -329,7 +329,7 @@
             }
         }
 
-        private final void swap(final Vector<Object> a, final int i, final int j) {
+        private void swap(final Vector<Object> a, final int i, final int j) {
             final Object T = a.elementAt(i);
             a.setElementAt(a.elementAt(j), i);
             a.setElementAt(T, j);
--- a/src/java.desktop/macosx/classes/sun/lwawt/LWComponentPeer.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/macosx/classes/sun/lwawt/LWComponentPeer.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1448,7 +1448,7 @@
      *
      * @return true during layout, false otherwise.
      */
-    private final boolean isLayouting() {
+    private boolean isLayouting() {
         return isLayouting;
     }
 }
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1359,14 +1359,18 @@
             this.pixelStream = new DataInputStream(is);
 
             /*
-             * NB: the PNG spec declares that valid range for width
+             * PNG spec declares that valid range for width
              * and height is [1, 2^31-1], so here we may fail to allocate
              * a buffer for destination image due to memory limitation.
              *
-             * However, the recovery strategy for this case should be
-             * defined on the level of application, so we will not
-             * try to estimate the required amount of the memory and/or
-             * handle OOM in any way.
+             * If the read operation triggers OutOfMemoryError, the same
+             * will be wrapped in an IIOException at PNGImageReader.read
+             * method.
+             *
+             * The recovery strategy for this case should be defined at
+             * the level of application, so we will not try to estimate
+             * the required amount of the memory and/or handle OOM in
+             * any way.
              */
             theImage = getDestination(param,
                                       getImageTypes(0),
@@ -1671,7 +1675,16 @@
             throw new IndexOutOfBoundsException("imageIndex != 0!");
         }
 
-        readImage(param);
+        try {
+            readImage(param);
+        } catch (IOException |
+                 IllegalStateException |
+                 IllegalArgumentException e)
+        {
+            throw e;
+        } catch (Throwable e) {
+            throw new IIOException("Caught exception during read: ", e);
+        }
         return theImage;
     }
 
@@ -1685,5 +1698,6 @@
         gotMetadata = false;
         metadata = null;
         pixelStream = null;
+        imageStartPosition = -1L;
     }
 }
--- a/src/java.desktop/share/classes/com/sun/media/sound/RIFFReader.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/com/sun/media/sound/RIFFReader.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
     private final String fourcc;
     private String riff_type = null;
     private final long ckSize;
-    private InputStream stream;
+    private final InputStream stream;
     private long avail = 0xffffffffL; // MAX_UNSIGNED_INT
     private RIFFReader lastiterator = null;
 
@@ -338,8 +338,6 @@
     @Override
     public void close() throws IOException {
         finish();
-        if (this == root)
-            stream.close();
-        stream = null;
+        stream.close();
     }
 }
--- a/src/java.desktop/share/classes/java/awt/Component.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/java/awt/Component.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1135,9 +1135,18 @@
         if (graphicsConfig == gc) {
             return false;
         }
-
+        GraphicsConfiguration oldConfig = graphicsConfig;
         graphicsConfig = gc;
 
+        /*
+         * If component is moved from one screen to another sceeen
+         * graphicsConfiguration property is fired to enable the component
+         * to recalculate any rendering data, if needed
+         */
+        if (oldConfig != null && gc != null) {
+            firePropertyChange("graphicsConfiguration", oldConfig, gc);
+        }
+
         ComponentPeer peer = this.peer;
         if (peer != null) {
             return peer.updateGraphicsData(gc);
@@ -2030,14 +2039,14 @@
      * used by GlobalCursormanager to update cursor
      */
     final Point getLocationOnScreen_NoTreeLock() {
-
+        ComponentPeer peer = this.peer;
         if (peer != null && isShowing()) {
             if (peer instanceof LightweightPeer) {
                 // lightweight component location needs to be translated
                 // relative to a native component.
                 Container host = getNativeContainer();
                 Point pt = host.peer.getLocationOnScreen();
-                for(Component c = this; c != host; c = c.getParent()) {
+                for(Component c = this; c != host; c = c.getContainer()) {
                     pt.x += c.x;
                     pt.y += c.y;
                 }
@@ -10218,7 +10227,7 @@
         applyCompoundShape(getAppliedShape().getDifference(s));
     }
 
-    private final void applyCurrentShapeBelowMe() {
+    private void applyCurrentShapeBelowMe() {
         checkTreeLock();
         Container parent = getContainer();
         if (parent != null && parent.isShowing()) {
--- a/src/java.desktop/share/classes/java/awt/EventQueue.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/java/awt/EventQueue.java	Sat Dec 02 06:51:10 2017 +0100
@@ -283,7 +283,7 @@
      * @param theEvent an instance of {@code java.awt.AWTEvent},
      *          or a subclass of it
      */
-    private final void postEventPrivate(AWTEvent theEvent) {
+    private void postEventPrivate(AWTEvent theEvent) {
         theEvent.isPosted = true;
         pushPopLock.lock();
         try {
--- a/src/java.desktop/share/classes/java/awt/MenuItem.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/java/awt/MenuItem.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -410,7 +410,7 @@
      * Returns true if the item and all its ancestors are
      * enabled, false otherwise
      */
-    private final boolean isItemEnabled() {
+    private boolean isItemEnabled() {
         // Fix For 6185151: Menu shortcuts of all menuitems within a menu
         // should be disabled when the menu itself is disabled
         if (!isEnabled()) {
--- a/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/java/awt/geom/AffineTransform.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1354,7 +1354,7 @@
         /* SH | SC => */         APPLY_SHEAR | APPLY_SCALE,
         /* SH | SC | TR => */    APPLY_SHEAR | APPLY_SCALE | APPLY_TRANSLATE,
     };
-    private final void rotate90() {
+    private void rotate90() {
         double M0 = m00;
         m00 = m01;
         m01 = -M0;
@@ -1370,7 +1370,7 @@
         this.state = state;
         type = TYPE_UNKNOWN;
     }
-    private final void rotate180() {
+    private void rotate180() {
         m00 = -m00;
         m11 = -m11;
         int state = this.state;
@@ -1390,7 +1390,7 @@
         }
         type = TYPE_UNKNOWN;
     }
-    private final void rotate270() {
+    private void rotate270() {
         double M0 = m00;
         m00 = -m01;
         m01 = M0;
--- a/src/java.desktop/share/classes/java/awt/image/BufferedImageFilter.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/java/awt/image/BufferedImageFilter.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -397,7 +397,7 @@
         consumer.imageComplete(status);
     }
 
-    private final WritableRaster createDCMraster() {
+    private WritableRaster createDCMraster() {
         WritableRaster wr;
         DirectColorModel dcm = (DirectColorModel) model;
         boolean hasAlpha = model.hasAlpha();
--- a/src/java.desktop/share/classes/java/awt/image/ColorConvertOp.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/java/awt/image/ColorConvertOp.java	Sat Dec 02 06:51:10 2017 +0100
@@ -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
@@ -295,7 +295,7 @@
         }
     }
 
-    private final BufferedImage ICCBIFilter(BufferedImage src,
+    private BufferedImage ICCBIFilter(BufferedImage src,
                                             ColorSpace srcColorSpace,
                                             BufferedImage dest,
                                             ColorSpace destColorSpace) {
@@ -753,7 +753,7 @@
         return hints;
     }
 
-    private final BufferedImage nonICCBIFilter(BufferedImage src,
+    private BufferedImage nonICCBIFilter(BufferedImage src,
                                                ColorSpace srcColorSpace,
                                                BufferedImage dst,
                                                ColorSpace dstColorSpace) {
@@ -947,7 +947,7 @@
 
     /* color convert a Raster - handles byte, ushort, int, short, float,
        or double transferTypes */
-    private final WritableRaster nonICCRasterFilter(Raster src,
+    private WritableRaster nonICCRasterFilter(Raster src,
                                                     WritableRaster dst)  {
 
         if (CSList.length != 2) {
--- a/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java	Sat Dec 02 06:51:10 2017 +0100
@@ -755,7 +755,7 @@
      * value is used to mask off the pixel parameters for methods such
      * as getRed(), getGreen(), getBlue(), getAlpha(), and getRGB().
      */
-    private final void calculatePixelMask() {
+    private void calculatePixelMask() {
         // Note that we adjust the mask so that our masking behavior here
         // is consistent with that of our native rendering loops.
         int maskbits = pixel_bits;
--- a/src/java.desktop/share/classes/java/awt/image/LookupOp.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/java/awt/image/LookupOp.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,6 +1,6 @@
 
 /*
- * 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
@@ -472,7 +472,7 @@
         return hints;
     }
 
-    private final void byteFilter(ByteLookupTable lookup, Raster src,
+    private void byteFilter(ByteLookupTable lookup, Raster src,
                                   WritableRaster dst,
                                   int width, int height, int numBands) {
         int[] srcPix = null;
@@ -519,7 +519,7 @@
         }
     }
 
-    private final void shortFilter(ShortLookupTable lookup, Raster src,
+    private void shortFilter(ShortLookupTable lookup, Raster src,
                                    WritableRaster dst,
                                    int width, int height, int numBands) {
         int band;
--- a/src/java.desktop/share/classes/java/awt/image/LookupTable.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/java/awt/image/LookupTable.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2000, 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
@@ -43,7 +43,7 @@
  * @see ShortLookupTable
  * @see LookupOp
  */
-public abstract class LookupTable extends Object{
+public abstract class LookupTable {
 
     /**
      * Constants
--- a/src/java.desktop/share/classes/javax/swing/JComponent.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/javax/swing/JComponent.java	Sat Dec 02 06:51:10 2017 +0100
@@ -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
@@ -775,8 +775,7 @@
      * transform. If you need to do these operations you may find it
      * easier to create a new <code>Graphics</code> from the passed in
      * <code>Graphics</code> and manipulate it. Further, if you do not
-     * invoker super's implementation you must honor the opaque property,
-     * that is
+     * invoke super's implementation you must honor the opaque property, that is
      * if this component is opaque, you must completely fill in the background
      * in an opaque color. If you do not honor the opaque property you
      * will likely see visual artifacts.
--- a/src/java.desktop/share/classes/javax/swing/event/EventListenerList.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/javax/swing/event/EventListenerList.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -102,7 +102,7 @@
     /* A null array to be shared by all empty listener lists*/
     private static final Object[] NULL_ARRAY = new Object[0];
     /** The list of ListenerType - Listener pairs */
-    protected transient Object[] listenerList = NULL_ARRAY;
+    protected transient volatile Object[] listenerList = NULL_ARRAY;
 
     /**
      * Passes back the event listener list as an array
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonListener.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonListener.java	Sat Dec 02 06:51:10 2017 +0100
@@ -75,7 +75,8 @@
             checkOpacity((AbstractButton) e.getSource() );
         }
         else if(prop == AbstractButton.TEXT_CHANGED_PROPERTY ||
-                "font" == prop || "foreground" == prop) {
+                "font" == prop || "foreground" == prop ||
+                "ancestor" == prop || "graphicsConfiguration" == prop) {
             AbstractButton b = (AbstractButton) e.getSource();
             BasicHTML.updateRenderer(b, b.getText());
         }
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLabelUI.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLabelUI.java	Sat Dec 02 06:51:10 2017 +0100
@@ -472,7 +472,8 @@
 
     public void propertyChange(PropertyChangeEvent e) {
         String name = e.getPropertyName();
-        if (name == "text" || "font" == name || "foreground" == name) {
+        if (name == "text" || "font" == name || "foreground" == name ||
+            "ancestor" == name || "graphicsConfiguration" == name) {
             // remove the old html view client property if one
             // existed, and install a new one if the text installed
             // into the JLabel is html source.
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1106,7 +1106,8 @@
                 name == "accelerator") {
                 updateAcceleratorBinding();
             } else if (name == "text" || "font" == name ||
-                       "foreground" == name) {
+                       "foreground" == name ||
+                       "ancestor" == name || "graphicsConfiguration" == name) {
                 // remove the old html view client property if one
                 // existed, and install a new one if the text installed
                 // into the JLabel is html source.
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuUI.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuUI.java	Sat Dec 02 06:51:10 2017 +0100
@@ -226,8 +226,13 @@
         return (MenuKeyListener)getHandler();
     }
 
+    public Dimension getMinimumSize(JComponent c) {
+        return (((JMenu)menuItem).isTopLevelMenu()) ?
+            c.getPreferredSize() : null;
+    }
+
     public Dimension getMaximumSize(JComponent c) {
-        if (((JMenu)menuItem).isTopLevelMenu() == true) {
+        if (((JMenu)menuItem).isTopLevelMenu()) {
             Dimension d = c.getPreferredSize();
             return new Dimension(d.width, Short.MAX_VALUE);
         }
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java	Sat Dec 02 06:51:10 2017 +0100
@@ -261,7 +261,8 @@
         public void propertyChange(PropertyChangeEvent e) {
             String name = e.getPropertyName();
             if (name.equals("tiptext") || "font".equals(name) ||
-                "foreground".equals(name)) {
+                "foreground".equals(name) ||
+                "ancestor" == name || "graphicsConfiguration" == name) {
                 // remove the old html view client property if one
                 // existed, and install a new one if the text installed
                 // into the JLabel is html source.
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3490,7 +3490,7 @@
       * the destination it is constructed with. It is assumed all the
       * events are currently target at source.
       */
-    public class MouseInputHandler extends Object implements
+    public class MouseInputHandler implements
                      MouseInputListener
     {
         /** Source that events are coming from. */
--- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java	Sat Dec 02 06:51:10 2017 +0100
@@ -227,7 +227,8 @@
         }
         String name = e.getPropertyName();
         if (name.equals("tiptext") || "font".equals(name) ||
-                "foreground".equals(name)) {
+                "foreground".equals(name) ||
+                "ancestor" == name || "graphicsConfiguration" == name) {
             // remove the old html view client property if one
             // existed, and install a new one if the text installed
             // into the JLabel is html source.
--- a/src/java.desktop/share/classes/javax/swing/table/TableColumn.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/javax/swing/table/TableColumn.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,7 +83,7 @@
  * @see JTable#getCellEditor(int, int)
  */
 @SuppressWarnings("serial") // Same-version serialization only
-public class TableColumn extends Object implements Serializable {
+public class TableColumn implements Serializable {
 
     /**
      * Obsolete as of Java 2 platform v1.3.  Please use string literals to identify
--- a/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java	Sat Dec 02 06:51:10 2017 +0100
@@ -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
@@ -1797,7 +1797,7 @@
             }
         }
 
-        private final void indent(PrintWriter out, int n) {
+        private void indent(PrintWriter out, int n) {
             for (int i = 0; i < n; i++) {
                 out.print("  ");
             }
@@ -2063,7 +2063,7 @@
             }
         }
 
-        private final void checkForIllegalCast() {
+        private void checkForIllegalCast() {
             Thread t = getCurrentWriter();
             if ((t == null) || (t != Thread.currentThread())) {
                 throw new StateInvariantError("Illegal cast to MutableAttributeSet");
--- a/src/java.desktop/share/classes/javax/swing/text/GlyphPainter1.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/javax/swing/text/GlyphPainter1.java	Sat Dec 02 06:51:10 2017 +0100
@@ -59,7 +59,8 @@
         sync(v);
         Segment text = v.getText(p0, p1);
         int[] justificationData = getJustificationData(v);
-        int width = Utilities.getTabbedTextWidth(v, text, metrics, (int) x, e, p0,
+
+        int width = Utilities.getTabbedTextWidth(v, text, metrics, (int)x, e, p0,
                                                  justificationData);
         SegmentCache.releaseSharedSegment(text);
         return width;
@@ -222,10 +223,15 @@
     @SuppressWarnings("deprecation")
     void sync(GlyphView v) {
         Font f = v.getFont();
-        if ((metrics == null) || (! f.equals(metrics.getFont()))) {
+        FontMetrics fm = null;
+        Container c = v.getContainer();
+        if (c != null) {
+            fm = c.getFontMetrics(f);
+        }
+        if ((metrics == null) || (! f.equals(metrics.getFont()))
+                || (! metrics.equals(fm))) {
             // fetch a new FontMetrics
-            Container c = v.getContainer();
-            metrics = (c != null) ? c.getFontMetrics(f) :
+            metrics = (c != null) ? fm :
                 Toolkit.getDefaultToolkit().getFontMetrics(f);
         }
     }
--- a/src/java.desktop/share/classes/javax/swing/text/html/parser/Parser.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/javax/swing/text/html/parser/Parser.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2422,7 +2422,7 @@
     private int currentPosition;
 
 
-    private final int readCh() throws IOException {
+    private int readCh() throws IOException {
 
         if (pos >= len) {
 
--- a/src/java.desktop/share/classes/javax/swing/tree/TreePath.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/javax/swing/tree/TreePath.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -82,7 +82,7 @@
  * @author Philip Milne
  */
 @SuppressWarnings("serial") // Same-version serialization only
-public class TreePath extends Object implements Serializable {
+public class TreePath implements Serializable {
     /** Path representing the parent, null if lastPathComponent represents
      * the root. */
     private TreePath           parentPath;
--- a/src/java.desktop/share/classes/sun/applet/AppletSecurity.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/sun/applet/AppletSecurity.java	Sat Dec 02 06:51:10 2017 +0100
@@ -48,6 +48,8 @@
 import sun.awt.AWTPermissions;
 import sun.security.util.SecurityConstants;
 
+import static java.lang.StackWalker.*;
+import static java.lang.StackWalker.Option.*;
 
 
 /**
@@ -106,11 +108,90 @@
         });
     }
 
+    private static final StackWalker walker =
+        AccessController.doPrivileged(
+            (PrivilegedAction<StackWalker>) () ->
+                StackWalker.getInstance(RETAIN_CLASS_REFERENCE));
+    /**
+     * Returns the class loader of the most recently executing method from
+     * a class defined using a non-system class loader. A non-system
+     * class loader is defined as being a class loader that is not equal to
+     * the system class loader (as returned
+     * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
+     * <p>
+     * This method will return
+     * <code>null</code> in the following three cases:
+     * <ol>
+     *   <li>All methods on the execution stack are from classes
+     *   defined using the system class loader or one of its ancestors.
+     *
+     *   <li>All methods on the execution stack up to the first
+     *   "privileged" caller
+     *   (see {@link java.security.AccessController#doPrivileged})
+     *   are from classes
+     *   defined using the system class loader or one of its ancestors.
+     *
+     *   <li> A call to <code>checkPermission</code> with
+     *   <code>java.security.AllPermission</code> does not
+     *   result in a SecurityException.
+     * </ol>
+     *
+     * NOTE: This is an implementation of the SecurityManager.currentClassLoader
+     * method that uses StackWalker. SecurityManager.currentClassLoader
+     * has been removed from SE. This is a temporary workaround which is
+     * only needed while applets are still supported.
+     *
+     * @return  the class loader of the most recent occurrence on the stack
+     *          of a method from a class defined using a non-system class
+     *          loader.
+     */
+    private static ClassLoader currentClassLoader() {
+        StackFrame f =
+            walker.walk(s -> s.takeWhile(AppletSecurity::isNonPrivileged)
+                              .filter(AppletSecurity::isNonSystemFrame)
+                              .findFirst())
+                  .orElse(null);
+
+        SecurityManager sm = System.getSecurityManager();
+        if (f != null && sm != null) {
+            try {
+                sm.checkPermission(new AllPermission());
+            } catch (SecurityException se) {
+                return f.getDeclaringClass().getClassLoader();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns true if the StackFrame is not AccessController.doPrivileged.
+     */
+    private static boolean isNonPrivileged(StackFrame f) {
+        // possibly other doPrivileged variants
+        Class<?> c = f.getDeclaringClass();
+        return c == AccessController.class &&
+               f.getMethodName().equals("doPrivileged");
+    }
+
+    /**
+     * Returns true if the StackFrame is not from a class defined by the
+     * system class loader or one of its ancestors.
+     */
+    private static boolean isNonSystemFrame(StackFrame f) {
+        ClassLoader loader = ClassLoader.getSystemClassLoader();
+        ClassLoader ld = f.getDeclaringClass().getClassLoader();
+        if (ld == null || ld == loader) return false;
+
+        while ((loader = loader.getParent()) != null) {
+            if (ld == loader)
+                return false;
+        }
+        return true;
+    }
+
     /**
      * get the current (first) instance of an AppletClassLoader on the stack.
      */
-    @SuppressWarnings({"deprecation",
-                       "removal"}) // SecurityManager.currentClassLoader()
     private AppletClassLoader currentAppletClassLoader()
     {
         // try currentClassLoader first
--- a/src/java.desktop/share/classes/sun/awt/image/PNGImageDecoder.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/sun/awt/image/PNGImageDecoder.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,7 +89,7 @@
     private void property(String key,float value) {
         property(key, Float.valueOf(value));
     }
-    private final void pngassert(boolean b) throws IOException {
+    private void pngassert(boolean b) throws IOException {
         if(!b) {
             PNGException e = new PNGException("Broken file");
             e.printStackTrace();
@@ -692,20 +692,20 @@
         fill();
         return limit-pos>=n;
     }
-    private final int getInt(int pos) {
+    private int getInt(int pos) {
         return ((inbuf[pos  ]&0xFF)<<24)
              | ((inbuf[pos+1]&0xFF)<<16)
              | ((inbuf[pos+2]&0xFF)<< 8)
              | ((inbuf[pos+3]&0xFF)    );
     }
-    private final int getShort(int pos) {
+    private int getShort(int pos) {
         return (short)(((inbuf[pos  ]&0xFF)<<8)
                      | ((inbuf[pos+1]&0xFF)   ));
     }
-    private final int getByte(int pos) {
+    private int getByte(int pos) {
         return inbuf[pos]&0xFF;
     }
-    private final boolean getChunk() throws IOException {
+    private boolean getChunk() throws IOException {
         chunkLength = 0;
         if (!need(8)) return false;
         chunkLength = getInt(pos);
--- a/src/java.desktop/share/classes/sun/awt/image/SunVolatileImage.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/sun/awt/image/SunVolatileImage.java	Sat Dec 02 06:51:10 2017 +0100
@@ -40,6 +40,7 @@
 import sun.java2d.SurfaceManagerFactory;
 import sun.java2d.DestSurfaceProvider;
 import sun.java2d.Surface;
+import sun.java2d.pipe.Region;
 import static sun.java2d.pipe.hw.AccelSurface.*;
 
 /**
@@ -245,8 +246,8 @@
      * or a backup surface with the given horizontal and vertical scale factors.
      */
     public BufferedImage getBackupImage(double scaleX, double scaleY) {
-        int w = (int) Math.ceil(getWidth() * scaleX);
-        int h = (int) Math.ceil(getHeight() * scaleY);
+        int w = Region.clipRound(getWidth() * scaleX);
+        int h = Region.clipRound(getHeight() * scaleY);
         return graphicsConfig.createCompatibleImage(w, h, getTransparency());
     }
 
--- a/src/java.desktop/share/classes/sun/font/ExtendedTextSourceLabel.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/sun/font/ExtendedTextSourceLabel.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -310,7 +310,7 @@
     return new Rectangle2D.Float(l, t, r - l, b - t);
   }
 
-  private final StandardGlyphVector getGV() {
+  private StandardGlyphVector getGV() {
     if (gv == null) {
       gv = createGV();
     }
@@ -543,7 +543,7 @@
       }
   }
 
-  private final float[] getCharinfo() {
+  private float[] getCharinfo() {
     if (charinfo == null) {
       charinfo = createCharinfo();
     }
--- a/src/java.desktop/share/classes/sun/font/StandardGlyphVector.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/sun/font/StandardGlyphVector.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -998,14 +998,14 @@
     }
 
     // called by getGlyphsPixelBounds
-    private final void setDTX(AffineTransform tx) {
+    private void setDTX(AffineTransform tx) {
         if (!equalNonTranslateTX(dtx, tx)) {
             resetDTX(getNonTranslateTX(tx));
         }
     }
 
     // called by most functions
-    private final void setFRCTX() {
+    private void setFRCTX() {
         if (!equalNonTranslateTX(frctx, dtx)) {
             resetDTX(getNonTranslateTX(frctx));
         }
@@ -1016,7 +1016,7 @@
      * must not contain translation.
      * Called by setRenderTransform, setDTX, initFontData.
      */
-    private final void resetDTX(AffineTransform at) {
+    private void resetDTX(AffineTransform at) {
         fsref = null;
         dtx = at;
         invdtx = null;
--- a/src/java.desktop/share/classes/sun/font/TextSourceLabel.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/sun/font/TextSourceLabel.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -147,7 +147,7 @@
     return createLogicalBounds();
   }
 
-  private final GlyphVector getGV() {
+  private GlyphVector getGV() {
     if (gv == null) {
       gv = createGV();
     }
--- a/src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, 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
@@ -106,11 +106,11 @@
         cmap = CMap.theNullCmap;
     }
 
-    private final char remapJAChar(char unicode) {
+    private char remapJAChar(char unicode) {
         return (unicode == REVERSE_SOLIDUS) ? JA_YEN : unicode;
     }
 
-    private final int remapJAIntChar(int unicode) {
+    private int remapJAIntChar(int unicode) {
         return (unicode == REVERSE_SOLIDUS) ? JA_YEN : unicode;
     }
 
--- a/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java	Sat Dec 02 06:51:10 2017 +0100
@@ -3146,6 +3146,14 @@
                     double widthScale = ((double) rvWidth) / width;
                     double heightScale = ((double) rvHeight) / height;
 
+                    if (resolutionVariant instanceof VolatileImage) {
+                        SurfaceData sd = SurfaceManager
+                                .getManager(resolutionVariant)
+                                .getPrimarySurfaceData();
+                        widthScale *= sd.getDefaultScaleX();
+                        heightScale *= sd.getDefaultScaleY();
+                    }
+
                     sx1 = Region.clipScale(sx1, widthScale);
                     sy1 = Region.clipScale(sy1, heightScale);
                     sx2 = Region.clipScale(sx2, widthScale);
--- a/src/java.desktop/share/classes/sun/java2d/marlin/DMarlinRenderingEngine.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/DMarlinRenderingEngine.java	Sat Dec 02 06:51:10 2017 +0100
@@ -227,7 +227,7 @@
                  pc2d);
     }
 
-    private final double userSpaceLineWidth(AffineTransform at, double lw) {
+    private double userSpaceLineWidth(AffineTransform at, double lw) {
 
         double widthScale;
 
--- a/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java	Sat Dec 02 06:51:10 2017 +0100
@@ -227,7 +227,7 @@
                  pc2d);
     }
 
-    private final float userSpaceLineWidth(AffineTransform at, float lw) {
+    private float userSpaceLineWidth(AffineTransform at, float lw) {
 
         float widthScale;
 
--- a/src/java.desktop/share/classes/sun/swing/AccumulativeRunnable.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/sun/swing/AccumulativeRunnable.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -152,7 +152,7 @@
      *
      * @return accumulated arguments
      */
-    private final synchronized List<T> flush() {
+    private synchronized List<T> flush() {
         List<T> list = arguments;
         arguments = null;
         return list;
--- a/src/java.desktop/share/classes/sun/swing/CachedPainter.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/share/classes/sun/swing/CachedPainter.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,9 +24,21 @@
  */
 package sun.swing;
 
-import java.awt.*;
-import java.awt.image.*;
-import java.util.*;
+import sun.awt.image.SurfaceManager;
+import sun.java2d.SurfaceData;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.Image;
+import java.awt.geom.AffineTransform;
+import java.awt.image.AbstractMultiResolutionImage;
+import java.awt.image.BufferedImage;
+import java.awt.image.ImageObserver;
+import java.awt.image.VolatileImage;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * A base class used for icons or images that are expensive to paint.
@@ -129,6 +141,22 @@
             }
             if (image == null) {
                 // Recreate the image
+                if( config != null && (w != baseHeight || h != baseWidth)) {
+                    AffineTransform tx = config.getDefaultTransform();
+                    double sx = tx.getScaleX();
+                    double sy = tx.getScaleY();
+                    if ( Double.compare(sx, 1) != 0 ||
+                                                   Double.compare(sy, 1) != 0) {
+                        if (Math.abs(sx * baseWidth - w) < 1 &&
+                            Math.abs(sy * baseHeight - h) < 1) {
+                            w = baseWidth;
+                            h = baseHeight;
+                        } else {
+                            w = (int)Math.ceil(w / sx);
+                            h = (int)Math.ceil(w / sy);
+                        }
+                    }
+                }
                 image = createImage(c, w, h, config, args);
                 cache.setImage(key, config, w, h, args, image);
                 draw = true;
@@ -139,10 +167,24 @@
             if (draw) {
                 // Render to the Image
                 Graphics2D g2 = (Graphics2D) image.getGraphics();
-                if (volatileImage == null && (w != baseWidth || h != baseHeight)) {
-                    g2.scale((double) w / baseWidth, (double) h / baseHeight);
+                if (volatileImage == null) {
+                    if ((w != baseWidth || h != baseHeight)) {
+                        g2.scale((double) w / baseWidth,
+                                (double) h / baseHeight);
+                    }
+                    paintToImage(c, image, g2, baseWidth, baseHeight, args);
+                } else {
+                    SurfaceData sd = SurfaceManager.getManager(volatileImage)
+                            .getPrimarySurfaceData();
+                    double sx = sd.getDefaultScaleX();
+                    double sy = sd.getDefaultScaleY();
+                    if ( Double.compare(sx, 1) != 0 ||
+                                                   Double.compare(sy, 1) != 0) {
+                        g2.scale(1 / sx, 1 / sy);
+                    }
+                    paintToImage(c, image, g2, (int)Math.ceil(w * sx),
+                                               (int)Math.ceil(h * sy), args);
                 }
-                paintToImage(c, image, g2, baseWidth, baseHeight, args);
                 g2.dispose();
             }
 
@@ -288,4 +330,4 @@
             return Arrays.asList(getResolutionVariant(baseWidth, baseHeight));
         }
     }
-}
\ No newline at end of file
+}
--- a/src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, 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
@@ -113,7 +113,7 @@
 
     // internal lock for synchronizing state changes and paint calls, initialized in preInit.
     // the order with other locks: AWTLock -> stateLock
-    static class StateLock extends Object { }
+    static class StateLock { }
     protected StateLock state_lock;
 
     /**
@@ -315,7 +315,7 @@
      * Creates window with parameters specified by {@code params}
      * @see #init
      */
-    private final void create(XCreateWindowParams params) {
+    private void create(XCreateWindowParams params) {
         XToolkit.awtLock();
         try {
             XSetWindowAttributes xattr = new XSetWindowAttributes();
--- a/src/java.desktop/unix/classes/sun/java2d/x11/X11Renderer.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/unix/classes/sun/java2d/x11/X11Renderer.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, 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
@@ -54,7 +54,7 @@
                 : new X11Renderer());
     }
 
-    private final long validate(SunGraphics2D sg2d) {
+    private long validate(SunGraphics2D sg2d) {
         // NOTE: getCompClip() will revalidateAll() if the
         // surfaceData is invalid.  This should ensure that
         // the clip and pixel that we are validating against
--- a/src/java.desktop/unix/classes/sun/java2d/xr/XRRenderer.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRRenderer.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,7 @@
      * Common validate method, used by all XRRender functions to validate the
      * destination context.
      */
-    private final void validateSurface(SunGraphics2D sg2d) {
+    private void validateSurface(SunGraphics2D sg2d) {
         XRSurfaceData xrsd;
         try {
             xrsd = (XRSurfaceData) sg2d.surfaceData;
--- a/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java	Sat Dec 02 06:51:10 2017 +0100
@@ -498,7 +498,7 @@
             // set Clause and Reading Information
             if (clauseBoundary!=null && clauseReading!=null &&
                 clauseReading.length!=0 && clauseBoundary.length==clauseReading.length+1 &&
-                clauseBoundary[0]==0 && clauseBoundary[clauseReading.length]==text.length() )
+                clauseBoundary[0]==0 && clauseBoundary[clauseReading.length]<=text.length() )
             {
                 for (int i=0; i<clauseBoundary.length-1; i++) {
                     attrStr.addAttribute(Attribute.INPUT_METHOD_SEGMENT,
--- a/src/java.desktop/windows/classes/sun/awt/windows/WWindowPeer.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WWindowPeer.java	Sat Dec 02 06:51:10 2017 +0100
@@ -630,7 +630,7 @@
      private native void nativeGrab();
      private native void nativeUngrab();
 
-     private final boolean hasWarningWindow() {
+     private boolean hasWarningWindow() {
          return ((Window)target).getWarningString() != null;
      }
 
@@ -674,7 +674,7 @@
          super.setBounds(x, y, width, height, op);
      }
 
-    private final void initScales() {
+    private void initScales() {
 
         if (scaleX >= 1 && scaleY >= 1) {
             return;
--- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceData.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceData.java	Sat Dec 02 06:51:10 2017 +0100
@@ -58,6 +58,7 @@
 import sun.java2d.pipe.PixelToParallelogramConverter;
 import sun.java2d.pipe.RenderBuffer;
 import sun.java2d.pipe.TextPipe;
+import sun.java2d.pipe.Region;
 import static sun.java2d.pipe.BufferedOpCodes.*;
 import static sun.java2d.d3d.D3DContext.D3DContextCaps.*;
 import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*;
@@ -236,8 +237,8 @@
             this.width = scaledSize.width;
             this.height = scaledSize.height;
         } else {
-            this.width = (int) Math.ceil(width * scaleX);
-            this.height = (int) Math.ceil(height * scaleY);
+            this.width = Region.clipRound(width * scaleX);
+            this.height = Region.clipRound(height * scaleY);
         }
 
         this.offscreenImage = image;
@@ -812,8 +813,8 @@
             double scaleY = getDefaultScaleY();
             Rectangle r = peer.getBounds();
             r.x = r.y = 0;
-            r.width = (int) Math.ceil(r.width * scaleX);
-            r.height = (int) Math.ceil(r.height * scaleY);
+            r.width = Region.clipRound(r.width * scaleX);
+            r.height = Region.clipRound(r.height * scaleY);
             return r;
         } else {
             return new Rectangle(width, height);
--- a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java	Sat Dec 02 06:51:10 2017 +0100
@@ -37,6 +37,7 @@
 import sun.awt.Win32GraphicsDevice;
 import sun.awt.windows.WComponentPeer;
 import sun.java2d.SurfaceData;
+import sun.java2d.pipe.Region;
 
 public abstract class WGLSurfaceData extends OGLSurfaceData {
 
@@ -165,8 +166,8 @@
         public Rectangle getBounds() {
             Rectangle r = peer.getBounds();
             r.x = r.y = 0;
-            r.width = (int) Math.ceil(r.width * scaleX);
-            r.height = (int) Math.ceil(r.height * scaleY);
+            r.width = Region.clipRound(r.width * scaleX);
+            r.height = Region.clipRound(r.height * scaleY);
             return r;
         }
 
@@ -227,8 +228,8 @@
         {
             super(peer, gc, cm, type);
 
-            this.width = (int) Math.ceil(width * scaleX);
-            this.height = (int) Math.ceil(height * scaleY);
+            this.width = Region.clipRound(width * scaleX);
+            this.height = Region.clipRound(height * scaleY);
             offscreenImage = image;
 
             initSurface(this.width, this.height);
@@ -241,8 +242,8 @@
         public Rectangle getBounds() {
             if (type == FLIP_BACKBUFFER) {
                 Rectangle r = peer.getBounds();
-                r.width = (int) Math.ceil(r.width * scaleX);
-                r.height = (int) Math.ceil(r.height * scaleY);
+                r.width = Region.clipRound(r.width * scaleX);
+                r.height = Region.clipRound(r.height * scaleY);
                 r.x = r.y = 0;
                 return r;
             } else {
--- a/src/java.desktop/windows/classes/sun/java2d/windows/GDIWindowSurfaceData.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/windows/classes/sun/java2d/windows/GDIWindowSurfaceData.java	Sat Dec 02 06:51:10 2017 +0100
@@ -302,8 +302,8 @@
     public Rectangle getBounds() {
         Rectangle r = peer.getBounds();
         r.x = r.y = 0;
-        r.width = (int) Math.ceil(r.width * scaleX);
-        r.height = (int) Math.ceil(r.height * scaleY);
+        r.width = Region.clipRound(r.width * scaleX);
+        r.height = Region.clipRound(r.height * scaleY);
         return r;
     }
 
--- a/src/java.desktop/windows/native/libawt/windows/awt_InputTextInfor.cpp	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.desktop/windows/native/libawt/windows/awt_InputTextInfor.cpp	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -202,9 +202,15 @@
          m_lpClauseW == NULL || m_lpReadClauseW == NULL ||
          m_lpClauseW[0] != 0 || m_lpClauseW[m_cClauseW] != (DWORD)m_cStrW ||
          m_lpReadClauseW[0] != 0 || m_lpReadClauseW[m_cReadClauseW] != (DWORD)m_cReadStrW) {
-        lpBndClauseW = NULL;
-        lpReadingClauseW = NULL;
-        return 0;
+        // For cases where IMM sends WM_IME_COMPOSITION with both GCS_COMPSTR and GCS_RESULTSTR
+        // The GCS_RESULTSTR part may have Caluse and Reading information which should not be ignored
+        if (NULL == m_pResultTextInfor) {
+            lpBndClauseW = NULL;
+            lpReadingClauseW = NULL;
+            return 0;
+        } else {
+            return m_pResultTextInfor->GetClauseInfor(lpBndClauseW, lpReadingClauseW);
+        }
     }
 
     int*    bndClauseW = NULL;
@@ -346,10 +352,14 @@
 //
 int AwtInputTextInfor::GetAttributeInfor(int*& lpBndAttrW, BYTE*& lpValAttrW) {
     if (m_cStrW == 0 || m_cAttrW != m_cStrW) {
-        lpBndAttrW = NULL;
-        lpValAttrW = NULL;
+        if (NULL == m_pResultTextInfor) {
+            lpBndAttrW = NULL;
+            lpValAttrW = NULL;
 
-        return 0;
+            return 0;
+        } else {
+            return m_pResultTextInfor->GetAttributeInfor(lpBndAttrW, lpValAttrW);
+        }
     }
 
     int* bndAttrW = NULL;
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriter.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriter.java	Sat Dec 02 06:51:10 2017 +0100
@@ -505,7 +505,7 @@
                     }
                     // add namespace declarations
                     for (NamespaceDeclaration namespace : this.namespaceDeclarations) {
-                        target.addNamespaceDeclaration(namespace.prefix, namespace.namespaceUri);
+                        newElement.addNamespaceDeclaration(namespace.prefix, namespace.namespaceUri);
                     }
                     // add attribute declarations
                     for (AttributeDeclaration attribute : this.attributeDeclarations) {
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java	Sat Dec 02 06:51:10 2017 +0100
@@ -499,7 +499,7 @@
                     }
                     // add namespace declarations
                     for (NamespaceDeclaration namespace : this.namespaceDeclarations) {
-                        target.addNamespaceDeclaration(namespace.prefix, namespace.namespaceUri);
+                        newElement.addNamespaceDeclaration(namespace.prefix, namespace.namespaceUri);
                     }
                     // add attribute declarations
                     for (AttributeDeclaration attribute : this.attributeDeclarations) {
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantDouble.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantDouble.java	Sat Dec 02 06:51:10 2017 +0100
@@ -32,6 +32,7 @@
  *
  * @version $Id: ConstantDouble.java 1747278 2016-06-07 17:28:43Z britter $
  * @see     Constant
+ * @LastModified: Nov 2017
  */
 public final class ConstantDouble extends Constant implements ConstantObject {
 
@@ -121,6 +122,6 @@
      */
     @Override
     public Object getConstantValue( final ConstantPool cp ) {
-        return new Double(bytes);
+        return bytes;
     }
 }
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantFloat.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/ConstantFloat.java	Sat Dec 02 06:51:10 2017 +0100
@@ -32,6 +32,7 @@
  *
  * @version $Id: ConstantFloat.java 1747278 2016-06-07 17:28:43Z britter $
  * @see     Constant
+ * @LastModified: Nov 2017
  */
 public final class ConstantFloat extends Constant implements ConstantObject {
 
@@ -122,6 +123,6 @@
      */
     @Override
     public Object getConstantValue( final ConstantPool cp ) {
-        return new Float(bytes);
+        return bytes;
     }
 }
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DCONST.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/DCONST.java	Sat Dec 02 06:51:10 2017 +0100
@@ -26,6 +26,7 @@
  * <PRE>Stack: ... -&gt; ..., </PRE>
  *
  * @version $Id: DCONST.java 1747278 2016-06-07 17:28:43Z britter $
+ * @LastModified: Nov 2017
  */
 public class DCONST extends Instruction implements ConstantPushInstruction {
 
@@ -55,7 +56,7 @@
 
     @Override
     public Number getValue() {
-        return new Double(value);
+        return value;
     }
 
 
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FCONST.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/FCONST.java	Sat Dec 02 06:51:10 2017 +0100
@@ -26,6 +26,7 @@
  * <PRE>Stack: ... -&gt; ..., </PRE>
  *
  * @version $Id: FCONST.java 1747278 2016-06-07 17:28:43Z britter $
+ * @LastModified: Nov 2017
  */
 public class FCONST extends Instruction implements ConstantPushInstruction {
 
@@ -57,7 +58,7 @@
 
     @Override
     public Number getValue() {
-        return new Float(value);
+        return value;
     }
 
 
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEDYNAMIC.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEDYNAMIC.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -41,6 +40,7 @@
  * <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.invokedynamic">
  * The invokedynamic instruction in The Java Virtual Machine Specification</a>
  * @since 6.0
+ * @LastModified: Nov 2017
  */
 public class INVOKEDYNAMIC extends InvokeInstruction {
 
@@ -124,8 +124,14 @@
 
     /**
      * Override the parent method because our classname is held elsewhere.
+     *
+     * @param cpg the ConstantPool generator
+     * @deprecated in FieldOrMethod
+     *
+     * @return name of the referenced class/interface
      */
     @Override
+    @Deprecated
     public String getClassName( final ConstantPoolGen cpg ) {
         final ConstantPool cp = cpg.getConstantPool();
         final ConstantInvokeDynamic cid = (ConstantInvokeDynamic) cp.getConstant(super.getIndex(), Const.CONSTANT_InvokeDynamic);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionFactory.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionFactory.java	Sat Dec 02 06:51:10 2017 +0100
@@ -32,6 +32,7 @@
  * @version $Id: InstructionFactory.java 1749603 2016-06-21 20:50:19Z ggregory $
  * @see Const
  * @see InstructionConst
+ * @LastModified: Nov 2017
  */
 public class InstructionFactory {
 
@@ -573,7 +574,7 @@
                     + short_names[dest - Const.T_CHAR];
             Instruction i = null;
             try {
-                i = (Instruction) java.lang.Class.forName(name).newInstance();
+                i = (Instruction) java.lang.Class.forName(name).getDeclaredConstructor().newInstance();
             } catch (final Exception e) {
                 throw new RuntimeException("Could not find instruction: " + name, e);
             }
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC.java	Sat Dec 02 06:51:10 2017 +0100
@@ -32,6 +32,7 @@
  * <PRE>Stack: ... -&gt; ..., item</PRE>
  *
  * @version $Id: LDC.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @LastModified: Nov 2017
  */
 public class LDC extends CPInstruction implements PushInstruction, ExceptionThrower {
 
@@ -104,9 +105,9 @@
                 c = cpg.getConstantPool().getConstant(i);
                 return ((com.sun.org.apache.bcel.internal.classfile.ConstantUtf8) c).getBytes();
             case com.sun.org.apache.bcel.internal.Const.CONSTANT_Float:
-                return new Float(((com.sun.org.apache.bcel.internal.classfile.ConstantFloat) c).getBytes());
+                return ((com.sun.org.apache.bcel.internal.classfile.ConstantFloat) c).getBytes();
             case com.sun.org.apache.bcel.internal.Const.CONSTANT_Integer:
-                return Integer.valueOf(((com.sun.org.apache.bcel.internal.classfile.ConstantInteger) c).getBytes());
+                return ((com.sun.org.apache.bcel.internal.classfile.ConstantInteger) c).getBytes();
             case com.sun.org.apache.bcel.internal.Const.CONSTANT_Class:
                 final int nameIndex = ((com.sun.org.apache.bcel.internal.classfile.ConstantClass) c).getNameIndex();
                 c = cpg.getConstantPool().getConstant(nameIndex);
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC2_W.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC2_W.java	Sat Dec 02 06:51:10 2017 +0100
@@ -26,6 +26,7 @@
  * <PRE>Stack: ... -&gt; ..., item.word1, item.word2</PRE>
  *
  * @version $Id: LDC2_W.java 1749603 2016-06-21 20:50:19Z ggregory $
+ * @LastModified: Nov 2017
  */
 public class LDC2_W extends CPInstruction implements PushInstruction {
 
@@ -59,9 +60,9 @@
         final com.sun.org.apache.bcel.internal.classfile.Constant c = cpg.getConstantPool().getConstant(super.getIndex());
         switch (c.getTag()) {
             case com.sun.org.apache.bcel.internal.Const.CONSTANT_Long:
-                return Long.valueOf(((com.sun.org.apache.bcel.internal.classfile.ConstantLong) c).getBytes());
+                return ((com.sun.org.apache.bcel.internal.classfile.ConstantLong) c).getBytes();
             case com.sun.org.apache.bcel.internal.Const.CONSTANT_Double:
-                return new Double(((com.sun.org.apache.bcel.internal.classfile.ConstantDouble) c).getBytes());
+                return ((com.sun.org.apache.bcel.internal.classfile.ConstantDouble) c).getBytes();
             default: // Never reached
                 throw new RuntimeException("Unknown or invalid constant type at " + super.getIndex());
         }
--- a/src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS.java.template	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS.java.template	Sat Dec 02 06:51:10 2017 +0100
@@ -31,6 +31,7 @@
 import sun.nio.cs.DoubleByte;
 import sun.nio.cs.HKSCS;
 import sun.nio.cs.HistoricallyNamedCharset;
+import sun.nio.cs.*;
 import static sun.nio.cs.CharsetMapping.*;
 
 public class Big5_HKSCS extends Charset implements HistoricallyNamedCharset
--- a/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS950_HKSCS.java	Sat Dec 02 11:25:35 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  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.nio.cs.ext;
-
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import sun.nio.cs.HistoricallyNamedCharset;
-import sun.nio.cs.*;
-import static sun.nio.cs.CharsetMapping.*;
-
-public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
-{
-    public MS950_HKSCS() {
-        super("x-MS950-HKSCS", ExtendedCharsets.aliasesFor("x-MS950-HKSCS"));
-    }
-
-    public String historicalName() {
-        return "MS950_HKSCS";
-    }
-
-    public boolean contains(Charset cs) {
-        return ((cs.name().equals("US-ASCII"))
-                || (cs instanceof MS950)
-                || (cs instanceof MS950_HKSCS));
-    }
-
-    public CharsetDecoder newDecoder() {
-        return new Decoder(this);
-    }
-
-    public CharsetEncoder newEncoder() {
-        return new Encoder(this);
-    }
-
-    static class Decoder extends HKSCS.Decoder {
-        private static DoubleByte.Decoder ms950 =
-            (DoubleByte.Decoder)new MS950().newDecoder();
-
-        private static char[][] b2cBmp = new char[0x100][];
-        private static char[][] b2cSupp = new char[0x100][];
-        static {
-            initb2c(b2cBmp, HKSCSMapping.b2cBmpStr);
-            initb2c(b2cSupp, HKSCSMapping.b2cSuppStr);
-        }
-
-        private Decoder(Charset cs) {
-            super(cs, ms950, b2cBmp, b2cSupp);
-        }
-    }
-
-    private static class Encoder extends HKSCS.Encoder {
-        private static DoubleByte.Encoder ms950 =
-            (DoubleByte.Encoder)new MS950().newEncoder();
-
-        static char[][] c2bBmp = new char[0x100][];
-        static char[][] c2bSupp = new char[0x100][];
-        static {
-            initc2b(c2bBmp, HKSCSMapping.b2cBmpStr, HKSCSMapping.pua);
-            initc2b(c2bSupp, HKSCSMapping.b2cSuppStr, null);
-        }
-
-        private Encoder(Charset cs) {
-            super(cs, ms950, c2bBmp, c2bSupp);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.charsets/share/classes/sun/nio/cs/ext/MS950_HKSCS.java.template	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 $PACKAGE$;
+
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import sun.nio.cs.HistoricallyNamedCharset;
+import sun.nio.cs.*;
+import static sun.nio.cs.CharsetMapping.*;
+
+public class MS950_HKSCS extends Charset implements HistoricallyNamedCharset
+{
+    public MS950_HKSCS() {
+        super("x-MS950-HKSCS", $ALIASES$);
+    }
+
+    public String historicalName() {
+        return "MS950_HKSCS";
+    }
+
+    public boolean contains(Charset cs) {
+        return ((cs.name().equals("US-ASCII"))
+                || (cs instanceof MS950)
+                || (cs instanceof MS950_HKSCS));
+    }
+
+    public CharsetDecoder newDecoder() {
+        return new Decoder(this);
+    }
+
+    public CharsetEncoder newEncoder() {
+        return new Encoder(this);
+    }
+
+    static class Decoder extends HKSCS.Decoder {
+        private static DoubleByte.Decoder ms950 =
+            (DoubleByte.Decoder)new MS950().newDecoder();
+
+        private static char[][] b2cBmp = new char[0x100][];
+        private static char[][] b2cSupp = new char[0x100][];
+        static {
+            initb2c(b2cBmp, HKSCSMapping.b2cBmpStr);
+            initb2c(b2cSupp, HKSCSMapping.b2cSuppStr);
+        }
+
+        private Decoder(Charset cs) {
+            super(cs, ms950, b2cBmp, b2cSupp);
+        }
+    }
+
+    private static class Encoder extends HKSCS.Encoder {
+        private static DoubleByte.Encoder ms950 =
+            (DoubleByte.Encoder)new MS950().newEncoder();
+
+        static char[][] c2bBmp = new char[0x100][];
+        static char[][] c2bSupp = new char[0x100][];
+        static {
+            initc2b(c2bBmp, HKSCSMapping.b2cBmpStr, HKSCSMapping.pua);
+            initc2b(c2bSupp, HKSCSMapping.b2cSuppStr, null);
+        }
+
+        private Encoder(Charset cs) {
+            super(cs, ms950, c2bBmp, c2bSupp);
+        }
+    }
+}
--- a/src/jdk.compiler/share/classes/com/sun/source/doctree/DocCommentTree.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/DocCommentTree.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 package com.sun.source.doctree;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -69,4 +70,39 @@
      * @return the block tags of a documentation comment
      */
     List<? extends DocTree> getBlockTags();
+
+    /**
+     * Returns a list of trees containing the content (if any) preceding
+     * the content of the documentation comment.
+     * When the {@code DocCommentTree} has been read from a documentation
+     * comment in a Java source file, the list will be empty.
+     * When the {@code DocCommentTree} has been read from an HTML file, this
+     * represents the content from the beginning of the file up to and
+     * including the {@code <body>} tag.
+     *
+     * @implSpec This implementation returns an empty list.
+     *
+     * @return the list of trees
+     * @since 10
+     */
+    default List<? extends DocTree> getPreamble() {
+        return Collections.emptyList();
+    }
+
+    /**
+     * Returns a list of trees containing the content (if any) following the
+     * content of the documentation comment.
+     * When the {@code DocCommentTree} has been read from a documentation
+     * comment in a Java source file, the list will be empty.
+     * When {@code DocCommentTree} has been read from an HTML file, this
+     * represents the content from the {@code </body>} tag to the end of file.
+     *
+     * @implSpec This implementation returns an empty list.
+     *
+     * @return the list of trees
+     * @since 10
+     */
+    default List<? extends DocTree> getPostamble() {
+        return Collections.emptyList();
+    }
 }
--- a/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTree.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTree.java	Sat Dec 02 06:51:10 2017 +0100
@@ -78,6 +78,12 @@
         DOC_ROOT("docRoot"),
 
         /**
+         * Used for instances of {@link DocTypeTree}
+         * representing an HTML DocType declaration.
+         */
+        DOC_TYPE,
+
+        /**
          * Used for instances of {@link EndElementTree}
          * representing the end of an HTML element.
          */
--- a/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTreeVisitor.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTreeVisitor.java	Sat Dec 02 06:51:10 2017 +0100
@@ -105,6 +105,21 @@
     R visitDocRoot(DocRootTree node, P p);
 
     /**
+     * Visits a DocTypeTree node.
+     *
+     * @implSpec Visits a {@code DocTypeTree} node
+     * by calling {@code visitOther(node, p)}.
+     *
+     * @param node the node being visited
+     * @param p    a parameter value
+     * @return a result value
+     * @since 10
+     */
+    default R visitDocType(DocTypeTree node, P p) {
+        return visitOther(node, p);
+    }
+
+    /**
      * Visits an EndElementTree node.
      * @param node the node being visited
      * @param p a parameter value
@@ -267,7 +282,9 @@
      * @return a result value
      * @since 10
      */
-    default R visitSummary(SummaryTree node, P p) { return visitOther(node, p);}
+    default R visitSummary(SummaryTree node, P p) {
+        return visitOther(node, p);
+    }
 
     /**
      * Visits a TextTree node.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/DocTypeTree.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.source.doctree;
+
+/**
+ * A tree node for a {@code doctype} declaration.
+ *
+ * <p>
+ * &lt;!doctype text&gt;
+ *
+ * @since 10
+ */
+public interface DocTypeTree extends DocTree {
+    /**
+     * Returns the text of the doctype declaration.
+     * @return text
+     */
+    String getText();
+}
--- a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java	Sat Dec 02 06:51:10 2017 +0100
@@ -39,6 +39,7 @@
 import com.sun.source.doctree.DocCommentTree;
 import com.sun.source.doctree.DocRootTree;
 import com.sun.source.doctree.DocTree;
+import com.sun.source.doctree.DocTypeTree;
 import com.sun.source.doctree.EndElementTree;
 import com.sun.source.doctree.EntityTree;
 import com.sun.source.doctree.ErroneousTree;
@@ -121,6 +122,20 @@
      */
     DocCommentTree newDocCommentTree(List<? extends DocTree> fullBody, List<? extends DocTree> tags);
 
+
+    /**
+     * Create a new {@code DocCommentTree} object, to represent the enitire doc comment.
+     * @param fullBody the entire body of the doc comment
+     * @param tags the block tags in the doc comment
+     * @param preamble the meta content of an html file including the body tag
+     * @param postamble the meta content of an html including the closing body tag
+     * @return a {@code DocCommentTree} object
+     * @since 10
+     */
+    DocCommentTree newDocCommentTree(List<? extends DocTree> fullBody,
+                                     List<? extends DocTree> tags,
+                                     List<? extends DocTree> preamble,
+                                     List<? extends DocTree> postamble);
     /**
      * Create a new {@code DocRootTree} object, to represent an {@code {@docroot} } tag.
      * @return a {@code DocRootTree} object
@@ -128,6 +143,14 @@
     DocRootTree newDocRootTree();
 
     /**
+     * Create a new {@code DocTypeTree}, to represent a {@code DOCTYPE} HTML declaration.
+     * @param text the content of the declaration
+     * @return a {@code CommentTree} object
+     * @since 10
+     */
+    DocTypeTree newDocTypeTree(String text);
+
+    /**
      * Create a new {@code EndElement} object, to represent the end of an HTML element.
      * @param name the name of the HTML element
      * @return an {@code EndElementTree} object
--- a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java	Sat Dec 02 06:51:10 2017 +0100
@@ -206,6 +206,18 @@
      * @return the result of scanning
      */
     @Override
+    public R visitDocType(DocTypeTree node, P p) {
+        return null;
+    }
+
+    /**
+     * {@inheritDoc} This implementation returns {@code null}.
+     *
+     * @param node  {@inheritDoc}
+     * @param p  {@inheritDoc}
+     * @return the result of scanning
+     */
+    @Override
     public R visitEndElement(EndElementTree node, P p) {
         return null;
     }
--- a/src/jdk.compiler/share/classes/com/sun/source/util/DocTrees.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/source/util/DocTrees.java	Sat Dec 02 06:51:10 2017 +0100
@@ -98,13 +98,12 @@
     /**
      * Returns the doc comment tree of the given file. The file must be
      * an HTML file, in which case the doc comment tree represents the
-     * contents of the &lt;body&gt; tag, and any enclosing tags are ignored.
+     * entire contents of the file.
      * Returns {@code null} if no doc comment was found.
      * Future releases may support additional file types.
      *
      * @param fileObject the content container
      * @return the doc comment tree
-     *
      * @since 9
      */
     public abstract DocCommentTree getDocCommentTree(FileObject fileObject);
--- a/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java	Sat Dec 02 06:51:10 2017 +0100
@@ -168,6 +168,19 @@
     }
 
     /**
+     * {@inheritDoc}
+     *
+     * @implSpec This implementation calls {@code defaultAction}.
+     *
+     * @param node {@inheritDoc}
+     * @param p {@inheritDoc}
+     * @return  the result of {@code defaultAction}
+     * @since 10
+     */
+    @Override
+    public R visitDocType(DocTypeTree node, P p) { return defaultAction(node, p); }
+
+    /**
      * {@inheritDoc} This implementation calls {@code defaultAction}.
      *
      * @param node {@inheritDoc}
@@ -175,9 +188,7 @@
      * @return  the result of {@code defaultAction}
      */
     @Override
-    public R visitEndElement(EndElementTree node, P p) {
-        return defaultAction(node, p);
-    }
+    public R visitEndElement(EndElementTree node, P p) { return defaultAction(node, p);}
 
     /**
      * {@inheritDoc} This implementation calls {@code defaultAction}.
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Sat Dec 02 06:51:10 2017 +0100
@@ -28,9 +28,8 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.text.BreakIterator;
-import java.util.HashMap;
+import java.util.Collections;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -59,6 +58,8 @@
 
 import com.sun.source.doctree.DocCommentTree;
 import com.sun.source.doctree.DocTree;
+import com.sun.source.doctree.EndElementTree;
+import com.sun.source.doctree.StartElementTree;
 import com.sun.source.tree.CatchTree;
 import com.sun.source.tree.CompilationUnitTree;
 import com.sun.source.tree.Scope;
@@ -68,6 +69,7 @@
 import com.sun.source.util.DocTreeScanner;
 import com.sun.source.util.DocTrees;
 import com.sun.source.util.JavacTask;
+import com.sun.source.util.SimpleDocTreeVisitor;
 import com.sun.source.util.TreePath;
 import com.sun.tools.javac.code.Flags;
 import com.sun.tools.javac.code.Scope.NamedImportScope;
@@ -1006,16 +1008,7 @@
             public String getText() {
                 try {
                     CharSequence rawDoc = fileObject.getCharContent(true);
-                    Pattern bodyPat =
-                            Pattern.compile("(?is).*?<body\\b[^>]*>(.*)</body\\b.*");
-                    Matcher m = bodyPat.matcher(rawDoc);
-                    if (m.matches()) {
-                        offset = m.end(1);
-                        return m.group(1);
-                    } else {
-                        // Assume doclint will do the right thing.
-                        return "";
-                    }
+                    return rawDoc.toString();
                 } catch (IOException ignore) {
                     // do nothing
                 }
@@ -1038,13 +1031,15 @@
             }
         };
 
-        return new DocCommentParser(parser, diagSource, comment).parse();
+        return new DocCommentParser(parser, diagSource, comment, true).parse();
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
     public DocTreePath getDocTreePath(FileObject fileObject, PackageElement packageElement) {
         JavaFileObject jfo = asJavaFileObject(fileObject);
         DocCommentTree docCommentTree = getDocCommentTree(jfo);
+        if (docCommentTree == null)
+            return null;
         TreePath treePath = makeTreePath((PackageSymbol)packageElement, jfo, docCommentTree);
         return new DocTreePath(treePath, docCommentTree);
     }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Sat Dec 02 06:51:10 2017 +0100
@@ -237,7 +237,7 @@
      * {@code upwards(List<#CAP1>, [#CAP2]) = List<#CAP1> }
      * {@code downwards(List<#CAP1>, [#CAP1]) = not defined }
      */
-    class TypeProjection extends StructuralTypeMapping<ProjectionKind> {
+    class TypeProjection extends TypeMapping<ProjectionKind> {
 
         List<Type> vars;
         Set<Type> seen = new HashSet<>();
@@ -257,13 +257,21 @@
                 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;
+                List<Type> formals = t.tsym.type.getTypeArguments();
+                ListBuffer<Type> typarams1 = new ListBuffer<>();
+                boolean changed = false;
+                for (Type actual : typarams) {
+                    Type t2 = mapTypeArgument(t, formals.head.getUpperBound(), actual, pkind);
+                    if (t2.hasTag(BOT)) {
+                        //not defined
+                        return syms.botType;
+                    }
+                    typarams1.add(t2);
+                    changed |= actual != t2;
+                    formals = formals.tail;
                 }
-                if (outer1 == outer && typarams1 == typarams) return t;
-                else return new ClassType(outer1, typarams1, t.tsym, t.getMetadata()) {
+                if (outer1 == outer && !changed) return t;
+                else return new ClassType(outer1, typarams1.toList(), t.tsym, t.getMetadata()) {
                     @Override
                     protected boolean needsStripping() {
                         return true;
@@ -272,21 +280,23 @@
             }
         }
 
-        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;
+        @Override
+        public Type visitArrayType(ArrayType t, ProjectionKind s) {
+            Type elemtype = t.elemtype;
+            Type elemtype1 = visit(elemtype, s);
+            if (elemtype1 == elemtype) {
+                return t;
+            } else if (elemtype1.hasTag(BOT)) {
+                //undefined
+                return syms.botType;
             } else {
-                bound = upper;
-                bk = isUpperObject ? UNBOUND : EXTENDS;
-            }
-            return new WildcardType(bound, bk, syms.boundClass);
+                return new ArrayType(elemtype1, t.tsym, t.metadata) {
+                    @Override
+                    protected boolean needsStripping() {
+                        return true;
+                    }
+                };
+            }
         }
 
         @Override
@@ -322,33 +332,79 @@
             }
         }
 
-        @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 site, Type declaredBound, Type t, ProjectionKind pkind) {
+            return t.containsAny(vars) ?
+                    t.map(new TypeArgumentProjection(site, declaredBound), pkind) :
+                    t;
         }
 
-        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);
+        class TypeArgumentProjection extends TypeMapping<ProjectionKind> {
+
+            Type site;
+            Type declaredBound;
+
+            TypeArgumentProjection(Type site, Type declaredBound) {
+                this.site = site;
+                this.declaredBound = declaredBound;
+            }
+
+            @Override
+            public Type visitType(Type t, ProjectionKind pkind) {
+                //type argument is some type containing restricted vars
+                if (pkind == ProjectionKind.DOWNWARDS) {
+                    //not defined
+                    return syms.botType;
+                }
+                Type upper = t.map(TypeProjection.this, ProjectionKind.UPWARDS);
+                Type lower = t.map(TypeProjection.this, ProjectionKind.DOWNWARDS);
+                List<Type> formals = site.tsym.type.getTypeArguments();
+                BoundKind bk;
+                Type bound;
+                if (!isSameType(upper, syms.objectType) &&
+                        (declaredBound.containsAny(formals) ||
+                         !isSubtype(declaredBound, upper))) {
+                    bound = upper;
+                    bk = EXTENDS;
+                } else if (!lower.hasTag(BOT)) {
+                    bound = lower;
+                    bk = SUPER;
+                } else {
+                    bound = syms.objectType;
+                    bk = UNBOUND;
+                }
+                return makeWildcard(bound, bk);
+            }
+
+            @Override
+            public Type visitWildcardType(WildcardType wt, ProjectionKind pkind) {
+                //type argument is some wildcard whose bound contains restricted vars
+                Type bound = syms.botType;
+                BoundKind bk = wt.kind;
+                switch (wt.kind) {
+                    case EXTENDS:
+                        bound = wt.type.map(TypeProjection.this, pkind);
+                        if (bound.hasTag(BOT)) {
+                            return syms.botType;
+                        }
+                        break;
+                    case SUPER:
+                        bound = wt.type.map(TypeProjection.this, pkind.complement());
+                        if (bound.hasTag(BOT)) {
+                            bound = syms.objectType;
+                            bk = UNBOUND;
+                        }
+                        break;
+                }
+                return makeWildcard(bound, bk);
+            }
+
+            private Type makeWildcard(Type bound, BoundKind bk) {
+                return new WildcardType(bound, bk, syms.boundClass) {
+                    @Override
+                    protected boolean needsStripping() {
+                        return true;
+                    }
+                };
             }
         }
     }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java	Sat Dec 02 06:51:10 2017 +0100
@@ -63,6 +63,7 @@
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.Options;
+import com.sun.tools.javac.util.Position;
 
 import java.util.EnumSet;
 import java.util.HashMap;
@@ -305,7 +306,7 @@
             JCMethodDecl md = (JCMethodDecl)decls(oldTree.def).head;
             List<JCVariableDecl> params = md.params;
             JCBlock body = md.body;
-            JCLambda newTree = make.Lambda(params, body);
+            JCLambda newTree = make.at(oldTree).Lambda(params, body);
             return List.of(newTree);
         }
 
@@ -418,7 +419,7 @@
         List<JCEnhancedForLoop> rewrite(JCEnhancedForLoop oldTree) {
             JCEnhancedForLoop newTree = copier.copy(oldTree);
             newTree.var = rewriteVarType(oldTree.var);
-            newTree.body = make.Block(0, List.nil());
+            newTree.body = make.at(oldTree.body).Block(0, List.nil());
             return List.of(newTree);
         }
         @Override
@@ -551,7 +552,8 @@
             JCStatement treeToAnalyze = (JCStatement)rewriting.originalTree;
             if (rewriting.env.info.scope.owner.kind == Kind.TYP) {
                 //add a block to hoist potential dangling variable declarations
-                treeToAnalyze = make.Block(Flags.SYNTHETIC, List.of((JCStatement)rewriting.originalTree));
+                treeToAnalyze = make.at(Position.NOPOS)
+                                    .Block(Flags.SYNTHETIC, List.of((JCStatement)rewriting.originalTree));
             }
 
             //TODO: to further refine the analysis, try all rewriting combinations
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java	Sat Dec 02 06:51:10 2017 +0100
@@ -57,6 +57,7 @@
 import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.DiagnosticSource;
+import com.sun.tools.javac.util.JCDiagnostic;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
@@ -98,6 +99,7 @@
     protected static final Context.Key<ArgumentAttr> methodAttrKey = new Context.Key<>();
 
     private final DeferredAttr deferredAttr;
+    private final JCDiagnostic.Factory diags;
     private final Attr attr;
     private final Symtab syms;
     private final Log log;
@@ -121,6 +123,7 @@
     protected ArgumentAttr(Context context) {
         context.put(methodAttrKey, this);
         deferredAttr = DeferredAttr.instance(context);
+        diags = JCDiagnostic.Factory.instance(context);
         attr = Attr.instance(context);
         syms = Symtab.instance(context);
         log = Log.instance(context);
@@ -482,18 +485,14 @@
         List<JCReturn> returnExpressions() {
             return returnExpressions.orElseGet(() -> {
                 final List<JCReturn> res;
-                if (speculativeTree.getBodyKind() == BodyKind.EXPRESSION) {
-                    res = List.of(attr.make.Return((JCExpression)speculativeTree.body));
-                } else {
-                    ListBuffer<JCReturn> returnExpressions = new ListBuffer<>();
-                    new LambdaReturnScanner() {
-                        @Override
-                        public void visitReturn(JCReturn tree) {
-                            returnExpressions.add(tree);
-                        }
-                    }.scan(speculativeTree.body);
-                    res = returnExpressions.toList();
-                }
+                ListBuffer<JCReturn> buf = new ListBuffer<>();
+                new LambdaReturnScanner() {
+                    @Override
+                    public void visitReturn(JCReturn tree) {
+                        buf.add(tree);
+                    }
+                }.scan(speculativeTree.body);
+                res = buf.toList();
                 returnExpressions = Optional.of(res);
                 return res;
             });
@@ -519,16 +518,38 @@
         private void checkLambdaCompatible(Type descriptor, ResultInfo resultInfo) {
             CheckContext checkContext = resultInfo.checkContext;
             ResultInfo bodyResultInfo = attr.lambdaBodyResult(speculativeTree, descriptor, resultInfo);
-            for (JCReturn ret : returnExpressions()) {
-                Type t = getReturnType(ret);
-                if (speculativeTree.getBodyKind() == BodyKind.EXPRESSION || !t.hasTag(VOID)) {
-                    checkSpeculative(ret.expr, t, bodyResultInfo);
-                }
+            switch (speculativeTree.getBodyKind()) {
+                case EXPRESSION:
+                    checkSpeculative(speculativeTree.body, speculativeTree.body.type, bodyResultInfo);
+                    break;
+                case STATEMENT:
+                    for (JCReturn ret : returnExpressions()) {
+                        checkReturnInStatementLambda(ret, bodyResultInfo);
+                    }
+                    break;
             }
 
             attr.checkLambdaCompatible(speculativeTree, descriptor, checkContext);
         }
 
+        /**
+         * This is an inlined version of {@link Attr#visitReturn(JCReturn)}.
+         */
+        void checkReturnInStatementLambda(JCReturn ret, ResultInfo resultInfo) {
+            if (resultInfo.pt.hasTag(VOID) && ret.expr != null) {
+                //fail - if the function type's result is void, the lambda body must be a void-compatible block.
+                resultInfo.checkContext.report(speculativeTree.pos(),
+                        diags.fragment("unexpected.ret.val"));
+            } else if (!resultInfo.pt.hasTag(VOID)) {
+                if (ret.expr == null) {
+                    //fail - if the function type's result is non-void, the lambda body must be a value-compatible block.
+                    resultInfo.checkContext.report(speculativeTree.pos(),
+                            diags.fragment("missing.ret.val"));
+                }
+                checkSpeculative(ret.expr, ret.expr.type, resultInfo);
+            }
+        }
+
         /** Get the type associated with given return expression. */
         Type getReturnType(JCReturn ret) {
             if (ret.expr == null) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Sat Dec 02 06:51:10 2017 +0100
@@ -946,14 +946,17 @@
         }
 
     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);
+        } else if (t.hasTag(VOID)) {
+            log.error(pos, Errors.CantInferLocalVarType(name, Fragments.LocalCantInferVoid));
+            return types.createErrorType(t);
         }
-        return t;
+
+        //upward project the initializer type
+        return types.upward(t, types.captures(t));
     }
 
     Type checkMethod(final Type mtype,
@@ -3554,18 +3557,19 @@
                                       Scope staticallyImportedSoFar, Scope topLevelScope,
                                       Symbol sym, boolean staticImport) {
         Filter<Symbol> duplicates = candidate -> candidate != sym && !candidate.type.isErroneous();
-        Symbol clashing = ordinallyImportedSoFar.findFirst(sym.name, duplicates);
-        if (clashing == null && !staticImport) {
-            clashing = staticallyImportedSoFar.findFirst(sym.name, duplicates);
+        Symbol ordinaryClashing = ordinallyImportedSoFar.findFirst(sym.name, duplicates);
+        Symbol staticClashing = null;
+        if (ordinaryClashing == null && !staticImport) {
+            staticClashing = staticallyImportedSoFar.findFirst(sym.name, duplicates);
         }
-        if (clashing != null) {
-            if (staticImport)
-                log.error(pos, Errors.AlreadyDefinedStaticSingleImport(clashing));
+        if (ordinaryClashing != null || staticClashing != null) {
+            if (ordinaryClashing != null)
+                log.error(pos, Errors.AlreadyDefinedSingleImport(ordinaryClashing));
             else
-                log.error(pos, Errors.AlreadyDefinedSingleImport(clashing));
+                log.error(pos, Errors.AlreadyDefinedStaticSingleImport(staticClashing));
             return false;
         }
-        clashing = topLevelScope.findFirst(sym.name, duplicates);
+        Symbol clashing = topLevelScope.findFirst(sym.name, duplicates);
         if (clashing != null) {
             log.error(pos, Errors.AlreadyDefinedThisUnit(clashing));
             return false;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1548,7 +1548,8 @@
                       boolean allowBoxing,
                       boolean useVarargs) {
         if (sym.kind == ERR ||
-                !sym.isInheritedIn(site.tsym, types)) {
+                (site.tsym != sym.owner && !sym.isInheritedIn(site.tsym, types)) ||
+                !notOverriddenIn(site, sym)) {
             return bestSoFar;
         } else if (useVarargs && (sym.flags() & VARARGS) == 0) {
             return bestSoFar.kind.isResolutionError() ?
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Sat Dec 02 06:51:10 2017 +0100
@@ -36,10 +36,12 @@
 import com.sun.tools.javac.tree.DCTree;
 import com.sun.tools.javac.tree.DCTree.DCAttribute;
 import com.sun.tools.javac.tree.DCTree.DCDocComment;
+import com.sun.tools.javac.tree.DCTree.DCEndElement;
 import com.sun.tools.javac.tree.DCTree.DCEndPosTree;
 import com.sun.tools.javac.tree.DCTree.DCErroneous;
 import com.sun.tools.javac.tree.DCTree.DCIdentifier;
 import com.sun.tools.javac.tree.DCTree.DCReference;
+import com.sun.tools.javac.tree.DCTree.DCStartElement;
 import com.sun.tools.javac.tree.DCTree.DCText;
 import com.sun.tools.javac.tree.DocTreeMaker;
 import com.sun.tools.javac.tree.JCTree;
@@ -50,6 +52,7 @@
 import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Position;
+import com.sun.tools.javac.util.StringUtils;
 
 import static com.sun.tools.javac.util.LayoutCharacters.*;
 
@@ -68,11 +71,14 @@
         }
     }
 
+    private enum Phase {PREAMBLE, BODY, POSTAMBLE};
+
     final ParserFactory fac;
     final DiagnosticSource diagSource;
     final Comment comment;
     final DocTreeMaker m;
     final Names names;
+    final boolean isFileContent;
 
     BreakIterator sentenceBreaker;
 
@@ -93,17 +99,23 @@
 
     Map<Name, TagParser> tagParsers;
 
-    public DocCommentParser(ParserFactory fac, DiagnosticSource diagSource, Comment comment) {
+    public DocCommentParser(ParserFactory fac, DiagnosticSource diagSource,
+                            Comment comment, boolean isFileContent) {
         this.fac = fac;
         this.diagSource = diagSource;
         this.comment = comment;
         names = fac.names;
+        this.isFileContent = isFileContent;
         m = fac.docTreeMaker;
         initTagParsers();
     }
 
+    public DocCommentParser(ParserFactory fac, DiagnosticSource diagSource, Comment comment) {
+        this(fac, diagSource, comment, false);
+    }
+
     public DocCommentParser(ParserFactory fac) {
-        this(fac, null, null);
+        this(fac, null, null, false);
     }
 
     public DCDocComment parse() {
@@ -115,13 +127,22 @@
         bp = -1;
         nextChar();
 
-        List<DCTree> body = blockContent();
+        List<DCTree> preamble = isFileContent ? blockContent(Phase.PREAMBLE) : List.nil();
+        List<DCTree> body = blockContent(Phase.BODY);
         List<DCTree> tags = blockTags();
-        int pos = !body.isEmpty()
-                ? body.head.pos
-                : !tags.isEmpty() ? tags.head.pos : Position.NOPOS;
+        List<DCTree> postamble = isFileContent ? blockContent(Phase.POSTAMBLE) : List.nil();
 
-        DCDocComment dc = m.at(pos).newDocCommentTree(comment, body, tags);
+        int pos = Position.NOPOS;
+        if (!preamble.isEmpty())
+            pos = preamble.head.pos;
+        else if (!body.isEmpty())
+            pos = body.head.pos;
+        else if (!tags.isEmpty())
+            pos = tags.head.pos;
+        else if (!postamble.isEmpty())
+            pos = postamble.head.pos;
+
+        DCDocComment dc = m.at(pos).newDocCommentTree(comment, body, tags, preamble, postamble);
         return dc;
     }
 
@@ -133,13 +154,17 @@
         }
     }
 
+    protected List<DCTree> blockContent() {
+        return blockContent(Phase.BODY);
+    }
+
     /**
      * Read block content, consisting of text, html and inline tags.
      * Terminated by the end of input, or the beginning of the next block tag:
      * i.e. @ as the first non-whitespace character on a line.
      */
     @SuppressWarnings("fallthrough")
-    protected List<DCTree> blockContent() {
+    protected List<DCTree> blockContent(Phase phase) {
         ListBuffer<DCTree> trees = new ListBuffer<>();
         textStart = -1;
 
@@ -160,8 +185,36 @@
 
                 case '<':
                     newline = false;
+                    if (isFileContent) {
+                        switch (phase) {
+                            case PREAMBLE:
+                                if (peek("body")) {
+                                    trees.add(html());
+                                    if (textStart == -1) {
+                                        textStart = bp;
+                                        lastNonWhite = -1;
+                                    }
+                                    // mark this as the start, for processing purposes
+                                    newline = true;
+                                    break loop;
+                                }
+                                break;
+                            case BODY:
+                                if (peek("/body")) {
+                                    addPendingText(trees, lastNonWhite);
+                                    break loop;
+                                }
+                                break;
+                            default:
+                                // fallthrough
+                        }
+                    }
                     addPendingText(trees, bp - 1);
                     trees.add(html());
+
+                    if (phase == Phase.PREAMBLE || phase == Phase.POSTAMBLE) {
+                        break; // Ignore newlines after html tags, in the meta content
+                    }
                     if (textStart == -1) {
                         textStart = bp;
                         lastNonWhite = -1;
@@ -734,11 +787,37 @@
         }
     }
 
+    boolean peek(String s) {
+        final int savedpos = bp;
+        try {
+            if (ch == '<')
+                nextChar();
+
+            if (ch == '/') {
+                if (s.charAt(0) != ch) {
+                    return false;
+                } else {
+                    s = s.substring(1, s.length());
+                    nextChar();
+                }
+            }
+
+            if (isIdentifierStart(ch)) {
+                Name name = readIdentifier();
+                return StringUtils.toLowerCase(name.toString()).equals(s);
+            }
+            return false;
+        } finally {
+            bp = savedpos;
+            ch = buf[bp];
+        }
+    }
+
     /**
      * Read the start or end of an HTML tag, or an HTML comment
      * {@literal <identifier attrs> } or {@literal </identifier> }
      */
-    protected DCTree html() {
+    private DCTree html() {
         int p = bp;
         nextChar();
         if (isIdentifierStart(ch)) {
@@ -790,6 +869,19 @@
                         nextChar();
                     }
                 }
+            } else if (isIdentifierStart(ch) && peek("doctype")) {
+                readIdentifier();
+                nextChar();
+                skipWhitespace();
+                int d = bp;
+                while (bp < buflen) {
+                    if (ch == '>') {
+                        int mark = bp;
+                        nextChar();
+                        return m.at(d).newDocTypeTree(newString(d, mark));
+                    }
+                    nextChar();
+                }
             }
         }
 
@@ -1316,4 +1408,5 @@
             tagParsers.put(names.fromString(p.getTreeKind().tagName), p);
 
     }
+
 }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1319,6 +1319,9 @@
                         break loop;
                     case DOT:
                         nextToken();
+                        if (token.kind == TokenKind.IDENTIFIER && typeArgs != null) {
+                            return illegal();
+                        }
                         int oldmode = mode;
                         mode &= ~NOPARAMS;
                         typeArgs = typeArgumentsOpt(EXPR);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Sat Dec 02 06:51:10 2017 +0100
@@ -1216,6 +1216,9 @@
 compiler.misc.local.cant.infer.null=\
     variable initializer is ''null''
 
+compiler.misc.local.cant.infer.void=\
+    variable initializer is ''void''
+
 compiler.misc.local.missing.init=\
     cannot use ''var'' on variable without initializer
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java	Sat Dec 02 06:51:10 2017 +0100
@@ -109,17 +109,23 @@
         public final List<DCTree> firstSentence;
         public final List<DCTree> body;
         public final List<DCTree> tags;
+        public final List<DCTree> preamble;
+        public final List<DCTree> postamble;
 
         public DCDocComment(Comment comment,
                             List<DCTree> fullBody,
                             List<DCTree> firstSentence,
                             List<DCTree> body,
-                            List<DCTree> tags) {
+                            List<DCTree> tags,
+                            List<DCTree> preamble,
+                            List<DCTree> postamble) {
             this.comment = comment;
             this.firstSentence = firstSentence;
             this.fullBody = fullBody;
             this.body = body;
             this.tags = tags;
+            this.preamble = preamble;
+            this.postamble = postamble;
         }
 
         @Override @DefinedBy(Api.COMPILER_TREE)
@@ -152,6 +158,15 @@
             return tags;
         }
 
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public List<? extends DocTree> getPreamble() {
+            return preamble;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public List<? extends DocTree> getPostamble() {
+            return postamble;
+        }
     }
 
     public static abstract class DCBlockTag extends DCTree implements BlockTagTree {
@@ -288,6 +303,29 @@
         }
     }
 
+    public static class DCDocType extends DCTree implements DocTypeTree {
+        public final String text;
+
+        DCDocType(String text) {
+            this.text = text;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public Kind getKind() {
+            return Kind.DOC_TYPE;
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
+            return v.visitDocType(this, d);
+        }
+
+        @Override @DefinedBy(Api.COMPILER_TREE)
+        public String getText() {
+            return text;
+        }
+    }
+
     public static class DCEndElement extends DCTree implements EndElementTree {
         public final Name name;
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java	Sat Dec 02 06:51:10 2017 +0100
@@ -225,6 +225,16 @@
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
+    public Void visitDocType(DocTypeTree node, Void p) {
+        try {
+            print(node.getText());
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+        return null;
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public Void visitEndElement(EndElementTree node, Void p) {
         try {
             print("</");
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Sat Dec 02 06:51:10 2017 +0100
@@ -28,6 +28,7 @@
 import java.text.BreakIterator;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.ListIterator;
@@ -37,6 +38,7 @@
 import javax.tools.JavaFileObject;
 
 import com.sun.source.doctree.AttributeTree.ValueKind;
+import com.sun.source.doctree.DocCommentTree;
 import com.sun.source.doctree.DocTree;
 import com.sun.source.doctree.DocTree.Kind;
 import com.sun.source.doctree.EndElementTree;
@@ -59,6 +61,7 @@
 import com.sun.tools.javac.tree.DCTree.DCDeprecated;
 import com.sun.tools.javac.tree.DCTree.DCDocComment;
 import com.sun.tools.javac.tree.DCTree.DCDocRoot;
+import com.sun.tools.javac.tree.DCTree.DCDocType;
 import com.sun.tools.javac.tree.DCTree.DCEndElement;
 import com.sun.tools.javac.tree.DCTree.DCEntity;
 import com.sun.tools.javac.tree.DCTree.DCErroneous;
@@ -195,9 +198,23 @@
         return tree;
     }
 
-    public DCDocComment newDocCommentTree(Comment comment, List<? extends DocTree> fullBody, List<? extends DocTree> tags) {
+    @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCDocComment newDocCommentTree(List<? extends DocTree> fullBody, List<? extends DocTree> tags) {
         Pair<List<DCTree>, List<DCTree>> pair = splitBody(fullBody);
-        DCDocComment tree = new DCDocComment(comment, cast(fullBody), pair.fst, pair.snd, cast(tags));
+        List<DCTree> preamble = Collections.emptyList();
+        List<DCTree> postamble = Collections.emptyList();
+
+        return newDocCommentTree(fullBody, tags, preamble, postamble);
+    }
+
+    public DCDocComment newDocCommentTree(Comment comment,
+                                          List<? extends DocTree> fullBody,
+                                          List<? extends DocTree> tags,
+                                          List<? extends DocTree> preamble,
+                                          List<? extends DocTree> postamble) {
+        Pair<List<DCTree>, List<DCTree>> pair = splitBody(fullBody);
+        DCDocComment tree = new DCDocComment(comment, cast(fullBody), pair.fst, pair.snd,
+                cast(tags), cast(preamble), cast(postamble));
         tree.pos = pos;
         return tree;
     }
@@ -208,7 +225,10 @@
      * where the trees are being synthesized by a tool.
      */
     @Override @DefinedBy(Api.COMPILER_TREE)
-    public DCDocComment newDocCommentTree(List<? extends DocTree> fullBody, List<? extends DocTree> tags) {
+    public DCDocComment newDocCommentTree(List<? extends DocTree> fullBody,
+                                          List<? extends DocTree> tags,
+                                          List<? extends DocTree> preamble,
+                                          List<? extends DocTree> postamble) {
         ListBuffer<DCTree> lb = new ListBuffer<>();
         lb.addAll(cast(fullBody));
         List<DCTree> fBody = lb.toList();
@@ -236,7 +256,8 @@
             }
         };
         Pair<List<DCTree>, List<DCTree>> pair = splitBody(fullBody);
-        DCDocComment tree = new DCDocComment(c, fBody, pair.fst, pair.snd, cast(tags));
+        DCDocComment tree = new DCDocComment(c, fBody, pair.fst, pair.snd, cast(tags),
+                                             cast(preamble), cast(postamble));
         return tree;
     }
 
@@ -248,6 +269,13 @@
     }
 
     @Override @DefinedBy(Api.COMPILER_TREE)
+    public DCDocType newDocTypeTree(String text) {
+        DCDocType tree = new DCDocType(text);
+        tree.pos = pos;
+        return tree;
+    }
+
+    @Override @DefinedBy(Api.COMPILER_TREE)
     public DCEndElement newEndElementTree(Name name) {
         DCEndElement tree = new DCEndElement(name);
         tree.pos = pos;
--- a/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocHelper.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocHelper.java	Sat Dec 02 06:51:10 2017 +0100
@@ -61,6 +61,7 @@
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
+import javax.tools.JavaFileObject.Kind;
 import javax.tools.SimpleJavaFileObject;
 import javax.tools.StandardJavaFileManager;
 import javax.tools.StandardLocation;
@@ -214,7 +215,9 @@
                 }
             }
 
-            DocCommentTree docCommentTree = parseDocComment(task, docComment);
+            Pair<DocCommentTree, Integer> parsed = parseDocComment(task, docComment);
+            DocCommentTree docCommentTree = parsed.fst;
+            int offset = parsed.snd;
             IOException[] exception = new IOException[1];
             Map<int[], String> replace = new TreeMap<>((span1, span2) -> span2[0] - span1[0]);
 
@@ -349,7 +352,10 @@
                     if (inherited == null) {
                         return null;
                     }
-                    DocCommentTree inheritedDocTree = parseDocComment(inheritedJavacTask, inherited);
+                    Pair<DocCommentTree, Integer> parsed =
+                            parseDocComment(inheritedJavacTask, inherited);
+                    DocCommentTree inheritedDocTree = parsed.fst;
+                    int offset = parsed.snd;
                     List<List<? extends DocTree>> inheritedText = new ArrayList<>();
                     DocTree parent = interestingParent.peek();
                     switch (parent.getKind()) {
@@ -391,7 +397,6 @@
                             break;
                     }
                     if (!inheritedText.isEmpty()) {
-                        long offset = trees.getSourcePositions().getStartPosition(null, inheritedDocTree, inheritedDocTree);
                         long start = Long.MAX_VALUE;
                         long end = Long.MIN_VALUE;
 
@@ -475,7 +480,6 @@
                 return docComment;
 
             StringBuilder replacedInheritDoc = new StringBuilder(docComment);
-            int offset = (int) trees.getSourcePositions().getStartPosition(null, docCommentTree, docCommentTree);
 
             for (Entry<int[], String> e : replace.entrySet()) {
                 replacedInheritDoc.delete(e.getKey()[0] - offset, e.getKey()[1] - offset + 1);
@@ -507,22 +511,28 @@
             }
 
          private DocTree parseBlockTag(JavacTask task, String blockTag) {
-            DocCommentTree dc = parseDocComment(task, blockTag);
+            DocCommentTree dc = parseDocComment(task, blockTag).fst;
 
             return dc.getBlockTags().get(0);
         }
 
-        private DocCommentTree parseDocComment(JavacTask task, String javadoc) {
+        private Pair<DocCommentTree, Integer> parseDocComment(JavacTask task, String javadoc) {
             DocTrees trees = DocTrees.instance(task);
             try {
-                return trees.getDocCommentTree(new SimpleJavaFileObject(new URI("mem://doc.html"), javax.tools.JavaFileObject.Kind.HTML) {
+                SimpleJavaFileObject fo =
+                        new SimpleJavaFileObject(new URI("mem://doc.html"), Kind.HTML) {
                     @Override @DefinedBy(Api.COMPILER)
-                    public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+                    public CharSequence getCharContent(boolean ignoreEncodingErrors)
+                            throws IOException {
                         return "<body>" + javadoc + "</body>";
                     }
-                });
+                };
+                DocCommentTree tree = trees.getDocCommentTree(fo);
+                int offset = (int) trees.getSourcePositions().getStartPosition(null, tree, tree);
+                offset += "<body>".length() + 1;
+                return Pair.of(tree, offset);
             } catch (URISyntaxException ex) {
-                return null;
+                throw new IllegalStateException(ex);
             }
         }
 
--- a/src/jdk.dynalink/share/classes/jdk/dynalink/beans/BeanLinker.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.dynalink/share/classes/jdk/dynalink/beans/BeanLinker.java	Sat Dec 02 06:51:10 2017 +0100
@@ -91,6 +91,7 @@
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.function.Function;
 import jdk.dynalink.CallSiteDescriptor;
 import jdk.dynalink.Namespace;
 import jdk.dynalink.Operation;
@@ -189,85 +190,126 @@
         assertParameterCount(callSiteDescriptor, isFixedKey ? 1 : 2);
         final LinkerServices linkerServices = req.linkerServices;
         final MethodType callSiteType = callSiteDescriptor.getMethodType();
-        final Class<?> declaredType = callSiteType.parameterType(0);
         final GuardedInvocationComponent nextComponent = getNextComponent(req);
 
+        final GuardedInvocationComponentAndCollectionType gicact = guardedInvocationComponentAndCollectionType(
+                callSiteType, linkerServices, MethodHandles::arrayElementGetter, GET_LIST_ELEMENT, GET_MAP_ELEMENT);
+
+        if (gicact == null) {
+            // Can't retrieve elements for objects that are neither arrays, nor list, nor maps.
+            return nextComponent;
+        }
+
+        final Object typedName = getTypedName(name, gicact.collectionType == CollectionType.MAP, linkerServices);
+        if (typedName == INVALID_NAME) {
+            return nextComponent;
+        }
+
+        return guardComponentWithRangeCheck(gicact, linkerServices,
+                callSiteDescriptor, nextComponent, new Binder(linkerServices, callSiteType, typedName),
+                isFixedKey ? NULL_GETTER_1 : NULL_GETTER_2);
+    }
+
+    private static class GuardedInvocationComponentAndCollectionType {
+        final GuardedInvocationComponent gic;
+        final CollectionType collectionType;
+
+        GuardedInvocationComponentAndCollectionType(final GuardedInvocationComponent gic, final CollectionType collectionType) {
+            this.gic = gic;
+            this.collectionType = collectionType;
+        }
+    }
+
+    private GuardedInvocationComponentAndCollectionType guardedInvocationComponentAndCollectionType(
+            final MethodType callSiteType, final LinkerServices linkerServices,
+            final Function<Class<?>, MethodHandle> arrayMethod, final MethodHandle listMethod, final MethodHandle mapMethod) {
+        final Class<?> declaredType = callSiteType.parameterType(0);
         // If declared type of receiver at the call site is already an array, a list or map, bind without guard. Thing
         // is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance they're
         // dealing with an array, or a list or map, but hey...
         // Note that for arrays and lists, using LinkerServices.asType() will ensure that any language specific linkers
         // in use will get a chance to perform any (if there's any) implicit conversion to integer for the indices.
-        final GuardedInvocationComponent gic;
-        final CollectionType collectionType;
         if(declaredType.isArray()) {
-            gic = createInternalFilteredGuardedInvocationComponent(MethodHandles.arrayElementGetter(declaredType), linkerServices);
-            collectionType = CollectionType.ARRAY;
+            return new GuardedInvocationComponentAndCollectionType(
+                    createInternalFilteredGuardedInvocationComponent(arrayMethod.apply(declaredType), linkerServices),
+                    CollectionType.ARRAY);
         } else if(List.class.isAssignableFrom(declaredType)) {
-            gic = createInternalFilteredGuardedInvocationComponent(GET_LIST_ELEMENT, linkerServices);
-            collectionType = CollectionType.LIST;
+            return new GuardedInvocationComponentAndCollectionType(
+                    createInternalFilteredGuardedInvocationComponent(listMethod, linkerServices),
+                    CollectionType.LIST);
         } else if(Map.class.isAssignableFrom(declaredType)) {
-            gic = createInternalFilteredGuardedInvocationComponent(GET_MAP_ELEMENT, linkerServices);
-            collectionType = CollectionType.MAP;
+            return new GuardedInvocationComponentAndCollectionType(
+                    createInternalFilteredGuardedInvocationComponent(mapMethod, linkerServices),
+                    CollectionType.MAP);
         } else if(clazz.isArray()) {
-            gic = getClassGuardedInvocationComponent(linkerServices.filterInternalObjects(MethodHandles.arrayElementGetter(clazz)), callSiteType);
-            collectionType = CollectionType.ARRAY;
+            return new GuardedInvocationComponentAndCollectionType(
+                    getClassGuardedInvocationComponent(linkerServices.filterInternalObjects(arrayMethod.apply(clazz)), callSiteType),
+                    CollectionType.ARRAY);
         } else if(List.class.isAssignableFrom(clazz)) {
-            gic = createInternalFilteredGuardedInvocationComponent(GET_LIST_ELEMENT, Guards.asType(LIST_GUARD, callSiteType), List.class, ValidationType.INSTANCE_OF,
-                    linkerServices);
-            collectionType = CollectionType.LIST;
+            return new GuardedInvocationComponentAndCollectionType(
+                    createInternalFilteredGuardedInvocationComponent(listMethod, Guards.asType(LIST_GUARD, callSiteType),
+                            List.class, ValidationType.INSTANCE_OF, linkerServices),
+                    CollectionType.LIST);
         } else if(Map.class.isAssignableFrom(clazz)) {
-            gic = createInternalFilteredGuardedInvocationComponent(GET_MAP_ELEMENT, Guards.asType(MAP_GUARD, callSiteType), Map.class, ValidationType.INSTANCE_OF,
-                    linkerServices);
-            collectionType = CollectionType.MAP;
-        } else {
-            // Can't retrieve elements for objects that are neither arrays, nor list, nor maps.
-            return nextComponent;
+            return new GuardedInvocationComponentAndCollectionType(
+                    createInternalFilteredGuardedInvocationComponent(mapMethod, Guards.asType(MAP_GUARD, callSiteType),
+                            Map.class, ValidationType.INSTANCE_OF, linkerServices),
+                    CollectionType.MAP);
         }
+        return null;
+    }
 
+    private static final Object INVALID_NAME = new Object();
+
+    private static Object getTypedName(final Object name, final boolean isMap, final LinkerServices linkerServices) throws Exception {
         // Convert the key to a number if we're working with a list or array
-        final Object typedName;
-        if (collectionType != CollectionType.MAP && isFixedKey) {
+        if (!isMap && name != null) {
             final Integer integer = convertKeyToInteger(name, linkerServices);
             if (integer == null || integer.intValue() < 0) {
                 // key is not a non-negative integer, it can never address an
                 // array or list element
-                return nextComponent;
+                return INVALID_NAME;
             }
-            typedName = integer;
-        } else {
-            typedName = name;
+            return integer;
         }
+        return name;
+    }
 
-        final GuardedInvocation gi = gic.getGuardedInvocation();
-        final Binder binder = new Binder(linkerServices, callSiteType, typedName);
-        final MethodHandle invocation = gi.getInvocation();
+    private static GuardedInvocationComponent guardComponentWithRangeCheck(
+            final GuardedInvocationComponentAndCollectionType gicact, final LinkerServices linkerServices,
+            final CallSiteDescriptor callSiteDescriptor, final GuardedInvocationComponent nextComponent, final Binder binder,
+            final MethodHandle noOp) {
+        final MethodType callSiteType = callSiteDescriptor.getMethodType();
 
         final MethodHandle checkGuard;
-        switch(collectionType) {
-        case LIST:
-            checkGuard = convertArgToNumber(RANGE_CHECK_LIST, linkerServices, callSiteDescriptor);
-            break;
-        case MAP:
-            checkGuard = linkerServices.filterInternalObjects(CONTAINS_MAP);
-            break;
-        case ARRAY:
-            checkGuard = convertArgToNumber(RANGE_CHECK_ARRAY, linkerServices, callSiteDescriptor);
-            break;
-        default:
-            throw new AssertionError();
+        switch(gicact.collectionType) {
+            case LIST:
+                checkGuard = convertArgToNumber(RANGE_CHECK_LIST, linkerServices, callSiteDescriptor);
+                break;
+            case MAP:
+                checkGuard = linkerServices.filterInternalObjects(CONTAINS_MAP);
+                break;
+            case ARRAY:
+                checkGuard = convertArgToNumber(RANGE_CHECK_ARRAY, linkerServices, callSiteDescriptor);
+                break;
+            default:
+                throw new AssertionError();
         }
 
-        // If there's no next component, produce a fixed null-returning one
+        // If there's no next component, produce a fixed no-op one
         final GuardedInvocationComponent finalNextComponent;
         if (nextComponent != null) {
             finalNextComponent = nextComponent;
         } else {
-            final MethodHandle nullGetterHandle = isFixedKey ? NULL_GETTER_1 : NULL_GETTER_2;
-            finalNextComponent = createGuardedInvocationComponentAsType(nullGetterHandle, callSiteType, linkerServices);
+            finalNextComponent = createGuardedInvocationComponentAsType(noOp, callSiteType, linkerServices);
         }
 
-        final MethodPair matchedInvocations = matchReturnTypes(binder.bind(invocation),
+        final GuardedInvocationComponent gic = gicact.gic;
+        final GuardedInvocation gi = gic.getGuardedInvocation();
+
+        final MethodPair matchedInvocations = matchReturnTypes(binder.bind(gi.getInvocation()),
                 finalNextComponent.getGuardedInvocation().getInvocation());
+
         return finalNextComponent.compose(matchedInvocations.guardWithTest(binder.bindTest(checkGuard)), gi.getGuard(),
                 gic.getValidatorClass(), gic.getValidationType());
     }
@@ -435,90 +477,37 @@
         assertParameterCount(callSiteDescriptor, isFixedKey ? 2 : 3);
         final LinkerServices linkerServices = req.linkerServices;
         final MethodType callSiteType = callSiteDescriptor.getMethodType();
-        final Class<?> declaredType = callSiteType.parameterType(0);
+
+        final GuardedInvocationComponentAndCollectionType gicact = guardedInvocationComponentAndCollectionType(
+                callSiteType, linkerServices, MethodHandles::arrayElementSetter, SET_LIST_ELEMENT, PUT_MAP_ELEMENT);
 
-        final GuardedInvocationComponent gic;
-        // If declared type of receiver at the call site is already an array, a list or map, bind without guard. Thing
-        // is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance they're
-        // dealing with an array, or a list or map, but hey...
-        // Note that for arrays and lists, using LinkerServices.asType() will ensure that any language specific linkers
-        // in use will get a chance to perform any (if there's any) implicit conversion to integer for the indices.
-        final CollectionType collectionType;
-        if(declaredType.isArray()) {
-            gic = createInternalFilteredGuardedInvocationComponent(MethodHandles.arrayElementSetter(declaredType), linkerServices);
-            collectionType = CollectionType.ARRAY;
-        } else if(List.class.isAssignableFrom(declaredType)) {
-            gic = createInternalFilteredGuardedInvocationComponent(SET_LIST_ELEMENT, linkerServices);
-            collectionType = CollectionType.LIST;
-        } else if(Map.class.isAssignableFrom(declaredType)) {
-            gic = createInternalFilteredGuardedInvocationComponent(PUT_MAP_ELEMENT, linkerServices);
-            collectionType = CollectionType.MAP;
-        } else if(clazz.isArray()) {
-            gic = getClassGuardedInvocationComponent(linkerServices.filterInternalObjects(
-                    MethodHandles.arrayElementSetter(clazz)), callSiteType);
-            collectionType = CollectionType.ARRAY;
-        } else if(List.class.isAssignableFrom(clazz)) {
-            gic = createInternalFilteredGuardedInvocationComponent(SET_LIST_ELEMENT, Guards.asType(LIST_GUARD, callSiteType), List.class, ValidationType.INSTANCE_OF,
-                    linkerServices);
-            collectionType = CollectionType.LIST;
-        } else if(Map.class.isAssignableFrom(clazz)) {
-            gic = createInternalFilteredGuardedInvocationComponent(PUT_MAP_ELEMENT, Guards.asType(MAP_GUARD, callSiteType),
-                    Map.class, ValidationType.INSTANCE_OF, linkerServices);
-            collectionType = CollectionType.MAP;
-        } else {
-            // Can't set elements for objects that are neither arrays, nor list, nor maps.
-            gic = null;
-            collectionType = null;
+        if(gicact == null) {
+            return getNextComponent(req);
         }
 
+        final boolean isMap = gicact.collectionType == CollectionType.MAP;
+
         // In contrast to, say, getElementGetter, we only compute the nextComponent if the target object is not a map,
         // as maps will always succeed in setting the element and will never need to fall back to the next component
         // operation.
-        final GuardedInvocationComponent nextComponent = collectionType == CollectionType.MAP ? null : getNextComponent(req);
-        if(gic == null) {
+        final GuardedInvocationComponent nextComponent = isMap ? null : getNextComponent(req);
+
+        final Object typedName = getTypedName(name, isMap, linkerServices);
+        if (typedName == INVALID_NAME) {
             return nextComponent;
         }
 
-        // Convert the key to a number if we're working with a list or array
-        final Object typedName;
-        if (collectionType != CollectionType.MAP && isFixedKey) {
-            final Integer integer = convertKeyToInteger(name, linkerServices);
-            if (integer == null || integer.intValue() < 0) {
-                // key is not a non-negative integer, it can never address an
-                // array or list element
-                return nextComponent;
-            }
-            typedName = integer;
-        } else {
-            typedName = name;
-        }
-
+        final GuardedInvocationComponent gic = gicact.gic;
         final GuardedInvocation gi = gic.getGuardedInvocation();
         final Binder binder = new Binder(linkerServices, callSiteType, typedName);
         final MethodHandle invocation = gi.getInvocation();
 
-        if (collectionType == CollectionType.MAP) {
-            assert nextComponent == null;
+        if (isMap) {
             return gic.replaceInvocation(binder.bind(invocation));
         }
 
-        assert collectionType == CollectionType.LIST || collectionType == CollectionType.ARRAY;
-        final MethodHandle checkGuard = convertArgToNumber(collectionType == CollectionType.LIST ? RANGE_CHECK_LIST :
-            RANGE_CHECK_ARRAY, linkerServices, callSiteDescriptor);
-
-        // If there's no next component, produce a no-op one.
-        final GuardedInvocationComponent finalNextComponent;
-        if (nextComponent != null) {
-            finalNextComponent = nextComponent;
-        } else {
-            final MethodHandle noOpSetterHandle = isFixedKey ? NO_OP_SETTER_2 : NO_OP_SETTER_3;
-            finalNextComponent = createGuardedInvocationComponentAsType(noOpSetterHandle, callSiteType, linkerServices);
-        }
-
-        final MethodPair matchedInvocations = matchReturnTypes(binder.bind(invocation),
-                finalNextComponent.getGuardedInvocation().getInvocation());
-        return finalNextComponent.compose(matchedInvocations.guardWithTest(binder.bindTest(checkGuard)), gi.getGuard(),
-                gic.getValidatorClass(), gic.getValidationType());
+        return guardComponentWithRangeCheck(gicact, linkerServices, callSiteDescriptor,
+                nextComponent, binder, isFixedKey ? NO_OP_SETTER_2 : NO_OP_SETTER_3);
     }
 
     private static final MethodHandle GET_COLLECTION_LENGTH = Lookup.PUBLIC.findVirtual(Collection.class, "size",
--- a/src/jdk.jartool/share/classes/sun/tools/jar/FingerPrint.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.jartool/share/classes/sun/tools/jar/FingerPrint.java	Sat Dec 02 06:51:10 2017 +0100
@@ -43,7 +43,7 @@
  * a class, it also contains information to (1) describe the public API;
  * (2) compare the public API of this class with another class;  (3) determine
  * whether or not it's a nested class and, if so, the name of the associated
- * top level class; and (4) for an canonically ordered set of classes determine
+ * outer class; and (4) for an canonically ordered set of classes determine
  * if the class versions are compatible.  A set of classes is canonically
  * ordered if the classes in the set have the same name, and the base class
  * precedes the versioned classes and if each versioned class with version
@@ -53,10 +53,13 @@
 final class FingerPrint {
     private static final MessageDigest MD;
 
+    private final String basename;
+    private final String entryName;
+    private final int mrversion;
+
     private final byte[] sha1;
     private final ClassAttributes attrs;
     private final boolean isClassEntry;
-    private final String entryName;
 
     static {
         try {
@@ -67,16 +70,19 @@
         }
     }
 
-    public FingerPrint(String entryName,byte[] bytes) throws IOException {
+    public FingerPrint(String basename, String entryName, int mrversion, byte[] bytes)
+            throws IOException {
+        this.basename = basename;
         this.entryName = entryName;
-        if (entryName.endsWith(".class") && isCafeBabe(bytes)) {
+        this.mrversion = mrversion;
+        if (isCafeBabe(bytes)) {
             isClassEntry = true;
             sha1 = sha1(bytes, 8);  // skip magic number and major/minor version
             attrs = getClassAttributes(bytes);
         } else {
             isClassEntry = false;
-            sha1 = sha1(bytes);
-            attrs = new ClassAttributes();   // empty class
+            sha1 = null;
+            attrs = null;
         }
     }
 
@@ -107,14 +113,24 @@
         return attrs.equals(that.attrs);
     }
 
-    public String name() {
-        String name = attrs.name;
-        return name == null ? entryName : name;
+    public String basename() {
+        return basename;
+    }
+
+    public String entryName() {
+        return entryName;
     }
 
-    public String topLevelName() {
-        String name = attrs.topLevelName;
-        return name == null ? name() : name;
+    public String className() {
+        return attrs.name;
+    }
+
+    public int mrversion() {
+        return mrversion;
+    }
+
+    public String outerClassName() {
+        return attrs.outerClassName;
     }
 
     private byte[] sha1(byte[] entry) {
@@ -218,7 +234,7 @@
 
     private static final class ClassAttributes extends ClassVisitor {
         private String name;
-        private String topLevelName;
+        private String outerClassName;
         private String superName;
         private int version;
         private int access;
@@ -228,7 +244,7 @@
         private final Set<Method> methods = new HashSet<>();
 
         public ClassAttributes() {
-            super(Opcodes.ASM5);
+            super(Opcodes.ASM6);
         }
 
         private boolean isPublic(int access) {
@@ -250,7 +266,7 @@
         @Override
         public void visitOuterClass(String owner, String name, String desc) {
             if (!this.nestedClass) return;
-            this.topLevelName = owner;
+            this.outerClassName = owner;
         }
 
         @Override
@@ -259,7 +275,7 @@
             if (!this.nestedClass) return;
             if (outerName == null) return;
             if (!this.name.equals(name)) return;
-            if (this.topLevelName == null) this.topLevelName = outerName;
+            if (this.outerClassName == null) this.outerClassName = outerName;
         }
 
         @Override
@@ -294,7 +310,7 @@
 
         @Override
         public void visitEnd() {
-            this.nestedClass = this.topLevelName != null;
+            this.nestedClass = this.outerClassName != null;
         }
 
         @Override
--- a/src/jdk.jartool/share/classes/sun/tools/jar/Main.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.jartool/share/classes/sun/tools/jar/Main.java	Sat Dec 02 06:51:10 2017 +0100
@@ -71,7 +71,6 @@
 import static java.util.jar.JarFile.MANIFEST_NAME;
 import static java.util.stream.Collectors.joining;
 import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
-import static sun.tools.jar.Validator.ENTRYNAME_COMPARATOR;
 
 /**
  * This class implements a simple utility for creating files in the JAR
@@ -444,8 +443,8 @@
 
     private void validateAndClose(File tmpfile) throws IOException {
         if (ok && isMultiRelease) {
-            try (JarFile jf = new JarFile(tmpfile)) {
-                ok = Validator.validate(this, jf);
+            try (ZipFile zf = new ZipFile(tmpfile)) {
+                ok = Validator.validate(this, zf);
                 if (!ok) {
                     error(formatMsg("error.validator.jarfile.invalid", fname));
                 }
@@ -1784,7 +1783,7 @@
     private boolean describeModule(ZipFile zipFile) throws IOException {
         ZipFileModuleInfoEntry[] infos = zipFile.stream()
                 .filter(e -> isModuleInfoEntry(e.getName()))
-                .sorted(Validator.ENTRY_COMPARATOR)
+                .sorted(ENTRY_COMPARATOR)
                 .map(e -> new ZipFileModuleInfoEntry(zipFile, e))
                 .toArray(ZipFileModuleInfoEntry[]::new);
 
@@ -2216,4 +2215,48 @@
             return hashesBuilder.computeHashes(Set.of(name)).get(name);
         }
     }
+
+    // sort base entries before versioned entries, and sort entry classes with
+    // nested classes so that the outter class appears before the associated
+    // nested class
+    static Comparator<String> ENTRYNAME_COMPARATOR = (s1, s2) ->  {
+
+        if (s1.equals(s2)) return 0;
+        boolean b1 = s1.startsWith(VERSIONS_DIR);
+        boolean b2 = s2.startsWith(VERSIONS_DIR);
+        if (b1 && !b2) return 1;
+        if (!b1 && b2) return -1;
+        int n = 0; // starting char for String compare
+        if (b1 && b2) {
+            // normally strings would be sorted so "10" goes before "9", but
+            // version number strings need to be sorted numerically
+            n = VERSIONS_DIR.length();   // skip the common prefix
+            int i1 = s1.indexOf('/', n);
+            int i2 = s2.indexOf('/', n);
+            if (i1 == -1) throw new Validator.InvalidJarException(s1);
+            if (i2 == -1) throw new Validator.InvalidJarException(s2);
+            // shorter version numbers go first
+            if (i1 != i2) return i1 - i2;
+            // otherwise, handle equal length numbers below
+        }
+        int l1 = s1.length();
+        int l2 = s2.length();
+        int lim = Math.min(l1, l2);
+        for (int k = n; k < lim; k++) {
+            char c1 = s1.charAt(k);
+            char c2 = s2.charAt(k);
+            if (c1 != c2) {
+                // change natural ordering so '.' comes before '$'
+                // i.e. outer classes come before nested classes
+                if (c1 == '$' && c2 == '.') return 1;
+                if (c1 == '.' && c2 == '$') return -1;
+                return c1 - c2;
+            }
+        }
+        return l1 - l2;
+    };
+
+    static Comparator<ZipEntry> ENTRY_COMPARATOR =
+        Comparator.comparing(ZipEntry::getName, ENTRYNAME_COMPARATOR);
+
 }
--- a/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java	Sat Dec 02 06:51:10 2017 +0100
@@ -28,24 +28,22 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.lang.module.InvalidModuleDescriptorException;
 import java.lang.module.ModuleDescriptor;
 import java.lang.module.ModuleDescriptor.Exports;
-import java.lang.module.InvalidModuleDescriptorException;
 import java.lang.module.ModuleDescriptor.Opens;
 import java.lang.module.ModuleDescriptor.Provides;
 import java.lang.module.ModuleDescriptor.Requires;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.function.Consumer;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
+import java.util.TreeMap;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
 
 import static java.util.jar.JarFile.MANIFEST_NAME;
 import static sun.tools.jar.Main.VERSIONS_DIR;
@@ -55,269 +53,176 @@
 import static sun.tools.jar.Main.formatMsg;
 import static sun.tools.jar.Main.formatMsg2;
 import static sun.tools.jar.Main.toBinaryName;
-import static sun.tools.jar.Main.isModuleInfoEntry;
 
 final class Validator {
-    private final static boolean DEBUG = Boolean.getBoolean("jar.debug");
-    private final  Map<String,FingerPrint> fps = new HashMap<>();
+
+    private final Map<String,FingerPrint> classes = new HashMap<>();
     private final Main main;
-    private final JarFile jf;
-    private int oldVersion = -1;
-    private String currentTopLevelName;
+    private final ZipFile zf;
     private boolean isValid = true;
     private Set<String> concealedPkgs = Collections.emptySet();
     private ModuleDescriptor md;
     private String mdName;
 
-    private Validator(Main main, JarFile jf) {
+    private Validator(Main main, ZipFile zf) {
         this.main = main;
-        this.jf = jf;
+        this.zf = zf;
         checkModuleDescriptor(MODULE_INFO);
     }
 
-    static boolean validate(Main main, JarFile jf) throws IOException {
-        return new Validator(main, jf).validate();
+    static boolean validate(Main main, ZipFile zf) throws IOException {
+        return new Validator(main, zf).validate();
     }
 
     private boolean validate() {
         try {
-            jf.stream()
-              .filter(e -> !e.isDirectory() &&
-                      !e.getName().equals(MANIFEST_NAME))
-              .sorted(ENTRY_COMPARATOR)
-              .forEachOrdered(e -> validate(e));
-            return isValid;
+            zf.stream()
+              .filter(e -> e.getName().endsWith(".class"))
+              .map(this::getFingerPrint)
+              .filter(FingerPrint::isClass)    // skip any non-class entry
+              .collect(Collectors.groupingBy(
+                      FingerPrint::mrversion,
+                      TreeMap::new,
+                      Collectors.toMap(FingerPrint::className,
+                                       Function.identity(),
+                                       this::sameNameFingerPrint)))
+              .forEach((version, entries) -> {
+                      if (version == 0)
+                          validateBase(entries);
+                      else
+                          validateVersioned(entries);
+                  });
         } catch (InvalidJarException e) {
-            error(formatMsg("error.validator.bad.entry.name", e.getMessage()));
+            errorAndInvalid(e.getMessage());
         }
-        return false;
+        return isValid;
     }
 
-    private static class InvalidJarException extends RuntimeException {
+    static class InvalidJarException extends RuntimeException {
         private static final long serialVersionUID = -3642329147299217726L;
         InvalidJarException(String msg) {
             super(msg);
         }
     }
 
-    // sort base entries before versioned entries, and sort entry classes with
-    // nested classes so that the top level class appears before the associated
-    // nested class
-    static Comparator<String> ENTRYNAME_COMPARATOR = (s1, s2) ->  {
+    private FingerPrint sameNameFingerPrint(FingerPrint fp1, FingerPrint fp2) {
+        checkClassName(fp1);
+        checkClassName(fp2);
+        // entries/classes with same name, return fp2 for now ?
+        return fp2;
+    }
+
+    private FingerPrint getFingerPrint(ZipEntry ze) {
+        // figure out the version and basename from the ZipEntry
+        String ename = ze.getName();
+        String bname = ename;
+        int version = 0;
 
-        if (s1.equals(s2)) return 0;
-        boolean b1 = s1.startsWith(VERSIONS_DIR);
-        boolean b2 = s2.startsWith(VERSIONS_DIR);
-        if (b1 && !b2) return 1;
-        if (!b1 && b2) return -1;
-        int n = 0; // starting char for String compare
-        if (b1 && b2) {
-            // normally strings would be sorted so "10" goes before "9", but
-            // version number strings need to be sorted numerically
-            n = VERSIONS_DIR.length();   // skip the common prefix
-            int i1 = s1.indexOf('/', n);
-            int i2 = s2.indexOf('/', n);
-            if (i1 == -1) throw new InvalidJarException(s1);
-            if (i2 == -1) throw new InvalidJarException(s2);
-            // shorter version numbers go first
-            if (i1 != i2) return i1 - i2;
-            // otherwise, handle equal length numbers below
+        if (ename.startsWith(VERSIONS_DIR)) {
+            int n = ename.indexOf("/", VERSIONS_DIR_LENGTH);
+            if (n == -1) {
+                throw new InvalidJarException(
+                    formatMsg("error.validator.version.notnumber", ename));
+            }
+            try {
+                version = Integer.parseInt(ename, VERSIONS_DIR_LENGTH, n, 10);
+            } catch (NumberFormatException x) {
+                throw new InvalidJarException(
+                    formatMsg("error.validator.version.notnumber", ename));
+            }
+            if (n == ename.length()) {
+                throw new InvalidJarException(
+                    formatMsg("error.validator.entryname.tooshort", ename));
+            }
+            bname = ename.substring(n + 1);
         }
-        int l1 = s1.length();
-        int l2 = s2.length();
-        int lim = Math.min(l1, l2);
-        for (int k = n; k < lim; k++) {
-            char c1 = s1.charAt(k);
-            char c2 = s2.charAt(k);
-            if (c1 != c2) {
-                // change natural ordering so '.' comes before '$'
-                // i.e. top level classes come before nested classes
-                if (c1 == '$' && c2 == '.') return 1;
-                if (c1 == '.' && c2 == '$') return -1;
-                return c1 - c2;
-            }
+
+        // return the cooresponding fingerprint entry
+        try (InputStream is = zf.getInputStream(ze)) {
+            return new FingerPrint(bname, ename, version, is.readAllBytes());
+        } catch (IOException x) {
+           throw new InvalidJarException(x.getMessage());
         }
-        return l1 - l2;
-    };
-
-    static Comparator<ZipEntry> ENTRY_COMPARATOR =
-        Comparator.comparing(ZipEntry::getName, ENTRYNAME_COMPARATOR);
+    }
 
     /*
-     *  Validator has state and assumes entries provided to accept are ordered
-     *  from base entries first and then through the versioned entries in
-     *  ascending version order.  Also, to find isolated nested classes,
-     *  classes must be ordered so that the top level class is before the associated
-     *  nested class(es).
-    */
-    public void validate(JarEntry je) {
-        String entryName = je.getName();
-
-        // directories are always accepted
-        if (entryName.endsWith("/")) {
-            debug("%s is a directory", entryName);
-            return;
-        }
-
-        // validate the versioned module-info
-        if (isModuleInfoEntry(entryName)) {
-            if (!entryName.equals(mdName))
-                checkModuleDescriptor(entryName);
-            return;
-        }
-
-        // figure out the version and basename from the JarEntry
-        int version;
-        String basename;
-        String versionStr = null;;
-        if (entryName.startsWith(VERSIONS_DIR)) {
-            int n = entryName.indexOf("/", VERSIONS_DIR_LENGTH);
-            if (n == -1) {
-                error(formatMsg("error.validator.version.notnumber", entryName));
-                isValid = false;
+     *  Validates (a) if there is any isolated nested class, and (b) if the
+     *  class name in class file (by asm) matches the entry's basename.
+     */
+    public void validateBase(Map<String, FingerPrint> fps) {
+        fps.values().forEach( fp -> {
+            if (!checkClassName(fp)) {
                 return;
             }
-            versionStr = entryName.substring(VERSIONS_DIR_LENGTH, n);
-            try {
-                version = Integer.parseInt(versionStr);
-            } catch (NumberFormatException x) {
-                error(formatMsg("error.validator.version.notnumber", entryName));
-                isValid = false;
-                return;
+            if (fp.isNestedClass()) {
+                checkNestedClass(fp, fps);
             }
-            if (n == entryName.length()) {
-                error(formatMsg("error.validator.entryname.tooshort", entryName));
-                isValid = false;
+            classes.put(fp.className(), fp);
+        });
+    }
+
+    public void validateVersioned(Map<String, FingerPrint> fps) {
+
+        fps.values().forEach( fp -> {
+
+            // validate the versioned module-info
+            if (MODULE_INFO.equals(fp.basename())) {
+                checkModuleDescriptor(fp.entryName());
                 return;
             }
-            basename = entryName.substring(n + 1);
-        } else {
-            version = 0;
-            basename = entryName;
-        }
-        debug("\n===================\nversion %d %s", version, entryName);
-
-        if (oldVersion != version) {
-            oldVersion = version;
-            currentTopLevelName = null;
-            if (md == null && versionStr != null) {
-                // don't have a base module-info.class yet, try to see if
-                // a versioned one exists
-                checkModuleDescriptor(VERSIONS_DIR + versionStr + "/" + MODULE_INFO);
-            }
-        }
-
-        // analyze the entry, keeping key attributes
-        FingerPrint fp;
-        try (InputStream is = jf.getInputStream(je)) {
-            fp = new FingerPrint(basename, is.readAllBytes());
-        } catch (IOException x) {
-            error(x.getMessage());
-            isValid = false;
-            return;
-        }
-        String internalName = fp.name();
-
-        // process a base entry paying attention to nested classes
-        if (version == 0) {
-            debug("base entry found");
-            if (fp.isNestedClass()) {
-                debug("nested class found");
-                if (fp.topLevelName().equals(currentTopLevelName)) {
-                    fps.put(internalName, fp);
-                    return;
-                }
-                error(formatMsg("error.validator.isolated.nested.class", entryName));
-                isValid = false;
-                return;
-            }
-            // top level class or resource entry
-            if (fp.isClass()) {
-                currentTopLevelName = fp.topLevelName();
-                if (!checkInternalName(entryName, basename, internalName)) {
-                    isValid = false;
-                    return;
-                }
-            }
-            fps.put(internalName, fp);
-            return;
-        }
-
-        // process a versioned entry, look for previous entry with same name
-        FingerPrint matchFp = fps.get(internalName);
-        debug("looking for match");
-        if (matchFp == null) {
-            debug("no match found");
-            if (fp.isClass()) {
+            // process a versioned entry, look for previous entry with same name
+            FingerPrint matchFp = classes.get(fp.className());
+            if (matchFp == null) {
+                // no match found
                 if (fp.isNestedClass()) {
-                    if (!checkNestedClass(version, entryName, internalName, fp)) {
-                        isValid = false;
-                    }
+                    checkNestedClass(fp, fps);
                     return;
                 }
                 if (fp.isPublicClass()) {
-                    if (!isConcealed(internalName)) {
-                        error(Main.formatMsg("error.validator.new.public.class", entryName));
-                        isValid = false;
+                    if (!isConcealed(fp.className())) {
+                        errorAndInvalid(formatMsg("error.validator.new.public.class",
+                                                  fp.entryName()));
                         return;
-                    }
-                    warn(formatMsg("warn.validator.concealed.public.class", entryName));
-                    debug("%s is a public class entry in a concealed package", entryName);
+                     }
+                     // entry is a public class entry in a concealed package
+                     warn(formatMsg("warn.validator.concealed.public.class",
+                                   fp.entryName()));
                 }
-                debug("%s is a non-public class entry", entryName);
-                fps.put(internalName, fp);
-                currentTopLevelName = fp.topLevelName();
+                classes.put(fp.className(), fp);
                 return;
             }
-            debug("%s is a resource entry");
-            fps.put(internalName, fp);
-            return;
-        }
-        debug("match found");
 
-        // are the two classes/resources identical?
-        if (fp.isIdentical(matchFp)) {
-            warn(formatMsg("warn.validator.identical.entry", entryName));
-            return;  // it's okay, just takes up room
-        }
-        debug("sha1 not equal -- different bytes");
+            // are the two classes/resources identical?
+            if (fp.isIdentical(matchFp)) {
+                warn(formatMsg("warn.validator.identical.entry", fp.entryName()));
+                return;    // it's okay, just takes up room
+            }
 
-        // ok, not identical, check for compatible class version and api
-        if (fp.isClass()) {
+            // ok, not identical, check for compatible class version and api
             if (fp.isNestedClass()) {
-                if (!checkNestedClass(version, entryName, internalName, fp)) {
-                    isValid = false;
-                }
-                return;
+                checkNestedClass(fp, fps);
+                return;    // fall through, need check nested public class??
             }
-            debug("%s is a class entry", entryName);
             if (!fp.isCompatibleVersion(matchFp)) {
-                error(formatMsg("error.validator.incompatible.class.version", entryName));
-                isValid = false;
+                errorAndInvalid(formatMsg("error.validator.incompatible.class.version",
+                                          fp.entryName()));
                 return;
             }
             if (!fp.isSameAPI(matchFp)) {
-                error(formatMsg("error.validator.different.api", entryName));
-                isValid = false;
+                errorAndInvalid(formatMsg("error.validator.different.api",
+                                          fp.entryName()));
                 return;
             }
-            if (!checkInternalName(entryName, basename, internalName)) {
-                isValid = false;
+            if (!checkClassName(fp)) {
                 return;
             }
-            debug("fingerprints same -- same api");
-            fps.put(internalName, fp);
-            currentTopLevelName = fp.topLevelName();
+            classes.put(fp.className(), fp);
+
             return;
-        }
-        debug("%s is a resource", entryName);
-
-        warn(formatMsg("warn.validator.resources.with.same.name", entryName));
-        fps.put(internalName, fp);
-        return;
+        });
     }
 
-    /**
+    /*
      * Checks whether or not the given versioned module descriptor's attributes
      * are valid when compared against the root/base module descriptor.
      *
@@ -326,12 +231,12 @@
      *  - A versioned descriptor can have different non-public `requires`
      *    clauses of platform ( `java.*` and `jdk.*` ) modules, and
      *  - A versioned descriptor can have different `uses` clauses, even of
-     *    service types defined outside of the platform modules.
+    *    service types defined outside of the platform modules.
      */
     private void checkModuleDescriptor(String miName) {
-        ZipEntry je = jf.getEntry(miName);
-        if (je != null) {
-            try (InputStream jis = jf.getInputStream(je)) {
+        ZipEntry ze = zf.getEntry(miName);
+        if (ze != null) {
+            try (InputStream jis = zf.getInputStream(ze)) {
                 ModuleDescriptor md = ModuleDescriptor.read(jis);
                 // Initialize the base md if it's not yet. A "base" md can be either the
                 // root module-info.class or the first versioned module-info.class
@@ -344,7 +249,7 @@
                     // must have the implementation class of the services it 'provides'.
                     if (md.provides().stream().map(Provides::providers)
                           .flatMap(List::stream)
-                          .filter(p -> jf.getEntry(toBinaryName(p)) == null)
+                          .filter(p -> zf.getEntry(toBinaryName(p)) == null)
                           .peek(p -> error(formatMsg("error.missing.provider", p)))
                           .count() != 0) {
                         isValid = false;
@@ -356,8 +261,7 @@
                 }
 
                 if (!base.name().equals(md.name())) {
-                    error(getMsg("error.validator.info.name.notequal"));
-                    isValid = false;
+                    errorAndInvalid(getMsg("error.validator.info.name.notequal"));
                 }
                 if (!base.requires().equals(md.requires())) {
                     Set<Requires> baseRequires = base.requires();
@@ -365,11 +269,9 @@
                         if (baseRequires.contains(r))
                             continue;
                         if (r.modifiers().contains(Requires.Modifier.TRANSITIVE)) {
-                            error(getMsg("error.validator.info.requires.transitive"));
-                            isValid = false;
+                            errorAndInvalid(getMsg("error.validator.info.requires.transitive"));
                         } else if (!isPlatformModule(r.name())) {
-                            error(getMsg("error.validator.info.requires.added"));
-                            isValid = false;
+                            errorAndInvalid(getMsg("error.validator.info.requires.added"));
                         }
                     }
                     for (Requires r : baseRequires) {
@@ -377,87 +279,79 @@
                         if (mdRequires.contains(r))
                             continue;
                         if (!isPlatformModule(r.name())) {
-                            error(getMsg("error.validator.info.requires.dropped"));
-                            isValid = false;
+                            errorAndInvalid(getMsg("error.validator.info.requires.dropped"));
                         }
                     }
                 }
                 if (!base.exports().equals(md.exports())) {
-                    error(getMsg("error.validator.info.exports.notequal"));
-                    isValid = false;
+                    errorAndInvalid(getMsg("error.validator.info.exports.notequal"));
                 }
                 if (!base.opens().equals(md.opens())) {
-                    error(getMsg("error.validator.info.opens.notequal"));
-                    isValid = false;
+                    errorAndInvalid(getMsg("error.validator.info.opens.notequal"));
                 }
                 if (!base.provides().equals(md.provides())) {
-                    error(getMsg("error.validator.info.provides.notequal"));
-                    isValid = false;
+                    errorAndInvalid(getMsg("error.validator.info.provides.notequal"));
                 }
                 if (!base.mainClass().equals(md.mainClass())) {
-                    error(formatMsg("error.validator.info.manclass.notequal", je.getName()));
-                    isValid = false;
+                    errorAndInvalid(formatMsg("error.validator.info.manclass.notequal",
+                                              ze.getName()));
                 }
                 if (!base.version().equals(md.version())) {
-                    error(formatMsg("error.validator.info.version.notequal", je.getName()));
-                    isValid = false;
+                    errorAndInvalid(formatMsg("error.validator.info.version.notequal",
+                                              ze.getName()));
                 }
             } catch (Exception x) {
-                error(x.getMessage() + " : " + miName);
-                this.isValid = false;
+                errorAndInvalid(x.getMessage() + " : " + miName);
             }
         }
     }
 
+    private boolean checkClassName(FingerPrint fp) {
+        if (fp.className().equals(className(fp.basename()))) {
+            return true;
+        }
+        error(formatMsg2("error.validator.names.mismatch",
+                         fp.entryName(), fp.className().replace("/", ".")));
+        return isValid = false;
+    }
+
+    private boolean checkNestedClass(FingerPrint fp, Map<String, FingerPrint> outerClasses) {
+        if (outerClasses.containsKey(fp.outerClassName())) {
+            return true;
+        }
+        // outer class was not available
+
+        error(formatMsg("error.validator.isolated.nested.class", fp.entryName()));
+        return isValid = false;
+    }
+
+    private boolean isConcealed(String className) {
+        if (concealedPkgs.isEmpty()) {
+            return false;
+        }
+        int idx = className.lastIndexOf('/');
+        String pkgName = idx != -1 ? className.substring(0, idx).replace('/', '.') : "";
+        return concealedPkgs.contains(pkgName);
+    }
+
     private static boolean isPlatformModule(String name) {
         return name.startsWith("java.") || name.startsWith("jdk.");
     }
 
-    private boolean checkInternalName(String entryName, String basename, String internalName) {
-        String className = className(basename);
-        if (internalName.equals(className)) {
-            return true;
-        }
-        error(formatMsg2("error.validator.names.mismatch",
-                entryName, internalName.replace("/", ".")));
-        return false;
-    }
-
-    private boolean checkNestedClass(int version, String entryName, String internalName, FingerPrint fp) {
-        debug("%s is a nested class entry in top level class %s", entryName, fp.topLevelName());
-        if (fp.topLevelName().equals(currentTopLevelName)) {
-            debug("%s (top level class) was accepted", fp.topLevelName());
-            fps.put(internalName, fp);
-            return true;
-        }
-        debug("top level class was not accepted");
-        error(formatMsg("error.validator.isolated.nested.class", entryName));
-        return false;
-    }
-
-    private String className(String entryName) {
+    private static String className(String entryName) {
         return entryName.endsWith(".class") ? entryName.substring(0, entryName.length() - 6) : null;
     }
 
-    private boolean isConcealed(String internalName) {
-        if (concealedPkgs.isEmpty()) {
-            return false;
-        }
-        int idx = internalName.lastIndexOf('/');
-        String pkgName = idx != -1 ? internalName.substring(0, idx).replace('/', '.') : "";
-        return concealedPkgs.contains(pkgName);
-    }
-
-    private void debug(String fmt, Object... args) {
-        if (DEBUG) System.err.format(fmt, args);
-    }
-
     private void error(String msg) {
         main.error(msg);
     }
 
+    private void errorAndInvalid(String msg) {
+        main.error(msg);
+        isValid = false;
+    }
+
     private void warn(String msg) {
         main.warn(msg);
     }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.formats.html;
+
+import com.sun.source.doctree.DocTree;
+import com.sun.source.doctree.EndElementTree;
+import com.sun.source.doctree.StartElementTree;
+import com.sun.source.doctree.TextTree;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocFileElement;
+import jdk.javadoc.internal.doclets.toolkit.DocFilesHandler;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
+import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
+import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
+import jdk.javadoc.internal.doclets.toolkit.util.Utils;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ModuleElement;
+import javax.lang.model.element.PackageElement;
+import javax.tools.FileObject;
+import javax.tools.JavaFileManager.Location;
+import java.util.Collections;
+import java.util.List;
+
+public class DocFilesHandlerImpl implements DocFilesHandler {
+
+    public final Element element;
+    public final Location location;
+    public final DocPath  source;
+    public final HtmlConfiguration configuration;
+
+    /**
+     * Constructor to construct the DocFilesWriter object.
+     *
+     * @param configuration the configuration of this doclet.
+     * @param element the containing element of the doc-files.
+     *
+     */
+    public DocFilesHandlerImpl(HtmlConfiguration configuration, Element element) {
+        this.configuration = configuration;
+        this.element = element;
+
+        switch (element.getKind()) {
+            case MODULE:
+                location = configuration.utils.getLocationForModule((ModuleElement)element);
+                source = DocPaths.DOC_FILES;
+                break;
+            case PACKAGE:
+                location = configuration.utils.getLocationForPackage((PackageElement)element);
+                source = DocPath.forPackage((PackageElement)element).resolve(DocPaths.DOC_FILES);
+                break;
+            default:
+                throw new AssertionError("unsupported element " + element);
+        }
+    }
+
+    /**
+     * Copy doc-files directory and its contents from the source
+     * elements directory to the generated documentation directory.
+     *
+     * @throws DocFileIOException if there is a problem while copying
+     *         the documentation files
+     */
+
+    public void copyDocFiles()  throws DocFileIOException {
+        boolean first = true;
+        for (DocFile srcdir : DocFile.list(configuration, location, source)) {
+            if (!srcdir.isDirectory()) {
+                continue;
+            }
+            DocPath path = null;
+            switch (this.element.getKind()) {
+                case MODULE:
+                    path = DocPath.forModule((ModuleElement)this.element);
+                    break;
+                case PACKAGE:
+                    path = DocPath.forPackage((PackageElement)this.element);
+                    break;
+                default:
+                    throw new AssertionError("unknown kind:" + this.element.getKind());
+            }
+            copyDirectory(srcdir, path.resolve(DocPaths.DOC_FILES), first);
+            first = false;
+        }
+    }
+
+
+    private void copyDirectory(DocFile srcdir, final DocPath dstDocPath,
+                               boolean first) throws DocFileIOException {
+        DocFile dstdir = DocFile.createFileForOutput(configuration, dstDocPath);
+        if (srcdir.isSameFile(dstdir)) {
+            return;
+        }
+        for (DocFile srcfile: srcdir.list()) {
+            DocFile destfile = dstdir.resolve(srcfile.getName());
+            if (srcfile.isFile()) {
+                if (destfile.exists() && !first) {
+                    configuration.messages.warning("doclet.Copy_Overwrite_warning",
+                            srcfile.getPath(), dstdir.getPath());
+                } else {
+                    configuration.messages.notice("doclet.Copying_File_0_To_Dir_1",
+                            srcfile.getPath(), dstdir.getPath());
+                    if (Utils.toLowerCase(srcfile.getPath()).endsWith(".html")) {
+                        handleHtmlFile(srcfile, dstDocPath);
+                    } else {
+                        destfile.copyFile(srcfile);
+                    }
+                }
+            } else if (srcfile.isDirectory()) {
+                if (configuration.copydocfilesubdirs
+                        && !configuration.shouldExcludeDocFileDir(srcfile.getName())) {
+                    DocPath dirDocPath = dstDocPath.resolve(srcfile.getName());
+                    copyDirectory(srcfile, dirDocPath, first);
+                }
+            }
+        }
+    }
+
+    private void handleHtmlFile(DocFile srcfile, DocPath dstPath) throws DocFileIOException {
+        DocPath dfilePath = dstPath.resolve(srcfile.getName());
+        HtmlDocletWriter docletWriter = new DocFileWriter(configuration, dfilePath, element);
+
+        Utils utils = configuration.utils;
+
+        FileObject fileObject = srcfile.getFileObject();
+        DocFileElement dfElement = new DocFileElement(element, fileObject);
+        String title = getWindowTitle(docletWriter, dfElement).trim();
+        HtmlTree htmlContent = docletWriter.getBody(true, title);
+        docletWriter.addTop(htmlContent);
+        docletWriter.addNavLinks(true, htmlContent);
+
+        List<? extends DocTree> fullBody = utils.getFullBody(dfElement);
+        Content bodyContent = docletWriter.commentTagsToContent(null, dfElement, fullBody, false);
+
+        docletWriter.addTagsInfo(dfElement, bodyContent);
+        htmlContent.addContent(bodyContent);
+
+        docletWriter.addNavLinks(false, htmlContent);
+        docletWriter.addBottom(htmlContent);
+        docletWriter.printHtmlDocument(Collections.emptyList(), false, htmlContent);
+    }
+
+    private String getWindowTitle(HtmlDocletWriter docletWriter, Element element) {
+        List<? extends DocTree> preamble = configuration.utils.getPreamble(element);
+        StringBuilder sb = new StringBuilder();
+        boolean titleFound = false;
+        loop:
+        for (DocTree dt : preamble) {
+            switch (dt.getKind()) {
+                case START_ELEMENT:
+                    StartElementTree nodeStart = (StartElementTree)dt;
+                    if (Utils.toLowerCase(nodeStart.getName().toString()).equals("title")) {
+                        titleFound = true;
+                    }
+                    break;
+
+                case END_ELEMENT:
+                    EndElementTree nodeEnd = (EndElementTree)dt;
+                    if (Utils.toLowerCase(nodeEnd.getName().toString()).equals("title")) {
+                        break loop;
+                    }
+                    break;
+
+                case TEXT:
+                    TextTree nodeText = (TextTree)dt;
+                    if (titleFound)
+                        sb.append(nodeText.getBody());
+                    break;
+
+                default:
+                    // do nothing
+            }
+        }
+        return docletWriter.getWindowTitle(sb.toString().trim());
+    }
+
+    private static class DocFileWriter extends HtmlDocletWriter {
+
+        final PackageElement pkg;
+
+        /**
+         * Constructor to construct the HtmlDocletWriter object.
+         *
+         * @param configuration the configuruation of this doclet.
+         * @param path          the file to be generated.
+         * @param e             the anchoring element.
+         */
+        public DocFileWriter(HtmlConfiguration configuration, DocPath path, Element e) {
+            super(configuration, path);
+            switch (e.getKind()) {
+                case PACKAGE:
+                    pkg = (PackageElement)e;
+                    break;
+                default:
+                    throw new AssertionError("unsupported element: " + e.getKind());
+            }
+        }
+
+        /**
+         * Get the module link.
+         *
+         * @return a content tree for the module link
+         */
+        @Override
+        protected Content getNavLinkModule() {
+            Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(pkg),
+                    contents.moduleLabel);
+            Content li = HtmlTree.LI(linkContent);
+            return li;
+        }
+
+        /**
+         * Get this package link.
+         *
+         * @return a content tree for the package link
+         */
+        @Override
+        protected Content getNavLinkPackage() {
+            Content linkContent = getPackageLink(pkg,
+                    contents.packageLabel);
+            Content li = HtmlTree.LI(linkContent);
+            return li;
+        }
+    }
+}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Sat Dec 02 06:51:10 2017 +0100
@@ -2268,13 +2268,14 @@
      * @param annotationDoc the annotation being documented
      * @param linkInfo the information about the link
      * @param annotation the annotation string to which the annotation will be added
-     * @param pairs annotation type element and value pairs
+     * @param map annotation type element to annotation value pairs
      * @param indent the number of extra spaces to indent the annotations.
      * @param linkBreak if true, add new line between each member value
      */
     private void addAnnotations(TypeElement annotationDoc, LinkInfoImpl linkInfo,
-        ContentBuilder annotation, Map<? extends ExecutableElement,? extends AnnotationValue>map,
-        int indent, boolean linkBreak) {
+                                ContentBuilder annotation,
+                                Map<? extends ExecutableElement, ? extends AnnotationValue> map,
+                                int indent, boolean linkBreak) {
         linkInfo.label = new StringContent("@");
         linkInfo.label.addContent(annotationDoc.getSimpleName());
         annotation.addContent(getLink(linkInfo));
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/WriterFactoryImpl.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/WriterFactoryImpl.java	Sat Dec 02 06:51:10 2017 +0100
@@ -26,6 +26,7 @@
 package jdk.javadoc.internal.doclets.formats.html;
 
 
+import javax.lang.model.element.Element;
 import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
@@ -37,6 +38,7 @@
 import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter;
 import jdk.javadoc.internal.doclets.toolkit.ClassWriter;
 import jdk.javadoc.internal.doclets.toolkit.ConstantsSummaryWriter;
+import jdk.javadoc.internal.doclets.toolkit.DocFilesHandler;
 import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
 import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter;
 import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter;
@@ -235,4 +237,12 @@
     public SerializedFormWriter getSerializedFormWriter() {
         return new SerializedFormWriterImpl(configuration);
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DocFilesHandler getDocFilesHandler(Element element) {
+        return new DocFilesHandlerImpl(configuration, element);
+    }
 }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java	Sat Dec 02 06:51:10 2017 +0100
@@ -375,7 +375,6 @@
         }
         initialized = true;
         this.docEnv = docEnv;
-        overviewElement = new OverviewElement(docEnv);
         Splitter specifiedSplitter = new Splitter(docEnv, false);
         specifiedModuleElements = Collections.unmodifiableSet(specifiedSplitter.mset);
         specifiedPackageElements = Collections.unmodifiableSet(specifiedSplitter.pset);
@@ -715,6 +714,7 @@
      * initializes certain components before anything else is started.
      */
     protected boolean finishOptionSettings0() throws DocletException {
+
         initDestDirectory();
         for (String link : linkList) {
             extern.link(link, reporter);
@@ -731,6 +731,7 @@
                 group.checkPackageGroups(grp.first, grp.second);
             }
         });
+        overviewElement = new OverviewElement(workArounds.getUnnamedPackage(), getOverviewPath());
         return true;
     }
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java	Sat Dec 02 06:51:10 2017 +0100
@@ -177,8 +177,11 @@
         PackageElement pe = null;
         switch (e.getKind()) {
             case OTHER:
-                fo = configuration.getOverviewPath();
-                pe = configuration.workArounds.getUnnamedPackage();
+                if (e instanceof DocletElement) {
+                    DocletElement de = (DocletElement)e;
+                    fo = de.getFileObject();
+                    pe = de.getPackageElement();
+                }
                 break;
             case PACKAGE:
                 fo = configuration.workArounds.getJavaFileObject((PackageElement)e);
@@ -209,13 +212,12 @@
         });
     }
 
-    public void setDocCommentTree(Element element, List<DocTree> fullBody,
-            List<DocTree> blockTags, Utils utils) {
+    public void setDocCommentTree(Element element, List<? extends DocTree> fullBody,
+                                  List<? extends DocTree> blockTags, Utils utils) {
         DocCommentTree docTree = treeFactory.newDocCommentTree(fullBody, blockTags);
         dcTreesMap.put(element, new DocCommentDuo(null, docTree));
-        // There maybe an entry with the original comments usually null,
-        // therefore remove that entry if it exists, and allow a new one
-        // to be reestablished.
+        // A method having null comment (no comment) that might need to be replaced
+        // with a synthetic comment, remove such a comment from the cache.
         utils.removeCommentHelper(element);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/DocFileElement.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.javadoc.internal.doclets.toolkit;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.ElementVisitor;
+import javax.lang.model.element.Name;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.type.TypeMirror;
+import javax.tools.FileObject;
+
+import jdk.javadoc.doclet.DocletEnvironment;
+
+/**
+ * This is a pseudo element wrapper for doc-files html contents, essentially to
+ * associate the doc-file's html documentation's DocCommentTree to an element.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class DocFileElement implements DocletElement {
+
+    private final Element element;
+    private final FileObject fo;
+
+    public DocFileElement(Element element, FileObject fo) {
+        this.element = element;
+        this.fo = fo;
+    }
+
+    @Override
+    public PackageElement getPackageElement() {
+        switch(element.getKind()) {
+            case MODULE:
+                // uncomment to support doc-files in modules
+                // return configuration.workArounds.getUnnamedPackage();
+                throw new UnsupportedOperationException("not implemented");
+            case PACKAGE:
+                return (PackageElement)element;
+            default:
+                throw new AssertionError("unknown kind: " + element.getKind());
+        }
+    }
+
+    @Override
+    public FileObject getFileObject() {
+        return fo;
+    }
+
+    @Override
+    public Kind getSubKind() {
+        return Kind.DOCFILE;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/DocFilesHandler.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.javadoc.internal.doclets.toolkit;
+
+/**
+ * The interface for copying doc-files to the output.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+
+public interface DocFilesHandler {
+    void copyDocFiles() throws DocletException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/DocletElement.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.javadoc.internal.doclets.toolkit;
+
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.ElementVisitor;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.Name;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.type.TypeMirror;
+import javax.tools.FileObject;
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+public interface DocletElement extends Element {
+
+    public default TypeMirror asType() {
+        throw new UnsupportedOperationException("Unsupported method");
+    }
+
+    default ElementKind getKind() {
+        return ElementKind.OTHER;
+    }
+
+    default Set<Modifier> getModifiers() {
+        throw new UnsupportedOperationException("Unsupported method");
+    }
+
+    default Name getSimpleName() {
+        throw new UnsupportedOperationException("Unsupported method");
+    }
+
+    default Element getEnclosingElement() {
+        throw new UnsupportedOperationException("Unsupported method");
+    }
+
+    default java.util.List<? extends Element> getEnclosedElements() {
+        throw new UnsupportedOperationException("Unsupported method");
+    }
+
+    default java.util.List<? extends AnnotationMirror> getAnnotationMirrors() {
+        throw new UnsupportedOperationException("Unsupported method");
+    }
+
+    default <A extends Annotation> A getAnnotation(Class<A> annotationType) {
+        throw new UnsupportedOperationException("Unsupported method");
+    }
+
+    default <R, P> R accept(ElementVisitor<R, P> v, P p) {
+        return v.visitUnknown(this, p);
+    }
+
+    default <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
+        throw new UnsupportedOperationException("Unsupported method");
+    }
+
+    /**
+     * Returns the anchoring package element, in the case of a
+     * module element, this is the module's unnamed package.
+     * @return the anchor element.
+     */
+    PackageElement getPackageElement();
+
+    /**
+     * Returns the file object associated with this special
+     * element such as overview.html, doc-file/foo.html.
+     * @return the file object
+     */
+    FileObject getFileObject();
+
+    /**
+     * Returns the subkind of this element.
+     * @return a subkind
+     */
+    Kind getSubKind();
+
+    /**
+     * Sub kind enums that this element supports.
+     */
+    public static enum Kind {
+        OVERVIEW, DOCFILE;
+    }
+}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/OverviewElement.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/OverviewElement.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,17 +25,9 @@
 
 package jdk.javadoc.internal.doclets.toolkit;
 
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-import javax.lang.model.element.AnnotationMirror;
 import javax.lang.model.element.Element;
-import javax.lang.model.element.ElementKind;
-import javax.lang.model.element.ElementVisitor;
-import javax.lang.model.element.Name;
-import javax.lang.model.type.TypeMirror;
-
-import jdk.javadoc.doclet.DocletEnvironment;
+import javax.lang.model.element.PackageElement;
+import javax.tools.FileObject;
 
 /**
  * This is a pseudo element wrapper for the overview element, essentially to
@@ -46,62 +38,28 @@
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  */
-public class OverviewElement implements Element {
-
-    public final DocletEnvironment docEnv;
-
-    OverviewElement(DocletEnvironment docEnv) {
-        this.docEnv = docEnv;
-    }
-
-    @Override
-    public TypeMirror asType() {
-        throw new UnsupportedOperationException("Unsupported method");
-    }
+public class OverviewElement implements DocletElement {
 
-    @Override
-    public ElementKind getKind() {
-        return ElementKind.OTHER;
-    }
+    private final PackageElement pkg;
+    private final FileObject fo;
 
-    @Override
-    public Set<javax.lang.model.element.Modifier> getModifiers() {
-        throw new UnsupportedOperationException("Unsupported method");
-    }
-
-    @Override
-    public Name getSimpleName() {
-        throw new UnsupportedOperationException("Unsupported method");
+    public OverviewElement(PackageElement pkg, FileObject fo) {
+        this.pkg = pkg;
+        this.fo = fo;
     }
 
     @Override
-    public Element getEnclosingElement() {
-        throw new UnsupportedOperationException("Unsupported method");
+    public PackageElement getPackageElement() {
+        return pkg;
     }
 
-    @Override
-    public java.util.List<? extends Element> getEnclosedElements() {
-        throw new UnsupportedOperationException("Unsupported method");
-    }
-
-    @Override
-    public java.util.List<? extends AnnotationMirror> getAnnotationMirrors() {
-        throw new UnsupportedOperationException("Unsupported method");
+    public FileObject getFileObject() {
+        return fo;
     }
 
     @Override
-    public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
-        throw new UnsupportedOperationException("Unsupported method");
-    }
-
-    @Override
-    public <R, P> R accept(ElementVisitor<R, P> v, P p) {
-        return v.visitUnknown(this, p);
-    }
-
-    @Override
-    public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
-        throw new UnsupportedOperationException("Unsupported method");
+    public Kind getSubKind() {
+        return Kind.OVERVIEW;
     }
 }
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java	Sat Dec 02 06:51:10 2017 +0100
@@ -151,21 +151,6 @@
         return (doclint == null);
     }
 
-    // TODO: jx.l.m directSuperTypes don't work for things like Enum,
-    // so we use javac directly, investigate why jx.l.m is not cutting it.
-    public List<TypeMirror> interfaceTypesOf(TypeMirror type) {
-        com.sun.tools.javac.util.List<com.sun.tools.javac.code.Type> interfaces =
-                ((DocEnvImpl)configuration.docEnv).toolEnv.getTypes().interfaces((com.sun.tools.javac.code.Type)type);
-        if (interfaces.isEmpty()) {
-            return Collections.emptyList();
-        }
-        List<TypeMirror> list = new ArrayList<>(interfaces.size());
-        for (com.sun.tools.javac.code.Type t : interfaces) {
-            list.add((TypeMirror)t);
-        }
-        return list;
-    }
-
     /*
      * TODO: This method exists because of a bug in javac which does not
      * handle "@deprecated tag in package-info.java", when this issue
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WriterFactory.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WriterFactory.java	Sat Dec 02 06:51:10 2017 +0100
@@ -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
@@ -25,6 +25,7 @@
 
 package jdk.javadoc.internal.doclets.toolkit;
 
+import javax.lang.model.element.Element;
 import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
@@ -222,4 +223,11 @@
      * @return the writer for the serialized form.
      */
     public SerializedFormWriter getSerializedFormWriter();
+
+    /**
+     * Return the handler for doc files.
+     *
+     * @return the handler for the doc files.
+     */
+    DocFilesHandler getDocFilesHandler(Element pkg);
 }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java	Sat Dec 02 06:51:10 2017 +0100
@@ -30,6 +30,7 @@
 
 import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocFilesHandler;
 import jdk.javadoc.internal.doclets.toolkit.DocletException;
 
 
@@ -132,7 +133,10 @@
             //Only copy doc files dir if the containing package is not
             //documented AND if we have not documented a class from the same
             //package already. Otherwise, we are making duplicate copies.
-            utils.copyDocFiles(containingPackage);
+            DocFilesHandler docFilesHandler = configuration
+                    .getWriterFactory()
+                    .getDocFilesHandler(containingPackage);
+            docFilesHandler.copyDocFiles();
             containingPackagesSeen.add(containingPackage);
         }
     }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/BuilderFactory.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/BuilderFactory.java	Sat Dec 02 06:51:10 2017 +0100
@@ -34,12 +34,15 @@
 import javax.lang.model.type.TypeMirror;
 
 import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter;
+import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
 import jdk.javadoc.internal.doclets.toolkit.ClassWriter;
-import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
 import jdk.javadoc.internal.doclets.toolkit.PropertyWriter;
 import jdk.javadoc.internal.doclets.toolkit.WriterFactory;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
 
+
+
+
 /**
  * The factory for constructing builders.
  *
@@ -87,7 +90,7 @@
      * @param pkg the package being documented.
      * @param prevPkg the previous package being documented.
      * @param nextPkg the next package being documented.
-     * @return the builder that builds the constant summary.
+     * @return the builder that builds the package summary.
      */
     public AbstractBuilder getPackageSummaryBuilder(PackageElement pkg, PackageElement prevPkg,
             PackageElement nextPkg) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java	Sat Dec 02 06:51:10 2017 +0100
@@ -30,6 +30,7 @@
 
 import jdk.javadoc.internal.doclets.toolkit.ClassWriter;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocFilesHandler;
 import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
@@ -269,7 +270,7 @@
      *
      * @throws DocFileIOException if there is a problem while copying the files
      */
-     private void copyDocFiles() throws DocFileIOException {
+     private void copyDocFiles() throws DocletException {
         PackageElement containingPackage = utils.containingPackage(typeElement);
         if ((configuration.packages == null ||
             !configuration.packages.contains(containingPackage)) &&
@@ -277,7 +278,10 @@
             //Only copy doc files dir if the containing package is not
             //documented AND if we have not documented a class from the same
             //package already. Otherwise, we are making duplicate copies.
-            utils.copyDocFiles(containingPackage);
+            DocFilesHandler docFilesHandler = configuration
+                    .getWriterFactory()
+                    .getDocFilesHandler(containingPackage);
+            docFilesHandler.copyDocFiles();
             containingPackagesSeen.add(containingPackage);
         }
      }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java	Sat Dec 02 06:51:10 2017 +0100
@@ -30,7 +30,6 @@
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter;
-import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 
 
 /**
@@ -117,7 +116,9 @@
 
         moduleWriter.addModuleFooter(contentTree);
         moduleWriter.printDocument(contentTree);
-        utils.copyDirectory(mdle, DocPaths.moduleSummary(mdle));
+        // uncomment to support doc-files in modules
+        // DocFilesHandler docFilesHandler = configuration.getWriterFactory().getDocFilesWriter(mdle);
+        // docFilesHandler.copyDocFiles();
     }
 
     /**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java	Sat Dec 02 06:51:10 2017 +0100
@@ -32,6 +32,7 @@
 import javax.lang.model.element.TypeElement;
 
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.DocFilesHandler;
 import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter;
 
@@ -122,7 +123,10 @@
 
         packageWriter.addPackageFooter(contentTree);
         packageWriter.printDocument(contentTree);
-        utils.copyDocFiles(packageElement);
+        DocFilesHandler docFilesHandler = configuration
+                .getWriterFactory()
+                .getDocFilesHandler(packageElement);
+        docFilesHandler.copyDocFiles();
     }
 
     /**
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Sat Dec 02 06:51:10 2017 +0100
@@ -1,10 +1,16 @@
-/* Javadoc style sheet */
-/*
-Overall document style
-*/
+/* 
+ * Javadoc style sheet
+ */
 
 @import url('resources/fonts/dejavu.css');
 
+/*
+ * Styles for individual HTML elements.
+ *
+ * These are styles that are specific to individual HTML elements. Changing them affects the style of a particular
+ * HTML element throughout the page.
+ */
+
 body {
     background-color:#ffffff;
     color:#353833;
@@ -41,9 +47,6 @@
     padding-top:129px;
     margin-top:-129px;
 }
-.searchTagResult:before, .searchTagResult:target {
-    color:red;
-}
 pre {
     font-family:'DejaVu Sans Mono', monospace;
     font-size:14px;
@@ -91,9 +94,16 @@
 sup {
     font-size:8px;
 }
+
 /*
-Document title and Copyright styles
-*/
+ * Styles for HTML generated by javadoc.
+ *
+ * These are style classes that are used by the standard doclet to generate HTML documentation.
+ */
+
+/*
+ * Styles for document title and copyright.
+ */
 .clear {
     clear:both;
     height:0px;
@@ -124,8 +134,8 @@
     font-weight:bold;
 }
 /*
-Navigation bar styles
-*/
+ * Styles for navigation bar.
+ */
 .bar {
     background-color:#4D7A97;
     color:#FFFFFF;
@@ -233,8 +243,8 @@
     overflow:hidden;
 }
 /*
-Page header and footer styles
-*/
+ * Styles for page header and footer.
+ */
 .header, .footer {
     clear:both;
     margin:0 20px;
@@ -277,8 +287,8 @@
     font-size:13px;
 }
 /*
-Heading styles
-*/
+ * Styles for headings.
+ */
 div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 {
     background-color:#dee3e9;
     border:1px solid #d0d9e0;
@@ -299,8 +309,8 @@
     padding:0px 0 20px 0;
 }
 /*
-Page layout container styles
-*/
+ * Styles for page layout containers.
+ */
 .contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer {
     clear:both;
     padding:10px 20px;
@@ -346,8 +356,8 @@
     display:inline;
 }
 /*
-List styles
-*/
+ * Styles for lists.
+ */
 li.circle {
     list-style:circle;
 }
@@ -403,8 +413,8 @@
     margin-bottom:1px;
 }
 /*
-Table styles
-*/
+ * Styles for tables.
+ */
 .overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary,
 .requiresSummary, .packagesSummary, .providesSummary, .usesSummary {
     width:100%;
@@ -529,7 +539,6 @@
     position:relative;
     background-color:#4D7A97;
     float:left;
-
 }
 .rowColor th, .altColor th {
     font-weight:normal;
@@ -601,8 +610,8 @@
     background-color:#EEEEEF;
 }
 /*
-Content styles
-*/
+ * Styles for contents.
+ */
 .description pre {
     margin-top:0;
 }
@@ -613,27 +622,22 @@
 .docSummary {
     padding:0;
 }
-
 ul.blockList ul.blockList ul.blockList li.blockList h3 {
     font-style:normal;
 }
-
 div.block {
     font-size:14px;
     font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif;
 }
-
 td.colLast div {
     padding-top:0px;
 }
-
-
 td.colLast a {
     padding-bottom:3px;
 }
 /*
-Formatting effect styles
-*/
+ * Styles for formatting effect.
+ */
 .sourceLineNo {
     color:green;
     padding:0 30px 0 0;
@@ -668,18 +672,16 @@
     margin-right:10px;
     display:inline-block;
 }
-
 div.block div.deprecationComment, div.block div.block span.emphasizedPhrase,
 div.block div.block span.interfaceName {
     font-style:normal;
 }
-
 div.contentContainer ul.blockList li.blockList h2 {
     padding-bottom:0px;
 }
 /*
-IFRAME specific styles
-*/
+ * Styles for IFRAME.
+ */
 .mainContainer {
     margin:0 auto; 
     padding:0; 
@@ -733,11 +735,14 @@
     margin-bottom:30px;
 }
 /*
-HTML5 specific styles
-*/
+ * Styles specific to HTML5 elements.
+ */
 main, nav, header, footer, section {
     display:block;
 }
+/*
+ * Styles for javadoc search.
+ */
 .ui-autocomplete-category {
     font-weight:bold;
     font-size:15px;
@@ -802,7 +807,9 @@
     font-style:italic;
     font-size:12px;
 }
-
+.searchTagResult:before, .searchTagResult:target {
+    color:red;
+}
 .moduleGraph span {
     display:none;
     position:absolute;
@@ -838,20 +845,17 @@
     margin-top: 10px;
     margin-bottom: 10px;
 }
-
 table.borderless > caption,
 table.plain > caption,
 table.striped > caption {
     font-weight: bold;
     font-size: smaller;
 }
-
 table.borderless th, table.borderless td,
 table.plain th, table.plain td,
 table.striped th, table.striped td {
     padding: 2px 5px;
 }
-
 table.borderless,
 table.borderless > thead > tr > th, table.borderless > tbody > tr > th, table.borderless > tr > th,
 table.borderless > thead > tr > td, table.borderless > tbody > tr > td, table.borderless > tr > td {
@@ -860,7 +864,6 @@
 table.borderless > thead > tr, table.borderless > tbody > tr, table.borderless > tr {
     background-color: transparent;
 }
-
 table.plain {
     border-collapse: collapse;
     border: 1px solid black;
@@ -872,7 +875,6 @@
 table.plain > thead > tr > td, table.plain > tbody > tr > td, table.plain > tr > td {
     border: 1px solid black;
 }
-
 table.striped {
     border-collapse: collapse;
     border: 1px solid black;
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java	Sat Dec 02 06:51:10 2017 +0100
@@ -43,6 +43,7 @@
 import jdk.javadoc.doclet.Doclet;
 import jdk.javadoc.doclet.DocletEnvironment;
 import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
+import jdk.javadoc.internal.doclets.toolkit.DocletElement;
 import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.Resources;
 
@@ -571,6 +572,7 @@
         return serializedFormTags;
     }
 
+    @SuppressWarnings("fallthrough")
     /**
      * Returns the custom tags for a given element.
      *
@@ -597,7 +599,17 @@
             case PACKAGE:
                 return getPackageCustomTaglets();
             case OTHER:
-                return getOverviewCustomTaglets();
+                if (e instanceof DocletElement) {
+                    DocletElement de = (DocletElement)e;
+                    switch (de.getSubKind()) {
+                        case DOCFILE:
+                            return getPackageCustomTaglets();
+                        case OVERVIEW:
+                            return getOverviewCustomTaglets();
+                        default:
+                            // fall through
+                    }
+                }
             default:
                 throw new AssertionError("unknown element: " + e + " ,kind: " + e.getKind());
         }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java	Sat Dec 02 06:51:10 2017 +0100
@@ -33,6 +33,7 @@
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
 
+import javax.tools.FileObject;
 import javax.tools.JavaFileManager.Location;
 import javax.tools.StandardLocation;
 
@@ -102,6 +103,12 @@
     }
 
     /**
+     * Returns a file object for the file.
+     * @return a file object
+     */
+    public abstract FileObject getFileObject();
+
+    /**
      * Open an input stream for the file.
      *
      * @return an open input stream for the file
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPath.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPath.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 
 package jdk.javadoc.internal.doclets.toolkit.util;
 
+import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
 
@@ -73,6 +74,12 @@
         return (typeElement == null) ? empty : new DocPath(utils.getSimpleName(typeElement) + ".html");
     }
 
+    public static DocPath forModule(ModuleElement mdle) {
+        return mdle == null || mdle.isUnnamed()
+                ? empty
+                : DocPath.create(mdle.getQualifiedName().toString());
+    }
+
     /**
      * Return the path for the package of a class.
      * For example, if the class is java.lang.Object,
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPaths.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPaths.java	Sat Dec 02 06:51:10 2017 +0100
@@ -170,6 +170,11 @@
     /** The name of the file for the package usage info. */
     public static final DocPath PACKAGE_USE = DocPath.create("package-use.html");
 
+    /** The name of the output directory for module documentation files. */
+    public static DocPath moduleDocFiles(ModuleElement mdle) {
+        return DocPath.create(mdle.getQualifiedName() + "-doc-files");
+    }
+
     /** The name of the file for the module frame. */
     public static DocPath moduleFrame(ModuleElement mdle) {
         return DocPath.create(mdle.getQualifiedName() + "-frame.html");
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/StandardDocFileFactory.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/StandardDocFileFactory.java	Sat Dec 02 06:51:10 2017 +0100
@@ -151,6 +151,11 @@
             this.file = newFile(getDestDir(), path.getPath());
         }
 
+        @Override
+        public FileObject getFileObject()  {
+            return getJavaFileObjectForInput(file);
+        }
+
         /**
          * Open an input stream for the file.
          *
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Sat Dec 02 06:51:10 2017 +0100
@@ -55,6 +55,8 @@
 import javax.lang.model.type.NoType;
 import javax.lang.model.type.PrimitiveType;
 import javax.lang.model.type.TypeMirror;
+import javax.lang.model.type.TypeVariable;
+import javax.lang.model.type.WildcardType;
 import javax.lang.model.util.ElementFilter;
 import javax.lang.model.util.ElementKindVisitor9;
 import javax.lang.model.util.Elements;
@@ -72,10 +74,12 @@
 import com.sun.source.doctree.DocTree.Kind;
 import com.sun.source.doctree.ParamTree;
 import com.sun.source.doctree.SerialFieldTree;
+import com.sun.source.doctree.StartElementTree;
 import com.sun.source.tree.CompilationUnitTree;
 import com.sun.source.tree.LineMap;
 import com.sun.source.util.DocSourcePositions;
 import com.sun.source.util.DocTrees;
+import com.sun.source.util.SimpleDocTreeVisitor;
 import com.sun.source.util.TreePath;
 import com.sun.tools.javac.model.JavacTypes;
 import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
@@ -263,97 +267,7 @@
         return getEnclosingTypeElement(e) == null || isStatic(e);
     }
 
-    /**
-     * Copy doc-files directory and its contents from the source
-     * package directory to the generated documentation directory.
-     * For example, given a package java.lang, this method will copy
-     * the doc-files directory, found in the package directory to the
-     * generated documentation hierarchy.
-     *
-     * @param pe the package containing the doc files to be copied
-     * @throws DocFileIOException if there is a problem while copying
-     *         the documentation files
-     */
-    public void copyDocFiles(PackageElement pe) throws DocFileIOException {
-        Location sourceLoc = getLocationForPackage(pe);
-        copyDirectory(sourceLoc, DocPath.forPackage(pe).resolve(DocPaths.DOC_FILES));
-    }
-
-    /**
-     * Copy the given directory contents from the source package directory
-     * to the generated documentation directory. For example, given a package
-     * java.lang, this method will copy the entire directory, to the generated
-     * documentation hierarchy.
-     *
-     * @param pe the package containing the directory to be copied
-     * @param dir the directory to be copied
-     * @throws DocFileIOException if there is a problem while copying
-     *         the documentation files
-     */
-    public void copyDirectory(PackageElement pe, DocPath dir) throws DocFileIOException {
-        copyDirectory(getLocationForPackage(pe), dir);
-    }
-
-    /**
-     * Copy the given directory and its contents from the source
-     * module directory to the generated documentation directory.
-     * For example, given a package java.lang, this method will
-     * copy the entire directory, to the generated documentation
-     * hierarchy.
-     *
-     * @param mdle the module containing the directory to be copied
-     * @param dir the directory to be copied
-     * @throws DocFileIOException if there is a problem while copying
-     *         the documentation files
-     */
-    public void copyDirectory(ModuleElement mdle, DocPath dir) throws DocFileIOException  {
-        copyDirectory(getLocationForModule(mdle), dir);
-    }
-
-    /**
-     * Copy files from a doc path location to the output.
-     *
-     * @param locn the location from which to read files
-     * @param dir the directory to be copied
-     * @throws DocFileIOException if there is a problem
-     *         copying the files
-     */
-    public void copyDirectory(Location locn, DocPath dir)  throws DocFileIOException {
-        boolean first = true;
-        for (DocFile f : DocFile.list(configuration, locn, dir)) {
-            if (!f.isDirectory()) {
-                continue;
-            }
-            DocFile srcdir = f;
-            DocFile destdir = DocFile.createFileForOutput(configuration, dir);
-            if (srcdir.isSameFile(destdir)) {
-                continue;
-            }
-
-            for (DocFile srcfile: srcdir.list()) {
-                DocFile destfile = destdir.resolve(srcfile.getName());
-                if (srcfile.isFile()) {
-                    if (destfile.exists() && !first) {
-                        messages.warning("doclet.Copy_Overwrite_warning",
-                                srcfile.getPath(), destdir.getPath());
-                    } else {
-                        messages.notice("doclet.Copying_File_0_To_Dir_1",
-                                srcfile.getPath(), destdir.getPath());
-                        destfile.copyFile(srcfile);
-                    }
-                } else if (srcfile.isDirectory()) {
-                    if (configuration.copydocfilesubdirs
-                            && !configuration.shouldExcludeDocFileDir(srcfile.getName())) {
-                        copyDirectory(locn, dir.resolve(srcfile.getName()));
-                    }
-                }
-            }
-
-            first = false;
-        }
-    }
-
-    protected Location getLocationForPackage(PackageElement pd) {
+    public Location getLocationForPackage(PackageElement pd) {
         ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(pd);
 
         if (mdle == null)
@@ -362,7 +276,7 @@
         return getLocationForModule(mdle);
     }
 
-    protected Location getLocationForModule(ModuleElement mdle) {
+    public Location getLocationForModule(ModuleElement mdle) {
         Location loc = configuration.workArounds.getLocationForModule(mdle);
         if (loc != null)
             return loc;
@@ -976,71 +890,40 @@
     }
 
     /**
-     * For the class return all implemented interfaces including the
-     * superinterfaces of the implementing interfaces, also iterate over for
-     * all the superclasses. For interface return all the extended interfaces
-     * as well as superinterfaces for those extended interfaces.
+     * Returns all the implemented super-interfaces of a given type,
+     * in the case of classes, include all the super-interfaces of
+     * the supertype. The super-interfaces are collected before the
+     * super-interfaces of the supertype.
      *
-     * @param  te the class to get the interfaces for
-     * @return List of all the required interfaces.
+     * @param  te the type element to get the super-interfaces for.
+     * @return the list of super-interfaces.
      */
     public Set<TypeMirror> getAllInterfaces(TypeElement te) {
         Set<TypeMirror> results = new LinkedHashSet<>();
-
-        List<? extends TypeMirror> interfaceTypes = te.getInterfaces();
-
-        for (TypeMirror interfaceType : interfaceTypes) {
-            TypeElement intfc = asTypeElement(interfaceType);
-
-            if (isPublic(intfc) || isLinkable(intfc)) {
-                results.add(interfaceType);
-                TypeElement klass = asTypeElement(interfaceType);
-                for (TypeMirror t : getAllInterfaces(klass)) {
-                    t = getDeclaredType(results, te, t);
-                    results.add(t);
-                }
-            }
-        }
-        // TypeMirror contains the modified TypeParameterElement's types represented
-        // in the local Class'es elements types. ex: Foo<E> implements Bar<V> and the
-        // class being considered is Foo then TypeParameters will be represented as <E>
-        // note that any conversion might revert back to the old signature. For this
-        // very reason we get the superType, and find its interfaces.
-        TypeMirror superType = getSuperType(te);
-        if (superType == getObjectType())
-            return results;
-        // Try walking the tree
-        addAllInterfaceTypes(results, te, superType,
-                configuration.workArounds.interfaceTypesOf(superType));
+        getAllInterfaces(te.asType(), results);
         return results;
     }
 
-    private void findAllInterfaceTypes(Set<TypeMirror> results, final TypeElement baseClass,
-            TypeMirror p) {
-        TypeMirror superType = getSuperType(asTypeElement(p));
-        if (superType == p) {
-            return;
-        }
-        addAllInterfaceTypes(results, baseClass, superType,
-                configuration.workArounds.interfaceTypesOf(superType));
-    }
-
-    private void addAllInterfaceTypes(Set<TypeMirror> results,
-            final TypeElement baseClass, TypeMirror type,
-            List<TypeMirror> interfaceTypes) {
-        for (TypeMirror interfaceType : interfaceTypes) {
-            TypeElement iElement = asTypeElement(interfaceType);
-            if (isPublic(iElement) && isLinkable(iElement)) {
-                interfaceType = getDeclaredType(results, baseClass, interfaceType);
-                results.add(interfaceType);
-                Set<TypeMirror> superInterfaces = getAllInterfaces(iElement);
-                for (TypeMirror superInterface : superInterfaces) {
-                    superInterface = getDeclaredType(results, baseClass, superInterface);
-                    results.add(superInterface);
-                }
+    private void getAllInterfaces(TypeMirror type, Set<TypeMirror> results) {
+        List<? extends TypeMirror> intfacs = typeUtils.directSupertypes(type);
+        TypeMirror superType = null;
+        for (TypeMirror intfac : intfacs) {
+            if (intfac == getObjectType())
+                continue;
+            TypeElement e = asTypeElement(intfac);
+            if (isInterface(e)) {
+                if (isPublic(e) || isLinkable(e))
+                    results.add(intfac);
+
+                getAllInterfaces(intfac, results);
+            } else {
+                // Save the supertype for later.
+                superType = intfac;
             }
         }
-        findAllInterfaceTypes(results, baseClass, type);
+        // Collect the super-interfaces of the supertype.
+        if (superType != null)
+            getAllInterfaces(superType, results);
     }
 
     /**
@@ -1154,22 +1037,6 @@
                 (isPublic(typeElem) || isProtected(typeElem)));
     }
 
-    List<TypeMirror> asErasureTypes(Collection<TypeElement> inList) {
-        List<TypeMirror> out = new ArrayList<>(inList.size());
-        inList.stream().forEach((te) -> {
-            out.add(typeUtils.erasure(te.asType()));
-        });
-        return out;
-    }
-
-    List<TypeMirror> asTypes(Collection<TypeElement> inList) {
-        List<TypeMirror> out = new ArrayList<>(inList.size());
-        inList.stream().forEach((te) -> {
-            out.add(te.asType());
-        });
-        return out;
-    }
-
     /**
      * Return this type as a {@code TypeElement} if it represents a class
      * interface or annotation.  Array dimensions are ignored.
@@ -1195,10 +1062,9 @@
             }
 
             @Override
-            public TypeElement visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) {
-               /*
-                * TODO: Check with JJG.
-                * if we have an annotated type @A $B T, then erasure returns a
+            public TypeElement visitTypeVariable(TypeVariable t, Void p) {
+               /* TODO, this may not be an optimimal fix.
+                * if we have an annotated type @DA T, then erasure returns a
                 * none, in this case we use asElement instead.
                 */
                 if (isAnnotated(t)) {
@@ -1208,7 +1074,7 @@
             }
 
             @Override
-            public TypeElement visitWildcard(javax.lang.model.type.WildcardType t, Void p) {
+            public TypeElement visitWildcard(WildcardType t, Void p) {
                 return visit(typeUtils.erasure(t));
             }
 
@@ -3142,6 +3008,10 @@
         if (!configuration.isAllowScriptInComments()) {
             DocCommentTree dct = configuration.cmtUtils.parse(
                     URI.create("option://" + name.replace("-", "")), "<body>" + value + "</body>");
+
+            if (dct == null)
+                return;
+
             try {
                 javaScriptScanner.scan(dct, null, p -> {
                     throw new JavaScriptScanner.Fault();
@@ -3169,6 +3039,13 @@
         return dcTree;
     }
 
+    public List<? extends DocTree> getPreamble(Element element) {
+        DocCommentTree docCommentTree = getDocCommentTree(element);
+        return docCommentTree == null
+                ? Collections.emptyList()
+                : docCommentTree.getPreamble();
+    }
+
     public List<? extends DocTree> getFullBody(Element element) {
         DocCommentTree docCommentTree = getDocCommentTree(element);
             return (docCommentTree == null)
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Sat Dec 02 06:51:10 2017 +0100
@@ -30,8 +30,6 @@
 import com.sun.tools.classfile.ConstantPoolException;
 import com.sun.tools.classfile.Dependencies.ClassFileError;
 
-import jdk.internal.util.jar.VersionedStream;
-
 import java.io.Closeable;
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -336,7 +334,7 @@
 
         protected Set<String> scan() {
             try (JarFile jf = openJarFile(path.toFile(), version)) {
-                return VersionedStream.stream(jf).map(JarEntry::getName)
+                return jf.versionedStream().map(JarEntry::getName)
                          .filter(n -> n.endsWith(".class"))
                          .collect(Collectors.toSet());
             } catch (IOException e) {
@@ -383,24 +381,9 @@
         }
     }
 
-    Enumeration<JarEntry> versionedEntries(JarFile jf) {
-        Iterator<JarEntry> it = VersionedStream.stream(jf).iterator();
-        return new Enumeration<>() {
-            @Override
-            public boolean hasMoreElements() {
-                return it.hasNext();
-            }
-
-            @Override
-            public JarEntry nextElement() {
-                return it.next();
-            }
-        };
-    }
-
     class JarFileIterator implements Iterator<ClassFile> {
         protected final JarFileReader reader;
-        protected Enumeration<JarEntry> entries;
+        protected Iterator<JarEntry> entries;
         protected JarFile jf;
         protected JarEntry nextEntry;
         protected ClassFile cf;
@@ -416,7 +399,7 @@
             if (jarfile == null) return;
 
             this.jf = jarfile;
-            this.entries = versionedEntries(jf);
+            this.entries = jarfile.versionedStream().iterator();
             this.nextEntry = nextEntry();
         }
 
@@ -450,8 +433,8 @@
         }
 
         protected JarEntry nextEntry() {
-            while (entries.hasMoreElements()) {
-                JarEntry e = entries.nextElement();
+            while (entries.hasNext()) {
+                JarEntry e = entries.next();
                 String name = e.getName();
                 if (name.endsWith(".class")) {
                     return e;
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/VersionHelper.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/VersionHelper.java	Sat Dec 02 06:51:10 2017 +0100
@@ -27,7 +27,6 @@
 
 import com.sun.tools.classfile.ClassFile;
 import com.sun.tools.classfile.ConstantPoolException;
-import jdk.internal.misc.SharedSecrets;
 
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -48,7 +47,7 @@
     public static void add(JarFile jarfile, JarEntry e, ClassFile cf)
             throws ConstantPoolException
     {
-        String realName = SharedSecrets.javaUtilJarAccess().getRealName(jarfile, e);
+        String realName = e.getRealName();
         if (realName.startsWith(META_INF_VERSIONS)) {
             int len = META_INF_VERSIONS.length();
             int n = realName.indexOf('/', len);
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JarArchive.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JarArchive.java	Sat Dec 02 06:51:10 2017 +0100
@@ -34,7 +34,6 @@
 import java.util.stream.Stream;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
-import jdk.internal.util.jar.VersionedStream;
 import jdk.tools.jlink.internal.Archive.Entry.EntryType;
 
 /**
@@ -105,7 +104,7 @@
         } catch (IOException ioe) {
             throw new UncheckedIOException(ioe);
         }
-        return VersionedStream.stream(jarFile)
+        return jarFile.versionedStream()
                 .filter(je -> !je.isDirectory())
                 .map(this::toEntry);
     }
--- a/src/jdk.jshell/share/classes/jdk/jshell/Eval.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/Eval.java	Sat Dec 02 06:51:10 2017 +0100
@@ -59,7 +59,6 @@
 import jdk.jshell.Snippet.SubKind;
 import jdk.jshell.TaskFactory.AnalyzeTask;
 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;
@@ -454,7 +453,7 @@
                         name = "$" + ++varNumber;
                     }
                 }
-                guts = Wrap.tempVarWrap(compileSource, typeName, name);
+                guts = Wrap.tempVarWrap(compileSource, ei.accessibleTypeName, name);
                 Collection<String> declareReferences = null; //TODO
                 snip = new VarSnippet(state.keyMap.keyForVariable(name), userSource, guts,
                         name, SubKind.TEMP_VAR_EXPRESSION_SUBKIND, typeName, declareReferences, null);
--- a/src/jdk.jshell/share/classes/jdk/jshell/ExpressionToTypeInfo.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/ExpressionToTypeInfo.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,8 @@
 import com.sun.source.tree.VariableTree;
 import com.sun.source.util.TreePath;
 import com.sun.source.util.TreePathScanner;
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Types;
@@ -69,6 +71,7 @@
     public static class ExpressionInfo {
         ExpressionTree tree;
         String typeName;
+        String accessibleTypeName;
         String fullTypeName;
         List<String> parameterTypes;
         String enclosingInstanceType;
@@ -215,6 +218,63 @@
         return null;
     }
 
+    /**
+     * A type is accessible if it is public or if it is package-private and is a
+     * type defined in JShell.  Additionally, all its type arguments must be
+     * accessible
+     *
+     * @param type the type to check for accessibility
+     * @return true if the type name can be referenced
+     */
+    private boolean isAccessible(Type type) {
+        Symbol.TypeSymbol tsym = type.asElement();
+        return ((tsym.flags() & Flags.PUBLIC) != 0 ||
+                ((tsym.flags() & Flags.PRIVATE) == 0 &&
+                Util.isInJShellClass(tsym.flatName().toString()))) &&
+                 type.getTypeArguments().stream()
+                        .allMatch(this::isAccessible);
+    }
+
+    /**
+     * Return the superclass.
+     *
+     * @param type the type
+     * @return the superclass, or Object on error
+     */
+    private Type supertype(Type type) {
+        Type sup = types.supertype(type);
+        if (sup == Type.noType || sup == null) {
+            return syms.objectType;
+        }
+        return sup;
+    }
+
+    /**
+     * Find an accessible supertype.
+     *
+     * @param type the type
+     * @return the type, if it is accessible, otherwise a superclass or
+     * interface which is
+     */
+    private Type findAccessibleSupertype(Type type) {
+        // Iterate up the superclasses, see if any are accessible
+        for (Type sup = type; !types.isSameType(sup, syms.objectType); sup = supertype(sup)) {
+            if (isAccessible(sup)) {
+                return sup;
+            }
+        }
+        // Failing superclasses, look through superclasses for accessible interfaces
+        for (Type sup = type; !types.isSameType(sup, syms.objectType); sup = supertype(sup)) {
+            for (Type itf : types.interfaces(sup)) {
+                if (isAccessible(itf)) {
+                    return itf;
+                }
+            }
+        }
+        // Punt, return Object which is the supertype of everything
+        return syms.objectType;
+    }
+
     private ExpressionInfo treeToInfo(TreePath tp) {
         if (tp != null) {
             Tree tree = tp.getLeaf();
@@ -234,10 +294,12 @@
                         case NULL:
                             ei.isNonVoid = true;
                             ei.typeName = OBJECT_TYPE_NAME;
+                            ei.accessibleTypeName = OBJECT_TYPE_NAME;
                             break;
                         default: {
                             ei.isNonVoid = true;
                             ei.typeName = varTypeName(type, false);
+                            ei.accessibleTypeName = varTypeName(findAccessibleSupertype(type), false);
                             ei.fullTypeName = varTypeName(type, true);
                             break;
                         }
--- a/src/jdk.jshell/share/classes/jdk/jshell/Util.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.jshell/share/classes/jdk/jshell/Util.java	Sat Dec 02 06:51:10 2017 +0100
@@ -29,6 +29,7 @@
 import java.util.Arrays;
 import java.util.List;
 import java.util.Locale;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
@@ -82,6 +83,17 @@
         return sb.toString();
     }
 
+    /**
+     * Check if this is the name of something in JShell.
+     *
+     * @param s the name of the class, method, variable, ...
+     * @return true if it is, or is within a JShell defined wrapper class
+     */
+    static boolean isInJShellClass(String s) {
+        Matcher m = PREFIX_PATTERN.matcher(s);
+        return m.find() && m.start() == 0;
+    }
+
     static String asLetters(int i) {
         if (i == 0) {
             return "";
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SplitIntoFunctions.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SplitIntoFunctions.java	Sat Dec 02 06:51:10 2017 +0100
@@ -306,10 +306,10 @@
 
     @Override
     public boolean enterVarNode(final VarNode varNode) {
-        if (!inSplitNode()) {
+        // ES6 block scoped declarations are already placed at their proper position by splitter
+        if (!inSplitNode() || varNode.isBlockScoped()) {
             return super.enterVarNode(varNode);
         }
-        assert !varNode.isBlockScoped(); //TODO: we must handle these too, but we currently don't
 
         final Expression init = varNode.getInit();
 
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Splitter.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Splitter.java	Sat Dec 02 06:51:10 2017 +0100
@@ -41,6 +41,7 @@
 import jdk.nashorn.internal.ir.SplitNode;
 import jdk.nashorn.internal.ir.Splittable;
 import jdk.nashorn.internal.ir.Statement;
+import jdk.nashorn.internal.ir.VarNode;
 import jdk.nashorn.internal.ir.visitor.SimpleNodeVisitor;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.logging.DebugLogger;
@@ -201,8 +202,9 @@
 
         for (final Statement statement : block.getStatements()) {
             final long weight = WeighNodes.weigh(statement, weightCache);
+            final boolean isBlockScopedVarNode = isBlockScopedVarNode(statement);
 
-            if (statementsWeight + weight >= SPLIT_THRESHOLD || statement.isTerminal()) {
+            if (statementsWeight + weight >= SPLIT_THRESHOLD || statement.isTerminal() || isBlockScopedVarNode) {
                 if (!statements.isEmpty()) {
                     splits.add(createBlockSplitNode(block, function, statements, statementsWeight));
                     statements = new ArrayList<>();
@@ -210,7 +212,7 @@
                 }
             }
 
-            if (statement.isTerminal()) {
+            if (statement.isTerminal() || isBlockScopedVarNode) {
                 splits.add(statement);
             } else {
                 statements.add(statement);
@@ -243,6 +245,10 @@
         return new SplitNode(name, newBlock, compiler.findUnit(weight + WeighNodes.FUNCTION_WEIGHT));
     }
 
+    private boolean isBlockScopedVarNode(final Statement statement) {
+        return statement instanceof VarNode && ((VarNode) statement).isBlockScoped();
+    }
+
     @Override
     public boolean enterBlock(final Block block) {
         if (block.isCatchBlock()) {
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/SplitReturn.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/SplitReturn.java	Sat Dec 02 06:51:10 2017 +0100
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.ir;
 
+import jdk.nashorn.internal.ir.annotations.Ignore;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 
 /**
@@ -37,6 +38,7 @@
     private static final long serialVersionUID = 1L;
 
     /** The sole instance of this AST node. */
+    @Ignore
     public static final SplitReturn INSTANCE = new SplitReturn();
 
     private SplitReturn() {
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/mozilla_compat.js	Sat Dec 02 11:25:35 2017 +0530
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/mozilla_compat.js	Sat Dec 02 06:51:10 2017 +0100
@@ -45,7 +45,7 @@
 // importPackage
 // avoid unnecessary chaining of __noSuchProperty__ again
 // in case user loads this script more than once.
-if (typeof importPackage == 'undefined') {
+if (typeof importPackage == 'undefined' || !(importPackage instanceof Function)) {
 
 Object.defineProperty(this, "importPackage", {
     configurable: true, enumerable: false, writable: true,
--- a/test/Makefile	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/Makefile	Sat Dec 02 06:51:10 2017 +0100
@@ -48,12 +48,7 @@
 all: jdk_all langtools_all jaxp_all
 
 ifeq ($(TEST_JOBS), 0)
-  ifeq ($(shell $(EXPR) $(JOBS) \> 50), 1)
-    # JTReg cannot handle more than 50 in concurrency
-    JDK_TEST_JOBS=50
-  else
-    JDK_TEST_JOBS=$(JOBS)
-  endif
+  JDK_TEST_JOBS=$(JOBS)
 else
   JDK_TEST_JOBS=$(TEST_JOBS)
 endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/Component/GetScreenLocTest/ComponentGetLocationOnScreenNPETest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8189204
+ * @summary Possible NPE in Component::getLocationOnScreen()
+ * @run main ComponentGetLocationOnScreenNPETest
+ */
+
+import javax.swing.*;
+import java.awt.*;
+
+public class ComponentGetLocationOnScreenNPETest {
+
+    private static Frame frame;
+    private static JPanel panel;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            frame = new Frame();
+            JPanel parentPanel = new JPanel() {
+                @Override
+                public Container getParent() {
+                    return new Frame();
+                }
+            };
+            frame.add(parentPanel);
+            panel = new JPanel();
+            parentPanel.add(panel);
+            frame.setVisible(true);
+        });
+        Robot robot = new Robot();
+        robot.waitForIdle();
+        robot.delay(200);
+
+        SwingUtilities.invokeAndWait(panel::getLocationOnScreen);
+        SwingUtilities.invokeLater(frame::dispose);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/dnd/RecognizedActionTest/RecognizedActionTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @key headful
+ * @bug 4494085 8158366
+ * @summary verifies that the recognized action matches modifiers state
+ * @compile RecognizedActionTest.java
+ * @run main RecognizedActionTest
+ */
+
+import java.awt.Frame;
+import java.awt.Component;
+import java.awt.Robot;
+import java.awt.Point;
+import java.awt.Dimension;
+import java.awt.AWTEvent;
+import java.awt.event.AWTEventListener;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragGestureEvent;
+
+public class RecognizedActionTest implements AWTEventListener {
+
+    final Frame frame = new Frame();
+    boolean dragGestureRecognized = false;
+    int currentDragAction = DnDConstants.ACTION_NONE;
+
+    final int[] modifiers = {
+            0,
+            InputEvent.CTRL_DOWN_MASK,
+            InputEvent.SHIFT_DOWN_MASK,
+            InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK
+    };
+
+    final DragSource dragSource = DragSource.getDefaultDragSource();
+    final DragGestureListener dragGestureListener = new DragGestureListener() {
+
+        public void dragGestureRecognized(DragGestureEvent dge) {
+            dragGestureRecognized = true;
+
+            if (dge.getDragAction() != currentDragAction) {
+                throw new RuntimeException("Expected: " +
+                        Integer.toHexString(currentDragAction) +
+                        " recognized: " +
+                        Integer.toHexString(dge.getDragAction()));
+            }
+        }
+    };
+
+    final Object SYNC_LOCK = new Object();
+    final int FRAME_ACTIVATION_TIMEOUT = 2000;
+    final int MOUSE_RELEASE_TIMEOUT = 1000;
+
+    Component clickedComponent = null;
+
+    public void init() {
+        try {
+            frame.setTitle("Test frame");
+            frame.setBounds(100, 100, 200, 200);
+            dragSource.createDefaultDragGestureRecognizer(frame,
+                    DnDConstants.ACTION_COPY |
+                            DnDConstants.ACTION_MOVE |
+                            DnDConstants.ACTION_LINK,
+                    dragGestureListener);
+
+            frame.getToolkit().addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK);
+            frame.setVisible(true);
+            Thread.sleep(100);
+
+            final Robot robot = new Robot();
+            robot.waitForIdle();
+
+            Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
+
+            final Point srcPoint = frame.getLocationOnScreen();
+            Dimension d = frame.getSize();
+            srcPoint.translate(d.width / 2, d.height / 2);
+
+            if (!pointInComponent(robot, srcPoint, frame)) {
+                throw new RuntimeException("WARNING: Couldn't locate source frame.");
+            }
+
+            final Point dstPoint = new Point(srcPoint);
+            dstPoint.translate(d.width / 4, d.height / 4);
+
+            if (!pointInComponent(robot, dstPoint, frame)) {
+                throw new RuntimeException("WARNING: Couldn't locate target frame.");
+            }
+
+            for (int i = 0; i < modifiers.length; i++) {
+                currentDragAction = convertModifiersToDropAction(modifiers[i]);
+                dragGestureRecognized = false;
+                final Point curPoint = new Point(srcPoint);
+                robot.mouseMove(curPoint.x, curPoint.y);
+
+                switch (modifiers[i]) {
+                    case InputEvent.SHIFT_DOWN_MASK:
+                        robot.keyPress(KeyEvent.VK_SHIFT);
+                        robot.waitForIdle();
+                        break;
+
+                    case InputEvent.CTRL_DOWN_MASK:
+                        robot.keyPress(KeyEvent.VK_CONTROL);
+                        robot.waitForIdle();
+                        break;
+
+                    case InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK:
+                        robot.keyPress(KeyEvent.VK_CONTROL);
+                        robot.waitForIdle();
+                        robot.keyPress(KeyEvent.VK_SHIFT);
+                        robot.waitForIdle();
+                        break;
+
+                    default:
+                        break;
+                }
+                robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+                Thread.sleep(100);
+
+                for (; !curPoint.equals(dstPoint) && !dragGestureRecognized;
+                     curPoint.translate(sign(dstPoint.x - curPoint.x),
+                             sign(dstPoint.y - curPoint.y))) {
+                    robot.mouseMove(curPoint.x, curPoint.y);
+                    Thread.sleep(50);
+                }
+                Thread.sleep(100);
+
+                robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+
+                switch (modifiers[i]) {
+                    case InputEvent.SHIFT_DOWN_MASK:
+                        robot.keyRelease(KeyEvent.VK_SHIFT);
+                        robot.waitForIdle();
+                        break;
+
+                    case InputEvent.CTRL_DOWN_MASK:
+                        robot.keyRelease(KeyEvent.VK_CONTROL);
+                        robot.waitForIdle();
+                        break;
+
+                    case InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK:
+                        robot.keyRelease(KeyEvent.VK_CONTROL);
+                        robot.waitForIdle();
+                        robot.keyRelease(KeyEvent.VK_SHIFT);
+                        robot.waitForIdle();
+                        break;
+
+                    default:
+                        break;
+                }
+                Thread.sleep(100);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("The test failed.");
+        }
+    }
+
+    public int sign(int n) {
+        return n < 0 ? -1 : n == 0 ? 0 : 1;
+    }
+
+    public void reset() {
+        clickedComponent = null;
+    }
+
+    public void eventDispatched(AWTEvent e) {
+        if (e.getID() == MouseEvent.MOUSE_RELEASED) {
+            clickedComponent = (Component) e.getSource();
+            synchronized (SYNC_LOCK) {
+                SYNC_LOCK.notifyAll();
+            }
+        }
+    }
+
+    public boolean pointInComponent(Robot robot, Point p, Component comp)
+            throws InterruptedException {
+        reset();
+        robot.mouseMove(p.x, p.y);
+        robot.waitForIdle();
+        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+        robot.waitForIdle();
+        synchronized (SYNC_LOCK) {
+            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+            SYNC_LOCK.wait(MOUSE_RELEASE_TIMEOUT);
+        }
+
+        Component c = clickedComponent;
+
+        while (c != null && c != comp) {
+            c = c.getParent();
+        }
+
+        return c == comp;
+    }
+
+    public void dispose() {
+        frame.dispose();
+    }
+
+    public int convertModifiersToDropAction(int modifiers) {
+        int dropAction = DnDConstants.ACTION_NONE;
+
+        switch (modifiers & (InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)) {
+            case InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK:
+                dropAction = DnDConstants.ACTION_LINK;
+                break;
+
+            case InputEvent.CTRL_DOWN_MASK:
+                dropAction = DnDConstants.ACTION_COPY;
+                break;
+
+            case InputEvent.SHIFT_DOWN_MASK:
+                dropAction = DnDConstants.ACTION_MOVE;
+                break;
+
+            default:
+                dropAction = DnDConstants.ACTION_MOVE;
+                break;
+        }
+
+        return dropAction;
+    }
+
+    public static void main(String args[]) {
+        RecognizedActionTest actionTest = new RecognizedActionTest();
+        actionTest.init();
+        actionTest.dispose();
+    }
+}
--- a/test/jdk/java/io/Serializable/maskSyntheticModifier/MaskSyntheticModifierTest.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/jdk/java/io/Serializable/maskSyntheticModifier/MaskSyntheticModifierTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -30,6 +30,7 @@
  *          serialVersionUID calculation.
  */
 
+import java.io.File;
 import java.io.ObjectStreamClass;
 import java.nio.file.Files;
 import java.nio.file.Paths;
@@ -46,7 +47,10 @@
     }
 
     private static void setup() throws Exception {
+        // Copy the class file to the first component of the class path
+        String cp = System.getProperty("java.class.path");
+        String cp1 = cp.substring(0, cp.indexOf(File.pathSeparatorChar));
         Files.copy(Paths.get(System.getProperty("test.src"), "Foo.class"),
-                Paths.get("Foo.class"), StandardCopyOption.REPLACE_EXISTING);
+                Paths.get(cp1, "Foo.class"), StandardCopyOption.REPLACE_EXISTING);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/SecurityManager/DepMethodsRequireAllPerm.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,82 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8004502 8008793 8029886 8186535
+ * @summary Sanity check that the SecurityManager checkMemberAccess method and
+ *          methods that used to check AWTPermission now check for AllPermission
+ */
+
+import java.security.AllPermission;
+import java.security.Permission;
+
+public class DepMethodsRequireAllPerm {
+
+    static class MySecurityManager extends SecurityManager {
+        final Class<?> expectedClass;
+
+        MySecurityManager(Class<?> c) {
+            expectedClass = c;
+        }
+
+        @Override
+        public void checkPermission(Permission perm) {
+            if (perm.getClass() != expectedClass)
+                throw new RuntimeException("Got: " + perm.getClass() + ", expected: " + expectedClass);
+            super.checkPermission(perm);
+        }
+    }
+
+    public static void main(String[] args) {
+        MySecurityManager sm = new MySecurityManager(AllPermission.class);
+
+        try {
+            sm.checkAwtEventQueueAccess();
+            throw new RuntimeException("SecurityException expected");
+        } catch (SecurityException expected) { }
+
+        try {
+            sm.checkSystemClipboardAccess();
+            throw new RuntimeException("SecurityException expected");
+        } catch (SecurityException expected) { }
+
+        try {
+            sm.checkTopLevelWindow(null);
+            throw new RuntimeException("NullPointException expected");
+        } catch (NullPointerException expected) { }
+
+        if (sm.checkTopLevelWindow(new Object())) {
+            throw new RuntimeException("checkTopLevelWindow expected to return false");
+        }
+
+        try {
+            sm.checkMemberAccess(Object.class, java.lang.reflect.Member.DECLARED);
+            throw new RuntimeException("SecurityException expected");
+        } catch (SecurityException expected) { }
+
+        try {
+            sm.checkMemberAccess(null, java.lang.reflect.Member.DECLARED);
+            throw new RuntimeException("NullPointerException expected");
+        } catch (NullPointerException expected) { }
+    }
+}
--- a/test/jdk/java/lang/SecurityManager/NoAWT.java	Sat Dec 02 11:25:35 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* @test
- * @bug 8004502 8008793 8029886
- * @summary Sanity check that SecurityManager methods that used to check
- *          AWTPermission now check for AllPermission
- */
-
-import java.security.AllPermission;
-import java.security.Permission;
-
-public class NoAWT {
-
-    static class MySecurityManager extends SecurityManager {
-        final Class<?> expectedClass;
-
-        MySecurityManager(Class<?> c) {
-            expectedClass = c;
-        }
-
-        @Override
-        public void checkPermission(Permission perm) {
-            if (perm.getClass() != expectedClass)
-                throw new RuntimeException("Got: " + perm.getClass() + ", expected: " + expectedClass);
-            super.checkPermission(perm);
-        }
-    }
-
-    public static void main(String[] args) {
-        MySecurityManager sm = new MySecurityManager(AllPermission.class);
-
-        try {
-            sm.checkAwtEventQueueAccess();
-            throw new RuntimeException("SecurityException expected");
-        } catch (SecurityException expected) { }
-
-        try {
-            sm.checkSystemClipboardAccess();
-            throw new RuntimeException("SecurityException expected");
-        } catch (SecurityException expected) { }
-
-        try {
-            sm.checkTopLevelWindow(null);
-            throw new RuntimeException("NullPointException expected");
-        } catch (NullPointerException expected) { }
-
-        if (sm.checkTopLevelWindow(new Object())) {
-            throw new RuntimeException("checkTopLevelWindow expected to return false");
-        }
-    }
-}
--- a/test/jdk/java/lang/String/concat/StringConcatFactoryInvariants.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/jdk/java/lang/String/concat/StringConcatFactoryInvariants.java	Sat Dec 02 06:51:10 2017 +0100
@@ -282,6 +282,30 @@
         // Advanced factory: public Lookup is rejected
         fail("Passing public Lookup",
                 () -> StringConcatFactory.makeConcatWithConstants(MethodHandles.publicLookup(), methodName, mtEmpty, recipeEmpty));
+
+        // Zero inputs
+        {
+            MethodType zero = MethodType.methodType(String.class);
+            CallSite cs = StringConcatFactory.makeConcat(lookup, methodName, zero);
+            test("", (String) cs.getTarget().invokeExact());
+
+            cs = StringConcatFactory.makeConcatWithConstants(lookup, methodName, zero, "");
+            test("", (String) cs.getTarget().invokeExact());
+        }
+
+        // One input
+        {
+            MethodType zero = MethodType.methodType(String.class);
+            MethodType one = MethodType.methodType(String.class, String.class);
+            CallSite cs = StringConcatFactory.makeConcat(lookup, methodName, one);
+            test("A", (String) cs.getTarget().invokeExact("A"));
+
+            cs = StringConcatFactory.makeConcatWithConstants(lookup, methodName, one, "\1");
+            test("A", (String) cs.getTarget().invokeExact("A"));
+
+            cs = StringConcatFactory.makeConcatWithConstants(lookup, methodName, zero, "\2", "A");
+            test("A", (String) cs.getTarget().invokeExact());
+        }
     }
 
     public static void ok(String msg, Callable runnable) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/jar/JarFile/mrjar/TestVersionedStream.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,242 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8163798 8189611
+ * @summary basic tests for multi-release jar versioned streams
+ * @library /test/lib
+ * @modules jdk.jartool/sun.tools.jar java.base/jdk.internal.util.jar
+ * @build jdk.test.lib.Platform
+ *        jdk.test.lib.util.FileUtils
+ * @run testng TestVersionedStream
+ */
+
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import java.util.zip.ZipFile;
+
+import jdk.test.lib.util.FileUtils;
+
+public class TestVersionedStream {
+    private final Path userdir;
+    private final Set<String> unversionedEntryNames;
+
+    public TestVersionedStream() throws IOException {
+        userdir = Paths.get(System.getProperty("user.dir", "."));
+
+        // These are not real class files even though they end with .class.
+        // They are resource files so jar tool validation won't reject them.
+        // But they are what we want to test, especially q/Bar.class that
+        // could be in a concealed package if this was a modular multi-release
+        // jar.
+        createFiles(
+                "base/p/Bar.class",
+                "base/p/Foo.class",
+                "base/p/Main.class",
+                "v9/p/Foo.class",
+                "v10/p/Foo.class",
+                "v10/q/Bar.class",
+                "v11/p/Bar.class",
+                "v11/p/Foo.class"
+        );
+
+        jar("cf mmr.jar -C base . --release 9 -C v9 . " +
+                "--release 10 -C v10 . --release 11 -C v11 .");
+
+        System.out.println("Contents of mmr.jar\n=======");
+
+        try(JarFile jf = new JarFile("mmr.jar")) {
+            unversionedEntryNames = jf.stream()
+                    .map(je -> je.getName())
+                    .peek(System.out::println)
+                    .map(nm -> nm.startsWith("META-INF/versions/")
+                            ? nm.replaceFirst("META-INF/versions/\\d+/", "")
+                            : nm)
+                    .collect(Collectors.toCollection(LinkedHashSet::new));
+        }
+
+        System.out.println("=======");
+    }
+
+    @AfterClass
+    public void close() throws IOException {
+        Files.walk(userdir, 1)
+                .filter(p -> !p.equals(userdir))
+                .forEach(p -> {
+                    try {
+                        if (Files.isDirectory(p)) {
+                            FileUtils.deleteFileTreeWithRetry(p);
+                        } else {
+                            FileUtils.deleteFileIfExistsWithRetry(p);
+                        }
+                    } catch (IOException x) {
+                        throw new UncheckedIOException(x);
+                    }
+                });
+    }
+
+    @DataProvider
+    public Object[][] data() {
+        return new Object[][] {
+            {Runtime.Version.parse("8")},
+            {Runtime.Version.parse("9")},
+            {Runtime.Version.parse("10")},
+            {Runtime.Version.parse("11")},
+            {JarFile.baseVersion()},
+            {JarFile.runtimeVersion()}
+        };
+    }
+
+    @Test(dataProvider="data")
+    public void test(Runtime.Version version) throws Exception {
+        try (JarFile jf = new JarFile(new File("mmr.jar"), false, ZipFile.OPEN_READ, version);
+             Stream<JarEntry> jes = jf.versionedStream())
+        {
+            Assert.assertNotNull(jes);
+
+            // put versioned entries in list so we can reuse them
+            List<JarEntry> versionedEntries = jes.collect(Collectors.toList());
+
+            Assert.assertTrue(versionedEntries.size() > 0);
+
+            // also keep the names
+            List<String> versionedNames = new ArrayList<>(versionedEntries.size());
+
+            // verify the correct order while building enames
+            Iterator<String> allIt = unversionedEntryNames.iterator();
+            Iterator<JarEntry> verIt = versionedEntries.iterator();
+            boolean match = false;
+
+            while (verIt.hasNext()) {
+                match = false;
+                if (!allIt.hasNext()) break;
+                String name = verIt.next().getName();
+                versionedNames.add(name);
+                while (allIt.hasNext()) {
+                    if (name.equals(allIt.next())) {
+                        match = true;
+                        break;
+                    }
+                }
+            }
+            if (!match) {
+                Assert.fail("versioned entries not in same order as unversioned entries");
+            }
+
+            // verify the contents:
+            // value.[0] end of the path
+            // value.[1] versioned path/real name
+            Map<String,String[]> expected = new HashMap<>();
+
+            expected.put("p/Bar.class", new String[] { "base/p/Bar.class", "p/Bar.class" });
+            expected.put("p/Main.class", new String[] { "base/p/Main.class", "p/Main.class" });
+            switch (version.major()) {
+                case 8:
+                    expected.put("p/Foo.class", new String[]
+                        { "base/p/Foo.class", "p/Foo.class" });
+                    break;
+                case 9:
+                    expected.put("p/Foo.class", new String[]
+                        { "v9/p/Foo.class", "META-INF/versions/9/p/Foo.class" });
+                    break;
+                case 10:
+                    expected.put("p/Foo.class", new String[]
+                        { "v10/p/Foo.class", "META-INF/versions/10/p/Foo.class" });
+
+                    expected.put("q/Bar.class", new String[]
+                        { "v10/q/Bar.class", "META-INF/versions/10/q/Bar.class" });
+                    break;
+                case 11:
+                    expected.put("p/Bar.class", new String[]
+                        { "v11/p/Bar.class", "META-INF/versions/11/p/Bar.class"});
+                    expected.put("p/Foo.class", new String[]
+                        { "v11/p/Foo.class", "META-INF/versions/11/p/Foo.class"});
+                    expected.put("q/Bar.class", new String[]
+                        { "q/Bar.class", "META-INF/versions/10/q/Bar.class"});
+                    break;
+                default:
+                    Assert.fail("Test out of date, please add more cases");
+            }
+
+            expected.entrySet().stream().forEach(e -> {
+                String name = e.getKey();
+                int i = versionedNames.indexOf(name);
+                Assert.assertTrue(i != -1, name + " not in enames");
+                JarEntry je = versionedEntries.get(i);
+                try (InputStream is = jf.getInputStream(je)) {
+                    String s = new String(is.readAllBytes()).replaceAll(System.lineSeparator(), "");
+                    // end of the path
+                    Assert.assertTrue(s.endsWith(e.getValue()[0]), s);
+                    // getRealName()
+                    Assert.assertTrue(je.getRealName().equals(e.getValue()[1]));
+                } catch (IOException x) {
+                    throw new UncheckedIOException(x);
+                }
+            });
+        }
+    }
+
+    private void createFiles(String... files) {
+        ArrayList<String> list = new ArrayList();
+        Arrays.stream(files)
+                .map(f -> Paths.get(userdir.toAbsolutePath().toString(), f))
+                .forEach(p -> {
+                    try {
+                        Files.createDirectories(p.getParent());
+                        Files.createFile(p);
+                        list.clear();
+                        list.add(p.toString().replace(File.separatorChar, '/'));
+                        Files.write(p, list);
+                    } catch (IOException x) {
+                        throw new UncheckedIOException(x);
+                    }});
+    }
+
+    private void jar(String args) {
+        new sun.tools.jar.Main(System.out, System.err, "jar")
+                .run(args.split(" +"));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/imageio/plugins/png/PngLargeIHDRDimensionTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     8190332
+ * @summary Test verifies whether PNGImageReader throws IIOException
+ *          or not when IHDR width value is very high.
+ * @run     main PngLargeIHDRDimensionTest
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.Base64;
+import javax.imageio.IIOException;
+import javax.imageio.ImageIO;
+
+public class PngLargeIHDRDimensionTest {
+
+    /*
+     * IHDR width is very large and when we try to create buffer to store
+     * image information of each row it overflows and we get
+     * NegativeArraySizeException without the fix for this bug.
+     */
+    private static String negativeArraySizeExceptionInput = "iVBORw0KGgoAAAANS"
+            + "UhEUg////0AAAABEAIAAAA6fptVAAAACklEQVQYV2P4DwABAQEAWk1v8QAAAAB"
+            + "JRU5ErkJgggo=";
+
+    /*
+     * IHDR width is ((2 to the power of 31) - 2), which is the maximum VM
+     * limit to create an array we get OutOfMemoryError without the fix
+     * for this bug.
+     */
+    private static String outOfMemoryErrorInput = "iVBORw0KGgoAAAANSUhEUgAAAAF/"
+            + "///+CAAAAAA6fptVAAAACklEQVQYV2P4DwABAQEAWk1v8QAAAABJRU5"
+            + "ErkJgggo=";
+
+    private static InputStream input;
+    private static Boolean firstTestFailed = true, secondTestFailed = true;
+    public static void main(String[] args) throws java.io.IOException {
+        byte[] inputBytes = Base64.getDecoder().
+                decode(negativeArraySizeExceptionInput);
+        input = new ByteArrayInputStream(inputBytes);
+
+        try {
+            ImageIO.read(input);
+        } catch (IIOException e) {
+            firstTestFailed = false;
+        }
+
+        inputBytes = Base64.getDecoder().decode(outOfMemoryErrorInput);
+        input = new ByteArrayInputStream(inputBytes);
+
+        try {
+            ImageIO.read(input);
+        } catch (IIOException e) {
+            secondTestFailed = false;
+        }
+
+        if (firstTestFailed || secondTestFailed) {
+            throw new RuntimeException("Test doesn't throw required"
+                    + " IIOException");
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/imageio/plugins/png/PngMultipleImageReadTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     8191431
+ * @summary Test verifies that whether we can use same PNGImageReader instance
+ *          to read multiple images or not. It also verifies whether
+ *          imageStartPosition in PNGImageReader is updated properly when we
+ *          use same PNGImageReader instance to read multiple images.
+ * @run     main PngMultipleImageReadTest
+ */
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReadParam;
+import javax.imageio.ImageReader;
+import javax.imageio.stream.ImageInputStream;
+
+public class PngMultipleImageReadTest {
+
+    private static final ImageReader PNG_READER =
+            ImageIO.getImageReadersByMIMEType("image/png").next();
+
+    public static void main(String[] args) throws IOException {
+
+        /*
+         * First we create a PNG image without palette so that the IDAT
+         * start position in the stream is at some position 'x'.
+         */
+        BufferedImage imageWithoutPalette =
+                new BufferedImage(20, 20, BufferedImage.TYPE_INT_ARGB);
+        Graphics2D g1 = imageWithoutPalette.createGraphics();
+        g1.setColor(Color.WHITE);
+        g1.fillRect(0, 0, 20, 20);
+        g1.dispose();
+        // write and read the image without palette
+        writeAndReadImage(imageWithoutPalette);
+
+        /*
+         * We create another PNG image with PLTE(palette) chunk so that
+         * now the IDAT start position is at some 'x + y'.
+         */
+        IndexColorModel cm = new IndexColorModel(
+                3,
+                1,
+                new byte[]{10}, // r
+                new byte[]{10}, // g
+                new byte[]{10}); // b
+        BufferedImage imageWithPalette = new BufferedImage(
+                10, 10,
+                BufferedImage.TYPE_BYTE_INDEXED,
+                cm);
+        Graphics2D g2 = imageWithPalette.createGraphics();
+        g2.setColor(Color.BLACK);
+        g2.fillRect(0, 0, 10, 10);
+        g2.dispose();
+        // write and read the image with palette
+        writeAndReadImage(imageWithPalette);
+    }
+
+    private static void writeAndReadImage(BufferedImage image)
+            throws IOException {
+        File output = File.createTempFile("output", ".png");
+        ImageInputStream stream = null;
+        try {
+            ImageIO.write(image, "png", output);
+
+            stream = ImageIO.createImageInputStream(output);
+            ImageReadParam param = PNG_READER.getDefaultReadParam();
+            PNG_READER.setInput(stream, true, true);
+            PNG_READER.read(0, param);
+        } finally {
+            if (stream != null) {
+                stream.close();
+            }
+            Files.delete(output.toPath());
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/Cert.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * The certificates and corresponding private keys used by the test.
+ * All of certificates uses relative weak key size and hash algorithm, then
+ * all JDK releases can load them. Accordingly, a custom java.security file is
+ * provided to make sure such weak key sizes and algorithms are not blocked by
+ * any JDK build.
+ */
+public enum Cert {
+
+    // This certificate is generated by the below command:
+    // openssl req -x509 -newkey rsa:1024 -days 7300 \
+    //     -subj "/CN=RSA_SHA1_1024" -sha1 \
+    //     -keyout key.pem -out cert.pem
+    RSA_SHA1_1024(
+            SignatureAlgorithm.RSA,
+            "-----BEGIN CERTIFICATE-----\n" +
+            "MIIB/jCCAWegAwIBAgIJANPuKkD7/jxkMA0GCSqGSIb3DQEBBQUAMBgxFjAUBgNV\n" +
+            "BAMMDVJTQV9TSEExXzEwMjQwHhcNMTcwOTA3MDIwNTM0WhcNMzcwOTAyMDIwNTM0\n" +
+            "WjAYMRYwFAYDVQQDDA1SU0FfU0hBMV8xMDI0MIGfMA0GCSqGSIb3DQEBAQUAA4GN\n" +
+            "ADCBiQKBgQC3v7UeIxD5bdv4mqwcpah7sNxpI3IxUFzI2ao1g1jVzDPZt9Zawa3K\n" +
+            "H+m9al1Fg2X1dyNeRlbiXavcIZOQwZqNj08zJEwAdICP8iOnXQ2HUv5cpzArOPTu\n" +
+            "GY3flhf39xgiWsSdfb+cP0QsWNagNU8EtebbHndv8W+2K5JEdlpwQQIDAQABo1Aw\n" +
+            "TjAdBgNVHQ4EFgQU32KqdiGyzg39chNt/OwQzGOlUyAwHwYDVR0jBBgwFoAU32Kq\n" +
+            "diGyzg39chNt/OwQzGOlUyAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOB\n" +
+            "gQAWx8y45IIWWhy44cuQs0qcSDQihIvhXB3pvlpCNdfsSrVoaaH8lrOVjTC718ip\n" +
+            "fE1sF8I9niLHUg8WrAzdQRDsKyUhDUhEEJ7w1ffxwf8bcI9+NgWwEix0Dazzkub8\n" +
+            "2IRXuZ3dGwzoI54XtxvKMFH86nJEj4M/XQGrc9bnlhcn4g==\n" +
+            "-----END CERTIFICATE-----",
+            "30820278020100300d06092a864886f70d0101010500048202623082025e0201" +
+            "0002818100b7bfb51e2310f96ddbf89aac1ca5a87bb0dc69237231505cc8d9aa" +
+            "358358d5cc33d9b7d65ac1adca1fe9bd6a5d458365f577235e4656e25dabdc21" +
+            "9390c19a8d8f4f33244c0074808ff223a75d0d8752fe5ca7302b38f4ee198ddf" +
+            "9617f7f718225ac49d7dbf9c3f442c58d6a0354f04b5e6db1e776ff16fb62b92" +
+            "44765a7041020301000102818100b2c5afdf5c5a9d72c73b7eb0c9465b3fcc79" +
+            "0549d946255bc0861555ef2eb503f1c67757f400cfa7019996123020fb906d5b" +
+            "b66b789ffba90b16270cbd1fbfcf285a821dcdc78fd8f17f399eb231ce9724db" +
+            "af60f9dd20f3e57bb4c0f9fdc9069589b82d442dd868d48c031eb782e27f9e70" +
+            "8469f9b3d5b1b23cee5bf1b41781024100dec184ea77c2126c6bc0c01ba727b4" +
+            "642587d63811240932334dc80c7976e0f715f156e52b352a25e5c52542af2b5f" +
+            "68a29a9b68858f313c4375cc78ec03d859024100d32be8375f52cbe904002321" +
+            "6977aee83fa88bf536d4052d2ed578727d7b7e5aeef91fc52b34c1b6638c00f0" +
+            "4c6985fdaaa2d6e72adbcc7d10ed8bafff69da29024100ae8210acd6f13519b7" +
+            "38a3c7862636ce1610daa3c5d9e3526e9acad3eafc54b57d7d3a44029b7dcf7e" +
+            "b7f9beca1842806892929949b8aa2bb9f5b9202a55c0d1024100887dc0c2c9a2" +
+            "429a823374818c2207b3a631d304d443867505e884c9bbc1ae9228146e2c8b18" +
+            "b67ca52b411010d3c3ff89e366f454076dcd08bc01a5e8790ac102402321988a" +
+            "2003e19c878791d402a7c0acdd1b6dd27203ed88f86a0e3a390ee57c0cd277f3" +
+            "ea5df6440dbc8bdb4c8b3c28fc77e6991bc4ed3f4dc0619a5b953e8e"),
+
+    // This certificate is generated by the below command:
+    // openssl req -x509 -newkey rsa:1024 -days 7300 \
+    //     -subj "/CN=www.example.com" -sha1 \
+    //     -keyout key.pem -out cert.pem
+    RSA_EXAMPLE_SHA1_1024(
+            SignatureAlgorithm.RSA,
+            "-----BEGIN CERTIFICATE-----\n" +
+            "MIICAjCCAWugAwIBAgIJAK6TC9eDtZg4MA0GCSqGSIb3DQEBBQUAMBoxGDAWBgNV\n" +
+            "BAMMD3d3dy5leGFtcGxlLmNvbTAeFw0xNzExMDIwNTA5NDRaFw0zNzEwMjgwNTA5\n" +
+            "NDRaMBoxGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTCBnzANBgkqhkiG9w0BAQEF\n" +
+            "AAOBjQAwgYkCgYEAtt5kxFTzJuoxJR2UgeXUxCw7TfL3FeK3lCrU3vruBe3XKKvF\n" +
+            "oyCxf/B5ucm22gzMfOvJBWRg6KrNTrXGI1LtlmAYNDM5J0lK2N/neKOm3Qxe0d1W\n" +
+            "AZ1lwgrMNirsWu+r4UPNMq5UohL5nqVU9WwVa12t0GF3er3k32tMTBqSclcCAwEA\n" +
+            "AaNQME4wHQYDVR0OBBYEFNc8tKGfZdFyaY0ZslwGLt1kpRYAMB8GA1UdIwQYMBaA\n" +
+            "FNc8tKGfZdFyaY0ZslwGLt1kpRYAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEF\n" +
+            "BQADgYEAc71ZO83YEw9WvhxDEng9tMYUhJnNZJss6+gfWjZ487aiEGnS+VgKsHWz\n" +
+            "DBLBrYe9Ag5L9f1HtPNheUbnhhBbQ607jOG/wfmpi4VoU3myB5uxOfeAZdXDOB5x\n" +
+            "bv3t7KcEhgmPjB/e123jrBK8qnAYmDlQVlkZScctB3I1OuA2Po4=\n" +
+            "-----END CERTIFICATE-----",
+            "30820277020100300d06092a864886f70d0101010500048202613082025d0201" +
+            "0002818100b6de64c454f326ea31251d9481e5d4c42c3b4df2f715e2b7942ad4" +
+            "defaee05edd728abc5a320b17ff079b9c9b6da0ccc7cebc9056460e8aacd4eb5" +
+            "c62352ed96601834333927494ad8dfe778a3a6dd0c5ed1dd56019d65c20acc36" +
+            "2aec5aefabe143cd32ae54a212f99ea554f56c156b5dadd061777abde4df6b4c" +
+            "4c1a927257020301000102818048af52bc1acbdededd13d4930fa28b9441c47c" +
+            "b222f5c6fc92df07676db3a815a61c9b51de0a03a347b10a609bd6459a0dd926" +
+            "38877261686a5c6bb1ca9e8ea2373870af7685e7d6cebd66faba65af2ef04bd9" +
+            "1244ae56900fcd6ce11207d8c4040176e4ba9fef3d563741a1027b229134cfe1" +
+            "c0a90d9c8eba9ce6349835e769024100e82494b6f777c784ffc29298d033e11d" +
+            "af46f0d464c4dbd950d46bcd697d0f0b49a77699f0111d408e8748f2b461ab8f" +
+            "210071c9c20d8ecee3ae229cb9c3954b024100c9a976f0011fcdc0ca7fb2f679" +
+            "974fa85d420c604ca7ff64fe4667a44f73088eef290d22195474039760e99325" +
+            "3ca45ee444588b150467d14451d3c45dab0ba5024019df39d3ca70c703c39d63" +
+            "c9342b1403c2ed1d1a0ec101df8e6a9e391e7099a4a068d187068261c8381a4b" +
+            "bf00eb81bb49ea4ac439a4592e25a1daa9acea67510241008c4640007497bdd4" +
+            "94473da26b33d06a29ecae9531dd4e2edf1cf42cfc42e53a1fac2b8183a3164c" +
+            "053999600c6fe15a4c682a3b1cb482ceb33a4416fc9ce52d024100e4f08cd10a" +
+            "5c8face0b20db86443d0a42e34dfdde236dae4f042a06dd3aff7ca159f8aa3b7" +
+            "854df41d510148096155204f2bf46c4a96e271747a4126a66ade6c"),
+
+    // This certificate is generated by the below commands:
+    // openssl dsaparam -genkey 1024 -out key.pem
+    // openssl req -x509 -new -key key.pem -days 7300 \
+    //     -subj "/CN=DSA_SHA1_1024" -sha1 -out cert.pem
+    DSA_SHA1_1024(
+            SignatureAlgorithm.DSA,
+            "-----BEGIN CERTIFICATE-----\n" +
+            "MIICuzCCAnugAwIBAgIJAMAMLRrhQWQFMAkGByqGSM44BAMwGDEWMBQGA1UEAwwN\n" +
+            "RFNBX1NIQTFfMTAyNDAeFw0xNzExMDIwNjA4MDRaFw0zNzEwMjgwNjA4MDRaMBgx\n" +
+            "FjAUBgNVBAMMDURTQV9TSEExXzEwMjQwggG2MIIBKwYHKoZIzjgEATCCAR4CgYEA\n" +
+            "8CspE1sE84pJ4YxzVHFEDNJvBaIxsbax03pDwNHr/ogP9PVwF9z1jT6hpC5WluHG\n" +
+            "g5n5gqpF2XpBhX2fKm1qqZWRxNvHKo0+zzAhUqMrvRJqcjlL4ijXndHldt67/VKS\n" +
+            "0eTKi9m64c+yJx80YYphCO5b93d2sTM29z8QZOlrbD8CFQCmttKnPAOk4uz8Z8cV\n" +
+            "uPGeGOMB9wKBgCItgPpAjW0srIwCaDysDNpydX6hB+1NTy1gFYl24n8edLGbR0mZ\n" +
+            "isteBd6LjMtgicRmtKZzKxW7igxoVvR3WHpTucFjms5NRNjPaj5wt3DxoXn4hyWk\n" +
+            "LzMvDeBvi+jKJiO0jnQ3+1NDOlAQy6ukeH59/gxZ3UmcNxDlAQ/IYHcpA4GEAAKB\n" +
+            "gEgvi72gL+zax7Y2hg4PL1PqZx2jFp0XlTIugiTrcsGytrAnn+/s2+3xVyVyvVMn\n" +
+            "0z5yL5eP9cdGA7qV1+7n6KJ8jNAhLCBSiC6x5ekd88aTlqnmt5lstk4w0Q0zSa58\n" +
+            "Hp6dCFg2Irk6Z9ERKaXJJBBS6reaFeATVROhN/LEEzzvo1AwTjAdBgNVHQ4EFgQU\n" +
+            "jb+HHABclGNR4lpf19nHFZpfwPQwHwYDVR0jBBgwFoAUjb+HHABclGNR4lpf19nH\n" +
+            "FZpfwPQwDAYDVR0TBAUwAwEB/zAJBgcqhkjOOAQDAy8AMCwCFDB3F/m6jsZdHaoy\n" +
+            "1xTp2U8uHBO+AhQYzeJuJd8/qRSDVLs8mesE8TQg2g==\n" +
+            "-----END CERTIFICATE-----",
+            "3082014a0201003082012b06072a8648ce3804013082011e02818100f02b2913" +
+            "5b04f38a49e18c735471440cd26f05a231b1b6b1d37a43c0d1ebfe880ff4f570" +
+            "17dcf58d3ea1a42e5696e1c68399f982aa45d97a41857d9f2a6d6aa99591c4db" +
+            "c72a8d3ecf302152a32bbd126a72394be228d79dd1e576debbfd5292d1e4ca8b" +
+            "d9bae1cfb2271f34618a6108ee5bf77776b13336f73f1064e96b6c3f021500a6" +
+            "b6d2a73c03a4e2ecfc67c715b8f19e18e301f7028180222d80fa408d6d2cac8c" +
+            "02683cac0cda72757ea107ed4d4f2d60158976e27f1e74b19b4749998acb5e05" +
+            "de8b8ccb6089c466b4a6732b15bb8a0c6856f477587a53b9c1639ace4d44d8cf" +
+            "6a3e70b770f1a179f88725a42f332f0de06f8be8ca2623b48e7437fb53433a50" +
+            "10cbaba4787e7dfe0c59dd499c3710e5010fc8607729041602146ef9db36045f" +
+            "bcd8c7fd82ba29c5c5057ed11c7f"),
+
+    // This certificate is generated by the below commands:
+    // openssl dsaparam -genkey 1024 -out key.pem
+    // openssl req -x509 -new -key key.pem -days 7300 \
+    //     -subj "/CN=www.example.com" -sha1 -out cert.pem
+    DSA_EXAMPLE_SHA1_1024(
+            SignatureAlgorithm.DSA,
+            "-----BEGIN CERTIFICATE-----\n" +
+            "MIICwDCCAoCgAwIBAgIJAI5mKbdK5ZqyMAkGByqGSM44BAMwGjEYMBYGA1UEAwwP\n" +
+            "d3d3LmV4YW1wbGUuY29tMB4XDTE3MTEwMjA1NDczOVoXDTM3MTAyODA1NDczOVow\n" +
+            "GjEYMBYGA1UEAwwPd3d3LmV4YW1wbGUuY29tMIIBtzCCASwGByqGSM44BAEwggEf\n" +
+            "AoGBANVGWRSlxVZQKlVrTDcU/6Mr8QFlR3kGKmkvdbTHH1EhcP7YlZ7CJ30VBDbN\n" +
+            "LS2HvN3HHNooJ7hHBheL5Yz8EZIUa95TzPukZ1TmCo9fufR5i9HWj9Z8jLhyqx3l\n" +
+            "iUZOYN9H0MSn4ftK6dr5oTz2ZGYDblXDCq6R8qZfuw1URFqrAhUArx0nmGEI/1S/\n" +
+            "qyxnV4I6ItOntxMCgYEAxZKIZ/7aOGfzaQG2wRFdD/viHBZkkcxCsgmPUroQVUIw\n" +
+            "dqmUnfYk8cb02LCevhhSwcjfocQsA3y1jufIUdWaHuIB9W3EsFJQNd/Byh9j/pRD\n" +
+            "7zH/8lnBzJh2S7y10Vg840STVo5+ekZb4E+W7KK5gUaEQ6kAtUIIB0xjNz7RWs4D\n" +
+            "gYQAAoGAPVQKWqJSlMrbU4XEsx50Ur8P84CwMnS7WcQNLnih1ScaK2BijgVj5Fny\n" +
+            "9JZxITwj7XD7FWriq3kTjbydi3iAvrgVWij79x5Z7fTRCuoBVmtnAFkVGalwbGr2\n" +
+            "ghz70y6hep2Evb1pRCrHjRkMaJFE5Y2CA7VbpKoat+j47/LkXJ2jUDBOMB0GA1Ud\n" +
+            "DgQWBBSVjWy3SpaDfnFo+37mZJqX2aybzTAfBgNVHSMEGDAWgBSVjWy3SpaDfnFo\n" +
+            "+37mZJqX2aybzTAMBgNVHRMEBTADAQH/MAkGByqGSM44BAMDLwAwLAIUd5NOlcfX\n" +
+            "5rakT9H8UzlFcFQLr0MCFGrEYvlFUf/HJOH4FwXS2jEholBB\n" +
+            "-----END CERTIFICATE-----",
+            "3082014c0201003082012c06072a8648ce3804013082011f02818100d5465914" +
+            "a5c556502a556b4c3714ffa32bf101654779062a692f75b4c71f512170fed895" +
+            "9ec2277d150436cd2d2d87bcddc71cda2827b84706178be58cfc1192146bde53" +
+            "ccfba46754e60a8f5fb9f4798bd1d68fd67c8cb872ab1de589464e60df47d0c4" +
+            "a7e1fb4ae9daf9a13cf66466036e55c30aae91f2a65fbb0d54445aab021500af" +
+            "1d27986108ff54bfab2c6757823a22d3a7b71302818100c5928867feda3867f3" +
+            "6901b6c1115d0ffbe21c166491cc42b2098f52ba1055423076a9949df624f1c6" +
+            "f4d8b09ebe1852c1c8dfa1c42c037cb58ee7c851d59a1ee201f56dc4b0525035" +
+            "dfc1ca1f63fe9443ef31fff259c1cc98764bbcb5d1583ce34493568e7e7a465b" +
+            "e04f96eca2b981468443a900b54208074c63373ed15ace0417021500abf47692" +
+            "88c6ac41e2802e7eb7addba367339318"),
+
+    // This certificate is generated by the below commands:
+    // openssl ecparam -name prime256v1 -genkey -out key.pem
+    // openssl req -new -key key.pem -x509 -nodes -days 7300 \
+    //     -subj "/CN=ECDSA_SHA1_prime256v1" -sha1 -out cert.pem
+    ECDSA_SHA1_PRIME256V1(
+            SignatureAlgorithm.ECDSA,
+            "-----BEGIN CERTIFICATE-----\n" +
+            "MIIBhDCCASygAwIBAgIJAKW4wuujp9JbMAkGByqGSM49BAEwIDEeMBwGA1UEAwwV\n" +
+            "RUNEU0FfU0hBMV9wcmltZTI1NnYxMB4XDTE3MDkwNzAyMTA0MVoXDTM3MDkwMjAy\n" +
+            "MTA0MVowIDEeMBwGA1UEAwwVRUNEU0FfU0hBMV9wcmltZTI1NnYxMFkwEwYHKoZI\n" +
+            "zj0CAQYIKoZIzj0DAQcDQgAEdbE+AMwsFBf73YXRVwsvsx2dMt1xgDxj/4pN+BfY\n" +
+            "LWnO94beeZcrCJ1/N8CHmDOce7KRDR6/9kpi20wFAVXZ3KNQME4wHQYDVR0OBBYE\n" +
+            "FA/hB2ODDNdz1JF08u2uhknhlsVoMB8GA1UdIwQYMBaAFA/hB2ODDNdz1JF08u2u\n" +
+            "hknhlsVoMAwGA1UdEwQFMAMBAf8wCQYHKoZIzj0EAQNHADBEAiBNxv2L2FW+6+w/\n" +
+            "QtDe+YSUNRj3F8QrpLkfGk7rVaOiHQIgVF2pWJ5ytg0pbCuO8Bh+UZ7zfZUD03s8\n" +
+            "ZuIYW7RtMe0=\n" +
+            "-----END CERTIFICATE-----",
+            "308187020100301306072a8648ce3d020106082a8648ce3d030107046d306b02" +
+            "010104204d901d5efd0e3def78d5307788a4c760115effce4b9e2c31ae5860b6" +
+            "c11915aca1440342000475b13e00cc2c1417fbdd85d1570b2fb31d9d32dd7180" +
+            "3c63ff8a4df817d82d69cef786de79972b089d7f37c08798339c7bb2910d1ebf" +
+            "f64a62db4c050155d9dc"),
+
+    // This certificate is generated by the below commands:
+    // openssl ecparam -name prime256v1 -genkey -out key.pem
+    // openssl req -new -key key.pem -x509 -nodes -days 7300 \
+    //     -subj "/CN=www.example.com" -sha1 -out cert.pem
+    ECDSA_EXAMPLE_SHA1_PRIME256V1(
+            SignatureAlgorithm.ECDSA,
+            "-----BEGIN CERTIFICATE-----\n" +
+            "MIIBeDCCASCgAwIBAgIJAMxOXBpiJ5mDMAkGByqGSM49BAEwGjEYMBYGA1UEAwwP\n" +
+            "d3d3LmV4YW1wbGUuY29tMB4XDTE3MTEwMjA1MTg0MVoXDTM3MTAyODA1MTg0MVow\n" +
+            "GjEYMBYGA1UEAwwPd3d3LmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D\n" +
+            "AQcDQgAER9IyuwyrJ7X9DmIqGC3YNTlWBt4Fo/Y3RnlcxhTVxb/ZAYVNhqe4MbSM\n" +
+            "2nsVnYMjjXXDav1plNKvmgGDf9s/saNQME4wHQYDVR0OBBYEFHNUTaIIEA89uNKH\n" +
+            "OOUgJ981Qj5HMB8GA1UdIwQYMBaAFHNUTaIIEA89uNKHOOUgJ981Qj5HMAwGA1Ud\n" +
+            "EwQFMAMBAf8wCQYHKoZIzj0EAQNHADBEAiBCW59S1nE15j8euO6/q9bM6J9Ci5xJ\n" +
+            "WWAVznGGxnS/HgIgFaFKC31uxTXoBN7QN0yW/umQgJ0nsjwj7Pnxc0wNyw8=\n" +
+            "-----END CERTIFICATE-----",
+            "308187020100301306072a8648ce3d020106082a8648ce3d030107046d306b02" +
+            "010104209aa3784cd0c1fe0553e59b3c7b8f08c8fdaffd94f34e2c1683243a79" +
+            "7b64b673a1440342000447d232bb0cab27b5fd0e622a182dd835395606de05a3" +
+            "f63746795cc614d5c5bfd901854d86a7b831b48cda7b159d83238d75c36afd69" +
+            "94d2af9a01837fdb3fb1");
+
+    public final SignatureAlgorithm signatureAlgorithm;
+    public final String certMaterials;
+    public final String privKeyMaterials;
+
+    private Cert(
+            SignatureAlgorithm signatureAlgorithm,
+            String certMaterials,
+            String privKeyMaterials) {
+        this.signatureAlgorithm = signatureAlgorithm;
+        this.certMaterials = certMaterials;
+        this.privKeyMaterials = privKeyMaterials;
+    }
+
+    // Two certificates (mainCert and exampleCert) are selected to respect the
+    // specified cipher suite. SNI-associated cases specify exampleCert as desired.
+    public static Cert[] getCerts(String cipherSuite) {
+        Cert mainCert = Cert.DSA_SHA1_1024;
+        Cert exampleCert = Cert.DSA_EXAMPLE_SHA1_1024;
+        if (cipherSuite.contains("_ECDHE_RSA_")) {
+            mainCert = Cert.RSA_SHA1_1024;
+            exampleCert = Cert.RSA_EXAMPLE_SHA1_1024;
+        } else if (cipherSuite.contains("_EC")) {
+            mainCert = Cert.ECDSA_SHA1_PRIME256V1;
+            exampleCert = Cert.ECDSA_EXAMPLE_SHA1_PRIME256V1;
+        } else if (cipherSuite.contains("_RSA")) {
+            mainCert = Cert.RSA_SHA1_1024;
+            exampleCert = Cert.RSA_EXAMPLE_SHA1_1024;
+        }
+        System.out.printf("mainCert=%s, exampleCert=%s%n",
+                mainCert, exampleCert);
+        return new Cert[] { mainCert, exampleCert };
+    }
+}
+
+enum SignatureAlgorithm {
+
+    RSA, DSA, ECDSA;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/Client.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLParameters;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSocketFactory;
+
+/*
+ * A simple SSL socket client.
+ */
+public class Client {
+
+    private final SSLSocket socket;
+
+    public Client(SSLContext context) throws Exception {
+        SSLSocketFactory socketFactory = context.getSocketFactory();
+        socket = (SSLSocket) socketFactory.createSocket();
+        socket.setSoTimeout(Utils.TIMEOUT);
+    }
+
+    public Client(Cert... certs) throws Exception {
+        this(Utils.createSSLContext(certs));
+    }
+
+    private SSLSession getSession() {
+        return socket.getSession();
+    }
+
+    private void setEnabledCipherSuites(String... cipherSuites) {
+        socket.setEnabledCipherSuites(cipherSuites);
+    }
+
+    private void setEnabledProtocols(String... protocols) {
+        socket.setEnabledProtocols(protocols);
+    }
+
+    @SuppressWarnings(value = { "unchecked", "rawtypes" })
+    private void setServerName(String hostname) {
+        List serverNames = new ArrayList();
+        serverNames.add(createSNIHostName(hostname));
+        SSLParameters params = socket.getSSLParameters();
+        params.setServerNames(serverNames);
+        socket.setSSLParameters(params);
+    }
+
+    // Create SNIHostName via reflection due to pre-8 JDK builds don't support
+    // SNI. Those JDK builds cannot find classes SNIServerName and SNIHostName.
+    private Object createSNIHostName(String hostname) {
+        try {
+            Class<?> clazz = Class.forName("javax.net.ssl.SNIHostName");
+            return clazz.getConstructor(String.class).newInstance(hostname);
+        } catch (Exception e) {
+            throw new RuntimeException("Creates SNIHostName failed!", e);
+        }
+    }
+
+    private void setApplicationProtocols(String... protocols) {
+        SSLParameters params = socket.getSSLParameters();
+        params.setApplicationProtocols(protocols);
+        socket.setSSLParameters(params);
+    }
+
+    private String getNegotiatedApplicationProtocol() {
+        return socket.getApplicationProtocol();
+    }
+
+    private void oneTimeConnect(String host, int port) throws IOException {
+        socket.connect(new InetSocketAddress(host, port));
+
+        OutputStream out = socket.getOutputStream();
+        out.write('C');
+        out.flush();
+
+        InputStream in = socket.getInputStream();
+        in.read();
+    }
+
+    public void close() throws IOException {
+        socket.close();
+    }
+
+    public static void main(String[] args) throws IOException {
+        System.out.println("----- Client start -----");
+        int port = Integer.valueOf(System.getProperty(Utils.PROP_PORT));
+
+        String protocol = System.getProperty(Utils.PROP_PROTOCOL);
+        String cipherSuite = System.getProperty(Utils.PROP_CIPHER_SUITE);
+        String serverName = System.getProperty(Utils.PROP_SERVER_NAME);
+        String appProtocols = System.getProperty(Utils.PROP_APP_PROTOCOLS);
+        boolean supportsSNIOnServer
+                = Utils.getBoolProperty(Utils.PROP_SUPPORTS_SNI_ON_SERVER);
+        boolean supportsSNIOnClient
+                = Utils.getBoolProperty(Utils.PROP_SUPPORTS_SNI_ON_CLIENT);
+        boolean supportsALPNOnServer
+                = Utils.getBoolProperty(Utils.PROP_SUPPORTS_ALPN_ON_SERVER);
+        boolean supportsALPNOnClient
+                = Utils.getBoolProperty(Utils.PROP_SUPPORTS_ALPN_ON_CLIENT);
+        boolean negativeCase
+                = Utils.getBoolProperty(Utils.PROP_NEGATIVE_CASE_ON_CLIENT);
+        System.out.println(Utils.join(Utils.PARAM_DELIMITER,
+                "ClientJDK=" + System.getProperty(Utils.PROP_CLIENT_JDK),
+                "Protocol=" + protocol,
+                "CipherSuite=" + cipherSuite,
+                "ServerName=" + serverName,
+                "AppProtocols=" + appProtocols));
+
+        Status status = Status.SUCCESS;
+        Client client = null;
+        try {
+            client = new Client(Cert.getCerts(cipherSuite));
+            client.setEnabledProtocols(protocol);
+            client.setEnabledCipherSuites(cipherSuite);
+
+            if (serverName != null) {
+                if (supportsSNIOnClient) {
+                    client.setServerName(serverName);
+                } else {
+                    System.out.println(
+                            "Ignored due to client doesn't support SNI.");
+                }
+            }
+
+            if (appProtocols != null) {
+                if (supportsALPNOnClient) {
+                    client.setApplicationProtocols(
+                            Utils.split(appProtocols, Utils.VALUE_DELIMITER));
+                } else {
+                    System.out.println(
+                            "Ignored due to client doesn't support ALPN.");
+                }
+            }
+
+            client.oneTimeConnect("localhost", port);
+
+            if (serverName != null && supportsSNIOnServer
+                    && supportsSNIOnClient) {
+                X509Certificate cert
+                        = (X509Certificate) client.getSession().getPeerCertificates()[0];
+                String subject
+                        = cert.getSubjectX500Principal().getName();
+                if (!subject.contains(serverName)) {
+                    System.out.println("Unexpected server: " + subject);
+                    status = Status.FAIL;
+                }
+            }
+
+            if (appProtocols != null && supportsALPNOnServer
+                    && supportsALPNOnClient) {
+                String negoAppProtocol
+                        = client.getNegotiatedApplicationProtocol();
+                String expectedNegoAppProtocol
+                        = System.getProperty(Utils.PROP_NEGO_APP_PROTOCOL);
+                if (!expectedNegoAppProtocol.equals(negoAppProtocol)) {
+                    System.out.println("Unexpected negotiated app protocol: "
+                            + negoAppProtocol);
+                    status = Status.FAIL;
+                }
+            }
+
+            if (status != Status.FAIL) {
+                status = negativeCase
+                       ? Status.UNEXPECTED_SUCCESS
+                       : Status.SUCCESS;
+            }
+        } catch (Exception exception) {
+            status = Utils.handleException(exception, negativeCase);
+        } finally {
+            if (client != null) {
+                client.close();
+            }
+        }
+
+        System.out.println("STATUS: " + status);
+        System.out.println("----- Client end -----");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/Compatibility.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary This test is used to check the interop compatibility on JSSE among
+ *     different JDK releases.
+ *     Note that, this is a manual test. For more details about the test and
+ *     its usages, please look through README.
+ *
+ * @library /test/lib
+ * @compile -source 1.6 -target 1.6 JdkUtils.java Parameter.java Server.java Client.java
+ * @run main/manual Compatibility
+ */
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+import jdk.test.lib.process.OutputAnalyzer;
+
+public class Compatibility {
+
+    public static void main(String[] args) throws Throwable {
+        String javaSecurityFile
+                = System.getProperty("test.src") + "/java.security";
+        boolean debug = Utils.getBoolProperty("debug");
+
+        Set<JdkInfo> jdkInfos = jdkInfoList();
+
+        System.out.println("Test start");
+
+        List<TestCase> testCases = new ArrayList<>();
+        ExecutorService executor = Executors.newCachedThreadPool();
+        PrintStream origStdOut = System.out;
+        PrintStream origStdErr = System.err;
+
+        try (PrintStream printStream = new PrintStream(
+                new FileOutputStream(Utils.TEST_LOG, true))) {
+            System.setOut(printStream);
+            System.setErr(printStream);
+
+            System.out.println(Utils.startHtml());
+            System.out.println(Utils.startPre());
+
+            for (UseCase useCase : UseCase.getAllUseCases()) {
+                for (JdkInfo serverJdk : jdkInfos) {
+                    if (useCase.ignoredByJdk(serverJdk)) {
+                        continue;
+                    }
+
+                    Map<String, String> props = new LinkedHashMap<>();
+                    if (debug) {
+                        props.put("javax.net.debug", "ssl");
+                    }
+                    props.put("java.security.properties", javaSecurityFile);
+
+                    props.put(Utils.PROP_PROTOCOL, useCase.protocol.version);
+                    props.put(Utils.PROP_CIPHER_SUITE, useCase.cipherSuite.name());
+                    props.put(Utils.PROP_CLIENT_AUTH, useCase.clientAuth.name());
+                    if (useCase.appProtocol != AppProtocol.NONE) {
+                        props.put(Utils.PROP_APP_PROTOCOLS,
+                                Utils.join(Utils.VALUE_DELIMITER,
+                                        useCase.appProtocol.appProtocols));
+                        props.put(Utils.PROP_NEGO_APP_PROTOCOL,
+                                useCase.appProtocol.negoAppProtocol);
+                    }
+                    props.put(Utils.PROP_SERVER_JDK, serverJdk.version);
+
+                    props.put(Utils.PROP_SUPPORTS_SNI_ON_SERVER,
+                            serverJdk.supportsSNI + "");
+                    props.put(Utils.PROP_SUPPORTS_ALPN_ON_SERVER,
+                            serverJdk.supportsALPN + "");
+
+                    for (JdkInfo clientJdk : jdkInfos) {
+                        if (useCase.ignoredByJdk(clientJdk)) {
+                            continue;
+                        }
+
+                        TestCase testCase = new TestCase(serverJdk, clientJdk,
+                                useCase);
+                        System.out.println(Utils.anchorName(testCase.toString(),
+                                "----- Case start -----"));
+                        System.out.println(testCase.toString());
+
+                        props.put(Utils.PROP_NEGATIVE_CASE_ON_SERVER,
+                                testCase.negativeCaseOnServer + "");
+                        props.put(Utils.PROP_NEGATIVE_CASE_ON_CLIENT,
+                                testCase.negativeCaseOnClient + "");
+
+                        Future<OutputAnalyzer> serverFuture = executor.submit(() -> {
+                            return runServer(serverJdk.jdkPath, props);
+                        });
+                        int port = waitForServerStarted();
+                        System.out.println("port=" + port);
+
+                        props.put(Utils.PROP_PORT, port + "");
+
+                        props.put(Utils.PROP_CLIENT_JDK, clientJdk.version);
+
+                        props.put(Utils.PROP_SUPPORTS_SNI_ON_CLIENT,
+                                clientJdk.supportsSNI + "");
+                        props.put(Utils.PROP_SUPPORTS_ALPN_ON_CLIENT,
+                                clientJdk.supportsALPN + "");
+                        if (useCase.serverName != ServerName.NONE) {
+                            props.put(Utils.PROP_SERVER_NAME,
+                                    useCase.serverName.name);
+                        }
+
+                        Status clientStatus = null;
+                        if (port != -1) {
+                            String clientOutput = runClient(clientJdk.jdkPath,
+                                    props).getOutput();
+                            clientStatus = getStatus(clientOutput);
+                        }
+
+                        String serverOutput = serverFuture.get().getOutput();
+                        Status serverStatus = getStatus(serverOutput);
+                        testCase.setStatus(caseStatus(serverStatus, clientStatus));
+                        testCases.add(testCase);
+                        System.out.printf(
+                                "ServerStatus=%s, ClientStatus=%s, CaseStatus=%s%n",
+                                serverStatus, clientStatus, testCase.getStatus());
+
+                        // Confirm the server has stopped.
+                        if(new File(Utils.PORT_LOG).exists()) {
+                            throw new RuntimeException("Server doesn't stop.");
+                        }
+                        System.out.println("----- Case end -----");
+                    }
+                }
+            }
+
+            System.out.println(Utils.endPre());
+            System.out.println(Utils.endHtml());
+        }
+        System.setOut(origStdOut);
+        System.setErr(origStdErr);
+        executor.shutdown();
+
+        System.out.println("Test end");
+        System.out.println("Report is being generated...");
+        boolean failed = generateReport(testCases);
+        System.out.println("Report is generated.");
+        if (failed) {
+            throw new RuntimeException("At least one case failed. "
+                    + "Please check logs for more details.");
+        }
+    }
+
+    private static Status getStatus(String log) {
+        if (log.contains(Status.UNEXPECTED_SUCCESS.name())) {
+            return Status.UNEXPECTED_SUCCESS;
+        } else if (log.contains(Status.SUCCESS.name())) {
+            return Status.SUCCESS;
+        } else if (log.contains(Status.EXPECTED_FAIL.name())) {
+            return Status.EXPECTED_FAIL;
+        } else if (log.contains(Status.TIMEOUT.name())) {
+            return Status.TIMEOUT;
+        } else {
+            return Status.FAIL;
+        }
+    }
+
+    private static Status caseStatus(Status serverStatus, Status clientStatus) {
+        if (clientStatus == null || clientStatus == Status.TIMEOUT) {
+            return serverStatus == Status.EXPECTED_FAIL
+                   ? Status.EXPECTED_FAIL
+                   : Status.FAIL;
+        } else if (serverStatus == Status.TIMEOUT) {
+            return clientStatus == Status.EXPECTED_FAIL
+                   ? Status.EXPECTED_FAIL
+                   : Status.FAIL;
+        } else {
+            return serverStatus == clientStatus
+                   ? serverStatus
+                   : Status.FAIL;
+        }
+    }
+
+    // Retrieves JDK info from the file which is specified by jdkListFile.
+    // If no such file or no JDK is specified by the file, the current testing
+    // JDK will be used.
+    private static Set<JdkInfo> jdkInfoList() throws Throwable {
+        List<String> jdkList = jdkList("jdkListFile");
+        if (jdkList.size() == 0) {
+            jdkList.add(System.getProperty("test.jdk"));
+        }
+
+        Set<JdkInfo> jdkInfoList = new LinkedHashSet<>();
+        for (String jdkPath : jdkList) {
+            JdkInfo jdkInfo = new JdkInfo(jdkPath);
+            // JDK version must be unique.
+            if (!jdkInfoList.add(jdkInfo)) {
+                System.out.println("The JDK version is duplicate: " + jdkPath);
+            }
+        }
+        return jdkInfoList;
+    }
+
+    private static List<String> jdkList(String listFileProp) throws IOException {
+        String listFile = System.getProperty(listFileProp);
+        System.out.println(listFileProp + "=" + listFile);
+        if (listFile != null && new File(listFile).exists()) {
+            return Files.lines(Paths.get(listFile))
+                        .filter(line -> { return !line.trim().isEmpty(); })
+                        .collect(Collectors.toList());
+        } else {
+            return new ArrayList<>();
+        }
+    }
+
+    // Checks if server is already launched, and returns server port.
+    private static int waitForServerStarted()
+            throws IOException, InterruptedException {
+        System.out.print("Waiting for server");
+        long deadline = System.currentTimeMillis() + Utils.TIMEOUT;
+        int port;
+        while ((port = getServerPort()) == -1
+                && System.currentTimeMillis() < deadline) {
+            System.out.print(".");
+            TimeUnit.SECONDS.sleep(1);
+        }
+        System.out.println();
+
+        return port;
+    }
+
+    // Retrieves the latest server port from port.log.
+    private static int getServerPort() throws IOException {
+        if (!new File(Utils.PORT_LOG).exists()) {
+            return -1;
+        }
+
+        return Integer.valueOf(
+                Files.lines(Paths.get(Utils.PORT_LOG)).findFirst().get());
+    }
+
+    private static OutputAnalyzer runServer(String jdkPath,
+            Map<String, String> props) {
+        return ProcessUtils.java(jdkPath, props, Server.class);
+    }
+
+    private static OutputAnalyzer runClient(String jdkPath,
+            Map<String, String> props) {
+        return ProcessUtils.java(jdkPath, props, Client.class);
+    }
+
+    // Generates the test result report.
+    private static boolean generateReport(List<TestCase> testCases)
+            throws IOException {
+        boolean failed = false;
+        StringBuilder report = new StringBuilder();
+        report.append(Utils.startHtml());
+        report.append(Utils.tableStyle());
+        report.append(Utils.startTable());
+        report.append(Utils.row(
+                "No.",
+                "ServerJDK",
+                "ClientJDK",
+                "Protocol",
+                "CipherSuite",
+                "ClientAuth",
+                "SNI",
+                "ALPN",
+                "Status"));
+        for (int i = 0, size = testCases.size(); i < size; i++) {
+            TestCase testCase = testCases.get(i);
+
+            report.append(Utils.row(
+                    Utils.anchorLink(
+                            Utils.TEST_LOG,
+                            testCase.toString(),
+                            i + ""),
+                    testCase.serverJdk.version,
+                    testCase.clientJdk.version,
+                    testCase.useCase.protocol.version,
+                    testCase.useCase.cipherSuite,
+                    Utils.boolToStr(
+                            testCase.useCase.clientAuth == ClientAuth.TRUE),
+                    Utils.boolToStr(
+                            testCase.useCase.serverName == ServerName.EXAMPLE),
+                    Utils.boolToStr(
+                            testCase.useCase.appProtocol == AppProtocol.EXAMPLE),
+                    testCase.getStatus()));
+            failed = failed
+                    || testCase.getStatus() == Status.FAIL
+                    || testCase.getStatus() == Status.UNEXPECTED_SUCCESS;
+        }
+        report.append(Utils.endTable());
+        report.append(Utils.endHtml());
+
+        generateFile("report.html", report.toString());
+        return failed;
+    }
+
+    private static void generateFile(String path, String content)
+            throws IOException {
+        try(FileWriter writer = new FileWriter(new File(path))) {
+            writer.write(content);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/JdkInfo.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+/*
+ * It represents a JDK with some specific attributes.
+ * If two JdkInfo instances have the same version value, the instances are
+ * regarded as equivalent.
+ */
+public class JdkInfo {
+
+    public final String jdkPath;
+
+    public final String version;
+    public final boolean supportsECKey;
+    public final boolean supportsSNI;
+    public final boolean supportsALPN;
+
+    public JdkInfo(String jdkPath) throws Throwable {
+        this.jdkPath = jdkPath;
+
+        String output = jdkAttributes(jdkPath);
+        if (output == null || output.trim().isEmpty()) {
+            throw new RuntimeException(
+                    "Cannot determine the JDK attributes: " + jdkPath);
+        }
+
+        String[] attributes = Utils.split(output, Utils.PARAM_DELIMITER);
+        version = attributes[0].replaceAll(".*=", "");
+        supportsECKey = Boolean.valueOf(attributes[1].replaceAll(".*=", ""));
+        supportsSNI = Boolean.valueOf(attributes[2].replaceAll(".*=", ""));
+        supportsALPN = Boolean.valueOf(attributes[3].replaceAll(".*=", ""));
+    }
+
+    // Determines the specific attributes for the specified JDK.
+    private static String jdkAttributes(String jdkPath) throws Throwable {
+        return ProcessUtils.java(jdkPath, null, JdkUtils.class).getOutput();
+    }
+
+    @Override
+    public int hashCode() {
+        return version == null ? 0 : version.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        JdkInfo other = (JdkInfo) obj;
+        if (version == null) {
+            if (other.version != null) {
+                return false;
+            }
+        } else if (!version.equals(other.version)) {
+            return false;
+        }
+        return true;
+    }
+
+    public boolean supportsCipherSuite(CipherSuite cipherSuite) {
+        JdkRelease jdkRelease = JdkRelease.getRelease(version);
+        return cipherSuite.startJdk.sequence <= jdkRelease.sequence
+                && (cipherSuite.endJdk == null
+                        || cipherSuite.endJdk.sequence >= jdkRelease.sequence);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/JdkRelease.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * JDK major versions.
+ */
+public enum JdkRelease {
+
+    JDK6(6, "1.6"),
+    JDK7(7, "1.7"),
+    JDK8(8, "1.8"),
+    JDK9(9, "9"),
+    JDK10(10, "10");
+
+    public final int sequence;
+    public final String release;
+
+    private JdkRelease(int sequence, String release) {
+        this.sequence = sequence;
+        this.release = release;
+    }
+
+    public static JdkRelease getRelease(String jdkVersion) {
+        if (jdkVersion.startsWith(JDK6.release)) {
+            return JDK6;
+        } else if (jdkVersion.startsWith(JDK7.release)) {
+            return JDK7;
+        } else if (jdkVersion.startsWith(JDK8.release)) {
+            return JDK8;
+        } else if (jdkVersion.startsWith(JDK9.release)) {
+            return JDK9;
+        } else if (jdkVersion.startsWith(JDK10.release)) {
+            return JDK10;
+        }
+
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/JdkUtils.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.security.KeyFactory;
+import java.security.NoSuchAlgorithmException;
+
+import javax.net.ssl.SSLParameters;
+
+/*
+ * This class is used for returning some specific JDK information.
+ */
+public class JdkUtils {
+
+    public static final String JAVA_RUNTIME_VERSION = "javaRuntimeVersion";
+    public static final String SUPPORTS_EC_KEY = "supportsECKey";
+    public static final String SUPPORTS_SNI = "supportsSNI";
+    public static final String SUPPORTS_ALPN = "supportsALPN";
+
+    // Returns the JDK build version.
+    public static String javaRuntimeVersion() {
+        return System.getProperty("java.runtime.version");
+    }
+
+    // Checks if EC key algorithm is supported by the JDK build.
+    private static boolean supportsECKey() {
+        boolean isSupported = true;
+        try {
+            KeyFactory.getInstance("EC");
+        } catch (NoSuchAlgorithmException e) {
+            isSupported = false;
+        }
+        return isSupported;
+    }
+
+    // Checks if SNI is supported by the JDK build.
+    private static boolean supportsSNI() {
+        boolean isSupported = true;
+        try {
+            SSLParameters.class.getMethod("getServerNames");
+        } catch (NoSuchMethodException e) {
+            isSupported = false;
+        }
+        return isSupported;
+    }
+
+    // Checks if ALPN is supported by the JDK build.
+    private static boolean supportsALPN() {
+        boolean isSupported = true;
+        try {
+            SSLParameters.class.getMethod("getApplicationProtocols");
+        } catch (NoSuchMethodException e) {
+            isSupported = false;
+        }
+        return isSupported;
+    }
+
+    public static void main(String[] args) {
+        System.out.print(Utils.join(Utils.PARAM_DELIMITER,
+                attr(JAVA_RUNTIME_VERSION, javaRuntimeVersion()),
+                attr(SUPPORTS_EC_KEY, supportsECKey()),
+                attr(SUPPORTS_SNI, supportsSNI()),
+                attr(SUPPORTS_ALPN, supportsALPN())));
+    }
+
+    private static String attr(String name, Object value) {
+        return name + "=" + String.valueOf(value);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/Parameter.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,252 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * A tagging interface that all TLS communication parameters must implement.
+ */
+public interface Parameter { }
+
+/* The followings are TLS communication parameters. */
+
+enum Protocol implements Parameter {
+
+    SSLV3_0(3, "SSLv3"),
+    TLSV1_0(4, "TLSv1"),
+    TLSV1_1(5, "TLSv1.1"),
+    TLSV1_2(6, "TLSv1.2");
+
+    public final int sequence;
+    public final String version;
+
+    private Protocol(int sequence, String version) {
+        this.sequence = sequence;
+        this.version = version;
+    }
+
+    static Protocol getProtocol(String version) {
+        for (Protocol protocol : values()) {
+            if (protocol.version.equals(version)) {
+                return protocol;
+            }
+        }
+
+        return null;
+    }
+
+    static Protocol[] getMandatoryValues() {
+        return new Protocol[] { TLSV1_0, TLSV1_1, TLSV1_2 };
+    }
+}
+
+enum CipherSuite implements Parameter {
+
+    TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384(
+            Protocol.TLSV1_2, JdkRelease.JDK7),
+    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384(
+            Protocol.TLSV1_2, JdkRelease.JDK7),
+    TLS_RSA_WITH_AES_256_CBC_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK7),
+    TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384(
+            Protocol.TLSV1_2, JdkRelease.JDK7),
+    TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384(
+            Protocol.TLSV1_2, JdkRelease.JDK7),
+    TLS_DHE_RSA_WITH_AES_256_CBC_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK7),
+    TLS_DHE_DSS_WITH_AES_256_CBC_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK7),
+    TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA(),
+    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA(),
+    TLS_RSA_WITH_AES_256_CBC_SHA(),
+    TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA(),
+    TLS_ECDH_RSA_WITH_AES_256_CBC_SHA(),
+    TLS_DHE_RSA_WITH_AES_256_CBC_SHA(),
+    TLS_DHE_DSS_WITH_AES_256_CBC_SHA(),
+    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK7),
+    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK7),
+    TLS_RSA_WITH_AES_128_CBC_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK7),
+    TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK7),
+    TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK7),
+    TLS_DHE_RSA_WITH_AES_128_CBC_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK7),
+    TLS_DHE_DSS_WITH_AES_128_CBC_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK7),
+    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA(),
+    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA(),
+    TLS_RSA_WITH_AES_128_CBC_SHA(),
+    TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA(),
+    TLS_ECDH_RSA_WITH_AES_128_CBC_SHA(
+            Protocol.SSLV3_0, JdkRelease.JDK7),
+    TLS_DHE_RSA_WITH_AES_128_CBC_SHA(),
+    TLS_DHE_DSS_WITH_AES_128_CBC_SHA(),
+    TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384(
+            Protocol.TLSV1_2, JdkRelease.JDK8),
+    TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK8),
+    TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384(
+            Protocol.TLSV1_2, JdkRelease.JDK8),
+    TLS_RSA_WITH_AES_256_GCM_SHA384(
+            Protocol.TLSV1_2, JdkRelease.JDK8),
+    TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384(
+            Protocol.TLSV1_2, JdkRelease.JDK8),
+    TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384(
+            Protocol.TLSV1_2, JdkRelease.JDK8),
+    TLS_DHE_RSA_WITH_AES_256_GCM_SHA384(
+            Protocol.TLSV1_2, JdkRelease.JDK8),
+    TLS_DHE_DSS_WITH_AES_256_GCM_SHA384(
+            Protocol.TLSV1_2, JdkRelease.JDK8),
+    TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK8),
+    TLS_RSA_WITH_AES_128_GCM_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK8),
+    TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK8),
+    TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK8),
+    TLS_DHE_RSA_WITH_AES_128_GCM_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK8),
+    TLS_DHE_DSS_WITH_AES_128_GCM_SHA256(
+            Protocol.TLSV1_2, JdkRelease.JDK8),
+    TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA(),
+    TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA(),
+    TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA(),
+    TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA(),
+    TLS_ECDHE_ECDSA_WITH_RC4_128_SHA(),
+    TLS_ECDHE_RSA_WITH_RC4_128_SHA(),
+    TLS_ECDH_ECDSA_WITH_RC4_128_SHA(),
+    TLS_ECDH_RSA_WITH_RC4_128_SHA(),
+    SSL_RSA_WITH_RC4_128_SHA(),
+    SSL_RSA_WITH_3DES_EDE_CBC_SHA(),
+    SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA(
+            Protocol.SSLV3_0, JdkRelease.JDK6),
+    SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA(
+            Protocol.SSLV3_0, JdkRelease.JDK6),
+    SSL_RSA_WITH_RC4_128_MD5(
+            Protocol.SSLV3_0, JdkRelease.JDK6);
+
+    private static final boolean FULL_CIPHER_SUITES
+            = Utils.getBoolProperty("fullCipherSuites");
+
+    final Protocol startProtocol;
+    final Protocol endProtocol;
+
+    final JdkRelease startJdk;
+    final JdkRelease endJdk;
+
+    private CipherSuite(
+            Protocol startProtocol, Protocol endProtocol,
+            JdkRelease startJdk, JdkRelease endJdk) {
+        this.startProtocol = startProtocol;
+        this.endProtocol = endProtocol;
+
+        this.startJdk = startJdk;
+        this.endJdk = endJdk;
+    }
+
+    private CipherSuite(Protocol startProtocol, JdkRelease startJdk) {
+        this(startProtocol, null, startJdk, null);
+    }
+
+    private CipherSuite() {
+        this(Protocol.TLSV1_0, null, JdkRelease.JDK6, null);
+    }
+
+    boolean supportedByProtocol(Protocol protocol) {
+        return startProtocol.sequence <= protocol.sequence
+                && (endProtocol == null || endProtocol.sequence >= protocol.sequence);
+    }
+
+    static CipherSuite[] getMandatoryValues() {
+        return FULL_CIPHER_SUITES
+               ? values()
+               : new CipherSuite[] {
+                       TLS_RSA_WITH_AES_128_CBC_SHA,
+                       TLS_DHE_DSS_WITH_AES_128_CBC_SHA,
+                       TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
+                       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
+                       TLS_RSA_WITH_AES_256_CBC_SHA256,
+                       TLS_DHE_DSS_WITH_AES_256_CBC_SHA256,
+                       TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,
+                       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 };
+    }
+
+    static CipherSuite getCipherSuite(String name) {
+        for (CipherSuite cipherSuite : values()) {
+            if (cipherSuite.name().equals(name)) {
+                return cipherSuite;
+            }
+        }
+
+        return null;
+    }
+}
+
+enum ClientAuth implements Parameter {
+
+    FALSE,
+    TRUE;
+
+    static ClientAuth[] getMandatoryValues() {
+        return new ClientAuth[] { TRUE };
+    }
+}
+
+enum ServerName implements Parameter {
+
+    NONE(null),
+    EXAMPLE("www.example.com");
+
+    final String name;
+
+    private ServerName(String name) {
+        this.name = name;
+    }
+
+    static ServerName[] getMandatoryValues() {
+        return new ServerName[] { EXAMPLE };
+    }
+}
+
+enum AppProtocol implements Parameter {
+
+    NONE(null, null),
+    EXAMPLE(new String[] { Utils.HTTP_2, Utils.HTTP_1_1 }, Utils.HTTP_2);
+
+    final String[] appProtocols;
+
+    // Expected negotiated application protocol
+    final String negoAppProtocol;
+
+    private AppProtocol(String[] appProtocols, String negoAppProtocol) {
+        this.appProtocols = appProtocols;
+        this.negoAppProtocol = negoAppProtocol;
+    }
+
+    static AppProtocol[] getMandatoryValues() {
+        return new AppProtocol[] { EXAMPLE };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/ProcessUtils.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+/*
+ * Utilities for executing java process.
+ */
+public class ProcessUtils {
+
+    private static final String TEST_CLASSES = System.getProperty("test.classes");
+
+    public static OutputAnalyzer java(String jdkPath, Map<String, String> props,
+            Class<?> clazz) {
+        List<String> cmds = new ArrayList<>();
+        cmds.add(jdkPath + "/bin/java");
+
+        if (props != null) {
+            for (Map.Entry<String, String> prop : props.entrySet()) {
+                cmds.add("-D" + prop.getKey() + "=" + prop.getValue());
+            }
+        }
+
+        cmds.add("-cp");
+        cmds.add(TEST_CLASSES);
+        cmds.add(clazz.getName());
+        try {
+            return ProcessTools.executeCommand(
+                    cmds.toArray(new String[cmds.size()]));
+        } catch (Throwable e) {
+            throw new RuntimeException("Execute command failed: " + cmds, e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/README	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,130 @@
+# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+
+##### Summary #####
+This test is used to check the interop compatibility on JSSE among different
+JDK releases. The oldest version supported by the test is JDK 6. Some of Java
+source files, JdkUtils.java, Parameter.java, Server.java, and Client.java, use
+only JDK 6-compliant language features and APIs, in order to allowing different
+JDK releases can load and run associated classes.
+
+##### Output #####
+The test can generate a report at $JTREG_WORKDIR/scratch/report.html to display
+the key information for each case. It also outputs all of details on both of
+server and client sides to a separated file at $JTREG_WORKDIR/scratch/test.html.
+
+##### Report Columns #####
+No.
+    A sequence number. It contains a hyper link to the corresponding details
+    in $JTREG_WORKDIR/scratch/test.html.
+
+ServerJDK
+    The version of the JDK that acts as server.
+
+ClientJDK
+    The version of the JDK that acts as client.
+
+Protocol
+    The TLS protocol version.
+
+CipherSuite
+    The only enabled cipher suite on both of server and client.
+
+ClientAuth
+    If the client authentication is checked, the value is "Y"; otherwise, "N".
+
+SNI
+    If the SNI is checked, the value is "Y"; otherwise, "N".
+
+ALPN
+    If the ALPN is checked, the value is "Y"; otherwise, "N".
+
+Status
+    It indicates the communication status for a test case.
+    There are three status:
+    SUCCESS: Communication succeed as expected.
+    UNEXPECTED_SUCCESS: Communication succeed as unexpected.
+    FAIL: Communication fails with unexpected failure.
+    EXPECTED_FAIL: Communication fails with expected failure.
+    Please note that, if a case finishes as status UNEXPECTED_SUCCESS or FAIL,
+    that means the case fails. Any failed case results in the test goes to fail.
+
+##### Usage #####
+jtreg [-options] \
+    [-Ddebug=<true|false>] \
+    [-DfullCases=<true|false>] \
+    [-DfullCipherSuites=<true|false>] \
+    [-DjdkListFile=</path/to/jdkListFile>] \
+    $JDK_WORKSPACE/test/jdk/javax/net/ssl/compatibility/Compatibility.java
+
+Besides the common jtreg options, like -jdk, this test introduces some more
+properties:
+debug
+    It indicates if the test enable -Djavax.net.ssl=debug. This is a boolean
+    property, and the default value is false.
+    It is not mandatory.
+
+fullCases
+    It indicates if testing the full or mandatory set of parameter values.
+    Every parameter provides a mandatory value set that must be covered.
+    For more details about the parameter value sets, please see Parameter.java.
+    This is a boolean property, and the default value is false.
+    It is not mandatory.
+
+fullCipherSuites
+    It indicates if testing the full or mandatory set of cipher suites.
+    For more details about the specific cipher suite sets, see CipherSuite in
+    Parameter.java.
+    This is a boolean property, and the default value is false.
+    It is not mandatory.
+
+jdkListFile
+    It indicate the path of a file, which lists the absolute paths of different
+    JDK builds. If no this property, the current testing JDK, specified by JTREG
+    option -jdk, is used as the testing JDK.
+    It is not mandatory.
+
+##### Usage Examples #####
+Example 1
+$ jtreg -jdk:/path/to/latest/jdk \
+    $JDK_WS/jdk/test/javax/net/ssl/compatibility/Compatibility.java
+This example doesn't specify any property introduced by the test. That means
+it uses the current testing JDK, namely /path/to/latest/jdk, as server and
+client. It doesn't output any debug log, and tests only mandatory parameter
+value sets.
+
+Example 2
+$ cat /path/to/jdkList
+/path/to/jdk6
+/path/to/jdk7
+/path/to/jdk8
+/path/to/jdk9
+/path/to/jdk10
+
+$ jtreg -jdk:/path/to/latest/jdk \
+    -Ddebug=true \
+    -DfullCipherSuites=true \
+    -DjdkListFile=/path/to/jdkList \
+    $JDK_WS/jdk/test/javax/net/ssl/compatibility/Compatibility.java
+The above example uses a file "/path/to/jdkList" to contain the paths of local
+different JDK builds through 6 to 10. The execution uses each of JDK builds as
+server and client respectively. And it enables SSL debug flag, and tests the
+full parameter value set.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/Server.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLParameters;
+import javax.net.ssl.SSLServerSocket;
+import javax.net.ssl.SSLServerSocketFactory;
+import javax.net.ssl.SSLSocket;
+
+/*
+ * A simple SSL socket server.
+ */
+public class Server {
+
+    private final SSLServerSocket serverSocket;
+
+    public Server(SSLContext context, int port) throws Exception {
+        SSLServerSocketFactory serverFactory = context.getServerSocketFactory();
+        serverSocket = (SSLServerSocket) serverFactory.createServerSocket(port);
+        serverSocket.setSoTimeout(Utils.TIMEOUT);
+    }
+
+    public Server(Cert[] certs, int port) throws Exception {
+        this(Utils.createSSLContext(certs), port);
+    }
+
+    public Server(Cert[] certs) throws Exception {
+        this(certs, 0);
+    }
+
+    private void setEnabledCipherSuites(String... cipherSuites) {
+        serverSocket.setEnabledCipherSuites(cipherSuites);
+    }
+
+    private void setEnabledProtocols(String... protocols) {
+        serverSocket.setEnabledProtocols(protocols);
+    }
+
+    private void setNeedClientAuth(boolean needClientAuth) {
+        serverSocket.setNeedClientAuth(needClientAuth);
+    }
+
+    private void setApplicationProtocols(String... protocols) {
+        SSLParameters params = serverSocket.getSSLParameters();
+        params.setApplicationProtocols(protocols);
+        serverSocket.setSSLParameters(params);
+    }
+
+    public int getPort() {
+        return serverSocket.getLocalPort();
+    }
+
+    private void accept() throws IOException {
+        SSLSocket socket = null;
+        try {
+            socket = (SSLSocket) serverSocket.accept();
+
+            InputStream in = socket.getInputStream();
+            in.read();
+
+            OutputStream out = socket.getOutputStream();
+            out.write('S');
+            out.flush();
+        } finally {
+            if (socket != null) {
+                socket.close();
+            }
+        }
+    }
+
+    public void close() throws IOException {
+        serverSocket.close();
+    }
+
+    public static void main(String[] args) throws IOException {
+        System.out.println("----- Server start -----");
+        String protocol = System.getProperty(Utils.PROP_PROTOCOL);
+        String cipherSuite = System.getProperty(Utils.PROP_CIPHER_SUITE);
+        boolean clientAuth
+                = Utils.getBoolProperty(Utils.PROP_CLIENT_AUTH);
+        String appProtocols = System.getProperty(Utils.PROP_APP_PROTOCOLS);
+        boolean supportsALPN
+                = Utils.getBoolProperty(Utils.PROP_SUPPORTS_ALPN_ON_SERVER);
+        boolean negativeCase
+                = Utils.getBoolProperty(Utils.PROP_NEGATIVE_CASE_ON_SERVER);
+
+        System.out.println(Utils.join(Utils.PARAM_DELIMITER,
+                "ServerJDK=" + System.getProperty(Utils.PROP_SERVER_JDK),
+                "Protocol=" + protocol,
+                "CipherSuite=" + cipherSuite,
+                "ClientAuth=" + clientAuth,
+                "AppProtocols=" + appProtocols));
+
+        Status status = Status.SUCCESS;
+        Server server = null;
+        try {
+            server = new Server(Cert.getCerts(cipherSuite));
+            System.out.println("port=" + server.getPort());
+            server.setNeedClientAuth(clientAuth);
+            server.setEnabledProtocols(protocol);
+            server.setEnabledCipherSuites(cipherSuite);
+            if (appProtocols != null) {
+                if (supportsALPN) {
+                    server.setApplicationProtocols(
+                            Utils.split(appProtocols, Utils.VALUE_DELIMITER));
+                } else {
+                    System.out.println(
+                            "Ignored due to server doesn't support ALPN.");
+                }
+            }
+
+            savePort(server.getPort());
+            server.accept();
+
+            status = negativeCase ? Status.UNEXPECTED_SUCCESS : Status.SUCCESS;
+        } catch (Exception exception) {
+            status = Utils.handleException(exception, negativeCase);
+        } finally {
+            if (server != null) {
+                server.close();
+            }
+
+            // Cleanups port.log.
+            File file = new File(Utils.PORT_LOG);
+            if (file.exists()) {
+                file.delete();
+            }
+        }
+
+        System.out.println("STATUS: " + status);
+        System.out.println("----- Server end -----");
+    }
+
+    private static void savePort(int port) throws IOException {
+        FileWriter writer = null;
+        try {
+            writer = new FileWriter(new File(Utils.PORT_LOG));
+            writer.write(port + "");
+        } finally {
+            if (writer != null) {
+                writer.close();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/Status.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Test case result status.
+ */
+public enum Status {
+
+    SUCCESS, UNEXPECTED_SUCCESS, FAIL, EXPECTED_FAIL, TIMEOUT;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/TestCase.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * A test case for a specific TLS communication use case between two JDKs.
+ */
+public class TestCase {
+
+    public final JdkInfo serverJdk;
+    public final JdkInfo clientJdk;
+    public final UseCase useCase;
+
+    public final boolean negativeCaseOnServer;
+    public final boolean negativeCaseOnClient;
+
+    private Status status;
+
+    public TestCase(JdkInfo serverJdk, JdkInfo clientJdk, UseCase useCase) {
+        this.serverJdk = serverJdk;
+        this.clientJdk = clientJdk;
+        this.useCase = useCase;
+
+        negativeCaseOnServer = useCase.negativeCase
+                || !serverJdk.supportsCipherSuite(useCase.cipherSuite);
+        negativeCaseOnClient = useCase.negativeCase
+                || !clientJdk.supportsCipherSuite(useCase.cipherSuite);
+    }
+
+    public Status getStatus() {
+        return status;
+    }
+
+    public void setStatus(Status status) {
+        this.status = status;
+    }
+
+    @Override
+    public String toString() {
+        return Utils.join(Utils.PARAM_DELIMITER,
+                "ServerJDK=" + serverJdk.version,
+                "ClientJDK=" + clientJdk.version,
+                useCase.toString());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/UseCase.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ * The TLS communication use case.
+ */
+public class UseCase {
+
+    private static final boolean FULL_CASES
+            = Utils.getBoolProperty("fullCases");
+
+    private static final Parameter[][] PARAMS = new Parameter[][] {
+            FULL_CASES ? Protocol.values() : Protocol.getMandatoryValues(),
+            FULL_CASES ? CipherSuite.values() : CipherSuite.getMandatoryValues(),
+            FULL_CASES ? ClientAuth.values() : ClientAuth.getMandatoryValues(),
+            FULL_CASES ? ServerName.values() : ServerName.getMandatoryValues(),
+            FULL_CASES ? AppProtocol.values() : AppProtocol.getMandatoryValues() };
+
+    public final Protocol protocol;
+    public final CipherSuite cipherSuite;
+    public final ClientAuth clientAuth;
+    public final ServerName serverName;
+    public final AppProtocol appProtocol;
+
+    public final boolean negativeCase;
+
+    public UseCase(
+            Protocol protocol,
+            CipherSuite cipherSuite,
+            ClientAuth clientAuth,
+            ServerName serverName,
+            AppProtocol appProtocol) {
+        this.protocol = protocol;
+        this.cipherSuite = cipherSuite;
+        this.clientAuth = clientAuth;
+        this.serverName = serverName;
+        this.appProtocol = appProtocol;
+
+        negativeCase = !cipherSuite.supportedByProtocol(protocol);
+    }
+
+    // JDK 6 doesn't support EC key algorithm.
+    public boolean ignoredByJdk(JdkInfo jdkInfo) {
+        return cipherSuite.name().contains("_EC") && !jdkInfo.supportsECKey;
+    }
+
+    @Override
+    public String toString() {
+        return Utils.join(Utils.PARAM_DELIMITER,
+                "Protocol=" + protocol.version,
+                "CipherSuite=" + cipherSuite,
+                "ClientAuth=" + clientAuth,
+                "ServerName=" + serverName,
+                "AppProtocols=" + appProtocol);
+    }
+
+    public static List<UseCase> getAllUseCases() {
+        List<UseCase> useCases = new ArrayList<>();
+        getUseCases(PARAMS, 0, new Parameter[PARAMS.length], useCases);
+        return useCases;
+    }
+
+    private static void getUseCases(Parameter[][] params, int index,
+            Parameter[] currentValues, List<UseCase> useCases) {
+        if (index == params.length) {
+            Protocol protocol = (Protocol) currentValues[0];
+            CipherSuite cipherSuite = (CipherSuite) currentValues[1];
+
+            UseCase useCase = new UseCase(
+                    protocol,
+                    cipherSuite,
+                    (ClientAuth) currentValues[2],
+                    (ServerName) currentValues[3],
+                    (AppProtocol) currentValues[4]);
+            useCases.add(useCase);
+        } else {
+            Parameter[] values = params[index];
+            for (int i = 0; i < values.length; i++) {
+                currentValues[index] = values[i];
+                getUseCases(params, index + 1, currentValues, useCases);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/Utils.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.net.SocketTimeoutException;
+import java.security.KeyFactory;
+import java.security.KeyStore;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLHandshakeException;
+import javax.net.ssl.TrustManagerFactory;
+
+/*
+ * Utilities for testing.
+ */
+public class Utils {
+
+    /* ***** Properties ***** */
+    public static final String PROP_PORT = "test.port";
+    public static final String PROP_PROTOCOL = "test.protocol";
+    public static final String PROP_CIPHER_SUITE = "test.cipher.suite";
+    public static final String PROP_CLIENT_AUTH = "test.client.auth";
+    public static final String PROP_SERVER_JDK = "test.server.jdk";
+    public static final String PROP_CLIENT_JDK = "test.client.jdk";
+    public static final String PROP_SERVER_NAME = "test.server.name";
+    public static final String PROP_APP_PROTOCOLS
+            = "test.app.protocols";
+    public static final String PROP_NEGO_APP_PROTOCOL
+            = "test.negotiated.app.protocol";
+    public static final String PROP_SUPPORTS_SNI_ON_SERVER
+            = "test.supports.sni.on.server";
+    public static final String PROP_SUPPORTS_SNI_ON_CLIENT
+            = "test.supports.sni.on.client";
+    public static final String PROP_SUPPORTS_ALPN_ON_SERVER
+            = "test.supports.alpn.on.server";
+    public static final String PROP_SUPPORTS_ALPN_ON_CLIENT
+            = "test.supports.alpn.on.client";
+    public static final String PROP_NEGATIVE_CASE_ON_SERVER
+            = "test.negative.case.on.server";
+    public static final String PROP_NEGATIVE_CASE_ON_CLIENT
+            = "test.negative.case.on.client";
+
+    public static final int TIMEOUT = 10000;
+    public static final char[] PASSWORD = "testpass".toCharArray();
+
+    public static final String TEST_LOG = "test.html";
+    public static final String PORT_LOG = "port";
+
+    public static final String HTTP_2 = "h2";
+    public static final String HTTP_1_1 = "http/1.1";
+
+    public static final String PARAM_DELIMITER = ";";
+    public static final String VALUE_DELIMITER = ",";
+
+    /*
+     * Creates SSL context with the specified certificate.
+     */
+    public static SSLContext createSSLContext(Cert... certs) throws Exception {
+        KeyStore trustStore = KeyStore.getInstance("JKS");
+        trustStore.load(null, null);
+        for (int i = 0; i < certs.length; i++) {
+            trustStore.setCertificateEntry("trust-" + certs[i].name(),
+                    createCert(certs[i]));
+        }
+        TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
+        tmf.init(trustStore);
+
+        KeyStore keyStore = KeyStore.getInstance("JKS");
+        keyStore.load(null, null);
+        for (int i = 0; i < certs.length; i++) {
+            PrivateKey privKey = createKey(certs[i]);
+            keyStore.setKeyEntry("cert-" + certs[i].name(), privKey, PASSWORD,
+                    new Certificate[] { createCert(certs[i]) });
+        }
+        KeyManagerFactory kmf = KeyManagerFactory.getInstance("NewSunX509");
+        kmf.init(keyStore, PASSWORD);
+
+        SSLContext context = SSLContext.getInstance("TLS");
+        context.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+        return context;
+    }
+
+    private static Certificate createCert(Cert cert) throws IOException {
+        try {
+            CertificateFactory certFactory
+                    = CertificateFactory.getInstance("X.509");
+            return certFactory.generateCertificate(
+                    new ByteArrayInputStream(cert.certMaterials.getBytes()));
+        } catch (Exception e) {
+            throw new RuntimeException("Create key failed: " + cert, e);
+        }
+    }
+
+    private static PrivateKey createKey(Cert cert)
+            throws NoSuchAlgorithmException, InvalidKeySpecException {
+        PKCS8EncodedKeySpec privKeySpec = new PKCS8EncodedKeySpec(
+                hexToBytes(cert.privKeyMaterials));
+        KeyFactory keyFactory = KeyFactory.getInstance(
+                getKeyAlgorithm(cert.signatureAlgorithm));
+        PrivateKey privKey = keyFactory.generatePrivate(privKeySpec);
+        return privKey;
+    }
+
+    private static String getKeyAlgorithm(
+            SignatureAlgorithm signatureAlgorithm) {
+        String signatureAlogrithmName = signatureAlgorithm.name();
+        return signatureAlogrithmName.equals(SignatureAlgorithm.ECDSA.name())
+               ? "EC"
+               : signatureAlogrithmName;
+    }
+
+    public static byte[] hexToBytes(String hex) {
+        if (hex == null) {
+            return null;
+        }
+
+        int length = hex.length();
+        if (length % 2 != 0) {
+            throw new IllegalArgumentException("Hex format is wrong.");
+        }
+
+        byte[] bytes = new byte[length / 2];
+        for (int i = 0; i < length; i += 2) {
+            bytes[i / 2] = (byte) ((Character.digit(hex.charAt(i), 16) << 4)
+                    + Character.digit(hex.charAt(i + 1), 16));
+        }
+        return bytes;
+    }
+
+    public static String join(String delimiter, String... values) {
+        StringBuilder result = new StringBuilder();
+        if (values != null && values.length > 0) {
+            for (int i = 0; i < values.length - 1; i++) {
+                result.append(values[i]).append(delimiter);
+            }
+            result.append(values[values.length - 1]);
+        }
+        return result.toString();
+    }
+
+    public static String[] split(String str, String delimiter) {
+        return str == null ? new String[0] : str.split(delimiter);
+    }
+
+    public static String boolToStr(boolean bool) {
+        return bool ? "Y" : "N";
+    }
+
+    public static boolean getBoolProperty(String prop) {
+        return Boolean.valueOf(System.getProperty(prop));
+    }
+
+    public static Status handleException(Exception exception,
+            boolean negativeCase) {
+        Status status;
+        if ((exception instanceof SSLHandshakeException
+                || exception instanceof IllegalArgumentException)
+                && negativeCase) {
+            System.out.println("Expected exception: " + exception);
+            status = Status.EXPECTED_FAIL;
+        } else if (exception instanceof SocketTimeoutException) {
+            status = Status.TIMEOUT;
+        } else {
+            exception.printStackTrace(System.out);
+            status = Status.FAIL;
+        }
+        return status;
+    }
+
+    /* The HTML-related constants and methods. */
+
+    private static final String STYLE
+            = "style=\"font-family: Courier New; "
+            + "font-size: 12px; "
+            + "white-space: pre-wrap\"";
+
+    private static final String TABLE_STYLE
+            = "#test { font-family: \"Courier New\"; font-size: 12px; border-collapse: collapse; }\n"
+            + "#test td { border: 1px solid #ddd; padding: 4px; }\n"
+            + "#test tr:nth-child(odd) { background-color: #f2f2f2; }";
+
+    public static String row(Object... values) {
+        StringBuilder row = new StringBuilder();
+        row.append(startTr());
+        for (Object value : values) {
+            row.append(startTd());
+            row.append(value);
+            row.append(endTd());
+        }
+        row.append(endTr());
+        return row.toString();
+    }
+
+    public static String startHtml() {
+        return startTag("html");
+    }
+
+    public static String endHtml() {
+        return endTag("html");
+    }
+
+    public static String startPre() {
+        return startTag("pre " + STYLE);
+    }
+
+    public static String endPre() {
+        return endTag("pre");
+    }
+
+    public static String anchorName(String name, String text) {
+        return "<a name=" + name + ">" + text + "</a>";
+    }
+
+    public static String anchorLink(String file, String anchorName,
+            String text) {
+        return "<a href=" + file + "#" + anchorName + ">" + text + "</a>";
+    }
+
+    public static String tableStyle() {
+        return startTag("style") + TABLE_STYLE  +endTag("style");
+    }
+
+    public static String startTable() {
+        return startTag("table id=\"test\"");
+    }
+
+    public static String endTable() {
+        return endTag("table");
+    }
+
+    private static String startTr() {
+        return startTag("tr");
+    }
+
+    private static String endTr() {
+        return endTag("tr");
+    }
+
+    private static String startTd() {
+        return startTag("td");
+    }
+
+    private static String endTd() {
+        return endTag("td");
+    }
+
+    private static String startTag(String tag) {
+        return "<" + tag + ">";
+    }
+
+    private static String endTag(String tag) {
+        return "</" + tag + ">";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/compatibility/java.security	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,2 @@
+jdk.certpath.disabledAlgorithms=
+jdk.tls.disabledAlgorithms=
\ No newline at end of file
--- a/test/jdk/javax/sound/midi/Gervill/RiffReaderWriter/Close.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/jdk/javax/sound/midi/Gervill/RiffReaderWriter/Close.java	Sat Dec 02 06:51:10 2017 +0100
@@ -22,6 +22,7 @@
  */
 
 /* @test
+   @bug 8191384
    @summary Test RiffReader close method
    @modules java.desktop/com.sun.media.sound
 */
@@ -54,6 +55,8 @@
             FileInputStream fis = new FileInputStream(tempfile);
             reader = new RIFFReader(fis);
             reader.close();
+            // second close should not throw any exceptions
+            reader.close();
             reader = null;
         }
         finally
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/sound/sampled/spi/AudioFileReader/AudioInputStreamClose.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.sound.sampled.AudioFileFormat;
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+import javax.sound.sampled.UnsupportedAudioFileException;
+import javax.sound.sampled.spi.AudioFileReader;
+import javax.sound.sampled.spi.AudioFileWriter;
+
+import static java.util.ServiceLoader.load;
+import static javax.sound.sampled.AudioFileFormat.Type.AIFC;
+import static javax.sound.sampled.AudioFileFormat.Type.AIFF;
+import static javax.sound.sampled.AudioFileFormat.Type.AU;
+import static javax.sound.sampled.AudioFileFormat.Type.SND;
+import static javax.sound.sampled.AudioFileFormat.Type.WAVE;
+import static javax.sound.sampled.AudioSystem.NOT_SPECIFIED;
+
+/**
+ * @test
+ * @bug 8191384
+ * @summary the stream returned by AudioFileReader should close its data stream
+ */
+public final class AudioInputStreamClose {
+
+    static final class StreamWrapper extends BufferedInputStream {
+
+        private boolean open = true;
+
+        StreamWrapper(final InputStream in) {
+            super(in);
+        }
+
+        @Override
+        public void close() throws IOException {
+            super.close();
+            open = false;
+        }
+
+        boolean isOpen() {
+            return open;
+        }
+    }
+
+    /**
+     * We will try to use all formats, in this case all our providers will be
+     * covered by supported/unsupported formats.
+     */
+    private static final List<AudioFormat> formats = new ArrayList<>(23000);
+
+    private static final AudioFormat.Encoding[] encodings = {
+            AudioFormat.Encoding.ALAW, AudioFormat.Encoding.ULAW,
+            AudioFormat.Encoding.PCM_SIGNED, AudioFormat.Encoding.PCM_UNSIGNED,
+            AudioFormat.Encoding.PCM_FLOAT, new AudioFormat.Encoding("Test")
+    };
+
+    private static final int[] sampleBits = {1, 4, 8, 11, 16, 20, 24, 32};
+
+    private static final int[] channels = {1, 2, 3, 4, 5};
+
+    private static final AudioFileFormat.Type[] types = {
+            WAVE, AU, AIFF, AIFC, SND,
+            new AudioFileFormat.Type("TestName", "TestExt")
+    };
+
+    private static final int FRAME_LENGTH = 10;
+
+    static {
+        for (final int sampleSize : sampleBits) {
+            for (final int channel : channels) {
+                for (final AudioFormat.Encoding enc : encodings) {
+                    final int frameSize = ((sampleSize + 7) / 8) * channel;
+                    formats.add(new AudioFormat(enc, 44100, sampleSize, channel,
+                                                frameSize, 44100, true));
+                    formats.add(new AudioFormat(enc, 44100, sampleSize, channel,
+                                                frameSize, 44100, false));
+                }
+            }
+        }
+    }
+
+    public static void main(final String[] args) throws IOException {
+        for (final AudioFileWriter afw : load(AudioFileWriter.class)) {
+            for (final AudioFileReader afr : load(AudioFileReader.class)) {
+                for (final AudioFileFormat.Type type : types) {
+                    for (final AudioFormat from : formats) {
+                        test(afw, afr, type, getStream(from, true));
+                        test(afw, afr, type, getStream(from, false));
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Writes and reads the data to/from the stream.
+     */
+    private static void test(final AudioFileWriter afw,
+                             final AudioFileReader afr,
+                             final AudioFileFormat.Type type,
+                             final AudioInputStream ais)
+            throws IOException {
+        try {
+            final ByteArrayOutputStream out = new ByteArrayOutputStream();
+            afw.write(ais, type, out);
+            final InputStream input = new ByteArrayInputStream(out.toByteArray());
+            final StreamWrapper wrapper = new StreamWrapper(input);
+
+            // the wrapper should be closed as well
+            afr.getAudioInputStream(wrapper).close();
+
+            if (wrapper.isOpen()) {
+                System.err.println("Writer = " + afw);
+                System.err.println("Reader = " + afr);
+                throw new RuntimeException("Stream was not closed");
+            }
+        } catch (IOException | IllegalArgumentException |
+                UnsupportedAudioFileException ignored) {
+        }
+    }
+
+    private static AudioInputStream getStream(final AudioFormat format,
+                                              final boolean frameLength) {
+        final int dataSize = FRAME_LENGTH * format.getFrameSize();
+        byte[] buf = new byte[dataSize];
+        final InputStream in = new ByteArrayInputStream(buf);
+        if (frameLength) {
+            return new AudioInputStream(in, format, FRAME_LENGTH);
+        } else {
+            return new AudioInputStream(in, format, NOT_SPECIFIED);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/GraphicsConfigNotifier/TestMultiScreenGConfigNotify.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 8178025
+ * @summary  Verifies if graphicsConfiguration property notification is sent
+ *           when frame is moved from one screen to another in multiscreen
+ *           environment.
+ * @run main TestMultiScreenGConfigNotify
+ */
+
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+public class TestMultiScreenGConfigNotify {
+
+    static JFrame f;
+    static String propName[];
+    static int propCount = 0;
+    static boolean result = false;
+    public static void main(String[] args) throws Exception {
+
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        GraphicsDevice[] gds = ge.getScreenDevices();
+        if (gds.length < 2) {
+            return;
+        }
+        GraphicsConfiguration gc = gds[0].getDefaultConfiguration();
+        GraphicsConfiguration gc2 = gds[1].getDefaultConfiguration();
+        propName = new String[10];
+        SwingUtilities.invokeAndWait(() -> {
+            f = new JFrame();
+            f.setSize(300, 300);
+            f.setBounds(gc.getBounds().x, gc.getBounds().y, f.getWidth(), f.getHeight());
+            f.setVisible(true);
+
+            f.addPropertyChangeListener((PropertyChangeEvent evt) -> {
+                String name = evt.getPropertyName();
+                System.out.println("propertyChange " + name);
+                propName[propCount] = name;
+                propCount++;
+            });
+            try {
+                Thread.sleep(2000);
+            } catch (InterruptedException ex) {
+            }
+            f.setBounds(gc2.getBounds().x, gc2.getBounds().y,
+                        f.getWidth(), f.getHeight());
+        });
+
+        Thread.sleep(1000);
+        for(int i = 0; i < propCount; i++) {
+            if (propName[i].equals("graphicsConfiguration")) {
+                result = true;
+            }
+        }
+        SwingUtilities.invokeAndWait(() ->  f.dispose());
+        if(!result) {
+            throw new RuntimeException("graphicsConfiguration notification not sent");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/JButton/TestGlyphBreak.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 8191428
+ * @summary  Verifies if text view is not borken into multiple lines
+ * @run main/othervm -Dsun.java2d.uiScale=1.2 TestGlyphBreak
+ */
+
+import java.awt.FontMetrics;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+public class TestGlyphBreak {
+
+    static JFrame f;
+    static int btnHeight;
+    static FontMetrics fm;
+
+    public static void main(String[] args) throws Exception {
+
+        SwingUtilities.invokeAndWait(() -> {
+
+            String str = "<html><font size=2 color=red><bold>Three!</font></html>";
+            JButton b = new JButton();
+            b.setText(str);
+
+            f = new JFrame();
+            f.add(b);
+            f.pack();
+            f.setVisible(true);
+            btnHeight = b.getHeight();
+            fm = b.getFontMetrics(b.getFont());
+
+        });
+
+        try {
+            Thread.sleep(2000);
+        } catch (InterruptedException ex) {
+        }
+        SwingUtilities.invokeAndWait(() -> f.dispose());
+        System.out.println("metrics getHeight " + fm.getHeight() +
+                             " button height " + btnHeight);
+
+        // Check if text is broken into 2 lines, in which case button height
+        // will be twice the string height
+        if (btnHeight > 2*fm.getHeight()) {
+            throw new RuntimeException("TextView is broken into different lines");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/JLabel/GetSpanHiDpiBug.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 8178025
+ * @summary  Verifies if SPANs in HTML text are rendered properly in hidpi
+ * @run main/manual/othervm -Dsun.java2d.uiScale=2.25 GetSpanHiDpiBug
+ */
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.beans.PropertyChangeSupport;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+public class GetSpanHiDpiBug {
+    public static void main(String[] args) throws Exception {
+
+        final CountDownLatch latch = new CountDownLatch(1);
+        SpanTest test = new SpanTest(latch);
+        Thread T1 = new Thread(test);
+        T1.start();
+
+        // wait for latch to complete
+        boolean ret = false;
+        try {
+            ret = latch.await(3000, TimeUnit.SECONDS);
+        } catch (InterruptedException ie) {
+            throw ie;
+        }
+        if (!ret) {
+            test.dispose();
+            throw new RuntimeException(" User has not executed the test");
+        }
+        if (test.testResult == false) {
+            throw new RuntimeException("Some characters overlap");
+        }
+    }
+}
+
+class SpanTest implements Runnable {
+    static JFrame f;
+    static JDialog dialog;
+    public boolean testResult = false;
+    private final CountDownLatch latch;
+
+    public SpanTest(CountDownLatch latch) throws Exception {
+        this.latch = latch;
+    }
+
+    @Override
+    public void run() {
+        try {
+            createUI();
+            spanTest();
+        } catch (Exception ex) {
+            dispose();
+            latch.countDown();
+            throw new RuntimeException("createUI Failed: " + ex.getMessage());
+        }
+    }
+
+    public void dispose() {
+        if (dialog != null) {
+            dialog.dispose();
+        }
+        if (f != null) {
+            f.dispose();
+        }
+    }
+
+    private static void spanTest() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                JLabel label =
+                    new JLabel("<html><span>A few words to get started "
+                    + "before the bug</span><span>overlapping text</span></html>");
+                f = new JFrame("");
+                f.getContentPane().add(label, BorderLayout.CENTER);
+                f.setSize(500,500);
+                f.setVisible(true);
+            }
+        });
+    }
+
+    private final void createUI() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                String description
+                        = " INSTRUCTIONS:\n"
+                        + " A string will be shown.\n "
+                        + " Press Pass if there is no overlap of characters\n"
+                        + " else press Fail.";
+
+                dialog = new JDialog();
+                dialog.setTitle("textselectionTest");
+                JTextArea textArea = new JTextArea(description);
+                textArea.setEditable(false);
+                final JButton passButton = new JButton("PASS");
+                passButton.addActionListener((e) -> {
+                    testResult = true;
+                    dispose();
+                    latch.countDown();
+                });
+                final JButton failButton = new JButton("FAIL");
+                failButton.addActionListener((e) -> {
+                    testResult = false;
+                    dispose();
+                    latch.countDown();
+                });
+                JPanel mainPanel = new JPanel(new BorderLayout());
+                mainPanel.add(textArea, BorderLayout.CENTER);
+                JPanel buttonPanel = new JPanel(new FlowLayout());
+                buttonPanel.add(passButton);
+                buttonPanel.add(failButton);
+                mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+                dialog.add(mainPanel);
+                dialog.pack();
+                dialog.setVisible(true);
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/JMenu/8178430/LabelDotTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 8178430
+ * @summary JMenu in GridBagLayout flickers when label text shows "..." and
+ * is updated
+ * @run main LabelDotTest
+ */
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Robot;
+
+import java.util.stream.IntStream;
+
+import javax.swing.SwingUtilities;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JFrame;
+import javax.swing.JMenuBar;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+
+public class LabelDotTest
+{
+    private final static String longText = "show a very long text to have it " +
+            "automatically shortened";
+    private final static String shortText = "show short text";
+
+    private static JFrame frame;
+    private static JLabel label;
+    private static JMenu menu;
+    private static volatile boolean isException = false;
+
+    private static void createUI() {
+       System.out.println("BEFORE CREATION");
+       frame = new JFrame();
+       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+       frame.setSize(new Dimension(50, 150));
+       frame.setLocationRelativeTo(null);
+
+       frame.setLayout(new GridBagLayout());
+       GridBagConstraints c = new GridBagConstraints();
+       c.fill = GridBagConstraints.BOTH;
+       c.weightx = 1.0;
+       c.weighty = 0.0;
+       c.gridwidth = GridBagConstraints.REMAINDER;
+
+       JMenuBar menuBar = new JMenuBar();
+       menu = new JMenu("Menu");
+       menuBar.add(menu);
+       frame.add(menuBar, c);
+
+       frame.add(new JLabel("Title", SwingConstants.CENTER), c);
+
+       c.weighty = 1.0;
+       frame.add(new JPanel(new GridBagLayout()), c);
+       c.weighty = 0.0;
+
+       label = new JLabel(shortText);
+       frame.add(label, c);
+
+       frame.setVisible(true);
+   }
+
+   private static void runTest(int iterations) throws Exception{
+        Robot robot = new Robot();
+
+        IntStream.range(0, iterations).forEach((i) -> {
+                SwingUtilities.invokeLater(() -> {
+                    if (label.getText().equals(shortText)) {
+                        label.setText(longText);
+                    } else {
+                        label.setText(shortText);
+                    }
+                    /*  For a top level menu item, minimum size and the
+                        preferred size should be the same, and should not be
+                        equal to 1. Save the exception state and throw later
+                        once the iterations are completed.
+                    */
+                    isException = (menu.getMinimumSize().height == 1 &&
+                        !menu.getMinimumSize().equals(menu.getPreferredSize())) ||
+                        isException;
+                });
+                robot.waitForIdle();
+        });
+   }
+
+   public static void main(String[] args) throws Exception {
+        try {
+            SwingUtilities.invokeAndWait(() -> createUI());
+            runTest(50);
+        } finally {
+            SwingUtilities.invokeAndWait(() -> frame.dispose());
+            if (isException)
+                throw new RuntimeException("Size of Menu bar is not correct.");
+        }
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/JTextField/JapaneseReadingAttributes/JapaneseReadingAttributes.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,295 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @key headful
+ * @bug 8176072
+ * @summary Checks whether reading attributes are obtained for Japanese IME
+ * @requires (os.family == "windows")
+ * @run main/manual JapaneseReadingAttributes
+ */
+
+/**
+ * This test requires a manual intervention as the keyboard layout has to be
+ * changed to Japanese IME. Once the keyboard layout has been selected, click on
+ * Start Test to start the automated tests. Will run two passes, first with an
+ * enter key in between to generate the yomigana for the first block of
+ * characters. The second without the intermediate enter key. Without the fix,
+ * there will be a mismatch in the reading attributes obtained.
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Robot;
+import java.awt.event.InputMethodEvent;
+import java.awt.event.InputMethodListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.WindowConstants;
+import java.awt.event.KeyEvent;
+import java.text.AttributedCharacterIterator;
+import java.util.ArrayList;
+import java.util.concurrent.CountDownLatch;
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+
+public class JapaneseReadingAttributes {
+    private static boolean testPassed = false;
+    private static boolean startTest = false;
+
+    private static JFrame frame = null;
+    private static JLabel lblTestStatus = null;
+    private static JTextField textFieldMain = null;
+    private static JTextField textFieldReading = null;
+    private static String testResult;
+    private static String readingPass1;
+    private static String readingPass2;
+
+    private static final CountDownLatch testStartLatch = new CountDownLatch(1);
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            setupUI();
+        });
+
+        testStartLatch.await();
+
+        if (startTest) {
+            glyphTest();
+
+            frame.dispose();
+
+            if (testPassed) {
+                System.out.println(testResult);
+            } else {
+                throw new RuntimeException(testResult);
+            }
+        } else {
+            throw new RuntimeException("User has not executed the test");
+        }
+    }
+
+    private static void setupUI() {
+        String description = " 1. Go to \"Language Preferences -> Add a Language"
+                            + "\" and add \"Japanese\"\n"
+                            + " 2. Set current IM to \"Japanese\" \n"
+                            + " 3. Try typing in the text field to ensure"
+                            + " that Japanese IME has been successfully"
+                            + " selected \n"
+                            + " 4. Now click on \"Start Test\" button \n";
+        String title = "Reading Attributes test Japanese IME (Windows)";
+
+        frame = new JFrame(title);
+
+        JPanel mainPanel = new JPanel(new BorderLayout());
+
+        JPanel textEditPanel = new JPanel(new FlowLayout());
+
+        textFieldMain = new JTextField(20);
+
+        textFieldReading = new JTextField(20);
+        textFieldReading.setEditable(false);
+
+        textEditPanel.add(textFieldMain);
+        textEditPanel.add(textFieldReading);
+
+        mainPanel.add(textEditPanel, BorderLayout.CENTER);
+
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+        final JButton btnStartTest = new JButton("Start Test");
+        final JButton btnCancelTest = new JButton("Cancel Test");
+
+        btnStartTest.addActionListener((e) -> {
+            btnStartTest.setEnabled(false);
+            btnCancelTest.setEnabled(false);
+            startTest = true;
+            testStartLatch.countDown();
+        });
+
+        btnCancelTest.addActionListener((e) -> {
+            frame.dispose();
+            testStartLatch.countDown();
+        });
+        mainPanel.add(textArea, BorderLayout.NORTH);
+
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(btnStartTest);
+        buttonPanel.add(btnCancelTest);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+
+        lblTestStatus = new JLabel("");
+        lblTestStatus.setMinimumSize(new Dimension(250, 20));
+        lblTestStatus.setPreferredSize(new Dimension(250, 20));
+        lblTestStatus.setVisible(true);
+        textEditPanel.add(lblTestStatus);
+
+        frame.add(mainPanel);
+        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+        frame.pack();
+        frame.setLocationRelativeTo(null);
+
+        frame.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                testStartLatch.countDown();
+            }
+            @Override
+            public void windowOpened( WindowEvent e ){
+                textFieldMain.requestFocusInWindow();
+            }
+        });
+
+        textFieldMain.addInputMethodListener(new InputMethodListener() {
+            @Override
+            public void caretPositionChanged(InputMethodEvent event) {
+            }
+
+            @Override
+            public void inputMethodTextChanged(InputMethodEvent event) {
+                AttributedCharacterIterator itr = event.getText();
+                if (itr != null) {
+                    int toCopy = event.getCommittedCharacterCount();
+                    if (toCopy > 0) {
+                        itr.first();
+                        StringBuilder yomigana = new StringBuilder(
+                                textFieldReading.getText());
+                        while (toCopy-- > 0) {
+                            if (itr.getIndex() == itr.getRunStart(
+                                    AttributedCharacterIterator.Attribute.READING)) {
+                                java.text.Annotation annotatedText
+                                        = (java.text.Annotation) itr.
+                                                getAttribute(AttributedCharacterIterator.Attribute.READING);
+                                yomigana.append(annotatedText.getValue());
+                            }
+                            itr.next();
+                        }
+                        textFieldReading.setText(yomigana.toString());
+                    }
+                }
+            }
+        });
+
+        frame.setVisible(true);
+    }
+
+    private static void glyphTest() throws Exception {
+        Robot robotKeySimulator = new Robot();
+        performTasks(robotKeySimulator);
+    }
+
+    public static void performTasks(Robot robotForKeyInput) throws Exception {
+        lblTestStatus.setText("Running Tests..");
+        robotForKeyInput.setAutoDelay(500);
+
+        ArrayList<Integer> keyCodesToUse = new ArrayList<Integer>();
+
+        keyCodesToUse.add(KeyEvent.VK_A);
+        keyCodesToUse.add(KeyEvent.VK_B);
+        keyCodesToUse.add(KeyEvent.VK_E);
+        keyCodesToUse.add(KeyEvent.VK_SPACE);
+        keyCodesToUse.add(KeyEvent.VK_SPACE);
+        keyCodesToUse.add(KeyEvent.VK_ENTER);
+        keyCodesToUse.add(KeyEvent.VK_S);
+        keyCodesToUse.add(KeyEvent.VK_I);
+        keyCodesToUse.add(KeyEvent.VK_N);
+        keyCodesToUse.add(KeyEvent.VK_Z);
+        keyCodesToUse.add(KeyEvent.VK_O);
+        keyCodesToUse.add(KeyEvent.VK_U);
+        keyCodesToUse.add(KeyEvent.VK_SPACE);
+        keyCodesToUse.add(KeyEvent.VK_ENTER);
+
+        textFieldMain.requestFocusInWindow();
+
+        robotForKeyInput.waitForIdle();
+
+        enterInput(robotForKeyInput, keyCodesToUse);
+
+        SwingUtilities.invokeAndWait(() -> {
+            readingPass1 = textFieldReading.getText();
+        });
+
+        if (setTaskStatus(readingPass1, 1)) {
+            keyCodesToUse.remove((Integer) KeyEvent.VK_ENTER);
+
+            enterInput(robotForKeyInput, keyCodesToUse);
+
+            SwingUtilities.invokeAndWait(() -> {
+                readingPass2 = textFieldReading.getText();
+            });
+
+            if (setTaskStatus(readingPass2, 2)) {
+                if (readingPass1.equals(readingPass2)) {
+                    testPassed = true;
+                    testResult = "Test Passed : Same reading attribute "
+                            + "obtained from both passes ";
+                    lblTestStatus.setText(testResult);
+                } else {
+                    testResult = "Test Failed : Reading attribute from Pass 1 <"
+                            + readingPass1 + "> != Reading attribute "
+                            + "from Pass 2 <" + readingPass2 + ">";
+                }
+            }
+        }
+    }
+
+    private static void enterInput(Robot robotKeyInput,
+            ArrayList<Integer> keyInputs) {
+        textFieldReading.setText("");
+        textFieldMain.setText("");
+
+        String strKeyInput = "KeyPress=>";
+        int nOfKeyInputs = keyInputs.size();
+        for (int i = 0; i < nOfKeyInputs; i++) {
+            int keyToUse = keyInputs.get(i);
+            robotKeyInput.keyPress(keyToUse);
+            robotKeyInput.keyRelease(keyToUse);
+            strKeyInput += (Integer.toHexString(keyToUse)) + ":";
+        }
+
+        System.out.println(strKeyInput);
+    }
+
+    public static boolean setTaskStatus(String readingValue, int passCount) {
+        boolean status = false;
+
+        if (!readingValue.isEmpty()) {
+            testResult = "Attribute : " + readingValue
+                    + "read from pass " + Integer.toString(passCount);
+            status = true;
+        } else {
+            testResult = "Failed to read Reading attribute from pass  "
+                    + Integer.toString(passCount);
+        }
+
+        lblTestStatus.setText(testResult);
+
+        return status;
+    }
+}
--- a/test/jdk/javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentCanvas.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/jdk/javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentCanvas.java	Sat Dec 02 06:51:10 2017 +0100
@@ -33,12 +33,13 @@
  * @library ../../../../lib/testlibrary
  * @build Common ExtendedRobot
  * @run main PerPixelTranslucentCanvas
+ * @run main/othervm -Dsun.java2d.uiScale=1.5 PerPixelTranslucentCanvas
  */
 
 public class PerPixelTranslucentCanvas extends Common {
 
     JPanel center;
-    Color OVAL_COLOR = Color.BLUE;
+    static Color OVAL_COLOR = Color.BLUE;
 
     public static void main(String[] ignored) throws Exception {
         FG_COLOR = new Color(200, 0, 0, 100);
--- a/test/jdk/javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentSwing.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/jdk/javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentSwing.java	Sat Dec 02 06:51:10 2017 +0100
@@ -90,7 +90,7 @@
 
         Color color = robot.getPixelColor(loc.x + bounds.width / 2, loc.y + bounds.height + 3);
         System.out.println(color);
-        if (FG_COLOR.getRGB() == color.getRGB())
+        if (BG_COLOR.getRGB() != color.getRGB())
             throw new RuntimeException("Background is not translucent (" + color + ")");
 
         EventQueue.invokeAndWait(this::dispose);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/event/EventListenerList/GetUpToDateData.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.event.AWTEventListener;
+import java.util.EventListener;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.swing.event.EventListenerList;
+
+/**
+ * @test
+ * @bug 5031664
+ * @summary EventListenerList.getXXX should always return up to date data
+ */
+public final class GetUpToDateData {
+
+    static final EventListenerList listeners = new EventListenerList();
+
+    static final EventListener o1 = new EventListener() {
+    };
+    static final AWTEventListener o2 = event -> {
+    };
+
+    public static void main(final String[] args) throws Exception {
+        CountDownLatch go = new CountDownLatch(3);
+
+        Thread t1 = new Thread(() -> {
+            try {
+                // Time to warm-up t3, t4, t5
+                Thread.sleep(2000);
+            } catch (InterruptedException e) {
+            }
+            listeners.add(EventListener.class, o1);
+        });
+        Thread t2 = new Thread(() -> {
+            try {
+                // Time to warm-up t3, t4, t5
+                Thread.sleep(2000);
+            } catch (InterruptedException e) {
+            }
+            listeners.add(AWTEventListener.class, o2);
+        });
+
+        Thread t3 = new Thread(() -> {
+            while (listeners.getListenerCount() != 2) {
+            }
+            go.countDown();
+        });
+        Thread t4 = new Thread(() -> {
+            while (listeners.getListeners(EventListener.class).length != 1
+                    || listeners.getListeners(EventListener.class)[0] != o1) {
+            }
+            go.countDown();
+        });
+        Thread t5 = new Thread(() -> {
+            while (listeners.getListeners(AWTEventListener.class).length != 1
+                    || listeners.getListeners(AWTEventListener.class)[0] != o2) {
+            }
+            go.countDown();
+        });
+
+        t1.setDaemon(true);
+        t2.setDaemon(true);
+        t3.setDaemon(true);
+        t4.setDaemon(true);
+        t5.setDaemon(true);
+
+        t1.start();
+        t2.start();
+        t3.start();
+        t4.start();
+        t5.start();
+        if (!go.await(10, TimeUnit.SECONDS)) {
+            throw new RuntimeException("The test hangs");
+        }
+    }
+}
--- a/test/jdk/javax/xml/ws/8159058/SaajEmptyNamespaceTest.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/jdk/javax/xml/ws/8159058/SaajEmptyNamespaceTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8159058
+ * @bug 8159058 8186441
  * @summary Test that empty default namespace declaration clears the
  *          default namespace value
  * @modules java.xml.ws/com.sun.xml.internal.ws.api
@@ -61,6 +61,26 @@
 public class SaajEmptyNamespaceTest {
 
     /*
+     * Test that SOAP reader doesn't move namespaces declarations to SOAP body element
+     *  as reported in JDK-8186441
+     */
+    @Test
+    public void testPreserveNamespacesPosition() throws Exception {
+        // Create SOAP message from XML string and process it with SAAJ reader
+        XMLStreamReader envelope = XMLInputFactory.newFactory().createXMLStreamReader(
+                new StringReader(INPUT_SOAP_MESSAGE_2));
+        StreamMessage streamMessage = new StreamMessage(SOAPVersion.SOAP_11,
+                envelope, null);
+        SAAJFactory saajFact = new SAAJFactory();
+        SOAPMessage soapMessage = saajFact.readAsSOAPMessage(SOAPVersion.SOAP_11, streamMessage);
+
+        //Get SOAP body and convert it to string representation
+        SOAPBody body = soapMessage.getSOAPBody();
+        String bodyAsString = nodeToText(body);
+        Assert.assertEquals(bodyAsString, PRESERVE_NAMESPACES_EXPECTED_RESULT);
+    }
+
+    /*
      * Test that SOAP message with default namespace declaration that contains empty
      * string is properly processed by SAAJ reader.
      */
@@ -275,10 +295,28 @@
 
     // Expected body content after SAAJ processing
     private static String EXPECTED_RESULT = "<SampleServiceRequest"
-            +" xmlns=\"http://example.org/test\">"
+            + " xmlns=\"http://example.org/test\""
+            + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
             + "<RequestParams xmlns=\"\">"
             + "<Param1>hogehoge</Param1>"
             + "<Param2>fugafuga</Param2>"
             + "</RequestParams>"
             + "</SampleServiceRequest>";
+
+    private static String PRESERVE_NAMESPACES_EXPECTED_RESULT =
+            "<s:Body xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+            +"<Request xmlns=\"http://example.org/NS_1\">"
+            +"<Item><Contact xmlns=\"http://example.org/NS_2\">Test_Contact</Contact>"
+            +"</Item></Request></s:Body>";
+
+    private static String INPUT_SOAP_MESSAGE_2 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+            + "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+            + "<s:Body>"
+            + "<Request xmlns=\"http://example.org/NS_1\">"
+            + "<Item>"
+            + "<Contact xmlns=\"http://example.org/NS_2\">Test_Contact</Contact>"
+            + "</Item>"
+            + "</Request>"
+            + "</s:Body>"
+            + "</s:Envelope>";
 }
--- a/test/jdk/jdk/internal/util/jar/TestVersionedStream.java	Sat Dec 02 11:25:35 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +0,0 @@
-/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8163798
- * @summary basic tests for multi-release jar versioned streams
- * @library /test/lib
- * @modules jdk.jartool/sun.tools.jar java.base/jdk.internal.util.jar
- * @build jdk.test.lib.Platform
- *        jdk.test.lib.util.FileUtils
- * @run testng TestVersionedStream
- */
-
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UncheckedIOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import java.util.zip.ZipFile;
-
-import jdk.test.lib.util.FileUtils;
-
-public class TestVersionedStream {
-    private final Path userdir;
-    private final Set<String> unversionedEntryNames;
-
-    public TestVersionedStream() throws IOException {
-        userdir = Paths.get(System.getProperty("user.dir", "."));
-
-        // These are not real class files even though they end with .class.
-        // They are resource files so jar tool validation won't reject them.
-        // But they are what we want to test, especially q/Bar.class that
-        // could be in a concealed package if this was a modular multi-release
-        // jar.
-        createFiles(
-                "base/p/Bar.class",
-                "base/p/Foo.class",
-                "base/p/Main.class",
-                "v9/p/Foo.class",
-                "v10/p/Foo.class",
-                "v10/q/Bar.class",
-                "v11/p/Bar.class",
-                "v11/p/Foo.class"
-        );
-
-        jar("cf mmr.jar -C base . --release 9 -C v9 . " +
-                "--release 10 -C v10 . --release 11 -C v11 .");
-
-        System.out.println("Contents of mmr.jar\n=======");
-
-        try(JarFile jf = new JarFile("mmr.jar")) {
-            unversionedEntryNames = jf.stream()
-                    .map(je -> je.getName())
-                    .peek(System.out::println)
-                    .map(nm -> nm.startsWith("META-INF/versions/")
-                            ? nm.replaceFirst("META-INF/versions/\\d+/", "")
-                            : nm)
-                    .collect(Collectors.toCollection(LinkedHashSet::new));
-        }
-
-        System.out.println("=======");
-    }
-
-    @AfterClass
-    public void close() throws IOException {
-        Files.walk(userdir, 1)
-                .filter(p -> !p.equals(userdir))
-                .forEach(p -> {
-                    try {
-                        if (Files.isDirectory(p)) {
-                            FileUtils.deleteFileTreeWithRetry(p);
-                        } else {
-                            FileUtils.deleteFileIfExistsWithRetry(p);
-                        }
-                    } catch (IOException x) {
-                        throw new UncheckedIOException(x);
-                    }
-                });
-    }
-
-    @DataProvider
-    public Object[][] data() {
-        return new Object[][] {
-            {Runtime.Version.parse("8")},
-            {Runtime.Version.parse("9")},
-            {Runtime.Version.parse("10")},
-            {Runtime.Version.parse("11")},
-            {JarFile.baseVersion()},
-            {JarFile.runtimeVersion()}
-        };
-    }
-
-    @Test(dataProvider="data")
-    public void test(Runtime.Version version) throws Exception {
-        try (JarFile jf = new JarFile(new File("mmr.jar"), false, ZipFile.OPEN_READ, version);
-             Stream<JarEntry> jes = jdk.internal.util.jar.VersionedStream.stream(jf))
-        {
-            Assert.assertNotNull(jes);
-
-            // put versioned entries in list so we can reuse them
-            List<JarEntry> versionedEntries = jes.collect(Collectors.toList());
-
-            Assert.assertTrue(versionedEntries.size() > 0);
-
-            // also keep the names
-            List<String> versionedNames = new ArrayList<>(versionedEntries.size());
-
-            // verify the correct order while building enames
-            Iterator<String> allIt = unversionedEntryNames.iterator();
-            Iterator<JarEntry> verIt = versionedEntries.iterator();
-            boolean match = false;
-
-            while (verIt.hasNext()) {
-                match = false;
-                if (!allIt.hasNext()) break;
-                String name = verIt.next().getName();
-                versionedNames.add(name);
-                while (allIt.hasNext()) {
-                    if (name.equals(allIt.next())) {
-                        match = true;
-                        break;
-                    }
-                }
-            }
-            if (!match) {
-                Assert.fail("versioned entries not in same order as unversioned entries");
-            }
-
-            // verify the contents
-            Map<String,String> contents = new HashMap<>();
-            contents.put("p/Bar.class", "base/p/Bar.class");
-            contents.put("p/Main.class", "base/p/Main.class");
-            switch (version.major()) {
-                case 8:
-                    contents.put("p/Foo.class", "base/p/Foo.class");
-                    break;
-                case 9:
-                    contents.put("p/Foo.class", "v9/p/Foo.class");
-                    break;
-                case 10:
-                    contents.put("p/Foo.class", "v10/p/Foo.class");
-                    contents.put("q/Bar.class", "v10/q/Bar.class");
-                    break;
-                case 11:
-                    contents.put("p/Bar.class", "v11/p/Bar.class");
-                    contents.put("p/Foo.class", "v11/p/Foo.class");
-                    contents.put("q/Bar.class", "v10/q/Bar.class");
-                    break;
-                default:
-                    Assert.fail("Test out of date, please add more cases");
-            }
-
-            contents.entrySet().stream().forEach(e -> {
-                String name = e.getKey();
-                int i = versionedNames.indexOf(name);
-                Assert.assertTrue(i != -1, name + " not in enames");
-                JarEntry je = versionedEntries.get(i);
-                try (InputStream is = jf.getInputStream(je)) {
-                    String s = new String(is.readAllBytes()).replaceAll(System.lineSeparator(), "");
-                    Assert.assertTrue(s.endsWith(e.getValue()), s);
-                } catch (IOException x) {
-                    throw new UncheckedIOException(x);
-                }
-            });
-        }
-    }
-
-    private void createFiles(String... files) {
-        ArrayList<String> list = new ArrayList();
-        Arrays.stream(files)
-                .map(f -> Paths.get(userdir.toAbsolutePath().toString(), f))
-                .forEach(p -> {
-                    try {
-                        Files.createDirectories(p.getParent());
-                        Files.createFile(p);
-                        list.clear();
-                        list.add(p.toString().replace(File.separatorChar, '/'));
-                        Files.write(p, list);
-                    } catch (IOException x) {
-                        throw new UncheckedIOException(x);
-                    }});
-    }
-
-    private void jar(String args) {
-        new sun.tools.jar.Main(System.out, System.err, "jar")
-                .run(args.split(" +"));
-    }
-}
--- a/test/jdk/sanity/client/SwingSet/src/SliderDemoTest.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/SliderDemoTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -82,6 +82,7 @@
         JSliderOperator jso = new JSliderOperator(jfo,
                 new AccessibleNameChooser(accessibleName));
         if (accessibleName.equals(HORIZONTAL_PLAIN_SLIDER)) {
+            jso.waitHasFocus();
             checkKeyboard(jso);
             checkMouse(jso);
         }
--- a/test/jdk/sun/java2d/SunGraphics2D/DrawImageBilinear.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/jdk/sun/java2d/SunGraphics2D/DrawImageBilinear.java	Sat Dec 02 06:51:10 2017 +0100
@@ -23,11 +23,12 @@
 /*
  * @test
  * @key headful
- * @bug 5009033 6603000 6666362
+ * @bug 5009033 6603000 6666362 8159142
  * @summary Verifies that images transformed with bilinear filtering do not
  * leave artifacts at the edges.
- * @run main/othervm DrawImageBilinear
- * @run main/othervm -Dsun.java2d.opengl=True DrawImageBilinear
+ * @run main/othervm -Dsun.java2d.uiScale=2.5 DrawImageBilinear
+ * @run main/othervm -Dsun.java2d.uiScale=2.5 -Dsun.java2d.opengl=True DrawImageBilinear
+ * @run main/othervm -Dsun.java2d.uiScale=2.5 -Dsun.java2d.d3d=false DrawImageBilinear
  * @author campbelc
  */
 
--- a/test/jdk/tools/jar/multiRelease/Basic.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/jdk/tools/jar/multiRelease/Basic.java	Sat Dec 02 06:51:10 2017 +0100
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ # @bug 8186087
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          jdk.compiler
@@ -346,39 +347,6 @@
     }
 
     @Test
-    // resources with same name in different versions
-    // this is okay but produces warning
-    public void test08() throws Throwable {
-        String jarfile = "test.jar";
-
-        compile("test01");  //use same data as test01
-
-        Path classes = Paths.get("classes");
-
-        // add a resource to the base
-        Path source = Paths.get(src, "data", "test01", "base", "version");
-        Files.copy(source.resolve("Version.java"), classes.resolve("base")
-                .resolve("version").resolve("Version.java"));
-
-        jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
-                "--release", "9", "-C", classes.resolve("v9").toString(), ".")
-                .shouldHaveExitValue(SUCCESS)
-                .shouldBeEmpty();
-
-        // now add a different resource with same name to META-INF/version/9
-        Files.copy(source.resolve("Main.java"), classes.resolve("v9")
-                .resolve("version").resolve("Version.java"));
-
-        jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
-                "--release", "9", "-C", classes.resolve("v9").toString(), ".")
-                .shouldHaveExitValue(SUCCESS)
-                .shouldContain("multiple resources with same name");
-
-        FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile));
-        FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes"));
-    }
-
-    @Test
     // a class with an internal name different from the external name
     public void test09() throws Throwable {
         String jarfile = "test.jar";
@@ -451,7 +419,9 @@
                 .shouldNotHaveExitValue(SUCCESS)
                 .asLines();
 
+        /* "META-INF/versions/9/version/Nested$nested.class" is really NOT isolated
         assertTrue(output.size() == 4);
+        assertTrue(output.size() == 3);
         assertTrue(output.get(0).contains("an isolated nested class"),
                 output.get(0));
         assertTrue(output.get(1).contains("contains a new public class"),
@@ -460,6 +430,17 @@
                 output.get(2));
         assertTrue(output.get(3).contains("invalid multi-release jar file"),
                 output.get(3));
+        assertTrue(output.get(2).contains("invalid multi-release jar file"),
+               output.get(2));
+        */
+
+        assertTrue(output.size() == 3);
+        assertTrue(output.get(0).contains("an isolated nested class"),
+                output.get(0));
+        assertTrue(output.get(1).contains("contains a new public class"),
+                output.get(1));
+        assertTrue(output.get(2).contains("invalid multi-release jar file"),
+               output.get(2));
 
         FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile));
         FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes"));
@@ -495,6 +476,31 @@
     }
 
     @Test
+    // assure the nested-nested classes are acceptable
+    public void test13() throws Throwable {
+        String jarfile = "test.jar";
+
+        compile("test01");  //use same data as test01
+
+        Path classes = Paths.get("classes");
+
+        // add a base class with a nested and nested-nested class
+        Path source = Paths.get(src, "data", "test13", "base", "version");
+        javac(classes.resolve("base"), source.resolve("Nested.java"));
+
+        // add a versioned class with a nested and nested-nested class
+        source = Paths.get(src, "data", "test13", "v10", "version");
+        javac(classes.resolve("v10"), source.resolve("Nested.java"));
+
+        jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
+                "--release", "10", "-C", classes.resolve("v10").toString(), ".")
+                .shouldHaveExitValue(SUCCESS);
+
+        FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile));
+        FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes"));
+    }
+
+    @Test
     public void testCustomManifest() throws Throwable {
         String jarfile = "test.jar";
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jar/multiRelease/data/test13/base/version/Nested.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,22 @@
+package version;
+
+public class Nested {
+    public int getVersion() {
+        return 9;
+    }
+
+    protected void doNothing() {
+    }
+
+    private void anyName() {
+    }
+
+    class nested {
+        int save;
+
+        class nestnested {
+            int save;
+        }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jar/multiRelease/data/test13/v10/version/Nested.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,18 @@
+package version;
+
+public class Nested {
+    public int getVersion() {
+        return 10;
+    }
+
+    protected void doNothing() {
+    }
+
+    class nested {
+        int save = getVersion();
+
+        class nestnested {
+            int save = getVersion();;
+        }
+    }
+}
--- a/test/jdk/tools/jar/multiRelease/whitebox/jdk.jartool/sun/tools/jar/ValidatorComparatorTest.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/jdk/tools/jar/multiRelease/whitebox/jdk.jartool/sun/tools/jar/ValidatorComparatorTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -29,7 +29,7 @@
 
 import java.util.List;
 import static java.util.stream.Collectors.toList;
-import static sun.tools.jar.Validator.ENTRYNAME_COMPARATOR;
+import static sun.tools.jar.Main.ENTRYNAME_COMPARATOR;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
--- a/test/langtools/jdk/internal/shellsupport/doc/JavadocHelperTest.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/jdk/internal/shellsupport/doc/JavadocHelperTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8131019
+ * @bug 8131019 8190552
  * @summary Test JavadocHelper
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
--- a/test/langtools/jdk/javadoc/doclet/testCopyFiles/TestCopyFiles.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/TestCopyFiles.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,8 @@
 
 /*
  * @test
- * @bug  8157349
- * @summary  test copy of doc-files
+ * @bug  8157349 8185985
+ * @summary  test copy of doc-files, and its contents for HTML meta content.
  * @library  ../lib
  * @modules jdk.javadoc/jdk.javadoc.internal.tool
  * @build    JavadocTester
@@ -39,13 +39,123 @@
     }
 
     @Test
-    void testDocFilesInModules() {
+    void testDocFilesInModulePackages() {
         javadoc("-d", "modules-out",
+                "-top", "phi-TOP-phi",
+                "-bottom", "phi-BOTTOM-phi",
+                "-header", "phi-HEADER-phi",
+                "-footer", "phi-FOOTER-phi",
+                "-windowtitle", "phi-WINDOW-TITLE-phi",
+                "--module-source-path", testSrc("modules"),
+                "--module", "acme.mdle");
+        checkExit(Exit.OK);
+        checkOrder("p/doc-files/inpackage.html",
+                "\"Hello World\" (phi-WINDOW-TITLE-phi)",
+                "phi-TOP-phi",
+                // check top navbar
+                "<a href=\"../../acme.mdle-summary.html\">Module</a>",
+                "<a href=\"../../p/package-summary.html\">Package</a>",
+                "<a href=\"../../overview-tree.html\">Tree</a>",
+                "<a href=\"../../deprecated-list.html\">Deprecated</a>",
+                "<a href=\"../../index-all.html\">Index</a>",
+                "phi-HEADER-phi",
+                "In a named module acme.module and named package "
+                        + "<a href=\"../../p/package-summary.html\"><code>p</code></a>.",
+                "\"simpleTagLabel\">Since:</",
+                "1940",
+                // check bottom navbar
+                "<a href=\"../../acme.mdle-summary.html\">Module</a>",
+                "<a href=\"../../p/package-summary.html\">Package</a>",
+                "<a href=\"../../overview-tree.html\">Tree</a>",
+                "<a href=\"../../deprecated-list.html\">Deprecated</a>",
+                "<a href=\"../../index-all.html\">Index</a>",
+                "phi-FOOTER-phi",
+                "phi-BOTTOM-phi"
+        );
+    }
+
+    @Test
+    void testDocFilesInMultiModulePackagesWithRecursiveCopy() {
+        javadoc("-d", "multi-modules-out-recursive",
+                "-docfilessubdirs",
+                "-top", "phi-TOP-phi",
+                "-bottom", "phi-BOTTOM-phi",
+                "-header", "phi-HEADER-phi",
+                "-footer", "phi-FOOTER-phi",
+                "-windowtitle", "phi-WINDOW-TITLE-phi",
+                "--module-source-path", testSrc("modules"),
+                "--module", "acme.mdle,acme2.mdle");
+        checkExit(Exit.OK);
+        checkOrder("p/doc-files/inpackage.html",
+                "\"Hello World\" (phi-WINDOW-TITLE-phi)",
+                "phi-TOP-phi",
+                // check top navbar
+                "<a href=\"../../acme.mdle-summary.html\">Module</a>",
+                "<a href=\"../../p/package-summary.html\">Package</a>",
+                "<a href=\"../../overview-tree.html\">Tree</a>",
+                "<a href=\"../../deprecated-list.html\">Deprecated</a>",
+                "<a href=\"../../index-all.html\">Index</a>",
+                "phi-HEADER-phi",
+                "In a named module acme.module and named package "
+                        + "<a href=\"../../p/package-summary.html\"><code>p</code></a>.",
+                "\"simpleTagLabel\">Since:</",
+                "1940",
+                // check bottom navbar
+                "<a href=\"../../acme.mdle-summary.html\">Module</a>",
+                "<a href=\"../../p/package-summary.html\">Package</a>",
+                "<a href=\"../../overview-tree.html\">Tree</a>",
+                "<a href=\"../../deprecated-list.html\">Deprecated</a>",
+                "<a href=\"../../index-all.html\">Index</a>",
+                "phi-FOOTER-phi",
+                "phi-BOTTOM-phi"
+        );
+
+        // check the bottom most doc file
+        checkOrder("p2/doc-files/sub-dir/sub-dir-1/SubSubReadme.html",
+                "SubSubReadme (phi-WINDOW-TITLE-phi)",
+                "phi-TOP-phi",
+                // check top navbar
+                "<a href=\"../../../../acme2.mdle-summary.html\">Module</a>",
+                "<a href=\"../../../../p2/package-summary.html\">Package</a>",
+                "<a href=\"../../../../overview-tree.html\">Tree</a>",
+                "<a href=\"../../../../deprecated-list.html\">Deprecated</a>",
+                "<a href=\"../../../../index-all.html\">Index</a>",
+                "phi-HEADER-phi",
+                "SubSubReadme.html at third level of doc-file directory.",
+                // check bottom navbar
+                "<a href=\"../../../../acme2.mdle-summary.html\">Module</a>",
+                "<a href=\"../../../../p2/package-summary.html\">Package</a>",
+                "<a href=\"../../../../overview-tree.html\">Tree</a>",
+                "<a href=\"../../../../deprecated-list.html\">Deprecated</a>",
+                "<a href=\"../../../../index-all.html\">Index</a>",
+                "phi-FOOTER-phi",
+                "phi-BOTTOM-phi"
+        );
+    }
+    @Test
+    void testDocFilesInModulePackagesWithRecursiveCopy() {
+        javadoc("-d", "modules-out-recursive",
+                "-docfilessubdirs",
                 "--module-source-path", testSrc("modules"),
                 "--module", "acme.mdle");
         checkExit(Exit.OK);
         checkOutput("p/doc-files/inpackage.html", true,
-                "In a named module and named package"
+                "In a named module acme.module and named package "
+                + "<a href=\"../../p/package-summary.html\"><code>p</code></a>."
+        );
+    }
+
+    @Test
+    void testDocFilesInModulePackagesWithRecursiveCopyWithExclusion() {
+        javadoc("-d", "modules-out-recursive-with-exclusion",
+                "-docfilessubdirs",
+                "-excludedocfilessubdir", "sub-dir",
+                "--module-source-path", testSrc("modules"),
+                "--module", "acme.mdle");
+        checkExit(Exit.OK);
+        checkOutput("p/doc-files/inpackage.html", true,
+                "In a named module acme.module and named package "
+                + "<a href=\"../../p/package-summary.html\"><code>p</code></a>."
         );
     }
 
@@ -61,18 +171,71 @@
     }
 
     @Test
+    void testDocFilesInPackagesWithRecursiveCopy() {
+        javadoc("-d", "packages-out-recursive",
+                "-docfilessubdirs",
+                "-sourcepath", testSrc("packages"),
+                "p1");
+        checkExit(Exit.OK);
+
+        checkOutput("p1/doc-files/inpackage.html", true,
+                "A named package in an unnamed module"
+        );
+
+        checkOutput("p1/doc-files/sub-dir/SubReadme.html", true,
+                "<title>SubReadme</title>",
+                "SubReadme.html at second level of doc-file directory."
+        );
+    }
+
+    @Test
+    void testDocFilesInPackagesWithRecursiveCopyWithExclusion() {
+        javadoc("-d", "packages-out-recursive-with-exclusion",
+                "-docfilessubdirs",
+                "-excludedocfilessubdir", "sub-dir",
+                "-sourcepath", testSrc("packages"),
+                "p1");
+        checkExit(Exit.OK);
+
+        checkOutput("p1/doc-files/inpackage.html", true,
+                "A named package in an unnamed module"
+        );
+    }
+
+    @Test
     void testDocFilesInUnnamedPackages() {
         javadoc("-d", "unnamed-out",
+                "-windowtitle", "phi-WINDOW-TITLE-phi",
                 "-sourcepath", testSrc("unnamed"),
                 testSrc("unnamed/Foo.java")
         );
         checkExit(Exit.OK);
         checkOutput("doc-files/inpackage.html", true,
+                "<title>(phi-WINDOW-TITLE-phi)</title>\n",
                 "In an unnamed package"
         );
     }
 
     @Test
+    void testDocFilesInUnnamedPackagesWithRecursiveCopy() {
+        javadoc("-d", "unnamed-out-recursive",
+                "-docfilessubdirs",
+                "-windowtitle", "phi-WINDOW-TITLE-phi",
+                "-sourcepath", testSrc("unnamed"),
+                testSrc("unnamed/Foo.java")
+        );
+        checkExit(Exit.OK);
+        checkOutput("doc-files/inpackage.html", true,
+                "<title>(phi-WINDOW-TITLE-phi)</title>\n",
+                "In an unnamed package"
+        );
+        checkOutput("doc-files/doc-file/SubReadme.html", true,
+                "<title>Beep Beep (phi-WINDOW-TITLE-phi)</title>\n",
+                "SubReadme.html at second level of doc-file directory for unnamed package."
+        );
+    }
+
+    @Test
     void testDocFilesInPackagesSource7() {
         javadoc("-d", "packages-out-src7",
                 "-source", "7",
--- a/test/langtools/jdk/javadoc/doclet/testCopyFiles/modules/acme.mdle/p/doc-files/inpackage.html	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/modules/acme.mdle/p/doc-files/inpackage.html	Sat Dec 02 06:51:10 2017 +0100
@@ -28,6 +28,8 @@
     <title>"Hello World"</title>
   </head>
   <body>
-    In a named module and named package 
+    In a named module acme.module and named package {@link p}.
+    @author Wile E. Coyote
+    @since 1940
   </body>
 </html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/modules/acme.mdle/p/doc-files/sub-dir/SubReadme.html	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<!--
+  ~ 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.
+  -->
+
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>SubReadme</title>
+</head>
+<body>
+    SubReadme.html at second level of doc-file directory for acme.module.
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/modules/acme.mdle/p/doc-files/sub-dir/sub-dir-1/SubSubReadme.html	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<!--
+  ~ 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.
+  -->
+
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>SubSubReadme</title>
+</head>
+<body>
+    SubSubReadme.html at third level of doc-file directory.
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/modules/acme.mdle/p/package.html	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<!--
+  ~ 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.
+  -->
+
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>package.html file for p</title>
+</head>
+<body>
+    A named package {@link p} in a name module acme.mdle.
+    @author WECoyote
+    @since 1940
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/modules/acme2.mdle/module-info.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+ /**
+  * A test module.
+  */
+module acme2.mdle {
+    exports p2;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/modules/acme2.mdle/p2/Foo.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 p2;
+
+/**
+ * A test class.
+ */
+public class Foo {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/modules/acme2.mdle/p2/doc-files/inpackage.html	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,35 @@
+<!--
+Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.  Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+
+<html>
+  <head>
+    <title>"Hello World"</title>
+  </head>
+  <body>
+    In a named module acme2.mdle and named package {@link p2}.
+    @author Wile E. Coyote
+    @since 1940
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/modules/acme2.mdle/p2/doc-files/sub-dir/SubReadme.html	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<!--
+  ~ 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.
+  -->
+
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>SubReadme</title>
+</head>
+<body>
+    SubReadme.html at second level of doc-file directory for acme2.mdle.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/modules/acme2.mdle/p2/doc-files/sub-dir/sub-dir-1/SubSubReadme.html	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<!--
+  ~ 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.
+  -->
+
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>SubSubReadme</title>
+</head>
+<body>
+    SubSubReadme.html at third level of doc-file directory.
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/modules/acme2.mdle/p2/package.html	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<!--
+  ~ 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.
+  -->
+
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>package.html file for p</title>
+</head>
+<body>
+    A named package {@link p2} in a name module acme2.mdle.
+    @author WECoyote
+    @since 1940
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/modules/overview.html	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<!--
+  ~ 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.
+  -->
+
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>My overview html file</title>
+</head>
+<body>
+The overview html file
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/packages/p1/doc-files/sub-dir/SubReadme.html	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<!--
+  ~ 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.
+  -->
+
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>SubReadme</title>
+</head>
+<body>
+    SubReadme.html at second level of doc-file directory.
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/unnamed/doc-files/doc-file/SubReadme.html	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<!--
+  ~ 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.
+  -->
+
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <TITLE>Beep Beep</TITLE>
+</head>
+<body>
+     SubReadme.html at second level of doc-file directory for unnamed package.
+</body>
+</html>
\ No newline at end of file
--- a/test/langtools/jdk/javadoc/doclet/testCopyFiles/unnamed/doc-files/inpackage.html	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/unnamed/doc-files/inpackage.html	Sat Dec 02 06:51:10 2017 +0100
@@ -24,9 +24,6 @@
 -->
 
 <html>
-  <head>
-    <title>"Hello World"</title>
-  </head>
   <body>
     In an unnamed package 
   </body>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testGrandParentTypes/TestGrandParentTypes.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug      8182108
+ * @summary  Verify that grand parent interface types are correct, and
+ *           various interface related sections are correctly generated.
+ * @library  ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build    JavadocTester
+ * @run main TestGrandParentTypes
+ */
+
+public class TestGrandParentTypes extends JavadocTester {
+
+    public static void main(String... args) throws Exception {
+        TestGrandParentTypes tester = new TestGrandParentTypes();
+        tester.runTests();
+    }
+
+    @Test
+    void test1() {
+        javadoc("-d", "out-1",
+                "-package",
+                "-sourcepath", testSrc,
+                "pkg1");
+
+        checkExit(Exit.OK);
+
+        checkOrder("pkg1/A.SupplierWithAList.html",
+                "All Superinterfaces:",
+                "A.AList",
+                "java.util.Collection&lt;java.lang.Object&gt;",
+                "java.lang.Iterable&lt;java.lang.Object&gt;",
+                "java.util.List&lt;java.lang.Object&gt;");
+
+        checkOrder("pkg1/A.AList.html",
+                "All Superinterfaces:",
+                "java.util.Collection&lt;java.lang.Object&gt;",
+                "java.lang.Iterable&lt;java.lang.Object&gt;",
+                "java.util.List&lt;java.lang.Object&gt;");
+
+        checkOrder("pkg1/TEnum.html",
+                "All Implemented Interfaces:",
+                "java.io.Serializable",
+                "java.lang.Comparable");
+
+        checkOrder("pkg1/TError.html",
+                "All Implemented Interfaces:",
+                "java.io.Serializable");
+
+        checkOrder("pkg1/TException.html",
+                "All Implemented Interfaces:",
+                "java.io.Serializable");
+
+        checkOrder("pkg1/MList.html",
+                "All Implemented Interfaces:",
+                "java.io.Serializable",
+                "java.lang.Cloneable",
+                "java.lang.Iterable&lt;java.lang.String&gt;",
+                "java.util.Collection&lt;java.lang.String&gt;",
+                "java.util.List&lt;java.lang.String&gt;",
+                "java.util.RandomAccess");
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testGrandParentTypes/pkg1/A.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public interface A {
+    interface AList extends List<Object> { }
+    interface SupplierWithAList<T> extends AList {
+        T getThingy();
+    }
+}
+
+enum TEnum {}
+class TError extends Error {}
+class TException extends Exception {}
+class MList extends ArrayList<String> {}
--- a/test/langtools/jdk/javadoc/doclet/testPackageHtml/TestPackageHtml.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testPackageHtml/TestPackageHtml.java	Sat Dec 02 06:51:10 2017 +0100
@@ -44,7 +44,7 @@
                 "-sourcepath", testSrc,
                 "pkg1");
         checkExit(Exit.ERROR);
-        checkOutput(Output.OUT, true, "package.html:10: error: bad use of '>'");
+        checkOutput(Output.OUT, true, "package.html:5: error: bad use of '>'");
     }
 
     // Doclet must handle empty body in package.html, must
--- a/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java	Sat Dec 02 06:51:10 2017 +0100
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug      4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743 8177417
- *           8175218 8176452 8181215 8182263 8183511 8169819 8183037
+ *           8175218 8176452 8181215 8182263 8183511 8169819 8183037 8185369
  * @summary  Run tests on doclet stylesheet.
  * @author   jamieh
  * @library  ../lib
@@ -50,16 +50,6 @@
         // TODO: most of this test seems a bit silly, since javadoc is simply
         // copying in the stylesheet from the source directory
         checkOutput("stylesheet.css", true,
-                "/* Javadoc style sheet */",
-                "/*\n"
-                + "Overall document style\n"
-                + "*/",
-                "/*\n"
-                + "Heading styles\n"
-                + "*/",
-                "/*\n"
-                + "Navigation bar styles\n"
-                + "*/",
                 "body {\n"
                 + "    background-color:#ffffff;\n"
                 + "    color:#353833;\n"
@@ -173,8 +163,8 @@
                 + "    position:relative;\n"
                 + "    padding-top:129px;\n"
                 + "    margin-top:-129px;\n"
-                + "}\n"
-                + ".searchTagResult:before, .searchTagResult:target {\n"
+                + "}",
+                ".searchTagResult:before, .searchTagResult:target {\n"
                 + "    color:red;\n"
                 + "}",
                 "a[href]:hover, a[href]:focus {\n"
--- a/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java	Sat Dec 02 06:51:10 2017 +0100
@@ -102,7 +102,7 @@
                 "p2");
         checkExit(Exit.OK);
 
-        checkOutput(Output.OUT, true, "package.html:5: warning: invalid use of @summary");
+        checkOutput(Output.OUT, true, "package.html:3: warning: invalid use of @summary");
 
         checkOutput("index-all.html", true, "<div class=\"block\">foo bar</div>\n");
 
--- a/test/langtools/jdk/jshell/ForwardReferenceImportTest.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/jdk/jshell/ForwardReferenceImportTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -188,7 +188,7 @@
                 DiagCheck.DIAG_ERROR,
                 added(VALID),
                 ste(a, VALID, RECOVERABLE_NOT_DEFINED, true, null)));
-        assertDeclareFail("A.list = Arrays.asList(1, 2, 3);", "compiler.err.already.defined.static.single.import");
+        assertDeclareFail("A.list = Arrays.asList(1, 2, 3);", "compiler.err.already.defined.single.import");
         assertActiveKeys();
         assertDrop(list,
                 ste(list, VALID, DROPPED, true, null),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/jshell/InaccessibleExpressionTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test 8190939
+ * @summary test expressions whose type is inaccessible
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.javap
+ * @library /tools/lib
+ * @build KullaTesting Compiler
+ * @run testng InaccessibleExpressionTest
+ */
+
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.testng.annotations.BeforeMethod;
+import jdk.jshell.VarSnippet;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+
+@Test
+public class InaccessibleExpressionTest extends KullaTesting {
+
+    @BeforeMethod
+    @Override
+    public void setUp() {
+        Path path = Paths.get("eit");
+        Compiler compiler = new Compiler();
+        compiler.compile(path,
+                "package priv;\n" +
+                "\n" +
+                "import java.util.function.Supplier;\n" +
+                "import java.util.ArrayList;\n" +
+                "\n" +
+                "public class GetPriv {\n" +
+                "   private enum Count { One };\n" +
+                "   public static Packp down() { return new Packp(); }\n" +
+                "   public static MyList list() { return new MyList(); }\n" +
+                "   public static Count priv() { return Count.One; }\n" +
+                "}\n" +
+                "\n" +
+                "class Packp extends Packp2 {\n" +
+                        "public String toString() { return \"Packp\"; } }\n" +
+                "\n" +
+                "class Packp2 implements Supplier<Integer>  {" +
+                        "public Integer get() { return 5; }}\n" +
+                "\n" +
+                "class MyList extends ArrayList<Integer> {}");
+        String tpath = compiler.getPath(path).toString();
+        setUp(b -> b
+                .remoteVMOptions("--class-path", tpath)
+                .compilerOptions("--class-path", tpath));
+    }
+
+    public void testExternal() {
+        assertEval("import static priv.GetPriv.*;");
+        VarSnippet down = varKey(assertEval("down()", "Packp"));
+        assertEquals(down.typeName(), "priv.Packp");
+        assertEval(down.name() + ".get()", "5");
+        VarSnippet list = varKey(assertEval("list()", "[]"));
+        assertEquals(list.typeName(), "priv.MyList");
+        assertEval(list.name() + ".size()", "0");
+        VarSnippet one = varKey(assertEval("priv()", "One"));
+        assertEquals(one.typeName(), "priv.GetPriv.Count");
+    }
+
+    public void testInternal() {
+        assertEval(
+                "class Top {" +
+                "    private class Inner {" +
+                "        public String toString() { return \"Inner\"; }" +
+                "    }" +
+                "    Inner n = new Inner(); }");
+        VarSnippet n = varKey(assertEval("new Top().n", "Inner"));
+        assertEquals(n.typeName(), "Top.Inner");
+    }
+
+}
--- a/test/langtools/jdk/jshell/TypeNameTest.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/jdk/jshell/TypeNameTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8144903 8171981
+ * @bug 8144903 8171981 8191802
  * @summary Tests for determining the type from the expression
  * @build KullaTesting TestingInputStream
  * @run testng TypeNameTest
@@ -55,7 +55,7 @@
 
         assertEval("class D<T extends CharSequence> { D<? super T> getS() { return null; } }");
         assertEval("D<?> d = new D<String>();");
-        assertType("d.getS()", "D<? extends CharSequence>");
+        assertType("d.getS()", "D<?>");
         assertType("null", "Object");
         assertType("Class.forName( \"java.util.ArrayList\" )", "Class<?>");
         assertType("new ArrayList<Boolean>() {}", "ArrayList<Boolean>");
@@ -68,7 +68,7 @@
         assertEval("interface J extends A, I {}");
         assertEval("interface K extends A, I {}");
         assertEval("class P<T extends A & I> {}");
-        assertType("(P<?>) null", "P<? extends Object>");
+        assertType("(P<?>) null", "P<?>");
     }
 
     public void testConditionals() {
--- a/test/langtools/tools/javac/4980495/std/NonStatic2StaticImportClash.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/4980495/std/NonStatic2StaticImportClash.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,14 +1,14 @@
 /*
  * @test  /nodynamiccopyright/
- * @bug 7101822
+ * @bug 7101822 8133616
  * @summary Check the when clashing types are imported through an ordinary and static import,
  *          the compile-time error is properly reported.
  * @compile/fail/ref=NonStatic2StaticImportClash.out -XDrawDiagnostics NonStatic2StaticImportClash.java p1/A1.java p2/A2.java
  *
  */
 
-import p1.A1.f;
-import static p2.A2.f;
+import static p1.A1.f;
+import p2.A2.f;
 
 public class NonStatic2StaticImportClash {
 }
--- a/test/langtools/tools/javac/4980495/std/Static2NonStaticImportClash.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/4980495/std/Static2NonStaticImportClash.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,14 +1,14 @@
 /*
  * @test  /nodynamiccopyright/
- * @bug 7101822
+ * @bug 7101822 8133616
  * @summary Check the when clashing types are imported through an ordinary and static import,
  *          the compile-time error is properly reported.
  * @compile/fail/ref=Static2NonStaticImportClash.out -XDrawDiagnostics Static2NonStaticImportClash.java p1/A1.java p2/A2.java
  *
  */
 
-import static p2.A2.f;
-import p1.A1.f;
+import p2.A2.f;
+import static p1.A1.f;
 
 public class Static2NonStaticImportClash {
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/T8185451/MisleadingVarArgsErrorMsgTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,21 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 8185451
+ * @summary Misleading 'cannot be accessed from outside package' diagnostic for inconsistent varargs override
+ * @compile/fail/ref=MisleadingVarArgsErrorMsgTest.out -XDrawDiagnostics MisleadingVarArgsErrorMsgTest.java
+ */
+
+class MisleadingVarArgsErrorMsgTest {
+    class A {
+        void f(int... x) {}
+    }
+
+    class B extends A {
+        @Override
+        void f(int[] x) {}
+    }
+
+    {
+        new B().f(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/T8185451/MisleadingVarArgsErrorMsgTest.out	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,2 @@
+MisleadingVarArgsErrorMsgTest.java:19:16: compiler.err.cant.apply.symbol: kindname.method, f, int[], int, kindname.class, MisleadingVarArgsErrorMsgTest.B, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, int[]))
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/T8185983/RejectTypeArgsOnSelectTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,12 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 8185983
+ * @summary Javac should reject TypeArguments on field access expression
+ * @compile/fail/ref=RejectTypeArgsOnSelectTest.out -XDrawDiagnostics RejectTypeArgsOnSelectTest.java
+ */
+
+import java.util.*;
+
+class RejectTypeArgsOnSelectTest {
+    Iterator<RejectTypeArgsOnSelectTest> nullIter = Collections.<RejectTypeArgsOnSelectTest>EMPTY_LIST.iterator();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/T8185983/RejectTypeArgsOnSelectTest.out	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,2 @@
+RejectTypeArgsOnSelectTest.java:11:104: compiler.err.illegal.start.of.expr
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/analyzer/LambdaWithMethod.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,17 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 8191981
+ * @compile/fail/ref=LambdaWithMethod.out -Werror -XDrawDiagnostics -XDfind=lambda LambdaWithMethod.java
+ */
+
+public class LambdaWithMethod {
+    public static void run(Runnable r) {
+        run(new Runnable() {
+            public void run() {
+                put(get());
+            }
+        });
+    }
+    private static String get() { return null; }
+    private static void put(String i) {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/analyzer/LambdaWithMethod.out	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,4 @@
+LambdaWithMethod.java:9:28: compiler.warn.potential.lambda.found
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- a/test/langtools/tools/javac/diags/examples/AlreadyDefinedStaticImport/AlreadDefinedStaticImport.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/diags/examples/AlreadyDefinedStaticImport/AlreadDefinedStaticImport.java	Sat Dec 02 06:51:10 2017 +0100
@@ -23,5 +23,5 @@
 
 // key: compiler.err.already.defined.static.single.import
 
-import p.E1.A;
-import static p.E2.A;
+import static p.E1.A;
+import p.E2.A;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/LocalCantInferVoid.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.cant.infer.local.var.type
+// key: compiler.misc.local.cant.infer.void
+
+class LocalCantInferVoid {
+    void test() {
+        var s = test();
+    }
+}
--- a/test/langtools/tools/javac/doctree/DocCommentTester.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/doctree/DocCommentTester.java	Sat Dec 02 06:51:10 2017 +0100
@@ -404,9 +404,18 @@
             public Void visitDocComment(DocCommentTree node, Void p) {
                 header(node);
                 indent(+1);
+                // Applicable only to html files, print iff non-empty
+                if (!node.getPreamble().isEmpty())
+                    print("preamble", node.getPreamble());
+
                 print("firstSentence", node.getFirstSentence());
                 print("body", node.getBody());
                 print("block tags", node.getBlockTags());
+
+                // Applicable only to html files, print iff non-empty
+                if (!node.getPostamble().isEmpty())
+                    print("postamble", node.getPostamble());
+
                 indent(-1);
                 indent();
                 out.println("]");
@@ -418,6 +427,11 @@
                 return null;
             }
 
+            public Void visitDocType(DocTypeTree node, Void p) {
+                header(node, compress(node.getText()));
+                return null;
+            }
+
             public Void visitEndElement(EndElementTree node, Void p) {
                 header(node, node.getName().toString());
                 return null;
--- a/test/langtools/tools/javac/doctree/SimpleDocTreeVisitorTest.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/doctree/SimpleDocTreeVisitorTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 
 import com.sun.source.doctree.DocCommentTree;
 import com.sun.source.doctree.DocTree;
+import com.sun.source.doctree.DocTree.Kind;
 import com.sun.source.doctree.DocTreeVisitor;
 import com.sun.source.tree.ClassTree;
 import com.sun.source.tree.CompilationUnitTree;
@@ -84,7 +85,7 @@
             }
 
             for (DocTree.Kind k: DocTree.Kind.values()) {
-                if (!found.contains(k) && k != DocTree.Kind.OTHER)
+                if (!found.contains(k) && k != DocTree.Kind.OTHER && k != DocTree.Kind.DOC_TYPE)
                     error("not found: " + k);
             }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/doctree/dcapi/Anchor.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Anchor test.
+ */
+public class Anchor {}
--- a/test/langtools/tools/javac/doctree/dcapi/DocCommentTreeApiTester.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/doctree/dcapi/DocCommentTreeApiTester.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug  8132096 8157611
+ * @bug  8132096 8157611 8190552
  * @summary test the APIs  in the DocTree interface
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.file
@@ -52,6 +52,7 @@
 import javax.lang.model.util.Elements;
 import javax.tools.FileObject;
 import javax.tools.JavaFileObject;
+import javax.tools.JavaFileObject.Kind;
 import javax.tools.StandardJavaFileManager;
 
 import com.sun.source.doctree.DocTree;
@@ -64,8 +65,8 @@
 
 public class DocCommentTreeApiTester {
 
-    private static final String MARKER_START = "<!-- EXPECT_START";
-    private static final String MARKER_END   = "EXPECT_END -->";
+    private static final String MARKER_START = "EXPECT_START";
+    private static final String MARKER_END   = "EXPECT_END";
 
     private static final String testSrc = System.getProperty("test.src", ".");
 
@@ -85,22 +86,26 @@
         DocCommentTreeApiTester test = new DocCommentTreeApiTester();
         try {
             // test getting a DocTree from an element
-            test.runElementAndBreakIteratorTests("OverviewTest.java", "OverviewTest test.");
+            test.runElementAndBreakIteratorTests("Anchor.java", "Anchor test.");
 
             // test relative paths in a class within a package
-            test.runRelativePathTest("pkg/Anchor.java", "package.html");
+            test.runRelativePathTest("pkg/Anchor.java", "package.html", true);
 
             // tests files relative path in an unnamed package
-            test.runRelativePathTest("OverviewTest.java", "overview0.html");
+            test.runRelativePathTest("Anchor.java", "overview0.html", true);
 
-            // tests doctreepath using package element and package.html
-            test.runDocTreePath("pkg/Anchor.java", "package.html");
+            // test doctree path and Doc
+            test.runDocTreePath("Anchor.java", "package.html");
 
             // test for correct parsing using valid and some invalid html tags
-            for (int i = 0; i < 7; i++) {
-                String hname = "overview" + i + ".html";
-                test.runFileObjectTest(hname);
-            }
+            test.runFileObjectTest("overview0.html");
+            test.runFileObjectTest("overview1.html");
+            test.runFileObjectTest("overview2.html");
+            test.runFileObjectTest("overview3.html");
+            test.runFileObjectTest("overview4.html");
+            test.runFileObjectTest("overview5.html");
+            test.runFileObjectTest("overview6.html");
+            test.runFileObjectTest("overview7.html");
 
         } finally {
             test.status();
@@ -166,7 +171,8 @@
      * @param fileName the relative html file
      * @throws java.lang.Exception ouch
      */
-    public void runRelativePathTest(String javaFileName, String fileName) throws Exception  {
+    public void runRelativePathTest(String javaFileName, String fileName,
+                                    boolean bodyOnly) throws Exception  {
         List<File> javaFiles = new ArrayList<>();
         javaFiles.add(new File(testSrc, javaFileName));
 
@@ -185,13 +191,17 @@
             Element klass = elements.iterator().next();
 
             DocCommentTree dcTree = trees.getDocCommentTree(klass, fileName);
+
+            if (dcTree == null)
+                throw new Error("invalid input: " + fileName);
+
             StringWriter sw = new StringWriter();
             printer.print(dcTree, sw);
             String found = sw.toString();
 
             FileObject htmlFo = fm.getFileForInput(javax.tools.StandardLocation.SOURCE_PATH,
                     t.getElements().getPackageOf(klass).getQualifiedName().toString(),
-                    fileName);
+                    fileName + ".out");
 
             String expected = getExpected(htmlFo.openReader(true));
             astcheck(fileName, expected, found);
@@ -209,6 +219,7 @@
 
         List<File> otherFiles = new ArrayList<>();
         otherFiles.add(new File(testSrc, htmlfileName));
+        otherFiles.add(new File(testSrc, htmlfileName + ".out"));
 
         try (StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null)) {
             Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(javaFiles);
@@ -218,10 +229,22 @@
             final DocTrees trees = DocTrees.instance(t);
 
             StringWriter sw = new StringWriter();
+            DocCommentTree dct = null;
+            String expected = null;
+            for (JavaFileObject jfo : others) {
+                switch (jfo.getKind()) {
+                    case HTML:
+                        dct = trees.getDocCommentTree(jfo);
+                        if (dct == null)
+                            throw new Exception("invalid input: " + jfo);
+                        break;
+                    default:
+                        expected = getExpected(jfo.openReader(true));
+                }
+            }
 
-            printer.print(trees.getDocCommentTree(others.iterator().next()), sw);
+            printer.print(dct, sw);
             String found = sw.toString();
-            String expected = getExpected(otherFiles.iterator().next().toPath());
             astcheck(otherFiles.toString(), expected, found);
         }
     }
@@ -237,6 +260,9 @@
         List<File> javaFiles = new ArrayList<>();
         javaFiles.add(new File(testSrc, javaFileName));
 
+        List<File> otherFiles = new ArrayList<>();
+        otherFiles.add(new File(testSrc, pkgFileName + ".out"));
+
         List<File> dirs = new ArrayList<>();
         dirs.add(new File(testSrc));
 
@@ -256,15 +282,23 @@
             FileObject htmlFo = fm.getFileForInput(javax.tools.StandardLocation.SOURCE_PATH,
                     t.getElements().getPackageOf(klass).getQualifiedName().toString(),
                     "package.html");
-            System.out.println();
             DocTreePath treePath = trees.getDocTreePath(htmlFo, pkg);
+
+            if (treePath == null) {
+                throw new Exception("invalid input: " + htmlFo);
+            }
+
             DocCommentTree dcTree = treePath.getDocComment();
+            if (dcTree == null)
+                throw new Exception("invalid input" + htmlFo);
 
             StringWriter sw = new StringWriter();
             printer.print(dcTree, sw);
             String found = sw.toString();
+            Iterable<? extends JavaFileObject> oos = fm.getJavaFileObjectsFromFiles(otherFiles);
+            JavaFileObject otherFo = oos.iterator().next();
+            String expected = getExpected(otherFo.openReader(true));
 
-            String expected = getExpected(htmlFo.openReader(true));
             astcheck(pkgFileName, expected, found);
         }
     }
@@ -300,10 +334,6 @@
         return getExpected(lines);
     }
 
-    String getExpected(Path p) throws IOException {
-        return getExpected(Files.readAllLines(p));
-    }
-
     String getExpected(List<String> lines) {
         boolean start = false;
         StringWriter sw = new StringWriter();
--- a/test/langtools/tools/javac/doctree/dcapi/OverviewTest.java	Sat Dec 02 11:25:35 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 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.
- */
-
-/**
- * OverviewTest test.
- */
-public class OverviewTest {}
--- a/test/langtools/tools/javac/doctree/dcapi/overview0.html	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/doctree/dcapi/overview0.html	Sat Dec 02 06:51:10 2017 +0100
@@ -1,48 +1,8 @@
-<!--
- Copyright (c) 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.
--->
-<!-- EXPECT_START
-DocComment[DOC_COMMENT, pos:1
-  firstSentence: 1
-    Text[TEXT, pos:1, A_simple_well_fo...rmed_html_document]
-  body: 4
-    StartElement[START_ELEMENT, pos:36
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:41, overview0.html]
-    StartElement[START_ELEMENT, pos:55
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:60, .]
-  block tags: empty
-]
-EXPECT_END -->
+<!-- /nodynamiccopyright/ -->
 <HTML>
 <HEAD>
 </HEAD>
 <BODY>
-A simple well formed html document <pre>overview0.html<pre>.
+A simple well formed html document <pre>overview0.html</pre>.
 </BODY>
-</HTML>
-
+</HTML>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/doctree/dcapi/overview0.html.out	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,33 @@
+EXPECT_START
+DocComment[DOC_COMMENT, pos:0
+  preamble: 5
+    Comment[COMMENT, pos:0, <!--_/nodynamiccopyright/_-->]
+    StartElement[START_ELEMENT, pos:30
+      name:HTML
+      attributes: empty
+    ]
+    StartElement[START_ELEMENT, pos:37
+      name:HEAD
+      attributes: empty
+    ]
+    EndElement[END_ELEMENT, pos:44, HEAD]
+    StartElement[START_ELEMENT, pos:52
+      name:BODY
+      attributes: empty
+    ]
+  firstSentence: 1
+    Text[TEXT, pos:59, A_simple_well_fo...rmed_html_document]
+  body: 4
+    StartElement[START_ELEMENT, pos:94
+      name:pre
+      attributes: empty
+    ]
+    Text[TEXT, pos:99, overview0.html]
+    EndElement[END_ELEMENT, pos:113, pre]
+    Text[TEXT, pos:119, .]
+  block tags: empty
+  postamble: 2
+    EndElement[END_ELEMENT, pos:121, BODY]
+    EndElement[END_ELEMENT, pos:129, HTML]
+]
+EXPECT_END
--- a/test/langtools/tools/javac/doctree/dcapi/overview1.html	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/doctree/dcapi/overview1.html	Sat Dec 02 06:51:10 2017 +0100
@@ -1,47 +1,8 @@
-<!--
- Copyright (c) 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.
--->
-<!-- EXPECT_START
-DocComment[DOC_COMMENT, pos:1
-  firstSentence: 1
-    Text[TEXT, pos:1, Html_document]
-  body: 4
-    StartElement[START_ELEMENT, pos:15
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:20, overview1.html]
-    StartElement[START_ELEMENT, pos:34
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:39, .|Missing_HTML.]
-  block tags: empty
-]
-EXPECT_END -->
+<!-- /nodynamiccopyright/ -->
 <HEAD>
 </HEAD>
 <BODY>
-Html document <pre>overview1.html<pre>.
+Html document <pre>overview1.html</pre>.
 Missing HTML.
 </BODY>
-</HTML>
+</HTML>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/doctree/dcapi/overview1.html.out	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,29 @@
+EXPECT_START
+DocComment[DOC_COMMENT, pos:0
+  preamble: 4
+    Comment[COMMENT, pos:0, <!--_/nodynamiccopyright/_-->]
+    StartElement[START_ELEMENT, pos:30
+      name:HEAD
+      attributes: empty
+    ]
+    EndElement[END_ELEMENT, pos:37, HEAD]
+    StartElement[START_ELEMENT, pos:45
+      name:BODY
+      attributes: empty
+    ]
+  firstSentence: 1
+    Text[TEXT, pos:52, Html_document]
+  body: 4
+    StartElement[START_ELEMENT, pos:66
+      name:pre
+      attributes: empty
+    ]
+    Text[TEXT, pos:71, overview1.html]
+    EndElement[END_ELEMENT, pos:85, pre]
+    Text[TEXT, pos:91, .|Missing_HTML.]
+  block tags: empty
+  postamble: 2
+    EndElement[END_ELEMENT, pos:107, BODY]
+    EndElement[END_ELEMENT, pos:115, HTML]
+]
+EXPECT_END
--- a/test/langtools/tools/javac/doctree/dcapi/overview2.html	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/doctree/dcapi/overview2.html	Sat Dec 02 06:51:10 2017 +0100
@@ -1,47 +1,8 @@
-<!--
- Copyright (c) 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.
--->
-<!-- EXPECT_START
-DocComment[DOC_COMMENT, pos:1
-  firstSentence: 1
-    Text[TEXT, pos:1, Html_document]
-  body: 4
-    StartElement[START_ELEMENT, pos:15
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:20, overview2.html]
-    StartElement[START_ELEMENT, pos:34
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:39, .|Missing_HEAD.]
-  block tags: empty
-]
-EXPECT_END -->
+<!-- /nodynamiccopyright/ -->
 <HTML>
 </HEAD>
 <BODY>
-Html document <pre>overview2.html<pre>.
+Html document <pre>overview2.html</pre>.
 Missing HEAD.
 </BODY>
-</HTML>
+</HTML>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/doctree/dcapi/overview2.html.out	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,29 @@
+EXPECT_START
+DocComment[DOC_COMMENT, pos:0
+  preamble: 4
+    Comment[COMMENT, pos:0, <!--_/nodynamiccopyright/_-->]
+    StartElement[START_ELEMENT, pos:30
+      name:HTML
+      attributes: empty
+    ]
+    EndElement[END_ELEMENT, pos:37, HEAD]
+    StartElement[START_ELEMENT, pos:45
+      name:BODY
+      attributes: empty
+    ]
+  firstSentence: 1
+    Text[TEXT, pos:52, Html_document]
+  body: 4
+    StartElement[START_ELEMENT, pos:66
+      name:pre
+      attributes: empty
+    ]
+    Text[TEXT, pos:71, overview2.html]
+    EndElement[END_ELEMENT, pos:85, pre]
+    Text[TEXT, pos:91, .|Missing_HEAD.]
+  block tags: empty
+  postamble: 2
+    EndElement[END_ELEMENT, pos:107, BODY]
+    EndElement[END_ELEMENT, pos:115, HTML]
+]
+EXPECT_END
--- a/test/langtools/tools/javac/doctree/dcapi/overview3.html	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/doctree/dcapi/overview3.html	Sat Dec 02 06:51:10 2017 +0100
@@ -1,47 +1,8 @@
-<!--
- Copyright (c) 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.
--->
-<!-- EXPECT_START
-DocComment[DOC_COMMENT, pos:1
-  firstSentence: 1
-    Text[TEXT, pos:1, Html_document]
-  body: 4
-    StartElement[START_ELEMENT, pos:15
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:20, overview3.html]
-    StartElement[START_ELEMENT, pos:34
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:39, .|Missing_enclosing_HEAD.]
-  block tags: empty
-]
-EXPECT_END -->
+<!-- /nodynamiccopyright/ -->
 <HTML>
 <HEAD>
 <BODY>
-Html document <pre>overview3.html<pre>.
+Html document <pre>overview3.html</pre>.
 Missing enclosing HEAD.
 </BODY>
-</HTML>
+</HTML>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/doctree/dcapi/overview3.html.out	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,32 @@
+EXPECT_START
+DocComment[DOC_COMMENT, pos:0
+  preamble: 4
+    Comment[COMMENT, pos:0, <!--_/nodynamiccopyright/_-->]
+    StartElement[START_ELEMENT, pos:30
+      name:HTML
+      attributes: empty
+    ]
+    StartElement[START_ELEMENT, pos:37
+      name:HEAD
+      attributes: empty
+    ]
+    StartElement[START_ELEMENT, pos:44
+      name:BODY
+      attributes: empty
+    ]
+  firstSentence: 1
+    Text[TEXT, pos:51, Html_document]
+  body: 4
+    StartElement[START_ELEMENT, pos:65
+      name:pre
+      attributes: empty
+    ]
+    Text[TEXT, pos:70, overview3.html]
+    EndElement[END_ELEMENT, pos:84, pre]
+    Text[TEXT, pos:90, .|Missing_enclosing_HEAD.]
+  block tags: empty
+  postamble: 2
+    EndElement[END_ELEMENT, pos:116, BODY]
+    EndElement[END_ELEMENT, pos:124, HTML]
+]
+EXPECT_END
--- a/test/langtools/tools/javac/doctree/dcapi/overview4.html	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/doctree/dcapi/overview4.html	Sat Dec 02 06:51:10 2017 +0100
@@ -1,44 +1,6 @@
-<!--
- Copyright (c) 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.
+<!-- /nodynamiccopyright/ -->
 
- 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.
--->
-<!-- EXPECT_START
-DocComment[DOC_COMMENT, pos:1
-  firstSentence: 1
-    Text[TEXT, pos:1, Html_document]
-  body: 4
-    StartElement[START_ELEMENT, pos:15
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:20, overview4.html]
-    StartElement[START_ELEMENT, pos:34
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:39, .|Only_BODY]
-  block tags: empty
-]
-EXPECT_END -->
 <BODY>
-Html document <pre>overview4.html<pre>.
+Html document <pre>overview4.html</pre>.
 Only BODY
-</BODY>
+</BODY>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/doctree/dcapi/overview4.html.out	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,23 @@
+EXPECT_START
+DocComment[DOC_COMMENT, pos:0
+  preamble: 2
+    Comment[COMMENT, pos:0, <!--_/nodynamiccopyright/_-->]
+    StartElement[START_ELEMENT, pos:31
+      name:BODY
+      attributes: empty
+    ]
+  firstSentence: 1
+    Text[TEXT, pos:38, Html_document]
+  body: 4
+    StartElement[START_ELEMENT, pos:52
+      name:pre
+      attributes: empty
+    ]
+    Text[TEXT, pos:57, overview4.html]
+    EndElement[END_ELEMENT, pos:71, pre]
+    Text[TEXT, pos:77, .|Only_BODY]
+  block tags: empty
+  postamble: 1
+    EndElement[END_ELEMENT, pos:89, BODY]
+]
+EXPECT_END
--- a/test/langtools/tools/javac/doctree/dcapi/overview5.html	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/doctree/dcapi/overview5.html	Sat Dec 02 06:51:10 2017 +0100
@@ -1,47 +1,8 @@
-<!--
- Copyright (c) 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.
--->
-<!-- EXPECT_START
-DocComment[DOC_COMMENT, pos:1
-  firstSentence: 1
-    Text[TEXT, pos:1, Html_document]
-  body: 4
-    StartElement[START_ELEMENT, pos:15
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:20, overview5.html]
-    StartElement[START_ELEMENT, pos:34
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:39, .|Missing_enclosing_HTML]
-  block tags: empty
-]
-EXPECT_END -->
+<!-- /nodynamiccopyright/ -->
 <HTML>
 <HEAD>
 </HEAD>
 <BODY>
-Html document <pre>overview5.html<pre>.
+Html document <pre>overview5.html</pre>.
 Missing enclosing HTML
-</BODY>
+</BODY>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/doctree/dcapi/overview5.html.out	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,32 @@
+EXPECT_START
+DocComment[DOC_COMMENT, pos:0
+  preamble: 5
+    Comment[COMMENT, pos:0, <!--_/nodynamiccopyright/_-->]
+    StartElement[START_ELEMENT, pos:30
+      name:HTML
+      attributes: empty
+    ]
+    StartElement[START_ELEMENT, pos:37
+      name:HEAD
+      attributes: empty
+    ]
+    EndElement[END_ELEMENT, pos:44, HEAD]
+    StartElement[START_ELEMENT, pos:52
+      name:BODY
+      attributes: empty
+    ]
+  firstSentence: 1
+    Text[TEXT, pos:59, Html_document]
+  body: 4
+    StartElement[START_ELEMENT, pos:73
+      name:pre
+      attributes: empty
+    ]
+    Text[TEXT, pos:78, overview5.html]
+    EndElement[END_ELEMENT, pos:92, pre]
+    Text[TEXT, pos:98, .|Missing_enclosing_HTML]
+  block tags: empty
+  postamble: 1
+    EndElement[END_ELEMENT, pos:123, BODY]
+]
+EXPECT_END
--- a/test/langtools/tools/javac/doctree/dcapi/overview6.html	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/doctree/dcapi/overview6.html	Sat Dec 02 06:51:10 2017 +0100
@@ -1,40 +1,4 @@
-<!--
- Copyright (c) 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.
--->
-<!-- EXPECT_START
-DocComment[DOC_COMMENT, pos:1
-  firstSentence: 1
-    Text[TEXT, pos:1, The_first_correct_body_pair.]
-  body: 4
-    EndElement[END_ELEMENT, pos:30, BODY]
-    Text[TEXT, pos:37, ||]
-    StartElement[START_ELEMENT, pos:39
-      name:BODY
-      attributes: empty
-    ]
-    Text[TEXT, pos:45, |Illegal_second_...body_pair,_the_first_body_should_not_be_ignored.]
-  block tags: empty
-]
-EXPECT_END -->
+<!-- /nodynamiccopyright/ -->
 <HTML>
 <HEAD>
 </HEAD>
@@ -46,4 +10,3 @@
 Illegal second body pair, the first body should not be ignored.
 </BODY>
 </HTML>
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/doctree/dcapi/overview6.html.out	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,32 @@
+EXPECT_START
+DocComment[DOC_COMMENT, pos:0
+  preamble: 5
+    Comment[COMMENT, pos:0, <!--_/nodynamiccopyright/_-->]
+    StartElement[START_ELEMENT, pos:30
+      name:HTML
+      attributes: empty
+    ]
+    StartElement[START_ELEMENT, pos:37
+      name:HEAD
+      attributes: empty
+    ]
+    EndElement[END_ELEMENT, pos:44, HEAD]
+    StartElement[START_ELEMENT, pos:52
+      name:BODY
+      attributes: empty
+    ]
+  firstSentence: 1
+    Text[TEXT, pos:59, The_first_correct_body_pair.]
+  body: empty
+  block tags: empty
+  postamble: 5
+    EndElement[END_ELEMENT, pos:88, BODY]
+    StartElement[START_ELEMENT, pos:97
+      name:BODY
+      attributes: empty
+    ]
+    Text[TEXT, pos:104, Illegal_second_b...ody_pair,_the_first_body_should_not_be_ignored.|]
+    EndElement[END_ELEMENT, pos:168, BODY]
+    EndElement[END_ELEMENT, pos:176, HTML]
+]
+EXPECT_END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/doctree/dcapi/overview7.html	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,6 @@
+<!-- /nodynamiccopyright/ -->
+<HTML>
+<HEAD>
+</HEAD>
+<BODY>@since 1.0</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/doctree/dcapi/overview7.html.out	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,29 @@
+EXPECT_START
+DocComment[DOC_COMMENT, pos:0
+  preamble: 5
+    Comment[COMMENT, pos:0, <!--_/nodynamiccopyright/_-->]
+    StartElement[START_ELEMENT, pos:30
+      name:HTML
+      attributes: empty
+    ]
+    StartElement[START_ELEMENT, pos:37
+      name:HEAD
+      attributes: empty
+    ]
+    EndElement[END_ELEMENT, pos:44, HEAD]
+    StartElement[START_ELEMENT, pos:52
+      name:BODY
+      attributes: empty
+    ]
+  firstSentence: empty
+  body: empty
+  block tags: 1
+    Since[SINCE, pos:58
+      body: 1
+        Text[TEXT, pos:65, 1.0]
+    ]
+  postamble: 2
+    EndElement[END_ELEMENT, pos:68, BODY]
+    EndElement[END_ELEMENT, pos:76, HTML]
+]
+EXPECT_END
--- a/test/langtools/tools/javac/doctree/dcapi/package.html	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/doctree/dcapi/package.html	Sat Dec 02 06:51:10 2017 +0100
@@ -1,47 +1,11 @@
-<!--
- Copyright (c) 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.
--->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<!-- /nodynamiccopyright/ -->
 <HTML>
 <HEAD>
+    <TITLE>The Crafty Fox</TITLE>
 </HEAD>
 <BODY>
 A simple well formed html document <pre>package.html<pre>.
 </BODY>
-</HTML>
-<!-- EXPECT_START
-DocComment[DOC_COMMENT, pos:1
-  firstSentence: 1
-    Text[TEXT, pos:1, This_is_a_very_simple]
-  body: 4
-    StartElement[START_ELEMENT, pos:23
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:28, _well_formed_html_document_]
-    StartElement[START_ELEMENT, pos:55
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:60, _using_some_html_tags.]
-  block tags: empty
-]
-EXPECT_END -->
+</HTML>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/doctree/dcapi/package.html.out	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,43 @@
+EXPECT_START
+DocComment[DOC_COMMENT, pos:10
+  preamble: 9
+    DocType[DOC_TYPE, pos:10, HTML_PUBLIC_"-//...W3C//DTD_HTML_4.01//EN"|________"http://www.w3.org/TR/html4/strict.dtd"]
+    Comment[COMMENT, pos:99, <!--_/nodynamiccopyright/_-->]
+    StartElement[START_ELEMENT, pos:129
+      name:HTML
+      attributes: empty
+    ]
+    StartElement[START_ELEMENT, pos:136
+      name:HEAD
+      attributes: empty
+    ]
+    StartElement[START_ELEMENT, pos:147
+      name:TITLE
+      attributes: empty
+    ]
+    Text[TEXT, pos:154, The_Crafty_Fox]
+    EndElement[END_ELEMENT, pos:168, TITLE]
+    EndElement[END_ELEMENT, pos:177, HEAD]
+    StartElement[START_ELEMENT, pos:185
+      name:BODY
+      attributes: empty
+    ]
+  firstSentence: 1
+    Text[TEXT, pos:192, A_simple_well_fo...rmed_html_document]
+  body: 4
+    StartElement[START_ELEMENT, pos:227
+      name:pre
+      attributes: empty
+    ]
+    Text[TEXT, pos:232, package.html]
+    StartElement[START_ELEMENT, pos:244
+      name:pre
+      attributes: empty
+    ]
+    Text[TEXT, pos:249, .]
+  block tags: empty
+  postamble: 2
+    EndElement[END_ELEMENT, pos:251, BODY]
+    EndElement[END_ELEMENT, pos:259, HTML]
+]
+EXPECT_END
--- a/test/langtools/tools/javac/doctree/dcapi/pkg/package.html	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/doctree/dcapi/pkg/package.html	Sat Dec 02 06:51:10 2017 +0100
@@ -1,48 +1,9 @@
-<!--
- Copyright (c) 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.
--->
-<!-- EXPECT_START
-DocComment[DOC_COMMENT, pos:1
-  firstSentence: 1
-    Text[TEXT, pos:1, A_simple_well_fo...rmed_html_document]
-  body: 4
-    StartElement[START_ELEMENT, pos:36
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:41, package.html]
-    StartElement[START_ELEMENT, pos:53
-      name:pre
-      attributes: empty
-    ]
-    Text[TEXT, pos:58, .|In_package_pkg.]
-  block tags: empty
-]
-EXPECT_END -->
+<!--  /nodynamiccopyright/ -->
 <HTML>
 <HEAD>
 </HEAD>
 <BODY>
-A simple well formed html document <pre>package.html<pre>.
+A simple well formed html document <pre>package.html</pre>.
 In package pkg.
 </BODY>
-</HTML>
+</HTML>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/doctree/dcapi/pkg/package.html.out	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,33 @@
+EXPECT_START
+DocComment[DOC_COMMENT, pos:0
+  preamble: 5
+    Comment[COMMENT, pos:0, <!--__/nodynamiccopyright/_-->]
+    StartElement[START_ELEMENT, pos:31
+      name:HTML
+      attributes: empty
+    ]
+    StartElement[START_ELEMENT, pos:38
+      name:HEAD
+      attributes: empty
+    ]
+    EndElement[END_ELEMENT, pos:45, HEAD]
+    StartElement[START_ELEMENT, pos:53
+      name:BODY
+      attributes: empty
+    ]
+  firstSentence: 1
+    Text[TEXT, pos:60, A_simple_well_fo...rmed_html_document]
+  body: 4
+    StartElement[START_ELEMENT, pos:95
+      name:pre
+      attributes: empty
+    ]
+    Text[TEXT, pos:100, package.html]
+    EndElement[END_ELEMENT, pos:112, pre]
+    Text[TEXT, pos:118, .|In_package_pkg.]
+  block tags: empty
+  postamble: 2
+    EndElement[END_ELEMENT, pos:136, BODY]
+    EndElement[END_ELEMENT, pos:144, HTML]
+]
+EXPECT_END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/generics/inference/8178427/T8178427.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8178427
+ * @summary NPE in Infer$CheckUpperBounds
+ * @compile T8178427.java
+ */
+
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.function.*;
+import java.util.stream.*;
+
+abstract class X {
+    public interface N<K, V> {
+        Stream<V> getValues();
+    }
+
+    abstract <K, V> N<K, V> c();
+
+    abstract <T, K, V, M extends N<K, V>> Collector<T, ?, M> f(
+            Function<? super T, ? extends K> k,
+            Function<? super T, ? extends Stream<? extends V>> v,
+            Supplier<M> multimapSupplier);
+
+    void m(Map<String, N<?, ?>> c, ExecutorService s) {
+        s.submit(() -> {
+            return c.entrySet().parallelStream()
+                    .collect(f(Map.Entry::getKey, e -> e.getValue().getValues(), this::c));
+        });
+    }
+}
+
--- a/test/langtools/tools/javac/lib/DPrinter.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/lib/DPrinter.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1028,6 +1028,12 @@
             return visitInlineTag(node, null);
         }
 
+        @Override
+        public Void visitDocType(DocTypeTree node, Void aVoid) {
+            printLimitedEscapedString("body", node.getText());
+            return visitTree(node, null);
+        }
+
         public Void visitEndElement(EndElementTree node, Void p) {
             printName("name", node.getName());
             return visitTree(node, null);
--- a/test/langtools/tools/javac/lvti/BadLocalVarInferenceTest.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/lvti/BadLocalVarInferenceTest.java	Sat Dec 02 06:51:10 2017 +0100
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8177466
+ * @bug 8177466 8191834
  * @summary Add compiler support for local variable type-inference
  * @compile/fail/ref=BadLocalVarInferenceTest.out -XDrawDiagnostics BadLocalVarInferenceTest.java
  */
@@ -27,7 +27,10 @@
             void m(String s) { }
         };
         var s = f(x -> { x.charAt(0); }); //LHS was String
+        var t = m(); //void
     }
 
     <Z> Z f(Supplier<Z> sz) { return null; }
+
+    void m() { }
 }
--- a/test/langtools/tools/javac/lvti/BadLocalVarInferenceTest.out	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/javac/lvti/BadLocalVarInferenceTest.out	Sat Dec 02 06:51:10 2017 +0100
@@ -7,4 +7,5 @@
 BadLocalVarInferenceTest.java:25:29: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: BadLocalVarInferenceTest$1, m(java.lang.Object), BadLocalVarInferenceTest.Foo
 BadLocalVarInferenceTest.java:26:13: compiler.err.method.does.not.override.superclass
 BadLocalVarInferenceTest.java:29:27: compiler.err.cant.resolve.location.args: kindname.method, charAt, , int, (compiler.misc.location.1: kindname.variable, x, java.lang.Object)
-9 errors
+BadLocalVarInferenceTest.java:30:13: compiler.err.cant.infer.local.var.type: t, (compiler.misc.local.cant.infer.void)
+10 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/T8191893.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8191802 8191893
+ * @summary Upward projection result is A<? extends Number> instead of A<? super Integer>
+ * @compile T8191893.java
+ */
+
+class T8191893 {
+
+    static class A<E> { }
+
+    <T> A<? super T> m(T t) {
+        return null;
+    }
+
+    <U> A<? super A<? super U>> m2(A<? super U> u) {
+        return null;
+    }
+
+    void test() {
+        var varValue = m2(m(10));
+        A<? super A<Object>> expectedTypeValue = varValue;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/T8191959.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8191802 8191959
+ * @summary Upward projection result is A<? extends Number> instead of A<? super Integer>
+ * @compile T8191959.java
+ */
+
+public class T8191959 {
+    static class A<E> { }
+
+    <T> A<? super T> m(T t) {
+        return null;
+    }
+
+    <U> A<? super A<? extends U>> m2(A<? super U> u) {
+        return null;
+    }
+
+    void test() {
+        var varValue = m2(m(10));
+        A<? super A<? extends Integer>> expectedTypeValue = varValue;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/TestBadArray.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8191802
+ * @summary Upward projection result is A<? extends Number> instead of A<? super Integer>
+ * @compile TestBadArray.java
+ */
+
+import java.util.List;
+
+class TestArr {
+    <Z> List<? super Z[]> m(List<Z> z) { return null; }
+    void test(List<? extends Number> l) {
+        var v = m(l);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lvti/harness/UpperBounds.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8191802
+ * @summary Upward projection result is A<? extends Number> instead of A<? super Integer>
+ * @modules jdk.compiler/com.sun.source.tree
+ *          jdk.compiler/com.sun.source.util
+ *          jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.code
+ *          jdk.compiler/com.sun.tools.javac.util
+ * @build LocalVariableInferenceTester
+ * @run main LocalVariableInferenceTester UpperBounds.java
+ */
+class UpperBounds {
+
+    static class A<T extends Number> { }
+
+    static class C<T extends Comparable<T>> { }
+
+    void test1(A<? super Integer> s) {
+        //U is not Object, Bi is not fbound and U is not more specific than Bi, use "? super L"
+        @InferredType("UpperBounds.A<? super java.lang.Integer>")
+        var x = s;
+    }
+
+    void test2(C<? super Integer> s) {
+        //U is not Object, Bi is fbound, use "? extends L"
+        @InferredType("UpperBounds.C<? extends java.lang.Comparable<?>>")
+        var x = s;
+    }
+
+    void test3(A<? extends Object> s) {
+        //U is not Object, Bi is not fbound and U is not more specific than Bi, L is undefined, use "?"
+        @InferredType("UpperBounds.A<?>")
+        var x = s;
+    }
+
+    void test4(A<? extends Integer> s) {
+        //U is not Object, Bi is not fbound and U is more specific than Bi, use "? extends U"
+        @InferredType("UpperBounds.A<? extends java.lang.Integer>")
+        var x = s;
+    }
+
+    void test5(A<? extends Object> s) {
+        //U is not Object, Bi is not fbound and U is not more specific than Bi, L is undefined, use "?"
+        @InferredType("UpperBounds.A<?>")
+        var x = s;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/model/util/TestTypeKindVisitors.java	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,196 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     8191234
+ * @summary Test TypeKind visitors on pseudo types.
+ * @library /tools/javac/lib
+ * @modules java.compiler
+ * @build   JavacTestingAbstractProcessor TestTypeKindVisitors
+ * @compile -processor TestTypeKindVisitors -proc:only TestTypeKindVisitors.java
+ */
+
+import java.lang.annotation.Annotation;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.element.*;
+import javax.lang.model.type.*;
+import javax.lang.model.util.*;
+import static javax.lang.model.SourceVersion.*;
+
+public class TestTypeKindVisitors extends JavacTestingAbstractProcessor {
+    @Override
+    public boolean process(Set<? extends TypeElement> tes,
+                           RoundEnvironment round) {
+        if (round.processingOver())
+            return true;
+
+        List<NoType> tradNoTypes = List.of(types.getNoType(TypeKind.NONE),
+                                           types.getNoType(TypeKind.VOID),
+                                           getPackageNoType());
+        NoType moduleNoType = getModuleNoType();
+
+        // For KindVisitors based on 6, 7, and 8
+        for (TypeVisitor<TypeKind, String> visitor : getVisitors()) {
+            System.out.println(visitor.getClass().getSuperclass().getName());
+
+            for (NoType noType : tradNoTypes) {
+                System.out.println("\t" + noType.toString());
+                checkTypeKind(noType.getKind(), visitor.visit(noType));
+            }
+
+            if (RELEASE_9.compareTo(visitor.getClass().getSuperclass().
+                                    getAnnotation(SupportedSourceVersion.class).
+                                    value()) > 0) {
+                try {
+                    System.out.println("\t" + moduleNoType.toString());
+                    visitor.visit(moduleNoType);
+                } catch (UnknownTypeException ute) {
+                    ; // Expected
+                }
+            } else {
+                checkTypeKind(moduleNoType.getKind(), visitor.visit(moduleNoType));
+            }
+        }
+
+        return true;
+    }
+
+    private NoType getPackageNoType() {
+        TypeMirror type = elements.getPackageElement("java.lang").asType();
+        checkTypeKind(TypeKind.PACKAGE, type.getKind());
+        return (NoType) type;
+    }
+
+    private NoType getModuleNoType() {
+        TypeMirror type = elements.getModuleElement("java.base").asType();
+        checkTypeKind(TypeKind.MODULE, type.getKind());
+        return (NoType) type;
+    }
+
+    private void checkTypeKind(TypeKind expected, TypeKind retreived) {
+        if (retreived != expected)
+            throw new AssertionError("Unexpected type kind " + retreived);
+    }
+
+    List<TypeVisitor<TypeKind, String>> getVisitors() {
+        return List.of(new TypeKindVisitor6<>(null) {
+                           @Override
+                           protected TypeKind defaultAction(TypeMirror e, String p) {
+                               throw new AssertionError("Should not reach");
+                           }
+
+                           @Override
+                           public TypeKind visitNoTypeAsVoid(NoType t, String p) {
+                               return t.getKind();
+                           }
+
+                           @Override
+                           public TypeKind visitNoTypeAsNone(NoType t, String p) {
+                               return t.getKind();
+                           }
+
+                           @Override
+                           public TypeKind visitNoTypeAsPackage(NoType t, String p) {
+                               return t.getKind();
+                           }
+                           // Leave default behavior for a NoType module
+                       },
+
+                       new TypeKindVisitor7<>(null){
+                           @Override
+                           protected TypeKind defaultAction(TypeMirror e, String p) {
+                               throw new AssertionError("Should not reach");
+                           }
+
+                           @Override
+                           public TypeKind visitNoTypeAsVoid(NoType t, String p) {
+                               return t.getKind();
+                           }
+
+                           @Override
+                           public TypeKind visitNoTypeAsNone(NoType t, String p) {
+                               return t.getKind();
+                           }
+
+                           @Override
+                           public TypeKind visitNoTypeAsPackage(NoType t, String p) {
+                               return t.getKind();
+                           }
+                           // Leave default behavior for a NoType module
+
+                       },
+
+                       new TypeKindVisitor8<>(null){
+                           @Override
+                           protected TypeKind defaultAction(TypeMirror e, String p) {
+                               throw new AssertionError("Should not reach");
+                           }
+
+                           @Override
+                           public TypeKind visitNoTypeAsVoid(NoType t, String p) {
+                               return t.getKind();
+                           }
+
+                           @Override
+                           public TypeKind visitNoTypeAsNone(NoType t, String p) {
+                               return t.getKind();
+                           }
+
+                           @Override
+                           public TypeKind visitNoTypeAsPackage(NoType t, String p) {
+                               return t.getKind();
+                           }
+                           // Leave default behavior for a NoType module
+
+                       },
+
+                       new TypeKindVisitor9<>(null){
+                           @Override
+                           protected TypeKind defaultAction(TypeMirror e, String p) {
+                               throw new AssertionError("Should not reach");
+                           }
+
+                           @Override
+                           public TypeKind visitNoTypeAsVoid(NoType t, String p) {
+                               return t.getKind();
+                           }
+
+                           @Override
+                           public TypeKind visitNoTypeAsNone(NoType t, String p) {
+                               return t.getKind();
+                           }
+
+                           @Override
+                           public TypeKind visitNoTypeAsPackage(NoType t, String p) {
+                               return t.getKind();
+                           }
+
+                           @Override
+                           public TypeKind visitNoTypeAsModule(NoType t, String p) {
+                               return t.getKind();
+                           }
+                       });
+    }
+}
--- a/test/langtools/tools/jdeps/MultiReleaseJar.java	Sat Dec 02 11:25:35 2017 +0530
+++ b/test/langtools/tools/jdeps/MultiReleaseJar.java	Sat Dec 02 06:51:10 2017 +0100
@@ -240,17 +240,26 @@
         cmds[0] = cmdPath.resolve(cmds[0]).toString();
         ProcessBuilder pb = new ProcessBuilder(cmds);
         pb.directory(mrjar.toFile());
-        Process p = pb.start();
-        p.waitFor(10, TimeUnit.SECONDS);
-        String out;
-        try (InputStream is = p.getInputStream()) {
-            out = new String(is.readAllBytes());
+        Process p = null;
+        try {
+            p = pb.start();
+            p.waitFor();
+
+            String out;
+            try (InputStream is = p.getInputStream()) {
+                out = new String(is.readAllBytes());
+            }
+            String err;
+            try (InputStream is = p.getErrorStream()) {
+                err = new String(is.readAllBytes());
+            }
+            return new Result(cmd, p.exitValue(), out, err);
+        } catch (Throwable t) {
+            if (p != null) {
+                p.destroyForcibly().waitFor();
+            }
+            throw t;
         }
-        String err;
-        try (InputStream is = p.getErrorStream()) {
-            err = new String(is.readAllBytes());
-        }
-        return new Result(cmd, p.exitValue(), out, err);
     }
 
     void checkResult(Result r) throws Exception {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8135178.js	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8135178: importPackage not working even with load "Mozilla compatibility script"
+ *
+ * @test
+ * @run
+ */
+
+var ScriptContext = javax.script.ScriptContext;
+var manager = new javax.script.ScriptEngineManager();
+
+var engine1 = manager.getEngineByName("nashorn");
+engine1.eval("load('nashorn:mozilla_compat.js')");
+manager.setBindings(engine1.getBindings(ScriptContext.ENGINE_SCOPE));
+
+var engine2 = manager.getEngineByName("nashorn");
+engine2.eval("load('nashorn:mozilla_compat.js');");
+engine2.eval("importPackage(java.util);");
+
+engine2.eval("var al = new ArrayList()");
+Assert.assertTrue(engine2.eval("al instanceof java.util.ArrayList"));
+Assert.assertTrue(engine2.get("al") instanceof java.util.ArrayList);
+
+engine2.eval("var hm = new HashMap()");
+Assert.assertTrue(engine2.eval("hm instanceof java.util.HashMap"));
+Assert.assertTrue(engine2.get("hm") instanceof java.util.HashMap);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/es6/JDK-8059835.js	Sat Dec 02 06:51:10 2017 +0100
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8059835: Optimistic splitting doesn't work with let and const
+ *
+ * @test
+ * @run
+ * @option --language=es6
+ * @option -Dnashorn.compiler.splitter.threshold=100
+ * @fork
+ */
+
+function f() {
+    let sum = 0;
+    const c = 13;
+    if (true) {
+        let x = 0;
+        const y = 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        sum += x;
+        sum += y;
+    }
+    outer: while (true) {
+        let x = 0;
+        const y = 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        sum += x;
+        sum += y;
+        sum += c;
+        let i = 0;
+        const k = 1;
+        while (true) {
+            x += k;
+            if (++i === 10) {
+                break outer;
+            }
+        }
+        x += k;
+    }
+    return sum;
+}
+
+function g() {
+    let sum = 0;
+    const c = 13;
+    if (true) {
+        let x = 0;
+        const y = 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        sum += x;
+        sum += y;
+    }
+    outer: while (true) {
+        let x = 0;
+        const y = 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        x += 1;
+        sum += x;
+        sum += y;
+        sum += c;
+        let i = 0;
+        const k = 1;
+        while (true) {
+            x += k;
+            if (++i === 10) return 'abc';
+        }
+        x += k;
+    }
+    return sum;
+}
+
+Assert.assertTrue(f() === 80);
+Assert.assertTrue(g() === 'abc');