changeset 15586:54c5931849a3 jdk-9+136

Merge
author sspitsyn
date Mon, 12 Sep 2016 22:04:48 +0000
parents 08d703b88378 708383deec79
children d6a338c11d88 32d957185656
files src/java.base/share/classes/sun/text/resources/BreakIteratorRulesProvider.java src/jdk.localedata/share/classes/sun/text/resources/thai_dict
diffstat 155 files changed, 2160 insertions(+), 1106 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Mon Sep 12 15:00:58 2016 -0700
+++ b/.hgtags	Mon Sep 12 22:04:48 2016 +0000
@@ -377,3 +377,4 @@
 d5c70818cd8a82e76632c8c815bdb4f75f53aeaf jdk-9+132
 3cdae27c90b5e41afe75eab904fda19fac076330 jdk-9+133
 803adcd526d74ae0b64948d1f8260c2dbe514779 jdk-9+134
+021369229cfd0b5feb76834b2ea498f47f43c0f3 jdk-9+135
--- a/make/gendata/GendataBreakIterator.gmk	Mon Sep 12 15:00:58 2016 -0700
+++ b/make/gendata/GendataBreakIterator.gmk	Mon Sep 12 22:04:48 2016 +0000
@@ -81,7 +81,7 @@
 
 # output
 BASE_DATA_PKG_DIR := $(JDK_OUTPUTDIR)/modules/java.base/sun/text/resources
-LD_DATA_PKG_DIR := $(JDK_OUTPUTDIR)/modules/jdk.localedata/sun/text/resources
+LD_DATA_PKG_DIR := $(JDK_OUTPUTDIR)/modules/jdk.localedata/sun/text/resources/ext
 BIFILES := $(BASE_DATA_PKG_DIR)/CharacterBreakIteratorData \
     $(BASE_DATA_PKG_DIR)/WordBreakIteratorData \
     $(BASE_DATA_PKG_DIR)/LineBreakIteratorData \
--- a/src/java.base/macosx/native/libnio/ch/KQueueArrayWrapper.c	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/macosx/native/libnio/ch/KQueueArrayWrapper.c	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -123,7 +123,6 @@
     kevent(kq, changes, 2, errors, 2, &dontBlock);
 }
 
