changeset 47509:8f62c5ed3f6f lambda-leftovers

manual merge with default
author mcimadamore
date Thu, 19 Oct 2017 21:39:39 +0100
parents 194bc551c790 c28e2522ac81
children ebd70c37f1fc
files make/hotspot/copy/Copy-java.base.gmk make/jdk/src/classes/build/tools/generatenimbus/ObjectFactory.java src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/DesktopProperty.java src/java.desktop/share/native/libfontmanager/FontInstanceAdapter.cpp src/java.desktop/share/native/libfontmanager/FontInstanceAdapter.h src/java.desktop/share/native/libfontmanager/layout/AlternateSubstSubtables.cpp src/java.desktop/share/native/libfontmanager/layout/AlternateSubstSubtables.h src/java.desktop/share/native/libfontmanager/layout/AnchorTables.cpp src/java.desktop/share/native/libfontmanager/layout/AnchorTables.h src/java.desktop/share/native/libfontmanager/layout/ArabicLayoutEngine.cpp src/java.desktop/share/native/libfontmanager/layout/ArabicLayoutEngine.h src/java.desktop/share/native/libfontmanager/layout/ArabicShaping.cpp src/java.desktop/share/native/libfontmanager/layout/ArabicShaping.h src/java.desktop/share/native/libfontmanager/layout/AttachmentPosnSubtables.h src/java.desktop/share/native/libfontmanager/layout/CanonData.cpp src/java.desktop/share/native/libfontmanager/layout/CanonShaping.cpp src/java.desktop/share/native/libfontmanager/layout/CanonShaping.h src/java.desktop/share/native/libfontmanager/layout/CharSubstitutionFilter.h src/java.desktop/share/native/libfontmanager/layout/ClassDefinitionTables.cpp src/java.desktop/share/native/libfontmanager/layout/ClassDefinitionTables.h src/java.desktop/share/native/libfontmanager/layout/ContextualGlyphInsertion.h src/java.desktop/share/native/libfontmanager/layout/ContextualGlyphInsertionProc2.cpp src/java.desktop/share/native/libfontmanager/layout/ContextualGlyphInsertionProc2.h src/java.desktop/share/native/libfontmanager/layout/ContextualGlyphSubstProc.cpp src/java.desktop/share/native/libfontmanager/layout/ContextualGlyphSubstProc.h src/java.desktop/share/native/libfontmanager/layout/ContextualGlyphSubstProc2.cpp src/java.desktop/share/native/libfontmanager/layout/ContextualGlyphSubstProc2.h src/java.desktop/share/native/libfontmanager/layout/ContextualGlyphSubstitution.h src/java.desktop/share/native/libfontmanager/layout/ContextualSubstSubtables.cpp src/java.desktop/share/native/libfontmanager/layout/ContextualSubstSubtables.h src/java.desktop/share/native/libfontmanager/layout/CoverageTables.cpp src/java.desktop/share/native/libfontmanager/layout/CoverageTables.h src/java.desktop/share/native/libfontmanager/layout/CursiveAttachmentSubtables.cpp src/java.desktop/share/native/libfontmanager/layout/CursiveAttachmentSubtables.h src/java.desktop/share/native/libfontmanager/layout/DefaultCharMapper.h src/java.desktop/share/native/libfontmanager/layout/DeviceTables.cpp src/java.desktop/share/native/libfontmanager/layout/DeviceTables.h src/java.desktop/share/native/libfontmanager/layout/ExtensionSubtables.cpp src/java.desktop/share/native/libfontmanager/layout/ExtensionSubtables.h src/java.desktop/share/native/libfontmanager/layout/Features.cpp src/java.desktop/share/native/libfontmanager/layout/GDEFMarkFilter.cpp src/java.desktop/share/native/libfontmanager/layout/GDEFMarkFilter.h src/java.desktop/share/native/libfontmanager/layout/GXLayoutEngine.cpp src/java.desktop/share/native/libfontmanager/layout/GXLayoutEngine.h src/java.desktop/share/native/libfontmanager/layout/GXLayoutEngine2.cpp src/java.desktop/share/native/libfontmanager/layout/GXLayoutEngine2.h src/java.desktop/share/native/libfontmanager/layout/GlyphDefinitionTables.cpp src/java.desktop/share/native/libfontmanager/layout/GlyphDefinitionTables.h src/java.desktop/share/native/libfontmanager/layout/GlyphIterator.cpp src/java.desktop/share/native/libfontmanager/layout/GlyphIterator.h src/java.desktop/share/native/libfontmanager/layout/GlyphLookupTables.cpp src/java.desktop/share/native/libfontmanager/layout/GlyphLookupTables.h src/java.desktop/share/native/libfontmanager/layout/GlyphPositionAdjustments.cpp src/java.desktop/share/native/libfontmanager/layout/GlyphPositionAdjustments.h src/java.desktop/share/native/libfontmanager/layout/GlyphPositioningTables.cpp src/java.desktop/share/native/libfontmanager/layout/GlyphPositioningTables.h src/java.desktop/share/native/libfontmanager/layout/GlyphPosnLookupProc.cpp src/java.desktop/share/native/libfontmanager/layout/GlyphPosnLookupProc.h src/java.desktop/share/native/libfontmanager/layout/GlyphSubstLookupProc.cpp src/java.desktop/share/native/libfontmanager/layout/GlyphSubstLookupProc.h src/java.desktop/share/native/libfontmanager/layout/GlyphSubstitutionTables.cpp src/java.desktop/share/native/libfontmanager/layout/GlyphSubstitutionTables.h src/java.desktop/share/native/libfontmanager/layout/HanLayoutEngine.cpp src/java.desktop/share/native/libfontmanager/layout/HanLayoutEngine.h src/java.desktop/share/native/libfontmanager/layout/HangulLayoutEngine.cpp src/java.desktop/share/native/libfontmanager/layout/HangulLayoutEngine.h src/java.desktop/share/native/libfontmanager/layout/ICUFeatures.h src/java.desktop/share/native/libfontmanager/layout/IndicClassTables.cpp src/java.desktop/share/native/libfontmanager/layout/IndicLayoutEngine.cpp src/java.desktop/share/native/libfontmanager/layout/IndicLayoutEngine.h src/java.desktop/share/native/libfontmanager/layout/IndicRearrangement.h src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor.cpp src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor.h src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor2.cpp src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor2.h src/java.desktop/share/native/libfontmanager/layout/IndicReordering.cpp src/java.desktop/share/native/libfontmanager/layout/IndicReordering.h src/java.desktop/share/native/libfontmanager/layout/KernTable.cpp src/java.desktop/share/native/libfontmanager/layout/KernTable.h src/java.desktop/share/native/libfontmanager/layout/KhmerLayoutEngine.cpp src/java.desktop/share/native/libfontmanager/layout/KhmerLayoutEngine.h src/java.desktop/share/native/libfontmanager/layout/KhmerReordering.cpp src/java.desktop/share/native/libfontmanager/layout/KhmerReordering.h src/java.desktop/share/native/libfontmanager/layout/LEFontInstance.cpp src/java.desktop/share/native/libfontmanager/layout/LEFontInstance.h src/java.desktop/share/native/libfontmanager/layout/LEGlyphFilter.h src/java.desktop/share/native/libfontmanager/layout/LEGlyphStorage.cpp src/java.desktop/share/native/libfontmanager/layout/LEGlyphStorage.h src/java.desktop/share/native/libfontmanager/layout/LEInsertionList.cpp src/java.desktop/share/native/libfontmanager/layout/LEInsertionList.h src/java.desktop/share/native/libfontmanager/layout/LELanguages.h src/java.desktop/share/native/libfontmanager/layout/LEScripts.h src/java.desktop/share/native/libfontmanager/layout/LEStandalone.h src/java.desktop/share/native/libfontmanager/layout/LESwaps.h src/java.desktop/share/native/libfontmanager/layout/LETableReference.h src/java.desktop/share/native/libfontmanager/layout/LETypes.h src/java.desktop/share/native/libfontmanager/layout/LayoutEngine.cpp src/java.desktop/share/native/libfontmanager/layout/LayoutEngine.h src/java.desktop/share/native/libfontmanager/layout/LayoutTables.h src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc.cpp src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc.h src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc2.cpp src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc2.h src/java.desktop/share/native/libfontmanager/layout/LigatureSubstSubtables.cpp src/java.desktop/share/native/libfontmanager/layout/LigatureSubstSubtables.h src/java.desktop/share/native/libfontmanager/layout/LigatureSubstitution.h src/java.desktop/share/native/libfontmanager/layout/LookupProcessor.cpp src/java.desktop/share/native/libfontmanager/layout/LookupProcessor.h src/java.desktop/share/native/libfontmanager/layout/LookupTables.cpp src/java.desktop/share/native/libfontmanager/layout/LookupTables.h src/java.desktop/share/native/libfontmanager/layout/Lookups.cpp src/java.desktop/share/native/libfontmanager/layout/Lookups.h src/java.desktop/share/native/libfontmanager/layout/MPreFixups.cpp src/java.desktop/share/native/libfontmanager/layout/MPreFixups.h src/java.desktop/share/native/libfontmanager/layout/MarkArrays.cpp src/java.desktop/share/native/libfontmanager/layout/MarkArrays.h src/java.desktop/share/native/libfontmanager/layout/MarkToBasePosnSubtables.cpp src/java.desktop/share/native/libfontmanager/layout/MarkToBasePosnSubtables.h src/java.desktop/share/native/libfontmanager/layout/MarkToLigaturePosnSubtables.cpp src/java.desktop/share/native/libfontmanager/layout/MarkToLigaturePosnSubtables.h src/java.desktop/share/native/libfontmanager/layout/MarkToMarkPosnSubtables.cpp src/java.desktop/share/native/libfontmanager/layout/MarkToMarkPosnSubtables.h src/java.desktop/share/native/libfontmanager/layout/MirroredCharData.cpp src/java.desktop/share/native/libfontmanager/layout/MorphStateTables.h src/java.desktop/share/native/libfontmanager/layout/MorphTables.cpp src/java.desktop/share/native/libfontmanager/layout/MorphTables.h src/java.desktop/share/native/libfontmanager/layout/MorphTables2.cpp src/java.desktop/share/native/libfontmanager/layout/MultipleSubstSubtables.cpp src/java.desktop/share/native/libfontmanager/layout/MultipleSubstSubtables.h src/java.desktop/share/native/libfontmanager/layout/NonContextualGlyphSubst.h src/java.desktop/share/native/libfontmanager/layout/NonContextualGlyphSubstProc.cpp src/java.desktop/share/native/libfontmanager/layout/NonContextualGlyphSubstProc.h src/java.desktop/share/native/libfontmanager/layout/NonContextualGlyphSubstProc2.cpp src/java.desktop/share/native/libfontmanager/layout/NonContextualGlyphSubstProc2.h src/java.desktop/share/native/libfontmanager/layout/OpenTypeLayoutEngine.cpp src/java.desktop/share/native/libfontmanager/layout/OpenTypeLayoutEngine.h src/java.desktop/share/native/libfontmanager/layout/OpenTypeTables.h src/java.desktop/share/native/libfontmanager/layout/OpenTypeUtilities.cpp src/java.desktop/share/native/libfontmanager/layout/OpenTypeUtilities.h src/java.desktop/share/native/libfontmanager/layout/PairPositioningSubtables.cpp src/java.desktop/share/native/libfontmanager/layout/PairPositioningSubtables.h src/java.desktop/share/native/libfontmanager/layout/ScriptAndLanguage.cpp src/java.desktop/share/native/libfontmanager/layout/ScriptAndLanguage.h src/java.desktop/share/native/libfontmanager/layout/ScriptAndLanguageTags.cpp src/java.desktop/share/native/libfontmanager/layout/ScriptAndLanguageTags.h src/java.desktop/share/native/libfontmanager/layout/SegmentArrayProcessor.cpp src/java.desktop/share/native/libfontmanager/layout/SegmentArrayProcessor.h src/java.desktop/share/native/libfontmanager/layout/SegmentArrayProcessor2.cpp src/java.desktop/share/native/libfontmanager/layout/SegmentArrayProcessor2.h src/java.desktop/share/native/libfontmanager/layout/SegmentSingleProcessor.cpp src/java.desktop/share/native/libfontmanager/layout/SegmentSingleProcessor.h src/java.desktop/share/native/libfontmanager/layout/SegmentSingleProcessor2.cpp src/java.desktop/share/native/libfontmanager/layout/SegmentSingleProcessor2.h src/java.desktop/share/native/libfontmanager/layout/ShapingTypeData.cpp src/java.desktop/share/native/libfontmanager/layout/SimpleArrayProcessor.cpp src/java.desktop/share/native/libfontmanager/layout/SimpleArrayProcessor.h src/java.desktop/share/native/libfontmanager/layout/SimpleArrayProcessor2.cpp src/java.desktop/share/native/libfontmanager/layout/SimpleArrayProcessor2.h src/java.desktop/share/native/libfontmanager/layout/SinglePositioningSubtables.cpp src/java.desktop/share/native/libfontmanager/layout/SinglePositioningSubtables.h src/java.desktop/share/native/libfontmanager/layout/SingleSubstitutionSubtables.cpp src/java.desktop/share/native/libfontmanager/layout/SingleSubstitutionSubtables.h src/java.desktop/share/native/libfontmanager/layout/SingleTableProcessor.cpp src/java.desktop/share/native/libfontmanager/layout/SingleTableProcessor.h src/java.desktop/share/native/libfontmanager/layout/SingleTableProcessor2.cpp src/java.desktop/share/native/libfontmanager/layout/SingleTableProcessor2.h src/java.desktop/share/native/libfontmanager/layout/StateTableProcessor.cpp src/java.desktop/share/native/libfontmanager/layout/StateTableProcessor.h src/java.desktop/share/native/libfontmanager/layout/StateTableProcessor2.cpp src/java.desktop/share/native/libfontmanager/layout/StateTableProcessor2.h src/java.desktop/share/native/libfontmanager/layout/StateTables.h src/java.desktop/share/native/libfontmanager/layout/SubstitutionLookups.cpp src/java.desktop/share/native/libfontmanager/layout/SubstitutionLookups.h src/java.desktop/share/native/libfontmanager/layout/SubtableProcessor.cpp src/java.desktop/share/native/libfontmanager/layout/SubtableProcessor.h src/java.desktop/share/native/libfontmanager/layout/SubtableProcessor2.cpp src/java.desktop/share/native/libfontmanager/layout/SubtableProcessor2.h src/java.desktop/share/native/libfontmanager/layout/SunLayoutEngine.cpp src/java.desktop/share/native/libfontmanager/layout/ThaiLayoutEngine.cpp src/java.desktop/share/native/libfontmanager/layout/ThaiLayoutEngine.h src/java.desktop/share/native/libfontmanager/layout/ThaiShaping.cpp src/java.desktop/share/native/libfontmanager/layout/ThaiShaping.h src/java.desktop/share/native/libfontmanager/layout/ThaiStateTables.cpp src/java.desktop/share/native/libfontmanager/layout/TibetanLayoutEngine.cpp src/java.desktop/share/native/libfontmanager/layout/TibetanLayoutEngine.h src/java.desktop/share/native/libfontmanager/layout/TibetanReordering.cpp src/java.desktop/share/native/libfontmanager/layout/TibetanReordering.h src/java.desktop/share/native/libfontmanager/layout/TrimmedArrayProcessor.cpp src/java.desktop/share/native/libfontmanager/layout/TrimmedArrayProcessor.h src/java.desktop/share/native/libfontmanager/layout/TrimmedArrayProcessor2.cpp src/java.desktop/share/native/libfontmanager/layout/TrimmedArrayProcessor2.h src/java.desktop/share/native/libfontmanager/layout/ValueRecords.cpp src/java.desktop/share/native/libfontmanager/layout/ValueRecords.h src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/ClassHistogramElement.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java test/jdk/javax/swing/JTabbedPane/4310381/bug4310381.html test/langtools/tools/javac/lambda/LambdaParserTest.java test/langtools/tools/javac/lib/combo/ReusableContext.java
diffstat 682 files changed, 10978 insertions(+), 43443 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Oct 12 22:05:47 2017 +0200
+++ b/.hgtags	Thu Oct 19 21:39:39 2017 +0100
@@ -451,3 +451,4 @@
 3b201865d5c1f244f555cad58da599c9261286d8 jdk-10+24
 8eb5e3ccee560c28ac9b1df2670adac2b3d36fad jdk-10+25
 1129253d3bc728a2963ba411ab9dd1adf358fb6b jdk-10+26
+b87d7b5d5dedc1185e5929470f945b7378cdb3ad jdk-10+27
--- a/doc/nashorn/DEVELOPER_README	Thu Oct 12 22:05:47 2017 +0200
+++ b/doc/nashorn/DEVELOPER_README	Thu Oct 19 21:39:39 2017 +0100
@@ -585,9 +585,6 @@
 	-plp, --print-lower-parse (Print the parse tree after lowering.)
 		param: [true|false]   default: false
 
-	--print-mem-usage (Print memory usage of IR after each compile stage.)
-		param: [true|false]   default: false
-
 	--print-no-newline (Print function will not print new line char.)
 		param: [true|false]   default: false
 
--- a/make/BuildNashorn.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/BuildNashorn.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -69,17 +69,12 @@
 NASHORN_CLASSES_DIR := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn
 NASGEN_RUN_FILE := $(NASHORN_CLASSES_DIR)/_the.nasgen.run
 
-ifeq ($(BOOT_JDK_MODULAR), true)
-  NASGEN_OPTIONS := \
-      -cp $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
-      --patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
-      --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
-      --add-exports java.base/jdk.internal.org.objectweb.asm.util=ALL-UNNAMED \
-      #
-else
-  NASGEN_OPTIONS := \
-      -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes
-endif
+NASGEN_OPTIONS := \
+    -cp $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
+    --patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
+    --add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
+    --add-exports java.base/jdk.internal.org.objectweb.asm.util=ALL-UNNAMED \
+    #
 
 # Copy classes to final classes dir and run nasgen to modify classes in jdk.nashorn.internal.objects package
 $(NASGEN_RUN_FILE): $(BUILD_NASGEN) $(jdk.scripting.nashorn)
--- a/make/Bundles.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/Bundles.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -70,9 +70,14 @@
   $$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false)
 
   $(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES)
+        # If any of the files contain a space in the file name, CacheFind
+        # will have replaced it with ?. Tar does not accept that so need to
+        # switch it back.
 	$$(foreach d, $$($1_BASE_DIRS), \
 	  $$(eval $$(call ListPathsSafely, \
 	      $1_$$d_RELATIVE_FILES, $$($1_$$d_LIST_FILE))) \
+	  $$(CAT) $$($1_$$d_LIST_FILE) | $$(TR) '?' ' ' > $$($1_$$d_LIST_FILE).tmp \
+	      && $(MV) $$($1_$$d_LIST_FILE).tmp $$($1_$$d_LIST_FILE) $$(NEWLINE) \
 	)
 	$$(call MakeDir, $$(@D))
         ifneq ($$($1_SPECIAL_INCLUDES), )
--- a/make/CompileDemos.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/CompileDemos.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -37,9 +37,13 @@
 include TextFileProcessing.gmk
 include ZipArchive.gmk
 
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, CompileDemos-pre.gmk))
+
 # Prepare the find cache.
