Merge
authorjwilhelm
Fri, 13 Jan 2017 18:26:33 +0100
changeset 43530 f444d3f438dd
parent 43066 bc2234c64fbd (diff)
parent 43528 977dab1b9ce9 (current diff)
child 43531 c31f3ca41bd8
Merge
--- a/.hgtags	Mon Jan 09 15:10:25 2017 +0100
+++ b/.hgtags	Fri Jan 13 18:26:33 2017 +0100
@@ -393,3 +393,4 @@
 5c71ea43933b6c7e8a85eb1a4eb2213011b95d82 jdk-9+148
 cf139f925da04c8bd7efd33270a0315d72b338d3 jdk-9+149
 17469f16fbb406ec9f0dd262ce776ab6efbc38f1 jdk-9+150
+37b95df0042ae0687324e1f7dc4a2519e230e704 jdk-9+151
--- a/.hgtags-top-repo	Mon Jan 09 15:10:25 2017 +0100
+++ b/.hgtags-top-repo	Fri Jan 13 18:26:33 2017 +0100
@@ -393,3 +393,4 @@
 3ffc3e886c74736e387f3685e86b557cdea706c8 jdk-9+148
 b119012d1c2ab2570fe8718633840d0c1f1f441d jdk-9+149
 6234069ff9789f7582e1faa32cb6283cbd1a5a2d jdk-9+150
+71a766d4c18041a7f833ee22823125b02e1a7f1e jdk-9+151
--- a/common/autoconf/flags.m4	Mon Jan 09 15:10:25 2017 +0100
+++ b/common/autoconf/flags.m4	Fri Jan 13 18:26:33 2017 +0100
@@ -147,15 +147,6 @@
   EXTRA_CXXFLAGS="$with_extra_cxxflags"
   EXTRA_LDFLAGS="$with_extra_ldflags"
 
-  # Hotspot needs these set in their legacy form
-  LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $EXTRA_CFLAGS"
-  LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $EXTRA_CXXFLAGS"
-  LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $EXTRA_LDFLAGS"
-
-  AC_SUBST(LEGACY_EXTRA_CFLAGS)
-  AC_SUBST(LEGACY_EXTRA_CXXFLAGS)
-  AC_SUBST(LEGACY_EXTRA_LDFLAGS)
-
   AC_SUBST(EXTRA_CFLAGS)
   AC_SUBST(EXTRA_CXXFLAGS)
   AC_SUBST(EXTRA_LDFLAGS)
@@ -192,10 +183,6 @@
       $1SYSROOT_CFLAGS="-isysroot [$]$1SYSROOT"
       $1SYSROOT_LDFLAGS="-isysroot [$]$1SYSROOT"
     fi
-    # Propagate the sysroot args to hotspot
-    $1LEGACY_EXTRA_CFLAGS="[$]$1LEGACY_EXTRA_CFLAGS [$]$1SYSROOT_CFLAGS"
-    $1LEGACY_EXTRA_CXXFLAGS="[$]$1LEGACY_EXTRA_CXXFLAGS [$]$1SYSROOT_CFLAGS"
-    $1LEGACY_EXTRA_LDFLAGS="[$]$1LEGACY_EXTRA_LDFLAGS [$]$1SYSROOT_LDFLAGS"
     # The global CFLAGS and LDFLAGS variables need these for configure to function
     $1CFLAGS="[$]$1CFLAGS [$]$1SYSROOT_CFLAGS"
     $1CPPFLAGS="[$]$1CPPFLAGS [$]$1SYSROOT_CFLAGS"
--- a/common/autoconf/generated-configure.sh	Mon Jan 09 15:10:25 2017 +0100
+++ b/common/autoconf/generated-configure.sh	Fri Jan 13 18:26:33 2017 +0100
@@ -854,9 +854,6 @@
 EXTRA_LDFLAGS
 EXTRA_CXXFLAGS
 EXTRA_CFLAGS
-LEGACY_EXTRA_LDFLAGS
-LEGACY_EXTRA_CXXFLAGS
-LEGACY_EXTRA_CFLAGS
 EXE_SUFFIX
 OBJ_SUFFIX
 STATIC_LIBRARY
@@ -5170,7 +5167,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1482828098
+DATE_WHEN_GENERATED=1483542685
 
 ###############################################################################
 #
@@ -31290,8 +31287,6 @@
       as_fn_error $? "--enable-static-build is only supported for macosx builds" "$LINENO" 5
     fi
     STATIC_BUILD_CFLAGS="-DSTATIC_BUILD=1"
-    LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $STATIC_BUILD_CFLAGS"
-    LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $STATIC_BUILD_CFLAGS"
     CFLAGS_JDKLIB_EXTRA="$CFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
     CXXFLAGS_JDKLIB_EXTRA="$CXXFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
     STATIC_BUILD=true
@@ -31493,15 +31488,6 @@
   EXTRA_CXXFLAGS="$with_extra_cxxflags"
   EXTRA_LDFLAGS="$with_extra_ldflags"
 
-  # Hotspot needs these set in their legacy form
-  LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $EXTRA_CFLAGS"
-  LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $EXTRA_CXXFLAGS"
-  LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $EXTRA_LDFLAGS"
-
-
-
-
-
 
 
 
@@ -31533,10 +31519,6 @@
       SYSROOT_CFLAGS="-isysroot $SYSROOT"
       SYSROOT_LDFLAGS="-isysroot $SYSROOT"
     fi
-    # Propagate the sysroot args to hotspot
-    LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $SYSROOT_CFLAGS"
-    LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $SYSROOT_CFLAGS"
-    LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $SYSROOT_LDFLAGS"
     # The global CFLAGS and LDFLAGS variables need these for configure to function
     CFLAGS="$CFLAGS $SYSROOT_CFLAGS"
     CPPFLAGS="$CPPFLAGS $SYSROOT_CFLAGS"
@@ -44053,10 +44035,6 @@
       BUILD_SYSROOT_CFLAGS="-isysroot $BUILD_SYSROOT"
       BUILD_SYSROOT_LDFLAGS="-isysroot $BUILD_SYSROOT"
     fi
-    # Propagate the sysroot args to hotspot
-    BUILD_LEGACY_EXTRA_CFLAGS="$BUILD_LEGACY_EXTRA_CFLAGS $BUILD_SYSROOT_CFLAGS"
-    BUILD_LEGACY_EXTRA_CXXFLAGS="$BUILD_LEGACY_EXTRA_CXXFLAGS $BUILD_SYSROOT_CFLAGS"
-    BUILD_LEGACY_EXTRA_LDFLAGS="$BUILD_LEGACY_EXTRA_LDFLAGS $BUILD_SYSROOT_LDFLAGS"
     # The global CFLAGS and LDFLAGS variables need these for configure to function
     BUILD_CFLAGS="$BUILD_CFLAGS $BUILD_SYSROOT_CFLAGS"
     BUILD_CPPFLAGS="$BUILD_CPPFLAGS $BUILD_SYSROOT_CFLAGS"
@@ -52779,9 +52757,8 @@
 $as_echo "yes" >&6; }
       GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline"
       GCOV_LDFLAGS="-fprofile-arcs"
-      LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $GCOV_CFLAGS"
-      LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $GCOV_CFLAGS"
-      LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $GCOV_LDFLAGS"
+      JVM_CFLAGS="$JVM_CFLAGS $GCOV_CFLAGS"
+      JVM_LDFLAGS="$JVM_LDFLAGS $GCOV_LDFLAGS"
       CFLAGS_JDKLIB="$CFLAGS_JDKLIB $GCOV_CFLAGS"
       CFLAGS_JDKEXE="$CFLAGS_JDKEXE $GCOV_CFLAGS"
       CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $GCOV_CFLAGS"
@@ -52982,7 +52959,7 @@
 $as_echo "no, forced" >&6; }
     BUILD_GTEST="false"
   elif test "x$enable_hotspot_gtest" = "x"; then
-    if test "x$GTEST_DIR_EXISTS" = "xtrue" && test "x$OPENJDK_TARGET_OS" != "xaix"; then
+    if test "x$GTEST_DIR_EXISTS" = "xtrue"; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
       BUILD_GTEST="true"
--- a/common/autoconf/jdk-options.m4	Mon Jan 09 15:10:25 2017 +0100
+++ b/common/autoconf/jdk-options.m4	Fri Jan 13 18:26:33 2017 +0100
@@ -320,9 +320,8 @@
       AC_MSG_RESULT([yes])
       GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline"
       GCOV_LDFLAGS="-fprofile-arcs"
-      LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $GCOV_CFLAGS"
-      LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $GCOV_CFLAGS"
-      LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $GCOV_LDFLAGS"
+      JVM_CFLAGS="$JVM_CFLAGS $GCOV_CFLAGS"
+      JVM_LDFLAGS="$JVM_LDFLAGS $GCOV_LDFLAGS"
       CFLAGS_JDKLIB="$CFLAGS_JDKLIB $GCOV_CFLAGS"
       CFLAGS_JDKEXE="$CFLAGS_JDKEXE $GCOV_CFLAGS"
       CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $GCOV_CFLAGS"
@@ -360,8 +359,6 @@
       AC_MSG_ERROR([--enable-static-build is only supported for macosx builds])
     fi
     STATIC_BUILD_CFLAGS="-DSTATIC_BUILD=1"
-    LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $STATIC_BUILD_CFLAGS"
-    LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $STATIC_BUILD_CFLAGS"
     CFLAGS_JDKLIB_EXTRA="$CFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
     CXXFLAGS_JDKLIB_EXTRA="$CXXFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
     STATIC_BUILD=true
--- a/common/conf/jib-profiles.js	Mon Jan 09 15:10:25 2017 +0100
+++ b/common/conf/jib-profiles.js	Fri Jan 13 18:26:33 2017 +0100
@@ -263,6 +263,7 @@
         labels: "open"
     };
 
+    common.configure_args_64bit = ["--with-target-bits=64"];
     common.configure_args_32bit = ["--with-target-bits=32"];
 
     /**
@@ -419,7 +420,7 @@
             target_os: "linux",
             target_cpu: "x64",
             dependencies: ["devkit"],
-            configure_args: ["--with-zlib=system"],
+            configure_args: concat(common.configure_args_64bit, "--with-zlib=system"),
             default_make_targets: ["docs-bundles"],
         },
 
@@ -436,27 +437,30 @@
             target_os: "macosx",
             target_cpu: "x64",
             dependencies: ["devkit"],
-            configure_args: concat(common.configure_args, "--with-zlib=system"),
+            configure_args: concat(common.configure_args_64bit, "--with-zlib=system"),
         },
 
         "solaris-x64": {
             target_os: "solaris",
             target_cpu: "x64",
             dependencies: ["devkit", "cups"],
-            configure_args: ["--with-zlib=system", "--enable-dtrace"],
+            configure_args: concat(common.configure_args_64bit,
+                "--with-zlib=system", "--enable-dtrace"),
         },
 
         "solaris-sparcv9": {
             target_os: "solaris",
             target_cpu: "sparcv9",
             dependencies: ["devkit", "cups"],
-            configure_args: ["--with-zlib=system", "--enable-dtrace"],
+            configure_args: concat(common.configure_args_64bit,
+                "--with-zlib=system", "--enable-dtrace"),
         },
 
         "windows-x64": {
             target_os: "windows",
             target_cpu: "x64",
             dependencies: ["devkit", "freetype"],
+            configure_args: concat(common.configure_args_64bit),
         },
 
         "windows-x86": {
@@ -518,11 +522,11 @@
             target_os: "linux",
             target_cpu: "x64",
             dependencies: ["devkit"],
-            configure_args: [
+            configure_args: concat(common.configure_args_64bit, [
                 "--with-zlib=system",
                 "--with-jvm-variants=zero",
                 "--enable-libffi-bundling"
-            ]
+            ])
         },
 
         "linux-x86-zero": {
--- a/corba/.hgtags	Mon Jan 09 15:10:25 2017 +0100
+++ b/corba/.hgtags	Fri Jan 13 18:26:33 2017 +0100
@@ -393,3 +393,4 @@
 f95cc86b6ac22ec1ade5d4f825dc7782adeea228 jdk-9+148
 00b19338e505690abe93d5995ed74a473d969c2c jdk-9+149
 9205e980062a5c4530b51021c6e274025f4ccbdf jdk-9+150
+77f827f5bbad3ef795664bc675f72d98d156b9f8 jdk-9+151
--- a/hotspot/.hgtags	Mon Jan 09 15:10:25 2017 +0100
+++ b/hotspot/.hgtags	Fri Jan 13 18:26:33 2017 +0100
@@ -553,3 +553,4 @@
 5e4e893520ecdbd517c6ed6375f0885664fe62c4 jdk-9+148
 30e1996bd55da36183434f24ed964adebf9ca71e jdk-9+149
 98fe046473c90204cbc9b34c512b9fc10dfb8479 jdk-9+150
+2a2ac7d9f52c8cb2b80077e515b5840b947e640c jdk-9+151
--- a/hotspot/make/CopyToExplodedJdk.gmk	Mon Jan 09 15:10:25 2017 +0100
+++ b/hotspot/make/CopyToExplodedJdk.gmk	Fri Jan 13 18:26:33 2017 +0100
@@ -49,6 +49,7 @@
       DEST := $(JDK_OUTPUTDIR)/lib, \
       FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(LIB_TARGETS)), \
       MACRO := link-file-relative, \
+      LOG_ACTION := Creating symlink, \
   ))
 
   TARGETS += $(COPY_LIBS) $(LINK_LIBS)
--- a/jaxp/.hgtags	Mon Jan 09 15:10:25 2017 +0100
+++ b/jaxp/.hgtags	Fri Jan 13 18:26:33 2017 +0100
@@ -393,3 +393,4 @@
 c45db75bfe8bc20bb80b4a009ae3f69c9cd2d885 jdk-9+148
 5978df8bfa3894f2b3d07b7256f25f78dffb1f9c jdk-9+149
 f85154af719f99a3b4d81b67a8b4c18a650d10f9 jdk-9+150
+13c6906bfc861d99dc35a19c80b7a99f0b0ac58d jdk-9+151
--- a/jaxws/.hgtags	Mon Jan 09 15:10:25 2017 +0100
+++ b/jaxws/.hgtags	Fri Jan 13 18:26:33 2017 +0100
@@ -396,3 +396,4 @@
 c8c9c334743caf8155c9809b6b4ac315d3a66476 jdk-9+148
 72554d319b474b3636c7d02fe3c110254d111b1a jdk-9+149
 77e4e30d9d111272cd4a45a2203e8f570d40b12e jdk-9+150
+c48b4d4768b1c2b8fe5d1a844ca13732e5dfbe2a jdk-9+151
--- a/jdk/src/java.base/share/classes/java/lang/Class.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -2477,7 +2477,7 @@
      * <ul>
      *
      * <li> If the {@code name} begins with a {@code '/'}
-     * (<tt>'&#92;u002f'</tt>), then the absolute name of the resource is the
+     * (<code>'&#92;u002f'</code>), then the absolute name of the resource is the
      * portion of the {@code name} following the {@code '/'}.
      *
      * <li> Otherwise, the absolute name is of the following form:
@@ -2488,7 +2488,7 @@
      *
      * <p> Where the {@code modified_package_name} is the package name of this
      * object with {@code '/'} substituted for {@code '.'}
-     * (<tt>'&#92;u002e'</tt>).
+     * (<code>'&#92;u002e'</code>).
      *
      * </ul>
      *
@@ -2570,7 +2570,7 @@
      * <ul>
      *
      * <li> If the {@code name} begins with a {@code '/'}
-     * (<tt>'&#92;u002f'</tt>), then the absolute name of the resource is the
+     * (<code>'&#92;u002f'</code>), then the absolute name of the resource is the
      * portion of the {@code name} following the {@code '/'}.
      *
      * <li> Otherwise, the absolute name is of the following form:
@@ -2581,7 +2581,7 @@
      *
      * <p> Where the {@code modified_package_name} is the package name of this
      * object with {@code '/'} substituted for {@code '.'}
-     * (<tt>'&#92;u002e'</tt>).
+     * (<code>'&#92;u002e'</code>).
      *
      * </ul>
      *
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,34 +70,34 @@
 
 /**
  * A class loader is an object that is responsible for loading classes. The
- * class <tt>ClassLoader</tt> is an abstract class.  Given the <a
+ * class {@code ClassLoader} is an abstract class.  Given the <a
  * href="#name">binary name</a> of a class, a class loader should attempt to
  * locate or generate data that constitutes a definition for the class.  A
  * typical strategy is to transform the name into a file name and then read a
  * "class file" of that name from a file system.
  *
- * <p> Every {@link Class <tt>Class</tt>} object contains a {@link
- * Class#getClassLoader() reference} to the <tt>ClassLoader</tt> that defined
+ * <p> Every {@link java.lang.Class Class} object contains a {@link
+ * Class#getClassLoader() reference} to the {@code ClassLoader} that defined
  * it.
  *
- * <p> <tt>Class</tt> objects for array classes are not created by class
+ * <p> {@code Class} objects for array classes are not created by class
  * loaders, but are created automatically as required by the Java runtime.
  * The class loader for an array class, as returned by {@link
  * Class#getClassLoader()} is the same as the class loader for its element
  * type; if the element type is a primitive type, then the array class has no
  * class loader.
  *
- * <p> Applications implement subclasses of <tt>ClassLoader</tt> in order to
+ * <p> Applications implement subclasses of {@code ClassLoader} in order to
  * extend the manner in which the Java virtual machine dynamically loads
  * classes.
  *
  * <p> Class loaders may typically be used by security managers to indicate
  * security domains.
  *
- * <p> The <tt>ClassLoader</tt> class uses a delegation model to search for
- * classes and resources.  Each instance of <tt>ClassLoader</tt> has an
+ * <p> The {@code ClassLoader} class uses a delegation model to search for
+ * classes and resources.  Each instance of {@code ClassLoader} has an
  * associated parent class loader.  When requested to find a class or
- * resource, a <tt>ClassLoader</tt> instance will delegate the search for the
+ * resource, a {@code ClassLoader} instance will delegate the search for the
  * class or resource to its parent class loader before attempting to find the
  * class or resource itself.
  *
@@ -105,15 +105,15 @@
  * <em>{@linkplain #isRegisteredAsParallelCapable() parallel capable}</em> class
  * loaders and are required to register themselves at their class initialization
  * time by invoking the {@link
- * #registerAsParallelCapable <tt>ClassLoader.registerAsParallelCapable</tt>}
- * method. Note that the <tt>ClassLoader</tt> class is registered as parallel
+ * #registerAsParallelCapable ClassLoader.registerAsParallelCapable}
+ * method. Note that the {@code ClassLoader} class is registered as parallel
  * capable by default. However, its subclasses still need to register themselves
  * if they are parallel capable.
  * In environments in which the delegation model is not strictly
  * hierarchical, class loaders need to be parallel capable, otherwise class
  * loading can lead to deadlocks because the loader lock is held for the
  * duration of the class loading process (see {@link #loadClass
- * <tt>loadClass</tt>} methods).
+ * loadClass} methods).
  *
  * <h3> <a name="builtinLoaders">Run-time Built-in Class Loaders</a></h3>
  *
@@ -143,13 +143,13 @@
  * However, some classes may not originate from a file; they may originate
  * from other sources, such as the network, or they could be constructed by an
  * application.  The method {@link #defineClass(String, byte[], int, int)
- * <tt>defineClass</tt>} converts an array of bytes into an instance of class
- * <tt>Class</tt>. Instances of this newly defined class can be created using
- * {@link Class#newInstance <tt>Class.newInstance</tt>}.
+ * defineClass} converts an array of bytes into an instance of class
+ * {@code Class}. Instances of this newly defined class can be created using
+ * {@link Class#newInstance Class.newInstance}.
  *
  * <p> The methods and constructors of objects created by a class loader may
  * reference other classes.  To determine the class(es) referred to, the Java
- * virtual machine invokes the {@link #loadClass <tt>loadClass</tt>} method of
+ * virtual machine invokes the {@link #loadClass loadClass} method of
  * the class loader that originally created the class.
  *
  * <p> For example, an application could create a network class loader to
@@ -162,9 +162,9 @@
  * </pre></blockquote>
  *
  * <p> The network class loader subclass must define the methods {@link
- * #findClass <tt>findClass</tt>} and <tt>loadClassData</tt> to load a class
+ * #findClass findClass} and {@code loadClassData} to load a class
  * from the network.  Once it has downloaded the bytes that make up the class,
- * it should use the method {@link #defineClass <tt>defineClass</tt>} to
+ * it should use the method {@link #defineClass defineClass} to
  * create a class instance.  A sample implementation is:
  *
  * <blockquote><pre>
@@ -392,7 +392,7 @@
      *
      * <p> If there is a security manager, its {@link
      * SecurityManager#checkCreateClassLoader()
-     * <tt>checkCreateClassLoader</tt>} method is invoked.  This may result in
+     * checkCreateClassLoader} method is invoked.  This may result in
      * a security exception.  </p>
      *
      * @param  parent
@@ -400,7 +400,7 @@
      *
      * @throws  SecurityException
      *          If a security manager exists and its
-     *          <tt>checkCreateClassLoader</tt> method doesn't allow creation
+     *          {@code checkCreateClassLoader} method doesn't allow creation
      *          of a new class loader.
      *
      * @since  1.2
@@ -410,18 +410,18 @@
     }
 
     /**
-     * Creates a new class loader using the <tt>ClassLoader</tt> returned by
+     * Creates a new class loader using the {@code ClassLoader} returned by
      * the method {@link #getSystemClassLoader()
-     * <tt>getSystemClassLoader()</tt>} as the parent class loader.
+     * getSystemClassLoader()} as the parent class loader.
      *
      * <p> If there is a security manager, its {@link
      * SecurityManager#checkCreateClassLoader()
-     * <tt>checkCreateClassLoader</tt>} method is invoked.  This may result in
+     * checkCreateClassLoader} method is invoked.  This may result in
      * a security exception.  </p>
      *
      * @throws  SecurityException
      *          If a security manager exists and its
-     *          <tt>checkCreateClassLoader</tt> method doesn't allow creation
+     *          {@code checkCreateClassLoader} method doesn't allow creation
      *          of a new class loader.
      */
     protected ClassLoader() {
@@ -458,13 +458,13 @@
      * This method searches for classes in the same manner as the {@link
      * #loadClass(String, boolean)} method.  It is invoked by the Java virtual
      * machine to resolve class references.  Invoking this method is equivalent
-     * to invoking {@link #loadClass(String, boolean) <tt>loadClass(name,
-     * false)</tt>}.
+     * to invoking {@link #loadClass(String, boolean) loadClass(name,
+     * false)}.
      *
      * @param  name
      *         The <a href="#name">binary name</a> of the class
      *
-     * @return  The resulting <tt>Class</tt> object
+     * @return  The resulting {@code Class} object
      *
      * @throws  ClassNotFoundException
      *          If the class was not found