-
 JNIEXPORT jint JNICALL
 Java_sun_nio_ch_KQueueArrayWrapper_kevent0(JNIEnv *env, jobject this, jint kq,
                                            jlong kevAddr, jint kevCount,
@@ -138,6 +137,15 @@
     // Java timeout == -1 : wait forever : timespec timeout of NULL
     // Java timeout == 0  : return immediately : timespec timeout of zero
     if (timeout >= 0) {
+        // For some indeterminate reason kevent(2) has been found to fail with
+        // an EINVAL error for timeout values greater than or equal to
+        // 100000001000L. To avoid this problem, clamp the timeout arbitrarily
+        // to the maximum value of a 32-bit signed integer which is
+        // approximately 25 days in milliseconds.
+        const jlong timeoutMax = 0x7fffffff; // java.lang.Integer.MAX_VALUE
+        if (timeout > timeoutMax) {
+            timeout = timeoutMax;
+        }
         ts.tv_sec = timeout / 1000;
         ts.tv_nsec = (timeout % 1000) * 1000000; //nanosec = 1 million millisec
         tsp = &ts;
--- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Package.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Package.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -476,7 +476,8 @@
             } else if (localICs.isEmpty()) {
                 // It was a non-empty diff, but the local ICs were absent.
                 actualICs = null;
-                changed = 0;  // [] => null, no tuple change
+                // [] => null, no tuple change, but attribute deletion.
+                changed = -1;
             } else {
                 // Non-trivial diff was transmitted.
                 actualICs = computeICdiff();
--- a/src/java.base/share/classes/com/sun/java/util/jar/pack/PackageReader.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/PackageReader.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1193,18 +1193,21 @@
         cls.visitRefs(VRM_CLASSIC, cpRefs);
 
         ArrayList<BootstrapMethodEntry> bsms = new ArrayList<>();
-        /*
-         * BootstrapMethod(BSMs) are added here before InnerClasses(ICs),
-         * so as to ensure the order. Noting that the BSMs  may be
-         * removed if they are not found in the CP, after the ICs expansion.
-         */
-        cls.addAttribute(Package.attrBootstrapMethodsEmpty.canonicalInstance());
-
         // flesh out the local constant pool
         ConstantPool.completeReferencesIn(cpRefs, true, bsms);
 
+        // add the bsm and references as required
+        if (!bsms.isEmpty()) {
+            cls.addAttribute(Package.attrBootstrapMethodsEmpty.canonicalInstance());
+            cpRefs.add(Package.getRefString("BootstrapMethods"));
+            Collections.sort(bsms);
+            cls.setBootstrapMethods(bsms);
+        }
+
         // Now that we know all our local class references,
         // compute the InnerClasses attribute.
+        // An InnerClasses attribute usually gets added here,
+        // although it might already have been present.
         int changed = cls.expandLocalICs();
 
         if (changed != 0) {
@@ -1221,16 +1224,6 @@
             ConstantPool.completeReferencesIn(cpRefs, true, bsms);
         }
 
-        // remove the attr previously set, otherwise add the bsm and
-        // references as required
-        if (bsms.isEmpty()) {
-            cls.attributes.remove(Package.attrBootstrapMethodsEmpty.canonicalInstance());
-        } else {
-            cpRefs.add(Package.getRefString("BootstrapMethods"));
-            Collections.sort(bsms);
-            cls.setBootstrapMethods(bsms);
-        }
-
         // construct a local constant pool
         int numDoubles = 0;
         for (Entry e : cpRefs) {
--- a/src/java.base/share/classes/com/sun/java/util/jar/pack/intrinsic.properties	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/intrinsic.properties	Mon Sep 12 22:04:48 2016 +0000
@@ -18,7 +18,7 @@
 pack.class.attribute.Module = NH[RUHFH]NH[RUHNH[RUH]]NH[RCH]NH[RCHRCH]
 pack.class.attribute.ConcealedPackages = NH[RUH]
 pack.class.attribute.Version = RUH
-pack.class.attribute.MainClass = RUH
+pack.class.attribute.MainClass = RCH
 pack.class.attribute.TargetPlatform = RUHRUHRUH
 pack.class.attribute.Hashes = RUHNH[RUHRUH]
 
--- a/src/java.base/share/classes/java/lang/ClassLoader.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java	Mon Sep 12 22:04:48 2016 +0000
@@ -27,6 +27,7 @@
 
 import java.io.InputStream;
 import java.io.IOException;
+import java.io.UncheckedIOException;
 import java.io.File;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
@@ -46,12 +47,16 @@
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
+import java.util.Spliterator;
+import java.util.Spliterators;
 import java.util.Stack;
 import java.util.NoSuchElementException;
 import java.util.Vector;
 import java.util.WeakHashMap;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Supplier;
 import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
 
 import jdk.internal.perf.PerfCounter;
 import jdk.internal.module.ServicesCatalog;
@@ -1167,17 +1172,7 @@
     protected final Class<?> findSystemClass(String name)
         throws ClassNotFoundException
     {
-        ClassLoader system = getSystemClassLoader();
-        if (system == null) {
-            if (!checkName(name))
-                throw new ClassNotFoundException(name);
-            Class<?> cls = findBootstrapClass(name);
-            if (cls == null) {
-                throw new ClassNotFoundException(name);
-            }
-            return cls;
-        }
-        return system.loadClass(name);
+        return getSystemClassLoader().loadClass(name);
     }
 
     /**
@@ -1354,6 +1349,57 @@
     }
 
     /**
+     * Returns a stream whose elements are the URLs of all the resources with
+     * the given name. A resource is some data (images, audio, text, etc) that
+     * can be accessed by class code in a way that is independent of the
+     * location of the code.
+     *
+     * Resources in a named module are private to that module. This method does
+     * not find resources in named modules.
+     *
+     * <p> The name of a resource is a {@code /}-separated path name that
+     * identifies the resource.
+     *
+     * <p> The search order is described in the documentation for {@link
+     * #getResource(String)}.
+     *
+     * <p> The resources will be located when the returned stream is evaluated.
+     * If the evaluation results in an {@code IOException} then the I/O
+     * exception is wrapped in an {@link UncheckedIOException} that is then
+     * thrown.
+     *
+     * @apiNote When overriding this method it is recommended that an
+     * implementation ensures that any delegation is consistent with the {@link
+     * #getResource(java.lang.String) getResource(String)} method. This should
+     * ensure that the first element returned by the stream is the same
+     * resource that the {@code getResource(String)} method would return.
+     *
+     * @param  name
+     *         The resource name
+     *
+     * @return  A stream of resource {@link java.net.URL URL} objects. If no
+     *          resources could  be found, the stream will be empty.  Resources
+     *          that the class loader doesn't have access to will not be in the
+     *          stream.
+     *
+     * @see  #findResources(String)
+     *
+     * @since  9
+     */
+    public Stream<URL> resources(String name) {
+        int characteristics = Spliterator.NONNULL | Spliterator.IMMUTABLE;
+        Supplier<Spliterator<URL>> si = () -> {
+            try {
+                return Spliterators.spliteratorUnknownSize(
+                    getResources(name).asIterator(), characteristics);
+            } catch (IOException e) {
+                throw new UncheckedIOException(e);
+            }
+        };
+        return StreamSupport.stream(si, characteristics, false);
+    }
+
+    /**
      * Finds the resource with the given name. Class loader implementations
      * should override this method to specify where to find resources.
      *
@@ -1437,11 +1483,7 @@
      * @since  1.1
      */
     public static URL getSystemResource(String name) {
-        ClassLoader system = getSystemClassLoader();
-        if (system == null) {
-            return BootLoader.findResource(name);
-        }
-        return system.getResource(name);
+        return getSystemClassLoader().getResource(name);
     }
 
     /**
@@ -1464,17 +1506,13 @@
      *
      * @throws  IOException
      *          If I/O errors occur
-
+     *
      * @since  1.2
      */
     public static Enumeration<URL> getSystemResources(String name)
         throws IOException
     {
-        ClassLoader system = getSystemClassLoader();
-        if (system == null) {
-            return BootLoader.findResources(name);
-        }
-        return system.getResources(name);
+        return getSystemClassLoader().getResources(name);
     }
 
     /**
@@ -1631,8 +1669,7 @@
      * this method during startup should take care not to cache the return
      * value until the system is fully initialized.
      *
-     * @return  The system <tt>ClassLoader</tt> for delegation, or
-     *          <tt>null</tt> if none
+     * @return  The system <tt>ClassLoader</tt> for delegation
      *
      * @throws  SecurityException
      *          If a security manager is present, and the caller's class loader
@@ -1941,9 +1978,14 @@
      * @return The {@code Package} of the given name defined by this class loader,
      *         or {@code null} if not found
      *
+     * @throws  NullPointerException
+     *          if {@code name} is {@code null}.
+     *
      * @since  9
      */
     public final Package getDefinedPackage(String name) {
+        Objects.requireNonNull(name, "name cannot be null");
+
         NamedPackage p = packages.get(name);
         if (p == null)
             return null;
@@ -1981,6 +2023,9 @@
      * @return The {@code Package} corresponding to the given name defined by
      *         this class loader or its ancestors, or {@code null} if not found.
      *
+     * @throws  NullPointerException
+     *          if {@code name} is {@code null}.
+     *
      * @deprecated
      * If multiple class loaders delegate to each other and define classes
      * with the same package name, and one such loader relies on the lookup
--- a/src/java.base/share/classes/java/lang/Compiler.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/lang/Compiler.java	Mon Sep 12 22:04:48 2016 +0000
@@ -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
@@ -29,21 +29,18 @@
  * The {@code Compiler} class is provided to support Java-to-native-code
  * compilers and related services. By design, the {@code Compiler} class does
  * nothing; it serves as a placeholder for a JIT compiler implementation.
+ * If no compiler is available, these methods do nothing.
  *
- * <p> When the Java Virtual Machine first starts, it determines if the system
- * property {@code java.compiler} exists. (System properties are accessible
- * through {@link System#getProperty(String)} and {@link
- * System#getProperty(String, String)}.  If so, it is assumed to be the name of
- * a library (with a platform-dependent exact location and type); {@link
- * System#loadLibrary} is called to load that library. If this loading
- * succeeds, the function named {@code java_lang_Compiler_start()} in that
- * library is called.
- *
- * <p> If no compiler is available, these methods do nothing.
+ * @deprecated JIT compilers and their technologies vary too widely to
+ * be controlled effectively by a standardized interface. As such, many
+ * JIT compiler implementations ignore this interface, and are instead
+ * controllable by implementation-specific mechanisms such as command-line
+ * options. This class is subject to removal in a future version of Java SE.
  *
  * @author  Frank Yellin
  * @since   1.0
  */
+@Deprecated(since="9", forRemoval=true)
 public final class Compiler  {
     private Compiler() {}               // don't make instances
 
--- a/src/java.base/share/classes/java/lang/Package.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/lang/Package.java	Mon Sep 12 22:04:48 2016 +0000
@@ -317,6 +317,9 @@
      * @return The {@code Package} of the given name defined by the caller's
      *         class loader or its ancestors, or {@code null} if not found.
      *
+     * @throws NullPointerException
+     *         if {@code name} is {@code null}.
+     *
      * @deprecated
      * If multiple class loaders delegate to each other and define classes
      * with the same package name, and one such loader relies on the lookup
--- a/src/java.base/share/classes/java/lang/Runtime.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/lang/Runtime.java	Mon Sep 12 22:04:48 2016 +0000
@@ -733,6 +733,7 @@
      * @deprecated
      * This method was intended to control instruction tracing.
      * It has been superseded by JVM-specific tracing mechanisms.
+     * This method is subject to removal in a future version of Java SE.
      *
      * @param on ignored
      */
@@ -745,6 +746,7 @@
      * @deprecated
      * This method was intended to control method call tracing.
      * It has been superseded by JVM-specific tracing mechanisms.
+     * This method is subject to removal in a future version of Java SE.
      *
      * @param on ignored
      */
--- a/src/java.base/share/classes/java/lang/RuntimePermission.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/lang/RuntimePermission.java	Mon Sep 12 22:04:48 2016 +0000
@@ -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
@@ -323,11 +323,9 @@
  *   <td>usePolicy</td>
  *   <td>Granting this permission disables the Java Plug-In's default
  *   security prompting behavior.</td>
- *   <td>For more information, refer to Java Plug-In's guides, <a href=
- *   "../../../technotes/guides/plugin/developer_guide/security.html">
- *   Applet Security Basics</a> and <a href=
- *   "../../../technotes/guides/plugin/developer_guide/rsa_how.html#use">
- *   usePolicy Permission</a>.</td>
+ *   <td>For more information, refer to the <a href=
+ *   "../../../technotes/guides/deploy/index.html">deployment guide</a>.
+ *   </td>
  * </tr>
  * <tr>
  *   <td>manageProcess</td>
--- a/src/java.base/share/classes/java/lang/StringConcatHelper.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/lang/StringConcatHelper.java	Mon Sep 12 22:04:48 2016 +0000
@@ -334,11 +334,15 @@
     /**
      * Instantiates the String with given buffer and coder
      * @param buf     buffer to use
+     * @param index   remaining index
      * @param coder   coder to use
      * @return String resulting string
      */
-    static String newString(byte[] buf, byte coder) {
+    static String newString(byte[] buf, int index, byte coder) {
         // Use the private, non-copying constructor (unsafe!)
+        if (index != 0) {
+            throw new InternalError("Storage is not completely initialized, " + index + " bytes left");
+        }
         return new String(buf, coder);
     }
 
--- a/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java	Mon Sep 12 22:04:48 2016 +0000
@@ -83,7 +83,9 @@
                 FOLD_ARGS = 11,
                 FOLD_ARGS_TO_VOID = 12,
                 PERMUTE_ARGS = 13,
-                LOCAL_TYPES = 14;
+                LOCAL_TYPES = 14,
+                FOLD_SELECT_ARGS = 15,
+                FOLD_SELECT_ARGS_TO_VOID = 16;
 
         private static final boolean STRESS_TEST = false; // turn on to disable most packing
         private static final int
@@ -695,6 +697,72 @@
         return buf.endEdit();
     }
 
+    private LambdaForm makeArgumentCombinationForm(int pos,
+                                                   MethodType combinerType,
+                                                   int[] argPositions,
+                                                   boolean keepArguments,
+                                                   boolean dropResult) {
+        LambdaFormBuffer buf = buffer();
+        buf.startEdit();
+        int combinerArity = combinerType.parameterCount();
+        assert(combinerArity == argPositions.length);
+
+        int resultArity = (dropResult ? 0 : 1);
+
+        assert(pos <= lambdaForm.arity);
+        assert(pos > 0);  // cannot filter the MH arg itself
+        assert(combinerType == combinerType.basicType());
+        assert(combinerType.returnType() != void.class || dropResult);
+
+        BoundMethodHandle.SpeciesData oldData = oldSpeciesData();
+        BoundMethodHandle.SpeciesData newData = newSpeciesData(L_TYPE);
+
+        // The newly created LF will run with a different BMH.
+        // Switch over any pre-existing BMH field references to the new BMH class.
+        Name oldBaseAddress = lambdaForm.parameter(0);  // BMH holding the values
+        buf.replaceFunctions(oldData.getterFunctions(), newData.getterFunctions(), oldBaseAddress);
+        Name newBaseAddress = oldBaseAddress.withConstraint(newData);
+        buf.renameParameter(0, newBaseAddress);
+
+        Name getCombiner = new Name(newData.getterFunction(oldData.fieldCount()), newBaseAddress);
+        Object[] combinerArgs = new Object[1 + combinerArity];
+        combinerArgs[0] = getCombiner;
+        Name[] newParams;
+        if (keepArguments) {
+            newParams = new Name[0];
+            for (int i = 0; i < combinerArity; i++) {
+                combinerArgs[i + 1] = lambdaForm.parameter(1 + argPositions[i]);
+                assert (basicType(combinerType.parameterType(i)) == lambdaForm.parameterType(1 + argPositions[i]));
+            }
+        } else {
+            newParams = new Name[combinerArity];
+            for (int i = 0; i < newParams.length; i++) {
+                newParams[i] = lambdaForm.parameter(1 + argPositions[i]);
+                assert (basicType(combinerType.parameterType(i)) == lambdaForm.parameterType(1 + argPositions[i]));
+            }
+            System.arraycopy(newParams, 0,
+                             combinerArgs, 1, combinerArity);
+        }
+        Name callCombiner = new Name(combinerType, combinerArgs);
+
+        // insert the two new expressions
+        int exprPos = lambdaForm.arity();
+        buf.insertExpression(exprPos+0, getCombiner);
+        buf.insertExpression(exprPos+1, callCombiner);
+
+        // insert new arguments, if needed
+        int argPos = pos + resultArity;  // skip result parameter
+        for (Name newParam : newParams) {
+            buf.insertParameter(argPos++, newParam);
+        }
+        assert(buf.lastIndexOf(callCombiner) == exprPos+1+newParams.length);
+        if (!dropResult) {
+            buf.replaceParameterByCopy(pos, exprPos+1+newParams.length);
+        }
+
+        return buf.endEdit();
+    }
+
     LambdaForm filterReturnForm(BasicType newType, boolean constantZero) {
         byte kind = (constantZero ? Transform.FILTER_RETURN_TO_ZERO : Transform.FILTER_RETURN);
         Transform key = Transform.of(kind, newType.ordinal());
@@ -759,6 +827,21 @@
         return putInCache(key, form);
     }
 
+    LambdaForm foldArgumentsForm(int foldPos, boolean dropResult, MethodType combinerType, int ... argPositions) {
+        byte kind = (dropResult ? Transform.FOLD_SELECT_ARGS_TO_VOID
+                                : Transform.FOLD_SELECT_ARGS);
+        int[] keyArgs = Arrays.copyOf(argPositions, argPositions.length + 1);
+        keyArgs[argPositions.length] = foldPos;
+        Transform key = Transform.of(kind, keyArgs);
+        LambdaForm form = getInCache(key);
+        if (form != null) {
+            assert(form.arity == lambdaForm.arity - (kind == Transform.FOLD_SELECT_ARGS ? 1 : 0));
+            return form;
+        }
+        form = makeArgumentCombinationForm(foldPos, combinerType, argPositions, true, dropResult);
+        return putInCache(key, form);
+    }
+
     LambdaForm permuteArgumentsForm(int skip, int[] reorder) {
         assert(skip == 1);  // skip only the leading MH argument, names[0]
         int length = lambdaForm.names.length;
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Mon Sep 12 22:04:48 2016 +0000
@@ -3943,6 +3943,33 @@
         return rtype;
     }
 
+    private static Class<?> foldArgumentChecks(int foldPos, MethodType targetType, MethodType combinerType, int ... argPos) {
+        int foldArgs = combinerType.parameterCount();
+        if (argPos.length != foldArgs) {
+            throw newIllegalArgumentException("combiner and argument map must be equal size", combinerType, argPos.length);
+        }
+        Class<?> rtype = combinerType.returnType();
+        int foldVals = rtype == void.class ? 0 : 1;
+        boolean ok = true;
+        for (int i = 0; i < foldArgs; i++) {
+            int arg = argPos[i];
+            if (arg < 0 || arg > targetType.parameterCount()) {
+                throw newIllegalArgumentException("arg outside of target parameterRange", targetType, arg);
+            }
+            if (combinerType.parameterType(i) != targetType.parameterType(arg)) {
+                throw newIllegalArgumentException("target argument type at position " + arg
+                        + " must match combiner argument type at index " + i + ": " + targetType
+                        + " -> " + combinerType + ", map: " + Arrays.toString(argPos));
+            }
+        }
+        if (ok && foldVals != 0 && combinerType.returnType() != targetType.parameterType(foldPos)) {
+            ok = false;
+        }
+        if (!ok)
+            throw misMatchedTypes("target and combiner types", targetType, combinerType);
+        return rtype;
+    }
+
     /**
      * Makes a method handle which adapts a target method handle,
      * by guarding it with a test, a boolean-valued method handle.
@@ -4949,6 +4976,27 @@
         return result;
     }
 
+    /**
+     * As {@see foldArguments(MethodHandle, int, MethodHandle)}, but with the
+     * added capability of selecting the arguments from the targets parameters
+     * to call the combiner with. This allows us to avoid some simple cases of
+     * permutations and padding the combiner with dropArguments to select the
+     * right argument, which may ultimately produce fewer intermediaries.
+     */
+    static MethodHandle foldArguments(MethodHandle target, int pos, MethodHandle combiner, int ... argPositions) {
+        MethodType targetType = target.type();
+        MethodType combinerType = combiner.type();
+        Class<?> rtype = foldArgumentChecks(pos, targetType, combinerType, argPositions);
+        BoundMethodHandle result = target.rebind();
+        boolean dropResult = rtype == void.class;
+        LambdaForm lform = result.editor().foldArgumentsForm(1 + pos, dropResult, combinerType.basicType(), argPositions);
+        MethodType newType = targetType;
+        if (!dropResult) {
+            newType = newType.dropParameterTypes(pos, pos + 1);
+        }
+        result = result.copyWithExtendL(newType, lform, combiner);
+        return result;
+    }
 
     private static void checkLoop0(MethodHandle[][] clauses) {
         if (clauses == null || clauses.length == 0) {
--- a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Mon Sep 12 22:04:48 2016 +0000
@@ -563,9 +563,8 @@
         }
 
         if ((lookup.lookupModes() & MethodHandles.Lookup.PRIVATE) == 0) {
-            throw new StringConcatException(String.format(
-                    "Invalid caller: %s",
-                    lookup.lookupClass().getName()));
+            throw new StringConcatException("Invalid caller: " +
+                    lookup.lookupClass().getName());
         }
 
         int cCount = 0;
@@ -1494,51 +1493,41 @@
             // Drop all remaining parameter types, leave only helper arguments:
             MethodHandle mh;
 
-            mh = MethodHandles.dropArguments(NEW_STRING, 2, ptypes);
-            mh = MethodHandles.dropArguments(mh, 0, int.class);
+            mh = MethodHandles.dropArguments(NEW_STRING, 3, ptypes);
 
-            // Safety: check that remaining index is zero -- that would mean the storage is completely
-            // overwritten, and no leakage of uninitialized data occurred.
-            mh = MethodHandles.filterArgument(mh, 0, CHECK_INDEX);
-
-            // Mix in prependers. This happens when (int, byte[], byte) = (index, storage, coder) is already
+            // Mix in prependers. This happens when (byte[], int, byte) = (storage, index, coder) is already
             // known from the combinators below. We are assembling the string backwards, so "index" is the
             // *ending* index.
             for (RecipeElement el : recipe.getElements()) {
-                MethodHandle prepender;
+                // Do the prepend, and put "new" index at index 1
+                mh = MethodHandles.dropArguments(mh, 2, int.class);
                 switch (el.getTag()) {
-                    case TAG_CONST:
+                    case TAG_CONST: {
                         Object cnst = el.getValue();
-                        prepender = MethodHandles.insertArguments(prepender(cnst.getClass()), 3, cnst);
+                        MethodHandle prepender = MethodHandles.insertArguments(prepender(cnst.getClass()), 3, cnst);
+                        mh = MethodHandles.foldArguments(mh, 1, prepender,
+                                2, 0, 3 // index, storage, coder
+                        );
                         break;
-                    case TAG_ARG:
+                    }
+                    case TAG_ARG: {
                         int pos = el.getArgPos();
-                        prepender = selectArgument(prepender(ptypes[pos]), 3, ptypes, pos);
+                        MethodHandle prepender = prepender(ptypes[pos]);
+                        mh = MethodHandles.foldArguments(mh, 1, prepender,
+                                2, 0, 3, // index, storage, coder
+                                4 + pos  // selected argument
+                        );
                         break;
+                    }
                     default:
                         throw new StringConcatException("Unhandled tag: " + el.getTag());
                 }
-
-                // Remove "old" index from arguments
-                mh = MethodHandles.dropArguments(mh, 1, int.class);
-
-                // Do the prepend, and put "new" index at index 0
-                mh = MethodHandles.foldArguments(mh, prepender);
             }
 
-            // Prepare the argument list for prepending. The tree below would instantiate
-            // the storage byte[] into argument 0, so we need to swap "storage" and "index".
-            // The index at this point equals to "size", and resides at argument 1.
-            {
-                MethodType nmt = mh.type()
-                        .changeParameterType(0, byte[].class)
-                        .changeParameterType(1, int.class);
-                mh = MethodHandles.permuteArguments(mh, nmt, swap10(nmt.parameterCount()));
-            }
-
-            // Fold in byte[] instantiation at argument 0.
-            MethodHandle combiner = MethodHandles.dropArguments(NEW_ARRAY, 2, ptypes);
-            mh = MethodHandles.foldArguments(mh, combiner);
+            // Fold in byte[] instantiation at argument 0
+            mh = MethodHandles.foldArguments(mh, 0, NEW_ARRAY,
+                    1, 2 // index, coder
+            );
 
             // Start combining length and coder mixers.
             //
@@ -1567,12 +1556,8 @@
                         int ac = el.getArgPos();
 
                         Class<?> argClass = ptypes[ac];
-                        MethodHandle lm = selectArgument(lengthMixer(argClass), 1, ptypes, ac);
-                        lm = MethodHandles.dropArguments(lm, 0, byte.class); // (*)
-                        lm = MethodHandles.dropArguments(lm, 2, byte.class);
-
-                        MethodHandle cm = selectArgument(coderMixer(argClass),  1, ptypes, ac);
-                        cm = MethodHandles.dropArguments(cm, 0, int.class);  // (**)
+                        MethodHandle lm = lengthMixer(argClass);
+                        MethodHandle cm = coderMixer(argClass);
 
                         // Read this bottom up:
 
@@ -1580,12 +1565,18 @@
                         mh = MethodHandles.dropArguments(mh, 2, int.class, byte.class);
 
                         // 3. Compute "new-index", producing ("new-index", "new-coder", "old-index", "old-coder", <args>)
-                        //    Length mixer ignores both "new-coder" and "old-coder" due to dropArguments above (*)
-                        mh = MethodHandles.foldArguments(mh, lm);
+                        //    Length mixer needs old index, plus the appropriate argument
+                        mh = MethodHandles.foldArguments(mh, 0, lm,
+                                2, // old-index
+                                4 + ac // selected argument
+                        );
 
                         // 2. Compute "new-coder", producing ("new-coder", "old-index", "old-coder", <args>)
-                        //    Coder mixer ignores the "old-index" arg due to dropArguments above (**)
-                        mh = MethodHandles.foldArguments(mh, cm);
+                        //    Coder mixer needs old coder, plus the appropriate argument.
+                        mh = MethodHandles.foldArguments(mh, 0, cm,
+                                2, // old-coder
+                                3 + ac // selected argument
+                        );
 
                         // 1. The mh shape here is ("old-index", "old-coder", <args>)
                         break;
@@ -1606,41 +1597,11 @@
             return mh;
         }
 
-        private static int[] swap10(int count) {
-            int[] perm = new int[count];
-            perm[0] = 1;
-            perm[1] = 0;
-            for (int i = 2; i < count; i++) {
-                perm[i] = i;
-            }
-            return perm;
-        }
-
-        // Adapts: (...prefix..., parameter[pos])R -> (...prefix..., ...parameters...)R
-        private static MethodHandle selectArgument(MethodHandle mh, int prefix, Class<?>[] ptypes, int pos) {
-            if (pos == 0) {
-                return MethodHandles.dropArguments(mh, prefix + 1, Arrays.copyOfRange(ptypes, 1, ptypes.length));
-            } else if (pos == ptypes.length - 1) {
-                return MethodHandles.dropArguments(mh, prefix, Arrays.copyOf(ptypes, ptypes.length - 1));
-            } else { // 0 < pos < ptypes.size() - 1
-                MethodHandle t = MethodHandles.dropArguments(mh, prefix, Arrays.copyOf(ptypes, pos));
-                return MethodHandles.dropArguments(t, prefix + 1 + pos, Arrays.copyOfRange(ptypes, pos + 1, ptypes.length));
-            }
-        }
-
         @ForceInline
         private static byte[] newArray(int length, byte coder) {
             return (byte[]) UNSAFE.allocateUninitializedArray(byte.class, length << coder);
         }
 
-        @ForceInline
-        private static int checkIndex(int index) {
-            if (index != 0) {
-                throw new IllegalStateException("Storage is not completely initialized, " + index + " bytes left");
-            }
-            return index;
-        }
-
         private static MethodHandle prepender(Class<?> cl) {
             return PREPENDERS.computeIfAbsent(cl, PREPEND);
         }
@@ -1678,7 +1639,6 @@
         };
 
         private static final MethodHandle NEW_STRING;
-        private static final MethodHandle CHECK_INDEX;
         private static final MethodHandle NEW_ARRAY;
         private static final ConcurrentMap<Class<?>, MethodHandle> PREPENDERS;
         private static final ConcurrentMap<Class<?>, MethodHandle> LENGTH_MIXERS;
@@ -1699,9 +1659,8 @@
             LENGTH_MIXERS = new ConcurrentHashMap<>();
             CODER_MIXERS = new ConcurrentHashMap<>();
 
-            NEW_STRING = lookupStatic(Lookup.IMPL_LOOKUP, STRING_HELPER, "newString", String.class, byte[].class, byte.class);
+            NEW_STRING = lookupStatic(Lookup.IMPL_LOOKUP, STRING_HELPER, "newString", String.class, byte[].class, int.class, byte.class);
             NEW_ARRAY  = lookupStatic(Lookup.IMPL_LOOKUP, MethodHandleInlineCopyStrategy.class, "newArray", byte[].class, int.class, byte.class);
-            CHECK_INDEX = lookupStatic(Lookup.IMPL_LOOKUP, MethodHandleInlineCopyStrategy.class, "checkIndex", int.class, int.class);
         }
     }
 
--- a/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Mon Sep 12 22:04:48 2016 +0000
@@ -152,7 +152,6 @@
  * {@link #getAndAdd getAndAdd},
  * {@link #getAndAddAcquire getAndAddAcquire},
  * {@link #getAndAddRelease getAndAddRelease},
- * {@link #addAndGet addAndGet}.
  * <li>bitwise atomic update access modes that, for example, atomically get and
  * bitwise OR the value of a variable under specified memory ordering
  * effects.
--- a/src/java.base/share/classes/java/lang/ref/package-info.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/lang/ref/package-info.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, 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
@@ -43,8 +43,7 @@
  * implementing memory-sensitive caches, weak references are for
  * implementing canonicalizing mappings that do not prevent their keys
  * (or values) from being reclaimed, and phantom references are for
- * scheduling pre-mortem cleanup actions in a more flexible way than
- * is possible with the Java finalization mechanism.
+ * scheduling post-mortem cleanup actions.
  * Post-mortem cleanup actions can be registered and managed by a
  * {@link java.lang.ref.Cleaner}.
  *
--- a/src/java.base/share/classes/java/security/DigestInputStream.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/security/DigestInputStream.java	Mon Sep 12 22:04:48 2016 +0000
@@ -52,7 +52,7 @@
  * {@link MessageDigest}),
  * so that in order to compute intermediate digests, a caller should
  * retain a handle onto the digest object, and clone it for each
- * digest to be computed, leaving the orginal digest untouched.
+ * digest to be computed, leaving the original digest untouched.
  *
  * @see MessageDigest
  *
--- a/src/java.base/share/classes/java/security/KeyPairGenerator.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/security/KeyPairGenerator.java	Mon Sep 12 22:04:48 2016 +0000
@@ -76,7 +76,7 @@
  * {@code g} parameters. If the modulus size is not one of the above
  * values, the <i>Sun</i> provider creates a new set of parameters. Other
  * providers might have precomputed parameter sets for more than just the
- * three modulus sizes mentioned above. Still others might not have a list of
+ * modulus sizes mentioned above. Still others might not have a list of
  * precomputed parameters at all and instead always create new parameter sets.
  *
  * <li><b>Algorithm-Specific Initialization</b>
@@ -393,7 +393,7 @@
      * of randomness.
      * (If none of the installed providers supply an implementation of
      * {@code SecureRandom}, a system-provided source of randomness is
-     * used.).
+     * used.)
      *
      * <p>This concrete method has been added to this previously-defined
      * abstract class.
--- a/src/java.base/share/classes/java/security/SignatureSpi.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/security/SignatureSpi.java	Mon Sep 12 22:04:48 2016 +0000
@@ -38,7 +38,7 @@
  * for the {@code Signature} class, which is used to provide the
  * functionality of a digital signature algorithm. Digital signatures are used
  * for authentication and integrity assurance of digital data.
- *.
+ *
  * <p> All the abstract methods in this class must be implemented by each
  * cryptographic service provider who wishes to supply the implementation
  * of a particular signature algorithm.
--- a/src/java.base/share/classes/java/util/ArrayDeque.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/ArrayDeque.java	Mon Sep 12 22:04:48 2016 +0000
@@ -81,8 +81,8 @@
  * Java Collections Framework</a>.
  *
  * @author  Josh Bloch and Doug Lea
+ * @param <E> the type of elements held in this deque
  * @since   1.6
- * @param <E> the type of elements held in this deque
  */
 public class ArrayDeque<E> extends AbstractCollection<E>
                            implements Deque<E>, Cloneable, Serializable
--- a/src/java.base/share/classes/java/util/Base64.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/Base64.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -788,7 +788,7 @@
         public void write(byte[] b, int off, int len) throws IOException {
             if (closed)
                 throw new IOException("Stream is closed");
-            if (off < 0 || len < 0 || off + len > b.length)
+            if (off < 0 || len < 0 || len > b.length - off)
                 throw new ArrayIndexOutOfBoundsException();
             if (len == 0)
                 return;
--- a/src/java.base/share/classes/java/util/ImmutableCollections.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/ImmutableCollections.java	Mon Sep 12 22:04:48 2016 +0000
@@ -31,6 +31,10 @@
 import java.io.ObjectOutputStream;
 import java.io.ObjectStreamException;
 import java.io.Serializable;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
 
 /**
  * Container class for immutable collections. Not part of the public API.
@@ -61,9 +65,25 @@
      */
     static final double EXPAND_FACTOR = 2.0;
 
+    static UnsupportedOperationException uoe() { return new UnsupportedOperationException(); }
+
     // ---------- List Implementations ----------
 
-    static final class List0<E> extends AbstractList<E> implements RandomAccess, Serializable {
+    abstract static class AbstractImmutableList<E> extends AbstractList<E>
+                                                implements RandomAccess, Serializable {
+        @Override public boolean add(E e) { throw uoe(); }
+        @Override public boolean addAll(Collection<? extends E> c) { throw uoe(); }
+        @Override public boolean addAll(int index, Collection<? extends E> c) { throw uoe(); }
+        @Override public void    clear() { throw uoe(); }
+        @Override public boolean remove(Object o) { throw uoe(); }
+        @Override public boolean removeAll(Collection<?> c) { throw uoe(); }
+        @Override public boolean removeIf(Predicate<? super E> filter) { throw uoe(); }
+        @Override public void    replaceAll(UnaryOperator<E> operator) { throw uoe(); }
+        @Override public boolean retainAll(Collection<?> c) { throw uoe(); }
+        @Override public void    sort(Comparator<? super E> c) { throw uoe(); }
+    }
+
+    static final class List0<E> extends AbstractImmutableList<E> {
         List0() { }
 
         @Override
@@ -86,7 +106,7 @@
         }
     }
 
-    static final class List1<E> extends AbstractList<E> implements RandomAccess, Serializable {
+    static final class List1<E> extends AbstractImmutableList<E> {
         private final E e0;
 
         List1(E e0) {
@@ -114,7 +134,7 @@
         }
     }
 
-    static final class List2<E> extends AbstractList<E> implements RandomAccess, Serializable {
+    static final class List2<E> extends AbstractImmutableList<E> {
         private final E e0;
         private final E e1;
 
@@ -147,7 +167,7 @@
         }
     }
 
-    static final class ListN<E> extends AbstractList<E> implements RandomAccess, Serializable {
+    static final class ListN<E> extends AbstractImmutableList<E> {
         private final E[] elements;
 
         @SafeVarargs
@@ -183,7 +203,17 @@
 
     // ---------- Set Implementations ----------
 
-    static final class Set0<E> extends AbstractSet<E> implements Serializable {
+    abstract static class AbstractImmutableSet<E> extends AbstractSet<E> implements Serializable {
+        @Override public boolean add(E e) { throw uoe(); }
+        @Override public boolean addAll(Collection<? extends E> c) { throw uoe(); }
+        @Override public void    clear() { throw uoe(); }
+        @Override public boolean remove(Object o) { throw uoe(); }
+        @Override public boolean removeAll(Collection<?> c) { throw uoe(); }
+        @Override public boolean removeIf(Predicate<? super E> filter) { throw uoe(); }
+        @Override public boolean retainAll(Collection<?> c) { throw uoe(); }
+    }
+
+    static final class Set0<E> extends AbstractImmutableSet<E> {
         Set0() { }
 
         @Override
@@ -210,7 +240,7 @@
         }
     }
 
-    static final class Set1<E> extends AbstractSet<E> implements Serializable {
+    static final class Set1<E> extends AbstractImmutableSet<E> {
         private final E e0;
 
         Set1(E e0) {
@@ -241,7 +271,7 @@
         }
     }
 
-    static final class Set2<E> extends AbstractSet<E> implements Serializable {
+    static final class Set2<E> extends AbstractImmutableSet<E> {
         private final E e0;
         private final E e1;
 
@@ -312,7 +342,7 @@
      * least one null is always present.
      * @param <E> the element type
      */
-    static final class SetN<E> extends AbstractSet<E> implements Serializable {
+    static final class SetN<E> extends AbstractImmutableSet<E> {
         private final E[] elements;
         private final int size;
 
@@ -403,7 +433,23 @@
 
     // ---------- Map Implementations ----------
 
-    static final class Map0<K,V> extends AbstractMap<K,V> implements Serializable {
+    abstract static class AbstractImmutableMap<K,V> extends AbstractMap<K,V> implements Serializable {
+        @Override public void clear() { throw uoe(); }
+        @Override public V compute(K key, BiFunction<? super K,? super V,? extends V> rf) { throw uoe(); }
+        @Override public V computeIfAbsent(K key, Function<? super K,? extends V> mf) { throw uoe(); }
+        @Override public V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> rf) { throw uoe(); }
+        @Override public V merge(K key, V value, BiFunction<? super V,? super V,? extends V> rf) { throw uoe(); }
+        @Override public V put(K key, V value) { throw uoe(); }
+        @Override public void putAll(Map<? extends K,? extends V> m) { throw uoe(); }
+        @Override public V putIfAbsent(K key, V value) { throw uoe(); }
+        @Override public V remove(Object key) { throw uoe(); }
+        @Override public boolean remove(Object key, Object value) { throw uoe(); }
+        @Override public V replace(K key, V value) { throw uoe(); }
+        @Override public boolean replace(K key, V oldValue, V newValue) { throw uoe(); }
+        @Override public void replaceAll(BiFunction<? super K,? super V,? extends V> f) { throw uoe(); }
+    }
+
+    static final class Map0<K,V> extends AbstractImmutableMap<K,V> {
         Map0() { }
 
         @Override
@@ -430,7 +476,7 @@
         }
     }
 
-    static final class Map1<K,V> extends AbstractMap<K,V> implements Serializable {
+    static final class Map1<K,V> extends AbstractImmutableMap<K,V> {
         private final K k0;
         private final V v0;
 
@@ -472,7 +518,7 @@
      * @param <K> the key type
      * @param <V> the value type
      */
-    static final class MapN<K,V> extends AbstractMap<K,V> implements Serializable {
+    static final class MapN<K,V> extends AbstractImmutableMap<K,V> {
         private final Object[] table; // pairs of key, value
         private final int size; // number of pairs
 
--- a/src/java.base/share/classes/java/util/List.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/List.java	Mon Sep 12 22:04:48 2016 +0000
@@ -94,7 +94,8 @@
  *
  * <ul>
  * <li>They are <em>structurally immutable</em>. Elements cannot be added, removed,
- * or replaced. Attempts to do so result in {@code UnsupportedOperationException}.
+ * or replaced. Calling any mutator method will always cause
+ * {@code UnsupportedOperationException} to be thrown.
  * However, if the contained elements are themselves mutable,
  * this may cause the List's contents to appear to change.
  * <li>They disallow {@code null} elements. Attempts to create them with
--- a/src/java.base/share/classes/java/util/Map.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/Map.java	Mon Sep 12 22:04:48 2016 +0000
@@ -119,7 +119,8 @@
  *
  * <ul>
  * <li>They are <em>structurally immutable</em>. Keys and values cannot be added,
- * removed, or updated. Attempts to do so result in {@code UnsupportedOperationException}.
+ * removed, or updated. Calling any mutator method will always cause
+ * {@code UnsupportedOperationException} to be thrown.
  * However, if the contained keys or values are themselves mutable, this may cause the
  * Map to behave inconsistently or its contents to appear to change.
  * <li>They disallow {@code null} keys and values. Attempts to create them with
--- a/src/java.base/share/classes/java/util/PriorityQueue.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/PriorityQueue.java	Mon Sep 12 22:04:48 2016 +0000
@@ -749,11 +749,11 @@
     /**
      * Saves this queue to a stream (that is, serializes it).
      *
+     * @param s the stream
+     * @throws java.io.IOException if an I/O error occurs
      * @serialData The length of the array backing the instance is
      *             emitted (int), followed by all of its elements
      *             (each an {@code Object}) in the proper order.
-     * @param s the stream
-     * @throws java.io.IOException if an I/O error occurs
      */
     private void writeObject(java.io.ObjectOutputStream s)
         throws java.io.IOException {
--- a/src/java.base/share/classes/java/util/Set.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/Set.java	Mon Sep 12 22:04:48 2016 +0000
@@ -70,7 +70,8 @@
  *
  * <ul>
  * <li>They are <em>structurally immutable</em>. Elements cannot be added or
- * removed. Attempts to do so result in {@code UnsupportedOperationException}.
+ * removed. Calling any mutator method will always cause
+ * {@code UnsupportedOperationException} to be thrown.
  * However, if the contained elements are themselves mutable, this may cause the
  * Set to behave inconsistently or its contents to appear to change.
  * <li>They disallow {@code null} elements. Attempts to create them with
--- a/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java	Mon Sep 12 22:04:48 2016 +0000
@@ -136,9 +136,9 @@
  * }}</pre>
  *
  * @author Doug Lea
- * @since 1.8
  * @param <T> The result type returned by this future's {@code join}
  * and {@code get} methods
+ * @since 1.8
  */
 public class CompletableFuture<T> implements Future<T>, CompletionStage<T> {
 
--- a/src/java.base/share/classes/java/util/concurrent/CountedCompleter.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/CountedCompleter.java	Mon Sep 12 22:04:48 2016 +0000
@@ -120,102 +120,114 @@
  * to complete for some elements than others, either because of
  * intrinsic variation (for example I/O) or auxiliary effects such as
  * garbage collection.  Because CountedCompleters provide their own
- * continuations, other threads need not block waiting to perform
- * them.
+ * continuations, other tasks need not block waiting to perform them.
  *
- * <p>For example, here is an initial version of a class that uses
- * divide-by-two recursive decomposition to divide work into single
- * pieces (leaf tasks). Even when work is split into individual calls,
- * tree-based techniques are usually preferable to directly forking
- * leaf tasks, because they reduce inter-thread communication and
- * improve load balancing. In the recursive case, the second of each
- * pair of subtasks to finish triggers completion of its parent
+ * <p>For example, here is an initial version of a utility method that
+ * uses divide-by-two recursive decomposition to divide work into
+ * single pieces (leaf tasks). Even when work is split into individual
+ * calls, tree-based techniques are usually preferable to directly
+ * forking leaf tasks, because they reduce inter-thread communication
+ * and improve load balancing. In the recursive case, the second of
+ * each pair of subtasks to finish triggers completion of their parent
  * (because no result combination is performed, the default no-op
  * implementation of method {@code onCompletion} is not overridden).
- * A static utility method sets up the base task and invokes it
- * (here, implicitly using the {@link ForkJoinPool#commonPool()}).
+ * The utility method sets up the root task and invokes it (here,
+ * implicitly using the {@link ForkJoinPool#commonPool()}).  It is
+ * straightforward and reliable (but not optimal) to always set the
+ * pending count to the number of child tasks and call {@code
+ * tryComplete()} immediately before returning.
  *
  * <pre> {@code
- * class MyOperation<E> { void apply(E e) { ... }  }
+ * public static <E> void forEach(E[] array, Consumer<E> action) {
+ *   class Task extends CountedCompleter<Void> {
+ *     final int lo, hi;
+ *     Task(Task parent, int lo, int hi) {
+ *       super(parent); this.lo = lo; this.hi = hi;
+ *     }
  *
- * class ForEach<E> extends CountedCompleter<Void> {
- *
- *   public static <E> void forEach(E[] array, MyOperation<E> op) {
- *     new ForEach<E>(null, array, op, 0, array.length).invoke();
+ *     public void compute() {
+ *       if (hi - lo >= 2) {
+ *         int mid = (lo + hi) >>> 1;
+ *         // must set pending count before fork
+ *         setPendingCount(2);
+ *         new Task(this, mid, hi).fork(); // right child
+ *         new Task(this, lo, mid).fork(); // left child
+ *       }
+ *       else if (hi > lo)
+ *         action.accept(array[lo]);
+ *       tryComplete();
+ *     }
  *   }
- *
- *   final E[] array; final MyOperation<E> op; final int lo, hi;
- *   ForEach(CountedCompleter<?> p, E[] array, MyOperation<E> op, int lo, int hi) {
- *     super(p);
- *     this.array = array; this.op = op; this.lo = lo; this.hi = hi;
- *   }
- *
- *   public void compute() { // version 1
- *     if (hi - lo >= 2) {
- *       int mid = (lo + hi) >>> 1;
- *       setPendingCount(2); // must set pending count before fork
- *       new ForEach(this, array, op, mid, hi).fork(); // right child
- *       new ForEach(this, array, op, lo, mid).fork(); // left child
- *     }
- *     else if (hi > lo)
- *       op.apply(array[lo]);
- *     tryComplete();
- *   }
+ *   new Task(null, 0, array.length).invoke();
  * }}</pre>
  *
  * This design can be improved by noticing that in the recursive case,
  * the task has nothing to do after forking its right task, so can
  * directly invoke its left task before returning. (This is an analog
- * of tail recursion removal.)  Also, because the task returns upon
- * executing its left task (rather than falling through to invoke
- * {@code tryComplete}) the pending count is set to one:
+ * of tail recursion removal.)  Also, when the last action in a task
+ * is to fork or invoke a subtask (a "tail call"), the call to {@code
+ * tryComplete()} can be optimized away, at the cost of making the
+ * pending count look "off by one".
  *
  * <pre> {@code
- * class ForEach<E> ... {
- *   ...
- *   public void compute() { // version 2
- *     if (hi - lo >= 2) {
- *       int mid = (lo + hi) >>> 1;
- *       setPendingCount(1); // only one pending
- *       new ForEach(this, array, op, mid, hi).fork(); // right child
- *       new ForEach(this, array, op, lo, mid).compute(); // direct invoke
+ *     public void compute() {
+ *       if (hi - lo >= 2) {
+ *         int mid = (lo + hi) >>> 1;
+ *         setPendingCount(1); // looks off by one, but correct!
+ *         new Task(this, mid, hi).fork(); // right child
+ *         new Task(this, lo, mid).compute(); // direct invoke
+ *       } else {
+ *         if (hi > lo)
+ *           action.accept(array[lo]);
+ *         tryComplete();
+ *       }
+ *     }}</pre>
+ *
+ * As a further optimization, notice that the left task need not even exist.
+ * Instead of creating a new one, we can continue using the original task,
+ * and add a pending count for each fork.  Additionally, because no task
+ * in this tree implements an {@link #onCompletion(CountedCompleter)} method,
+ * {@code tryComplete} can be replaced with {@link #propagateCompletion}.
+ *
+ * <pre> {@code
+ *     public void compute() {
+ *       int n = hi - lo;
+ *       for (; n >= 2; n /= 2) {
+ *         addToPendingCount(1);
+ *         new Task(this, lo + n/2, lo + n).fork();
+ *       }
+ *       if (n > 0)
+ *         action.accept(array[lo]);
+ *       propagateCompletion();
+ *     }}</pre>
+ *
+ * When pending counts can be precomputed, they can be established in
+ * the constructor:
+ *
+ * <pre> {@code
+ * public static <E> void forEach(E[] array, Consumer<E> action) {
+ *   class Task extends CountedCompleter<Void> {
+ *     final int lo, hi;
+ *     Task(Task parent, int lo, int hi) {
+ *       super(parent, 31 - Integer.numberOfLeadingZeros(hi - lo));
+ *       this.lo = lo; this.hi = hi;
  *     }
- *     else {
- *       if (hi > lo)
- *         op.apply(array[lo]);
- *       tryComplete();
+ *
+ *     public void compute() {
+ *       for (int n = hi - lo; n >= 2; n /= 2)
+ *         new Task(this, lo + n/2, lo + n).fork();
+ *       action.accept(array[lo]);
+ *       propagateCompletion();
  *     }
  *   }
+ *   if (array.length > 0)
+ *     new Task(null, 0, array.length).invoke();
  * }}</pre>
  *
- * As a further optimization, notice that the left task need not even exist.
- * Instead of creating a new one, we can iterate using the original task,
- * and add a pending count for each fork.  Additionally, because no task
- * in this tree implements an {@link #onCompletion(CountedCompleter)} method,
- * {@code tryComplete()} can be replaced with {@link #propagateCompletion}.
- *
- * <pre> {@code
- * class ForEach<E> ... {
- *   ...
- *   public void compute() { // version 3
- *     int l = lo, h = hi;
- *     while (h - l >= 2) {
- *       int mid = (l + h) >>> 1;
- *       addToPendingCount(1);
- *       new ForEach(this, array, op, mid, h).fork(); // right child
- *       h = mid;
- *     }
- *     if (h > l)
- *       op.apply(array[l]);
- *     propagateCompletion();
- *   }
- * }}</pre>
- *
- * Additional optimizations of such classes might entail precomputing
- * pending counts so that they can be established in constructors,
- * specializing classes for leaf steps, subdividing by say, four,
- * instead of two per iteration, and using an adaptive threshold
- * instead of always subdividing down to single elements.
+ * Additional optimizations of such classes might entail specializing
+ * classes for leaf steps, subdividing by say, four, instead of two
+ * per iteration, and using an adaptive threshold instead of always
+ * subdividing down to single elements.
  *
  * <p><b>Searching.</b> A tree of CountedCompleters can search for a
  * value or property in different parts of a data structure, and
--- a/src/java.base/share/classes/java/util/concurrent/CyclicBarrier.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/CyclicBarrier.java	Mon Sep 12 22:04:48 2016 +0000
@@ -132,10 +132,10 @@
  * <i>happen-before</i> actions following a successful return from the
  * corresponding {@code await()} in other threads.
  *
- * @since 1.5
  * @see CountDownLatch
  *
  * @author Doug Lea
+ * @since 1.5
  */
 public class CyclicBarrier {
     /**
--- a/src/java.base/share/classes/java/util/concurrent/Flow.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/Flow.java	Mon Sep 12 22:04:48 2016 +0000
@@ -68,7 +68,7 @@
  *   private boolean subscribed; // true after first subscribe
  *   public synchronized void subscribe(Subscriber<? super Boolean> subscriber) {
  *     if (subscribed)
- *        subscriber.onError(new IllegalStateException()); // only one allowed
+ *       subscriber.onError(new IllegalStateException()); // only one allowed
  *     else {
  *       subscribed = true;
  *       subscriber.onSubscribe(new OneShotSubscription(subscriber, executor));
--- a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java	Mon Sep 12 22:04:48 2016 +0000
@@ -130,7 +130,7 @@
  * </table>
  *
  * <p>The common pool is by default constructed with default
- * parameters, but these may be controlled by setting three
+ * parameters, but these may be controlled by setting the following
  * {@linkplain System#getProperty system properties}:
  * <ul>
  * <li>{@code java.util.concurrent.ForkJoinPool.common.parallelism}
@@ -3241,7 +3241,7 @@
          * An ACC to restrict permissions for the factory itself.
          * The constructed workers have no permissions set.
          */
-        private static final AccessControlContext innocuousAcc;
+        private static final AccessControlContext INNOCUOUS_ACC;
         static {
             Permissions innocuousPerms = new Permissions();
             innocuousPerms.add(modifyThreadPermission);
@@ -3249,7 +3249,7 @@
                                    "enableContextClassLoaderOverride"));
             innocuousPerms.add(new RuntimePermission(
                                    "modifyThreadGroup"));
-            innocuousAcc = new AccessControlContext(new ProtectionDomain[] {
+            INNOCUOUS_ACC = new AccessControlContext(new ProtectionDomain[] {
                     new ProtectionDomain(null, innocuousPerms)
                 });
         }
@@ -3260,7 +3260,7 @@
                     public ForkJoinWorkerThread run() {
                         return new ForkJoinWorkerThread.
                             InnocuousForkJoinWorkerThread(pool);
-                    }}, innocuousAcc);
+                    }}, INNOCUOUS_ACC);
         }
     }
 
--- a/src/java.base/share/classes/java/util/concurrent/Semaphore.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/Semaphore.java	Mon Sep 12 22:04:48 2016 +0000
@@ -72,8 +72,8 @@
  *   protected synchronized Object getNextAvailableItem() {
  *     for (int i = 0; i < MAX_AVAILABLE; ++i) {
  *       if (!used[i]) {
- *          used[i] = true;
- *          return items[i];
+ *         used[i] = true;
+ *         return items[i];
  *       }
  *     }
  *     return null; // not reached
@@ -82,11 +82,11 @@
  *   protected synchronized boolean markAsUnused(Object item) {
  *     for (int i = 0; i < MAX_AVAILABLE; ++i) {
  *       if (item == items[i]) {
- *          if (used[i]) {
- *            used[i] = false;
- *            return true;
- *          } else
- *            return false;
+ *         if (used[i]) {
+ *           used[i] = false;
+ *           return true;
+ *         } else
+ *           return false;
  *       }
  *     }
  *     return false;
--- a/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java	Mon Sep 12 22:04:48 2016 +0000
@@ -554,8 +554,9 @@
                 while (r != null) {
                     BufferedSubscription<T> nextRetry = r.nextRetry;
                     r.nextRetry = null;
-                    int stat = (nanos > 0L) ? r.timedOffer(item, nanos) :
-                        r.offer(item);
+                    int stat = (nanos > 0L)
+                        ? r.timedOffer(item, nanos)
+                        : r.offer(item);
                     if (stat == 0 && onDrop != null &&
                         onDrop.test(r.subscriber, item))
                         stat = r.offer(item);
--- a/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java	Mon Sep 12 22:04:48 2016 +0000
@@ -617,6 +617,9 @@
         /** Per-thread task counter */
         volatile long completedTasks;
 
+        // TODO: switch to AbstractQueuedLongSynchronizer and move
+        // completedTasks into the lock word.
+
         /**
          * Creates with given first task and thread from ThreadFactory.
          * @param firstTask the first task (null if none)
--- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Mon Sep 12 22:04:48 2016 +0000
@@ -193,7 +193,7 @@
 
     /**
      * Atomically increments the current value,
-     * with memory effects as specified by {@link VarHandle#addAndGet}.
+     * with memory effects as specified by {@link VarHandle#getAndAdd}.
      *
      * <p>Equivalent to {@code addAndGet(1)}.
      *
@@ -205,7 +205,7 @@
 
     /**
      * Atomically decrements the current value,
-     * with memory effects as specified by {@link VarHandle#addAndGet}.
+     * with memory effects as specified by {@link VarHandle#getAndAdd}.
      *
      * <p>Equivalent to {@code addAndGet(-1)}.
      *
--- a/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java	Mon Sep 12 22:04:48 2016 +0000
@@ -154,13 +154,13 @@
  *     long stamp = sl.tryOptimisticRead();
  *     double currentX = x, currentY = y;
  *     if (!sl.validate(stamp)) {
- *        stamp = sl.readLock();
- *        try {
- *          currentX = x;
- *          currentY = y;
- *        } finally {
- *           sl.unlockRead(stamp);
- *        }
+ *       stamp = sl.readLock();
+ *       try {
+ *         currentX = x;
+ *         currentY = y;
+ *       } finally {
+ *         sl.unlockRead(stamp);
+ *       }
  *     }
  *     return Math.sqrt(currentX * currentX + currentY * currentY);
  *   }
--- a/src/java.base/share/classes/java/util/jar/JarFile.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/jar/JarFile.java	Mon Sep 12 22:04:48 2016 +0000
@@ -836,18 +836,25 @@
     private static final byte[] CLASSPATH_CHARS =
             {'C','L','A','S','S','-','P','A','T','H', ':', ' '};
 
-    // The bad character shift for "class-path:"
+    // The bad character shift for "class-path: "
     private static final byte[] CLASSPATH_LASTOCC;
 
+    // The good suffix shift for "class-path: "
+    private static final byte[] CLASSPATH_OPTOSFT;
+
     private static final byte[] MULTIRELEASE_CHARS =
             {'M','U','L','T','I','-','R','E','L','E', 'A', 'S', 'E', ':',
                     ' ', 'T', 'R', 'U', 'E'};
 
-    // The bad character shift for "multi-release: "
+    // The bad character shift for "multi-release: true"
     private static final byte[] MULTIRELEASE_LASTOCC;
 
+    // The good suffix shift for "multi-release: true"
+    private static final byte[] MULTIRELEASE_OPTOSFT;
+
     static {
         CLASSPATH_LASTOCC = new byte[64];
+        CLASSPATH_OPTOSFT = new byte[12];
         CLASSPATH_LASTOCC[(int)'C' - 32] = 1;
         CLASSPATH_LASTOCC[(int)'L' - 32] = 2;
         CLASSPATH_LASTOCC[(int)'S' - 32] = 5;
@@ -858,8 +865,13 @@
         CLASSPATH_LASTOCC[(int)'H' - 32] = 10;
         CLASSPATH_LASTOCC[(int)':' - 32] = 11;
         CLASSPATH_LASTOCC[(int)' ' - 32] = 12;
+        for (int i = 0; i < 11; i++) {
+            CLASSPATH_OPTOSFT[i] = 12;
+        }
+        CLASSPATH_OPTOSFT[11] = 1;
 
         MULTIRELEASE_LASTOCC = new byte[64];
+        MULTIRELEASE_OPTOSFT = new byte[19];
         MULTIRELEASE_LASTOCC[(int)'M' - 32] = 1;
         MULTIRELEASE_LASTOCC[(int)'I' - 32] = 5;
         MULTIRELEASE_LASTOCC[(int)'-' - 32] = 6;
@@ -872,6 +884,11 @@
         MULTIRELEASE_LASTOCC[(int)'R' - 32] = 17;
         MULTIRELEASE_LASTOCC[(int)'U' - 32] = 18;
         MULTIRELEASE_LASTOCC[(int)'E' - 32] = 19;
+        for (int i = 0; i < 17; i++) {
+            MULTIRELEASE_OPTOSFT[i] = 19;
+        }
+        MULTIRELEASE_OPTOSFT[17] = 6;
+        MULTIRELEASE_OPTOSFT[18] = 1;
     }
 
     private JarEntry getManEntry() {
@@ -913,7 +930,7 @@
      * Since there are no repeated substring in our search strings,
      * the good suffix shifts can be replaced with a comparison.
      */
-    private int match(byte[] src, byte[] b, byte[] lastOcc) {
+    private int match(byte[] src, byte[] b, byte[] lastOcc, byte[] optoSft) {
         int len = src.length;
         int last = b.length - len;
         int i = 0;
@@ -926,9 +943,8 @@
 
                     if (c != src[j]) {
                         // no match
-                        int goodShift = (j < len - 1) ? len : 1;
                         int badShift = lastOcc[c - 32];
-                        i += Math.max(j + 1 - badShift, goodShift);
+                        i += Math.max(j + 1 - badShift, optoSft[j]);
                         continue next;
                     }
                 } else {
@@ -958,10 +974,11 @@
             if (manEntry != null) {
                 byte[] b = getBytes(manEntry);
                 hasClassPathAttribute = match(CLASSPATH_CHARS, b,
-                        CLASSPATH_LASTOCC) != -1;
+                        CLASSPATH_LASTOCC, CLASSPATH_OPTOSFT) != -1;
                 // is this a multi-release jar file
                 if (MULTI_RELEASE_ENABLED) {
-                    int i = match(MULTIRELEASE_CHARS, b, MULTIRELEASE_LASTOCC);
+                    int i = match(MULTIRELEASE_CHARS, b, MULTIRELEASE_LASTOCC,
+                            MULTIRELEASE_OPTOSFT);
                     if (i != -1) {
                         i += MULTIRELEASE_CHARS.length;
                         if (i < b.length) {
--- a/src/java.base/share/classes/java/util/stream/DoubleStream.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/stream/DoubleStream.java	Mon Sep 12 22:04:48 2016 +0000
@@ -567,19 +567,23 @@
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
-     * @param <R> type of the result
-     * @param supplier a function that creates a new result container. For a
-     *                 parallel execution, this function may be called
+     * @param <R> the type of the mutable result container
+     * @param supplier a function that creates a new mutable result container.
+     *                 For a parallel execution, this function may be called
      *                 multiple times and must return a fresh value each time.
      * @param accumulator an <a href="package-summary.html#Associativity">associative</a>,
      *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
      *                    <a href="package-summary.html#Statelessness">stateless</a>
-     *                    function for incorporating an additional element into a result
+     *                    function that must fold an element into a result
+     *                    container.
      * @param combiner an <a href="package-summary.html#Associativity">associative</a>,
      *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
      *                    <a href="package-summary.html#Statelessness">stateless</a>
-     *                    function for combining two values, which must be
-     *                    compatible with the accumulator function
+     *                    function that accepts two partial result containers
+     *                    and merges them, which must be compatible with the
+     *                    accumulator function.  The combiner function must fold
+     *                    the elements from the second result container into the
+     *                    first result container.
      * @return the result of the reduction
      * @see Stream#collect(Supplier, BiConsumer, BiConsumer)
      */
@@ -947,6 +951,12 @@
      * position {@code n}, will be the result of applying the function {@code f}
      *  to the element at position {@code n - 1}.
      *
+     * <p>The action of applying {@code f} for one element
+     * <a href="../concurrent/package-summary.html#MemoryVisibility"><i>happens-before</i></a>
+     * the action of applying {@code f} for subsequent elements.  For any given
+     * element the action may be performed in whatever thread the library
+     * chooses.
+     *
      * @param seed the initial element
      * @param f a function to be applied to the previous element to produce
      *          a new element
@@ -978,37 +988,44 @@
 
     /**
      * Returns a sequential ordered {@code DoubleStream} produced by iterative
-     * application of a function to an initial element, conditioned on
-     * satisfying the supplied predicate.  The stream terminates as soon as
-     * the predicate returns false.
+     * application of the given {@code next} function to an initial element,
+     * conditioned on satisfying the given {@code hasNext} predicate.  The
+     * stream terminates as soon as the {@code hasNext} predicate returns false.
      *
-     * <p>
-     * {@code DoubleStream.iterate} should produce the same sequence of
-     * elements as produced by the corresponding for-loop:
+     * <p>{@code DoubleStream.iterate} should produce the same sequence of elements as
+     * produced by the corresponding for-loop:
      * <pre>{@code
-     *     for (double index=seed; predicate.test(index); index = f.applyAsDouble(index)) {
+     *     for (double index=seed; hasNext.test(index); index = next.applyAsDouble(index)) {
      *         ...
      *     }
      * }</pre>
      *
-     * <p>
-     * The resulting sequence may be empty if the predicate does not hold on
-     * the seed value.  Otherwise the first element will be the supplied seed
-     * value, the next element (if present) will be the result of applying the
-     * function f to the seed value, and so on iteratively until the predicate
-     * indicates that the stream should terminate.
+     * <p>The resulting sequence may be empty if the {@code hasNext} predicate
+     * does not hold on the seed value.  Otherwise the first element will be the
+     * supplied {@code seed} value, the next element (if present) will be the
+     * result of applying the {@code next} function to the {@code seed} value,
+     * and so on iteratively until the {@code hasNext} predicate indicates that
+     * the stream should terminate.
+     *
+     * <p>The action of applying the {@code hasNext} predicate to an element
+     * <a href="../concurrent/package-summary.html#MemoryVisibility"><i>happens-before</i></a>
+     * the action of applying the {@code next} function to that element.  The
+     * action of applying the {@code next} function for one element
+     * <i>happens-before</i> the action of applying the {@code hasNext}
+     * predicate for subsequent elements.  For any given element an action may
+     * be performed in whatever thread the library chooses.
      *
      * @param seed the initial element
-     * @param predicate a predicate to apply to elements to determine when the
-     *          stream must terminate.
-     * @param f a function to be applied to the previous element to produce
-     *          a new element
+     * @param hasNext a predicate to apply to elements to determine when the
+     *                stream must terminate.
+     * @param next a function to be applied to the previous element to produce
+     *             a new element
      * @return a new sequential {@code DoubleStream}
      * @since 9
      */
-    public static DoubleStream iterate(double seed, DoublePredicate predicate, DoubleUnaryOperator f) {
-        Objects.requireNonNull(f);
-        Objects.requireNonNull(predicate);
+    public static DoubleStream iterate(double seed, DoublePredicate hasNext, DoubleUnaryOperator next) {
+        Objects.requireNonNull(next);
+        Objects.requireNonNull(hasNext);
         Spliterator.OfDouble spliterator = new Spliterators.AbstractDoubleSpliterator(Long.MAX_VALUE,
                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL) {
             double prev;
@@ -1021,12 +1038,12 @@
                     return false;
                 double t;
                 if (started)
-                    t = f.applyAsDouble(prev);
+                    t = next.applyAsDouble(prev);
                 else {
                     t = seed;
                     started = true;
                 }
-                if (!predicate.test(t)) {
+                if (!hasNext.test(t)) {
                     finished = true;
                     return false;
                 }
@@ -1040,10 +1057,10 @@
                 if (finished)
                     return;
                 finished = true;
-                double t = started ? f.applyAsDouble(prev) : seed;
-                while (predicate.test(t)) {
+                double t = started ? next.applyAsDouble(prev) : seed;
+                while (hasNext.test(t)) {
                     action.accept(t);
-                    t = f.applyAsDouble(t);
+                    t = next.applyAsDouble(t);
                 }
             }
         };
--- a/src/java.base/share/classes/java/util/stream/IntStream.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/stream/IntStream.java	Mon Sep 12 22:04:48 2016 +0000
@@ -562,19 +562,23 @@
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
-     * @param <R> type of the result
-     * @param supplier a function that creates a new result container. For a
-     *                 parallel execution, this function may be called
+     * @param <R> the type of the mutable result container
+     * @param supplier a function that creates a new mutable result container.
+     *                 For a parallel execution, this function may be called
      *                 multiple times and must return a fresh value each time.
      * @param accumulator an <a href="package-summary.html#Associativity">associative</a>,
      *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
      *                    <a href="package-summary.html#Statelessness">stateless</a>
-     *                    function for incorporating an additional element into a result
+     *                    function that must fold an element into a result
+     *                    container.
      * @param combiner an <a href="package-summary.html#Associativity">associative</a>,
      *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
      *                    <a href="package-summary.html#Statelessness">stateless</a>
-     *                    function for combining two values, which must be
-     *                    compatible with the accumulator function
+     *                    function that accepts two partial result containers
+     *                    and merges them, which must be compatible with the
+     *                    accumulator function.  The combiner function must fold
+     *                    the elements from the second result container into the
+     *                    first result container.
      * @return the result of the reduction
      * @see Stream#collect(Supplier, BiConsumer, BiConsumer)
      */
@@ -887,6 +891,12 @@
      * {@code n}, will be the result of applying the function {@code f} to the
      * element at position {@code n - 1}.
      *
+     * <p>The action of applying {@code f} for one element
+     * <a href="../concurrent/package-summary.html#MemoryVisibility"><i>happens-before</i></a>
+     * the action of applying {@code f} for subsequent elements.  For any given
+     * element the action may be performed in whatever thread the library
+     * chooses.
+     *
      * @param seed the initial element
      * @param f a function to be applied to the previous element to produce
      *          a new element
@@ -918,37 +928,44 @@
 
     /**
      * Returns a sequential ordered {@code IntStream} produced by iterative
-     * application of a function to an initial element, conditioned on
-     * satisfying the supplied predicate.  The stream terminates as soon as
-     * the predicate returns false.
+     * application of the given {@code next} function to an initial element,
+     * conditioned on satisfying the given {@code hasNext} predicate.  The
+     * stream terminates as soon as the {@code hasNext} predicate returns false.
      *
-     * <p>
-     * {@code IntStream.iterate} should produce the same sequence of elements
-     * as produced by the corresponding for-loop:
+     * <p>{@code IntStream.iterate} should produce the same sequence of elements as
+     * produced by the corresponding for-loop:
      * <pre>{@code
-     *     for (int index=seed; predicate.test(index); index = f.applyAsInt(index)) {
+     *     for (int index=seed; hasNext.test(index); index = next.applyAsInt(index)) {
      *         ...
      *     }
      * }</pre>
      *
-     * <p>
-     * The resulting sequence may be empty if the predicate does not hold on
-     * the seed value.  Otherwise the first element will be the supplied seed
-     * value, the next element (if present) will be the result of applying the
-     * function f to the seed value, and so on iteratively until the predicate
-     * indicates that the stream should terminate.
+     * <p>The resulting sequence may be empty if the {@code hasNext} predicate
+     * does not hold on the seed value.  Otherwise the first element will be the
+     * supplied {@code seed} value, the next element (if present) will be the
+     * result of applying the {@code next} function to the {@code seed} value,
+     * and so on iteratively until the {@code hasNext} predicate indicates that
+     * the stream should terminate.
+     *
+     * <p>The action of applying the {@code hasNext} predicate to an element
+     * <a href="../concurrent/package-summary.html#MemoryVisibility"><i>happens-before</i></a>
+     * the action of applying the {@code next} function to that element.  The
+     * action of applying the {@code next} function for one element
+     * <i>happens-before</i> the action of applying the {@code hasNext}
+     * predicate for subsequent elements.  For any given element an action may
+     * be performed in whatever thread the library chooses.
      *
      * @param seed the initial element
-     * @param predicate a predicate to apply to elements to determine when the
-     *          stream must terminate.
-     * @param f a function to be applied to the previous element to produce
-     *          a new element
+     * @param hasNext a predicate to apply to elements to determine when the
+     *                stream must terminate.
+     * @param next a function to be applied to the previous element to produce
+     *             a new element
      * @return a new sequential {@code IntStream}
      * @since 9
      */
-    public static IntStream iterate(int seed, IntPredicate predicate, IntUnaryOperator f) {
-        Objects.requireNonNull(f);
-        Objects.requireNonNull(predicate);
+    public static IntStream iterate(int seed, IntPredicate hasNext, IntUnaryOperator next) {
+        Objects.requireNonNull(next);
+        Objects.requireNonNull(hasNext);
         Spliterator.OfInt spliterator = new Spliterators.AbstractIntSpliterator(Long.MAX_VALUE,
                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL) {
             int prev;
@@ -961,12 +978,12 @@
                     return false;
                 int t;
                 if (started)
-                    t = f.applyAsInt(prev);
+                    t = next.applyAsInt(prev);
                 else {
                     t = seed;
                     started = true;
                 }
-                if (!predicate.test(t)) {
+                if (!hasNext.test(t)) {
                     finished = true;
                     return false;
                 }
@@ -980,10 +997,10 @@
                 if (finished)
                     return;
                 finished = true;
-                int t = started ? f.applyAsInt(prev) : seed;
-                while (predicate.test(t)) {
+                int t = started ? next.applyAsInt(prev) : seed;
+                while (hasNext.test(t)) {
                     action.accept(t);
-                    t = f.applyAsInt(t);
+                    t = next.applyAsInt(t);
                 }
             }
         };
--- a/src/java.base/share/classes/java/util/stream/LongStream.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/stream/LongStream.java	Mon Sep 12 22:04:48 2016 +0000
@@ -564,19 +564,23 @@
      * <p>This is a <a href="package-summary.html#StreamOps">terminal
      * operation</a>.
      *
-     * @param <R> type of the result
-     * @param supplier a function that creates a new result container. For a
-     *                 parallel execution, this function may be called
+     * @param <R> the type of the mutable result container
+     * @param supplier a function that creates a new mutable result container.
+     *                 For a parallel execution, this function may be called
      *                 multiple times and must return a fresh value each time.
      * @param accumulator an <a href="package-summary.html#Associativity">associative</a>,
      *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
      *                    <a href="package-summary.html#Statelessness">stateless</a>
-     *                    function for incorporating an additional element into a result
+     *                    function that must fold an element into a result
+     *                    container.
      * @param combiner an <a href="package-summary.html#Associativity">associative</a>,
      *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
      *                    <a href="package-summary.html#Statelessness">stateless</a>
-     *                    function for combining two values, which must be
-     *                    compatible with the accumulator function
+     *                    function that accepts two partial result containers
+     *                    and merges them, which must be compatible with the
+     *                    accumulator function.  The combiner function must fold
+     *                    the elements from the second result container into the
+     *                    first result container.
      * @return the result of the reduction
      * @see Stream#collect(Supplier, BiConsumer, BiConsumer)
      */
@@ -877,6 +881,12 @@
      * {@code n}, will be the result of applying the function {@code f} to the
      * element at position {@code n - 1}.
      *
+     * <p>The action of applying {@code f} for one element
+     * <a href="../concurrent/package-summary.html#MemoryVisibility"><i>happens-before</i></a>
+     * the action of applying {@code f} for subsequent elements.  For any given
+     * element the action may be performed in whatever thread the library
+     * chooses.
+     *
      * @param seed the initial element
      * @param f a function to be applied to the previous element to produce
      *          a new element
@@ -908,37 +918,44 @@
 
     /**
      * Returns a sequential ordered {@code LongStream} produced by iterative
-     * application of a function to an initial element, conditioned on
-     * satisfying the supplied predicate.  The stream terminates as soon as
-     * the predicate returns false.
+     * application of the given {@code next} function to an initial element,
+     * conditioned on satisfying the given {@code hasNext} predicate.  The
+     * stream terminates as soon as the {@code hasNext} predicate returns false.
      *
-     * <p>
-     * {@code LongStream.iterate} should produce the same sequence of elements
-     * as produced by the corresponding for-loop:
+     * <p>{@code LongStream.iterate} should produce the same sequence of elements as
+     * produced by the corresponding for-loop:
      * <pre>{@code
-     *     for (long index=seed; predicate.test(index); index = f.applyAsLong(index)) {
+     *     for (long index=seed; hasNext.test(index); index = next.applyAsLong(index)) {
      *         ...
      *     }
      * }</pre>
      *
-     * <p>
-     * The resulting sequence may be empty if the predicate does not hold on
-     * the seed value.  Otherwise the first element will be the supplied seed
-     * value, the next element (if present) will be the result of applying the
-     * function f to the seed value, and so on iteratively until the predicate
-     * indicates that the stream should terminate.
+     * <p>The resulting sequence may be empty if the {@code hasNext} predicate
+     * does not hold on the seed value.  Otherwise the first element will be the
+     * supplied {@code seed} value, the next element (if present) will be the
+     * result of applying the {@code next} function to the {@code seed} value,
+     * and so on iteratively until the {@code hasNext} predicate indicates that
+     * the stream should terminate.
+     *
+     * <p>The action of applying the {@code hasNext} predicate to an element
+     * <a href="../concurrent/package-summary.html#MemoryVisibility"><i>happens-before</i></a>
+     * the action of applying the {@code next} function to that element.  The
+     * action of applying the {@code next} function for one element
+     * <i>happens-before</i> the action of applying the {@code hasNext}
+     * predicate for subsequent elements.  For any given element an action may
+     * be performed in whatever thread the library chooses.
      *
      * @param seed the initial element
-     * @param predicate a predicate to apply to elements to determine when the
-     *          stream must terminate.
-     * @param f a function to be applied to the previous element to produce
-     *          a new element
+     * @param hasNext a predicate to apply to elements to determine when the
+     *                stream must terminate.
+     * @param next a function to be applied to the previous element to produce
+     *             a new element
      * @return a new sequential {@code LongStream}
      * @since 9
      */
-    public static LongStream iterate(long seed, LongPredicate predicate, LongUnaryOperator f) {
-        Objects.requireNonNull(f);
-        Objects.requireNonNull(predicate);
+    public static LongStream iterate(long seed, LongPredicate hasNext, LongUnaryOperator next) {
+        Objects.requireNonNull(next);
+        Objects.requireNonNull(hasNext);
         Spliterator.OfLong spliterator = new Spliterators.AbstractLongSpliterator(Long.MAX_VALUE,
                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL) {
             long prev;
@@ -951,12 +968,12 @@
                     return false;
                 long t;
                 if (started)
-                    t = f.applyAsLong(prev);
+                    t = next.applyAsLong(prev);
                 else {
                     t = seed;
                     started = true;
                 }
-                if (!predicate.test(t)) {
+                if (!hasNext.test(t)) {
                     finished = true;
                     return false;
                 }
@@ -970,10 +987,10 @@
                 if (finished)
                     return;
                 finished = true;
-                long t = started ? f.applyAsLong(prev) : seed;
-                while (predicate.test(t)) {
+                long t = started ? next.applyAsLong(prev) : seed;
+                while (hasNext.test(t)) {
                     action.accept(t);
-                    t = f.applyAsLong(t);
+                    t = next.applyAsLong(t);
                 }
             }
         };
--- a/src/java.base/share/classes/java/util/stream/Stream.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/java/util/stream/Stream.java	Mon Sep 12 22:04:48 2016 +0000
@@ -882,19 +882,23 @@
      *                                 .toString();
      * }</pre>
      *
-     * @param <R> type of the result
-     * @param supplier a function that creates a new result container. For a
-     *                 parallel execution, this function may be called
+     * @param <R> the type of the mutable result container
+     * @param supplier a function that creates a new mutable result container.
+     *                 For a parallel execution, this function may be called
      *                 multiple times and must return a fresh value each time.
      * @param accumulator an <a href="package-summary.html#Associativity">associative</a>,
      *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
      *                    <a href="package-summary.html#Statelessness">stateless</a>
-     *                    function for incorporating an additional element into a result
+     *                    function that must fold an element into a result
+     *                    container.
      * @param combiner an <a href="package-summary.html#Associativity">associative</a>,
      *                    <a href="package-summary.html#NonInterference">non-interfering</a>,
      *                    <a href="package-summary.html#Statelessness">stateless</a>
-     *                    function for combining two values, which must be
-     *                    compatible with the accumulator function
+     *                    function that accepts two partial result containers
+     *                    and merges them, which must be compatible with the
+     *                    accumulator function.  The combiner function must fold
+     *                    the elements from the second result container into the
+     *                    first result container.
      * @return the result of the reduction
      */
     <R> R collect(Supplier<R> supplier,
@@ -1194,6 +1198,12 @@
      * {@code n}, will be the result of applying the function {@code f} to the
      * element at position {@code n - 1}.
      *
+     * <p>The action of applying {@code f} for one element
+     * <a href="../concurrent/package-summary.html#MemoryVisibility"><i>happens-before</i></a>
+     * the action of applying {@code f} for subsequent elements.  For any given
+     * element the action may be performed in whatever thread the library
+     * chooses.
+     *
      * @param <T> the type of stream elements
      * @param seed the initial element
      * @param f a function to be applied to the previous element to produce
@@ -1226,38 +1236,45 @@
 
     /**
      * Returns a sequential ordered {@code Stream} produced by iterative
-     * application of a function to an initial element, conditioned on
-     * satisfying the supplied predicate.  The stream terminates as soon as
-     * the predicate returns false.
+     * application of the given {@code next} function to an initial element,
+     * conditioned on satisfying the given {@code hasNext} predicate.  The
+     * stream terminates as soon as the {@code hasNext} predicate returns false.
      *
-     * <p>
-     * {@code Stream.iterate} should produce the same sequence of elements as
+     * <p>{@code Stream.iterate} should produce the same sequence of elements as
      * produced by the corresponding for-loop:
      * <pre>{@code
-     *     for (T index=seed; predicate.test(index); index = f.apply(index)) {
+     *     for (T index=seed; hasNext.test(index); index = next.apply(index)) {
      *         ...
      *     }
      * }</pre>
      *
-     * <p>
-     * The resulting sequence may be empty if the predicate does not hold on
-     * the seed value.  Otherwise the first element will be the supplied seed
-     * value, the next element (if present) will be the result of applying the
-     * function f to the seed value, and so on iteratively until the predicate
-     * indicates that the stream should terminate.
+     * <p>The resulting sequence may be empty if the {@code hasNext} predicate
+     * does not hold on the seed value.  Otherwise the first element will be the
+     * supplied {@code seed} value, the next element (if present) will be the
+     * result of applying the {@code next} function to the {@code seed} value,
+     * and so on iteratively until the {@code hasNext} predicate indicates that
+     * the stream should terminate.
+     *
+     * <p>The action of applying the {@code hasNext} predicate to an element
+     * <a href="../concurrent/package-summary.html#MemoryVisibility"><i>happens-before</i></a>
+     * the action of applying the {@code next} function to that element.  The
+     * action of applying the {@code next} function for one element
+     * <i>happens-before</i> the action of applying the {@code hasNext}
+     * predicate for subsequent elements.  For any given element an action may
+     * be performed in whatever thread the library chooses.
      *
      * @param <T> the type of stream elements
      * @param seed the initial element
-     * @param predicate a predicate to apply to elements to determine when the
-     *          stream must terminate.
-     * @param f a function to be applied to the previous element to produce
-     *          a new element
+     * @param hasNext a predicate to apply to elements to determine when the
+     *                stream must terminate.
+     * @param next a function to be applied to the previous element to produce
+     *             a new element
      * @return a new sequential {@code Stream}
      * @since 9
      */
-    public static<T> Stream<T> iterate(T seed, Predicate<? super T> predicate, UnaryOperator<T> f) {
-        Objects.requireNonNull(f);
-        Objects.requireNonNull(predicate);
+    public static<T> Stream<T> iterate(T seed, Predicate<? super T> hasNext, UnaryOperator<T> next) {
+        Objects.requireNonNull(next);
+        Objects.requireNonNull(hasNext);
         Spliterator<T> spliterator = new Spliterators.AbstractSpliterator<>(Long.MAX_VALUE,
                Spliterator.ORDERED | Spliterator.IMMUTABLE) {
             T prev;
@@ -1270,12 +1287,12 @@
                     return false;
                 T t;
                 if (started)
-                    t = f.apply(prev);
+                    t = next.apply(prev);
                 else {
                     t = seed;
                     started = true;
                 }
-                if (!predicate.test(t)) {
+                if (!hasNext.test(t)) {
                     prev = null;
                     finished = true;
                     return false;
@@ -1290,11 +1307,11 @@
                 if (finished)
                     return;
                 finished = true;
-                T t = started ? f.apply(prev) : seed;
+                T t = started ? next.apply(prev) : seed;
                 prev = null;
-                while (predicate.test(t)) {
+                while (hasNext.test(t)) {
                     action.accept(t);
-                    t = f.apply(t);
+                    t = next.apply(t);
                 }
             }
         };
--- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/commons/SerialVersionUIDAdder.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/commons/SerialVersionUIDAdder.java	Mon Sep 12 22:04:48 2016 +0000
@@ -80,7 +80,7 @@
  *   ClassWriter cw = new ClassWriter(...);
  *   ClassVisitor sv = new SerialVersionUIDAdder(cw);
  *   ClassVisitor ca = new MyClassAdapter(sv);
- *   new ClassReader(orginalClass).accept(ca, false);
+ *   new ClassReader(originalClass).accept(ca, false);
  * </pre>
  *
  * The SVUID algorithm can be found <a href=
--- a/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1185,7 +1185,7 @@
         /*
          * FOURTH, if we sent a Certificate, we need to send a signed
          * CertificateVerify (unless the key in the client's certificate
-         * was a Diffie-Hellman key).).
+         * was a Diffie-Hellman key).
          *
          * This uses a hash of the previous handshake messages ... either
          * a nonfinal one (if the particular implementation supports it)
--- a/src/java.base/share/classes/sun/text/resources/BreakIteratorRulesProvider.java	Mon Sep 12 15:00:58 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.text.resources;
-
-import java.util.spi.ResourceBundleProvider;
-
-/**
- * An interface for the internal locale data provider for which {@code ResourceBundle}
- * searches.
- */
-public interface BreakIteratorRulesProvider extends ResourceBundleProvider {
-}
--- a/src/java.base/share/classes/sun/util/locale/provider/BreakDictionary.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/sun/util/locale/provider/BreakDictionary.java	Mon Sep 12 22:04:48 2016 +0000
@@ -149,7 +149,10 @@
         BufferedInputStream in;
         try {
             PrivilegedExceptionAction<BufferedInputStream> pa = () -> {
-                InputStream is = module.getResourceAsStream("sun/text/resources/" + dictionaryName);
+                String pathName = "jdk.localedata".equals(module.getName()) ?
+                     "sun/text/resources/ext/" :
+                     "sun/text/resources/";
+                InputStream is = module.getResourceAsStream(pathName + dictionaryName);
                 if (is == null) {
                     // Try to load the file with "java.base" module instance. Assumption
                     // here is that the fall back data files to be read should reside in
--- a/src/java.base/share/classes/sun/util/locale/provider/RuleBasedBreakIterator.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/share/classes/sun/util/locale/provider/RuleBasedBreakIterator.java	Mon Sep 12 22:04:48 2016 +0000
@@ -444,7 +444,10 @@
         BufferedInputStream is;
         try {
             PrivilegedExceptionAction<BufferedInputStream> pa = () -> {
-                InputStream in = module.getResourceAsStream("sun/text/resources/" + datafile);
+                String pathName = "jdk.localedata".equals(module.getName()) ?
+                     "sun/text/resources/ext/" :
+                     "sun/text/resources/";
+                InputStream in = module.getResourceAsStream(pathName + datafile);
                 if (in == null) {
                     // Try to load the file with "java.base" module instance. Assumption
                     // here is that the fall back data files to be read should reside in
--- a/src/java.base/unix/native/libjava/ProcessImpl_md.c	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/unix/native/libjava/ProcessImpl_md.c	Mon Sep 12 22:04:48 2016 +0000
@@ -349,6 +349,8 @@
 __attribute_noinline__
 #endif
 
+/* vfork(2) is deprecated on Solaris */
+#ifndef __solaris__
 static pid_t
 vforkChild(ChildStuff *c) {
     volatile pid_t resultPid;
@@ -367,6 +369,7 @@
     assert(resultPid != 0);  /* childProcess never returns */
     return resultPid;
 }
+#endif
 
 static pid_t
 forkChild(ChildStuff *c) {
@@ -479,8 +482,11 @@
 static pid_t
 startChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) {
     switch (c->mode) {
+/* vfork(2) is deprecated on Solaris */
+#ifndef __solaris__
       case MODE_VFORK:
         return vforkChild(c);
+#endif
       case MODE_FORK:
         return forkChild(c);
 #if defined(__solaris__) || defined(_ALLBSD_SOURCE) || defined(_AIX)
--- a/src/java.base/unix/native/libnet/NetworkInterface.c	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/unix/native/libnet/NetworkInterface.c	Mon Sep 12 22:04:48 2016 +0000
@@ -80,6 +80,12 @@
     #define DEV_PREFIX "/dev/"
 #endif
 
+#ifdef LIFNAMSIZ
+    #define IFNAMESIZE LIFNAMSIZ
+#else
+    #define IFNAMESIZE IFNAMSIZ
+#endif
+
 #define CHECKED_MALLOC3(_pointer, _type, _size) \
     do { \
         _pointer = (_type)malloc(_size); \
@@ -158,7 +164,7 @@
 
 static int     getIndex(int sock, const char *ifname);
 static int     getFlags(int sock, const char *ifname, int *flags);
-static int     getMacAddress(JNIEnv *env, int sock, const char *ifname,
+static int     getMacAddress(JNIEnv *env, const char *ifname,
                              const struct in_addr *addr, unsigned char *buf);
 static int     getMTU(JNIEnv *env, int sock, const char *ifname);
 
@@ -237,20 +243,25 @@
     const char* name_utf;
     jobject obj = NULL;
 
+    if (name != NULL) {
+        name_utf = (*env)->GetStringUTFChars(env, name, &isCopy);
+    } else {
+        JNU_ThrowNullPointerException(env, "network interface name is NULL");
+        return NULL;
+    }
+
+    if (name_utf == NULL) {
+        if (!(*env)->ExceptionCheck(env))
+            JNU_ThrowOutOfMemoryError(env, NULL);
+        return NULL;
+    }
+
     ifs = enumInterfaces(env);
     if (ifs == NULL) {
         return NULL;
     }
 
-    name_utf = (*env)->GetStringUTFChars(env, name, &isCopy);
-    if (name_utf == NULL) {
-       if (!(*env)->ExceptionCheck(env))
-           JNU_ThrowOutOfMemoryError(env, NULL);
-       freeif(ifs);
-       return NULL;
-    }
-
-    // Search the list of interface based on name
+    // search the list of interfaces based on name
     curr = ifs;
     while (curr != NULL) {
         if (strcmp(name_utf, curr->name) == 0) {
@@ -285,12 +296,13 @@
     if (index <= 0) {
         return NULL;
     }
+
     ifs = enumInterfaces(env);
     if (ifs == NULL) {
         return NULL;
     }
 
-    // Search the list of interface based on index
+    // search the list of interfaces based on index
     curr = ifs;
     while (curr != NULL) {
         if (index == curr->index) {
@@ -304,7 +316,9 @@
         obj = createNetworkInterface(env, curr);
     }
 
+    // release the interface list
     freeif(ifs);
+
     return obj;
 }
 
@@ -317,13 +331,11 @@
   (JNIEnv *env, jclass cls, jobject iaObj)
 {
     netif *ifs, *curr;
-
 #if defined(AF_INET6)
     int family = (getInetAddress_family(env, iaObj) == IPv4) ? AF_INET : AF_INET6;
 #else
     int family =  AF_INET;
 #endif
-
     jobject obj = NULL;
     jboolean match = JNI_FALSE;
 
@@ -342,7 +354,7 @@
             if (family == addrP->family) {
                 if (family == AF_INET) {
                     int address1 = htonl(
-                        ((struct sockaddr_in*)addrP->addr)->sin_addr.s_addr);
+                        ((struct sockaddr_in *)addrP->addr)->sin_addr.s_addr);
                     int address2 = getInetAddress_addr(env, iaObj);
 
                     if (address1 == address2) {
@@ -350,7 +362,6 @@
                         break;
                     }
                 }
-
 #if defined(AF_INET6)
                 if (family == AF_INET6) {
                     jbyte *bytes = (jbyte *)&(
@@ -390,7 +401,9 @@
         obj = createNetworkInterface(env, curr);
     }
 
+    // release the interface list
     freeif(ifs);
+
     return obj;
 }
 
@@ -411,7 +424,7 @@
         return NULL;
     }
 
-    // count the interface
+    // count the interfaces
     ifCount = 0;
     curr = ifs;
     while (curr != NULL) {
@@ -426,8 +439,8 @@
         return NULL;
     }
 
-    // Iterate through the interfaces, create a NetworkInterface instance
-    // for each array element and populate the object.
+    // iterate through the interfaces, create a NetworkInterface instance
+    // for each array element and populate the object
     curr = ifs;
     arr_index = 0;
     while (curr != NULL) {
@@ -445,7 +458,9 @@
         curr = curr->next;
     }
 
+    // release the interface list
     freeif(ifs);
+
     return netIFArr;
 }
 
@@ -511,46 +526,45 @@
     jbyteArray ret = NULL;
     unsigned char mac[16];
     int len;
-    int sock;
     jboolean isCopy;
-    const char* name_utf;
+    const char *name_utf;
 
-    name_utf = (*env)->GetStringUTFChars(env, name, &isCopy);
+    if (name != NULL) {
+        name_utf = (*env)->GetStringUTFChars(env, name, &isCopy);
+    } else {
+        JNU_ThrowNullPointerException(env, "network interface name is NULL");
+        return NULL;
+    }
+
     if (name_utf == NULL) {
-       if (!(*env)->ExceptionCheck(env))
-           JNU_ThrowOutOfMemoryError(env, NULL);
-       return NULL;
-    }
-    if ((sock = openSocketWithFallback(env, name_utf)) < 0) {
-       (*env)->ReleaseStringUTFChars(env, name, name_utf);
-       return NULL;
+        if (!(*env)->ExceptionCheck(env))
+            JNU_ThrowOutOfMemoryError(env, NULL);
+        return NULL;
     }
 
     if (!IS_NULL(addrArray)) {
-       (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr);
-       addr = ((caddr[0]<<24) & 0xff000000);
-       addr |= ((caddr[1] <<16) & 0xff0000);
-       addr |= ((caddr[2] <<8) & 0xff00);
-       addr |= (caddr[3] & 0xff);
-       iaddr.s_addr = htonl(addr);
-       len = getMacAddress(env, sock, name_utf, &iaddr, mac);
+        (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr);
+        addr = ((caddr[0]<<24) & 0xff000000);
+        addr |= ((caddr[1] <<16) & 0xff0000);
+        addr |= ((caddr[2] <<8) & 0xff00);
+        addr |= (caddr[3] & 0xff);
+        iaddr.s_addr = htonl(addr);
+        len = getMacAddress(env, name_utf, &iaddr, mac);
     } else {
-       len = getMacAddress(env, sock, name_utf, NULL, mac);
+        len = getMacAddress(env, name_utf, NULL, mac);
     }
+
     if (len > 0) {
-       ret = (*env)->NewByteArray(env, len);
-       if (IS_NULL(ret)) {
-          /* we may have memory to free at the end of this */
-          goto fexit;
-       }
-       (*env)->SetByteArrayRegion(env, ret, 0, len, (jbyte *)(mac));
+        ret = (*env)->NewByteArray(env, len);
+        if (!IS_NULL(ret)) {
+            (*env)->SetByteArrayRegion(env, ret, 0, len, (jbyte *)(mac));
+        }
     }
- fexit:
-   // release the UTF string and interface list
-   (*env)->ReleaseStringUTFChars(env, name, name_utf);
 
-   close(sock);
-   return ret;
+    // release the UTF string and interface list
+    (*env)->ReleaseStringUTFChars(env, name, name_utf);
+
+    return ret;
 }
 
 /*
@@ -562,8 +576,7 @@
   (JNIEnv *env, jclass cls, jstring name, jint index)
 {
     jboolean isCopy;
-    int ret = -1;
-    int sock;
+    int sock, ret = -1;
     const char* name_utf = NULL;
 
     if (name != NULL) {
@@ -572,15 +585,16 @@
         JNU_ThrowNullPointerException(env, "network interface name is NULL");
         return ret;
     }
+
     if (name_utf == NULL) {
-       if (!(*env)->ExceptionCheck(env))
-           JNU_ThrowOutOfMemoryError(env, NULL);
-       return ret;
+        if (!(*env)->ExceptionCheck(env))
+            JNU_ThrowOutOfMemoryError(env, NULL);
+        return ret;
     }
 
     if ((sock = openSocketWithFallback(env, name_utf)) < 0) {
-       (*env)->ReleaseStringUTFChars(env, name, name_utf);
-       return JNI_FALSE;
+        (*env)->ReleaseStringUTFChars(env, name, name_utf);
+        return JNI_FALSE;
     }
 
     ret = getMTU(env, sock, name_utf);
@@ -595,9 +609,8 @@
 
 static int getFlags0(JNIEnv *env, jstring name) {
     jboolean isCopy;
-    int ret, sock;
-    const char* name_utf;
-    int flags = 0;
+    int ret, sock, flags = 0;
+    const char *name_utf;
 
     if (name != NULL) {
         name_utf = (*env)->GetStringUTFChars(env, name, &isCopy);
@@ -607,9 +620,9 @@
     }
 
     if (name_utf == NULL) {
-       if (!(*env)->ExceptionCheck(env))
-           JNU_ThrowOutOfMemoryError(env, NULL);
-       return -1;
+        if (!(*env)->ExceptionCheck(env))
+            JNU_ThrowOutOfMemoryError(env, NULL);
+        return -1;
     }
     if ((sock = openSocketWithFallback(env, name_utf)) < 0) {
         (*env)->ReleaseStringUTFChars(env, name, name_utf);
@@ -648,7 +661,7 @@
     netif *childP;
     jobject tmp;
 
-    // Create a NetworkInterface object and populate it
+    // create a NetworkInterface object and populate it
     netifObj = (*env)->NewObject(env, ni_class, ni_ctrID);
     CHECK_NULL_RETURN(netifObj, NULL);
     name = (*env)->NewStringUTF(env, ifs->name);
@@ -659,7 +672,7 @@
     (*env)->SetBooleanField(env, netifObj, ni_virutalID,
                             ifs->virtual ? JNI_TRUE : JNI_FALSE);
 
-    //Count the number of address on this interface
+    // count the number of addresses on this interface
     addr_count = 0;
     addrP = ifs->addr;
     while (addrP != NULL) {
@@ -667,7 +680,7 @@
         addrP = addrP->next;
     }
 
-    // Create the array of InetAddresses
+    // create the array of InetAddresses
     addrArr = (*env)->NewObjectArray(env, addr_count, ia_class, NULL);
     if (addrArr == NULL) {
         return NULL;
@@ -687,32 +700,31 @@
         if (addrP->family == AF_INET) {
             iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
             if (iaObj) {
-                 setInetAddress_addr(env, iaObj, htonl(
-                     ((struct sockaddr_in*)addrP->addr)->sin_addr.s_addr));
+                setInetAddress_addr(env, iaObj, htonl(
+                    ((struct sockaddr_in*)addrP->addr)->sin_addr.s_addr));
             } else {
                 return NULL;
             }
             ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
             if (ibObj) {
-                 (*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj);
-                 if (addrP->brdcast) {
+                (*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj);
+                if (addrP->brdcast) {
                     jobject ia2Obj = NULL;
                     ia2Obj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
                     if (ia2Obj) {
-                       setInetAddress_addr(env, ia2Obj, htonl(
-                           ((struct sockaddr_in*)addrP->brdcast)->sin_addr.s_addr));
-                       (*env)->SetObjectField(env, ibObj, ni_ib4broadcastID, ia2Obj);
+                        setInetAddress_addr(env, ia2Obj, htonl(
+                            ((struct sockaddr_in*)addrP->brdcast)->sin_addr.s_addr));
+                        (*env)->SetObjectField(env, ibObj, ni_ib4broadcastID, ia2Obj);
                     } else {
                         return NULL;
                     }
-                 }
-                 (*env)->SetShortField(env, ibObj, ni_ib4maskID, addrP->mask);
-                 (*env)->SetObjectArrayElement(env, bindArr, bind_index++, ibObj);
+                }
+                (*env)->SetShortField(env, ibObj, ni_ib4maskID, addrP->mask);
+                (*env)->SetObjectArrayElement(env, bindArr, bind_index++, ibObj);
             } else {
                 return NULL;
             }
         }
-
 #if defined(AF_INET6)
         if (addrP->family == AF_INET6) {
             int scope=0;
@@ -748,7 +760,7 @@
         addrP = addrP->next;
     }
 
-    // See if there is any virtual interface attached to this one.
+    // see if there is any virtual interface attached to this one.
     child_count = 0;
     childP = ifs->childs;
     while (childP) {
@@ -761,17 +773,17 @@
         return NULL;
     }
 
-    // Create the NetworkInterface instances for the sub-interfaces as well.
+    // create the NetworkInterface instances for the sub-interfaces as well
     child_index = 0;
     childP = ifs->childs;
     while(childP) {
-      tmp = createNetworkInterface(env, childP);
-      if (tmp == NULL) {
-         return NULL;
-      }
-      (*env)->SetObjectField(env, tmp, ni_parentID, netifObj);
-      (*env)->SetObjectArrayElement(env, childArr, child_index++, tmp);
-      childP = childP->next;
+        tmp = createNetworkInterface(env, childP);
+        if (tmp == NULL) {
+            return NULL;
+        }
+        (*env)->SetObjectField(env, tmp, ni_parentID, netifObj);
+        (*env)->SetObjectArrayElement(env, childArr, child_index++, tmp);
+        childP = childP->next;
     }
     (*env)->SetObjectField(env, netifObj, ni_addrsID, addrArr);
     (*env)->SetObjectField(env, netifObj, ni_bindsID, bindArr);
@@ -785,46 +797,42 @@
  * Enumerates all interfaces
  */
 static netif *enumInterfaces(JNIEnv *env) {
-    netif *ifs;
+    netif *ifs = NULL;
     int sock;
 
-    // Enumerate IPv4 addresses
     sock = openSocket(env, AF_INET);
     if (sock < 0 && (*env)->ExceptionOccurred(env)) {
         return NULL;
     }
 
+    // enumerate IPv4 addresses
     ifs = enumIPv4Interfaces(env, sock, NULL);
     close(sock);
 
+    // return partial list if an exception occurs in the middle of process ???
     if (ifs == NULL && (*env)->ExceptionOccurred(env)) {
         return NULL;
     }
 
-    // return partial list if an exception occurs in the middle of process ???
-
     // If IPv6 is available then enumerate IPv6 addresses.
 #if defined(AF_INET6)
-
         // User can disable ipv6 explicitly by -Djava.net.preferIPv4Stack=true,
         // so we have to call ipv6_available()
         if (ipv6_available()) {
+            sock = openSocket(env, AF_INET6);
+            if (sock < 0 && (*env)->ExceptionOccurred(env)) {
+                freeif(ifs);
+                return NULL;
+            }
 
-           sock = openSocket(env, AF_INET6);
-           if (sock < 0 && (*env)->ExceptionOccurred(env)) {
-               freeif(ifs);
-               return NULL;
-           }
+            ifs = enumIPv6Interfaces(env, sock, ifs);
+            close(sock);
 
-           ifs = enumIPv6Interfaces(env, sock, ifs);
-           close(sock);
-
-           if ((*env)->ExceptionOccurred(env)) {
-              freeif(ifs);
-              return NULL;
-           }
-
-       }
+            if ((*env)->ExceptionOccurred(env)) {
+                freeif(ifs);
+                return NULL;
+            }
+        }
 #endif
 
     return ifs;
@@ -845,7 +853,7 @@
             addrP = next;
         }
 
-        // Don't forget to free the sub-interfaces.
+        // don't forget to free the sub-interfaces
         if (currif->childs != NULL) {
             freeif(currif->childs);
         }
@@ -863,26 +871,17 @@
 {
     netif *currif = ifs, *parent;
     netaddr *addrP;
-
-#ifdef LIFNAMSIZ
-    int ifnam_size = LIFNAMSIZ;
-    char name[LIFNAMSIZ], vname[LIFNAMSIZ];
-#else
-    int ifnam_size = IFNAMSIZ;
-    char name[IFNAMSIZ], vname[IFNAMSIZ];
-#endif
-
+    char name[IFNAMESIZE], vname[IFNAMESIZE];
     char *name_colonP;
     int isVirtual = 0;
     int addr_size;
-    int flags = 0;
 
     // If the interface name is a logical interface then we remove the unit
     // number so that we have the physical interface (eg: hme0:1 -> hme0).
     // NetworkInterface currently doesn't have any concept of physical vs.
     // logical interfaces.
-    strncpy(name, if_name, ifnam_size);
-    name[ifnam_size - 1] = '\0';
+    strncpy(name, if_name, IFNAMESIZE);
+    name[IFNAMESIZE - 1] = '\0';
     *vname = 0;
 
     // Create and populate the netaddr node. If allocation fails
@@ -917,20 +916,21 @@
     // Deal with virtual interface with colon notation e.g. eth0:1
     name_colonP = strchr(name, ':');
     if (name_colonP != NULL) {
+        int flags = 0;
         // This is a virtual interface. If we are able to access the parent
         // we need to create a new entry if it doesn't exist yet *and* update
         // the 'parent' interface with the new records.
         *name_colonP = 0;
         if (getFlags(sock, name, &flags) < 0 || flags < 0) {
-             // failed to access parent interface do not create parent.
-             // We are a virtual interface with no parent.
-             isVirtual = 1;
-             *name_colonP = ':';
+            // failed to access parent interface do not create parent.
+            // We are a virtual interface with no parent.
+            isVirtual = 1;
+            *name_colonP = ':';
         } else {
-             // Got access to parent, so create it if necessary.
-             // Save original name to vname and truncate name by ':'
-             memcpy(vname, name, sizeof(vname) );
-             vname[name_colonP - name] = ':';
+            // Got access to parent, so create it if necessary.
+            // Save original name to vname and truncate name by ':'
+            memcpy(vname, name, sizeof(vname));
+            vname[name_colonP - name] = ':';
         }
     }
 
@@ -943,12 +943,12 @@
         currif = currif->next;
     }
 
-    // If "new" then create an netif structure and insert it into the list.
+    // If "new" then create a netif structure and insert it into the list.
     if (currif == NULL) {
-         CHECKED_MALLOC3(currif, netif *, sizeof(netif) + ifnam_size);
+         CHECKED_MALLOC3(currif, netif *, sizeof(netif) + IFNAMESIZE);
          currif->name = (char *)currif + sizeof(netif);
-         strncpy(currif->name, name, ifnam_size);
-         currif->name[ifnam_size - 1] = '\0';
+         strncpy(currif->name, name, IFNAMESIZE);
+         currif->name[IFNAMESIZE - 1] = '\0';
          currif->index = getIndex(sock, name);
          currif->addr = NULL;
          currif->childs = NULL;
@@ -977,13 +977,12 @@
         }
 
         if (currif == NULL) {
-            CHECKED_MALLOC3(currif, netif *, sizeof(netif) + ifnam_size);
+            CHECKED_MALLOC3(currif, netif *, sizeof(netif) + IFNAMESIZE);
             currif->name = (char *)currif + sizeof(netif);
-            strncpy(currif->name, vname, ifnam_size);
-            currif->name[ifnam_size - 1] = '\0';
+            strncpy(currif->name, vname, IFNAMESIZE);
+            currif->name[IFNAMESIZE - 1] = '\0';
             currif->index = getIndex(sock, vname);
-            currif->addr = NULL;
-            // Need to duplicate the addr entry?
+            currif->addr = NULL; // Need to duplicate the addr entry?
             currif->virtual = 1;
             currif->childs = NULL;
             currif->next = parent->childs;
@@ -1150,7 +1149,7 @@
         struct sockaddr addr, broadaddr, *broadaddrP = NULL;
         short prefix = 0;
 
-        // ignore non IPv4 interfaces
+        // ignore non IPv4 addresses
         if (ifreqP->ifr_addr.sa_family != AF_INET) {
             continue;
         }
@@ -1264,19 +1263,26 @@
  * MAC address. Returns -1 if there is no hardware address on that interface.
  */
 static int getMacAddress
-  (JNIEnv *env, int sock, const char *ifname, const struct in_addr *addr,
+  (JNIEnv *env, const char *ifname, const struct in_addr *addr,
    unsigned char *buf)
 {
     static struct ifreq ifr;
-    int i;
+    int i, sock;
+
+    if ((sock = openSocketWithFallback(env, ifname)) < 0) {
+        return -1;
+    }
+
     memset((char *)&ifr, 0, sizeof(ifr));
     strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1);
     if (ioctl(sock, SIOCGIFHWADDR, &ifr) < 0) {
         JNU_ThrowByNameWithMessageAndLastError
             (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFHWADDR) failed");
+        close(sock);
         return -1;
     }
 
+    close(sock);
     memcpy(buf, &ifr.ifr_hwaddr.sa_data, IFHWADDRLEN);
 
     // all bytes to 0 means no hardware address
@@ -1388,7 +1394,7 @@
         struct sockaddr addr, broadaddr, *broadaddrP = NULL;
         short prefix = 0;
 
-        // ignore non IPv4 interfaces
+        // ignore non IPv4 addresses
         if (ifreqP->ifr_addr.sa_family != AF_INET) {
             continue;
         }
@@ -1444,7 +1450,7 @@
 static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
     struct ifconf ifc;
     struct ifreq *ifreqP;
-    char *buf;
+    char *buf, *cp, *cplimit;
 
     // call SIOCGSIZIFCONF to get size for SIOCGIFCONF buffer
     if (ioctl(sock, SIOCGSIZIFCONF, &(ifc.ifc_len)) < 0) {
@@ -1464,8 +1470,9 @@
     }
 
     // iterate through each interface
-    char *cp = (char *)ifc.ifc_req;
-    char *cplimit = cp + ifc.ifc_len;
+    ifreqP = ifc.ifc_req;
+    cp = (char *)ifc.ifc_req;
+    cplimit = cp + ifc.ifc_len;
 
     for (; cp < cplimit;
          cp += (sizeof(ifreqP->ifr_name) +
@@ -1474,7 +1481,7 @@
         ifreqP = (struct ifreq *)cp;
         short prefix = 0;
 
-        // ignore non IPv6 interfaces
+        // ignore non IPv6 addresses
         if (ifreqP->ifr_addr.sa_family != AF_INET6) {
             continue;
         }
@@ -1527,7 +1534,7 @@
  * MAC address. Returns -1 if there is no hardware address on that interface.
  */
 static int getMacAddress
-  (JNIEnv *env, int sock, const char *ifname, const struct in_addr *addr,
+  (JNIEnv *env, const char *ifname, const struct in_addr *addr,
    unsigned char *buf)
 {
     int size;
@@ -1586,20 +1593,20 @@
 }
 
 static int getFlags(int sock, const char *ifname, int *flags) {
-  struct ifreq if2;
-  memset((char *)&if2, 0, sizeof(if2));
-  strncpy(if2.ifr_name, ifname, sizeof(if2.ifr_name) - 1);
+    struct ifreq if2;
+    memset((char *)&if2, 0, sizeof(if2));
+    strncpy(if2.ifr_name, ifname, sizeof(if2.ifr_name) - 1);
 
-  if (ioctl(sock, SIOCGIFFLAGS, (char *)&if2) < 0) {
-      return -1;
-  }
+    if (ioctl(sock, SIOCGIFFLAGS, (char *)&if2) < 0) {
+        return -1;
+    }
 
-  if (sizeof(if2.ifr_flags) == sizeof(short)) {
-      *flags = (if2.ifr_flags & 0xffff);
-  } else {
-      *flags = if2.ifr_flags;
-  }
-  return 0;
+    if (sizeof(if2.ifr_flags) == sizeof(short)) {
+        *flags = (if2.ifr_flags & 0xffff);
+    } else {
+        *flags = if2.ifr_flags;
+    }
+    return 0;
 }
 
 #endif /* _AIX */
@@ -1668,7 +1675,7 @@
     char *buf = NULL;
     unsigned i;
 
-    // call SIOCGLIFNUM to get the size of SIOCGIFCONF buffer
+    // call SIOCGLIFNUM to get the interface count
     numifs.lifn_family = AF_INET;
     numifs.lifn_flags = 0;
     if (ioctl(sock, SIOCGLIFNUM, (char *)&numifs) < 0) {
@@ -1695,7 +1702,7 @@
     for (i = 0; i < numifs.lifn_count; i++, ifreqP++) {
         struct sockaddr addr, *broadaddrP = NULL;
 
-        // ignore non IPv4 interfaces
+        // ignore non IPv4 addresses
         if (ifreqP->lifr_addr.ss_family != AF_INET) {
             continue;
         }
@@ -1744,7 +1751,7 @@
     char *buf = NULL;
     unsigned i;
 
-    // call SIOCGLIFNUM to get the size of SIOCGLIFCONF buffer
+    // call SIOCGLIFNUM to get the interface count
     numifs.lifn_family = AF_INET6;
     numifs.lifn_flags = 0;
     if (ioctl(sock, SIOCGLIFNUM, (char *)&numifs) < 0) {
@@ -1770,7 +1777,7 @@
     ifreqP = ifc.lifc_req;
     for (i = 0; i < numifs.lifn_count; i++, ifreqP++) {
 
-        // ignore non IPv6 interfaces
+        // ignore non IPv6 addresses
         if (ifreqP->lifr_addr.ss_family != AF_INET6) {
             continue;
         }
@@ -1789,7 +1796,7 @@
             free(buf);
             return ifs;
         }
-   }
+    }
 
     // free buffer
     free(buf);
@@ -1834,9 +1841,9 @@
     strcpy(style1dev, DEV_PREFIX);
     strcat(style1dev, ifname);
     if ((fd = open(style1dev, O_RDWR)) < 0) {
-         // Can't open it. We probably are missing the privilege.
-         // We'll have to try something else
-         return 0;
+        // Can't open it. We probably are missing the privilege.
+        // We'll have to try something else
+        return 0;
     }
 
     dlpareq.dl_primitive = DL_PHYS_ADDR_REQ;
@@ -1878,11 +1885,15 @@
  * MAC address. Returns -1 if there is no hardware address on that interface.
  */
 static int getMacAddress
-  (JNIEnv *env, int sock, const char *ifname, const struct in_addr *addr,
+  (JNIEnv *env, const char *ifname, const struct in_addr *addr,
    unsigned char *buf)
 {
     struct lifreq if2;
-    int len, i;
+    int len, i, sock;
+
+    if ((sock = openSocketWithFallback(env, ifname)) < 0) {
+        return -1;
+    }
 
     // First, try the new (S11) SIOCGLIFHWADDR ioctl(). If that fails
     // try the old way.
@@ -1893,40 +1904,36 @@
         struct sockaddr_dl *sp;
         sp = (struct sockaddr_dl *)&if2.lifr_addr;
         memcpy(buf, &sp->sdl_data[0], sp->sdl_alen);
+        close(sock);
         return sp->sdl_alen;
     }
 
     // On Solaris we have to use DLPI, but it will only work if we have
     // privileged access (i.e. root). If that fails, we try a lookup
     // in the ARP table, which requires an IPv4 address.
-    if ((len = getMacFromDevice(env, ifname, buf))  == 0) {
-        // DLPI failed - trying to do arp lookup
-
+    if (((len = getMacFromDevice(env, ifname, buf)) == 0) && (addr != NULL)) {
         struct arpreq arpreq;
         struct sockaddr_in *sin;
         struct sockaddr_in ipAddr;
 
-        if (addr == NULL) {
-             // No IPv4 address for that interface, so can't do an ARP lookup.
-             return -1;
-         }
+        len = 6; //???
 
-         len = 6; //???
+        sin = (struct sockaddr_in *)&arpreq.arp_pa;
+        memset((char *)&arpreq, 0, sizeof(struct arpreq));
+        ipAddr.sin_port = 0;
+        ipAddr.sin_family = AF_INET;
+        memcpy(&ipAddr.sin_addr, addr, sizeof(struct in_addr));
+        memcpy(&arpreq.arp_pa, &ipAddr, sizeof(struct sockaddr_in));
+        arpreq.arp_flags= ATF_PUBL;
 
-         sin = (struct sockaddr_in *)&arpreq.arp_pa;
-         memset((char *)&arpreq, 0, sizeof(struct arpreq));
-         ipAddr.sin_port = 0;
-         ipAddr.sin_family = AF_INET;
-         memcpy(&ipAddr.sin_addr, addr, sizeof(struct in_addr));
-         memcpy(&arpreq.arp_pa, &ipAddr, sizeof(struct sockaddr_in));
-         arpreq.arp_flags= ATF_PUBL;
+        if (ioctl(sock, SIOCGARP, &arpreq) < 0) {
+            close(sock);
+            return -1;
+        }
 
-         if (ioctl(sock, SIOCGARP, &arpreq) < 0) {
-             return -1;
-         }
-
-         memcpy(buf, &arpreq.arp_ha.sa_data[0], len);
+        memcpy(buf, &arpreq.arp_ha.sa_data[0], len);
     }
+    close(sock);
 
     // all bytes to 0 means no hardware address
     for (i = 0; i < len; i++) {
@@ -2014,7 +2021,7 @@
     for (ifa = origifa; ifa != NULL; ifa = ifa->ifa_next) {
         struct sockaddr *broadaddrP = NULL;
 
-        // ignore non IPv4 interfaces
+        // ignore non IPv4 addresses
         if (ifa->ifa_addr == NULL || ifa->ifa_addr->sa_family != AF_INET)
             continue;
 
@@ -2058,7 +2065,7 @@
     }
 
     for (ifa = origifa; ifa != NULL; ifa = ifa->ifa_next) {
-        // ignore non IPv6 interfaces
+        // ignore non IPv6 addresses
         if (ifa->ifa_addr == NULL || ifa->ifa_addr->sa_family != AF_INET6)
             continue;
 
@@ -2113,22 +2120,22 @@
  * MAC address. Returns -1 if there is no hardware address on that interface.
  */
 static int getMacAddress
-  (JNIEnv *env, int sock, const char *ifname, const struct in_addr *addr,
+  (JNIEnv *env, const char *ifname, const struct in_addr *addr,
    unsigned char *buf)
 {
     struct ifaddrs *ifa0, *ifa;
     struct sockaddr *saddr;
     int i;
 
-    // Grab the interface list
+    // grab the interface list
     if (!getifaddrs(&ifa0)) {
-        // Cycle through the interfaces
+        // cycle through the interfaces
         for (i = 0, ifa = ifa0; ifa != NULL; ifa = ifa->ifa_next, i++) {
             saddr = ifa->ifa_addr;
-            // Link layer contains the MAC address
+            // link layer contains the MAC address
             if (saddr->sa_family == AF_LINK && !strcmp(ifname, ifa->ifa_name)) {
                 struct sockaddr_dl *sadl = (struct sockaddr_dl *) saddr;
-                // Check the address is the correct length
+                // check the address has the correct length
                 if (sadl->sdl_alen == ETHER_ADDR_LEN) {
                     memcpy(buf, (sadl->sdl_data + sadl->sdl_nlen), ETHER_ADDR_LEN);
                     freeifaddrs(ifa0);
--- a/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c	Mon Sep 12 22:04:48 2016 +0000
@@ -52,6 +52,10 @@
 #include <strings.h>
 #endif
 
+#ifdef __linux__
+#include <sys/syscall.h>
+#endif
+
 #if defined(__linux__) || defined(_AIX)
 #include <string.h>
 #endif
@@ -157,14 +161,11 @@
 }
 #endif
 
-#if defined(__linux__) && defined(__x86_64__)
+#if defined(__linux__) && defined(_LP64) && defined(__NR_newfstatat)
 #define FSTATAT64_SYSCALL_AVAILABLE
 static int fstatat64_wrapper(int dfd, const char *path,
                              struct stat64 *statbuf, int flag)
 {
-    #ifndef __NR_newfstatat
-    #define __NR_newfstatat  262
-    #endif
     return syscall(__NR_newfstatat, dfd, path, statbuf, flag);
 }
 #endif
--- a/src/java.desktop/share/classes/com/sun/media/sound/DLSInfo.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/media/sound/DLSInfo.java	Mon Sep 12 22:04:48 2016 +0000
@@ -95,7 +95,7 @@
     public String subject = null;
     /**
      * (ISRC) Name of person or orginization who supplied
-     *        orginal material for the file.
+     *        original material for the file.
      */
     public String source = null;
     /**
--- a/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, 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
@@ -64,6 +64,7 @@
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.WeakHashMap;
 import java.util.stream.Collectors;
@@ -1851,8 +1852,11 @@
     private static final class ObjectInputStreamWithLoader
             extends ObjectInputStream {
         ObjectInputStreamWithLoader(InputStream in, ClassLoader cl)
-        throws IOException {
+        throws IOException, IllegalArgumentException {
             super(in);
+            if (cl == null ) {
+              throw new IllegalArgumentException("class loader is null");
+            }
             this.loader = cl;
         }
 
@@ -1861,7 +1865,7 @@
                 throws IOException, ClassNotFoundException {
             String name = classDesc.getName();
             ReflectUtil.checkPackageAccess(name);
-            return Class.forName(name, false, loader);
+            return Class.forName(name, false, Objects.requireNonNull(loader));
         }
 
         private final ClassLoader loader;
--- a/src/java.management/share/classes/module-info.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.management/share/classes/module-info.java	Mon Sep 12 22:04:48 2016 +0000
@@ -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
@@ -50,6 +50,7 @@
     uses javax.management.remote.JMXConnectorProvider;
     uses javax.management.remote.JMXConnectorServerProvider;
     uses sun.management.spi.PlatformMBeanProvider;
+    uses sun.management.spi.AgentProvider;
 
     provides javax.security.auth.spi.LoginModule
         with com.sun.jmx.remote.security.FileLoginModule;
--- a/src/java.management/share/classes/sun/management/Agent.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/java.management/share/classes/sun/management/Agent.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -31,17 +31,19 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.management.ManagementFactory;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.InetAddress;
 import java.net.MalformedURLException;
 import java.net.UnknownHostException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.text.MessageFormat;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.MissingResourceException;
 import java.util.Properties;
 import java.util.ResourceBundle;
+import java.util.ServiceLoader;
 import java.util.function.Function;
 import java.util.function.Predicate;
 
@@ -53,6 +55,7 @@
 import sun.management.jdp.JdpController;
 import sun.management.jdp.JdpException;
 import jdk.internal.vm.VMSupport;
+import sun.management.spi.AgentProvider;
 
 /**
  * This Agent is started by the VM when -Dcom.sun.management.snmp or
@@ -248,8 +251,8 @@
             "com.sun.management.enableThreadContentionMonitoring";
     private static final String LOCAL_CONNECTOR_ADDRESS_PROP =
             "com.sun.management.jmxremote.localConnectorAddress";
-    private static final String SNMP_ADAPTOR_BOOTSTRAP_CLASS_NAME =
-            "sun.management.snmp.AdaptorBootstrap";
+    private static final String SNMP_AGENT_NAME =
+            "SnmpAgent";
 
     private static final String JDP_DEFAULT_ADDRESS = "224.0.23.178";
     private static final int JDP_DEFAULT_PORT = 7095;
@@ -429,7 +432,7 @@
 
         try {
             if (snmpPort != null) {
-                loadSnmpAgent(snmpPort, props);
+                loadSnmpAgent(props);
             }
 
             /*
@@ -554,28 +557,24 @@
         return mgmtProps;
     }
 
-    private static void loadSnmpAgent(String snmpPort, Properties props) {
-        try {
-            // invoke the following through reflection:
-            //     AdaptorBootstrap.initialize(snmpPort, props);
-            final Class<?> adaptorClass =
-                    Class.forName(SNMP_ADAPTOR_BOOTSTRAP_CLASS_NAME, true, null);
-            final Method initializeMethod =
-                    adaptorClass.getMethod("initialize",
-                    String.class, Properties.class);
-            initializeMethod.invoke(null, snmpPort, props);
-        } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException x) {
-            // snmp runtime doesn't exist - initialization fails
-            throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT, x);
-        } catch (InvocationTargetException x) {
-            final Throwable cause = x.getCause();
-            if (cause instanceof RuntimeException) {
-                throw (RuntimeException) cause;
-            } else if (cause instanceof Error) {
-                throw (Error) cause;
-            }
-            // should not happen...
-            throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT, cause);
+    private static void loadSnmpAgent(Properties props) {
+        /*
+         * Load the jdk.snmp service
+         */
+        AgentProvider provider = AccessController.doPrivileged(
+            (PrivilegedAction<AgentProvider>) () -> {
+                for(AgentProvider aProvider : ServiceLoader.loadInstalled(AgentProvider.class)) {
+                    if(aProvider.getName().equals(SNMP_AGENT_NAME))
+                        return aProvider;
+                }
+                return null;
+            },  null
+        );
+
+        if (provider != null) {
+            provider.startAgent(props);
+         } else { // snmp runtime doesn't exist - initialization fails
+            throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT);
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.management/share/classes/sun/management/spi/AgentProvider.java	Mon Sep 12 22:04:48 2016 +0000
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.management.spi;
+
+import java.util.Properties;
+
+/**
+ * Service interface for management agent
+ */
+public abstract class AgentProvider {
+
+    /**
+     * Instantiates a new AgentProvider.
+     *
+     * @throws SecurityException if the subclass (and calling code) does not
+     * have
+     * {@code RuntimePermission("sun.management.spi.AgentProvider.subclass")}
+     */
+    protected AgentProvider() {
+        this(checkSubclassPermission());
+    }
+
+    private AgentProvider(Void unused) {
+    }
+
+    private static Void checkSubclassPermission() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new RuntimePermission(AgentProvider.class.getName() + ".subclass"));
+        }
+        return null;
+    }
+
+    /**
+     * Gets the name of the agent provider.
+     *
+     * @return name of agent provider
+     */
+    public abstract String getName();
+
+    /**
+     * Initializes and starts the agent.
+     *
+     * @throws IllegalStateException if this agent has already been started.
+     */
+    public abstract void startAgent();
+
+    /**
+     * Initializes and starts the agent at given port and with given properties
+     *
+     * @param props environment variables for agent
+     *
+     * @throws IllegalStateException if this agent has already been started.
+     */
+    public abstract void startAgent(Properties props);
+
+    /**
+     * Checks if agent is started and not terminated.
+     *
+     * @return true if agent is running, false otherwise.
+     */
+    public abstract boolean isActive();
+
+    /**
+     * Stops this agent.
+     *
+     * @throws IllegalStateException if this agent is not started.
+     */
+    public abstract void stopAgent();
+}
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Mon Sep 12 22:04:48 2016 +0000
@@ -189,12 +189,12 @@
             storeFiles(modules, release);
 
             if (Files.getFileStore(root).supportsFileAttributeView(PosixFileAttributeView.class)) {
-                // launchers in the bin directory need execute permission
+                // launchers in the bin directory need execute permission.
+                // On Windows, "bin" also subdirectories containing jvm.dll.
                 if (Files.isDirectory(bin)) {
-                    Files.list(bin)
-                            .filter(f -> !f.toString().endsWith(".diz"))
-                            .filter(f -> Files.isRegularFile(f))
-                            .forEach(this::setExecutable);
+                    Files.find(bin, 2, (path, attrs) -> {
+                        return attrs.isRegularFile() && !path.toString().endsWith(".diz");
+                    }).forEach(this::setExecutable);
                 }
 
                 // jspawnhelper is in lib or lib/<arch>
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java	Mon Sep 12 22:04:48 2016 +0000
@@ -99,9 +99,15 @@
      * e.g.: /java.base/native/amd64/server/libjvm.so
      * /java.base/native/server/libjvm.dylib
      */
-    private List<ResourcePoolEntry> getVMs(ResourcePoolModule javaBase, String jvmlib) {
+    private List<ResourcePoolEntry> getVMs(ResourcePoolModule javaBase, String[] jvmlibs) {
         List<ResourcePoolEntry> ret = javaBase.entries().filter((t) -> {
-            return t.path().endsWith("/" + jvmlib);
+            String path = t.path();
+            for (String jvmlib : jvmlibs) {
+                if (t.path().endsWith("/" + jvmlib)) {
+                    return true;
+                }
+            }
+            return false;
         }).collect(Collectors.toList());
         return ret;
     }
@@ -109,18 +115,21 @@
     @Override
     public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) {
         ResourcePoolModule javaBase = in.moduleView().findModule("java.base").get();
-        String jvmlib = jvmlib(javaBase.descriptor().osName().get());
+        String[] jvmlibs = jvmlibs(javaBase.descriptor().osName().get());
         TreeSet<Jvm> existing = new TreeSet<>(new JvmComparator());
         TreeSet<Jvm> removed = new TreeSet<>(new JvmComparator());
         if (!keepAll) {
             // First retrieve all available VM names and removed VM
-            List<ResourcePoolEntry> jvms = getVMs(javaBase, jvmlib);
+            List<ResourcePoolEntry> jvms = getVMs(javaBase, jvmlibs);
             for (Jvm jvm : Jvm.values()) {
                 for (ResourcePoolEntry md : jvms) {
-                    if (md.path().endsWith("/" + jvm.getName() + "/" + jvmlib)) {
-                        existing.add(jvm);
-                        if (isRemoved(md)) {
-                            removed.add(jvm);
+                    String mdPath = md.path();
+                    for (String jvmlib : jvmlibs) {
+                        if (mdPath.endsWith("/" + jvm.getName() + "/" + jvmlib)) {
+                            existing.add(jvm);
+                            if (isRemoved(md)) {
+                                removed.add(jvm);
+                            }
                         }
                     }
                 }
@@ -248,14 +257,14 @@
         return orig.copyWithContent(content);
     }
 
-    private static String jvmlib(String osName) {
-        String lib = "libjvm.so";
+    private static String[] jvmlibs(String osName) {
         if (isWindows(osName)) {
-            lib = "jvm.dll";
+            return new String[] { "jvm.dll" };
         } else if (isMac(osName)) {
-            lib = "libjvm.dylib";
+            return new String[] { "libjvm.dylib", "libjvm.a" };
+        } else {
+            return new String[] { "libjvm.so", "libjvm.a" };
         }
-        return lib;
     }
 
     private static boolean isWindows(String osName) {
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Mon Sep 12 22:04:48 2016 +0000
@@ -264,8 +264,8 @@
 
         // Add Thai BreakIterator related data files
         if (tag.equals("th")) {
-            files.add(".+sun/text/resources/thai_dict");
-            files.add(".+sun/text/resources/[^_]+BreakIteratorData_th");
+            files.add(".+sun/text/resources/ext/thai_dict");
+            files.add(".+sun/text/resources/ext/[^_]+BreakIteratorData_th");
         }
 
         // Add Taiwan resource bundles for Hong Kong
Binary file src/jdk.localedata/share/classes/sun/text/resources/ext/thai_dict has changed
Binary file src/jdk.localedata/share/classes/sun/text/resources/thai_dict has changed
--- a/test/ProblemList.txt	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/ProblemList.txt	Mon Sep 12 22:04:48 2016 +0000
@@ -310,8 +310,6 @@
 
 tools/pack200/CommandLineTests.java                             7143279,8059906 generic-all
 
-tools/pack200/Pack200Test.java                                  8059906,8151901 generic-all
-
 tools/launcher/FXLauncherTest.java                              8068049 linux-all,macosx-all
 
 tools/pack200/Pack200Props.java                                 8155857 generic-all
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/lang/ClassLoader/GetDefinedPackage.java	Mon Sep 12 22:04:48 2016 +0000
@@ -0,0 +1,57 @@
+/*
+ * 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 8165346
+ * @summary Basic test for ClassLoader::getDefinedPackage
+ */
+
+public class GetDefinedPackage {
+    public static void main(String... args) {
+        TestClassLoader loader = new TestClassLoader();
+        Package pkg = loader.getDefinedPackage(TestClassLoader.PKG_NAME);
+        if (pkg == null) {
+            throw new RuntimeException("package foo not found");
+        }
+
+        try {
+            loader.getDefinedPackage(null);
+            throw new RuntimeException("NullPointerException not thrown");
+        } catch (NullPointerException e) {
+        }
+    }
+
+    static class TestClassLoader extends ClassLoader {
+        public static final String PKG_NAME = "foo";
+
+        public TestClassLoader() {
+            super();
+            definePackage(PKG_NAME);
+        }
+
+        public Package definePackage(String name) {
+            return definePackage(name, null, null, null, null, null, null, null);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/lang/ClassLoader/ResourcesStreamTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/*
+ * @test
+ * @bug 8161230
+ * @summary Test java.lang.ClassLoader.resources() method
+ *
+ * @build ResourcesStreamTest
+ * @run main ResourcesStreamTest
+ */
+public class ResourcesStreamTest {
+
+    public static void main(String[] args) throws Exception {
+        testSuccess();
+        testFailure();
+    }
+
+    public static void testSuccess() throws Exception {
+        // failing part first
+        try {
+            ClassLoader cl = new FailingClassLoader();
+            // should create the stream pipe
+            Stream<URL> stream = cl.resources("the name");
+            // expect function to throw an exception when calling the method
+            stream.forEach(System.out::println);
+            throw new Exception("expected UncheckedIOException not thrown");
+        } catch (UncheckedIOException uio) {
+            String causeMessage = uio.getCause().getMessage();
+            if (!"the name".equals(causeMessage))
+                throw new Exception("unexpected cause message: " + causeMessage);
+        }
+    }
+
+    public static void testFailure() throws Exception {
+        ClassLoader cl = new SuccessClassLoader();
+        long count = cl.resources("the name").count();
+        if (count != 1)
+            throw new Exception("expected resource is null or empty");
+
+        cl.resources("the name")
+          .filter(url -> "file:/somefile".equals(url.toExternalForm()))
+          .findFirst()
+          .orElseThrow(() -> new Exception("correct URL not found"));
+    }
+
+    public static class SuccessClassLoader extends ClassLoader {
+        @Override
+        public Enumeration<URL> getResources(String name) throws IOException {
+            URL url = new URL("file:/somefile");
+            return Collections.enumeration(Collections.singleton(url));
+        }
+    }
+
+    public static class FailingClassLoader extends ClassLoader {
+        @Override
+        public Enumeration<URL> getResources(String name) throws IOException {
+            throw new IOException(name);
+        }
+    }
+}
--- a/test/java/net/SetFactoryPermission/SetFactoryPermission.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/net/SetFactoryPermission/SetFactoryPermission.java	Mon Sep 12 22:04:48 2016 +0000
@@ -27,7 +27,7 @@
  * @bug 8048052
  * @summary Test a series of methods which requires "setFactory" runtime permission
  * @modules java.rmi
- * @run main SetFactoryPermission success
+ * @run main/othervm SetFactoryPermission success
  * @run main/othervm/policy=policy.fail SetFactoryPermission fail
  * @run main/othervm/policy=policy.success SetFactoryPermission success
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/channels/Selector/SelectTimeout.java	Mon Sep 12 22:04:48 2016 +0000
@@ -0,0 +1,83 @@
+/*
+* 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 8165000
+ * @summary Verify no IOException on OS X for large timeout value in select().
+ * @requires (os.family == "mac")
+ */
+import java.io.IOException;
+import java.nio.channels.Selector;
+
+public class SelectTimeout {
+    private static final long HUGE_TIMEOUT = 100000001000L;
+    private static final long SLEEP_MILLIS = 10000;
+
+    private static Exception theException;
+
+    public static void main(String[] args)
+        throws IOException, InterruptedException {
+        int failures = 0;
+        long[] timeouts =
+            new long[] {0, HUGE_TIMEOUT/2, HUGE_TIMEOUT - 1, HUGE_TIMEOUT};
+        for (long t : timeouts) {
+            if (!test(t)) {
+                failures++;
+            }
+        }
+        if (failures > 0) {
+            throw new RuntimeException("Test failed!");
+        } else {
+            System.out.println("Test succeeded");
+        }
+    }
+
+    private static boolean test(final long timeout)
+        throws InterruptedException, IOException {
+        theException = null;
+
+        Selector selector = Selector.open();
+
+        Thread t = new Thread(() -> {
+            try {
+                selector.select(timeout);
+            } catch (IOException ioe) {
+                theException = ioe;
+            }
+        });
+        t.start();
+
+        Thread.currentThread().sleep(SLEEP_MILLIS);
+        t.interrupt();
+
+        if (theException == null) {
+            System.out.printf("Test succeeded with timeout %d%n", timeout);
+            return true;
+        } else {
+            System.err.printf("Test failed with timeout %d%n", timeout);
+            theException.printStackTrace();
+            return false;
+        }
+    }
+}
--- a/test/java/nio/file/DirectoryStream/SecureDS.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/nio/file/DirectoryStream/SecureDS.java	Mon Sep 12 22:04:48 2016 +0000
@@ -45,6 +45,9 @@
             DirectoryStream<Path> stream = newDirectoryStream(dir);
             stream.close();
             if (!(stream instanceof SecureDirectoryStream)) {
+                if (System.getProperty("os.name").equals("Linux"))
+                    throw new AssertionError(
+                            "SecureDirectoryStream not supported.");
                 System.out.println("SecureDirectoryStream not supported.");
                 return;
             }
--- a/test/java/time/TEST.properties	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/time/TEST.properties	Mon Sep 12 22:04:48 2016 +0000
@@ -1,4 +1,6 @@
 # Threeten test uses TestNG
 TestNG.dirs = .
 othervm.dirs = tck/java/time/chrono test/java/time/chrono test/java/time/format
+modules = jdk.localedata
 lib.dirs = ../../lib/testlibrary
+lib.build = jdk.testlibrary.RandomFactory
--- a/test/java/util/Base64/TestBase64.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/Base64/TestBase64.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,11 @@
 
 /**
  * @test 4235519 8004212 8005394 8007298 8006295 8006315 8006530 8007379 8008925
- *       8014217 8025003 8026330 8028397 8129544
+ *       8014217 8025003 8026330 8028397 8129544 8165243
  * @summary tests java.util.Base64
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
+ * @run main TestBase64
  * @key randomness
  */
 
@@ -35,11 +38,17 @@
 import java.io.OutputStream;
 import java.nio.ByteBuffer;
 import java.util.Arrays;
+import java.util.ArrayList;
 import java.util.Base64;
+import java.util.List;
 import java.util.Random;
 
+import jdk.testlibrary.RandomFactory;
+
 public class TestBase64 {
 
+    private static final Random rnd = RandomFactory.getRandom();
+
     public static void main(String args[]) throws Throwable {
         int numRuns  = 10;
         int numBytes = 200;
@@ -52,7 +61,6 @@
         test(Base64.getUrlEncoder(), Base64.getUrlDecoder(), numRuns, numBytes);
         test(Base64.getMimeEncoder(), Base64.getMimeDecoder(), numRuns, numBytes);
 
-        Random rnd = new java.util.Random();
         byte[] nl_1 = new byte[] {'\n'};
         byte[] nl_2 = new byte[] {'\n', '\r'};
         byte[] nl_3 = new byte[] {'\n', '\r', '\n'};
@@ -76,7 +84,7 @@
         testNull(Base64.getDecoder());
         testNull(Base64.getUrlDecoder());
         testNull(Base64.getMimeDecoder());
-        checkNull(new Runnable() { public void run() { Base64.getMimeEncoder(10, null); }});
+        checkNull(() -> Base64.getMimeEncoder(10, null));
 
         testIOE(Base64.getEncoder());
         testIOE(Base64.getUrlEncoder());
@@ -84,26 +92,23 @@
         testIOE(Base64.getMimeEncoder(10, new byte[]{'\n'}));
 
         byte[] src = new byte[1024];
-        new Random().nextBytes(src);
+        rnd.nextBytes(src);
         final byte[] decoded = Base64.getEncoder().encode(src);
         testIOE(Base64.getDecoder(), decoded);
         testIOE(Base64.getMimeDecoder(), decoded);
         testIOE(Base64.getUrlDecoder(), Base64.getUrlEncoder().encode(src));
 
         // illegal line separator
-        checkIAE(new Runnable() { public void run() { Base64.getMimeEncoder(10, new byte[]{'\r', 'N'}); }});
+        checkIAE(() -> Base64.getMimeEncoder(10, new byte[]{'\r', 'N'}));
 
         // malformed padding/ending
         testMalformedPadding();
 
         // illegal base64 character
         decoded[2] = (byte)0xe0;
-        checkIAE(new Runnable() {
-            public void run() { Base64.getDecoder().decode(decoded); }});
-        checkIAE(new Runnable() {
-            public void run() { Base64.getDecoder().decode(decoded, new byte[1024]); }});
-        checkIAE(new Runnable() { public void run() {
-            Base64.getDecoder().decode(ByteBuffer.wrap(decoded)); }});
+        checkIAE(() -> Base64.getDecoder().decode(decoded));
+        checkIAE(() -> Base64.getDecoder().decode(decoded, new byte[1024]));
+        checkIAE(() -> Base64.getDecoder().decode(ByteBuffer.wrap(decoded)));
 
         // test single-non-base64 character for mime decoding
         testSingleNonBase64MimeDec();
@@ -113,12 +118,20 @@
 
         // test mime decoding with ignored character after padding
         testDecodeIgnoredAfterPadding();
+
+        // given invalid args, encoder should not produce output
+        testEncoderKeepsSilence(Base64.getEncoder());
+        testEncoderKeepsSilence(Base64.getUrlEncoder());
+        testEncoderKeepsSilence(Base64.getMimeEncoder());
+
+        // given invalid args, decoder should not consume input
+        testDecoderKeepsAbstinence(Base64.getDecoder());
+        testDecoderKeepsAbstinence(Base64.getUrlDecoder());
+        testDecoderKeepsAbstinence(Base64.getMimeDecoder());
     }
 
     private static void test(Base64.Encoder enc, Base64.Decoder dec,
                              int numRuns, int numBytes) throws Throwable {
-        Random rnd = new java.util.Random();
-
         enc.encode(new byte[0]);
         dec.decode(new byte[0]);
 
@@ -258,48 +271,49 @@
     private static final String str_null = null;
     private static final ByteBuffer bb_null = null;
 
-    private static void testNull(final Base64.Encoder enc) {
-        checkNull(new Runnable() { public void run() { enc.encode(ba_null); }});
-        checkNull(new Runnable() { public void run() { enc.encodeToString(ba_null); }});
-        checkNull(new Runnable() { public void run() { enc.encode(ba_null, new byte[10]); }});
-        checkNull(new Runnable() { public void run() { enc.encode(new byte[10], ba_null); }});
-        checkNull(new Runnable() { public void run() { enc.encode(bb_null); }});
-        checkNull(new Runnable() { public void run() { enc.wrap((OutputStream)null); }});
+    private static void testNull(Base64.Encoder enc) {
+        checkNull(() -> enc.encode(ba_null));
+        checkNull(() -> enc.encodeToString(ba_null));
+        checkNull(() -> enc.encode(ba_null, new byte[10]));
+        checkNull(() -> enc.encode(new byte[10], ba_null));
+        checkNull(() -> enc.encode(bb_null));
+        checkNull(() -> enc.wrap((OutputStream)null));
     }
 
-    private static void testNull(final Base64.Decoder dec) {
-        checkNull(new Runnable() { public void run() { dec.decode(ba_null); }});
-        checkNull(new Runnable() { public void run() { dec.decode(str_null); }});
-        checkNull(new Runnable() { public void run() { dec.decode(ba_null, new byte[10]); }});
-        checkNull(new Runnable() { public void run() { dec.decode(new byte[10], ba_null); }});
-        checkNull(new Runnable() { public void run() { dec.decode(bb_null); }});
-        checkNull(new Runnable() { public void run() { dec.wrap((InputStream)null); }});
+    private static void testNull(Base64.Decoder dec) {
+        checkNull(() -> dec.decode(ba_null));
+        checkNull(() -> dec.decode(str_null));
+        checkNull(() -> dec.decode(ba_null, new byte[10]));
+        checkNull(() -> dec.decode(new byte[10], ba_null));
+        checkNull(() -> dec.decode(bb_null));
+        checkNull(() -> dec.wrap((InputStream)null));
     }
 
+    @FunctionalInterface
     private static interface Testable {
         public void test() throws Throwable;
     }
 
-    private static void testIOE(final Base64.Encoder enc) throws Throwable {
+    private static void testIOE(Base64.Encoder enc) throws Throwable {
         ByteArrayOutputStream baos = new ByteArrayOutputStream(8192);
-        final OutputStream os = enc.wrap(baos);
+        OutputStream os = enc.wrap(baos);
         os.write(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9});
         os.close();
-        checkIOE(new Testable() { public void test() throws Throwable { os.write(10); }});
-        checkIOE(new Testable() { public void test() throws Throwable { os.write(new byte[] {10}); }});
-        checkIOE(new Testable() { public void test() throws Throwable { os.write(new byte[] {10}, 1, 4); }});
+        checkIOE(() -> os.write(10));
+        checkIOE(() -> os.write(new byte[] {10}));
+        checkIOE(() -> os.write(new byte[] {10}, 1, 4));
     }
 
-    private static void testIOE(final Base64.Decoder dec, byte[] decoded) throws Throwable {
+    private static void testIOE(Base64.Decoder dec, byte[] decoded) throws Throwable {
         ByteArrayInputStream bais = new ByteArrayInputStream(decoded);
-        final InputStream is = dec.wrap(bais);
+        InputStream is = dec.wrap(bais);
         is.read(new byte[10]);
         is.close();
-        checkIOE(new Testable() { public void test() throws Throwable { is.read(); }});
-        checkIOE(new Testable() { public void test() throws Throwable { is.read(new byte[] {10}); }});
-        checkIOE(new Testable() { public void test() throws Throwable { is.read(new byte[] {10}, 1, 4); }});
-        checkIOE(new Testable() { public void test() throws Throwable { is.available(); }});
-        checkIOE(new Testable() { public void test() throws Throwable { is.skip(20); }});
+        checkIOE(() -> is.read());
+        checkIOE(() -> is.read(new byte[] {10}));
+        checkIOE(() -> is.read(new byte[] {10}, 1, 4));
+        checkIOE(() -> is.available());
+        checkIOE(() -> is.skip(20));
     }
 
     private static final void checkNull(Runnable r) {
@@ -391,13 +405,13 @@
                 int pos = (Integer)data[i + 2];
 
                 // decode(byte[])
-                checkIAE(new Runnable() { public void run() { dec.decode(srcBytes); }});
+                checkIAE(() -> dec.decode(srcBytes));
 
                 // decode(String)
-                checkIAE(new Runnable() { public void run() { dec.decode(srcStr); }});
+                checkIAE(() -> dec.decode(srcStr));
 
                 // decode(ByteBuffer)
-                checkIAE(new Runnable() { public void run() { dec.decode(srcBB); }});
+                checkIAE(() -> dec.decode(srcBB));
 
                 // wrap stream
                 checkIOE(new Testable() {
@@ -412,10 +426,8 @@
         // anything left after padding is "invalid"/IAE, if
         // not MIME. In case of MIME, non-base64 character(s)
         // is ignored.
-        checkIAE(new Runnable() { public void run() {
-            Base64.getDecoder().decode("AA==\u00D2"); }});
-        checkIAE(new Runnable() { public void run() {
-            Base64.getUrlDecoder().decode("AA==\u00D2"); }});
+        checkIAE(() -> Base64.getDecoder().decode("AA==\u00D2"));
+        checkIAE(() -> Base64.getUrlDecoder().decode("AA==\u00D2"));
         Base64.getMimeDecoder().decode("AA==\u00D2");
      }
 
@@ -516,4 +528,67 @@
         }
         return ret;
     }
+
+    private static void testEncoderKeepsSilence(Base64.Encoder enc)
+            throws Throwable {
+        List<Integer> vals = new ArrayList<>(List.of(Integer.MIN_VALUE,
+                Integer.MIN_VALUE + 1, -1111, -2, -1, 0, 1, 2, 3, 1111,
+                Integer.MAX_VALUE - 1, Integer.MAX_VALUE));
+        vals.addAll(List.of(rnd.nextInt(), rnd.nextInt(), rnd.nextInt(),
+                rnd.nextInt()));
+        byte[] buf = new byte[] {1, 0, 91};
+        for (int off : vals) {
+            for (int len : vals) {
+                if (off >= 0 && len >= 0 && off <= buf.length - len) {
+                    // valid args, skip them
+                    continue;
+                }
+                // invalid args, test them
+                System.out.println("testing off=" + off + ", len=" + len);
+
+                ByteArrayOutputStream baos = new ByteArrayOutputStream(100);
+                try (OutputStream os = enc.wrap(baos)) {
+                    os.write(buf, off, len);
+                    throw new RuntimeException("Expected IOOBEx was not thrown");
+                } catch (IndexOutOfBoundsException expected) {
+                }
+                if (baos.size() > 0)
+                    throw new RuntimeException("No output was expected, but got "
+                            + baos.size() + " bytes");
+            }
+        }
+    }
+
+    private static void testDecoderKeepsAbstinence(Base64.Decoder dec)
+            throws Throwable {
+        List<Integer> vals = new ArrayList<>(List.of(Integer.MIN_VALUE,
+                Integer.MIN_VALUE + 1, -1111, -2, -1, 0, 1, 2, 3, 1111,
+                Integer.MAX_VALUE - 1, Integer.MAX_VALUE));
+        vals.addAll(List.of(rnd.nextInt(), rnd.nextInt(), rnd.nextInt(),
+                rnd.nextInt()));
+        byte[] buf = new byte[3];
+        for (int off : vals) {
+            for (int len : vals) {
+                if (off >= 0 && len >= 0 && off <= buf.length - len) {
+                    // valid args, skip them
+                    continue;
+                }
+                // invalid args, test them
+                System.out.println("testing off=" + off + ", len=" + len);
+
+                String input = "AAAAAAAAAAAAAAAAAAAAAA";
+                ByteArrayInputStream bais =
+                        new ByteArrayInputStream(input.getBytes("Latin1"));
+                try (InputStream is = dec.wrap(bais)) {
+                    is.read(buf, off, len);
+                    throw new RuntimeException("Expected IOOBEx was not thrown");
+                } catch (IndexOutOfBoundsException expected) {
+                }
+                if (bais.available() != input.length())
+                    throw new RuntimeException("No input should be consumed, "
+                            + "but consumed " + (input.length() - bais.available())
+                            + " bytes");
+            }
+        }
+    }
 }
--- a/test/java/util/Calendar/Bug4302966.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/Calendar/Bug4302966.java	Mon Sep 12 22:04:48 2016 +0000
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 4302966
+ * @modules jdk.localedata
  * @summary In Czech Republic first day of week is Monday not Sunday
  */
 
--- a/test/java/util/Collection/MOAT.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/Collection/MOAT.java	Mon Sep 12 22:04:48 2016 +0000
@@ -112,7 +112,6 @@
         testCollection(Arrays.asList(1,2,3));
         testCollection(nCopies(25,1));
         testImmutableList(nCopies(25,1));
-        testImmutableList(unmodifiableList(Arrays.asList(1,2,3)));
 
         testMap(new HashMap<Integer,Integer>());
         testMap(new LinkedHashMap<Integer,Integer>());
@@ -134,6 +133,20 @@
         testMap(Collections.synchronizedSortedMap(new TreeMap<Integer,Integer>()));
         testMap(Collections.synchronizedNavigableMap(new TreeMap<Integer,Integer>()));
 
+        // Unmodifiable wrappers
+        testImmutableSet(unmodifiableSet(new HashSet<>(Arrays.asList(1,2,3))));
+        testImmutableList(unmodifiableList(Arrays.asList(1,2,3)));
+        testImmutableMap(unmodifiableMap(Collections.singletonMap(1,2)));
+        testCollMutatorsAlwaysThrow(unmodifiableSet(new HashSet<>(Arrays.asList(1,2,3))));
+        testCollMutatorsAlwaysThrow(unmodifiableSet(Collections.emptySet()));
+        testEmptyCollMutatorsAlwaysThrow(unmodifiableSet(Collections.emptySet()));
+        testListMutatorsAlwaysThrow(unmodifiableList(Arrays.asList(1,2,3)));
+        testListMutatorsAlwaysThrow(unmodifiableList(Collections.emptyList()));
+        testEmptyListMutatorsAlwaysThrow(unmodifiableList(Collections.emptyList()));
+        testMapMutatorsAlwaysThrow(unmodifiableMap(Collections.singletonMap(1,2)));
+        testMapMutatorsAlwaysThrow(unmodifiableMap(Collections.emptyMap()));
+        testEmptyMapMutatorsAlwaysThrow(unmodifiableMap(Collections.emptyMap()));
+
         // Empty collections
         final List<Integer> emptyArray = Arrays.asList(new Integer[]{});
         testCollection(emptyArray);
@@ -196,6 +209,8 @@
 
         // Immutable List
         testEmptyList(List.of());
+        testListMutatorsAlwaysThrow(List.of());
+        testEmptyListMutatorsAlwaysThrow(List.of());
         for (List<Integer> list : Arrays.asList(
                 List.<Integer>of(),
                 List.of(1),
@@ -211,10 +226,13 @@
                 List.of(integerArray))) {
             testCollection(list);
             testImmutableList(list);
+            testListMutatorsAlwaysThrow(list);
         }
 
         // Immutable Set
         testEmptySet(Set.of());
+        testCollMutatorsAlwaysThrow(Set.of());
+        testEmptyCollMutatorsAlwaysThrow(Set.of());
         for (Set<Integer> set : Arrays.asList(
                 Set.<Integer>of(),
                 Set.of(1),
@@ -230,6 +248,7 @@
                 Set.of(integerArray))) {
             testCollection(set);
             testImmutableSet(set);
+            testCollMutatorsAlwaysThrow(set);
         }
 
         // Immutable Map
@@ -241,6 +260,8 @@
         }
 
         testEmptyMap(Map.of());
+        testMapMutatorsAlwaysThrow(Map.of());
+        testEmptyMapMutatorsAlwaysThrow(Map.of());
         for (Map<Integer,Integer> map : Arrays.asList(
                 Map.<Integer,Integer>of(),
                 Map.of(1, 101),
@@ -256,6 +277,7 @@
                 Map.ofEntries(ea))) {
             testMap(map);
             testImmutableMap(map);
+            testMapMutatorsAlwaysThrow(map);
         }
     }
 
@@ -358,6 +380,93 @@
                            it.remove(); });
     }
 
+    /**
+     * Test that calling a mutator always throws UOE, even if the mutator
+     * wouldn't actually do anything, given its arguments.
+     *
+     * @param c the collection instance to test
+     */
+    private static void testCollMutatorsAlwaysThrow(Collection<Integer> c) {
+        THROWS(UnsupportedOperationException.class,
+                () -> c.addAll(Collections.emptyList()),
+                () -> c.remove(ABSENT_VALUE),
+                () -> c.removeAll(Collections.emptyList()),
+                () -> c.removeIf(x -> false),
+                () -> c.retainAll(c));
+    }
+
+    /**
+     * Test that calling a mutator always throws UOE, even if the mutator
+     * wouldn't actually do anything on an empty collection.
+     *
+     * @param c the collection instance to test, must be empty
+     */
+    private static void testEmptyCollMutatorsAlwaysThrow(Collection<Integer> c) {
+        if (! c.isEmpty()) {
+            fail("collection is not empty");
+        }
+        THROWS(UnsupportedOperationException.class,
+                () -> c.clear());
+    }
+
+    /**
+     * As above, for a list.
+     *
+     * @param c the list instance to test
+     */
+    private static void testListMutatorsAlwaysThrow(List<Integer> c) {
+        testCollMutatorsAlwaysThrow(c);
+        THROWS(UnsupportedOperationException.class,
+                () -> c.addAll(0, Collections.emptyList()));
+    }
+
+    /**
+     * As above, for an empty list.
+     *
+     * @param c the list instance to test, must be empty
+     */
+    private static void testEmptyListMutatorsAlwaysThrow(List<Integer> c) {
+        if (! c.isEmpty()) {
+            fail("list is not empty");
+        }
+        testEmptyCollMutatorsAlwaysThrow(c);
+        THROWS(UnsupportedOperationException.class,
+                () -> c.replaceAll(x -> x),
+                () -> c.sort(null));
+    }
+
+    /**
+     * As above, for a map.
+     *
+     * @param m the map instance to test
+     */
+    private static void testMapMutatorsAlwaysThrow(Map<Integer,Integer> m) {
+        THROWS(UnsupportedOperationException.class,
+                () -> m.compute(ABSENT_VALUE, (k, v) -> null),
+                () -> m.computeIfAbsent(ABSENT_VALUE, k -> null),
+                () -> m.computeIfPresent(ABSENT_VALUE, (k, v) -> null),
+                () -> m.merge(ABSENT_VALUE, 0, (k, v) -> null),
+                () -> m.putAll(Collections.emptyMap()),
+                () -> m.remove(ABSENT_VALUE),
+                () -> m.remove(ABSENT_VALUE, 0),
+                () -> m.replace(ABSENT_VALUE, 0),
+                () -> m.replace(ABSENT_VALUE, 0, 1));
+    }
+
+    /**
+     * As above, for an empty map.
+     *
+     * @param map the map instance to test, must be empty
+     */
+    private static void testEmptyMapMutatorsAlwaysThrow(Map<Integer,Integer> m) {
+        if (! m.isEmpty()) {
+            fail("map is not empty");
+        }
+        THROWS(UnsupportedOperationException.class,
+                () -> m.clear(),
+                () -> m.replaceAll((k, v) -> v));
+    }
+
     private static void clear(Collection<Integer> c) {
         try { c.clear(); }
         catch (Throwable t) { unexpected(t); }
--- a/test/java/util/Date/Bug8135055.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/Date/Bug8135055.java	Mon Sep 12 22:04:48 2016 +0000
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8135055
+ * @modules java.sql
  * @summary Test java.sql.TimeStamp instance should come after java.util.Date
  * if Nanos component of TimeStamp is not equal to 0 milliseconds.
 */
--- a/test/java/util/Formatter/FormatLocale.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/Formatter/FormatLocale.java	Mon Sep 12 22:04:48 2016 +0000
@@ -24,6 +24,7 @@
 /**
  * @test
  * @bug 8146156 8159548
+ * @modules jdk.localedata
  * @summary test whether uppercasing follows Locale.Category.FORMAT locale.
  * @run main/othervm FormatLocale
  */
--- a/test/java/util/PriorityQueue/NoNulls.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/PriorityQueue/NoNulls.java	Mon Sep 12 22:04:48 2016 +0000
@@ -38,10 +38,8 @@
  */
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Comparator;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.PriorityQueue;
 import java.util.SortedSet;
 import java.util.TreeSet;
--- a/test/java/util/ResourceBundle/modules/security/TestPermission.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/ResourceBundle/modules/security/TestPermission.java	Mon Sep 12 22:04:48 2016 +0000
@@ -69,6 +69,7 @@
     @Test
     public void runTest() throws Exception {
         int exitValue = executeTestJava("--module-path", MODS_DIR.toString(),
+                                        "--add-modules", "m1",
                                         "-m", "test/jdk.test.Main")
                             .outputTo(System.out)
                             .errorTo(System.out)
--- a/test/java/util/ServiceLoader/modules/ServicesTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/ServiceLoader/modules/ServicesTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -42,7 +42,7 @@
  * @test
  * @library /lib/testlibrary
  * @modules java.scripting
-            jdk.compiler
+ *          jdk.compiler
  * @build ServicesTest CompilerUtils jdk.testlibrary.*
  * @run testng ServicesTest
  * @summary Tests ServiceLoader to locate service providers on the module path
@@ -112,6 +112,7 @@
     public void runWithModulePath() throws Exception {
         int exitValue
             = executeTestJava("--module-path", MODS_DIR.toString(),
+                              "--add-modules", "bananascript",
                               "-m", "test/test.Main",
                               "BananaScriptEngine")
                 .outputTo(System.out)
@@ -131,6 +132,7 @@
         int exitValue
             = executeTestJava("--module-path", MODS_DIR.toString(),
                               "-cp", CLASSES_DIR.toString(),
+                              "--add-modules", "bananascript",
                               "-m", "test/test.Main",
                               "BananaScriptEngine", "PearScriptEngine")
                 .outputTo(System.out)
--- a/test/java/util/TimeZone/HongKong.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/TimeZone/HongKong.java	Mon Sep 12 22:04:48 2016 +0000
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 4487276 8008577
+ * @modules jdk.localedata
  * @summary Verify that Hong Kong locale uses traditional Chinese names.
  * @run main/othervm -Djava.locale.providers=COMPAT,SPI HongKong
  */
--- a/test/java/util/concurrent/BlockingQueue/LoopHelpers.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/BlockingQueue/LoopHelpers.java	Mon Sep 12 22:04:48 2016 +0000
@@ -31,8 +31,6 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-import java.util.concurrent.atomic.AtomicLong;
-
 /**
  * Misc utilities in JSR166 performance tests
  */
--- a/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java	Mon Sep 12 22:04:48 2016 +0000
@@ -43,7 +43,6 @@
 import java.util.SplittableRandom;
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.LinkedBlockingDeque;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.LinkedTransferQueue;
--- a/test/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java	Mon Sep 12 22:04:48 2016 +0000
@@ -31,8 +31,6 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-import java.util.concurrent.atomic.AtomicLong;
-
 /**
  * Misc utilities in JSR166 performance tests
  */
--- a/test/java/util/concurrent/ConcurrentQueues/LoopHelpers.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/ConcurrentQueues/LoopHelpers.java	Mon Sep 12 22:04:48 2016 +0000
@@ -31,8 +31,6 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-import java.util.concurrent.atomic.AtomicLong;
-
 /**
  * Misc utilities in JSR166 performance tests
  */
--- a/test/java/util/concurrent/ConcurrentQueues/OfferRemoveLoops.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/ConcurrentQueues/OfferRemoveLoops.java	Mon Sep 12 22:04:48 2016 +0000
@@ -43,7 +43,6 @@
 import java.util.concurrent.LinkedTransferQueue;
 import java.util.concurrent.PriorityBlockingQueue;
 import java.util.concurrent.Semaphore;
-import java.util.concurrent.ThreadLocalRandom;
 
 @SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
 public class OfferRemoveLoops {
--- a/test/java/util/concurrent/DelayQueue/Stress.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/DelayQueue/Stress.java	Mon Sep 12 22:04:48 2016 +0000
@@ -22,7 +22,6 @@
  */
 
 import static java.util.concurrent.TimeUnit.NANOSECONDS;
-import static java.util.concurrent.TimeUnit.SECONDS;
 
 import java.util.concurrent.DelayQueue;
 import java.util.concurrent.Delayed;
--- a/test/java/util/concurrent/Exchanger/LoopHelpers.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/Exchanger/LoopHelpers.java	Mon Sep 12 22:04:48 2016 +0000
@@ -31,8 +31,6 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-import java.util.concurrent.atomic.AtomicLong;
-
 /**
  * Misc utilities in JSR166 performance tests
  */
--- a/test/java/util/concurrent/ExecutorCompletionService/LoopHelpers.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/ExecutorCompletionService/LoopHelpers.java	Mon Sep 12 22:04:48 2016 +0000
@@ -31,8 +31,6 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-import java.util.concurrent.atomic.AtomicLong;
-
 /**
  * Misc utilities in JSR166 performance tests
  */
--- a/test/java/util/concurrent/FutureTask/LoopHelpers.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/FutureTask/LoopHelpers.java	Mon Sep 12 22:04:48 2016 +0000
@@ -31,8 +31,6 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-import java.util.concurrent.atomic.AtomicLong;
-
 /**
  * Misc utilities in JSR166 performance tests
  */
--- a/test/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCorePoolSize.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCorePoolSize.java	Mon Sep 12 22:04:48 2016 +0000
@@ -33,7 +33,6 @@
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
 import jdk.testlibrary.Utils;
 
 /**
--- a/test/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCoreThreads.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCoreThreads.java	Mon Sep 12 22:04:48 2016 +0000
@@ -40,7 +40,6 @@
 
 import static java.util.concurrent.TimeUnit.HOURS;
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static java.util.concurrent.TimeUnit.SECONDS;
 
 import java.lang.reflect.Field;
 import java.util.concurrent.BlockingQueue;
--- a/test/java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java	Mon Sep 12 22:04:48 2016 +0000
@@ -28,13 +28,13 @@
  * @library /lib/testlibrary/
  * @build jdk.testlibrary.RandomFactory
  * @run main/othervm ConfigChanges
- * @key randomness intermittent
+ * @key randomness
  * @author Martin Buchholz
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.MINUTES;
-import static java.util.concurrent.TimeUnit.SECONDS;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
 
 import java.security.Permission;
 import java.util.Random;
@@ -44,7 +44,6 @@
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.atomic.AtomicInteger;
 import jdk.testlibrary.RandomFactory;
 
 public class ConfigChanges {
@@ -95,10 +94,10 @@
             check(tpe.getQueue().isEmpty());
             check(tpe.isTerminated());
             check(! tpe.isTerminating());
-            equal(tpe.getActiveCount(), 0);
-            equal(tpe.getPoolSize(), 0);
+            equal(0, tpe.getActiveCount());
+            equal(0, tpe.getPoolSize());
             equal(tpe.getTaskCount(), tpe.getCompletedTaskCount());
-            check(tpe.awaitTermination(0L, SECONDS));
+            check(tpe.awaitTermination(0L, MINUTES));
         } catch (Throwable t) { unexpected(t); }
     }
 
@@ -110,6 +109,21 @@
 
     static volatile Runnable runnableDuJour;
 
+    static void awaitIdleness(ThreadPoolExecutor tpe, long taskCount) {
+        restart: for (;;) {
+            // check twice to make chance of race vanishingly small
+            for (int i = 0; i < 2; i++) {
+                if (tpe.getQueue().size() != 0 ||
+                    tpe.getActiveCount() != 0 ||
+                    tpe.getCompletedTaskCount() != taskCount) {
+                    Thread.yield();
+                    continue restart;
+                }
+            }
+            return;
+        }
+    }
+
     private static void realMain(String[] args) throws Throwable {
         if (rnd.nextBoolean())
             System.setSecurityManager(new PermissiveSecurityManger());
@@ -137,8 +151,9 @@
 
         if (prestart) {
             tpe.prestartAllCoreThreads();
-            equal(tg.activeCount(), n);
-            equal(tg.activeCount(), tpe.getCorePoolSize());
+            equal(n, tg.activeCount());
+            equal(n, tpe.getCorePoolSize());
+            equal(n, tpe.getLargestPoolSize());
         }
 
         final Runnable runRunnableDuJour =
@@ -153,7 +168,7 @@
                 tpe.execute(runRunnableDuJour);
             // Wait for prestarted threads to dequeue their initial tasks.
             while (! tpe.getQueue().isEmpty())
-                Thread.sleep(10);
+                Thread.sleep(1);
             for (int i = 0; i < 5*n; i++)
                 tpe.execute(runRunnableDuJour);
         } else {
@@ -163,73 +178,76 @@
 
         //report("submitted", tpe);
         pumpedUp.await();
-        equal(tg.activeCount(), 3*n);
-        equal(tg.activeCount(), tpe.getMaximumPoolSize());
-        equal(tpe.getCorePoolSize(), n);
+        equal(3*n, tg.activeCount());
+        equal(3*n, tpe.getMaximumPoolSize());
+        equal(3*n, tpe.getLargestPoolSize());
+        equal(n, tpe.getCorePoolSize());
+        equal(3*n, tpe.getActiveCount());
+        equal(6L*n, tpe.getTaskCount());
+        equal(0L, tpe.getCompletedTaskCount());
+
         //report("pumped up", tpe);
-        equal(tpe.getMaximumPoolSize(), 3*n);
         tpe.setMaximumPoolSize(4*n);
-        equal(tpe.getMaximumPoolSize(), 4*n);
+        equal(4*n, tpe.getMaximumPoolSize());
         //report("pumped up2", tpe);
         final CyclicBarrier pumpedUp2 = new CyclicBarrier(n + 1);
         runnableDuJour = waiter(pumpedUp2);
         for (int i = 0; i < 1*n; i++)
             tpe.execute(runRunnableDuJour);
         pumpedUp2.await();
-        equal(tg.activeCount(), 4*n);
-        equal(tg.activeCount(), tpe.getMaximumPoolSize());
-        equal(tpe.getCompletedTaskCount(), 0L);
+        equal(4*n, tg.activeCount());
+        equal(4*n, tpe.getMaximumPoolSize());
+        equal(4*n, tpe.getLargestPoolSize());
+        equal(4*n, tpe.getActiveCount());
+        equal(7L*n, tpe.getTaskCount());
+        equal(0L, tpe.getCompletedTaskCount());
         //report("pumped up2", tpe);
         runnableDuJour = new Runnable() { public void run() {}};
 
         tpe.setMaximumPoolSize(2*n);
-        //report("after set", tpe);
+        //report("after setMaximumPoolSize", tpe);
 
         pumpedUp2.await();
         pumpedUp.await();
 
-//      while (tg.activeCount() != n &&
-//             tg.activeCount() != n)
-//          Thread.sleep(10);
-//      equal(tg.activeCount(), n);
-//      equal(tg.activeCount(), tpe.getCorePoolSize());
-
         while (tg.activeCount() != 2*n &&
                tg.activeCount() != 2*n)
-            Thread.sleep(10);
-        equal(tg.activeCount(), 2*n);
-        equal(tg.activeCount(), tpe.getMaximumPoolSize());
+            Thread.yield();
+        equal(2*n, tg.activeCount());
+        equal(2*n, tpe.getMaximumPoolSize());
+        equal(4*n, tpe.getLargestPoolSize());
 
+        //report("draining", tpe);
+        awaitIdleness(tpe, 7L*n);
 
-//report("draining", tpe);
-        while (tpe.getCompletedTaskCount() < 7*n &&
-               tpe.getCompletedTaskCount() < 7*n)
-            Thread.sleep(10);
+        equal(2*n, tg.activeCount());
+        equal(2*n, tpe.getMaximumPoolSize());
+        equal(4*n, tpe.getLargestPoolSize());
 
-        //equal(tg.activeCount(), n);
-        //equal(tg.activeCount(), tpe.getCorePoolSize());
-        equal(tg.activeCount(), 2*n);
-        equal(tg.activeCount(), tpe.getMaximumPoolSize());
+        equal(7L*n, tpe.getTaskCount());
+        equal(7L*n, tpe.getCompletedTaskCount());
+        equal(0, tpe.getActiveCount());
 
-        equal(tpe.getTaskCount(), 7L*n);
-        equal(tpe.getCompletedTaskCount(), 7L*n);
-
-        equal(tpe.getKeepAliveTime(MINUTES), 3L);
+        equal(3L, tpe.getKeepAliveTime(MINUTES));
+        long t0 = System.nanoTime();
         tpe.setKeepAliveTime(7L, MILLISECONDS);
-        equal(tpe.getKeepAliveTime(MILLISECONDS), 7L);
+        equal(7L, tpe.getKeepAliveTime(MILLISECONDS));
         while (tg.activeCount() > n &&
                tg.activeCount() > n)
-            Thread.sleep(10);
-        equal(tg.activeCount(), n);
+            Thread.sleep(4);
+        equal(n, tg.activeCount());
+        check(System.nanoTime() - t0 >= tpe.getKeepAliveTime(NANOSECONDS));
 
         //report("idle", tpe);
         check(! tpe.allowsCoreThreadTimeOut());
+        t0 = System.nanoTime();
         tpe.allowCoreThreadTimeOut(true);
         check(tpe.allowsCoreThreadTimeOut());
         while (tg.activeCount() > 0 &&
                tg.activeCount() > 0)
-            Thread.sleep(10);
+            Thread.sleep(4);
         equal(tg.activeCount(), 0);
+        check(System.nanoTime() - t0 >= tpe.getKeepAliveTime(NANOSECONDS));
 
         //report("idle", tpe);
 
--- a/test/java/util/concurrent/ThreadPoolExecutor/ThreadRestarts.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/ThreadPoolExecutor/ThreadRestarts.java	Mon Sep 12 22:04:48 2016 +0000
@@ -40,7 +40,6 @@
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static java.util.concurrent.TimeUnit.SECONDS;
 
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.ThreadFactory;
--- a/test/java/util/concurrent/ThreadPoolExecutor/TimeOutShrink.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/ThreadPoolExecutor/TimeOutShrink.java	Mon Sep 12 22:04:48 2016 +0000
@@ -34,7 +34,6 @@
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
 import jdk.testlibrary.Utils;
 
 public class TimeOutShrink {
--- a/test/java/util/concurrent/atomic/AtomicReferenceTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/atomic/AtomicReferenceTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -22,7 +22,6 @@
  */
 
 import java.util.concurrent.atomic.AtomicReference;
-import java.util.function.UnaryOperator;
 import org.testng.annotations.Test;
 import static org.testng.Assert.*;
 
--- a/test/java/util/concurrent/forkjoin/SubmissionTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/forkjoin/SubmissionTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -22,27 +22,35 @@
  */
 
 import java.util.concurrent.ForkJoinPool;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
+import jdk.testlibrary.Utils;
 
 /*
  * @test
  * @bug 8078490
  * @summary Test submission and execution of task without joining
+ * @library /lib/testlibrary/
  */
 public class SubmissionTest {
+    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
+
+    static long millisElapsedSince(long startTime) {
+        return (System.nanoTime() - startTime) / (1000L * 1000L);
+    }
+
     public static void main(String[] args) throws Throwable {
         final ForkJoinPool e = new ForkJoinPool(1);
         final AtomicBoolean b = new AtomicBoolean();
         final Runnable setFalse = () -> b.set(false);
-        for (int i = 0; i < 100000; i++) {
+        for (int i = 0; i < 30_000; i++) {
             b.set(true);
             e.execute(setFalse);
-            long st = System.nanoTime();
+            long startTime = System.nanoTime();
             while (b.get()) {
-                if (System.nanoTime() - st >= TimeUnit.SECONDS.toNanos(10)) {
+                if (millisElapsedSince(startTime) >= LONG_DELAY_MS) {
                     throw new RuntimeException("Submitted task failed to execute");
                 }
+                Thread.yield();
             }
         }
     }
--- a/test/java/util/concurrent/locks/Lock/LoopHelpers.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/locks/Lock/LoopHelpers.java	Mon Sep 12 22:04:48 2016 +0000
@@ -31,8 +31,6 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-import java.util.concurrent.atomic.AtomicLong;
-
 /**
  * Misc utilities in JSR166 performance tests
  */
--- a/test/java/util/concurrent/locks/Lock/Mutex.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/locks/Lock/Mutex.java	Mon Sep 12 22:04:48 2016 +0000
@@ -35,7 +35,6 @@
 import java.util.concurrent.locks.AbstractQueuedSynchronizer;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 
--- a/test/java/util/concurrent/locks/LockSupport/ParkLoops.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/locks/LockSupport/ParkLoops.java	Mon Sep 12 22:04:48 2016 +0000
@@ -43,7 +43,6 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReferenceArray;
 import java.util.concurrent.locks.LockSupport;
 
--- a/test/java/util/concurrent/locks/ReentrantLock/LoopHelpers.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/locks/ReentrantLock/LoopHelpers.java	Mon Sep 12 22:04:48 2016 +0000
@@ -31,8 +31,6 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-import java.util.concurrent.atomic.AtomicLong;
-
 /**
  * Misc utilities in JSR166 performance tests
  */
--- a/test/java/util/concurrent/locks/ReentrantReadWriteLock/LoopHelpers.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/locks/ReentrantReadWriteLock/LoopHelpers.java	Mon Sep 12 22:04:48 2016 +0000
@@ -31,8 +31,6 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-import java.util.concurrent.atomic.AtomicLong;
-
 /**
  * Misc utilities in JSR166 performance tests
  */
--- a/test/java/util/concurrent/locks/StampedLock/ReadersUnlockAfterWriteUnlock.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/locks/StampedLock/ReadersUnlockAfterWriteUnlock.java	Mon Sep 12 22:04:48 2016 +0000
@@ -22,7 +22,6 @@
 
 /*
  * @test
- * @run main/othervm/timeout=60 ReadersUnlockAfterWriteUnlock
  * @bug 8023234
  * @summary StampedLock serializes readers on writer unlock
  * @author Dmitry Chyuko
@@ -30,26 +29,23 @@
  */
 
 import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.locks.StampedLock;
 
 public class ReadersUnlockAfterWriteUnlock {
-    static final int RNUM = 2;
-    static final StampedLock sl = new StampedLock();
-    static volatile boolean isDone;
+    public static void main(String[] args) throws InterruptedException {
+        final int RNUM = 2;
+        final int REPS = 128;
+        final StampedLock sl = new StampedLock();
+        final AtomicReference<Throwable> bad = new AtomicReference<>();
 
-    static CyclicBarrier iterationStart = new CyclicBarrier(RNUM + 1);
-    static CyclicBarrier readersHaveLocks = new CyclicBarrier(RNUM);
-    static CyclicBarrier writerHasLock = new CyclicBarrier(RNUM + 1);
+        final CyclicBarrier iterationStart = new CyclicBarrier(RNUM + 1);
+        final CyclicBarrier readersHaveLocks = new CyclicBarrier(RNUM);
+        final CyclicBarrier writerHasLock = new CyclicBarrier(RNUM + 1);
 
-    static class Reader extends Thread {
-        final String name;
-        Reader(String name) {
-            super();
-            this.name = name;
-        }
-        public void run() {
-            while (!isDone && !isInterrupted()) {
-                try {
+        Runnable reader = () -> {
+            try {
+                for (int i = 0; i < REPS; i++) {
                     iterationStart.await();
                     writerHasLock.await();
                     long rs = sl.readLock();
@@ -59,30 +55,45 @@
                     readersHaveLocks.await();
 
                     sl.unlockRead(rs);
-                } catch (Exception e) {
-                    throw new IllegalStateException(e);
                 }
+            } catch (Throwable ex) {
+                ex.printStackTrace();
+                bad.set(ex);
             }
+        };
+
+        Thread[] threads = new Thread[RNUM];
+        for (int i = 0 ; i < RNUM; i++) {
+            Thread thread = new Thread(reader, "Reader");
+            threads[i] = thread;
+            thread.start();
         }
-    }
-
-    public static void main(String[] args) throws InterruptedException {
-        for (int r = 0 ; r < RNUM; ++r) {
-            new Reader("r" + r).start();
-        }
-        int i;
-        for (i = 0; i < 1024; ++i) {
+        for (int i = 0; i < REPS; i++) {
             try {
                 iterationStart.await();
                 long ws = sl.writeLock();
                 writerHasLock.await();
-                Thread.sleep(10);
+                awaitWaitState(threads);
                 sl.unlockWrite(ws);
             } catch (Exception e) {
                 throw new IllegalStateException(e);
             }
         }
-        isDone = true;
+        for (Thread thread : threads)
+            thread.join();
+        if (bad.get() != null)
+            throw new AssertionError(bad.get());
     }
 
+    static void awaitWaitState(Thread[] threads) {
+        restart: for (;;) {
+            for (Thread thread : threads) {
+                if (thread.getState() != Thread.State.WAITING) {
+                    Thread.yield();
+                    continue restart;
+                }
+            }
+            break;
+        }
+    }
 }
--- a/test/java/util/concurrent/tck/AtomicIntegerArray9Test.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/AtomicIntegerArray9Test.java	Mon Sep 12 22:04:48 2016 +0000
@@ -31,7 +31,6 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-import java.util.Arrays;
 import java.util.concurrent.atomic.AtomicIntegerArray;
 
 import junit.framework.Test;
--- a/test/java/util/concurrent/tck/AtomicLongArray9Test.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/AtomicLongArray9Test.java	Mon Sep 12 22:04:48 2016 +0000
@@ -31,7 +31,6 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-import java.util.Arrays;
 import java.util.concurrent.atomic.AtomicLongArray;
 
 import junit.framework.Test;
--- a/test/java/util/concurrent/tck/AtomicReferenceArray9Test.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/AtomicReferenceArray9Test.java	Mon Sep 12 22:04:48 2016 +0000
@@ -31,7 +31,6 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-import java.util.Arrays;
 import java.util.concurrent.atomic.AtomicReferenceArray;
 
 import junit.framework.Test;
--- a/test/java/util/concurrent/tck/CompletableFutureTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/CompletableFutureTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -59,7 +59,6 @@
 import java.util.concurrent.ForkJoinTask;
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.TimeoutException;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.BiConsumer;
--- a/test/java/util/concurrent/tck/ConcurrentHashMap8Test.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/ConcurrentHashMap8Test.java	Mon Sep 12 22:04:48 2016 +0000
@@ -38,7 +38,6 @@
 import java.util.AbstractMap;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.NoSuchElementException;
--- a/test/java/util/concurrent/tck/CopyOnWriteArrayListTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/CopyOnWriteArrayListTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -36,7 +36,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
--- a/test/java/util/concurrent/tck/CopyOnWriteArraySetTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/CopyOnWriteArraySetTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -36,7 +36,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 import java.util.Set;
--- a/test/java/util/concurrent/tck/CountedCompleterTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/CountedCompleterTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -40,9 +40,12 @@
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ForkJoinPool;
 import java.util.concurrent.ForkJoinTask;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.BiConsumer;
+import java.util.function.Consumer;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -1869,4 +1872,115 @@
         testInvokeOnPool(singletonPool(), a);
     }
 
+    /** CountedCompleter class javadoc code sample, version 1. */
+    public static <E> void forEach1(E[] array, Consumer<E> action) {
+        class Task extends CountedCompleter<Void> {
+            final int lo, hi;
+            Task(Task parent, int lo, int hi) {
+                super(parent); this.lo = lo; this.hi = hi;
+            }
+
+            public void compute() {
+                if (hi - lo >= 2) {
+                    int mid = (lo + hi) >>> 1;
+                    // must set pending count before fork
+                    setPendingCount(2);
+                    new Task(this, mid, hi).fork(); // right child
+                    new Task(this, lo, mid).fork(); // left child
+                }
+                else if (hi > lo)
+                    action.accept(array[lo]);
+                tryComplete();
+            }
+        }
+        new Task(null, 0, array.length).invoke();
+    }
+
+    /** CountedCompleter class javadoc code sample, version 2. */
+    public static <E> void forEach2(E[] array, Consumer<E> action) {
+        class Task extends CountedCompleter<Void> {
+            final int lo, hi;
+            Task(Task parent, int lo, int hi) {
+                super(parent); this.lo = lo; this.hi = hi;
+            }
+
+            public void compute() {
+                if (hi - lo >= 2) {
+                    int mid = (lo + hi) >>> 1;
+                    setPendingCount(1); // looks off by one, but correct!
+                    new Task(this, mid, hi).fork(); // right child
+                    new Task(this, lo, mid).compute(); // direct invoke
+                } else {
+                    if (hi > lo)
+                        action.accept(array[lo]);
+                    tryComplete();
+                }
+            }
+        }
+        new Task(null, 0, array.length).invoke();
+    }
+
+    /** CountedCompleter class javadoc code sample, version 3. */
+    public static <E> void forEach3(E[] array, Consumer<E> action) {
+        class Task extends CountedCompleter<Void> {
+            final int lo, hi;
+            Task(Task parent, int lo, int hi) {
+                super(parent); this.lo = lo; this.hi = hi;
+            }
+
+            public void compute() {
+                int n = hi - lo;
+                for (; n >= 2; n /= 2) {
+                    addToPendingCount(1);
+                    new Task(this, lo + n/2, lo + n).fork();
+                }
+                if (n > 0)
+                    action.accept(array[lo]);
+                propagateCompletion();
+            }
+        }
+        new Task(null, 0, array.length).invoke();
+    }
+
+    /** CountedCompleter class javadoc code sample, version 4. */
+    public static <E> void forEach4(E[] array, Consumer<E> action) {
+        class Task extends CountedCompleter<Void> {
+            final int lo, hi;
+            Task(Task parent, int lo, int hi) {
+                super(parent, 31 - Integer.numberOfLeadingZeros(hi - lo));
+                this.lo = lo; this.hi = hi;
+            }
+
+            public void compute() {
+                for (int n = hi - lo; n >= 2; n /= 2)
+                    new Task(this, lo + n/2, lo + n).fork();
+                action.accept(array[lo]);
+                propagateCompletion();
+            }
+        }
+        if (array.length > 0)
+            new Task(null, 0, array.length).invoke();
+    }
+
+    void testRecursiveDecomposition(
+        BiConsumer<Integer[], Consumer<Integer>> action) {
+        int n = ThreadLocalRandom.current().nextInt(8);
+        Integer[] a = new Integer[n];
+        for (int i = 0; i < n; i++) a[i] = i + 1;
+        AtomicInteger ai = new AtomicInteger(0);
+        action.accept(a, (x) -> ai.addAndGet(x));
+        assertEquals(n * (n + 1) / 2, ai.get());
+    }
+
+    /**
+     * Variants of divide-by-two recursive decomposition into leaf tasks,
+     * as described in the CountedCompleter class javadoc code samples
+     */
+    public void testRecursiveDecomposition() {
+        testRecursiveDecomposition(CountedCompleterTest::forEach1);
+        testRecursiveDecomposition(CountedCompleterTest::forEach2);
+        testRecursiveDecomposition(CountedCompleterTest::forEach3);
+        testRecursiveDecomposition(CountedCompleterTest::forEach4);
+    }
+
 }
--- a/test/java/util/concurrent/tck/ExecutorCompletionService9Test.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/ExecutorCompletionService9Test.java	Mon Sep 12 22:04:48 2016 +0000
@@ -42,7 +42,6 @@
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executor;
 import java.util.concurrent.ExecutorCompletionService;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 
 import junit.framework.Test;
--- a/test/java/util/concurrent/tck/ExecutorCompletionServiceTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/ExecutorCompletionServiceTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -40,7 +40,6 @@
 import java.util.concurrent.CompletionService;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executor;
 import java.util.concurrent.ExecutorCompletionService;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
--- a/test/java/util/concurrent/tck/ForkJoinPool8Test.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/ForkJoinPool8Test.java	Mon Sep 12 22:04:48 2016 +0000
@@ -296,12 +296,11 @@
         RecursiveAction a = new CheckedRecursiveAction() {
             protected void realCompute() {
                 FibAction f = new FibAction(8);
-                final Thread myself = Thread.currentThread();
+                final Thread currentThread = Thread.currentThread();
 
                 // test join()
                 assertSame(f, f.fork());
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 assertNull(f.join());
                 Thread.interrupted();
                 assertEquals(21, f.result);
@@ -310,8 +309,7 @@
                 f = new FibAction(8);
                 f.cancel(true);
                 assertSame(f, f.fork());
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 try {
                     f.join();
                     shouldThrow();
@@ -323,8 +321,7 @@
                 f = new FibAction(8);
                 f.completeExceptionally(new FJException());
                 assertSame(f, f.fork());
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 try {
                     f.join();
                     shouldThrow();
@@ -336,8 +333,7 @@
                 // test quietlyJoin()
                 f = new FibAction(8);
                 assertSame(f, f.fork());
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 f.quietlyJoin();
                 Thread.interrupted();
                 assertEquals(21, f.result);
@@ -346,8 +342,7 @@
                 f = new FibAction(8);
                 f.cancel(true);
                 assertSame(f, f.fork());
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 f.quietlyJoin();
                 Thread.interrupted();
                 checkCancelled(f);
@@ -355,8 +350,7 @@
                 f = new FibAction(8);
                 f.completeExceptionally(new FJException());
                 assertSame(f, f.fork());
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 f.quietlyJoin();
                 Thread.interrupted();
                 checkCompletedAbnormally(f, f.getException());
--- a/test/java/util/concurrent/tck/ForkJoinTask8Test.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/ForkJoinTask8Test.java	Mon Sep 12 22:04:48 2016 +0000
@@ -35,7 +35,6 @@
 import static java.util.concurrent.TimeUnit.SECONDS;
 
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ForkJoinPool;
--- a/test/java/util/concurrent/tck/ForkJoinTaskTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/ForkJoinTaskTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -35,9 +35,7 @@
 import static java.util.concurrent.TimeUnit.SECONDS;
 
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashSet;
-import java.util.List;
 import java.util.concurrent.CancellationException;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ForkJoinPool;
--- a/test/java/util/concurrent/tck/JSR166TestCase.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/JSR166TestCase.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1264,7 +1264,7 @@
      * Sleeps until the given time has elapsed.
      * Throws AssertionFailedError if interrupted.
      */
-    void sleep(long millis) {
+    static void sleep(long millis) {
         try {
             delay(millis);
         } catch (InterruptedException fail) {
--- a/test/java/util/concurrent/tck/RecursiveActionTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/RecursiveActionTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -285,12 +285,11 @@
         RecursiveAction a = new CheckedRecursiveAction() {
             protected void realCompute() {
                 FibAction f = new FibAction(8);
-                final Thread myself = Thread.currentThread();
+                final Thread currentThread = Thread.currentThread();
 
                 // test join()
                 assertSame(f, f.fork());
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 assertNull(f.join());
                 Thread.interrupted();
                 assertEquals(21, f.result);
@@ -299,8 +298,7 @@
                 f = new FibAction(8);
                 f.cancel(true);
                 assertSame(f, f.fork());
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 try {
                     f.join();
                     shouldThrow();
@@ -312,8 +310,7 @@
                 f = new FibAction(8);
                 f.completeExceptionally(new FJException());
                 assertSame(f, f.fork());
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 try {
                     f.join();
                     shouldThrow();
@@ -325,8 +322,7 @@
                 // test quietlyJoin()
                 f = new FibAction(8);
                 assertSame(f, f.fork());
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 f.quietlyJoin();
                 Thread.interrupted();
                 assertEquals(21, f.result);
@@ -335,8 +331,7 @@
                 f = new FibAction(8);
                 f.cancel(true);
                 assertSame(f, f.fork());
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 f.quietlyJoin();
                 Thread.interrupted();
                 checkCancelled(f);
@@ -344,8 +339,7 @@
                 f = new FibAction(8);
                 f.completeExceptionally(new FJException());
                 assertSame(f, f.fork());
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 f.quietlyJoin();
                 Thread.interrupted();
                 checkCompletedAbnormally(f, f.getException());
@@ -385,22 +379,20 @@
             public void realRun() throws InterruptedException {
                 FibAction[] fibActions = sq.take();
                 FibAction f;
-                final Thread myself = Thread.currentThread();
+                final Thread currentThread = Thread.currentThread();
 
                 // test join() ------------
 
                 f = fibActions[0];
                 assertFalse(ForkJoinTask.inForkJoinPool());
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 assertNull(f.join());
                 assertTrue(Thread.interrupted());
                 assertEquals(21, f.result);
                 checkCompletedNormally(f);
 
                 f = fibActions[1];
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 try {
                     f.join();
                     shouldThrow();
@@ -410,8 +402,7 @@
                 }
 
                 f = fibActions[2];
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 try {
                     f.join();
                     shouldThrow();
@@ -423,23 +414,20 @@
                 // test quietlyJoin() ---------
 
                 f = fibActions[3];
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 f.quietlyJoin();
                 assertTrue(Thread.interrupted());
                 assertEquals(21, f.result);
                 checkCompletedNormally(f);
 
                 f = fibActions[4];
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 f.quietlyJoin();
                 assertTrue(Thread.interrupted());
                 checkCancelled(f);
 
                 f = fibActions[5];
-                myself.interrupt();
-                assertTrue(myself.isInterrupted());
+                currentThread.interrupt();
                 f.quietlyJoin();
                 assertTrue(Thread.interrupted());
                 assertTrue(f.getException() instanceof FJException);
--- a/test/java/util/concurrent/tck/ScheduledExecutorSubclassTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/ScheduledExecutorSubclassTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -44,7 +44,6 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Delayed;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.concurrent.RejectedExecutionException;
--- a/test/java/util/concurrent/tck/ScheduledExecutorTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/ScheduledExecutorTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -45,7 +45,6 @@
 import java.util.concurrent.CancellationException;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.concurrent.RejectedExecutionException;
--- a/test/java/util/concurrent/tck/StampedLockTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/StampedLockTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -44,7 +44,6 @@
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.StampedLock;
 import java.util.function.BiConsumer;
-import java.util.function.Consumer;
 import java.util.function.Function;
 
 import junit.framework.Test;
--- a/test/java/util/concurrent/tck/SubmissionPublisherTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/SubmissionPublisherTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -37,24 +37,14 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.Flow;
 import java.util.concurrent.ForkJoinPool;
-import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.SubmissionPublisher;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.function.BiConsumer;
-import java.util.function.BiFunction;
-import java.util.function.BiPredicate;
-import java.util.stream.Stream;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import static java.util.concurrent.Flow.Publisher;
 import static java.util.concurrent.Flow.Subscriber;
 import static java.util.concurrent.Flow.Subscription;
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static java.util.concurrent.TimeUnit.SECONDS;
 
 public class SubmissionPublisherTest extends JSR166TestCase {
 
--- a/test/java/util/concurrent/tck/ThreadPoolExecutorSubclassTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/ThreadPoolExecutorSubclassTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -44,7 +44,6 @@
 import java.util.concurrent.CancellationException;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.concurrent.FutureTask;
--- a/test/java/util/concurrent/tck/ThreadPoolExecutorTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/concurrent/tck/ThreadPoolExecutorTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -55,7 +55,6 @@
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import junit.framework.Test;
--- a/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java	Mon Sep 12 22:04:48 2016 +0000
@@ -23,23 +23,29 @@
 
 /*
  * @test
- * @bug 8132734 8144062
+ * @bug 8132734 8144062 8165723
  * @summary Test the extended API and the aliasing additions in JarFile that
  *          support multi-release jar files
- * @library /lib/testlibrary/java/util/jar
+ * @library /lib/testlibrary/java/util/jar /lib/testlibrary/
  * @build Compiler JarBuilder CreateMultiReleaseTestJars
+ * @build jdk.testlibrary.RandomFactory
  * @run testng MultiReleaseJarAPI
  */
 
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.util.Arrays;
+import java.util.Map;
+import java.util.Random;
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
+import jdk.testlibrary.RandomFactory;
+
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
@@ -48,12 +54,15 @@
 
 public class MultiReleaseJarAPI {
 
+    private static final Random RANDOM = RandomFactory.getRandom();
+
     String userdir = System.getProperty("user.dir",".");
     CreateMultiReleaseTestJars creator =  new CreateMultiReleaseTestJars();
     File unversioned = new File(userdir, "unversioned.jar");
     File multirelease = new File(userdir, "multi-release.jar");
     File signedmultirelease = new File(userdir, "signed-multi-release.jar");
 
+
     @BeforeClass
     public void initialize() throws Exception {
         creator.compileEntries();
@@ -99,10 +108,35 @@
         testCustomMultiReleaseValue("true\r ", false);
         testCustomMultiReleaseValue("true\n true", false);
         testCustomMultiReleaseValue("true\r\n true", false);
+
+        // generate "random" Strings to use as extra attributes, and
+        // verify that Multi-Release: true is always properly matched
+        for (int i = 0; i < 100; i++) {
+            byte[] keyBytes = new byte[RANDOM.nextInt(70) + 1];
+            Arrays.fill(keyBytes, (byte)('a' + RANDOM.nextInt(24)));
+            byte[] valueBytes = new byte[RANDOM.nextInt(70) + 1];
+            Arrays.fill(valueBytes, (byte)('a' + RANDOM.nextInt(24)));
+
+            String key = new String(keyBytes, StandardCharsets.UTF_8);
+            String value = new String(valueBytes, StandardCharsets.UTF_8);
+            // test that Multi-Release: true anywhere in the manifest always
+            // return true
+            testCustomMultiReleaseValue("true", Map.of(key, value), true);
+
+            // test that we don't get any false positives
+            testCustomMultiReleaseValue("false", Map.of(key, value), false);
+        }
     }
 
-    private void testCustomMultiReleaseValue(String value, boolean expected) throws Exception {
-        creator.buildCustomMultiReleaseJar("custom-mr.jar", value);
+    private void testCustomMultiReleaseValue(String value, boolean expected)
+            throws Exception {
+        testCustomMultiReleaseValue(value, Map.of(), expected);
+    }
+
+    private void testCustomMultiReleaseValue(String value,
+            Map<String, String> extraAttributes, boolean expected)
+            throws Exception {
+        creator.buildCustomMultiReleaseJar("custom-mr.jar", value, extraAttributes);
         File custom = new File(userdir, "custom-mr.jar");
         try (JarFile jf = new JarFile(custom, true, ZipFile.OPEN_READ, Runtime.version())) {
             Assert.assertEquals(jf.isMultiRelease(), expected);
--- a/test/java/util/logging/modules/GetResourceBundleTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/java/util/logging/modules/GetResourceBundleTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -37,6 +37,7 @@
  * @bug 8129126 8136802 8137316 8137317 8136804 8139350
  * @library /lib/testlibrary
  * @modules jdk.compiler
+ *          java.logging
  * @build GetResourceBundleTest CompilerUtils jdk.testlibrary.ProcessTools
  * @run testng GetResourceBundleTest
  * @summary Tests Logger.getLogger + logger.getResourceBundle in an named/unnamed module,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/management/remote/mandatory/connection/ObjectInputStreamWithLoaderNullCheckTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -0,0 +1,84 @@
+/*
+ * 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 8009560
+ * @summary Test RMIConnector.ObjectInputStreamWithLoader constructor with
+ *          null Class loader. The test expects a IllegalArgumentException
+ *          thrown when constructor is invoked with null class loader as
+ *          an argument.
+ * @author Amit Sapre
+ * @modules java.management
+ * @run clean ObjectInputStreamWithLoaderNullCheckTest
+ * @run build ObjectInputStreamWithLoaderNullCheckTest
+ * @run main ObjectInputStreamWithLoaderNullCheckTest
+ */
+
+import java.lang.reflect.*;
+import javax.management.remote.*;
+import javax.management.remote.rmi.*;
+import java.io.*;
+
+public class ObjectInputStreamWithLoaderNullCheckTest {
+
+    private static Class<?> innerClass;
+
+    public static void main(String[] args) throws Exception {
+
+       System.out.println(">> == ObjectInputStreamWithLoaderNullCheckTest started...");
+
+       try {
+           innerClass = Class.forName("javax.management.remote.rmi.RMIConnector$ObjectInputStreamWithLoader");
+           Constructor<?> ctor = innerClass.getDeclaredConstructor(InputStream.class,ClassLoader.class);
+           ctor.setAccessible(true);
+
+           ByteArrayOutputStream baos = new ByteArrayOutputStream();
+           ObjectOutput objOut =  new ObjectOutputStream(baos);
+           objOut.writeObject(new String("Serialize"));
+           objOut.close();
+           baos.close();
+           ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+
+           System.out.println(">> == Testing constructor with null class loader.");
+           Object obj = ctor.newInstance(bais,null);
+
+           System.out.println(">> == Test case failed. No error occured");
+           System.exit(1);
+       } catch (InvocationTargetException ex) {
+           Throwable cause = ex.getCause();
+           System.out.println(">> == InvocationTargetException Cause message : " + cause.toString());
+           if (cause instanceof IllegalArgumentException) {
+              System.out.println(">> == Test case Passed.");
+           } else {
+              System.out.println(">> == Test case Failed.");
+              ex.printStackTrace();
+              System.exit(1);
+           }
+       } catch (Exception ex) {
+           System.out.println(">>> == Test case failed with error " + ex.getCause().getMessage());
+           ex.printStackTrace();
+           System.exit(1);
+       }
+    }
+}
--- a/test/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java	Mon Sep 12 22:04:48 2016 +0000
@@ -88,12 +88,35 @@
     }
 
     public void buildMultiReleaseJar() throws IOException {
-        buildCustomMultiReleaseJar("multi-release.jar", "true");
+        JarBuilder jb = customMultiReleaseJar("multi-release.jar", "true");
+        addEntries(jb);
+        jb.addEntry("META-INF/versions/9/version/Version.class", version9Classes.get("version.Version"));
+        jb.build();
     }
 
-    public void buildCustomMultiReleaseJar(String filename, String multiReleaseValue) throws IOException {
+    public void buildShortMultiReleaseJar() throws IOException {
+        JarBuilder jb = customMultiReleaseJar("short-multi-release.jar", "true");
+        addEntries(jb);
+        jb.build();
+    }
+
+    private JarBuilder customMultiReleaseJar(String filename, String multiReleaseValue)
+            throws IOException {
         JarBuilder jb = new JarBuilder(filename);
         jb.addAttribute("Multi-Release", multiReleaseValue);
+        return jb;
+    }
+
+    public void buildCustomMultiReleaseJar(String filename, String multiReleaseValue,
+            Map<String, String> extraAttributes) throws IOException {
+        JarBuilder jb = new JarBuilder(filename);
+        extraAttributes.entrySet()
+                .forEach(entry -> jb.addAttribute(entry.getKey(), entry.getValue()));
+        jb.addAttribute("Multi-Release", multiReleaseValue);
+        jb.build();
+    }
+
+    private void addEntries(JarBuilder jb) {
         jb.addEntry("README", readme8.getBytes());
         jb.addEntry("version/Main.java", main.getBytes());
         jb.addEntry("version/Main.class", rootClasses.get("version.Main"));
@@ -102,31 +125,10 @@
         jb.addEntry("META-INF/versions/9/README", readme9.getBytes());
         jb.addEntry("META-INF/versions/9/version/Version.java", java9.getBytes());
         jb.addEntry("META-INF/versions/9/version/PackagePrivate.java", ppjava9.getBytes());
-        jb.addEntry("META-INF/versions/9/version/Version.class", version9Classes.get("version.Version"));
         jb.addEntry("META-INF/versions/9/version/PackagePrivate.class", version9Classes.get("version.PackagePrivate"));
         jb.addEntry("META-INF/versions/10/README", readme10.getBytes());
         jb.addEntry("META-INF/versions/10/version/Version.java", java10.getBytes());
         jb.addEntry("META-INF/versions/10/version/Version.class", version10Classes.get("version.Version"));
-        jb.build();
-    }
-
-    public void buildShortMultiReleaseJar() throws IOException {
-        JarBuilder jb = new JarBuilder("short-multi-release.jar");
-        jb.addAttribute("Multi-Release", "true");
-        jb.addEntry("README", readme8.getBytes());
-        jb.addEntry("version/Main.java", main.getBytes());
-        jb.addEntry("version/Main.class", rootClasses.get("version.Main"));
-        jb.addEntry("version/Version.java", java8.getBytes());
-        jb.addEntry("version/Version.class", rootClasses.get("version.Version"));
-        jb.addEntry("META-INF/versions/9/README", readme9.getBytes());
-        jb.addEntry("META-INF/versions/9/version/Version.java", java9.getBytes());
-        jb.addEntry("META-INF/versions/9/version/PackagePrivate.java", ppjava9.getBytes());
-        // no entry for META-INF/versions/9/version/Version.class
-        jb.addEntry("META-INF/versions/9/version/PackagePrivate.class", version9Classes.get("version.PackagePrivate"));
-        jb.addEntry("META-INF/versions/10/README", readme10.getBytes());
-        jb.addEntry("META-INF/versions/10/version/Version.java", java10.getBytes());
-        jb.addEntry("META-INF/versions/10/version/Version.class", version10Classes.get("version.Version"));
-        jb.build();
     }
 
     public void buildSignedMultiReleaseJar() throws Exception {
--- a/test/sun/text/resources/Collator/Bug4248694.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/Collator/Bug4248694.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -24,11 +24,13 @@
 /*
  * @test
  * @bug 4248694
+ * @modules jdk.localedata
  * @summary updating collation tables for icelandic
  */
 
-import java.text.*;
-import java.util.*;
+import java.text.Collator;
+import java.util.Arrays;
+import java.util.Locale;
 
 public class Bug4248694 {
 
--- a/test/sun/text/resources/Collator/Bug4804273.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/Collator/Bug4804273.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -24,11 +24,13 @@
 /*
  * @test
  * @bug 4804273
+ * @modules jdk.localedata
  * @summary updating collation tables for swedish
  */
 
-import java.text.*;
-import java.util.*;
+import java.text.Collator;
+import java.util.Arrays;
+import java.util.Locale;
 
 public class Bug4804273 {
 
--- a/test/sun/text/resources/Collator/Bug6755060.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/Collator/Bug6755060.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,11 +24,13 @@
 /*
  * @test
  * @bug 6755060
+ * @modules jdk.localedata
  * @summary updating collation tables for thai to make it consistent with CLDR 1.9
  */
 
-import java.text.*;
-import java.util.*;
+import java.text.Collator;
+import java.util.Arrays;
+import java.util.Locale;
 
 public class Bug6755060 {
 
--- a/test/sun/text/resources/Format/Bug4395196.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/Format/Bug4395196.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -22,15 +22,18 @@
  */
 
 /*
- *@test
- *@bug 4395196 4930708 4900884 4890240 8008577
- *@summary verify the ko DateFormat
- *@run main/othervm -Djava.locale.providers=JRE,SPI Bug4395196
-*/
+ * @test
+ * @bug 4395196 4930708 4900884 4890240 8008577
+ * @modules jdk.localedata
+ * @summary verify the ko DateFormat
+ * @run main/othervm -Djava.locale.providers=JRE,SPI Bug4395196
+ */
 
-import java.io.*;
-import java.text.*;
-import java.util.*;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
 
 public class Bug4395196
 {
--- a/test/sun/text/resources/Format/Bug4442855.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/Format/Bug4442855.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -22,14 +22,16 @@
  */
 
 /*
- *@test
- *@bug 4442855
- *@summary verify the era's translation for tradition chinese
+ * @test
+ * @bug 4442855
+ * @modules jdk.localedata
+ * @summary verify the era's translation for tradition chinese
  */
 
-import java.io.*;
-import java.util.*;
-import java.text.*;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
 
 public class Bug4442855
 {
--- a/test/sun/text/resources/Format/Bug4621320.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/Format/Bug4621320.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -24,10 +24,12 @@
 /*
  * @test
  * @bug 4621320
+ * @modules jdk.localedata
  * @summary Verify that Ukrainian month name is correct.
  */
-import java.text.*;
-import java.util.*;
+
+import java.text.DateFormatSymbols;
+import java.util.Locale;
 
 public class Bug4621320 {
 
--- a/test/sun/text/resources/Format/Bug4651568.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/Format/Bug4651568.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -22,10 +22,11 @@
  */
 
 /*
- *@test
- *@bug 4651568 8008577
- *@summary Verifies the currency pattern for pt_BR locale
- *@run main/othervm -Djava.locale.providers=JRE,SPI Bug4651568
+ * @test
+ * @bug 4651568 8008577
+ * @modules jdk.localedata
+ * @summary Verifies the currency pattern for pt_BR locale
+ * @run main/othervm -Djava.locale.providers=JRE,SPI Bug4651568
  */
 
 import java.text.DecimalFormat;
--- a/test/sun/text/resources/Format/Bug4762201.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/Format/Bug4762201.java	Mon Sep 12 22:04:48 2016 +0000
@@ -22,15 +22,17 @@
  */
 
 /*
- *@test
- *@bug 4762201
- *@summary verify the zh_CN full time pattern (and other time patterns)
- *@run main/othervm -Djava.locale.providers=COMPAT,SPI Bug4762201
-*/
+ * @test
+ * @bug 4762201
+ * @modules jdk.localedata
+ * @summary verify the zh_CN full time pattern (and other time patterns)
+ * @run main/othervm -Djava.locale.providers=COMPAT,SPI Bug4762201
+ */
 
-import java.io.*;
-import java.text.*;
-import java.util.*;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
 
 public class Bug4762201
 {
--- a/test/sun/text/resources/Format/Bug4807540.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/Format/Bug4807540.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -24,6 +24,7 @@
 /*
  * @test %i%
  * @bug 4807540 8008577
+ * @modules jdk.localedata
  * @summary updating dateformat for sl_SI
  * @run main/othervm -Djava.locale.providers=JRE,SPI Bug4807540
  */
--- a/test/sun/text/resources/Format/Bug4810032.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/Format/Bug4810032.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -22,14 +22,16 @@
  */
 
 /*
- *@test
- *@bug 4810032 8008577
- *@summary verify the ja full time pattern parsing
+ * @test
+ * @bug 4810032 8008577
+ * @modules jdk.localedata
+ * @summary verify the ja full time pattern parsing
  * @run main/othervm -Djava.locale.providers=JRE,SPI Bug4810032
 */
 
-import java.text.*;
-import java.util.*;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.util.Locale;
 
 public class Bug4810032
 {
--- a/test/sun/text/resources/Format/Bug4994312.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/Format/Bug4994312.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -22,9 +22,10 @@
  */
 
 /*
- *@test
- *@bug 4994312 8008577
- *@summary verify the German locale will accept localized pattern chars 't' and 'u'.
+ * @test
+ * @bug 4994312 8008577
+ * @modules jdk.localedata
+ * @summary verify the German locale will accept localized pattern chars 't' and 'u'.
  * @run main/othervm -Djava.locale.providers=JRE,SPI Bug4994312
  */
 
--- a/test/sun/text/resources/Format/Bug5096553.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/Format/Bug5096553.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 5096553 8008577
+ * @modules jdk.localedata
  * @summary updating dateformat for da_DK
  *          following resources:
  *          http://oss.software.ibm.com/cvs/icu/~checkout~/locale/common/main/da.xml
--- a/test/sun/text/resources/Format/Bug8037343.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/Format/Bug8037343.java	Mon Sep 12 22:04:48 2016 +0000
@@ -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
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8008577 8037343
+ * @modules jdk.localedata
  * @summary updating dateformat for es_DO
  * @run main/othervm -Djava.locale.providers=JRE,SPI Bug8037343
  */
--- a/test/sun/text/resources/Format/Bug8074791.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/Format/Bug8074791.java	Mon Sep 12 22:04:48 2016 +0000
@@ -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
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8074791
+ * @modules jdk.localedata
  * @summary Make sure that Finnish month names are correct in formatted text.
  */
 
@@ -32,7 +33,7 @@
 import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.Locale;
-import static java.text.DateFormat.*;
+import static java.text.DateFormat.LONG;
 import static java.util.Calendar.JANUARY;
 
 public class Bug8074791 {
--- a/test/sun/text/resources/LocaleDataTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/text/resources/LocaleDataTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -40,6 +40,7 @@
  *      8145136
  * @summary Verify locale data
  * @modules java.base/sun.util.resources
+ * @modules jdk.localedata
  * @run main LocaleDataTest
  * @run main LocaleDataTest -cldr
  *
@@ -145,12 +146,20 @@
  *    this test against the new version of the data.
  */
 
-import java.io.*;
-import java.text.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FilterReader;
+import java.io.FilterWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.Writer;
 import java.util.Locale;
+import java.util.MissingResourceException;
 import java.util.ResourceBundle;
-import java.util.ResourceBundle.Control;
-import java.util.MissingResourceException;
 import sun.util.resources.LocaleData;
 
 public class LocaleDataTest
--- a/test/sun/util/locale/provider/Bug8038436.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/util/locale/provider/Bug8038436.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016 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
@@ -27,15 +27,25 @@
  * @summary Test for changes in 8038436
  * @modules java.base/sun.util.locale.provider
  *          java.base/sun.util.spi
+ *          jdk.localedata
  * @compile -XDignore.symbol.file Bug8038436.java
  * @run main/othervm  --limit-modules java.base      Bug8038436  security
  * @run main/othervm  -Djava.locale.providers=COMPAT Bug8038436  availlocs
  */
 
-import java.security.*;
-import java.util.*;
-import java.util.stream.*;
-import sun.util.locale.provider.*;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.Arrays;
+import java.util.Formatter;
+import java.util.GregorianCalendar;
+import java.util.List;
+import java.util.Locale;
+import java.util.stream.Collectors;
+import sun.util.locale.provider.LocaleProviderAdapter;
 
 public class Bug8038436 {
     public static void main(String[] args) {
--- a/test/sun/util/locale/provider/Bug8152817.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/util/locale/provider/Bug8152817.java	Mon Sep 12 22:04:48 2016 +0000
@@ -28,6 +28,7 @@
  * @bug 8152817
  * @summary Make sure that resource bundles in the jdk.localedata module are
  *          loaded under a security manager.
+ * @modules jdk.localedata
  * @run main/othervm -Djava.locale.providers=COMPAT
  *      -Djava.security.debug=access,failure,codebase=jrt:/jdk.localedata Bug8152817
  */
--- a/test/sun/util/resources/Calendar/Bug4518811.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/util/resources/Calendar/Bug4518811.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -22,9 +22,10 @@
  */
 
 /*
- *@test
- *@bug 4518811
- *@summary Verifies the minimum days of the week for euro locales
+ * @test
+ * @bug 4518811
+ * @modules jdk.localedata
+ * @summary Verifies the minimum days of the week for euro locales
  */
 
 // this code is a bit brute-force, but I've been coding in nothing but Shell for the last year, so I'm rusty.
--- a/test/sun/util/resources/Calendar/Bug4527203.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/util/resources/Calendar/Bug4527203.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -24,6 +24,7 @@
 /*
  * @test 1.1 11/02/01
  * @bug 4527203
+ * @modules jdk.localedata
  * @summary In Hungary and Ukraine first day of week is Monday not Sunday
  */
 
--- a/test/sun/util/resources/Locale/Bug4429024.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/util/resources/Locale/Bug4429024.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -20,12 +20,13 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/**
-    @test
-    @summary checking localised language/country names in finnish
-    @bug 4429024 4964035 6558856 8008577
-    @run main/othervm -Djava.locale.providers=JRE,SPI Bug4429024
-*/
+/*
+ * @test
+ * @summary checking localised language/country names in finnish
+ * @modules jdk.localedata
+ * @bug 4429024 4964035 6558856 8008577
+ * @run main/othervm -Djava.locale.providers=JRE,SPI Bug4429024
+ */
 
 import java.util.Locale;
 
--- a/test/sun/util/resources/Locale/Bug4965260.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/util/resources/Locale/Bug4965260.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -20,11 +20,12 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/**
- *@test
- *@bug 4965260 8008577
- *@summary Verifies the language name of "nl" for supported locales
- *@run main/othervm -Djava.locale.providers=JRE,SPI Bug4965260
+/*
+ * @test
+ * @bug 4965260 8008577
+ * @modules jdk.localedata
+ * @summary Verifies the language name of "nl" for supported locales
+ * @run main/othervm -Djava.locale.providers=JRE,SPI Bug4965260
  */
 
 import java.util.Locale;
--- a/test/sun/util/resources/Locale/Bug6275682.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/util/resources/Locale/Bug6275682.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -21,10 +21,11 @@
  * questions.
  */
 
-/**
-    @test
-    @summary Verifying that the language names starts with lowercase in spanish
-    @bug 6275682
+/*
+ * @test
+ * @summary Verifying that the language names starts with lowercase in spanish
+ * @modules jdk.localedata
+ * @bug 6275682
 */
 
 import java.util.Locale;
--- a/test/sun/util/resources/TimeZone/Bug4938846.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/util/resources/TimeZone/Bug4938846.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -22,10 +22,11 @@
  */
 
 /*
- *@test
- *@bug 4938846 8008577
- *@summary Test case for en_IE TimeZone info
- *@run main/othervm -Djava.locale.providers=JRE,SPI Bug4938846
+ * @test
+ * @bug 4938846 8008577
+ * @modules jdk.localedata
+ * @summary Test case for en_IE TimeZone info
+ * @run main/othervm -Djava.locale.providers=JRE,SPI Bug4938846
  */
 
 import java.util.Locale;
--- a/test/sun/util/resources/TimeZone/Bug6271396.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/util/resources/TimeZone/Bug6271396.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -22,10 +22,11 @@
  */
 
 /*
- *@test
- *@bug 6271396 8008577
- *@summary Test case for verifying typo of timezone display name Australia/Lord_Howe
- *@run main/othervm -Djava.locale.providers=JRE,SPI Bug6271396
+ * @test
+ * @bug 6271396 8008577
+ * @modules jdk.localedata
+ * @summary Test case for verifying typo of timezone display name Australia/Lord_Howe
+ * @run main/othervm -Djava.locale.providers=JRE,SPI Bug6271396
  */
 
 import java.util.Locale;
--- a/test/sun/util/resources/TimeZone/Bug6317929.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/util/resources/TimeZone/Bug6317929.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -22,10 +22,11 @@
  */
 
 /*
- *@test
- *@bug 6317929 6409419 8008577
- *@summary Test case for tzdata2005m support for 9 locales
- *@run main/othervm -Djava.locale.providers=JRE,SPI Bug6317929
+ * @test
+ * @bug 6317929 6409419 8008577
+ * @modules jdk.localedata
+ * @summary Test case for tzdata2005m support for 9 locales
+ * @run main/othervm -Djava.locale.providers=JRE,SPI Bug6317929
  */
 
 import java.util.Locale;
--- a/test/sun/util/resources/TimeZone/Bug6377794.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/util/resources/TimeZone/Bug6377794.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -22,10 +22,11 @@
  */
 
 /*
- *@test
- *@bug 6377794
- *@summary Test case for tzdata2005r support for 9 locales
- *@run main/othervm -Djava.locale.providers=JRE,SPI Bug6377794
+ * @test
+ * @bug 6377794
+ * @modules jdk.localedata
+ * @summary Test case for tzdata2005r support for 9 locales
+ * @run main/othervm -Djava.locale.providers=JRE,SPI Bug6377794
  */
 
 import java.util.Locale;
--- a/test/sun/util/resources/TimeZone/Bug6442006.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/util/resources/TimeZone/Bug6442006.java	Mon Sep 12 22:04:48 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -22,10 +22,11 @@
  */
 
 /*
- *@test
- *@bug 6442006 8008577
- *@summary Test case for verifying timezone display name for Asia/Taipei
- *@run main/othervm -Djava.locale.providers=JRE,SPI Bug6442006
+ * @test
+ * @bug 6442006 8008577
+ * @modules jdk.localedata
+ * @summary Test case for verifying timezone display name for Asia/Taipei
+ * @run main/othervm -Djava.locale.providers=JRE,SPI Bug6442006
  */
 
 import java.util.Locale;
--- a/test/sun/util/resources/cldr/Bug8134250.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/util/resources/cldr/Bug8134250.java	Mon Sep 12 22:04:48 2016 +0000
@@ -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
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8134250 8134520
+ * @modules jdk.localedata
  * @summary Tests CLDR/LDML features are correctly reflected in JDK.
  * @run main/othervm -Djava.locale.providers=CLDR Bug8134250
  */
@@ -31,10 +32,15 @@
 // Note this test highly depends on a particular version of CLDR. Results
 // may vary in the future.
 
-import java.time.*;
-import java.time.chrono.*;
-import java.time.format.*;
-import java.util.*;
+import java.time.LocalDate;
+import java.time.Month;
+import java.time.ZoneId;
+import java.time.chrono.Chronology;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.FormatStyle;
+import java.time.format.TextStyle;
+import java.util.Locale;
 
 public class Bug8134250 {
     public static void main(String [] args) {
--- a/test/sun/util/resources/cldr/Bug8145136.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/sun/util/resources/cldr/Bug8145136.java	Mon Sep 12 22:04:48 2016 +0000
@@ -25,6 +25,7 @@
  /*
  * @test
  * @bug 8145136
+ * @modules jdk.localedata
  * @summary Tests CLDR 28/29 newly added feature LikelySubtags is correctly reflected in JDK.
  * @run main/othervm -Djava.locale.providers=CLDR Bug8145136
  */
--- a/test/tools/jlink/plugins/IncludeLocalesPluginTest.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/tools/jlink/plugins/IncludeLocalesPluginTest.java	Mon Sep 12 22:04:48 2016 +0000
@@ -126,11 +126,10 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_es_419.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_es_AR.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
@@ -165,11 +164,10 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_zh.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class",
@@ -206,11 +204,10 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_150.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_AT.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
@@ -235,11 +232,10 @@
                 "/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_kok_IN.class",
                 "/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_pa_Guru_IN.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
@@ -261,11 +257,10 @@
             "--include-locales=th",
             "jdk.localedata",
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class"),
             List.of(
                 "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
@@ -290,11 +285,10 @@
                 "/jdk.localedata/sun/text/resources/ext/FormatData_zh_TW.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
@@ -318,11 +312,10 @@
                 "/jdk.localedata/sun/text/resources/ext/FormatData_zh_SG.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
@@ -346,11 +339,10 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_nb.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_nn.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
@@ -376,11 +368,10 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_iw.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ji.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
--- a/test/tools/pack200/Pack200Test.java	Mon Sep 12 15:00:58 2016 -0700
+++ b/test/tools/pack200/Pack200Test.java	Mon Sep 12 22:04:48 2016 +0000
@@ -21,6 +21,14 @@
  * questions.
  */
 
+ /*
+  * @test
+  * @bug 6521334 6712743 8007902 8151901
+  * @summary test general packer/unpacker functionality
+  *          using native and java unpackers
+  * @compile -XDignore.symbol.file Utils.java Pack200Test.java
+  * @run main/othervm/timeout=1200 -Xmx1280m -Xshare:off Pack200Test
+  */
 
 import java.util.*;
 import java.io.*;
@@ -28,17 +36,6 @@
 import java.lang.management.MemoryMXBean;
 import java.util.jar.*;
 
- /*
-  * @test
-  * @bug 6521334 6712743 8007902
-  * @key intermittent
-  * @summary check for memory leaks, test general packer/unpacker functionality\
-  *          using native and java unpackers
-  * @compile -XDignore.symbol.file Utils.java Pack200Test.java
-  * @run main/othervm/timeout=1200 -Xmx1280m -Xshare:off Pack200Test
-  * @author ksrini
-  */
-
 /**
  * Tests the packing/unpacking via the APIs.
  */
@@ -48,6 +45,9 @@
     static final MemoryMXBean mmxbean = ManagementFactory.getMemoryMXBean();
     static final long m0 = getUsedMemory();
     static final int LEAK_TOLERANCE = 21000; // OS and GC related variations.
+    // enable leak checks only if required, GC charecteristics vary on
+    // platforms and this may not yield consistent results
+    static final boolean LEAK_CHECK = Boolean.getBoolean("Pack200Test.enableLeakCheck");
 
     /** Creates a new instance of Pack200Test */
     private Pack200Test() {}
@@ -60,9 +60,11 @@
     }
 
     private static void leakCheck() throws Exception {
+        if (!LEAK_CHECK)
+            return;
         long diff = getUsedMemory() - m0;
         System.out.println("  Info: memory diff = " + diff + "K");
-        if ( diff  > LEAK_TOLERANCE) {
+        if (diff > LEAK_TOLERANCE) {
             throw new Exception("memory leak detected " + diff);
         }
     }
@@ -126,7 +128,7 @@
     /**
      * @param args the command line arguments
      */
-    public static void main(String[] args) throws IOException {
+    public static void main(String[] args) throws Exception {
         // select the jars carefully, adding more jars will increase the
         // testing time, especially for jprt.
         jarList.add(Utils.createRtJar());
Binary file test/tools/pack200/pack200-verifier/data/golden.jar has changed