changeset 39068:ebe077bb28ab

Merge
author ddehaven
date Wed, 01 Jun 2016 15:27:49 -0700
parents b470511f7339 f434a5f3ffaf
children 4279c9c95a92
files jdk/test/java/util/ResourceBundle/RestrictedBundleTest.html jdk/test/java/util/ResourceBundle/RestrictedBundleTest.java
diffstat 598 files changed, 44600 insertions(+), 1261 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri May 20 00:02:55 2016 -0700
+++ b/.hgtags	Wed Jun 01 15:27:49 2016 -0700
@@ -362,3 +362,4 @@
 82b8d12a553f5617737c238cec060281d52e351c jdk-9+117
 7c04fcb12bd4a31570a238e663fa846dfa5ec3b8 jdk-9+118
 caf97b37ebec84288c112d21d3a60cb628cba1e8 jdk-9+119
+9330543436402b8f3bd070524846a464d8143557 jdk-9+120
--- a/.hgtags-top-repo	Fri May 20 00:02:55 2016 -0700
+++ b/.hgtags-top-repo	Wed Jun 01 15:27:49 2016 -0700
@@ -362,3 +362,4 @@
 e882bcdbdac436523f3d5681611d3118a3804ea7 jdk-9+117
 047f95de8f918d8ff5e8cd2636a2abb5c3c8adb8 jdk-9+118
 3463a3f14f0f0e8a68f29ac6405454f2fa2f598a jdk-9+119
+647e0142a5a52749db572b5e6638d561def6479e jdk-9+120
--- a/common/autoconf/configure.ac	Fri May 20 00:02:55 2016 -0700
+++ b/common/autoconf/configure.ac	Wed Jun 01 15:27:49 2016 -0700
@@ -229,6 +229,7 @@
 
 JDKOPT_DETECT_INTREE_EC
 JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER
+JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST
 
 ###############################################################################
 #
--- a/common/autoconf/generated-configure.sh	Fri May 20 00:02:55 2016 -0700
+++ b/common/autoconf/generated-configure.sh	Wed Jun 01 15:27:49 2016 -0700
@@ -650,6 +650,7 @@
 JOBS
 MEMORY_SIZE
 NUM_CORES
+ENABLE_GENERATE_CLASSLIST
 BUILD_FAILURE_HANDLER
 ENABLE_INTREE_EC
 STLPORT_LIB
@@ -1226,6 +1227,7 @@
 with_dxsdk_lib
 with_dxsdk_include
 enable_jtreg_failure_handler
+enable_generate_classlist
 with_num_cores
 with_memory_size
 with_jobs
@@ -2005,6 +2007,10 @@
                           Default is auto, where the failure handler is built
                           if all dependencies are present and otherwise just
                           disabled.
+  --disable-generate-classlist
+                          forces enabling or disabling of the generation of a
+                          CDS classlist at build time. Default is to generate
+                          it when either the server or client JVMs are built.
   --enable-sjavac         use sjavac to do fast incremental compiles
                           [disabled]
   --disable-javac-server  disable javac server [enabled]
@@ -4391,6 +4397,12 @@
 #
 
 
+################################################################################
+#
+# Enable or disable generation of the classlist at build time
+#
+
+
 #
 # Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -5080,7 +5092,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1463732692
+DATE_WHEN_GENERATED=1464173584
 
 ###############################################################################
 #
@@ -64812,6 +64824,51 @@
 
 
 
+  # Check whether --enable-generate-classlist was given.
+if test "${enable_generate_classlist+set}" = set; then :
+  enableval=$enable_generate_classlist;
+fi
+
+
+  # Check if it's likely that it's possible to generate the classlist. Depending
+  # on exact jvm configuration it could be possible anyway.
+  if   [[ " $JVM_VARIANTS " =~ " server " ]]   ||   [[ " $JVM_VARIANTS " =~ " client " ]]  ; then
+    ENABLE_GENERATE_CLASSLIST_POSSIBLE="true"
+  else
+    ENABLE_GENERATE_CLASSLIST_POSSIBLE="false"
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the CDS classlist generation should be enabled" >&5
+$as_echo_n "checking if the CDS classlist generation should be enabled... " >&6; }
+  if test "x$enable_generate_classlist" = "xyes"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, forced" >&5
+$as_echo "yes, forced" >&6; }
+    ENABLE_GENERATE_CLASSLIST="true"
+    if test "x$ENABLE_GENERATE_CLASSLIST_POSSIBLE" = "xfalse"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS" >&5
+$as_echo "$as_me: WARNING: Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS" >&2;}
+    fi
+  elif test "x$enable_generate_classlist" = "xno"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, forced" >&5
+$as_echo "no, forced" >&6; }
+    ENABLE_GENERATE_CLASSLIST="false"
+  elif test "x$enable_generate_classlist" = "x"; then
+    if test "x$ENABLE_GENERATE_CLASSLIST_POSSIBLE" = "xtrue"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+      ENABLE_GENERATE_CLASSLIST="true"
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+      ENABLE_GENERATE_CLASSLIST="false"
+    fi
+  else
+    as_fn_error $? "Invalid value for --enable-generate-classlist: $enable_generate_classlist" "$LINENO" 5
+  fi
+
+
+
+
 ###############################################################################
 #
 # Configure parts of the build that only affect the build performance,
--- a/common/autoconf/jdk-options.m4	Fri May 20 00:02:55 2016 -0700
+++ b/common/autoconf/jdk-options.m4	Wed Jun 01 15:27:49 2016 -0700
@@ -491,3 +491,46 @@
 
   AC_SUBST(BUILD_FAILURE_HANDLER)
 ])
+
+################################################################################
+#
+# Enable or disable generation of the classlist at build time
+#
+AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST],
+[
+  AC_ARG_ENABLE([generate-classlist], [AS_HELP_STRING([--disable-generate-classlist],
+      [forces enabling or disabling of the generation of a CDS classlist at build time.
+      Default is to generate it when either the server or client JVMs are built.])])
+
+  # Check if it's likely that it's possible to generate the classlist. Depending
+  # on exact jvm configuration it could be possible anyway.
+  if HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client); then
+    ENABLE_GENERATE_CLASSLIST_POSSIBLE="true"
+  else
+    ENABLE_GENERATE_CLASSLIST_POSSIBLE="false"
+  fi
+
+  AC_MSG_CHECKING([if the CDS classlist generation should be enabled])
+  if test "x$enable_generate_classlist" = "xyes"; then
+    AC_MSG_RESULT([yes, forced])
+    ENABLE_GENERATE_CLASSLIST="true"
+    if test "x$ENABLE_GENERATE_CLASSLIST_POSSIBLE" = "xfalse"; then
+      AC_MSG_WARN([Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS])
+    fi
+  elif test "x$enable_generate_classlist" = "xno"; then
+    AC_MSG_RESULT([no, forced])
+    ENABLE_GENERATE_CLASSLIST="false"
+  elif test "x$enable_generate_classlist" = "x"; then
+    if test "x$ENABLE_GENERATE_CLASSLIST_POSSIBLE" = "xtrue"; then
+      AC_MSG_RESULT([yes])
+      ENABLE_GENERATE_CLASSLIST="true"
+    else
+      AC_MSG_RESULT([no])
+      ENABLE_GENERATE_CLASSLIST="false"
+    fi
+  else
+    AC_MSG_ERROR([Invalid value for --enable-generate-classlist: $enable_generate_classlist])
+  fi
+
+  AC_SUBST([ENABLE_GENERATE_CLASSLIST])
+])
--- a/common/autoconf/spec.gmk.in	Fri May 20 00:02:55 2016 -0700
+++ b/common/autoconf/spec.gmk.in	Wed Jun 01 15:27:49 2016 -0700
@@ -285,6 +285,8 @@
 
 BUILD_FAILURE_HANDLER := @BUILD_FAILURE_HANDLER@
 
+ENABLE_GENERATE_CLASSLIST := @ENABLE_GENERATE_CLASSLIST@
+
 # The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
 # it in sync.
 BOOT_JDK:=@BOOT_JDK@
--- a/corba/.hgtags	Fri May 20 00:02:55 2016 -0700
+++ b/corba/.hgtags	Wed Jun 01 15:27:49 2016 -0700
@@ -362,3 +362,4 @@
 7a1b36bf2fe55a9a7732489ccdd326c910329a7e jdk-9+117
 8c2c2d17f7ce92a31c9ccb44a122ec62f5a85ace jdk-9+118
 daf533920b1266603b5cbdab31908d2a931c5361 jdk-9+119
+5943b791e131e79b969d4cea053aecda34801723 jdk-9+120
--- a/corba/LICENSE	Fri May 20 00:02:55 2016 -0700
+++ b/corba/LICENSE	Wed Jun 01 15:27:49 2016 -0700
@@ -3,7 +3,7 @@
 Version 2, June 1991
 
 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 Everyone is permitted to copy and distribute verbatim copies of this license
 document, but changing it is not allowed.
@@ -287,8 +287,8 @@
     more details.
 
     You should have received a copy of the GNU General Public License along
-    with this program; if not, write to the Free Software Foundation, Inc., 59
-    Temple Place, Suite 330, Boston, MA 02111-1307 USA
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 Also add information on how to contact you by electronic and paper mail.
 
--- a/hotspot/.hgtags	Fri May 20 00:02:55 2016 -0700
+++ b/hotspot/.hgtags	Wed Jun 01 15:27:49 2016 -0700
@@ -522,3 +522,4 @@
 88170d3642905b9e6cac03e8efcc976885a7e6da jdk-9+117
 9b1075cac08dc836ec32e7b368415cbe3aceaf8c jdk-9+118
 15f3fe264872766bcb205696198f0c1502420e17 jdk-9+119
+0be6f4f5d18671184e62583668cb1d783dffa128 jdk-9+120
--- a/jaxp/.hgtags	Fri May 20 00:02:55 2016 -0700
+++ b/jaxp/.hgtags	Wed Jun 01 15:27:49 2016 -0700
@@ -362,3 +362,4 @@
 46b57560cd06ebcdd21489250628ff5f9d9d8916 jdk-9+117
 a8aa25fc6c5fda0ed7a93b8ffee62da326a752fc jdk-9+118
 f92e8518bb34a9628b11e662bf7308561a55eb3b jdk-9+119
+ecbe72546137cd29cb73d4dcc81cc099e847d543 jdk-9+120
--- a/jaxws/.hgtags	Fri May 20 00:02:55 2016 -0700
+++ b/jaxws/.hgtags	Wed Jun 01 15:27:49 2016 -0700
@@ -365,3 +365,4 @@
 58265b39fc74b932bda4d4f4649c530a89f55c4e jdk-9+117
 6ba73d04589ccc0705a5d8ae5111b63632b6ad20 jdk-9+118
 331a825f849afd2e5126c93c88e55bd9ef0c6b8f jdk-9+119
+ecd0d6a71c7ccf93584ba4dacdd4fa8455efd741 jdk-9+120
--- a/jdk/.hgtags	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/.hgtags	Wed Jun 01 15:27:49 2016 -0700
@@ -362,3 +362,4 @@
 4da0f73ce03aaf245b92cc040cc0ab0e3fa54dc2 jdk-9+117
 e1eba5cfa5cc8c66d524396a05323dc93568730a jdk-9+118
 bad3f8a33db271a6143ba6eac0c8bd5bbd942417 jdk-9+119
+b9a518bf72516954e57ac2f6e3ef21e13008f1cd jdk-9+120
--- a/jdk/make/mapfiles/libjava/mapfile-vers	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/make/mapfiles/libjava/mapfile-vers	Wed Jun 01 15:27:49 2016 -0700
@@ -267,6 +267,7 @@
                 Java_jdk_internal_misc_VM_geteuid;
                 Java_jdk_internal_misc_VM_getgid;
                 Java_jdk_internal_misc_VM_getegid;
+                Java_jdk_internal_misc_VM_getRuntimeArguments;
                 Java_jdk_internal_misc_VM_initialize;
 
                 Java_java_lang_reflect_Module_defineModule0;
--- a/jdk/src/java.base/share/classes/java/lang/Boolean.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Boolean.java	Wed Jun 01 15:27:49 2016 -0700
@@ -117,7 +117,9 @@
      * Parses the string argument as a boolean.  The {@code boolean}
      * returned represents the value {@code true} if the string argument
      * is not {@code null} and is equal, ignoring case, to the string
-     * {@code "true"}. <p>
+     * {@code "true"}.
+     * Otherwise, a false value is returned, including for a null
+     * argument.<p>
      * Example: {@code Boolean.parseBoolean("True")} returns {@code true}.<br>
      * Example: {@code Boolean.parseBoolean("yes")} returns {@code false}.
      *
@@ -165,6 +167,8 @@
      * specified string.  The {@code Boolean} returned represents a
      * true value if the string argument is not {@code null}
      * and is equal, ignoring case, to the string {@code "true"}.
+     * Otherwise, a false value is returned, including for a null
+     * argument.
      *
      * @param   s   a string.
      * @return  the {@code Boolean} value represented by the string.
@@ -241,14 +245,12 @@
 
     /**
      * Returns {@code true} if and only if the system property named
-     * by the argument exists and is equal to the string {@code
-     * "true"}. (Beginning with version 1.0.2 of the Java&trade;
-     * platform, the test of this string is case insensitive.) A
-     * system property is accessible through {@code getProperty}, a
-     * method defined by the {@code System} class.
-     * <p>
-     * If there is no property with the specified name, or if the specified
-     * name is empty or null, then {@code false} is returned.
+     * by the argument exists and is equal to, ignoring case, the
+     * string {@code "true"}.
+     * A system property is accessible through {@code getProperty}, a
+     * method defined by the {@code System} class.  <p> If there is no
+     * property with the specified name, or if the specified name is
+     * empty or null, then {@code false} is returned.
      *
      * @param   name   the system property name.
      * @return  the {@code boolean} value of the system property.
--- a/jdk/src/java.base/share/classes/java/lang/StackWalker.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/StackWalker.java	Wed Jun 01 15:27:49 2016 -0700
@@ -306,8 +306,9 @@
             return DEFAULT_WALKER;
         }
 
-        checkPermission(options);
-        return new StackWalker(toEnumSet(options));
+        EnumSet<Option> optionSet = toEnumSet(options);
+        checkPermission(optionSet);
+        return new StackWalker(optionSet);
     }
 
     /**
@@ -341,8 +342,9 @@
         if (estimateDepth <= 0) {
             throw new IllegalArgumentException("estimateDepth must be > 0");
         }
-        checkPermission(options);
-        return new StackWalker(toEnumSet(options), estimateDepth);
+        EnumSet<Option> optionSet = toEnumSet(options);
+        checkPermission(optionSet);
+        return new StackWalker(optionSet, estimateDepth);
     }
 
     // ----- private constructors ------
@@ -540,13 +542,11 @@
     }
 
     // ---- package access ----
-    static StackWalker newInstanceNoCheck(EnumSet<Option> options) {
-        return new StackWalker(options, 0, null);
-    }
 
     static StackWalker newInstance(Set<Option> options, ExtendedOption extendedOption) {
-        checkPermission(options);
-        return new StackWalker(toEnumSet(options), 0, extendedOption);
+        EnumSet<Option> optionSet = toEnumSet(options);
+        checkPermission(optionSet);
+        return new StackWalker(optionSet, 0, extendedOption);
     }
 
     int estimateDepth() {
--- a/jdk/src/java.base/share/classes/java/lang/annotation/ElementType.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/annotation/ElementType.java	Wed Jun 01 15:27:49 2016 -0700
@@ -46,7 +46,7 @@
  * {@code @Target(ElementType.FIELD)} may only be written as a modifier for a
  * field declaration.
  *
- * <p>The constant {@link #TYPE_USE} corresponds to the 15 type contexts in JLS
+ * <p>The constant {@link #TYPE_USE} corresponds to the type contexts in JLS
  * 4.11, as well as to two declaration contexts: type declarations (including
  * annotation type declarations) and type parameter declarations.
  *
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleReader.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleReader.java	Wed Jun 01 15:27:49 2016 -0700
@@ -30,6 +30,7 @@
 import java.io.InputStream;
 import java.net.URI;
 import java.nio.ByteBuffer;
+import java.util.Objects;
 import java.util.Optional;
 
 
@@ -163,9 +164,12 @@
      * @param  bb
      *         The byte buffer to release
      *
-     * @implSpec The default implementation does nothing.
+     * @implSpec The default implementation doesn't do anything except check
+     * if the byte buffer is null.
      */