@@ -483,8 +483,8 @@
      *   <li><p> Invoke {@link #findLoadedClass(String)} to check if the class
      *   has already been loaded.  </p></li>
      *
-     *   <li><p> Invoke the {@link #loadClass(String) <tt>loadClass</tt>} method
-     *   on the parent class loader.  If the parent is <tt>null</tt> the class
+     *   <li><p> Invoke the {@link #loadClass(String) loadClass} method
+     *   on the parent class loader.  If the parent is {@code null} the class
      *   loader built-in to the virtual machine is used, instead.  </p></li>
      *
      *   <li><p> Invoke the {@link #findClass(String)} method to find the
@@ -493,23 +493,23 @@
      * </ol>
      *
      * <p> If the class was found using the above steps, and the
-     * <tt>resolve</tt> flag is true, this method will then invoke the {@link
-     * #resolveClass(Class)} method on the resulting <tt>Class</tt> object.
+     * {@code resolve} flag is true, this method will then invoke the {@link
+     * #resolveClass(Class)} method on the resulting {@code Class} object.
      *
-     * <p> Subclasses of <tt>ClassLoader</tt> are encouraged to override {@link
+     * <p> Subclasses of {@code ClassLoader} are encouraged to override {@link
      * #findClass(String)}, rather than this method.  </p>
      *
      * <p> Unless overridden, this method synchronizes on the result of
-     * {@link #getClassLoadingLock <tt>getClassLoadingLock</tt>} method
+     * {@link #getClassLoadingLock getClassLoadingLock} method
      * during the entire class loading process.
      *
      * @param  name
      *         The <a href="#name">binary name</a> of the class
      *
      * @param  resolve
-     *         If <tt>true</tt> then resolve the class
+     *         If {@code true} then resolve the class
      *
-     * @return  The resulting <tt>Class</tt> object
+     * @return  The resulting {@code Class} object
      *
      * @throws  ClassNotFoundException
      *          If the class could not be found
@@ -606,7 +606,7 @@
      * @return the lock for class loading operations
      *
      * @throws NullPointerException
-     *         If registered as parallel capable and <tt>className</tt> is null
+     *         If registered as parallel capable and {@code className} is null
      *
      * @see #loadClass(String, boolean)
      *
@@ -667,14 +667,14 @@
      * Finds the class with the specified <a href="#name">binary name</a>.
      * This method should be overridden by class loader implementations that
      * follow the delegation model for loading classes, and will be invoked by
-     * the {@link #loadClass <tt>loadClass</tt>} method after checking the
+     * the {@link #loadClass loadClass} method after checking the
      * parent class loader for the requested class.  The default implementation
-     * throws a <tt>ClassNotFoundException</tt>.
+     * throws a {@code ClassNotFoundException}.
      *
      * @param  name
      *         The <a href="#name">binary name</a> of the class
      *
-     * @return  The resulting <tt>Class</tt> object
+     * @return  The resulting {@code Class} object
      *
      * @throws  ClassNotFoundException
      *          If the class could not be found
@@ -722,32 +722,32 @@
 
 
     /**
-     * Converts an array of bytes into an instance of class <tt>Class</tt>.
-     * Before the <tt>Class</tt> can be used it must be resolved.  This method
+     * Converts an array of bytes into an instance of class {@code Class}.
+     * Before the {@code Class} can be used it must be resolved.  This method
      * is deprecated in favor of the version that takes a <a
      * href="#name">binary name</a> as its first argument, and is more secure.
      *
      * @param  b
      *         The bytes that make up the class data.  The bytes in positions
-     *         <tt>off</tt> through <tt>off+len-1</tt> should have the format
+     *         {@code off} through {@code off+len-1} should have the format
      *         of a valid class file as defined by
      *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @param  off
-     *         The start offset in <tt>b</tt> of the class data
+     *         The start offset in {@code b} of the class data
      *
      * @param  len
      *         The length of the class data
      *
-     * @return  The <tt>Class</tt> object that was created from the specified
+     * @return  The {@code Class} object that was created from the specified
      *          class data
      *
      * @throws  ClassFormatError
      *          If the data did not contain a valid class
      *
      * @throws  IndexOutOfBoundsException
-     *          If either <tt>off</tt> or <tt>len</tt> is negative, or if
-     *          <tt>off+len</tt> is greater than <tt>b.length</tt>.
+     *          If either {@code off} or {@code len} is negative, or if
+     *          {@code off+len} is greater than {@code b.length}.
      *
      * @throws  SecurityException
      *          If an attempt is made to add this class to a package that
@@ -994,11 +994,11 @@
      * #defineClass(String, byte[], int, int, ProtectionDomain)}.
      *
      * <p> An invocation of this method of the form
-     * <i>cl</i><tt>.defineClass(</tt><i>name</i><tt>,</tt>
-     * <i>bBuffer</i><tt>,</tt> <i>pd</i><tt>)</tt> yields exactly the same
+     * <i>cl</i>{@code .defineClass(}<i>name</i>{@code ,}
+     * <i>bBuffer</i>{@code ,} <i>pd</i>{@code )} yields exactly the same
      * result as the statements
      *
-     *<p> <tt>
+     *<p> <code>
      * ...<br>
      * byte[] temp = new byte[bBuffer.{@link
      * java.nio.ByteBuffer#remaining remaining}()];<br>
@@ -1007,16 +1007,16 @@
      *     return {@link #defineClass(String, byte[], int, int, ProtectionDomain)
      * cl.defineClass}(name, temp, 0,
      * temp.length, pd);<br>
-     * </tt></p>
+     * </code></p>
      *
      * @param  name
      *         The expected <a href="#name">binary name</a>. of the class, or
-     *         <tt>null</tt> if not known
+     *         {@code null} if not known
      *
      * @param  b
      *         The bytes that make up the class data. The bytes from positions
-     *         <tt>b.position()</tt> through <tt>b.position() + b.limit() -1
-     *         </tt> should have the format of a valid class file as defined by
+     *         {@code b.position()} through {@code b.position() + b.limit() -1
+     *         } should have the format of a valid class file as defined by
      *         <cite>The Java&trade; Virtual Machine Specification</cite>.
      *
      * @param  protectionDomain
@@ -1158,7 +1158,7 @@
 
     /**
      * Links the specified class.  This (misleadingly named) method may be
-     * used by a class loader to link a class.  If the class <tt>c</tt> has
+     * used by a class loader to link a class.  If the class {@code c} has
      * already been linked, then this method simply returns. Otherwise, the
      * class is linked as described in the "Execution" chapter of
      * <cite>The Java&trade; Language Specification</cite>.
@@ -1167,7 +1167,7 @@
      *         The class to link
      *
      * @throws  NullPointerException
-     *          If <tt>c</tt> is <tt>null</tt>.
+     *          If {@code c} is {@code null}.
      *
      * @see  #defineClass(String, byte[], int, int)
      */
@@ -1182,16 +1182,16 @@
      * loading it if necessary.
      *
      * <p> This method loads the class through the system class loader (see
-     * {@link #getSystemClassLoader()}).  The <tt>Class</tt> object returned
-     * might have more than one <tt>ClassLoader</tt> associated with it.
-     * Subclasses of <tt>ClassLoader</tt> need not usually invoke this method,
+     * {@link #getSystemClassLoader()}).  The {@code Class} object returned
+     * might have more than one {@code ClassLoader} associated with it.
+     * Subclasses of {@code ClassLoader} need not usually invoke this method,
      * because most class loaders need to override just {@link
      * #findClass(String)}.  </p>
      *
      * @param  name
      *         The <a href="#name">binary name</a> of the class
      *
-     * @return  The <tt>Class</tt> object for the specified <tt>name</tt>
+     * @return  The {@code Class} object for the specified {@code name}
      *
      * @throws  ClassNotFoundException
      *          If the class could not be found
@@ -1222,12 +1222,12 @@
      * Returns the class with the given <a href="#name">binary name</a> if this
      * loader has been recorded by the Java virtual machine as an initiating
      * loader of a class with that <a href="#name">binary name</a>.  Otherwise
-     * <tt>null</tt> is returned.
+     * {@code null} is returned.
      *
      * @param  name
      *         The <a href="#name">binary name</a> of the class
      *
-     * @return  The <tt>Class</tt> object, or <tt>null</tt> if the class has
+     * @return  The {@code Class} object, or {@code null} if the class has
      *          not been loaded
      *
      * @since  1.1
@@ -1245,7 +1245,7 @@
      * class.
      *
      * @param  c
-     *         The <tt>Class</tt> object
+     *         The {@code Class} object
      *
      * @param  signers
      *         The signers for the class
@@ -1306,11 +1306,11 @@
      * (images, audio, text, etc) that can be accessed by class code in a way
      * that is independent of the location of the code.
      *
-     * <p> The name of a resource is a '<tt>/</tt>'-separated path name that
+     * <p> The name of a resource is a '{@code /}'-separated path name that
      * identifies the resource.
      *
      * <p> This method will first search the parent class loader for the
-     * resource; if the parent is <tt>null</tt> the path of the class loader
+     * resource; if the parent is {@code null} the path of the class loader
      * built-in to the virtual machine is searched.  That failing, this method
      * will invoke {@link #findResource(String)} to find the resource.  </p>
      *
@@ -1362,7 +1362,7 @@
      * (images, audio, text, etc) that can be accessed by class code in a way
      * that is independent of the location of the code.
      *
-     * <p> The name of a resource is a <tt>/</tt>-separated path name that
+     * <p> The name of a resource is a {@code /}-separated path name that
      * identifies the resource.
      *
      * <p> The delegation order for searching is described in the documentation
@@ -1389,7 +1389,7 @@
      * @param  name
      *         The resource name
      *
-     * @return  An enumeration of {@link java.net.URL <tt>URL</tt>} objects for
+     * @return  An enumeration of {@link java.net.URL URL} objects for
      *          the resource. If no resources could  be found, the enumeration
      *          will be empty. Resources for which a {@code URL} cannot be
      *          constructed, are in package that is not opened unconditionally,
@@ -1505,7 +1505,7 @@
     }
 
     /**
-     * Returns an enumeration of {@link java.net.URL <tt>URL</tt>} objects
+     * Returns an enumeration of {@link java.net.URL URL} objects
      * representing all the resources with the given name. Class loader
      * implementations should override this method to specify where to load
      * resources from.
@@ -1520,7 +1520,7 @@
      * @param  name
      *         The resource name
      *
-     * @return  An enumeration of {@link java.net.URL <tt>URL</tt>} objects for
+     * @return  An enumeration of {@link java.net.URL URL} objects for
      *          the resource. If no resources could  be found, the enumeration
      *          will be empty. Resources for which a {@code URL} cannot be
      *          constructed, are in a package that is not opened unconditionally,
@@ -1594,7 +1594,7 @@
      * @param  name
      *         The resource name
      *
-     * @return  A {@link java.net.URL <tt>URL</tt>} to the resource; {@code
+     * @return  A {@link java.net.URL URL} to the resource; {@code
      *          null} if the resource could not be found, a URL could not be
      *          constructed to locate the resource, the resource is in a package
      *          that is not opened unconditionally or access to the resource is
@@ -1609,8 +1609,8 @@
     /**
      * Finds all resources of the specified name from the search path used to
      * load classes.  The resources thus found are returned as an
-     * {@link java.util.Enumeration <tt>Enumeration</tt>} of {@link
-     * java.net.URL <tt>URL</tt>} objects.
+     * {@link java.util.Enumeration Enumeration} of {@link
+     * java.net.URL URL} objects.
      *
      * <p> The search order is described in the documentation for {@link
      * #getSystemResource(String)}.  </p>
@@ -1625,7 +1625,7 @@
      * @param  name
      *         The resource name
      *
-     * @return  An enumeration of {@link java.net.URL <tt>URL</tt>} objects for
+     * @return  An enumeration of {@link java.net.URL URL} objects for
      *          the resource. If no resources could  be found, the enumeration
      *          will be empty. Resources for which a {@code URL} cannot be
      *          constructed, are in a package that is not opened unconditionally,
@@ -1714,11 +1714,11 @@
 
     /**
      * Returns the parent class loader for delegation. Some implementations may
-     * use <tt>null</tt> to represent the bootstrap class loader. This method
-     * will return <tt>null</tt> in such implementations if this class loader's
+     * use {@code null} to represent the bootstrap class loader. This method
+     * will return {@code null} in such implementations if this class loader's
      * parent is the bootstrap class loader.
      *
-     * @return  The parent <tt>ClassLoader</tt>
+     * @return  The parent {@code ClassLoader}
      *
      * @throws  SecurityException
      *          If a security manager is present, and the caller's class loader
@@ -1785,7 +1785,7 @@
 
     /**
      * Returns the system class loader for delegation.  This is the default
-     * delegation parent for new <tt>ClassLoader</tt> instances, and is
+     * delegation parent for new {@code ClassLoader} instances, and is
      * typically the class loader used to start the application.
      *
      * <p> This method is first invoked early in the runtime's startup
@@ -1797,12 +1797,12 @@
      * <p> The default system class loader is an implementation-dependent
      * instance of this class.
      *
-     * <p> If the system property "<tt>java.system.class.loader</tt>" is defined
+     * <p> If the system property "{@code java.system.class.loader}" is defined
      * when this method is first invoked then the value of that property is
      * taken to be the name of a class that will be returned as the system
      * class loader.  The class is loaded using the default system class loader
      * and must define a public constructor that takes a single parameter of
-     * type <tt>ClassLoader</tt> which is used as the delegation parent.  An
+     * type {@code ClassLoader} which is used as the delegation parent.  An
      * instance is then created using this constructor with the default system
      * class loader as the parameter.  The resulting class loader is defined
      * to be the system class loader. During construction, the class loader
@@ -1825,7 +1825,7 @@
      * the application module path then the class path defaults to
      * the current working directory.
      *
-     * @return  The system <tt>ClassLoader</tt> for delegation
+     * @return  The system {@code ClassLoader} for delegation
      *
      * @throws  SecurityException
      *          If a security manager is present, and the caller's class loader
@@ -1835,11 +1835,11 @@
      *
      * @throws  IllegalStateException
      *          If invoked recursively during the construction of the class
-     *          loader specified by the "<tt>java.system.class.loader</tt>"
+     *          loader specified by the "{@code java.system.class.loader}"
      *          property.
      *
      * @throws  Error
-     *          If the system property "<tt>java.system.class.loader</tt>"
+     *          If the system property "{@code java.system.class.loader}"
      *          is defined but the named class could not be loaded, the
      *          provider class does not define the required constructor, or an
      *          exception is thrown by that constructor when it is invoked. The
@@ -2249,9 +2249,9 @@
     /**
      * Returns the absolute path name of a native library.  The VM invokes this
      * method to locate the native libraries that belong to classes loaded with
-     * this class loader. If this method returns <tt>null</tt>, the VM
+     * this class loader. If this method returns {@code null}, the VM
      * searches the library along the path specified as the
-     * "<tt>java.library.path</tt>" property.
+     * "{@code java.library.path}" property.
      *
      * @param  libname
      *         The library name
@@ -2270,12 +2270,12 @@
     /**
      * The inner class NativeLibrary denotes a loaded native library instance.
      * Every classloader contains a vector of loaded native libraries in the
-     * private field <tt>nativeLibraries</tt>.  The native libraries loaded
-     * into the system are entered into the <tt>systemNativeLibraries</tt>
+     * private field {@code nativeLibraries}.  The native libraries loaded
+     * into the system are entered into the {@code systemNativeLibraries}
      * vector.
      *
      * <p> Every native library requires a particular version of JNI. This is
-     * denoted by the private <tt>jniVersion</tt> field.  This field is set by
+     * denoted by the private {@code jniVersion} field.  This field is set by
      * the VM when it loads the library, and used by the VM to pass the correct
      * version of JNI to the native methods.  </p>
      *
@@ -2592,8 +2592,8 @@
      * #setClassAssertionStatus(String, boolean)}.
      *
      * @param  enabled
-     *         <tt>true</tt> if classes loaded by this class loader will
-     *         henceforth have assertions enabled by default, <tt>false</tt>
+     *         {@code true} if classes loaded by this class loader will
+     *         henceforth have assertions enabled by default, {@code false}
      *         if they will have assertions disabled by default.
      *
      * @since  1.4
@@ -2614,16 +2614,16 @@
      * any of its "subpackages".
      *
      * <p> A subpackage of a package named p is any package whose name begins
-     * with "<tt>p.</tt>".  For example, <tt>javax.swing.text</tt> is a
-     * subpackage of <tt>javax.swing</tt>, and both <tt>java.util</tt> and
-     * <tt>java.lang.reflect</tt> are subpackages of <tt>java</tt>.
+     * with "{@code p.}".  For example, {@code javax.swing.text} is a
+     * subpackage of {@code javax.swing}, and both {@code java.util} and
+     * {@code java.lang.reflect} are subpackages of {@code java}.
      *
      * <p> In the event that multiple package defaults apply to a given class,
      * the package default pertaining to the most specific package takes
-     * precedence over the others.  For example, if <tt>javax.lang</tt> and
-     * <tt>javax.lang.reflect</tt> both have package defaults associated with
+     * precedence over the others.  For example, if {@code javax.lang} and
+     * {@code javax.lang.reflect} both have package defaults associated with
      * them, the latter package default applies to classes in
-     * <tt>javax.lang.reflect</tt>.
+     * {@code javax.lang.reflect}.
      *
      * <p> Package defaults take precedence over the class loader's default
      * assertion status, and may be overridden on a per-class basis by invoking
@@ -2631,15 +2631,15 @@
      *
      * @param  packageName
      *         The name of the package whose package default assertion status
-     *         is to be set. A <tt>null</tt> value indicates the unnamed
+     *         is to be set. A {@code null} value indicates the unnamed
      *         package that is "current"
      *         (see section 7.4.2 of
      *         <cite>The Java&trade; Language Specification</cite>.)
      *
      * @param  enabled
-     *         <tt>true</tt> if classes loaded by this classloader and
+     *         {@code true} if classes loaded by this classloader and
      *         belonging to the named package or any of its subpackages will
-     *         have assertions enabled by default, <tt>false</tt> if they will
+     *         have assertions enabled by default, {@code false} if they will
      *         have assertions disabled by default.
      *
      * @since  1.4
@@ -2670,8 +2670,8 @@
      *         assertion status is to be set.
      *
      * @param  enabled
-     *         <tt>true</tt> if the named class is to have assertions
-     *         enabled when (and if) it is initialized, <tt>false</tt> if the
+     *         {@code true} if the named class is to have assertions
+     *         enabled when (and if) it is initialized, {@code false} if the
      *         class is to have assertions disabled.
      *
      * @since  1.4
@@ -2687,7 +2687,7 @@
 
     /**
      * Sets the default assertion status for this class loader to
-     * <tt>false</tt> and discards any package defaults or class assertion
+     * {@code false} and discards any package defaults or class assertion
      * status settings associated with the class loader.  This method is
      * provided so that class loaders can be made to ignore any command line or
      * persistent assertion status settings and "start with a clean slate."
--- a/jdk/src/java.base/share/classes/java/text/ChoiceFormat.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/text/ChoiceFormat.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -172,6 +172,8 @@
     /**
      * Sets the pattern.
      * @param newPattern See the class description.
+     * @exception NullPointerException if {@code newPattern}
+     *            is {@code null}
      */
     public void applyPattern(String newPattern) {
         StringBuffer[] segments = new StringBuffer[2];
@@ -309,6 +311,8 @@
      * Constructs with limits and corresponding formats based on the pattern.
      *
      * @param newPattern the new pattern string
+     * @exception NullPointerExcpetion if {@code newPattern} is
+     *            {@code null}
      * @see #applyPattern
      */
     public ChoiceFormat(String newPattern)  {
@@ -320,6 +324,8 @@
      *
      * @param limits limits in ascending order
      * @param formats corresponding format strings
+     * @exception NullPointerException if {@code limits} or {@code formats}
+     *            is {@code null}
      * @see #setChoices
      */
     public ChoiceFormat(double[] limits, String[] formats) {
@@ -339,6 +345,8 @@
      * When formatting with object Y,
      * if the object is a NumberFormat, then ((NumberFormat) Y).format(X)
      * is called. Otherwise Y.toString() is called.
+     * @exception NullPointerException if {@code limits} or
+     *            {@code formats} is {@code null}
      */
     public void setChoices(double[] limits, String formats[]) {
         if (limits.length != formats.length) {
@@ -386,6 +394,8 @@
      * @param number number to be formatted and substituted.
      * @param toAppendTo where text is appended.
      * @param status ignore no useful status is returned.
+     * @exception NullPointerException if {@code toAppendTo}
+     *            is {@code null}
      */
    public StringBuffer format(double number, StringBuffer toAppendTo,
                                FieldPosition status) {
@@ -414,6 +424,9 @@
      * status.index is unchanged and status.errorIndex is set to the
      * first index of the character that caused the parse to fail.
      * @return A Number representing the value of the number parsed.
+     * @exception NullPointerException if {@code status} is {@code null}
+     *            or if {@code text} is {@code null} and the list of
+     *            choice strings is not empty.
      */
     public Number parse(String text, ParsePosition status) {
         // find the best number (defined as the one with the longest parse)
--- a/jdk/src/java.base/share/classes/java/text/DateFormat.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/text/DateFormat.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -141,6 +141,25 @@
  * If multiple threads access a format concurrently, it must be synchronized
  * externally.
  *
+ * @implSpec
+ * <ul><li>The {@link #format(Date, StringBuffer, FieldPosition)} and
+ * {@link #parse(String, ParsePosition)} methods may throw
+ * {@code NullPointerException}, if any of their parameter is {@code null}.
+ * The subclass may provide its own implementation and specification about
+ * {@code NullPointerException}.</li>
+ * <li>The {@link #setCalendar(Calendar)}, {@link
+ * #setNumberFormat(NumberFormat)} and {@link #setTimeZone(TimeZone)} methods
+ * do not throw {@code NullPointerException} when their parameter is
+ * {@code null}, but any subsequent operations on the same instance may throw
+ * {@code NullPointerException}.</li>
+ * <li>The {@link #getCalendar()}, {@link #getNumberFormat()} and
+ * {@link getTimeZone()} methods may return {@code null}, if the respective
+ * values of this instance is set to {@code null} through the corresponding
+ * setter methods. For Example: {@link #getTimeZone()} may return {@code null},
+ * if the {@code TimeZone} value of this instance is set as
+ * {@link #setTimeZone(java.util.TimeZone) setTimeZone(null)}.</li>
+ * </ul>
+ *
  * @see          Format
  * @see          NumberFormat
  * @see          SimpleDateFormat
@@ -296,6 +315,8 @@
      * the begin index and end index of fieldPosition will be set to
      * 5 and 8, respectively, for the first occurrence of the timezone
      * pattern character 'z'.
+     * @exception IllegalArgumentException if the {@code Format} cannot format
+     *            the given {@code obj}.
      * @see java.text.Format
      */
     public final StringBuffer format(Object obj, StringBuffer toAppendTo,
--- a/jdk/src/java.base/share/classes/java/text/DecimalFormat.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/text/DecimalFormat.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, 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
@@ -514,6 +514,8 @@
      * @param result    where the text is to be appended
      * @param fieldPosition    On input: an alignment field, if desired.
      * On output: the offsets of the alignment field.
+     * @exception NullPointerException if {@code result} or
+     *            {@code fieldPosition} is {@code null}
      * @exception ArithmeticException if rounding is needed with rounding
      *            mode being set to RoundingMode.UNNECESSARY
      * @return The formatted number string
@@ -632,6 +634,8 @@
      * @param result    where the text is to be appended
      * @param fieldPosition    On input: an alignment field, if desired.
      * On output: the offsets of the alignment field.
+     * @exception       NullPointerException if {@code result} or
+     *                  {@code fieldPosition} is {@code null}
      * @exception       ArithmeticException if rounding is needed with rounding
      *                  mode being set to RoundingMode.UNNECESSARY
      * @return The formatted number string
--- a/jdk/src/java.base/share/classes/java/text/MessageFormat.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/text/MessageFormat.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -356,6 +356,8 @@
      *
      * @param pattern the pattern for this message format
      * @exception IllegalArgumentException if the pattern is invalid
+     * @exception NullPointerException if {@code pattern} is
+     *            {@code null}
      */
     public MessageFormat(String pattern) {
         this.locale = Locale.getDefault(Locale.Category.FORMAT);
@@ -373,6 +375,8 @@
      * @param pattern the pattern for this message format
      * @param locale the locale for this message format
      * @exception IllegalArgumentException if the pattern is invalid
+     * @exception NullPointerException if {@code pattern} is
+     *            {@code null}
      * @since 1.4
      */
     public MessageFormat(String pattern, Locale locale) {
@@ -420,6 +424,8 @@
      *
      * @param pattern the pattern for this message format
      * @exception IllegalArgumentException if the pattern is invalid
+     * @exception NullPointerException if {@code pattern} is
+     *            {@code null}
      */
     @SuppressWarnings("fallthrough") // fallthrough in switch is expected, suppress it
     public void applyPattern(String pattern) {
@@ -814,6 +820,7 @@
      * @exception IllegalArgumentException if an argument in the
      *            <code>arguments</code> array is not of the type
      *            expected by the format element(s) that use it.
+     * @exception NullPointerException if {@code result} is {@code null}
      */
     public final StringBuffer format(Object[] arguments, StringBuffer result,
                                      FieldPosition pos)
@@ -835,6 +842,7 @@
      *            or if an argument in the <code>arguments</code> array
      *            is not of the type expected by the format element(s)
      *            that use it.
+     * @exception NullPointerException if {@code pattern} is {@code null}
      */
     public static String format(String pattern, Object ... arguments) {
         MessageFormat temp = new MessageFormat(pattern);
@@ -858,6 +866,7 @@
      * @exception IllegalArgumentException if an argument in the
      *            <code>arguments</code> array is not of the type
      *            expected by the format element(s) that use it.
+     * @exception NullPointerException if {@code result} is {@code null}
      */
     public final StringBuffer format(Object arguments, StringBuffer result,
                                      FieldPosition pos)
@@ -947,6 +956,8 @@
      * @param source the string to parse
      * @param pos    the parse position
      * @return an array of parsed objects
+     * @exception NullPointerException if {@code pos} is {@code null}
+     *            for a non-null {@code source} string.
      */
     public Object[] parse(String source, ParsePosition pos) {
         if (source == null) {
--- a/jdk/src/java.base/share/classes/java/text/NumberFormat.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/text/NumberFormat.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -174,6 +174,13 @@
  * If multiple threads access a format concurrently, it must be synchronized
  * externally.
  *
+ * @implSpec The {@link #format(double, StringBuffer, FieldPosition)},
+ * {@link #format(long, StringBuffer, FieldPosition)} and
+ * {@link #parse(String, ParsePosition)} methods may throw
+ * {@code NullPointerException}, if any of their parameter is {@code null}.
+ * The subclass may provide its own implementation and specification about
+ * {@code NullPointerException}.
+ *
  * @see          DecimalFormat
  * @see          ChoiceFormat
  * @author       Mark Davis
--- a/jdk/src/java.base/share/classes/java/text/SimpleDateFormat.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/src/java.base/share/classes/java/text/SimpleDateFormat.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, 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
@@ -905,6 +905,7 @@
      * @param startDate During parsing, two digit years will be placed in the range
      * <code>startDate</code> to <code>startDate + 100 years</code>.
      * @see #get2DigitYearStart
+     * @throws NullPointerException if {@code startDate} is {@code null}.
      * @since 1.2
      */
     public void set2DigitYearStart(Date startDate) {
@@ -933,7 +934,7 @@
      * @param pos the formatting position. On input: an alignment field,
      * if desired. On output: the offsets of the alignment field.
      * @return the formatted date-time string.
-     * @exception NullPointerException if the given {@code date} is {@code null}.
+     * @exception NullPointerException if any of the parameters is {@code null}.
      */
     @Override
     public StringBuffer format(Date date, StringBuffer toAppendTo,
--- a/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, 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
@@ -362,59 +362,81 @@
     }
 
     /**
-     * Main program to start a registry. <br>
-     * The port number can be specified on the command line.
+     * Return a new RegistryImpl on the requested port and export it to serve
+     * registry requests. A classloader is initialized from the system property
+     * "env.class.path" and a security manager is set unless one is already set.
+     * <p>
+     * The returned Registry is fully functional within the current process and
+     * is usable for internal and testing purposes.
+     *
+     * @param regPort port on which the rmiregistry accepts requests;
+     *                if 0, an implementation specific port is assigned
+     * @return a RegistryImpl instance
+     * @exception RemoteException If remote operation failed.
+     * @since 9
      */
-    public static void main(String args[])
-    {
+    public static RegistryImpl createRegistry(int regPort) throws RemoteException {
         // Create and install the security manager if one is not installed
         // already.
         if (System.getSecurityManager() == null) {
             System.setSecurityManager(new SecurityManager());
         }
 
+        /*
+         * Fix bugid 4147561: When JDK tools are executed, the value of
+         * the CLASSPATH environment variable for the shell in which they
+         * were invoked is no longer incorporated into the application
+         * class path; CLASSPATH's only effect is to be the value of the
+         * system property "env.class.path".  To preserve the previous
+         * (JDK1.1 and JDK1.2beta3) behavior of this tool, however, its
+         * CLASSPATH should still be considered when resolving classes
+         * being unmarshalled.  To effect this old behavior, a class
+         * loader that loads from the file path specified in the
+         * "env.class.path" property is created and set to be the context
+         * class loader before the remote object is exported.
+         */
+        String envcp = System.getProperty("env.class.path");
+        if (envcp == null) {
+            envcp = ".";            // preserve old default behavior
+        }
+        URL[] urls = pathToURLs(envcp);
+        ClassLoader cl = new URLClassLoader(urls);
+
+        /*
+         * Fix bugid 4242317: Classes defined by this class loader should
+         * be annotated with the value of the "java.rmi.server.codebase"
+         * property, not the "file:" URLs for the CLASSPATH elements.
+         */
+        sun.rmi.server.LoaderHandler.registerCodebaseLoader(cl);
+
+        Thread.currentThread().setContextClassLoader(cl);
+
+        RegistryImpl registryImpl = null;
         try {
-            /*
-             * Fix bugid 4147561: When JDK tools are executed, the value of
-             * the CLASSPATH environment variable for the shell in which they
-             * were invoked is no longer incorporated into the application
-             * class path; CLASSPATH's only effect is to be the value of the
-             * system property "env.class.path".  To preserve the previous
-             * (JDK1.1 and JDK1.2beta3) behavior of this tool, however, its
-             * CLASSPATH should still be considered when resolving classes
-             * being unmarshalled.  To effect this old behavior, a class
-             * loader that loads from the file path specified in the
-             * "env.class.path" property is created and set to be the context
-             * class loader before the remote object is exported.
-             */
-            String envcp = System.getProperty("env.class.path");
-            if (envcp == null) {
-                envcp = ".";            // preserve old default behavior
-            }
-            URL[] urls = pathToURLs(envcp);
-            ClassLoader cl = new URLClassLoader(urls);
+            registryImpl = AccessController.doPrivileged(
+                new PrivilegedExceptionAction<RegistryImpl>() {
+                    public RegistryImpl run() throws RemoteException {
+                        return new RegistryImpl(regPort);
+                    }
+                }, getAccessControlContext(regPort));
+        } catch (PrivilegedActionException ex) {
+            throw (RemoteException) ex.getException();
+        }
 
-            /*
-             * Fix bugid 4242317: Classes defined by this class loader should
-             * be annotated with the value of the "java.rmi.server.codebase"
-             * property, not the "file:" URLs for the CLASSPATH elements.
-             */
-            sun.rmi.server.LoaderHandler.registerCodebaseLoader(cl);
+        return registryImpl;
+    }
 
-            Thread.currentThread().setContextClassLoader(cl);
-
+    /**
+     * Main program to start a registry. <br>
+     * The port number can be specified on the command line.
+     */
+    public static void main(String args[])
+    {
+        try {
             final int regPort = (args.length >= 1) ? Integer.parseInt(args[0])
                                                    : Registry.REGISTRY_PORT;
-            try {
-                registry = AccessController.doPrivileged(
-                    new PrivilegedExceptionAction<RegistryImpl>() {
-                        public RegistryImpl run() throws RemoteException {
-                            return new RegistryImpl(regPort);
-                        }
-                    }, getAccessControlContext(regPort));
-            } catch (PrivilegedActionException ex) {
-                throw (RemoteException) ex.getException();
-            }
+
+            registry = createRegistry(regPort);
 
             // prevent registry from exiting
             while (true) {
--- a/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,9 @@
  *          java.rmi/sun.rmi.server
  *          java.rmi/sun.rmi.transport
  *          java.rmi/sun.rmi.transport.tcp
- * @build TestLibrary JavaVM RMID TestSecurityManager
+ *          java.base/sun.nio.ch
+ * @build TestLibrary RMID RMIDSelectorProvider RegistryVM RMIRegistryRunner
+ *        TestSecurityManager
  * @run main/othervm AltSecurityManager
  */
 
@@ -44,7 +46,6 @@
  * if registry and rmid take too long to exit.
  */
 public class AltSecurityManager implements Runnable {
-    private final int regPort;
     // variable to hold registry and rmid children
     static JavaVM vm = null;
 
@@ -54,33 +55,37 @@
     static final String ACTIVATION = "sun.rmi.server.Activation";
 
     // children should exit in at least this time.
-    static long TIME_OUT = 15000;
-
-    public AltSecurityManager(int port) {
-        if (port <= 0) {
-            TestLibrary.bomb("Port must be greater than 0.");
-        }
-
-        this.regPort = port;
-    }
+    private static final long TIME_OUT =
+            (long)(15000 * TestLibrary.getTimeoutFactor());
 
     public void run() {
         try {
             if (utilityToStart.equals(REGISTRY_IMPL)) {
-                vm = new JavaVM(utilityToStart,
-                        " -Djava.security.manager=TestSecurityManager",
-                        Integer.toString(regPort));
+                vm = RegistryVM.createRegistryVMWithRunner(
+                        "RMIRegistryRunner",
+                        "-Djava.security.manager=TestSecurityManager");
             } else if (utilityToStart.contains(ACTIVATION)) {
-                vm = new JavaVM(utilityToStart,
-                        " -Djava.security.manager=TestSecurityManager",
-                        "-port " + Integer.toString(regPort));
+                vm = RMID.createRMIDOnEphemeralPortWithOptions(
+                        "-Djava.security.manager=TestSecurityManager");
             } else {
                 TestLibrary.bomb("Utility to start must be " + REGISTRY_IMPL +
                         " or " + ACTIVATION);
             }
 
             System.err.println("starting " + utilityToStart);
-            vm.execute();
+            try {
+                vm.start();
+                throw new RuntimeException("Expected exception did not occur!");
+            } catch (Exception expected) {
+                int exit = vm.waitFor();
+                if (exit != TestSecurityManager.EXIT_VALUE) {
+                    throw new RuntimeException(utilityToStart
+                            + " exit with an unexpected value "
+                            + exit + ".");
+                }
+                System.err.format("Success: starting %s exited with status %d%n",
+                                  utilityToStart, TestSecurityManager.EXIT_VALUE);
+            }
 
         } catch (Exception e) {
             TestLibrary.bomb(e);
@@ -95,8 +100,7 @@
         utilityToStart = utility;
 
         try {
-            int port = TestLibrary.getUnusedRandomPort();
-            Thread thread = new Thread(new AltSecurityManager(port));
+            Thread thread = new Thread(new AltSecurityManager());
             System.err.println("expecting RuntimeException for " +
                                "checkListen in child process");
             long start = System.currentTimeMillis();
@@ -115,7 +119,7 @@
                                    " terminated on time");
             }
         } finally {
-            vm.destroy();
+            vm.cleanup();
             vm = null;
         }
     }
--- a/jdk/test/java/rmi/registry/altSecurityManager/TestSecurityManager.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/rmi/registry/altSecurityManager/TestSecurityManager.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
 /**/
 
 public class TestSecurityManager extends SecurityManager {
+    public static final int EXIT_VALUE = 123;
+
     public TestSecurityManager() {
     }
 
@@ -36,7 +38,7 @@
         // by the main test process to detect that the proper security
         // manager has been installed in the relevant VMs.
         //
-        System.exit(1);
+        System.exit(EXIT_VALUE);
     }
 
     public void checkExit(int status) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/rmi/registry/altSecurityManager/registry.security.policy	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,8 @@
+grant {
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.registry";
+  permission java.util.PropertyPermission "env.class.path", "read";
+  permission java.io.FilePermission ".", "read";
+  permission java.util.PropertyPermission "user.dir", "read";
+  permission java.lang.RuntimePermission "createClassLoader";
+  permission java.lang.RuntimePermission "setContextClassLoader";
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/rmi/registry/altSecurityManager/rmid.security.policy	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,7 @@
+grant {
+  permission java.lang.RuntimePermission "selectorProvider";
+  permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
+  permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.port", "read";
+  permission java.util.PropertyPermission "test.java.rmi.testlibrary.RMIDSelectorProvider.timeout", "read";
+  permission java.net.SocketPermission "*:1024-", "listen,resolve,connect,accept";
+};
--- a/jdk/test/java/rmi/registry/reexport/Reexport.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/rmi/registry/reexport/Reexport.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
  *          java.rmi/sun.rmi.server
  *          java.rmi/sun.rmi.transport
  *          java.rmi/sun.rmi.transport.tcp
- * @build TestLibrary REGISTRY RegistryRunner
+ * @build TestLibrary RegistryVM RegistryRunner
  * @run main/othervm Reexport
  */
 
@@ -114,7 +114,7 @@
 
     public static void makeRegistry() {
         try {
-            subreg = REGISTRY.createREGISTRY();
+            subreg = RegistryVM.createRegistryVM();
             subreg.start();
             port = subreg.getPort();
             System.out.println("Starting registry on port " + port);
@@ -125,12 +125,12 @@
         }
     }
 
-    private static REGISTRY subreg = null;
+    private static RegistryVM subreg = null;
     private static int port = -1;
 
     public static void killRegistry() {
         if (subreg != null) {
-            subreg.shutdown();
+            subreg.cleanup();
             subreg = null;
         }
     }
--- a/jdk/test/java/rmi/testlibrary/JavaVM.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/rmi/testlibrary/JavaVM.java	Fri Jan 13 18:26:33 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
@@ -230,6 +230,22 @@
     }
 
     /**
+     * Return exit value for vm process.
+     * @return exit value for vm process
+     * @throws IllegalThreadStateException if the vm process has not yet terminated
+     */
+    public int exitValue() {
+        return vm.exitValue();
+    }
+
+    /**
+     * Destroy the vm process, and do necessary cleanup.
+     */
+    public void cleanup() {
+        destroy();
+    }
+
+    /**
      * Destroys the VM, waits for it to terminate, and returns
      * its exit status.
      *
--- a/jdk/test/java/rmi/testlibrary/REGISTRY.java	Mon Jan 09 15:10:25 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.OutputStream;
-import java.io.IOException;
-
-/**
- * Class to run and control rmiregistry in a sub-process.
- *
- * We can't kill a registry if we have too-close control
- * over it.  We must make it in a subprocess, and then kill the
- * subprocess when it has served our needs.
- */
-public class REGISTRY extends JavaVM {
-
-    private static final double START_TIMEOUT =
-            20_000 * TestLibrary.getTimeoutFactor();
-    private static final String DEFAULT_RUNNER = "RegistryRunner";
-
-    private int port = -1;
-
-    private REGISTRY(String runner, OutputStream out, OutputStream err,
-                    String options, int port) {
-        super(runner, options, Integer.toString(port), out, err);
-        try {
-            Class runnerClass = Class.forName(runner);
-            if (!RegistryRunner.class.isAssignableFrom(runnerClass)) {
-                throw new RuntimeException("runner class must be RegistryRunner"
-                        + " or its sub class");
-            }
-        } catch (ClassNotFoundException ex) {
-            throw new RuntimeException(ex);
-        }
-        this.port = port;
-    }
-
-    public static REGISTRY createREGISTRY() {
-        return createREGISTRYWithRunner(DEFAULT_RUNNER, System.out, System.err, "", 0);
-    }
-
-    public static REGISTRY createREGISTRY(OutputStream out, OutputStream err,
-                                    String options, int port) {
-        return createREGISTRYWithRunner(DEFAULT_RUNNER, out, err, options, port);
-    }
-
-    public static REGISTRY createREGISTRYWithRunner(String runner, String options) {
-        return createREGISTRYWithRunner(runner, System.out, System.err, options, 0);
-    }
-
-    public static REGISTRY createREGISTRYWithRunner(String runner, OutputStream out,
-                                        OutputStream err, String options, int port) {
-        options += " --add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED"
-                + " --add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED"
-                + " --add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED"
-                + " --add-exports=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED";
-       REGISTRY reg = new REGISTRY(runner, out, err, options, port);
-       return reg;
-    }
-
-    /**
-     * Starts the registry in a sub-process and waits up to
-     * the given timeout period to confirm that it's running,
-     * and get the port where it's running.
-     */
-    public void start() throws IOException {
-        super.start();
-        long startTime = System.currentTimeMillis();
-        long deadline = TestLibrary.computeDeadline(startTime, (long)START_TIMEOUT);
-        while (true) {
-            try {
-                Thread.sleep(1000);
-            } catch (InterruptedException ignore) { }
-
-            String output = outputStream.ba.toString();
-            port = RegistryRunner.getRegistryPort(output);
-            if (port != -1) {
-                break;
-            }
-            if (System.currentTimeMillis() > deadline) {
-                TestLibrary.bomb("Failed to start registry, giving up after " +
-                    (System.currentTimeMillis() - startTime) + "ms.", null);
-            }
-        }
-    }
-
-    /**
-     * Shuts down the registry.
-     */
-    public void shutdown() {
-        RegistryRunner.requestExit(port);
-    }
-
-    /**
-     * Gets the port where the registry is serving.
-     */
-    public int getPort() {
-        return port;
-    }
-}
--- a/jdk/test/java/rmi/testlibrary/RMID.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/rmi/testlibrary/RMID.java	Fri Jan 13 18:26:33 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
@@ -140,18 +140,6 @@
     }
 
     private static String makeArgs(boolean includePortArg, int port) {
-        String propagateManager = null;
-
-        // rmid will run with a security manager set, but no policy
-        // file - it should not need one.
-        if (System.getSecurityManager() == null) {
-            propagateManager = MANAGER_OPTION +
-                TestParams.defaultSecurityManager;
-        } else {
-            propagateManager = MANAGER_OPTION +
-                System.getSecurityManager().getClass().getName();
-        }
-
         // getAbsolutePath requires permission to read user.dir
         String args =
             " -log " + (new File(LOGDIR, log)).getAbsolutePath();
@@ -210,7 +198,30 @@
                                   boolean debugExec, boolean includePortArg,
                                   int port)
     {
+        return createRMIDWithOptions(out, err, debugExec, includePortArg, port, "");
+    }
+
+    /**
+     * Create a RMID on a specified port capturing stdout and stderr
+     * with additional command line options and whether to print out
+     * debugging information that is used for spawning activation groups.
+     *
+     * @param out the OutputStream where the normal output of the
+     *            rmid subprocess goes
+     * @param err the OutputStream where the error output of the
+     *            rmid subprocess goes
+     * @param debugExec whether to print out debugging information
+     * @param includePortArg whether to include port argument
+     * @param port the port on which rmid accepts requests
+     * @param additionalOptions additional command line options
+     * @return a RMID instance
+     */
+    public static RMID createRMIDWithOptions(OutputStream out, OutputStream err,
+                                  boolean debugExec, boolean includePortArg,
+                                  int port, String additionalOptions)
+    {
         String options = makeOptions(port, debugExec, false);
+        options += " " + additionalOptions;
         String args = makeArgs(includePortArg, port);
         RMID rmid = new RMID("sun.rmi.server.Activation", options, args,
                              out, err, port);
@@ -223,6 +234,19 @@
         return createRMID(System.out, System.err, true, false, 0);
     }
 
+    /**
+     * Create a RMID on an ephemeral port capturing stdout and stderr
+     * with additional command line options.
+     *
+     * @param additionalOptions additional command line options
+     * @return a RMID instance
+     */
+    public static RMID createRMIDOnEphemeralPortWithOptions(
+                                            String additionalOptions) {
+        return createRMIDWithOptions(System.out, System.err,
+                                     true, false, 0, additionalOptions);
+    }
+
     public static RMID createRMIDOnEphemeralPort(OutputStream out,
                                                  OutputStream err,
                                                  boolean debugExec)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/rmi/testlibrary/RMIRegistryRunner.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**/
+
+import java.rmi.*;
+import java.rmi.registry.*;
+import java.rmi.server.*;
+
+/**
+ * Class to run a rmiregistry whose VM can be told to exit remotely;
+ * Difference between this class and RegistryRunner is that this class
+ * simulate rmiregistry closer than RegistryRunner.
+ */
+public class RMIRegistryRunner extends RegistryRunner
+{
+    public RMIRegistryRunner() throws RemoteException {
+    }
+
+    /**
+     * port 0 means to use ephemeral port to start registry.
+     *
+     * @param args command line arguments passed in from main
+     * @return the port number on which registry accepts requests
+     */
+    protected static int init(String[] args) {
+        try {
+            if (args.length == 0) {
+                System.err.println("Usage: <port>");
+                System.exit(0);
+            }
+            int port = -1;
+            port = Integer.parseInt(args[0]);
+
+            // call RegistryImpl.createRegistry to simulate rmiregistry.
+            registry = sun.rmi.registry.RegistryImpl.createRegistry(port);
+            if (port == 0) {
+                port = TestLibrary.getRegistryPort(registry);
+            }
+
+            // create a remote object to tell this VM to exit
+            exiter = new RMIRegistryRunner();
+            Naming.rebind("rmi://localhost:" + port +
+                          "/RemoteExiter", exiter);
+
+            return port;
+        } catch (Exception e) {
+            System.err.println(e.getMessage());
+            e.printStackTrace();
+            System.exit(1);
+        }
+        return -1;
+    }
+
+    public static void main(String[] args) {
+        int port = init(args);
+        notify(port);
+    }
+}
--- a/jdk/test/java/rmi/testlibrary/RegistryRunner.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/rmi/testlibrary/RegistryRunner.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 
 /**
  * Class to run a registry whose VM can be told to exit remotely; using
- * the rmiregistry in this fashion makes tests more robust under
+ * a registry (in a sub-process) in this fashion makes tests more robust under
  * windows where Process.destroy() seems not to be 100% reliable.
  */
 public class RegistryRunner extends UnicastRemoteObject
@@ -38,8 +38,8 @@
     private static final String PORT_LABEL_START = "RegistryRunner.port.start:";
     private static final String PORT_LABEL_END = ":RegistryRunner.port.end";
 
-    private static Registry registry = null;
-    private static RemoteExiter exiter = null;
+    protected static Registry registry = null;
+    protected static RemoteExiter exiter = null;
 
     public RegistryRunner() throws RemoteException {
     }
@@ -72,6 +72,7 @@
             } catch (RemoteException re) {
             }
             e = null;
+
         } catch (java.net.MalformedURLException mfue) {
             // will not happen
         } catch (NotBoundException nbe) {
@@ -97,6 +98,9 @@
 
     /**
      * port 0 means to use ephemeral port to start registry.
+     *
+     * @param args command line arguments passed in from main
+     * @return the port number on which registry accepts requests
      */
     protected static int init(String[] args) {
         try {
@@ -128,13 +132,15 @@
     }
 
     /**
-     * REGISTRY.start() will filter the output of registry subprocess,
-     * when valid port is detected, REGISTRY.start() returns.
+     * RegistryVM.start() will filter the output of registry subprocess,
+     * when valid port is detected, RegistryVM.start() returns.
      * So, for subclass, it's important to call this method after registry
      * is initialized and necessary remote objects have been bound.
+     *
+     * @param port the port on which registry accepts requests
      */
     protected static void notify(int port) {
-        // this output is important for REGISTRY to get the port
+        // this output is important for RegistryVM to get the port
         // where rmiregistry is serving
         System.out.println(PORT_LABEL_START + port + PORT_LABEL_END);
         System.out.flush();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/rmi/testlibrary/RegistryVM.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.OutputStream;
+import java.io.IOException;
+
+/**
+ * Class to run and control registry/rmiregistry in a sub-process.
+ * The behaviour changes when use different runner, currently
+ * there are 2 built-in runners, RegistryRunner and RMIRegistryRunner.
+ *
+ * We can't kill a registry if we have too-close control
+ * over it.  We must make it in a subprocess, and then kill the
+ * subprocess when it has served our needs.
+ */
+public class RegistryVM extends JavaVM {
+
+    private static final double START_TIMEOUT =
+            20_000 * TestLibrary.getTimeoutFactor();
+    private static final String DEFAULT_RUNNER = "RegistryRunner";
+
+    private int port = -1;
+
+    private RegistryVM(String runner, OutputStream out, OutputStream err,
+                    String options, int port) {
+        super(runner, options, Integer.toString(port), out, err);
+        try {
+            Class runnerClass = Class.forName(runner);
+            if (!RegistryRunner.class.isAssignableFrom(runnerClass)) {
+                throw new RuntimeException("runner class must be RegistryRunner"
+                        + " or its sub class");
+            }
+        } catch (ClassNotFoundException ex) {
+            throw new RuntimeException(ex);
+        }
+        this.port = port;
+    }
+
+    /**
+     * Create a RegistryVM instance on an ephemeral port.
+     *
+     * @return a RegistryVM instance
+     */
+    public static RegistryVM createRegistryVM() {
+        return createRegistryVMWithRunner(DEFAULT_RUNNER, System.out, System.err, "", 0);
+    }
+
+    /**
+     * Create a RegistryVM instance on an ephemeral port with additional
+     * command line options.
+     *
+     * @param options command line options
+     * @return a RegistryVM instance
+     */
+    public static RegistryVM createRegistryVM(String options) {
+        return createRegistryVMWithRunner(
+                DEFAULT_RUNNER, System.out, System.err, options, 0);
+    }
+
+    /**
+     * Create a RegistryVM instance on a specified port capturing stdout and
+     * stderr with additional command line options.
+     *
+     * @param out the OutputStream where the normal output of the
+     *            registry subprocess goes
+     * @param err the OutputStream where the error output of the
+     *            registry subprocess goes
+     * @param options the command line options
+     * @param port the port on which Registry accepts requests
+     * @return a RegistryVM instance
+     */
+    public static RegistryVM createRegistryVM(OutputStream out, OutputStream err,
+                                              String options, int port) {
+        return createRegistryVMWithRunner(DEFAULT_RUNNER, out, err, options, port);
+    }
+
+    /**
+     * Create a RegistryVM instance on an ephemeral port with additional
+     * command line options and a specified runner.
+     *
+     * @param runner the runner class name
+     * @param options command line options
+     * @return a RegistryVM instance
+     */
+    public static RegistryVM createRegistryVMWithRunner(String runner, String options) {
+        return createRegistryVMWithRunner(runner, System.out, System.err, options, 0);
+    }
+
+    /**
+     * Create a RegistryVM instance on a specified port capturing stdout and
+     * stderr with additional command line options and a specified runner.
+     *
+     * @param runner the runner class name
+     * @param out the OutputStream where the normal output of the
+     *            registry subprocess goes
+     * @param err the OutputStream where the error output of the
+     *            registry subprocess goes
+     * @param options the command line options
+     * @param port the port on which Registry accepts requests
+     * @return a RegistryVM instance
+     */
+    public static RegistryVM createRegistryVMWithRunner(String runner, OutputStream out,
+                                        OutputStream err, String options, int port) {
+        options += " --add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED"
+                + " --add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED"
+                + " --add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED"
+                + " --add-exports=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED";
+        RegistryVM reg = new RegistryVM(runner, out, err, options, port);
+        reg.setPolicyFile(TestParams.defaultRegistryPolicy);
+        return reg;
+    }
+
+    /**
+     * Starts the registry in a sub-process and waits up to
+     * the given timeout period to confirm that it's running,
+     * and get the port where it's running.
+     *
+     * @throws IOException if fails to start subprocess
+     */
+    public void start() throws IOException {
+        super.start();
+        long startTime = System.currentTimeMillis();
+        long deadline = TestLibrary.computeDeadline(startTime, (long)START_TIMEOUT);
+        while (true) {
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException ignore) { }
+
+            String output = outputStream.ba.toString();
+            port = RegistryRunner.getRegistryPort(output);
+            if (port != -1) {
+                break;
+            }
+            try {
+                int exit = vm.exitValue();
+                TestLibrary.bomb("[RegistryVM] registry sub-process exited with status "
+                        + exit + ".");
+            } catch (IllegalThreadStateException ignore) { }
+
+            if (System.currentTimeMillis() > deadline) {
+                TestLibrary.bomb("Failed to start registry, giving up after " +
+                    (System.currentTimeMillis() - startTime) + "ms.", null);
+            }
+        }
+    }
+
+    /**
+     * Shuts down the registry.
+     */
+    @Override
+    public void cleanup() {
+        RegistryRunner.requestExit(port);
+        super.destroy();
+    }
+
+    /**
+     * Gets the port where the registry is serving.
+     *
+     * @return the port where the registry is serving
+     */
+    public int getPort() {
+        return port;
+    }
+}
--- a/jdk/test/java/rmi/testlibrary/TestParams.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/rmi/testlibrary/TestParams.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,9 @@
     /** name of default security policy for RMID */
     public static final String defaultRmidPolicy;
 
+    /** name of default security policy for RegistryVM */
+    public static final String defaultRegistryPolicy;
+
     /** name of default security policy for activation groups */
     public static final String defaultGroupPolicy;
 
@@ -69,6 +72,9 @@
         defaultRmidPolicy =
             testSrc + File.separatorChar + "rmid.security.policy";
 
+        defaultRegistryPolicy =
+            testSrc + File.separatorChar + "registry.security.policy";
+
         defaultGroupPolicy =
             testSrc + File.separatorChar + "group.security.policy";
 
--- a/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java	Fri Jan 13 18:26:33 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
@@ -33,7 +33,7 @@
  *          java.rmi/sun.rmi.server
  *          java.rmi/sun.rmi.transport
  *          java.rmi/sun.rmi.transport.tcp
- * @build TestLibrary Test TestImpl REGISTRY RegistryRunner
+ * @build TestLibrary Test TestImpl RegistryVM RegistryRunner
  * @run main/othervm/policy=security.policy/timeout=360 DGCDeadLock
  */
 
@@ -68,21 +68,18 @@
 
     static public void main(String[] args) {
 
-        REGISTRY testImplVM = null;
+        RegistryVM testImplVM = null;
 
         System.err.println("\nregression test for 4118056\n");
         TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
 
         try {
-            String options = " -Djava.security.policy=" +
-                TestParams.defaultPolicy +
-                " --add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED" +
+            String options = " --add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED" +
                 " -Djava.rmi.dgc.leaseValue=500000" +
                 " -Dsun.rmi.dgc.checkInterval=" +
-                (HOLD_TARGET_TIME - 5000) +
-                "" ;
+                (HOLD_TARGET_TIME - 5000);
 
-            testImplVM = REGISTRY.createREGISTRYWithRunner("TestImpl", options);
+            testImplVM = RegistryVM.createRegistryVMWithRunner("TestImpl", options);
             testImplVM.start();
             registryPort = testImplVM.getPort();
 
@@ -107,7 +104,7 @@
             TestLibrary.bomb("test failed in main()", e);
         } finally {
             if (testImplVM != null) {
-                testImplVM.shutdown();
+                testImplVM.cleanup();
                 testImplVM = null;
             }
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/rmi/transport/dgcDeadLock/registry.security.policy	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,27 @@
+/*
+ * security policy used by the registry sub-process
+ */
+
+grant {
+  // used by TestLibrary to determine extra commandline properties
+  permission java.io.FilePermission "..${/}..${/}test.props", "read";
+
+  // property specifically accessed by this test.
+  permission java.util.PropertyPermission "sun.rmi.transport.cleanInterval", "write";
+  permission java.util.PropertyPermission "package.restrict.access.sun", "read";
+  permission java.util.PropertyPermission "package.restrict.access.sun.rmi", "read";
+
+  // test needs to use java to exec an EchoImpl object
+  permission java.io.FilePermission "${java.home}${/}bin${/}java", "execute";
+
+  // used by TestLibrary to determine test environment 
+  permission java.util.PropertyPermission "test.*", "read";
+  permission java.util.PropertyPermission "user.dir", "read";
+  permission java.util.PropertyPermission "java.home", "read";
+
+  permission java.util.PropertyPermission "java.security.policy", "read";
+  permission java.util.PropertyPermission "java.security.manager", "read";
+
+  // test needs to export rmid and communicate with objects on arbitrary ports
+  permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
+};
--- a/jdk/test/java/time/TEST.properties	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/time/TEST.properties	Fri Jan 13 18:26:33 2017 +0100
@@ -1,7 +1,6 @@
 # Threeten test uses TestNG
 TestNG.dirs = .
 othervm.dirs = tck/java/time/chrono test/java/time/chrono test/java/time/format
-modules = jdk.localedata
 lib.dirs = ../../lib/testlibrary
 lib.build = jdk.testlibrary.RandomFactory
 modules = java.base/java.time:open java.base/java.time.chrono:open java.base/java.time.zone:open
--- a/jdk/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java	Fri Jan 13 18:26:33 2017 +0100
@@ -880,25 +880,6 @@
     }
 
     //-----------------------------------------------------------------------
-    @DataProvider(name="patternPrint")
-    Object[][] data_patternPrint() {
-        return new Object[][] {
-            {"Q", date(2012, 2, 10), "1"},
-            {"QQ", date(2012, 2, 10), "01"},
-            {"QQQ", date(2012, 2, 10), "Q1"},
-            {"QQQQ", date(2012, 2, 10), "1st quarter"},
-            {"QQQQQ", date(2012, 2, 10), "1"},
-        };
-    }
-
-    @Test(dataProvider="patternPrint")
-    public void test_appendPattern_patternPrint(String input, Temporal temporal, String expected) throws Exception {
-        DateTimeFormatter f = builder.appendPattern(input).toFormatter(Locale.UK);
-        String test = f.format(temporal);
-        assertEquals(test, expected);
-    }
-
-    //-----------------------------------------------------------------------
     @DataProvider(name="localePatterns")
     Object[][] localizedDateTimePatterns() {
         return new Object[][] {
@@ -914,48 +895,6 @@
             {null, FormatStyle.LONG, IsoChronology.INSTANCE, Locale.US, "h:mm:ss a z"},
             {null, FormatStyle.MEDIUM, IsoChronology.INSTANCE, Locale.US, "h:mm:ss a"},
             {null, FormatStyle.SHORT, IsoChronology.INSTANCE, Locale.US, "h:mm a"},
-
-            // French Locale and ISO Chronology
-            {FormatStyle.FULL, FormatStyle.FULL, IsoChronology.INSTANCE, Locale.FRENCH, "EEEE d MMMM y '\u00e0' HH:mm:ss zzzz"},
-            {FormatStyle.LONG, FormatStyle.LONG, IsoChronology.INSTANCE, Locale.FRENCH, "d MMMM y '\u00e0' HH:mm:ss z"},
-            {FormatStyle.MEDIUM, FormatStyle.MEDIUM, IsoChronology.INSTANCE, Locale.FRENCH, "d MMM y '\u00e0' HH:mm:ss"},
-            {FormatStyle.SHORT, FormatStyle.SHORT, IsoChronology.INSTANCE, Locale.FRENCH, "dd/MM/y HH:mm"},
-            {FormatStyle.FULL, null, IsoChronology.INSTANCE, Locale.FRENCH, "EEEE d MMMM y"},
-            {FormatStyle.LONG, null, IsoChronology.INSTANCE, Locale.FRENCH, "d MMMM y"},
-            {FormatStyle.MEDIUM, null, IsoChronology.INSTANCE, Locale.FRENCH, "d MMM y"},
-            {FormatStyle.SHORT, null, IsoChronology.INSTANCE, Locale.FRENCH, "dd/MM/y"},
-            {null, FormatStyle.FULL, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm:ss zzzz"},
-            {null, FormatStyle.LONG, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm:ss z"},
-            {null, FormatStyle.MEDIUM, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm:ss"},
-            {null, FormatStyle.SHORT, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm"},
-
-            // Japanese Locale and JapaneseChronology
-            {FormatStyle.FULL, FormatStyle.FULL, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5EEEE H\u6642mm\u5206ss\u79d2 zzzz"},
-            {FormatStyle.LONG, FormatStyle.LONG, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5 H:mm:ss z"},
-            {FormatStyle.MEDIUM, FormatStyle.MEDIUM, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5 H:mm:ss"},
-            {FormatStyle.SHORT, FormatStyle.SHORT, JapaneseChronology.INSTANCE, Locale.JAPANESE, "GGGGGy/M/d H:mm"},
-            {FormatStyle.FULL, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5EEEE"},
-            {FormatStyle.LONG, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5"},
-            {FormatStyle.MEDIUM, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5"},
-            {FormatStyle.SHORT, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "GGGGGy/M/d"},
-            {null, FormatStyle.FULL, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H\u6642mm\u5206ss\u79d2 zzzz"},
-            {null, FormatStyle.LONG, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H:mm:ss z"},
-            {null, FormatStyle.MEDIUM, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H:mm:ss"},
-            {null, FormatStyle.SHORT, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H:mm"},
-
-            // Chinese Local and Chronology
-            {FormatStyle.FULL, FormatStyle.FULL, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5EEEE zzzz ah:mm:ss"},
-            {FormatStyle.LONG, FormatStyle.LONG, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5 z ah:mm:ss"},
-            {FormatStyle.MEDIUM, FormatStyle.MEDIUM, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5 ah:mm:ss"},
-            {FormatStyle.SHORT, FormatStyle.SHORT, MinguoChronology.INSTANCE, Locale.CHINESE, "Gyy/M/d ah:mm"},
-            {FormatStyle.FULL, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5EEEE"},
-            {FormatStyle.LONG, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5"},
-            {FormatStyle.MEDIUM, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5"},
-            {FormatStyle.SHORT, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gyy/M/d"},
-            {null, FormatStyle.FULL, MinguoChronology.INSTANCE, Locale.CHINESE, "zzzz ah:mm:ss"},
-            {null, FormatStyle.LONG, MinguoChronology.INSTANCE, Locale.CHINESE, "z ah:mm:ss"},
-            {null, FormatStyle.MEDIUM, MinguoChronology.INSTANCE, Locale.CHINESE, "ah:mm:ss"},
-            {null, FormatStyle.SHORT, MinguoChronology.INSTANCE, Locale.CHINESE, "ah:mm"},
         };
     }
 
@@ -1004,5 +943,4 @@
     private static Temporal date(int y, int m, int d) {
         return LocalDate.of(y, m, d);
     }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/test/java/time/format/TestDateTimeFormatterBuilderWithLocale.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2009-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * @test
+ * @modules jdk.localedata
+ */
+package test.java.time.format;
+
+import java.time.chrono.Chronology;
+import java.time.chrono.IsoChronology;
+import java.time.chrono.JapaneseChronology;
+import java.time.chrono.MinguoChronology;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.FormatStyle;
+import java.time.LocalDate;
+import java.time.temporal.Temporal;
+
+import java.util.Locale;
+
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test DateTimeFormatterBuilder.
+ */
+@Test
+public class TestDateTimeFormatterBuilderWithLocale {
+
+    private DateTimeFormatterBuilder builder;
+
+    @BeforeMethod
+    public void setUp() {
+        builder = new DateTimeFormatterBuilder();
+    }
+
+    //-----------------------------------------------------------------------
+    @DataProvider(name="patternPrint")
+    Object[][] data_patternPrint() {
+        return new Object[][] {
+            {"Q", date(2012, 2, 10), "1"},
+            {"QQ", date(2012, 2, 10), "01"},
+            {"QQQ", date(2012, 2, 10), "Q1"},
+            {"QQQQ", date(2012, 2, 10), "1st quarter"},
+            {"QQQQQ", date(2012, 2, 10), "1"},
+        };
+    }
+
+    @Test(dataProvider="patternPrint")
+    public void test_appendPattern_patternPrint(String input, Temporal temporal, String expected) throws Exception {
+        DateTimeFormatter f = builder.appendPattern(input).toFormatter(Locale.UK);
+        String test = f.format(temporal);
+        assertEquals(test, expected);
+    }
+
+    //-----------------------------------------------------------------------
+    @DataProvider(name="localePatterns")
+    Object[][] localizedDateTimePatterns() {
+        return new Object[][] {
+            // French Locale and ISO Chronology
+            {FormatStyle.FULL, FormatStyle.FULL, IsoChronology.INSTANCE, Locale.FRENCH, "EEEE d MMMM y '\u00e0' HH:mm:ss zzzz"},
+            {FormatStyle.LONG, FormatStyle.LONG, IsoChronology.INSTANCE, Locale.FRENCH, "d MMMM y '\u00e0' HH:mm:ss z"},
+            {FormatStyle.MEDIUM, FormatStyle.MEDIUM, IsoChronology.INSTANCE, Locale.FRENCH, "d MMM y '\u00e0' HH:mm:ss"},
+            {FormatStyle.SHORT, FormatStyle.SHORT, IsoChronology.INSTANCE, Locale.FRENCH, "dd/MM/y HH:mm"},
+            {FormatStyle.FULL, null, IsoChronology.INSTANCE, Locale.FRENCH, "EEEE d MMMM y"},
+            {FormatStyle.LONG, null, IsoChronology.INSTANCE, Locale.FRENCH, "d MMMM y"},
+            {FormatStyle.MEDIUM, null, IsoChronology.INSTANCE, Locale.FRENCH, "d MMM y"},
+            {FormatStyle.SHORT, null, IsoChronology.INSTANCE, Locale.FRENCH, "dd/MM/y"},
+            {null, FormatStyle.FULL, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm:ss zzzz"},
+            {null, FormatStyle.LONG, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm:ss z"},
+            {null, FormatStyle.MEDIUM, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm:ss"},
+            {null, FormatStyle.SHORT, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm"},
+
+            // Japanese Locale and JapaneseChronology
+            {FormatStyle.FULL, FormatStyle.FULL, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5EEEE H\u6642mm\u5206ss\u79d2 zzzz"},
+            {FormatStyle.LONG, FormatStyle.LONG, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5 H:mm:ss z"},
+            {FormatStyle.MEDIUM, FormatStyle.MEDIUM, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5 H:mm:ss"},
+            {FormatStyle.SHORT, FormatStyle.SHORT, JapaneseChronology.INSTANCE, Locale.JAPANESE, "GGGGGy/M/d H:mm"},
+            {FormatStyle.FULL, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5EEEE"},
+            {FormatStyle.LONG, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5"},
+            {FormatStyle.MEDIUM, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5"},
+            {FormatStyle.SHORT, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "GGGGGy/M/d"},
+            {null, FormatStyle.FULL, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H\u6642mm\u5206ss\u79d2 zzzz"},
+            {null, FormatStyle.LONG, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H:mm:ss z"},
+            {null, FormatStyle.MEDIUM, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H:mm:ss"},
+            {null, FormatStyle.SHORT, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H:mm"},
+
+            // Chinese Local and Chronology
+            {FormatStyle.FULL, FormatStyle.FULL, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5EEEE zzzz ah:mm:ss"},
+            {FormatStyle.LONG, FormatStyle.LONG, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5 z ah:mm:ss"},
+            {FormatStyle.MEDIUM, FormatStyle.MEDIUM, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5 ah:mm:ss"},
+            {FormatStyle.SHORT, FormatStyle.SHORT, MinguoChronology.INSTANCE, Locale.CHINESE, "Gyy/M/d ah:mm"},
+            {FormatStyle.FULL, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5EEEE"},
+            {FormatStyle.LONG, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5"},
+            {FormatStyle.MEDIUM, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5"},
+            {FormatStyle.SHORT, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gyy/M/d"},
+            {null, FormatStyle.FULL, MinguoChronology.INSTANCE, Locale.CHINESE, "zzzz ah:mm:ss"},
+            {null, FormatStyle.LONG, MinguoChronology.INSTANCE, Locale.CHINESE, "z ah:mm:ss"},
+            {null, FormatStyle.MEDIUM, MinguoChronology.INSTANCE, Locale.CHINESE, "ah:mm:ss"},
+            {null, FormatStyle.SHORT, MinguoChronology.INSTANCE, Locale.CHINESE, "ah:mm"},
+        };
+    }
+
+    @Test(dataProvider="localePatterns")
+    public void test_getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
+            Chronology chrono, Locale locale, String expected) {
+        String actual = DateTimeFormatterBuilder.getLocalizedDateTimePattern(dateStyle, timeStyle, chrono, locale);
+        assertEquals(actual, expected, "Pattern " + convertNonAscii(actual));
+    }
+
+    /**
+     * Returns a string that includes non-ascii characters after expanding
+     * the non-ascii characters to their Java language \\uxxxx form.
+     * @param input an input string
+     * @return the encoded string.
+     */
+    private String convertNonAscii(String input) {
+        StringBuilder sb = new StringBuilder(input.length() * 6);
+        for (int i = 0; i < input.length(); i++) {
+            char ch = input.charAt(i);
+            if (ch < 255) {
+                sb.append(ch);
+            } else {
+                sb.append("\\u");
+                sb.append(Integer.toHexString(ch));
+            }
+        }
+        return sb.toString();
+    }
+
+    private static Temporal date(int y, int m, int d) {
+        return LocalDate.of(y, m, d);
+    }
+}
--- a/jdk/test/java/time/test/java/time/format/TestDateTimeTextProvider.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/time/test/java/time/format/TestDateTimeTextProvider.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -80,7 +80,6 @@
 public class TestDateTimeTextProvider extends AbstractTestPrinterParser {
 
     Locale enUS = new Locale("en", "US");
-    Locale ptBR = new Locale("pt", "BR");
 
     //-----------------------------------------------------------------------
     @DataProvider(name = "Text")
@@ -94,14 +93,6 @@
             {DAY_OF_WEEK, 6, TextStyle.SHORT, enUS, "Sat"},
             {DAY_OF_WEEK, 7, TextStyle.SHORT, enUS, "Sun"},
 
-            {DAY_OF_WEEK, 1, TextStyle.SHORT, ptBR, "seg"},
-            {DAY_OF_WEEK, 2, TextStyle.SHORT, ptBR, "ter"},
-            {DAY_OF_WEEK, 3, TextStyle.SHORT, ptBR, "qua"},
-            {DAY_OF_WEEK, 4, TextStyle.SHORT, ptBR, "qui"},
-            {DAY_OF_WEEK, 5, TextStyle.SHORT, ptBR, "sex"},
-            {DAY_OF_WEEK, 6, TextStyle.SHORT, ptBR, "s\u00E1b"},
-            {DAY_OF_WEEK, 7, TextStyle.SHORT, ptBR, "dom"},
-
             {DAY_OF_WEEK, 1, TextStyle.FULL, enUS, "Monday"},
             {DAY_OF_WEEK, 2, TextStyle.FULL, enUS, "Tuesday"},
             {DAY_OF_WEEK, 3, TextStyle.FULL, enUS, "Wednesday"},
@@ -110,14 +101,6 @@
             {DAY_OF_WEEK, 6, TextStyle.FULL, enUS, "Saturday"},
             {DAY_OF_WEEK, 7, TextStyle.FULL, enUS, "Sunday"},
 
-            {DAY_OF_WEEK, 1, TextStyle.FULL, ptBR, "segunda-feira"},
-            {DAY_OF_WEEK, 2, TextStyle.FULL, ptBR, "ter\u00E7a-feira"},
-            {DAY_OF_WEEK, 3, TextStyle.FULL, ptBR, "quarta-feira"},
-            {DAY_OF_WEEK, 4, TextStyle.FULL, ptBR, "quinta-feira"},
-            {DAY_OF_WEEK, 5, TextStyle.FULL, ptBR, "sexta-feira"},
-            {DAY_OF_WEEK, 6, TextStyle.FULL, ptBR, "s\u00E1bado"},
-            {DAY_OF_WEEK, 7, TextStyle.FULL, ptBR, "domingo"},
-
             {MONTH_OF_YEAR, 1, TextStyle.SHORT, enUS, "Jan"},
             {MONTH_OF_YEAR, 2, TextStyle.SHORT, enUS, "Feb"},
             {MONTH_OF_YEAR, 3, TextStyle.SHORT, enUS, "Mar"},
@@ -131,19 +114,6 @@
             {MONTH_OF_YEAR, 11, TextStyle.SHORT, enUS, "Nov"},
             {MONTH_OF_YEAR, 12, TextStyle.SHORT, enUS, "Dec"},
 
-            {MONTH_OF_YEAR, 1, TextStyle.SHORT, ptBR, "jan"},
-            {MONTH_OF_YEAR, 2, TextStyle.SHORT, ptBR, "fev"},
-            {MONTH_OF_YEAR, 3, TextStyle.SHORT, ptBR, "mar"},
-            {MONTH_OF_YEAR, 4, TextStyle.SHORT, ptBR, "abr"},
-            {MONTH_OF_YEAR, 5, TextStyle.SHORT, ptBR, "mai"},
-            {MONTH_OF_YEAR, 6, TextStyle.SHORT, ptBR, "jun"},
-            {MONTH_OF_YEAR, 7, TextStyle.SHORT, ptBR, "jul"},
-            {MONTH_OF_YEAR, 8, TextStyle.SHORT, ptBR, "ago"},
-            {MONTH_OF_YEAR, 9, TextStyle.SHORT, ptBR, "set"},
-            {MONTH_OF_YEAR, 10, TextStyle.SHORT, ptBR, "out"},
-            {MONTH_OF_YEAR, 11, TextStyle.SHORT, ptBR, "nov"},
-            {MONTH_OF_YEAR, 12, TextStyle.SHORT, ptBR, "dez"},
-
             {MONTH_OF_YEAR, 1, TextStyle.FULL, enUS, "January"},
             {MONTH_OF_YEAR, 2, TextStyle.FULL, enUS, "February"},
             {MONTH_OF_YEAR, 3, TextStyle.FULL, enUS, "March"},
@@ -157,19 +127,6 @@
             {MONTH_OF_YEAR, 11, TextStyle.FULL, enUS, "November"},
             {MONTH_OF_YEAR, 12, TextStyle.FULL, enUS, "December"},
 
-            {MONTH_OF_YEAR, 1, TextStyle.FULL, ptBR, "janeiro"},
-            {MONTH_OF_YEAR, 2, TextStyle.FULL, ptBR, "fevereiro"},
-            {MONTH_OF_YEAR, 3, TextStyle.FULL, ptBR, "mar\u00E7o"},
-            {MONTH_OF_YEAR, 4, TextStyle.FULL, ptBR, "abril"},
-            {MONTH_OF_YEAR, 5, TextStyle.FULL, ptBR, "maio"},
-            {MONTH_OF_YEAR, 6, TextStyle.FULL, ptBR, "junho"},
-            {MONTH_OF_YEAR, 7, TextStyle.FULL, ptBR, "julho"},
-            {MONTH_OF_YEAR, 8, TextStyle.FULL, ptBR, "agosto"},
-            {MONTH_OF_YEAR, 9, TextStyle.FULL, ptBR, "setembro"},
-            {MONTH_OF_YEAR, 10, TextStyle.FULL, ptBR, "outubro"},
-            {MONTH_OF_YEAR, 11, TextStyle.FULL, ptBR, "novembro"},
-            {MONTH_OF_YEAR, 12, TextStyle.FULL, ptBR, "dezembro"},
-
             {AMPM_OF_DAY, 0, TextStyle.SHORT, enUS, "AM"},
             {AMPM_OF_DAY, 1, TextStyle.SHORT, enUS, "PM"},
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/test/java/time/format/TestDateTimeTextProviderWithLocale.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2011-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * @test
+ * @modules jdk.localedata
+ */
+
+package test.java.time.format;
+
+import static java.time.temporal.ChronoField.AMPM_OF_DAY;
+import static java.time.temporal.ChronoField.DAY_OF_WEEK;
+import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
+import static org.testng.Assert.assertEquals;
+
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.TextStyle;
+import java.time.temporal.TemporalField;
+import java.util.Locale;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test SimpleDateTimeTextProviderWithLocale.
+ */
+@Test
+public class TestDateTimeTextProviderWithLocale extends AbstractTestPrinterParser {
+
+    Locale enUS = new Locale("en", "US");
+    Locale ptBR = new Locale("pt", "BR");
+
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "Text")
+    Object[][] data_text() {
+        return new Object[][] {
+            {DAY_OF_WEEK, 1, TextStyle.SHORT, ptBR, "seg"},
+            {DAY_OF_WEEK, 2, TextStyle.SHORT, ptBR, "ter"},
+            {DAY_OF_WEEK, 3, TextStyle.SHORT, ptBR, "qua"},
+            {DAY_OF_WEEK, 4, TextStyle.SHORT, ptBR, "qui"},
+            {DAY_OF_WEEK, 5, TextStyle.SHORT, ptBR, "sex"},
+            {DAY_OF_WEEK, 6, TextStyle.SHORT, ptBR, "s\u00E1b"},
+            {DAY_OF_WEEK, 7, TextStyle.SHORT, ptBR, "dom"},
+
+            {DAY_OF_WEEK, 1, TextStyle.FULL, ptBR, "segunda-feira"},
+            {DAY_OF_WEEK, 2, TextStyle.FULL, ptBR, "ter\u00E7a-feira"},
+            {DAY_OF_WEEK, 3, TextStyle.FULL, ptBR, "quarta-feira"},
+            {DAY_OF_WEEK, 4, TextStyle.FULL, ptBR, "quinta-feira"},
+            {DAY_OF_WEEK, 5, TextStyle.FULL, ptBR, "sexta-feira"},
+            {DAY_OF_WEEK, 6, TextStyle.FULL, ptBR, "s\u00E1bado"},
+            {DAY_OF_WEEK, 7, TextStyle.FULL, ptBR, "domingo"},
+
+            {MONTH_OF_YEAR, 1, TextStyle.SHORT, ptBR, "jan"},
+            {MONTH_OF_YEAR, 2, TextStyle.SHORT, ptBR, "fev"},
+            {MONTH_OF_YEAR, 3, TextStyle.SHORT, ptBR, "mar"},
+            {MONTH_OF_YEAR, 4, TextStyle.SHORT, ptBR, "abr"},
+            {MONTH_OF_YEAR, 5, TextStyle.SHORT, ptBR, "mai"},
+            {MONTH_OF_YEAR, 6, TextStyle.SHORT, ptBR, "jun"},
+            {MONTH_OF_YEAR, 7, TextStyle.SHORT, ptBR, "jul"},
+            {MONTH_OF_YEAR, 8, TextStyle.SHORT, ptBR, "ago"},
+            {MONTH_OF_YEAR, 9, TextStyle.SHORT, ptBR, "set"},
+            {MONTH_OF_YEAR, 10, TextStyle.SHORT, ptBR, "out"},
+            {MONTH_OF_YEAR, 11, TextStyle.SHORT, ptBR, "nov"},
+            {MONTH_OF_YEAR, 12, TextStyle.SHORT, ptBR, "dez"},
+
+            {MONTH_OF_YEAR, 1, TextStyle.FULL, ptBR, "janeiro"},
+            {MONTH_OF_YEAR, 2, TextStyle.FULL, ptBR, "fevereiro"},
+            {MONTH_OF_YEAR, 3, TextStyle.FULL, ptBR, "mar\u00E7o"},
+            {MONTH_OF_YEAR, 4, TextStyle.FULL, ptBR, "abril"},
+            {MONTH_OF_YEAR, 5, TextStyle.FULL, ptBR, "maio"},
+            {MONTH_OF_YEAR, 6, TextStyle.FULL, ptBR, "junho"},
+            {MONTH_OF_YEAR, 7, TextStyle.FULL, ptBR, "julho"},
+            {MONTH_OF_YEAR, 8, TextStyle.FULL, ptBR, "agosto"},
+            {MONTH_OF_YEAR, 9, TextStyle.FULL, ptBR, "setembro"},
+            {MONTH_OF_YEAR, 10, TextStyle.FULL, ptBR, "outubro"},
+            {MONTH_OF_YEAR, 11, TextStyle.FULL, ptBR, "novembro"},
+            {MONTH_OF_YEAR, 12, TextStyle.FULL, ptBR, "dezembro"},
+
+        };
+    }
+
+    @Test(dataProvider = "Text")
+    public void test_getText(TemporalField field, Number value, TextStyle style, Locale locale, String expected) {
+          DateTimeFormatter fmt = getFormatter(field, style).withLocale(locale);
+          assertEquals(fmt.format(ZonedDateTime.now().with(field, value.longValue())), expected);
+    }
+
+}
--- a/jdk/test/java/time/test/java/time/format/TestNarrowMonthNamesAndDayNames.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/time/test/java/time/format/TestNarrowMonthNamesAndDayNames.java	Fri Jan 13 18:26:33 2017 +0100
@@ -20,13 +20,14 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-package test.java.time.format;
-
 /*
  * @test
+ * @modules jdk.localedata
  * @bug 8146750
  * @summary Test Narrow and NarrowStandalone month names are retrieved correctly.
  */
+package test.java.time.format;
+
 import static org.testng.Assert.assertEquals;
 
 import java.time.DayOfWeek;
--- a/jdk/test/java/time/test/java/time/format/TestNonIsoFormatter.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/time/test/java/time/format/TestNonIsoFormatter.java	Fri Jan 13 18:26:33 2017 +0100
@@ -20,6 +20,13 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
+/*
+ *
+ * @test
+ * @modules jdk.localedata
+ */
+
 package test.java.time.format;
 
 import static org.testng.Assert.assertEquals;
--- a/jdk/test/java/time/test/java/time/format/TestTextParser.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/time/test/java/time/format/TestTextParser.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -68,16 +68,9 @@
 
 import java.text.ParsePosition;
 import java.time.DayOfWeek;
-import java.time.chrono.ChronoLocalDate;
-import java.time.chrono.JapaneseChronology;
-import java.time.chrono.HijrahDate;
-import java.time.chrono.JapaneseDate;
-import java.time.chrono.MinguoDate;
-import java.time.chrono.ThaiBuddhistDate;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatterBuilder;
 import java.time.format.TextStyle;
-import java.time.format.SignStyle;
 import java.time.temporal.TemporalAccessor;
 import java.time.temporal.TemporalField;
 import java.time.temporal.TemporalQueries;
@@ -92,8 +85,6 @@
  */
 @Test
 public class TestTextParser extends AbstractTestPrinterParser {
-    static final Locale RUSSIAN = new Locale("ru");
-    static final Locale FINNISH = new Locale("fi");
 
     //-----------------------------------------------------------------------
     @DataProvider(name="error")
@@ -213,20 +204,6 @@
        };
     }
 
-    // Test data is dependent on localized resources.
-    @DataProvider(name="parseStandaloneText")
-    Object[][] providerStandaloneText() {
-        // Locale, TemporalField, TextStyle, expected value, input text
-        return new Object[][] {
-            {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,   1, "\u044f\u043d\u0432\u0430\u0440\u044c"},
-            {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  12, "\u0434\u0435\u043a\u0430\u0431\u0440\u044c"},
-            {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE,  1, "\u044f\u043d\u0432."},
-            {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 12, "\u0434\u0435\u043a."},
-            {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,   2, "tiistai"},
-            {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE,  2, "ti"},
-        };
-    }
-
     @DataProvider(name="parseDayOfWeekText")
     Object[][] providerDayOfWeekData() {
         return new Object[][] {
@@ -234,26 +211,9 @@
             {Locale.US, "e",  "1",  DayOfWeek.SUNDAY},
             {Locale.US, "ee", "01", DayOfWeek.SUNDAY},
             {Locale.US, "c",  "1",  DayOfWeek.SUNDAY},
-
-            {Locale.UK, "e",  "1",  DayOfWeek.MONDAY},
-            {Locale.UK, "ee", "01", DayOfWeek.MONDAY},
-            {Locale.UK, "c",  "1",  DayOfWeek.MONDAY},
         };
     }
 
-    // Test data is dependent on localized resources.
-    @DataProvider(name="parseLenientText")
-    Object[][] providerLenientText() {
-        // Locale, TemporalField, expected value, input text
-        return new Object[][] {
-            {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432\u0430\u0440\u044f"}, // full format
-            {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432\u0430\u0440\u044c"}, // full standalone
-            {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432."}, // short format
-            {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432."}, // short standalone
-        };
-    }
-
-
 
     @Test(dataProvider="parseText")
     public void test_parseText(TemporalField field, TextStyle style, int value, String input) throws Exception {
@@ -269,14 +229,6 @@
         assertEquals(pos.getIndex(), input.length());
     }
 
-    @Test(dataProvider="parseStandaloneText")
-    public void test_parseStandaloneText(Locale locale, TemporalField field, TextStyle style, int expectedValue, String input) {
-        DateTimeFormatter formatter = getFormatter(field, style).withLocale(locale);
-        ParsePosition pos = new ParsePosition(0);
-        assertEquals(formatter.parseUnresolved(input, pos).getLong(field), (long) expectedValue);
-        assertEquals(pos.getIndex(), input.length());
-    }
-
     @Test(dataProvider="parseDayOfWeekText")
     public void test_parseDayOfWeekText(Locale locale, String pattern, String input, DayOfWeek expected) {
         DateTimeFormatter formatter = getPatternFormatter(pattern).withLocale(locale);
@@ -374,25 +326,6 @@
     }
 
     //-----------------------------------------------------------------------
-    public void test_parse_french_short_strict_full_noMatch() throws Exception {
-        setStrict(true);
-        ParsePosition pos = new ParsePosition(0);
-        getFormatter(MONTH_OF_YEAR, TextStyle.SHORT).withLocale(Locale.FRENCH)
-                                                    .parseUnresolved("janvier", pos);
-        assertEquals(pos.getErrorIndex(), 0);
-    }
-
-    public void test_parse_french_short_strict_short_match() throws Exception {
-        setStrict(true);
-        ParsePosition pos = new ParsePosition(0);
-        assertEquals(getFormatter(MONTH_OF_YEAR, TextStyle.SHORT).withLocale(Locale.FRENCH)
-                                                                 .parseUnresolved("janv.", pos)
-                                                                 .getLong(MONTH_OF_YEAR),
-                     1L);
-        assertEquals(pos.getIndex(), 5);
-    }
-
-    //-----------------------------------------------------------------------
     public void test_parse_full_lenient_full_match() throws Exception {
         setStrict(false);
         ParsePosition pos = new ParsePosition(0);
@@ -436,51 +369,4 @@
         assertEquals(pos.getIndex(), 1);
     }
 
-    @Test(dataProvider="parseLenientText")
-    public void test_parseLenientText(Locale locale, TemporalField field, int expectedValue, String input) {
-        setStrict(false);
-        ParsePosition pos = new ParsePosition(0);
-        DateTimeFormatter formatter = getFormatter(field).withLocale(locale);
-        assertEquals(formatter.parseUnresolved(input, pos).getLong(field), (long) expectedValue);
-        assertEquals(pos.getIndex(), input.length());
-    }
-
-    //-----------------------------------------------------------------------
-    @DataProvider(name="parseChronoLocalDate")
-    Object[][] provider_chronoLocalDate() {
-        return new Object[][] {
-            { HijrahDate.now() },
-            { JapaneseDate.now() },
-            { MinguoDate.now() },
-            { ThaiBuddhistDate.now() }};
-    }
-
-    private static final DateTimeFormatter fmt_chrono =
-        new DateTimeFormatterBuilder()
-            .optionalStart()
-            .appendChronologyId()
-            .appendLiteral(' ')
-            .optionalEnd()
-            .optionalStart()
-            .appendText(ChronoField.ERA, TextStyle.SHORT)
-            .appendLiteral(' ')
-            .optionalEnd()
-            .appendValue(ChronoField.YEAR_OF_ERA, 1, 9, SignStyle.NORMAL)
-            .appendLiteral('-')
-            .appendValue(ChronoField.MONTH_OF_YEAR, 1, 2, SignStyle.NEVER)
-            .appendLiteral('-')
-            .appendValue(ChronoField.DAY_OF_MONTH, 1, 2, SignStyle.NEVER)
-            .toFormatter();
-
-    @Test(dataProvider="parseChronoLocalDate")
-    public void test_chronoLocalDate(ChronoLocalDate date) throws Exception {
-        System.out.printf(" %s, [fmt=%s]%n", date, fmt_chrono.format(date));
-        assertEquals(date, fmt_chrono.parse(fmt_chrono.format(date), ChronoLocalDate::from));
-
-        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("[GGG ]yyy-MM-dd")
-                                                 .withChronology(date.getChronology());
-        System.out.printf(" %s, [fmt=%s]%n", date.toString(), fmt.format(date));
-        assertEquals(date, fmt.parse(fmt.format(date), ChronoLocalDate::from));
-    }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/test/java/time/format/TestTextParserWithLocale.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * @test
+ * @modules jdk.localedata
+ */
+
+package test.java.time.format;
+
+import java.text.ParsePosition;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.JapaneseChronology;
+import java.time.chrono.HijrahDate;
+import java.time.chrono.JapaneseDate;
+import java.time.chrono.MinguoDate;
+import java.time.chrono.ThaiBuddhistDate;
+import java.time.DayOfWeek;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.TextStyle;
+import java.time.format.SignStyle;
+import java.time.temporal.ChronoField;
+import java.time.temporal.TemporalField;
+import java.util.Locale;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+
+import static java.time.temporal.ChronoField.DAY_OF_MONTH;
+import static java.time.temporal.ChronoField.DAY_OF_WEEK;
+import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
+import static org.testng.Assert.assertEquals;
+
+/**
+ * Test TextPrinterParser.
+ */
+@Test
+public class TestTextParserWithLocale extends AbstractTestPrinterParser {
+    static final Locale RUSSIAN = new Locale("ru");
+    static final Locale FINNISH = new Locale("fi");
+
+    @DataProvider(name="parseDayOfWeekText")
+    Object[][] providerDayOfWeekData() {
+        return new Object[][] {
+            // Locale, pattern, input text, expected DayOfWeek
+            {Locale.US, "e",  "1",  DayOfWeek.SUNDAY},
+            {Locale.US, "ee", "01", DayOfWeek.SUNDAY},
+            {Locale.US, "c",  "1",  DayOfWeek.SUNDAY},
+
+            {Locale.UK, "e",  "1",  DayOfWeek.MONDAY},
+            {Locale.UK, "ee", "01", DayOfWeek.MONDAY},
+            {Locale.UK, "c",  "1",  DayOfWeek.MONDAY},
+        };
+    }
+
+    @Test(dataProvider="parseDayOfWeekText")
+    public void test_parseDayOfWeekText(Locale locale, String pattern, String input, DayOfWeek expected) {
+        DateTimeFormatter formatter = getPatternFormatter(pattern).withLocale(locale);
+        ParsePosition pos = new ParsePosition(0);
+        assertEquals(DayOfWeek.from(formatter.parse(input, pos)), expected);
+        assertEquals(pos.getIndex(), input.length());
+    }
+
+    //--------------------------------------------------------------------
+    // Test data is dependent on localized resources.
+    @DataProvider(name="parseStandaloneText")
+    Object[][] providerStandaloneText() {
+        // Locale, TemporalField, TextStyle, expected value, input text
+        return new Object[][] {
+            {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,   1, "\u044f\u043d\u0432\u0430\u0440\u044c"},
+            {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  12, "\u0434\u0435\u043a\u0430\u0431\u0440\u044c"},
+            {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE,  1, "\u044f\u043d\u0432."},
+            {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 12, "\u0434\u0435\u043a."},
+            {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,   2, "tiistai"},
+            {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE,  2, "ti"},
+        };
+    }
+
+    // Test data is dependent on localized resources.
+    @DataProvider(name="parseLenientText")
+    Object[][] providerLenientText() {
+        // Locale, TemporalField, expected value, input text
+        return new Object[][] {
+            {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432\u0430\u0440\u044f"}, // full format
+            {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432\u0430\u0440\u044c"}, // full standalone
+            {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432."}, // short format
+            {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432."}, // short standalone
+        };
+    }
+
+    @Test(dataProvider="parseStandaloneText")
+    public void test_parseStandaloneText(Locale locale, TemporalField field, TextStyle style, int expectedValue, String input) {
+        DateTimeFormatter formatter = getFormatter(field, style).withLocale(locale);
+        ParsePosition pos = new ParsePosition(0);
+        assertEquals(formatter.parseUnresolved(input, pos).getLong(field), (long) expectedValue);
+        assertEquals(pos.getIndex(), input.length());
+    }
+
+    //-----------------------------------------------------------------------
+    public void test_parse_french_short_strict_full_noMatch() throws Exception {
+        setStrict(true);
+        ParsePosition pos = new ParsePosition(0);
+        getFormatter(MONTH_OF_YEAR, TextStyle.SHORT).withLocale(Locale.FRENCH)
+                                                    .parseUnresolved("janvier", pos);
+        assertEquals(pos.getErrorIndex(), 0);
+    }
+
+    public void test_parse_french_short_strict_short_match() throws Exception {
+        setStrict(true);
+        ParsePosition pos = new ParsePosition(0);
+        assertEquals(getFormatter(MONTH_OF_YEAR, TextStyle.SHORT).withLocale(Locale.FRENCH)
+                                                                 .parseUnresolved("janv.", pos)
+                                                                 .getLong(MONTH_OF_YEAR),
+                     1L);
+        assertEquals(pos.getIndex(), 5);
+    }
+
+    //-----------------------------------------------------------------------
+
+    @Test(dataProvider="parseLenientText")
+    public void test_parseLenientText(Locale locale, TemporalField field, int expectedValue, String input) {
+        setStrict(false);
+        ParsePosition pos = new ParsePosition(0);
+        DateTimeFormatter formatter = getFormatter(field).withLocale(locale);
+        assertEquals(formatter.parseUnresolved(input, pos).getLong(field), (long) expectedValue);
+        assertEquals(pos.getIndex(), input.length());
+    }
+
+
+    //-----------------------------------------------------------------------
+    @DataProvider(name="parseChronoLocalDate")
+    Object[][] provider_chronoLocalDate() {
+        return new Object[][] {
+            { HijrahDate.now() },
+            { JapaneseDate.now() },
+            { MinguoDate.now() },
+            { ThaiBuddhistDate.now() }};
+    }
+
+    private static final DateTimeFormatter fmt_chrono =
+        new DateTimeFormatterBuilder()
+            .optionalStart()
+            .appendChronologyId()
+            .appendLiteral(' ')
+            .optionalEnd()
+            .optionalStart()
+            .appendText(ChronoField.ERA, TextStyle.SHORT)
+            .appendLiteral(' ')
+            .optionalEnd()
+            .appendValue(ChronoField.YEAR_OF_ERA, 1, 9, SignStyle.NORMAL)
+            .appendLiteral('-')
+            .appendValue(ChronoField.MONTH_OF_YEAR, 1, 2, SignStyle.NEVER)
+            .appendLiteral('-')
+            .appendValue(ChronoField.DAY_OF_MONTH, 1, 2, SignStyle.NEVER)
+            .toFormatter();
+
+    @Test(dataProvider="parseChronoLocalDate")
+    public void test_chronoLocalDate(ChronoLocalDate date) throws Exception {
+        System.out.printf(" %s, [fmt=%s]%n", date, fmt_chrono.format(date));
+        assertEquals(date, fmt_chrono.parse(fmt_chrono.format(date), ChronoLocalDate::from));
+
+        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("[GGG ]yyy-MM-dd")
+                                                 .withChronology(date.getChronology());
+        System.out.printf(" %s, [fmt=%s]%n", date.toString(), fmt.format(date));
+        assertEquals(date, fmt.parse(fmt.format(date), ChronoLocalDate::from));
+    }
+}
--- a/jdk/test/java/time/test/java/time/format/TestTextPrinter.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/java/time/test/java/time/format/TestTextPrinter.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -84,8 +84,6 @@
  */
 @Test
 public class TestTextPrinter extends AbstractTestPrinterParser {
-    static final Locale RUSSIAN = new Locale("ru");
-    static final Locale FINNISH = new Locale("fi");
 
     //-----------------------------------------------------------------------
     @Test(expectedExceptions=DateTimeException.class)
@@ -213,32 +211,6 @@
             {Locale.US, "e",  "1",  DayOfWeek.SUNDAY},
             {Locale.US, "ee", "01", DayOfWeek.SUNDAY},
             {Locale.US, "c",  "1",  DayOfWeek.SUNDAY},
-
-            {Locale.UK, "e",  "1",  DayOfWeek.MONDAY},
-            {Locale.UK, "ee", "01", DayOfWeek.MONDAY},
-            {Locale.UK, "c",  "1",  DayOfWeek.MONDAY},
-        };
-    }
-
-    @DataProvider(name="print_JapaneseChronology")
-    Object[][] provider_japaneseEra() {
-       return new Object[][] {
-            {ERA,           TextStyle.FULL, 2, "Heisei"}, // Note: CLDR doesn't define "wide" Japanese era names.
-            {ERA,           TextStyle.SHORT, 2, "Heisei"},
-            {ERA,           TextStyle.NARROW, 2, "H"},
-       };
-    };
-
-    // Test data is dependent on localized resources.
-    @DataProvider(name="print_standalone")
-    Object[][] provider_StandaloneNames() {
-        return new Object[][] {
-            // standalone names for 2013-01-01 (Tue)
-            // Locale, TemporalField, TextStyle, expected text
-            {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  "\u044f\u043d\u0432\u0430\u0440\u044c"},
-            {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u044f\u043d\u0432."},
-            {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,  "tiistai"},
-            {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE, "ti"},
         };
     }
 
@@ -255,30 +227,6 @@
         assertEquals(text, expected);
     }
 
-    @Test(dataProvider="print_JapaneseChronology")
-    public void test_formatJapaneseEra(TemporalField field, TextStyle style, int value, String expected) throws Exception {
-        LocalDate ld = LocalDate.of(2013, 1, 31);
-        getFormatter(field, style).withChronology(JapaneseChronology.INSTANCE).formatTo(ld, buf);
-        assertEquals(buf.toString(), expected);
-    }
-
-    @Test(dataProvider="print_standalone")
-    public void test_standaloneNames(Locale locale, TemporalField field, TextStyle style, String expected) {
-        getFormatter(field, style).withLocale(locale).formatTo(LocalDate.of(2013, 1, 1), buf);
-        assertEquals(buf.toString(), expected);
-    }
-
-    //-----------------------------------------------------------------------
-    public void test_print_french_long() throws Exception {
-        getFormatter(MONTH_OF_YEAR, TextStyle.FULL).withLocale(Locale.FRENCH).formatTo(LocalDate.of(2012, 1, 1), buf);
-        assertEquals(buf.toString(), "janvier");
-    }
-
-    public void test_print_french_short() throws Exception {
-        getFormatter(MONTH_OF_YEAR, TextStyle.SHORT).withLocale(Locale.FRENCH).formatTo(LocalDate.of(2012, 1, 1), buf);
-        assertEquals(buf.toString(), "janv.");
-    }
-
     //-----------------------------------------------------------------------
     public void test_toString1() throws Exception {
         assertEquals(getFormatter(MONTH_OF_YEAR, TextStyle.FULL).toString(), "Text(MonthOfYear)");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/test/java/time/format/TestTextPrinterWithLocale.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * @test
+ * @modules jdk.localedata
+ */
+
+package test.java.time.format;
+
+import static java.time.temporal.ChronoField.DAY_OF_MONTH;
+import static java.time.temporal.ChronoField.DAY_OF_WEEK;
+import static java.time.temporal.ChronoField.ERA;
+import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
+import static java.time.temporal.IsoFields.QUARTER_OF_YEAR;
+import static org.testng.Assert.assertEquals;
+
+import java.time.DateTimeException;
+import java.time.DayOfWeek;
+import java.time.LocalDate;
+import java.time.chrono.JapaneseChronology;
+import java.time.format.DateTimeFormatter;
+import java.time.format.TextStyle;
+import java.time.temporal.TemporalField;
+import java.util.Locale;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import test.java.time.temporal.MockFieldValue;
+
+/**
+ * Test TextPrinterParserWithLocale.
+ */
+@Test
+public class TestTextPrinterWithLocale extends AbstractTestPrinterParser {
+    static final Locale RUSSIAN = new Locale("ru");
+    static final Locale FINNISH = new Locale("fi");
+
+    //-----------------------------------------------------------------------
+    @DataProvider(name="print_DayOfWeekData")
+    Object[][] providerDayOfWeekData() {
+        return new Object[][] {
+            // Locale, pattern, expected text, input DayOfWeek
+            {Locale.US, "e",  "1",  DayOfWeek.SUNDAY},
+            {Locale.US, "ee", "01", DayOfWeek.SUNDAY},
+            {Locale.US, "c",  "1",  DayOfWeek.SUNDAY},
+
+            {Locale.UK, "e",  "1",  DayOfWeek.MONDAY},
+            {Locale.UK, "ee", "01", DayOfWeek.MONDAY},
+            {Locale.UK, "c",  "1",  DayOfWeek.MONDAY},
+        };
+    }
+
+    // Test data is dependent on localized resources.
+    @DataProvider(name="print_standalone")
+    Object[][] provider_StandaloneNames() {
+        return new Object[][] {
+            // standalone names for 2013-01-01 (Tue)
+            // Locale, TemporalField, TextStyle, expected text
+            {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  "\u044f\u043d\u0432\u0430\u0440\u044c"},
+            {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u044f\u043d\u0432."},
+            {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,  "tiistai"},
+            {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE, "ti"},
+        };
+    }
+
+    @Test(dataProvider="print_DayOfWeekData")
+    public void test_formatDayOfWeek(Locale locale, String pattern, String expected, DayOfWeek dayOfWeek) {
+        DateTimeFormatter formatter = getPatternFormatter(pattern).withLocale(locale);
+        String text = formatter.format(dayOfWeek);
+        assertEquals(text, expected);
+    }
+
+    @Test(dataProvider="print_standalone")
+    public void test_standaloneNames(Locale locale, TemporalField field, TextStyle style, String expected) {
+        getFormatter(field, style).withLocale(locale).formatTo(LocalDate.of(2013, 1, 1), buf);
+        assertEquals(buf.toString(), expected);
+    }
+
+    //-----------------------------------------------------------------------
+    public void test_print_french_long() throws Exception {
+        getFormatter(MONTH_OF_YEAR, TextStyle.FULL).withLocale(Locale.FRENCH).formatTo(LocalDate.of(2012, 1, 1), buf);
+        assertEquals(buf.toString(), "janvier");
+    }
+
+    public void test_print_french_short() throws Exception {
+        getFormatter(MONTH_OF_YEAR, TextStyle.SHORT).withLocale(Locale.FRENCH).formatTo(LocalDate.of(2012, 1, 1), buf);
+        assertEquals(buf.toString(), "janv.");
+    }
+
+    @DataProvider(name="print_JapaneseChronology")
+    Object[][] provider_japaneseEra() {
+       return new Object[][] {
+            {ERA,           TextStyle.FULL, 2, "Heisei"}, // Note: CLDR doesn't define "wide" Japanese era names.
+            {ERA,           TextStyle.SHORT, 2, "Heisei"},
+            {ERA,           TextStyle.NARROW, 2, "H"},
+       };
+    };
+
+    @Test(dataProvider="print_JapaneseChronology")
+    public void test_formatJapaneseEra(TemporalField field, TextStyle style, int value, String expected) throws Exception {
+        LocalDate ld = LocalDate.of(2013, 1, 31);
+        getFormatter(field, style).withChronology(JapaneseChronology.INSTANCE).formatTo(ld, buf);
+        assertEquals(buf.toString(), expected);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/ws/8159058/SaajEmptyNamespaceTest.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8159058
+ * @summary Test that empty default namespace declaration clears the
+ *          default namespace value
+ * @modules java.xml.ws/com.sun.xml.internal.ws.api
+ *          java.xml.ws/com.sun.xml.internal.ws.api.message.saaj
+ *          java.xml.ws/com.sun.xml.internal.ws.message.stream
+ * @run testng/othervm SaajEmptyNamespaceTest
+ */
+
+import com.sun.xml.internal.ws.api.SOAPVersion;
+import com.sun.xml.internal.ws.api.message.saaj.SAAJFactory;
+import com.sun.xml.internal.ws.message.stream.StreamMessage;
+import java.io.ByteArrayInputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Node;
+
+public class SaajEmptyNamespaceTest {
+
+    /*
+     * Test that SOAP message with default namespace declaration that contains empty
+     * string is properly processed by SAAJ reader.
+     */
+    @Test
+    public void testResetDefaultNamespaceSAAJ() throws Exception {
+        // Create SOAP message from XML string and process it with SAAJ reader
+        XMLStreamReader envelope = XMLInputFactory.newFactory().createXMLStreamReader(
+                new StringReader(INPUT_SOAP_MESSAGE));
+        StreamMessage streamMessage = new StreamMessage(SOAPVersion.SOAP_11,
+                envelope, null);
+        SAAJFactory saajFact = new SAAJFactory();
+        SOAPMessage soapMessage = saajFact.readAsSOAPMessage(SOAPVersion.SOAP_11, streamMessage);
+
+        // Check if constructed object model meets local names and namespace expectations
+        SOAPElement request = (SOAPElement) soapMessage.getSOAPBody().getFirstChild();
+        // Check top body element name
+        Assert.assertEquals(request.getLocalName(), "SampleServiceRequest");
+        // Check top body element namespace
+        Assert.assertEquals(request.getNamespaceURI(), TEST_NS);
+        SOAPElement params = (SOAPElement) request.getFirstChild();
+        // Check first child name
+        Assert.assertEquals(params.getLocalName(), "RequestParams");
+        // Check if first child namespace is null
+        Assert.assertNull(params.getNamespaceURI());
+
+        // Check inner elements of the first child
+        SOAPElement param1 = (SOAPElement) params.getFirstChild();
+        Assert.assertEquals(param1.getLocalName(), "Param1");
+        Assert.assertNull(param1.getNamespaceURI());
+        SOAPElement param2 = (SOAPElement) params.getChildNodes().item(1);
+        Assert.assertEquals(param2.getLocalName(), "Param2");
+        Assert.assertNull(param2.getNamespaceURI());
+        // Check full content of SOAP body
+        Assert.assertEquals(nodeToText(request), EXPECTED_RESULT);
+    }
+
+    /*
+     * Test that adding element with explicitly null namespace URI shall put the
+     * element into global namespace. Namespace declarations are not added explicitly.
+     */
+    @Test
+    public void testAddElementToNullNsNoDeclarations() throws Exception {
+        // Create empty SOAP message
+        SOAPMessage msg = createSoapMessage();
+        SOAPBody body = msg.getSOAPPart().getEnvelope().getBody();
+
+        // Add elements
+        SOAPElement parentExplicitNS = body.addChildElement("content", "", TEST_NS);
+        SOAPElement childGlobalNS = parentExplicitNS.addChildElement("global-child", "", null);
+        SOAPElement childDefaultNS = parentExplicitNS.addChildElement("default-child");
+
+        // Check namespace URIs
+        Assert.assertNull(childGlobalNS.getNamespaceURI());
+        Assert.assertEquals(childDefaultNS.getNamespaceURI(), TEST_NS);
+    }
+
+    /*
+     * Test that adding element with explicitly empty namespace URI shall put
+     * the element into global namespace. Namespace declarations are not added
+     * explicitly.
+     */
+    @Test
+    public void testAddElementToGlobalNsNoDeclarations() throws Exception {
+        // Create empty SOAP message
+        SOAPMessage msg = createSoapMessage();
+        SOAPBody body = msg.getSOAPPart().getEnvelope().getBody();
+
+        // Add elements
+        SOAPElement parentExplicitNS = body.addChildElement("content", "", TEST_NS);
+        SOAPElement childGlobalNS = parentExplicitNS.addChildElement("global-child", "", "");
+        SOAPElement childDefaultNS = parentExplicitNS.addChildElement("default-child");
+
+        // Check namespace URIs
+        Assert.assertNull(childGlobalNS.getNamespaceURI());
+        Assert.assertEquals(childDefaultNS.getNamespaceURI(), TEST_NS);
+    }
+
+    /*
+     * Test that adding element with explicitly empty namespace URI set via QName
+     * shall put the element into global namespace.
+     */
+    @Test
+    public void testAddElementToNullNsQName() throws Exception {
+        // Create empty SOAP message
+        SOAPMessage msg = createSoapMessage();
+        SOAPBody body = msg.getSOAPPart().getEnvelope().getBody();
+
+        // Add elements
+        SOAPElement parentExplicitNS = body.addChildElement("content", "", TEST_NS);
+        parentExplicitNS.addNamespaceDeclaration("", TEST_NS);
+        SOAPElement childGlobalNS = parentExplicitNS.addChildElement(new QName(null, "global-child"));
+        childGlobalNS.addNamespaceDeclaration("", "");
+        SOAPElement grandChildGlobalNS = childGlobalNS.addChildElement("global-grand-child");
+        SOAPElement childDefaultNS = parentExplicitNS.addChildElement("default-child");
+
+        // Check namespace URIs
+        Assert.assertNull(childGlobalNS.getNamespaceURI());
+        Assert.assertNull(grandChildGlobalNS.getNamespaceURI());
+        Assert.assertEquals(childDefaultNS.getNamespaceURI(), TEST_NS);
+    }
+
+    /*
+     * Test that adding element with explicitly empty namespace URI shall put
+     * the element into global namespace.
+     */
+    @Test
+    public void testAddElementToGlobalNs() throws Exception {
+        // Create empty SOAP message
+        SOAPMessage msg = createSoapMessage();
+        SOAPBody body = msg.getSOAPPart().getEnvelope().getBody();
+
+        // Add elements
+        SOAPElement parentExplicitNS = body.addChildElement("content", "", TEST_NS);
+        parentExplicitNS.addNamespaceDeclaration("", TEST_NS);
+        SOAPElement childGlobalNS = parentExplicitNS.addChildElement("global-child", "", "");
+        childGlobalNS.addNamespaceDeclaration("", "");
+        SOAPElement grandChildGlobalNS = childGlobalNS.addChildElement("global-grand-child");
+        SOAPElement childDefaultNS = parentExplicitNS.addChildElement("default-child");
+
+        // Check namespace URIs
+        Assert.assertNull(childGlobalNS.getNamespaceURI());
+        Assert.assertNull(grandChildGlobalNS.getNamespaceURI());
+        Assert.assertEquals(childDefaultNS.getNamespaceURI(), TEST_NS);
+    }
+
+    /*
+     * Test that adding element with explicitly null namespace URI shall put
+     * the element into global namespace.
+     */
+    @Test
+    public void testAddElementToNullNs() throws Exception {
+        // Create empty SOAP message
+        SOAPMessage msg = createSoapMessage();
+        SOAPBody body = msg.getSOAPPart().getEnvelope().getBody();
+
+        // Add elements
+        SOAPElement parentExplicitNS = body.addChildElement("content", "", TEST_NS);
+        parentExplicitNS.addNamespaceDeclaration("", TEST_NS);
+        SOAPElement childGlobalNS = parentExplicitNS.addChildElement("global-child", "", null);
+        childGlobalNS.addNamespaceDeclaration("", null);
+        SOAPElement grandChildGlobalNS = childGlobalNS.addChildElement("global-grand-child");
+        SOAPElement childDefaultNS = parentExplicitNS.addChildElement("default-child");
+
+        // Check namespace URIs
+        Assert.assertNull(childGlobalNS.getNamespaceURI());
+        Assert.assertNull(grandChildGlobalNS.getNamespaceURI());
+        Assert.assertEquals(TEST_NS, childDefaultNS.getNamespaceURI());
+    }
+
+    /*
+     * Test that adding element with explicitly empty namespace URI via QName
+     * shall put the element in global namespace.
+     */
+    @Test
+    public void testAddElementToGlobalNsQName() throws Exception {
+        // Create empty SOAP message
+        SOAPMessage msg = createSoapMessage();
+        SOAPBody body = msg.getSOAPPart().getEnvelope().getBody();
+
+        // Add elements
+        SOAPElement parentExplicitNS = body.addChildElement("content", "", TEST_NS);
+        parentExplicitNS.addNamespaceDeclaration("", TEST_NS);
+        SOAPElement childGlobalNS = parentExplicitNS.addChildElement(new QName("", "global-child"));
+        childGlobalNS.addNamespaceDeclaration("", "");
+        SOAPElement grandChildGlobalNS = childGlobalNS.addChildElement("global-grand-child");
+        SOAPElement childDefaultNS = parentExplicitNS.addChildElement("default-child");
+
+        // Check namespace URIs
+        Assert.assertNull(childGlobalNS.getNamespaceURI());
+        Assert.assertNull(grandChildGlobalNS.getNamespaceURI());
+        Assert.assertEquals(childDefaultNS.getNamespaceURI(),TEST_NS);
+    }
+
+    // Convert DOM node to text representation
+    private String nodeToText(Node node) throws TransformerException {
+        Transformer trans = TransformerFactory.newInstance().newTransformer();
+        trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+        StringWriter writer = new StringWriter();
+        StreamResult result = new StreamResult(writer);
+        trans.transform(new DOMSource(node), result);
+        String bodyContent = writer.toString();
+        System.out.println("SOAP body content read by SAAJ:"+bodyContent);
+        return bodyContent;
+    }
+
+    // Create SOAP message with empty body
+    private static SOAPMessage createSoapMessage() throws SOAPException, UnsupportedEncodingException {
+        String xml = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+                    +"<SOAP-ENV:Body/></SOAP-ENV:Envelope>";
+        MessageFactory mFactory = MessageFactory.newInstance();
+        SOAPMessage msg = mFactory.createMessage();
+        msg.getSOAPPart().setContent(new StreamSource(new ByteArrayInputStream(xml.getBytes("utf-8"))));
+        return msg;
+    }
+
+    // Namespace value used in tests
+    private static String TEST_NS = "http://example.org/test";
+
+    // Content of SOAP message passed to SAAJ factory
+    private static String INPUT_SOAP_MESSAGE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+            + "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+            + "<s:Body>"
+            + "<SampleServiceRequest xmlns=\"http://example.org/test\""
+            + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
+            + "<RequestParams xmlns=\"\">"
+            + "<Param1>hogehoge</Param1>"
+            + "<Param2>fugafuga</Param2>"
+            + "</RequestParams>"
+            + "</SampleServiceRequest>"
+            + "</s:Body>"
+            + "</s:Envelope>";
+
+    // Expected body content after SAAJ processing
+    private static String EXPECTED_RESULT = "<SampleServiceRequest"
+            +" xmlns=\"http://example.org/test\">"
+            + "<RequestParams xmlns=\"\">"
+            + "<Param1>hogehoge</Param1>"
+            + "<Param2>fugafuga</Param2>"
+            + "</RequestParams>"
+            + "</SampleServiceRequest>";
+}
--- a/jdk/test/sun/rmi/transport/tcp/DeadCachedConnection.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/jdk/test/sun/rmi/transport/tcp/DeadCachedConnection.java	Fri Jan 13 18:26:33 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
@@ -29,7 +29,7 @@
  *          java.rmi/sun.rmi.server
  *          java.rmi/sun.rmi.transport
  *          java.rmi/sun.rmi.transport.tcp
- * @build TestLibrary REGISTRY RegistryRunner
+ * @build TestLibrary RegistryVM RegistryRunner
  * @run main/othervm DeadCachedConnection
  */
 
@@ -100,7 +100,7 @@
 
     public static int makeRegistry(int port) {
         try {
-            subreg = REGISTRY.createREGISTRY(System.out, System.err, "", port);
+            subreg = RegistryVM.createRegistryVM(System.out, System.err, "", port);
             subreg.start();
             int regPort = subreg.getPort();
             System.out.println("Starting registry on port " + regPort);
@@ -113,11 +113,11 @@
         return -1;
     }
 
-    private static REGISTRY subreg = null;
+    private static RegistryVM subreg = null;
 
     public static void killRegistry() throws InterruptedException {
         if (subreg != null) {
-            subreg.shutdown();
+            subreg.cleanup();
             subreg = null;
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/RuntimeTest.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,236 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Test Multi-Release jar usage in runtime
+ * @library /test/lib
+ * @library /lib/testlibrary
+ * @modules jdk.compiler
+ * @build jdk.test.lib.JDKToolFinder jdk.test.lib.JDKToolLauncher
+ *        jdk.test.lib.process.OutputAnalyzer
+ *        jdk.test.lib.process.ProcessTools
+ *        CompilerUtils RuntimeTest
+ * @run testng RuntimeTest
+ */
+
+import static org.testng.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Stream;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class RuntimeTest {
+    public static final int SUCCESS = 0;
+    private final String src = System.getProperty("test.src", ".");
+    private final String usr = System.getProperty("user.dir", ".");
+
+    @DataProvider(name = "jarFiles")
+    Object[][] jarFiles() {
+        return new Object[][] { { "MV_BOTH.jar", 9, 9, 9 },
+                { "MV_ONLY_9.jar", 9, 9, 9 },
+                { "NON_MV.jar", 8, 8, 8 } };
+    }
+
+    @BeforeClass
+    protected void setUpTest() throws Throwable {
+        compile();
+        Path classes = Paths.get("classes");
+        jar("cfm", "MV_BOTH.jar", "manifest.txt",
+                "-C", classes.resolve("base").toString(), ".",
+                "--release", "9", "-C", classes.resolve("v9").toString(), ".",
+                "--release", "10", "-C", classes.resolve("v10").toString(), ".")
+                .shouldHaveExitValue(0);
+
+        jar("cfm", "MV_ONLY_9.jar", "manifest.txt",
+                "-C", classes.resolve("base").toString(), ".",
+                "--release", "9", "-C", classes.resolve("v9").toString(), ".")
+                .shouldHaveExitValue(0);
+        jar("cfm", "NON_MV.jar", "manifest.txt",
+                "-C", classes.resolve("base").toString(), ".")
+                .shouldHaveExitValue(0);
+    }
+
+    @Test(dataProvider = "jarFiles")
+    public void testClasspath(String jar, int mainVer, int helperVer,
+            int resVer) throws Throwable {
+        String[] command = { "-cp", jar, "testpackage.Main" };
+        System.out.println("Command arguments:" + Arrays.asList(command));
+        System.out.println();
+        java(command).shouldHaveExitValue(SUCCESS)
+                .shouldContain("Main version: " + mainVer)
+                .shouldContain("Helpers version: " + helperVer)
+                .shouldContain("Resource version: " + resVer);
+    }
+
+    @Test(dataProvider = "jarFiles")
+    void testMVJarAsLib(String jar, int mainVer, int helperVer, int resVer)
+            throws Throwable {
+        String[] apps = { "UseByImport", "UseByReflection" };
+        for (String app : apps) {
+            String[] command = {"-cp",
+                    jar + File.pathSeparatorChar + "classes/test/", app };
+            System.out.println("Command arguments:" + Arrays.asList(command));
+            System.out.println();
+            java(command).shouldHaveExitValue(SUCCESS)
+                    .shouldContain("Main version: " + mainVer)
+                    .shouldContain("Helpers version: " + helperVer)
+                    .shouldContain("Resource version: " + resVer);
+        }
+    }
+
+    @Test(dataProvider = "jarFiles")
+    void testJavaJar(String jar, int mainVer, int helperVer, int resVer)
+            throws Throwable {
+        String[] command = { "-jar", jar };
+        System.out.println("Command arguments:" + Arrays.asList(command));
+        System.out.println();
+        java(command).shouldHaveExitValue(SUCCESS)
+                .shouldContain("Main version: " + mainVer)
+                .shouldContain("Helpers version: " + helperVer)
+                .shouldContain("Resource version: " + resVer);
+    }
+
+    @Test(dataProvider = "jarFiles")
+    void testURLClassLoader(String jarName, int mainVer, int helperVer,
+            int resVer) throws ClassNotFoundException, NoSuchMethodException,
+            IllegalAccessException, IllegalArgumentException,
+            InvocationTargetException, IOException {
+        Path pathToJAR = Paths.get(jarName).toAbsolutePath();
+        URL jarURL1 = new URL("jar:file:" + pathToJAR + "!/");
+        URL jarURL2 = new URL("file:///" + pathToJAR);
+        testURLClassLoaderURL(jarURL1, mainVer, helperVer, resVer);
+        testURLClassLoaderURL(jarURL2, mainVer, helperVer, resVer);
+    }
+
+    private static void testURLClassLoaderURL(URL jarURL,
+            int mainVersionExpected, int helperVersionExpected,
+            int resourceVersionExpected) throws ClassNotFoundException,
+            NoSuchMethodException, IllegalAccessException,
+            IllegalArgumentException, InvocationTargetException, IOException {
+        System.out.println(
+                "Testing URLClassLoader MV JAR support for URL: " + jarURL);
+        URL[] urls = { jarURL };
+        int mainVersionActual;
+        int helperVersionActual;
+        int resourceVersionActual;
+        try (URLClassLoader cl = URLClassLoader.newInstance(urls)) {
+            Class c = cl.loadClass("testpackage.Main");
+            Method getMainVersion = c.getMethod("getMainVersion");
+            mainVersionActual = (int) getMainVersion.invoke(null);
+            Method getHelperVersion = c.getMethod("getHelperVersion");
+            helperVersionActual = (int) getHelperVersion.invoke(null);
+            try (InputStream ris = cl.getResourceAsStream("versionResource");
+                    BufferedReader br = new BufferedReader(
+                            new InputStreamReader(ris))) {
+                resourceVersionActual = Integer.parseInt(br.readLine());
+            }
+        }
+
+        assertEquals(mainVersionActual, mainVersionExpected,
+                         "Test failed: Expected Main class version: "
+                         + mainVersionExpected + " Actual version: "
+                         + mainVersionActual);
+        assertEquals(helperVersionActual, helperVersionExpected,
+                         "Test failed: Expected Helper class version: "
+                         + helperVersionExpected + " Actual version: "
+                         + helperVersionActual);
+        assertEquals(resourceVersionActual, resourceVersionExpected,
+                         "Test failed: Expected resource version: "
+                         + resourceVersionExpected + " Actual version: "
+                         + resourceVersionActual);
+    }
+
+    @Test(dataProvider = "jarFiles")
+    void testJjs(String jar, int mainVer, int helperVer, int resVer)
+            throws Throwable {
+        JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jjs");
+        launcher.addToolArg("-cp").addToolArg(jar)
+                .addToolArg(src + "/data/runtimetest/MVJarJJSTestScript.js");
+        ProcessTools.executeCommand(launcher.getCommand())
+                .shouldHaveExitValue(SUCCESS)
+                .shouldContain("Main version: " + mainVer)
+                .shouldContain("Helpers version: " + helperVer)
+                .shouldContain("Resource version: " + resVer);
+    }
+
+    private static OutputAnalyzer jar(String... args) throws Throwable {
+        JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jar");
+        Stream.of(args).forEach(launcher::addToolArg);
+        return ProcessTools.executeCommand(launcher.getCommand());
+    }
+
+    private void compile() throws Throwable {
+        String[] vers = { "base", "v9", "v10" };
+        for (String ver : vers) {
+            Path classes = Paths.get(usr, "classes", ver);
+            Files.createDirectories(classes);
+            Path source = Paths.get(src, "data", "runtimetest", ver);
+            assertTrue(CompilerUtils.compile(source, classes));
+            Files.copy(source.resolve("versionResource"),
+                    classes.resolve("versionResource"),
+                    StandardCopyOption.REPLACE_EXISTING);
+        }
+
+        Path classes = Paths.get(usr, "classes", "test");
+        Files.createDirectory(classes);
+        Path source = Paths.get(src, "data", "runtimetest", "test");
+        assertTrue(
+                CompilerUtils.compile(source, classes, "-cp", "classes/base/"));
+        Files.copy(Paths.get(src, "data", "runtimetest", "manifest.txt"),
+                Paths.get(usr, "manifest.txt"),
+                StandardCopyOption.REPLACE_EXISTING);
+    }
+
+    OutputAnalyzer java(String... args) throws Throwable {
+        String java = JDKToolFinder.getJDKTool("java");
+
+        List<String> commands = new ArrayList<>();
+        commands.add(java);
+        Stream.of(args).forEach(x -> commands.add(x));
+        return ProcessTools.executeCommand(new ProcessBuilder(commands));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/MVJarJJSTestScript.js	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+var Main = Java.type("testpackage.Main");
+var mainVersion = Main.getMainVersion();
+var helperVersion = Main.getHelperVersion();
+var resourceVersion = Main.getResourceVersion();
+print("Main version: " + mainVersion);
+print("Helpers version: " + helperVersion);
+print("Resource version: " + resourceVersion);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/base/testpackage/Helper.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ *
+ * 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 testpackage;
+
+public class Helper {
+
+    private static final int HELPER_VERSION = 8;
+
+    public static int getHelperVersion() {
+        return HELPER_VERSION;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/base/testpackage/Main.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ *
+ * 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 testpackage;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+public class Main {
+
+    private static final int MAIN_VERSION = 8;
+
+    public static void main(String[] args) {
+        System.out.println("Main version: " + getMainVersion());
+        System.out.println("Helpers version: " + getHelperVersion());
+        System.out.println("Resource version: " + getResourceVersion());
+    }
+
+    public static int getMainVersion() {
+        return MAIN_VERSION;
+    }
+
+    public static int getHelperVersion() {
+        return testpackage.Helper.getHelperVersion();
+    }
+
+    public static int getResourceVersion() {
+        ClassLoader cl = Main.class.getClassLoader();
+        InputStream ris = cl.getResourceAsStream("versionResource");
+        if (ris == null) {
+            throw new Error("Test issue: resource versionResource"
+                    + " cannot be loaded!");
+        }
+        try (BufferedReader br = new BufferedReader(new InputStreamReader(ris))) {
+            return Integer.parseInt(br.readLine());
+        } catch (IOException ioe) {
+            throw new Error("Unexpected issue", ioe);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/base/versionResource	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,1 @@
+8
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/manifest.txt	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,1 @@
+Main-Class: testpackage.Main
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/test/UseByImport.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import testpackage.Main;
+
+/**
+ * This class is used in MVJarAsLibraryTest.java test.
+ * It is a part of the test.
+ */
+public class UseByImport {
+
+    /**
+     * Method for the test execution.
+     * @param args - no args needed
+     */
+    public static void main(String[] args) {
+        System.out.println("Main version: " + Main.getMainVersion());
+        System.out.println("Helpers version: " + Main.getHelperVersion());
+        System.out.println("Resource version: " + Main.getResourceVersion());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/test/UseByReflection.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * This class is used in RuntimeTest.java.
+ */
+public class UseByReflection {
+
+    /**
+     * Method for the test execution.
+     *
+     * @param args - no args needed
+     * @throws java.lang.ClassNotFoundException
+     * @throws java.lang.NoSuchMethodException
+     * @throws java.lang.IllegalAccessException
+     * @throws java.lang.reflect.InvocationTargetException
+     * @throws java.io.IOException
+     */
+    public static void main(String[] args) throws ClassNotFoundException,
+            NoSuchMethodException, IllegalAccessException,
+            IllegalArgumentException, InvocationTargetException, IOException {
+        Class mainClass = Class.forName("testpackage.Main");
+        Method getMainVersion = mainClass.getMethod("getMainVersion");
+        int mainVersionActual = (int) getMainVersion.invoke(null);
+        Method getHelperVersion = mainClass.getMethod("getHelperVersion");
+        int helperVersionActual = (int) getHelperVersion.invoke(null);
+        ClassLoader cl = UseByReflection.class.getClassLoader();
+        int resourceVersionActual;
+        try (InputStream ris = cl.getResourceAsStream("versionResource");
+                BufferedReader br = new BufferedReader(new InputStreamReader(ris))) {
+            resourceVersionActual = Integer.parseInt(br.readLine());
+        }
+        System.out.println("Main version: " + mainVersionActual);
+        System.out.println("Helpers version: " + helperVersionActual);
+        System.out.println("Resource version: " + resourceVersionActual);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/testpackage/Helper.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ *
+ * 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 testpackage;
+
+public class Helper {
+
+    private static final int HELPER_VERSION = 10;
+
+    public static int getHelperVersion() {
+        return HELPER_VERSION;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/testpackage/Main.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ *
+ * 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 testpackage;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+public class Main {
+
+    private static final int MAIN_VERSION = 10;
+
+    public static void main(String[] args) {
+        System.out.println("Main version: " + getMainVersion());
+        System.out.println("Helpers version: " + getHelperVersion());
+        System.out.println("Resource version: " + getResourceVersion());
+    }
+
+    public static int getMainVersion() {
+        return MAIN_VERSION;
+    }
+
+    public static int getHelperVersion() {
+        return testpackage.Helper.getHelperVersion();
+    }
+
+    public static int getResourceVersion() {
+        ClassLoader cl = Main.class.getClassLoader();
+        InputStream ris = cl.getResourceAsStream("versionResource");
+        if (ris == null) {
+            throw new Error("Test issue: resource versionResource"
+                    + " cannot be loaded!");
+        }
+        try (BufferedReader br = new BufferedReader(new InputStreamReader(ris))) {
+            return Integer.parseInt(br.readLine());
+        } catch (IOException ioe) {
+            throw new Error("Unexpected issue", ioe);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/versionResource	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,1 @@
+10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/v9/testpackage/Helper.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ *
+ * 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 testpackage;
+
+public class Helper {
+
+    private static final int HELPER_VERSION = 9;
+
+    public static int getHelperVersion() {
+        return HELPER_VERSION;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/v9/testpackage/Main.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ *
+ * 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 testpackage;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+public class Main {
+
+    private static final int MAIN_VERSION = 9;
+
+    public static void main(String[] args) {
+        System.out.println("Main version: " + getMainVersion());
+        System.out.println("Helpers version: " + getHelperVersion());
+        System.out.println("Resource version: " + getResourceVersion());
+    }
+
+    public static int getMainVersion() {
+        return MAIN_VERSION;
+    }
+
+    public static int getHelperVersion() {
+        return testpackage.Helper.getHelperVersion();
+    }
+
+    public static int getResourceVersion() {
+        ClassLoader cl = Main.class.getClassLoader();
+        InputStream ris = cl.getResourceAsStream("versionResource");
+        if (ris == null) {
+            throw new Error("Test issue: resource versionResource"
+                    + " cannot be loaded!");
+        }
+        try (BufferedReader br = new BufferedReader(new InputStreamReader(ris))) {
+            return Integer.parseInt(br.readLine());
+        } catch (IOException ioe) {
+            throw new Error("Unexpected issue", ioe);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/v9/versionResource	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,1 @@
+9
--- a/langtools/.hgtags	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/.hgtags	Fri Jan 13 18:26:33 2017 +0100
@@ -393,3 +393,4 @@
 586c93260d3b2f91a055b96118b141c05841694f jdk-9+148
 4d4cd7cd731c1952d7330ea5bcfda8bd26820fa5 jdk-9+149
 e5a42ddaf633fde14b983f740ae0e7e490741fd1 jdk-9+150
+4f348bd05341581df84ff1510d5b3a9b5b488367 jdk-9+151
--- a/langtools/make/intellij/src/idea/LangtoolsIdeaAntLogger.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/make/intellij/src/idea/LangtoolsIdeaAntLogger.java	Fri Jan 13 18:26:33 2017 +0100
@@ -84,6 +84,8 @@
         JAVAC_WARNING(StringBinaryPredicate.CONTAINS, MSG_WARN, "warning:", "compiler.warn"),
         /** a javac note */
         JAVAC_NOTE(StringBinaryPredicate.CONTAINS, MSG_INFO, "note:", "compiler.note"),
+        /** a javac raw error (these typically come from a build misconfiguration - such as a bad javac flag) */
+        JAVAC_RAW_ERROR(StringBinaryPredicate.STARTS_WITH, MSG_INFO, "javac: "),
         /** continuation of some javac error message */
         JAVAC_NESTED_DIAG(StringBinaryPredicate.STARTS_WITH, MSG_INFO, "  "),
         /** a javac crash */
@@ -126,7 +128,7 @@
     enum Task {
         /** exec task - invoked during compilation */
         JAVAC("exec", MessageKind.JAVAC_ERROR, MessageKind.JAVAC_WARNING, MessageKind.JAVAC_NOTE,
-                       MessageKind.JAVAC_NESTED_DIAG, MessageKind.JAVAC_CRASH),
+                       MessageKind.JAVAC_RAW_ERROR, MessageKind.JAVAC_NESTED_DIAG, MessageKind.JAVAC_CRASH),
         /** jtreg task - invoked during test execution */
         JTREG("jtreg", MessageKind.JTREG_TEST_PASSED, MessageKind.JTREG_TEST_FAILED, MessageKind.JTREG_TEST_ERROR, MessageKind.JTREG_TEST_REPORT),
         /** initial synthetic task when the logger is created */
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Fri Jan 13 18:26:33 2017 +0100
@@ -3845,20 +3845,26 @@
             return bounds.head;
         } else {                            // length > 1
             int classCount = 0;
+            List<Type> cvars = List.nil();
             List<Type> lowers = List.nil();
             for (Type bound : bounds) {
                 if (!bound.isInterface()) {
                     classCount++;
                     Type lower = cvarLowerBound(bound);
-                    if (bound != lower && !lower.hasTag(BOT))
-                        lowers = insert(lowers, lower);
+                    if (bound != lower && !lower.hasTag(BOT)) {
+                        cvars = cvars.append(bound);
+                        lowers = lowers.append(lower);
+                    }
                 }
             }
             if (classCount > 1) {
-                if (lowers.isEmpty())
+                if (lowers.isEmpty()) {
                     return createErrorType(errT);
-                else
-                    return glbFlattened(union(bounds, lowers), errT);
+                } else {
+                    // try again with lower bounds included instead of capture variables
+                    List<Type> newBounds = bounds.diff(cvars).appendList(lowers);
+                    return glb(newBounds);
+                }
             }
         }
         return makeIntersectionType(bounds);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1740,7 +1740,7 @@
         accept(ARROW);
 
         return token.kind == LBRACE ?
-            lambdaStatement(args, pos, pos) :
+            lambdaStatement(args, pos, token.pos) :
             lambdaExpression(args, pos);
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Fri Jan 13 18:26:33 2017 +0100
@@ -114,6 +114,7 @@
     private final boolean fatalErrors;
     private final boolean werror;
     private final boolean showResolveErrors;
+    private final boolean allowModules;
 
     private final JavacFiler filer;
     private final JavacMessager messager;
@@ -178,7 +179,6 @@
     private final Enter enter;
     private final Completer initialCompleter;
     private final Check chk;
-    private final ModuleSymbol defaultModule;
 
     private final Context context;
 
@@ -230,8 +230,7 @@
         chk = Check.instance(context);
         initProcessorLoader();
 
-        defaultModule = source.allowModules() && options.isUnset("noModules")
-                ? symtab.unnamedModule : symtab.noModule;
+        allowModules = source.allowModules() && options.isUnset("noModules");
     }
 
     public void setProcessors(Iterable<? extends Processor> processors) {
@@ -665,7 +664,7 @@
         private ArrayList<Pattern> supportedAnnotationPatterns;
         private ArrayList<String>  supportedOptionNames;
 
-        ProcessorState(Processor p, Log log, Source source, ProcessingEnvironment env) {
+        ProcessorState(Processor p, Log log, Source source, boolean allowModules, ProcessingEnvironment env) {
             processor = p;
             contributed = false;
 
@@ -676,7 +675,8 @@
 
                 supportedAnnotationPatterns = new ArrayList<>();
                 for (String importString : processor.getSupportedAnnotationTypes()) {
-                    supportedAnnotationPatterns.add(importStringToPattern(importString,
+                    supportedAnnotationPatterns.add(importStringToPattern(allowModules,
+                                                                          importString,
                                                                           processor,
                                                                           log));
                 }
@@ -768,7 +768,8 @@
 
                 if (psi.processorIterator.hasNext()) {
                     ProcessorState ps = new ProcessorState(psi.processorIterator.next(),
-                                                           log, source, JavacProcessingEnvironment.this);
+                                                           log, source, allowModules,
+                                                           JavacProcessingEnvironment.this);
                     psi.procStateList.add(ps);
                     return ps;
                 } else
@@ -834,7 +835,8 @@
 
         for(TypeElement a  : annotationsPresent) {
             ModuleElement mod = elementUtils.getModuleOf(a);
-            unmatchedAnnotations.put((mod != null ? mod.getSimpleName() + "/" : "") + a.getQualifiedName().toString(),
+            String moduleSpec = allowModules && mod != null ? mod.getSimpleName() + "/" : "";
+            unmatchedAnnotations.put(moduleSpec + a.getQualifiedName().toString(),
                                      a);
         }
 
@@ -1657,7 +1659,7 @@
      * regex matching that string.  If the string is not a valid
      * import-style string, return a regex that won't match anything.
      */
-    private static Pattern importStringToPattern(String s, Processor p, Log log) {
+    private static Pattern importStringToPattern(boolean allowModules, String s, Processor p, Log log) {
         String module;
         String pkg;
         int slash = s.indexOf('/');
@@ -1672,7 +1674,7 @@
             pkg = s.substring(slash + 1);
         }
         if (MatchingUtils.isValidImportString(pkg)) {
-            return Pattern.compile(module + MatchingUtils.validImportStringToPatternString(pkg));
+            return Pattern.compile((allowModules ? module : "") + MatchingUtils.validImportStringToPatternString(pkg));
         } else {
             log.warning("proc.malformed.supported.string", s, p.getClass().getName());
             return noMatches; // won't match any valid identifier
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Jan 13 18:26:33 2017 +0100
@@ -2558,7 +2558,7 @@
 # 0: string
 compiler.err.intersection.types.in.cast.not.supported.in.source=\
     intersection types in cast are not supported in -source {0}\n\
-    (use -source 8 or higher to enable default methods)
+    (use -source 8 or higher to enable intersection types in cast)
 
 # 0: string
 compiler.err.static.intf.methods.not.supported.in.source=\
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsConfiguration.java	Fri Jan 13 18:26:33 2017 +0100
@@ -105,18 +105,18 @@
         // build root set for resolution
         Set<String> mods = new HashSet<>(roots);
 
-        // add default modules to the root set
-        // unnamed module
-        if (!initialArchives.isEmpty() || !classpaths.isEmpty() ||
-                roots.isEmpty() || allDefaultModules) {
-            mods.addAll(systemModulePath.defaultSystemRoots());
-        }
-        if (allSystemModules) {
+        // add all system modules to the root set for unnamed module or set explicitly
+        boolean unnamed = !initialArchives.isEmpty() || !classpaths.isEmpty();
+        if (allSystemModules || (unnamed && !allDefaultModules)) {
             systemModulePath.findAll().stream()
                 .map(mref -> mref.descriptor().name())
                 .forEach(mods::add);
         }
 
+        if (allDefaultModules) {
+            mods.addAll(systemModulePath.defaultSystemRoots());
+        }
+
         this.configuration = Configuration.empty()
                 .resolveRequires(finder, ModuleFinder.of(), mods);
 
@@ -502,6 +502,7 @@
         boolean addAllApplicationModules;
         boolean addAllDefaultModules;
         boolean addAllSystemModules;
+        boolean allModules;
         Runtime.Version version;
 
         public Builder() {
@@ -550,8 +551,7 @@
          * Include all system modules and modules found on modulepath
          */
         public Builder allModules() {
-            this.addAllSystemModules = true;
-            this.addAllApplicationModules = true;
+            this.allModules = true;
             return this;
         }
 
@@ -592,19 +592,30 @@
                         .map(mref -> mref.descriptor().name())
                         .forEach(rootModules::add);
             }
-            if (addAllApplicationModules && appModulePath != null) {
+
+            if ((addAllApplicationModules || allModules) && appModulePath != null) {
                 appModulePath.findAll().stream()
                     .map(mref -> mref.descriptor().name())
                     .forEach(rootModules::add);
             }
 
+            // no archive is specified for analysis
+            // add all system modules as root if --add-modules ALL-SYSTEM is specified
+            if (addAllSystemModules && rootModules.isEmpty() &&
+                    initialArchives.isEmpty() && classPaths.isEmpty()) {
+                systemModulePath.findAll()
+                    .stream()
+                    .map(mref -> mref.descriptor().name())
+                    .forEach(rootModules::add);
+            }
+
             return new JdepsConfiguration(systemModulePath,
                                           finder,
                                           rootModules,
                                           classPaths,
                                           initialArchives,
                                           addAllDefaultModules,
-                                          addAllSystemModules,
+                                          allModules,
                                           version);
         }
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java	Fri Jan 13 18:26:33 2017 +0100
@@ -38,10 +38,10 @@
 import java.nio.file.Paths;
 import java.text.MessageFormat;
 import java.util.*;
+import java.util.function.Function;
+import java.util.function.ToIntFunction;
 import java.util.jar.JarFile;
 import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 /**
  * Implementation for the jdeps tool for static class dependency analysis.
@@ -314,7 +314,10 @@
         },
         new Option(true, "-m", "--module") {
             void process(JdepsTask task, String opt, String arg) throws BadArgs {
-                task.options.rootModule = arg;
+                if (!task.options.rootModules.isEmpty()) {
+                    throw new BadArgs("err.option.already.specified", opt);
+                }
+                task.options.rootModules.add(arg);
                 task.options.addmods.add(arg);
             }
         },
@@ -350,6 +353,7 @@
         new Option(true, "--require") {
             void process(JdepsTask task, String opt, String arg) {
                 task.options.requires.add(arg);
+                task.options.addmods.add(arg);
             }
         },
         new Option(true, "-f", "-filter") {
@@ -491,11 +495,6 @@
             if (options.help || options.version || options.fullVersion) {
                 return EXIT_OK;
             }
-
-            if (!inputArgs.isEmpty() && options.rootModule != null) {
-                reportError("err.invalid.arg.for.option", "-m");
-            }
-
             if (options.numFilters() > 1) {
                 reportError("err.invalid.filters");
                 return EXIT_CMDERR;
@@ -543,8 +542,8 @@
                                                      e.getKey(),
                                                      e.getValue().toString())));
 
-            // check if any module specified in --require is missing
-            Stream.concat(options.addmods.stream(), options.requires.stream())
+            // check if any module specified in --add-modules, --require, and -m is missing
+            options.addmods.stream()
                 .filter(mn -> !config.isValidToken(mn))
                 .forEach(mn -> config.findModule(mn).orElseThrow(() ->
                     new UncheckedBadArgs(new BadArgs("err.module.not.found", mn))));
@@ -620,6 +619,7 @@
         protected Command(CommandOption option) {
             this.option = option;
         }
+
         /**
          * Returns true if the command-line options are all valid;
          * otherwise, returns false.
@@ -633,6 +633,10 @@
 
         /**
          * Includes all modules on system module path and application module path
+         *
+         * When a named module is analyzed, it will analyze the dependences
+         * only.  The method should be overridden when this command should
+         * analyze all modules instead.
          */
         boolean allModules() {
             return false;
@@ -680,6 +684,10 @@
                     return false;
                 }
             }
+
+            if (!inputArgs.isEmpty() && !options.rootModules.isEmpty()) {
+                reportError("err.invalid.arg.for.option", "-m");
+            }
             if (inputArgs.isEmpty() && !options.hasSourcePath()) {
                 showHelp();
                 return false;
@@ -808,23 +816,46 @@
             log.println();
             if (!options.requires.isEmpty())
                 log.println(getMessage("inverse.transitive.dependencies.on",
-                    options.requires));
+                                       options.requires));
             else
                 log.println(getMessage("inverse.transitive.dependencies.matching",
-                    options.regex != null
-                        ? options.regex.toString()
-                        : "packages " + options.packageNames));
+                                       options.regex != null
+                                           ? options.regex.toString()
+                                           : "packages " + options.packageNames));
 
-            analyzer.inverseDependences().stream()
-                .sorted(Comparator.comparing(this::sortPath))
-                .forEach(path -> log.println(path.stream()
-                    .map(Archive::getName)
-                    .collect(joining(" <- "))));
+            analyzer.inverseDependences()
+                    .stream()
+                    .sorted(comparator())
+                    .map(this::toInversePath)
+                    .forEach(log::println);
             return ok;
         }
 
-        private String sortPath(Deque<Archive> path) {
-            return path.peekFirst().getName();
+        private String toInversePath(Deque<Archive> path) {
+            return path.stream()
+                       .map(Archive::getName)
+                       .collect(joining(" <- "));
+        }
+
+        /*
+         * Returns a comparator for sorting the inversed path, grouped by
+         * the first module name, then the shortest path and then sort by
+         * the module names of each path
+         */
+        private Comparator<Deque<Archive>> comparator() {
+            return Comparator.<Deque<Archive>, String>
+                comparing(deque -> deque.peekFirst().getName())
+                    .thenComparingInt(Deque::size)
+                    .thenComparing(this::toInversePath);
+        }
+
+        /*
+         * Returns true if --require is specified so that all modules are
+         * analyzed to find all modules that depend on the modules specified in the
+         * --require option directly and indirectly
+         */
+        public boolean allModules() {
+            return options.requires.size() > 0;
         }
     }
 
@@ -924,6 +955,9 @@
             return new ModuleAnalyzer(config, log, modules).run();
         }
 
+        /*
+         * Returns true to analyze all modules
+         */
         public boolean allModules() {
             return true;
         }
@@ -957,6 +991,10 @@
                             option);
                 return false;
             }
+
+            if (!inputArgs.isEmpty() && !options.rootModules.isEmpty()) {
+                reportError("err.invalid.arg.for.option", "-m");
+            }
             if (inputArgs.isEmpty() && !options.hasSourcePath()) {
                 showHelp();
                 return false;
@@ -971,11 +1009,6 @@
                                              reduced,
                                              log).run();
         }
-
-        @Override
-        boolean allModules() {
-            return true;
-        }
     }
 
 
@@ -1155,7 +1188,7 @@
         String systemModulePath = System.getProperty("java.home");
         String upgradeModulePath;
         String modulePath;
-        String rootModule;
+        Set<String> rootModules = new HashSet<>();
         Set<String> addmods = new HashSet<>();
         Runtime.Version multiRelease;
 
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleExportsAnalyzer.java	Fri Jan 13 18:26:33 2017 +0100
@@ -34,6 +34,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import static com.sun.tools.jdeps.Analyzer.NOT_FOUND;
 
@@ -109,9 +110,7 @@
     private void printDependences() {
         // find use of JDK internals
         Map<Module, Set<String>> jdkinternals = new HashMap<>();
-        deps.keySet().stream()
-            .filter(source -> !source.getModule().isNamed())
-            .map(deps::get)
+        dependenceStream()
             .flatMap(map -> map.entrySet().stream())
             .filter(e -> e.getValue().size() > 0)
             .forEach(e -> jdkinternals.computeIfAbsent(e.getKey().getModule(),
@@ -124,11 +123,10 @@
         Module root = new RootModule("root");
         builder.addModule(root);
         // find named module dependences
-        deps.keySet().stream()
-            .filter(source -> !source.getModule().isNamed())
-            .map(deps::get)
+        dependenceStream()
             .flatMap(map -> map.keySet().stream())
-            .filter(m -> m.getModule().isNamed())
+            .filter(m -> m.getModule().isNamed()
+                            && !configuration.rootModules().contains(m))
             .map(Archive::getModule)
             .forEach(m -> builder.addEdge(root, m));
 
@@ -167,6 +165,16 @@
             });
     }
 
+    /*
+     * Returns a stream of dependence map from an Archive to the set of JDK
+     * internal APIs being used.
+     */
+    private Stream<Map<Archive, Set<String>>> dependenceStream() {
+        return deps.keySet().stream()
+                   .filter(source -> !source.getModule().isNamed()
+                            || configuration.rootModules().contains(source))
+                   .map(deps::get);
+    }
 
     private class RootModule extends Module {
         final ModuleDescriptor descriptor;
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties	Fri Jan 13 18:26:33 2017 +0100
@@ -194,6 +194,7 @@
 err.invalid.options={0} cannot be used with {1} option
 err.module.not.found=module not found: {0}
 err.root.module.not.set=root module set empty
+err.option.already.specified={0} option specified more than once.
 err.filter.not.specified=--package (-p), --regex (-e), --require option must be specified
 err.multirelease.option.exists={0} is not a multi-release jar file, but the --multi-release option is set
 err.multirelease.option.notfound={0} is a multi-release jar file, but the --multi-release option is not set
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Fri Jan 13 18:26:33 2017 +0100
@@ -47,7 +47,9 @@
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -185,10 +187,7 @@
     private IOContext input = null;
     private boolean regenerateOnDeath = true;
     private boolean live = false;
-    private boolean feedbackInitialized = false;
-    private String commandLineFeedbackMode = null;
-    private List<String> remoteVMOptions = new ArrayList<>();
-    private List<String> compilerOptions = new ArrayList<>();
+    private Options options;
 
     SourceCodeAnalysis analysis;
     JShell state = null;
@@ -198,7 +197,6 @@
 
     private boolean debug = false;
     public boolean testPrompt = false;
-    private String cmdlineClasspath = null;
     private String defaultStartup = null;
     private String startup = null;
     private String executionControlSpec = null;
@@ -221,6 +219,16 @@
     static final Pattern BUILTIN_FILE_PATTERN = Pattern.compile("\\w+");
     static final String BUILTIN_FILE_PATH_FORMAT = "jrt:/jdk.jshell/jdk/jshell/tool/resources/%s.jsh";
 
+    // match anything followed by whitespace
+    private static final Pattern OPTION_PRE_PATTERN =
+            Pattern.compile("\\s*(\\S+\\s+)*?");
+    // match a (possibly incomplete) option flag with optional double-dash and/or internal dashes
+    private static final Pattern OPTION_PATTERN =
+            Pattern.compile(OPTION_PRE_PATTERN.pattern() + "(?<dd>-??)(?<flag>-([a-z][a-z\\-]*)?)");
+    // match an option flag and a (possibly missing or incomplete) value
+    private static final Pattern OPTION_VALUE_PATTERN =
+            Pattern.compile(OPTION_PATTERN.pattern() + "\\s+(?<val>\\S*)");
+
     // Tool id (tid) mapping: the three name spaces
     NameSpace mainNamespace;
     NameSpace startNamespace;
@@ -229,7 +237,278 @@
     // Tool id (tid) mapping: the current name spaces
     NameSpace currentNameSpace;
 
-    Map<Snippet,SnippetInfo> mapSnippet;
+    Map<Snippet, SnippetInfo> mapSnippet;
+
+    // Kinds of compiler/runtime init options
+    private enum OptionKind {
+        CLASS_PATH("--class-path", true),
+        MODULE_PATH("--module-path", true),
+        ADD_MODULES("--add-modules", false),
+        ADD_EXPORTS("--add-exports", false),
+        TO_COMPILER("-C", false, false, true, false),
+        TO_REMOTE_VM("-R", false, false, false, true),;
+        final String optionFlag;
+        final boolean onlyOne;
+        final boolean passFlag;
+        final boolean toCompiler;
+        final boolean toRemoteVm;
+
+        private OptionKind(String optionFlag, boolean onlyOne) {
+            this(optionFlag, onlyOne, true, true, true);
+        }
+
+        private OptionKind(String optionFlag, boolean onlyOne, boolean passFlag,
+                boolean toCompiler, boolean toRemoteVm) {
+            this.optionFlag = optionFlag;
+            this.onlyOne = onlyOne;
+            this.passFlag = passFlag;
+            this.toCompiler = toCompiler;
+            this.toRemoteVm = toRemoteVm;
+        }
+
+    }
+
+    // compiler/runtime init option values
+    private static class Options {
+
+        private Map<OptionKind, List<String>> optMap = new HashMap<>();
+
+        private String[] selectOptions(Predicate<Entry<OptionKind, List<String>>> pred) {
+            return optMap.entrySet().stream()
+                    .filter(pred)
+                    .flatMap(e -> e.getValue().stream())
+                    .toArray(String[]::new);
+        }
+
+        String[] remoteVmOptions() {
+            return selectOptions(e -> e.getKey().toRemoteVm);
+        }
+
+        String[] compilerOptions() {
+            return selectOptions(e -> e.getKey().toCompiler);
+        }
+
+        String[] commonOptions() {
+            return selectOptions(e -> e.getKey().passFlag);
+        }
+
+        void addAll(OptionKind kind, Collection<String> vals) {
+            optMap.computeIfAbsent(kind, k -> new ArrayList<>())
+                    .addAll(vals);
+        }
+
+        void override(Options newer) {
+            newer.optMap.entrySet().stream()
+                    .forEach(e -> {
+                        if (e.getKey().onlyOne) {
+                            // Only one allowed, override last
+                            optMap.put(e.getKey(), e.getValue());
+                        } else {
+                            // Additive
+                            addAll(e.getKey(), e.getValue());
+                        }
+                    });
+        }
+    }
+
+    // base option parsing of /env, /reload, and /reset and command-line options
+    private class OptionParserBase {
+
+        final OptionParser parser = new OptionParser();
+        private final OptionSpec<String> argClassPath = parser.accepts("class-path").withRequiredArg();
+        private final OptionSpec<String> argModulePath = parser.accepts("module-path").withRequiredArg();
+        private final OptionSpec<String> argAddModules = parser.accepts("add-modules").withRequiredArg();
+        private final OptionSpec<String> argAddExports = parser.accepts("add-exports").withRequiredArg();
+        private final NonOptionArgumentSpec<String> argNonOptions = parser.nonOptions();
+
+        private Options opts = new Options();
+        private List<String> nonOptions;
+        private boolean failed = false;
+
+        List<String> nonOptions() {
+            return nonOptions;
+        }
+
+        void msg(String key, Object... args) {
+            errormsg(key, args);
+        }
+
+        Options parse(String[] args) throws OptionException {
+            try {
+                OptionSet oset = parser.parse(args);
+                nonOptions = oset.valuesOf(argNonOptions);
+                return parse(oset);
+            } catch (OptionException ex) {
+                if (ex.options().isEmpty()) {
+                    msg("jshell.err.opt.invalid", stream(args).collect(joining(", ")));
+                } else {
+                    boolean isKnown = parser.recognizedOptions().containsKey(ex.options().iterator().next());
+                    msg(isKnown
+                            ? "jshell.err.opt.arg"
+                            : "jshell.err.opt.unknown",
+                            ex.options()
+                            .stream()
+                            .collect(joining(", ")));
+                }
+                return null;
+            }
+        }
+
+        Options parse(OptionSet options) {
+            addOptions(OptionKind.CLASS_PATH, options.valuesOf(argClassPath));
+            addOptions(OptionKind.MODULE_PATH, options.valuesOf(argModulePath));
+            addOptions(OptionKind.ADD_MODULES, options.valuesOf(argAddModules));
+            addOptions(OptionKind.ADD_EXPORTS, options.valuesOf(argAddExports).stream()
+                    .map(mp -> mp.contains("=") ? mp : mp + "=ALL-UNNAMED")
+                    .collect(toList())
+            );
+
+            return failed ? null : opts;
+        }
+
+        void addOptions(OptionKind kind, Collection<String> vals) {
+            if (!vals.isEmpty()) {
+                if (kind.onlyOne && vals.size() > 1) {
+                    msg("jshell.err.opt.one", kind.optionFlag);
+                    failed = true;
+                    return;
+                }
+                if (kind.passFlag) {
+                    vals = vals.stream()
+                            .flatMap(mp -> Stream.of(kind.optionFlag, mp))
+                            .collect(toList());
+                }
+                opts.addAll(kind, vals);
+            }
+        }
+    }
+
+    // option parsing for /reload (adds -restore -quiet)
+    private class OptionParserReload extends OptionParserBase {
+
+        private final OptionSpecBuilder argRestore = parser.accepts("restore");
+        private final OptionSpecBuilder argQuiet   = parser.accepts("quiet");
+
+        private boolean restore = false;
+        private boolean quiet = false;
+
+        boolean restore() {
+            return restore;
+        }
+
+        boolean quiet() {
+            return quiet;
+        }
+
+        @Override
+        Options parse(OptionSet options) {
+            if (options.has(argRestore)) {
+                restore = true;
+            }
+            if (options.has(argQuiet)) {
+                quiet = true;
+            }
+            return super.parse(options);
+        }
+    }
+
+    // option parsing for command-line
+    private class OptionParserCommandLine extends OptionParserBase {
+
+        private final OptionSpec<String> argStart = parser.accepts("startup").withRequiredArg();
+        private final OptionSpecBuilder argNoStart = parser.acceptsAll(asList("n", "no-startup"));
+        private final OptionSpec<String> argFeedback = parser.accepts("feedback").withRequiredArg();
+        private final OptionSpec<String> argExecution = parser.accepts("execution").withRequiredArg();
+        private final OptionSpecBuilder argQ = parser.accepts("q");
+        private final OptionSpecBuilder argS = parser.accepts("s");
+        private final OptionSpecBuilder argV = parser.accepts("v");
+        private final OptionSpec<String> argR = parser.accepts("R").withRequiredArg();
+        private final OptionSpec<String> argC = parser.accepts("C").withRequiredArg();
+        private final OptionSpecBuilder argHelp = parser.acceptsAll(asList("h", "help"));
+        private final OptionSpecBuilder argVersion = parser.accepts("version");
+        private final OptionSpecBuilder argFullVersion = parser.accepts("full-version");
+        private final OptionSpecBuilder argX = parser.accepts("X");
+
+        private String feedbackMode = null;
+        private String initialStartup = null;
+
+        String feedbackMode() {
+            return feedbackMode;
+        }
+
+        String startup() {
+            return initialStartup;
+        }
+
+        @Override
+        void msg(String key, Object... args) {
+            startmsg(key, args);
+        }
+
+        @Override
+        Options parse(OptionSet options) {
+            if (options.has(argHelp)) {
+                printUsage();
+                return null;
+            }
+            if (options.has(argX)) {
+                printUsageX();
+                return null;
+            }
+            if (options.has(argVersion)) {
+                cmdout.printf("jshell %s\n", version());
+                return null;
+            }
+            if (options.has(argFullVersion)) {
+                cmdout.printf("jshell %s\n", fullVersion());
+                return null;
+            }
+            if ((options.valuesOf(argFeedback).size() +
+                    (options.has(argQ) ? 1 : 0) +
+                    (options.has(argS) ? 1 : 0) +
+                    (options.has(argV) ? 1 : 0)) > 1) {
+                msg("jshell.err.opt.feedback.one");
+                return null;
+            } else if (options.has(argFeedback)) {
+                feedbackMode = options.valueOf(argFeedback);
+            } else if (options.has("q")) {
+                feedbackMode = "concise";
+            } else if (options.has("s")) {
+                feedbackMode = "silent";
+            } else if (options.has("v")) {
+                feedbackMode = "verbose";
+            }
+            if (options.has(argStart)) {
+                List<String> sts = options.valuesOf(argStart);
+                if (options.has("no-startup")) {
+                    startmsg("jshell.err.opt.startup.conflict");
+                    return null;
+                }
+                StringBuilder sb = new StringBuilder();
+                for (String fn : sts) {
+                    String s = readFile(fn, "--startup");
+                    if (s == null) {
+                        return null;
+                    }
+                    sb.append(s);
+                }
+                initialStartup = sb.toString();
+            } else if (options.has(argNoStart)) {
+                initialStartup = "";
+            } else {
+                initialStartup = prefs.get(STARTUP_KEY);
+                if (initialStartup == null) {
+                    initialStartup = defaultStartup();
+                }
+            }
+            if (options.has(argExecution)) {
+                executionControlSpec = options.valueOf(argExecution);
+            }
+            addOptions(OptionKind.TO_REMOTE_VM, options.valuesOf(argR));
+            addOptions(OptionKind.TO_COMPILER, options.valuesOf(argC));
+            return super.parse(options);
+        }
+    }
 
     /**
      * Is the input/output currently interactive
@@ -464,43 +743,45 @@
     }
 
     public void start(String[] args) throws Exception {
-        List<String> loadList = processCommandArgs(args);
-        if (loadList == null) {
+        OptionParserCommandLine commandLineArgs = new OptionParserCommandLine();
+        options = commandLineArgs.parse(args);
+        if (options == null) {
             // Abort
             return;
         }
-        try (IOContext in = new ConsoleIOContext(this, cmdin, console)) {
-            start(in, loadList);
-        }
-    }
-
-    private void start(IOContext in, List<String> loadList) {
-        // If startup hasn't been set by command line, set from retained/default
-        if (startup == null) {
-            startup = prefs.get(STARTUP_KEY);
-            if (startup == null) {
-                startup = defaultStartup();
-            }
-        }
-
+        startup = commandLineArgs.startup();
+        // initialize editor settings
         configEditor();
-
-        resetState(); // Initialize
-
+        // initialize JShell instance
+        resetState();
         // Read replay history from last jshell session into previous history
         String prevReplay = prefs.get(REPLAY_RESTORE_KEY);
         if (prevReplay != null) {
             replayableHistoryPrevious = Arrays.asList(prevReplay.split(RECORD_SEPARATOR));
         }
-
-        for (String loadFile : loadList) {
+        // load snippet/command files given on command-line
+        for (String loadFile : commandLineArgs.nonOptions()) {
             runFile(loadFile, "jshell");
         }
+        // if we survived that...
+        if (regenerateOnDeath) {
+            // initialize the predefined feedback modes
+            initFeedback(commandLineArgs.feedbackMode());
+        }
+        // check again, as feedback setting could have failed
+        if (regenerateOnDeath) {
+            // if we haven't died, and the feedback mode wants fluff, print welcome
+            if (feedback.shouldDisplayCommandFluff()) {
+                hardmsg("jshell.msg.welcome", version());
+            }
+            // execute from user input
+            try (IOContext in = new ConsoleIOContext(this, cmdin, console)) {
+                start(in);
+            }
+        }
+    }
 
-        if (regenerateOnDeath && feedback.shouldDisplayCommandFluff()) {
-            hardmsg("jshell.msg.welcome", version());
-        }
-
+    private void start(IOContext in) {
         try {
             while (regenerateOnDeath) {
                 if (!live) {
@@ -530,144 +811,6 @@
         return editor = BUILT_IN_EDITOR;
     }
 
-    /**
-     * Process the command line arguments.
-     * Set options.
-     * @param args the command line arguments
-     * @return the list of files to be loaded
-     */
-    private List<String> processCommandArgs(String[] args) {
-        OptionParser parser = new OptionParser();
-        OptionSpec<String> cp = parser.accepts("class-path").withRequiredArg();
-        OptionSpec<String> mpath = parser.accepts("module-path").withRequiredArg();
-        OptionSpec<String> amods = parser.accepts("add-modules").withRequiredArg();
-        OptionSpec<String> st = parser.accepts("startup").withRequiredArg();
-        parser.acceptsAll(asList("n", "no-startup"));
-        OptionSpec<String> fb = parser.accepts("feedback").withRequiredArg();
-        OptionSpec<String> ec = parser.accepts("execution").withRequiredArg();
-        parser.accepts("q");
-        parser.accepts("s");
-        parser.accepts("v");
-        OptionSpec<String> r = parser.accepts("R").withRequiredArg();
-        OptionSpec<String> c = parser.accepts("C").withRequiredArg();
-        parser.acceptsAll(asList("h", "help"));
-        parser.accepts("version");
-        parser.accepts("full-version");
-
-        parser.accepts("X");
-        OptionSpec<String> addExports = parser.accepts("add-exports").withRequiredArg();
-
-        NonOptionArgumentSpec<String> loadFileSpec = parser.nonOptions();
-
-        OptionSet options;
-        try {
-            options = parser.parse(args);
-        } catch (OptionException ex) {
-            if (ex.options().isEmpty()) {
-                startmsg("jshell.err.opt.invalid", stream(args).collect(joining(", ")));
-            } else {
-                boolean isKnown = parser.recognizedOptions().containsKey(ex.options().iterator().next());
-                startmsg(isKnown
-                        ? "jshell.err.opt.arg"
-                        : "jshell.err.opt.unknown",
-                        ex.options()
-                        .stream()
-                        .collect(joining(", ")));
-            }
-            return null;
-        }
-
-        if (options.has("help")) {
-            printUsage();
-            return null;
-        }
-        if (options.has("X")) {
-            printUsageX();
-            return null;
-        }
-        if (options.has("version")) {
-            cmdout.printf("jshell %s\n", version());
-            return null;
-        }
-        if (options.has("full-version")) {
-            cmdout.printf("jshell %s\n", fullVersion());
-            return null;
-        }
-        if (options.has(cp)) {
-            List<String> cps = options.valuesOf(cp);
-            if (cps.size() > 1) {
-                startmsg("jshell.err.opt.one", "--class-path");
-                return null;
-            }
-            cmdlineClasspath = cps.get(0);
-        }
-        if (options.has(st)) {
-            List<String> sts = options.valuesOf(st);
-            if (options.has("no-startup")) {
-                startmsg("jshell.err.opt.startup.conflict");
-                return null;
-            }
-            StringBuilder sb = new StringBuilder();
-            for (String fn : sts) {
-                String s = readFile(fn, "--startup");
-                if (s == null) {
-                    return null;
-                }
-                sb.append(s);
-            }
-            startup = sb.toString();
-        } else if (options.has("no-startup")) {
-            startup = "";
-        }
-        if ((options.valuesOf(fb).size() +
-                 (options.has("q") ? 1 : 0) +
-                 (options.has("s") ? 1 : 0) +
-                 (options.has("v") ? 1 : 0)) > 1) {
-            startmsg("jshell.err.opt.feedback.one");
-            return null;
-        } else if (options.has(fb)) {
-            commandLineFeedbackMode = options.valueOf(fb);
-        } else if (options.has("q")) {
-            commandLineFeedbackMode = "concise";
-        } else if (options.has("s")) {
-            commandLineFeedbackMode = "silent";
-        } else if (options.has("v")) {
-            commandLineFeedbackMode = "verbose";
-        }
-        if (options.has(r)) {
-            remoteVMOptions.addAll(options.valuesOf(r));
-        }
-        if (options.has(c)) {
-            compilerOptions.addAll(options.valuesOf(c));
-        }
-        if (options.has(mpath)) {
-            compilerOptions.add("--module-path");
-            compilerOptions.addAll(options.valuesOf(mpath));
-            remoteVMOptions.add("--module-path");
-            remoteVMOptions.addAll(options.valuesOf(mpath));
-        }
-        if (options.has(amods)) {
-            compilerOptions.add("--add-modules");
-            compilerOptions.addAll(options.valuesOf(amods));
-            remoteVMOptions.add("--add-modules");
-            remoteVMOptions.addAll(options.valuesOf(amods));
-        }
-        if (options.has(ec)) {
-            executionControlSpec = options.valueOf(ec);
-        }
-
-        if (options.has(addExports)) {
-            List<String> exports = options.valuesOf(addExports).stream()
-                    .map(mp -> mp + "=ALL-UNNAMED")
-                    .flatMap(mp -> Stream.of("--add-exports", mp))
-                    .collect(toList());
-            remoteVMOptions.addAll(exports);
-            compilerOptions.addAll(exports);
-        }
-
-        return options.valuesOf(loadFileSpec);
-    }
-
     private void printUsage() {
         cmdout.print(getResourceString("help.usage"));
     }
@@ -734,8 +877,8 @@
                 .idGenerator((sn, i) -> (currentNameSpace == startNamespace || state.status(sn).isActive())
                         ? currentNameSpace.tid(sn)
                         : errorNamespace.tid(sn))
-                .remoteVMOptions(remoteVMOptions.stream().toArray(String[]::new))
-                .compilerOptions(compilerOptions.stream().toArray(String[]::new));
+                .remoteVMOptions(options.remoteVmOptions())
+                .compilerOptions(options.compilerOptions());
         if (executionControlSpec != null) {
             builder.executionEngine(executionControlSpec);
         }
@@ -748,15 +891,6 @@
         });
         analysis = state.sourceCodeAnalysis();
         live = true;
-        if (!feedbackInitialized) {
-            // One time per run feedback initialization
-            feedbackInitialized = true;
-            initFeedback();
-        }
-
-        if (cmdlineClasspath != null) {
-            state.addToClasspath(cmdlineClasspath);
-        }
 
         startUpRun(startup);
         currentNameSpace = mainNamespace;
@@ -767,7 +901,7 @@
     }
 
     //where -- one-time per run initialization of feedback modes
-    private void initFeedback() {
+    private void initFeedback(String initMode) {
         // No fluff, no prefix, for init failures
         MessageHandler initmh = new InitMessageHandler();
         // Execute the feedback initialization code in the resource file
@@ -782,12 +916,11 @@
                 prefs.remove(MODE_KEY);
             }
         }
-        if (commandLineFeedbackMode != null) {
+        if (initMode != null) {
             // The feedback mode to use was specified on the command line, use it
-            if (!setFeedback(initmh, new ArgTokenizer("--feedback", commandLineFeedbackMode))) {
+            if (!setFeedback(initmh, new ArgTokenizer("--feedback", initMode))) {
                 regenerateOnDeath = false;
             }
-            commandLineFeedbackMode = null;
         } else {
             String fb = prefs.get(FEEDBACK_KEY);
             if (fb != null) {
@@ -1016,6 +1149,13 @@
             this.alternatives = alternatives;
         }
 
+        // Add more options to an existing provider
+        public FixedCompletionProvider(FixedCompletionProvider base, String... alternatives) {
+            List<String> l = new ArrayList<>(Arrays.asList(base.alternatives));
+            l.addAll(Arrays.asList(alternatives));
+            this.alternatives = l.toArray(new String[l.size()]);
+        }
+
         @Override
         public List<Suggestion> completionSuggestions(String input, int cursor, int[] anchor) {
             List<Suggestion> result = new ArrayList<>();
@@ -1037,11 +1177,20 @@
     private static final CompletionProvider SNIPPET_HISTORY_OPTION_COMPLETION_PROVIDER = new FixedCompletionProvider("-all", "-start ", "-history");
     private static final CompletionProvider SAVE_OPTION_COMPLETION_PROVIDER = new FixedCompletionProvider("-all ", "-start ", "-history ");
     private static final CompletionProvider SNIPPET_OPTION_COMPLETION_PROVIDER = new FixedCompletionProvider("-all", "-start " );
-    private static final CompletionProvider RELOAD_OPTIONS_COMPLETION_PROVIDER = new FixedCompletionProvider("-restore ", "-quiet ");
-    private static final CompletionProvider RESTORE_COMPLETION_PROVIDER = new FixedCompletionProvider("-restore");
-    private static final CompletionProvider QUIET_COMPLETION_PROVIDER = new FixedCompletionProvider("-quiet");
+    private static final FixedCompletionProvider COMMAND_LINE_LIKE_OPTIONS_COMPLETION_PROVIDER = new FixedCompletionProvider(
+            "-class-path ", "-module-path ", "-add-modules ", "-add-exports ");
+    private static final CompletionProvider RELOAD_OPTIONS_COMPLETION_PROVIDER = new FixedCompletionProvider(
+            COMMAND_LINE_LIKE_OPTIONS_COMPLETION_PROVIDER,
+            "-restore ", "-quiet ");
     private static final CompletionProvider SET_MODE_OPTIONS_COMPLETION_PROVIDER = new FixedCompletionProvider("-command", "-quiet", "-delete");
     private static final CompletionProvider FILE_COMPLETION_PROVIDER = fileCompletions(p -> true);
+    private static final Map<String, CompletionProvider> ARG_OPTIONS = new HashMap<>();
+    static {
+        ARG_OPTIONS.put("-class-path", classPathCompletion());
+        ARG_OPTIONS.put("-module-path", fileCompletions(Files::isDirectory));
+        ARG_OPTIONS.put("-add-modules", EMPTY_COMPLETION_PROVIDER);
+        ARG_OPTIONS.put("-add-exports", EMPTY_COMPLETION_PROVIDER);
+    }
     private final Map<String, Command> commands = new LinkedHashMap<>();
     private void registerCommand(Command cmd) {
         commands.put(cmd.command, cmd);
@@ -1167,32 +1316,70 @@
         };
     }
 
-    private static CompletionProvider reloadCompletion() {
+    // command-line-like option completion -- options with values
+    private static CompletionProvider optionCompletion(CompletionProvider provider) {
         return (code, cursor, anchor) -> {
-            CompletionProvider provider;
-            int pastSpace = code.indexOf(' ') + 1; // zero if no space
-            if (pastSpace == 0) {
-                provider = RELOAD_OPTIONS_COMPLETION_PROVIDER;
-            } else {
-                switch (code.substring(0, pastSpace - 1)) {
-                    case "-quiet":
-                        provider = RESTORE_COMPLETION_PROVIDER;
-                        break;
-                    case "-restore":
-                        provider = QUIET_COMPLETION_PROVIDER;
-                        break;
-                    default:
-                        provider = EMPTY_COMPLETION_PROVIDER;
-                        break;
+            Matcher ovm = OPTION_VALUE_PATTERN.matcher(code);
+            if (ovm.matches()) {
+                String flag = ovm.group("flag");
+                List<CompletionProvider> ps = ARG_OPTIONS.entrySet().stream()
+                        .filter(es -> es.getKey().startsWith(flag))
+                        .map(es -> es.getValue())
+                        .collect(toList());
+                if (ps.size() == 1) {
+                    int pastSpace = ovm.start("val");
+                    List<Suggestion> result = ps.get(0).completionSuggestions(
+                            ovm.group("val"), cursor - pastSpace, anchor);
+                    anchor[0] += pastSpace;
+                    return result;
                 }
             }
-            List<Suggestion> result = provider.completionSuggestions(
-                    code.substring(pastSpace), cursor - pastSpace, anchor);
-            anchor[0] += pastSpace;
-            return result;
+            Matcher om = OPTION_PATTERN.matcher(code);
+            if (om.matches()) {
+                int pastSpace = om.start("flag");
+                List<Suggestion> result = provider.completionSuggestions(
+                        om.group("flag"), cursor - pastSpace, anchor);
+                if (!om.group("dd").isEmpty()) {
+                    result = result.stream()
+                            .map(sug -> new Suggestion() {
+                                @Override
+                                public String continuation() {
+                                    return "-" + sug.continuation();
+                                }
+
+                                @Override
+                                public boolean matchesType() {
+                                    return false;
+                                }
+                            })
+                            .collect(toList());
+                    --pastSpace;
+                }
+                anchor[0] += pastSpace;
+                return result;
+            }
+            Matcher opp = OPTION_PRE_PATTERN.matcher(code);
+            if (opp.matches()) {
+                int pastSpace = opp.end();
+                List<Suggestion> result = provider.completionSuggestions(
+                        "", cursor - pastSpace, anchor);
+                anchor[0] += pastSpace;
+                return result;
+            }
+            return Collections.emptyList();
         };
     }
 
+    // /reload command completion
+    private static CompletionProvider reloadCompletion() {
+        return optionCompletion(RELOAD_OPTIONS_COMPLETION_PROVIDER);
+    }
+
+    // /env command completion
+    private static CompletionProvider envCompletion() {
+        return optionCompletion(COMMAND_LINE_LIKE_OPTIONS_COMPLETION_PROVIDER);
+    }
+
     private static CompletionProvider orMostSpecificCompletion(
             CompletionProvider left, CompletionProvider right) {
         return (code, cursor, anchor) -> {
@@ -1286,16 +1473,15 @@
         registerCommand(new Command("/exit",
                 arg -> cmdExit(),
                 EMPTY_COMPLETION_PROVIDER));
+        registerCommand(new Command("/env",
+                arg -> cmdEnv(arg),
+                envCompletion()));
         registerCommand(new Command("/reset",
-                arg -> cmdReset(),
-                EMPTY_COMPLETION_PROVIDER));
+                arg -> cmdReset(arg),
+                envCompletion()));
         registerCommand(new Command("/reload",
                 this::cmdReload,
                 reloadCompletion()));
-        registerCommand(new Command("/classpath",
-                this::cmdClasspath,
-                classPathCompletion(),
-                CommandKind.REPLAY));
         registerCommand(new Command("/history",
                 arg -> cmdHistory(),
                 EMPTY_COMPLETION_PROVIDER));
@@ -1344,6 +1530,9 @@
         registerCommand(new Command("shortcuts",
                 "help.shortcuts",
                 CommandKind.HELP_SUBJECT));
+        registerCommand(new Command("context",
+                "help.context",
+                CommandKind.HELP_SUBJECT));
 
         commandCompletions = new ContinuousCompletionProvider(
                 commands.values().stream()
@@ -1692,17 +1881,6 @@
         hard(stset);
     }
 
-    boolean cmdClasspath(String arg) {
-        if (arg.isEmpty()) {
-            errormsg("jshell.err.classpath.arg");
-            return false;
-        } else {
-            state.addToClasspath(toPathResolvingUserHome(arg).toString());
-            fluffmsg("jshell.msg.classpath", arg);
-            return true;
-        }
-    }
-
     boolean cmdDebug(String arg) {
         if (arg.isEmpty()) {
             debug = !debug;
@@ -2228,7 +2406,6 @@
 
     }
 
-    // Read a built-in file from resources or null
     String getResource(String name) {
         if (BUILTIN_FILE_PATTERN.matcher(name).matches()) {
             try {
@@ -2266,20 +2443,22 @@
         return defaultStartup;
     }
 
-    private boolean cmdReset() {
+    private boolean cmdReset(String rawargs) {
+        if (!parseCommandLineLikeFlags(rawargs, new OptionParserBase())) {
+            return false;
+        }
         live = false;
         fluffmsg("jshell.msg.resetting.state");
         return true;
     }
 
     private boolean cmdReload(String rawargs) {
-        ArgTokenizer at = new ArgTokenizer("/reload", rawargs.trim());
-        at.allowedOptions("-restore", "-quiet");
-        if (!checkOptionsAndRemainingInput(at)) {
+        OptionParserReload ap = new OptionParserReload();
+        if (!parseCommandLineLikeFlags(rawargs, ap)) {
             return false;
         }
         Iterable<String> history;
-        if (at.hasOption("-restore")) {
+        if (ap.restore()) {
             if (replayableHistoryPrevious == null) {
                 errormsg("jshell.err.reload.no.previous");
                 return false;
@@ -2290,13 +2469,57 @@
             history = replayableHistory;
             fluffmsg("jshell.err.reload.restarting.state");
         }
-        boolean echo = !at.hasOption("-quiet");
+        return doReload(history, !ap.quiet());
+    }
+
+    private boolean cmdEnv(String rawargs) {
+        if (rawargs.trim().isEmpty()) {
+            // No arguments, display current settings (as option flags)
+            StringBuilder sb = new StringBuilder();
+            for (String a : options.commonOptions()) {
+                sb.append(
+                        a.startsWith("-")
+                            ? sb.length() > 0
+                                    ? "\n   "
+                                    :   "   "
+                            : " ");
+                sb.append(a);
+            }
+            if (sb.length() > 0) {
+                rawout(prefix(sb.toString()));
+            }
+            return false;
+        }
+        if (!parseCommandLineLikeFlags(rawargs, new OptionParserBase())) {
+            return false;
+        }
+        fluffmsg("jshell.msg.set.restore");
+        return doReload(replayableHistory, false);
+    }
+
+    private boolean doReload(Iterable<String> history, boolean echo) {
         resetState();
         run(new ReloadIOContext(history,
                 echo ? cmdout : null));
         return true;
     }
 
+    private boolean parseCommandLineLikeFlags(String rawargs, OptionParserBase ap) {
+        String[] args = Arrays.stream(rawargs.split("\\s+"))
+                .filter(s -> !s.isEmpty())
+                .toArray(String[]::new);
+        Options opts = ap.parse(args);
+        if (opts == null) {
+            return false;
+        }
+        if (!ap.nonOptions().isEmpty()) {
+            errormsg("jshell.err.unexpected.at.end", ap.nonOptions(), rawargs);
+            return false;
+        }
+        options.override(opts);
+        return true;
+    }
+
     private boolean cmdSave(String rawargs) {
         ArgTokenizer at = new ArgTokenizer("/save", rawargs.trim());
         at.allowedOptions("-all", "-start", "-history");
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Fri Jan 13 18:26:33 2017 +0100
@@ -52,6 +52,7 @@
 
 jshell.err.no.such.command.or.snippet.id = No such command or snippet id: {0}
 jshell.err.command.ambiguous = Command: ''{0}'' is ambiguous: {1}
+jshell.msg.set.restore = Setting new options and restoring state.
 jshell.msg.set.editor.set = Editor set to: {0}
 jshell.msg.set.editor.retain = Editor setting retained: {0}
 jshell.err.no.builtin.editor = Built-in editor not available.
@@ -319,21 +320,25 @@
 Save any work before using this command
 
 help.reset.summary = reset jshell
-help.reset.args =
+help.reset.args = \
+[-class-path <path>] [-module-path <path>] [-add-modules <modules>]...
 help.reset =\
 Reset the jshell tool code and execution state:\n\t\
    * All entered code is lost.\n\t\
    * Start-up code is re-executed.\n\t\
    * The execution state is restarted.\n\t\
-   * The classpath is cleared.\n\
 Tool settings are maintained, as set with: /set ...\n\
-Save any work before using this command
+Save any work before using this command.\n\
+The /reset command accepts context options, see:\n\n\t\
+     /help context\n\
+
 
 help.reload.summary = reset and replay relevant history -- current or previous (-restore)
-help.reload.args = [-restore] [-quiet]
+help.reload.args = \
+[-restore] [-quiet] [-class-path <path>] [-module-path <path>]...
 help.reload =\
 Reset the jshell tool code and execution state then replay each valid snippet\n\
-and any /drop or /classpath commands in the order they were entered.\n\
+and any /drop commands in the order they were entered.\n\
 \n\
 /reload\n\t\
      Reset and replay the valid history since jshell was entered, or\n\t\
@@ -345,12 +350,31 @@
      command was executed. This can thus be used to restore a previous\n\t\
      jshell tool session.\n\n\
 /reload [-restore] -quiet\n\t\
-     With the '-quiet' argument the replay is not shown.  Errors will display.
+     With the '-quiet' argument the replay is not shown.  Errors will display.\n\
+\n\
+Each of the above accepts context options, see:\n\n\t\
+     /help context\n\
+\n\
+For example:\n\n\t\
+     /reload -add-modules com.greetings -restore
 
-help.classpath.summary = add a path to the classpath
-help.classpath.args = <path>
-help.classpath =\
-Append a additional path to the classpath.
+help.env.summary = view or change the evaluation context
+help.env.args = \
+[-class-path <path>] [-module-path <path>] [-add-modules <modules>] ...
+help.env =\
+View or change the evaluation context.  The evaluation context is the class path,\n\
+module path, etc.\n\
+/env\n\t\
+     Show the evaluation context displayed as context options.\n\n\
+/env [-class-path <path>] [-module-path <path>] [-add-modules <modules>] ...\n\t\
+     With at least one option set, sets the evaluation context.  If snippets\n\t\
+     have been defined, the execution state is reset with the new\n\t\
+     evaluation context and the snippets will be replayed -- the replay is not\n\t\
+     shown, however, errors will display.  This is equivalent to: /reload -quiet\n\t\
+     For details of context options, see:\n\n\t\t\
+           /help context\n\n\t\
+     For example:\n\n\t\t\
+           /env -add-modules com.greetings
 
 help.history.summary = history of what you have typed
 help.history.args =
@@ -473,6 +497,37 @@
         possible fully qualified names based on the content of the specified classpath.\n\t\t\
         The "<fix-shortcut>" is either Alt-F1 or Alt-Enter, depending on the platform.
 
+help.context.summary = the evaluation context options for /env /reload and /reset
+help.context =\
+These options configure the evaluation context, they can be specified when\n\
+jshell is started: on the command-line, or restarted with the commands /env,\n\
+/reload, or /reset.\n\
+\n\
+They are:\n\t\
+    --class-path <class search path of directories and zip/jar files>\n\t\t\
+                  A list of directories, JAR archives,\n\t\t\
+                  and ZIP archives to search for class files.\n\t\t\
+                  The list is separated with the path separator\n\t\t\
+                  (a : on unix/linux/mac, and ; on windows).\n\t\
+    --module-path <module path>...\n\t\t\
+                  A list of directories, each directory\n\t\t\
+                  is a directory of modules.\n\t\t\
+                  The list is separated with the path separator\n\t\t\
+                  (a : on unix/linux/mac, and ; on windows).\n\t\
+    --add-modules <modulename>[,<modulename>...]\n\t\t\
+                  root modules to resolve in addition to the initial module.\n\t\t\
+                  <modulename> can also be ALL-DEFAULT, ALL-SYSTEM,\n\t\t\
+                  ALL-MODULE-PATH.\n\t\
+    --add-exports <module>/<package>=<target-module>(,<target-module>)*\n\t\t\
+                  updates <module> to export <package> to <target-module>,\n\t\t\
+                  regardless of module declaration.\n\t\t\
+                  <target-module> can be ALL-UNNAMED to export to all\n\t\t\
+                  unnamed modules. In jshell, if the <target-module> is not\n\t\t\
+                  specified (no =) then ALL-UNNAMED is used.\n\
+\n\
+On the command-line these options must have two dashes, e.g.: --module-path\n\
+On jshell commands they can have one or two dashes, e.g.: -module-path\n\
+
 help.set._retain = \
 The '-retain' option saves a setting so that it is used in future sessions.\n\
 The -retain option can be used on the following forms of /set:\n\n\t\
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java	Fri Jan 13 18:26:33 2017 +0100
@@ -161,6 +161,10 @@
         @Override
         public Diag diag(Diagnostic<? extends JavaFileObject> d) {
             SourceMemoryJavaFileObject smjfo = (SourceMemoryJavaFileObject) d.getSource();
+            if (smjfo == null) {
+                // Handle failure that doesn't preserve mapping
+                return new StringSourceHandler().diag(d);
+            }
             OuterWrap w = (OuterWrap) smjfo.getOrigin();
             return w.wrapDiag(d);
         }
--- a/langtools/test/ProblemList.txt	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/ProblemList.txt	Fri Jan 13 18:26:33 2017 +0100
@@ -1,6 +1,6 @@
 ###########################################################################
 #
-# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -36,17 +36,14 @@
 #
 # jshell
 
-jdk/jshell/EditorPadTest.java                                                   8161276    windows-all    Test set-up cannot press buttons
-jdk/jshell/ToolBasicTest.java                                                   8139873    generic-all    JShell tests failing
-jdk/jshell/ExternalEditorTest.java                                              8170108    generic-all
 jdk/jshell/ToolFormatTest.java                                                  8170216    solaris-sparcv9
 jdk/jshell/ReplaceTest.java                                                     8170216    solaris-sparcv9
+jdk/jshell/UserInputTest.java                                                   8169536    generic-all   
 
 ###########################################################################
 #
 # javac
 
-tools/javac/Paths/AbsolutePathTest.java                                         8055768    generic-all    ToolBox does not close opened files
 tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.java      8057679    generic-all    clarify error messages trying to annotate scoping
 tools/javac/annotations/typeAnnotations/failures/CantAnnotateScoping.java       8057679    generic-all    clarify error messages trying to annotate scoping
 tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.java  8057679    generic-all    clarify error messages trying to annotate scoping
--- a/langtools/test/jdk/jshell/CommandCompletionTest.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/jdk/jshell/CommandCompletionTest.java	Fri Jan 13 18:26:33 2017 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8144095 8164825 8169818 8153402
+ * @bug 8144095 8164825 8169818 8153402 8165405
  * @summary Test Command Completion
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -138,7 +138,7 @@
     @Test
     public void testEdit() {
         test(false, new String[]{"--no-startup"},
-                a -> assertCompletion(a, "/e|", false, "/edit ", "/exit "),
+                a -> assertCompletion(a, "/e|", false, "/edit ", "/env ", "/exit "),
                 a -> assertCompletion(a, "/ed|", false, "/edit "),
                 a -> assertClass(a, "class cTest {}", "class", "cTest"),
                 a -> assertMethod(a, "int mTest() { return 0; }", "()I", "mTest"),
@@ -158,15 +158,17 @@
     public void testHelp() {
         testNoStartUp(
                 a -> assertCompletion(a, "/help |", false,
-                "/! ", "/-<n> ", "/<id> ", "/? ", "/classpath ", "/drop ",
-                "/edit ", "/exit ", "/help ", "/history ", "/imports ",
+                "/! ", "/-<n> ", "/<id> ", "/? ", "/drop ",
+                "/edit ", "/env ", "/exit ",
+                "/help ", "/history ", "/imports ",
                 "/list ", "/methods ", "/open ", "/reload ", "/reset ",
-                "/save ", "/set ", "/types ", "/vars ", "intro ", "shortcuts "),
+                "/save ", "/set ", "/types ", "/vars ", "context ", "intro ", "shortcuts "),
                 a -> assertCompletion(a, "/? |", false,
-                "/! ", "/-<n> ", "/<id> ", "/? ", "/classpath ", "/drop ",
-                "/edit ", "/exit ", "/help ", "/history ", "/imports ",
+                "/! ", "/-<n> ", "/<id> ", "/? ", "/drop ",
+                "/edit ", "/env ", "/exit ",
+                "/help ", "/history ", "/imports ",
                 "/list ", "/methods ", "/open ", "/reload ", "/reset ",
-                "/save ", "/set ", "/types ", "/vars ", "intro ", "shortcuts "),
+                "/save ", "/set ", "/types ", "/vars ", "context ", "intro ", "shortcuts "),
                 a -> assertCompletion(a, "/help /s|", false,
                 "/save ", "/set "),
                 a -> assertCompletion(a, "/help /set |", false,
@@ -177,17 +179,63 @@
 
     @Test
     public void testReload() {
+        String[] ropts = new String[] { "-add-exports ", "-add-modules ",
+            "-class-path ", "-module-path ", "-quiet ", "-restore " };
+        String[] dropts = new String[] { "--add-exports ", "--add-modules ",
+            "--class-path ", "--module-path ", "--quiet ", "--restore " };
         testNoStartUp(
-                a -> assertCompletion(a, "/reload |", false, "-quiet ", "-restore "),
-                a -> assertCompletion(a, "/reload -restore |", false, "-quiet"),
-                a -> assertCompletion(a, "/reload -quiet |", false, "-restore"),
-                a -> assertCompletion(a, "/reload -restore -quiet |", false)
+                a -> assertCompletion(a, "/reloa |", false, ropts),
+                a -> assertCompletion(a, "/relo               |", false, ropts),
+                a -> assertCompletion(a, "/reload -|", false, ropts),
+                a -> assertCompletion(a, "/reload --|", false, dropts),
+                a -> assertCompletion(a, "/reload -restore |", false, ropts),
+                a -> assertCompletion(a, "/reload -restore --|", false, dropts),
+                a -> assertCompletion(a, "/reload -rest|", false, "-restore "),
+                a -> assertCompletion(a, "/reload --r|", false, "--restore "),
+                a -> assertCompletion(a, "/reload -q|", false, "-quiet "),
+                a -> assertCompletion(a, "/reload -add|", false, "-add-exports ", "-add-modules "),
+                a -> assertCompletion(a, "/reload -class-path . -quiet |", false, ropts)
+        );
+    }
+
+    @Test
+    public void testEnv() {
+        String[] ropts = new String[] { "-add-exports ", "-add-modules ",
+            "-class-path ", "-module-path " };
+        String[] dropts = new String[] { "--add-exports ", "--add-modules ",
+            "--class-path ", "--module-path " };
+        testNoStartUp(
+                a -> assertCompletion(a, "/env |", false, ropts),
+                a -> assertCompletion(a, "/env -|", false, ropts),
+                a -> assertCompletion(a, "/env --|", false, dropts),
+                a -> assertCompletion(a, "/env --a|", false, "--add-exports ", "--add-modules "),
+                a -> assertCompletion(a, "/env -add-|", false, "-add-exports ", "-add-modules "),
+                a -> assertCompletion(a, "/env -class-path . |", false, ropts),
+                a -> assertCompletion(a, "/env -class-path . --|", false, dropts)
+        );
+    }
+
+    @Test
+    public void testReset() {
+        String[] ropts = new String[] { "-add-exports ", "-add-modules ",
+            "-class-path ", "-module-path " };
+        String[] dropts = new String[] { "--add-exports ", "--add-modules ",
+            "--class-path ", "--module-path " };
+        testNoStartUp(
+                a -> assertCompletion(a, "/reset    |", false, ropts),
+                a -> assertCompletion(a, "/res -m|", false, "-module-path "),
+                a -> assertCompletion(a, "/res -module-|", false, "-module-path "),
+                a -> assertCompletion(a, "/res --m|", false, "--module-path "),
+                a -> assertCompletion(a, "/res --module-|", false, "--module-path "),
+                a -> assertCompletion(a, "/reset -add|", false, "-add-exports ", "-add-modules "),
+                a -> assertCompletion(a, "/rese -class-path . |", false, ropts),
+                a -> assertCompletion(a, "/rese -class-path . --|", false, dropts)
         );
     }
 
     @Test
     public void testVarsMethodsTypes() {
-        test(false, new String[]{"--no-startup"},
+        testNoStartUp(
                 a -> assertCompletion(a, "/v|", false, "/vars "),
                 a -> assertCompletion(a, "/m|", false, "/methods "),
                 a -> assertCompletion(a, "/t|", false, "/types "),
@@ -245,9 +293,6 @@
 
     @Test
     public void testClassPath() throws IOException {
-        testNoStartUp(
-                a -> assertCompletion(a, "/classp|", false, "/classpath ")
-        );
         Compiler compiler = new Compiler();
         Path outDir = compiler.getPath("testClasspathCompletion");
         Files.createDirectories(outDir);
@@ -259,8 +304,13 @@
         compiler.jar(outDir, jarName, "pkg/A.class");
         compiler.getPath(outDir).resolve(jarName);
         List<String> paths = listFiles(outDir, CLASSPATH_FILTER);
+        String[] pathArray = paths.toArray(new String[paths.size()]);
         testNoStartUp(
-                a -> assertCompletion(a, "/classpath " + outDir + "/|", false, paths.toArray(new String[paths.size()]))
+                a -> assertCompletion(a, "/env -class-path " + outDir + "/|", false, pathArray),
+                a -> assertCompletion(a, "/env --class-path " + outDir + "/|", false, pathArray),
+                a -> assertCompletion(a, "/env -clas    " + outDir + "/|", false, pathArray),
+                a -> assertCompletion(a, "/env --class-p    " + outDir + "/|", false, pathArray),
+                a -> assertCompletion(a, "/env --module-path . --class-p    " + outDir + "/|", false, pathArray)
         );
     }
 
@@ -275,7 +325,7 @@
                                  .collect(Collectors.toList());
         }
         testNoStartUp(
-                a -> assertCompletion(a, "/classpath ~/|", false, completions.toArray(new String[completions.size()]))
+                a -> assertCompletion(a, "/env --class-path ~/|", false, completions.toArray(new String[completions.size()]))
         );
     }
 
--- a/langtools/test/jdk/jshell/ToolBasicTest.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/jdk/jshell/ToolBasicTest.java	Fri Jan 13 18:26:33 2017 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8143037 8142447 8144095 8140265 8144906 8146138 8147887 8147886 8148316 8148317 8143955 8157953 8080347 8154714 8166649 8167643 8170162 8172102
+ * @bug 8143037 8142447 8144095 8140265 8144906 8146138 8147887 8147886 8148316 8148317 8143955 8157953 8080347 8154714 8166649 8167643 8170162 8172102 8165405
  * @summary Tests for Basic tests for REPL tool
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -263,7 +263,8 @@
         compiler.compile(outDir, "package pkg; public class A { public String toString() { return \"A\"; } }");
         Path classpath = compiler.getPath(outDir);
         test(
-                (a) -> assertCommand(a, "/classpath " + classpath, String.format("|  Path '%s' added to classpath", classpath)),
+                (a) -> assertCommand(a, "/env --class-path " + classpath,
+                        "|  Setting new options and restoring state."),
                 (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
         );
         test(new String[] { "--class-path", classpath.toString() },
@@ -279,7 +280,8 @@
         compiler.jar(outDir, jarName, "pkg/A.class");
         Path jarPath = compiler.getPath(outDir).resolve(jarName);
         test(
-                (a) -> assertCommand(a, "/classpath " + jarPath, String.format("|  Path '%s' added to classpath", jarPath)),
+                (a) -> assertCommand(a, "/env --class-path " + jarPath,
+                        "|  Setting new options and restoring state."),
                 (a) -> evaluateExpression(a, "pkg.A", "new pkg.A();", "A")
         );
         test(new String[] { "--class-path", jarPath.toString() },
--- a/langtools/test/jdk/jshell/ToolReloadTest.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/jdk/jshell/ToolReloadTest.java	Fri Jan 13 18:26:33 2017 +0100
@@ -24,7 +24,7 @@
 /*
  * @test
  * @key intermittent
- * @bug 8081845 8147898 8143955
+ * @bug 8081845 8147898 8143955  8165405
  * @summary Tests for /reload in JShell tool
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -70,8 +70,8 @@
         compiler.compile(outDir, prog.apply("A"));
         Path classpath = compiler.getPath(outDir);
         test(
-                (a) -> assertCommand(a, "/classpath " + classpath,
-                        String.format("|  Path '%s' added to classpath", classpath)),
+                (a) -> assertCommand(a, "/env --class-path " + classpath,
+                        "|  Setting new options and restoring state."),
                 (a) -> assertMethod(a, "String foo() { return (new pkg.A()).toString(); }",
                         "()String", "foo"),
                 (a) -> assertVariable(a, "String", "v", "foo()", "\"A\""),
@@ -79,7 +79,6 @@
                        if (!a) compiler.compile(outDir, prog.apply("Aprime"));
                        assertCommand(a, "/reload",
                         "|  Restarting and restoring state.\n" +
-                        "-: /classpath " + classpath + "\n" +
                         "-: String foo() { return (new pkg.A()).toString(); }\n" +
                         "-: String v = foo();\n");
                        },
--- a/langtools/test/jdk/jshell/ToolSimpleTest.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/jdk/jshell/ToolSimpleTest.java	Fri Jan 13 18:26:33 2017 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102
+ * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103  8165405
  * @summary Simple jshell tool tests
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -196,7 +196,7 @@
 
     @Test
     public void testEmptyClassPath() {
-        test(after -> assertCommand(after, "/classpath", "|  The /classpath command requires a path argument."));
+        test(after -> assertCommand(after, "/env --class-path", "|  Argument to class-path missing."));
     }
 
     @Test
@@ -606,6 +606,13 @@
     }
 
     @Test
+    public void testWrapSourceHandlerDiagCrash() {
+        test(new String[]{"--add-exports", "jdk.javadoc/ALL-UNNAMED"},
+                (a) -> assertCommand(a, "1+1", "$1 ==> 2")
+         );
+    }
+
+    @Test
     public void test8156910() {
         test(
                 (a) -> assertCommandOutputContains(a, "System.out.println(\"%5d\", 10);", "%5d"),
--- a/langtools/test/jdk/jshell/UserInputTest.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/jdk/jshell/UserInputTest.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary Verify that the user's code can read System.in
  * @build KullaTesting TestingInputStream
  * @run testng UserInputTest
+ * @key intermittent
  */
 
 import java.io.IOException;
--- a/langtools/test/tools/doclint/tidy/util/Main.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/doclint/tidy/util/Main.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -154,6 +154,11 @@
                 errs += Integer.valueOf(m.group(2));
                 if (m.group(3) != null)
                     overflow++;
+            } else if ((m = countPattern2.matcher(line)).matches()) {
+                warns += Integer.valueOf(m.group(1));
+                errs += Integer.valueOf(m.group(2));
+                if (m.group(3) != null)
+                    overflow++;
             } else if ((m = guardPattern.matcher(line)).matches()) {
                 boolean found = false;
                 for (Pattern p: patterns) {
@@ -183,6 +188,7 @@
 
     Pattern okPattern = Pattern.compile("No warnings or errors were found.");
     Pattern countPattern = Pattern.compile("([0-9]+) warnings, ([0-9]+) errors were found!.*?(Not all warnings/errors were shown.)?");
+    Pattern countPattern2 = Pattern.compile("Tidy found ([0-9]+) warning[s]? and ([0-9]+) error[s]?!.*?(Not all warnings/errors were shown.)?");
     Pattern cssPattern = Pattern.compile("You are recommended to use CSS.*");
     Pattern guardPattern = Pattern.compile("line [0-9]+ column [0-9]+ - (Error|Warning):.*");
 
@@ -221,7 +227,11 @@
         Pattern.compile(".*Warning: trimming empty <.*>"),
         Pattern.compile(".*Warning: unescaped & or unknown entity \".*\""),
         Pattern.compile(".*Warning: unescaped & which should be written as &amp;"),
-        Pattern.compile(".*Warning: using <br> in place of <p>")
+        Pattern.compile(".*Warning: using <br> in place of <p>"),
+        Pattern.compile(".*Warning: <.*> element removed from HTML5"),
+        Pattern.compile(".*Warning: <.*> attribute \".*\" not allowed for HTML5"),
+        Pattern.compile(".*Warning: The summary attribute on the <table> element is obsolete in HTML5"),
+        Pattern.compile(".*Warning: replacing invalid UTF-8 bytes \\(char. code U\\+.*\\)")
     };
 
     int files;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/CaptureGLB1.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8144066
+ * @summary GLB of two lower-bounded capture variables, bounded by related array types
+ * @compile CaptureGLB1.java
+ */
+
+public class CaptureGLB1 {
+
+    interface A<T> { }
+
+    Exception[] bar(A<? super Exception[]> x, A<? super Throwable[]> y){
+        return foo(x, y);
+    }
+
+    <T> T foo(A<? super T> x, A<? super T> y){
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/CaptureGLB2.java	Fri Jan 13 18:26:33 2017 +0100
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8144066
+ * @summary GLB of two lower-bounded capture variables, bounded by related wildcard-parameterized types
+ * @compile CaptureGLB2.java
+ */
+
+public class CaptureGLB2 {
+
+    interface A<T> { }
+
+    Class<?> bar(A<? super Class<? extends Exception>> x, A<? super Class<? extends Throwable>> y){
+        return foo(x, y);
+    }
+
+    <T> T foo(A<? super T> x, A<? super T> y){
+        return null;
+    }
+}
--- a/langtools/test/tools/javac/lambda/MostSpecific09.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/javac/lambda/MostSpecific09.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8029718
+ * @bug 8029718 8065800
  * @summary Should always use lambda body structure to disambiguate overload resolution
  * @compile/fail/ref=MostSpecific09.out -XDrawDiagnostics --should-stop:at=ATTR --debug:verboseResolution=applicable,success MostSpecific09.java
  */
--- a/langtools/test/tools/javac/lambda/MostSpecific09.out	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/javac/lambda/MostSpecific09.out	Fri Jan 13 18:26:33 2017 +0100
@@ -2,16 +2,16 @@
 MostSpecific09.java:26:9: compiler.note.verbose.resolve.multi: foo, MostSpecific09, 0, BASIC, compiler.misc.type.none, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, foo(MostSpecific09.I), null)}
 MostSpecific09.java:27:9: compiler.note.verbose.resolve.multi: foo, MostSpecific09, 0, BASIC, compiler.misc.type.none, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, foo(MostSpecific09.J), null)}
 MostSpecific09.java:27:32: compiler.note.verbose.resolve.multi: println, java.io.PrintStream, 1, BASIC, java.lang.String, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, println(java.lang.Object), null),(compiler.misc.applicable.method.found: 1, println(java.lang.String), null)}
-MostSpecific09.java:28:13: compiler.err.lambda.body.neither.value.nor.void.compatible
-MostSpecific09.java:28:9: compiler.err.cant.apply.symbols: kindname.method, foo, @682,{(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.I), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.missing.ret.val: java.lang.String)))),(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.J), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.unexpected.ret.val)))}
+MostSpecific09.java:28:20: compiler.err.lambda.body.neither.value.nor.void.compatible
+MostSpecific09.java:28:9: compiler.err.cant.apply.symbols: kindname.method, foo, @690,{(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.I), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.missing.ret.val: java.lang.String)))),(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.J), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.unexpected.ret.val)))}
 MostSpecific09.java:28:43: compiler.note.verbose.resolve.multi: println, java.io.PrintStream, 1, BASIC, java.lang.String, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, println(java.lang.Object), null),(compiler.misc.applicable.method.found: 1, println(java.lang.String), null)}
 MostSpecific09.java:29:9: compiler.err.ref.ambiguous: foo, kindname.method, foo(MostSpecific09.I), MostSpecific09, kindname.method, foo(MostSpecific09.J), MostSpecific09
 MostSpecific09.java:29:28: compiler.note.verbose.resolve.multi: <init>, java.lang.RuntimeException, 0, BASIC, compiler.misc.no.args, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, java.lang.RuntimeException(), null)}
 MostSpecific09.java:30:9: compiler.err.ref.ambiguous: foo, kindname.method, foo(MostSpecific09.I), MostSpecific09, kindname.method, foo(MostSpecific09.J), MostSpecific09
 MostSpecific09.java:32:9: compiler.err.ref.ambiguous: foo, kindname.method, foo(MostSpecific09.I), MostSpecific09, kindname.method, foo(MostSpecific09.J), MostSpecific09
 MostSpecific09.java:33:9: compiler.note.verbose.resolve.multi: foo, MostSpecific09, 0, BASIC, compiler.misc.type.none, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, foo(MostSpecific09.I), null)}
-MostSpecific09.java:42:13: compiler.err.lambda.body.neither.value.nor.void.compatible
-MostSpecific09.java:42:9: compiler.err.cant.apply.symbols: kindname.method, foo, @1131,{(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.I), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.missing.ret.val: java.lang.String)))),(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.J), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.unexpected.ret.val)))}
+MostSpecific09.java:42:20: compiler.err.lambda.body.neither.value.nor.void.compatible
+MostSpecific09.java:42:9: compiler.err.cant.apply.symbols: kindname.method, foo, @1139,{(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.I), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.missing.ret.val: java.lang.String)))),(compiler.misc.inapplicable.method: kindname.method, MostSpecific09, foo(MostSpecific09.J), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.unexpected.ret.val)))}
 MostSpecific09.java:46:23: compiler.note.verbose.resolve.multi: println, java.io.PrintStream, 1, BASIC, java.lang.String, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, println(java.lang.Object), null),(compiler.misc.applicable.method.found: 1, println(java.lang.String), null)}
 MostSpecific09.java:49:9: compiler.note.verbose.resolve.multi: foo, MostSpecific09, 0, BASIC, compiler.misc.type.none, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, foo(MostSpecific09.J), null)}
 MostSpecific09.java:56:25: compiler.note.verbose.resolve.multi: <init>, Bar, 0, BASIC, compiler.misc.no.args, compiler.misc.no.args,{(compiler.misc.applicable.method.found: 0, Bar(), null)}
--- a/langtools/test/tools/javac/lambda/MostSpecific10.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/javac/lambda/MostSpecific10.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,13 @@
  * @test
  * @bug 8034223
  * @summary Structural most-specific logic for lambdas, method refs, parens, and conditionals
- * @compile MostSpecific10.java
  */
-class MostSpecific10 {
+
+public class MostSpecific10 {
+
+    public static void main(String[] args) {
+        new MostSpecific10().test(true);
+    }
 
     interface GetInt {
         int get();
@@ -38,7 +42,9 @@
     }
 
     void m(GetInt getter) {}
-    void m(GetInteger getter) {}
+    void m(GetInteger getter) {
+        throw new AssertionError("Less-specific method invocation: " + getter.getClass());
+    }
 
     void test(boolean cond) {
         m(() -> 23);
--- a/langtools/test/tools/javac/lambda/MostSpecific11.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/javac/lambda/MostSpecific11.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,19 @@
  * @test
  * @bug 8034223
  * @summary Return type Object is not more specific than return type String
- * @compile MostSpecific11.java
  */
-class MostSpecific11 {
+public class MostSpecific11 {
+
+    public static void main(String[] args) {
+        new MostSpecific11().test();
+    }
 
     interface I { Object run(); }
     interface J { String run(); }
 
-    void m(I arg) {}
+    void m(I arg) {
+        throw new RuntimeException("Less-specific method invocation.");
+    }
     void m(J arg) {}
 
     void test() {
--- a/langtools/test/tools/javac/lambda/MostSpecific15.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/javac/lambda/MostSpecific15.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,18 @@
  * @test
  * @bug 8143852
  * @summary Rename functional interface method type parameters during most specific test
- * @compile MostSpecific15.java
  */
-class MostSpecific15 {
+public class MostSpecific15 {
+    public static void main(String[] args) {
+        new MostSpecific15().test();
+    }
+
     interface F1 { <X> Object apply(X arg); }
     interface F2 { <Y> String apply(Y arg); }
 
-    static void m1(F1 f) {}
+    static void m1(F1 f) {
+        throw new AssertionError("Less-specific method invocation.");
+    }
     static void m1(F2 f) {}
 
     static String foo(Object in) { return "a"; }
@@ -39,5 +44,4 @@
     void test() {
         m1(MostSpecific15::foo);
     }
-
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/lambda/MostSpecific17.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/javac/lambda/MostSpecific17.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,12 @@
  * @test
  * @bug 8143852
  * @summary Rename functional interface method type parameters during most specific test
- * @compile MostSpecific17.java
  */
-class MostSpecific17 {
+public class MostSpecific17 {
+
+    public static void main(String[] args) {
+        new MostSpecific17().test();
+    }
 
     interface A<T> {}
     interface B<T> extends A<T> {}
@@ -35,7 +38,9 @@
     interface F1 { <X> A<? super X> apply(Object arg); }
     interface F2 { <Y> B<? super Y> apply(Object arg); }
 
-    static void m1(F1 f) {}
+    static void m1(F1 f) {
+        throw new AssertionError("Less-specific method invocation.");
+    }
     static void m1(F2 f) {}
 
     static B<Object> foo(Object in) { return null; }
@@ -43,5 +48,4 @@
     void test() {
         m1(MostSpecific17::foo);
     }
-
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/lambda/MostSpecific18.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/javac/lambda/MostSpecific18.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,18 @@
  * @test
  * @bug 8143852
  * @summary Test that generic function interface method bounds are the same
- * @compile MostSpecific18.java
  */
-class MostSpecific18 {
+public class MostSpecific18 {
+    public static void main(String[] args) {
+        new MostSpecific18().test();
+    }
+
     interface F1 { <X extends Number> Object apply(X arg); }
     interface F2 { <Y extends Number> String apply(Y arg); }
 
-    static void m1(F1 f) {}
+    static void m1(F1 f) {
+        throw new AssertionError("Less-specific method invocation.");
+    }
     static void m1(F2 f) {}
 
     static String foo(Object in) { return "a"; }
@@ -39,5 +44,4 @@
     void test() {
         m1(MostSpecific18::foo);
     }
-
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/lambda/MostSpecific20.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/javac/lambda/MostSpecific20.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,18 @@
  * @test
  * @bug 8143852
  * @summary Test that generic function interface method bounds are the same
- * @compile MostSpecific20.java
  */
-class MostSpecific20 {
+public class MostSpecific20 {
+    public static void main(String[] args) {
+        new MostSpecific20().test();
+    }
+
     interface F1 { <X extends Iterable<X>> Object apply(X arg); }
     interface F2 { <Y extends Iterable<Y>> String apply(Y arg); }
 
-    static void m1(F1 f) {}
+    static void m1(F1 f) {
+        throw new AssertionError("Less-specific method invocation.");
+    }
     static void m1(F2 f) {}
 
     static String foo(Object in) { return "a"; }
@@ -39,5 +44,4 @@
     void test() {
         m1(MostSpecific20::foo);
     }
-
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/lambda/MostSpecific22.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/javac/lambda/MostSpecific22.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,19 @@
  * @test
  * @bug 8143852
  * @summary Most specific inference constraints derived from both functional interface method parameters and tparam bounds
- * @compile MostSpecific22.java
  */
-class MostSpecific22 {
+
+public class MostSpecific22 {
+    public static void main(String[] args) {
+        new MostSpecific22().test();
+    }
+
     interface F1<T> { <X extends T> Object apply(T arg); }
     interface F2 { <Y extends Number> String apply(Number arg); }
 
-    static <T> T m1(F1<T> f) { return null; }
+    static <T> T m1(F1<T> f) {
+        throw new AssertionError("Less-specific method invocation.");
+    }
     static Object m1(F2 f) { return null; }
 
     static String foo(Object in) { return "a"; }
@@ -40,4 +46,4 @@
         m1(MostSpecific22::foo);
     }
 
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/lambda/MostSpecific27.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/javac/lambda/MostSpecific27.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,18 @@
  * @test
  * @bug 8143852
  * @summary Most specific inference constraints derived from intersection bound
- * @compile MostSpecific27.java
  */
-class MostSpecific27 {
+public class MostSpecific27 {
+    public static void main(String[] args) {
+        new MostSpecific27().test();
+    }
+
     interface F1<T> { <X extends Iterable<T> & Runnable> Object apply(T arg); }
     interface F2 { <Y extends Iterable<Number> & Runnable> String apply(Number arg); }
 
-    static <T> T m1(F1<T> f) { return null; }
+    static <T> T m1(F1<T> f) {
+        throw new AssertionError("Less-specific method invocation.");
+    }
     static Object m1(F2 f) { return null; }
 
     static String foo(Object in) { return "a"; }
@@ -40,4 +45,4 @@
         m1(MostSpecific27::foo);
     }
 
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/lambda/MostSpecific29.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/javac/lambda/MostSpecific29.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,15 +25,20 @@
  * @test
  * @bug 8144767
  * @summary Correct most-specific test when wildcards appear in functional interface type
- * @compile MostSpecific29.java
  */
-class MostSpecific29 {
+public class MostSpecific29 {
+
+    public static void main(String[] args) {
+        new MostSpecific29().test();
+    }
 
     interface Pred<T> { boolean test(T arg); }
     interface Fun<T,R> { R apply(T arg); }
 
     static void m1(Pred<? super Integer> f) {}
-    static void m1(Fun<Integer, Boolean> f) {}
+    static void m1(Fun<Integer, Boolean> f) {
+        throw new AssertionError("Less-specific method invocation.");
+    }
 
     void test() {
         m1((Integer n) -> true);
--- a/langtools/test/tools/javac/lambda/T8024947/PotentiallyAmbiguousWarningTest.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/javac/lambda/T8024947/PotentiallyAmbiguousWarningTest.java	Fri Jan 13 18:26:33 2017 +0100
@@ -1,33 +1,9 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
+ * @test /nodynamiccopyright/
  * @bug 8024947
  * @summary javac should issue the potentially ambiguous overload warning only
  * where the problem appears
  * @compile/fail/ref=PotentiallyAmbiguousWarningTest.out -XDrawDiagnostics -Werror -Xlint:overloads PotentiallyAmbiguousWarningTest.java
- * @compile PotentiallyAmbiguousWarningTest.java
  */
 
 import java.util.function.*;
--- a/langtools/test/tools/javac/lambda/T8024947/PotentiallyAmbiguousWarningTest.out	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/javac/lambda/T8024947/PotentiallyAmbiguousWarningTest.out	Fri Jan 13 18:26:33 2017 +0100
@@ -1,9 +1,9 @@
-PotentiallyAmbiguousWarningTest.java:39:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.I1, foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.I1
-PotentiallyAmbiguousWarningTest.java:45:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.C1, foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.C1
-PotentiallyAmbiguousWarningTest.java:55:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.J1, foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.I2
-PotentiallyAmbiguousWarningTest.java:72:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.D1, foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.C2
-PotentiallyAmbiguousWarningTest.java:78:21: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.C3, foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.C3
-PotentiallyAmbiguousWarningTest.java:95:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.J2, foo(T), PotentiallyAmbiguousWarningTest.I5
+PotentiallyAmbiguousWarningTest.java:15:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.I1, foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.I1
+PotentiallyAmbiguousWarningTest.java:21:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.C1, foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.C1
+PotentiallyAmbiguousWarningTest.java:31:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.J1, foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.I2
+PotentiallyAmbiguousWarningTest.java:48:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.D1, foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.C2
+PotentiallyAmbiguousWarningTest.java:54:21: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.C3, foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.C3
+PotentiallyAmbiguousWarningTest.java:71:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.J2, foo(T), PotentiallyAmbiguousWarningTest.I5
 - compiler.err.warnings.and.werror
 1 error
 6 warnings
--- a/langtools/test/tools/javac/modules/AnnotationProcessing.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/javac/modules/AnnotationProcessing.java	Fri Jan 13 18:26:33 2017 +0100
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 8133884 8162711 8133896
+ * @bug 8133884 8162711 8133896 8172158
  * @summary Verify that annotation processing works.
  * @library /tools/lib
  * @modules
@@ -979,6 +979,38 @@
         }
     }
 
+    @Test
+    public void testDisambiguateAnnotationsNoModules(Path base) throws Exception {
+        Path classes = base.resolve("classes");
+
+        Files.createDirectories(classes);
+
+        Path src = base.resolve("src");
+
+        tb.writeJavaFiles(src,
+                          "package api; public @interface A {}",
+                          "package api; public @interface B {}",
+                          "package impl; import api.*; @A @B public class T {}");
+
+        List<String> log = new JavacTask(tb)
+            .options("-processor", SelectAnnotationATestAP.class.getName() + "," + SelectAnnotationBTestAP.class.getName(),
+                     "-source", "8", "-target", "8")
+            .outdir(classes)
+            .files(findJavaFiles(src))
+            .run()
+            .writeAll()
+            .getOutputLines(OutputKind.STDERR);
+
+        List<String> expected = Arrays.asList("SelectAnnotationATestAP",
+                                              "SelectAnnotationBTestAP",
+                                              "SelectAnnotationATestAP",
+                                              "SelectAnnotationBTestAP");
+
+        if (!expected.equals(log)) {
+            throw new AssertionError("Output does not match; output: " + log);
+        }
+    }
+
     @SupportedAnnotationTypes("m2x/api.A")
     public static final class SelectAnnotationATestAP extends AbstractProcessor {
 
--- a/langtools/test/tools/jdeps/listdeps/ListModuleDeps.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/jdeps/listdeps/ListModuleDeps.java	Fri Jan 13 18:26:33 2017 +0100
@@ -83,6 +83,28 @@
         ));
     }
 
+    @DataProvider(name = "jdkModules")
+    public Object[][] jdkModules() {
+        return new Object[][]{
+            {"jdk.compiler", new String[]{
+                                "java.base/sun.reflect.annotation",
+                                "java.compiler",
+                             }
+            },
+        };
+    }
+
+    @Test(dataProvider = "jdkModules")
+    public void testJDKModule(String moduleName, String[] expected) {
+        JdepsRunner jdeps = JdepsRunner.run(
+            "--list-deps", "-m", moduleName
+        );
+        String[] output = Arrays.stream(jdeps.output())
+                                .map(s -> s.trim())
+                                .toArray(String[]::new);
+        assertEquals(output, expected);
+    }
+
     @Test(dataProvider = "listdeps")
     public void testListDeps(Path classes, String[] expected) {
         JdepsRunner jdeps = JdepsRunner.run(
--- a/langtools/test/tools/jdeps/modules/CheckModuleTest.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/jdeps/modules/CheckModuleTest.java	Fri Jan 13 18:26:33 2017 +0100
@@ -57,6 +57,7 @@
     private static final Set<String> modules = Set.of("unsafe", "mIV", "mV", "mVI", "mVII", "mVIII");
 
     private static final String JAVA_BASE = "java.base";
+    private static final String JAVA_COMPILER = "java.compiler";
 
     /**
      * Compiles classes used by the test
@@ -73,6 +74,8 @@
         return new Object[][] {
             { JAVA_BASE, new ModuleMetaData(JAVA_BASE)
             },
+            { JAVA_COMPILER, new ModuleMetaData(JAVA_BASE)
+            },
         };
     };
 
--- a/langtools/test/tools/jdeps/modules/InverseDeps.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/jdeps/modules/InverseDeps.java	Fri Jan 13 18:26:33 2017 +0100
@@ -26,7 +26,9 @@
  * @summary Tests split packages
  * @library ../lib
  * @build CompilerUtils JdepsUtil
- * @modules jdk.jdeps/com.sun.tools.jdeps
+ * @modules java.logging
+ *          jdk.jdeps/com.sun.tools.jdeps
+ *          jdk.unsupported
  * @run testng InverseDeps
  */
 
@@ -87,6 +89,44 @@
             }
         }
     }
+    @DataProvider(name = "jdkModules")
+    public Object[][] jdkModules() {
+        return new Object[][]{
+            // --require and a subset of dependences
+            { "jdk.compiler", new String[][] {
+                    new String[] {"jdk.compiler", "jdk.jshell"},
+                    new String[] {"jdk.compiler", "jdk.rmic"},
+                    new String[] {"jdk.compiler", "jdk.javadoc", "jdk.rmic"},
+                }
+            },
+            { "java.compiler", new String[][] {
+                    new String[] {"java.compiler", "jdk.jshell"},
+                    new String[] {"java.compiler", "jdk.compiler", "jdk.jshell"},
+                    new String[] {"java.compiler", "jdk.compiler", "jdk.rmic"},
+                    new String[] {"java.compiler", "jdk.compiler", "jdk.javadoc", "jdk.rmic"},
+                    new String[] {"java.compiler", "java.se", "java.se.ee"},
+                }
+            },
+        };
+    }
+
+    @Test(dataProvider = "jdkModules")
+    public void testJDKModule(String moduleName, String[][] expected) throws Exception {
+        // this invokes the jdeps launcher so that all system modules are observable
+        JdepsRunner jdeps = JdepsRunner.run(
+            "--inverse", "--require", moduleName
+        );
+        List<String> output = Arrays.stream(jdeps.output())
+            .map(s -> s.trim())
+            .collect(Collectors.toList());
+
+        // verify the dependences
+        assertTrue(Arrays.stream(expected)
+                         .map(path -> Arrays.stream(path)
+                         .collect(Collectors.joining(" <- ")))
+                         .anyMatch(output::contains));
+    }
+
 
     @DataProvider(name = "testrequires")
     public Object[][] expected1() {
--- a/langtools/test/tools/jdeps/modules/SplitPackage.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/langtools/test/tools/jdeps/modules/SplitPackage.java	Fri Jan 13 18:26:33 2017 +0100
@@ -63,10 +63,15 @@
 
     @Test
     public void runTest() throws Exception {
+        // split package detected if java.annotation.common is in the root set
+        runTest(JAVA_ANNOTATIONS_COMMON, SPLIT_PKG_NAME);
+        runTest("ALL-SYSTEM", SPLIT_PKG_NAME);
+        // default
+        runTest(null, SPLIT_PKG_NAME);
+
         // Test jdeps classes
-        runTest(null);
-        // Test jdeps --add-modules
-        runTest(JAVA_ANNOTATIONS_COMMON, SPLIT_PKG_NAME);
+        runTest("ALL-DEFAULT");
+
     }
 
     private void runTest(String root, String... splitPackages) throws Exception {
--- a/make/CopyImportModules.gmk	Mon Jan 09 15:10:25 2017 +0100
+++ b/make/CopyImportModules.gmk	Fri Jan 13 18:26:33 2017 +0100
@@ -67,14 +67,17 @@
     # or risk invalidating the build output from external changes.
     ifeq ($(filter $(OUTPUT_ROOT)/%, $(LIBS_DIR)), )
       LINK_MACRO := install-file
+      LOG_ACTION := Copying
     else
       LINK_MACRO := link-file-relative
+      LOG_ACTION := Creating symlink
     endif
     $(eval $(call SetupCopyFiles, LINK_LIBS, \
         SRC := $(LIBS_DIR), \
         DEST := $(JDK_OUTPUTDIR)/lib, \
         FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \
         MACRO := $(LINK_MACRO), \
+        LOG_ACTION := $(LOG_ACTION), \
     ))
     TARGETS += $(COPY_LIBS) $(LINK_LIBS)
   endif
--- a/make/Main.gmk	Mon Jan 09 15:10:25 2017 +0100
+++ b/make/Main.gmk	Fri Jan 13 18:26:33 2017 +0100
@@ -630,13 +630,12 @@
   # in javadoc.
   java.desktop-gensrc-jdk: java.base-gensrc
 
-  # The annotation processing for jdk.vm.ci needs java.base classes from the
-  # current JDK.
-  jdk.vm.ci-gensrc-hotspot: java.base-java
-
-  # The annotation processing for jdk.vm.compiler needs classes from the current JDK.
-  jdk.vm.compiler-gensrc-hotspot: java.base-java java.management-java \
-      jdk.management-java jdk.vm.ci-java jdk.unsupported-java
+  # The annotation processing for jdk.vm.ci and jdk.vm.compiler needs classes
+  # from the current JDK.
+  jdk.vm.ci-gensrc-hotspot: $(addsuffix -java, \
+      $(call FindTransitiveDepsForModule, jdk.vm.ci))
+  jdk.vm.compiler-gensrc-hotspot: $(addsuffix -java, \
+      $(call FindTransitiveDepsForModule, jdk.vm.compiler))
 
   # For jdk.vm.compiler, the gensrc step is generating a module-info.java.extra
   # file to be processed by the gensrc-moduleinfo target.
--- a/make/ModuleWrapper.gmk	Mon Jan 09 15:10:25 2017 +0100
+++ b/make/ModuleWrapper.gmk	Fri Jan 13 18:26:33 2017 +0100
@@ -76,6 +76,7 @@
           $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
           $(TARGETS))), \
       MACRO := link-file-relative, \
+      LOG_ACTION := Creating symlink, \
   ))
 endif
 
--- a/make/common/MakeBase.gmk	Mon Jan 09 15:10:25 2017 +0100
+++ b/make/common/MakeBase.gmk	Fri Jan 13 18:26:33 2017 +0100
@@ -694,8 +694,9 @@
   # 2 : Dest file
   # 3 : Variable to add targets to
   # 4 : Macro to call for copy operation
+  # 5 : Action text to log
   $2: $1
-	$$(call LogInfo, Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@))
+	$$(call LogInfo, $(strip $5) $$(patsubst $(OUTPUT_ROOT)/%,%,$$@))
 	$$($$(strip $4))
 
   $3 += $2
@@ -721,6 +722,7 @@
 #             Default is 'install-file'
 #   NAME_MACRO : Optionally supply a macro that rewrites the target file name
 #                based on the source file name
+#   LOG_ACTION : Optionally specify a different action text for log messages
 SetupCopyFiles = $(NamedParamsMacroTemplate)
 define SetupCopyFilesBody
 
@@ -737,6 +739,10 @@
     $1_NAME_MACRO := identity
   endif
 
+  ifeq ($$($1_LOG_ACTION), )
+    $1_LOG_ACTION := Copying
+  endif
+
   # Remove any trailing slash from SRC and DEST
   $1_SRC := $$(patsubst %/,%,$$($1_SRC))
   $1_DEST := $$(patsubst %/,%,$$($1_DEST))
@@ -744,7 +750,7 @@
   $$(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, $$($1_MACRO), $$($1_LOG_ACTION))))
 
 endef
 
--- a/nashorn/.hgtags	Mon Jan 09 15:10:25 2017 +0100
+++ b/nashorn/.hgtags	Fri Jan 13 18:26:33 2017 +0100
@@ -384,3 +384,4 @@
 0a4bc2f049132ddc20985565bb41b2be8a458dda jdk-9+148
 c281306d33d83c92e0d870ace385d5f99678d7e7 jdk-9+149
 ace1d994bca775d6545a4c874ae73d1dfc9ec18b jdk-9+150
+2a0437036a64853334e538044eb68d2df70075fa jdk-9+151
--- a/nashorn/README	Mon Jan 09 15:10:25 2017 +0100
+++ b/nashorn/README	Fri Jan 13 18:26:33 2017 +0100
@@ -24,33 +24,33 @@
 
 You can clone Nashorn Mercurial forest using this command:
 
-    hg fclone http://hg.openjdk.java.net/nashorn/jdk8 nashorn~jdk8
+    hg fclone http://hg.openjdk.java.net/nashorn/jdk9 nashorn~jdk9
     
 To update your copy of the forest (fwith the latest code:
 
-    (cd nashorn~jdk8 ; hg fpull)
+    (cd nashorn~jdk9 ; hg fpull)
     
 Or just the nashorn subdirectory with
 
-    (cd nashorn~jdk8/nashorn ; hg pull -u)
+    (cd nashorn~jdk9/nashorn ; hg pull -u)
     
 To learn about Mercurial in detail, please visit http://hgbook.red-bean.com.
 
 - How to build?
 
-To build Nashorn, you need to install JDK 8. You may use the Nashorn
+To build Nashorn, you need to install JDK 9. You may use the Nashorn
 forest build (recommended) or down load from java.net.  You will need to
 set JAVA_HOME environmental variable to point to your JDK installation
 directory.
 
-    cd nashorn~jdk8/nashorn/make
+    cd nashorn~jdk9/nashorn/make
     ant clean; ant
 
 - How to run?
 
 Use the jjs script (see RELESE_README):
 
-    cd nashorn~jdk8/nashorn
+    cd nashorn~jdk9/nashorn
     sh bin/jjs <your .js file>
 
 Nashorn supports javax.script API. It is possible to drop nashorn.jar in
@@ -64,7 +64,7 @@
 Comprehensive development documentation is found in the Nashorn JavaDoc. You can
 build it using:
 
-    cd nashorn~jdk8/nashorn/make
+    cd nashorn~jdk9/nashorn/make
     ant javadoc
     
 after which you can view the generated documentation at dist/javadoc/index.html.
@@ -90,7 +90,7 @@
 test/script/external/test262 a symbolic link to that directory. After
 you've done this, you can run the ECMA-262 tests using:
 
-    cd nashorn~jdk8/nashorn/make
+    cd nashorn~jdk9/nashorn/make
     ant test262
 
 Ant target to get/update external test suites:
@@ -101,7 +101,7 @@
 These tests take time, so we have a parallelized runner for them that
 takes advantage of all processor cores on the computer:
 
-    cd nashorn~jdk8/nashorn/make
+    cd nashorn~jdk9/nashorn/make
     ant test262parallel
     
 - How to write your own test?
--- a/nashorn/RELEASE_README	Mon Jan 09 15:10:25 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-The Nashorn repo is in the process of being migrated to OpenJDK and as such is
-incomplete in several areas.
-
-- The build system is not fully integrated.  When complete, Nashorn will be
-installed in its proper location in the JRE.
-
-- Once integrated, the correct version of the JDK will be wrapped around 
-Nashorn.  In the meantime, ensure you use JDK8 b68 or later.
-
-- The jjs tool has not been implemented in binary form yet.  Use "sh bin/jjs" 
-(or bin/jjs.bat on windows) in the interm.
-
-- The Dynalink component is not fully integrated into Nashorn as yet, but will
-be when details are finalized.
-
-- And, finally Nashorn is still in development.  To stay up to date, subscribe
-to nashorn-dev@openjdk.java.net at
-
-    http://mail.openjdk.java.net/mailman/listinfo/nashorn-dev.
-
--- a/nashorn/make/build.xml	Mon Jan 09 15:10:25 2017 +0100
+++ b/nashorn/make/build.xml	Fri Jan 13 18:26:33 2017 +0100
@@ -267,7 +267,7 @@
 
   <!-- generate javadoc for Nashorn classes -->
   <target name="javadoc" depends="jar">
-    <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="${nashorn.module.src.dir}/overview.html"
+    <javadoc destdir="${dist.javadoc.dir}" use="yes"
         windowtitle="${nashorn.product.name} ${nashorn.version}"
         additionalparam="-quiet" failonerror="true" useexternalfile="true">
       <arg value="--module-source-path"/>
@@ -285,7 +285,7 @@
   <!-- generate javadoc only for nashorn extension api classes -->
   <target name="nashornapi" depends="jar">
     <mkdir dir="${dist.nashornapi.javadoc.dir}"/>
-    <javadoc destdir="${dist.nashornapi.javadoc.dir}" use="yes" overview="${nashorn.module.src.dir}/overview.html"
+    <javadoc destdir="${dist.nashornapi.javadoc.dir}" use="yes"
         extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}"
         additionalparam="-quiet" failonerror="true" useexternalfile="true">
       <arg value="--module-source-path"/>
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/package-info.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/package-info.java	Fri Jan 13 18:26:33 2017 +0100
@@ -82,197 +82,6 @@
 */
 
 /**
- * <p>
- * Dynalink is a library for dynamic linking of high-level operations on objects.
- * These operations include "read a property",
- * "write a property", "invoke a function" and so on. Dynalink is primarily
- * useful for implementing programming languages where at least some expressions
- * have dynamic types (that is, types that can not be decided statically), and
- * the operations on dynamic types are expressed as
- * {@link java.lang.invoke.CallSite call sites}. These call sites will be
- * linked to appropriate target {@link java.lang.invoke.MethodHandle method handles}
- * at run time based on actual types of the values the expressions evaluated to.
- * These can change between invocations, necessitating relinking the call site
- * multiple times to accommodate new types; Dynalink handles all that and more.
- * <p>
- * Dynalink supports implementation of programming languages with object models
- * that differ (even radically) from the JVM's class-based model and have their
- * custom type conversions.
- * <p>
- * Dynalink is closely related to, and relies on, the {@link java.lang.invoke}
- * package.
- * <p>
- *
- * While {@link java.lang.invoke} provides a low level API for dynamic linking
- * of {@code invokedynamic} call sites, it does not provide a way to express
- * higher level operations on objects, nor methods that implement them. These
- * operations are the usual ones in object-oriented environments: property
- * access, access of elements of collections, invocation of methods and
- * constructors (potentially with multiple dispatch, e.g. link- and run-time
- * equivalents of Java overloaded method resolution). These are all functions
- * that are normally desired in a language on the JVM. If a language is
- * statically typed and its type system matches that of the JVM, it can
- * accomplish this with use of the usual invocation, field access, etc.
- * instructions (e.g. {@code invokevirtual}, {@code getfield}). However, if the
- * language is dynamic (hence, types of some expressions are not known until
- * evaluated at run time), or its object model or type system don't match
- * closely that of the JVM, then it should use {@code invokedynamic} call sites
- * instead and let Dynalink manage them.
- * <h2>Example</h2>
- * Dynalink is probably best explained by an example showing its use. Let's
- * suppose you have a program in a language where you don't have to declare the
- * type of an object and you want to access a property on it:
- * <pre>
- * var color = obj.color;
- * </pre>
- * If you generated a Java class to represent the above one-line program, its
- * bytecode would look something like this:
- * <pre>
- * aload 2 // load "obj" on stack
- * invokedynamic "GET:PROPERTY:color"(Object)Object // invoke property getter on object of unknown type
- * astore 3 // store the return value into local variable "color"
- * </pre>
- * In order to link the {@code invokedynamic} instruction, we need a bootstrap
- * method. A minimalist bootstrap method with Dynalink could look like this:
- * <pre>
- * import java.lang.invoke.*;
- * import jdk.dynalink.*;
- * import jdk.dynalink.support.*;
- *
- * class MyLanguageRuntime {
- *     private static final DynamicLinker dynamicLinker = new DynamicLinkerFactory().createLinker();
- *
- *     public static CallSite bootstrap(MethodHandles.Lookup lookup, String name, MethodType type) {
- *         return dynamicLinker.link(
- *             new SimpleRelinkableCallSite(
- *                 new CallSiteDescriptor(lookup, parseOperation(name), type)));
- *     }
- *
- *     private static Operation parseOperation(String name) {
- *         ...
- *     }
- * }
- * </pre>
- * There are several objects of significance in the above code snippet:
- * <ul>
- * <li>{@link jdk.dynalink.DynamicLinker} is the main object in Dynalink, it
- * coordinates the linking of call sites to method handles that implement the
- * operations named in them. It is configured and created using a
- * {@link jdk.dynalink.DynamicLinkerFactory}.</li>
- * <li>When the bootstrap method is invoked, it needs to create a
- * {@link java.lang.invoke.CallSite} object. In Dynalink, these call sites need
- * to additionally implement the {@link jdk.dynalink.RelinkableCallSite}
- * interface. "Relinkable" here alludes to the fact that if the call site
- * encounters objects of different types at run time, its target will be changed
- * to a method handle that can perform the operation on the newly encountered
- * type. {@link jdk.dynalink.support.SimpleRelinkableCallSite} and
- * {@link jdk.dynalink.support.ChainedCallSite} (not used in the above example)
- * are two implementations already provided by the library.</li>
- * <li>Dynalink uses {@link jdk.dynalink.CallSiteDescriptor} objects to
- * preserve the parameters to the bootstrap method: the lookup and the method type,
- * as it will need them whenever it needs to relink a call site.</li>
- * <li>Dynalink uses {@link jdk.dynalink.Operation} objects to express
- * dynamic operations. It does not prescribe how would you encode the operations
- * in your call site, though. That is why in the above example the
- * {@code parseOperation} function is left empty, and you would be expected to
- * provide the code to parse the string {@code "GET:PROPERTY:color"}
- * in the call site's name into a named property getter operation object as
- * {@code StandardOperation.GET.withNamespace(StandardNamespace.PROPERTY).named("color")}.
- * </ul>
- * <p>What can you already do with the above setup? {@code DynamicLinkerFactory}
- * by default creates a {@code DynamicLinker} that can link Java objects with the
- * usual Java semantics. If you have these three simple classes:
- * <pre>
- * public class A {
- *     public String color;
- *     public A(String color) { this.color = color; }
- * }
- *
- * public class B {
- *     private String color;
- *     public B(String color) { this.color = color; }
- *     public String getColor() { return color; }
- * }
- *
- * public class C {
- *     private int color;
- *     public C(int color) { this.color = color; }
- *     public int getColor() { return color; }
- * }
- * </pre>
- * and you somehow create their instances and pass them to your call site in your
- * programming language:
- * <pre>
- * for each(var obj in [new A("red"), new B("green"), new C(0x0000ff)]) {
- *     print(obj.color);
- * }
- * </pre>
- * then on first invocation, Dynalink will link the {@code .color} getter
- * operation to a field getter for {@code A.color}, on second invocation it will
- * relink it to {@code B.getColor()} returning a {@code String}, and finally on
- * third invocation it will relink it to {@code C.getColor()} returning an {@code int}.
- * The {@code SimpleRelinkableCallSite} we used above only remembers the linkage
- * for the last encountered type (it implements what is known as a <i>monomorphic
- * inline cache</i>). Another already provided implementation,
- * {@link jdk.dynalink.support.ChainedCallSite} will remember linkages for
- * several different types (it is a <i>polymorphic inline cache</i>) and is
- * probably a better choice in serious applications.
- * <h2>Dynalink and bytecode creation</h2>
- * {@code CallSite} objects are usually created as part of bootstrapping
- * {@code invokedynamic} instructions in bytecode. Hence, Dynalink is typically
- * used as part of language runtimes that compile programs into Java
- * {@code .class} bytecode format. Dynalink does not address the aspects of
- * either creating bytecode classes or loading them into the JVM. That said,
- * Dynalink can also be used without bytecode compilation (e.g. in language
- * interpreters) by creating {@code CallSite} objects explicitly and associating
- * them with representations of dynamic operations in the interpreted program
- * (e.g. a typical representation would be some node objects in a syntax tree).
- * <h2>Available operations</h2>
- * Dynalink defines several standard operations in its
- * {@link jdk.dynalink.StandardOperation} class. The linker for Java
- * objects can link all of these operations, and you are encouraged to at
- * minimum support and use these operations in your language too. The
- * standard operations {@code GET} and {@code SET} need to be combined with
- * at least one {@link jdk.dynalink.Namespace} to be useful, e.g. to express a
- * property getter, you'd use {@code StandardOperation.GET.withNamespace(StandardNamespace.PROPERTY)}.
- * Dynalink defines three standard namespaces in the {@link jdk.dynalink.StandardNamespace} class.
- * To associate a fixed name with an operation, you can use
- * {@link jdk.dynalink.NamedOperation} as in the previous example:
- * {@code StandardOperation.GET.withNamespace(StandardNamespace.PROPERTY).named("color")}
- * expresses a getter for the property named "color".
- * <h2>Operations on multiple namespaces</h2>
- * Some languages might not have separate namespaces on objects for
- * properties, elements, and methods, and a source language construct might
- * address several of them at once. Dynalink supports specifying multiple
- * {@link jdk.dynalink.Namespace} objects with {@link jdk.dynalink.NamespaceOperation}.
- * <h2>Language-specific linkers</h2>
- * Languages that define their own object model different than the JVM
- * class-based model and/or use their own type conversions will need to create
- * their own language-specific linkers. See the {@link jdk.dynalink.linker}
- * package and specifically the {@link jdk.dynalink.linker.GuardingDynamicLinker}
- * interface to get started.
- * <h2>Dynalink and Java objects</h2>
- * The {@code DynamicLinker} objects created by {@code DynamicLinkerFactory} by
- * default contain an internal instance of
- * {@code BeansLinker}, which is a language-specific linker
- * that implements the usual Java semantics for all of the above operations and
- * can link any Java object that no other language-specific linker has managed
- * to link. This way, all language runtimes have built-in interoperability with
- * ordinary Java objects. See {@link jdk.dynalink.beans.BeansLinker} for details
- * on how it links the various operations.
- * <h2>Cross-language interoperability</h2>
- * A {@code DynamicLinkerFactory} can be configured with a
- * {@link jdk.dynalink.DynamicLinkerFactory#setClassLoader(ClassLoader) class
- * loader}. It will try to instantiate all
- * {@link jdk.dynalink.linker.GuardingDynamicLinkerExporter} classes visible to
- * that class loader and compose the linkers they provide into the
- * {@code DynamicLinker} it creates. This allows for interoperability between
- * languages: if you have two language runtimes A and B deployed in your JVM and
- * they export their linkers through the above mechanism, language runtime A
- * will have a language-specific linker instance from B and vice versa inside
- * their {@code DynamicLinker} objects. This means that if an object from
- * language runtime B gets passed to code from language runtime A, the linker
- * from B will get a chance to link the call site in A when it encounters the
- * object from B.
+ * Contains interfaces and classes that are used to link an {@code invokedynamic} call site.
  */
 package jdk.dynalink;
--- a/nashorn/src/jdk.dynalink/share/classes/module-info.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/nashorn/src/jdk.dynalink/share/classes/module-info.java	Fri Jan 13 18:26:33 2017 +0100
@@ -24,7 +24,198 @@
  */
 
 /**
- * Dynalink
+ * <p>
+ * Dynalink is a library for dynamic linking of high-level operations on objects.
+ * These operations include "read a property",
+ * "write a property", "invoke a function" and so on. Dynalink is primarily
+ * useful for implementing programming languages where at least some expressions
+ * have dynamic types (that is, types that can not be decided statically), and
+ * the operations on dynamic types are expressed as
+ * {@link java.lang.invoke.CallSite call sites}. These call sites will be
+ * linked to appropriate target {@link java.lang.invoke.MethodHandle method handles}
+ * at run time based on actual types of the values the expressions evaluated to.
+ * These can change between invocations, necessitating relinking the call site
+ * multiple times to accommodate new types; Dynalink handles all that and more.
+ * <p>
+ * Dynalink supports implementation of programming languages with object models
+ * that differ (even radically) from the JVM's class-based model and have their
+ * custom type conversions.
+ * <p>
+ * Dynalink is closely related to, and relies on, the {@link java.lang.invoke}
+ * package.
+ * <p>
+ *
+ * While {@link java.lang.invoke} provides a low level API for dynamic linking
+ * of {@code invokedynamic} call sites, it does not provide a way to express
+ * higher level operations on objects, nor methods that implement them. These
+ * operations are the usual ones in object-oriented environments: property
+ * access, access of elements of collections, invocation of methods and
+ * constructors (potentially with multiple dispatch, e.g. link- and run-time
+ * equivalents of Java overloaded method resolution). These are all functions
+ * that are normally desired in a language on the JVM. If a language is
+ * statically typed and its type system matches that of the JVM, it can
+ * accomplish this with use of the usual invocation, field access, etc.
+ * instructions (e.g. {@code invokevirtual}, {@code getfield}). However, if the
+ * language is dynamic (hence, types of some expressions are not known until
+ * evaluated at run time), or its object model or type system don't match
+ * closely that of the JVM, then it should use {@code invokedynamic} call sites
+ * instead and let Dynalink manage them.
+ * <h2>Example</h2>
+ * Dynalink is probably best explained by an example showing its use. Let's
+ * suppose you have a program in a language where you don't have to declare the
+ * type of an object and you want to access a property on it:
+ * <pre>
+ * var color = obj.color;
+ * </pre>
+ * If you generated a Java class to represent the above one-line program, its
+ * bytecode would look something like this:
+ * <pre>
+ * aload 2 // load "obj" on stack
+ * invokedynamic "GET:PROPERTY:color"(Object)Object // invoke property getter on object of unknown type
+ * astore 3 // store the return value into local variable "color"
+ * </pre>
+ * In order to link the {@code invokedynamic} instruction, we need a bootstrap
+ * method. A minimalist bootstrap method with Dynalink could look like this:
+ * <pre>
+ * import java.lang.invoke.*;
+ * import jdk.dynalink.*;
+ * import jdk.dynalink.support.*;
+ *
+ * class MyLanguageRuntime {
+ *     private static final DynamicLinker dynamicLinker = new DynamicLinkerFactory().createLinker();
+ *
+ *     public static CallSite bootstrap(MethodHandles.Lookup lookup, String name, MethodType type) {
+ *         return dynamicLinker.link(
+ *             new SimpleRelinkableCallSite(
+ *                 new CallSiteDescriptor(lookup, parseOperation(name), type)));
+ *     }
+ *
+ *     private static Operation parseOperation(String name) {
+ *         ...
+ *     }
+ * }
+ * </pre>
+ * There are several objects of significance in the above code snippet:
+ * <ul>
+ * <li>{@link jdk.dynalink.DynamicLinker} is the main object in Dynalink, it
+ * coordinates the linking of call sites to method handles that implement the
+ * operations named in them. It is configured and created using a
+ * {@link jdk.dynalink.DynamicLinkerFactory}.</li>
+ * <li>When the bootstrap method is invoked, it needs to create a
+ * {@link java.lang.invoke.CallSite} object. In Dynalink, these call sites need
+ * to additionally implement the {@link jdk.dynalink.RelinkableCallSite}
+ * interface. "Relinkable" here alludes to the fact that if the call site
+ * encounters objects of different types at run time, its target will be changed
+ * to a method handle that can perform the operation on the newly encountered
+ * type. {@link jdk.dynalink.support.SimpleRelinkableCallSite} and
+ * {@link jdk.dynalink.support.ChainedCallSite} (not used in the above example)
+ * are two implementations already provided by the library.</li>
+ * <li>Dynalink uses {@link jdk.dynalink.CallSiteDescriptor} objects to
+ * preserve the parameters to the bootstrap method: the lookup and the method type,
+ * as it will need them whenever it needs to relink a call site.</li>
+ * <li>Dynalink uses {@link jdk.dynalink.Operation} objects to express
+ * dynamic operations. It does not prescribe how would you encode the operations
+ * in your call site, though. That is why in the above example the
+ * {@code parseOperation} function is left empty, and you would be expected to
+ * provide the code to parse the string {@code "GET:PROPERTY:color"}
+ * in the call site's name into a named property getter operation object as
+ * {@code StandardOperation.GET.withNamespace(StandardNamespace.PROPERTY).named("color")}.
+ * </ul>
+ * <p>What can you already do with the above setup? {@code DynamicLinkerFactory}
+ * by default creates a {@code DynamicLinker} that can link Java objects with the
+ * usual Java semantics. If you have these three simple classes:
+ * <pre>
+ * public class A {
+ *     public String color;
+ *     public A(String color) { this.color = color; }
+ * }
+ *
+ * public class B {
+ *     private String color;
+ *     public B(String color) { this.color = color; }
+ *     public String getColor() { return color; }
+ * }
+ *
+ * public class C {
+ *     private int color;
+ *     public C(int color) { this.color = color; }
+ *     public int getColor() { return color; }
+ * }
+ * </pre>
+ * and you somehow create their instances and pass them to your call site in your
+ * programming language:
+ * <pre>
+ * for each(var obj in [new A("red"), new B("green"), new C(0x0000ff)]) {
+ *     print(obj.color);
+ * }
+ * </pre>
+ * then on first invocation, Dynalink will link the {@code .color} getter
+ * operation to a field getter for {@code A.color}, on second invocation it will
+ * relink it to {@code B.getColor()} returning a {@code String}, and finally on
+ * third invocation it will relink it to {@code C.getColor()} returning an {@code int}.
+ * The {@code SimpleRelinkableCallSite} we used above only remembers the linkage
+ * for the last encountered type (it implements what is known as a <i>monomorphic
+ * inline cache</i>). Another already provided implementation,
+ * {@link jdk.dynalink.support.ChainedCallSite} will remember linkages for
+ * several different types (it is a <i>polymorphic inline cache</i>) and is
+ * probably a better choice in serious applications.
+ * <h2>Dynalink and bytecode creation</h2>
+ * {@code CallSite} objects are usually created as part of bootstrapping
+ * {@code invokedynamic} instructions in bytecode. Hence, Dynalink is typically
+ * used as part of language runtimes that compile programs into Java
+ * {@code .class} bytecode format. Dynalink does not address the aspects of
+ * either creating bytecode classes or loading them into the JVM. That said,
+ * Dynalink can also be used without bytecode compilation (e.g. in language
+ * interpreters) by creating {@code CallSite} objects explicitly and associating
+ * them with representations of dynamic operations in the interpreted program
+ * (e.g. a typical representation would be some node objects in a syntax tree).
+ * <h2>Available operations</h2>
+ * Dynalink defines several standard operations in its
+ * {@link jdk.dynalink.StandardOperation} class. The linker for Java
+ * objects can link all of these operations, and you are encouraged to at
+ * minimum support and use these operations in your language too. The
+ * standard operations {@code GET} and {@code SET} need to be combined with
+ * at least one {@link jdk.dynalink.Namespace} to be useful, e.g. to express a
+ * property getter, you'd use {@code StandardOperation.GET.withNamespace(StandardNamespace.PROPERTY)}.
+ * Dynalink defines three standard namespaces in the {@link jdk.dynalink.StandardNamespace} class.
+ * To associate a fixed name with an operation, you can use
+ * {@link jdk.dynalink.NamedOperation} as in the previous example:
+ * {@code StandardOperation.GET.withNamespace(StandardNamespace.PROPERTY).named("color")}
+ * expresses a getter for the property named "color".
+ * <h2>Operations on multiple namespaces</h2>
+ * Some languages might not have separate namespaces on objects for
+ * properties, elements, and methods, and a source language construct might
+ * address several of them at once. Dynalink supports specifying multiple
+ * {@link jdk.dynalink.Namespace} objects with {@link jdk.dynalink.NamespaceOperation}.
+ * <h2>Language-specific linkers</h2>
+ * Languages that define their own object model different than the JVM
+ * class-based model and/or use their own type conversions will need to create
+ * their own language-specific linkers. See the {@link jdk.dynalink.linker}
+ * package and specifically the {@link jdk.dynalink.linker.GuardingDynamicLinker}
+ * interface to get started.
+ * <h2>Dynalink and Java objects</h2>
+ * The {@code DynamicLinker} objects created by {@code DynamicLinkerFactory} by
+ * default contain an internal instance of
+ * {@code BeansLinker}, which is a language-specific linker
+ * that implements the usual Java semantics for all of the above operations and
+ * can link any Java object that no other language-specific linker has managed
+ * to link. This way, all language runtimes have built-in interoperability with
+ * ordinary Java objects. See {@link jdk.dynalink.beans.BeansLinker} for details
+ * on how it links the various operations.
+ * <h2>Cross-language interoperability</h2>
+ * A {@code DynamicLinkerFactory} can be configured with a
+ * {@link jdk.dynalink.DynamicLinkerFactory#setClassLoader(ClassLoader) class
+ * loader}. It will try to instantiate all
+ * {@link jdk.dynalink.linker.GuardingDynamicLinkerExporter} classes visible to
+ * that class loader and compose the linkers they provide into the
+ * {@code DynamicLinker} it creates. This allows for interoperability between
+ * languages: if you have two language runtimes A and B deployed in your JVM and
+ * they export their linkers through the above mechanism, language runtime A
+ * will have a language-specific linker instance from B and vice versa inside
+ * their {@code DynamicLinker} objects. This means that if an object from
+ * language runtime B gets passed to code from language runtime A, the linker
+ * from B will get a chance to link the call site in A when it encounters the
+ * object from B.
  */
 module jdk.dynalink {
     requires java.logging;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/module-info.java	Mon Jan 09 15:10:25 2017 +0100
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/module-info.java	Fri Jan 13 18:26:33 2017 +0100
@@ -24,7 +24,71 @@
  */
 
 /**
- * Nashorn
+<p>
+Nashorn is a runtime environment for programs written in ECMAScript 5.1.
+</p>
+<h1>Usage</h1>
+The recommended way to use Nashorn is through the <a href="http://jcp.org/en/jsr/detail?id=223" target="_top">JSR-223
+"Scripting for the Java Platform"</a> APIs found in the {@link javax.script} package. Usually, you'll obtain a
+{@link javax.script.ScriptEngine} instance for Nashorn using:
+<pre>
+import javax.script.*;
+...
+ScriptEngine nashornEngine = new ScriptEngineManager().getEngineByName("nashorn");
+</pre>
+and then use it just as you would any other JSR-223 script engine. See
+<a href="jdk/nashorn/api/scripting/package-summary.html">{@code jdk.nashorn.api.scripting}</a> package
+for details.
+<h1>Compatibility</h1>
+Nashorn is 100% compliant with the <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm"
+target="_top">ECMA-262 Standard, Edition 5.1</a>. It requires a Java Virtual Machine that implements the
+<a href="http://jcp.org/en/jsr/detail?id=292" target="_top">JSR-292 "Supporting Dynamically Typed Languages on the Java
+Platform"</a> specification (often referred to as "invokedynamic"), as well as the already mentioned JSR-223.
+<h1>Interoperability with the Java platform</h1>
+In addition to being a 100% ECMAScript 5.1 runtime, Nashorn provides features for interoperability of the ECMAScript
+programs with the Java platform. In general, any Java object put into the script engine's context will be visible from
+the script. In terms of the standard, such Java objects are not considered "native objects", but rather "host objects",
+as defined in section 4.3.8. This distinction allows certain semantical differences in handling them compared to native
+objects. For most purposes, Java objects behave just as native objects do: you can invoke their methods, get and set
+their properties. In most cases, though, you can't add arbitrary properties to them, nor can you remove existing
+properties.
+<h2>Java collection handling</h2>
+Native Java arrays and {@link java.util.List}s support indexed access to their elements through the property accessors,
+and {@link java.util.Map}s support both property and element access through both dot and square-bracket property
+accessors, with the difference being that dot operator gives precedence to object properties (its fields and properties
+defined as {@code getXxx} and {@code setXxx} methods) while the square bracket operator gives precedence to map
+elements. Native Java arrays expose the {@code length} property.
+<h2>ECMAScript primitive types</h2>
+ECMAScript primitive types for number, string, and boolean are represented with {@link java.lang.Number},
+{@link java.lang.CharSequence}, and {@link java.lang.Boolean} objects. While the most often used number type is
+{@link java.lang.Double} and the most often used string type is {@link java.lang.String}, don't rely on it as various
+internal optimizations cause other subclasses of {@code Number} and internal implementations of {@code CharSequence} to
+be used.
+<h2>Type conversions</h2>
+When a method on a Java object is invoked, the arguments are converted to the formal parameter types of the Java method
+using all allowed ECMAScript conversions. This can be surprising, as in general, conversions from string to number will
+succeed according to Standard's section 9.3 "ToNumber" and so on; string to boolean, number to boolean, Object to
+number, Object to string all work. Note that if the Java method's declared parameter type is {@code java.lang.Object},
+Nashorn objects are passed without any conversion whatsoever; specifically if the JavaScript value being passed is of
+primitive string type, you can only rely on it being a {@code java.lang.CharSequence}, and if the value is a number, you
+can only rely on it being a {@code java.lang.Number}. If the Java method declared parameter type is more specific (e.g.
+{@code java.lang.String} or {@code java.lang.Double}), then Nashorn will of course ensure the required type is passed.
+<h2>SAM types</h2>
+As a special extension when invoking Java methods, ECMAScript function objects can be passed in place of an argument
+whose Java type is so-called "single abstract method" or "SAM" type. While this name usually covers single-method
+interfaces, Nashorn is a bit more versatile, and it recognizes a type as a SAM type if all its abstract methods are
+overloads of the same name, and it is either an interface, or it is an abstract class with
+a no-arg constructor. The type itself must be public, while the constructor and the methods can be either public or
+protected. If there are multiple abstract overloads of the same name, the single function will serve as the shared
+implementation for all of them, <em>and additionally it will also override any non-abstract methods of the same name</em>.
+This is done to be consistent with the fact that ECMAScript does not have the concept of overloaded methods.
+<h2>The {@code Java} object</h2>
+Nashorn exposes a non-standard global object named {@code Java} that is the primary API entry point into Java
+platform-specific functionality. You can use it to create instances of Java classes, convert from Java arrays to native
+arrays and back, and so on.
+<h2>Other non-standard built-in objects</h2>
+In addition to {@code Java}, Nashorn also exposes some other non-standard built-in objects:
+{@code JSAdapter}, {@code JavaImporter}, {@code Packages}
  */
 module jdk.scripting.nashorn {
     requires java.logging;
@@ -47,4 +111,3 @@
     provides jdk.dynalink.linker.GuardingDynamicLinkerExporter
         with jdk.nashorn.api.linker.NashornLinkerExporter;
 }
-
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/overview.html	Mon Jan 09 15:10:25 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-<!-- 
- Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  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.
--->
-<body>
-<p>
-Nashorn is a runtime environment for programs written in ECMAScript 5.1.
-</p>
-<h1>Usage</h1>
-<p>
-The recommended way to use Nashorn is through the <a href="http://jcp.org/en/jsr/detail?id=223" target="_top">JSR-223
-"Scripting for the Java Platform"</a> APIs found in the {@link javax.script} package. Usually, you'll obtain a
-{@link javax.script.ScriptEngine} instance for Nashorn using:
-<pre>
-import javax.script.*;
-...
-ScriptEngine nashornEngine = new ScriptEngineManager().getEngineByName("nashorn");
-</pre>
-and then use it just as you would any other JSR-223 script engine. See
-<a href="jdk/nashorn/api/scripting/package-summary.html">{@code jdk.nashorn.api.scripting}</a> package
-for details.
-<p>
-<h1>Compatibility</h1>
-Nashorn is 100% compliant with the <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm"
-target="_top">ECMA-262 Standard, Edition 5.1</a>. It requires a Java Virtual Machine that implements the
-<a href="http://jcp.org/en/jsr/detail?id=292" target="_top">JSR-292 "Supporting Dynamically Typed Languages on the Java
-Platform"</a> specification (often referred to as "invokedynamic"), as well as the already mentioned JSR-223.
-<h1>Interoperability with the Java platform</h1>
-<p>
-In addition to being a 100% ECMAScript 5.1 runtime, Nashorn provides features for interoperability of the ECMAScript
-programs with the Java platform. In general, any Java object put into the script engine's context will be visible from
-the script. In terms of the standard, such Java objects are not considered "native objects", but rather "host objects",
-as defined in section 4.3.8. This distinction allows certain semantical differences in handling them compared to native
-objects. For most purposes, Java objects behave just as native objects do: you can invoke their methods, get and set
-their properties. In most cases, though, you can't add arbitrary properties to them, nor can you remove existing
-properties.
-<p>
-<h2>Java collection handling</h2>
-<p>
-Native Java arrays and {@link java.util.List}s support indexed access to their elements through the property accessors,
-and {@link java.util.Map}s support both property and element access through both dot and square-bracket property
-accessors, with the difference being that dot operator gives precedence to object properties (its fields and properties
-defined as {@code getXxx} and {@code setXxx} methods) while the square bracket operator gives precedence to map
-elements. Native Java arrays expose the {@code length} property.
-<p>
-<h2>ECMAScript primitive types</h2>
-<p>
-ECMAScript primitive types for number, string, and boolean are represented with {@link java.lang.Number},
-{@link java.lang.CharSequence}, and {@link java.lang.Boolean} objects. While the most often used number type is
-{@link java.lang.Double} and the most often used string type is {@link java.lang.String}, don't rely on it as various
-internal optimizations cause other subclasses of {@code Number} and internal implementations of {@code CharSequence} to
-be used.
-<p>
-<h2>Type conversions</h2>
-<p>
-When a method on a Java object is invoked, the arguments are converted to the formal parameter types of the Java method
-using all allowed ECMAScript conversions. This can be surprising, as in general, conversions from string to number will
-succeed according to Standard's section 9.3 "ToNumber" and so on; string to boolean, number to boolean, Object to
-number, Object to string all work. Note that if the Java method's declared parameter type is {@code java.lang.Object},
-Nashorn objects are passed without any conversion whatsoever; specifically if the JavaScript value being passed is of
-primitive string type, you can only rely on it being a {@code java.lang.CharSequence}, and if the value is a number, you
-can only rely on it being a {@code java.lang.Number}. If the Java method declared parameter type is more specific (e.g.
-{@code java.lang.String} or {@code java.lang.Double}), then Nashorn will of course ensure the required type is passed.
-<p>
-<h2>SAM types</h2>
-<p>
-As a special extension when invoking Java methods, ECMAScript function objects can be passed in place of an argument
-whose Java type is so-called "single abstract method" or "SAM" type. While this name usually covers single-method
-interfaces, Nashorn is a bit more versatile, and it recognizes a type as a SAM type if all its abstract methods are
-overloads of the same name, and it is either an interface, or it is an abstract class with
-a no-arg constructor. The type itself must be public, while the constructor and the methods can be either public or
-protected. If there are multiple abstract overloads of the same name, the single function will serve as the shared
-implementation for all of them, <em>and additionally it will also override any non-abstract methods of the same name</em>.
-This is done to be consistent with the fact that ECMAScript does not have the concept of overloaded methods.
-<p>
-<h2>The {@code Java} object</h2>
-Nashorn exposes a non-standard global object named {@code Java} that is the primary API entry point into Java
-platform-specific functionality. You can use it to create instances of Java classes, convert from Java arrays to native
-arrays and back, and so on. The methods on the objects are directly implemented by public static methods on the class
-<a href="jdk/nashorn/internal/objects/NativeJava.html">{@code NativeJava}</a>, see that class for details on what
-functionality is available.
-<h2>Representations of Java types</h2>
-The method <a href="jdk/nashorn/internal/objects/NativeJava.html#type(java.lang.Object,%20java.lang.Object)">
-{@code Java.type(typeName)}</a> takes a name of a type, and returns an object representing a Java type. You can
-use that object to both create new instances of Java classes, as well as to access static fields and methods on them.
-The type object is distinct from the {@code java.lang.Class} object, which represents the reflective run-time type
-identity and doesn't carry i.e. static members. Again, see the link for {@code NativeJava} above for details.
-<h2>Other non-standard built-in objects</h2>
-In addition to {@code Java}, Nashorn also exposes some other non-standard built-in objects:
-<a href="jdk/nashorn/internal/objects/NativeJSAdapter.html">{@code JSAdapter}</a>,
-<a href="jdk/nashorn/internal/objects/NativeJavaImporter.html">{@code JavaImporter}</a>,
-<a href="jdk/nashorn/internal/runtime/NativeJavaPackage.html">{@code Packages}.</a>
-</body>