-$(eval $(call FillCacheFind, $(wildcard $(TOPDIR)/src/demo \
-    $(TOPDIR)/src/*/demo)))
+DEMO_SRC_DIRS += $(TOPDIR)/src/demo
+
+$(eval $(call FillCacheFind, $(wildcard $(DEMO_SRC_DIRS))))
 
 # Append demo goals to this variable.
 TARGETS =
@@ -295,7 +299,7 @@
   $(eval $(call SetupCopyFiles, COPY_TO_TEST_IMAGE, \
       SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \
       DEST := $(TEST_IMAGE_DIR)/jdk/demos, \
-      FILES := $(call DoubleDollar, $(call CacheFind, $(SUPPORT_OUTPUTDIR)/demos/image)), \
+      FILES := $(call CacheFind, $(SUPPORT_OUTPUTDIR)/demos/image), \
   ))
 
   IMAGES_TARGETS := $(COPY_TO_TEST_IMAGE)
@@ -303,7 +307,7 @@
 
 ################################################################################
 # Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, CompileDemos.gmk))
+$(eval $(call IncludeCustomExtension, CompileDemos-post.gmk))
 
 all: $(TARGETS)
 images: $(IMAGES_TARGETS)
--- a/make/CompileInterimLangtools.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/CompileInterimLangtools.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -30,39 +30,63 @@
 include MakeBase.gmk
 include JavaCompilation.gmk
 include SetupJavaCompilers.gmk
+include Modules.gmk
+
+################################################################################
+# Generate interim versions of the module-info.java files for the interim
+# langtools modules. Each interim module has ".interim" added as suffix to the
+# original module name.
+
+INTERIM_MODULEINFO_PATTERN := \
+    $(foreach m, $(INTERIM_LANGTOOLS_BASE_MODULES), -e 's/$m\([,; ]\)/$m.interim\1/g')
+
+$(BUILDTOOLS_OUTPUTDIR)/gensrc/%.interim/module-info.java: \
+    $(TOPDIR)/src/%/share/classes/module-info.java
+	$(call LogInfo, Generating module-info.java for $*.interim)
+	$(call MakeDir, $(@D))
+	$(SED) $(INTERIM_MODULEINFO_PATTERN) $< > $@
+
+TARGETS += $(patsubst %, $(BUILDTOOLS_OUTPUTDIR)/gensrc/%/module-info.java, \
+    $(INTERIM_LANGTOOLS_MODULES))
 
 ################################################################################
 # Setup the rules to build interim langtools, which is compiled by the boot
-# javac and can be run on the boot jdk. This will be used to compile
-# the rest of the product. Each module is compiled separately to allow a modular
-# boot jdk to override system classes using -Xoverride:.
+# javac and can be run on the boot jdk. This will be used to compile the rest of
+# the product. Each module is compiled separately because a multi module setup
+# would require the source files to be copied into directories named after the
+# actual interim modules.
 
 # Param 1 - Name of module to compile
-# Param 2 - Name of modules to depend on
 define SetupInterimModule
-  $$(eval $$(call SetupJavaCompilation,BUILD_INTERIM_$(strip $1), \
+  $$(eval $$(call SetupJavaCompilation, BUILD_$1.interim, \
       SETUP := BOOT_JAVAC, \
       DISABLE_SJAVAC := true, \
-      SRC := $(TOPDIR)/src/$(strip $1)/share/classes \
-          $$(wildcard $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)), \
-      EXCLUDES := sun com/sun/tools/jdeps com/sun/tools/javap \
-          com/sun/tools/jdeprscan, \
-      EXCLUDE_FILES := module-info.java JavacToolProvider.java \
-	  JavadocToolProvider.java Standard.java, \
+      SRC := $(BUILDTOOLS_OUTPUTDIR)/gensrc/$1.interim \
+          $$(wildcard $(SUPPORT_OUTPUTDIR)/gensrc/$1) \
+          $(TOPDIR)/src/$1/share/classes, \
+      EXCLUDES := sun, \
+      EXCLUDE_FILES := $(TOPDIR)/src/$1/share/classes/module-info.java \
+          Standard.java, \
+      EXTRA_FILES := $(BUILDTOOLS_OUTPUTDIR)/gensrc/$1.interim/module-info.java, \
       COPY := .gif .png .xml .css .js javax.tools.JavaCompilerTool, \
-      BIN := $(BUILDTOOLS_OUTPUTDIR)/override_modules/$(strip $1), \
-      ADD_JAVAC_FLAGS := -Xbootclasspath/p:$$(call PathList, \
-          $$(foreach m, $2, $(BUILDTOOLS_OUTPUTDIR)/override_modules/$$m)), \
+      BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_modules/$1.interim, \
+      ADD_JAVAC_FLAGS := --module-path $(BUILDTOOLS_OUTPUTDIR)/interim_modules \
+          $$(INTERIM_LANGTOOLS_ADD_EXPORTS) \
+          -Xlint:-module, \
   ))
 
-  $$(BUILD_INTERIM_$(strip $1)): $$(foreach m, $2, $$(BUILD_INTERIM_$(strip $$m)))
+  $1_DEPS_INTERIM := $$(addsuffix .interim, $$(filter \
+      $$(INTERIM_LANGTOOLS_BASE_MODULES), $$(call FindTransitiveDepsForModule, $1)))
 
-  TARGETS += $$(BUILD_INTERIM_$(strip $1))
+  $$(BUILD_$1.interim): $$(foreach d, $$($1_DEPS_INTERIM), $$(BUILD_$$d))
+
+  TARGETS += $$(BUILD_$1.interim)
 endef
 
-$(eval $(call SetupInterimModule, java.compiler))
-$(eval $(call SetupInterimModule, jdk.compiler, java.compiler))
-$(eval $(call SetupInterimModule, jdk.jdeps, jdk.compiler java.compiler))
-$(eval $(call SetupInterimModule, jdk.javadoc, java.compiler jdk.compiler))
+$(foreach m, $(INTERIM_LANGTOOLS_BASE_MODULES), \
+  $(eval $(call SetupInterimModule,$m)) \
+)
+
+################################################################################
 
 all: $(TARGETS)
--- a/make/CompileInterimRmic.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/CompileInterimRmic.gmk	Thu Oct 19 21:39:39 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
@@ -30,7 +30,25 @@
 include JavaCompilation.gmk
 include SetupJavaCompilers.gmk
 
-##########################################################################################
+################################################################################
+# Generate interim versions of the module-info.java files for the interim
+# langtools modules. Each interim module has ".interim" added as suffix to the
+# original module name.
+
+INTERIM_MODULEINFO_PATTERN := \
+    $(foreach m, $(INTERIM_RMIC_BASE_MODULES), -e 's/$m\([,; ]\)/$m.interim\1/g') \
+    -e '/ToolProvider[,; ]/d'
+
+$(BUILDTOOLS_OUTPUTDIR)/gensrc/%.interim/module-info.java: \
+    $(TOPDIR)/src/%/share/classes/module-info.java
+	$(call LogInfo, Generating module-info.java for $*.interim)
+	$(call MakeDir, $(@D))
+	$(SED) $(INTERIM_MODULEINFO_PATTERN) $< > $@
+
+TARGETS += $(patsubst %, $(BUILDTOOLS_OUTPUTDIR)/gensrc/%/module-info.java, \
+    $(INTERIM_RMIC_MODULES))
+
+################################################################################
 
 RMIC_PKGS := \
     sun/rmi/rmic \
@@ -41,14 +59,23 @@
     sun/tools/util \
     #
 
-$(eval $(call SetupJavaCompilation,BUILD_INTERIM_RMIC, \
+$(eval $(call SetupJavaCompilation, BUILD_jdk.rmic.interim, \
     SETUP := GENERATE_OLDBYTECODE, \
     SRC := $(TOPDIR)/src/jdk.rmic/share/classes, \
-    EXCLUDE_FILES := module-info.java, \
+    EXCLUDE_FILES := $(TOPDIR)/src/jdk.rmic/share/classes/module-info.java, \
+    EXTRA_FILES := $(BUILDTOOLS_OUTPUTDIR)/gensrc/jdk.rmic.interim/module-info.java, \
     INCLUDES := $(RMIC_PKGS), \
-    BIN := $(BUILDTOOLS_OUTPUTDIR)/override_modules/jdk.rmic, \
-    COPY := .properties))
+    BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_modules/jdk.rmic.interim, \
+    COPY := .properties, \
+    ADD_JAVAC_FLAGS := \
+        --module-path $(BUILDTOOLS_OUTPUTDIR)/interim_modules \
+        --add-modules java.corba \
+        --add-exports java.corba/com.sun.corba.se.impl.util=jdk.rmic.interim \
+        $(INTERIM_RMIC_ADD_EXPORTS), \
+))
+
+TARGETS += $(BUILD_jdk.rmic.interim)
 
 ##########################################################################################
 
-all: $(BUILD_INTERIM_RMIC)
+all: $(TARGETS)
--- a/make/CompileToolsJdk.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/CompileToolsJdk.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -42,13 +42,22 @@
     $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes \
     #
 
-$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
+$(eval $(call SetupJavaCompilation, BUILD_TOOLS_JDK, \
     SETUP := GENERATE_OLDBYTECODE, \
     SRC := $(BUILD_TOOLS_SRC_DIRS), \
-    EXCLUDES := build/tools/deps \
-                build/tools/docs \
-                build/tools/jigsaw, \
-    BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes))
+    EXCLUDES := \
+        build/tools/deps \
+        build/tools/docs \
+        build/tools/jigsaw \
+        , \
+    BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
+    ADD_JAVAC_FLAGS := \
+        --add-modules java.xml.bind \
+        --add-exports java.desktop/sun.awt=ALL-UNNAMED \
+        --add-exports java.xml.bind/javax.xml.bind.annotation=ALL-UNNAMED \
+        --add-exports java.base/sun.text=ALL-UNNAMED \
+        , \
+))
 
 TARGETS += $(BUILD_TOOLS_JDK)
 
--- a/make/Images.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/Images.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -324,9 +324,8 @@
 
   DEMO_FILES := \
       $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
-        $(call DoubleDollar, \
         $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
-            -type f -a ! \( -name "_the*" -o -name "javac_state" \) )) \
+            -type f -a ! \( -name "_the*" -o -name "javac_state" \) ) \
       )
 
   ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
--- a/make/Init.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/Init.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -267,8 +267,9 @@
 	  $(ECHO) "Re-running configure using default settings"
         endif
 	( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \
+	    CUSTOM_ROOT="$(CUSTOM_ROOT)" \
 	    CUSTOM_CONFIG_DIR="$(CUSTOM_CONFIG_DIR)" \
-	    $(BASH) $(CONFIGURE_CMD) $(CONFIGURE_COMMAND_LINE) )
+	    $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
 
   ##############################################################################
   # The main target, for delegating into Main.gmk
--- a/make/InitSupport.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/InitSupport.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -70,10 +70,10 @@
       $(subst \ ,\#,$(MAKEOVERRIDES))))
 
   # Setup information about available configurations, if any.
-  ifeq ($(CUSTOM_BUILD_DIR), )
+  ifneq ($(CUSTOM_ROOT), )
+    build_dir=$(CUSTOM_ROOT)/build
+  else
     build_dir=$(topdir)/build
-  else
-    build_dir=$(CUSTOM_BUILD_DIR)
   endif
   all_spec_files=$(wildcard $(build_dir)/*/spec.gmk)
   # Extract the configuration names from the path
@@ -227,7 +227,11 @@
     else
       # Use spec.gmk files in the build output directory
       ifeq ($$(all_spec_files),)
-        $$(info Error: No configurations found for $$(topdir).)
+        ifneq ($(CUSTOM_ROOT), )
+          $$(info Error: No configurations found for $$(CUSTOM_ROOT).)
+        else
+          $$(info Error: No configurations found for $$(topdir).)
+        endif
         $$(info Please run 'bash configure' to create a configuration.)
         $$(info )
         $$(error Cannot continue)
--- a/make/JrtfsJar.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/JrtfsJar.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
     #
 
 $(eval $(call SetupJavaCompilation, BUILD_JRTFS, \
-    SETUP := GENERATE_OLDBYTECODE, \
+    SETUP := GENERATE_8_BYTECODE, \
     SRC := $(TOPDIR)/src/java.base/share/classes, \
     EXCLUDE_FILES := module-info.java, \
     INCLUDES := $(JIMAGE_PKGS), \
--- a/make/MacBundles.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/MacBundles.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -49,22 +49,17 @@
     BUNDLE_VENDOR := $(COMPANY_NAME)
   endif
 
-  JDK_FILE_LIST := $(shell $(FIND) $(JDK_IMAGE_DIR))
-  JRE_FILE_LIST := $(shell $(FIND) $(JRE_IMAGE_DIR))
+  $(eval $(call SetupCopyFiles, COPY_JDK_IMAGE, \
+      SRC := $(JDK_IMAGE_DIR), \
+      DEST := $(JDK_MACOSX_CONTENTS_DIR)/Home, \
+      FILES := $(call CacheFind, $(JDK_IMAGE_DIR)), \
+  ))
 
-  JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_MACOSX_CONTENTS_DIR)/Home/,$(JDK_FILE_LIST))
-  JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_MACOSX_CONTENTS_DIR)/Home/,$(JRE_FILE_LIST))
-
-  # Copy empty directories (jre/lib/applet).
-  $(JDK_MACOSX_CONTENTS_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
-	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
-	$(MKDIR) -p $(@D)
-	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
-
-  $(JRE_MACOSX_CONTENTS_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
-	$(call LogInfo, Copying $(patsubst $(OUTPUTDIR)/%,%,$@))
-	$(MKDIR) -p $(@D)
-	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
+  $(eval $(call SetupCopyFiles, COPY_JRE_IMAGE, \
+      SRC := $(JRE_IMAGE_DIR), \
+      DEST := $(JRE_MACOSX_CONTENTS_DIR)/Home, \
+      FILES := $(call CacheFind, $(JRE_IMAGE_DIR)), \
+  ))
 
   $(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib:
 	$(call LogInfo, Creating link $(patsubst $(OUTPUTDIR)/%,%,$@))
@@ -102,11 +97,11 @@
           @@VENDOR@@ => $(BUNDLE_VENDOR) , \
   ))
 
-  jdk-bundle: $(JDK_TARGET_LIST) $(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib \
+  jdk-bundle: $(COPY_JDK_IMAGE) $(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib \
       $(BUILD_JDK_PLIST)
 	$(SETFILE) -a B $(dir $(JDK_MACOSX_CONTENTS_DIR))
 
-  jre-bundle: $(JRE_TARGET_LIST) $(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib \
+  jre-bundle: $(COPY_JRE_IMAGE) $(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib \
       $(BUILD_JRE_PLIST)
 	$(SETFILE) -a B $(dir $(JRE_MACOSX_CONTENTS_DIR))
 
--- a/make/Main.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/Main.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -122,6 +122,8 @@
   $(foreach m, $(GENSRC_MODULES), $(eval $m-gensrc: $m-gensrc-src))
 
   LANGTOOLS_GENSRC_TARGETS := $(filter $(addsuffix -%, $(LANGTOOLS_MODULES)), $(GENSRC_TARGETS))
+  INTERIM_LANGTOOLS_GENSRC_TARGETS := $(filter $(addsuffix -%, \
+      $(INTERIM_LANGTOOLS_BASE_MODULES)), $(GENSRC_TARGETS))
   CORBA_GENSRC_TARGETS := $(filter $(addsuffix -%, $(CORBA_MODULES)), $(GENSRC_TARGETS))
   HOTSPOT_GENSRC_TARGETS := $(filter $(addsuffix -%, $(HOTSPOT_MODULES)), $(GENSRC_TARGETS))
   JDK_GENSRC_TARGETS := $(filter-out $(LANGTOOLS_GENSRC_TARGETS) \
@@ -602,7 +604,7 @@
 else
   $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
 
-  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
+  interim-langtools: $(INTERIM_LANGTOOLS_GENSRC_TARGETS)
 
   buildtools-jdk: interim-langtools interim-cldrconverter
 
--- a/make/ToolsJdk.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/ToolsJdk.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -40,12 +40,8 @@
 
 ################################################################################
 
-ifeq ($(BOOT_JDK_MODULAR), true)
-  COMPILEFONTCONFIG_ADD_EXPORTS := --add-exports java.desktop/sun.awt=ALL-UNNAMED
-endif
-
 TOOL_COMPILEFONTCONFIG = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
-    $(COMPILEFONTCONFIG_ADD_EXPORTS) \
+    --add-exports java.desktop/sun.awt=ALL-UNNAMED \
     build.tools.compilefontconfig.CompileFontConfig
 
 TOOL_COMPILEPROPERTIES = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
@@ -95,13 +91,8 @@
 TOOL_SPP = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.spp.Spp
 
 # Nimbus is used somewhere in the swing build.
-
-ifeq ($(BOOT_JDK_MODULAR), true)
-  COMPILENIMBUS_ADD_MODS := --add-modules java.xml.bind
-endif
-
 TOOL_GENERATENIMBUS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
-    $(COMPILENIMBUS_ADD_MODS) \
+    --add-modules java.xml.bind \
     build.tools.generatenimbus.Generator
 
 TOOL_WRAPPERGENERATOR = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
--- a/make/autoconf/basics.m4	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/autoconf/basics.m4	Thu Oct 19 21:39:39 2017 +0100
@@ -766,13 +766,10 @@
   AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
       [use this as the name of the configuration @<:@generated from important configuration options@:>@])],
       [ CONF_NAME=${with_conf_name} ])
-  AC_ARG_WITH(output-base-dir, [AS_HELP_STRING([--with-output-base-dir],
-      [override the default output base directory @<:@./build@:>@])],
-      [ OUTPUT_BASE=${with_output_base_dir} ], [ OUTPUT_BASE="$TOPDIR/build" ] )
 
   # Test from where we are running configure, in or outside of src root.
   AC_MSG_CHECKING([where to store configuration])
-  if test "x$CURDIR" = "x$TOPDIR" || test "x$CURDIR" = "x$TOPDIR/common" \
+  if test "x$CURDIR" = "x$TOPDIR" || test "x$CURDIR" = "x$CUSTOM_ROOT" \
       || test "x$CURDIR" = "x$TOPDIR/make/autoconf" \
       || test "x$CURDIR" = "x$TOPDIR/make" ; then
     # We are running configure from the src root.
@@ -783,7 +780,12 @@
     else
       AC_MSG_RESULT([in build directory with custom name])
     fi
-    OUTPUTDIR="${OUTPUT_BASE}/${CONF_NAME}"
+
+    if test "x$CUSTOM_ROOT" != x; then
+      OUTPUTDIR="${CUSTOM_ROOT}/build/${CONF_NAME}"
+    else
+      OUTPUTDIR="${TOPDIR}/build/${CONF_NAME}"
+    fi
     $MKDIR -p "$OUTPUTDIR"
     if test ! -d "$OUTPUTDIR"; then
       AC_MSG_ERROR([Could not create build directory $OUTPUTDIR])
--- a/make/autoconf/boot-jdk.m4	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/autoconf/boot-jdk.m4	Thu Oct 19 21:39:39 2017 +0100
@@ -77,10 +77,10 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          [FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`]
+          [FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`]
           if test "x$FOUND_CORRECT_VERSION" = x; then
             AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
-            AC_MSG_NOTICE([(Your Boot JDK must be version 8, 9 or 10)])
+            AC_MSG_NOTICE([(Your Boot JDK must be version 9 or 10)])
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -301,20 +301,11 @@
 
   # Finally, set some other options...
 
-  # When compiling code to be executed by the Boot JDK, force jdk8 compatibility.
-  BOOT_JDK_SOURCETARGET="-source 8 -target 8"
+  # When compiling code to be executed by the Boot JDK, force compatibility with the
+  # oldest supported bootjdk.
+  BOOT_JDK_SOURCETARGET="-source 9 -target 9"
   AC_SUBST(BOOT_JDK_SOURCETARGET)
 
-  AC_MSG_CHECKING([if Boot JDK supports modules])
-  if "$JAVA" --list-modules > /dev/null 2>&1; then
-    AC_MSG_RESULT([yes])
-    BOOT_JDK_MODULAR="true"
-  else
-    AC_MSG_RESULT([no])
-    BOOT_JDK_MODULAR="false"
-  fi
-  AC_SUBST(BOOT_JDK_MODULAR)
-
   AC_SUBST(JAVAC_FLAGS)
 
   # Check if the boot jdk is 32 or 64 bit
--- a/make/autoconf/bootcycle-spec.gmk.in	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/autoconf/bootcycle-spec.gmk.in	Thu Oct 19 21:39:39 2017 +0100
@@ -25,8 +25,6 @@
 
 # Support for building boot cycle builds
 
-BOOT_JDK_MODULAR := true
-
 # First include the real base spec.gmk file
 include @SPEC@
 
--- a/make/autoconf/configure	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/autoconf/configure	Thu Oct 19 21:39:39 2017 +0100
@@ -23,19 +23,18 @@
 #
 
 if test "x$1" != xCHECKME; then
-  echo "WARNING: Calling the wrapper script directly is deprecated and unsupported."
-  echo "Not all features of configure will be available."
+  echo "ERROR: Calling this wrapper script directly is not supported."
   echo "Use the 'configure' script in the top-level directory instead."
-  TOPDIR=$(cd $(dirname $0)/../.. > /dev/null && pwd)
-else
-  # Now the next argument is the absolute top-level directory path.
-  # The TOPDIR variable is passed on to configure.ac.
-  TOPDIR="$2"
-  # Remove these two arguments to get to the user supplied arguments
-  shift
-  shift
+  exit 1
 fi
 
+# The next argument is the absolute top-level directory path.
+# The TOPDIR variable is passed on to configure.ac.
+TOPDIR="$2"
+# Remove these two arguments to get to the user supplied arguments
+shift
+shift
+
 if test "x$BASH" = x; then
   echo "Error: This script must be run using bash." 1>&2
   exit 1
--- a/make/autoconf/flags.m4	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/autoconf/flags.m4	Thu Oct 19 21:39:39 2017 +0100
@@ -1279,7 +1279,7 @@
       $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS -xarch=sparc"
     fi
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
-    LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok"
+    LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok -btextpsize:64K -bdatapsize:64K -bstackpsize:64K"
     $2LDFLAGS_JDK="${$2LDFLAGS_JDK} $LDFLAGS_XLC"
     $2JVM_LDFLAGS="[$]$2JVM_LDFLAGS $LDFLAGS_XLC"
     # We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
--- a/make/autoconf/generated-configure.sh	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/autoconf/generated-configure.sh	Thu Oct 19 21:39:39 2017 +0100
@@ -878,7 +878,6 @@
 JLINK
 JMOD
 JAVAC_FLAGS
-BOOT_JDK_MODULAR
 BOOT_JDK_SOURCETARGET
 JARSIGNER
 JAR
@@ -1134,7 +1133,6 @@
 with_extra_path
 with_sdk_name
 with_conf_name
-with_output_base_dir
 with_output_sync
 with_default_make_target
 enable_headless_only
@@ -2043,7 +2041,6 @@
   --with-sdk-name         use the platform SDK of the given name. [macosx]
   --with-conf-name        use this as the name of the configuration [generated
                           from important configuration options]
-  --with-output-base-dir  override the default output base directory [./build]
   --with-output-sync      set make output sync type if supported by make.
                           [recurse]
   --with-default-make-target
@@ -5117,7 +5114,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1507635096
+DATE_WHEN_GENERATED=1508415370
 
 ###############################################################################
 #
@@ -17554,18 +17551,10 @@
 fi
 
 
-# Check whether --with-output-base-dir was given.
-if test "${with_output_base_dir+set}" = set; then :
-  withval=$with_output_base_dir;  OUTPUT_BASE=${with_output_base_dir}
-else
-   OUTPUT_BASE="$TOPDIR/build"
-fi
-
-
   # Test from where we are running configure, in or outside of src root.
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to store configuration" >&5
 $as_echo_n "checking where to store configuration... " >&6; }
-  if test "x$CURDIR" = "x$TOPDIR" || test "x$CURDIR" = "x$TOPDIR/common" \
+  if test "x$CURDIR" = "x$TOPDIR" || test "x$CURDIR" = "x$CUSTOM_ROOT" \
       || test "x$CURDIR" = "x$TOPDIR/make/autoconf" \
       || test "x$CURDIR" = "x$TOPDIR/make" ; then
     # We are running configure from the src root.
@@ -17578,7 +17567,12 @@
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: in build directory with custom name" >&5
 $as_echo "in build directory with custom name" >&6; }
     fi
-    OUTPUTDIR="${OUTPUT_BASE}/${CONF_NAME}"
+
+    if test "x$CUSTOM_ROOT" != x; then
+      OUTPUTDIR="${CUSTOM_ROOT}/build/${CONF_NAME}"
+    else
+      OUTPUTDIR="${TOPDIR}/build/${CONF_NAME}"
+    fi
     $MKDIR -p "$OUTPUTDIR"
     if test ! -d "$OUTPUTDIR"; then
       as_fn_error $? "Could not create build directory $OUTPUTDIR" "$LINENO" 5
@@ -25665,12 +25659,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -25867,12 +25861,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -26057,12 +26051,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -26246,12 +26240,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -26435,12 +26429,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -26615,12 +26609,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -26946,12 +26940,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -27277,12 +27271,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -27495,12 +27489,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -27678,12 +27672,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -27889,12 +27883,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -28072,12 +28066,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -28283,12 +28277,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -28466,12 +28460,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -28677,12 +28671,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -28860,12 +28854,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -29058,12 +29052,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -29239,12 +29233,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -29438,12 +29432,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -29619,12 +29613,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -29817,12 +29811,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -29998,12 +29992,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -30197,12 +30191,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -30378,12 +30372,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -30558,12 +30552,12 @@
           BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
 
           # Extra M4 quote needed to protect [] in grep expression.
-          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"|(1\.[89]\.)'`
+          FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"10([\.+-].*)?\"|\"9([\.+-].*)?\"'`
           if test "x$FOUND_CORRECT_VERSION" = x; then
             { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8, 9 or 10)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8, 9 or 10)" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 9 or 10)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 9 or 10)" >&6;}
             BOOT_JDK_FOUND=no
           else
             # We're done! :-)
@@ -31453,21 +31447,9 @@
 
   # Finally, set some other options...
 
-  # When compiling code to be executed by the Boot JDK, force jdk8 compatibility.
-  BOOT_JDK_SOURCETARGET="-source 8 -target 8"
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Boot JDK supports modules" >&5
-$as_echo_n "checking if Boot JDK supports modules... " >&6; }
-  if "$JAVA" --list-modules > /dev/null 2>&1; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-    BOOT_JDK_MODULAR="true"
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-    BOOT_JDK_MODULAR="false"
-  fi
+  # When compiling code to be executed by the Boot JDK, force compatibility with the
+  # oldest supported bootjdk.
+  BOOT_JDK_SOURCETARGET="-source 9 -target 9"
 
 
 
@@ -52033,7 +52015,7 @@
       JVM_LDFLAGS="$JVM_LDFLAGS -xarch=sparc"
     fi
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
-    LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok"
+    LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok -btextpsize:64K -bdatapsize:64K -bstackpsize:64K"
     LDFLAGS_JDK="${LDFLAGS_JDK} $LDFLAGS_XLC"
     JVM_LDFLAGS="$JVM_LDFLAGS $LDFLAGS_XLC"
     # We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
@@ -52914,7 +52896,7 @@
       OPENJDK_BUILD_JVM_LDFLAGS="$OPENJDK_BUILD_JVM_LDFLAGS -xarch=sparc"
     fi
   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
-    LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok"
+    LDFLAGS_XLC="-b64 -brtl -bnolibpath -bexpall -bernotok -btextpsize:64K -bdatapsize:64K -bstackpsize:64K"
     OPENJDK_BUILD_LDFLAGS_JDK="${OPENJDK_BUILD_LDFLAGS_JDK} $LDFLAGS_XLC"
     OPENJDK_BUILD_JVM_LDFLAGS="$OPENJDK_BUILD_JVM_LDFLAGS $LDFLAGS_XLC"
     # We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
--- a/make/autoconf/spec.gmk.in	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/autoconf/spec.gmk.in	Thu Oct 19 21:39:39 2017 +0100
@@ -561,38 +561,35 @@
 BUILD_JAVA_FLAGS := @BOOTCYCLE_JVM_ARGS_BIG@
 BUILD_JAVA=@FIXPATH@ $(BUILD_JDK)/bin/java $(BUILD_JAVA_FLAGS)
 
-# Use ?= as this can be overridden from bootcycle-spec.gmk
-BOOT_JDK_MODULAR ?= @BOOT_JDK_MODULAR@
+# Interim langtools and rmic modules and arguments
+INTERIM_LANGTOOLS_BASE_MODULES := java.compiler jdk.compiler jdk.jdeps 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))))
+INTERIM_LANGTOOLS_ARGS := \
+    --limit-modules java.base,jdk.zipfs,$(INTERIM_LANGTOOLS_MODULES_COMMA) \
+    --add-modules $(INTERIM_LANGTOOLS_MODULES_COMMA) \
+    --module-path $(BUILDTOOLS_OUTPUTDIR)/interim_modules \
+    $(INTERIM_LANGTOOLS_ADD_EXPORTS) \
+    #
+JAVAC_MAIN_CLASS = -m jdk.compiler.interim/com.sun.tools.javac.Main
+JAVADOC_MAIN_CLASS = -m jdk.javadoc.interim/jdk.javadoc.internal.tool.Main
 
-INTERIM_LANGTOOLS_OVERRIDE_MODULES := java.compiler jdk.compiler \
-    jdk.jdeps jdk.javadoc
-INTERIM_RMIC_OVERRIDE_MODULES := jdk.rmic
-ifeq ($(BOOT_JDK_MODULAR), true)
-  INTERIM_LANGTOOLS_OVERRIDE_MODULES_ARGS = $(foreach m, \
-      $(INTERIM_LANGTOOLS_OVERRIDE_MODULES), \
-      --patch-module $m=$(BUILDTOOLS_OUTPUTDIR)/override_modules/$m)
-  INTERIM_RMIC_OVERRIDE_MODULES_ARGS = $(foreach m, \
-      $(INTERIM_LANGTOOLS_OVERRIDE_MODULES) \
-      $(INTERIM_RMIC_OVERRIDE_MODULES), \
-      --patch-module $m=$(BUILDTOOLS_OUTPUTDIR)/override_modules/$m)
-  INTERIM_LANGTOOLS_ARGS = $(INTERIM_LANGTOOLS_OVERRIDE_MODULES_ARGS)
-  JAVAC_MAIN_CLASS = -m jdk.compiler/com.sun.tools.javac.Main
-  JAVADOC_MAIN_CLASS = -m jdk.javadoc/jdk.javadoc.internal.tool.Main
-else
-  INTERIM_LANGTOOLS_OVERRIDE_MODULES_ARGS = \
-      -Xbootclasspath/p:$(call PathList, \
-          $(addprefix $(BUILDTOOLS_OUTPUTDIR)/override_modules/, \
-              $(INTERIM_LANGTOOLS_OVERRIDE_MODULES)))
-  INTERIM_RMIC_OVERRIDE_MODULES_ARGS = \
-      -Xbootclasspath/p:$(call PathList, \
-          $(addprefix $(BUILDTOOLS_OUTPUTDIR)/override_modules/, \
-              $(INTERIM_LANGTOOLS_OVERRIDE_MODULES) \
-              $(INTERIM_RMIC_OVERRIDE_MODULES)))
-  INTERIM_LANGTOOLS_ARGS = $(INTERIM_LANGTOOLS_OVERRIDE_MODULES_ARGS) \
-      -cp $(BUILDTOOLS_OUTPUTDIR)/override_modules/jdk.compiler
-  JAVAC_MAIN_CLASS = com.sun.tools.javac.Main
-  JAVADOC_MAIN_CLASS = jdk.javadoc.internal.tool.Main
-endif
+INTERIM_RMIC_BASE_MODULES := jdk.rmic
+INTERIM_RMIC_MODULES := $(addsuffix .interim, $(INTERIM_RMIC_BASE_MODULES))
+INTERIM_RMIC_ADD_EXPORTS := \
+    --add-exports java.corba/com.sun.corba.se.impl.util=jdk.rmic.interim \
+    #
+INTERIM_RMIC_ARGS := --limit-modules java.base,jdk.compiler,jdk.javadoc,java.corba \
+    --module-path $(BUILDTOOLS_OUTPUTDIR)/interim_modules \
+    $(INTERIM_RMIC_ADD_EXPORTS) \
+    #
+
 # You run the new javac using the boot jdk with $(BOOT_JDK)/bin/java $(NEW_JAVAC) ...
 # Use = assignment to be able to override in bootcycle-spec.gmk
 NEW_JAVAC   = $(INTERIM_LANGTOOLS_ARGS) $(JAVAC_MAIN_CLASS)
@@ -842,8 +839,6 @@
 TEST_BUNDLE :=  $(BUNDLES_OUTPUTDIR)/$(TEST_BUNDLE_NAME)
 DOCS_BUNDLE :=  $(BUNDLES_OUTPUTDIR)/$(DOCS_BUNDLE_NAME)
 
-CONFIGURE_CMD := $(TOPDIR)/configure
-
 # This macro is called to allow inclusion of closed source counterparts.
 # Unless overridden in closed sources, it expands to nothing.
 # Usage: This function is called in an open makefile, with the following
--- a/make/common/JavaCompilation.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/common/JavaCompilation.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -166,6 +166,8 @@
 #   INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file!
 #   EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file!
 #       "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found.
+#   EXTRA_FILES:=List of extra source files to include in compilation. Can be used to
+#       specify files that need to be generated by other rules first.
 #   HEADERS:=path to directory where all generated c-headers are written.
 #   DEPENDS:=Extra dependecy
 #   DISABLE_SJAVAC:=Explicitly disable the use of sjavac for this compilation unit.
@@ -203,16 +205,23 @@
     $1_MODULE_SUBDIR := /$$($1_MODULE)
   endif
 
-  # Make sure the dirs exist.
-  $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupJavaCompilation $1 contains missing directory >$$d<)))
+  # Make sure the dirs exist, or that one of the EXTRA_FILES, that may not
+  # exist yet, is in it.
+  $$(foreach d, $$($1_SRC), \
+    $$(if $$(wildcard $$d), , \
+      $$(if $$(filter $$d%, $$($1_EXTRA_FILES)), , \
+        $$(error SRC specified to SetupJavaCompilation $1 contains missing directory >$$d<) \
+      ) \
+    ) \
+  )
   $$(call MakeDir,$$($1_BIN))
   # Add all source roots to the find cache since we are likely going to run find
   # on these more than once. The cache will only be updated if necessary.
-  $$(eval $$(call FillCacheFind,$$($1_SRC)))
+  $$(eval $$(call FillCacheFind, $$($1_SRC)))
   # Find all files in the source trees. Preserve order of source roots so that
   # the first version in case of multiple instances of the same file is selected.
   # CacheFind does not preserve order so need to call it for each root.
-  $1_ALL_SRCS += $$(foreach s, $$($1_SRC), $$(call CacheFind, $$(s)))
+  $1_ALL_SRCS += $$($1_EXTRA_FILES) $$(foreach s, $$($1_SRC), $$(call CacheFind, $$s))
   # Extract the java files.
   $1_SRCS := $$(filter %.java, $$($1_ALL_SRCS))
 
@@ -235,7 +244,7 @@
     $1_SRCS := $$(filter-out $$($1_EXCLUDE_PATTERN), $$($1_SRCS))
   endif
   ifneq ($$($1_INCLUDE_PATTERN), )
-    $1_SRCS := $$(filter $$($1_INCLUDE_PATTERN), $$($1_SRCS))
+    $1_SRCS := $$(filter $$($1_INCLUDE_PATTERN) $$($1_EXTRA_FILES), $$($1_SRCS))
   endif
 
   ifneq ($$($1_KEEP_DUPS), true)
--- a/make/common/MakeBase.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/common/MakeBase.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -463,11 +463,22 @@
 endef
 
 ################################################################################
+# Replace question marks with space in string. This macro needs to be called on
+# files from CacheFind in case any of them contains space in their file name,
+# since CacheFind replaces space with ?.
+# Param 1 - String to replace in
+DecodeSpace = \
+    $(subst ?,$(SPACE),$(strip $1))
+EncodeSpace = \
+    $(subst $(SPACE),?,$(strip $1))
+
+################################################################################
 # Make directory without forking mkdir if not needed
 # 1: List of directories to create
 MakeDir = \
     $(strip \
-        $(eval MakeDir_dirs_to_make := $(strip $(foreach d, $1, $(if $(wildcard $d), , $d)))) \
+        $(eval MakeDir_dirs_to_make := $(strip $(foreach d, $1, $(if $(wildcard $d), , \
+            "$(call DecodeSpace, $d)")))) \
         $(if $(MakeDir_dirs_to_make), $(shell $(MKDIR) -p $(MakeDir_dirs_to_make))) \
     )
 
@@ -479,6 +490,7 @@
     $(if $($(strip $1)),,$(eval $(strip $1) := $2))
 
 ################################################################################
+# All install-file and related macros automatically call DecodeSpace when needed.
 
 ifeq ($(OPENJDK_TARGET_OS),solaris)
   # On Solaris, if the target is a symlink and exists, cp won't overwrite.
@@ -487,19 +499,21 @@
   # If the source and target parent directories are the same, recursive copy doesn't work
   # so we fall back on regular copy, which isn't preserving symlinks.
   define install-file
-	$(MKDIR) -p '$(@D)'
-	$(RM) '$@'
-	if [ "$(@D)" != "$(<D)" ]; then \
-	  $(CP) -f -r -P '$<' '$(@D)'; \
-	  if [ "$(@F)" != "$(<F)" ]; then \
-	    $(MV) '$(@D)/$(<F)' '$@'; \
+	$(call MakeDir, $(@D))
+	$(RM) '$(call DecodeSpace, $@)'
+	if [ '$(call DecodeSpace, $(dir $@))' != \
+	    '$(call DecodeSpace, $(dir $(call EncodeSpace, $<)))' ]; then \
+	  $(CP) -f -r -P '$(call DecodeSpace, $<)' '$(call DecodeSpace, $(@D))'; \
+	  if [ '$(call DecodeSpace, $(@F))' != \
+	      '$(call DecodeSpace, $(notdir $(call EncodeSpace, $(<))))' ]; then \
+	    $(MV) '$(call DecodeSpace, $(@D)/$(<F))' '$(call DecodeSpace, $@)'; \
 	  fi; \
 	else \
-	  if [ -L '$<' ]; then \
+	  if [ -L '$(call DecodeSpace, $<)' ]; then \
 	    $(ECHO) "Source file is a symlink and target is in the same directory: $< $@" ; \
 	    exit 1; \
 	  fi; \
-	  $(CP) -f '$<' '$@'; \
+	  $(CP) -f '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'; \
 	fi
   endef
 else ifeq ($(OPENJDK_TARGET_OS),macosx)
@@ -512,22 +526,22 @@
   # If copying a soft link to a directory, need to delete the target first to avoid
   # weird errors.
   define install-file
-	$(MKDIR) -p '$(@D)'
-	$(RM) '$@'
-	$(CP) -fRP '$<' '$@'
-	if [ -n "`$(XATTR) -l '$@'`" ]; then $(XATTR) -c '$@'; fi
+	$(call MakeDir, $(@D))
+	$(RM) '$(call DecodeSpace, $@)'
+	$(CP) -fRP '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'
+	if [ -n "`$(XATTR) -l '$(call DecodeSpace, $@)'`" ]; then $(XATTR) -c '$(call DecodeSpace, $@)'; fi
   endef
 else
   define install-file
 	$(call MakeDir, $(@D))
-	$(CP) -fP '$<' '$@'
+	$(CP) -fP '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'
   endef
 endif
 
 # Variant of install file that does not preserve symlinks
 define install-file-nolink
 	$(call MakeDir, $(@D))
-	$(CP) -f '$<' '$@'
+	$(CP) -f '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'
 endef
 
 ################################################################################
@@ -577,14 +591,14 @@
 # the unix emulation environment.
 define link-file-relative
 	$(call MakeDir, $(@D))
-	$(RM) $@
-	$(LN) -s $(call RelativePath, $<, $(@D)) $@
+	$(RM) '$(call DecodeSpace, $@)'
+	$(LN) -s '$(call DecodeSpace, $(call RelativePath, $<, $(@D)))' '$(call DecodeSpace, $@)'
 endef
 
 define link-file-absolute
 	$(call MakeDir, $(@D))
-	$(RM) $@
-	$(LN) -s $< $@
+	$(RM) '$(call DecodeSpace, $@)'
+	$(LN) -s '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'
 endef
 
 ################################################################################
@@ -651,6 +665,13 @@
   # This macro can be called multiple times to add to the cache. Only finds files
   # with no filters.
   #
+  # Files containing space will get spaces replaced with ? because GNU Make
+  # cannot handle lists of files with space in them. By using ?, make will match
+  # the wildcard to space in many situations so we don't need to replace back
+  # to space on every use. While not a complete solution it does allow some uses
+  # of CacheFind to function with spaces in file names, including for
+  # SetupCopyFiles.
+  #
   # Needs to be called with $(eval )
   #
   # Even if the performance benifit is negligible on other platforms, keep the
@@ -668,7 +689,9 @@
     ifneq ($$(FIND_CACHE_NEW_DIRS), )
       # Remove any trailing slash from dirs in the cache dir list
       FIND_CACHE_DIRS += $$(patsubst %/,%, $$(FIND_CACHE_NEW_DIRS))
-      FIND_CACHE := $$(sort $$(FIND_CACHE) $$(shell $(FIND) $$(FIND_CACHE_NEW_DIRS) \( -type f -o -type l \) $2))
+      FIND_CACHE := $$(sort $$(FIND_CACHE) \
+          $$(shell $(FIND) $$(wildcard $$(FIND_CACHE_NEW_DIRS)) \
+              \( -type f -o -type l \) $2 | $(TR) ' ' '?'))
     endif
   endef
 
@@ -684,7 +707,8 @@
   # Param 2 - (optional) specialization. Normally "-a \( ... \)" expression.
   define CacheFind
     $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \
-      $(if $(wildcard $1), $(shell $(FIND) $1 \( -type f -o -type l \) $2)), \
+      $(if $(wildcard $1), $(shell $(FIND) $(wildcard $1) \( -type f -o -type l \) $2 \
+          | $(TR) ' ' '?')), \
       $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE)))
   endef
 
@@ -693,7 +717,9 @@
   # Param 1 - Dirs to find in
   # Param 2 - (optional) specialization. Normally "-a \( ... \)" expression.
   define CacheFind