-    default void release(ByteBuffer bb) { }
+    default void release(ByteBuffer bb) {
+        Objects.requireNonNull(bb);
+    }
 
     /**
      * Closes the module reader. Once closed then subsequent calls to locate or
--- a/jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java	Wed Jun 01 15:27:49 2016 -0700
@@ -272,9 +272,9 @@
          * if not found.
          */
         private ImageLocation findImageLocation(String name) throws IOException {
+            Objects.requireNonNull(name);
             if (closed)
                 throw new IOException("ModuleReader is closed");
-
             if (imageReader != null) {
                 return imageReader.findLocation(module, name);
             } else {
@@ -322,6 +322,7 @@
 
         @Override
         public void release(ByteBuffer bb) {
+            Objects.requireNonNull(bb);
             ImageReader.releaseByteBuffer(bb);
         }
 
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Layer.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Layer.java	Wed Jun 01 15:27:49 2016 -0700
@@ -75,11 +75,12 @@
  *
  * <p> A Java virtual machine has at least one non-empty layer, the {@link
  * #boot() boot} layer, that is created when the Java virtual machine is
- * started. The <em>system modules</em>, including {@code java.base}, are in
- * the boot layer. The modules in the boot layer are mapped to the bootstrap
- * class loader and other class loaders that are built-in into the Java virtual
- * machine. The boot layer will often be the {@link #parent() parent} when
- * creating additional layers. </p>
+ * started. The boot layer contains module {@code java.base} and is the only
+ * layer in the Java virtual machine with a module named "{@code java.base}".
+ * The modules in the boot layer are mapped to the bootstrap class loader and
+ * other class loaders that are <a href="../ClassLoader.html#builtinLoaders">
+ * built-in</a> into the Java virtual machine. The boot layer will often be
+ * the {@link #parent() parent} when creating additional layers. </p>
  *
  * <p> As when creating a {@code Configuration},
  * {@link ModuleDescriptor#isAutomatic() automatic} modules receive
@@ -204,7 +205,8 @@
      *         for this layer
      * @throws LayerInstantiationException
      *         If all modules cannot be defined to the same class loader for any
-     *         of the reasons listed above
+     *         of the reasons listed above or the layer cannot be created because
+     *         the configuration contains a module named "{@code java.base}"
      * @throws SecurityException
      *         If {@code RuntimePermission("createClassLoader")} or
      *         {@code RuntimePermission("getClassLoader")} is denied by
@@ -219,14 +221,13 @@
         checkCreateClassLoaderPermission();
         checkGetClassLoaderPermission();
 
-        Loader loader;
         try {
-            loader = new Loader(cf.modules(), parentLoader);
+            Loader loader = new Loader(cf.modules(), parentLoader);
             loader.initRemotePackageMap(cf, this);
+            return new Layer(cf, this, mn -> loader);
         } catch (IllegalArgumentException e) {
             throw new LayerInstantiationException(e.getMessage());
         }
-        return new Layer(cf, this, mn -> loader);
     }
 
 
@@ -266,6 +267,9 @@
      * @throws IllegalArgumentException
      *         If the parent of the given configuration is not the configuration
      *         for this layer
+     * @throws LayerInstantiationException
+     *         If the layer cannot be created because the configuration contains
+     *         a module named "{@code java.base}"
      * @throws SecurityException
      *         If {@code RuntimePermission("createClassLoader")} or
      *         {@code RuntimePermission("getClassLoader")} is denied by
@@ -281,7 +285,11 @@
         checkGetClassLoaderPermission();
 
         LoaderPool pool = new LoaderPool(cf, this, parentLoader);
-        return new Layer(cf, this, pool::loaderFor);
+        try {
+            return new Layer(cf, this, pool::loaderFor);
+        } catch (IllegalArgumentException e) {
+            throw new LayerInstantiationException(e.getMessage());
+        }
     }
 
 
@@ -330,7 +338,8 @@
      *         for this layer
      * @throws LayerInstantiationException
      *         If creating the {@code Layer} fails for any of the reasons
-     *         listed above
+     *         listed above or the layer cannot be created because the
+     *         configuration contains a module named "{@code java.base}"
      * @throws SecurityException
      *         If {@code RuntimePermission("getClassLoader")} is denied by
      *         the security manager
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Module.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Module.java	Wed Jun 01 15:27:49 2016 -0700
@@ -513,7 +513,7 @@
      * package {@code pn} to the given module.
      *
      * <p> This method has no effect if the package is already exported to the
-     * given module. If also has no effect if invoked on an unnamed module (as
+     * given module. It also has no effect if invoked on an unnamed module (as
      * unnamed modules export all packages). </p>
      *
      * @param  pn
@@ -866,7 +866,7 @@
             URI uri = mref.location().orElse(null);
 
             Module m;
-            if (loader == null && name.equals("java.base")) {
+            if (loader == null && name.equals("java.base") && Layer.boot() == null) {
                 m = Object.class.getModule();
             } else {
                 m = new Module(layer, loader, descriptor, uri);
--- a/jdk/src/java.base/share/classes/java/math/BigDecimal.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/math/BigDecimal.java	Wed Jun 01 15:27:49 2016 -0700
@@ -55,7 +55,7 @@
  * object to the operation.  In either case, eight <em>rounding
  * modes</em> are provided for the control of rounding.  Using the
  * integer fields in this class (such as {@link #ROUND_HALF_UP}) to
- * represent rounding mode is largely obsolete; the enumeration values
+ * represent rounding mode is deprecated; the enumeration values
  * of the {@code RoundingMode} {@code enum}, (such as {@link
  * RoundingMode#HALF_UP}) should be used instead.
  *
@@ -93,7 +93,7 @@
  * <p>In general the rounding modes and precision setting determine
  * how operations return results with a limited number of digits when
  * the exact result has more digits (perhaps infinitely many in the
- * case of division) than the number of digits returned.
+ * case of division and square root) than the number of digits returned.
  *
  * First, the
  * total number of digits to return is specified by the
@@ -196,18 +196,19 @@
  * {@code BigDecimal} value; for example [19, 2] is the
  * {@code BigDecimal} numerically equal to 0.19 having a scale of 2.
  *
- * <p>Note: care should be exercised if {@code BigDecimal} objects
- * are used as keys in a {@link java.util.SortedMap SortedMap} or
- * elements in a {@link java.util.SortedSet SortedSet} since
- * {@code BigDecimal}'s <i>natural ordering</i> is <i>inconsistent
- * with equals</i>.  See {@link Comparable}, {@link
- * java.util.SortedMap} or {@link java.util.SortedSet} for more
- * information.
  *
  * <p>All methods and constructors for this class throw
  * {@code NullPointerException} when passed a {@code null} object
  * reference for any input parameter.
  *
+ * @apiNote Care should be exercised if {@code BigDecimal} objects
+ * are used as keys in a {@link java.util.SortedMap SortedMap} or
+ * elements in a {@link java.util.SortedSet SortedSet} since
+ * {@code BigDecimal}'s <i>natural ordering</i> is <em>inconsistent
+ * with equals</em>.  See {@link Comparable}, {@link
+ * java.util.SortedMap} or {@link java.util.SortedSet} for more
+ * information.
+ *
  * @see     BigInteger
  * @see     MathContext
  * @see     RoundingMode
@@ -377,10 +378,10 @@
      * same sequence of characters as the {@link #BigDecimal(String)}
      * constructor, while allowing a sub-array to be specified.
      *
-     * <p>Note that if the sequence of characters is already available
+     * @implNote If the sequence of characters is already available
      * within a character array, using this constructor is faster than
      * converting the {@code char} array to string and using the
-     * {@code BigDecimal(String)} constructor .
+     * {@code BigDecimal(String)} constructor.
      *
      * @param  in {@code char} array that is the source of characters.
      * @param  offset first character in the array to inspect.
@@ -401,14 +402,14 @@
      * constructor, while allowing a sub-array to be specified and
      * with rounding according to the context settings.
      *
-     * <p>Note that if the sequence of characters is already available
+     * @implNote If the sequence of characters is already available
      * within a character array, using this constructor is faster than
      * converting the {@code char} array to string and using the
      * {@code BigDecimal(String)} constructor.
      *
      * @param  in {@code char} array that is the source of characters.
      * @param  offset first character in the array to inspect.
-     * @param  len number of characters to consider..
+     * @param  len number of characters to consider.
      * @param  mc the context to use.
      * @throws ArithmeticException if the result is inexact but the
      *         rounding mode is {@code UNNECESSARY}.
@@ -679,10 +680,10 @@
      * same sequence of characters as the {@link #BigDecimal(String)}
      * constructor.
      *
-     * <p>Note that if the sequence of characters is already available
+     * @implNote If the sequence of characters is already available
      * as a character array, using this constructor is faster than
      * converting the {@code char} array to string and using the
-     * {@code BigDecimal(String)} constructor .
+     * {@code BigDecimal(String)} constructor.
      *
      * @param in {@code char} array that is the source of characters.
      * @throws NumberFormatException if {@code in} is not a valid
@@ -700,10 +701,10 @@
      * constructor and with rounding according to the context
      * settings.
      *
-     * <p>Note that if the sequence of characters is already available
+     * @implNote If the sequence of characters is already available
      * as a character array, using this constructor is faster than
      * converting the {@code char} array to string and using the
-     * {@code BigDecimal(String)} constructor .
+     * {@code BigDecimal(String)} constructor.
      *
      * @param  in {@code char} array that is the source of characters.
      * @param  mc the context to use.
@@ -805,7 +806,7 @@
      * "-0"           [0,0]
      * </pre>
      *
-     * <p>Note: For values other than {@code float} and
+     * @apiNote For values other than {@code float} and
      * {@code double} NaN and &plusmn;Infinity, this constructor is
      * compatible with the values returned by {@link Float#toString}
      * and {@link Double#toString}.  This is generally the preferred
@@ -859,13 +860,13 @@
      * This is because 0.1 cannot be represented exactly as a
      * {@code double} (or, for that matter, as a binary fraction of
      * any finite length).  Thus, the value that is being passed
-     * <i>in</i> to the constructor is not exactly equal to 0.1,
+     * <em>in</em> to the constructor is not exactly equal to 0.1,
      * appearances notwithstanding.
      *
      * <li>
      * The {@code String} constructor, on the other hand, is
      * perfectly predictable: writing {@code new BigDecimal("0.1")}
-     * creates a {@code BigDecimal} which is <i>exactly</i> equal to
+     * creates a {@code BigDecimal} which is <em>exactly</em> equal to
      * 0.1, as one would expect.  Therefore, it is generally
      * recommended that the {@linkplain #BigDecimal(String)
      * String constructor} be used in preference to this one.
@@ -1199,10 +1200,11 @@
 
     /**
      * Translates a {@code long} unscaled value and an
-     * {@code int} scale into a {@code BigDecimal}.  This
-     * {@literal "static factory method"} is provided in preference to
-     * a ({@code long}, {@code int}) constructor because it
-     * allows for reuse of frequently used {@code BigDecimal} values..
+     * {@code int} scale into a {@code BigDecimal}.
+     *
+     * @apiNote This static factory method is provided in preference
+     * to a ({@code long}, {@code int}) constructor because it allows
+     * for reuse of frequently used {@code BigDecimal} values.
      *
      * @param unscaledVal unscaled value of the {@code BigDecimal}.
      * @param scale scale of the {@code BigDecimal}.
@@ -1222,10 +1224,11 @@
 
     /**
      * Translates a {@code long} value into a {@code BigDecimal}
-     * with a scale of zero.  This {@literal "static factory method"}
-     * is provided in preference to a ({@code long}) constructor
-     * because it allows for reuse of frequently used
-     * {@code BigDecimal} values.
+     * with a scale of zero.
+     *
+     * @apiNote This static factory method is provided in preference
+     * to a ({@code long}) constructor because it allows for reuse of
+     * frequently used {@code BigDecimal} values.
      *
      * @param val value of the {@code BigDecimal}.
      * @return a {@code BigDecimal} whose value is {@code val}.
@@ -1270,11 +1273,11 @@
      * the {@code double}'s canonical string representation provided
      * by the {@link Double#toString(double)} method.
      *
-     * <p><b>Note:</b> This is generally the preferred way to convert
-     * a {@code double} (or {@code float}) into a
-     * {@code BigDecimal}, as the value returned is equal to that
-     * resulting from constructing a {@code BigDecimal} from the
-     * result of using {@link Double#toString(double)}.
+     * @apiNote This is generally the preferred way to convert a
+     * {@code double} (or {@code float}) into a {@code BigDecimal}, as
+     * the value returned is equal to that resulting from constructing
+     * a {@code BigDecimal} from the result of using {@link
+     * Double#toString(double)}.
      *
      * @param  val {@code double} to convert to a {@code BigDecimal}.
      * @return a {@code BigDecimal} whose value is equal to or approximately
@@ -1896,7 +1899,7 @@
      *
      * <p>The remainder is given by
      * {@code this.subtract(this.divideToIntegralValue(divisor).multiply(divisor))}.
-     * Note that this is not the modulo operation (the result can be
+     * Note that this is <em>not</em> the modulo operation (the result can be
      * negative).
      *
      * @param  divisor value by which this {@code BigDecimal} is to be divided.
@@ -2037,6 +2040,7 @@
      * {@code (mc.getRoundingMode()==RoundingMode.UNNECESSARY}) and
      * the exact result cannot fit in {@code mc.getPrecision()}
      * digits.
+     * @see BigInteger#sqrt()
      * @since  9
      */
     public BigDecimal sqrt(MathContext mc) {
@@ -2694,8 +2698,8 @@
      * in this case, the specified rounding mode is applied to the
      * division.
      *
-     * <p>Note that since BigDecimal objects are immutable, calls of
-     * this method do <i>not</i> result in the original object being
+     * @apiNote Since BigDecimal objects are immutable, calls of
+     * this method do <em>not</em> result in the original object being
      * modified, contrary to the usual convention of having methods
      * named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
      * Instead, {@code setScale} returns an object with the proper
@@ -2727,8 +2731,8 @@
      * in this case, the specified rounding mode is applied to the
      * division.
      *
-     * <p>Note that since BigDecimal objects are immutable, calls of
-     * this method do <i>not</i> result in the original object being
+     * @apiNote Since BigDecimal objects are immutable, calls of
+     * this method do <em>not</em> result in the original object being
      * modified, contrary to the usual convention of having methods
      * named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
      * Instead, {@code setScale} returns an object with the proper
@@ -2822,8 +2826,8 @@
      * versions of {@code setScale}, but saves the caller the trouble
      * of specifying a rounding mode in cases where it is irrelevant.
      *
-     * <p>Note that since {@code BigDecimal} objects are immutable,
-     * calls of this method do <i>not</i> result in the original
+     * @apiNote Since {@code BigDecimal} objects are immutable,
+     * calls of this method do <em>not</em> result in the original
      * object being modified, contrary to the usual convention of
      * having methods named <code>set<i>X</i></code> mutate field
      * <i>{@code X}</i>.  Instead, {@code setScale} returns an
@@ -3091,7 +3095,7 @@
     /**
      * Returns the hash code for this {@code BigDecimal}.  Note that
      * two {@code BigDecimal} objects that are numerically equal but
-     * differ in scale (like 2.0 and 2.00) will generally <i>not</i>
+     * differ in scale (like 2.0 and 2.00) will generally <em>not</em>
      * have the same hash code.
      *
      * @return hash code for this {@code BigDecimal}.
@@ -3342,7 +3346,7 @@
      * Converts this {@code BigDecimal} to a {@code BigInteger}.
      * This conversion is analogous to the
      * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code long} as defined in section 5.1.3 of
+     * {@code long} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * any fractional part of this
      * {@code BigDecimal} will be discarded.  Note that this
@@ -3354,6 +3358,7 @@
      * {@link #toBigIntegerExact()} method.
      *
      * @return this {@code BigDecimal} converted to a {@code BigInteger}.
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     public BigInteger toBigInteger() {
         // force to an integer, quietly
@@ -3379,7 +3384,7 @@
      * Converts this {@code BigDecimal} to a {@code long}.
      * This conversion is analogous to the
      * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code short} as defined in section 5.1.3 of
+     * {@code short} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * any fractional part of this
      * {@code BigDecimal} will be discarded, and if the resulting
@@ -3390,6 +3395,7 @@
      * as return a result with the opposite sign.
      *
      * @return this {@code BigDecimal} converted to a {@code long}.
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     @Override
     public long longValue(){
@@ -3448,7 +3454,7 @@
      * Converts this {@code BigDecimal} to an {@code int}.
      * This conversion is analogous to the
      * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code short} as defined in section 5.1.3 of
+     * {@code short} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * any fractional part of this
      * {@code BigDecimal} will be discarded, and if the resulting
@@ -3459,6 +3465,7 @@
      * value as well as return a result with the opposite sign.
      *
      * @return this {@code BigDecimal} converted to an {@code int}.
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     @Override
     public int intValue() {
@@ -3531,7 +3538,7 @@
      * Converts this {@code BigDecimal} to a {@code float}.
      * This conversion is similar to the
      * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code float} as defined in section 5.1.3 of
+     * {@code float} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * if this {@code BigDecimal} has too great a
      * magnitude to represent as a {@code float}, it will be
@@ -3542,6 +3549,7 @@
      * value.
      *
      * @return this {@code BigDecimal} converted to a {@code float}.
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     @Override
     public float floatValue(){
@@ -3575,7 +3583,7 @@
      * Converts this {@code BigDecimal} to a {@code double}.
      * This conversion is similar to the
      * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code float} as defined in section 5.1.3 of
+     * {@code float} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * if this {@code BigDecimal} has too great a
      * magnitude represent as a {@code double}, it will be
@@ -3586,6 +3594,7 @@
      * value.
      *
      * @return this {@code BigDecimal} converted to a {@code double}.
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     @Override
     public double doubleValue(){
--- a/jdk/src/java.base/share/classes/java/math/BigInteger.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/math/BigInteger.java	Wed Jun 01 15:27:49 2016 -0700
@@ -116,6 +116,7 @@
  * +2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive).
  *
  * @see     BigDecimal
+ * @jls     4.2.2 Integer Operations
  * @author  Josh Bloch
  * @author  Michael McCloskey
  * @author  Alan Eliasen
@@ -126,7 +127,7 @@
 public class BigInteger extends Number implements Comparable<BigInteger> {
     /**
      * The signum of this BigInteger: -1 for negative, 0 for zero, or
-     * 1 for positive.  Note that the BigInteger zero <i>must</i> have
+     * 1 for positive.  Note that the BigInteger zero <em>must</em> have
      * a signum of 0.  This is necessary to ensures that there is exactly one
      * representation for each BigInteger value.
      */
@@ -710,7 +711,7 @@
      * Constructs a randomly generated positive BigInteger that is probably
      * prime, with the specified bitLength.
      *
-     * <p>It is recommended that the {@link #probablePrime probablePrime}
+     * @apiNote It is recommended that the {@link #probablePrime probablePrime}
      * method be used in preference to this constructor unless there
      * is a compelling need to specify a certainty.
      *
@@ -1157,9 +1158,11 @@
 
     /**
      * Returns a BigInteger whose value is equal to that of the
-     * specified {@code long}.  This "static factory method" is
-     * provided in preference to a ({@code long}) constructor
-     * because it allows for reuse of frequently used BigIntegers.
+     * specified {@code long}.
+     *
+     * @apiNote This static factory method is provided in preference
+     * to a ({@code long}) constructor because it allows for reuse of
+     * frequently used BigIntegers.
      *
      * @param  val value of the BigInteger to return.
      * @return a BigInteger with the specified value.
@@ -3551,13 +3554,13 @@
 
     /**
      * Returns the number of bits in the minimal two's-complement
-     * representation of this BigInteger, <i>excluding</i> a sign bit.
+     * representation of this BigInteger, <em>excluding</em> a sign bit.
      * For positive BigIntegers, this is equivalent to the number of bits in
      * the ordinary binary representation.  (Computes
      * {@code (ceil(log2(this < 0 ? -this : this+1)))}.)
      *
      * @return number of bits in the minimal two's-complement
-     *         representation of this BigInteger, <i>excluding</i> a sign bit.
+     *         representation of this BigInteger, <em>excluding</em> a sign bit.
      */
     public int bitLength() {
         int n = bitLengthPlusOne - 1;
@@ -4034,7 +4037,7 @@
      * Converts this BigInteger to an {@code int}.  This
      * conversion is analogous to a
      * <i>narrowing primitive conversion</i> from {@code long} to
-     * {@code int} as defined in section 5.1.3 of
+     * {@code int} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * if this BigInteger is too big to fit in an
      * {@code int}, only the low-order 32 bits are returned.
@@ -4044,6 +4047,7 @@
      *
      * @return this BigInteger converted to an {@code int}.
      * @see #intValueExact()
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     public int intValue() {
         int result = 0;
@@ -4055,7 +4059,7 @@
      * Converts this BigInteger to a {@code long}.  This
      * conversion is analogous to a
      * <i>narrowing primitive conversion</i> from {@code long} to
-     * {@code int} as defined in section 5.1.3 of
+     * {@code int} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * if this BigInteger is too big to fit in a
      * {@code long}, only the low-order 64 bits are returned.
@@ -4065,6 +4069,7 @@
      *
      * @return this BigInteger converted to a {@code long}.
      * @see #longValueExact()
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     public long longValue() {
         long result = 0;
@@ -4078,7 +4083,7 @@
      * Converts this BigInteger to a {@code float}.  This
      * conversion is similar to the
      * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code float} as defined in section 5.1.3 of
+     * {@code float} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * if this BigInteger has too great a magnitude
      * to represent as a {@code float}, it will be converted to
@@ -4088,6 +4093,7 @@
      * information about the precision of the BigInteger value.
      *
      * @return this BigInteger converted to a {@code float}.
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     public float floatValue() {
         if (signum == 0) {
@@ -4162,7 +4168,7 @@
      * Converts this BigInteger to a {@code double}.  This
      * conversion is similar to the
      * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code float} as defined in section 5.1.3 of
+     * {@code float} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * if this BigInteger has too great a magnitude
      * to represent as a {@code double}, it will be converted to
@@ -4172,6 +4178,7 @@
      * information about the precision of the BigInteger value.
      *
      * @return this BigInteger converted to a {@code double}.
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     public double doubleValue() {
         if (signum == 0) {
--- a/jdk/src/java.base/share/classes/java/net/Inet6AddressImpl.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/net/Inet6AddressImpl.java	Wed Jun 01 15:27:49 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -23,7 +23,10 @@
  * questions.
  */
 package java.net;
+
 import java.io.IOException;
+import static java.net.InetAddress.PREFER_IPV6_VALUE;
+import static java.net.InetAddress.PREFER_SYSTEM_VALUE;
 
 /*
  * Package private implementation of InetAddressImpl for dual
@@ -35,15 +38,23 @@
  *
  * @since 1.4
  */
+class Inet6AddressImpl implements InetAddressImpl {
 
-class Inet6AddressImpl implements InetAddressImpl {
     public native String getLocalHostName() throws UnknownHostException;
-    public native InetAddress[]
-        lookupAllHostAddr(String hostname) throws UnknownHostException;
+
+    public native InetAddress[] lookupAllHostAddr(String hostname)
+        throws UnknownHostException;
+
     public native String getHostByAddr(byte[] addr) throws UnknownHostException;
-    private native boolean isReachable0(byte[] addr, int scope, int timeout, byte[] inf, int ttl, int if_scope) throws IOException;
 
-    public boolean isReachable(InetAddress addr, int timeout, NetworkInterface netif, int ttl) throws IOException {
+    private native boolean isReachable0(byte[] addr, int scope, int timeout,
+                                        byte[] inf, int ttl, int if_scope)
+        throws IOException;
+
+    public boolean isReachable(InetAddress addr, int timeout,
+                               NetworkInterface netif, int ttl)
+        throws IOException
+    {
         byte[] ifaddr = null;
         int scope = -1;
         int netif_scope = -1;
@@ -79,7 +90,8 @@
 
     public synchronized InetAddress anyLocalAddress() {
         if (anyLocalAddress == null) {
-            if (InetAddress.preferIPv6Address) {
+            if (InetAddress.preferIPv6Address == PREFER_IPV6_VALUE ||
+                InetAddress.preferIPv6Address == PREFER_SYSTEM_VALUE) {
                 anyLocalAddress = new Inet6Address();
                 anyLocalAddress.holder().hostName = "::";
             } else {
@@ -91,7 +103,8 @@
 
     public synchronized InetAddress loopbackAddress() {
         if (loopbackAddress == null) {
-             if (InetAddress.preferIPv6Address) {
+             if (InetAddress.preferIPv6Address == PREFER_IPV6_VALUE ||
+                 InetAddress.preferIPv6Address == PREFER_SYSTEM_VALUE) {
                  byte[] loopback =
                         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
@@ -103,6 +116,6 @@
         return loopbackAddress;
     }
 
-    private InetAddress      anyLocalAddress;
-    private InetAddress      loopbackAddress;
+    private InetAddress anyLocalAddress;
+    private InetAddress loopbackAddress;
 }
--- a/jdk/src/java.base/share/classes/java/net/InetAddress.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/net/InetAddress.java	Wed Jun 01 15:27:49 2016 -0700
@@ -26,8 +26,6 @@
 package java.net;
 
 import java.util.NavigableSet;
-import java.util.Iterator;
-import java.util.List;
 import java.util.ArrayList;
 import java.util.Objects;
 import java.util.Scanner;
@@ -41,6 +39,7 @@
 import java.io.ObjectInputStream.GetField;
 import java.io.ObjectOutputStream;
 import java.io.ObjectOutputStream.PutField;
+import java.lang.annotation.Native;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ConcurrentSkipListSet;
@@ -193,6 +192,11 @@
  */
 public
 class InetAddress implements java.io.Serializable {
+
+    @Native static final int PREFER_IPV4_VALUE = 0;
+    @Native static final int PREFER_IPV6_VALUE = 1;
+    @Native static final int PREFER_SYSTEM_VALUE = 2;
+
     /**
      * Specify the address family: Internet Protocol, Version 4
      * @since 1.4
@@ -206,8 +210,7 @@
     static final int IPv6 = 2;
 
     /* Specify address family preference */
-    static transient boolean preferIPv6Address = false;
-
+    static transient final int preferIPv6Address;
 
     static class InetAddressHolder {
         /**
@@ -293,8 +296,19 @@
      * Load net library into runtime, and perform initializations.
      */
     static {
-        preferIPv6Address = java.security.AccessController.doPrivileged(
-            new GetBooleanAction("java.net.preferIPv6Addresses")).booleanValue();
+        String str = java.security.AccessController.doPrivileged(
+                new GetPropertyAction("java.net.preferIPv6Addresses"));
+        if (str == null) {
+            preferIPv6Address = PREFER_IPV4_VALUE;
+        } else if (str.equalsIgnoreCase("true")) {
+            preferIPv6Address = PREFER_IPV6_VALUE;
+        } else if (str.equalsIgnoreCase("false")) {
+            preferIPv6Address = PREFER_IPV4_VALUE;
+        } else if (str.equalsIgnoreCase("system")) {
+            preferIPv6Address = PREFER_SYSTEM_VALUE;
+        } else {
+            preferIPv6Address = PREFER_IPV4_VALUE;
+        }
         AccessController.doPrivileged(
             new java.security.PrivilegedAction<>() {
                 public Void run() {
--- a/jdk/src/java.base/share/classes/java/net/doc-files/net-properties.html	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/net/doc-files/net-properties.html	Wed Jun 01 15:27:49 2016 -0700
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 1998, 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
@@ -35,7 +35,7 @@
 java.net package. Some are checked only once at startup of the VM,
 and therefore are best set using the -D option of the java command,
 while others have a more dynamic nature and can also be changed using
-the <a href="../../lang/System.html#setProperty(java.lang.String,%20java.lang.String)">System.setProperty()</a> API. 
+the <a href="../../lang/System.html#setProperty(java.lang.String,%20java.lang.String)">System.setProperty()</a> API.
 The purpose of this document is to list
 and detail all of these properties.</P>
 <P>If there is no special note, a property value is checked every time it is used.</P>
@@ -58,7 +58,8 @@
 	applications that depend on the representation of an IPv4 address
 	(e.g. 192.168.1.1). This property can be set to <B>true</B> to
 	change that preference and use IPv6 addresses over IPv4 ones where
-	possible.</P>
+	possible, or <B>system</B> to preserve the order of the addresses as
+    returned by the operating system.</P>
 </UL>
 <P>Both of these properties are checked only once, at startup.</P>
 <a name="Proxies"></a>
@@ -73,7 +74,7 @@
 	<P>The following proxy settings are used by the HTTP protocol handler.</P>
 	<UL>
 		<LI><P><B>http.proxyHost</B> (default: &lt;none&gt;)<BR>
-	        The hostname, or address, of the proxy server 
+	        The hostname, or address, of the proxy server
 		</P>
 		<LI><P><B>http.proxyPort</B> (default: 80)<BR>
 	        The port number of the proxy server.</P>
@@ -94,7 +95,7 @@
 	<P>The following proxy settings are used by the HTTPS protocol handler.</P>
 	<UL>
 		<LI><P><B>https.proxyHost</B>(default: &lt;none&gt;)<BR>
-	        The hostname, or address, of the proxy server 
+	        The hostname, or address, of the proxy server
 		</P>
 		<LI><P><B>https.proxyPort</B> (default: 443)<BR>
 	        The port number of the proxy server.</P>
@@ -105,7 +106,7 @@
 	<P>The following proxy settings are used by the FTP protocol handler.</P>
 	<UL>
 		<LI><P><B>ftp.proxyHost</B>(default: &lt;none&gt;)<BR>
-	        The hostname, or address, of the proxy server 
+	        The hostname, or address, of the proxy server
 		</P>
 		<LI><P><B>ftp.proxyPort</B> (default: 80)<BR>
 	        The port number of the proxy server.</P>
@@ -160,7 +161,7 @@
 	<LI><P><B>http.agent</B> (default: &ldquo;Java/&lt;version&gt;&rdquo;)<BR>
 	Defines the string sent in the User-Agent request header in http
 	requests. Note that the string &ldquo;Java/&lt;version&gt;&rdquo; will
-	be appended to the one provided in the property (e.g. if 
+	be appended to the one provided in the property (e.g. if
 	-Dhttp.agent=&rdquo;foobar&rdquo; is used, the User-Agent header will
 	contain &ldquo;foobar Java/1.5.0&rdquo; if the version of the VM is
 	1.5.0). This property is checked only once at startup.</P>
--- a/jdk/src/java.base/share/classes/java/util/ImmutableCollections.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/ImmutableCollections.java	Wed Jun 01 15:27:49 2016 -0700
@@ -28,6 +28,7 @@
 import java.io.IOException;
 import java.io.InvalidObjectException;
 import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.io.ObjectStreamException;
 import java.io.Serializable;
 
@@ -607,7 +608,10 @@
 // ---------- Serialization Proxy ----------
 
 /**
- * Serialization proxy class for immutable collections.
+ * A unified serialization proxy class for the immutable collections.
+ *
+ * @serial
+ * @since 9
  */
 final class CollSer implements Serializable {
     private static final long serialVersionUID = 6309168927139932177L;
@@ -616,14 +620,114 @@
     static final int IMM_SET = 2;
     static final int IMM_MAP = 3;
 
-    private final int flags;
-    private final Object[] array;
+    /**
+     * Indicates the type of collection that is serialized.
+     * The low order 8 bits have the value 1 for an immutable
+     * {@code List}, 2 for an immutable {@code Set}, and 3 for
+     * an immutable {@code Map}. Any other value causes an
+     * {@link InvalidObjectException} to be thrown. The high
+     * order 24 bits are zero when an instance is serialized,
+     * and they are ignored when an instance is deserialized.
+     * They can thus be used by future implementations without
+     * causing compatibility issues.
+     *
+     * <p>The tag value also determines the interpretation of the
+     * transient {@code Object[] array} field.
+     * For {@code List} and {@code Set}, the array's length is the size
+     * of the collection, and the array contains the elements of the collection.
+     * Null elements are not allowed. For {@code Set}, duplicate elements
+     * are not allowed.
+     *
+     * <p>For {@code Map}, the array's length is twice the number of mappings
+     * present in the map. The array length is necessarily even.
+     * The array contains a succession of key and value pairs:
+     * {@code k1, v1, k2, v2, ..., kN, vN.} Nulls are not allowed,
+     * and duplicate keys are not allowed.
+     *
+     * @serial
+     * @since 9
+     */
+    private final int tag;
 
-    CollSer(int f, Object... a) {
-        flags = f;
+    /**
+     * @serial
+     * @since 9
+     */
+    private transient Object[] array;
+
+    CollSer(int t, Object... a) {
+        tag = t;
         array = a;
     }
 
+    /**
+     * Reads objects from the stream and stores them
+     * in the transient {@code Object[] array} field.
+     *
+     * @serialData
+     * A nonnegative int, indicating the count of objects,
+     * followed by that many objects.
+     *
+     * @param ois the ObjectInputStream from which data is read
+     * @throws IOException if an I/O error occurs
+     * @throws ClassNotFoundException if a serialized class cannot be loaded
+     * @throws InvalidObjectException if the count is negative
+     * @since 9
+     */
+    private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
+        ois.defaultReadObject();
+        int len = ois.readInt();
+
+        if (len < 0) {
+            throw new InvalidObjectException("negative length " + len);
+        }
+
+        Object[] a = new Object[len];
+        for (int i = 0; i < len; i++) {
+            a[i] = ois.readObject();
+        }
+
+        array = a;
+    }
+
+    /**
+     * Writes objects to the stream from
+     * the transient {@code Object[] array} field.
+     *
+     * @serialData
+     * A nonnegative int, indicating the count of objects,
+     * followed by that many objects.
+     *
+     * @param oos the ObjectOutputStream to which data is written
+     * @throws IOException if an I/O error occurs
+     * @since 9
+     */
+    private void writeObject(ObjectOutputStream oos) throws IOException {
+        oos.defaultWriteObject();
+        oos.writeInt(array.length);
+        for (int i = 0; i < array.length; i++) {
+            oos.writeObject(array[i]);
+        }
+    }
+
+    /**
+     * Creates and returns an immutable collection from this proxy class.
+     * The instance returned is created as if by calling one of the
+     * static factory methods for
+     * <a href="List.html#immutable">List</a>,
+     * <a href="Map.html#immutable">Map</a>, or
+     * <a href="Set.html#immutable">Set</a>.
+     * This proxy class is the serial form for all immutable collection instances,
+     * regardless of implementation type. This is necessary to ensure that the
+     * existence of any particular implementation type is kept out of the
+     * serialized form.
+     *
+     * @return a collection created from this proxy object
+     * @throws InvalidObjectException if the tag value is illegal or if an exception
+     *         is thrown during creation of the collection
+     * @throws ObjectStreamException if another serialization error has occurred
+     * @since 9
+     */
     private Object readResolve() throws ObjectStreamException {
         try {
             if (array == null) {
@@ -631,8 +735,8 @@
             }
 
             // use low order 8 bits to indicate "kind"
-            // ignore high order bits
-            switch (flags & 0xff) {
+            // ignore high order 24 bits
+            switch (tag & 0xff) {
                 case IMM_LIST:
                     return List.of(array);
                 case IMM_SET:
@@ -646,7 +750,7 @@
                         return new ImmutableCollections.MapN<>(array);
                     }
                 default:
-                    throw new InvalidObjectException(String.format("invalid flags 0x%x", flags));
+                    throw new InvalidObjectException(String.format("invalid flags 0x%x", tag));
             }
         } catch (NullPointerException|IllegalArgumentException ex) {
             InvalidObjectException ioe = new InvalidObjectException("invalid object");
--- a/jdk/src/java.base/share/classes/java/util/List.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/List.java	Wed Jun 01 15:27:49 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -107,6 +107,9 @@
  * Factories are free to create new instances or reuse existing ones. Therefore,
  * identity-sensitive operations on these instances (reference equality ({@code ==}),
  * identity hash code, and synchronization) are unreliable and should be avoided.
+ * <li>They are serialized as specified on the
+ * <a href="{@docRoot}/serialized-form.html#java.util.CollSer">Serialized Form</a>
+ * page.
  * </ul>
  *
  * <p>This interface is a member of the
--- a/jdk/src/java.base/share/classes/java/util/Map.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Map.java	Wed Jun 01 15:27:49 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -133,6 +133,9 @@
  * Factories are free to create new instances or reuse existing ones. Therefore,
  * identity-sensitive operations on these instances (reference equality ({@code ==}),
  * identity hash code, and synchronization) are unreliable and should be avoided.
+ * <li>They are serialized as specified on the
+ * <a href="{@docRoot}/serialized-form.html#java.util.CollSer">Serialized Form</a>
+ * page.
  * </ul>
  *
  * <p>This interface is a member of the
--- a/jdk/src/java.base/share/classes/java/util/Set.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Set.java	Wed Jun 01 15:27:49 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,6 +84,9 @@
  * Factories are free to create new instances or reuse existing ones. Therefore,
  * identity-sensitive operations on these instances (reference equality ({@code ==}),
  * identity hash code, and synchronization) are unreliable and should be avoided.
+ * <li>They are serialized as specified on the
+ * <a href="{@docRoot}/serialized-form.html#java.util.CollSer">Serialized Form</a>
+ * page.
  * </ul>
  *
  * <p>This interface is a member of the
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java	Wed Jun 01 15:27:49 2016 -0700
@@ -1242,7 +1242,8 @@
      */
     public KeySetView<K,V> keySet() {
         KeySetView<K,V> ks;
-        return (ks = keySet) != null ? ks : (keySet = new KeySetView<K,V>(this, null));
+        if ((ks = keySet) != null) return ks;
+        return keySet = new KeySetView<K,V>(this, null);
     }
 
     /**
@@ -1265,7 +1266,8 @@
      */
     public Collection<V> values() {
         ValuesView<K,V> vs;
-        return (vs = values) != null ? vs : (values = new ValuesView<K,V>(this));
+        if ((vs = values) != null) return vs;
+        return values = new ValuesView<K,V>(this);
     }
 
     /**
@@ -1287,7 +1289,8 @@
      */
     public Set<Map.Entry<K,V>> entrySet() {
         EntrySetView<K,V> es;
-        return (es = entrySet) != null ? es : (entrySet = new EntrySetView<K,V>(this));
+        if ((es = entrySet) != null) return es;
+        return entrySet = new EntrySetView<K,V>(this);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Wed Jun 01 15:27:49 2016 -0700
@@ -376,12 +376,12 @@
 
     /** Lazily initialized key set */
     private transient KeySet<K,V> keySet;
+    /** Lazily initialized values collection */
+    private transient Values<K,V> values;
     /** Lazily initialized entry set */
     private transient EntrySet<K,V> entrySet;
-    /** Lazily initialized values collection */
-    private transient Values<K,V> values;
     /** Lazily initialized descending key set */
-    private transient ConcurrentNavigableMap<K,V> descendingMap;
+    private transient SubMap<K,V> descendingMap;
 
     /**
      * Initializes or resets state. Needed by constructors, clone,
@@ -1827,13 +1827,15 @@
      * @return a navigable set view of the keys in this map
      */
     public NavigableSet<K> keySet() {
-        KeySet<K,V> ks = keySet;
-        return (ks != null) ? ks : (keySet = new KeySet<>(this));
+        KeySet<K,V> ks;
+        if ((ks = keySet) != null) return ks;
+        return keySet = new KeySet<>(this);
     }
 
     public NavigableSet<K> navigableKeySet() {
-        KeySet<K,V> ks = keySet;
-        return (ks != null) ? ks : (keySet = new KeySet<>(this));
+        KeySet<K,V> ks;
+        if ((ks = keySet) != null) return ks;
+        return keySet = new KeySet<>(this);
     }
 
     /**
@@ -1856,8 +1858,9 @@
      * <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
      */
     public Collection<V> values() {
-        Values<K,V> vs = values;
-        return (vs != null) ? vs : (values = new Values<>(this));
+        Values<K,V> vs;
+        if ((vs = values) != null) return vs;
+        return values = new Values<>(this);
     }
 
     /**
@@ -1888,14 +1891,16 @@
      *         sorted in ascending key order
      */
     public Set<Map.Entry<K,V>> entrySet() {
-        EntrySet<K,V> es = entrySet;
-        return (es != null) ? es : (entrySet = new EntrySet<K,V>(this));
+        EntrySet<K,V> es;
+        if ((es = entrySet) != null) return es;
+        return entrySet = new EntrySet<K,V>(this);
     }
 
     public ConcurrentNavigableMap<K,V> descendingMap() {
-        ConcurrentNavigableMap<K,V> dm = descendingMap;
-        return (dm != null) ? dm : (descendingMap = new SubMap<K,V>
-                                    (this, null, false, null, false, true));
+        ConcurrentNavigableMap<K,V> dm;
+        if ((dm = descendingMap) != null) return dm;
+        return descendingMap =
+            new SubMap<K,V>(this, null, false, null, false, true);
     }
 
     public NavigableSet<K> descendingKeySet() {
@@ -2564,7 +2569,7 @@
      * @serial include
      */
     static final class SubMap<K,V> extends AbstractMap<K,V>
-        implements ConcurrentNavigableMap<K,V>, Cloneable, Serializable {
+        implements ConcurrentNavigableMap<K,V>, Serializable {
         private static final long serialVersionUID = -7647078645895051609L;
 
         /** Underlying map */
@@ -2582,8 +2587,8 @@
 
         // Lazily initialized view holders
         private transient KeySet<K,V> keySetView;
-        private transient Set<Map.Entry<K,V>> entrySetView;
-        private transient Collection<V> valuesView;
+        private transient Values<K,V> valuesView;
+        private transient EntrySet<K,V> entrySetView;
 
         /**
          * Creates a new submap, initializing all fields.
@@ -3049,23 +3054,27 @@
         /* ---------------- Submap Views -------------- */
 
         public NavigableSet<K> keySet() {
-            KeySet<K,V> ks = keySetView;
-            return (ks != null) ? ks : (keySetView = new KeySet<>(this));
+            KeySet<K,V> ks;
+            if ((ks = keySetView) != null) return ks;
+            return keySetView = new KeySet<>(this);
         }
 
         public NavigableSet<K> navigableKeySet() {
-            KeySet<K,V> ks = keySetView;
-            return (ks != null) ? ks : (keySetView = new KeySet<>(this));
+            KeySet<K,V> ks;
+            if ((ks = keySetView) != null) return ks;
+            return keySetView = new KeySet<>(this);
         }
 
         public Collection<V> values() {
-            Collection<V> vs = valuesView;
-            return (vs != null) ? vs : (valuesView = new Values<>(this));
+            Values<K,V> vs;
+            if ((vs = valuesView) != null) return vs;
+            return valuesView = new Values<>(this);
         }
 
         public Set<Map.Entry<K,V>> entrySet() {
-            Set<Map.Entry<K,V>> es = entrySetView;
-            return (es != null) ? es : (entrySetView = new EntrySet<K,V>(this));
+            EntrySet<K,V> es;
+            if ((es = entrySetView) != null) return es;
+            return entrySetView = new EntrySet<K,V>(this);
         }
 
         public NavigableSet<K> descendingKeySet() {
--- a/jdk/src/java.base/share/classes/java/util/concurrent/CountedCompleter.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/CountedCompleter.java	Wed Jun 01 15:27:49 2016 -0700
@@ -596,7 +596,7 @@
      * not, be invoked for each completer in a computation.
      */
     public final void propagateCompletion() {
-        CountedCompleter<?> a = this, s = a;
+        CountedCompleter<?> a = this, s;
         for (int c;;) {
             if ((c = a.pending) == 0) {
                 if ((a = (s = a).completer) == null) {
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ExecutorCompletionService.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ExecutorCompletionService.java	Wed Jun 01 15:27:49 2016 -0700
@@ -56,13 +56,11 @@
  * void solve(Executor e,
  *            Collection<Callable<Result>> solvers)
  *     throws InterruptedException, ExecutionException {
- *   CompletionService<Result> ecs
- *       = new ExecutorCompletionService<Result>(e);
- *   for (Callable<Result> s : solvers)
- *     ecs.submit(s);
- *   int n = solvers.size();
- *   for (int i = 0; i < n; ++i) {
- *     Result r = ecs.take().get();
+ *   CompletionService<Result> cs
+ *       = new ExecutorCompletionService<>(e);
+ *   solvers.forEach(cs::submit);
+ *   for (int i = solvers.size(); i > 0; i--) {
+ *     Result r = cs.take().get();
  *     if (r != null)
  *       use(r);
  *   }
@@ -76,27 +74,24 @@
  * void solve(Executor e,
  *            Collection<Callable<Result>> solvers)
  *     throws InterruptedException {
- *   CompletionService<Result> ecs
- *       = new ExecutorCompletionService<Result>(e);
+ *   CompletionService<Result> cs
+ *       = new ExecutorCompletionService<>(e);
  *   int n = solvers.size();
  *   List<Future<Result>> futures = new ArrayList<>(n);
  *   Result result = null;
  *   try {
- *     for (Callable<Result> s : solvers)
- *       futures.add(ecs.submit(s));
- *     for (int i = 0; i < n; ++i) {
+ *     solvers.forEach((solver) -> futures.add(cs.submit(solver)));
+ *     for (int i = n; i > 0; i--) {
  *       try {
- *         Result r = ecs.take().get();
+ *         Result r = cs.take().get();
  *         if (r != null) {
  *           result = r;
  *           break;
  *         }
  *       } catch (ExecutionException ignore) {}
  *     }
- *   }
- *   finally {
- *     for (Future<Result> f : futures)
- *       f.cancel(true);
+ *   } finally {
+ *     futures.forEach((future) -> future.cancel(true));
  *   }
  *
  *   if (result != null)
--- a/jdk/src/java.base/share/classes/java/util/concurrent/Phaser.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/Phaser.java	Wed Jun 01 15:27:49 2016 -0700
@@ -348,10 +348,6 @@
     private final AtomicReference<QNode> evenQ;
     private final AtomicReference<QNode> oddQ;
 
-    private AtomicReference<QNode> queueFor(int phase) {
-        return ((phase & 1) == 0) ? evenQ : oddQ;
-    }
-
     /**
      * Returns message string for bounds exceptions on arrival.
      */
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java	Wed Jun 01 15:27:49 2016 -0700
@@ -67,9 +67,9 @@
     static private final boolean MAP_ALL =
             isSystemProperty("jdk.image.map.all", "true", IS_64_BIT ? "true" : "false");
 
+    private final Path imagePath;
+    private final ByteOrder byteOrder;
     private final String name;
-    private final ByteOrder byteOrder;
-    private final Path imagePath;
     private final ByteBuffer memoryMap;
     private final FileChannel channel;
     private final ImageHeader header;
@@ -83,11 +83,9 @@
 
     protected BasicImageReader(Path path, ByteOrder byteOrder)
             throws IOException {
-        Objects.requireNonNull(path);
-        Objects.requireNonNull(byteOrder);
-        this.name = path.toString();
-        this.byteOrder = byteOrder;
-        imagePath = path;
+        this.imagePath = Objects.requireNonNull(path);
+        this.byteOrder = Objects.requireNonNull(byteOrder);
+        this.name = this.imagePath.toString();
 
         ByteBuffer map;
 
@@ -211,6 +209,8 @@
     }
 
     public static void releaseByteBuffer(ByteBuffer buffer) {
+        Objects.requireNonNull(buffer);
+
         if (!MAP_ALL) {
             ImageBufferCache.releaseBuffer(buffer);
         }
@@ -240,10 +240,14 @@
     }
 
     public ImageLocation findLocation(String mn, String rn) {
+        Objects.requireNonNull(mn);
+        Objects.requireNonNull(rn);
+
         return findLocation("/" + mn + "/" + rn);
     }
 
     public synchronized ImageLocation findLocation(String name) {
+        Objects.requireNonNull(name);
         // Details of the algorithm used here can be found in
         // jdk.tools.jlink.internal.PerfectHashBuilder.
         byte[] bytes = ImageStringsReader.mutf8FromString(name);
@@ -287,16 +291,25 @@
     }
 
     public long[] getAttributes(int offset) {
+        if (offset < 0 || offset >= locations.limit()) {
+            throw new IndexOutOfBoundsException("offset");
+        }
+
         ByteBuffer buffer = slice(locations, offset, locations.limit() - offset);
         return ImageLocation.decompress(buffer);
     }
 
     public String getString(int offset) {
+        if (offset < 0 || offset >= strings.limit()) {
+            throw new IndexOutOfBoundsException("offset");
+        }
+
         ByteBuffer buffer = slice(strings, offset, strings.limit() - offset);
         return ImageStringsReader.stringFromByteBuffer(buffer);
     }
 
     private byte[] getBufferBytes(ByteBuffer buffer) {
+        Objects.requireNonNull(buffer);
         byte[] bytes = new byte[buffer.limit()];
         buffer.get(bytes);
 
@@ -343,6 +356,7 @@
     }
 
     public byte[] getResource(String name) {
+        Objects.requireNonNull(name);
         ImageLocation location = findLocation(name);
 
         return location != null ? getResource(location) : null;
@@ -362,6 +376,7 @@
     }
 
     public ByteBuffer getResourceBuffer(ImageLocation loc) {
+        Objects.requireNonNull(loc);
         long offset = loc.getContentOffset() + indexSize;
         long compressedSize = loc.getCompressedSize();
         long uncompressedSize = loc.getUncompressedSize();
@@ -399,6 +414,7 @@
     }
 
     public InputStream getResourceStream(ImageLocation loc) {
+        Objects.requireNonNull(loc);
         byte[] bytes = getResource(loc);
 
         return new ByteArrayInputStream(bytes);
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageHeader.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageHeader.java	Wed Jun 01 15:27:49 2016 -0700
@@ -27,6 +27,7 @@
 
 import java.nio.ByteBuffer;
 import java.nio.IntBuffer;
+import java.util.Objects;
 
 /**
  * @implNote This class needs to maintain JDK 8 source compatibility.
@@ -75,6 +76,8 @@
     }
 
     static ImageHeader readFrom(IntBuffer buffer) {
+        Objects.requireNonNull(buffer);
+
         if (buffer.capacity() != HEADER_SLOTS) {
             throw new InternalError("jimage header not the correct size");
         }
@@ -94,11 +97,13 @@
     }
 
     public void writeTo(ImageStream stream) {
+        Objects.requireNonNull(stream);
         stream.ensure(getHeaderSize());
         writeTo(stream.getBuffer());
     }
 
     public void writeTo(ByteBuffer buffer) {
+        Objects.requireNonNull(buffer);
         buffer.putInt(magic);
         buffer.putInt(majorVersion << 16 | minorVersion);
         buffer.putInt(flags);
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageLocation.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageLocation.java	Wed Jun 01 15:27:49 2016 -0700
@@ -26,6 +26,7 @@
 package jdk.internal.jimage;
 
 import java.nio.ByteBuffer;
+import java.util.Objects;
 
 /**
  * @implNote This class needs to maintain JDK 8 source compatibility.
@@ -50,8 +51,8 @@
     protected final ImageStrings strings;
 
     public ImageLocation(long[] attributes, ImageStrings strings) {
-        this.attributes = attributes;
-        this.strings = strings;
+        this.attributes = Objects.requireNonNull(attributes);
+        this.strings = Objects.requireNonNull(strings);
     }
 
     ImageStrings getStrings() {
@@ -67,6 +68,7 @@
     }
 
     static long[] decompress(ByteBuffer bytes) {
+        Objects.requireNonNull(bytes);
         long[] attributes = new long[ATTRIBUTE_COUNT];
 
         if (bytes != null) {
@@ -103,6 +105,7 @@
     }
 
     public static byte[] compress(long[] attributes) {
+        Objects.requireNonNull(attributes);
         ImageStream stream = new ImageStream(16);
 
         for (int kind = ATTRIBUTE_END + 1; kind < ATTRIBUTE_COUNT; kind++) {
@@ -124,6 +127,8 @@
      }
 
     public boolean verify(String name) {
+        Objects.requireNonNull(name);
+
         return name.equals(getFullName());
     }
 
@@ -250,6 +255,7 @@
     }
 
     static ImageLocation readFrom(BasicImageReader reader, int offset) {
+        Objects.requireNonNull(reader);
         long[] attributes = reader.getAttributes(offset);
         ImageStringsReader strings = reader.getStrings();
 
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java	Wed Jun 01 15:27:49 2016 -0700
@@ -59,6 +59,9 @@
     }
 
     public static ImageReader open(Path imagePath, ByteOrder byteOrder) throws IOException {
+        Objects.requireNonNull(imagePath);
+        Objects.requireNonNull(byteOrder);
+
         return SharedImageReader.open(imagePath, byteOrder);
     }
 
@@ -218,6 +221,9 @@
         }
 
         public static ImageReader open(Path imagePath, ByteOrder byteOrder) throws IOException {
+            Objects.requireNonNull(imagePath);
+            Objects.requireNonNull(byteOrder);
+
             synchronized (OPEN_FILES) {
                 SharedImageReader reader = OPEN_FILES.get(imagePath);
 
@@ -237,6 +243,8 @@
         }
 
         public void close(ImageReader image) throws IOException {
+            Objects.requireNonNull(image);
+
             synchronized (OPEN_FILES) {
                 if (!openers.remove(image)) {
                     throw new IOException("image file already closed");
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReaderFactory.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReaderFactory.java	Wed Jun 01 15:27:49 2016 -0700
@@ -31,6 +31,7 @@
 import java.nio.file.Paths;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.Map;
+import java.util.Objects;
 
 /**
  * Factory to get ImageReader
@@ -54,6 +55,7 @@
      * Returns an {@code ImageReader} to read from the given image file
      */
     public static ImageReader get(Path jimage) throws IOException {
+        Objects.requireNonNull(jimage);
         ImageReader reader = readers.get(jimage);
         if (reader != null) {
             return reader;
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStream.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStream.java	Wed Jun 01 15:27:49 2016 -0700
@@ -28,6 +28,7 @@
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.Arrays;
+import java.util.Objects;
 
 /**
  * @implNote This class needs to maintain JDK 8 source compatibility.
@@ -57,16 +58,16 @@
 
     public ImageStream(int size, ByteOrder byteOrder) {
         buffer = ByteBuffer.allocate(size);
-        buffer.order(byteOrder);
+        buffer.order(Objects.requireNonNull(byteOrder));
     }
 
     public ImageStream(byte[] bytes, ByteOrder byteOrder) {
-        buffer = ByteBuffer.wrap(bytes);
-        buffer.order(byteOrder);
+        buffer = ByteBuffer.wrap(Objects.requireNonNull(bytes));
+        buffer.order(Objects.requireNonNull(byteOrder));
     }
 
     public ImageStream(ByteBuffer buffer) {
-        this.buffer = buffer;
+        this.buffer = Objects.requireNonNull(buffer);
     }
 
     public ImageStream align(int alignment) {
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStringsReader.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStringsReader.java	Wed Jun 01 15:27:49 2016 -0700
@@ -27,6 +27,7 @@
 
 import java.io.UTFDataFormatException;
 import java.nio.ByteBuffer;
+import java.util.Objects;
 
 /**
  * @implNote This class needs to maintain JDK 8 source compatibility.
@@ -40,7 +41,7 @@
     private final BasicImageReader reader;
 
     ImageStringsReader(BasicImageReader reader) {
-        this.reader = reader;
+        this.reader = Objects.requireNonNull(reader);
     }
 
     @Override
@@ -54,7 +55,19 @@
     }
 
     private static int hashCode(byte[] bytes, int offset, int count, int seed) {
-        for (int i = offset, limit = offset + count; i < limit; i++) {
+        Objects.requireNonNull(bytes);
+
+        if (offset < 0 || count < 0 || offset > bytes.length - count) {
+            throw new IndexOutOfBoundsException("offset=" + offset + ", count=" + count);
+        }
+
+        int limit = offset + count;
+
+        if (limit < 0 || limit > bytes.length) {
+            throw new IndexOutOfBoundsException("limit=" + limit);
+        }
+
+        for (int i = offset; i < limit; i++) {
             seed = (seed * HASH_MULTIPLIER) ^ (bytes[i] & 0xFF);
         }
 
--- a/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java	Wed Jun 01 15:27:49 2016 -0700
@@ -72,8 +72,8 @@
  * loader. This allows automatic modules (for example) to link to types in the
  * unnamed module of the parent class loader.
  *
- * @see Layer#createWithOneLoader
- * @see Layer#createWithManyLoaders
+ * @see Layer#defineModulesWithOneLoader
+ * @see Layer#defineModulesWithManyLoaders
  */
 
 public final class Loader extends SecureClassLoader {
@@ -315,6 +315,8 @@
                 }, acc);
         } catch (PrivilegedActionException pae) {
             throw (IOException) pae.getCause();
+        } catch (SecurityException se) {
+            return null;
         }
     }
 
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/VM.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/VM.java	Wed Jun 01 15:27:49 2016 -0700
@@ -475,6 +475,23 @@
      */
     public static native long getNanoTimeAdjustment(long offsetInSeconds);
 
+    /**
+     * Returns the VM arguments for this runtime environment.
+     *
+     * @implNote
+     * The HotSpot JVM processes the input arguments from multiple sources
+     * in the following order:
+     * 1. JAVA_TOOL_OPTIONS environment variable
+     * 2. Options from JNI Invocation API
+     * 3. _JAVA_OPTIONS environment variable
+     *
+     * If VM options file is specified via -XX:VMOptionsFile, the vm options
+     * file is read and expanded in place of -XX:VMOptionFile option.
+     *
+     * Open issue with -XX:Flags (see JDK-8157979)
+     */
+    public static native String[] getRuntimeArguments();
+
     static {
         initialize();
     }
--- a/jdk/src/java.base/share/classes/module-info.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/module-info.java	Wed Jun 01 15:27:49 2016 -0700
@@ -165,6 +165,7 @@
         java.sql,
         java.xml,
         jdk.charsets,
+        jdk.compiler,
         jdk.jartool,
         jdk.jlink,
         jdk.net,
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/AlgorithmChecker.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/AlgorithmChecker.java	Wed Jun 01 15:27:49 2016 -0700
@@ -29,6 +29,7 @@
 import java.security.CryptoPrimitive;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Date;
 import java.util.Set;
 import java.util.EnumSet;
 import java.math.BigInteger;
@@ -59,7 +60,7 @@
 import sun.security.x509.AlgorithmId;
 
 /**
- * A <code>PKIXCertPathChecker</code> implementation to check whether a
+ * A {@code PKIXCertPathChecker} implementation to check whether a
  * specified certificate contains the required algorithm constraints.
  * <p>
  * Certificate fields such as the subject public key, the signature
@@ -74,6 +75,7 @@
 
     private final AlgorithmConstraints constraints;
     private final PublicKey trustedPubKey;
+    private final Date pkixdate;
     private PublicKey prevPubKey;
 
     private static final Set<CryptoPrimitive> SIGNATURE_PRIMITIVE_SET =
@@ -99,7 +101,7 @@
     private boolean trustedMatch = false;
 
     /**
-     * Create a new <code>AlgorithmChecker</code> with the algorithm
+     * Create a new {@code AlgorithmChecker} with the algorithm
      * constraints specified in security property
      * "jdk.certpath.disabledAlgorithms".
      *
@@ -107,11 +109,26 @@
      *     certificate
      */
     public AlgorithmChecker(TrustAnchor anchor) {
-        this(anchor, certPathDefaultConstraints);
+        this(anchor, certPathDefaultConstraints, null);
     }
 
     /**
-     * Create a new <code>AlgorithmChecker</code> with the
+     * Create a new {@code AlgorithmChecker} with the
+     * given {@code TrustAnchor} and {@code AlgorithmConstraints}.
+     *
+     * @param anchor the trust anchor selected to validate the target
+     *     certificate
+     * @param constraints the algorithm constraints (or null)
+     *
+     * @throws IllegalArgumentException if the {@code anchor} is null
+     */
+    public AlgorithmChecker(TrustAnchor anchor,
+            AlgorithmConstraints constraints) {
+        this(anchor, constraints, null);
+    }
+
+    /**
+     * Create a new {@code AlgorithmChecker} with the
      * given {@code AlgorithmConstraints}.
      * <p>
      * Note that this constructor will be used to check a certification
@@ -124,20 +141,24 @@
         this.prevPubKey = null;
         this.trustedPubKey = null;
         this.constraints = constraints;
+        this.pkixdate = null;
     }
 
     /**
-     * Create a new <code>AlgorithmChecker</code> with the
-     * given <code>TrustAnchor</code> and <code>AlgorithmConstraints</code>.
+     * Create a new {@code AlgorithmChecker} with the
+     * given {@code TrustAnchor} and {@code AlgorithmConstraints}.
      *
      * @param anchor the trust anchor selected to validate the target
      *     certificate
      * @param constraints the algorithm constraints (or null)
+     * @param pkixdate Date the constraints are checked against. The value is
+     *             either the PKIXParameter date or null for the current date.
      *
-     * @throws IllegalArgumentException if the <code>anchor</code> is null
+     * @throws IllegalArgumentException if the {@code anchor} is null
      */
     public AlgorithmChecker(TrustAnchor anchor,
-            AlgorithmConstraints constraints) {
+            AlgorithmConstraints constraints,
+            Date pkixdate) {
 
         if (anchor == null) {
             throw new IllegalArgumentException(
@@ -157,6 +178,22 @@
 
         this.prevPubKey = trustedPubKey;
         this.constraints = constraints;
+        this.pkixdate = pkixdate;
+    }
+
+    /**
+     * Create a new {@code AlgorithmChecker} with the
+     * given {@code TrustAnchor} and {@code PKIXParameter} date.
+     *
+     * @param anchor the trust anchor selected to validate the target
+     *     certificate
+     * @param pkixdate Date the constraints are checked against. The value is
+     *             either the PKIXParameter date or null for the current date.
+     *
+     * @throws IllegalArgumentException if the {@code anchor} is null
+     */
+    public AlgorithmChecker(TrustAnchor anchor, Date pkixdate) {
+        this(anchor, certPathDefaultConstraints, pkixdate);
     }
 
     // Check this 'cert' for restrictions in the AnchorCertificates
@@ -259,7 +296,7 @@
         // permits() will throw exception on failure.
         certPathDefaultConstraints.permits(primitives,
                 new CertConstraintParameters((X509Certificate)cert,
-                        trustedMatch));
+                        trustedMatch, pkixdate));
                 // new CertConstraintParameters(x509Cert, trustedMatch));
         // If there is no previous key, set one and exit
         if (prevPubKey == null) {
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java	Wed Jun 01 15:27:49 2016 -0700
@@ -172,7 +172,7 @@
         List<PKIXCertPathChecker> certPathCheckers = new ArrayList<>();
         // add standard checkers that we will be using
         certPathCheckers.add(untrustedChecker);
-        certPathCheckers.add(new AlgorithmChecker(anchor));
+        certPathCheckers.add(new AlgorithmChecker(anchor, params.date()));
         certPathCheckers.add(new KeyChecker(certPathLen,
                                             params.targetCertConstraints()));
         certPathCheckers.add(new ConstraintsChecker(certPathLen));
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java	Wed Jun 01 15:27:49 2016 -0700
@@ -343,7 +343,8 @@
                 checkers.add(policyChecker);
 
                 // add the algorithm checker
-                checkers.add(new AlgorithmChecker(builder.trustAnchor));
+                checkers.add(new AlgorithmChecker(builder.trustAnchor,
+                        buildParams.date()));
 
                 BasicChecker basicChecker = null;
                 if (nextState.keyParamsNeeded()) {
--- a/jdk/src/java.base/share/classes/sun/security/util/CertConstraintParameters.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/util/CertConstraintParameters.java	Wed Jun 01 15:27:49 2016 -0700
@@ -26,6 +26,7 @@
 package sun.security.util;
 
 import java.security.cert.X509Certificate;
+import java.util.Date;
 
 /**
  * This class is a wrapper for keeping state and passing objects between PKIX,
@@ -34,18 +35,21 @@
 public class CertConstraintParameters {
     // A certificate being passed to check against constraints.
     private final X509Certificate cert;
-
     // This is true if the trust anchor in the certificate chain matches a cert
     // in AnchorCertificates
     private final boolean trustedMatch;
+    // PKIXParameter date
+    private final Date pkixDate;
 
-    public CertConstraintParameters(X509Certificate c, boolean match) {
+    public CertConstraintParameters(X509Certificate c, boolean match,
+            Date pkixdate) {
         cert = c;
         trustedMatch = match;
+        pkixDate = pkixdate;
     }
 
     public CertConstraintParameters(X509Certificate c) {
-        this(c, false);
+        this(c, false, null);
     }
 
     // Returns if the trust anchor has a match if anchor checking is enabled.
@@ -56,4 +60,9 @@
     public X509Certificate getCertificate() {
         return cert;
     }
+
+    public Date getPKIXParamDate() {
+        return pkixDate;
+    }
+
 }
--- a/jdk/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java	Wed Jun 01 15:27:49 2016 -0700
@@ -31,11 +31,15 @@
 import java.security.cert.CertPathValidatorException;
 import java.security.cert.CertPathValidatorException.BasicReason;
 import java.security.cert.X509Certificate;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
+import java.util.TimeZone;
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 
@@ -226,6 +230,8 @@
         private Map<String, Set<Constraint>> constraintsMap = new HashMap<>();
         private static final Pattern keySizePattern = Pattern.compile(
                 "keySize\\s*(<=|<|==|!=|>|>=)\\s*(\\d+)");
+        private static final Pattern denyAfterPattern = Pattern.compile(
+                "denyAfter\\s+(\\d{4})-(\\d{2})-(\\d{2})");
 
         public Constraints(String[] constraintArray) {
             for (String constraintEntry : constraintArray) {
@@ -259,6 +265,8 @@
                 Constraint c, lastConstraint = null;
                 // Allow only one jdkCA entry per constraint entry
                 boolean jdkCALimit = false;
+                // Allow only one denyAfter entry per constraint entry
+                boolean denyAfterLimit = false;
 
                 for (String entry : policy.split("&")) {
                     entry = entry.trim();
@@ -284,6 +292,22 @@
                         }
                         c = new jdkCAConstraint(algorithm);
                         jdkCALimit = true;
+
+                    } else if(matcher.usePattern(denyAfterPattern).matches()) {
+                        if (debug != null) {
+                            debug.println("Constraints set to denyAfter");
+                        }
+                        if (denyAfterLimit) {
+                            throw new IllegalArgumentException("Only one " +
+                                    "denyAfter entry allowed in property. " +
+                                    "Constraint: " + constraintEntry);
+                        }
+                        int year = Integer.parseInt(matcher.group(1));
+                        int month = Integer.parseInt(matcher.group(2));
+                        int day = Integer.parseInt(matcher.group(3));
+                        c = new DenyAfterConstraint(algorithm, year, month,
+                                day);
+                        denyAfterLimit = true;
                     } else {
                         throw new IllegalArgumentException("Error in security" +
                                 " property. Constraint unknown: " + entry);
@@ -360,7 +384,15 @@
         }
     }
 
-    // Abstract class for algorithm constraint checking
+    /**
+     * This abstract Constraint class for algorithm-based checking
+     * may contain one or more constraints.  If the '&' on the {@Security}
+     * property is used, multiple constraints have been grouped together
+     * requiring all the constraints to fail for the check to be disallowed.
+     *
+     * If the class contains multiple constraints, the next constraint
+     * is stored in {@code nextConstraint} in linked-list fashion.
+     */
     private abstract static class Constraint {
         String algorithm;
         Constraint nextConstraint = null;
@@ -396,22 +428,79 @@
         }
 
         /**
-         * Check if an algorithm constraint permit this key to be used.
+         * Check if an algorithm constraint is permitted with a given key.
+         *
+         * If the check inside of {@code permit()} fails, it must call
+         * {@code next()} with the same {@code Key} parameter passed if
+         * multiple constraints need to be checked.
+         *
          * @param key Public key
-         * @return true if constraints do not match
+         * @return 'true' if constraint is allowed, 'false' if disallowed.
          */
         public boolean permits(Key key) {
             return true;
         }
 
         /**
-         * Check if an algorithm constraint is permit this certificate to
-         * be used.
-         * @param cp CertificateParameter containing certificate and state info
-         * @return true if constraints do not match
+         * Check if an algorithm constraint is permitted with a given
+         * CertConstraintParameters.
+         *
+         * If the check inside of {@code permits()} fails, it must call
+         * {@code next()} with the same {@code CertConstraintParameters}
+         * parameter passed if multiple constraints need to be checked.
+         *
+         * @param cp CertConstraintParameter containing certificate info
+         * @throws CertPathValidatorException if constraint disallows.
+         *
          */
         public abstract void permits(CertConstraintParameters cp)
                 throws CertPathValidatorException;
+
+        /**
+         * Recursively check if the constraints are allowed.
+         *
+         * If {@code nextConstraint} is non-null, this method will
+         * call {@code nextConstraint}'s {@code permits()} to check if the
+         * constraint is allowed or denied.  If the constraint's
+         * {@code permits()} is allowed, this method will exit this and any
+         * recursive next() calls, returning 'true'.  If the constraints called
+         * were disallowed, the last constraint will throw
+         * {@code CertPathValidatorException}.
+         *
+         * @param cp CertConstraintParameters
+         * @return 'true' if constraint allows the operation, 'false' if
+         * we are at the end of the constraint list or,
+         * {@code nextConstraint} is null.
+         */
+        boolean next(CertConstraintParameters cp)
+                throws CertPathValidatorException {
+            if (nextConstraint != null) {
+                nextConstraint.permits(cp);
+                return true;
+            }
+            return false;
+        }
+
+        /**
+         * Recursively check if this constraint is allowed,
+         *
+         * If {@code nextConstraint} is non-null, this method will
+         * call {@code nextConstraint}'s {@code permit()} to check if the
+         * constraint is allowed or denied.  If the constraint's
+         * {@code permit()} is allowed, this method will exit this and any
+         * recursive next() calls, returning 'true'.  If the constraints
+         * called were disallowed the check will exit with 'false'.
+         *
+         * @param key Public key
+         * @return 'true' if constraint allows the operation, 'false' if
+         * the constraint denies the operation.
+         */
+        boolean next(Key key) {
+            if (nextConstraint != null && nextConstraint.permits(key)) {
+                return true;
+            }
+            return false;
+        }
     }
 
     /*
@@ -424,9 +513,9 @@
         }
 
         /*
-         * Check if each constraint fails and check if there is a linked
-         * constraint  Any permitted constraint will exit the linked list
-         * to allow the operation.
+         * Check if CertConstraintParameters has a trusted match, if it does
+         * call next() for any following constraints. If it does not, exit
+         * as this constraint(s) does not restrict the operation.
          */
         public void permits(CertConstraintParameters cp)
                 throws CertPathValidatorException {
@@ -434,10 +523,9 @@
                 debug.println("jdkCAConstraints.permits(): " + algorithm);
             }
 
-            // Return false if the chain has a trust anchor in cacerts
+            // Check chain has a trust anchor in cacerts
             if (cp.isTrustedMatch()) {
-                if (nextConstraint != null) {
-                    nextConstraint.permits(cp);
+                if (next(cp)) {
                     return;
                 }
                 throw new CertPathValidatorException(
@@ -448,6 +536,99 @@
         }
     }
 
+    /*
+     * This class handles the denyAfter constraint.  The date is in the UTC/GMT
+     * timezone.
+     */
+     private static class DenyAfterConstraint extends Constraint {
+         private Date denyAfterDate;
+         private static final SimpleDateFormat dateFormat =
+                 new SimpleDateFormat("EEE, MMM d HH:mm:ss z YYYY");
+
+         DenyAfterConstraint(String algo, int year, int month, int day) {
+             Calendar c;
+
+             algorithm = algo;
+
+             if (debug != null) {
+                 debug.println("DenyAfterConstraint read in as:  year " +
+                         year + ", month = " + month + ", day = " + day);
+             }
+
+             c = new Calendar.Builder().setTimeZone(TimeZone.getTimeZone("GMT"))
+                     .setDate(year, month - 1, day).build();
+
+             if (year > c.getActualMaximum(Calendar.YEAR) ||
+                     year < c.getActualMinimum(Calendar.YEAR)) {
+                 throw new IllegalArgumentException(
+                         "Invalid year given in constraint: " + year);
+             }
+             if ((month - 1) > c.getActualMaximum(Calendar.MONTH) ||
+                     (month - 1) < c.getActualMinimum(Calendar.MONTH)) {
+                 throw new IllegalArgumentException(
+                         "Invalid month given in constraint: " + month);
+             }
+             if (day > c.getActualMaximum(Calendar.DAY_OF_MONTH) ||
+                     day < c.getActualMinimum(Calendar.DAY_OF_MONTH)) {
+                 throw new IllegalArgumentException(
+                         "Invalid Day of Month given in constraint: " + day);
+             }
+
+             denyAfterDate = c.getTime();
+             if (debug != null) {
+                 debug.println("DenyAfterConstraint date set to: " +
+                         dateFormat.format(denyAfterDate));
+             }
+         }
+
+         /*
+          * Checking that the provided date is not beyond the constraint date.
+          * The provided date can be the PKIXParameter date if given,
+          * otherwise it is the current date.
+          *
+          * If the constraint disallows, call next() for any following
+          * constraints. Throw an exception if this is the last constraint.
+          */
+         @Override
+         public void permits(CertConstraintParameters cp)
+                 throws CertPathValidatorException {
+             Date currentDate;
+
+             if (cp.getPKIXParamDate() != null) {
+                 currentDate = cp.getPKIXParamDate();
+             } else {
+                 currentDate = new Date();
+             }
+
+             if (!denyAfterDate.after(currentDate)) {
+                 if (next(cp)) {
+                     return;
+                 }
+                 throw new CertPathValidatorException(
+                         "denyAfter constraint check failed.  " +
+                                 "Constraint date: " +
+                                 dateFormat.format(denyAfterDate) +
+                                 "; Cert date: " +
+                                 dateFormat.format(currentDate),
+                          null, null, -1, BasicReason.ALGORITHM_CONSTRAINED);
+             }
+         }
+
+         /*
+          * Return result if the constraint's date is beyond the current date
+          * in UTC timezone.
+          */
+         public boolean permits(Key key) {
+             if (next(key)) {
+                 return true;
+             }
+             if (debug != null) {
+                 debug.println("DenyAfterConstraints.permits(): " + algorithm);
+             }
+
+             return denyAfterDate.after(new Date());
+         }
+     }
 
     /*
      * This class contains constraints dealing with the key size
--- a/jdk/src/java.base/share/conf/security/java.security	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/conf/security/java.security	Wed Jun 01 15:27:49 2016 -0700
@@ -570,9 +570,7 @@
 # describes the mechanism for disabling algorithms based on algorithm name
 # and/or key length.  This includes algorithms used in certificates, as well
 # as revocation information such as CRLs and signed OCSP Responses.
-#
-# The syntax of the disabled algorithm string is described as this Java
-# BNF-style:
+# The syntax of the disabled algorithm string is described as follows:
 #   DisabledAlgorithms:
 #       " DisabledAlgorithm { , DisabledAlgorithm } "
 #
@@ -583,25 +581,22 @@
 #       (see below)
 #
 #   Constraint:
-#       KeySizeConstraint, CertConstraint
+#       KeySizeConstraint | CAConstraint | DenyAfterConstraint
 #
 #   KeySizeConstraint:
-#       keySize Operator DecimalInteger
+#       keySize Operator KeyLength
 #
 #   Operator:
 #       <= | < | == | != | >= | >
 #
-#   DecimalInteger:
-#       DecimalDigits
+#   KeyLength:
+#       Integer value of the algorithm's key length in bits
 #
-#   DecimalDigits:
-#       DecimalDigit {DecimalDigit}
+#   CAConstraint:
+#       jdkCA
 #
-#   DecimalDigit: one of
-#       1 2 3 4 5 6 7 8 9 0
-#
-#   CertConstraint
-#       jdkCA
+#   DenyAfterConstraint:
+#       denyAfter YYYY-MM-DD
 #
 # The "AlgorithmName" is the standard algorithm name of the disabled
 # algorithm. See "Java Cryptography Architecture Standard Algorithm Name
@@ -615,27 +610,42 @@
 # that rely on DSA, such as NONEwithDSA, SHA1withDSA.  However, the assertion
 # will not disable algorithms related to "ECDSA".
 #
-# A "Constraint" provides further guidance for the algorithm being specified.
-# The "KeySizeConstraint" requires a key of a valid size range if the
-# "AlgorithmName" is of a key algorithm.  The "DecimalInteger" indicates the
-# key size specified in number of bits.  For example, "RSA keySize <= 1024"
-# indicates that any RSA key with key size less than or equal to 1024 bits
-# should be disabled, and "RSA keySize < 1024, RSA keySize > 2048" indicates
-# that any RSA key with key size less than 1024 or greater than 2048 should
-# be disabled. Note that the "KeySizeConstraint" only makes sense to key
-# algorithms.
+# A "Constraint" defines restrictions on the keys and/or certificates for
+# a specified AlgorithmName:
 #
-# "CertConstraint" specifies additional constraints for
-# certificates that contain algorithms that are restricted:
+#   KeySizeConstraint:
+#     keySize Operator KeyLength
+#       The constraint requires a key of a valid size range if the
+#       "AlgorithmName" is of a key algorithm.  The "KeyLength" indicates
+#       the key size specified in number of bits.  For example,
+#       "RSA keySize <= 1024" indicates that any RSA key with key size less
+#       than or equal to 1024 bits should be disabled, and
+#       "RSA keySize < 1024, RSA keySize > 2048" indicates that any RSA key
+#       with key size less than 1024 or greater than 2048 should be disabled.
+#       This constraint is only used on algorithms that have a key size.
 #
-#   "jdkCA" prohibits the specified algorithm only if the algorithm is used
-#     in a certificate chain that terminates at a marked trust anchor in the
-#     lib/security/cacerts keystore.  All other chains are not affected.
-#     If the jdkCA constraint is not set, then all chains using the
-#     specified algorithm are restricted.  jdkCA may only be used once in
-#     a DisabledAlgorithm expression.
-#     Example:  To apply this constraint to SHA-1 certificates, include
-#     the following:  "SHA1 jdkCA"
+#   CAConstraint:
+#     jdkCA
+#       This constraint prohibits the specified algorithm only if the
+#       algorithm is used in a certificate chain that terminates at a marked
+#       trust anchor in the lib/security/cacerts keystore.  If the jdkCA
+#       constraint is not set, then all chains using the specified algorithm
+#       are restricted.  jdkCA may only be used once in a DisabledAlgorithm
+#       expression.
+#       Example:  To apply this constraint to SHA-1 certificates, include
+#       the following:  "SHA1 jdkCA"
+#
+#   DenyAfterConstraint:
+#     denyAfter YYYY-MM-DD
+#       This constraint prohibits a certificate with the specified algorithm
+#       from being used after the date regardless of the certificate's
+#       validity.  JAR files that are signed and timestamped before the
+#       constraint date with certificates containing the disabled algorithm
+#       will not be restricted.  The date is processed in the UTC timezone.
+#       This constraint can only be used once in a DisabledAlgorithm
+#       expression.
+#       Example:  To deny usage of RSA 2048 bit certificates after Feb 3 2020,
+#       use the following:  "RSA keySize == 2048 & denyAfter 2020-02-03"
 #
 # When an algorithm must satisfy more than one constraint, it must be
 # delimited by an ampersand '&'.  For example, to restrict certificates in a
--- a/jdk/src/java.base/share/native/libjava/VM.c	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/native/libjava/VM.c	Wed Jun 01 15:27:49 2016 -0700
@@ -55,3 +55,8 @@
     (*env)->RegisterNatives(env, cls,
                             methods, sizeof(methods)/sizeof(methods[0]));
 }
+
+JNIEXPORT jobjectArray JNICALL
+Java_jdk_internal_misc_VM_getRuntimeArguments(JNIEnv *env, jclass cls) {
+    return JVM_GetVmArguments(env);
+}
--- a/jdk/src/java.base/share/native/libnet/InetAddress.c	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/native/libnet/InetAddress.c	Wed Jun 01 15:27:49 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -61,7 +61,7 @@
         CHECK_NULL(iac_class);
         ia_holderID = (*env)->GetFieldID(env, ia_class, "holder", "Ljava/net/InetAddress$InetAddressHolder;");
         CHECK_NULL(ia_holderID);
-        ia_preferIPv6AddressID = (*env)->GetStaticFieldID(env, ia_class, "preferIPv6Address", "Z");
+        ia_preferIPv6AddressID = (*env)->GetStaticFieldID(env, ia_class, "preferIPv6Address", "I");
         CHECK_NULL(ia_preferIPv6AddressID);
 
         iac_addressID = (*env)->GetFieldID(env, iac_class, "address", "I");
--- a/jdk/src/java.base/share/native/libverify/check_code.c	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/native/libverify/check_code.c	Wed Jun 01 15:27:49 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -1744,9 +1744,14 @@
             }
 
         default: {
+            if (instruction < 0 || instruction > JVM_OPC_MAX)
+                return -1;
+
             /* A length of 0 indicates an error. */
-            int length = opcode_length[instruction];
-            return (length <= 0) ? -1 : length;
+            if (opcode_length[instruction] <= 0)
+                return -1;
+
+            return opcode_length[instruction];
         }
     }
 }
--- a/jdk/src/java.base/share/native/libzip/zip_util.c	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/share/native/libzip/zip_util.c	Wed Jun 01 15:27:49 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -77,6 +77,13 @@
 static jint INITIAL_META_COUNT = 2;   /* initial number of entries in meta name array */
 
 /*
+ * Declare library specific JNI_Onload entry if static build
+ */
+#ifdef STATIC_BUILD
+DEF_STATIC_JNI_OnLoad
+#endif
+
+/*
  * The ZFILE_* functions exist to provide some platform-independence with
  * respect to file access needs.
  */
--- a/jdk/src/java.base/unix/native/libnet/Inet6AddressImpl.c	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/unix/native/libnet/Inet6AddressImpl.c	Wed Jun 01 15:27:49 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -48,6 +48,7 @@
 
 #include "java_net_Inet4AddressImpl.h"
 #include "java_net_Inet6AddressImpl.h"
+#include "java_net_InetAddress.h"
 
 /* the initial size of our hostent buffers */
 #ifndef NI_MAXHOST
@@ -157,7 +158,10 @@
     }
 
     name = (*env)->NewStringUTF(env, hostname);
-    CHECK_NULL_RETURN(name, NULL);
+    if (name == NULL) {
+        freeifaddrs(ifa);
+        return NULL;
+    }
 
     /* Iterate over the interfaces, and total up the number of IPv4 and IPv6
      * addresses we have. Also keep a count of loopback addresses. We need to
@@ -312,8 +316,8 @@
         JNU_ReleaseStringPlatformChars(env, host, hostname);
         return NULL;
     } else {
-        int i = 0;
-        int inetCount = 0, inet6Count = 0, inetIndex, inet6Index;
+        int i = 0, addressPreference = -1;
+        int inetCount = 0, inet6Count = 0, inetIndex = 0, inet6Index = 0, originalIndex = 0;
         struct addrinfo *itr, *last = NULL, *iterator = res;
         while (iterator != NULL) {
             int skip = 0;
@@ -394,14 +398,18 @@
             goto cleanupAndReturn;
         }
 
-        if ((*env)->GetStaticBooleanField(env, ia_class, ia_preferIPv6AddressID)) {
+        addressPreference = (*env)->GetStaticIntField(env, ia_class, ia_preferIPv6AddressID);
+
+        if (addressPreference == java_net_InetAddress_PREFER_IPV6_VALUE) {
             /* AF_INET addresses will be offset by inet6Count */
             inetIndex = inet6Count;
             inet6Index = 0;
-        } else {
+        } else if (addressPreference == java_net_InetAddress_PREFER_IPV4_VALUE) {
             /* AF_INET6 addresses will be offset by inetCount */
             inetIndex = 0;
             inet6Index = inetCount;
+        } else if (addressPreference == java_net_InetAddress_PREFER_SYSTEM_VALUE) {
+            inetIndex = inet6Index = originalIndex = 0;
         }
 
         while (iterator != NULL) {
@@ -414,7 +422,7 @@
                 }
                 setInetAddress_addr(env, iaObj, ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
                 setInetAddress_hostName(env, iaObj, host);
-                (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj);
+                (*env)->SetObjectArrayElement(env, ret, (inetIndex | originalIndex), iaObj);
                 inetIndex++;
             } else if (iterator->ai_family == AF_INET6) {
                 jint scope = 0;
@@ -435,9 +443,13 @@
                     setInet6Address_scopeid(env, iaObj, scope);
                 }
                 setInetAddress_hostName(env, iaObj, host);
-                (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj);
+                (*env)->SetObjectArrayElement(env, ret, (inet6Index | originalIndex), iaObj);
                 inet6Index++;
             }
+            if (addressPreference == java_net_InetAddress_PREFER_SYSTEM_VALUE) {
+                originalIndex++;
+                inetIndex = inet6Index = 0;
+            }
             iterator = iterator->ai_next;
         }
     }
--- a/jdk/src/java.base/unix/native/libnet/NetworkInterface.c	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/unix/native/libnet/NetworkInterface.c	Wed Jun 01 15:27:49 2016 -0700
@@ -243,6 +243,7 @@
     if (name_utf == NULL) {
        if (!(*env)->ExceptionCheck(env))
            JNU_ThrowOutOfMemoryError(env, NULL);
+       freeif(ifs);
        return NULL;
     }
 
@@ -519,7 +520,7 @@
     }
     if ((sock = openSocketWithFallback(env, name_utf)) < 0) {
        (*env)->ReleaseStringUTFChars(env, name, name_utf);
-       return JNI_FALSE;
+       return NULL;
     }
 
     if (!IS_NULL(addrArray)) {
@@ -664,7 +665,7 @@
     }
 
     // Create the array of InetAddresses
-    addrArr = (*env)->NewObjectArray(env, addr_count,  ia_class, NULL);
+    addrArr = (*env)->NewObjectArray(env, addr_count, ia_class, NULL);
     if (addrArr == NULL) {
         return NULL;
     }
@@ -1829,7 +1830,7 @@
     strncpy(if2.lifr_name, ifname, sizeof(if2.lifr_name) - 1);
 
     if (ioctl(sock, SIOCGLIFFLAGS, (char *)&if2) < 0) {
-         return -1;
+        return -1;
     }
 
     *flags = if2.lifr_flags;
@@ -1859,8 +1860,7 @@
                                               "IPV6 Socket creation failed");
                  return -1;
               }
-         }
-         else{ // errno is not NOSUPPORT
+         } else { // errno is not NOSUPPORT
              NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
                                           "IPV4 Socket creation failed");
              return -1;
--- a/jdk/src/java.base/unix/native/libnet/net_util_md.c	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/unix/native/libnet/net_util_md.c	Wed Jun 01 15:27:49 2016 -0700
@@ -95,8 +95,8 @@
         CHECK_NULL(c);
         c = (*env)->NewGlobalRef(env, c);
         CHECK_NULL(c);
-        ni_defaultIndexID = (*env)->GetStaticFieldID(
-            env, c, "defaultIndex", "I");
+        ni_defaultIndexID = (*env)->GetStaticFieldID(env, c, "defaultIndex", "I");
+        CHECK_NULL(ni_defaultIndexID);
         ni_class = c;
     }
     int defaultIndex;
@@ -118,8 +118,8 @@
         CHECK_NULL_RETURN(c, 0);
         c = (*env)->NewGlobalRef(env, c);
         CHECK_NULL_RETURN(c, 0);
-        ni_defaultIndexID = (*env)->GetStaticFieldID(env, c,
-                                                     "defaultIndex", "I");
+        ni_defaultIndexID = (*env)->GetStaticFieldID(env, c, "defaultIndex", "I");
+        CHECK_NULL_RETURN(ni_defaultIndexID, 0);
         ni_class = c;
     }
     defaultIndex = (*env)->GetStaticIntField(env, ni_class,
--- a/jdk/src/java.base/windows/native/libnet/Inet6AddressImpl.c	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/java.base/windows/native/libnet/Inet6AddressImpl.c	Wed Jun 01 15:27:49 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -97,7 +97,7 @@
 
     /* get the address preference */
     preferIPv6Address
-        = (*env)->GetStaticBooleanField(env, ia_class, ia_preferIPv6AddressID);
+        = (*env)->GetStaticIntField(env, ia_class, ia_preferIPv6AddressID);
 
     /* Try once, with our static buffer. */
     memset(&hints, 0, sizeof(hints));
@@ -122,7 +122,7 @@
         }
     } else {
         int i = 0;
-        int inetCount = 0, inet6Count = 0, inetIndex, inet6Index;
+        int inetCount = 0, inet6Count = 0, inetIndex = 0, inet6Index = 0, originalIndex = 0;
         struct addrinfo *itr, *last, *iterator = res;
         while (iterator != NULL) {
             int skip = 0;
@@ -203,12 +203,14 @@
             goto cleanupAndReturn;
         }
 
-        if (preferIPv6Address) {
+        if (preferIPv6Address == java_net_InetAddress_PREFER_IPV6_VALUE) {
             inetIndex = inet6Count;
             inet6Index = 0;
-        } else {
+        } else if (preferIPv6Address == java_net_InetAddress_PREFER_IPV4_VALUE) {
             inetIndex = 0;
             inet6Index = inetCount;
+        } else if (preferIPv6Address == java_net_InetAddress_PREFER_SYSTEM_VALUE) {
+            inetIndex = inet6Index = originalIndex = 0;
         }
 
         while (iterator != NULL) {
@@ -220,7 +222,7 @@
               }
               setInetAddress_addr(env, iaObj, ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
               setInetAddress_hostName(env, iaObj, host);
-              (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj);
+              (*env)->SetObjectArrayElement(env, ret, (inetIndex | originalIndex), iaObj);
                 inetIndex ++;
             } else if (iterator->ai_family == AF_INET6) {
               jint scope = 0;
@@ -240,9 +242,13 @@
                 setInet6Address_scopeid(env, iaObj, scope);
               }
               setInetAddress_hostName(env, iaObj, host);
-              (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj);
+              (*env)->SetObjectArrayElement(env, ret, (inet6Index | originalIndex), iaObj);
               inet6Index ++;
             }
+            if (preferIPv6Address == java_net_InetAddress_PREFER_SYSTEM_VALUE) {
+                originalIndex++;
+                inetIndex = inet6Index = 0;
+            }
             iterator = iterator->ai_next;
         }
     }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ModuleEntry.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ModuleEntry.java	Wed Jun 01 15:27:49 2016 -0700
@@ -40,7 +40,7 @@
  * <li>For jimage content: /{module name}/{package1}/.../{packageN}/{file
  * name}</li>
  * <li>For other files (shared lib, launchers, config, ...):/{module name}/
- * {@literal bin|conf|native}/{dir1}>/.../{dirN}/{file name}</li>
+ * {@literal bin|conf|native}/{dir1}/.../{dirN}/{file name}</li>
  * </ul>
  */
 public interface ModuleEntry {
--- a/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java	Wed Jun 01 15:27:49 2016 -0700
@@ -296,45 +296,6 @@
         theInternalUnsafe.putDouble(o, offset, x);
     }
 
-
-    // These read VM internal data.
-
-    /**
-     * Fetches an uncompressed reference value from a given native variable
-     * ignoring the VM's compressed references mode.
-     *
-     * @param address a memory address locating the variable
-     * @return the value fetched from the indicated native variable
-     */
-    @ForceInline
-    public Object getUncompressedObject(long address) {
-        return theInternalUnsafe.getUncompressedObject(address);
-    }
-
-    /**
-     * Fetches the {@link java.lang.Class} Java mirror for the given native
-     * metaspace {@code Klass} pointer.
-     *
-     * @param metaspaceKlass a native metaspace {@code Klass} pointer
-     * @return the {@link java.lang.Class} Java mirror
-     */
-    @ForceInline
-    public Class<?> getJavaMirror(long metaspaceKlass) {
-        return theInternalUnsafe.getJavaMirror(metaspaceKlass);
-    }
-
-    /**
-     * Fetches a native metaspace {@code Klass} pointer for the given Java
-     * object.
-     *
-     * @param o Java heap object for which to fetch the class pointer
-     * @return a native metaspace {@code Klass} pointer
-     */
-    @ForceInline
-    public long getKlassPointer(Object o) {
-        return theInternalUnsafe.getKlassPointer(o);
-    }
-
     // These work on values in the C heap.
 
     /**
--- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java	Wed Jun 01 15:27:49 2016 -0700
@@ -376,12 +376,17 @@
             // count names
             count = 0;
             index = 0;
-            while (index < path.length) {
-                byte c = path[index++];
-                if (c != '/') {
-                    count++;
-                    while (index < path.length && path[index] != '/')
-                        index++;
+            if (path.length == 0) {
+                // empty path has one name
+                count = 1;
+            } else {
+                while (index < path.length) {
+                    byte c = path[index++];
+                    if (c != '/') {
+                        count++;
+                        while (index < path.length && path[index] != '/')
+                             index++;
+                    }
                 }
             }
             // populate offsets
@@ -423,10 +428,11 @@
     // removes redundant slashs, replace "\" to zip separator "/"
     // and check for invalid characters
     private byte[] normalize(byte[] path) {
-        if (path.length == 0)
+        int len = path.length;
+        if (len == 0)
             return path;
         byte prevC = 0;
-        for (int i = 0; i < path.length; i++) {
+        for (int i = 0; i < len; i++) {
             byte c = path[i];
             if (c == '\\' || c == '\u0000')
                 return normalize(path, i);
@@ -434,6 +440,8 @@
                 return normalize(path, i - 1);
             prevC = c;
         }
+        if (len > 1 && prevC == '/')
+            return Arrays.copyOf(path, len - 1);
         return path;
     }
 
@@ -567,7 +575,8 @@
         if (watcher == null || events == null || modifiers == null) {
             throw new NullPointerException();
         }
-        throw new UnsupportedOperationException();
+        // watcher must be associated with a different provider
+        throw new ProviderMismatchException();
     }
 
     @Override
--- a/jdk/test/ProblemList.txt	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/test/ProblemList.txt	Wed Jun 01 15:27:49 2016 -0700
@@ -195,8 +195,6 @@
 
 java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java       7191877 generic-all
 
-sun/rmi/transport/proxy/EagerHttpFallback.java                  7195095 generic-all
-
 java/rmi/activation/Activatable/extLoadedImpl/ext.sh            8062724 generic-all
 
 sun/rmi/rmic/newrmic/equivalence/run.sh                         8145980 generic-all
@@ -288,8 +286,6 @@
 
 sun/security/tools/keytool/autotest.sh                          8130302 generic-all
 
-sun/security/provider/NSASuiteB/TestDSAGenParameterSpec.java    8137255 generic-all
-
 sun/security/x509/URICertStore/ExtensionsWithLDAP.java          8134577 generic-all
 
 sun/security/provider/SecureRandom/StrongSecureRandom.java      8157387 linux-all
@@ -394,7 +390,5 @@
 
 # core_tools
 
-tools/jimage/JImageTest.java                                    8150975 linux-i586,windows-i586
-
 ############################################################################
 
--- a/jdk/test/TEST.groups	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/test/TEST.groups	Wed Jun 01 15:27:49 2016 -0700
@@ -527,9 +527,13 @@
   java/net/URLConnection/HandleContentTypeWithAttrs.java \
   java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh \
   java/security/Security/ClassLoaderDeadlock/Deadlock.sh \
+  java/text/AttributedCharacterIterator/Attribute/ReadResolve.java \
+  java/text/AttributedString/TestAttributedStringCtor.java \
+  java/text/AttributedString/getRunStartLimitTest.java \
   java/util/jar/Manifest/CreateManifest.java \
   java/util/logging/TestMainAppContext.java \
   java/util/logging/TestLoggingWithMainAppContext.java \
+  java/util/TimeZone/DefaultTimeZoneTest.java \
   java/text/Bidi/BidiConformance.java \
   java/text/Bidi/BidiEmbeddingTest.java \
   java/text/Bidi/Bug7042148.java \
@@ -724,6 +728,7 @@
   java/util/Collections/UnmodifiableMapEntrySet.java  \
   java/util/Comparator/BasicTest.java  \
   java/util/Comparator/TypeTest.java  \
+  java/util/Date/TimestampTest.java \
   java/util/Iterator/IteratorDefaults.java  \
   java/util/Iterator/PrimitiveIteratorDefaults.java  \
   java/util/List/ListDefaults.java  \
--- a/jdk/test/com/sun/jarsigner/DefaultMethod.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/test/com/sun/jarsigner/DefaultMethod.java	Wed Jun 01 15:27:49 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -25,6 +25,7 @@
  * @test
  * @bug 8039358
  * @summary com.sun.jarsigner.ContentSignerParameters.getTSAPolicyID() should be default
+ * @modules jdk.jartool
  * @compile DefaultMethod.java
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/net/httpserver/TEST.properties	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,1 @@
+modules = jdk.httpserver
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/ComponentOrientation/BasicTest.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 1998, 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     4108453 4778440 6304780 6396378
+ * @summary Basic tests for java.awt.ComponentOrientation
+ * @build TestBundle TestBundle_es TestBundle_iw
+ * @build TestBundle1 TestBundle1_ar
+ *
+ * @run main BasicTest
+ */
+/*
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.awt.ComponentOrientation;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+public class BasicTest {
+    public static void main(String args[]) {
+        System.out.println("BasicTest {");
+        TestInvariants();
+        TestLocale();
+        TestBundle();
+
+        System.out.println("} Pass");
+    }
+
+    // TestInvariants
+    //
+    // Various no-brainer tests to make sure the constants behave properly
+    // and so on.
+    //
+    static void TestInvariants() {
+        System.out.println("  TestInvariants {");
+
+        Assert(ComponentOrientation.LEFT_TO_RIGHT.isLeftToRight(),
+               "LEFT_TO_RIGHT.isLeftToRight()");
+
+        Assert(ComponentOrientation.UNKNOWN.isLeftToRight(),
+               "UNKNOWN.isLeftToRight()");
+
+        Assert(!ComponentOrientation.RIGHT_TO_LEFT.isLeftToRight(),
+               "!RIGHT_TO_LEFT.isLeftToRight()");
+
+        Assert(ComponentOrientation.LEFT_TO_RIGHT.isHorizontal(),
+               "LEFT_TO_RIGHT.isHorizontal()");
+
+        Assert(ComponentOrientation.UNKNOWN.isHorizontal(),
+               "UNKNOWN.isHorizontal()");
+
+        Assert(ComponentOrientation.RIGHT_TO_LEFT.isHorizontal(),
+               "RIGHT_TO_LEFT.isHorizontal()");
+
+        System.out.println("  } Pass");
+    }
+
+    // TestLocale
+    //
+    // Make sure that getOrientation(Locale) works, and that the appropriate
+    // system locales are RIGHT_TO_LEFT
+    //
+    static void TestLocale() {
+        System.out.println("  TestLocale {");
+
+        ComponentOrientation orient = ComponentOrientation.getOrientation(Locale.US);
+        Assert(orient == ComponentOrientation.LEFT_TO_RIGHT, "US == LEFT_TO_RIGHT");
+
+        orient = ComponentOrientation.getOrientation(new Locale("iw", ""));
+        Assert(orient == ComponentOrientation.RIGHT_TO_LEFT, "iw == RIGHT_TO_LEFT");
+
+        orient = ComponentOrientation.getOrientation(new Locale("ar", ""));
+        Assert(orient == ComponentOrientation.RIGHT_TO_LEFT, "ar == RIGHT_TO_LEFT");
+
+        System.out.println("  } Pass");
+    }
+
+    // TestBundle
+    //
+    // Make sure that getOrientation(ResourceBundle) works right, especially
+    // the fallback mechasm
+    //
+    static void TestBundle() {
+        System.out.println("  TestBundle {");
+
+        // This will fall back to the default locale's bundle or root bundle
+        ResourceBundle rb = ResourceBundle.getBundle("TestBundle",
+                                                        new Locale("et", ""));
+        if (rb.getLocale().getLanguage().equals(new Locale("iw").getLanguage())) {
+            assertEquals(rb, ComponentOrientation.RIGHT_TO_LEFT, "et == RIGHT_TO_LEFT" );
+        } else if (rb.getLocale().getLanguage() == "es") {
+            assertEquals(rb, ComponentOrientation.LEFT_TO_RIGHT, "et == LEFT_TO_RIGHT" );
+        } else {
+            assertEquals(rb, ComponentOrientation.UNKNOWN, "et == UNKNOWN" );
+        }
+
+        // We have actual bundles for "es" and "iw", so it should just fetch
+        // the orientation object out of them
+        rb = ResourceBundle.getBundle("TestBundle",new Locale("es", ""));
+        assertEquals(rb, ComponentOrientation.LEFT_TO_RIGHT, "es == LEFT_TO_RIGHT" );
+
+        rb = ResourceBundle.getBundle("TestBundle", new Locale("iw", "IL"));
+        assertEquals(rb, ComponentOrientation.RIGHT_TO_LEFT, "iw == RIGHT_TO_LEFT" );
+
+        // This bundle has no orientation setting at all, so we should get
+        // the system's default orientation for Arabic
+        rb = ResourceBundle.getBundle("TestBundle1", new Locale("ar", ""));
+        assertEquals(rb, ComponentOrientation.RIGHT_TO_LEFT, "ar == RIGHT_TO_LEFT" );
+
+        System.out.println("  } Pass");
+    }
+
+    static void assertEquals(ResourceBundle rb, ComponentOrientation o, String str) {
+        Assert(ComponentOrientation.getOrientation(rb) == o, str);
+    }
+
+    static void Assert(boolean condition, String str) {
+        if (!condition) {
+            System.err.println("    ASSERT FAILED: " + str);
+            throw new RuntimeException("Assert Failed: " + str);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/ComponentOrientation/BorderTest.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 1998, 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     4108453
+ * @summary Test ComponentOrientation (Bidi) support in BorderLayout
+ */
+/*
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+
+public class BorderTest extends Applet {
+    Panel       panel1;
+    Panel       panel2;
+
+    public BorderTest() {
+        setLayout(new GridLayout(0,2));
+
+        // Create a panel with a BorderLayout and a bunch of buttons in it
+        panel1 = new Panel();
+        panel1.setLayout(new BorderLayout());
+        panel1.add("North", new Button("North"));
+        panel1.add("South", new Button("South"));
+        panel1.add("East", new Button("East"));
+        panel1.add("West", new Button("West"));
+        panel1.add("Center", new Button("Center"));
+        add(panel1);
+
+        // Create a panel with a BorderLayout and a bunch of buttons in it
+        panel2 = new Panel();
+        panel2.setLayout(new BorderLayout());
+        panel2.add(BorderLayout.BEFORE_FIRST_LINE, new Button("FirstLine"));
+        panel2.add(BorderLayout.AFTER_LAST_LINE, new Button("LastLine"));
+        panel2.add(BorderLayout.BEFORE_LINE_BEGINS, new Button("FirstItem"));
+        panel2.add(BorderLayout.AFTER_LINE_ENDS, new Button("LastItem"));
+        panel2.add("Center", new Button("Center"));
+        add(panel2);
+
+        // Create a popup menu for switching between orientations
+        {
+            Choice c = new Choice();
+            c.addItem("LEFT_TO_RIGHT");
+            c.addItem("RIGHT_TO_LEFT");
+            c.addItem("UNKNOWN");
+            c.addItemListener( new ItemListener() {
+                public void itemStateChanged(ItemEvent e) {
+                    String item = (String)(e.getItem());
+
+                    ComponentOrientation o = ComponentOrientation.UNKNOWN;
+                    if (item.equals("LEFT_TO_RIGHT")) {
+                        o = ComponentOrientation.LEFT_TO_RIGHT;
+                    } else if (item.equals("RIGHT_TO_LEFT")) {
+                        o = ComponentOrientation.RIGHT_TO_LEFT;
+                    }
+                    panel1.setComponentOrientation(o);
+                    panel2.setComponentOrientation(o);
+                    panel1.layout();
+                    panel2.layout();
+                    panel1.repaint();
+                    panel2.repaint();
+                }
+            } );
+            add(c);
+        }
+    }
+
+    public static void main(String args[]) {
+        Frame f = new Frame("BorderTest");
+
+        f.addWindowListener( new WindowAdapter() {
+            public void windowClosing(WindowEvent e) {
+                e.getWindow().hide();
+                e.getWindow().dispose();
+                System.exit(0);
+            };
+        } );
+
+        BorderTest BorderTest = new BorderTest();
+        BorderTest.init();
+        BorderTest.start();
+
+        f.add("Center", BorderTest);
+        f.setSize(450, 300);
+        f.show();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/ComponentOrientation/FlowTest.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 1998, 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     4108453
+ * @summary Test ComponentOrientation (Bidi) support in FlowLayout
+ */
+/*
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+
+public class FlowTest extends Applet {
+    Panel       panel;
+
+    public FlowTest() {
+        setLayout(new BorderLayout());
+
+        // Create a panel with a FlowLayout and a bunch of buttons in it
+        panel = new Panel();
+        panel.setLayout(new FlowLayout(FlowLayout.LEFT));
+        panel.add(new Button("one"));
+        panel.add(new Button("two"));
+        panel.add(new Button("three"));
+        panel.add(new Button("four"));
+        panel.add(new Button("five"));
+        panel.add(new Button("six"));
+        panel.add(new Button("seven"));
+        panel.add(new Button("eight"));
+        panel.add(new Button("nine"));
+        panel.add(new Button("ten"));
+        panel.add(new Button("eleven"));
+
+        add("Center", panel);
+
+        Panel controls = new Panel();
+        controls.setLayout(new GridLayout(0, 2));
+
+        // Menu for setting the alignment of the main FlowLayout panel
+        {
+            Choice c = new Choice();
+            c.addItem("LEFT");
+            c.addItem("CENTER");
+            c.addItem("RIGHT");
+            c.addItem("LEADING");
+            c.addItem("TRAILING");
+            c.addItemListener( new ItemListener() {
+                public void itemStateChanged(ItemEvent e) {
+                    String item = (String)(e.getItem());
+                    FlowLayout layout = (FlowLayout) panel.getLayout();
+
+                    if (item.equals("LEFT")) {
+                        layout.setAlignment(FlowLayout.LEFT);
+                    } else if (item.equals("CENTER")) {
+                        layout.setAlignment(FlowLayout.CENTER);
+                    } else if (item.equals("RIGHT")) {
+                        layout.setAlignment(FlowLayout.RIGHT);
+                    } else if (item.equals("LEADING")) {
+                        layout.setAlignment(FlowLayout.LEADING);
+                    } else if (item.equals("TRAILING")) {
+                        layout.setAlignment(FlowLayout.TRAILING);
+                    }
+                    panel.layout();
+                    panel.repaint();
+                }
+            } );
+            controls.add(new Label("FlowLayout Alignment:"));
+            controls.add(c);
+        }
+
+        // Create a popup menu for switching the Panel between orientations
+        {
+            Choice c = new Choice();
+            c.addItem("LEFT_TO_RIGHT");
+            c.addItem("RIGHT_TO_LEFT");
+            c.addItem("UNKNOWN");
+            c.addItemListener( new ItemListener() {
+                public void itemStateChanged(ItemEvent e) {
+                    String item = (String)(e.getItem());
+
+                    if (item.equals("LEFT_TO_RIGHT")) {
+                        panel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+                    } else if (item.equals("RIGHT_TO_LEFT")) {
+                        panel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+                    } else {
+                        panel.setComponentOrientation(ComponentOrientation.UNKNOWN);
+                    }
+                    panel.layout();
+                    panel.repaint();
+                }
+            } );
+
+            controls.add(new Label("ComponentOrientation:"));
+            controls.add(c);
+        }
+
+        add("South", controls);
+
+    }
+
+    public static void main(String args[]) {
+        Frame f = new Frame("FlowTest");
+
+        f.addWindowListener( new WindowAdapter() {
+            public void windowClosing(WindowEvent e) {
+                e.getWindow().hide();
+                e.getWindow().dispose();
+                System.exit(0);
+            };
+        } );
+
+        FlowTest flowTest = new FlowTest();
+        flowTest.init();
+        flowTest.start();
+
+        f.add("Center", flowTest);
+        f.setSize(300, 300);
+        f.show();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/ComponentOrientation/TestBundle.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1998, 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.
+ */
+
+/**
+ * TestBundle.java -- used by BasicTest
+ *
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.util.ListResourceBundle;
+import java.awt.ComponentOrientation;
+
+public class TestBundle extends ListResourceBundle {
+
+    protected Object[][] getContents() {
+        return new Object[][] {
+            { "Orientation", ComponentOrientation.UNKNOWN },
+        };
+    }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/ComponentOrientation/TestBundle1.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1998, 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.
+ */
+
+/**
+ * TestBundle1.java -- used by BasicTest
+ *
+ * @bug     4108453
+ * @summary Basic tests for java.awt.ComponentOrientation
+ *
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.util.ListResourceBundle;
+import java.awt.ComponentOrientation;
+
+public class TestBundle1 extends ListResourceBundle {
+
+    protected Object[][] getContents() {
+        return new Object[][] {
+            {  },
+        };
+    }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/ComponentOrientation/TestBundle1_ar.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1998, 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.
+ */
+
+/**
+ * TestBundle1_ar.java -- used by BasicTest
+ *
+ * @bug     4108453
+ * @summary Basic tests for java.awt.ComponentOrientation
+ *
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.util.ListResourceBundle;
+import java.awt.ComponentOrientation;
+
+public class TestBundle1_ar extends ListResourceBundle {
+
+    protected Object[][] getContents() {
+        return new Object[][] {
+            {  },
+        };
+    }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/ComponentOrientation/TestBundle_es.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1998, 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.
+ */
+
+/**
+ * TestBundle_es.java -- used by BasicTest
+ *
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.util.ListResourceBundle;
+import java.awt.ComponentOrientation;
+
+public class TestBundle_es extends ListResourceBundle {
+
+    protected Object[][] getContents() {
+        return new Object[][] {
+            { "Orientation", ComponentOrientation.LEFT_TO_RIGHT },
+        };
+    }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/ComponentOrientation/TestBundle_iw.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1998, 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.
+ */
+
+/**
+ *
+ *
+ * used by BasicTest
+ *
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.util.ListResourceBundle;
+import java.awt.ComponentOrientation;
+
+public class TestBundle_iw extends ListResourceBundle {
+
+    protected Object[][] getContents() {
+        return new Object[][] {
+            { "Orientation", ComponentOrientation.RIGHT_TO_LEFT },
+        };
+    }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/ComponentOrientation/WindowTest.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 1998, 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     4108453 4778440 6304785
+ * @summary Test Window.applyResourceBundle orientation support
+ *
+ * @build TestBundle TestBundle_es TestBundle_iw
+ * @build TestBundle1 TestBundle1_ar
+ * @run main WindowTest
+ */
+
+import java.awt.*;
+import java.applet.*;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+public class WindowTest extends Applet {
+    static Exception failure=null;
+    static Thread mainThread=null;
+
+    public static void main(String args[]) throws Exception {
+        mainThread = Thread.currentThread();
+        WindowTest app = new WindowTest();
+        app.start();
+        try {
+            Thread.sleep(300000);
+        } catch (InterruptedException e) {
+            if (failure != null) {
+                throw failure;
+            }
+        }
+    }
+
+    public void start() {
+        try {
+            doTest();
+        } catch (Exception e) {
+            failure = e;
+        }
+        mainThread.interrupt();
+    }
+
+    public void doTest() {
+        System.out.println("WindowTest {");
+
+        ResourceBundle rb;
+        Frame myFrame;
+
+        // Create a window containing a hierarchy of components.
+        System.out.println("  Creating component hierarchy...");
+        myFrame = new Frame();
+        myFrame.setLayout(new FlowLayout());
+        Panel panel1 = new Panel();
+        panel1.setLayout(new BorderLayout());
+        panel1.add("North", new Button("North"));
+        panel1.add("South", new Button("South"));
+        panel1.add("East", new Button("East"));
+        panel1.add("West", new Button("West"));
+        panel1.add("Center", new Button("Center"));
+        myFrame.add(panel1);
+
+        Panel panel2 = new Panel();
+        panel2.setLayout(new BorderLayout());
+        panel2.add(BorderLayout.BEFORE_FIRST_LINE, new Button("FirstLine"));
+        panel2.add(BorderLayout.AFTER_LAST_LINE, new Button("LastLine"));
+        panel2.add(BorderLayout.BEFORE_LINE_BEGINS, new Button("FirstItem"));
+        panel2.add(BorderLayout.AFTER_LINE_ENDS, new Button("LastItem"));
+        panel2.add("Center", new Button("Center"));
+        myFrame.add(panel2);
+
+        // After construction, all of the components' orientations should be
+        // set to ComponentOrientation.UNKNOWN.
+        System.out.println("  Verifying orientation is UNKNOWN...");
+        verifyOrientation(myFrame, ComponentOrientation.UNKNOWN);
+
+        // This will load TestBundle1 using the default locale and apply
+        // it to the component hierarchy.  Since the bundle has no Orientation
+        // specified, this should fall back to the bundle-locale's orientation
+        System.out.println("  Applying TestBundle1 by name and verifying...");
+        myFrame.applyResourceBundle("TestBundle1");
+        verifyOrientation(myFrame,
+                    ComponentOrientation.getOrientation(
+                        ResourceBundle.getBundle("TestBundle1", Locale.getDefault())));
+
+        System.out.println("  Applying TestBundle_iw and verifying...");
+        rb = ResourceBundle.getBundle("TestBundle", new Locale("iw", ""));
+        myFrame.applyResourceBundle(rb);
+        verifyOrientation(myFrame, ComponentOrientation.RIGHT_TO_LEFT);
+
+        System.out.println("  Applying TestBundle_es and verifying...");
+        rb = ResourceBundle.getBundle("TestBundle", new Locale("es", ""));
+        myFrame.applyResourceBundle(rb);
+        verifyOrientation(myFrame, ComponentOrientation.LEFT_TO_RIGHT);
+
+
+        myFrame.setVisible(false);
+        myFrame.dispose();
+        System.out.println("}");
+    }
+
+    static void verifyOrientation(Component c, ComponentOrientation orient) {
+
+        ComponentOrientation o = c.getComponentOrientation();
+
+        if (o != orient) {
+            throw new RuntimeException("ERROR: expected " + oString(orient) +
+                                        ", got " + oString(o) +
+                                        " on component " + c);
+        }
+
+        if (c instanceof Container) {
+            Container cont = (Container) c;
+            int ncomponents = cont.getComponentCount();
+
+            for (int i = 0 ; i < ncomponents ; ++i) {
+                Component comp = cont.getComponent(i);
+                verifyOrientation(comp, orient);
+            }
+        }
+    }
+
+    static String oString(ComponentOrientation o) {
+        if (o == ComponentOrientation.LEFT_TO_RIGHT) {
+            return "LEFT_TO_RIGHT";
+        }
+        else if (o == ComponentOrientation.RIGHT_TO_LEFT) {
+            return "RIGHT_TO_LEFT";
+        }
+        else {
+            return "UNKNOWN";
+        }
+    }
+}
--- a/jdk/test/java/lang/StackWalker/VerifyStackTrace.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/test/java/lang/StackWalker/VerifyStackTrace.java	Wed Jun 01 15:27:49 2016 -0700
@@ -202,7 +202,7 @@
             // synthetic frames introduced by lambdas & method handles
             return produced.replaceAll(":[1-9][0-9]*\\)", ":00)")
                     .replaceAll("-internal/", "/").replaceAll("-ea/", "/")
-                    .replaceAll("java.base@[0-9]+/", "java.base/")
+                    .replaceAll("java.base@(\\d+\\.){0,3}(\\d+)/", "java.base/")
                     .replaceAll("/[0-9]+\\.run", "/xxxxxxxx.run")
                     .replaceAll("/[0-9]+\\.invoke", "/xxxxxxxx.invoke")
                     .replaceAll("\\$[0-9]+", "\\$??");
--- a/jdk/test/java/lang/module/ModuleReader/ModuleReaderTest.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/test/java/lang/module/ModuleReader/ModuleReaderTest.java	Wed Jun 01 15:27:49 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -38,6 +38,7 @@
 import java.lang.module.ModuleFinder;
 import java.lang.module.ModuleReader;
 import java.lang.module.ModuleReference;
+import java.lang.reflect.Module;
 import java.net.URI;
 import java.net.URL;
 import java.net.URLConnection;
@@ -64,16 +65,24 @@
     private static final Path SRC_DIR    = Paths.get(TEST_SRC, "src");
     private static final Path MODS_DIR   = Paths.get("mods");
 
+    // the module name of the base module
+    private static final String BASE_MODULE = "java.base";
+
     // the module name of the test module
     private static final String TEST_MODULE = "m";
 
+    // resources in the base module
+    private static final String[] BASE_RESOURCES = {
+        "java/lang/Object.class"
+    };
+
     // resources in test module (can't use module-info.class as a test
     // resource as it will be modified by the jmod tool)
-    private static final String[] RESOURCES = {
+    private static final String[] TEST_RESOURCES = {
         "p/Main.class"
     };
 
-    // a resource that is not in the test module
+    // a resource that is not in the base or test module
     private static final String NOT_A_RESOURCE = "NotAResource";
 
 
@@ -89,7 +98,74 @@
 
 
     /**
-     * Test exploded module
+     * Test ModuleReader to module in runtime image
+     */
+    public void testImage() throws Exception {
+
+        ModuleFinder finder = ModuleFinder.ofSystem();
+        ModuleReference mref = finder.find(BASE_MODULE).get();
+        ModuleReader reader = mref.open();
+
+        try (reader) {
+
+            for (String name : BASE_RESOURCES) {
+                byte[] expectedBytes;
+                Module baseModule = Object.class.getModule();
+                try (InputStream in = baseModule.getResourceAsStream(name)) {
+                    expectedBytes = in.readAllBytes();
+                }
+
+                testFind(reader, name, expectedBytes);
+                testOpen(reader, name, expectedBytes);
+                testRead(reader, name, expectedBytes);
+
+            }
+
+            // test "not found"
+            assertFalse(reader.find(NOT_A_RESOURCE).isPresent());
+            assertFalse(reader.open(NOT_A_RESOURCE).isPresent());
+            assertFalse(reader.read(NOT_A_RESOURCE).isPresent());
+
+
+            // test nulls
+            try {
+                reader.find(null);
+                assertTrue(false);
+            } catch (NullPointerException expected) { }
+
+            try {
+                reader.open(null);
+                assertTrue(false);
+            } catch (NullPointerException expected) { }
+
+            try {
+                reader.read(null);
+                assertTrue(false);
+            } catch (NullPointerException expected) { }
+
+            try {
+                reader.release(null);
+                assertTrue(false);
+            } catch (NullPointerException expected) { }
+
+        }
+
+        // test closed ModuleReader
+        try {
+            reader.open(BASE_RESOURCES[0]);
+            assertTrue(false);
+        } catch (IOException expected) { }
+
+
+        try {
+            reader.read(BASE_RESOURCES[0]);
+            assertTrue(false);
+        } catch (IOException expected) { }
+    }
+
+
+    /**
+     * Test ModuleReader to exploded module
      */
     public void testExplodedModule() throws Exception {
         test(MODS_DIR);
@@ -97,7 +173,7 @@
 
 
     /**
-     * Test modular JAR
+     * Test ModuleReader to modular JAR
      */
     public void testModularJar() throws Exception {
         Path dir = Files.createTempDirectory(USER_DIR, "mlib");
@@ -111,7 +187,7 @@
 
 
     /**
-     * Test JMOD
+     * Test ModuleReader to JMOD
      */
     public void testJMod() throws Exception {
         Path dir = Files.createTempDirectory(USER_DIR, "mlib");
@@ -145,7 +221,7 @@
         try (reader) {
 
             // test each of the known resources in the module
-            for (String name : RESOURCES) {
+            for (String name : TEST_RESOURCES) {
                 byte[] expectedBytes
                     = Files.readAllBytes(MODS_DIR
                         .resolve(TEST_MODULE)
@@ -157,6 +233,7 @@
             }
 
             // test "not found"
+            assertFalse(reader.find(NOT_A_RESOURCE).isPresent());
             assertFalse(reader.open(NOT_A_RESOURCE).isPresent());
             assertFalse(reader.read(NOT_A_RESOURCE).isPresent());
 
@@ -176,19 +253,22 @@
                 assertTrue(false);
             } catch (NullPointerException expected) { }
 
-            // should release(null) throw NPE?
+            try {
+                reader.release(null);
+                throw new RuntimeException();
+            } catch (NullPointerException expected) { }
 
         }
 
         // test closed ModuleReader
         try {
-            reader.open(RESOURCES[0]);
+            reader.open(TEST_RESOURCES[0]);
             assertTrue(false);
         } catch (IOException expected) { }
 
 
         try {
-            reader.read(RESOURCES[0]);
+            reader.read(TEST_RESOURCES[0]);
             assertTrue(false);
         } catch (IOException expected) { }
     }
--- a/jdk/test/java/lang/reflect/Layer/BasicLayerTest.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/test/java/lang/reflect/Layer/BasicLayerTest.java	Wed Jun 01 15:27:49 2016 -0700
@@ -103,7 +103,7 @@
 
 
     /**
-     * Exercise Layer.create, created on an empty layer
+     * Exercise Layer defineModules, created with empty layer as parent
      */
     public void testLayerOnEmpty() {
         ModuleDescriptor descriptor1
@@ -184,7 +184,7 @@
 
 
     /**
-     * Exercise Layer.create, created over the boot layer
+     * Exercise Layer defineModules, created with boot layer as parent
      */
     public void testLayerOnBoot() {
         ModuleDescriptor descriptor1
@@ -247,8 +247,8 @@
 
 
     /**
-     * Layer.create with a configuration of two modules that have the same
-     * module-private package.
+     * Exercise Layer defineModules with a configuration of two modules that
+     * have the same module-private package.
      */
     public void testSameConcealedPackage() {
         ModuleDescriptor descriptor1
@@ -281,8 +281,8 @@
 
 
     /**
-     * Layer.create with a configuration with a partitioned graph. The same
-     * package is exported in both partitions.
+     * Exercise Layer defineModules with a configuration that is a partitioned
+     * graph. The same package is exported in both partitions.
      */
     public void testSameExportInPartitionedGraph() {
 
@@ -338,9 +338,9 @@
 
 
     /**
-     * Layer.create with a configuration that contains a module that has a
-     * concealed package that is the same name as a non-exported package
-     * in a parent layer.
+     * Exercise Layer defineModules with a configuration that contains a module
+     * that has a concealed package that is the same name as a non-exported
+     * package in a parent layer.
      */
     public void testConcealSamePackageAsBootLayer() {
 
@@ -667,9 +667,9 @@
 
 
     /**
-     * Attempt to use Layer.create to create a layer with a module defined to a
-     * class loader that already has a module of the same name defined to the
-     * class loader.
+     * Attempt to use Layer defineModules to create a layer with a module
+     * defined to a class loader that already has a module of the same name
+     * defined to the class loader.
      */
     @Test(expectedExceptions = { LayerInstantiationException.class })
     public void testModuleAlreadyDefinedToLoader() {
@@ -696,9 +696,9 @@
 
 
     /**
-     * Attempt to use Layer.create to create a Layer with a module containing
-     * package {@code p} where the class loader already has a module defined
-     * to it containing package {@code p}.
+     * Attempt to use Layer defineModules to create a Layer with a module
+     * containing package {@code p} where the class loader already has a module
+     * defined to it containing package {@code p}.
      */
     @Test(expectedExceptions = { LayerInstantiationException.class })
     public void testPackageAlreadyInNamedModule() {
@@ -738,8 +738,9 @@
 
 
     /**
-     * Attempt to use Layer.create to create a Layer with a module containing
-     * a package in which a type is already loaded by the class loader.
+     * Attempt to use Layer defineModules to create a Layer with a module
+     * containing a package in which a type is already loaded by the class
+     * loader.
      */
     @Test(expectedExceptions = { LayerInstantiationException.class })
     public void testPackageAlreadyInUnnamedModule() throws Exception {
@@ -763,6 +764,46 @@
 
 
     /**
+     * Attempt to create a Layer with a module named "java.base".
+     */
+    public void testLayerWithJavaBase() {
+        ModuleDescriptor descriptor
+            = new ModuleDescriptor.Builder("java.base")
+                .exports("java.lang")
+                .build();
+
+        ModuleFinder finder = ModuleUtils.finderOf(descriptor);
+
+        Configuration cf = Layer.boot()
+            .configuration()
+            .resolveRequires(finder, ModuleFinder.of(), Set.of("java.base"));
+        assertTrue(cf.modules().size() == 1);
+
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+
+        try {
+            Layer.boot().defineModules(cf, loader -> null );
+            assertTrue(false);
+        } catch (LayerInstantiationException e) { }
+
+        try {
+            Layer.boot().defineModules(cf, loader -> new ClassLoader() { });
+            assertTrue(false);
+        } catch (LayerInstantiationException e) { }
+
+        try {
+            Layer.boot().defineModulesWithOneLoader(cf, scl);
+            assertTrue(false);
+        } catch (LayerInstantiationException e) { }
+
+        try {
+            Layer.boot().defineModulesWithManyLoaders(cf, scl);
+            assertTrue(false);
+        } catch (LayerInstantiationException e) { }
+    }
+
+
+    /**
      * Parent of configuration != configuration of parent Layer
      */
     @Test(expectedExceptions = { IllegalArgumentException.class })
@@ -812,7 +853,6 @@
 
     @Test(expectedExceptions = { NullPointerException.class })
     public void testCreateWithNull2() {
-        ClassLoader loader = new ClassLoader() { };
         Configuration cf = resolveRequires(Layer.boot().configuration(), ModuleFinder.of());
         Layer.boot().defineModules(cf, null);
     }
--- a/jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java	Fri May 20 00:02:55 2016 -0700
+++ b/jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java	Wed Jun 01 15:27:49 2016 -0700
@@ -70,7 +70,7 @@
 
 
     /**
-     * Basic test of Layer.defineModulesWithOneLoader
+     * Basic test of Layer defineModulesWithOneLoader
      *
      * Test scenario:
      *   m1 requires m2 and m3
@@ -99,7 +99,7 @@
 
 
     /**
-     * Basic test of Layer.defineModulesWithManyLoaders
+     * Basic test of Layer defineModulesWithManyLoaders
      *
      * Test scenario:
      *   m1 requires m2 and m3
@@ -131,7 +131,7 @@
 
 
     /**
-     * Basic test of Layer.defineModulesWithOneLoader where one of the modules
+     * Basic test of Layer defineModulesWithOneLoader where one of the modules
      * is a service provider module.
      *
      * Test scenario:
@@ -172,8 +172,8 @@
 
 
     /**
-     * Basic test of Layer.defineModulesWithManyLoaders where one of the modules
-     * is a service provider module.
+     * Basic test of Layer defineModulesWithManyLoaders where one of the
+     * modules is a service provider module.
      *
      * Test scenario:
      *    m1 requires m2 and m3
@@ -224,7 +224,7 @@
 
 
     /**
-     * Tests that the class loaders created by Layer.createWithXXX delegate
+     * Tests that the class loaders created by defineModulesWithXXX delegate
      * to the given parent class loader.
      */
     public void testDelegationToParent() throws Exception {
@@ -254,7 +254,7 @@
 
 
     /**
-     * Test Layer.createWithXXX when modules that have overlapping packages.
+     * Test defineModulesWithXXX when modules that have overlapping packages.
      *
      * Test scenario:
      *   m1 exports p
@@ -288,7 +288,7 @@
 
 
     /**
-     * Test Layer.createWithXXX with split delegation.
+     * Test Layer defineModulesWithXXX with split delegation.
      *
      * Test scenario:
      *   layer1: m1 exports p, m2 exports p
@@ -319,7 +319,8 @@
 
         ModuleFinder finder2 = ModuleUtils.finderOf(descriptor3, descriptor4);
 
-        Configuration cf2 = cf1.resolveRequires(finder2, ModuleFinder.of(), Set.of("m3", "m4"));
+        Configuration cf2 = cf1.resolveRequires(finder2, ModuleFinder.of(),
+                                                Set.of("m3", "m4"));
 
         // package p cannot be supplied by two class loaders
         try {
@@ -335,8 +336,8 @@
 
 
     /**
-     * Test Layer.createWithXXX when the modules that override same named
-     * modules in the parent layer.
+     * Test Layer defineModulesWithXXX when the modules that override same
+     * named modules in the parent layer.
      *
      * Test scenario:
      *   layer1: m1, m2, m3 => same loader
@@ -350,7 +351,8 @@
         checkLayer(layer1, "m1", "m2", "m3");
 
         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(),
+                                                Set.of("m1"));
 
         Layer layer2 = layer1.defineModulesWithOneLoader(cf2, null);
         checkLayer(layer2, "m1", "m2", "m3");
@@ -383,8 +385,8 @@
 
 
     /**
-     * Test Layer.createWithXXX when the modules that override same named
-     * modules in the parent layer.
+     * Test Layer defineModulesWithXXX when the modules that override same
+     * named modules in the parent layer.
      *
      * Test scenario:
      *   layer1: m1, m2, m3 => loader pool
@@ -398,7 +400,8 @@
         checkLayer(layer1, "m1", "m2", "m3");
 
         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(),
+                                                Set.of("m1"));
 
         Layer layer2 = layer1.defineModulesWithManyLoaders(cf2, null);
         checkLayer(layer2, "m1", "m2", "m3");
@@ -477,8 +480,8 @@
 
 
     /**
-     * Test Layer.createWithXXX when the modules that override same named
-     * modules in the parent layer.
+     * Test Layer defineModulesWithXXX when the modules that override same
+     * named modules in the parent layer.
      *
      * layer1: m1, m2, m3 => same loader
      * layer2: m1, m3 => same loader
@@ -492,7 +495,8 @@
 
         ModuleFinder finder = finderFor("m1", "m3");
 
-        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(),
+                                                Set.of("m1"));
 
         Layer layer2 = layer1.defineModulesWithOneLoader(cf2, null);
         checkLayer(layer2, "m1", "m3");
@@ -513,8 +517,8 @@
 
 
     /**
-     * Test Layer.createWithXXX when the modules that override same named
-     * modules in the parent layer.
+     * Test Layer defineModulesWithXXX when the modules that override same
+     * named modules in the parent layer.
      *
      * layer1: m1, m2, m3 => loader pool
      * layer2: m1, m3 => loader pool
@@ -528,7 +532,8 @@
 
         ModuleFinder finder = finderFor("m1", "m3");
 
-        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(),
+                                                Set.of("m1"));
 
         Layer layer2 = layer1.defineModulesWithManyLoaders(cf2, null);
         checkLayer(layer2, "m1", "m3");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/reflect/Module/WithSecurityManager.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,147 @@
+/*
+ * 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
+ * @modules java.logging
+ * @summary Test java.lang.reflect.Module methods that specify permission checks
+ * @run main/othervm -Djava.security.policy=${test.src}/allow.policy WithSecurityManager allow
+ * @run main/othervm WithSecurityManager deny
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.module.Configuration;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReference;
+import java.lang.reflect.Layer;
+import java.lang.reflect.Module;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Set;
+
+/**
+ * Test java.lang.reflect.Module methods that specify permission checks.
+ */
+
+public class WithSecurityManager {
+
+    // a module that will be loaded into a child layer
+    static final String ANOTHER_MODULE          = "java.logging";
+    static final String ANOTHER_MODULE_RESOURCE = "java/util/logging/Logger.class";
+
+    public static void main(String[] args) throws IOException {
+        boolean allow = args[0].equals("allow");
+
+        // base module, in the boot layer
+        Module base = Object.class.getModule();
+
+        // another module, in a child layer
+        Module other = loadModuleInChildLayer(ANOTHER_MODULE);
+        assertTrue(other.getLayer() != Layer.boot());
+
+        System.setSecurityManager(new SecurityManager());
+
+        test(base, "java/lang/Object.class", allow);
+        test(other, ANOTHER_MODULE_RESOURCE, allow);
+    }
+
+    /**
+     * Test the permission checks by invoking methods on the given module.
+     *
+     * If {@code allow} is {@code true} then the permission checks should succeed.
+     */
+    static void test(Module m, String name, boolean allow) throws IOException {
+
+        // test Module::getClassLoader
+        System.out.format("Test getClassLoader on %s ...%n", m);
+        try {
+            ClassLoader cl = m.getClassLoader();
+            System.out.println(cl);
+            if (!allow)
+                assertTrue("getClassLoader should have failed", false);
+        } catch (SecurityException e) {
+            System.out.println(e + " thrown");
+            if (allow)
+                throw e;
+        }
+
+        // test Module::getResourceAsStream
+        System.out.format("Test getResourceAsStream(\"%s\") on %s ...%n", name, m);
+        try (InputStream in = m.getResourceAsStream(name)) {
+            System.out.println(in);
+            if (allow && (in == null))
+                assertTrue(name + " not found", false);
+            if (!allow && (in != null))
+                assertTrue(name + " should not be found", false);
+        }
+
+    }
+
+    /**
+     * Create a module layer that contains the given system module.
+     */
+    static Module loadModuleInChildLayer(String mn) {
+        Optional<ModuleReference> omref = ModuleFinder.ofSystem().find(mn);
+        assertTrue("module " + mn + " not a system module", omref.isPresent());
+
+        // create a ModuleFinder that only finds this module
+        ModuleReference mref = omref.get();
+        ModuleFinder finder = new ModuleFinder() {
+            @Override
+            public Optional<ModuleReference> find(String name) {
+                if (name.equals(mn))
+                    return Optional.of(mref);
+                else
+                    return Optional.empty();
+            }
+
+            @Override
+            public Set<ModuleReference> findAll() {
+                return Collections.singleton(mref);
+            }
+        };
+
+        // create a child configuration and layer with this module
+        Layer bootLayer = Layer.boot();
+        Configuration cf = bootLayer
+            .configuration()
+            .resolveRequires(finder, ModuleFinder.of(), Set.of(ANOTHER_MODULE));
+        Layer layer = bootLayer.defineModulesWithOneLoader(cf, null);
+
+        Optional<Module> om = layer.findModule(mn);
+        assertTrue("module " + mn + " not in child layer", om.isPresent());
+        return om.get();
+    }
+
+    static void assertTrue(String msg, boolean e) {
+        if (!e)
+            throw new RuntimeException(msg);
+    }
+
+    static void assertTrue(boolean e) {
+        if (!e)
+            throw new RuntimeException();
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/reflect/Module/allow.policy	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+grant {
+    permission java.lang.RuntimePermission "getClassLoader";
+    permission java.io.FilePermission "${java.home}/-", "read";
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/Inet6Address/PreferIPv6AddressesTest.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,132 @@
+/*
+ * 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 8016521
+ * @summary InetAddress should not always re-order addresses returned from name
+ *          service
+ * @run main/othervm -Djava.net.preferIPv6Addresses=false PreferIPv6AddressesTest
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true PreferIPv6AddressesTest
+ * @run main/othervm -Djava.net.preferIPv6Addresses=system PreferIPv6AddressesTest
+ * @run main/othervm PreferIPv6AddressesTest
+ */
+
+import java.io.IOException;
+import java.net.*;
+import java.nio.channels.DatagramChannel;
+import java.util.Arrays;
+import java.util.stream.IntStream;
+import static java.lang.System.out;
+
+public class PreferIPv6AddressesTest {
+
+    // A name, that if resolves, returns both IPv4 and IPv6 addresses.
+    static final String HOST_NAME = "www.google.com";
+
+    static final InetAddress LOOPBACK = InetAddress.getLoopbackAddress();
+
+    static final String preferIPV6Address =
+            System.getProperty("java.net.preferIPv6Addresses", "false");
+
+    public static void main(String args[]) throws IOException {
+
+        InetAddress addrs[];
+        try {
+            addrs = InetAddress.getAllByName(HOST_NAME);
+        } catch (UnknownHostException e) {
+            out.println("Unknown host " + HOST_NAME + ", cannot run test.");
+            return;
+        }
+
+        int firstIPv4Address = IntStream.range(0, addrs.length)
+                .filter(x -> addrs[x] instanceof Inet4Address)
+                .findFirst().orElse(-1);
+        int firstIPv6Address = IntStream.range(0, addrs.length)
+                .filter(x -> addrs[x] instanceof Inet6Address)
+                .findFirst().orElse(-1);
+
+        out.println("IPv6 supported: " + IPv6Supported());
+        out.println("Addresses: " + Arrays.asList(addrs));
+
+        if (preferIPV6Address.equalsIgnoreCase("true") && firstIPv6Address != -1) {
+            int off = firstIPv4Address != -1 ? firstIPv4Address : addrs.length;
+            assertAllv6Addresses(addrs, 0, off);
+            assertAllv4Addresses(addrs, off, addrs.length);
+            assertLoopbackAddress(Inet6Address.class);
+            assertAnyLocalAddress(Inet6Address.class);
+        } else if (preferIPV6Address.equalsIgnoreCase("false") && firstIPv4Address != -1) {
+            int off = firstIPv6Address != -1 ? firstIPv6Address : addrs.length;
+            assertAllv4Addresses(addrs, 0, off);
+            assertAllv6Addresses(addrs, off, addrs.length);
+            assertLoopbackAddress(Inet4Address.class);
+            assertAnyLocalAddress(Inet4Address.class);
+        } else if (preferIPV6Address.equalsIgnoreCase("system") && IPv6Supported()) {
+            assertLoopbackAddress(Inet6Address.class);
+            assertAnyLocalAddress(Inet6Address.class);
+        } else if (preferIPV6Address.equalsIgnoreCase("system") && !IPv6Supported()) {
+            assertLoopbackAddress(Inet4Address.class);
+            assertAnyLocalAddress(Inet4Address.class);
+        }
+    }
+
+    static void assertAllv4Addresses(InetAddress[] addrs, int off, int len) {
+        IntStream.range(off, len)
+                 .mapToObj(x -> addrs[x])
+                 .forEach(x -> {
+                     if (!(x instanceof Inet4Address))
+                         throw new RuntimeException("Expected IPv4, got " + x);
+                 });
+    }
+
+    static void assertAllv6Addresses(InetAddress[] addrs, int off, int len) {
+        IntStream.range(off, len)
+                .mapToObj(x -> addrs[x])
+                .forEach(x -> {
+                    if (!(x instanceof Inet6Address))
+                        throw new RuntimeException("Expected IPv6, got " + x);
+                });
+    }
+
+    static void assertLoopbackAddress(Class<?> expectedType) {
+        if (!LOOPBACK.getClass().isAssignableFrom(expectedType))
+            throw new RuntimeException("Expected " + expectedType
+                    + ", got " + LOOPBACK.getClass());
+    }
+
+    static void assertAnyLocalAddress(Class<?> expectedType) {
+        InetAddress anyAddr = (new InetSocketAddress(0)).getAddress();
+        if (!anyAddr.getClass().isAssignableFrom(expectedType))
+            throw new RuntimeException("Expected " + expectedType
+                    + ", got " + anyAddr.getClass());
+    }
+
+    static boolean IPv6Supported() throws IOException {
+        try {
+            DatagramChannel.open(StandardProtocolFamily.INET6);
+            return true;
+        } catch (UnsupportedOperationException x) {
+            return false;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/rmi/module/ModuleTest.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,159 @@
+/*
+ * 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
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.ProcessTools
+ *        ModuleTest CompilerUtils JarUtils
+ * @run testng ModuleTest
+ * @summary Basic tests for using rmi in module world
+ */
+
+import static jdk.testlibrary.ProcessTools.executeTestJava;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.nio.file.Paths;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+public class ModuleTest {
+
+    static String fileJoin(String... names) {
+        return String.join(File.separator, names);
+    }
+
+    static String pathJoin(String... paths) {
+        return String.join(File.pathSeparator, paths);
+    }
+
+    private static final String TEST_SRC = System.getProperty("test.src");
+    private static final String CLIENT_EXP = fileJoin("exploded", "mclient");
+    private static final String SERVER_EXP = fileJoin("exploded", "mserver");
+    private static final String MTEST_EXP  = fileJoin("exploded", "mtest");
+    private static final String CLIENT_JAR = fileJoin("mods", "mclient.jar");
+    private static final String SERVER_JAR = fileJoin("mods", "mserver.jar");
+    private static final String MTEST_JAR  = fileJoin("mods", "mtest.jar");
+
+    private static final String DUMMY_MAIN = "testpkg.DummyApp";
+
+    /**
+     * Compiles all sample classes
+     */
+    @BeforeTest
+    public void compileAll() throws Exception {
+        assertTrue(CompilerUtils.compile(
+                Paths.get(TEST_SRC, "src", "mserver"),
+                Paths.get(SERVER_EXP)));
+
+        JarUtils.createJarFile(
+                Paths.get(SERVER_JAR),
+                Paths.get(SERVER_EXP));
+
+        assertTrue(CompilerUtils.compile(
+                Paths.get(TEST_SRC, "src", "mclient"),
+                Paths.get(CLIENT_EXP),
+                "-cp", SERVER_JAR));
+
+        JarUtils.createJarFile(
+                Paths.get(CLIENT_JAR),
+                Paths.get(CLIENT_EXP));
+
+        assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "mtest"),
+                Paths.get(MTEST_EXP),
+                "-cp", pathJoin(CLIENT_JAR, SERVER_JAR)));
+
+        JarUtils.createJarFile(
+                Paths.get(MTEST_JAR),
+                Paths.get(MTEST_EXP));
+    }
+
+    /**
+     * Test the client, server and dummy application in different modules
+     * @throws Exception
+     */
+    @Test
+    public void testAllInModule() throws Exception {
+        assertEquals(executeTestJava("-mp", pathJoin(MTEST_JAR, CLIENT_JAR, SERVER_JAR),
+                "-addmods", "mclient,mserver",
+                "-m", "mtest/" + DUMMY_MAIN)
+                .outputTo(System.out)
+                .errorTo(System.out)
+                .getExitValue(),
+                0);
+    }
+
+    /**
+     * Test the client and server in unnamed modules,
+     * while the dummy application is in automatic module
+     * @throws Exception
+     */
+    @Test
+    public void testAppInModule() throws Exception {
+        assertEquals(executeTestJava("-mp", MTEST_JAR,
+                "-cp", pathJoin(CLIENT_JAR, SERVER_JAR),
+                "-m", "mtest/" + DUMMY_MAIN)
+                .outputTo(System.out)
+                .errorTo(System.out)
+                .getExitValue(),
+                0);
+    }
+
+    /**
+     * Test the client and server in automatic modules,
+     * while the dummy application is in unnamed module
+     * @throws Exception
+     */
+    @Test
+    public void testAppInUnnamedModule() throws Exception {
+        assertEquals(executeTestJava("-mp", pathJoin(CLIENT_JAR, SERVER_JAR),
+                "-addmods", "mclient,mserver",
+                "-cp", MTEST_JAR,
+                DUMMY_MAIN)
+                .outputTo(System.out)
+                .errorTo(System.out)
+                .getExitValue(),
+                0);
+    }
+
+    /**
+     * Test the server and test application in automatic modules,
+     * with client in unnamed module
+     * @throws Exception
+     */
+    @Test
+    public void testClientInUnamedModule() throws Exception {
+        assertEquals(executeTestJava("-mp", pathJoin(MTEST_JAR, SERVER_JAR),
+                "-addmods", "mserver",
+                "-cp", CLIENT_JAR,
+                "-m", "mtest/" + DUMMY_MAIN)
+                .outputTo(System.out)
+                .errorTo(System.out)
+                .getExitValue(),
+                0);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/rmi/module/src/mclient/clientpkg/Client.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,47 @@
+/*
+ * 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 clientpkg;
+
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+
+import serverpkg.Hello;
+
+public class Client {
+    int port;
+    Hello stub;
+
+    public Client(Hello stub) {
+        this.stub = stub;
+    }
+
+    public String testStub() throws Exception {
+        try {
+            return stub.sayHello();
+        } catch (Exception e) {
+            System.err.println("Client exception: " + e.toString());
+            throw e;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/rmi/module/src/mserver/serverpkg/Hello.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,32 @@
+/*
+ * 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 serverpkg;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface Hello extends Remote {
+
+    String sayHello() throws RemoteException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/rmi/module/src/mserver/serverpkg/Server.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,37 @@
+/*
+ * 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 serverpkg;
+
+public class Server implements Hello {
+
+    private final String hello = "Hello world!";
+
+    public Server() {
+    }
+
+    @Override
+    public String sayHello() {
+        return hello;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/rmi/module/src/mtest/testpkg/DummyApp.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,55 @@
+/*
+ * 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 testpkg;
+
+import java.rmi.server.UnicastRemoteObject;
+
+import clientpkg.Client;
+import serverpkg.Hello;
+import serverpkg.Server;
+
+public class DummyApp {
+
+    public static void main(String args[]) {
+        try {
+            Hello obj = new Server();
+            Hello stub = (Hello) UnicastRemoteObject.exportObject(obj, 0);
+
+            Client client = new Client(stub);
+            String testStubReturn = client.testStub();
+            System.out.println("Stub is: " + testStubReturn);
+            if (!testStubReturn.equals(obj.sayHello())) {
+                throw new RuntimeException("Unexpected string from stub call, expected \""
+                        + testStubReturn + "\", actual \"" + obj.sayHello() + "\"");
+            } else {
+                System.out.println("Test passed");
+            }
+
+            System.exit(0);
+        } catch (Throwable e) {
+            e.printStackTrace();
+            System.exit(-1);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/AttributedCharacterIterator/Attribute/ReadResolve.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 1998, 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 4136620 4144590
+   @summary Make sure that Attribute & subclasses are serialized and deserialized correctly
+   @modules java.desktop
+ */
+
+import java.text.AttributedCharacterIterator.Attribute;
+import java.awt.font.TextAttribute;
+import java.io.*;
+
+public class ReadResolve {
+
+    public static void main(String[] args) throws Exception {
+        testSerializationCycle(Attribute.LANGUAGE);
+        testSerializationCycle(TextAttribute.INPUT_METHOD_HIGHLIGHT);
+
+        boolean gotException = false;
+        Attribute result = null;
+        try {
+            result = doSerializationCycle(FakeAttribute.LANGUAGE);
+        } catch (Throwable e) {
+            gotException = true;
+        }
+        if (!gotException) {
+            throw new RuntimeException("Attribute should throw an exception when given a fake \"language\" attribute. Deserialized object: " + result);
+        }
+    }
+
+    static Attribute doSerializationCycle(Attribute attribute) throws Exception {
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream  oos  =  new  ObjectOutputStream(baos);
+        oos.writeObject(attribute);
+        oos.flush();
+
+        byte[] data = baos.toByteArray();
+
+        ByteArrayInputStream bais = new ByteArrayInputStream(data);
+        ObjectInputStream ois = new ObjectInputStream(bais);
+        Attribute result = (Attribute) ois.readObject();
+
+        return result;
+    }
+
+    static void testSerializationCycle(Attribute attribute) throws Exception {
+        Attribute result = doSerializationCycle(attribute);
+        if (result != attribute) {
+            throw new RuntimeException("attribute changed identity during serialization/deserialization");
+        }
+    }
+
+    private static class FakeAttribute extends Attribute {
+
+        // This LANGUAGE attribute should never be confused with the
+        // Attribute.LANGUAGE attribute. However, we don't override
+        // readResolve here, so that deserialization goes
+        // to Attribute. Attribute has to catch this problem and reject
+        // the fake attribute.
+        static final FakeAttribute LANGUAGE = new FakeAttribute("language");
+
+        FakeAttribute(String name) {
+            super(name);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/AttributedString/AttributedStringTest.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 1998, 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 4139771
+ * @summary test all aspects of AttributedString class
+ */
+
+import java.text.Annotation;
+import java.text.AttributedCharacterIterator;
+import java.text.AttributedCharacterIterator.Attribute;
+import java.text.AttributedString;
+import java.text.CharacterIterator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+
+public class AttributedStringTest {
+
+    private static final String text = "Hello, world!";
+    private static final Annotation hi = new Annotation("hi");
+    private static final int[] array5_13 = {5, 13};
+    private static final int[] array3_9_13 = {3, 9, 13};
+    private static final int[] array5_9_13 = {5, 9, 13};
+    private static final int[] array3_5_9_13 = {3, 5, 9, 13};
+    private static final Attribute[] arrayLanguage = {Attribute.LANGUAGE};
+    private static final Attribute[] arrayLanguageReading = {Attribute.LANGUAGE, Attribute.READING};
+    private static final Set setLanguageReading = new HashSet();
+    static {
+        setLanguageReading.add(Attribute.LANGUAGE);
+        setLanguageReading.add(Attribute.READING);
+    }
+
+
+    public static final void main(String argv[]) throws Exception {
+
+
+        AttributedString string;
+        AttributedCharacterIterator iterator;
+
+        // create a string with text, but no attributes
+        string = new AttributedString(text);
+        iterator = string.getIterator();
+
+        // make sure the text is there and attributes aren't
+        checkIteratorText(iterator, text);
+        if (!iterator.getAllAttributeKeys().isEmpty()) {
+            throwException(iterator, "iterator provides attributes where none are defined");
+        }
+
+        // add an attribute to a subrange
+        string.addAttribute(Attribute.LANGUAGE, Locale.ENGLISH, 3, 9);
+        iterator = string.getIterator();
+
+        // make sure the attribute is defined, and it's on the correct subrange
+        checkIteratorAttributeKeys(iterator, arrayLanguage);
+        checkIteratorSubranges(iterator, array3_9_13);
+        checkIteratorAttribute(iterator, 0, Attribute.LANGUAGE, null);
+        checkIteratorAttribute(iterator, 3, Attribute.LANGUAGE, Locale.ENGLISH);
+        checkIteratorAttribute(iterator, 9, Attribute.LANGUAGE, null);
+
+        // add an attribute to a subrange
+        string.addAttribute(Attribute.READING, hi, 0, 5);
+        iterator = string.getIterator();
+
+        // make sure the attribute is defined, and it's on the correct subrange
+        checkIteratorAttributeKeys(iterator, arrayLanguageReading);
+        checkIteratorSubranges(iterator, array3_5_9_13);
+        checkIteratorAttribute(iterator, 0, Attribute.READING, hi);
+        checkIteratorAttribute(iterator, 3, Attribute.READING, hi);
+        checkIteratorAttribute(iterator, 5, Attribute.READING, null);
+        checkIteratorAttribute(iterator, 9, Attribute.READING, null);
+
+        // make sure the first attribute wasn't adversely affected
+        // in particular, we shouldn't see separate subranges (3,5) and (5,9).
+        checkIteratorSubranges(iterator, Attribute.LANGUAGE, array3_9_13);
+        checkIteratorAttribute(iterator, 0, Attribute.LANGUAGE, null);
+        checkIteratorAttribute(iterator, 3, Attribute.LANGUAGE, Locale.ENGLISH);
+        checkIteratorAttribute(iterator, 5, Attribute.LANGUAGE, Locale.ENGLISH);
+        checkIteratorAttribute(iterator, 9, Attribute.LANGUAGE, null);
+
+        // for the entire set of attributes, we expect four subranges
+        checkIteratorSubranges(iterator, setLanguageReading, array3_5_9_13);
+
+        // redefine the language attribute so that both language and reading are continuous from 0 to 5
+        string.addAttribute(Attribute.LANGUAGE, Locale.US, 0, 5);
+        iterator = string.getIterator();
+
+        // make sure attributes got changed and merged correctly
+        checkIteratorAttributeKeys(iterator, arrayLanguageReading);
+        checkIteratorSubranges(iterator, array3_5_9_13);
+        checkIteratorSubranges(iterator, Attribute.LANGUAGE, array5_9_13);
+        checkIteratorSubranges(iterator, Attribute.READING, array5_13);
+        checkIteratorSubranges(iterator, setLanguageReading, array5_9_13);
+        checkIteratorAttribute(iterator, 0, Attribute.LANGUAGE, Locale.US);
+        checkIteratorAttribute(iterator, 3, Attribute.LANGUAGE, Locale.US);
+        checkIteratorAttribute(iterator, 5, Attribute.LANGUAGE, Locale.ENGLISH);
+        checkIteratorAttribute(iterator, 9, Attribute.LANGUAGE, null);
+
+        // make sure an annotation is only returned if its range is contained in the iterator's range
+        iterator = string.getIterator(null, 3, 5);
+        checkIteratorAttribute(iterator, 3, Attribute.READING, null);
+        checkIteratorAttribute(iterator, 5, Attribute.READING, null);
+        iterator = string.getIterator(null, 0, 4);
+        checkIteratorAttribute(iterator, 0, Attribute.READING, null);
+        checkIteratorAttribute(iterator, 3, Attribute.READING, null);
+        iterator = string.getIterator(null, 0, 5);
+        checkIteratorAttribute(iterator, 0, Attribute.READING, hi);
+        checkIteratorAttribute(iterator, 4, Attribute.READING, hi);
+        checkIteratorAttribute(iterator, 5, Attribute.READING, null);
+
+    }
+
+    private static final void checkIteratorText(AttributedCharacterIterator iterator, String expectedText) throws Exception {
+        if (iterator.getEndIndex() - iterator.getBeginIndex() != expectedText.length()) {
+            throwException(iterator, "text length doesn't match between original text and iterator");
+        }
+
+        char c = iterator.first();
+        for (int i = 0; i < expectedText.length(); i++) {
+            if (c != expectedText.charAt(i)) {
+                throwException(iterator, "text content doesn't match between original text and iterator");
+            }
+            c = iterator.next();
+        }
+        if (c != CharacterIterator.DONE) {
+            throwException(iterator, "iterator text doesn't end with DONE");
+        }
+    }
+
+    private static final void checkIteratorAttributeKeys(AttributedCharacterIterator iterator, Attribute[] expectedKeys) throws Exception {
+         Set iteratorKeys = iterator.getAllAttributeKeys();
+         if (iteratorKeys.size() != expectedKeys.length) {
+             throwException(iterator, "number of keys returned by iterator doesn't match expectation");
+         }
+         for (int i = 0; i < expectedKeys.length; i++) {
+             if (!iteratorKeys.contains(expectedKeys[i])) {
+                 throwException(iterator, "expected key wasn't found in iterator's key set");
+             }
+         }
+    }
+
+    private static final void checkIteratorSubranges(AttributedCharacterIterator iterator, int[] expectedLimits) throws Exception {
+        int previous = 0;
+        char c = iterator.first();
+        for (int i = 0; i < expectedLimits.length; i++) {
+             if (iterator.getRunStart() != previous || iterator.getRunLimit() != expectedLimits[i]) {
+                 throwException(iterator, "run boundaries are not as expected: " + iterator.getRunStart() + ", " + iterator.getRunLimit());
+             }
+             previous = expectedLimits[i];
+             c = iterator.setIndex(previous);
+        }
+        if (c != CharacterIterator.DONE) {
+            throwException(iterator, "iterator's run sequence doesn't end with DONE");
+        }
+    }
+
+    private static final void checkIteratorSubranges(AttributedCharacterIterator iterator, Attribute key, int[] expectedLimits) throws Exception {
+        int previous = 0;
+        char c = iterator.first();
+        for (int i = 0; i < expectedLimits.length; i++) {
+             if (iterator.getRunStart(key) != previous || iterator.getRunLimit(key) != expectedLimits[i]) {
+                 throwException(iterator, "run boundaries are not as expected: " + iterator.getRunStart(key) + ", " + iterator.getRunLimit(key) + " for key " + key);
+             }
+             previous = expectedLimits[i];
+             c = iterator.setIndex(previous);
+        }
+        if (c != CharacterIterator.DONE) {
+            throwException(iterator, "iterator's run sequence doesn't end with DONE");
+        }
+    }
+
+    private static final void checkIteratorSubranges(AttributedCharacterIterator iterator, Set keys, int[] expectedLimits) throws Exception {
+        int previous = 0;
+        char c = iterator.first();
+        for (int i = 0; i < expectedLimits.length; i++) {
+             if (iterator.getRunStart(keys) != previous || iterator.getRunLimit(keys) != expectedLimits[i]) {
+                 throwException(iterator, "run boundaries are not as expected: " + iterator.getRunStart(keys) + ", " + iterator.getRunLimit(keys) + " for keys " + keys);
+             }
+             previous = expectedLimits[i];
+             c = iterator.setIndex(previous);
+        }
+        if (c != CharacterIterator.DONE) {
+            throwException(iterator, "iterator's run sequence doesn't end with DONE");
+        }
+    }
+
+    private static final void checkIteratorAttribute(AttributedCharacterIterator iterator, int index, Attribute key, Object expectedValue) throws Exception {
+        iterator.setIndex(index);
+        Object value = iterator.getAttribute(key);
+        if (!((expectedValue == null && value == null) || (expectedValue != null && expectedValue.equals(value)))) {
+            throwException(iterator, "iterator returns wrong attribute value - " + value + " instead of " + expectedValue);
+        }
+        value = iterator.getAttributes().get(key);
+        if (!((expectedValue == null && value == null) || (expectedValue != null && expectedValue.equals(value)))) {
+            throwException(iterator, "iterator's map returns wrong attribute value - " + value + " instead of " + expectedValue);
+        }
+    }
+
+    private static final void throwException(AttributedCharacterIterator iterator, String details) throws Exception {
+        dumpIterator(iterator);
+        throw new Exception(details);
+    }
+
+    private static final void dumpIterator(AttributedCharacterIterator iterator) {
+        Set attributeKeys = iterator.getAllAttributeKeys();
+        System.out.print("All attributes: ");
+        Iterator keyIterator = attributeKeys.iterator();
+        while (keyIterator.hasNext()) {
+            Attribute key = (Attribute) keyIterator.next();
+            System.out.print(key);
+        }
+        for(char c = iterator.first(); c != CharacterIterator.DONE; c = iterator.next()) {
+            if (iterator.getIndex() == iterator.getBeginIndex() ||
+                        iterator.getIndex() == iterator.getRunStart()) {
+                System.out.println();
+                Map attributes = iterator.getAttributes();
+                Set entries = attributes.entrySet();
+                Iterator attributeIterator = entries.iterator();
+                while (attributeIterator.hasNext()) {
+                    Map.Entry entry = (Map.Entry) attributeIterator.next();
+                    System.out.print("<" + entry.getKey() + ": "
+                                + entry.getValue() + ">");
+                }
+            }
+            System.out.print(" ");
+            System.out.print(c);
+        }
+        System.out.println();
+        System.out.println("done");
+        System.out.println();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/AttributedString/TestAttributedStringCtor.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 1998, 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 4146853
+ * @summary Make sure we can construct an AttributedString from
+ * an AttributedCharacterIterator covering only a subrange
+ * @modules java.desktop
+ */
+
+import java.awt.font.TextAttribute;
+import java.text.AttributedCharacterIterator;
+import java.text.AttributedString;
+import java.util.Hashtable;
+
+public class TestAttributedStringCtor {
+
+    public static void main(String[] args) {
+
+        // Create a new AttributedString with one attribute.
+        Hashtable attributes = new Hashtable();
+        attributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
+        AttributedString origString = new AttributedString("Hello world.", attributes);
+
+        // Create an iterator over part of the AttributedString.
+        AttributedCharacterIterator iter = origString.getIterator(null, 4, 6);
+
+        // Attempt to create a new AttributedString from the iterator.
+        // This will throw IllegalArgumentException.
+        AttributedString newString = new AttributedString(iter);
+
+        // Without the exception this would get executed.
+        System.out.println("DONE");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/AttributedString/getRunStartLimitTest.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 1998, 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 4151160
+ * @summary Make sure to return correct run start and limit values
+ * when the iterator has been created with begin and end index values.
+ * @modules java.desktop
+ */
+
+import java.awt.font.TextAttribute;
+import java.text.AttributedCharacterIterator;
+import java.text.AttributedString;
+import java.text.Annotation;
+
+public class getRunStartLimitTest {
+
+    public static void main(String[] args) throws Exception {
+
+        String text = "Hello world";
+        AttributedString as = new AttributedString(text);
+
+        // add non-Annotation attributes
+        as.addAttribute(TextAttribute.WEIGHT,
+                        TextAttribute.WEIGHT_LIGHT,
+                        0,
+                        3);
+        as.addAttribute(TextAttribute.WEIGHT,
+                        TextAttribute.WEIGHT_BOLD,
+                        3,
+                        5);
+        as.addAttribute(TextAttribute.WEIGHT,
+                        TextAttribute.WEIGHT_EXTRABOLD,
+                        5,
+                        text.length());
+
+        // add Annotation attributes
+        as.addAttribute(TextAttribute.WIDTH,
+                        new Annotation(TextAttribute.WIDTH_EXTENDED),
+                        0,
+                        3);
+        as.addAttribute(TextAttribute.WIDTH,
+                        new Annotation(TextAttribute.WIDTH_CONDENSED),
+                        3,
+                        4);
+
+        AttributedCharacterIterator aci = as.getIterator(null, 2, 4);
+
+        aci.first();
+        int runStart = aci.getRunStart();
+        if (runStart != 2) {
+            throw new Exception("1st run start is wrong. ("+runStart+" should be 2.)");
+        }
+
+        int runLimit = aci.getRunLimit();
+        if (runLimit != 3) {
+            throw new Exception("1st run limit is wrong. ("+runLimit+" should be 3.)");
+        }
+
+        Object value = aci.getAttribute(TextAttribute.WEIGHT);
+        if (value != TextAttribute.WEIGHT_LIGHT) {
+            throw new Exception("1st run attribute is wrong. ("
+                                +value+" should be "+TextAttribute.WEIGHT_LIGHT+".)");
+        }
+
+        value = aci.getAttribute(TextAttribute.WIDTH);
+        if (value != null) {
+            throw new Exception("1st run annotation is wrong. ("
+                                +value+" should be null.)");
+        }
+
+        aci.setIndex(runLimit);
+        runStart = aci.getRunStart();
+        if (runStart != 3) {
+            throw new Exception("2nd run start is wrong. ("+runStart+" should be 3.)");
+        }
+
+        runLimit = aci.getRunLimit();
+        if (runLimit != 4) {
+            throw new Exception("2nd run limit is wrong. ("+runLimit+" should be 4.)");
+        }
+        value = aci.getAttribute(TextAttribute.WEIGHT);
+        if (value != TextAttribute.WEIGHT_BOLD) {
+            throw new Exception("2nd run attribute is wrong. ("
+                                +value+" should be "+TextAttribute.WEIGHT_BOLD+".)");
+        }
+
+        value = aci.getAttribute(TextAttribute.WIDTH);
+        if (!(value instanceof Annotation)
+            || (((Annotation)value).getValue() !=  TextAttribute.WIDTH_CONDENSED)) {
+            throw new Exception("2nd run annotation is wrong. (" + value + " should be "
+                                + new Annotation(TextAttribute.WIDTH_CONDENSED)+".)");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/BreakIterator/BreakIteratorTest.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,1438 @@
+/*
+ * Copyright (c) 1996, 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 4035266 4052418 4068133 4068137 4068139 4086052 4095322 4097779
+ *      4097920 4098467 4111338 4113835 4117554 4143071 4146175 4152117
+ *      4152416 4153072 4158381 4214367 4217703 4638433
+ * @library /java/text/testlib
+ * @run main/timeout=2000 BreakIteratorTest
+ * @summary test BreakIterator
+ */
+
+/*
+ *
+ *
+ * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
+ *
+ * Portions copyright (c) 2007 Sun Microsystems, Inc.
+ * All Rights Reserved.
+ *
+ * The original version of this source code and documentation
+ * is copyrighted and owned by Taligent, Inc., a wholly-owned
+ * subsidiary of IBM. These materials are provided under terms
+ * of a License Agreement between Taligent and Sun. This technology
+ * is protected by multiple US and International patents.
+ *
+ * This notice and attribution to Taligent may not be removed.
+ * Taligent is a registered trademark of Taligent, Inc.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * and its documentation for NON-COMMERCIAL purposes and without
+ * fee is hereby granted provided that this copyright notice
+ * appears in all copies. Please refer to the file "copyright.html"
+ * for further important copyright and licensing information.
+ *
+ * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
+ * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+ * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+ *
+ */
+
+import java.text.BreakIterator;
+import java.text.CharacterIterator;
+import java.text.StringCharacterIterator;
+import java.util.Locale;
+import java.util.Vector;
+import java.util.Enumeration;
+import java.io.*;
+
+public class BreakIteratorTest extends IntlTest
+{
+    private BreakIterator characterBreak;
+    private BreakIterator wordBreak;
+    private BreakIterator lineBreak;
+    private BreakIterator sentenceBreak;
+
+    public static void main(String[] args) throws Exception {
+        new BreakIteratorTest().run(args);
+    }
+
+    public BreakIteratorTest()
+    {
+        characterBreak = BreakIterator.getCharacterInstance();
+        wordBreak = BreakIterator.getWordInstance();
+        lineBreak = BreakIterator.getLineInstance();
+        sentenceBreak = BreakIterator.getSentenceInstance();
+    }
+
+    //=========================================================================
+    // general test subroutines
+    //=========================================================================
+
+    private void generalIteratorTest(BreakIterator bi, Vector expectedResult) {
+        StringBuffer buffer = new StringBuffer();
+        String text;
+        for (int i = 0; i < expectedResult.size(); i++) {
+            text = (String)expectedResult.elementAt(i);
+            buffer.append(text);
+        }
+        text = buffer.toString();
+
+        bi.setText(text);
+
+        Vector nextResults = testFirstAndNext(bi, text);
+        Vector previousResults = testLastAndPrevious(bi, text);
+
+        logln("comparing forward and backward...");
+        int errs = getErrorCount();
+        compareFragmentLists("forward iteration", "backward iteration", nextResults,
+                        previousResults);
+        if (getErrorCount() == errs) {
+            logln("comparing expected and actual...");
+            compareFragmentLists("expected result", "actual result", expectedResult,
+                            nextResults);
+        }
+
+        int[] boundaries = new int[expectedResult.size() + 3];
+        boundaries[0] = BreakIterator.DONE;
+        boundaries[1] = 0;
+        for (int i = 0; i < expectedResult.size(); i++)
+            boundaries[i + 2] = boundaries[i + 1] + ((String)expectedResult.elementAt(i)).
+                            length();
+        boundaries[boundaries.length - 1] = BreakIterator.DONE;
+
+        testFollowing(bi, text, boundaries);
+        testPreceding(bi, text, boundaries);
+        testIsBoundary(bi, text, boundaries);
+
+        doMultipleSelectionTest(bi, text);
+    }
+
+    private Vector testFirstAndNext(BreakIterator bi, String text) {
+        int p = bi.first();
+        int lastP = p;
+        Vector<String> result = new Vector<String>();
+
+        if (p != 0)
+            errln("first() returned " + p + " instead of 0");
+        while (p != BreakIterator.DONE) {
+            p = bi.next();
+            if (p != BreakIterator.DONE) {
+                if (p <= lastP)
+                    errln("next() failed to move forward: next() on position "
+                                    + lastP + " yielded " + p);
+
+                result.addElement(text.substring(lastP, p));
+            }
+            else {
+                if (lastP != text.length())
+                    errln("next() returned DONE prematurely: offset was "
+                                    + lastP + " instead of " + text.length());
+            }
+            lastP = p;
+        }
+        return result;
+    }
+
+    private Vector testLastAndPrevious(BreakIterator bi, String text) {
+        int p = bi.last();
+        int lastP = p;
+        Vector<String> result = new Vector<String>();
+
+        if (p != text.length())
+            errln("last() returned " + p + " instead of " + text.length());
+        while (p != BreakIterator.DONE) {
+            p = bi.previous();
+            if (p != BreakIterator.DONE) {
+                if (p >= lastP)
+                    errln("previous() failed to move backward: previous() on position "
+                                    + lastP + " yielded " + p);
+
+                result.insertElementAt(text.substring(p, lastP), 0);
+            }
+            else {
+                if (lastP != 0)
+                    errln("previous() returned DONE prematurely: offset was "
+                                    + lastP + " instead of 0");
+            }
+            lastP = p;
+        }
+        return result;
+    }
+
+    private void compareFragmentLists(String f1Name, String f2Name, Vector f1, Vector f2) {
+        int p1 = 0;
+        int p2 = 0;
+        String s1;
+        String s2;
+        int t1 = 0;
+        int t2 = 0;
+
+        while (p1 < f1.size() && p2 < f2.size()) {
+            s1 = (String)f1.elementAt(p1);
+            s2 = (String)f2.elementAt(p2);
+            t1 += s1.length();
+            t2 += s2.length();
+
+            if (s1.equals(s2)) {
+                debugLogln("   >" + s1 + "<");
+                ++p1;
+                ++p2;
+            }
+            else {
+                int tempT1 = t1;
+                int tempT2 = t2;
+                int tempP1 = p1;
+                int tempP2 = p2;
+
+                while (tempT1 != tempT2 && tempP1 < f1.size() && tempP2 < f2.size()) {
+                    while (tempT1 < tempT2 && tempP1 < f1.size()) {
+                        tempT1 += ((String)f1.elementAt(tempP1)).length();
+                        ++tempP1;
+                    }
+                    while (tempT2 < tempT1 && tempP2 < f2.size()) {
+                        tempT2 += ((String)f2.elementAt(tempP2)).length();
+                        ++tempP2;
+                    }
+                }
+                logln("*** " + f1Name + " has:");
+                while (p1 <= tempP1 && p1 < f1.size()) {
+                    s1 = (String)f1.elementAt(p1);
+                    t1 += s1.length();
+                    debugLogln(" *** >" + s1 + "<");
+                    ++p1;
+                }
+                logln("***** " + f2Name + " has:");
+                while (p2 <= tempP2 && p2 < f2.size()) {
+                    s2 = (String)f2.elementAt(p2);
+                    t2 += s2.length();
+                    debugLogln(" ***** >" + s2 + "<");
+                    ++p2;
+                }
+                errln("Discrepancy between " + f1Name + " and " + f2Name + "\n---\n" + f1 +"\n---\n" + f2);
+            }
+        }
+    }
+
+    private void testFollowing(BreakIterator bi, String text, int[] boundaries) {
+        logln("testFollowing():");
+        int p = 2;
+        int i = 0;
+        try {
+            for (i = 0; i <= text.length(); i++) {  // change to <= when new BI code goes in
+                if (i == boundaries[p])
+                    ++p;
+
+                int b = bi.following(i);
+                logln("bi.following(" + i + ") -> " + b);
+                if (b != boundaries[p])
+                    errln("Wrong result from following() for " + i + ": expected " + boundaries[p]
+                          + ", got " + b);
+            }
+        } catch (IllegalArgumentException illargExp) {
+            errln("IllegalArgumentException caught from following() for offset: " + i);
+        }
+    }
+
+    private void testPreceding(BreakIterator bi, String text, int[] boundaries) {
+        logln("testPreceding():");
+        int p = 0;
+        int i = 0;
+        try {
+            for (i = 0; i <= text.length(); i++) {  // change to <= when new BI code goes in
+                int b = bi.preceding(i);
+                logln("bi.preceding(" + i + ") -> " + b);
+                if (b != boundaries[p])
+                    errln("Wrong result from preceding() for " + i + ": expected " + boundaries[p]
+                          + ", got " + b);
+
+                if (i == boundaries[p + 1])
+                    ++p;
+            }
+        } catch (IllegalArgumentException illargExp) {
+            errln("IllegalArgumentException caught from preceding() for offset: " + i);
+        }
+    }
+
+    private void testIsBoundary(BreakIterator bi, String text, int[] boundaries) {
+        logln("testIsBoundary():");
+        int p = 1;
+        boolean isB;
+        for (int i = 0; i <= text.length(); i++) {  // change to <= when new BI code goes in
+            isB = bi.isBoundary(i);
+            logln("bi.isBoundary(" + i + ") -> " + isB);
+
+            if (i == boundaries[p]) {
+                if (!isB)
+                    errln("Wrong result from isBoundary() for " + i + ": expected true, got false");
+                ++p;
+            }
+            else {
+                if (isB)
+                    errln("Wrong result from isBoundary() for " + i + ": expected false, got true");
+            }
+        }
+    }
+
+    private void doMultipleSelectionTest(BreakIterator iterator, String testText)
+    {
+        logln("Multiple selection test...");
+        BreakIterator testIterator = (BreakIterator)iterator.clone();
+        int offset = iterator.first();
+        int testOffset;
+        int count = 0;
+
+        do {
+            testOffset = testIterator.first();
+            testOffset = testIterator.next(count);
+            logln("next(" + count + ") -> " + testOffset);
+            if (offset != testOffset)
+                errln("next(n) and next() not returning consistent results: for step " + count + ", next(n) returned " + testOffset + " and next() had " + offset);
+
+            if (offset != BreakIterator.DONE) {
+                count++;
+                offset = iterator.next();
+            }
+        } while (offset != BreakIterator.DONE);
+
+        // now do it backwards...
+        offset = iterator.last();
+        count = 0;
+
+        do {
+            testOffset = testIterator.last();
+            testOffset = testIterator.next(count);
+            logln("next(" + count + ") -> " + testOffset);
+            if (offset != testOffset)
+                errln("next(n) and next() not returning consistent results: for step " + count + ", next(n) returned " + testOffset + " and next() had " + offset);
+
+            if (offset != BreakIterator.DONE) {
+                count--;
+                offset = iterator.previous();
+            }
+        } while (offset != BreakIterator.DONE);
+    }
+
+    private void doBreakInvariantTest(BreakIterator tb, String testChars)
+    {
+        StringBuffer work = new StringBuffer("aaa");
+        int errorCount = 0;
+
+        // a break should always occur after CR (unless followed by LF), LF, PS, and LS
+        String breaks = /*"\r\n\u2029\u2028"*/"\n\u2029\u2028";
+                            // change this back when new BI code is added
+
+        for (int i = 0; i < breaks.length(); i++) {
+            work.setCharAt(1, breaks.charAt(i));
+            for (int j = 0; j < testChars.length(); j++) {
+                work.setCharAt(0, testChars.charAt(j));
+                for (int k = 0; k < testChars.length(); k++) {
+                    char c = testChars.charAt(k);
+
+                    // if a cr is followed by lf, don't do the check (they stay together)
+                    if (work.charAt(1) == '\r' && (c == '\n'))
+                        continue;
+
+                    // CONTROL (Cc) and FORMAT (Cf) Characters are to be ignored
+                    // for breaking purposes as per UTR14
+                    int type1 = Character.getType(work.charAt(1));
+                    int type2 = Character.getType(c);
+                    if (type1 == Character.CONTROL || type1 == Character.FORMAT ||
+                        type2 == Character.CONTROL || type2 == Character.FORMAT) {
+                        continue;
+                    }
+
+                    work.setCharAt(2, c);
+                    tb.setText(work.toString());
+                    boolean seen2 = false;
+                    for (int l = tb.first(); l != BreakIterator.DONE; l = tb.next()) {
+                        if (l == 2)
+                            seen2 = true;
+                    }
+                    if (!seen2) {
+                        errln("No break between U+" + Integer.toHexString((int)(work.charAt(1)))
+                                    + " and U+" + Integer.toHexString((int)(work.charAt(2))));
+                        errorCount++;
+                        if (errorCount >= 75)
+                            return;
+                    }
+                }
+            }
+        }
+    }
+
+    private void doOtherInvariantTest(BreakIterator tb, String testChars)
+    {
+        StringBuffer work = new StringBuffer("a\r\na");
+        int errorCount = 0;
+
+        // a break should never occur between CR and LF
+        for (int i = 0; i < testChars.length(); i++) {
+            work.setCharAt(0, testChars.charAt(i));
+            for (int j = 0; j < testChars.length(); j++) {
+                work.setCharAt(3, testChars.charAt(j));
+                tb.setText(work.toString());
+                for (int k = tb.first(); k != BreakIterator.DONE; k = tb.next())
+                    if (k == 2) {
+                        errln("Break between CR and LF in string U+" + Integer.toHexString(
+                                (int)(work.charAt(0))) + ", U+d U+a U+" + Integer.toHexString(
+                                (int)(work.charAt(3))));
+                        errorCount++;
+                        if (errorCount >= 75)
+                            return;
+                    }
+            }
+        }
+
+        // a break should never occur before a non-spacing mark, unless it's preceded
+        // by a line terminator
+        work.setLength(0);
+        work.append("aaaa");
+        for (int i = 0; i < testChars.length(); i++) {
+            char c = testChars.charAt(i);
+            if (c == '\n' || c == '\r' || c == '\u2029' || c == '\u2028' || c == '\u0003')
+                continue;
+            work.setCharAt(1, c);
+            for (int j = 0; j < testChars.length(); j++) {
+                c = testChars.charAt(j);
+                if (Character.getType(c) != Character.NON_SPACING_MARK && Character.getType(c)
+                        != Character.ENCLOSING_MARK)
+                    continue;
+                work.setCharAt(2, c);
+
+                // CONTROL (Cc) and FORMAT (Cf) Characters are to be ignored
+                // for breaking purposes as per UTR14
+                int type1 = Character.getType(work.charAt(1));
+                int type2 = Character.getType(work.charAt(2));
+                if (type1 == Character.CONTROL || type1 == Character.FORMAT ||
+                    type2 == Character.CONTROL || type2 == Character.FORMAT) {
+                    continue;
+                }
+
+                tb.setText(work.toString());
+                for (int k = tb.first(); k != BreakIterator.DONE; k = tb.next())
+                    if (k == 2) {
+                        errln("Break between U+" + Integer.toHexString((int)(work.charAt(1)))
+                                + " and U+" + Integer.toHexString((int)(work.charAt(2))));
+                        errorCount++;
+                        if (errorCount >= 75)
+                            return;
+                    }
+            }
+        }
+    }
+
+    public void debugLogln(String s) {
+        final String zeros = "0000";
+        String temp;
+        StringBuffer out = new StringBuffer();
+        for (int i = 0; i < s.length(); i++) {
+            char c = s.charAt(i);
+            if (c >= ' ' && c < '\u007f')
+                out.append(c);
+            else {
+                out.append("\\u");
+                temp = Integer.toHexString((int)c);
+                out.append(zeros.substring(0, 4 - temp.length()));
+                out.append(temp);
+            }
+        }
+        logln(out.toString());
+    }
+
+    //=========================================================================
+    // tests
+    //=========================================================================
+
+    public void TestWordBreak() {
+
+        Vector<String> wordSelectionData = new Vector<String>();
+
+        wordSelectionData.addElement("12,34");
+
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\u00A2"); //cent sign
+        wordSelectionData.addElement("\u00A3"); //pound sign
+        wordSelectionData.addElement("\u00A4"); //currency sign
+        wordSelectionData.addElement("\u00A5"); //yen sign
+        wordSelectionData.addElement("alpha-beta-gamma");
+        wordSelectionData.addElement(".");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("Badges");
+        wordSelectionData.addElement("?");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("BADGES");
+        wordSelectionData.addElement("!");
+        wordSelectionData.addElement("?");
+        wordSelectionData.addElement("!");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("We");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("don't");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("need");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("no");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("STINKING");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("BADGES");
+        wordSelectionData.addElement("!");
+        wordSelectionData.addElement("!");
+        wordSelectionData.addElement("!");
+
+        wordSelectionData.addElement("012.566,5");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("123.3434,900");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("1000,233,456.000");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("1,23.322%");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("123.1222");
+
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\u0024123,000.20");
+
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("179.01\u0025");
+
+        wordSelectionData.addElement("Hello");
+        wordSelectionData.addElement(",");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("how");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("are");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("you");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("X");
+        wordSelectionData.addElement(" ");
+
+        wordSelectionData.addElement("Now");
+        wordSelectionData.addElement("\r");
+        wordSelectionData.addElement("is");
+        wordSelectionData.addElement("\n");
+        wordSelectionData.addElement("the");
+        wordSelectionData.addElement("\r\n");
+        wordSelectionData.addElement("time");
+        wordSelectionData.addElement("\n");
+        wordSelectionData.addElement("\r");
+        wordSelectionData.addElement("for");
+        wordSelectionData.addElement("\r");
+        wordSelectionData.addElement("\r");
+        wordSelectionData.addElement("all");
+        wordSelectionData.addElement(" ");
+
+        generalIteratorTest(wordBreak, wordSelectionData);
+    }
+
+    public void TestBug4097779() {
+        Vector<String> wordSelectionData = new Vector<String>();
+
+        wordSelectionData.addElement("aa\u0300a");
+        wordSelectionData.addElement(" ");
+
+        generalIteratorTest(wordBreak, wordSelectionData);
+    }
+
+    public void TestBug4098467Words() {
+        Vector<String> wordSelectionData = new Vector<String>();
+
+        // What follows is a string of Korean characters (I found it in the Yellow Pages
+        // ad for the Korean Presbyterian Church of San Francisco, and I hope I transcribed
+        // it correctly), first as precomposed syllables, and then as conjoining jamo.
+        // Both sequences should be semantically identical and break the same way.
+        // precomposed syllables...
+        wordSelectionData.addElement("\uc0c1\ud56d");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\ud55c\uc778");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\uc5f0\ud569");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\uc7a5\ub85c\uad50\ud68c");
+        wordSelectionData.addElement(" ");
+        // conjoining jamo...
+        wordSelectionData.addElement("\u1109\u1161\u11bc\u1112\u1161\u11bc");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\u1112\u1161\u11ab\u110b\u1175\u11ab");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\u110b\u1167\u11ab\u1112\u1161\u11b8");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\u110c\u1161\u11bc\u1105\u1169\u1100\u116d\u1112\u116c");
+        wordSelectionData.addElement(" ");
+
+        generalIteratorTest(wordBreak, wordSelectionData);
+    }
+
+    public void TestBug4117554Words() {
+        Vector<String> wordSelectionData = new Vector<String>();
+
+        // this is a test for bug #4117554: the ideographic iteration mark (U+3005) should
+        // count as a Kanji character for the purposes of word breaking
+        wordSelectionData.addElement("abc");
+        wordSelectionData.addElement("\u4e01\u4e02\u3005\u4e03\u4e03");
+        wordSelectionData.addElement("abc");
+
+        generalIteratorTest(wordBreak, wordSelectionData);
+    }
+
+    public void TestSentenceBreak() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        sentenceSelectionData.addElement("This is a simple sample sentence. ");
+        sentenceSelectionData.addElement("(This is it.) ");
+        sentenceSelectionData.addElement("This is a simple sample sentence. ");
+        sentenceSelectionData.addElement("\"This isn\'t it.\" ");
+        sentenceSelectionData.addElement("Hi! ");
+        sentenceSelectionData.addElement("This is a simple sample sentence. ");
+        sentenceSelectionData.addElement("It does not have to make any sense as you can see. ");
+        sentenceSelectionData.addElement("Nel mezzo del cammin di nostra vita, mi ritrovai in una selva oscura. ");
+        sentenceSelectionData.addElement("Che la dritta via aveo smarrita. ");
+        sentenceSelectionData.addElement("He said, that I said, that you said!! ");
+
+        sentenceSelectionData.addElement("Don't rock the boat.\u2029");
+
+        sentenceSelectionData.addElement("Because I am the daddy, that is why. ");
+        sentenceSelectionData.addElement("Not on my time (el timo.)! ");
+
+        sentenceSelectionData.addElement("So what!!\u2029");
+
+        sentenceSelectionData.addElement("\"But now,\" he said, \"I know!\" ");
+        sentenceSelectionData.addElement("Harris thumbed down several, including \"Away We Go\" (which became the huge success Oklahoma!). ");
+        sentenceSelectionData.addElement("One species, B. anthracis, is highly virulent.\n");
+        sentenceSelectionData.addElement("Wolf said about Sounder:\"Beautifully thought-out and directed.\" ");
+        sentenceSelectionData.addElement("Have you ever said, \"This is where \tI shall live\"? ");
+        sentenceSelectionData.addElement("He answered, \"You may not!\" ");
+        sentenceSelectionData.addElement("Another popular saying is: \"How do you do?\". ");
+        sentenceSelectionData.addElement("Yet another popular saying is: \'I\'m fine thanks.\' ");
+        sentenceSelectionData.addElement("What is the proper use of the abbreviation pp.? ");
+        sentenceSelectionData.addElement("Yes, I am definatelly 12\" tall!!");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4113835() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // test for bug #4113835: \n and \r count as spaces, not as paragraph breaks
+        sentenceSelectionData.addElement("Now\ris\nthe\r\ntime\n\rfor\r\rall\u2029");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4111338() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // test for bug #4111338: Don't break sentences at the boundary between CJK
+        // and other letters
+        sentenceSelectionData.addElement("\u5487\u67ff\ue591\u5017\u61b3\u60a1\u9510\u8165:\"JAVA\u821c"
+                + "\u8165\u7fc8\u51ce\u306d,\u2494\u56d8\u4ec0\u60b1\u8560\u51ba"
+                + "\u611d\u57b6\u2510\u5d46\".\u2029");
+        sentenceSelectionData.addElement("\u5487\u67ff\ue591\u5017\u61b3\u60a1\u9510\u8165\u9de8"
+                + "\u97e4JAVA\u821c\u8165\u7fc8\u51ce\u306d\ue30b\u2494\u56d8\u4ec0"
+                + "\u60b1\u8560\u51ba\u611d\u57b6\u2510\u5d46\u97e5\u7751\u2029");
+        sentenceSelectionData.addElement("\u5487\u67ff\ue591\u5017\u61b3\u60a1\u9510\u8165\u9de8\u97e4"
+                + "\u6470\u8790JAVA\u821c\u8165\u7fc8\u51ce\u306d\ue30b\u2494\u56d8"
+                + "\u4ec0\u60b1\u8560\u51ba\u611d\u57b6\u2510\u5d46\u97e5\u7751\u2029");
+        sentenceSelectionData.addElement("He said, \"I can go there.\"\u2029");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4117554Sentences() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // Treat fullwidth variants of .!? the same as their
+        // normal counterparts
+        sentenceSelectionData.addElement("I know I'm right\uff0e ");
+        sentenceSelectionData.addElement("Right\uff1f ");
+        sentenceSelectionData.addElement("Right\uff01 ");
+
+        // Don't break sentences at boundary between CJK and digits
+        sentenceSelectionData.addElement("\u5487\u67ff\ue591\u5017\u61b3\u60a1\u9510\u8165\u9de8"
+                + "\u97e48888\u821c\u8165\u7fc8\u51ce\u306d\ue30b\u2494\u56d8\u4ec0"
+                + "\u60b1\u8560\u51ba\u611d\u57b6\u2510\u5d46\u97e5\u7751\u2029");
+
+        // Break sentence between a sentence terminator and
+        // opening punctuation
+        sentenceSelectionData.addElement("no?");
+        sentenceSelectionData.addElement("(yes)");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4158381() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // Don't break sentence after period if it isn't followed by a space
+        sentenceSelectionData.addElement("Test <code>Flags.Flag</code> class.  ");
+        sentenceSelectionData.addElement("Another test.\u2029");
+
+        // No breaks when there are no terminators around
+        sentenceSelectionData.addElement("<P>Provides a set of "
+                + "&quot;lightweight&quot; (all-java<FONT SIZE=\"-2\"><SUP>TM"
+                + "</SUP></FONT> language) components that, "
+                + "to the maximum degree possible, work the same on all platforms.  ");
+        sentenceSelectionData.addElement("Another test.\u2029");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4143071() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // Make sure sentences that end with digits work right
+        sentenceSelectionData.addElement("Today is the 27th of May, 1998.  ");
+        sentenceSelectionData.addElement("Tomorrow with be 28 May 1998.  ");
+        sentenceSelectionData.addElement("The day after will be the 30th.\u2029");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4152416() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // Make sure sentences ending with a capital letter are treated correctly
+        sentenceSelectionData.addElement("The type of all primitive "
+                + "<code>boolean</code> values accessed in the target VM.  ");
+        sentenceSelectionData.addElement("Calls to xxx will return an "
+                + "implementor of this interface.\u2029");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4152117() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // Make sure sentence breaking is handling punctuation correctly
+        // [COULD NOT REPRODUCE THIS BUG, BUT TEST IS HERE TO MAKE SURE
+        // IT DOESN'T CROP UP]
+        sentenceSelectionData.addElement("Constructs a randomly generated "
+                + "BigInteger, uniformly distributed over the range <tt>0</tt> "
+                + "to <tt>(2<sup>numBits</sup> - 1)</tt>, inclusive.  ");
+        sentenceSelectionData.addElement("The uniformity of the distribution "
+                + "assumes that a fair source of random bits is provided in "
+                + "<tt>rnd</tt>.  ");
+        sentenceSelectionData.addElement("Note that this constructor always "
+                + "constructs a non-negative BigInteger.\u2029");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestLineBreak() {
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        lineSelectionData.addElement("Multi-");
+        lineSelectionData.addElement("Level ");
+        lineSelectionData.addElement("example ");
+        lineSelectionData.addElement("of ");
+        lineSelectionData.addElement("a ");
+        lineSelectionData.addElement("semi-");
+        lineSelectionData.addElement("idiotic ");
+        lineSelectionData.addElement("non-");
+        lineSelectionData.addElement("sensical ");
+        lineSelectionData.addElement("(non-");
+        lineSelectionData.addElement("important) ");
+        lineSelectionData.addElement("sentence. ");
+
+        lineSelectionData.addElement("Hi  ");
+        lineSelectionData.addElement("Hello ");
+        lineSelectionData.addElement("How\n");
+        lineSelectionData.addElement("are\r");
+        lineSelectionData.addElement("you\u2028");
+        lineSelectionData.addElement("fine.\t");
+        lineSelectionData.addElement("good.  ");
+
+        lineSelectionData.addElement("Now\r");
+        lineSelectionData.addElement("is\n");
+        lineSelectionData.addElement("the\r\n");
+        lineSelectionData.addElement("time\n");
+        lineSelectionData.addElement("\r");
+        lineSelectionData.addElement("for\r");
+        lineSelectionData.addElement("\r");
+        lineSelectionData.addElement("all");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+
+    public void TestBug4068133() {
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        lineSelectionData.addElement("\u96f6");
+        lineSelectionData.addElement("\u4e00\u3002");
+        lineSelectionData.addElement("\u4e8c\u3001");
+        lineSelectionData.addElement("\u4e09\u3002\u3001");
+        lineSelectionData.addElement("\u56db\u3001\u3002\u3001");
+        lineSelectionData.addElement("\u4e94,");
+        lineSelectionData.addElement("\u516d.");
+        lineSelectionData.addElement("\u4e03.\u3001,\u3002");
+        lineSelectionData.addElement("\u516b");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+
+    public void TestBug4086052() {
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        lineSelectionData.addElement("foo\u00a0bar ");
+//        lineSelectionData.addElement("foo\ufeffbar");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+
+    public void TestBug4097920() {
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        lineSelectionData.addElement("dog,");
+        lineSelectionData.addElement("cat,");
+        lineSelectionData.addElement("mouse ");
+        lineSelectionData.addElement("(one)");
+        lineSelectionData.addElement("(two)\n");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+    /*
+    public void TestBug4035266() {
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        lineSelectionData.addElement("The ");
+        lineSelectionData.addElement("balance ");
+        lineSelectionData.addElement("is ");
+        lineSelectionData.addElement("$-23,456.78, ");
+        lineSelectionData.addElement("not ");
+        lineSelectionData.addElement("-$32,456.78!\n");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+    */
+    public void TestBug4098467Lines() {
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        // What follows is a string of Korean characters (I found it in the Yellow Pages
+        // ad for the Korean Presbyterian Church of San Francisco, and I hope I transcribed
+        // it correctly), first as precomposed syllables, and then as conjoining jamo.
+        // Both sequences should be semantically identical and break the same way.
+        // precomposed syllables...
+        lineSelectionData.addElement("\uc0c1");
+        lineSelectionData.addElement("\ud56d ");
+        lineSelectionData.addElement("\ud55c");
+        lineSelectionData.addElement("\uc778 ");
+        lineSelectionData.addElement("\uc5f0");
+        lineSelectionData.addElement("\ud569 ");
+        lineSelectionData.addElement("\uc7a5");
+        lineSelectionData.addElement("\ub85c");
+        lineSelectionData.addElement("\uad50");
+        lineSelectionData.addElement("\ud68c ");
+        // conjoining jamo...
+        lineSelectionData.addElement("\u1109\u1161\u11bc\u1112\u1161\u11bc ");
+        lineSelectionData.addElement("\u1112\u1161\u11ab\u110b\u1175\u11ab ");
+        lineSelectionData.addElement("\u110b\u1167\u11ab\u1112\u1161\u11b8 ");
+        lineSelectionData.addElement("\u110c\u1161\u11bc\u1105\u1169\u1100\u116d\u1112\u116c");
+
+        if (Locale.getDefault().getLanguage().equals("th")) {
+            logln("This test is skipped in th locale.");
+            return;
+        }
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+
+    public void TestBug4117554Lines() {
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        // Fullwidth .!? should be treated as postJwrd
+        lineSelectionData.addElement("\u4e01\uff0e");
+        lineSelectionData.addElement("\u4e02\uff01");
+        lineSelectionData.addElement("\u4e03\uff1f");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+
+    public void TestBug4217703() {
+        if (Locale.getDefault().getLanguage().equals("th")) {
+            logln("This test is skipped in th locale.");
+            return;
+        }
+
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        // There shouldn't be a line break between sentence-ending punctuation
+        // and a closing quote
+        lineSelectionData.addElement("He ");
+        lineSelectionData.addElement("said ");
+        lineSelectionData.addElement("\"Go!\"  ");
+        lineSelectionData.addElement("I ");
+        lineSelectionData.addElement("went.  ");
+
+        lineSelectionData.addElement("Hashtable$Enumeration ");
+        lineSelectionData.addElement("getText().");
+        lineSelectionData.addElement("getIndex()");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+
+    private static final String graveS = "S\u0300";
+    private static final String acuteBelowI = "i\u0317";
+    private static final String acuteE = "e\u0301";
+    private static final String circumflexA = "a\u0302";
+    private static final String tildeE = "e\u0303";
+
+    public void TestCharacterBreak() {
+        Vector<String> characterSelectionData = new Vector<String>();
+
+        characterSelectionData.addElement(graveS);
+        characterSelectionData.addElement(acuteBelowI);
+        characterSelectionData.addElement("m");
+        characterSelectionData.addElement("p");
+        characterSelectionData.addElement("l");
+        characterSelectionData.addElement(acuteE);
+        characterSelectionData.addElement(" ");
+        characterSelectionData.addElement("s");
+        characterSelectionData.addElement(circumflexA);
+        characterSelectionData.addElement("m");
+        characterSelectionData.addElement("p");
+        characterSelectionData.addElement("l");
+        characterSelectionData.addElement(tildeE);
+        characterSelectionData.addElement(".");
+        characterSelectionData.addElement("w");
+        characterSelectionData.addElement(circumflexA);
+        characterSelectionData.addElement("w");
+        characterSelectionData.addElement("a");
+        characterSelectionData.addElement("f");
+        characterSelectionData.addElement("q");
+        characterSelectionData.addElement("\n");
+        characterSelectionData.addElement("\r");
+        characterSelectionData.addElement("\r\n");
+        characterSelectionData.addElement("\n");
+
+        generalIteratorTest(characterBreak, characterSelectionData);
+    }
+
+    public void TestBug4098467Characters() {
+        Vector<String> characterSelectionData = new Vector<String>();
+
+        // What follows is a string of Korean characters (I found it in the Yellow Pages
+        // ad for the Korean Presbyterian Church of San Francisco, and I hope I transcribed
+        // it correctly), first as precomposed syllables, and then as conjoining jamo.
+        // Both sequences should be semantically identical and break the same way.
+        // precomposed syllables...
+        characterSelectionData.addElement("\uc0c1");
+        characterSelectionData.addElement("\ud56d");
+        characterSelectionData.addElement(" ");
+        characterSelectionData.addElement("\ud55c");
+        characterSelectionData.addElement("\uc778");
+        characterSelectionData.addElement(" ");
+        characterSelectionData.addElement("\uc5f0");
+        characterSelectionData.addElement("\ud569");
+        characterSelectionData.addElement(" ");
+        characterSelectionData.addElement("\uc7a5");
+        characterSelectionData.addElement("\ub85c");
+        characterSelectionData.addElement("\uad50");
+        characterSelectionData.addElement("\ud68c");
+        characterSelectionData.addElement(" ");
+        // conjoining jamo...
+        characterSelectionData.addElement("\u1109\u1161\u11bc");
+        characterSelectionData.addElement("\u1112\u1161\u11bc");
+        characterSelectionData.addElement(" ");
+        characterSelectionData.addElement("\u1112\u1161\u11ab");
+        characterSelectionData.addElement("\u110b\u1175\u11ab");
+        characterSelectionData.addElement(" ");
+        characterSelectionData.addElement("\u110b\u1167\u11ab");
+        characterSelectionData.addElement("\u1112\u1161\u11b8");
+        characterSelectionData.addElement(" ");
+        characterSelectionData.addElement("\u110c\u1161\u11bc");
+        characterSelectionData.addElement("\u1105\u1169");
+        characterSelectionData.addElement("\u1100\u116d");
+        characterSelectionData.addElement("\u1112\u116c");
+
+        generalIteratorTest(characterBreak, characterSelectionData);
+    }
+
+    public void TestBug4153072() {
+        BreakIterator iter = BreakIterator.getWordInstance();
+        String str = "...Hello, World!...";
+        int begin = 3;
+        int end = str.length() - 3;
+        boolean gotException = false;
+        boolean dummy;
+
+        iter.setText(new StringCharacterIterator(str, begin, end, begin));
+        for (int index = -1; index < begin + 1; ++index) {
+            try {
+                dummy = iter.isBoundary(index);
+                if (index < begin)
+                    errln("Didn't get exception with offset = " + index +
+                                    " and begin index = " + begin);
+            }
+            catch (IllegalArgumentException e) {
+                if (index >= begin)
+                    errln("Got exception with offset = " + index +
+                                    " and begin index = " + begin);
+            }
+        }
+    }
+
+    public void TestBug4146175Sentences() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // break between periods and opening punctuation even when there's no
+        // intervening space
+        sentenceSelectionData.addElement("end.");
+        sentenceSelectionData.addElement("(This is\u2029");
+
+        // treat the fullwidth period as an unambiguous sentence terminator
+        sentenceSelectionData.addElement("\u7d42\u308f\u308a\uff0e");
+        sentenceSelectionData.addElement("\u300c\u3053\u308c\u306f");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4146175Lines() {
+        if (Locale.getDefault().getLanguage().equals("th")) {
+            logln("This test is skipped in th locale.");
+            return;
+        }
+
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        // the fullwidth comma should stick to the preceding Japanese character
+        lineSelectionData.addElement("\u7d42\uff0c");
+        lineSelectionData.addElement("\u308f");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+
+    public void TestBug4214367() {
+        if (Locale.getDefault().getLanguage().equals("th")) {
+            logln("This test is skipped in th locale.");
+            return;
+        }
+
+        Vector<String> wordSelectionData = new Vector<String>();
+
+        // the hiragana and katakana iteration marks and the long vowel mark
+        // are not being treated correctly by the word-break iterator
+        wordSelectionData.addElement("\u3042\u3044\u309d\u3042\u309e\u3042\u30fc\u3042");
+        wordSelectionData.addElement("\u30a2\u30a4\u30fd\u30a2\u30fe\u30a2\u30fc\u30a2");
+
+        generalIteratorTest(wordBreak, wordSelectionData);
+    }
+
+    private static final String cannedTestChars // characters fo the class Cc are ignorable for breaking
+        = /*"\u0000\u0001\u0002\u0003\u0004*/" !\"#$%&()+-01234<=>ABCDE[]^_`abcde{}|\u00a0\u00a2"
+        + "\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00ab\u00ad\u00ae\u00af\u00b0\u00b2\u00b3"
+        + "\u00b4\u00b9\u00bb\u00bc\u00bd\u02b0\u02b1\u02b2\u02b3\u02b4\u0300\u0301\u0302\u0303"
+        + "\u0304\u05d0\u05d1\u05d2\u05d3\u05d4\u0903\u093e\u093f\u0940\u0949\u0f3a\u0f3b\u2000"
+        + "\u2001\u2002\u200c\u200d\u200e\u200f\u2010\u2011\u2012\u2028\u2029\u202a\u203e\u203f"
+        + "\u2040\u20dd\u20de\u20df\u20e0\u2160\u2161\u2162\u2163\u2164";
+
+    public void TestSentenceInvariants()
+    {
+        BreakIterator e = BreakIterator.getSentenceInstance();
+        doOtherInvariantTest(e, cannedTestChars + ".,\u3001\u3002\u3041\u3042\u3043\ufeff");
+    }
+
+    public void TestWordInvariants()
+    {
+        if (Locale.getDefault().getLanguage().equals("th")) {
+            logln("This test is skipped in th locale.");
+            return;
+        }
+
+        BreakIterator e = BreakIterator.getWordInstance();
+        doBreakInvariantTest(e, cannedTestChars + "\',.\u3041\u3042\u3043\u309b\u309c\u30a1\u30a2"
+            + "\u30a3\u4e00\u4e01\u4e02");
+        doOtherInvariantTest(e, cannedTestChars + "\',.\u3041\u3042\u3043\u309b\u309c\u30a1\u30a2"
+            + "\u30a3\u4e00\u4e01\u4e02");
+    }
+
+    public void TestLineInvariants()
+    {
+        if (Locale.getDefault().getLanguage().equals("th")) {
+            logln("This test is skipped in th locale.");
+            return;
+        }
+
+        BreakIterator e = BreakIterator.getLineInstance();
+        String testChars = cannedTestChars + ".,;:\u3001\u3002\u3041\u3042\u3043\u3044\u3045"
+            + "\u30a3\u4e00\u4e01\u4e02";
+        doBreakInvariantTest(e, testChars);
+        doOtherInvariantTest(e, testChars);
+
+        int errorCount = 0;
+
+        // in addition to the other invariants, a line-break iterator should make sure that:
+        // it doesn't break around the non-breaking characters
+        String noBreak = "\u00a0\u2007\u2011\ufeff";
+        StringBuffer work = new StringBuffer("aaa");
+        for (int i = 0; i < testChars.length(); i++) {
+            char c = testChars.charAt(i);
+            if (c == '\r' || c == '\n' || c == '\u2029' || c == '\u2028' || c == '\u0003')
+                continue;
+            work.setCharAt(0, c);
+            for (int j = 0; j < noBreak.length(); j++) {
+                work.setCharAt(1, noBreak.charAt(j));
+                for (int k = 0; k < testChars.length(); k++) {
+                    work.setCharAt(2, testChars.charAt(k));
+                    // CONTROL (Cc) and FORMAT (Cf) Characters are to be ignored
+                    // for breaking purposes as per UTR14
+                    int type1 = Character.getType(work.charAt(1));
+                    int type2 = Character.getType(work.charAt(2));
+                    if (type1 == Character.CONTROL || type1 == Character.FORMAT ||
+                        type2 == Character.CONTROL || type2 == Character.FORMAT) {
+                        continue;
+                    }
+                    e.setText(work.toString());
+                    for (int l = e.first(); l != BreakIterator.DONE; l = e.next()) {
+                        if (l == 1 || l == 2) {
+                            //errln("Got break between U+" + Integer.toHexString((int)
+                            //        (work.charAt(l - 1))) + " and U+" + Integer.toHexString(
+                            //        (int)(work.charAt(l))) + "\ntype1 = " + type1 + "\ntype2 = " + type2);
+                            // as per UTR14 spaces followed by a GLUE character should allow
+                            // line breaking
+                            if (work.charAt(l-1) == '\u0020' && (work.charAt(l) == '\u00a0' ||
+                                                                 work.charAt(l) == '\u0f0c' ||
+                                                                 work.charAt(l) == '\u2007' ||
+                                                                 work.charAt(l) == '\u2011' ||
+                                                                 work.charAt(l) == '\u202f' ||
+                                                                 work.charAt(l) == '\ufeff')) {
+                                continue;
+                            }
+                            errln("Got break between U+" + Integer.toHexString((int)
+                                    (work.charAt(l - 1))) + " and U+" + Integer.toHexString(
+                                    (int)(work.charAt(l))));
+                            errorCount++;
+                            if (errorCount >= 75)
+                                return;
+                        }
+                    }
+                }
+            }
+        }
+
+        // The following test has so many exceptions that it would be better to write a new set of data
+        // that tested exactly what should be tested
+        // Until that point it will be commented out
+        /*
+
+        // it does break after dashes (unless they're followed by a digit, a non-spacing mark,
+        // a currency symbol, a space, a format-control character, a regular control character,
+        // a line or paragraph separator, or another dash)
+        String dashes = "-\u00ad\u2010\u2012\u2013\u2014";
+        for (int i = 0; i < testChars.length(); i++) {
+            work.setCharAt(0, testChars.charAt(i));
+            for (int j = 0; j < dashes.length(); j++) {
+                work.setCharAt(1, dashes.charAt(j));
+                for (int k = 0; k < testChars.length(); k++) {
+                    char c = testChars.charAt(k);
+                    if (Character.getType(c) == Character.DECIMAL_DIGIT_NUMBER ||
+                        Character.getType(c) == Character.OTHER_NUMBER ||
+                        Character.getType(c) == Character.NON_SPACING_MARK ||
+                        Character.getType(c) == Character.ENCLOSING_MARK ||
+                        Character.getType(c) == Character.CURRENCY_SYMBOL ||
+                        Character.getType(c) == Character.DASH_PUNCTUATION ||
+                        Character.getType(c) == Character.SPACE_SEPARATOR ||
+                        Character.getType(c) == Character.FORMAT ||
+                        Character.getType(c) == Character.CONTROL ||
+                        Character.getType(c) == Character.END_PUNCTUATION ||
+                        Character.getType(c) == Character.FINAL_QUOTE_PUNCTUATION ||
+                        Character.getType(c) == Character.OTHER_PUNCTUATION ||
+                        c == '\'' || c == '\"' ||
+                        // category EX as per UTR14
+                        c == '!' || c == '?' || c == '\ufe56' || c == '\ufe57' || c == '\uff01' || c == '\uff1f' ||
+                        c == '\n' || c == '\r' || c == '\u2028' || c == '\u2029' ||
+                        c == '\u0003' || c == '\u2007' || c == '\u2011' ||
+                        c == '\ufeff')
+                        continue;
+                    work.setCharAt(2, c);
+                    e.setText(work.toString());
+                    boolean saw2 = false;
+                    for (int l = e.first(); l != BreakIterator.DONE; l = e.next())
+                        if (l == 2)
+                            saw2 = true;
+                    if (!saw2) {
+                        errln("Didn't get break between U+" + Integer.toHexString((int)
+                                    (work.charAt(1))) + " and U+" + Integer.toHexString(
+                                    (int)(work.charAt(2))));
+                        errorCount++;
+                        if (errorCount >= 75)
+                            return;
+                    }
+                }
+            }
+        }
+        */
+    }
+
+    public void TestCharacterInvariants()
+    {
+        BreakIterator e = BreakIterator.getCharacterInstance();
+        doBreakInvariantTest(e, cannedTestChars + "\u1100\u1101\u1102\u1160\u1161\u1162\u11a8"
+            + "\u11a9\u11aa");
+        doOtherInvariantTest(e, cannedTestChars + "\u1100\u1101\u1102\u1160\u1161\u1162\u11a8"
+            + "\u11a9\u11aa");
+    }
+
+    public void TestEmptyString()
+    {
+        String text = "";
+        Vector<String> x = new Vector<String>();
+        x.addElement(text);
+
+        generalIteratorTest(lineBreak, x);
+    }
+
+    public void TestGetAvailableLocales()
+    {
+        Locale[] locList = BreakIterator.getAvailableLocales();
+
+        if (locList.length == 0)
+            errln("getAvailableLocales() returned an empty list!");
+        // I have no idea how to test this function...
+    }
+
+
+    /**
+     * Bug 4095322
+     */
+    public void TestJapaneseLineBreak()
+    {
+        StringBuffer testString = new StringBuffer("\u4e00x\u4e8c");
+        // Breaking on <Kanji>$<Kanji> is inconsistent
+
+        /* Characters in precedingChars and followingChars have been updated
+         * from Unicode 2.0.14-based to 3.0.0-based when 4638433 was fixed.
+         * In concrete terms,
+         *   0x301F : Its category was changed from Ps to Pe since Unicode 2.1.
+         *   0x169B & 0x169C : added since Unicode 3.0.0.
+         */
+        String precedingChars =
+            /* Puctuation, Open */
+          "([{\u201a\u201e\u2045\u207d\u208d\u2329\u3008\u300a\u300c\u300e\u3010\u3014\u3016\u3018\u301a\u301d\ufe35\ufe37\ufe39\ufe3b\ufe3d\ufe3f\ufe41\ufe43\ufe59\ufe5b\ufe5d\uff08\uff3b\uff5b\uff62\u169b"
+            /* Punctuation, Initial quote */
+          + "\u00ab\u2018\u201b\u201c\u201f\u2039"
+            /* Symbol, Currency */
+          + "\u00a5\u00a3\u00a4\u20a0";
+
+        String followingChars =
+            /* Puctuation, Close */
+          ")]}\u2046\u207e\u208e\u232a\u3009\u300b\u300d\u300f\u3011\u3015\u3017\u3019\u301b\u301e\u301f\ufd3e\ufe36\ufe38\ufe3a\ufe3c\ufe3e\ufe40\ufe42\ufe44\ufe5a\ufe5c\ufe5e\uff09\uff3d\uff5d\uff63\u169c"
+            /* Punctuation, Final quote */
+          + "\u00bb\u2019\u201d\u203a"
+            /* Punctuation, Other */
+          + "!%,.:;\u3001\u3002\u2030\u2031\u2032\u2033\u2034"
+            /* Punctuation, Dash */
+          + "\u2103\u2109"
+            /* Symbol, Currency */
+          + "\u00a2"
+            /* Letter, Modifier */
+          + "\u3005\u309d\u309e"
+            /* Letter, Other */
+          + "\u3063\u3083\u3085\u3087\u30c3\u30e3\u30e5\u30e7\u30fc\u30fd\u30fe"
+           /* Mark, Non-Spacing */
+          + "\u0300\u0301\u0302"
+            /* Symbol, Modifier */
+          + "\u309b\u309c"
+            /* Symbol, Other */
+          + "\u00b0";
+
+        BreakIterator iter = BreakIterator.getLineInstance(Locale.JAPAN);
+
+        for (int i = 0; i < precedingChars.length(); i++) {
+            testString.setCharAt(1, precedingChars.charAt(i));
+            iter.setText(testString.toString());
+            int j = iter.first();
+            if (j != 0) {
+                errln("ja line break failure: failed to start at 0 and bounced at " + j);
+            }
+            j = iter.next();
+            if (j != 1) {
+                errln("ja line break failure: failed to stop before '"
+                        + precedingChars.charAt(i) + "' (\\u"
+                        + Integer.toString(precedingChars.charAt(i), 16)
+                        + ") at 1 and bounded at " + j);
+            }
+            j = iter.next();
+            if (j != 3) {
+                errln("ja line break failure: failed to skip position after '"
+                        + precedingChars.charAt(i) + "' (\\u"
+                        + Integer.toString(precedingChars.charAt(i), 16)
+                        + ") at 3 and bounded at " + j);
+            }
+        }
+
+        for (int i = 0; i < followingChars.length(); i++) {
+            testString.setCharAt(1, followingChars.charAt(i));
+            iter.setText(testString.toString());
+            int j = iter.first();
+            if (j != 0) {
+                errln("ja line break failure: failed to start at 0 and bounded at " + j);
+            }
+            j = iter.next();
+            if (j != 2) {
+                errln("ja line break failure: failed to skip position before '"
+                        + followingChars.charAt(i) + "' (\\u"
+                        + Integer.toString(followingChars.charAt(i), 16)
+                        + ") at 2 and bounded at " + j);
+            }
+            j = iter.next();
+            if (j != 3) {
+                errln("ja line break failure: failed to stop after '"
+                        + followingChars.charAt(i) + "' (\\u"
+                        + Integer.toString(followingChars.charAt(i), 16)
+                        + ") at 3 and bounded at " + j);
+            }
+        }
+    }
+
+    /**
+     * Bug 4638433
+     */
+    public void TestLineBreakBasedOnUnicode3_0_0()
+    {
+        BreakIterator iter;
+        int i;
+
+        /* Latin Extend-B characters
+         * 0x0218-0x0233 which have been added since Unicode 3.0.0.
+         */
+        iter = BreakIterator.getWordInstance(Locale.US);
+        iter.setText("\u0216\u0217\u0218\u0219\u021A");
+        i = iter.first();
+        i = iter.next();
+        if (i != 5) {
+            errln("Word break failure: failed to stop at 5 and bounded at " + i);
+        }
+
+
+        iter = BreakIterator.getLineInstance(Locale.US);
+
+        /* <Three(Nd)><Two(Nd)><Low Double Prime Quotation Mark(Pe)><One(Nd)>
+         * \u301f has changed its category from Ps to Pe since Unicode 2.1.
+         */
+        iter.setText("32\u301f1");
+        i = iter.first();
+        i = iter.next();
+        if (i != 3) {
+            errln("Line break failure: failed to skip before \\u301F(Pe) at 3 and bounded at " + i);
+        }
+
+        /* Mongolian <Letter A(Lo)><Todo Soft Hyphen(Pd)><Letter E(Lo)>
+         * which have been added since Unicode 3.0.0.
+         */
+        iter.setText("\u1820\u1806\u1821");
+        i = iter.first();
+        i = iter.next();
+        if (i != 2) {
+            errln("Mongolian line break failure: failed to skip position before \\u1806(Pd) at 2 and bounded at " + i);
+        }
+
+        /* Khmer <ZERO(Nd)><Currency Symbol(Sc)><ONE(Nd)> which have
+         * been added since Unicode 3.0.0.
+         */
+        iter.setText("\u17E0\u17DB\u17E1");
+        i = iter.first();
+        i = iter.next();
+        if (i != 1) {
+            errln("Khmer line break failure: failed to stop before \\u17DB(Sc) at 1 and bounded at " + i);
+        }
+        i = iter.next();
+        if (i != 3) {
+            errln("Khmer line break failure: failed to skip position after \\u17DB(Sc) at 3 and bounded at " + i);
+        }
+
+        /* Ogham <Letter UR(Lo)><Space Mark(Zs)><Letter OR(Lo)> which have
+         * been added since Unicode 3.0.0.
+         */
+        iter.setText("\u1692\u1680\u1696");
+        i = iter.first();
+        i = iter.next();
+        if (i != 2) {
+            errln("Ogham line break failure: failed to skip postion before \\u1680(Zs) at 2 and bounded at " + i);
+        }
+
+
+        // Confirm changes in BreakIteratorRules_th.java have been reflected.
+        iter = BreakIterator.getLineInstance(new Locale("th", ""));
+
+        /* Thai <Seven(Nd)>
+         *      <Left Double Quotation Mark(Pi)>
+         *      <Five(Nd)>
+         *      <Right Double Quotation Mark(Pf)>
+         *      <Three(Nd)>
+         */
+        iter.setText("\u0E57\u201C\u0E55\u201D\u0E53");
+        i = iter.first();
+        i = iter.next();
+        if (i != 1) {
+            errln("Thai line break failure: failed to stop before \\u201C(Pi) at 1 and bounded at " + i);
+        }
+        i = iter.next();
+        if (i != 4) {
+            errln("Thai line break failure: failed to stop after \\u201D(Pf) at 4 and bounded at " + i);
+        }
+    }
+
+    /**
+     * Bug 4068137
+     */
+    public void TestEndBehavior()
+    {
+        String testString = "boo.";
+        BreakIterator wb = BreakIterator.getWordInstance();
+        wb.setText(testString);
+
+        if (wb.first() != 0)
+            errln("Didn't get break at beginning of string.");
+        if (wb.next() != 3)
+            errln("Didn't get break before period in \"boo.\"");
+        if (wb.current() != 4 && wb.next() != 4)
+            errln("Didn't get break at end of string.");
+    }
+
+    // [serialization test has been removed pursuant to bug #4152965]
+
+    /**
+     * Bug 4450804
+     */
+    public void TestLineBreakContractions() {
+        Vector<String> expected = new Vector<String>();
+
+        expected.add("These ");
+        expected.add("are ");
+        expected.add("'foobles'. ");
+        expected.add("Don't ");
+        expected.add("you ");
+        expected.add("like ");
+        expected.add("them?");
+        generalIteratorTest(lineBreak, expected);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/BreakIterator/Bug4533872.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2003, 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 4533872 4640853
+ * @library /java/text/testlib
+ * @summary Unit tests for supplementary character support (JSR-204) and Unicode 4.0 support
+ */
+
+import java.text.BreakIterator;
+import java.util.Locale;
+
+public class Bug4533872 extends IntlTest {
+
+    public static void main(String[] args) throws Exception {
+        new Bug4533872().run(args);
+    }
+
+    static final String[] given = {
+      /* Lu Nd    Lu     Ll    */
+        "XYZ12345 ABCDE  abcde",
+      /* Nd Lo          Nd  Lu Po    Lu   Ll    */
+        "123\uD800\uDC00345 ABC\uFF61XYZ  abc",
+      /* Nd Lo          Nd  Lu Po          Lu   Ll    */
+        "123\uD800\uDC00345 ABC\uD800\uDD00XYZ  abc",
+      /* Lu Ll Cs    Ll Cs    Lu Lo          Lu  */
+        "ABCabc\uDC00xyz\uD800ABC\uD800\uDC00XYZ",
+    };
+
+    // Golden data for TestNext(), TestBoundar() and TestPrintEach*ward()
+    static final String[][] expected = {
+        {"XYZ12345", " ", "ABCDE", "  ", "abcde"},
+        {"123\uD800\uDC00345", " ", "ABC", "\uFF61", "XYZ", "  ", "abc"},
+        {"123\uD800\uDC00345", " ", "ABC", "\uD800\uDD00", "XYZ", "  ", "abc"},
+        {"ABCabc", "\uDC00", "xyz", "\uD800", "ABC\uD800\uDC00XYZ"},
+    };
+
+    BreakIterator iter;
+    int start, end, current;
+
+    /*
+     * Test for next(int n)
+     */
+    void TestNext() {
+        iter = BreakIterator.getWordInstance(Locale.US);
+
+        for (int i = 0; i < given.length; i++) {
+            iter.setText(given[i]);
+            start = iter.first();
+            int j = expected[i].length - 1;
+            start = iter.next(j);
+            end = iter.next();
+
+            if (!expected[i][j].equals(given[i].substring(start, end))) {
+                errln("Word break failure: printEachForward() expected:<" +
+                      expected[i][j] + ">, got:<" +
+                      given[i].substring(start, end) +
+                      "> start=" + start + "  end=" + end);
+            }
+        }
+    }
+
+    /*
+     * Test for isBoundary(int n)
+     */
+    void TestIsBoundary() {
+        iter = BreakIterator.getWordInstance(Locale.US);
+
+        for (int i = 0; i < given.length; i++) {
+            iter.setText(given[i]);
+
+            start = iter.first();
+            end = iter.next();
+
+            while (end < given[i].length()) {
+                if (!iter.isBoundary(end)) {
+                    errln("Word break failure: isBoundary() This should be a boundary. Index=" +
+                          end + " for " + given[i]);
+                }
+                end = iter.next();
+            }
+        }
+    }
+
+
+    /*
+     * The followig test cases were made based on examples in BreakIterator's
+     * API Doc.
+     */
+
+    /*
+     * Test mainly for next() and current()
+     */
+    void TestPrintEachForward() {
+        iter = BreakIterator.getWordInstance(Locale.US);
+
+        for (int i = 0; i < given.length; i++) {
+            iter.setText(given[i]);
+            start = iter.first();
+
+            // Check current()'s return value - should be same as first()'s.
+            current = iter.current();
+            if (start != current) {
+                errln("Word break failure: printEachForward() Unexpected current value: current()=" +
+                      current + ", expected(=first())=" + start);
+            }
+
+            int j = 0;
+            for (end = iter.next();
+                 end != BreakIterator.DONE;
+                 start = end, end = iter.next(), j++) {
+
+                // Check current()'s return value - should be same as next()'s.
+                current = iter.current();
+                if (end != current) {
+                    errln("Word break failure: printEachForward() Unexpected current value: current()=" +
+                          current + ", expected(=next())=" + end);
+                }
+
+                if (!expected[i][j].equals(given[i].substring(start, end))) {
+                    errln("Word break failure: printEachForward() expected:<" +
+                          expected[i][j] + ">, got:<" +
+                          given[i].substring(start, end) +
+                          "> start=" + start + "  end=" + end);
+                }
+            }
+        }
+    }
+
+    /*
+     * Test mainly for previous() and current()
+     */
+    void TestPrintEachBackward() {
+        iter = BreakIterator.getWordInstance(Locale.US);
+
+        for (int i = 0; i < given.length; i++) {
+            iter.setText(given[i]);
+            end = iter.last();
+
+            // Check current()'s return value - should be same as last()'s.
+            current = iter.current();
+            if (end != current) {
+                errln("Word break failure: printEachBackward() Unexpected current value: current()=" +
+                      current + ", expected(=last())=" + end);
+            }
+
+            int j;
+            for (start = iter.previous(), j = expected[i].length-1;
+                 start != BreakIterator.DONE;
+                 end = start, start = iter.previous(), j--) {
+
+                // Check current()'s return value - should be same as previous()'s.
+                current = iter.current();
+                if (start != current) {
+                    errln("Word break failure: printEachBackward() Unexpected current value: current()=" +
+                          current + ", expected(=previous())=" + start);
+                }
+
+                if (!expected[i][j].equals(given[i].substring(start, end))) {
+                    errln("Word break failure: printEachBackward() expected:<" +
+                          expected[i][j] + ">, got:<" +
+                          given[i].substring(start, end) +
+                          "> start=" + start + "  end=" + end);
+                }
+            }
+        }
+    }
+
+    /*
+     * Test mainly for following() and previous()
+     */
+    void TestPrintAt_1() {
+        iter = BreakIterator.getWordInstance(Locale.US);
+
+        int[][] index = {
+            {2, 8, 10, 15, 17},
+            {1, 8, 10, 12, 15, 17, 20},
+            {3, 8, 10, 13, 16, 18, 20},
+            {4, 6,  9, 10, 16},
+        };
+
+        for (int i = 0; i < given.length; i++) {
+            iter.setText(given[i]);
+            for (int j = index[i].length-1; j >= 0; j--) {
+                end = iter.following(index[i][j]);
+                start = iter.previous();
+
+                if (!expected[i][j].equals(given[i].substring(start, end))) {
+                    errln("Word break failure: printAt_1() expected:<" +
+                          expected[i][j] + ">, got:<" +
+                          given[i].substring(start, end) +
+                          "> start=" + start + "  end=" + end);
+                }
+            }
+        }
+    }
+
+    /*
+     * Test mainly for preceding() and next()
+     */
+    void TestPrintAt_2() {
+        iter = BreakIterator.getWordInstance(Locale.US);
+
+        int[][] index = {
+            {2, 9, 10, 15, 17},
+            {1, 9, 10, 13, 16, 18, 20},
+            {4, 9, 10, 13, 16, 18, 20},
+            {6, 7, 10, 11, 15},
+        };
+
+        for (int i = 0; i < given.length; i++) {
+            iter.setText(given[i]);
+
+            // Check preceding(0)'s return value - should equals BreakIterator.DONE.
+            if (iter.preceding(0) != BreakIterator.DONE) {
+                 errln("Word break failure: printAt_2() expected:-1(BreakIterator.DONE), got:" +
+                       iter.preceding(0));
+            }
+
+            for (int j = 0; j < index[i].length; j++) {
+                start = iter.preceding(index[i][j]);
+                end = iter.next();
+
+                if (!expected[i][j].equals(given[i].substring(start, end))) {
+                    errln("Word break failure: printAt_2() expected:<" +
+                          expected[i][j] + ">, got:<" +
+                          given[i].substring(start, end) +
+                          "> start=" + start + "  end=" + end);
+                }
+            }
+
+            // Check next()'s return value - should equals BreakIterator.DONE.
+            end = iter.last();
+            start = iter.next();
+            if (start != BreakIterator.DONE) {
+                 errln("Word break failure: printAt_2() expected:-1(BreakIterator.DONE), got:" + start);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/BreakIterator/Bug4740757.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 4740757
+ * @summary Confirm line-breaking behavior of Hangul
+ */
+
+import java.text.*;
+import java.util.*;
+
+public class Bug4740757 {
+
+    private static boolean err = false;
+
+    public static void main(String[] args) {
+        Locale defaultLocale = Locale.getDefault();
+        if (defaultLocale.getLanguage().equals("th")) {
+            Locale.setDefault(Locale.KOREA);
+            test4740757();
+            Locale.setDefault(defaultLocale);
+        } else {
+            test4740757();
+        }
+
+        if (err) {
+            throw new RuntimeException("Incorrect Line-breaking");
+        }
+    }
+
+    private static void test4740757() {
+        String source = "\uc548\ub155\ud558\uc138\uc694? \uc88b\uc740 \uc544\uce68, \uc5ec\ubcf4\uc138\uc694! \uc548\ub155. End.";
+        String expected = "\uc548/\ub155/\ud558/\uc138/\uc694? /\uc88b/\uc740 /\uc544/\uce68, /\uc5ec/\ubcf4/\uc138/\uc694! /\uc548/\ub155. /End./";
+
+        BreakIterator bi = BreakIterator.getLineInstance(Locale.KOREAN);
+        bi.setText(source);
+        int start = bi.first();
+        int end = bi.next();
+        StringBuilder sb =  new StringBuilder();
+
+        for (; end != BreakIterator.DONE; start = end, end = bi.next()) {
+            sb.append(source.substring(start,end));
+            sb.append('/');
+        }
+
+        if (!expected.equals(sb.toString())) {
+            System.err.println("Failed: Hangul line-breaking failed." +
+                "\n\tExpected: " + expected +
+                "\n\tGot:      " + sb +
+                "\nin " + Locale.getDefault() + " locale.");
+            err = true;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/BreakIterator/Bug4912404.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003, 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 4912404
+ * @summary Confirm that BreakIterator.equals(null) return false.
+ */
+
+import java.text.BreakIterator;
+
+public class Bug4912404 {
+
+    public static void main(String[] args) {
+        BreakIterator b = BreakIterator.getWordInstance();
+        b.setText("abc");
+        if (b.equals(null)) {
+            throw new RuntimeException("BreakIterator.equals(null) should return false.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/BreakIterator/Bug4932583.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003, 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
+ * @run main/timeout=60 Bug4932583
+ * @bug 4932583
+ * @summary Confirm that BreakIterator doesn't get caught in an infinite loop.
+ */
+
+import java.text.*;
+import java.util.*;
+import java.io.*;
+
+public class Bug4932583 {
+    public static void main(String[] args) {
+        BreakIterator iterator = BreakIterator.getCharacterInstance();
+        iterator.setText("\uDB40\uDFFF");
+        int boundary = iterator.next();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/BreakIterator/Bug6513074.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 6513074
+ * @summary Confirm that JIS X 0213 characters are processed in line-breaking properly.
+ */
+
+import java.text.*;
+import java.util.*;
+
+public class Bug6513074 {
+
+    private static final String[][] source = {
+        {"\ufa30\ufa31 \ufa69\ufa6a",
+         "JIS X 0213 compatibility additions (\\uFA30-\\uFA6A)"},
+    };
+
+    private static final String[] expected_line = {
+        "\ufa30/\ufa31 /\ufa69/\ufa6a/",
+    };
+
+    private static final String[] expected_word = {
+        "\ufa30\ufa31/ /\ufa69\ufa6a/",
+    };
+
+    private static final String[] expected_char = {
+        "\ufa30/\ufa31/ /\ufa69/\ufa6a/",
+    };
+
+
+    private static boolean err = false;
+
+    public static void main(String[] args) {
+        Locale defaultLocale = Locale.getDefault();
+        if (defaultLocale.getLanguage().equals("th")) {
+            Locale.setDefault(Locale.JAPAN);
+            test6513074();
+            Locale.setDefault(defaultLocale);
+        } else {
+            test6513074();
+        }
+
+        if (err) {
+            throw new RuntimeException("Failed: Incorrect Text-breaking.");
+        }
+    }
+
+
+    private static void test6513074() {
+        BreakIterator bi = BreakIterator.getLineInstance(Locale.JAPAN);
+        for (int i = 0; i < source.length; i++) {
+            testBreakIterator(bi, "Line", source[i][0], expected_line[i], source[i][1]);
+        }
+
+        bi = BreakIterator.getWordInstance(Locale.JAPAN);
+        for (int i = 0; i < source.length; i++) {
+            testBreakIterator(bi, "Word", source[i][0], expected_word[i], source[i][1]);
+        }
+
+        bi = BreakIterator.getCharacterInstance(Locale.JAPAN);
+        for (int i = 0; i < source.length; i++) {
+            testBreakIterator(bi, "Character", source[i][0], expected_char[i], source[i][1]);
+        }
+    }
+
+    private static void testBreakIterator(BreakIterator bi,
+                                          String type,
+                                          String source,
+                                          String expected,
+                                          String description) {
+        bi.setText(source);
+        int start = bi.first();
+        int end = bi.next();
+        StringBuilder sb =  new StringBuilder();
+
+        for (; end != BreakIterator.DONE; start = end, end = bi.next()) {
+            sb.append(source.substring(start,end));
+            sb.append('/');
+        }
+
+        if (!expected.equals(sb.toString())) {
+            System.err.println("Failed: Incorrect " + type + "-breaking for " +
+                description +
+                "\n\tExpected: " + toString(expected) +
+                "\n\tGot:      " + toString(sb.toString()));
+            err = true;
+        }
+    }
+
+    private static String toString(String s) {
+        StringBuilder sb = new StringBuilder();
+
+        for (int i = 0; i < s.length(); i++) {
+            sb.append("  0x" + Integer.toHexString(s.charAt(i)));
+        }
+
+        return sb.toString();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/BreakIterator/NewVSOld_th_TH.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2000, 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 Comparison of New Collators against Old Collators in the en_US locale
+*/
+
+import java.io.*;
+import java.util.Enumeration;
+import java.util.Vector;
+import java.util.Locale;
+import java.text.BreakIterator;
+import java.lang.Math;
+
+public class NewVSOld_th_TH {
+    public static void main(String args[]) throws FileNotFoundException,
+                                                  UnsupportedEncodingException,
+                                                  IOException {
+        final String ENCODING = "UTF-8";
+        final Locale THAI_LOCALE = new Locale("th", "TH");
+
+        String rawFileName = "test_th_TH.txt";
+        String oldFileName = "broken_th_TH.txt";
+        StringBuilder rawText = new StringBuilder();
+        StringBuilder oldText = new StringBuilder();
+        StringBuilder cookedText = new StringBuilder();
+
+        File f;
+        f = new File(System.getProperty("test.src", "."), rawFileName);
+
+        try (InputStreamReader rawReader =
+                 new InputStreamReader(new FileInputStream(f), ENCODING)) {
+            int c;
+            while ((c = rawReader.read()) != -1) {
+                rawText.append((char) c);
+            }
+        }
+
+        f = new File(System.getProperty("test.src", "."), oldFileName);
+        try (InputStreamReader oldReader =
+                 new InputStreamReader(new FileInputStream(f), ENCODING)) {
+            int c;
+            while ((c = oldReader.read()) != -1) {
+                oldText.append((char) c);
+            }
+        }
+
+        BreakIterator breakIterator = BreakIterator.getWordInstance(THAI_LOCALE);
+        breakIterator.setText(rawText.toString());
+
+        int start = breakIterator.first();
+        for (int end = breakIterator.next();
+             end != BreakIterator.DONE;
+             start = end, end = breakIterator.next()) {
+             cookedText.append(rawText.substring(start, end));
+             cookedText.append("\n");
+        }
+
+        String cooked = cookedText.toString();
+        String old = oldText.toString();
+        if (cooked.compareTo(old) != 0) {
+            throw new RuntimeException("Text not broken the same as with the old BreakIterators");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/BreakIterator/broken_th_TH.txt	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,13 @@
+การ
+เก็บ
+ภาษีประเทศ
+ไทยและ
+ประเทศ
+เดนมาร์ค
+อนุสัญญา
+ระหว่าง
+รัฐบาล
+แห่ง
+ประเทศ
+ไทย
+กับ
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/BreakIterator/test_th_TH.txt	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,1 @@
+การเก็บภาษีประเทศไทยและประเทศเดนมาร์คอนุสัญญาระหว่างรัฐบาลแห่งประเทศไทยกับ
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/CharacterIterator/CharacterIteratorTest.java	Wed Jun 01 15:27:49 2016 -0700
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 1997, 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
+ * @library /java/text/testlib
+ * @summary test for Character Iterator
+ */
+
+/*
+ *
+ *
+ * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
+ *
+ * Portions copyright (c) 2007 Sun Microsystems, Inc.
+ * All Rights Reserved.
+ *
+ * The original version of this source code and documentation
+ * is copyrighted and owned by Taligent, Inc., a wholly-owned
+ * subsidiary of IBM. These materials are provided under terms
+ * of a License Agreement between Taligent and Sun. This technology
+ * is protected by multiple US and International patents.
+ *
+ * This notice and attribution to Taligent may not be removed.
+ * Taligent is a registered trademark of Taligent, Inc.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * and its documentation for NON-COMMERCIAL purposes and without
+ * fee is hereby granted provided that this copyright notice
+ * appears in all copies. Please refer to the file "copyright.html"
+ * for further important copyright and licensing information.
+ *
+ * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
+ * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+ * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+ *
+ */
+
+import java.text.*;
+
+public class CharacterIteratorTest extends IntlTest {
+    public static void main(String[] args) throws Exception {
+        new CharacterIteratorTest().run(args);
+    }
+
+    public CharacterIteratorTest() {
+    }
+
+    public void TestConstructionAndEquality() {
+        String  testText = "Now is the time for all good men to come to the aid of their country.";
+        String  testText2 = "Don't bother using this string.";
+
+        CharacterIterator test1 = new StringCharacterIterator(testText);
+        CharacterIterator test2 = new StringCharacterIterator(testText, 5);
+        CharacterIterator test3 = new StringCharacterIterator(testText, 2, 20, 5);
+        CharacterIterator test4 = new StringCharacterIterator(testText2);
+        CharacterIterator test5 = (CharacterIterator)test1.clone();
+
+        if (test1.equals(test2) || test1.equals(test3) || test1.equals(test4))
+            errln("Construation or equals() failed: Two unequal iterators tested equal");
+
+        if (!test1.equals(test5))
+            errln("clone() or equals() failed: Two clones tested unequal");
+
+        if (test1.hashCode() == test2.hashCode() || test1.hashCode() == test3.hashCode()
+                        || test1.hashCode() == test4.hashCode())