-    $(shell $(FIND) $1 \( -type f -o -type l \) $2)
+    $(if $(wildcard $1, \
+      $(shell $(FIND) $(wildcard $1) \( -type f -o -type l \) $2 | $(TR) ' ' '?') \
+    )
   endef
 endif
 
@@ -707,7 +733,7 @@
   # 4 : Macro to call for copy operation
   # 5 : Action text to log
   $2: $1
-	$$(call LogInfo, $(strip $5) $$(patsubst $(OUTPUTDIR)/%,%,$$@))
+	$$(call LogInfo, $(strip $5) $$(patsubst $(OUTPUTDIR)/%,%,$$(call DecodeSpace, $$@)))
 	$$($$(strip $4))
 
   $3 += $2
@@ -758,10 +784,19 @@
   $1_SRC := $$(patsubst %/,%,$$($1_SRC))
   $1_DEST := $$(patsubst %/,%,$$($1_DEST))
 
+  # Need to wrap arguments in DoubleDollar because of the eval nested inside an
+  # eval macro body.
   $$(foreach f, $$(patsubst $$($1_SRC)/%,%,$$($1_FILES)), \
-      $$(eval $$(call AddFileToCopy, $$($1_SRC)/$$f, \
-      $$($1_DEST)/$$(call $$(strip $$($1_NAME_MACRO)),$$(if $$($1_FLATTEN),$$(notdir $$f),$$f)), \
-      $1, $$($1_MACRO), $$($1_LOG_ACTION))))
+    $$(eval $$(call AddFileToCopy, \
+        $$(call DoubleDollar, $$($1_SRC)/$$f), \
+        $$(call DoubleDollar, \
+            $$($1_DEST)/$$(call $$(strip $$($1_NAME_MACRO)),$$(if $$($1_FLATTEN),$$(notdir $$f),$$f)) \
+        ), \
+        $1, \
+        $$($1_MACRO), \
+        $$($1_LOG_ACTION) \
+    )) \
+  )
 
 endef
 
--- a/make/common/SetupJavaCompilers.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/common/SetupJavaCompilers.gmk	Thu Oct 19 21:39:39 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
@@ -95,4 +95,15 @@
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
 
+# Use boot javac to generate JDK 8 compatible class files explicitly
+$(eval $(call SetupJavaCompiler,GENERATE_8_BYTECODE, \
+    JAVAC := $(JAVAC), \
+    FLAGS := \
+        $(JAVA_TOOL_FLAGS_SMALL) \
+        --release 8 \
+        -XDignore.symbol.file=true -g \
+        -Xlint:all -Werror, \
+    DISABLE_SJAVAC := true, \
+))
+
 endif # _SETUP_GMK
--- a/make/conf/jib-profiles.js	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/conf/jib-profiles.js	Thu Oct 19 21:39:39 2017 +0100
@@ -381,24 +381,10 @@
         };
     };
 
-    var boot_jdk_revision = "8";
-    var boot_jdk_subdirpart = "1.8.0";
-    // JDK 8 does not work on sparc M7 cpus, need a newer update when building
-    // on such hardware.
-    if (input.build_cpu == "sparcv9") {
-       var cpu_brand = $EXEC("bash -c \"kstat -m cpu_info | grep brand | head -n1 | awk '{ print \$2 }'\"");
-       if (cpu_brand.trim().match('SPARC-.[78]')) {
-           boot_jdk_revision = "8u20";
-           boot_jdk_subdirpart = "1.8.0_20";
-       }
-    }
-    common.boot_jdk_revision = boot_jdk_revision;
-    common.boot_jdk_subdirpart = boot_jdk_subdirpart;
-    common.boot_jdk_home = input.get("boot_jdk", "home_path") + "/jdk"
-        + common.boot_jdk_subdirpart
+    common.boot_jdk_version = "9";
+    common.boot_jdk_home = input.get("boot_jdk", "home_path") + "/jdk-"
+        + common.boot_jdk_version
         + (input.build_os == "macosx" ? ".jdk/Contents/Home" : "");
-    common.boot_jdk_platform = input.build_os + "-"
-        + (input.build_cpu == "x86" ? "i586" : input.build_cpu);
 
     return common;
 };
@@ -1027,15 +1013,18 @@
         ? input.target_os + "_x64"
         : input.target_platform);
 
+    var boot_jdk_platform = (input.build_os == "macosx" ? "osx" : input.build_os)
+        + "-" + input.build_cpu;
+
     var dependencies = {
 
         boot_jdk: {
-            server: "javare",
-            module: "jdk",
-            revision: common.boot_jdk_revision,
-            checksum_file: common.boot_jdk_platform + "/MD5_VALUES",
-            file: common.boot_jdk_platform + "/jdk-" + common.boot_jdk_revision
-                + "-" + common.boot_jdk_platform + ".tar.gz",
+            server: "jpg",
+            product: "jdk",
+            version: common.boot_jdk_version,
+            build_number: "181",
+            file: "bundles/" + boot_jdk_platform + "/jdk-" + common.boot_jdk_version + "_"
+                + boot_jdk_platform + "_bin.tar.gz",
             configure_args: "--with-boot-jdk=" + common.boot_jdk_home,
             environment_path: common.boot_jdk_home + "/bin"
         },
--- a/make/copy/Copy-java.base.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/copy/Copy-java.base.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -247,3 +247,19 @@
 ))
 
 TARGETS += $(COPY_JDK_NOTICES)
+
+################################################################################
+# Optionally copy libffi.so.? into the the image
+
+ifeq ($(ENABLE_LIBFFI_BUNDLING), true)
+  $(eval $(call SetupCopyFiles, COPY_LIBFFI, \
+      FILES := $(LIBFFI_LIB_FILE), \
+      DEST := $(call FindLibDirForModule, $(MODULE)), \
+      FLATTEN := true, \
+      MACRO := install-file-nolink, \
+  ))
+
+  TARGETS += $(COPY_LIBFFI)
+endif
+
+################################################################################
--- a/make/gendata/Gendata-jdk.compiler.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/gendata/Gendata-jdk.compiler.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -41,23 +41,23 @@
 
 CT_DATA_DESCRIPTION ?= $(TOPDIR)/make/data/symbols/symbols
 
+COMPILECREATESYMBOLS_ADD_EXPORTS := \
+    --add-exports jdk.compiler.interim/com.sun.tools.javac.api=ALL-UNNAMED \
+    --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, \
-    ADD_JAVAC_FLAGS := -Xbootclasspath/p:"$(INTERIM_LANGTOOLS_JAR)", \
     BIN := $(BUILDTOOLS_OUTPUTDIR)/create_symbols, \
+    ADD_JAVAC_FLAGS := $(INTERIM_LANGTOOLS_ARGS) \
+        $(COMPILECREATESYMBOLS_ADD_EXPORTS), \
 ))
 
-ifeq ($(BOOT_JDK_MODULAR), true)
-  COMPILECREATESYMBOLS_ADD_EXPORTS := \
-      --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
-      --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
-      --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
-      --add-exports=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \
-      --add-exports=jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED
-endif
-
 $(SUPPORT_OUTPUTDIR)/symbols/ct.sym-files/_the.symbols: \
     $(COMPILE_CREATE_SYMBOLS) \
     $(wildcard $(TOPDIR)/make/data/symbols/*) \
--- a/make/gendata/GendataBreakIterator.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/gendata/GendataBreakIterator.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -60,19 +60,13 @@
         $(TEXT_PKG_LD)/BreakIteratorInfo_th.java, \
     BIN := $(BREAK_ITERATOR_CLASSES)/jdk.localedata))
 
-ifeq ($(BOOT_JDK_MODULAR), true)
-  BREAK_ITERATOR_BOOTCLASSPATH := \
-      --patch-module java.base=$(BREAK_ITERATOR_CLASSES)/java.base \
-      --patch-module jdk.localedata=$(BREAK_ITERATOR_CLASSES)/jdk.localedata \
-      --add-exports java.base/sun.text=ALL-UNNAMED \
-      --add-exports java.base/sun.text.resources=ALL-UNNAMED \
-      --add-exports jdk.localedata/sun.text.resources.ext=ALL-UNNAMED \
-      #
-else
-  BREAK_ITERATOR_BOOTCLASSPATH := -Xbootclasspath/p:$(call PathList, \
-      $(BREAK_ITERATOR_CLASSES)/java.base \
-      $(BREAK_ITERATOR_CLASSES)/jdk.localedata)
-endif
+BREAK_ITERATOR_BOOTCLASSPATH := \
+    --patch-module java.base=$(BREAK_ITERATOR_CLASSES)/java.base \
+    --patch-module jdk.localedata=$(BREAK_ITERATOR_CLASSES)/jdk.localedata \
+    --add-exports java.base/sun.text=ALL-UNNAMED \
+    --add-exports java.base/sun.text.resources=ALL-UNNAMED \
+    --add-exports jdk.localedata/sun.text.resources.ext=ALL-UNNAMED \
+    #
 
 # Generate data resource files.
 # input
--- a/make/hotspot/copy/Copy-java.base.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +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.
-#
-
-# These include files are currently being copied from the jdk repository for
-# historical reasons. Disable copying from here until this has been cleaned up.
-# The files in hotspot differ slightly from the corresponding files in jdk.
-# See JDK-8167078.
-
-INCLUDE_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)
-
-################################################################################
-# Copy platform-independent .h files
-$(eval $(call SetupCopyFiles, COPY_INCLUDE_FILES, \
-    SRC := $(TOPDIR)/src/hotspot/share, \
-    DEST := $(INCLUDE_DST_DIR), \
-    FLATTEN := true, \
-    FILES := prims/jni.h code/jvmticmlr.h \
-))
-
-#TARGETS += $(COPY_INCLUDE_FILES)
-
-################################################################################
-# Copy jni_md.h
-
-# This might have been defined in a custom extension
-JNI_MD_H_SRC ?= $(TOPDIR)/src/hotspot/cpu/$(HOTSPOT_TARGET_CPU_ARCH)/jni_$(HOTSPOT_TARGET_CPU_ARCH).h
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-  # NOTE: This should most likely be darwin, but the old hotspot build uses bsd
-  JNI_MD_SUBDIR := bsd
-else ifeq ($(OPENJDK_TARGET_OS), windows)
-  JNI_MD_SUBDIR := win32
-else
-  JNI_MD_SUBDIR := $(OPENJDK_TARGET_OS)
-endif
-
-# SetupCopyFiles is not used here since it's non-trivial to copy a single
-# file with a different target name.
-$(INCLUDE_DST_DIR)/$(JNI_MD_SUBDIR)/jni_md.h: $(JNI_MD_H_SRC)
-	$(call LogInfo, Copying hotspot/dist/include/$(JNI_MD_SUBDIR)/jni_md.h)
-	$(install-file)
-
-#TARGETS += $(INCLUDE_DST_DIR)/$(JNI_MD_SUBDIR)/jni_md.h
-
-################################################################################
-# Optionally copy libffi.so.? into the the image
-
-ifeq ($(ENABLE_LIBFFI_BUNDLING), true)
-  $(eval $(call SetupCopyFiles, COPY_LIBFFI, \
-      FILES := $(LIBFFI_LIB_FILE), \
-      DEST := $(call FindLibDirForModule, $(MODULE)), \
-      FLATTEN := true, \
-      MACRO := install-file-nolink, \
-  ))
-
-  TARGETS += $(COPY_LIBFFI)
-endif
-
-################################################################################
--- a/make/jdk/src/classes/build/tools/generatenimbus/AbstractGradient.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/AbstractGradient.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,16 +25,41 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.xml.bind.annotation.XmlElement;
-
 class AbstractGradient extends Paint {
-    public static enum CycleMethod {
+    public enum CycleMethod {
         NO_CYCLE, REFLECT, REPEAT
     }
 
-    @XmlElement(name="stop") private ArrayList<GradientStop> stops;
+    private ArrayList<GradientStop> stops;
     public List<GradientStop> getStops() { return stops; }
+
+    AbstractGradient(XMLStreamReader reader) throws XMLStreamException {
+        stops = new ArrayList<>();
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "stop":
+                            stops.add(new GradientStop(reader));
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "stop":
+                            break;
+                        default:
+                            return;
+                    }
+                    break;
+            }
+        }
+
+    }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/Border.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Border.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,20 +25,41 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlEnumValue;
+import javax.xml.stream.XMLStreamReader;
 
 class Border {
     enum BorderType {
-        @XmlEnumValue("empty") EMPTY,
-        @XmlEnumValue("painter") PAINTER
+        EMPTY,
+        PAINTER
     }
-    @XmlAttribute private BorderType type;
-    @XmlAttribute private String painter;
-    @XmlAttribute private int top;
-    @XmlAttribute private int left;
-    @XmlAttribute private int bottom;
-    @XmlAttribute private int right;
+
+    private BorderType type;
+
+    private String painter;
+
+    private int top;
+
+    private int left;
+
+    private int bottom;
+
+    private int right;
+
+    Border(XMLStreamReader reader) {
+        switch (reader.getAttributeValue(null, "type")) {
+            case "empty":
+                type = BorderType.EMPTY;
+                break;
+            case "painter":
+                type =BorderType.PAINTER;
+                break;
+        }
+        painter = reader.getAttributeValue(null, "painter");
+        top = Integer.parseInt(reader.getAttributeValue(null, "top"));
+        left = Integer.parseInt(reader.getAttributeValue(null, "left"));
+        bottom = Integer.parseInt(reader.getAttributeValue(null, "bottom"));
+        right = Integer.parseInt(reader.getAttributeValue(null, "right"));
+    }
 
     public String write() {
         switch (type) {
--- a/make/jdk/src/classes/build/tools/generatenimbus/Canvas.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Canvas.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,18 +25,49 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.util.ArrayList;
 import java.util.List;
 
-import javax.xml.bind.annotation.XmlElement;
+class Canvas {
+    private Dimension size;
 
-class Canvas {
-    @XmlElement private Dimension size;
     public Dimension getSize() { return size; }
 
-    @XmlElement(name="layer") private List<Layer> layers;
+    private List<Layer> layers;
     public List<Layer> getLayers() { return layers; }
 
-    @XmlElement private Insets stretchingInsets = null;
+    private Insets stretchingInsets = null;
+
+    Canvas(XMLStreamReader reader) throws XMLStreamException {
+        layers = new ArrayList<>();
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "size":
+                            size = new Dimension(reader);
+                            break;
+                        case "layer":
+                            layers.add(new Layer(reader));
+                            break;
+                        case "stretchingInsets":
+                            stretchingInsets = new Insets(reader);
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "canvas":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
+
     public Insets getStretchingInsets() { return stretchingInsets; }
 
     public boolean isBlank() {
--- a/make/jdk/src/classes/build/tools/generatenimbus/Dimension.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Dimension.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,11 +25,16 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamReader;
 
 class Dimension {
-    @XmlAttribute int width;
-    @XmlAttribute int height;
+    int width;
+    int height;
+
+    Dimension(XMLStreamReader reader) {
+        width = Integer.parseInt(reader.getAttributeValue(null, "width"));
+        height = Integer.parseInt(reader.getAttributeValue(null, "height"));
+    }
 
     public String write(boolean uiResource) {
         String uiSuffix = (uiResource ? "UIResource" : "");
--- a/make/jdk/src/classes/build/tools/generatenimbus/Ellipse.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Ellipse.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,18 +25,55 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class Ellipse extends Shape {
-    @XmlAttribute private double x1;
+    private double x1;
+
     public double getX1() { return x1; }
 
-    @XmlAttribute private double x2;
+    private double x2;
     public double getX2() { return x2; }
 
-    @XmlAttribute private double y1;
+    private double y1;
     public double getY1() { return y1; }
 
-    @XmlAttribute private double y2;
+    private double y2;
     public double getY2() { return y2; }
+
+    Ellipse(XMLStreamReader reader) throws XMLStreamException {
+        x1 = Double.parseDouble(reader.getAttributeValue(null, "x1"));
+        x2 = Double.parseDouble(reader.getAttributeValue(null, "x2"));
+        y1 = Double.parseDouble(reader.getAttributeValue(null, "y1"));
+        y2 = Double.parseDouble(reader.getAttributeValue(null, "y2"));
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "matte":
+                            paint = new Matte(reader);
+                            break;
+                        case "gradient":
+                            paint = new Gradient(reader);
+                            break;
+                        case "radialGradient":
+                            paint = new RadialGradient(reader);
+                            break;
+                        case "paintPoints":
+                            paintPoints = new PaintPoints(reader);
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "ellipse":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
+
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/Generator.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Generator.java	Thu Oct 19 21:39:39 2017 +0100
@@ -24,11 +24,12 @@
  */
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.io.*;
 import java.util.HashMap;
 import java.util.Map;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Unmarshaller;
 
 /**
  * Generates the various Java artifacts based on a SynthModel.
@@ -105,9 +106,14 @@
             System.out.println("   packagePrefix :" +packagePrefix);
             System.out.println("   lafName       :" +lafName);
 
-            JAXBContext ctx = JAXBContext.newInstance("build.tools.generatenimbus");
-            Unmarshaller u = ctx.createUnmarshaller();
-            SynthModel model = (SynthModel) u.unmarshal(skinFile);
+            SynthModel model;
+            XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+            XMLStreamReader reader;
+            try( InputStream fis = new FileInputStream(skinFile);
+                 InputStream is = new BufferedInputStream(fis)) {
+                reader = inputFactory.createXMLStreamReader(is);
+                model = new SynthModel(reader);
+            }
             Generator.init(full, buildDir, packagePrefix, lafName, model);
             Generator.getInstance().generate();
         }
--- a/make/jdk/src/classes/build/tools/generatenimbus/Gradient.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Gradient.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,5 +25,11 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
 class Gradient extends AbstractGradient {
+    Gradient(XMLStreamReader reader) throws XMLStreamException {
+        super(reader);
+    }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/GradientStop.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/GradientStop.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,16 +25,32 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class GradientStop {
-    @XmlAttribute private float position;
+    private float position;
+
     public float getPosition() { return position; }
 
-    @XmlAttribute private float midpoint;
+    private float midpoint;
     public float getMidpoint() { return midpoint; }
 
-    @XmlElement private Matte matte;
+    private Matte matte;
     public Matte getColor() { return matte; }
+
+    GradientStop(XMLStreamReader reader) throws XMLStreamException {
+        position = Float.parseFloat(reader.getAttributeValue(null, "position"));
+        midpoint = Float.parseFloat(reader.getAttributeValue(null, "midpoint"));
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    matte = new Matte(reader);
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    return;
+            }
+        }
+    }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/Insets.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Insets.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,13 +25,13 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamReader;
 
 class Insets {
-    @XmlAttribute int top;
-    @XmlAttribute int left;
-    @XmlAttribute int bottom;
-    @XmlAttribute int right;
+    int top;
+    int left;
+    int bottom;
+    int right;
 
     public Insets() {
         this(0, 0, 0, 0);
@@ -44,6 +44,13 @@
         this.right = right;
     }
 
+    Insets(XMLStreamReader reader) {
+        top = Integer.parseInt(reader.getAttributeValue(null, "top"));
+        left = Integer.parseInt(reader.getAttributeValue(null, "left"));
+        bottom = Integer.parseInt(reader.getAttributeValue(null, "bottom"));
+        right = Integer.parseInt(reader.getAttributeValue(null, "right"));
+    }
+
     public String write(boolean uiResource) {
         String uiSuffix = (uiResource ? "UIResource" : "");
         return String.format("new Insets%s(%d, %d, %d, %d)",
--- a/make/jdk/src/classes/build/tools/generatenimbus/Layer.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Layer.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,22 +25,45 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlElements;
-
 class Layer {
     /** List of shapes in this layer, first shape is painted on top */
-    @XmlElements({
-        @XmlElement(name = "ellipse", type = Ellipse.class),
-        @XmlElement(name = "path", type = Path.class),
-        @XmlElement(name = "rectangle", type = Rectangle.class)
-    })
-    @XmlElementWrapper(name="shapes")
     private List<Shape> shapes = new ArrayList<Shape>();
+
+    Layer(XMLStreamReader reader) throws XMLStreamException {
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "shapes":
+                            shapes = new ArrayList<>();
+                            break;
+                        case "ellipse":
+                            shapes.add(new Ellipse(reader));
+                            break;
+                        case "path":
+                            shapes.add(new Path(reader));
+                            break;
+                        case "rectangle":
+                            shapes.add(new Rectangle(reader));
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "layer":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
+
     public List<Shape> getShapes() { return shapes; }
 
     public boolean isEmpty() {
--- a/make/jdk/src/classes/build/tools/generatenimbus/Matte.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Matte.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,24 +25,47 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamReader;
+import java.util.Optional;
 
 class Matte extends Paint {
-    @XmlAttribute private int red;
-    @XmlAttribute private int green;
-    @XmlAttribute private int blue;
-    @XmlAttribute private int alpha;
+    private int red;
+    private int green;
+    private int blue;
+    private int alpha;
 
-    @XmlAttribute private String uiDefaultParentName = null;
-    @XmlAttribute private float hueOffset = 0;
-    @XmlAttribute private float saturationOffset = 0;
-    @XmlAttribute private float brightnessOffset = 0;
-    @XmlAttribute private int alphaOffset = 0;
+    private String uiDefaultParentName = null;
+    private float hueOffset = 0;
+    private float saturationOffset = 0;
+    private float brightnessOffset = 0;
+    private int alphaOffset = 0;
 
-    @XmlAttribute private String componentPropertyName = null;
+    private String componentPropertyName = null;
+
     public String getComponentPropertyName() { return componentPropertyName; }
 
-    @XmlAttribute private boolean uiResource = true;
+    private boolean uiResource = true;
+
+    Matte(XMLStreamReader reader) {
+        red = Integer.parseInt(reader.getAttributeValue(null, "red"));
+        green = Integer.parseInt(reader.getAttributeValue(null, "green"));
+        blue = Integer.parseInt(reader.getAttributeValue(null, "blue"));
+        alpha = Integer.parseInt(reader.getAttributeValue(null, "alpha"));
+        uiDefaultParentName = reader.getAttributeValue(null,
+                "uiDefaultParentName");
+        hueOffset = Float.parseFloat(reader.getAttributeValue(null,
+                "hueOffset"));
+        saturationOffset = Float.parseFloat(reader.getAttributeValue(null,
+                "saturationOffset"));
+        brightnessOffset = Float.parseFloat(reader.getAttributeValue(null,
+                "brightnessOffset"));
+        alphaOffset = Integer.parseInt(reader.getAttributeValue(null,
+                "alphaOffset"));
+        componentPropertyName = reader.getAttributeValue(null,
+                "componentPropertyName");
+        uiResource = Boolean.parseBoolean(Optional.ofNullable(
+                reader.getAttributeValue(null, "uiResource")).orElse("true"));
+    }
 
     public boolean isAbsolute() {
         return uiDefaultParentName == null;
--- a/make/jdk/src/classes/build/tools/generatenimbus/ObjectFactory.java	Thu Oct 12 22:05:47 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2002, 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.  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 build.tools.generatenimbus;
-
-import javax.xml.bind.annotation.XmlRegistry;
-
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the test package.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups.  Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
-    /**
-     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: test
-     *
-     */
-    public ObjectFactory() {
-    }
-
-    /**
-     * Create an instance of {@link SynthModel }
-     *
-     */
-    public SynthModel createSynthModel() {
-        return new SynthModel();
-    }
-}
--- a/make/jdk/src/classes/build/tools/generatenimbus/Path.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Path.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,15 +25,49 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
+class Path extends Shape {
+    private List<Point> controlPoints = new ArrayList<Point>();
 
-class Path extends Shape {
-    @XmlElement(name="point")
-    @XmlElementWrapper(name="points")
-    private List<Point> controlPoints = new ArrayList<Point>();
+    Path(XMLStreamReader reader) throws XMLStreamException {
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "points":
+                            controlPoints = new ArrayList<>();
+                            break;
+                        case "point":
+                            controlPoints.add(new Point(reader));
+                            break;
+                        case "matte":
+                            paint = new Matte(reader);
+                            break;
+                        case "gradient":
+                            paint = new Gradient(reader);
+                            break;
+                        case "radialGradient":
+                            paint = new RadialGradient(reader);
+                            break;
+                        case "paintPoints":
+                            paintPoints = new PaintPoints(reader);
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "path":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
+
     public List<Point> getControlPoints() { return controlPoints; }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/Point.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Point.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,27 +25,37 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamReader;
 
 class Point {
-    @XmlAttribute private double x;
+    private double x;
+
     public double getX() { return x; }
 
-    @XmlAttribute private double y;
+    private double y;
     public double getY() { return y; }
 
-    @XmlAttribute(name="cp1x") private double cp1x;
+    private double cp1x;
     public double getCp1X() { return cp1x; }
 
-    @XmlAttribute(name="cp1y") private double cp1y;
+    private double cp1y;
     public double getCp1Y() { return cp1y; }
 
-    @XmlAttribute(name="cp2x") private double cp2x;
+    private double cp2x;
     public double getCp2X() { return cp2x; }
 
-    @XmlAttribute(name="cp2y") private double cp2y;
+    private double cp2y;
     public double getCp2Y() { return cp2y; }
 
+    Point(XMLStreamReader reader) {
+        x = Double.parseDouble(reader.getAttributeValue(null, "x"));
+        y = Double.parseDouble(reader.getAttributeValue(null, "y"));
+        cp1x = Double.parseDouble(reader.getAttributeValue(null, "cp1x"));
+        cp1y = Double.parseDouble(reader.getAttributeValue(null, "cp1y"));
+        cp2x = Double.parseDouble(reader.getAttributeValue(null, "cp2x"));
+        cp2y = Double.parseDouble(reader.getAttributeValue(null, "cp2y"));
+    }
+
     public boolean isP1Sharp() {
         return cp1x == x && cp1y == y;
     }
--- a/make/jdk/src/classes/build/tools/generatenimbus/RadialGradient.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/RadialGradient.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,5 +25,11 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
 class RadialGradient extends AbstractGradient {
+    RadialGradient(XMLStreamReader reader) throws XMLStreamException {
+        super(reader);
+    }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/Rectangle.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Rectangle.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,22 +25,23 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class Rectangle extends Shape {
-    @XmlAttribute private double x1;
+    private double x1;
+
     public double getX1() { return x1; }
 
-    @XmlAttribute private double x2;
+    private double x2;
     public double getX2() { return x2; }
 
-    @XmlAttribute private double y1;
+    private double y1;
     public double getY1() { return y1; }
 
-    @XmlAttribute private double y2;
+    private double y2;
     public double getY2() { return y2; }
 
-    @XmlAttribute
     public double getRounding() {
         double rounding = Math.abs(roundingX - x1) * 2;
         return rounding > 2 ? rounding : 0;
@@ -58,4 +59,38 @@
         return getRounding() > 0;
     }
 
+    Rectangle(XMLStreamReader reader) throws XMLStreamException {
+        x1 = Double.parseDouble(reader.getAttributeValue(null, "x1"));
+        x2 = Double.parseDouble(reader.getAttributeValue(null, "x2"));
+        y1 = Double.parseDouble(reader.getAttributeValue(null, "y1"));
+        y2 = Double.parseDouble(reader.getAttributeValue(null, "y2"));
+        setRounding(Double.parseDouble(reader.getAttributeValue(null, "rounding")));
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "matte":
+                            paint = new Matte(reader);
+                            break;
+                        case "gradient":
+                            paint = new Gradient(reader);
+                            break;
+                        case "radialGradient":
+                            paint = new RadialGradient(reader);
+                            break;
+                        case "paintPoints":
+                            paintPoints = new PaintPoints(reader);
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "rectangle":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/Shape.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Shape.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,31 +25,30 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElements;
-
+import javax.xml.stream.XMLStreamReader;
 
 public abstract class Shape {
-    @XmlElement
-    private PaintPoints paintPoints;
+    PaintPoints paintPoints;
+
     public double getPaintX1() { return paintPoints.x1; }
     public double getPaintX2() { return paintPoints.x2; }
     public double getPaintY1() { return paintPoints.y1; }
     public double getPaintY2() { return paintPoints.y2; }
 
-    @XmlElements({
-        @XmlElement(name = "matte", type = Matte.class),
-        @XmlElement(name = "gradient", type = Gradient.class),
-        @XmlElement(name = "radialGradient", type = RadialGradient.class)
-    })
-    private Paint paint;
+    Paint paint;
     public Paint getPaint() { return paint; }
 
     static class PaintPoints {
-        @XmlAttribute double x1;
-        @XmlAttribute double y1;
-        @XmlAttribute double x2;
-        @XmlAttribute double y2;
+        double x1;
+        double y1;
+        double x2;
+        double y2;
+
+        PaintPoints(XMLStreamReader reader) {
+            x1 = Double.parseDouble(reader.getAttributeValue(null, "x1"));
+            x2 = Double.parseDouble(reader.getAttributeValue(null, "x2"));
+            y1 = Double.parseDouble(reader.getAttributeValue(null, "y1"));
+            y2 = Double.parseDouble(reader.getAttributeValue(null, "y2"));
+        }
     }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/SynthModel.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/SynthModel.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,26 +25,54 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
-import javax.xml.bind.annotation.*;
 
+public class SynthModel {
+    private UIStyle style;
 
-@XmlRootElement(name="synthModel")
-public class SynthModel {
-    @XmlElement private UIStyle style;
-
-    @XmlElement(name="uiColor")
-    @XmlElementWrapper(name="colors")
     private ArrayList<UIColor> colors;
 
-    @XmlElement(name="uiFont")
-    @XmlElementWrapper(name="fonts")
     private ArrayList<UIFont> fonts;
 
-    @XmlElement(name="uiComponent")
-    @XmlElementWrapper(name="components")
     private ArrayList<UIComponent> components;
 
+    SynthModel(XMLStreamReader reader) throws XMLStreamException {
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "style":
+                            style = new UIStyle(reader);
+                            break;
+                        case "colors":
+                            colors = new ArrayList<>();
+                            break;
+                        case "fonts":
+                            fonts = new ArrayList<>();
+                            break;
+                        case "components":
+                            components = new ArrayList<>();
+                            break;
+                        case "uiColor":
+                            colors.add(new UIColor(reader));
+                            break;
+                        case "uiFont":
+                            fonts.add(new UIFont(reader));
+                            break;
+                        case "uiComponent":
+                            components.add(new UIComponent(reader));
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    break;
+            }
+        }
+    }
+
     public void initStyles() {
         for (UIComponent c: components) {
             c.initStyles(this.style);
--- a/make/jdk/src/classes/build/tools/generatenimbus/Typeface.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Typeface.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,11 +25,11 @@
 
 package build.tools.generatenimbus;
 
-import java.awt.Font;
-
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamReader;
+import java.awt.*;
 
 class Typeface {
+
     public enum DeriveStyle {
         Default, Off, On;
 
@@ -42,12 +42,30 @@
         }
     }
 
-    @XmlAttribute private String uiDefaultParentName;
-    @XmlAttribute(name="family") private String name;
-    @XmlAttribute private int size;
-    @XmlAttribute private DeriveStyle bold = DeriveStyle.Default;
-    @XmlAttribute private DeriveStyle italic = DeriveStyle.Default;
-    @XmlAttribute private float sizeOffset = 1f;
+    private String uiDefaultParentName;
+    private String name;
+    private int size;
+    private DeriveStyle bold = DeriveStyle.Default;
+    private DeriveStyle italic = DeriveStyle.Default;
+    private float sizeOffset = 1f;
+
+    Typeface(XMLStreamReader reader) {
+        uiDefaultParentName = reader.getAttributeValue(null, "uiDefaultParentName");
+        name = reader.getAttributeValue(null, "family");
+        try {
+            size = Integer.parseInt(reader.getAttributeValue(null, "size"));
+        } catch (Exception e) {}
+        try {
+            bold = DeriveStyle.valueOf(reader.getAttributeValue(null, "bold"));
+        } catch (Exception e) {}
+        try {
+            italic = DeriveStyle.valueOf(reader.getAttributeValue(null, "italic"));
+        } catch (Exception e) {}
+        try {
+            sizeOffset = Float.parseFloat(reader.getAttributeValue(null, "sizeOffset"));
+        } catch (Exception e) {}
+    }
+
 
     public boolean isAbsolute() {
         return uiDefaultParentName == null;
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIColor.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIColor.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,13 +25,23 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlElement;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class UIColor extends UIDefault<Matte> {
 
-    @XmlElement
-    public void setMatte(Matte m) {
-        setValue(m);
+    UIColor(XMLStreamReader reader) throws XMLStreamException {
+        name = reader.getAttributeValue(null, "name");
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    setValue(new Matte(reader));
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    return;
+            }
+        }
     }
 
     public String write() {
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIComponent.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIComponent.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,19 +25,41 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
+class UIComponent extends UIRegion {
+    private String componentName;
 
-class UIComponent extends UIRegion {
-    @XmlAttribute private String componentName;
+    private List<UIStateType> stateTypes = new ArrayList<>();
 
-    @XmlElement(name="stateType")
-    @XmlElementWrapper(name="stateTypes")
-    private List<UIStateType> stateTypes = new ArrayList<UIStateType>();
+    UIComponent(XMLStreamReader reader) throws XMLStreamException {
+        super(reader, false);
+        componentName = reader.getAttributeValue(null, "componentName");
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "stateType":
+                            stateTypes.add(new UIStateType(reader));
+                            break;
+                        default:
+                            parse(reader);
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "uiComponent":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
+
     public List<UIStateType> getStateTypes() { return stateTypes; }
 
     @Override public String getKey() {
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIDefault.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIDefault.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,10 +25,8 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
-
 public class UIDefault<T> {
-    @XmlAttribute private String name;
+    String name;
     private T value;
 
     public String getName() {
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIFont.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIFont.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,12 +25,22 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlElement;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class UIFont extends UIDefault<Typeface> {
-    @XmlElement
-    public void setTypeface(Typeface t) {
-        setValue(t);
+    UIFont(XMLStreamReader reader) throws XMLStreamException {
+        name = reader.getAttributeValue(null, "name");
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    setValue(new Typeface(reader));
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    return;
+            }
+        }
     }
 
     public String write() {
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIIconRegion.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIIconRegion.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,10 +25,31 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class UIIconRegion extends UIRegion {
-    @XmlAttribute private String basicKey;
+    private String basicKey;
+
+    UIIconRegion(XMLStreamReader reader) throws XMLStreamException {
+        super(reader, false);
+        basicKey = reader.getAttributeValue(null, "basicKey");
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    parse(reader);
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "uiIconRegion":
+                            return;
+                    }
+                    break;
+            }
+        }
+
+    }
 
     @Override public void write(StringBuilder sb, StringBuilder styleBuffer, UIComponent comp, String prefix, String pkg) {
         Dimension size = null;
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIProperty.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIProperty.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,22 +25,60 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class UIProperty extends UIDefault<String> {
-    public static enum PropertyType {
+    public enum PropertyType {
         BOOLEAN, INT, FLOAT, DOUBLE, STRING, FONT, COLOR, INSETS, DIMENSION, BORDER
     }
-    @XmlAttribute private PropertyType type;
+    private PropertyType type;
 
-    @XmlElement private Border border;
-    @XmlElement private Dimension dimension;
-    @XmlElement private Insets insets;
-    @XmlElement private Matte matte;
-    @XmlElement private Typeface typeface;
+    private Border border;
+    private Dimension dimension;
+    private Insets insets;
+    private Matte matte;
+    private Typeface typeface;
 
-    @XmlAttribute
+    UIProperty(XMLStreamReader reader) throws XMLStreamException {
+        name = reader.getAttributeValue(null, "name");
+        setValue(reader.getAttributeValue(null, "value"));
+        try {
+            type = PropertyType.valueOf(reader.getAttributeValue(null, "type"));
+        } catch (Exception e) {}
+
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "border":
+                            border = new Border(reader);
+                            break;
+                        case "dimension":
+                            dimension = new Dimension(reader);
+                            break;
+                        case "insets":
+                            insets = new Insets(reader);
+                            break;
+                        case "matte":
+                            matte = new Matte(reader);
+                            break;
+                        case "typeface":
+                            typeface = new Typeface(reader);
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "uiProperty":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
+
     @Override public void setValue(String value) {
         super.setValue(value);
     }
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIRegion.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIRegion.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,48 +25,92 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlElements;
+class UIRegion {
+    String name;
+    String key;
+    private boolean opaque = false;
 
-class UIRegion {
-    @XmlAttribute protected String name;
-    @XmlAttribute protected String key;
-    @XmlAttribute private boolean opaque = false;
+    private Insets contentMargins = new Insets(0, 0, 0, 0);
 
-    @XmlElement private Insets contentMargins = new Insets(0, 0, 0, 0);
+    protected List<UIState> backgroundStates = new ArrayList<UIState>();
 
-    @XmlElement(name="state")
-    @XmlElementWrapper(name="backgroundStates")
-    protected List<UIState> backgroundStates = new ArrayList<UIState>();
     public List<UIState> getBackgroundStates() { return backgroundStates; }
 
-    @XmlElement(name="state")
-    @XmlElementWrapper(name="foregroundStates")
     protected List<UIState> foregroundStates = new ArrayList<UIState>();
     public List<UIState> getForegroundStates() { return foregroundStates; }
 
-    @XmlElement(name="state")
-    @XmlElementWrapper(name="borderStates")
     protected List<UIState> borderStates = new ArrayList<UIState>();
     public List<UIState> getBorderStates() { return borderStates; }
 
-    @XmlElement private UIStyle style = new UIStyle();
+    UIStyle style = new UIStyle();
 
-    @XmlElements({
-        @XmlElement(name = "region", type = UIRegion.class),
-        @XmlElement(name = "uiComponent", type = UIComponent.class),
-        @XmlElement(name = "uiIconRegion", type = UIIconRegion.class)
-    })
-    @XmlElementWrapper(name="regions")
-    private List<UIRegion> subRegions = new ArrayList<UIRegion>();
+    List<UIRegion> subRegions = new ArrayList<>();
     public List<UIRegion> getSubRegions() { return subRegions; }
 
+    UIRegion(XMLStreamReader reader, boolean parse)
+                                                     throws XMLStreamException {
+        name = reader.getAttributeValue(null, "name");
+        key = reader.getAttributeValue(null, "key");
+        opaque = Boolean.parseBoolean(reader.getAttributeValue(null, "opaque"));
+        if (!parse) {
+            return;
+        }
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    parse(reader);
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "region":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
+
+    private List<UIState> states = new ArrayList<UIState>();
+
+    void parse(XMLStreamReader reader) throws XMLStreamException {
+        switch (reader.getLocalName()) {
+            case "backgroundStates":
+                backgroundStates = states = new ArrayList<>();
+                break;
+            case "foregroundStates":
+                foregroundStates = states = new ArrayList<>();
+                break;
+            case "borderStates":
+                borderStates = states = new ArrayList<>();
+                break;
+            case "style":
+                style = new UIStyle(reader);
+                break;
+            case "region":
+                subRegions.add(new UIRegion(reader, true));
+                break;
+            case "uiComponent":
+                subRegions.add(new UIComponent(reader));
+                break;
+            case "uiIconRegion":
+                subRegions.add(new UIIconRegion(reader));
+                break;
+            case "contentMargins":
+                contentMargins = new Insets(reader);
+                break;
+            case "state":
+                states.add(new UIState(reader));
+                break;
+        }
+    }
+
     protected void initStyles(UIStyle parentStyle) {
         style.setParentStyle(parentStyle);
         for (UIState state: backgroundStates) {
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIState.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIState.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,30 +25,56 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
+class UIState {
+    private String stateKeys;
 
-class UIState {
-    @XmlAttribute private String stateKeys;
     public String getStateKeys() { return stateKeys; }
 
     /** Indicates whether to invert the meaning of the 9-square stretching insets */
-    @XmlAttribute private boolean inverted;
+    private boolean inverted;
 
     /** A cached string representing the list of stateKeys deliminated with "+" */
     private String cachedName = null;
 
-    @XmlElement private Canvas canvas;
+    private Canvas canvas;
     public Canvas getCanvas() { return canvas; }
 
-    @XmlElement private UIStyle style;
+    private UIStyle style;
     public UIStyle getStyle() { return style; }
 
+    UIState(XMLStreamReader reader) throws XMLStreamException {
+        stateKeys = reader.getAttributeValue(null, "stateKeys");
+        inverted = Boolean.parseBoolean(reader.getAttributeValue(null, "inverted"));
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "canvas":
+                            canvas = new Canvas(reader);
+                            break;
+                        case "style":
+                            style = new UIStyle(reader);
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "state":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
+
     public boolean hasCanvas() {
         return ! canvas.isBlank();
     }
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIStateType.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIStateType.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,13 +25,37 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class UIStateType {
-    @XmlAttribute private String key;
-    public String getKey() { return key; }
+    private String key;
 
-    @XmlElement private String codeSnippet;
+    public String
+    getKey() { return key; }
+
+    private String codeSnippet;
     public String getCodeSnippet() { return codeSnippet; }
+
+    UIStateType(XMLStreamReader reader) throws XMLStreamException {
+        key = reader.getAttributeValue(null, "key");
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "codeSnippet":
+                            codeSnippet = reader.getElementText();
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "stateType":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIStyle.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIStyle.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,37 +25,86 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
 import java.util.List;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-
 
 class UIStyle {
-    public static enum CacheMode {
+
+    public enum CacheMode {
         NO_CACHING, FIXED_SIZES, NINE_SQUARE_SCALE
     }
 
-    @XmlElement private UIColor textForeground = null;
-    @XmlElement(name="inherit-textForeground")
+    private UIColor textForeground = null;
     private boolean textForegroundInherited = true;
 
-    @XmlElement private UIColor textBackground = null;
-    @XmlElement(name="inherit-textBackground")
+    private UIColor textBackground = null;
     private boolean textBackgroundInherited = true;
 
-    @XmlElement private UIColor background = null;
-    @XmlElement(name="inherit-background")
+    private UIColor background = null;
     private boolean backgroundInherited = true;
 
-    @XmlElement private boolean cacheSettingsInherited = true;
-    @XmlElement CacheMode cacheMode = CacheMode.FIXED_SIZES;
-    @XmlElement String maxHozCachedImgScaling = "1.0";
-    @XmlElement String maxVertCachedImgScaling = "1.0";
+    private boolean cacheSettingsInherited = true;
+    CacheMode cacheMode = CacheMode.FIXED_SIZES;
+    String maxHozCachedImgScaling = "1.0";
+    String maxVertCachedImgScaling = "1.0";
 
-    @XmlElement(name="uiProperty")
-    @XmlElementWrapper(name="uiproperties")
-    private List<UIProperty> uiProperties = new ArrayList<UIProperty>();
+    private List<UIProperty> uiProperties = new ArrayList<>();
+
+    UIStyle() {
+    }
+
+    UIStyle(XMLStreamReader reader) throws XMLStreamException {
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "textForeground":
+                            textForeground = new UIColor(reader);
+                            break;
+                        case "textBackground":
+                            textBackground = new UIColor(reader);
+                            break;
+                        case "background":
+                            background = new UIColor(reader);
+                            break;
+                        case "uiProperty":
+                            uiProperties.add(new UIProperty(reader));
+                            break;
+                        case "inherit-textForeground":
+                            textForegroundInherited = Boolean.parseBoolean(reader.getElementText());
+                            break;
+                        case "inherit-textBackground":
+                            textBackgroundInherited = Boolean.parseBoolean(reader.getElementText());
+                            break;
+                        case "cacheSettingsInherited":
+                            cacheSettingsInherited = Boolean.parseBoolean(reader.getElementText());
+                            break;
+                        case "inherit-background":
+                            backgroundInherited = Boolean.parseBoolean(reader.getElementText());
+                            break;
+                        case "cacheMode":
+                            cacheMode = CacheMode.valueOf(reader.getElementText());
+                            break;
+                        case "maxHozCachedImgScaling":
+                            maxHozCachedImgScaling = reader.getElementText();
+                            break;
+                        case "maxVertCachedImgScaling":
+                            maxVertCachedImgScaling = reader.getElementText();
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "style":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
 
     private UIStyle parentStyle = null;
     public void setParentStyle(UIStyle parentStyle) {
--- a/make/langtools/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/langtools/src/classes/build/tools/symbolgenerator/TransitiveDependencies.java	Thu Oct 19 21:39:39 2017 +0100
@@ -39,6 +39,7 @@
 import javax.tools.ToolProvider;
 
 import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.api.JavacTool;
 import com.sun.tools.javac.code.Symbol.ModuleSymbol;
 
 /**
@@ -56,7 +57,7 @@
             return ;
         }
 
-        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        JavaCompiler compiler = JavacTool.create();
         List<String> options = Arrays.asList("-source", "10",
                                              "-target", "10",
                                              "-proc:only",
--- a/make/lib/Lib-java.base.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/lib/Lib-java.base.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -25,9 +25,13 @@
 
 include LibCommon.gmk
 
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, lib/Lib-java.base.gmk))
+
 # Prepare the find cache.
-$(eval $(call FillCacheFind, $(wildcard $(TOPDIR)/src/java.base/*/native \
-    $(TOPDIR)/src/*/java.base/*/native)))
+LIB_java.base_SRC_DIRS += $(TOPDIR)/src/java.base/*/native
+
+$(eval $(call FillCacheFind, $(wildcard $(LIB_java.base_SRC_DIRS))))
 
 include CoreLibraries.gmk
 include NetworkingLibraries.gmk
--- a/make/lib/Lib-java.desktop.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/lib/Lib-java.desktop.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -25,9 +25,13 @@
 
 include LibCommon.gmk
 
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, lib/Lib-java.desktop.gmk))
+
 # Prepare the find cache.
-$(eval $(call FillCacheFind, $(wildcard $(TOPDIR)/src/java.desktop/*/native \
-    $(TOPDIR)/src/*/java.desktop/*/native)))
+LIB_java.desktop_SRC_DIRS += $(TOPDIR)/src/java.desktop/*/native
+
+$(eval $(call FillCacheFind, $(wildcard $(LIB_java.desktop_SRC_DIRS))))
 
 include LibosxLibraries.gmk
 include PlatformLibraries.gmk
--- a/make/mapfiles/libfontmanager/mapfile-vers	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/mapfiles/libfontmanager/mapfile-vers	Thu Oct 19 21:39:39 2017 +0100
@@ -41,8 +41,6 @@
                 Java_sun_font_StrikeCache_freeLongPointer;
                 Java_sun_font_StrikeCache_freeIntMemory;
                 Java_sun_font_StrikeCache_freeLongMemory;
-                Java_sun_font_SunLayoutEngine_initGVIDs;
-                Java_sun_font_SunLayoutEngine_nativeLayout;
                 Java_sun_font_SunLayoutEngine_shape;
                 Java_sun_font_X11TextRenderer_doDrawGlyphList;
 		Java_sun_java2d_loops_DrawGlyphListAA_DrawGlyphListAA;
--- a/make/rmic/RmicCommon.gmk	Thu Oct 12 22:05:47 2017 +0200
+++ b/make/rmic/RmicCommon.gmk	Thu Oct 19 21:39:39 2017 +0100
@@ -31,13 +31,9 @@
 
 ################################################################################
 
-ifeq ($(BOOT_JDK_MODULAR), true)
-  RMIC_MAIN_CLASS := -m jdk.rmic/sun.rmi.rmic.Main
-else
-  RMIC_MAIN_CLASS := sun.rmi.rmic.Main
-endif
+RMIC_MAIN_CLASS := -m jdk.rmic.interim/sun.rmi.rmic.Main
 
-RMIC := $(JAVA_SMALL) $(INTERIM_RMIC_OVERRIDE_MODULES_ARGS) $(RMIC_MAIN_CLASS)
+RMIC := $(JAVA_SMALL) $(INTERIM_RMIC_ARGS) $(RMIC_MAIN_CLASS)
 
 CLASSES_DIR := $(JDK_OUTPUTDIR)/modules
 # NOTE: If the smart javac dependency management is reintroduced, these classes
--- a/src/java.base/macosx/native/libjava/java_props_macosx.c	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.base/macosx/native/libjava/java_props_macosx.c	Thu Oct 19 21:39:39 2017 +0100
@@ -113,6 +113,12 @@
     }
 
     if (retVal != NULL) {
+        // convertToPOSIXLocale() does not expect any variant codes, so ignore
+        // '@' and anything following, if present.
+        char* rmAt = strchr(retVal, '@');
+        if (rmAt != NULL) {
+            *rmAt = '\0';
+        }
         return strdup(convertToPOSIXLocale(retVal));
     }
 
--- a/src/java.base/share/classes/java/lang/Object.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.base/share/classes/java/lang/Object.java	Thu Oct 19 21:39:39 2017 +0100
@@ -307,18 +307,67 @@
     public final native void notifyAll();
 
     /**
-     * Causes the current thread to wait until either another thread invokes the
-     * {@link java.lang.Object#notify()} method or the
-     * {@link java.lang.Object#notifyAll()} method for this object, or a
-     * specified amount of time has elapsed.
+     * Causes the current thread to wait until it is awakened, typically
+     * by being <em>notified</em> or <em>interrupted</em>.
      * <p>
-     * The current thread must own this object's monitor.
+     * In all respects, this method behaves as if {@code wait(0L, 0)}
+     * had been called. See the specification of the {@link #wait(long, int)} method
+     * for details.
+     *
+     * @throws IllegalMonitorStateException if the current thread is not
+     *         the owner of the object's monitor
+     * @throws InterruptedException if any thread interrupted the current thread before or
+     *         while the current thread was waiting. The <em>interrupted status</em> of the
+     *         current thread is cleared when this exception is thrown.
+     * @see    #notify()
+     * @see    #notifyAll()
+     * @see    #wait(long)
+     * @see    #wait(long, int)
+     */
+    public final void wait() throws InterruptedException {
+        wait(0L);
+    }
+
+    /**
+     * Causes the current thread to wait until it is awakened, typically
+     * by being <em>notified</em> or <em>interrupted</em>, or until a
+     * certain amount of real time has elapsed.
      * <p>
-     * This method causes the current thread (call it <var>T</var>) to
-     * place itself in the wait set for this object and then to relinquish
-     * any and all synchronization claims on this object. Thread <var>T</var>
-     * becomes disabled for thread scheduling purposes and lies dormant
-     * until one of four things happens:
+     * In all respects, this method behaves as if {@code wait(timeout, 0)}
+     * had been called. See the specification of the {@link #wait(long, int)} method
+     * for details.
+     *
+     * @param  timeout the maximum time to wait, in milliseconds
+     * @throws IllegalArgumentException if the value of {@code timeout} is negative
+     * @throws IllegalMonitorStateException if the current thread is not
+     *         the owner of the object's monitor
+     * @throws InterruptedException if any thread interrupted the current thread before or
+     *         while the current thread was waiting. The <em>interrupted status</em> of the
+     *         current thread is cleared when this exception is thrown.
+     * @see    #notify()
+     * @see    #notifyAll()
+     * @see    #wait()
+     * @see    #wait(long, int)
+     */
+    public final native void wait(long timeout) throws InterruptedException;
+
+    /**
+     * Causes the current thread to wait until it is awakened, typically
+     * by being <em>notified</em> or <em>interrupted</em>, or until a
+     * certain amount of real time has elapsed.
+     * <p>
+     * The current thread must own this object's monitor lock. See the
+     * {@link #notify notify} method for a description of the ways in which
+     * a thread can become the owner of a monitor lock.
+     * <p>
+     * This method causes the current thread (referred to here as <var>T</var>) to
+     * place itself in the wait set for this object and then to relinquish any
+     * and all synchronization claims on this object. Note that only the locks
+     * on this object are relinquished; any other objects on which the current
+     * thread may be synchronized remain locked while the thread waits.
+     * <p>
+     * Thread <var>T</var> then becomes disabled for thread scheduling purposes
+     * and lies dormant until one of the following occurs:
      * <ul>
      * <li>Some other thread invokes the {@code notify} method for this
      * object and thread <var>T</var> happens to be arbitrarily chosen as
@@ -327,14 +376,18 @@
      * object.
      * <li>Some other thread {@linkplain Thread#interrupt() interrupts}
      * thread <var>T</var>.
-     * <li>The specified amount of real time has elapsed, more or less.  If
-     * {@code timeout} is zero, however, then real time is not taken into
-     * consideration and the thread simply waits until notified.
+     * <li>The specified amount of real time has elapsed, more or less.
+     * The amount of real time, in nanoseconds, is given by the expression
+     * {@code 1000000 * timeout + nanos}. If {@code timeout} and {@code nanos}
+     * are both zero, then real time is not taken into consideration and the
+     * thread waits until awakened by one of the other causes.
+     * <li>Thread <var>T</var> is awakened spuriously. (See below.)
      * </ul>
+     * <p>
      * The thread <var>T</var> is then removed from the wait set for this
-     * object and re-enabled for thread scheduling. It then competes in the
+     * object and re-enabled for thread scheduling. It competes in the
      * usual manner with other threads for the right to synchronize on the
-     * object; once it has gained control of the object, all its
+     * object; once it has regained control of the object, all its
      * synchronization claims on the object are restored to the status quo
      * ante - that is, to the situation as of the time that the {@code wait}
      * method was invoked. Thread <var>T</var> then returns from the
@@ -343,119 +396,54 @@
      * thread {@code T} is exactly as it was when the {@code wait} method
      * was invoked.
      * <p>
-     * A thread can also wake up without being notified, interrupted, or
-     * timing out, a so-called <i>spurious wakeup</i>.  While this will rarely
-     * occur in practice, applications must guard against it by testing for
-     * the condition that should have caused the thread to be awakened, and
-     * continuing to wait if the condition is not satisfied.  In other words,
-     * waits should always occur in loops, like this one:
-     * <pre>
+     * A thread can wake up without being notified, interrupted, or timing out, a
+     * so-called <em>spurious wakeup</em>.  While this will rarely occur in practice,
+     * applications must guard against it by testing for the condition that should
+     * have caused the thread to be awakened, and continuing to wait if the condition
+     * is not satisfied. See the example below.
+     * <p>
+     * For more information on this topic, see section 14.2,
+     * "Condition Queues," in Brian Goetz and others' <em>Java Concurrency
+     * in Practice</em> (Addison-Wesley, 2006) or Item 69 in Joshua
+     * Bloch's <em>Effective Java, Second Edition</em> (Addison-Wesley,
+     * 2008).
+     * <p>
+     * If the current thread is {@linkplain java.lang.Thread#interrupt() interrupted}
+     * by any thread before or while it is waiting, then an {@code InterruptedException}
+     * is thrown.  The <em>interrupted status</em> of the current thread is cleared when
+     * this exception is thrown. This exception is not thrown until the lock status of
+     * this object has been restored as described above.
+     *
+     * @apiNote
+     * The recommended approach to waiting is to check the condition being awaited in
+     * a {@code while} loop around the call to {@code wait}, as shown in the example
+     * below. Among other things, this approach avoids problems that can be caused
+     * by spurious wakeups.
+     *
+     * <pre>{@code
      *     synchronized (obj) {
-     *         while (&lt;condition does not hold&gt;)
-     *             obj.wait(timeout);
-     *         ... // Perform action appropriate to condition
+     *         while (<condition does not hold> and <timeout not exceeded>) {
+     *             long timeout = ... ; // recompute timeout values
+     *             int nanos = ... ;
+     *             obj.wait(timeout, nanos);
+     *         }
+     *         ... // Perform action appropriate to condition or timeout
      *     }
-     * </pre>
+     * }</pre>
      *
-     * (For more information on this topic, see section 14.2,
-     * Condition Queues, in Brian Goetz and others' "Java Concurrency
-     * in Practice" (Addison-Wesley, 2006) or Item 69 in Joshua
-     * Bloch's "Effective Java (Second Edition)" (Addison-Wesley,
-     * 2008).
-     *
-     * <p>If the current thread is {@linkplain java.lang.Thread#interrupt()
-     * interrupted} by any thread before or while it is waiting, then an
-     * {@code InterruptedException} is thrown.  This exception is not
-     * thrown until the lock status of this object has been restored as
-     * described above.
-     *
-     * <p>
-     * Note that the {@code wait} method, as it places the current thread
-     * into the wait set for this object, unlocks only this object; any
-     * other objects on which the current thread may be synchronized remain
-     * locked while the thread waits.
-     * <p>
-     * This method should only be called by a thread that is the owner
-     * of this object's monitor. See the {@code notify} method for a
-     * description of the ways in which a thread can become the owner of
-     * a monitor.
-     *
-     * @param      timeout   the maximum time to wait in milliseconds.
-     * @throws  IllegalArgumentException      if the value of timeout is
-     *               negative.
-     * @throws  IllegalMonitorStateException  if the current thread is not
-     *               the owner of the object's monitor.
-     * @throws  InterruptedException if any thread interrupted the
-     *             current thread before or while the current thread
-     *             was waiting for a notification.  The <i>interrupted
-     *             status</i> of the current thread is cleared when
-     *             this exception is thrown.
-     * @see        java.lang.Object#notify()
-     * @see        java.lang.Object#notifyAll()
-     */
-    public final native void wait(long timeout) throws InterruptedException;
-
-    /**
-     * Causes the current thread to wait until another thread invokes the
-     * {@link java.lang.Object#notify()} method or the
-     * {@link java.lang.Object#notifyAll()} method for this object, or
-     * some other thread interrupts the current thread, or a certain
-     * amount of real time has elapsed.
-     * <p>
-     * This method is similar to the {@code wait} method of one
-     * argument, but it allows finer control over the amount of time to
-     * wait for a notification before giving up. The amount of real time,
-     * measured in nanoseconds, is given by:
-     * <blockquote>
-     * <pre>
-     * 1000000*timeout+nanos</pre></blockquote>
-     * <p>
-     * In all other respects, this method does the same thing as the
-     * method {@link #wait(long)} of one argument. In particular,
-     * {@code wait(0, 0)} means the same thing as {@code wait(0)}.
-     * <p>
-     * The current thread must own this object's monitor. The thread
-     * releases ownership of this monitor and waits until either of the
-     * following two conditions has occurred:
-     * <ul>
-     * <li>Another thread notifies threads waiting on this object's monitor
-     *     to wake up either through a call to the {@code notify} method
-     *     or the {@code notifyAll} method.
-     * <li>The timeout period, specified by {@code timeout}
-     *     milliseconds plus {@code nanos} nanoseconds arguments, has
-     *     elapsed.
-     * </ul>
-     * <p>
-     * The thread then waits until it can re-obtain ownership of the
-     * monitor and resumes execution.
-     * <p>
-     * As in the one argument version, interrupts and spurious wakeups are
-     * possible, and this method should always be used in a loop:
-     * <pre>
-     *     synchronized (obj) {
-     *         while (&lt;condition does not hold&gt;)
-     *             obj.wait(timeout, nanos);
-     *         ... // Perform action appropriate to condition
-     *     }
-     * </pre>
-     * This method should only be called by a thread that is the owner
-     * of this object's monitor. See the {@code notify} method for a
-     * description of the ways in which a thread can become the owner of
-     * a monitor.
-     *
-     * @param      timeout   the maximum time to wait in milliseconds.
-     * @param      nanos      additional time, in nanoseconds range
-     *                       0-999999.
-     * @throws  IllegalArgumentException      if the value of timeout is
-     *                      negative or the value of nanos is
-     *                      not in the range 0-999999.
-     * @throws  IllegalMonitorStateException  if the current thread is not
-     *               the owner of this object's monitor.
-     * @throws  InterruptedException if any thread interrupted the
-     *             current thread before or while the current thread
-     *             was waiting for a notification.  The <i>interrupted
-     *             status</i> of the current thread is cleared when
-     *             this exception is thrown.
+     * @param  timeout the maximum time to wait, in milliseconds
+     * @param  nanos   additional time, in nanoseconds, in the range range 0-999999 inclusive
+     * @throws IllegalArgumentException if the value of {@code timeout} is negative,
+     *         or if the value of {@code nanos} is out of range
+     * @throws IllegalMonitorStateException if the current thread is not
+     *         the owner of the object's monitor
+     * @throws InterruptedException if any thread interrupted the current thread before or
+     *         while the current thread was waiting. The <em>interrupted status</em> of the
+     *         current thread is cleared when this exception is thrown.
+     * @see    #notify()
+     * @see    #notifyAll()
+     * @see    #wait()
+     * @see    #wait(long)
      */
     public final void wait(long timeout, int nanos) throws InterruptedException {
         if (timeout < 0) {
@@ -475,48 +463,6 @@
     }
 
     /**
-     * Causes the current thread to wait until another thread invokes the
-     * {@link java.lang.Object#notify()} method or the
-     * {@link java.lang.Object#notifyAll()} method for this object.
-     * In other words, this method behaves exactly as if it simply
-     * performs the call {@code wait(0)}.
-     * <p>
-     * The current thread must own this object's monitor. The thread
-     * releases ownership of this monitor and waits until another thread
-     * notifies threads waiting on this object's monitor to wake up
-     * either through a call to the {@code notify} method or the
-     * {@code notifyAll} method. The thread then waits until it can
-     * re-obtain ownership of the monitor and resumes execution.
-     * <p>
-     * As in the one argument version, interrupts and spurious wakeups are
-     * possible, and this method should always be used in a loop:
-     * <pre>
-     *     synchronized (obj) {
-     *         while (&lt;condition does not hold&gt;)
-     *             obj.wait();
-     *         ... // Perform action appropriate to condition
-     *     }
-     * </pre>
-     * This method should only be called by a thread that is the owner
-     * of this object's monitor. See the {@code notify} method for a
-     * description of the ways in which a thread can become the owner of
-     * a monitor.
-     *
-     * @throws  IllegalMonitorStateException  if the current thread is not
-     *               the owner of the object's monitor.
-     * @throws  InterruptedException if any thread interrupted the
-     *             current thread before or while the current thread
-     *             was waiting for a notification.  The <i>interrupted
-     *             status</i> of the current thread is cleared when
-     *             this exception is thrown.
-     * @see        java.lang.Object#notify()
-     * @see        java.lang.Object#notifyAll()
-     */
-    public final void wait() throws InterruptedException {
-        wait(0);
-    }
-
-    /**
      * Called by the garbage collector on an object when garbage collection
      * determines that there are no more references to the object.
      * A subclass overrides the {@code finalize} method to dispose of
--- a/src/java.base/share/classes/java/util/ServiceLoader.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.base/share/classes/java/util/ServiceLoader.java	Thu Oct 19 21:39:39 2017 +0100
@@ -747,8 +747,10 @@
                 // invoke factory method with permissions restricted by acc
                 try {
                     result = AccessController.doPrivileged(pa, acc);
-                } catch (PrivilegedActionException pae) {
-                    exc = pae.getCause();
+                } catch (Throwable x) {
+                    if (x instanceof PrivilegedActionException)
+                        x = x.getCause();
+                    exc = x;
                 }
             }
             if (exc != null) {
@@ -788,8 +790,10 @@
                 // invoke constructor with permissions restricted by acc
                 try {
                     p = AccessController.doPrivileged(pa, acc);
-                } catch (PrivilegedActionException pae) {
-                    exc = pae.getCause();
+                } catch (Throwable x) {
+                    if (x instanceof PrivilegedActionException)
+                        x = x.getCause();
+                    exc = x;
                 }
             }
             if (exc != null) {
@@ -852,8 +856,9 @@
             PrivilegedExceptionAction<Class<?>> pa = () -> Class.forName(module, cn);
             try {
                 clazz = AccessController.doPrivileged(pa);
-            } catch (PrivilegedActionException pae) {
-                Throwable x = pae.getCause();
+            } catch (Throwable x) {
+                if (x instanceof PrivilegedActionException)
+                    x = x.getCause();
                 fail(service, "Unable to load " + cn, x);
                 return null;
             }
@@ -1477,6 +1482,8 @@
                 next = (Provider<T>) loadedProviders.get(index++);
             } else if (iterator.hasNext()) {
                 next = iterator.next();
+                loadedProviders.add((Provider<S>)next);
+                index++;
             } else {
                 loadedAllProviders = true;
             }
--- a/src/java.base/share/classes/java/util/SplittableRandom.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.base/share/classes/java/util/SplittableRandom.java	Thu Oct 19 21:39:39 2017 +0100
@@ -399,6 +399,26 @@
     }
 
     /**
+     * Fills a user-supplied byte array with generated pseudorandom bytes.
+     *
+     * @param  bytes the byte array to fill with pseudorandom bytes
+     * @throws NullPointerException if bytes is null
+     * @since  10
+     */
+    public void nextBytes(byte[] bytes) {
+        int i = 0;
+        int len = bytes.length;
+        for (int words = len >> 3; words--> 0; ) {
+            long rnd = nextLong();
+            for (int n = 8; n--> 0; rnd >>>= Byte.SIZE)
+                bytes[i++] = (byte)rnd;
+        }
+        if (i < len)
+            for (long rnd = nextLong(); i < len; rnd >>>= Byte.SIZE)
+                bytes[i++] = (byte)rnd;
+    }
+
+    /**
      * Returns a pseudorandom {@code int} value.
      *
      * @return a pseudorandom {@code int} value
--- a/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java	Thu Oct 19 21:39:39 2017 +0100
@@ -231,15 +231,16 @@
      *
      * The implementation is completely directionally symmetrical,
      * except that most public methods that iterate through the list
-     * follow next pointers ("forward" direction).
+     * follow next pointers, in the "forward" direction.
      *
-     * We believe (without full proof) that all single-element deque
-     * operations (e.g., addFirst, peekLast, pollLast) are linearizable
-     * (see Herlihy and Shavit's book).  However, some combinations of
+     * We believe (without full proof) that all single-element Deque
+     * operations that operate directly at the two ends of the Deque
+     * (e.g., addFirst, peekLast, pollLast) are linearizable (see
+     * Herlihy and Shavit's book).  However, some combinations of
      * operations are known not to be linearizable.  In particular,
-     * when an addFirst(A) is racing with pollFirst() removing B, it is
-     * possible for an observer iterating over the elements to observe
-     * A B C and subsequently observe A C, even though no interior
+     * when an addFirst(A) is racing with pollFirst() removing B, it
+     * is possible for an observer iterating over the elements to
+     * observe first [A B C] and then [A C], even though no interior
      * removes are ever performed.  Nevertheless, iterators behave
      * reasonably, providing the "weakly consistent" guarantees.
      *
@@ -865,21 +866,33 @@
     }
 
     public E peekFirst() {
-        for (Node<E> p = first(); p != null; p = succ(p)) {
-            final E item;
-            if ((item = p.item) != null)
-                return item;
+        restart: for (;;) {
+            for (Node<E> first = first(), p = first;;) {
+                final E item;
+                if ((item = p.item) != null) {
+                    // recheck for linearizability
+                    if (first.prev != null) continue restart;
+                    return item;
+                }
+                if ((p = succ(p)) == null)
+                    return null;
+            }
         }
-        return null;
     }
 
     public E peekLast() {
-        for (Node<E> p = last(); p != null; p = pred(p)) {
-            final E item;
-            if ((item = p.item) != null)
-                return item;
+        restart: for (;;) {
+            for (Node<E> last = last(), p = last;;) {
+                final E item;
+                if ((item = p.item) != null) {
+                    // recheck for linearizability
+                    if (last.next != null) continue restart;
+                    return item;
+                }
+                if ((p = pred(p)) == null)
+                    return null;
+            }
         }
-        return null;
     }
 
     /**
@@ -897,27 +910,39 @@
     }
 
     public E pollFirst() {
-        for (Node<E> p = first(); p != null; p = succ(p)) {
-            final E item;
-            if ((item = p.item) != null
-                && ITEM.compareAndSet(p, item, null)) {
-                unlink(p);
-                return item;
+        restart: for (;;) {
+            for (Node<E> first = first(), p = first;;) {
+                final E item;
+                if ((item = p.item) != null) {
+                    // recheck for linearizability
+                    if (first.prev != null) continue restart;
+                    if (ITEM.compareAndSet(p, item, null)) {
+                        unlink(p);
+                        return item;
+                    }
+                }
+                if ((p = succ(p)) == null)
+                    return null;
             }
         }
-        return null;
     }
 
     public E pollLast() {
-        for (Node<E> p = last(); p != null; p = pred(p)) {
-            final E item;
-            if ((item = p.item) != null
-                && ITEM.compareAndSet(p, item, null)) {
-                unlink(p);
-                return item;
+        restart: for (;;) {
+            for (Node<E> last = last(), p = last;;) {
+                final E item;
+                if ((item = p.item) != null) {
+                    // recheck for linearizability
+                    if (last.next != null) continue restart;
+                    if (ITEM.compareAndSet(p, item, null)) {
+                        unlink(p);
+                        return item;
+                    }
+                }
+                if ((p = pred(p)) == null)
+                    return null;
             }
         }
-        return null;
     }
 
     /**
@@ -1079,14 +1104,14 @@
      * @return the number of elements in this deque
      */
     public int size() {
-        restartFromHead: for (;;) {
+        restart: for (;;) {
             int count = 0;
             for (Node<E> p = first(); p != null;) {
                 if (p.item != null)
                     if (++count == Integer.MAX_VALUE)
                         break;  // @see Collection.size()
                 if (p == (p = p.next))
-                    continue restartFromHead;
+                    continue restart;
             }
             return count;
         }
@@ -1183,7 +1208,7 @@
 
     public String toString() {
         String[] a = null;
-        restartFromHead: for (;;) {
+        restart: for (;;) {
             int charLength = 0;
             int size = 0;
             for (Node<E> p = first(); p != null;) {
@@ -1198,7 +1223,7 @@
                     charLength += s.length();
                 }
                 if (p == (p = p.next))
-                    continue restartFromHead;
+                    continue restart;
             }
 
             if (size == 0)
@@ -1210,7 +1235,7 @@
 
     private Object[] toArrayInternal(Object[] a) {
         Object[] x = a;
-        restartFromHead: for (;;) {
+        restart: for (;;) {
             int size = 0;
             for (Node<E> p = first(); p != null;) {
                 final E item;
@@ -1222,7 +1247,7 @@
                     x[size++] = item;
                 }
                 if (p == (p = p.next))
-                    continue restartFromHead;
+                    continue restart;
             }
             if (x == null)
                 return new Object[0];
--- a/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java	Thu Oct 19 21:39:39 2017 +0100
@@ -1039,7 +1039,10 @@
      */
     private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL;
 
-    // Constants from SplittableRandom
+    /**
+     * The least non-zero value returned by nextDouble(). This value
+     * is scaled by a random value of 53 bits to produce a result.
+     */
     private static final double DOUBLE_UNIT = 0x1.0p-53;  // 1.0  / (1L << 53)
     private static final float  FLOAT_UNIT  = 0x1.0p-24f; // 1.0f / (1 << 24)
 
--- a/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java	Thu Oct 19 21:39:39 2017 +0100
@@ -140,7 +140,8 @@
  *   private double x, y;
  *   private final StampedLock sl = new StampedLock();
  *
- *   void move(double deltaX, double deltaY) { // an exclusively locked method
+ *   // an exclusively locked method
+ *   void move(double deltaX, double deltaY) {
  *     long stamp = sl.writeLock();
  *     try {
  *       x += deltaX;
@@ -150,25 +151,57 @@
  *     }
  *   }
  *
- *   double distanceFromOrigin() { // A read-only method
- *     double currentX, currentY;
+ *   // a read-only method
+ *   // upgrade from optimistic read to read lock
+ *   double distanceFromOrigin() {
  *     long stamp = sl.tryOptimisticRead();
- *     do {
- *       if (stamp == 0L)
- *         stamp = sl.readLock();
- *       try {
+ *     try {
+ *       retryHoldingLock: for (;; stamp = sl.readLock()) {
+ *         if (stamp == 0L)
+ *           continue retryHoldingLock;
  *         // possibly racy reads
- *         currentX = x;
- *         currentY = y;
- *       } finally {
- *         stamp = sl.tryConvertToOptimisticRead(stamp);
+ *         double currentX = x;
+ *         double currentY = y;
+ *         if (!sl.validate(stamp))
+ *           continue retryHoldingLock;
+ *         return Math.hypot(currentX, currentY);
  *       }
- *     } while (stamp == 0);
- *     return Math.hypot(currentX, currentY);
+ *     } finally {
+ *       if (StampedLock.isReadLockStamp(stamp))
+ *         sl.unlockRead(stamp);
+ *     }
  *   }
  *
- *   void moveIfAtOrigin(double newX, double newY) { // upgrade
- *     // Could instead start with optimistic, not read mode
+ *   // upgrade from optimistic read to write lock
+ *   void moveIfAtOrigin(double newX, double newY) {
+ *     long stamp = sl.tryOptimisticRead();
+ *     try {
+ *       retryHoldingLock: for (;; stamp = sl.writeLock()) {
+ *         if (stamp == 0L)
+ *           continue retryHoldingLock;
+ *         // possibly racy reads
+ *         double currentX = x;
+ *         double currentY = y;
+ *         if (!sl.validate(stamp))
+ *           continue retryHoldingLock;
+ *         if (currentX != 0.0 || currentY != 0.0)
+ *           break;
+ *         stamp = sl.tryConvertToWriteLock(stamp);
+ *         if (stamp == 0L)
+ *           continue retryHoldingLock;
+ *         // exclusive access
+ *         x = newX;
+ *         y = newY;
+ *         return;
+ *       }
+ *     } finally {
+ *       if (StampedLock.isWriteLockStamp(stamp))
+ *         sl.unlockWrite(stamp);
+ *     }
+ *   }
+ *
+ *   // Upgrade read lock to write lock
+ *   void moveIfAtOrigin(double newX, double newY) {
  *     long stamp = sl.readLock();
  *     try {
  *       while (x == 0.0 && y == 0.0) {
@@ -882,6 +915,92 @@
     }
 
     /**
+     * Tells whether a stamp represents holding a lock exclusively.
+     * This method may be useful in conjunction with
+     * {@link #tryConvertToWriteLock}, for example: <pre> {@code
+     * long stamp = sl.tryOptimisticRead();
+     * try {
+     *   ...
+     *   stamp = sl.tryConvertToWriteLock(stamp);
+     *   ...
+     * } finally {
+     *   if (StampedLock.isWriteLockStamp(stamp))
+     *     sl.unlockWrite(stamp);
+     * }}</pre>
+     *
+     * @param stamp a stamp returned by a previous StampedLock operation
+     * @return {@code true} if the stamp was returned by a successful
+     *   write-lock operation
+     * @since 10
+     */
+    public static boolean isWriteLockStamp(long stamp) {
+        return (stamp & ABITS) == WBIT;
+    }
+
+    /**
+     * Tells whether a stamp represents holding a lock non-exclusively.
+     * This method may be useful in conjunction with
+     * {@link #tryConvertToReadLock}, for example: <pre> {@code
+     * long stamp = sl.tryOptimisticRead();
+     * try {
+     *   ...
+     *   stamp = sl.tryConvertToReadLock(stamp);
+     *   ...
+     * } finally {
+     *   if (StampedLock.isReadLockStamp(stamp))
+     *     sl.unlockRead(stamp);
+     * }}</pre>
+     *
+     * @param stamp a stamp returned by a previous StampedLock operation
+     * @return {@code true} if the stamp was returned by a successful
+     *   read-lock operation
+     * @since 10
+     */
+    public static boolean isReadLockStamp(long stamp) {
+        return (stamp & RBITS) != 0L;
+    }
+
+    /**
+     * Tells whether a stamp represents holding a lock.
+     * This method may be useful in conjunction with
+     * {@link #tryConvertToReadLock} and {@link #tryConvertToWriteLock},
+     * for example: <pre> {@code
+     * long stamp = sl.tryOptimisticRead();
+     * try {
+     *   ...
+     *   stamp = sl.tryConvertToReadLock(stamp);
+     *   ...
+     *   stamp = sl.tryConvertToWriteLock(stamp);
+     *   ...
+     * } finally {
+     *   if (StampedLock.isLockStamp(stamp))
+     *     sl.unlock(stamp);
+     * }}</pre>
+     *
+     * @param stamp a stamp returned by a previous StampedLock operation
+     * @return {@code true} if the stamp was returned by a successful
+     *   read-lock or write-lock operation
+     * @since 10
+     */
+    public static boolean isLockStamp(long stamp) {
+        return (stamp & ABITS) != 0L;
+    }
+
+    /**
+     * Tells whether a stamp represents a successful optimistic read.
+     *
+     * @param stamp a stamp returned by a previous StampedLock operation
+     * @return {@code true} if the stamp was returned by a successful
+     *   optimistic read operation, that is, a non-zero return from
+     *   {@link #tryOptimisticRead()} or
+     *   {@link #tryConvertToOptimisticRead(long)}
+     * @since 10
+     */
+    public static boolean isOptimisticReadStamp(long stamp) {
+        return (stamp & ABITS) == 0L && stamp != 0L;
+    }
+
+    /**
      * Queries the number of read locks held for this lock. This
      * method is designed for use in monitoring system state, not for
      * synchronization control.
--- a/src/java.base/share/classes/sun/net/www/http/KeepAliveCache.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.base/share/classes/sun/net/www/http/KeepAliveCache.java	Thu Oct 19 21:39:39 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,10 +27,18 @@
 
 import java.io.IOException;
 import java.io.NotSerializableException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.net.URL;
+import java.util.List;
+
 import jdk.internal.misc.InnocuousThread;
+import sun.security.action.GetIntegerAction;
 
 /**
  * A class that implements a cache of idle Http connections for keep-alive
@@ -53,14 +61,14 @@
     static int result = -1;
     static int getMaxConnections() {
         if (result == -1) {
-            result = java.security.AccessController.doPrivileged(
-                new sun.security.action.GetIntegerAction("http.maxConnections",
-                                                         MAX_CONNECTIONS))
+            result = AccessController.doPrivileged(
+                new GetIntegerAction("http.maxConnections", MAX_CONNECTIONS))
                 .intValue();
-            if (result <= 0)
+            if (result <= 0) {
                 result = MAX_CONNECTIONS;
+            }
         }
-            return result;
+        return result;
     }
 
     static final int LIFETIME = 5000;
@@ -93,8 +101,7 @@
              * The robustness to get around this is in HttpClient.parseHTTP()
              */
             final KeepAliveCache cache = this;
-            java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction<>() {
+            AccessController.doPrivileged(new PrivilegedAction<>() {
                 public Void run() {
                     keepAliveTimer = InnocuousThread.newSystemThread("Keep-Alive-Timer", cache);
                     keepAliveTimer.setDaemon(true);
@@ -110,8 +117,8 @@
 
         if (v == null) {
             int keepAliveTimeout = http.getKeepAliveTimeout();
-            v = new ClientVector(keepAliveTimeout > 0?
-                                 keepAliveTimeout*1000 : LIFETIME);
+            v = new ClientVector(keepAliveTimeout > 0 ?
+                                 keepAliveTimeout * 1000 : LIFETIME);
             v.put(http);
             super.put(key, v);
         } else {
@@ -120,12 +127,12 @@
     }
 
     /* remove an obsolete HttpClient from its VectorCache */
-    public synchronized void remove (HttpClient h, Object obj) {
+    public synchronized void remove(HttpClient h, Object obj) {
         KeepAliveKey key = new KeepAliveKey(h.url, obj);
         ClientVector v = super.get(key);
         if (v != null) {
             v.remove(h);
-            if (v.empty()) {
+            if (v.isEmpty()) {
                 removeVector(key);
             }
         }
@@ -142,7 +149,6 @@
      * Check to see if this URL has a cached HttpClient
      */
     public synchronized HttpClient get(URL url, Object obj) {
-
         KeepAliveKey key = new KeepAliveKey(url, obj);
         ClientVector v = super.get(key);
         if (v == null) { // nothing in cache yet
@@ -161,39 +167,27 @@
             try {
                 Thread.sleep(LIFETIME);
             } catch (InterruptedException e) {}
+
+            // Remove all outdated HttpClients.
             synchronized (this) {
-                /* Remove all unused HttpClients.  Starting from the
-                 * bottom of the stack (the least-recently used first).
-                 * REMIND: It'd be nice to not remove *all* connections
-                 * that aren't presently in use.  One could have been added
-                 * a second ago that's still perfectly valid, and we're
-                 * needlessly axing it.  But it's not clear how to do this
-                 * cleanly, and doing it right may be more trouble than it's
-                 * worth.
-                 */
-
                 long currentTime = System.currentTimeMillis();
-
-                ArrayList<KeepAliveKey> keysToRemove
-                    = new ArrayList<>();
+                List<KeepAliveKey> keysToRemove = new ArrayList<>();
 
                 for (KeepAliveKey key : keySet()) {
                     ClientVector v = get(key);
                     synchronized (v) {
-                        int i;
-
-                        for (i = 0; i < v.size(); i++) {
-                            KeepAliveEntry e = v.elementAt(i);
+                        KeepAliveEntry e = v.peek();
+                        while (e != null) {
                             if ((currentTime - e.idleStartTime) > v.nap) {
-                                HttpClient h = e.hc;
-                                h.closeServer();
+                                v.poll();
+                                e.hc.closeServer();
                             } else {
                                 break;
                             }
+                            e = v.peek();
                         }
-                        v.subList(0, i).clear();
 
-                        if (v.size() == 0) {
+                        if (v.isEmpty()) {
                             keysToRemove.add(key);
                         }
                     }
@@ -203,21 +197,19 @@
                     removeVector(key);
                 }
             }
-        } while (size() > 0);
-
-        return;
+        } while (!isEmpty());
     }
 
     /*
      * Do not serialize this class!
      */
-    private void writeObject(java.io.ObjectOutputStream stream)
-    throws IOException {
+    private void writeObject(ObjectOutputStream stream) throws IOException {
         throw new NotSerializableException();
     }
 
-    private void readObject(java.io.ObjectInputStream stream)
-    throws IOException, ClassNotFoundException {
+    private void readObject(ObjectInputStream stream)
+        throws IOException, ClassNotFoundException
+    {
         throw new NotSerializableException();
     }
 }
@@ -225,37 +217,33 @@
 /* FILO order for recycling HttpClients, should run in a thread
  * to time them out.  If > maxConns are in use, block.
  */
-
-
-class ClientVector extends java.util.Stack<KeepAliveEntry> {
+class ClientVector extends ArrayDeque<KeepAliveEntry> {
     private static final long serialVersionUID = -8680532108106489459L;
 
     // sleep time in milliseconds, before cache clear
     int nap;
 
-
-
-    ClientVector (int nap) {
+    ClientVector(int nap) {
         this.nap = nap;
     }
 
     synchronized HttpClient get() {
-        if (empty()) {
+        if (isEmpty()) {
             return null;
-        } else {
-            // Loop until we find a connection that has not timed out
-            HttpClient hc = null;
-            long currentTime = System.currentTimeMillis();
-            do {
-                KeepAliveEntry e = pop();
-                if ((currentTime - e.idleStartTime) > nap) {
-                    e.hc.closeServer();
-                } else {
-                    hc = e.hc;
-                }
-            } while ((hc== null) && (!empty()));
-            return hc;
         }
+
+        // Loop until we find a connection that has not timed out
+        HttpClient hc = null;
+        long currentTime = System.currentTimeMillis();
+        do {
+            KeepAliveEntry e = pop();
+            if ((currentTime - e.idleStartTime) > nap) {
+                e.hc.closeServer();
+            } else {
+                hc = e.hc;
+            }
+        } while ((hc == null) && (!isEmpty()));
+        return hc;
     }
 
     /* return a still valid, unused HttpClient */
@@ -267,21 +255,30 @@
         }
     }
 
+    /* remove an HttpClient */
+    synchronized boolean remove(HttpClient h) {
+        for (KeepAliveEntry curr : this) {
+            if (curr.hc == h) {
+                return super.remove(curr);
+            }
+        }
+        return false;
+    }
+
     /*
      * Do not serialize this class!
      */
-    private void writeObject(java.io.ObjectOutputStream stream)
-    throws IOException {
+    private void writeObject(ObjectOutputStream stream) throws IOException {
         throw new NotSerializableException();
     }
 
-    private void readObject(java.io.ObjectInputStream stream)
-    throws IOException, ClassNotFoundException {
+    private void readObject(ObjectInputStream stream)
+        throws IOException, ClassNotFoundException
+    {
         throw new NotSerializableException();
     }
 }
 
-
 class KeepAliveKey {
     private String      protocol = null;
     private String      host = null;
--- a/src/java.base/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.base/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java	Thu Oct 19 21:39:39 2017 +0100
@@ -26,6 +26,7 @@
 package sun.util.cldr;
 
 import java.security.AccessController;
+import java.security.AccessControlException;
 import java.security.PrivilegedExceptionAction;
 import java.text.spi.BreakIteratorProvider;
 import java.text.spi.CollatorProvider;
@@ -37,6 +38,7 @@
 import java.util.Map;
 import java.util.Objects;
 import java.util.ServiceLoader;
+import java.util.ServiceConfigurationError;
 import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.concurrent.ConcurrentHashMap;
@@ -81,8 +83,11 @@
                     return null;
                 }
             });
-        }  catch (Exception e) {
+        } catch (Exception e) {
             // Catch any exception, and continue as if only CLDR's base locales exist.
+        } catch (ServiceConfigurationError sce) {
+            Throwable cause = sce.getCause();
+            if (!(cause instanceof AccessControlException)) throw sce;
         }
 
         nonBaseMetaInfo = nbmi;
--- a/src/java.base/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.base/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java	Thu Oct 19 21:39:39 2017 +0100
@@ -26,6 +26,7 @@
 package sun.util.locale.provider;
 
 import java.security.AccessController;
+import java.security.AccessControlException;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedExceptionAction;
 import java.text.spi.BreakIteratorProvider;
@@ -40,6 +41,7 @@
 import java.util.Locale;
 import java.util.ResourceBundle;
 import java.util.ServiceLoader;
+import java.util.ServiceConfigurationError;
 import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.concurrent.ConcurrentHashMap;
@@ -476,8 +478,11 @@
             if (nonBaseTags != null) {
                 supportedLocaleString += " " + nonBaseTags;
             }
-        }  catch (Exception e) {
+        } catch (Exception e) {
             // catch any exception, and ignore them as if non-EN locales do not exist.
+        } catch (ServiceConfigurationError sce) {
+            Throwable cause = sce.getCause();
+            if (!(cause instanceof AccessControlException)) throw sce;
         }
 
         return supportedLocaleString;
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java	Thu Oct 19 21:39:39 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
@@ -330,7 +330,9 @@
 
         // not for the scrolling tabs
         if (component == null && tabIndex >= 0) {
-            paintTitle(g2d, font, metrics, textRect, tabIndex, title);
+            String clippedTitle = SwingUtilities2.clipStringIfNecessary(tabPane, metrics,
+                    title, textRect.width);
+            paintTitle(g2d, font, metrics, textRect, tabIndex, clippedTitle);
         }
 
         if (icon != null) {
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Thu Oct 19 21:39:39 2017 +0100
@@ -674,6 +674,7 @@
                         CWrapper.NSWindow.orderWindow(ptr, CWrapper.NSWindow.NSWindowAbove, ownerPtr);
                     });
                 });
+                execute(CWrapper.NSWindow::orderFront);
                 applyWindowLevel(target);
             }
 
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m	Thu Oct 19 21:39:39 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
@@ -387,7 +387,7 @@
     if (nsChar == 0 && spaceKeyTyped == YES) {
         return java_awt_event_KeyEvent_VK_SPACE;
     }
-	
+
     // otherwise return character unchanged
     return nsChar;
 }
@@ -439,7 +439,8 @@
 static void
 NsCharToJavaVirtualKeyCode(unichar ch, BOOL isDeadChar,
                            NSUInteger flags, unsigned short key,
-                           jint *keyCode, jint *keyLocation, BOOL *postsTyped, unichar *deadChar)
+                           jint *keyCode, jint *keyLocation, BOOL *postsTyped,
+                           unichar *deadChar)
 {
     static size_t size = sizeof(keyTable) / sizeof(struct _key);
     NSInteger offset;
@@ -481,7 +482,8 @@
         offset = ch - '0';
         // make sure in range for decimal digits
         if (offset >= 0 && offset <= 9)    {
-            jboolean numpad = (flags & NSNumericPadKeyMask) != 0;
+            jboolean numpad = ((flags & NSNumericPadKeyMask) &&
+                               (key > 81 && key < 93));
             *postsTyped = YES;
             if (numpad) {
                 *keyCode = offset + java_awt_event_KeyEvent_VK_NUMPAD0;
@@ -562,10 +564,10 @@
 {
     jint javaModifiers = 0;
     const struct _nsKeyToJavaModifier* cur;
-	
+
     for (cur = nsKeyToJavaModifierTable; cur->nsMask != 0; ++cur) {
         if ((cur->nsMask & nsFlags) != 0) {
-			
+
             if (cur->nsMask == NSAlternateKeyMask) {
                 if (leftAltKeyPressed == YES) {
                     javaModifiers |= isExtMods? cur->javaExtMask : cur->javaMask;
@@ -707,16 +709,17 @@
 
     jint jkeyCode = java_awt_event_KeyEvent_VK_UNDEFINED;
     jint jkeyLocation = java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN;
-    jchar testDeadChar = 0;
+    jint testDeadChar = 0;
 
     NsCharToJavaVirtualKeyCode((unichar)testChar, isDeadChar,
                                (NSUInteger)modifierFlags, (unsigned short)keyCode,
-                               &jkeyCode, &jkeyLocation, &postsTyped, &testDeadChar);
+                               &jkeyCode, &jkeyLocation, &postsTyped,
+                               (unichar *) &testDeadChar);
 
-    // out = [jkeyCode, jkeyLocation];
+    // out = [jkeyCode, jkeyLocation, deadChar];
     (*env)->SetIntArrayRegion(env, outData, 0, 1, &jkeyCode);
     (*env)->SetIntArrayRegion(env, outData, 1, 1, &jkeyLocation);
-    (*env)->SetIntArrayRegion(env, outData, 2, 1, (jint *)&testDeadChar);
+    (*env)->SetIntArrayRegion(env, outData, 2, 1, &testDeadChar);
 
     (*env)->ReleaseIntArrayElements(env, inData, data, 0);
 
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifComboBoxUI.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifComboBoxUI.java	Thu Oct 19 21:39:39 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
@@ -160,7 +160,7 @@
                 in = new Insets( 0, 0, 0, 0 );
             }
             // Draw the separation
-            if(MotifGraphicsUtils.isLeftToRight(comboBox)) {
+            if (comboBox.getComponentOrientation().isLeftToRight()) {
                 r.x -= (HORIZ_MARGIN + 2);
             }
             else {
@@ -211,7 +211,7 @@
         b.width -= (in.left + in.right);
         b.height -= (in.top + in.bottom);
 
-        if(MotifGraphicsUtils.isLeftToRight(comboBox)) {
+        if (comboBox.getComponentOrientation().isLeftToRight()) {
             b.x = b.x + b.width - HORIZ_MARGIN - arrowIcon.getIconWidth();
         }
         else {
@@ -227,7 +227,7 @@
         int width = comboBox.getWidth();
         int height = comboBox.getHeight();
         Insets insets = getInsets();
-        if(MotifGraphicsUtils.isLeftToRight(comboBox)) {
+        if (comboBox.getComponentOrientation().isLeftToRight()) {
             return new Rectangle(insets.left, insets.top,
                                  (width - (insets.left + insets.right)) -
                                                         iconAreaWidth(),
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifDesktopIconUI.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifDesktopIconUI.java	Thu Oct 19 21:39:39 2017 +0100
@@ -36,6 +36,8 @@
 import java.util.EventListener;
 import java.io.Serializable;
 
+import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.MouseEventAccessor;
 
 /**
  * Motif rendition of the component.
@@ -238,11 +240,15 @@
         }
         @SuppressWarnings("deprecation")
         void forwardEventToParent(MouseEvent e) {
-            getParent().dispatchEvent(new MouseEvent(
+            MouseEvent newEvent = new MouseEvent(
                 getParent(), e.getID(), e.getWhen(), e.getModifiers(),
                 e.getX(), e.getY(), e.getXOnScreen(),
                 e.getYOnScreen(), e.getClickCount(),
-                e.isPopupTrigger(), MouseEvent.NOBUTTON));
+                e.isPopupTrigger(), MouseEvent.NOBUTTON);
+            MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+            meAccessor.setCausedByTouchEvent(newEvent,
+                meAccessor.isCausedByTouchEvent(e));
+            getParent().dispatchEvent(newEvent);
         }
 
         @SuppressWarnings("deprecation")
@@ -331,10 +337,14 @@
         }
         @SuppressWarnings("deprecation")
         void forwardEventToParent(MouseEvent e) {
-            getParent().dispatchEvent(new MouseEvent(
+            MouseEvent newEvent = new MouseEvent(
                 getParent(), e.getID(), e.getWhen(), e.getModifiers(),
                 e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(),
-                e.getClickCount(), e.isPopupTrigger(), MouseEvent.NOBUTTON ));
+                e.getClickCount(), e.isPopupTrigger(), MouseEvent.NOBUTTON );
+            MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+            meAccessor.setCausedByTouchEvent(newEvent,
+                meAccessor.isCausedByTouchEvent(e));
+            getParent().dispatchEvent(newEvent);
         }
 
         @SuppressWarnings("deprecation")
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifGraphicsUtils.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifGraphicsUtils.java	Thu Oct 19 21:39:39 2017 +0100
@@ -22,48 +22,29 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.java.swing.plaf.motif;
 
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+
+import javax.swing.JComponent;
+import javax.swing.SwingConstants;
+
 import sun.swing.SwingUtilities2;
 
-import javax.swing.*;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Rectangle;
-import java.awt.Component;
-import java.awt.Insets;
-import java.awt.event.KeyEvent;
-import java.awt.Container;
-
-import javax.swing.plaf.basic.*;
-import javax.swing.text.View;
-
 /*
  * @author Jeff Dinkins
  * @author Dave Kloba
  */
-
-public class MotifGraphicsUtils implements SwingConstants
-{
-    /* Client Property keys for text and accelerator text widths */
-    private static final String MAX_ACC_WIDTH  =  "maxAccWidth";
-
-    /**
-     * Draws the point (<b>x</b>, <b>y</b>) in the current color.
-     */
-    static void drawPoint(Graphics g, int x, int y) {
-        g.drawLine(x, y, x, y);
-    }
+final class MotifGraphicsUtils {
 
     /*
      * Convenience method for drawing a grooved line
-     *
      */
-    public static void drawGroove(Graphics g, int x, int y, int w, int h,
-                                  Color shadow, Color highlight)
+    static void drawGroove(Graphics g, int x, int y, int w, int h, Color shadow,
+                           Color highlight)
     {
         Color oldColor = g.getColor();  // Make no net change to g
         g.translate(x, y);
@@ -82,19 +63,6 @@
         g.setColor(oldColor);
     }
 
-    /** Draws <b>aString</b> in the rectangle defined by
-      * (<b>x</b>, <b>y</b>, <b>width</b>, <b>height</b>).
-      * <b>justification</b> specifies the text's justification, one of
-      * LEFT, CENTER, or RIGHT.
-      * <b>drawStringInRect()</b> does not clip to the rectangle, but instead
-      * uses this rectangle and the desired justification to compute the point
-      * at which to begin drawing the text.
-      */
-    public static void drawStringInRect(Graphics g, String aString, int x, int y,
-                                 int width, int height, int justification) {
-        drawStringInRect(null, g, aString, x, y, width, height, justification);
-    }
-
     static void drawStringInRect(JComponent c, Graphics g, String aString,
                                  int x, int y, int width, int height,
                                  int justification) {
@@ -111,13 +79,13 @@
             return;
         }
 
-        if (justification == CENTER) {
+        if (justification == SwingConstants.CENTER) {
             drawWidth = SwingUtilities2.stringWidth(c, fontMetrics, aString);
             if (drawWidth > width) {
                 drawWidth = width;
             }
             startX = x + (width - drawWidth) / 2;
-        } else if (justification == RIGHT) {
+        } else if (justification == SwingConstants.RIGHT) {
             drawWidth = SwingUtilities2.stringWidth(c, fontMetrics, aString);
             if (drawWidth > width) {
                 drawWidth = width;
@@ -136,341 +104,4 @@
 
         SwingUtilities2.drawString(c, g, aString, startX, startY);
     }
-
-  /**
-   * @deprecated This method is not being used to paint menu item since
-   * 6.0 This code left for compatibility only. Do not use or
-   * override it, this will not cause any visible effect.
-   */
-  @Deprecated(since = "9")
-  public static void paintMenuItem(Graphics g, JComponent c,
-                                   Icon checkIcon, Icon arrowIcon,
-                                   Color background, Color foreground,
-                                   int defaultTextIconGap)
-    {
-
-        JMenuItem b = (JMenuItem) c;
-        ButtonModel model = b.getModel();
-
-        Dimension size = b.getSize();
-        Insets i = c.getInsets();
-
-        Rectangle viewRect = new Rectangle(size);
-
-        viewRect.x += i.left;
-        viewRect.y += i.top;
-        viewRect.width -= (i.right + viewRect.x);
-        viewRect.height -= (i.bottom + viewRect.y);
-
-        Rectangle iconRect = new Rectangle();
-        Rectangle textRect = new Rectangle();
-        Rectangle acceleratorRect = new Rectangle();
-        Rectangle checkRect = new Rectangle();
-        Rectangle arrowRect = new Rectangle();
-
-        Font holdf = g.getFont();
-        Font f = c.getFont();
-        g.setFont(f);
-        FontMetrics fm = SwingUtilities2.getFontMetrics(c, g, f);
-        FontMetrics fmAccel = SwingUtilities2.getFontMetrics(
-            c, g, UIManager.getFont("MenuItem.acceleratorFont"));
-
-        if (c.isOpaque()) {
-            if (model.isArmed()|| (c instanceof JMenu && model.isSelected())) {
-                g.setColor(background);
-            } else {
-                g.setColor(c.getBackground());
-            }
-            g.fillRect(0,0, size.width, size.height);
-        }
-
-        // get Accelerator text
-        KeyStroke accelerator =  b.getAccelerator();
-        String acceleratorText = "";
-        if (accelerator != null) {
-            int modifiers = accelerator.getModifiers();
-            if (modifiers > 0) {
-                acceleratorText = KeyEvent.getKeyModifiersText(modifiers);
-                acceleratorText += "+";
-            }
-            acceleratorText += KeyEvent.getKeyText(accelerator.getKeyCode());
-        }
-
-        // layout the text and icon
-        String text = layoutMenuItem(c, fm, b.getText(), fmAccel,
-                                     acceleratorText, b.getIcon(),
-                                     checkIcon, arrowIcon,
-                                     b.getVerticalAlignment(),
-                                     b.getHorizontalAlignment(),
-                                     b.getVerticalTextPosition(),
-                                     b.getHorizontalTextPosition(),
-                                     viewRect, iconRect,
-                                     textRect, acceleratorRect,
-                                     checkRect, arrowRect,
-                                     b.getText() == null
-                                     ? 0 : defaultTextIconGap,
-                                     defaultTextIconGap
-                                     );
-
-        // Paint the Check
-        Color holdc = g.getColor();
-        if (checkIcon != null) {
-            if(model.isArmed() || (c instanceof JMenu && model.isSelected()))
-                g.setColor(foreground);
-            checkIcon.paintIcon(c, g, checkRect.x, checkRect.y);
-            g.setColor(holdc);
-        }
-
-        // Paint the Icon
-        if(b.getIcon() != null) {
-            Icon icon;
-            if(!model.isEnabled()) {
-                icon = b.getDisabledIcon();
-            } else if(model.isPressed() && model.isArmed()) {
-                icon = b.getPressedIcon();
-                if(icon == null) {
-                    // Use default icon
-                    icon = b.getIcon();
-                }
-            } else {
-                icon = b.getIcon();
-            }
-
-            if (icon!=null) {
-                icon.paintIcon(c, g, iconRect.x, iconRect.y);
-            }
-        }
-
-        // Draw the Text
-        if(text != null && !text.equals("")) {
-            // Once BasicHTML becomes public, use BasicHTML.propertyKey
-            // instead of the hardcoded string below!
-            View v = (View) c.getClientProperty("html");
-            if (v != null) {
-                v.paint(g, textRect);
-            } else {
-                int mnemIndex = b.getDisplayedMnemonicIndex();
-
-                if(!model.isEnabled()) {
-                    // *** paint the text disabled
-                    g.setColor(b.getBackground().brighter());
-                    SwingUtilities2.drawStringUnderlineCharAt(b, g,text,
-                        mnemIndex,
-                        textRect.x, textRect.y + fmAccel.getAscent());
-                    g.setColor(b.getBackground().darker());
-                    SwingUtilities2.drawStringUnderlineCharAt(b, g,text,
-                        mnemIndex,
-                        textRect.x - 1, textRect.y + fmAccel.getAscent() - 1);
-
-                } else {
-                    // *** paint the text normally
-                    if (model.isArmed()|| (c instanceof JMenu && model.isSelected())) {
-                        g.setColor(foreground);
-                    } else {
-                        g.setColor(b.getForeground());
-                    }
-                    SwingUtilities2.drawStringUnderlineCharAt(b, g,text,
-                                                  mnemIndex,
-                                                  textRect.x,
-                                                  textRect.y + fm.getAscent());
-                }
-            }
-        }
-
-        // Draw the Accelerator Text
-        if(acceleratorText != null && !acceleratorText.equals("")) {
-
-            //Get the maxAccWidth from the parent to calculate the offset.
-            int accOffset = 0;
-            Container parent = b.getParent();
-            if (parent != null && parent instanceof JComponent) {
-                JComponent p = (JComponent) parent;
-                Integer maxValueInt = (Integer) p.getClientProperty(MotifGraphicsUtils.MAX_ACC_WIDTH);
-                int maxValue = maxValueInt != null ?
-                    maxValueInt.intValue() : acceleratorRect.width;
-
-                //Calculate the offset, with which the accelerator texts will be drawn with.
-                accOffset = maxValue - acceleratorRect.width;
-            }
-
-            g.setFont( UIManager.getFont("MenuItem.acceleratorFont") );
-            if(!model.isEnabled()) {
-                // *** paint the acceleratorText disabled
-                g.setColor(b.getBackground().brighter());
-                SwingUtilities2.drawString(c, g,acceleratorText,
-                                              acceleratorRect.x - accOffset, acceleratorRect.y + fm.getAscent());
-                g.setColor(b.getBackground().darker());
-                SwingUtilities2.drawString(c, g,acceleratorText,
-                                              acceleratorRect.x - accOffset - 1, acceleratorRect.y + fm.getAscent() - 1);
-            } else {
-                // *** paint the acceleratorText normally
-                if (model.isArmed()|| (c instanceof JMenu && model.isSelected()))
-                    {
-                        g.setColor(foreground);
-                    } else {
-                        g.setColor(b.getForeground());
-                    }
-                SwingUtilities2.drawString(c, g,acceleratorText,
-                                              acceleratorRect.x - accOffset,
-                                              acceleratorRect.y + fmAccel.getAscent());
-            }
-        }
-
-        // Paint the Arrow
-        if (arrowIcon != null) {
-            if(model.isArmed() || (c instanceof JMenu && model.isSelected()))
-                g.setColor(foreground);
-            if( !(b.getParent() instanceof JMenuBar) )
-                arrowIcon.paintIcon(c, g, arrowRect.x, arrowRect.y);
-        }
-
-        g.setColor(holdc);
-        g.setFont(holdf);
-    }
-
-
-    /**
-     * Compute and return the location of the icons origin, the
-     * location of origin of the text baseline, and a possibly clipped
-     * version of the compound labels string.  Locations are computed
-     * relative to the viewR rectangle.
-     */
-
-    private static String layoutMenuItem(
-        JComponent c,
-        FontMetrics fm,
-        String text,
-        FontMetrics fmAccel,
-        String acceleratorText,
-        Icon icon,
-        Icon checkIcon,
-        Icon arrowIcon,
-        int verticalAlignment,
-        int horizontalAlignment,
-        int verticalTextPosition,
-        int horizontalTextPosition,
-        Rectangle viewR,
-        Rectangle iconR,
-        Rectangle textR,
-        Rectangle acceleratorR,
-        Rectangle checkIconR,
-        Rectangle arrowIconR,
-        int textIconGap,
-        int menuItemGap
-        )
-    {
-
-        SwingUtilities.layoutCompoundLabel(c,
-                                           fm,
-                                           text,
-                                           icon,
-                                           verticalAlignment,
-                                           horizontalAlignment,
-                                           verticalTextPosition,
-                                           horizontalTextPosition,
-                                           viewR,
-                                           iconR,
-                                           textR,
-                                           textIconGap);
-
-        /* Initialize the acceelratorText bounds rectangle textR.  If a null
-         * or and empty String was specified we substitute "" here
-         * and use 0,0,0,0 for acceleratorTextR.
-         */
-        if( (acceleratorText == null) || acceleratorText.equals("") ) {
-            acceleratorR.width = acceleratorR.height = 0;
-            acceleratorText = "";
-        }
-        else {
-            acceleratorR.width
-                = SwingUtilities2.stringWidth(c, fmAccel, acceleratorText);
-            acceleratorR.height = fmAccel.getHeight();
-        }
-
-        /* Initialize the checkIcon bounds rectangle checkIconR.
-         */
-
-        if (checkIcon != null) {
-            checkIconR.width = checkIcon.getIconWidth();
-            checkIconR.height = checkIcon.getIconHeight();
-        }
-        else {
-            checkIconR.width = checkIconR.height = 0;
-        }
-
-        /* Initialize the arrowIcon bounds rectangle arrowIconR.
-         */
-
-        if (arrowIcon != null) {
-            arrowIconR.width = arrowIcon.getIconWidth();
-            arrowIconR.height = arrowIcon.getIconHeight();
-        }
-        else {
-            arrowIconR.width = arrowIconR.height = 0;
-        }
-
-
-        Rectangle labelR = iconR.union(textR);
-        if( MotifGraphicsUtils.isLeftToRight(c) ) {
-            textR.x += checkIconR.width + menuItemGap;
-            iconR.x += checkIconR.width + menuItemGap;
-
-            // Position the Accelerator text rect
-            acceleratorR.x = viewR.x + viewR.width - arrowIconR.width
-                             - menuItemGap - acceleratorR.width;
-
-            // Position the Check and Arrow Icons
-            checkIconR.x = viewR.x;
-            arrowIconR.x = viewR.x + viewR.width - menuItemGap
-                           - arrowIconR.width;
-        } else {
-            textR.x -= (checkIconR.width + menuItemGap);
-            iconR.x -= (checkIconR.width + menuItemGap);
-
-            // Position the Accelerator text rect
-            acceleratorR.x = viewR.x + arrowIconR.width + menuItemGap;
-
-            // Position the Check and Arrow Icons
-            checkIconR.x = viewR.x + viewR.width - checkIconR.width;
-            arrowIconR.x = viewR.x + menuItemGap;
-        }
-
-        // Align the accelertor text and the check and arrow icons vertically
-        // with the center of the label rect.
-        acceleratorR.y = labelR.y + (labelR.height/2) - (acceleratorR.height/2);
-        arrowIconR.y = labelR.y + (labelR.height/2) - (arrowIconR.height/2);
-        checkIconR.y = labelR.y + (labelR.height/2) - (checkIconR.height/2);
-
-        /*
-          System.out.println("Layout: v=" +viewR+"  c="+checkIconR+" i="+
-          iconR+" t="+textR+" acc="+acceleratorR+" a="+arrowIconR);
-          */
-        return text;
-    }
-
-  private static void drawMenuBezel(Graphics g, Color background,
-                                    int x, int y,
-                                    int width, int height)
-    {
-      // shadowed button region
-      g.setColor(background);
-      g.fillRect(x,y,width,height);
-
-      g.setColor(background.brighter().brighter());
-      g.drawLine(x+1,       y+height-1,  x+width-1, y+height-1);
-      g.drawLine(x+width-1, y+height-2,  x+width-1, y+1);
-
-      g.setColor(background.darker().darker());
-      g.drawLine(x,   y,   x+width-2, y);
-      g.drawLine(x,   y+1, x,         y+height-2);
-
-    }
-
-    /*
-     * Convenience function for determining ComponentOrientation.  Helps us
-     * avoid having Munge directives throughout the code.
-     */
-    static boolean isLeftToRight( Component c ) {
-        return c.getComponentOrientation().isLeftToRight();
-    }
 }
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifIconFactory.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifIconFactory.java	Thu Oct 19 21:39:39 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
@@ -360,7 +360,7 @@
             Color oldColor = g.getColor();
 
             if (model.isSelected()){
-                if( MotifGraphicsUtils.isLeftToRight(c) ){
+                if (c.getComponentOrientation().isLeftToRight()) {
                     g.setColor(shadow);
                     g.fillRect(x+1,y+1,2,h);
                     g.drawLine(x+4,y+2,x+4,y+2);
@@ -392,7 +392,7 @@
                     g.drawLine(x+7,y+1,x+7,y+1);
                 }
             } else {
-                if( MotifGraphicsUtils.isLeftToRight(c) ){
+                if (c.getComponentOrientation().isLeftToRight()) {
                     g.setColor(highlight);
                     g.drawLine(x+1,y+1,x+1,y+h);
                     g.drawLine(x+2,y+1,x+2,y+h-2);
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java	Thu Oct 19 21:39:39 2017 +0100
@@ -37,6 +37,9 @@
 import java.beans.VetoableChangeListener;
 import java.beans.PropertyVetoException;
 
+import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.MouseEventAccessor;
+
 /**
  * Class that manages a Motif title bar
  *
@@ -363,11 +366,15 @@
         }
         @SuppressWarnings("deprecation")
         void forwardEventToParent(MouseEvent e) {
-            getParent().dispatchEvent(new MouseEvent(
+            MouseEvent newEvent = new MouseEvent(
                 getParent(), e.getID(), e.getWhen(), e.getModifiers(),
                 e.getX(), e.getY(),  e.getXOnScreen(),
                 e.getYOnScreen(), e.getClickCount(),
-                e.isPopupTrigger(),  MouseEvent.NOBUTTON));
+                e.isPopupTrigger(),  MouseEvent.NOBUTTON);
+            MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+            meAccessor.setCausedByTouchEvent(newEvent,
+                meAccessor.isCausedByTouchEvent(e));
+            getParent().dispatchEvent(newEvent);
         }
 
         public void paintComponent(Graphics g) {
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifScrollPaneUI.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifScrollPaneUI.java	Thu Oct 19 21:39:39 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 @@
                             vsb.getBorder() == vsbBorder) {
                             // The Border on the verticall scrollbar matches
                             // what we installed, reset it.
-                            if (MotifGraphicsUtils.isLeftToRight(pane)) {
+                            if (pane.getComponentOrientation().isLeftToRight()) {
                                 vsbBorder = new CompoundBorder(vsbMarginBorderR,
                                                 vsbBorder.getInsideBorder());
                             } else {
@@ -101,7 +101,7 @@
 
         JScrollBar vsb = scrollpane.getVerticalScrollBar();
         if (vsb != null) {
-            if (MotifGraphicsUtils.isLeftToRight(scrollpane)) {
+            if (scrollpane.getComponentOrientation().isLeftToRight()) {
                 vsbBorder = new CompoundBorder(vsbMarginBorderR,
                                                vsb.getBorder());
             }
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/DesktopProperty.java	Thu Oct 12 22:05:47 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,286 +0,0 @@
-/*
- * Copyright (c) 2001, 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 com.sun.java.swing.plaf.windows;
-
-import java.awt.*;
-import java.beans.*;
-import java.lang.ref.*;
-import javax.swing.*;
-import javax.swing.plaf.*;
-import sun.awt.AppContext;
-
-/**
- * Wrapper for a value from the desktop. The value is lazily looked up, and
- * can be accessed using the <code>UIManager.ActiveValue</code> method
- * <code>createValue</code>. If the underlying desktop property changes this
- * will force the UIs to update all known Frames. You can invoke
- * <code>invalidate</code> to force the value to be fetched again.
- *
- */
-// NOTE: Don't rely on this class staying in this location. It is likely
-// to move to a different package in the future.
-public class DesktopProperty implements UIDefaults.ActiveValue {
-    private static final StringBuilder DESKTOP_PROPERTY_UPDATE_PENDING_KEY =
-            new StringBuilder("DesktopPropertyUpdatePending");
-
-    /**
-     * ReferenceQueue of unreferenced WeakPCLs.
-     */
-    private static final ReferenceQueue<DesktopProperty> queue = new ReferenceQueue<DesktopProperty>();
-
-    /**
-     * PropertyChangeListener attached to the Toolkit.
-     */
-    private WeakPCL pcl;
-    /**
-     * Key used to lookup value from desktop.
-     */
-    private final String key;
-    /**
-     * Value to return.
-     */
-    private Object value;
-    /**
-     * Fallback value in case we get null from desktop.
-     */
-    private final Object fallback;
-
-
-    /**
-     * Cleans up any lingering state held by unrefeernced
-     * DesktopProperties.
-     */
-    static void flushUnreferencedProperties() {
-        WeakPCL pcl;
-
-        while ((pcl = (WeakPCL)queue.poll()) != null) {
-            pcl.dispose();
-        }
-    }
-
-
-    /**
-     * Sets whether or not an updateUI call is pending.
-     */
-    private static synchronized void setUpdatePending(boolean update) {
-        AppContext.getAppContext()
-                .put(DESKTOP_PROPERTY_UPDATE_PENDING_KEY, update);
-    }
-
-    /**
-     * Returns true if a UI update is pending.
-     */
-    private static synchronized boolean isUpdatePending() {
-        return Boolean.TRUE.equals(AppContext.getAppContext()
-                .get(DESKTOP_PROPERTY_UPDATE_PENDING_KEY));
-    }
-
-    /**
-     * Updates the UIs of all the known Frames.
-     */
-    private static void updateAllUIs() {
-        // Check if the current UI is WindowsLookAndfeel and flush the XP style map.
-        // Note: Change the package test if this class is moved to a different package.
-        Class<?> uiClass = UIManager.getLookAndFeel().getClass();
-        if (uiClass.getPackage().equals(DesktopProperty.class.getPackage())) {
-            XPStyle.invalidateStyle();
-        }
-        Frame appFrames[] = Frame.getFrames();
-        for (Frame appFrame : appFrames) {
-            updateWindowUI(appFrame);
-        }
-    }
-
-    /**
-     * Updates the UI of the passed in window and all its children.
-     */
-    private static void updateWindowUI(Window window) {
-        SwingUtilities.updateComponentTreeUI(window);
-        Window ownedWins[] = window.getOwnedWindows();
-        for (Window ownedWin : ownedWins) {
-            updateWindowUI(ownedWin);
-        }
-    }
-
-
-    /**
-     * Creates a DesktopProperty.
-     *
-     * @param key Key used in looking up desktop value.
-     * @param fallback Value used if desktop property is null.
-     */
-    public DesktopProperty(String key, Object fallback) {
-        this.key = key;
-        this.fallback = fallback;
-        // The only sure fire way to clear our references is to create a
-        // Thread and wait for a reference to be added to the queue.
-        // Because it is so rare that you will actually change the look
-        // and feel, this stepped is forgoed and a middle ground of
-        // flushing references from the constructor is instead done.
-        // The implication is that once one DesktopProperty is created
-        // there will most likely be n (number of DesktopProperties created
-        // by the LookAndFeel) WeakPCLs around, but this number will not
-        // grow past n.
-        flushUnreferencedProperties();
-    }
-
-    /**
-     * UIManager.LazyValue method, returns the value from the desktop
-     * or the fallback value if the desktop value is null.
-     */
-    public Object createValue(UIDefaults table) {
-        if (value == null) {
-            value = configureValue(getValueFromDesktop());
-            if (value == null) {
-                value = configureValue(getDefaultValue());
-            }
-        }
-        return value;
-    }
-
-    /**
-     * Returns the value from the desktop.
-     */
-    protected Object getValueFromDesktop() {
-        Toolkit toolkit = Toolkit.getDefaultToolkit();
-
-        if (pcl == null) {
-            pcl = new WeakPCL(this, getKey(), UIManager.getLookAndFeel());
-            toolkit.addPropertyChangeListener(getKey(), pcl);
-        }
-
-        return toolkit.getDesktopProperty(getKey());
-    }
-
-    /**
-     * Returns the value to use if the desktop property is null.
-     */
-    protected Object getDefaultValue() {
-        return fallback;
-    }
-
-    /**
-     * Invalidates the current value.
-     *
-     * @param laf the LookAndFeel this DesktopProperty was created with
-     */
-    public void invalidate(LookAndFeel laf) {
-        invalidate();
-    }
-
-    /**
-     * Invalides the current value so that the next invocation of
-     * <code>createValue</code> will ask for the property again.
-     */
-    public void invalidate() {
-        value = null;
-    }
-
-    /**
-     * Requests that all components in the GUI hierarchy be updated
-     * to reflect dynamic changes in this {@literal look&feel}. This update occurs
-     * by uninstalling and re-installing the UI objects. Requests are
-     * batched and collapsed into a single update pass because often
-     * many desktop properties will change at once.
-     */
-    protected void updateUI() {
-        if (!isUpdatePending()) {
-            setUpdatePending(true);
-            Runnable uiUpdater = new Runnable() {
-                public void run() {
-                    updateAllUIs();
-                    setUpdatePending(false);
-                }
-            };
-            SwingUtilities.invokeLater(uiUpdater);
-        }
-    }
-
-    /**
-     * Configures the value as appropriate for a defaults property in
-     * the UIDefaults table.
-     */
-    protected Object configureValue(Object value) {
-        if (value != null) {
-            if (value instanceof Color) {
-                return new ColorUIResource((Color)value);
-            }
-            else if (value instanceof Font) {
-                return new FontUIResource((Font)value);
-            }
-            else if (value instanceof UIDefaults.LazyValue) {
-                value = ((UIDefaults.LazyValue)value).createValue(null);
-            }
-            else if (value instanceof UIDefaults.ActiveValue) {
-                value = ((UIDefaults.ActiveValue)value).createValue(null);
-            }
-        }
-        return value;
-    }
-
-    /**
-     * Returns the key used to lookup the desktop properties value.
-     */
-    protected String getKey() {
-        return key;
-    }
-
-
-
-    /**
-     * As there is typically only one Toolkit, the PropertyChangeListener
-     * is handled via a WeakReference so as not to pin down the
-     * DesktopProperty.
-     */
-    private static class WeakPCL extends WeakReference<DesktopProperty>
-                               implements PropertyChangeListener {
-        private String key;
-        private LookAndFeel laf;
-
-        WeakPCL(DesktopProperty target, String key, LookAndFeel laf) {
-            super(target, queue);
-            this.key = key;
-            this.laf = laf;
-        }
-
-        public void propertyChange(PropertyChangeEvent pce) {
-            DesktopProperty property = get();
-
-            if (property == null || laf != UIManager.getLookAndFeel()) {
-                // The property was GC'ed, we're no longer interested in
-                // PropertyChanges, remove the listener.
-                dispose();
-            }
-            else {
-                property.invalidate(laf);
-                property.updateUI();
-            }
-        }
-
-        void dispose() {
-            Toolkit.getDefaultToolkit().removePropertyChangeListener(key, this);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsDesktopProperty.java	Thu Oct 19 21:39:39 2017 +0100
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.java.swing.plaf.windows;
+
+import javax.swing.UIManager;
+
+import sun.swing.plaf.DesktopProperty;
+
+/**
+ * Wrapper for a value from the desktop. The value is lazily looked up, and
+ * can be accessed using the <code>UIManager.ActiveValue</code> method
+ * <code>createValue</code>. If the underlying desktop property changes this
+ * will force the UIs to update all known Frames. You can invoke
+ * <code>invalidate</code> to force the value to be fetched again.
+ */
+public class WindowsDesktopProperty extends DesktopProperty {
+
+    /**
+     * Updates the UIs of all the known Frames.
+     */
+    @Override
+    protected final void updateAllUIs() {
+        // Check if the current UI is WindowsLookAndfeel and flush the XP style map.
+        // Note: Change the package test if this class is moved to a different package.
+        Class<?> uiClass = UIManager.getLookAndFeel().getClass();
+        if (uiClass.getPackage().equals(WindowsDesktopProperty.class.getPackage())) {
+            XPStyle.invalidateStyle();
+        }
+        super.updateAllUIs();
+    }
+
+    /**
+     * Creates a WindowsDesktopProperty.
+     *
+     * @param key Key used in looking up desktop value.
+     * @param fallback Value used if desktop property is null.
+     */
+    public WindowsDesktopProperty(String key, Object fallback) {
+        super(key,fallback);
+    }
+}
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Thu Oct 19 21:39:39 2017 +0100
@@ -114,8 +114,8 @@
 
     // These properties are not used directly, but are kept as
     // private members to avoid being GC'd.
-    private DesktopProperty themeActive, dllName, colorName, sizeName;
-    private DesktopProperty aaSettings;
+    private WindowsDesktopProperty themeActive, dllName, colorName, sizeName;
+    private WindowsDesktopProperty aaSettings;
 
     private transient LayoutStyle style;
 
@@ -455,61 +455,61 @@
 
         Object menuItemAcceleratorDelimiter = "+";
 
-        Object ControlBackgroundColor = new DesktopProperty(
+        Object ControlBackgroundColor = new WindowsDesktopProperty(
                                                        "win.3d.backgroundColor",
                                                         table.get("control"));
-        Object ControlLightColor      = new DesktopProperty(
+        Object ControlLightColor      = new WindowsDesktopProperty(
                                                        "win.3d.lightColor",
                                                         table.get("controlHighlight"));
-        Object ControlHighlightColor  = new DesktopProperty(
+        Object ControlHighlightColor  = new WindowsDesktopProperty(
                                                        "win.3d.highlightColor",
                                                         table.get("controlLtHighlight"));
-        Object ControlShadowColor     = new DesktopProperty(
+        Object ControlShadowColor     = new WindowsDesktopProperty(
                                                        "win.3d.shadowColor",
                                                         table.get("controlShadow"));
-        Object ControlDarkShadowColor = new DesktopProperty(
+        Object ControlDarkShadowColor = new WindowsDesktopProperty(
                                                        "win.3d.darkShadowColor",
                                                         table.get("controlDkShadow"));
-        Object ControlTextColor       = new DesktopProperty(
+        Object ControlTextColor       = new WindowsDesktopProperty(
                                                        "win.button.textColor",
                                                         table.get("controlText"));
-        Object MenuBackgroundColor    = new DesktopProperty(
+        Object MenuBackgroundColor    = new WindowsDesktopProperty(
                                                        "win.menu.backgroundColor",
                                                         table.get("menu"));
-        Object MenuBarBackgroundColor = new DesktopProperty(
+        Object MenuBarBackgroundColor = new WindowsDesktopProperty(
                                                        "win.menubar.backgroundColor",
                                                         table.get("menu"));
-        Object MenuTextColor          = new DesktopProperty(
+        Object MenuTextColor          = new WindowsDesktopProperty(
                                                        "win.menu.textColor",
                                                         table.get("menuText"));
-        Object SelectionBackgroundColor = new DesktopProperty(
+        Object SelectionBackgroundColor = new WindowsDesktopProperty(
                                                        "win.item.highlightColor",
                                                         table.get("textHighlight"));
-        Object SelectionTextColor     = new DesktopProperty(
+        Object SelectionTextColor     = new WindowsDesktopProperty(
                                                        "win.item.highlightTextColor",
                                                         table.get("textHighlightText"));
-        Object WindowBackgroundColor  = new DesktopProperty(
+        Object WindowBackgroundColor  = new WindowsDesktopProperty(
                                                        "win.frame.backgroundColor",
                                                         table.get("window"));
-        Object WindowTextColor        = new DesktopProperty(
+        Object WindowTextColor        = new WindowsDesktopProperty(
                                                        "win.frame.textColor",
                                                         table.get("windowText"));
-        Object WindowBorderWidth      = new DesktopProperty(
+        Object WindowBorderWidth      = new WindowsDesktopProperty(
                                                        "win.frame.sizingBorderWidth",
                                                        Integer.valueOf(1));
-        Object TitlePaneHeight        = new DesktopProperty(
+        Object TitlePaneHeight        = new WindowsDesktopProperty(
                                                        "win.frame.captionHeight",
                                                        Integer.valueOf(18));
-        Object TitleButtonWidth       = new DesktopProperty(
+        Object TitleButtonWidth       = new WindowsDesktopProperty(
                                                        "win.frame.captionButtonWidth",
                                                        Integer.valueOf(16));
-        Object TitleButtonHeight      = new DesktopProperty(
+        Object TitleButtonHeight      = new WindowsDesktopProperty(
                                                        "win.frame.captionButtonHeight",
                                                        Integer.valueOf(16));
-        Object InactiveTextColor      = new DesktopProperty(
+        Object InactiveTextColor      = new WindowsDesktopProperty(
                                                        "win.text.grayedTextColor",
                                                         table.get("textInactiveText"));
-        Object ScrollbarBackgroundColor = new DesktopProperty(
+        Object ScrollbarBackgroundColor = new WindowsDesktopProperty(
                                                        "win.scrollbar.backgroundColor",
                                                         table.get("scrollbar"));
         Object buttonFocusColor = new FocusColorProperty();
@@ -535,13 +535,13 @@
         Object ToolTipFont = sansSerifPlain12;
         Object IconFont = ControlFont;
 
-        Object scrollBarWidth = new DesktopProperty("win.scrollbar.width", Integer.valueOf(16));
+        Object scrollBarWidth = new WindowsDesktopProperty("win.scrollbar.width", Integer.valueOf(16));
 
-        Object menuBarHeight = new DesktopProperty("win.menu.height", null);
+        Object menuBarHeight = new WindowsDesktopProperty("win.menu.height", null);
 
-        Object hotTrackingOn = new DesktopProperty("win.item.hotTrackingOn", true);
+        Object hotTrackingOn = new WindowsDesktopProperty("win.item.hotTrackingOn", true);
 
-        Object showMnemonics = new DesktopProperty("win.menu.keyboardCuesOn", Boolean.TRUE);
+        Object showMnemonics = new WindowsDesktopProperty("win.menu.keyboardCuesOn", Boolean.TRUE);
 
         if (useSystemFontSettings) {
             MenuFont = getDesktopFontValue("win.menu.font", MenuFont);
@@ -634,7 +634,7 @@
                  }),
 
             "Caret.width",
-                  new DesktopProperty("win.caret.width", null),
+                  new WindowsDesktopProperty("win.caret.width", null),
 
             "CheckBox.font", ControlFont,
             "CheckBox.interiorBackground", WindowBackgroundColor,
@@ -699,7 +699,7 @@
               }),
 
             // DeskTop.
-            "Desktop.background", new DesktopProperty(
+            "Desktop.background", new WindowsDesktopProperty(
                                                  "win.mdi.backgroundColor",
                                                   table.get("desktop")),
             "Desktop.ancestorInputMap",
@@ -761,8 +761,8 @@
             "FileChooser.useSystemExtensionHiding", Boolean.TRUE,
 
             "FileChooser.usesSingleFilePane", Boolean.TRUE,
-            "FileChooser.noPlacesBar", new DesktopProperty("win.comdlg.noPlacesBar",
-                                                           Boolean.FALSE),
+            "FileChooser.noPlacesBar", new WindowsDesktopProperty("win.comdlg.noPlacesBar",
+                                                                  Boolean.FALSE),
             "FileChooser.ancestorInputMap",
                new UIDefaults.LazyInputMap(new Object[] {
                      "ESCAPE", "cancelSelection",
@@ -802,28 +802,28 @@
             "InternalFrame.minimizeIconBackground", ControlBackgroundColor,
             "InternalFrame.resizeIconHighlight", ControlLightColor,
             "InternalFrame.resizeIconShadow", ControlShadowColor,
-            "InternalFrame.activeBorderColor", new DesktopProperty(
+            "InternalFrame.activeBorderColor", new WindowsDesktopProperty(
                                                        "win.frame.activeBorderColor",
                                                        table.get("windowBorder")),
-            "InternalFrame.inactiveBorderColor", new DesktopProperty(
+            "InternalFrame.inactiveBorderColor", new WindowsDesktopProperty(
                                                        "win.frame.inactiveBorderColor",
                                                        table.get("windowBorder")),
-            "InternalFrame.activeTitleBackground", new DesktopProperty(
+            "InternalFrame.activeTitleBackground", new WindowsDesktopProperty(
                                                         "win.frame.activeCaptionColor",
                                                          table.get("activeCaption")),
-            "InternalFrame.activeTitleGradient", new DesktopProperty(
+            "InternalFrame.activeTitleGradient", new WindowsDesktopProperty(
                                                         "win.frame.activeCaptionGradientColor",
                                                          table.get("activeCaption")),
-            "InternalFrame.activeTitleForeground", new DesktopProperty(
+            "InternalFrame.activeTitleForeground", new WindowsDesktopProperty(
                                                         "win.frame.captionTextColor",
                                                          table.get("activeCaptionText")),
-            "InternalFrame.inactiveTitleBackground", new DesktopProperty(
+            "InternalFrame.inactiveTitleBackground", new WindowsDesktopProperty(
                                                         "win.frame.inactiveCaptionColor",
                                                          table.get("inactiveCaption")),
-            "InternalFrame.inactiveTitleGradient", new DesktopProperty(
+            "InternalFrame.inactiveTitleGradient", new WindowsDesktopProperty(
                                                         "win.frame.inactiveCaptionGradientColor",
                                                          table.get("inactiveCaption")),
-            "InternalFrame.inactiveTitleForeground", new DesktopProperty(
+            "InternalFrame.inactiveTitleForeground", new WindowsDesktopProperty(
                                                         "win.frame.inactiveCaptionTextColor",
                                                          table.get("inactiveCaptionText")),
 
@@ -1462,8 +1462,8 @@
 
             // *** ToolTip
             "ToolTip.font", ToolTipFont,
-            "ToolTip.background", new DesktopProperty("win.tooltip.backgroundColor", table.get("info")),
-            "ToolTip.foreground", new DesktopProperty("win.tooltip.textColor", table.get("infoText")),
+            "ToolTip.background", new WindowsDesktopProperty("win.tooltip.backgroundColor", table.get("info")),
+            "ToolTip.foreground", new WindowsDesktopProperty("win.tooltip.textColor", table.get("infoText")),
 
         // *** ToolTipManager
             "ToolTipManager.enableToolTipMode", "activeApplication",
@@ -1724,7 +1724,7 @@
 
     /**
      * If we support loading of fonts from the desktop this will return
-     * a DesktopProperty representing the font. If the font can't be
+     * a WindowsDesktopProperty representing the font. If the font can't be
      * represented in the current encoding this will return null and
      * turn off the use of system fonts.
      */
@@ -1885,7 +1885,7 @@
         }
         KeyboardFocusManager.getCurrentKeyboardFocusManager().
             removeKeyEventPostProcessor(WindowsRootPaneUI.altProcessor);
-        DesktopProperty.flushUnreferencedProperties();
+        WindowsDesktopProperty.flushUnreferencedProperties();
     }
 
 
@@ -2097,7 +2097,7 @@
         private Icon icon;
         private String nativeImageName;
         private String fallbackName;
-        private DesktopProperty desktopProperty;
+        private WindowsDesktopProperty desktopProperty;
 
         ActiveWindowsIcon(String desktopPropertyName,
                             String nativeImageName, String fallbackName) {
@@ -2194,10 +2194,10 @@
     }
 
     /**
-     * DesktopProperty for fonts. If a font with the name 'MS Sans Serif'
+     * WindowsDesktopProperty for fonts. If a font with the name 'MS Sans Serif'
      * is returned, it is mapped to 'Microsoft Sans Serif'.
      */
-    private static class WindowsFontProperty extends DesktopProperty {
+    private static class WindowsFontProperty extends WindowsDesktopProperty {
         WindowsFontProperty(String key, Object backup) {
             super(key, backup);
         }
@@ -2254,10 +2254,11 @@
 
 
     /**
-     * DesktopProperty for fonts that only gets sizes from the desktop,
+     * WindowsDesktopProperty for fonts that only gets sizes from the desktop,
      * font name and style are passed into the constructor
      */
-    private static class WindowsFontSizeProperty extends DesktopProperty {
+    private static class WindowsFontSizeProperty extends
+                                                 WindowsDesktopProperty {
         private String fontName;
         private int fontSize;
         private int fontStyle;
@@ -2398,7 +2399,7 @@
         }
     }
 
-    private class TriggerDesktopProperty extends DesktopProperty {
+    private class TriggerDesktopProperty extends WindowsDesktopProperty {
         TriggerDesktopProperty(String key) {
             super(key, null);
             // This call adds a property change listener for the property,
@@ -2567,7 +2568,7 @@
         }
     }
 
-    private static class FocusColorProperty extends DesktopProperty {
+    private static class FocusColorProperty extends WindowsDesktopProperty {
         public FocusColorProperty () {
             // Fallback value is never used because of the configureValue method doesn't return null
             super("win.3d.backgroundColor", Color.BLACK);
--- a/src/java.desktop/share/classes/java/awt/Component.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/java/awt/Component.java	Thu Oct 19 21:39:39 2017 +0100
@@ -5022,6 +5022,12 @@
                 tpeer.handleEvent(e);
             }
         }
+
+        if (SunToolkit.isTouchKeyboardAutoShowEnabled() &&
+            (toolkit instanceof SunToolkit) &&
+            ((e instanceof MouseEvent) || (e instanceof FocusEvent))) {
+            ((SunToolkit)toolkit).showOrHideTouchKeyboard(this, e);
+        }
     } // dispatchEventImpl()
 
     /*
--- a/src/java.desktop/share/classes/java/awt/Container.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/java/awt/Container.java	Thu Oct 19 21:39:39 2017 +0100
@@ -55,6 +55,7 @@
 
 import sun.awt.AppContext;
 import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.MouseEventAccessor;
 import sun.awt.PeerEvent;
 import sun.awt.SunToolkit;
 
@@ -4783,6 +4784,9 @@
                                srcEvent.getClickCount(),
                                srcEvent.isPopupTrigger(),
                                srcEvent.getButton());
+            MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+            meAccessor.setCausedByTouchEvent(me,
+                meAccessor.isCausedByTouchEvent(srcEvent));
             ((AWTEvent)srcEvent).copyPrivateDataInto(me);
             // translate coordinates to this native container
             final Point ptSrcOrigin = srcComponent.getLocationOnScreen();
@@ -4884,6 +4888,9 @@
                                             e.getClickCount(),
                                             e.isPopupTrigger(),
                                             e.getButton());
+                MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+                meAccessor.setCausedByTouchEvent(retargeted,
+                    meAccessor.isCausedByTouchEvent(e));
             }
 
             ((AWTEvent)e).copyPrivateDataInto(retargeted);
--- a/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java	Thu Oct 19 21:39:39 2017 +0100
@@ -30,6 +30,8 @@
 import java.awt.peer.ComponentPeer;
 import java.awt.peer.LightweightPeer;
 import java.lang.ref.WeakReference;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.LinkedList;
 import java.util.Iterator;
 import java.util.ListIterator;
@@ -77,6 +79,8 @@
     private boolean consumeNextKeyTyped;
     private Component restoreFocusTo;
 
+    private static boolean fxAppThreadIsDispatchThread;
+
     static {
         AWTAccessor.setDefaultKeyboardFocusManagerAccessor(
             new AWTAccessor.DefaultKeyboardFocusManagerAccessor() {
@@ -84,6 +88,13 @@
                     dkfm.consumeNextKeyTyped(e);
                 }
             });
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
+            public Object run() {
+                fxAppThreadIsDispatchThread =
+                        "true".equals(System.getProperty("javafx.embed.singleThread"));
+                return null;
+            }
+        });
     }
 
     private static class TypeAheadMarker {
@@ -180,11 +191,16 @@
     private boolean doRestoreFocus(Component toFocus, Component vetoedComponent,
                                    boolean clearOnFailure)
     {
+        boolean success = true;
         if (toFocus != vetoedComponent && toFocus.isShowing() && toFocus.canBeFocusOwner() &&
-            toFocus.requestFocus(false, FocusEvent.Cause.ROLLBACK))
+            (success = toFocus.requestFocus(false, FocusEvent.Cause.ROLLBACK)))
         {
             return true;
         } else {
+            if (!success && getGlobalFocusedWindow() != SunToolkit.getContainingWindow(toFocus)) {
+                restoreFocusTo = toFocus;
+                return true;
+            }
             Component nextFocus = toFocus.getNextFocusCandidate();
             if (nextFocus != null && nextFocus != vetoedComponent &&
                 nextFocus.requestFocusInWindow(FocusEvent.Cause.ROLLBACK))
@@ -264,13 +280,41 @@
             }
             SunToolkit.postEvent(targetAppContext, se);
             if (EventQueue.isDispatchThread()) {
-                EventDispatchThread edt = (EventDispatchThread)
-                    Thread.currentThread();
-                edt.pumpEvents(SentEvent.ID, new Conditional() {
+                if (Thread.currentThread() instanceof EventDispatchThread) {
+                    EventDispatchThread edt = (EventDispatchThread)
+                            Thread.currentThread();
+                    edt.pumpEvents(SentEvent.ID, new Conditional() {
                         public boolean evaluate() {
                             return !se.dispatched && !targetAppContext.isDisposed();
                         }
                     });
+                } else {
+                    if (fxAppThreadIsDispatchThread) {
+                        Thread fxCheckDispatchThread = new Thread() {
+                            @Override
+                            public void run() {
+                                while (!se.dispatched && !targetAppContext.isDisposed()) {
+                                    try {
+                                        Thread.sleep(100);
+                                    } catch (InterruptedException e) {
+                                        break;
+                                    }
+                                }
+                            }
+                        };
+                        fxCheckDispatchThread.start();
+                        try {
+                            // check if event is dispatched or disposed
+                            // but since this user app thread is same as
+                            // dispatch thread in fx when run with
+                            // javafx.embed.singleThread=true
+                            // we do not wait infinitely to avoid deadlock
+                            // as dispatch will ultimately be done by this thread
+                            fxCheckDispatchThread.join(500);
+                        } catch (InterruptedException ex) {
+                        }
+                    }
+                }
             } else {
                 synchronized (se) {
                     while (!se.dispatched && !targetAppContext.isDisposed()) {
--- a/src/java.desktop/share/classes/java/awt/Polygon.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/java/awt/Polygon.java	Thu Oct 19 21:39:39 2017 +0100
@@ -62,7 +62,7 @@
      * represents the number of valid points in this {@code Polygon}
      * and might be less than the number of elements in
      * {@link #xpoints xpoints} or {@link #ypoints ypoints}.
-     * This value can be NULL.
+     * This value can be 0.
      *
      * @serial
      * @see #addPoint(int, int)
--- a/src/java.desktop/share/classes/java/awt/SequencedEvent.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/java/awt/SequencedEvent.java	Thu Oct 19 21:39:39 2017 +0100
@@ -25,6 +25,8 @@
 
 package java.awt;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.LinkedList;
 import sun.awt.AWTAccessor;
 import sun.awt.AppContext;
@@ -55,6 +57,8 @@
     private AppContext appContext;
     private boolean disposed;
 
+    private static boolean fxAppThreadIsDispatchThread;
+    private Thread fxCheckSequenceThread;
     static {
         AWTAccessor.setSequencedEventAccessor(new AWTAccessor.SequencedEventAccessor() {
             public AWTEvent getNested(AWTEvent sequencedEvent) {
@@ -68,6 +72,13 @@
                 return new SequencedEvent(event);
             }
         });
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
+            public Object run() {
+                fxAppThreadIsDispatchThread =
+                        "true".equals(System.getProperty("javafx.embed.singleThread"));
+                return null;
+            }
+        });
     }
 
     /**
@@ -83,6 +94,21 @@
         // All AWTEvents that are wrapped in SequencedEvents are (at
         // least currently) implicitly generated by the system
         SunToolkit.setSystemGenerated(nested);
+
+        if (fxAppThreadIsDispatchThread) {
+            fxCheckSequenceThread = new Thread() {
+                @Override
+                public void run() {
+                    while(!isFirstOrDisposed()) {
+                        try {
+                            Thread.sleep(100);
+                        } catch (InterruptedException e) {
+                            break;
+                        }
+                    }
+                }
+            };
+        }
         synchronized (SequencedEvent.class) {
             list.add(this);
         }
@@ -106,13 +132,29 @@
 
             if (getFirst() != this) {
                 if (EventQueue.isDispatchThread()) {
-                    EventDispatchThread edt = (EventDispatchThread)
-                        Thread.currentThread();
-                    edt.pumpEvents(SentEvent.ID, new Conditional() {
-                        public boolean evaluate() {
-                            return !SequencedEvent.this.isFirstOrDisposed();
+                    if (Thread.currentThread() instanceof EventDispatchThread) {
+                        EventDispatchThread edt = (EventDispatchThread)
+                                Thread.currentThread();
+                        edt.pumpEvents(SentEvent.ID, new Conditional() {
+                            public boolean evaluate() {
+                                return !SequencedEvent.this.isFirstOrDisposed();
+                            }
+                        });
+                    } else {
+                        if (fxAppThreadIsDispatchThread) {
+                            fxCheckSequenceThread.start();
+                            try {
+                                // check if event is dispatched or disposed
+                                // but since this user app thread is same as
+                                // dispatch thread in fx when run with
+                                // javafx.embed.singleThread=true
+                                // we do not wait infinitely to avoid deadlock
+                                // as dispatch will ultimately be done by this thread
+                                fxCheckSequenceThread.join(500);
+                            } catch (InterruptedException e) {
+                            }
                         }
-                    });
+                    }
                 } else {
                     while(!isFirstOrDisposed()) {
                         synchronized (SequencedEvent.class) {
--- a/src/java.desktop/share/classes/java/awt/event/MouseEvent.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/java/awt/event/MouseEvent.java	Thu Oct 19 21:39:39 2017 +0100
@@ -33,6 +33,8 @@
 import java.io.ObjectInputStream;
 import java.awt.IllegalComponentStateException;
 import java.awt.MouseInfo;
+
+import sun.awt.AWTAccessor;
 import sun.awt.SunToolkit;
 
 /**
@@ -332,6 +334,11 @@
     int clickCount;
 
     /**
+     * Indicates whether the event is a result of a touch event.
+     */
+    private boolean causedByTouchEvent;
+
+    /**
      * Indicates which, if any, of the mouse buttons has changed state.
      *
      * The valid values are ranged from 0 to the value returned by the
@@ -399,6 +406,17 @@
             //whatever besides SunToolkit) could also operate.
             cachedNumberOfButtons = 3;
         }
+        AWTAccessor.setMouseEventAccessor(
+            new AWTAccessor.MouseEventAccessor() {
+                public boolean isCausedByTouchEvent(MouseEvent ev) {
+                    return ev.causedByTouchEvent;
+                }
+
+                public void setCausedByTouchEvent(MouseEvent ev,
+                    boolean causedByTouchEvent) {
+                    ev.causedByTouchEvent = causedByTouchEvent;
+                }
+            });
     }
 
     /**
--- a/src/java.desktop/share/classes/javax/swing/Autoscroller.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/javax/swing/Autoscroller.java	Thu Oct 19 21:39:39 2017 +0100
@@ -28,6 +28,9 @@
 import java.awt.*;
 import java.awt.event.*;
 
+import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.MouseEventAccessor;
+
 /**
  * Autoscroller is responsible for generating synthetic mouse dragged
  * events. It is the responsibility of the Component (or its MouseListeners)
@@ -97,6 +100,9 @@
                                e.getYOnScreen(),
                                e.getClickCount(), e.isPopupTrigger(),
                                MouseEvent.NOBUTTON);
+        MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+        meAccessor.setCausedByTouchEvent(event,
+            meAccessor.isCausedByTouchEvent(e));
 
         if (timer == null) {
             timer = new Timer(100, this);
@@ -175,6 +181,9 @@
                                       event.getClickCount(),
                                       event.isPopupTrigger(),
                                       MouseEvent.NOBUTTON);
+        MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+        meAccessor.setCausedByTouchEvent(e,
+            meAccessor.isCausedByTouchEvent(event));
         component.superProcessMouseMotionEvent(e);
     }
 
--- a/src/java.desktop/share/classes/javax/swing/JComponent.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/javax/swing/JComponent.java	Thu Oct 19 21:39:39 2017 +0100
@@ -778,7 +778,7 @@
      * invoker super's implementation you must honor the opaque property,
      * that is
      * if this component is opaque, you must completely fill in the background
-     * in a non-opaque color. If you do not honor the opaque property you
+     * in an opaque color. If you do not honor the opaque property you
      * will likely see visual artifacts.
      * <p>
      * The passed in <code>Graphics</code> object might
--- a/src/java.desktop/share/classes/javax/swing/JList.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/javax/swing/JList.java	Thu Oct 19 21:39:39 2017 +0100
@@ -48,6 +48,8 @@
 import java.io.IOException;
 import java.io.Serializable;
 
+import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.MouseEventAccessor;
 import sun.swing.SwingUtilities2;
 import sun.swing.SwingUtilities2.Section;
 import static sun.swing.SwingUtilities2.Section.*;
@@ -1552,6 +1554,10 @@
                                               event.getClickCount(),
                                               event.isPopupTrigger(),
                                               MouseEvent.NOBUTTON);
+                    MouseEventAccessor meAccessor =
+                        AWTAccessor.getMouseEventAccessor();
+                    meAccessor.setCausedByTouchEvent(newEvent,
+                        meAccessor.isCausedByTouchEvent(event));
 
                     String tip = ((JComponent)rComponent).getToolTipText(
                                               newEvent);
--- a/src/java.desktop/share/classes/javax/swing/JRootPane.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/javax/swing/JRootPane.java	Thu Oct 19 21:39:39 2017 +0100
@@ -922,7 +922,7 @@
                 rd = new Dimension(Integer.MAX_VALUE,
                         Integer.MAX_VALUE - i.top - i.bottom - mbd.height - 1);
             }
-            return new Dimension(Math.min(rd.width, mbd.width) + i.left + i.right,
+            return new Dimension(Math.max(rd.width, mbd.width) + i.left + i.right,
                                          rd.height + mbd.height + i.top + i.bottom);
         }
 
--- a/src/java.desktop/share/classes/javax/swing/JTable.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/javax/swing/JTable.java	Thu Oct 19 21:39:39 2017 +0100
@@ -56,6 +56,8 @@
 import javax.print.attribute.*;
 import javax.print.PrintService;
 
+import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.MouseEventAccessor;
 import sun.reflect.misc.ReflectUtil;
 
 import sun.swing.SwingUtilities2;
@@ -3420,6 +3422,9 @@
                                           event.getClickCount(),
                                           event.isPopupTrigger(),
                                           MouseEvent.NOBUTTON);
+                MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+                meAccessor.setCausedByTouchEvent(newEvent,
+                    meAccessor.isCausedByTouchEvent(event));
 
                 tip = ((JComponent)component).getToolTipText(newEvent);
             }
--- a/src/java.desktop/share/classes/javax/swing/JTree.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/javax/swing/JTree.java	Thu Oct 19 21:39:39 2017 +0100
@@ -39,6 +39,8 @@
 import javax.swing.text.Position;
 import javax.accessibility.*;
 
+import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.MouseEventAccessor;
 import sun.swing.SwingUtilities2;
 import sun.swing.SwingUtilities2.Section;
 import static sun.swing.SwingUtilities2.Section.*;
@@ -1578,6 +1580,10 @@
                                               event.getClickCount(),
                                               event.isPopupTrigger(),
                                               MouseEvent.NOBUTTON);
+                    MouseEventAccessor meAccessor =
+                        AWTAccessor.getMouseEventAccessor();
+                    meAccessor.setCausedByTouchEvent(newEvent,
+                        meAccessor.isCausedByTouchEvent(event));
 
                     tip = ((JComponent)rComponent).getToolTipText(newEvent);
                 }
--- a/src/java.desktop/share/classes/javax/swing/MenuSelectionManager.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/javax/swing/MenuSelectionManager.java	Thu Oct 19 21:39:39 2017 +0100
@@ -30,6 +30,8 @@
 import javax.swing.event.*;
 
 import sun.awt.AppContext;
+import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.MouseEventAccessor;
 import sun.swing.SwingUtilities2;
 
 /**
@@ -308,6 +310,9 @@
                                                               event.getClickCount(),
                                                               event.isPopupTrigger(),
                                                               MouseEvent.NOBUTTON);
+                        MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+                        meAccessor.setCausedByTouchEvent(exitEvent,
+                            meAccessor.isCausedByTouchEvent(event));
                         currentSelection[currentSelection.length-1].
                             processMouseEvent(exitEvent, path, this);
 
@@ -320,6 +325,8 @@
                                                                event.getClickCount(),
                                                                event.isPopupTrigger(),
                                                                MouseEvent.NOBUTTON);
+                        meAccessor.setCausedByTouchEvent(enterEvent,
+                            meAccessor.isCausedByTouchEvent(event));
                         subElements[j].processMouseEvent(enterEvent, path, this);
                     }
                     MouseEvent mouseEvent = new MouseEvent(mc, event.getID(),event. getWhen(),
@@ -329,6 +336,9 @@
                                                            event.getClickCount(),
                                                            event.isPopupTrigger(),
                                                            MouseEvent.NOBUTTON);
+                    MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+                    meAccessor.setCausedByTouchEvent(mouseEvent,
+                        meAccessor.isCausedByTouchEvent(event));
                     subElements[j].processMouseEvent(mouseEvent, path, this);
                     success = true;
                     event.consume();
--- a/src/java.desktop/share/classes/javax/swing/SwingUtilities.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/javax/swing/SwingUtilities.java	Thu Oct 19 21:39:39 2017 +0100
@@ -44,6 +44,8 @@
 import sun.security.action.GetPropertyAction;
 
 import sun.awt.AppContext;
+import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.MouseEventAccessor;
 
 /**
  * A collection of utility methods for Swing.
@@ -405,6 +407,9 @@
                                       sourceEvent.getClickCount(),
                                       sourceEvent.isPopupTrigger(),
                                       sourceEvent.getButton());
+            MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+            meAccessor.setCausedByTouchEvent(newEvent,
+                meAccessor.isCausedByTouchEvent(sourceEvent));
         }
         return newEvent;
     }
--- a/src/java.desktop/share/classes/javax/swing/filechooser/FileSystemView.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/javax/swing/filechooser/FileSystemView.java	Thu Oct 19 21:39:39 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,23 +25,25 @@
 
 package javax.swing.filechooser;
 
-
-import javax.swing.*;
-
 import java.awt.Image;
+import java.beans.PropertyChangeListener;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.List;
-import java.util.ArrayList;
 import java.lang.ref.WeakReference;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeEvent;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
 
-import sun.awt.shell.*;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JFileChooser;
+import javax.swing.UIManager;
+
+import jdk.internal.ref.CleanerFactory;
+import sun.awt.shell.ShellFolder;
 
 /**
  * FileSystemView is JFileChooser's gateway to the
@@ -109,22 +111,19 @@
      * Constructs a FileSystemView.
      */
     public FileSystemView() {
-        final WeakReference<FileSystemView> weakReference = new WeakReference<FileSystemView>(this);
+        final WeakReference<FileSystemView> weakReference = new WeakReference<>(this);
+        final PropertyChangeListener pcl = evt -> {
+            final FileSystemView fsv = weakReference.get();
+            if (fsv != null && evt.getPropertyName().equals("lookAndFeel")) {
+                fsv.useSystemExtensionHiding =
+                        UIManager.getDefaults().getBoolean(
+                                "FileChooser.useSystemExtensionHiding");
+            }
+        };
 
-        UIManager.addPropertyChangeListener(new PropertyChangeListener() {
-            public void propertyChange(PropertyChangeEvent evt) {
-                FileSystemView fileSystemView = weakReference.get();
-
-                if (fileSystemView == null) {
-                    // FileSystemView was destroyed
-                    UIManager.removePropertyChangeListener(this);
-                } else {
-                    if (evt.getPropertyName().equals("lookAndFeel")) {
-                        fileSystemView.useSystemExtensionHiding =
-                                UIManager.getDefaults().getBoolean("FileChooser.useSystemExtensionHiding");
-                    }
-                }
-            }
+        UIManager.addPropertyChangeListener(pcl);
+        CleanerFactory.cleaner().register(this, () -> {
+            UIManager.removePropertyChangeListener(pcl);
         });
     }
 
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java	Thu Oct 19 21:39:39 2017 +0100
@@ -36,6 +36,8 @@
 import java.beans.PropertyChangeEvent;
 import java.io.Serializable;
 
+import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.MouseEventAccessor;
 
 /**
  * This is a basic implementation of the <code>ComboPopup</code> interface.
@@ -534,13 +536,18 @@
                     // Fix for 4234053. Filter out the Control Key from the list.
                     // ie., don't allow CTRL key deselection.
                     Toolkit toolkit = Toolkit.getDefaultToolkit();
-                    e = new MouseEvent((Component)e.getSource(), e.getID(), e.getWhen(),
+                    MouseEvent newEvent = new MouseEvent(
+                                       (Component)e.getSource(), e.getID(), e.getWhen(),
                                        e.getModifiers() ^ toolkit.getMenuShortcutKeyMask(),
                                        e.getX(), e.getY(),
                                        e.getXOnScreen(), e.getYOnScreen(),
                                        e.getClickCount(),
                                        e.isPopupTrigger(),
                                        MouseEvent.NOBUTTON);
+                    MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+                    meAccessor.setCausedByTouchEvent(newEvent,
+                        meAccessor.isCausedByTouchEvent(e));
+                    e = newEvent;
                 }
                 super.processMouseEvent(e);
             }
@@ -1251,6 +1258,9 @@
                                               e.getClickCount(),
                                               e.isPopupTrigger(),
                                               MouseEvent.NOBUTTON );
+        MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+        meAccessor.setCausedByTouchEvent(newEvent,
+            meAccessor.isCausedByTouchEvent(e));
         return newEvent;
     }
 
--- a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFontDesktopProperty.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFontDesktopProperty.java	Thu Oct 19 21:39:39 2017 +0100
@@ -22,16 +22,18 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.swing.plaf.metal;
 
-import java.awt.*;
+import java.awt.Font;
+
+import sun.swing.plaf.DesktopProperty;
 
 /**
  * DesktopProperty that only uses font height in configuring font. This
  * is only used on Windows.
- *
  */
-class MetalFontDesktopProperty extends com.sun.java.swing.plaf.windows.DesktopProperty {
+final class MetalFontDesktopProperty extends DesktopProperty {
     /**
      * Maps from metal font theme type as defined in MetalTheme
      * to the corresponding desktop property name.
--- a/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java	Thu Oct 19 21:39:39 2017 +0100
@@ -42,6 +42,9 @@
 import java.io.ObjectOutputStream;
 import java.io.IOException;
 
+import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.MouseEventAccessor;
+
 /**
  * This is the object which manages the header of the <code>JTable</code>.
  * <p>
@@ -414,6 +417,9 @@
                                           p.x, p.y, event.getXOnScreen(), event.getYOnScreen(),
                                           event.getClickCount(),
                                           event.isPopupTrigger(), MouseEvent.NOBUTTON);
+                MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+                meAccessor.setCausedByTouchEvent(newEvent,
+                    meAccessor.isCausedByTouchEvent(event));
 
                 tip = ((JComponent)component).getToolTipText(newEvent);
             }
--- a/src/java.desktop/share/classes/sun/awt/AWTAccessor.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/sun/awt/AWTAccessor.java	Thu Oct 19 21:39:39 2017 +0100
@@ -38,6 +38,7 @@
 import java.awt.event.InputEvent;
 import java.awt.event.InvocationEvent;
 import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
 import java.awt.geom.Point2D;
 import java.awt.image.BufferStrategy;
 import java.awt.peer.ComponentPeer;
@@ -412,6 +413,21 @@
                 boolean canAccessSystemClipboard);
     }
 
+    /**
+     * An accessor for the MouseEvent class.
+     */
+    public interface MouseEventAccessor {
+        /**
+         * Indicates whether the event is a result of a touch event.
+         */
+        boolean isCausedByTouchEvent(MouseEvent ev);
+
+        /**
+         * Sets whether the event is a result of a touch event.
+         */
+        void setCausedByTouchEvent(MouseEvent ev, boolean causedByTouchEvent);
+    }
+
     /*
      * An accessor for the java.awt.Frame class.
      */
@@ -851,6 +867,7 @@
     private static WindowAccessor windowAccessor;
     private static AWTEventAccessor awtEventAccessor;
     private static InputEventAccessor inputEventAccessor;
+    private static MouseEventAccessor mouseEventAccessor;
     private static FrameAccessor frameAccessor;
     private static KeyboardFocusManagerAccessor kfmAccessor;
     private static MenuComponentAccessor menuComponentAccessor;
@@ -965,6 +982,23 @@
     }
 
     /*
+     * Set an accessor object for the java.awt.event.MouseEvent class.
+     */
+    public static void setMouseEventAccessor(MouseEventAccessor mea) {
+        mouseEventAccessor = mea;
+    }
+
+    /*
+     * Retrieve the accessor object for the java.awt.event.MouseEvent class.
+     */
+    public static MouseEventAccessor getMouseEventAccessor() {
+        if (mouseEventAccessor == null) {
+            unsafe.ensureClassInitialized(MouseEvent.class);
+        }
+        return mouseEventAccessor;
+    }
+
+    /*
      * Set an accessor object for the java.awt.Frame class.
      */
     public static void setFrameAccessor(FrameAccessor fa) {
--- a/src/java.desktop/share/classes/sun/awt/SunToolkit.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/sun/awt/SunToolkit.java	Thu Oct 19 21:39:39 2017 +0100
@@ -84,6 +84,9 @@
         if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.nativedebug"))) {
             DebugSettings.init();
         }
+        touchKeyboardAutoShowIsEnabled = Boolean.valueOf(
+            GetPropertyAction.privilegedGetProperty(
+                "awt.touchKeyboardAutoShowIsEnabled", "true"));
     };
 
     /**
@@ -1614,6 +1617,13 @@
      */
     public abstract void ungrab(Window w);
 
+    public void showOrHideTouchKeyboard(Component comp, AWTEvent e) {}
+
+    private static boolean touchKeyboardAutoShowIsEnabled;
+
+    public static boolean isTouchKeyboardAutoShowEnabled() {
+        return touchKeyboardAutoShowIsEnabled;
+    }
 
     /**
      * Locates the splash screen library in a platform dependent way and closes
--- a/src/java.desktop/share/classes/sun/font/SunLayoutEngine.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/sun/font/SunLayoutEngine.java	Thu Oct 19 21:39:39 2017 +0100
@@ -102,21 +102,8 @@
  * suffice.
  * */
 public final class SunLayoutEngine implements LayoutEngine, LayoutEngineFactory {
-    private static native void initGVIDs();
-    private static final boolean useICU;
     static {
         FontManagerNativeLibrary.load();
-        initGVIDs();
-        String le = java.security.AccessController.doPrivileged(
-            new sun.security.action.
-                GetPropertyAction("sun.font.layoutengine", ""));
-        useICU = le.equals("icu");
-        String verbose = java.security.AccessController.doPrivileged(
-            new sun.security.action.
-                GetPropertyAction("sun.font.layoutengine.verbose", ""));
-        if ("true".equalsIgnoreCase(verbose)) {
-            System.out.println("Using " + (useICU ? "icu." : "harfbuzz."));
-        }
     }
 
     private LayoutEngineKey key;
@@ -180,34 +167,19 @@
         Font2D font = key.font();
         FontStrike strike = font.getStrike(desc);
         long layoutTables = font.getLayoutTableCache();
-        if (useICU) {
-        nativeLayout(font, strike, mat, gmask, baseIndex,
-             tr.text, tr.start, tr.limit, tr.min, tr.max,
-             key.script(), key.lang(), typo_flags, pt, data,
-             font.getUnitsPerEm(), layoutTables);
-        } else {
-            long pNativeFont = font.getPlatformNativeFontPtr(); // used on OSX
-            // pScaler probably not needed long term.
-            long pScaler = 0L;
-            if (font instanceof FileFont) {
-                pScaler = ((FileFont)font).getScaler().nativeScaler;
-            }
-            shape(font, strike, ptSize, mat, pScaler, pNativeFont,
-                  layoutTables, isAAT(font),
-                  tr.text, data, key.script(),
-                  tr.start, tr.limit, baseIndex, pt,
-                  typo_flags, gmask);
-         }
+        long pNativeFont = font.getPlatformNativeFontPtr(); // used on OSX
+        // pScaler probably not needed long term.
+        long pScaler = 0L;
+        if (font instanceof FileFont) {
+            pScaler = ((FileFont)font).getScaler().nativeScaler;
+        }
+        shape(font, strike, ptSize, mat, pScaler, pNativeFont,
+              layoutTables, isAAT(font),
+              tr.text, data, key.script(),
+              tr.start, tr.limit, baseIndex, pt,
+              typo_flags, gmask);
     }
 
-    /* Native method to invoke ICU layout engine */
-    private static native void
-        nativeLayout(Font2D font, FontStrike strike, float[] mat, int gmask,
-             int baseIndex, char[] chars, int offset, int limit,
-             int min, int max, int script, int lang, int typo_flags,
-             Point2D.Float pt, GVData data, long upem, long layoutTables);
-
-
     /* Native method to invoke harfbuzz layout engine */
     private static native boolean
         shape(Font2D font, FontStrike strike, float ptSize, float[] mat,
--- a/src/java.desktop/share/classes/sun/swing/FilePane.java	Thu Oct 12 22:05:47 2017 +0200
+++ b/src/java.desktop/share/classes/sun/swing/FilePane.java	Thu Oct 19 21:39:39 2017 +0100
@@ -44,6 +44,8 @@
 import javax.swing.table.*;
 import javax.swing.text.*;
 
+import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.MouseEventAccessor;
 import sun.awt.shell.*;
 
 /**
@@ -1858,13 +1860,17 @@
                     // Make a new event with the list as source, placing the
                     // click in the corresponding list cell.
                     Rectangle r = list.getCellBounds(index, index);
-                    evt = new MouseEvent(list, evt.getID(),
+                    MouseEvent newEvent = new MouseEvent(list, evt.getID(),
                                          evt.getWhen(), evt.getModifiers(),
                                          r.x + 1, r.y + r.height/2,
                                          evt.getXOnScreen(),
                                          evt.getYOnScreen(),
                                          evt.getClickCount(), evt.isPopupTrigger(),
                                          evt.getButton());
+                    MouseEventAccessor meAccessor = AWTAccessor.getMouseEventAccessor();
+                    meAccessor.setCausedByTouchEvent(newEvent,
+                        meAccessor.isCausedByTouchEvent(evt));
+                    evt = newEvent;
                 }
             } else {
                 return;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/swing/plaf/DesktopProperty.java	Thu Oct 19 21:39:39 2017 +0100
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.swing.plaf;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Toolkit;
+import java.awt.Window;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+
+import javax.swing.LookAndFeel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.plaf.ColorUIResource;
+import javax.swing.plaf.FontUIResource;
+
+import sun.awt.AppContext;
+
+/**
+ * Wrapper for a value from the desktop. The value is lazily looked up, and
+ * can be accessed using the <code>UIManager.ActiveValue</code> method
+ * <code>createValue</code>. If the underlying desktop property changes this
+ * will force the UIs to update all known Frames. You can invoke
+ * <code>invalidate</code> to force the value to be fetched again.
+ */
+public class DesktopProperty implements UIDefaults.ActiveValue {
+    private static final StringBuilder DESKTOP_PROPERTY_UPDATE_PENDING_KEY =
+            new StringBuilder("DesktopPropertyUpdatePending");
+
+    /**
+     * ReferenceQueue of unreferenced WeakPCLs.
+     */
+    private static final ReferenceQueue<DesktopProperty> queue = new ReferenceQueue<DesktopProperty>();
+
+    /**
+     * PropertyChangeListener attached to the Toolkit.
+     */
+    private WeakPCL pcl;
+    /**
+     * Key used to lookup value from desktop.
+     */
+    private final String key;
+    /**
+     * Value to return.
+     */
+    private Object value;
+    /**
+     * Fallback value in case we get null from desktop.
+     */
+    private final Object fallback;
+
+
+    /**
+     * Cleans up any lingering state held by unrefeernced
+     * DesktopProperties.
+     */
+    public static void flushUnreferencedProperties() {
+        WeakPCL pcl;
+
+        while ((pcl = (WeakPCL)queue.poll()) != null) {
+            pcl.dispose();
+        }
+    }
+
+
+    /**
+     * Sets whether or not an updateUI call is pending.
+     */
+    private static synchronized void setUpdatePending(boolean update) {
+        AppContext.getAppContext()
+                .put(DESKTOP_PROPERTY_UPDATE_PENDING_KEY, update);
+    }
+
+    /**
+     * Returns true if a UI update is pending.
+     */
+    private static synchronized boolean isUpdatePending() {
+        return Boolean.TRUE.equals(AppContext.getAppContext()
+                .get(DESKTOP_PROPERTY_UPDATE_PENDING_KEY));
+    }
+
+    /**
+     * Updates the UIs of all the known Frames.
+     */
+    protected void updateAllUIs() {
+        Frame appFrames[] = Frame.getFrames();
+        for (Frame appFrame : appFrames) {
+            updateWindowUI(appFrame);
+        }
+    }
+
+    /**
+     * Updates the UI of the passed in window and all its children.
+     */
+    private static void updateWindowUI(Window window) {
+        SwingUtilities.updateComponentTreeUI(window);
+        Window ownedWins[] = window.getOwnedWindows();
+        for (Window ownedWin : ownedWins) {
+            updateWindowUI(ownedWin);
+        }
+    }
+
+
+    /**
+     * Creates a DesktopProperty.
+     *
+     * @param key Key used in looking up desktop value.
+     * @param fallback Value used if desktop property is null.
+     */
+    public DesktopProperty(String key, Object fallback) {
+        this.key = key;
+        this.fallback = fallback;
+        // The only sure fire way to clear our references is to create a
+        // Thread and wait for a reference to be added to the queue.
+        // Because it is so rare that you will actually change the look
+        // and feel, this stepped is forgoed and a middle ground of
+        // flushing references from the constructor is instead done.
+        // The implication is that once one DesktopProperty is created
+        // there will most likely be n (number of DesktopProperties created
+        // by the LookAndFeel) WeakPCLs around, but this number will not
+        // grow past n.
+        flushUnreferencedProperties();
+    }
+
+    /**
+     * UIManager.LazyValue method, returns the value from the desktop
+     * or the fallback value if the desktop value is null.
+     */
+    public Object createValue(UIDefaults table) {
+        if (value == null) {
+            value = configureValue(getValueFromDesktop());
+            if (value == null) {
+                value = configureValue(getDefaultValue());
+            }
+        }
+        return value;
+    }
+
+    /**
+     * Returns the value from the desktop.
+     */
+    protected Object getValueFromDesktop() {
+        Toolkit toolkit = Toolkit.getDefaultToolkit();
+
+        if (pcl == null) {
+            pcl = new WeakPCL(this, getKey(), UIManager.getLookAndFeel());
+            toolkit.addPropertyChangeListener(getKey(), pcl);
+        }
+
+        return toolkit.getDesktopProperty(getKey());
+    }
+
+    /**
+     * Returns the value to use if the desktop property is null.
+     */
+    protected Object getDefaultValue() {
+        return fallback;
+    }
+
+    /**
+     * Invalidates the current value.
+     *
+     * @param laf the LookAndFeel this DesktopProperty was created with
+     */
+    public void invalidate(LookAndFeel laf) {
+        invalidate();
+    }
+
+    /**
+     * Invalides the current value so that the next invocation of
+     * <code>createValue</code> will ask for the property again.
+     */
+    public void invalidate() {
+        value = null;
+    }
+
+    /**
+     * Requests that all components in the GUI hierarchy be updated
+     * to reflect dynamic changes in this {@literal look&feel}. This update occurs
+     * by uninstalling and re-installing the UI objects. Requests are
+     * batched and collapsed into a single update pass because often
+     * many desktop properties will change at once.
+     */
+    protected void updateUI() {
+        if (!isUpdatePending()) {
+            setUpdatePending(true);
+            Runnable uiUpdater = new Runnable() {
+                public void run() {
+                    updateAllUIs();
+                    setUpdatePending(false);
+                }
+            };
+            SwingUtilities.invokeLater(uiUpdater);
+        }
+    }
+
+    /**
+     * Configures the value as appropriate for a defaults property in
+     * the UIDefaults table.
+     */
+    protected Object configureValue(Object value) {
+        if (value != null) {
+            if (value instanceof Color) {
+                return new ColorUIResource((Color)value);
+            }
+            else if (value instanceof Font) {
+                return new FontUIResource((Font)value);
+            }
+            else if (value instanceof UIDefaults.LazyValue) {
+                value = ((UIDefaults.LazyValue)value).createValue(null);
+            }
+            else if (value instanceof UIDefaults.ActiveValue) {
+                value = ((UIDefaults.ActiveValue)value).createValue(null);
+            }
+        }
+        return value;
+    }
+
+    /**
+     * Returns the key used to lookup the desktop properties value.
+     */
+    protected String getKey() {
+        return key;
+    }
+
+    /**
+     * As there is typically only one Toolkit, the PropertyChangeListener
+     * is handled via a WeakReference so as not to pin down the
+     * DesktopProperty.
+     */
+    private static class WeakPCL extends WeakReference<DesktopProperty>
+                               implements PropertyChangeListener {
+        private String key;
+        private LookAndFeel laf;
+
+        WeakPCL(DesktopProperty target, String key, LookAndFeel laf) {
+            super(target, queue);
+            this.key = key;
+            this.laf = laf;
+        }
+
+        public void propertyChange(PropertyChangeEvent pce) {
+            DesktopProperty property = get();
+
+            if (property == null || laf != UIManager.getLookAndFeel()) {
+                // The property was GC'ed, we're no longer interested in
+                // PropertyChanges, remove the listener.
+                dispose();
+            }
+            else {
+                property.invalidate(laf);
+                property.updateUI();
+            }
+        }
+
+        void dispose() {
+            Toolkit.getDefaultToolkit().removePropertyChangeListener(key, this);
+        }
+    }
+}
--- a/src/java.desktop/share/native/libfontmanager/FontInstanceAdapter.cpp	Thu Oct 12 22:05:47 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,323 +0,0 @@
-/*
- * Copyright (c) 1999, 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.  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.
- */
-
-/*
- * (C) Copyright IBM Corp. 1998-2001 - All Rights Reserved
- *
- * The original version of this source code and documentation is
- * copyrighted and owned by IBM. These materials are provided
- * under terms of a License Agreement between IBM and Sun.
- * This technology is protected by multiple US and International
- * patents. This notice and attribution to IBM may not be removed.
- */
-
-#include "FontInstanceAdapter.h"
-
-FontInstanceAdapter::FontInstanceAdapter(JNIEnv *theEnv,
-                                         jobject theFont2D,
-                                         jobject theFontStrike,
-                                         float *matrix,
-                                         le_int32 xRes, le_int32 yRes,
-                                         le_int32 theUPEM,
-                                         TTLayoutTableCache *ltables)
-    : env(theEnv), font2D(theFont2D), fontStrike(theFontStrike),
-      xppem(0), yppem(0),
-      xScaleUnitsToPoints(0), yScaleUnitsToPoints(0),
-      xScalePixelsToUnits(0), yScalePixelsToUnits(0),
-      upem(theUPEM), layoutTables(ltables)
-{
-    xPointSize = euclidianDistance(matrix[0], matrix[1]);
-    yPointSize = euclidianDistance(matrix[2], matrix[3]);
-
-    txMat[0] = matrix[0]/xPointSize;
-    txMat[1] = matrix[1]/xPointSize;
-    txMat[2] = matrix[2]/yPointSize;
-    txMat[3] = matrix[3]/yPointSize;
-
-    xppem = ((float) xRes / 72) * xPointSize;
-    yppem = ((float) yRes / 72) * yPointSize;
-
-    xScaleUnitsToPoints = xPointSize / upem;
-    yScaleUnitsToPoints = yPointSize / upem;
-
-    xScalePixelsToUnits = upem / xppem;
-    yScalePixelsToUnits = upem / yppem;
-};
-
-
-static const LETag cacheMap[LAYOUTCACHE_ENTRIES] = {
-  GPOS_TAG, GDEF_TAG, GSUB_TAG, MORT_TAG, MORX_TAG, KERN_TAG
-};
-
-const void *FontInstanceAdapter::getFontTable(LETag tableTag, size_t &length) const
-{
-  length = 0;
-
-  if (!layoutTables) { // t1 font
-    return 0;
-  }
-
-  // cache in font's pscaler object
-  // font disposer will handle for us
-
-  int cacheIdx;
-  for (cacheIdx=0;cacheIdx<LAYOUTCACHE_ENTRIES;cacheIdx++) {
-    if (tableTag==cacheMap[cacheIdx]) break;
-  }
-
-  if (cacheIdx<LAYOUTCACHE_ENTRIES) { // if found
-    if (layoutTables->entries[cacheIdx].len != -1) {
-      length = layoutTables->entries[cacheIdx].len;
-      return layoutTables->entries[cacheIdx].ptr;
-    }
-  } else {
-    //fprintf(stderr, "unexpected table request from font instance adapter: %x\n", tableTag);
-    // (don't load any other tables)
-    return 0;
-  }
-
-  jbyte* result = 0;
-  jsize  len = 0;
-  jbyteArray tableBytes = (jbyteArray)
-    env->CallObjectMethod(font2D, sunFontIDs.getTableBytesMID, tableTag);
-  if (!IS_NULL(tableBytes)) {
-    len = env->GetArrayLength(tableBytes);
-    result = new jbyte[len];
-    env->GetByteArrayRegion(tableBytes, 0, len, result);
-  }
-
-  if (cacheIdx<LAYOUTCACHE_ENTRIES) { // if cacheable table
-    layoutTables->entries[cacheIdx].len = len;
-    layoutTables->entries[cacheIdx].ptr = (const void*)result;
-  }
-
-  length = len;
-  return (const void*)result;
-};
-
-LEGlyphID FontInstanceAdapter::mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const
-{
-    LEUnicode32 mappedChar = mapper->mapChar(ch);
-
-    if (mappedChar == 0xFFFF || mappedChar == 0xFFFE) {
-        return 0xFFFF;
-    }
-
-    if (mappedChar == 0x200C || mappedChar == 0x200D) {
-        return 1;
-    }
-
-    LEGlyphID id = (LEGlyphID)env->CallIntMethod(font2D, sunFontIDs.f2dCharToGlyphMID, (jint)mappedChar);
-    return id;
-}
-
-LEGlyphID FontInstanceAdapter::mapCharToGlyph(LEUnicode32 ch) const
-{
-    LEGlyphID id = (LEGlyphID)env->CallIntMethod(font2D, sunFontIDs.f2dCharToGlyphMID, ch);
-    return id;
-}
-
-void FontInstanceAdapter::mapCharsToWideGlyphs(const LEUnicode chars[],
-    le_int32 offset, le_int32 count, le_bool reverse,
-    const LECharMapper *mapper, le_uint32 glyphs[]) const
-{
-    le_int32 i, out = 0, dir = 1;
-
-    if (reverse) {
-        out = count - 1;
-        dir = -1;
-    }
-
-    for (i = offset; i < offset + count; i += 1, out += dir) {
-                LEUnicode16 high = chars[i];
-                LEUnicode32 code = high;
-
-                if (i < offset + count - 1 && high >= 0xD800 && high <= 0xDBFF) {
-                        LEUnicode16 low = chars[i + 1];
-
-                        if (low >= 0xDC00 && low <= 0xDFFF) {
-                                code = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
-                        }
-                }
-
-        glyphs[out] = mapCharToWideGlyph(code, mapper);
-
-                if (code >= 0x10000) {
-                        i += 1;
-                        glyphs[out += dir] = 0xFFFF;
-                }
-    }
-}
-
-le_uint32 FontInstanceAdapter::mapCharToWideGlyph(LEUnicode32 ch, const LECharMapper *mapper) const
-{
-    LEUnicode32 mappedChar = mapper->mapChar(ch);
-
-    if (mappedChar == 0xFFFF) {
-        return 0xFFFF;
-    }
-
-    if (mappedChar == 0x200C || mappedChar == 0x200D) {
-        return 1;
-    }
-
-    return (LEGlyphID)env->CallIntMethod(font2D, sunFontIDs.charToGlyphMID,
-                                         mappedChar);
-}
-
-void FontInstanceAdapter::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const
-{
-    getWideGlyphAdvance((le_uint32)glyph, advance);
-}
-
-void FontInstanceAdapter::getKerningAdjustment(LEPoint &adjustment) const
-{
-    float xx, xy, yx, yy;
-    le_bool isIdentityMatrix;
-
-    isIdentityMatrix = (txMat[0] == 1 && txMat[1] == 0 &&
-                        txMat[2] == 0 && txMat[3] == 1);
-
-    if (!isIdentityMatrix) {
-      xx = adjustment.fX;
-      xy = xx * txMat[1];
-      xx = xx * txMat[0];
-
-      yy = adjustment.fY;
-      yx = yy * txMat[2];
-      yy = yy * txMat[3];
-
-      adjustment.fX = xx + yx;
-      adjustment.fY = xy + yy;
-    }
-
-    jobject pt = env->NewObject(sunFontIDs.pt2DFloatClass,
-                                sunFontIDs.pt2DFloatCtr,
-                                adjustment.fX, adjustment.fY);
-    if (pt == NULL) {
-        env->ExceptionClear();
-        adjustment.fX = 0.0f;
-        adjustment.fY = 0.0f;
-    } else {
-        env->CallObjectMethod(fontStrike, sunFontIDs.adjustPointMID, pt);
-        adjustment.fX = env->GetFloatField(pt, sunFontIDs.xFID);
-        adjustment.fY = env->GetFloatField(pt, sunFontIDs.yFID);
-    }
-}
-
-void FontInstanceAdapter::getWideGlyphAdvance(le_uint32 glyph, LEPoint &advance) const
-{
-    if ((glyph & 0xfffe) == 0xfffe) {
-        advance.fX = 0;
-        advance.fY = 0;
-        return;
-    }
-    jobject pt = env->CallObjectMethod(fontStrike,
-                                       sunFontIDs.getGlyphMetricsMID, glyph);
-    if (pt != NULL) {
-        advance.fX = env->GetFloatField(pt, sunFontIDs.xFID);
-        advance.fY = env->GetFloatField(pt, sunFontIDs.yFID);
-        env->DeleteLocalRef(pt);
-    }
-}
-
-le_bool FontInstanceAdapter::getGlyphPoint(LEGlyphID glyph,
-                                           le_int32 pointNumber,
-                                           LEPoint &point) const
-{
-  /* This upcall is not ideal, since it will make another down call.
-   * The intention is to move up some of this code into Java. But
-   * a HashMap has been added to the Java PhysicalStrike object to cache
-   * these points so that they don't need to be repeatedly recalculated
-   * which is expensive as it needs the font scaler to re-generate the
-   * hinted glyph outline. This turns out to be a huge win over 1.4.x
-   */
-     jobject pt = env->CallObjectMethod(fontStrike,
-                                        sunFontIDs.getGlyphPointMID,
-                                        glyph, pointNumber);
-     if (pt != NULL) {
-       /* point is a java.awt.geom.Point2D.Float */
-        point.fX = env->GetFloatField(pt, sunFontIDs.xFID);
-        /* convert from java coordinate system to internal '+y up' coordinate system */
-        point.fY = -env->GetFloatField(pt, sunFontIDs.yFID);
-        return true;
-     } else {
-        return false;
-     }
-}
-
-void FontInstanceAdapter::transformFunits(float xFunits, float yFunits, LEPoint &pixels) const
-{
-    float xx, xy, yx, yy;
-    le_bool isIdentityMatrix;
-
-    isIdentityMatrix = (txMat[0] == 1 && txMat[1] == 0 &&
-                        txMat[2] == 0 && txMat[3] == 1);
-
-    xx = xFunits * xScaleUnitsToPoints;
-    xy = 0;
-    if (!isIdentityMatrix) {
-        xy = xx * txMat[1];
-        xx = xx * txMat[0];
-    };
-
-    yx = 0;
-    yy = yFunits * yScaleUnitsToPoints;
-    if (!isIdentityMatrix) {
-        yx = yy * txMat[2];
-        yy = yy * txMat[3];
-    };
-    pixels.fX = xx + yx;
-    pixels.fY = xy + yy;
-}
-
-
-float FontInstanceAdapter::euclidianDistance(float a, float b)
-{
-    if (a < 0) {
-        a = -a;
-    }
-
-    if (b < 0) {
-        b = -b;
-    }
-
-    if (a == 0) {
-        return b;
-    }
-
-    if (b == 0) {
-        return a;
-    }
-
-    float root = a > b ? a + (b / 2) : b + (a / 2); /* Do an initial approximation, in root */
-
-        /* An unrolled Newton-Raphson iteration sequence */
-    root = (root + (a * (a / root)) + (b * (b / root)) + 1) / 2;
-    root = (root + (a * (a / root)) + (b * (b / root)) + 1) / 2;
-    root = (root + (a * (a / root)) + (b * (b / root)) + 1) / 2;
-
-    return root;
-}
--- a/src/java.desktop/share/native/libfontmanager/FontInstanceAdapter.h	Thu Oct 12 22:05:47 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 1999, 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.  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.
- */
-
-
-/*
- * (C) Copyright IBM Corp. 1998-2001 - All Rights Reserved
- *
- * The original version of this source code and documentation is
- * copyrighted and owned by IBM. These materials are provided
- * under terms of a License Agreement between IBM and Sun.
- * This technology is protected by multiple US and International
- * patents. This notice and attribution to IBM may not be removed.
- */
-
-#ifndef __FONTINSTANCEADAPTER_H
-#define __FONTINSTANCEADAPTER_H
-
-#include "LETypes.h"
-#include "LEFontInstance.h"
-#include "jni.h"
-#include "sunfontids.h"
-#include "fontscalerdefs.h"
-#include <jni_util.h>
-
-class FontInstanceAdapter : public LEFontInstance {
-private:
-    JNIEnv *env;
-    jobject font2D;
-    jobject fontStrike;
-
-    float xppem;
-    float yppem;
-
-    float xScaleUnitsToPoints;
-    float yScaleUnitsToPoints;
-
-    float xScalePixelsToUnits;
-    float yScalePixelsToUnits;
-
-    le_int32 upem;
-    float xPointSize, yPointSize;
-    float txMat[4];
-
-    float euclidianDistance(float a, float b);
-
-    /* Table format is the same as defined in the truetype spec.
-       Pointer can be NULL (e.g. for Type1 fonts). */
-    TTLayoutTableCache* layoutTables;
-
-public:
-    FontInstanceAdapter(JNIEnv *env,
-                        jobject theFont2D, jobject theFontStrike,
-                        float *matrix, le_int32 xRes, le_int32 yRes,
-                        le_int32 theUPEM, TTLayoutTableCache *ltables);
-
-    virtual ~FontInstanceAdapter() { };
-
-    virtual const LEFontInstance *getSubFont(const LEUnicode chars[],
-                            le_int32 *offset, le_int32 limit,
-                            le_int32 script, LEErrorCode &success) const {
-      return this;
-    }
-
-    // tables are cached with the native font scaler data
-    // only supports gsub, gpos, gdef, mort tables at present
-    virtual const void *getFontTable(LETag tableTag, size_t &len) const;
-
-    virtual void *getKernPairs() const {
-        return layoutTables->kernPairs;
-    }
-    virtual void setKernPairs(void *pairs) const {
-        layoutTables->kernPairs = pairs;
-    }
-
-    virtual le_bool canDisplay(LEUnicode32 ch) const
-    {
-        return  (le_bool)env->CallBooleanMethod(font2D,
-                                                sunFontIDs.canDisplayMID, ch);
-    };
-
-    virtual le_int32 getUnitsPerEM() const {
-       return upem;
-    };
-
-    virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
-
-    virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const;
-
-    virtual void mapCharsToWideGlyphs(const LEUnicode chars[],
-        le_int32 offset, le_int32 count, le_bool reverse,
-        const LECharMapper *mapper, le_uint32 glyphs[]) const;
-
-    virtual le_uint32 mapCharToWideGlyph(LEUnicode32 ch,
-        const LECharMapper *mapper) const;
-
-    virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const;
-
-    virtual void getKerningAdjustment(LEPoint &adjustment) const;
-
-    virtual void getWideGlyphAdvance(le_uint32 glyph, LEPoint &advance) const;
-
-    virtual le_bool getGlyphPoint(LEGlyphID glyph,
-        le_int32 pointNumber, LEPoint &point) const;
-
-    float getXPixelsPerEm() const
-    {
-        return xppem;
-    };
-
-    float getYPixelsPerEm() const
-    {
-        return yppem;
-    };
-
-    float xUnitsToPoints(float xUnits) const
-    {
-        return xUnits * xScaleUnitsToPoints;
-    };
-
-    float yUnitsToPoints(float yUnits) const
-    {
-        return yUnits * yScaleUnitsToPoints;
-    };
-
-    void unitsToPoints(LEPoint &units, LEPoint &points) const
-    {
-        points.fX = xUnitsToPoints(units.fX);
-        points.fY = yUnitsToPoints(units.fY);
-    }
-
-    float xPixelsToUnits(float xPixels) const
-    {
-        return xPixels * xScalePixelsToUnits;
-    };
-
-    float yPixelsToUnits(float yPixels) const
-    {
-        return yPixels * yScalePixelsToUnits;
-    };
-
-    void pixelsToUnits(LEPoint &pixels, LEPoint &units) const
-    {
-        units.fX = xPixelsToUnits(pixels.fX);
-        units.fY = yPixelsToUnits(pixels.fY);
-    };
-
-    virtual float getScaleFactorX() const {