Merge
authorlana
Thu, 26 May 2016 17:19:13 +0000
changeset 38572 347523bb90c6
parent 38550 9b5b0b4c2649 (current diff)
parent 38571 75eeea87c73d (diff)
child 38573 4964706e8a45
Merge
--- a/jdk/src/java.base/share/classes/java/lang/StackWalker.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/StackWalker.java	Thu May 26 17:19:13 2016 +0000
@@ -306,8 +306,9 @@
             return DEFAULT_WALKER;
         }
 
-        checkPermission(options);
-        return new StackWalker(toEnumSet(options));
+        EnumSet<Option> optionSet = toEnumSet(options);
+        checkPermission(optionSet);
+        return new StackWalker(optionSet);
     }
 
     /**
@@ -341,8 +342,9 @@
         if (estimateDepth <= 0) {
             throw new IllegalArgumentException("estimateDepth must be > 0");
         }
-        checkPermission(options);
-        return new StackWalker(toEnumSet(options), estimateDepth);
+        EnumSet<Option> optionSet = toEnumSet(options);
+        checkPermission(optionSet);
+        return new StackWalker(optionSet, estimateDepth);
     }
 
     // ----- private constructors ------
@@ -540,13 +542,11 @@
     }
 
     // ---- package access ----
-    static StackWalker newInstanceNoCheck(EnumSet<Option> options) {
-        return new StackWalker(options, 0, null);
-    }
 
     static StackWalker newInstance(Set<Option> options, ExtendedOption extendedOption) {
-        checkPermission(options);
-        return new StackWalker(toEnumSet(options), 0, extendedOption);
+        EnumSet<Option> optionSet = toEnumSet(options);
+        checkPermission(optionSet);
+        return new StackWalker(optionSet, 0, extendedOption);
     }
 
     int estimateDepth() {
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleReader.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleReader.java	Thu May 26 17:19:13 2016 +0000
@@ -30,6 +30,7 @@
 import java.io.InputStream;
 import java.net.URI;
 import java.nio.ByteBuffer;
+import java.util.Objects;
 import java.util.Optional;
 
 
@@ -163,9 +164,12 @@
      * @param  bb
      *         The byte buffer to release
      *
-     * @implSpec The default implementation does nothing.
+     * @implSpec The default implementation doesn't do anything except check
+     * if the byte buffer is null.
      */
-    default void release(ByteBuffer bb) { }
+    default void release(ByteBuffer bb) {
+        Objects.requireNonNull(bb);
+    }
 
     /**
      * Closes the module reader. Once closed then subsequent calls to locate or
--- a/jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java	Thu May 26 17:19:13 2016 +0000
@@ -272,9 +272,9 @@
          * if not found.
          */
         private ImageLocation findImageLocation(String name) throws IOException {
+            Objects.requireNonNull(name);
             if (closed)
                 throw new IOException("ModuleReader is closed");
-
             if (imageReader != null) {
                 return imageReader.findLocation(module, name);
             } else {
@@ -322,6 +322,7 @@
 
         @Override
         public void release(ByteBuffer bb) {
+            Objects.requireNonNull(bb);
             ImageReader.releaseByteBuffer(bb);
         }
 
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Layer.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Layer.java	Thu May 26 17:19:13 2016 +0000
@@ -75,11 +75,12 @@
  *
  * <p> A Java virtual machine has at least one non-empty layer, the {@link
  * #boot() boot} layer, that is created when the Java virtual machine is
- * started. The <em>system modules</em>, including {@code java.base}, are in
- * the boot layer. The modules in the boot layer are mapped to the bootstrap
- * class loader and other class loaders that are built-in into the Java virtual
- * machine. The boot layer will often be the {@link #parent() parent} when
- * creating additional layers. </p>
+ * started. The boot layer contains module {@code java.base} and is the only
+ * layer in the Java virtual machine with a module named "{@code java.base}".
+ * The modules in the boot layer are mapped to the bootstrap class loader and
+ * other class loaders that are <a href="../ClassLoader.html#builtinLoaders">
+ * built-in</a> into the Java virtual machine. The boot layer will often be
+ * the {@link #parent() parent} when creating additional layers. </p>
  *
  * <p> As when creating a {@code Configuration},
  * {@link ModuleDescriptor#isAutomatic() automatic} modules receive
@@ -204,7 +205,8 @@
      *         for this layer
      * @throws LayerInstantiationException
      *         If all modules cannot be defined to the same class loader for any
-     *         of the reasons listed above
+     *         of the reasons listed above or the layer cannot be created because
+     *         the configuration contains a module named "{@code java.base}"
      * @throws SecurityException
      *         If {@code RuntimePermission("createClassLoader")} or
      *         {@code RuntimePermission("getClassLoader")} is denied by
@@ -219,14 +221,13 @@
         checkCreateClassLoaderPermission();
         checkGetClassLoaderPermission();
 
-        Loader loader;
         try {
-            loader = new Loader(cf.modules(), parentLoader);
+            Loader loader = new Loader(cf.modules(), parentLoader);
             loader.initRemotePackageMap(cf, this);
+            return new Layer(cf, this, mn -> loader);
         } catch (IllegalArgumentException e) {
             throw new LayerInstantiationException(e.getMessage());
         }
-        return new Layer(cf, this, mn -> loader);
     }
 
 
@@ -266,6 +267,9 @@
      * @throws IllegalArgumentException
      *         If the parent of the given configuration is not the configuration
      *         for this layer
+     * @throws LayerInstantiationException
+     *         If the layer cannot be created because the configuration contains
+     *         a module named "{@code java.base}"
      * @throws SecurityException
      *         If {@code RuntimePermission("createClassLoader")} or
      *         {@code RuntimePermission("getClassLoader")} is denied by
@@ -281,7 +285,11 @@
         checkGetClassLoaderPermission();
 
         LoaderPool pool = new LoaderPool(cf, this, parentLoader);
-        return new Layer(cf, this, pool::loaderFor);
+        try {
+            return new Layer(cf, this, pool::loaderFor);
+        } catch (IllegalArgumentException e) {
+            throw new LayerInstantiationException(e.getMessage());
+        }
     }
 
 
@@ -330,7 +338,8 @@
      *         for this layer
      * @throws LayerInstantiationException
      *         If creating the {@code Layer} fails for any of the reasons
-     *         listed above
+     *         listed above or the layer cannot be created because the
+     *         configuration contains a module named "{@code java.base}"
      * @throws SecurityException
      *         If {@code RuntimePermission("getClassLoader")} is denied by
      *         the security manager
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Module.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Module.java	Thu May 26 17:19:13 2016 +0000
@@ -513,7 +513,7 @@
      * package {@code pn} to the given module.
      *
      * <p> This method has no effect if the package is already exported to the
-     * given module. If also has no effect if invoked on an unnamed module (as
+     * given module. It also has no effect if invoked on an unnamed module (as
      * unnamed modules export all packages). </p>
      *
      * @param  pn
@@ -866,7 +866,7 @@
             URI uri = mref.location().orElse(null);
 
             Module m;
-            if (loader == null && name.equals("java.base")) {
+            if (loader == null && name.equals("java.base") && Layer.boot() == null) {
                 m = Object.class.getModule();
             } else {
                 m = new Module(layer, loader, descriptor, uri);
--- a/jdk/src/java.base/share/classes/java/math/BigDecimal.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/math/BigDecimal.java	Thu May 26 17:19:13 2016 +0000
@@ -55,7 +55,7 @@
  * object to the operation.  In either case, eight <em>rounding
  * modes</em> are provided for the control of rounding.  Using the
  * integer fields in this class (such as {@link #ROUND_HALF_UP}) to
- * represent rounding mode is largely obsolete; the enumeration values
+ * represent rounding mode is deprecated; the enumeration values
  * of the {@code RoundingMode} {@code enum}, (such as {@link
  * RoundingMode#HALF_UP}) should be used instead.
  *
@@ -93,7 +93,7 @@
  * <p>In general the rounding modes and precision setting determine
  * how operations return results with a limited number of digits when
  * the exact result has more digits (perhaps infinitely many in the
- * case of division) than the number of digits returned.
+ * case of division and square root) than the number of digits returned.
  *
  * First, the
  * total number of digits to return is specified by the
@@ -196,18 +196,19 @@
  * {@code BigDecimal} value; for example [19, 2] is the
  * {@code BigDecimal} numerically equal to 0.19 having a scale of 2.
  *
- * <p>Note: care should be exercised if {@code BigDecimal} objects
- * are used as keys in a {@link java.util.SortedMap SortedMap} or
- * elements in a {@link java.util.SortedSet SortedSet} since
- * {@code BigDecimal}'s <i>natural ordering</i> is <i>inconsistent
- * with equals</i>.  See {@link Comparable}, {@link
- * java.util.SortedMap} or {@link java.util.SortedSet} for more
- * information.
  *
  * <p>All methods and constructors for this class throw
  * {@code NullPointerException} when passed a {@code null} object
  * reference for any input parameter.
  *
+ * @apiNote Care should be exercised if {@code BigDecimal} objects
+ * are used as keys in a {@link java.util.SortedMap SortedMap} or
+ * elements in a {@link java.util.SortedSet SortedSet} since
+ * {@code BigDecimal}'s <i>natural ordering</i> is <em>inconsistent
+ * with equals</em>.  See {@link Comparable}, {@link
+ * java.util.SortedMap} or {@link java.util.SortedSet} for more
+ * information.
+ *
  * @see     BigInteger
  * @see     MathContext
  * @see     RoundingMode
@@ -377,10 +378,10 @@
      * same sequence of characters as the {@link #BigDecimal(String)}
      * constructor, while allowing a sub-array to be specified.
      *
-     * <p>Note that if the sequence of characters is already available
+     * @implNote If the sequence of characters is already available
      * within a character array, using this constructor is faster than
      * converting the {@code char} array to string and using the
-     * {@code BigDecimal(String)} constructor .
+     * {@code BigDecimal(String)} constructor.
      *
      * @param  in {@code char} array that is the source of characters.
      * @param  offset first character in the array to inspect.
@@ -401,14 +402,14 @@
      * constructor, while allowing a sub-array to be specified and
      * with rounding according to the context settings.
      *
-     * <p>Note that if the sequence of characters is already available
+     * @implNote If the sequence of characters is already available
      * within a character array, using this constructor is faster than
      * converting the {@code char} array to string and using the
      * {@code BigDecimal(String)} constructor.
      *
      * @param  in {@code char} array that is the source of characters.
      * @param  offset first character in the array to inspect.
-     * @param  len number of characters to consider..
+     * @param  len number of characters to consider.
      * @param  mc the context to use.
      * @throws ArithmeticException if the result is inexact but the
      *         rounding mode is {@code UNNECESSARY}.
@@ -679,10 +680,10 @@
      * same sequence of characters as the {@link #BigDecimal(String)}
      * constructor.
      *
-     * <p>Note that if the sequence of characters is already available
+     * @implNote If the sequence of characters is already available
      * as a character array, using this constructor is faster than
      * converting the {@code char} array to string and using the
-     * {@code BigDecimal(String)} constructor .
+     * {@code BigDecimal(String)} constructor.
      *
      * @param in {@code char} array that is the source of characters.
      * @throws NumberFormatException if {@code in} is not a valid
@@ -700,10 +701,10 @@
      * constructor and with rounding according to the context
      * settings.
      *
-     * <p>Note that if the sequence of characters is already available
+     * @implNote If the sequence of characters is already available
      * as a character array, using this constructor is faster than
      * converting the {@code char} array to string and using the
-     * {@code BigDecimal(String)} constructor .
+     * {@code BigDecimal(String)} constructor.
      *
      * @param  in {@code char} array that is the source of characters.
      * @param  mc the context to use.
@@ -805,7 +806,7 @@
      * "-0"           [0,0]
      * </pre>
      *
-     * <p>Note: For values other than {@code float} and
+     * @apiNote For values other than {@code float} and
      * {@code double} NaN and &plusmn;Infinity, this constructor is
      * compatible with the values returned by {@link Float#toString}
      * and {@link Double#toString}.  This is generally the preferred
@@ -859,13 +860,13 @@
      * This is because 0.1 cannot be represented exactly as a
      * {@code double} (or, for that matter, as a binary fraction of
      * any finite length).  Thus, the value that is being passed
-     * <i>in</i> to the constructor is not exactly equal to 0.1,
+     * <em>in</em> to the constructor is not exactly equal to 0.1,
      * appearances notwithstanding.
      *
      * <li>
      * The {@code String} constructor, on the other hand, is
      * perfectly predictable: writing {@code new BigDecimal("0.1")}
-     * creates a {@code BigDecimal} which is <i>exactly</i> equal to
+     * creates a {@code BigDecimal} which is <em>exactly</em> equal to
      * 0.1, as one would expect.  Therefore, it is generally
      * recommended that the {@linkplain #BigDecimal(String)
      * String constructor} be used in preference to this one.
@@ -1199,10 +1200,11 @@
 
     /**
      * Translates a {@code long} unscaled value and an
-     * {@code int} scale into a {@code BigDecimal}.  This
-     * {@literal "static factory method"} is provided in preference to
-     * a ({@code long}, {@code int}) constructor because it
-     * allows for reuse of frequently used {@code BigDecimal} values..
+     * {@code int} scale into a {@code BigDecimal}.
+     *
+     * @apiNote This static factory method is provided in preference
+     * to a ({@code long}, {@code int}) constructor because it allows
+     * for reuse of frequently used {@code BigDecimal} values.
      *
      * @param unscaledVal unscaled value of the {@code BigDecimal}.
      * @param scale scale of the {@code BigDecimal}.
@@ -1222,10 +1224,11 @@
 
     /**
      * Translates a {@code long} value into a {@code BigDecimal}
-     * with a scale of zero.  This {@literal "static factory method"}
-     * is provided in preference to a ({@code long}) constructor
-     * because it allows for reuse of frequently used
-     * {@code BigDecimal} values.
+     * with a scale of zero.
+     *
+     * @apiNote This static factory method is provided in preference
+     * to a ({@code long}) constructor because it allows for reuse of
+     * frequently used {@code BigDecimal} values.
      *
      * @param val value of the {@code BigDecimal}.
      * @return a {@code BigDecimal} whose value is {@code val}.
@@ -1270,11 +1273,11 @@
      * the {@code double}'s canonical string representation provided
      * by the {@link Double#toString(double)} method.
      *
-     * <p><b>Note:</b> This is generally the preferred way to convert
-     * a {@code double} (or {@code float}) into a
-     * {@code BigDecimal}, as the value returned is equal to that
-     * resulting from constructing a {@code BigDecimal} from the
-     * result of using {@link Double#toString(double)}.
+     * @apiNote This is generally the preferred way to convert a
+     * {@code double} (or {@code float}) into a {@code BigDecimal}, as
+     * the value returned is equal to that resulting from constructing
+     * a {@code BigDecimal} from the result of using {@link
+     * Double#toString(double)}.
      *
      * @param  val {@code double} to convert to a {@code BigDecimal}.
      * @return a {@code BigDecimal} whose value is equal to or approximately
@@ -1896,7 +1899,7 @@
      *
      * <p>The remainder is given by
      * {@code this.subtract(this.divideToIntegralValue(divisor).multiply(divisor))}.
-     * Note that this is not the modulo operation (the result can be
+     * Note that this is <em>not</em> the modulo operation (the result can be
      * negative).
      *
      * @param  divisor value by which this {@code BigDecimal} is to be divided.
@@ -2037,6 +2040,7 @@
      * {@code (mc.getRoundingMode()==RoundingMode.UNNECESSARY}) and
      * the exact result cannot fit in {@code mc.getPrecision()}
      * digits.
+     * @see BigInteger#sqrt()
      * @since  9
      */
     public BigDecimal sqrt(MathContext mc) {
@@ -2694,8 +2698,8 @@
      * in this case, the specified rounding mode is applied to the
      * division.
      *
-     * <p>Note that since BigDecimal objects are immutable, calls of
-     * this method do <i>not</i> result in the original object being
+     * @apiNote Since BigDecimal objects are immutable, calls of
+     * this method do <em>not</em> result in the original object being
      * modified, contrary to the usual convention of having methods
      * named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
      * Instead, {@code setScale} returns an object with the proper
@@ -2727,8 +2731,8 @@
      * in this case, the specified rounding mode is applied to the
      * division.
      *
-     * <p>Note that since BigDecimal objects are immutable, calls of
-     * this method do <i>not</i> result in the original object being
+     * @apiNote Since BigDecimal objects are immutable, calls of
+     * this method do <em>not</em> result in the original object being
      * modified, contrary to the usual convention of having methods
      * named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
      * Instead, {@code setScale} returns an object with the proper
@@ -2822,8 +2826,8 @@
      * versions of {@code setScale}, but saves the caller the trouble
      * of specifying a rounding mode in cases where it is irrelevant.
      *
-     * <p>Note that since {@code BigDecimal} objects are immutable,
-     * calls of this method do <i>not</i> result in the original
+     * @apiNote Since {@code BigDecimal} objects are immutable,
+     * calls of this method do <em>not</em> result in the original
      * object being modified, contrary to the usual convention of
      * having methods named <code>set<i>X</i></code> mutate field
      * <i>{@code X}</i>.  Instead, {@code setScale} returns an
@@ -3091,7 +3095,7 @@
     /**
      * Returns the hash code for this {@code BigDecimal}.  Note that
      * two {@code BigDecimal} objects that are numerically equal but
-     * differ in scale (like 2.0 and 2.00) will generally <i>not</i>
+     * differ in scale (like 2.0 and 2.00) will generally <em>not</em>
      * have the same hash code.
      *
      * @return hash code for this {@code BigDecimal}.
@@ -3342,7 +3346,7 @@
      * Converts this {@code BigDecimal} to a {@code BigInteger}.
      * This conversion is analogous to the
      * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code long} as defined in section 5.1.3 of
+     * {@code long} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * any fractional part of this
      * {@code BigDecimal} will be discarded.  Note that this
@@ -3354,6 +3358,7 @@
      * {@link #toBigIntegerExact()} method.
      *
      * @return this {@code BigDecimal} converted to a {@code BigInteger}.
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     public BigInteger toBigInteger() {
         // force to an integer, quietly
@@ -3379,7 +3384,7 @@
      * Converts this {@code BigDecimal} to a {@code long}.
      * This conversion is analogous to the
      * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code short} as defined in section 5.1.3 of
+     * {@code short} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * any fractional part of this
      * {@code BigDecimal} will be discarded, and if the resulting
@@ -3390,6 +3395,7 @@
      * as return a result with the opposite sign.
      *
      * @return this {@code BigDecimal} converted to a {@code long}.
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     @Override
     public long longValue(){
@@ -3448,7 +3454,7 @@
      * Converts this {@code BigDecimal} to an {@code int}.
      * This conversion is analogous to the
      * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code short} as defined in section 5.1.3 of
+     * {@code short} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * any fractional part of this
      * {@code BigDecimal} will be discarded, and if the resulting
@@ -3459,6 +3465,7 @@
      * value as well as return a result with the opposite sign.
      *
      * @return this {@code BigDecimal} converted to an {@code int}.
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     @Override
     public int intValue() {
@@ -3531,7 +3538,7 @@
      * Converts this {@code BigDecimal} to a {@code float}.
      * This conversion is similar to the
      * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code float} as defined in section 5.1.3 of
+     * {@code float} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * if this {@code BigDecimal} has too great a
      * magnitude to represent as a {@code float}, it will be
@@ -3542,6 +3549,7 @@
      * value.
      *
      * @return this {@code BigDecimal} converted to a {@code float}.
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     @Override
     public float floatValue(){
@@ -3575,7 +3583,7 @@
      * Converts this {@code BigDecimal} to a {@code double}.
      * This conversion is similar to the
      * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code float} as defined in section 5.1.3 of
+     * {@code float} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * if this {@code BigDecimal} has too great a
      * magnitude represent as a {@code double}, it will be
@@ -3586,6 +3594,7 @@
      * value.
      *
      * @return this {@code BigDecimal} converted to a {@code double}.
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     @Override
     public double doubleValue(){
--- a/jdk/src/java.base/share/classes/java/math/BigInteger.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/math/BigInteger.java	Thu May 26 17:19:13 2016 +0000
@@ -116,6 +116,7 @@
  * +2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive).
  *
  * @see     BigDecimal
+ * @jls     4.2.2 Integer Operations
  * @author  Josh Bloch
  * @author  Michael McCloskey
  * @author  Alan Eliasen
@@ -126,7 +127,7 @@
 public class BigInteger extends Number implements Comparable<BigInteger> {
     /**
      * The signum of this BigInteger: -1 for negative, 0 for zero, or
-     * 1 for positive.  Note that the BigInteger zero <i>must</i> have
+     * 1 for positive.  Note that the BigInteger zero <em>must</em> have
      * a signum of 0.  This is necessary to ensures that there is exactly one
      * representation for each BigInteger value.
      */
@@ -710,7 +711,7 @@
      * Constructs a randomly generated positive BigInteger that is probably
      * prime, with the specified bitLength.
      *
-     * <p>It is recommended that the {@link #probablePrime probablePrime}
+     * @apiNote It is recommended that the {@link #probablePrime probablePrime}
      * method be used in preference to this constructor unless there
      * is a compelling need to specify a certainty.
      *
@@ -1157,9 +1158,11 @@
 
     /**
      * Returns a BigInteger whose value is equal to that of the
-     * specified {@code long}.  This "static factory method" is
-     * provided in preference to a ({@code long}) constructor
-     * because it allows for reuse of frequently used BigIntegers.
+     * specified {@code long}.
+     *
+     * @apiNote This static factory method is provided in preference
+     * to a ({@code long}) constructor because it allows for reuse of
+     * frequently used BigIntegers.
      *
      * @param  val value of the BigInteger to return.
      * @return a BigInteger with the specified value.
@@ -3551,13 +3554,13 @@
 
     /**
      * Returns the number of bits in the minimal two's-complement
-     * representation of this BigInteger, <i>excluding</i> a sign bit.
+     * representation of this BigInteger, <em>excluding</em> a sign bit.
      * For positive BigIntegers, this is equivalent to the number of bits in
      * the ordinary binary representation.  (Computes
      * {@code (ceil(log2(this < 0 ? -this : this+1)))}.)
      *
      * @return number of bits in the minimal two's-complement
-     *         representation of this BigInteger, <i>excluding</i> a sign bit.
+     *         representation of this BigInteger, <em>excluding</em> a sign bit.
      */
     public int bitLength() {
         int n = bitLengthPlusOne - 1;
@@ -4034,7 +4037,7 @@
      * Converts this BigInteger to an {@code int}.  This
      * conversion is analogous to a
      * <i>narrowing primitive conversion</i> from {@code long} to
-     * {@code int} as defined in section 5.1.3 of
+     * {@code int} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * if this BigInteger is too big to fit in an
      * {@code int}, only the low-order 32 bits are returned.
@@ -4044,6 +4047,7 @@
      *
      * @return this BigInteger converted to an {@code int}.
      * @see #intValueExact()
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     public int intValue() {
         int result = 0;
@@ -4055,7 +4059,7 @@
      * Converts this BigInteger to a {@code long}.  This
      * conversion is analogous to a
      * <i>narrowing primitive conversion</i> from {@code long} to
-     * {@code int} as defined in section 5.1.3 of
+     * {@code int} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * if this BigInteger is too big to fit in a
      * {@code long}, only the low-order 64 bits are returned.
@@ -4065,6 +4069,7 @@
      *
      * @return this BigInteger converted to a {@code long}.
      * @see #longValueExact()
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     public long longValue() {
         long result = 0;
@@ -4078,7 +4083,7 @@
      * Converts this BigInteger to a {@code float}.  This
      * conversion is similar to the
      * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code float} as defined in section 5.1.3 of
+     * {@code float} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * if this BigInteger has too great a magnitude
      * to represent as a {@code float}, it will be converted to
@@ -4088,6 +4093,7 @@
      * information about the precision of the BigInteger value.
      *
      * @return this BigInteger converted to a {@code float}.
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     public float floatValue() {
         if (signum == 0) {
@@ -4162,7 +4168,7 @@
      * Converts this BigInteger to a {@code double}.  This
      * conversion is similar to the
      * <i>narrowing primitive conversion</i> from {@code double} to
-     * {@code float} as defined in section 5.1.3 of
+     * {@code float} as defined in
      * <cite>The Java&trade; Language Specification</cite>:
      * if this BigInteger has too great a magnitude
      * to represent as a {@code double}, it will be converted to
@@ -4172,6 +4178,7 @@
      * information about the precision of the BigInteger value.
      *
      * @return this BigInteger converted to a {@code double}.
+     * @jls 5.1.3 Narrowing Primitive Conversion
      */
     public double doubleValue() {
         if (signum == 0) {
--- a/jdk/src/java.base/share/classes/java/net/Inet6AddressImpl.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/net/Inet6AddressImpl.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,10 @@
  * questions.
  */
 package java.net;
+
 import java.io.IOException;
+import static java.net.InetAddress.PREFER_IPV6_VALUE;
+import static java.net.InetAddress.PREFER_SYSTEM_VALUE;
 
 /*
  * Package private implementation of InetAddressImpl for dual
@@ -35,15 +38,23 @@
  *
  * @since 1.4
  */
+class Inet6AddressImpl implements InetAddressImpl {
 
-class Inet6AddressImpl implements InetAddressImpl {
     public native String getLocalHostName() throws UnknownHostException;
-    public native InetAddress[]
-        lookupAllHostAddr(String hostname) throws UnknownHostException;
+
+    public native InetAddress[] lookupAllHostAddr(String hostname)
+        throws UnknownHostException;
+
     public native String getHostByAddr(byte[] addr) throws UnknownHostException;
-    private native boolean isReachable0(byte[] addr, int scope, int timeout, byte[] inf, int ttl, int if_scope) throws IOException;
+
+    private native boolean isReachable0(byte[] addr, int scope, int timeout,
+                                        byte[] inf, int ttl, int if_scope)
+        throws IOException;
 
-    public boolean isReachable(InetAddress addr, int timeout, NetworkInterface netif, int ttl) throws IOException {
+    public boolean isReachable(InetAddress addr, int timeout,
+                               NetworkInterface netif, int ttl)
+        throws IOException
+    {
         byte[] ifaddr = null;
         int scope = -1;
         int netif_scope = -1;
@@ -79,7 +90,8 @@
 
     public synchronized InetAddress anyLocalAddress() {
         if (anyLocalAddress == null) {
-            if (InetAddress.preferIPv6Address) {
+            if (InetAddress.preferIPv6Address == PREFER_IPV6_VALUE ||
+                InetAddress.preferIPv6Address == PREFER_SYSTEM_VALUE) {
                 anyLocalAddress = new Inet6Address();
                 anyLocalAddress.holder().hostName = "::";
             } else {
@@ -91,7 +103,8 @@
 
     public synchronized InetAddress loopbackAddress() {
         if (loopbackAddress == null) {
-             if (InetAddress.preferIPv6Address) {
+             if (InetAddress.preferIPv6Address == PREFER_IPV6_VALUE ||
+                 InetAddress.preferIPv6Address == PREFER_SYSTEM_VALUE) {
                  byte[] loopback =
                         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
@@ -103,6 +116,6 @@
         return loopbackAddress;
     }
 
-    private InetAddress      anyLocalAddress;
-    private InetAddress      loopbackAddress;
+    private InetAddress anyLocalAddress;
+    private InetAddress loopbackAddress;
 }
--- a/jdk/src/java.base/share/classes/java/net/InetAddress.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/net/InetAddress.java	Thu May 26 17:19:13 2016 +0000
@@ -26,8 +26,6 @@
 package java.net;
 
 import java.util.NavigableSet;
-import java.util.Iterator;
-import java.util.List;
 import java.util.ArrayList;
 import java.util.Objects;
 import java.util.Scanner;
@@ -41,6 +39,7 @@
 import java.io.ObjectInputStream.GetField;
 import java.io.ObjectOutputStream;
 import java.io.ObjectOutputStream.PutField;
+import java.lang.annotation.Native;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ConcurrentSkipListSet;
@@ -193,6 +192,11 @@
  */
 public
 class InetAddress implements java.io.Serializable {
+
+    @Native static final int PREFER_IPV4_VALUE = 0;
+    @Native static final int PREFER_IPV6_VALUE = 1;
+    @Native static final int PREFER_SYSTEM_VALUE = 2;
+
     /**
      * Specify the address family: Internet Protocol, Version 4
      * @since 1.4
@@ -206,8 +210,7 @@
     static final int IPv6 = 2;
 
     /* Specify address family preference */
-    static transient boolean preferIPv6Address = false;
-
+    static transient final int preferIPv6Address;
 
     static class InetAddressHolder {
         /**
@@ -293,8 +296,19 @@
      * Load net library into runtime, and perform initializations.
      */
     static {
-        preferIPv6Address = java.security.AccessController.doPrivileged(
-            new GetBooleanAction("java.net.preferIPv6Addresses")).booleanValue();
+        String str = java.security.AccessController.doPrivileged(
+                new GetPropertyAction("java.net.preferIPv6Addresses"));
+        if (str == null) {
+            preferIPv6Address = PREFER_IPV4_VALUE;
+        } else if (str.equalsIgnoreCase("true")) {
+            preferIPv6Address = PREFER_IPV6_VALUE;
+        } else if (str.equalsIgnoreCase("false")) {
+            preferIPv6Address = PREFER_IPV4_VALUE;
+        } else if (str.equalsIgnoreCase("system")) {
+            preferIPv6Address = PREFER_SYSTEM_VALUE;
+        } else {
+            preferIPv6Address = PREFER_IPV4_VALUE;
+        }
         AccessController.doPrivileged(
             new java.security.PrivilegedAction<>() {
                 public Void run() {
--- a/jdk/src/java.base/share/classes/java/net/doc-files/net-properties.html	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/net/doc-files/net-properties.html	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
 java.net package. Some are checked only once at startup of the VM,
 and therefore are best set using the -D option of the java command,
 while others have a more dynamic nature and can also be changed using
-the <a href="../../lang/System.html#setProperty(java.lang.String,%20java.lang.String)">System.setProperty()</a> API. 
+the <a href="../../lang/System.html#setProperty(java.lang.String,%20java.lang.String)">System.setProperty()</a> API.
 The purpose of this document is to list
 and detail all of these properties.</P>
 <P>If there is no special note, a property value is checked every time it is used.</P>
@@ -58,7 +58,8 @@
 	applications that depend on the representation of an IPv4 address
 	(e.g. 192.168.1.1). This property can be set to <B>true</B> to
 	change that preference and use IPv6 addresses over IPv4 ones where
-	possible.</P>
+	possible, or <B>system</B> to preserve the order of the addresses as
+    returned by the operating system.</P>
 </UL>
 <P>Both of these properties are checked only once, at startup.</P>
 <a name="Proxies"></a>
@@ -73,7 +74,7 @@
 	<P>The following proxy settings are used by the HTTP protocol handler.</P>
 	<UL>
 		<LI><P><B>http.proxyHost</B> (default: &lt;none&gt;)<BR>
-	        The hostname, or address, of the proxy server 
+	        The hostname, or address, of the proxy server
 		</P>
 		<LI><P><B>http.proxyPort</B> (default: 80)<BR>
 	        The port number of the proxy server.</P>
@@ -94,7 +95,7 @@
 	<P>The following proxy settings are used by the HTTPS protocol handler.</P>
 	<UL>
 		<LI><P><B>https.proxyHost</B>(default: &lt;none&gt;)<BR>
-	        The hostname, or address, of the proxy server 
+	        The hostname, or address, of the proxy server
 		</P>
 		<LI><P><B>https.proxyPort</B> (default: 443)<BR>
 	        The port number of the proxy server.</P>
@@ -105,7 +106,7 @@
 	<P>The following proxy settings are used by the FTP protocol handler.</P>
 	<UL>
 		<LI><P><B>ftp.proxyHost</B>(default: &lt;none&gt;)<BR>
-	        The hostname, or address, of the proxy server 
+	        The hostname, or address, of the proxy server
 		</P>
 		<LI><P><B>ftp.proxyPort</B> (default: 80)<BR>
 	        The port number of the proxy server.</P>
@@ -160,7 +161,7 @@
 	<LI><P><B>http.agent</B> (default: &ldquo;Java/&lt;version&gt;&rdquo;)<BR>
 	Defines the string sent in the User-Agent request header in http
 	requests. Note that the string &ldquo;Java/&lt;version&gt;&rdquo; will
-	be appended to the one provided in the property (e.g. if 
+	be appended to the one provided in the property (e.g. if
 	-Dhttp.agent=&rdquo;foobar&rdquo; is used, the User-Agent header will
 	contain &ldquo;foobar Java/1.5.0&rdquo; if the version of the VM is
 	1.5.0). This property is checked only once at startup.</P>
--- a/jdk/src/java.base/share/classes/java/util/ImmutableCollections.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/ImmutableCollections.java	Thu May 26 17:19:13 2016 +0000
@@ -28,6 +28,7 @@
 import java.io.IOException;
 import java.io.InvalidObjectException;
 import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.io.ObjectStreamException;
 import java.io.Serializable;
 
@@ -607,7 +608,10 @@
 // ---------- Serialization Proxy ----------
 
 /**
- * Serialization proxy class for immutable collections.
+ * A unified serialization proxy class for the immutable collections.
+ *
+ * @serial
+ * @since 9
  */
 final class CollSer implements Serializable {
     private static final long serialVersionUID = 6309168927139932177L;
@@ -616,14 +620,114 @@
     static final int IMM_SET = 2;
     static final int IMM_MAP = 3;
 
-    private final int flags;
-    private final Object[] array;
+    /**
+     * Indicates the type of collection that is serialized.
+     * The low order 8 bits have the value 1 for an immutable
+     * {@code List}, 2 for an immutable {@code Set}, and 3 for
+     * an immutable {@code Map}. Any other value causes an
+     * {@link InvalidObjectException} to be thrown. The high
+     * order 24 bits are zero when an instance is serialized,
+     * and they are ignored when an instance is deserialized.
+     * They can thus be used by future implementations without
+     * causing compatibility issues.
+     *
+     * <p>The tag value also determines the interpretation of the
+     * transient {@code Object[] array} field.
+     * For {@code List} and {@code Set}, the array's length is the size
+     * of the collection, and the array contains the elements of the collection.
+     * Null elements are not allowed. For {@code Set}, duplicate elements
+     * are not allowed.
+     *
+     * <p>For {@code Map}, the array's length is twice the number of mappings
+     * present in the map. The array length is necessarily even.
+     * The array contains a succession of key and value pairs:
+     * {@code k1, v1, k2, v2, ..., kN, vN.} Nulls are not allowed,
+     * and duplicate keys are not allowed.
+     *
+     * @serial
+     * @since 9
+     */
+    private final int tag;
 
-    CollSer(int f, Object... a) {
-        flags = f;
+    /**
+     * @serial
+     * @since 9
+     */
+    private transient Object[] array;
+
+    CollSer(int t, Object... a) {
+        tag = t;
         array = a;
     }
 
+    /**
+     * Reads objects from the stream and stores them
+     * in the transient {@code Object[] array} field.
+     *
+     * @serialData
+     * A nonnegative int, indicating the count of objects,
+     * followed by that many objects.
+     *
+     * @param ois the ObjectInputStream from which data is read
+     * @throws IOException if an I/O error occurs
+     * @throws ClassNotFoundException if a serialized class cannot be loaded
+     * @throws InvalidObjectException if the count is negative
+     * @since 9
+     */
+    private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
+        ois.defaultReadObject();
+        int len = ois.readInt();
+
+        if (len < 0) {
+            throw new InvalidObjectException("negative length " + len);
+        }
+
+        Object[] a = new Object[len];
+        for (int i = 0; i < len; i++) {
+            a[i] = ois.readObject();
+        }
+
+        array = a;
+    }
+
+    /**
+     * Writes objects to the stream from
+     * the transient {@code Object[] array} field.
+     *
+     * @serialData
+     * A nonnegative int, indicating the count of objects,
+     * followed by that many objects.
+     *
+     * @param oos the ObjectOutputStream to which data is written
+     * @throws IOException if an I/O error occurs
+     * @since 9
+     */
+    private void writeObject(ObjectOutputStream oos) throws IOException {
+        oos.defaultWriteObject();
+        oos.writeInt(array.length);
+        for (int i = 0; i < array.length; i++) {
+            oos.writeObject(array[i]);
+        }
+    }
+
+    /**
+     * Creates and returns an immutable collection from this proxy class.
+     * The instance returned is created as if by calling one of the
+     * static factory methods for
+     * <a href="List.html#immutable">List</a>,
+     * <a href="Map.html#immutable">Map</a>, or
+     * <a href="Set.html#immutable">Set</a>.
+     * This proxy class is the serial form for all immutable collection instances,
+     * regardless of implementation type. This is necessary to ensure that the
+     * existence of any particular implementation type is kept out of the
+     * serialized form.
+     *
+     * @return a collection created from this proxy object
+     * @throws InvalidObjectException if the tag value is illegal or if an exception
+     *         is thrown during creation of the collection
+     * @throws ObjectStreamException if another serialization error has occurred
+     * @since 9
+     */
     private Object readResolve() throws ObjectStreamException {
         try {
             if (array == null) {
@@ -631,8 +735,8 @@
             }
 
             // use low order 8 bits to indicate "kind"
-            // ignore high order bits
-            switch (flags & 0xff) {
+            // ignore high order 24 bits
+            switch (tag & 0xff) {
                 case IMM_LIST:
                     return List.of(array);
                 case IMM_SET:
@@ -646,7 +750,7 @@
                         return new ImmutableCollections.MapN<>(array);
                     }
                 default:
-                    throw new InvalidObjectException(String.format("invalid flags 0x%x", flags));
+                    throw new InvalidObjectException(String.format("invalid flags 0x%x", tag));
             }
         } catch (NullPointerException|IllegalArgumentException ex) {
             InvalidObjectException ioe = new InvalidObjectException("invalid object");
--- a/jdk/src/java.base/share/classes/java/util/List.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/List.java	Thu May 26 17:19:13 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
@@ -107,6 +107,9 @@
  * Factories are free to create new instances or reuse existing ones. Therefore,
  * identity-sensitive operations on these instances (reference equality ({@code ==}),
  * identity hash code, and synchronization) are unreliable and should be avoided.
+ * <li>They are serialized as specified on the
+ * <a href="{@docRoot}/serialized-form.html#java.util.CollSer">Serialized Form</a>
+ * page.
  * </ul>
  *
  * <p>This interface is a member of the
--- a/jdk/src/java.base/share/classes/java/util/Map.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/Map.java	Thu May 26 17:19:13 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
@@ -133,6 +133,9 @@
  * Factories are free to create new instances or reuse existing ones. Therefore,
  * identity-sensitive operations on these instances (reference equality ({@code ==}),
  * identity hash code, and synchronization) are unreliable and should be avoided.
+ * <li>They are serialized as specified on the
+ * <a href="{@docRoot}/serialized-form.html#java.util.CollSer">Serialized Form</a>
+ * page.
  * </ul>
  *
  * <p>This interface is a member of the
--- a/jdk/src/java.base/share/classes/java/util/Set.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/Set.java	Thu May 26 17:19:13 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
@@ -84,6 +84,9 @@
  * Factories are free to create new instances or reuse existing ones. Therefore,
  * identity-sensitive operations on these instances (reference equality ({@code ==}),
  * identity hash code, and synchronization) are unreliable and should be avoided.
+ * <li>They are serialized as specified on the
+ * <a href="{@docRoot}/serialized-form.html#java.util.CollSer">Serialized Form</a>
+ * page.
  * </ul>
  *
  * <p>This interface is a member of the
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java	Thu May 26 17:19:13 2016 +0000
@@ -1242,7 +1242,8 @@
      */
     public KeySetView<K,V> keySet() {
         KeySetView<K,V> ks;
-        return (ks = keySet) != null ? ks : (keySet = new KeySetView<K,V>(this, null));
+        if ((ks = keySet) != null) return ks;
+        return keySet = new KeySetView<K,V>(this, null);
     }
 
     /**
@@ -1265,7 +1266,8 @@
      */
     public Collection<V> values() {
         ValuesView<K,V> vs;
-        return (vs = values) != null ? vs : (values = new ValuesView<K,V>(this));
+        if ((vs = values) != null) return vs;
+        return values = new ValuesView<K,V>(this);
     }
 
     /**
@@ -1287,7 +1289,8 @@
      */
     public Set<Map.Entry<K,V>> entrySet() {
         EntrySetView<K,V> es;
-        return (es = entrySet) != null ? es : (entrySet = new EntrySetView<K,V>(this));
+        if ((es = entrySet) != null) return es;
+        return entrySet = new EntrySetView<K,V>(this);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java	Thu May 26 17:19:13 2016 +0000
@@ -376,12 +376,12 @@
 
     /** Lazily initialized key set */
     private transient KeySet<K,V> keySet;
+    /** Lazily initialized values collection */
+    private transient Values<K,V> values;
     /** Lazily initialized entry set */
     private transient EntrySet<K,V> entrySet;
-    /** Lazily initialized values collection */
-    private transient Values<K,V> values;
     /** Lazily initialized descending key set */
-    private transient ConcurrentNavigableMap<K,V> descendingMap;
+    private transient SubMap<K,V> descendingMap;
 
     /**
      * Initializes or resets state. Needed by constructors, clone,
@@ -1827,13 +1827,15 @@
      * @return a navigable set view of the keys in this map
      */
     public NavigableSet<K> keySet() {
-        KeySet<K,V> ks = keySet;
-        return (ks != null) ? ks : (keySet = new KeySet<>(this));
+        KeySet<K,V> ks;
+        if ((ks = keySet) != null) return ks;
+        return keySet = new KeySet<>(this);
     }
 
     public NavigableSet<K> navigableKeySet() {
-        KeySet<K,V> ks = keySet;
-        return (ks != null) ? ks : (keySet = new KeySet<>(this));
+        KeySet<K,V> ks;
+        if ((ks = keySet) != null) return ks;
+        return keySet = new KeySet<>(this);
     }
 
     /**
@@ -1856,8 +1858,9 @@
      * <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
      */
     public Collection<V> values() {
-        Values<K,V> vs = values;
-        return (vs != null) ? vs : (values = new Values<>(this));
+        Values<K,V> vs;
+        if ((vs = values) != null) return vs;
+        return values = new Values<>(this);
     }
 
     /**
@@ -1888,14 +1891,16 @@
      *         sorted in ascending key order
      */
     public Set<Map.Entry<K,V>> entrySet() {
-        EntrySet<K,V> es = entrySet;
-        return (es != null) ? es : (entrySet = new EntrySet<K,V>(this));
+        EntrySet<K,V> es;
+        if ((es = entrySet) != null) return es;
+        return entrySet = new EntrySet<K,V>(this);
     }
 
     public ConcurrentNavigableMap<K,V> descendingMap() {
-        ConcurrentNavigableMap<K,V> dm = descendingMap;
-        return (dm != null) ? dm : (descendingMap = new SubMap<K,V>
-                                    (this, null, false, null, false, true));
+        ConcurrentNavigableMap<K,V> dm;
+        if ((dm = descendingMap) != null) return dm;
+        return descendingMap =
+            new SubMap<K,V>(this, null, false, null, false, true);
     }
 
     public NavigableSet<K> descendingKeySet() {
@@ -2564,7 +2569,7 @@
      * @serial include
      */
     static final class SubMap<K,V> extends AbstractMap<K,V>
-        implements ConcurrentNavigableMap<K,V>, Cloneable, Serializable {
+        implements ConcurrentNavigableMap<K,V>, Serializable {
         private static final long serialVersionUID = -7647078645895051609L;
 
         /** Underlying map */
@@ -2582,8 +2587,8 @@
 
         // Lazily initialized view holders
         private transient KeySet<K,V> keySetView;
-        private transient Set<Map.Entry<K,V>> entrySetView;
-        private transient Collection<V> valuesView;
+        private transient Values<K,V> valuesView;
+        private transient EntrySet<K,V> entrySetView;
 
         /**
          * Creates a new submap, initializing all fields.
@@ -3049,23 +3054,27 @@
         /* ---------------- Submap Views -------------- */
 
         public NavigableSet<K> keySet() {
-            KeySet<K,V> ks = keySetView;
-            return (ks != null) ? ks : (keySetView = new KeySet<>(this));
+            KeySet<K,V> ks;
+            if ((ks = keySetView) != null) return ks;
+            return keySetView = new KeySet<>(this);
         }
 
         public NavigableSet<K> navigableKeySet() {
-            KeySet<K,V> ks = keySetView;
-            return (ks != null) ? ks : (keySetView = new KeySet<>(this));
+            KeySet<K,V> ks;
+            if ((ks = keySetView) != null) return ks;
+            return keySetView = new KeySet<>(this);
         }
 
         public Collection<V> values() {
-            Collection<V> vs = valuesView;
-            return (vs != null) ? vs : (valuesView = new Values<>(this));
+            Values<K,V> vs;
+            if ((vs = valuesView) != null) return vs;
+            return valuesView = new Values<>(this);
         }
 
         public Set<Map.Entry<K,V>> entrySet() {
-            Set<Map.Entry<K,V>> es = entrySetView;
-            return (es != null) ? es : (entrySetView = new EntrySet<K,V>(this));
+            EntrySet<K,V> es;
+            if ((es = entrySetView) != null) return es;
+            return entrySetView = new EntrySet<K,V>(this);
         }
 
         public NavigableSet<K> descendingKeySet() {
--- a/jdk/src/java.base/share/classes/java/util/concurrent/CountedCompleter.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/CountedCompleter.java	Thu May 26 17:19:13 2016 +0000
@@ -596,7 +596,7 @@
      * not, be invoked for each completer in a computation.
      */
     public final void propagateCompletion() {
-        CountedCompleter<?> a = this, s = a;
+        CountedCompleter<?> a = this, s;
         for (int c;;) {
             if ((c = a.pending) == 0) {
                 if ((a = (s = a).completer) == null) {
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ExecutorCompletionService.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ExecutorCompletionService.java	Thu May 26 17:19:13 2016 +0000
@@ -56,13 +56,11 @@
  * void solve(Executor e,
  *            Collection<Callable<Result>> solvers)
  *     throws InterruptedException, ExecutionException {
- *   CompletionService<Result> ecs
- *       = new ExecutorCompletionService<Result>(e);
- *   for (Callable<Result> s : solvers)
- *     ecs.submit(s);
- *   int n = solvers.size();
- *   for (int i = 0; i < n; ++i) {
- *     Result r = ecs.take().get();
+ *   CompletionService<Result> cs
+ *       = new ExecutorCompletionService<>(e);
+ *   solvers.forEach(cs::submit);
+ *   for (int i = solvers.size(); i > 0; i--) {
+ *     Result r = cs.take().get();
  *     if (r != null)
  *       use(r);
  *   }
@@ -76,27 +74,24 @@
  * void solve(Executor e,
  *            Collection<Callable<Result>> solvers)
  *     throws InterruptedException {
- *   CompletionService<Result> ecs
- *       = new ExecutorCompletionService<Result>(e);
+ *   CompletionService<Result> cs
+ *       = new ExecutorCompletionService<>(e);
  *   int n = solvers.size();
  *   List<Future<Result>> futures = new ArrayList<>(n);
  *   Result result = null;
  *   try {
- *     for (Callable<Result> s : solvers)
- *       futures.add(ecs.submit(s));
- *     for (int i = 0; i < n; ++i) {
+ *     solvers.forEach((solver) -> futures.add(cs.submit(solver)));
+ *     for (int i = n; i > 0; i--) {
  *       try {
- *         Result r = ecs.take().get();
+ *         Result r = cs.take().get();
  *         if (r != null) {
  *           result = r;
  *           break;
  *         }
  *       } catch (ExecutionException ignore) {}
  *     }
- *   }
- *   finally {
- *     for (Future<Result> f : futures)
- *       f.cancel(true);
+ *   } finally {
+ *     futures.forEach((future) -> future.cancel(true));
  *   }
  *
  *   if (result != null)
--- a/jdk/src/java.base/share/classes/java/util/concurrent/Phaser.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/Phaser.java	Thu May 26 17:19:13 2016 +0000
@@ -348,10 +348,6 @@
     private final AtomicReference<QNode> evenQ;
     private final AtomicReference<QNode> oddQ;
 
-    private AtomicReference<QNode> queueFor(int phase) {
-        return ((phase & 1) == 0) ? evenQ : oddQ;
-    }
-
     /**
      * Returns message string for bounds exceptions on arrival.
      */
--- a/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java	Thu May 26 17:19:13 2016 +0000
@@ -72,8 +72,8 @@
  * loader. This allows automatic modules (for example) to link to types in the
  * unnamed module of the parent class loader.
  *
- * @see Layer#createWithOneLoader
- * @see Layer#createWithManyLoaders
+ * @see Layer#defineModulesWithOneLoader
+ * @see Layer#defineModulesWithManyLoaders
  */
 
 public final class Loader extends SecureClassLoader {
@@ -315,6 +315,8 @@
                 }, acc);
         } catch (PrivilegedActionException pae) {
             throw (IOException) pae.getCause();
+        } catch (SecurityException se) {
+            return null;
         }
     }
 
--- a/jdk/src/java.base/share/native/libnet/InetAddress.c	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/share/native/libnet/InetAddress.c	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,7 +61,7 @@
         CHECK_NULL(iac_class);
         ia_holderID = (*env)->GetFieldID(env, ia_class, "holder", "Ljava/net/InetAddress$InetAddressHolder;");
         CHECK_NULL(ia_holderID);
-        ia_preferIPv6AddressID = (*env)->GetStaticFieldID(env, ia_class, "preferIPv6Address", "Z");
+        ia_preferIPv6AddressID = (*env)->GetStaticFieldID(env, ia_class, "preferIPv6Address", "I");
         CHECK_NULL(ia_preferIPv6AddressID);
 
         iac_addressID = (*env)->GetFieldID(env, iac_class, "address", "I");
--- a/jdk/src/java.base/unix/native/libnet/Inet6AddressImpl.c	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/unix/native/libnet/Inet6AddressImpl.c	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,6 +48,7 @@
 
 #include "java_net_Inet4AddressImpl.h"
 #include "java_net_Inet6AddressImpl.h"
+#include "java_net_InetAddress.h"
 
 /* the initial size of our hostent buffers */
 #ifndef NI_MAXHOST
@@ -157,7 +158,10 @@
     }
 
     name = (*env)->NewStringUTF(env, hostname);
-    CHECK_NULL_RETURN(name, NULL);
+    if (name == NULL) {
+        freeifaddrs(ifa);
+        return NULL;
+    }
 
     /* Iterate over the interfaces, and total up the number of IPv4 and IPv6
      * addresses we have. Also keep a count of loopback addresses. We need to
@@ -312,8 +316,8 @@
         JNU_ReleaseStringPlatformChars(env, host, hostname);
         return NULL;
     } else {
-        int i = 0;
-        int inetCount = 0, inet6Count = 0, inetIndex, inet6Index;
+        int i = 0, addressPreference = -1;
+        int inetCount = 0, inet6Count = 0, inetIndex = 0, inet6Index = 0, originalIndex = 0;
         struct addrinfo *itr, *last = NULL, *iterator = res;
         while (iterator != NULL) {
             int skip = 0;
@@ -394,14 +398,18 @@
             goto cleanupAndReturn;
         }
 
-        if ((*env)->GetStaticBooleanField(env, ia_class, ia_preferIPv6AddressID)) {
+        addressPreference = (*env)->GetStaticIntField(env, ia_class, ia_preferIPv6AddressID);
+
+        if (addressPreference == java_net_InetAddress_PREFER_IPV6_VALUE) {
             /* AF_INET addresses will be offset by inet6Count */
             inetIndex = inet6Count;
             inet6Index = 0;
-        } else {
+        } else if (addressPreference == java_net_InetAddress_PREFER_IPV4_VALUE) {
             /* AF_INET6 addresses will be offset by inetCount */
             inetIndex = 0;
             inet6Index = inetCount;
+        } else if (addressPreference == java_net_InetAddress_PREFER_SYSTEM_VALUE) {
+            inetIndex = inet6Index = originalIndex = 0;
         }
 
         while (iterator != NULL) {
@@ -414,7 +422,7 @@
                 }
                 setInetAddress_addr(env, iaObj, ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
                 setInetAddress_hostName(env, iaObj, host);
-                (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj);
+                (*env)->SetObjectArrayElement(env, ret, (inetIndex | originalIndex), iaObj);
                 inetIndex++;
             } else if (iterator->ai_family == AF_INET6) {
                 jint scope = 0;
@@ -435,9 +443,13 @@
                     setInet6Address_scopeid(env, iaObj, scope);
                 }
                 setInetAddress_hostName(env, iaObj, host);
-                (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj);
+                (*env)->SetObjectArrayElement(env, ret, (inet6Index | originalIndex), iaObj);
                 inet6Index++;
             }
+            if (addressPreference == java_net_InetAddress_PREFER_SYSTEM_VALUE) {
+                originalIndex++;
+                inetIndex = inet6Index = 0;
+            }
             iterator = iterator->ai_next;
         }
     }
--- a/jdk/src/java.base/unix/native/libnet/NetworkInterface.c	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/unix/native/libnet/NetworkInterface.c	Thu May 26 17:19:13 2016 +0000
@@ -243,6 +243,7 @@
     if (name_utf == NULL) {
        if (!(*env)->ExceptionCheck(env))
            JNU_ThrowOutOfMemoryError(env, NULL);
+       freeif(ifs);
        return NULL;
     }
 
@@ -519,7 +520,7 @@
     }
     if ((sock = openSocketWithFallback(env, name_utf)) < 0) {
        (*env)->ReleaseStringUTFChars(env, name, name_utf);
-       return JNI_FALSE;
+       return NULL;
     }
 
     if (!IS_NULL(addrArray)) {
@@ -664,7 +665,7 @@
     }
 
     // Create the array of InetAddresses
-    addrArr = (*env)->NewObjectArray(env, addr_count,  ia_class, NULL);
+    addrArr = (*env)->NewObjectArray(env, addr_count, ia_class, NULL);
     if (addrArr == NULL) {
         return NULL;
     }
@@ -1829,7 +1830,7 @@
     strncpy(if2.lifr_name, ifname, sizeof(if2.lifr_name) - 1);
 
     if (ioctl(sock, SIOCGLIFFLAGS, (char *)&if2) < 0) {
-         return -1;
+        return -1;
     }
 
     *flags = if2.lifr_flags;
@@ -1859,8 +1860,7 @@
                                               "IPV6 Socket creation failed");
                  return -1;
               }
-         }
-         else{ // errno is not NOSUPPORT
+         } else { // errno is not NOSUPPORT
              NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
                                           "IPV4 Socket creation failed");
              return -1;
--- a/jdk/src/java.base/unix/native/libnet/net_util_md.c	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/unix/native/libnet/net_util_md.c	Thu May 26 17:19:13 2016 +0000
@@ -95,8 +95,8 @@
         CHECK_NULL(c);
         c = (*env)->NewGlobalRef(env, c);
         CHECK_NULL(c);
-        ni_defaultIndexID = (*env)->GetStaticFieldID(
-            env, c, "defaultIndex", "I");
+        ni_defaultIndexID = (*env)->GetStaticFieldID(env, c, "defaultIndex", "I");
+        CHECK_NULL(ni_defaultIndexID);
         ni_class = c;
     }
     int defaultIndex;
@@ -118,8 +118,8 @@
         CHECK_NULL_RETURN(c, 0);
         c = (*env)->NewGlobalRef(env, c);
         CHECK_NULL_RETURN(c, 0);
-        ni_defaultIndexID = (*env)->GetStaticFieldID(env, c,
-                                                     "defaultIndex", "I");
+        ni_defaultIndexID = (*env)->GetStaticFieldID(env, c, "defaultIndex", "I");
+        CHECK_NULL_RETURN(ni_defaultIndexID, 0);
         ni_class = c;
     }
     defaultIndex = (*env)->GetStaticIntField(env, ni_class,
--- a/jdk/src/java.base/windows/native/libnet/Inet6AddressImpl.c	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/java.base/windows/native/libnet/Inet6AddressImpl.c	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -97,7 +97,7 @@
 
     /* get the address preference */
     preferIPv6Address
-        = (*env)->GetStaticBooleanField(env, ia_class, ia_preferIPv6AddressID);
+        = (*env)->GetStaticIntField(env, ia_class, ia_preferIPv6AddressID);
 
     /* Try once, with our static buffer. */
     memset(&hints, 0, sizeof(hints));
@@ -122,7 +122,7 @@
         }
     } else {
         int i = 0;
-        int inetCount = 0, inet6Count = 0, inetIndex, inet6Index;
+        int inetCount = 0, inet6Count = 0, inetIndex = 0, inet6Index = 0, originalIndex = 0;
         struct addrinfo *itr, *last, *iterator = res;
         while (iterator != NULL) {
             int skip = 0;
@@ -203,12 +203,14 @@
             goto cleanupAndReturn;
         }
 
-        if (preferIPv6Address) {
+        if (preferIPv6Address == java_net_InetAddress_PREFER_IPV6_VALUE) {
             inetIndex = inet6Count;
             inet6Index = 0;
-        } else {
+        } else if (preferIPv6Address == java_net_InetAddress_PREFER_IPV4_VALUE) {
             inetIndex = 0;
             inet6Index = inetCount;
+        } else if (preferIPv6Address == java_net_InetAddress_PREFER_SYSTEM_VALUE) {
+            inetIndex = inet6Index = originalIndex = 0;
         }
 
         while (iterator != NULL) {
@@ -220,7 +222,7 @@
               }
               setInetAddress_addr(env, iaObj, ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
               setInetAddress_hostName(env, iaObj, host);
-              (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj);
+              (*env)->SetObjectArrayElement(env, ret, (inetIndex | originalIndex), iaObj);
                 inetIndex ++;
             } else if (iterator->ai_family == AF_INET6) {
               jint scope = 0;
@@ -240,9 +242,13 @@
                 setInet6Address_scopeid(env, iaObj, scope);
               }
               setInetAddress_hostName(env, iaObj, host);
-              (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj);
+              (*env)->SetObjectArrayElement(env, ret, (inet6Index | originalIndex), iaObj);
               inet6Index ++;
             }
+            if (preferIPv6Address == java_net_InetAddress_PREFER_SYSTEM_VALUE) {
+                originalIndex++;
+                inetIndex = inet6Index = 0;
+            }
             iterator = iterator->ai_next;
         }
     }
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ModuleEntry.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ModuleEntry.java	Thu May 26 17:19:13 2016 +0000
@@ -40,7 +40,7 @@
  * <li>For jimage content: /{module name}/{package1}/.../{packageN}/{file
  * name}</li>
  * <li>For other files (shared lib, launchers, config, ...):/{module name}/
- * {@literal bin|conf|native}/{dir1}>/.../{dirN}/{file name}</li>
+ * {@literal bin|conf|native}/{dir1}/.../{dirN}/{file name}</li>
  * </ul>
  */
 public interface ModuleEntry {
--- a/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java	Thu May 26 17:19:13 2016 +0000
@@ -296,45 +296,6 @@
         theInternalUnsafe.putDouble(o, offset, x);
     }
 
-
-    // These read VM internal data.
-
-    /**
-     * Fetches an uncompressed reference value from a given native variable
-     * ignoring the VM's compressed references mode.
-     *
-     * @param address a memory address locating the variable
-     * @return the value fetched from the indicated native variable
-     */
-    @ForceInline
-    public Object getUncompressedObject(long address) {
-        return theInternalUnsafe.getUncompressedObject(address);
-    }
-
-    /**
-     * Fetches the {@link java.lang.Class} Java mirror for the given native
-     * metaspace {@code Klass} pointer.
-     *
-     * @param metaspaceKlass a native metaspace {@code Klass} pointer
-     * @return the {@link java.lang.Class} Java mirror
-     */
-    @ForceInline
-    public Class<?> getJavaMirror(long metaspaceKlass) {
-        return theInternalUnsafe.getJavaMirror(metaspaceKlass);
-    }
-
-    /**
-     * Fetches a native metaspace {@code Klass} pointer for the given Java
-     * object.
-     *
-     * @param o Java heap object for which to fetch the class pointer
-     * @return a native metaspace {@code Klass} pointer
-     */
-    @ForceInline
-    public long getKlassPointer(Object o) {
-        return theInternalUnsafe.getKlassPointer(o);
-    }
-
     // These work on values in the C heap.
 
     /**
--- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java	Thu May 26 17:19:13 2016 +0000
@@ -376,12 +376,17 @@
             // count names
             count = 0;
             index = 0;
-            while (index < path.length) {
-                byte c = path[index++];
-                if (c != '/') {
-                    count++;
-                    while (index < path.length && path[index] != '/')
-                        index++;
+            if (path.length == 0) {
+                // empty path has one name
+                count = 1;
+            } else {
+                while (index < path.length) {
+                    byte c = path[index++];
+                    if (c != '/') {
+                        count++;
+                        while (index < path.length && path[index] != '/')
+                             index++;
+                    }
                 }
             }
             // populate offsets
@@ -423,10 +428,11 @@
     // removes redundant slashs, replace "\" to zip separator "/"
     // and check for invalid characters
     private byte[] normalize(byte[] path) {
-        if (path.length == 0)
+        int len = path.length;
+        if (len == 0)
             return path;
         byte prevC = 0;
-        for (int i = 0; i < path.length; i++) {
+        for (int i = 0; i < len; i++) {
             byte c = path[i];
             if (c == '\\' || c == '\u0000')
                 return normalize(path, i);
@@ -434,6 +440,8 @@
                 return normalize(path, i - 1);
             prevC = c;
         }
+        if (len > 1 && prevC == '/')
+            return Arrays.copyOf(path, len - 1);
         return path;
     }
 
@@ -567,7 +575,8 @@
         if (watcher == null || events == null || modifiers == null) {
             throw new NullPointerException();
         }
-        throw new UnsupportedOperationException();
+        // watcher must be associated with a different provider
+        throw new ProviderMismatchException();
     }
 
     @Override
--- a/jdk/test/ProblemList.txt	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/ProblemList.txt	Thu May 26 17:19:13 2016 +0000
@@ -195,8 +195,6 @@
 
 java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java       7191877 generic-all
 
-sun/rmi/transport/proxy/EagerHttpFallback.java                  7195095 generic-all
-
 java/rmi/activation/Activatable/extLoadedImpl/ext.sh            8062724 generic-all
 
 sun/rmi/rmic/newrmic/equivalence/run.sh                         8145980 generic-all
@@ -288,8 +286,6 @@
 
 sun/security/tools/keytool/autotest.sh                          8130302 generic-all
 
-sun/security/provider/NSASuiteB/TestDSAGenParameterSpec.java    8137255 generic-all
-
 sun/security/x509/URICertStore/ExtensionsWithLDAP.java          8134577 generic-all
 
 sun/security/provider/SecureRandom/StrongSecureRandom.java      8157387 linux-all
@@ -394,7 +390,5 @@
 
 # core_tools
 
-tools/jimage/JImageTest.java                                    8150975 linux-i586,windows-i586
-
 ############################################################################
 
--- a/jdk/test/com/sun/jarsigner/DefaultMethod.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/com/sun/jarsigner/DefaultMethod.java	Thu May 26 17:19:13 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
@@ -25,6 +25,7 @@
  * @test
  * @bug 8039358
  * @summary com.sun.jarsigner.ContentSignerParameters.getTSAPolicyID() should be default
+ * @modules jdk.jartool
  * @compile DefaultMethod.java
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/net/httpserver/TEST.properties	Thu May 26 17:19:13 2016 +0000
@@ -0,0 +1,1 @@
+modules = jdk.httpserver
\ No newline at end of file
--- a/jdk/test/java/lang/StackWalker/VerifyStackTrace.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/java/lang/StackWalker/VerifyStackTrace.java	Thu May 26 17:19:13 2016 +0000
@@ -202,7 +202,7 @@
             // synthetic frames introduced by lambdas & method handles
             return produced.replaceAll(":[1-9][0-9]*\\)", ":00)")
                     .replaceAll("-internal/", "/").replaceAll("-ea/", "/")
-                    .replaceAll("java.base@[0-9]+/", "java.base/")
+                    .replaceAll("java.base@(\\d+\\.){0,3}(\\d+)/", "java.base/")
                     .replaceAll("/[0-9]+\\.run", "/xxxxxxxx.run")
                     .replaceAll("/[0-9]+\\.invoke", "/xxxxxxxx.invoke")
                     .replaceAll("\\$[0-9]+", "\\$??");
--- a/jdk/test/java/lang/module/ModuleReader/ModuleReaderTest.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/java/lang/module/ModuleReader/ModuleReaderTest.java	Thu May 26 17:19:13 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
@@ -38,6 +38,7 @@
 import java.lang.module.ModuleFinder;
 import java.lang.module.ModuleReader;
 import java.lang.module.ModuleReference;
+import java.lang.reflect.Module;
 import java.net.URI;
 import java.net.URL;
 import java.net.URLConnection;
@@ -64,16 +65,24 @@
     private static final Path SRC_DIR    = Paths.get(TEST_SRC, "src");
     private static final Path MODS_DIR   = Paths.get("mods");
 
+    // the module name of the base module
+    private static final String BASE_MODULE = "java.base";
+
     // the module name of the test module
     private static final String TEST_MODULE = "m";
 
+    // resources in the base module
+    private static final String[] BASE_RESOURCES = {
+        "java/lang/Object.class"
+    };
+
     // resources in test module (can't use module-info.class as a test
     // resource as it will be modified by the jmod tool)
-    private static final String[] RESOURCES = {
+    private static final String[] TEST_RESOURCES = {
         "p/Main.class"
     };
 
-    // a resource that is not in the test module
+    // a resource that is not in the base or test module
     private static final String NOT_A_RESOURCE = "NotAResource";
 
 
@@ -89,7 +98,74 @@
 
 
     /**
-     * Test exploded module
+     * Test ModuleReader to module in runtime image
+     */
+    public void testImage() throws Exception {
+
+        ModuleFinder finder = ModuleFinder.ofSystem();
+        ModuleReference mref = finder.find(BASE_MODULE).get();
+        ModuleReader reader = mref.open();
+
+        try (reader) {
+
+            for (String name : BASE_RESOURCES) {
+                byte[] expectedBytes;
+                Module baseModule = Object.class.getModule();
+                try (InputStream in = baseModule.getResourceAsStream(name)) {
+                    expectedBytes = in.readAllBytes();
+                }
+
+                testFind(reader, name, expectedBytes);
+                testOpen(reader, name, expectedBytes);
+                testRead(reader, name, expectedBytes);
+
+            }
+
+            // test "not found"
+            assertFalse(reader.find(NOT_A_RESOURCE).isPresent());
+            assertFalse(reader.open(NOT_A_RESOURCE).isPresent());
+            assertFalse(reader.read(NOT_A_RESOURCE).isPresent());
+
+
+            // test nulls
+            try {
+                reader.find(null);
+                assertTrue(false);
+            } catch (NullPointerException expected) { }
+
+            try {
+                reader.open(null);
+                assertTrue(false);
+            } catch (NullPointerException expected) { }
+
+            try {
+                reader.read(null);
+                assertTrue(false);
+            } catch (NullPointerException expected) { }
+
+            try {
+                reader.release(null);
+                assertTrue(false);
+            } catch (NullPointerException expected) { }
+
+        }
+
+        // test closed ModuleReader
+        try {
+            reader.open(BASE_RESOURCES[0]);
+            assertTrue(false);
+        } catch (IOException expected) { }
+
+
+        try {
+            reader.read(BASE_RESOURCES[0]);
+            assertTrue(false);
+        } catch (IOException expected) { }
+    }
+
+
+    /**
+     * Test ModuleReader to exploded module
      */
     public void testExplodedModule() throws Exception {
         test(MODS_DIR);
@@ -97,7 +173,7 @@
 
 
     /**
-     * Test modular JAR
+     * Test ModuleReader to modular JAR
      */
     public void testModularJar() throws Exception {
         Path dir = Files.createTempDirectory(USER_DIR, "mlib");
@@ -111,7 +187,7 @@
 
 
     /**
-     * Test JMOD
+     * Test ModuleReader to JMOD
      */
     public void testJMod() throws Exception {
         Path dir = Files.createTempDirectory(USER_DIR, "mlib");
@@ -145,7 +221,7 @@
         try (reader) {
 
             // test each of the known resources in the module
-            for (String name : RESOURCES) {
+            for (String name : TEST_RESOURCES) {
                 byte[] expectedBytes
                     = Files.readAllBytes(MODS_DIR
                         .resolve(TEST_MODULE)
@@ -157,6 +233,7 @@
             }
 
             // test "not found"
+            assertFalse(reader.find(NOT_A_RESOURCE).isPresent());
             assertFalse(reader.open(NOT_A_RESOURCE).isPresent());
             assertFalse(reader.read(NOT_A_RESOURCE).isPresent());
 
@@ -176,19 +253,22 @@
                 assertTrue(false);
             } catch (NullPointerException expected) { }
 
-            // should release(null) throw NPE?
+            try {
+                reader.release(null);
+                throw new RuntimeException();
+            } catch (NullPointerException expected) { }
 
         }
 
         // test closed ModuleReader
         try {
-            reader.open(RESOURCES[0]);
+            reader.open(TEST_RESOURCES[0]);
             assertTrue(false);
         } catch (IOException expected) { }
 
 
         try {
-            reader.read(RESOURCES[0]);
+            reader.read(TEST_RESOURCES[0]);
             assertTrue(false);
         } catch (IOException expected) { }
     }
--- a/jdk/test/java/lang/reflect/Layer/BasicLayerTest.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/java/lang/reflect/Layer/BasicLayerTest.java	Thu May 26 17:19:13 2016 +0000
@@ -103,7 +103,7 @@
 
 
     /**
-     * Exercise Layer.create, created on an empty layer
+     * Exercise Layer defineModules, created with empty layer as parent
      */
     public void testLayerOnEmpty() {
         ModuleDescriptor descriptor1
@@ -184,7 +184,7 @@
 
 
     /**
-     * Exercise Layer.create, created over the boot layer
+     * Exercise Layer defineModules, created with boot layer as parent
      */
     public void testLayerOnBoot() {
         ModuleDescriptor descriptor1
@@ -247,8 +247,8 @@
 
 
     /**
-     * Layer.create with a configuration of two modules that have the same
-     * module-private package.
+     * Exercise Layer defineModules with a configuration of two modules that
+     * have the same module-private package.
      */
     public void testSameConcealedPackage() {
         ModuleDescriptor descriptor1
@@ -281,8 +281,8 @@
 
 
     /**
-     * Layer.create with a configuration with a partitioned graph. The same
-     * package is exported in both partitions.
+     * Exercise Layer defineModules with a configuration that is a partitioned
+     * graph. The same package is exported in both partitions.
      */
     public void testSameExportInPartitionedGraph() {
 
@@ -338,9 +338,9 @@
 
 
     /**
-     * Layer.create with a configuration that contains a module that has a
-     * concealed package that is the same name as a non-exported package
-     * in a parent layer.
+     * Exercise Layer defineModules with a configuration that contains a module
+     * that has a concealed package that is the same name as a non-exported
+     * package in a parent layer.
      */
     public void testConcealSamePackageAsBootLayer() {
 
@@ -667,9 +667,9 @@
 
 
     /**
-     * Attempt to use Layer.create to create a layer with a module defined to a
-     * class loader that already has a module of the same name defined to the
-     * class loader.
+     * Attempt to use Layer defineModules to create a layer with a module
+     * defined to a class loader that already has a module of the same name
+     * defined to the class loader.
      */
     @Test(expectedExceptions = { LayerInstantiationException.class })
     public void testModuleAlreadyDefinedToLoader() {
@@ -696,9 +696,9 @@
 
 
     /**
-     * Attempt to use Layer.create to create a Layer with a module containing
-     * package {@code p} where the class loader already has a module defined
-     * to it containing package {@code p}.
+     * Attempt to use Layer defineModules to create a Layer with a module
+     * containing package {@code p} where the class loader already has a module
+     * defined to it containing package {@code p}.
      */
     @Test(expectedExceptions = { LayerInstantiationException.class })
     public void testPackageAlreadyInNamedModule() {
@@ -738,8 +738,9 @@
 
 
     /**
-     * Attempt to use Layer.create to create a Layer with a module containing
-     * a package in which a type is already loaded by the class loader.
+     * Attempt to use Layer defineModules to create a Layer with a module
+     * containing a package in which a type is already loaded by the class
+     * loader.
      */
     @Test(expectedExceptions = { LayerInstantiationException.class })
     public void testPackageAlreadyInUnnamedModule() throws Exception {
@@ -763,6 +764,46 @@
 
 
     /**
+     * Attempt to create a Layer with a module named "java.base".
+     */
+    public void testLayerWithJavaBase() {
+        ModuleDescriptor descriptor
+            = new ModuleDescriptor.Builder("java.base")
+                .exports("java.lang")
+                .build();
+
+        ModuleFinder finder = ModuleUtils.finderOf(descriptor);
+
+        Configuration cf = Layer.boot()
+            .configuration()
+            .resolveRequires(finder, ModuleFinder.of(), Set.of("java.base"));
+        assertTrue(cf.modules().size() == 1);
+
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+
+        try {
+            Layer.boot().defineModules(cf, loader -> null );
+            assertTrue(false);
+        } catch (LayerInstantiationException e) { }
+
+        try {
+            Layer.boot().defineModules(cf, loader -> new ClassLoader() { });
+            assertTrue(false);
+        } catch (LayerInstantiationException e) { }
+
+        try {
+            Layer.boot().defineModulesWithOneLoader(cf, scl);
+            assertTrue(false);
+        } catch (LayerInstantiationException e) { }
+
+        try {
+            Layer.boot().defineModulesWithManyLoaders(cf, scl);
+            assertTrue(false);
+        } catch (LayerInstantiationException e) { }
+    }
+
+
+    /**
      * Parent of configuration != configuration of parent Layer
      */
     @Test(expectedExceptions = { IllegalArgumentException.class })
@@ -812,7 +853,6 @@
 
     @Test(expectedExceptions = { NullPointerException.class })
     public void testCreateWithNull2() {
-        ClassLoader loader = new ClassLoader() { };
         Configuration cf = resolveRequires(Layer.boot().configuration(), ModuleFinder.of());
         Layer.boot().defineModules(cf, null);
     }
--- a/jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java	Thu May 26 17:19:13 2016 +0000
@@ -70,7 +70,7 @@
 
 
     /**
-     * Basic test of Layer.defineModulesWithOneLoader
+     * Basic test of Layer defineModulesWithOneLoader
      *
      * Test scenario:
      *   m1 requires m2 and m3
@@ -99,7 +99,7 @@
 
 
     /**
-     * Basic test of Layer.defineModulesWithManyLoaders
+     * Basic test of Layer defineModulesWithManyLoaders
      *
      * Test scenario:
      *   m1 requires m2 and m3
@@ -131,7 +131,7 @@
 
 
     /**
-     * Basic test of Layer.defineModulesWithOneLoader where one of the modules
+     * Basic test of Layer defineModulesWithOneLoader where one of the modules
      * is a service provider module.
      *
      * Test scenario:
@@ -172,8 +172,8 @@
 
 
     /**
-     * Basic test of Layer.defineModulesWithManyLoaders where one of the modules
-     * is a service provider module.
+     * Basic test of Layer defineModulesWithManyLoaders where one of the
+     * modules is a service provider module.
      *
      * Test scenario:
      *    m1 requires m2 and m3
@@ -224,7 +224,7 @@
 
 
     /**
-     * Tests that the class loaders created by Layer.createWithXXX delegate
+     * Tests that the class loaders created by defineModulesWithXXX delegate
      * to the given parent class loader.
      */
     public void testDelegationToParent() throws Exception {
@@ -254,7 +254,7 @@
 
 
     /**
-     * Test Layer.createWithXXX when modules that have overlapping packages.
+     * Test defineModulesWithXXX when modules that have overlapping packages.
      *
      * Test scenario:
      *   m1 exports p
@@ -288,7 +288,7 @@
 
 
     /**
-     * Test Layer.createWithXXX with split delegation.
+     * Test Layer defineModulesWithXXX with split delegation.
      *
      * Test scenario:
      *   layer1: m1 exports p, m2 exports p
@@ -319,7 +319,8 @@
 
         ModuleFinder finder2 = ModuleUtils.finderOf(descriptor3, descriptor4);
 
-        Configuration cf2 = cf1.resolveRequires(finder2, ModuleFinder.of(), Set.of("m3", "m4"));
+        Configuration cf2 = cf1.resolveRequires(finder2, ModuleFinder.of(),
+                                                Set.of("m3", "m4"));
 
         // package p cannot be supplied by two class loaders
         try {
@@ -335,8 +336,8 @@
 
 
     /**
-     * Test Layer.createWithXXX when the modules that override same named
-     * modules in the parent layer.
+     * Test Layer defineModulesWithXXX when the modules that override same
+     * named modules in the parent layer.
      *
      * Test scenario:
      *   layer1: m1, m2, m3 => same loader
@@ -350,7 +351,8 @@
         checkLayer(layer1, "m1", "m2", "m3");
 
         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(),
+                                                Set.of("m1"));
 
         Layer layer2 = layer1.defineModulesWithOneLoader(cf2, null);
         checkLayer(layer2, "m1", "m2", "m3");
@@ -383,8 +385,8 @@
 
 
     /**
-     * Test Layer.createWithXXX when the modules that override same named
-     * modules in the parent layer.
+     * Test Layer defineModulesWithXXX when the modules that override same
+     * named modules in the parent layer.
      *
      * Test scenario:
      *   layer1: m1, m2, m3 => loader pool
@@ -398,7 +400,8 @@
         checkLayer(layer1, "m1", "m2", "m3");
 
         ModuleFinder finder = ModuleFinder.of(MODS_DIR);
-        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(),
+                                                Set.of("m1"));
 
         Layer layer2 = layer1.defineModulesWithManyLoaders(cf2, null);
         checkLayer(layer2, "m1", "m2", "m3");
@@ -477,8 +480,8 @@
 
 
     /**
-     * Test Layer.createWithXXX when the modules that override same named
-     * modules in the parent layer.
+     * Test Layer defineModulesWithXXX when the modules that override same
+     * named modules in the parent layer.
      *
      * layer1: m1, m2, m3 => same loader
      * layer2: m1, m3 => same loader
@@ -492,7 +495,8 @@
 
         ModuleFinder finder = finderFor("m1", "m3");
 
-        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(),
+                                                Set.of("m1"));
 
         Layer layer2 = layer1.defineModulesWithOneLoader(cf2, null);
         checkLayer(layer2, "m1", "m3");
@@ -513,8 +517,8 @@
 
 
     /**
-     * Test Layer.createWithXXX when the modules that override same named
-     * modules in the parent layer.
+     * Test Layer defineModulesWithXXX when the modules that override same
+     * named modules in the parent layer.
      *
      * layer1: m1, m2, m3 => loader pool
      * layer2: m1, m3 => loader pool
@@ -528,7 +532,8 @@
 
         ModuleFinder finder = finderFor("m1", "m3");
 
-        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+        Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(),
+                                                Set.of("m1"));
 
         Layer layer2 = layer1.defineModulesWithManyLoaders(cf2, null);
         checkLayer(layer2, "m1", "m3");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/reflect/Module/WithSecurityManager.java	Thu May 26 17:19:13 2016 +0000
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @modules java.logging
+ * @summary Test java.lang.reflect.Module methods that specify permission checks
+ * @run main/othervm -Djava.security.policy=${test.src}/allow.policy WithSecurityManager allow
+ * @run main/othervm WithSecurityManager deny
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.module.Configuration;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReference;
+import java.lang.reflect.Layer;
+import java.lang.reflect.Module;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Set;
+
+/**
+ * Test java.lang.reflect.Module methods that specify permission checks.
+ */
+
+public class WithSecurityManager {
+
+    // a module that will be loaded into a child layer
+    static final String ANOTHER_MODULE          = "java.logging";
+    static final String ANOTHER_MODULE_RESOURCE = "java/util/logging/Logger.class";
+
+    public static void main(String[] args) throws IOException {
+        boolean allow = args[0].equals("allow");
+
+        // base module, in the boot layer
+        Module base = Object.class.getModule();
+
+        // another module, in a child layer
+        Module other = loadModuleInChildLayer(ANOTHER_MODULE);
+        assertTrue(other.getLayer() != Layer.boot());
+
+        System.setSecurityManager(new SecurityManager());
+
+        test(base, "java/lang/Object.class", allow);
+        test(other, ANOTHER_MODULE_RESOURCE, allow);
+    }
+
+    /**
+     * Test the permission checks by invoking methods on the given module.
+     *
+     * If {@code allow} is {@code true} then the permission checks should succeed.
+     */
+    static void test(Module m, String name, boolean allow) throws IOException {
+
+        // test Module::getClassLoader
+        System.out.format("Test getClassLoader on %s ...%n", m);
+        try {
+            ClassLoader cl = m.getClassLoader();
+            System.out.println(cl);
+            if (!allow)
+                assertTrue("getClassLoader should have failed", false);
+        } catch (SecurityException e) {
+            System.out.println(e + " thrown");
+            if (allow)
+                throw e;
+        }
+
+        // test Module::getResourceAsStream
+        System.out.format("Test getResourceAsStream(\"%s\") on %s ...%n", name, m);
+        try (InputStream in = m.getResourceAsStream(name)) {
+            System.out.println(in);
+            if (allow && (in == null))
+                assertTrue(name + " not found", false);
+            if (!allow && (in != null))
+                assertTrue(name + " should not be found", false);
+        }
+
+    }
+
+    /**
+     * Create a module layer that contains the given system module.
+     */
+    static Module loadModuleInChildLayer(String mn) {
+        Optional<ModuleReference> omref = ModuleFinder.ofSystem().find(mn);
+        assertTrue("module " + mn + " not a system module", omref.isPresent());
+
+        // create a ModuleFinder that only finds this module
+        ModuleReference mref = omref.get();
+        ModuleFinder finder = new ModuleFinder() {
+            @Override
+            public Optional<ModuleReference> find(String name) {
+                if (name.equals(mn))
+                    return Optional.of(mref);
+                else
+                    return Optional.empty();
+            }
+
+            @Override
+            public Set<ModuleReference> findAll() {
+                return Collections.singleton(mref);
+            }
+        };
+
+        // create a child configuration and layer with this module
+        Layer bootLayer = Layer.boot();
+        Configuration cf = bootLayer
+            .configuration()
+            .resolveRequires(finder, ModuleFinder.of(), Set.of(ANOTHER_MODULE));
+        Layer layer = bootLayer.defineModulesWithOneLoader(cf, null);
+
+        Optional<Module> om = layer.findModule(mn);
+        assertTrue("module " + mn + " not in child layer", om.isPresent());
+        return om.get();
+    }
+
+    static void assertTrue(String msg, boolean e) {
+        if (!e)
+            throw new RuntimeException(msg);
+    }
+
+    static void assertTrue(boolean e) {
+        if (!e)
+            throw new RuntimeException();
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/reflect/Module/allow.policy	Thu May 26 17:19:13 2016 +0000
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+grant {
+    permission java.lang.RuntimePermission "getClassLoader";
+    permission java.io.FilePermission "${java.home}/-", "read";
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/Inet6Address/PreferIPv6AddressesTest.java	Thu May 26 17:19:13 2016 +0000
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8016521
+ * @summary InetAddress should not always re-order addresses returned from name
+ *          service
+ * @run main/othervm -Djava.net.preferIPv6Addresses=false PreferIPv6AddressesTest
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true PreferIPv6AddressesTest
+ * @run main/othervm -Djava.net.preferIPv6Addresses=system PreferIPv6AddressesTest
+ * @run main/othervm PreferIPv6AddressesTest
+ */
+
+import java.io.IOException;
+import java.net.*;
+import java.nio.channels.DatagramChannel;
+import java.util.Arrays;
+import java.util.stream.IntStream;
+import static java.lang.System.out;
+
+public class PreferIPv6AddressesTest {
+
+    // A name, that if resolves, returns both IPv4 and IPv6 addresses.
+    static final String HOST_NAME = "www.google.com";
+
+    static final InetAddress LOOPBACK = InetAddress.getLoopbackAddress();
+
+    static final String preferIPV6Address =
+            System.getProperty("java.net.preferIPv6Addresses", "false");
+
+    public static void main(String args[]) throws IOException {
+
+        InetAddress addrs[];
+        try {
+            addrs = InetAddress.getAllByName(HOST_NAME);
+        } catch (UnknownHostException e) {
+            out.println("Unknown host " + HOST_NAME + ", cannot run test.");
+            return;
+        }
+
+        int firstIPv4Address = IntStream.range(0, addrs.length)
+                .filter(x -> addrs[x] instanceof Inet4Address)
+                .findFirst().orElse(-1);
+        int firstIPv6Address = IntStream.range(0, addrs.length)
+                .filter(x -> addrs[x] instanceof Inet6Address)
+                .findFirst().orElse(-1);
+
+        out.println("IPv6 supported: " + IPv6Supported());
+        out.println("Addresses: " + Arrays.asList(addrs));
+
+        if (preferIPV6Address.equalsIgnoreCase("true") && firstIPv6Address != -1) {
+            int off = firstIPv4Address != -1 ? firstIPv4Address : addrs.length;
+            assertAllv6Addresses(addrs, 0, off);
+            assertAllv4Addresses(addrs, off, addrs.length);
+            assertLoopbackAddress(Inet6Address.class);
+            assertAnyLocalAddress(Inet6Address.class);
+        } else if (preferIPV6Address.equalsIgnoreCase("false") && firstIPv4Address != -1) {
+            int off = firstIPv6Address != -1 ? firstIPv6Address : addrs.length;
+            assertAllv4Addresses(addrs, 0, off);
+            assertAllv6Addresses(addrs, off, addrs.length);
+            assertLoopbackAddress(Inet4Address.class);
+            assertAnyLocalAddress(Inet4Address.class);
+        } else if (preferIPV6Address.equalsIgnoreCase("system") && IPv6Supported()) {
+            assertLoopbackAddress(Inet6Address.class);
+            assertAnyLocalAddress(Inet6Address.class);
+        } else if (preferIPV6Address.equalsIgnoreCase("system") && !IPv6Supported()) {
+            assertLoopbackAddress(Inet4Address.class);
+            assertAnyLocalAddress(Inet4Address.class);
+        }
+    }
+
+    static void assertAllv4Addresses(InetAddress[] addrs, int off, int len) {
+        IntStream.range(off, len)
+                 .mapToObj(x -> addrs[x])
+                 .forEach(x -> {
+                     if (!(x instanceof Inet4Address))
+                         throw new RuntimeException("Expected IPv4, got " + x);
+                 });
+    }
+
+    static void assertAllv6Addresses(InetAddress[] addrs, int off, int len) {
+        IntStream.range(off, len)
+                .mapToObj(x -> addrs[x])
+                .forEach(x -> {
+                    if (!(x instanceof Inet6Address))
+                        throw new RuntimeException("Expected IPv6, got " + x);
+                });
+    }
+
+    static void assertLoopbackAddress(Class<?> expectedType) {
+        if (!LOOPBACK.getClass().isAssignableFrom(expectedType))
+            throw new RuntimeException("Expected " + expectedType
+                    + ", got " + LOOPBACK.getClass());
+    }
+
+    static void assertAnyLocalAddress(Class<?> expectedType) {
+        InetAddress anyAddr = (new InetSocketAddress(0)).getAddress();
+        if (!anyAddr.getClass().isAssignableFrom(expectedType))
+            throw new RuntimeException("Expected " + expectedType
+                    + ", got " + anyAddr.getClass());
+    }
+
+    static boolean IPv6Supported() throws IOException {
+        try {
+            DatagramChannel.open(StandardProtocolFamily.INET6);
+            return true;
+        } catch (UnsupportedOperationException x) {
+            return false;
+        }
+    }
+}
--- a/jdk/test/java/time/tck/java/time/temporal/TCKIsoFields.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/java/time/tck/java/time/temporal/TCKIsoFields.java	Thu May 26 17:19:13 2016 +0000
@@ -442,29 +442,45 @@
     }
 
     //-----------------------------------------------------------------------
-    // range refinedby
+    // rangeRefinedBy
     //-----------------------------------------------------------------------
     @DataProvider(name="isofields")
     Object[][] data_isofields() {
         return new Object[][] {
-               {IsoFields.DAY_OF_QUARTER},
-               {IsoFields.QUARTER_OF_YEAR},
-               {IsoFields.WEEK_OF_WEEK_BASED_YEAR},
-               {IsoFields.WEEK_BASED_YEAR},
+               {IsoFields.DAY_OF_QUARTER, 49, ValueRange.of(1, 91)},
+               {IsoFields.QUARTER_OF_YEAR, 2, ValueRange.of(1, 4)},
+               {IsoFields.WEEK_OF_WEEK_BASED_YEAR, 20, ValueRange.of(1, 52)},
+               {IsoFields.WEEK_BASED_YEAR, 2016, ValueRange.of(LocalDate.MIN.getYear(),
+                                                               LocalDate.MAX.getYear())},
         };
     }
 
     @Test(dataProvider = "isofields")
-    public void test_isofields_rangerefinedby(TemporalField field) {
-        field.rangeRefinedBy(LocalDate.now());
+    public void test_isofields_rangerefinedby(TemporalField field, int value, ValueRange valueRange) {
+        LocalDate date = LocalDate.of(2016, 5, 19);
+        assertEquals(field.rangeRefinedBy(date), valueRange);
     }
 
     @Test(dataProvider = "isofields", expectedExceptions = UnsupportedTemporalTypeException.class)
-    public void test_nonisofields_rangerefinedby(TemporalField field) {
+    public void test_nonisofields_rangerefinedby(TemporalField field, int value, ValueRange valueRange) {
         field.rangeRefinedBy(ThaiBuddhistDate.now());
     }
 
     //-----------------------------------------------------------------------
+    // getFrom
+    //-----------------------------------------------------------------------
+    @Test(dataProvider = "isofields")
+    public void test_isofields_getFrom(TemporalField field, int value, ValueRange valueRange) {
+        LocalDate date = LocalDate.of(2016, 5, 19);
+        assertEquals(field.getFrom(date), value);
+    }
+
+    @Test(dataProvider = "isofields", expectedExceptions = UnsupportedTemporalTypeException.class)
+    public void test_nonisofields_getFrom(TemporalField field, int value, ValueRange valueRange) {
+        field.getFrom(ThaiBuddhistDate.now());
+    }
+
+    //-----------------------------------------------------------------------
     public void test_loop() {
         // loop round at least one 400 year cycle, including before 1970
         LocalDate date = LocalDate.of(1960, 1, 5);  // Tuseday of week 1 1960
--- a/jdk/test/java/util/concurrent/locks/Lock/FlakyMutex.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/java/util/concurrent/locks/Lock/FlakyMutex.java	Thu May 26 17:19:13 2016 +0000
@@ -25,13 +25,10 @@
  * @test
  * @bug 6503247 6574123
  * @summary Test resilience to tryAcquire methods that throw
- * @library /lib/testlibrary/
  * @author Martin Buchholz
  */
 
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-
-import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -39,7 +36,6 @@
 import java.util.concurrent.locks.AbstractQueuedLongSynchronizer;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
-import jdk.testlibrary.Utils;
 
 /**
  * This uses a variant of the standard Mutex demo, except with a
@@ -48,22 +44,10 @@
  */
 @SuppressWarnings("serial")
 public class FlakyMutex implements Lock {
-    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static class MyError extends Error {}
     static class MyException extends Exception {}
     static class MyRuntimeException extends RuntimeException {}
 
-    static final Random rnd = new Random();
-
-    static void maybeThrow() {
-        switch (rnd.nextInt(10)) {
-        case 0: throw new MyError();
-        case 1: throw new MyRuntimeException();
-        case 2: FlakyMutex.<RuntimeException>uncheckedThrow(new MyException());
-        default: /* Do nothing */ break;
-        }
-    }
-
     static void checkThrowable(Throwable t) {
         check((t instanceof MyError) ||
               (t instanceof MyException) ||
@@ -72,31 +56,35 @@
 
     static void realMain(String[] args) throws Throwable {
         final int nThreads = 3;
-        final CyclicBarrier barrier = new CyclicBarrier(nThreads + 1);
-        final FlakyMutex m = new FlakyMutex();
+        final int iterations = 10_000;
+        final CyclicBarrier startingGate = new CyclicBarrier(nThreads);
+        final FlakyMutex mutex = new FlakyMutex();
         final ExecutorService es = Executors.newFixedThreadPool(nThreads);
-        for (int i = 0; i < nThreads; i++) {
-            es.submit(new Runnable() { public void run() {
-                try {
-                    barrier.await();
-                    for (int i = 0; i < 10000; i++) {
-                        for (;;) {
-                            try { m.lock(); break; }
-                            catch (Throwable t) { checkThrowable(t); }
-                        }
+        final Runnable task = () -> {
+            try {
+                startingGate.await();
+                for (int i = 0; i < iterations; i++) {
+                    for (;;) {
+                        try { mutex.lock(); break; }
+                        catch (Throwable t) { checkThrowable(t); }
+                    }
 
-                        try { check(! m.tryLock()); }
-                        catch (Throwable t) { checkThrowable(t); }
+                    try { check(! mutex.tryLock()); }
+                    catch (Throwable t) { checkThrowable(t); }
 
-                        try { check(! m.tryLock(1, TimeUnit.MICROSECONDS)); }
-                        catch (Throwable t) { checkThrowable(t); }
+                    try { check(! mutex.tryLock(1, TimeUnit.MICROSECONDS)); }
+                    catch (Throwable t) { checkThrowable(t); }
 
-                        m.unlock();
-                    }
-                } catch (Throwable t) { unexpected(t); }}});}
-        barrier.await();
+                    mutex.unlock();
+                }
+            } catch (Throwable t) { unexpected(t); }
+        };
+
+        for (int i = 0; i < nThreads; i++)
+            es.submit(task);
         es.shutdown();
-        check(es.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
+        // Let test harness handle timeout
+        check(es.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS));
     }
 
     private static class FlakySync extends AbstractQueuedLongSynchronizer {
@@ -116,8 +104,12 @@
                 do {} while (hasQueuedPredecessors() != hasQueuedThreads());
             }
 
-            maybeThrow();
-            return compareAndSetState(0, 1);
+            switch (ThreadLocalRandom.current().nextInt(10)) {
+            case 0: throw new MyError();
+            case 1: throw new MyRuntimeException();
+            case 2: FlakyMutex.<RuntimeException>uncheckedThrow(new MyException());
+            default: return compareAndSetState(0, 1);
+            }
         }
 
         public boolean tryRelease(long releases) {
--- a/jdk/test/java/util/concurrent/locks/LockSupport/ParkLoops.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/java/util/concurrent/locks/LockSupport/ParkLoops.java	Thu May 26 17:19:13 2016 +0000
@@ -35,16 +35,10 @@
  * @test
  * @bug 8074773
  * @summary Stress test looks for lost unparks
- * @library /lib/testlibrary/
- * @modules java.management
- * @run main/timeout=1200 ParkLoops
  */
 
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.SECONDS;
 
-import java.lang.management.ManagementFactory;
-import java.lang.management.ThreadInfo;
 import java.util.SplittableRandom;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
@@ -52,11 +46,8 @@
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReferenceArray;
 import java.util.concurrent.locks.LockSupport;
-import jdk.testlibrary.Utils;
 
 public final class ParkLoops {
-    static final long TEST_TIMEOUT_SECONDS = Utils.adjustTimeout(1000);
-    static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
     static final int THREADS = 4;
     static final int ITERS = 30_000;
 
@@ -126,28 +117,13 @@
         final AtomicReferenceArray<Thread> threads
             = new AtomicReferenceArray<>(THREADS);
         final CountDownLatch done = new CountDownLatch(THREADS);
-        final Runnable parker = new Parker(threads, done, rnd.split());
-        final Runnable unparker = new Unparker(threads, done, rnd.split());
         for (int i = 0; i < THREADS; i++) {
-            pool.submit(parker);
-            pool.submit(unparker);
+            pool.submit(new Parker(threads, done, rnd.split()));
+            pool.submit(new Unparker(threads, done, rnd.split()));
         }
-        try {
-          if (!done.await(TEST_TIMEOUT_SECONDS, SECONDS)) {
-            dumpAllStacks();
-            throw new AssertionError("lost unpark");
-          }
-        } finally {
-          pool.shutdown();
-          pool.awaitTermination(LONG_DELAY_MS, MILLISECONDS);
-        }
-    }
-
-    static void dumpAllStacks() {
-        ThreadInfo[] threadInfos =
-            ManagementFactory.getThreadMXBean().dumpAllThreads(true, true);
-        for (ThreadInfo threadInfo : threadInfos) {
-            System.err.print(threadInfo);
-        }
+        // Let test harness handle timeout
+        done.await();
+        pool.shutdown();
+        pool.awaitTermination(Long.MAX_VALUE, SECONDS);
     }
 }
--- a/jdk/test/java/util/concurrent/tck/CompletableFutureTest.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/java/util/concurrent/tck/CompletableFutureTest.java	Thu May 26 17:19:13 2016 +0000
@@ -3322,7 +3322,7 @@
             () -> f.obtrudeException(null),
 
             () -> CompletableFuture.delayedExecutor(1L, SECONDS, null),
-            () -> CompletableFuture.delayedExecutor(1L, null, new ThreadExecutor()),
+            () -> CompletableFuture.delayedExecutor(1L, null, exec),
             () -> CompletableFuture.delayedExecutor(1L, null),
 
             () -> f.orTimeout(1L, null),
@@ -3552,7 +3552,7 @@
         long timeoutMillis = timeoutMillis();
         CompletableFuture<Integer> f = new CompletableFuture<>();
         long startTime = System.nanoTime();
-        f.orTimeout(timeoutMillis, MILLISECONDS);
+        assertSame(f, f.orTimeout(timeoutMillis, MILLISECONDS));
         checkCompletedWithTimeoutException(f);
         assertTrue(millisElapsedSince(startTime) >= timeoutMillis);
     }
@@ -3567,8 +3567,8 @@
         CompletableFuture<Integer> g = new CompletableFuture<>();
         long startTime = System.nanoTime();
         f.complete(v1);
-        f.orTimeout(LONG_DELAY_MS, MILLISECONDS);
-        g.orTimeout(LONG_DELAY_MS, MILLISECONDS);
+        assertSame(f, f.orTimeout(LONG_DELAY_MS, MILLISECONDS));
+        assertSame(g, g.orTimeout(LONG_DELAY_MS, MILLISECONDS));
         g.complete(v1);
         checkCompletedNormally(f, v1);
         checkCompletedNormally(g, v1);
@@ -3583,11 +3583,14 @@
                        () -> testCompleteOnTimeout_timesOut(null));
     }
 
+    /**
+     * completeOnTimeout completes with given value if not complete
+     */
     public void testCompleteOnTimeout_timesOut(Integer v) {
         long timeoutMillis = timeoutMillis();
         CompletableFuture<Integer> f = new CompletableFuture<>();
         long startTime = System.nanoTime();
-        f.completeOnTimeout(v, timeoutMillis, MILLISECONDS);
+        assertSame(f, f.completeOnTimeout(v, timeoutMillis, MILLISECONDS));
         assertSame(v, f.join());
         assertTrue(millisElapsedSince(startTime) >= timeoutMillis);
         f.complete(99);         // should have no effect
@@ -3604,8 +3607,8 @@
         CompletableFuture<Integer> g = new CompletableFuture<>();
         long startTime = System.nanoTime();
         f.complete(v1);
-        f.completeOnTimeout(-1, LONG_DELAY_MS, MILLISECONDS);
-        g.completeOnTimeout(-1, LONG_DELAY_MS, MILLISECONDS);
+        assertSame(f, f.completeOnTimeout(-1, LONG_DELAY_MS, MILLISECONDS));
+        assertSame(g, g.completeOnTimeout(-1, LONG_DELAY_MS, MILLISECONDS));
         g.complete(v1);
         checkCompletedNormally(f, v1);
         checkCompletedNormally(g, v1);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/concurrent/tck/ExecutorCompletionService9Test.java	Thu May 26 17:19:13 2016 +0000
@@ -0,0 +1,137 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Written by Doug Lea and Martin Buchholz with assistance from
+ * members of JCP JSR-166 Expert Group and released to the public
+ * domain, as explained at
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CompletionService;
+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;
+import junit.framework.TestSuite;
+
+public class ExecutorCompletionService9Test extends JSR166TestCase {
+    public static void main(String[] args) {
+        main(suite(), args);
+    }
+    public static Test suite() {
+        return new TestSuite(ExecutorCompletionService9Test.class);
+    }
+
+    void solveAll(Executor e,
+                  Collection<Callable<Integer>> solvers)
+        throws InterruptedException, ExecutionException {
+        CompletionService<Integer> cs
+            = new ExecutorCompletionService<>(e);
+        solvers.forEach(cs::submit);
+        for (int i = solvers.size(); i > 0; i--) {
+            Integer r = cs.take().get();
+            if (r != null)
+                use(r);
+        }
+    }
+
+    void solveAny(Executor e,
+                  Collection<Callable<Integer>> solvers)
+        throws InterruptedException {
+        CompletionService<Integer> cs
+            = new ExecutorCompletionService<>(e);
+        int n = solvers.size();
+        List<Future<Integer>> futures = new ArrayList<>(n);
+        Integer result = null;
+        try {
+            solvers.forEach((solver) -> futures.add(cs.submit(solver)));
+            for (int i = n; i > 0; i--) {
+                try {
+                    Integer r = cs.take().get();
+                    if (r != null) {
+                        result = r;
+                        break;
+                    }
+                } catch (ExecutionException ignore) {}
+            }
+        } finally {
+            futures.forEach((future) -> future.cancel(true));
+        }
+
+        if (result != null)
+            use(result);
+    }
+
+    HashSet<Integer> results;
+
+    void use(Integer x) {
+        if (results == null) results = new HashSet<Integer>();
+        results.add(x);
+    }
+
+    /**
+     * The first "solvers" sample code in the class javadoc works.
+     */
+    public void testSolveAll()
+        throws InterruptedException, ExecutionException {
+        Set<Callable<Integer>> solvers = Set.of(
+            () -> null,
+            () -> 1,
+            () -> 2,
+            () -> 3,
+            () -> null);
+        solveAll(cachedThreadPool, solvers);
+        assertEquals(Set.of(1, 2, 3), results);
+    }
+
+    /**
+     * The second "solvers" sample code in the class javadoc works.
+     */
+    public void testSolveAny()
+        throws InterruptedException {
+        Set<Callable<Integer>> solvers = Set.of(
+            () -> { throw new ArithmeticException(); },
+            () -> null,
+            () -> 1,
+            () -> 2);
+        solveAny(cachedThreadPool, solvers);
+        assertEquals(1, results.size());
+        Integer elt = results.iterator().next();
+        assertTrue(elt.equals(1) || elt.equals(2));
+    }
+
+}
--- a/jdk/test/java/util/concurrent/tck/ExecutorCompletionServiceTest.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/java/util/concurrent/tck/ExecutorCompletionServiceTest.java	Thu May 26 17:19:13 2016 +0000
@@ -37,8 +37,11 @@
 
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.Callable;
+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.Executors;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.concurrent.FutureTask;
@@ -59,7 +62,7 @@
     }
 
     /**
-     * Creating a new ECS with null Executor throw NPE
+     * new ExecutorCompletionService(null) throws NullPointerException
      */
     public void testConstructorNPE() {
         try {
@@ -69,111 +72,147 @@
     }
 
     /**
-     * Creating a new ECS with null queue throw NPE
+     * new ExecutorCompletionService(e, null) throws NullPointerException
      */
     public void testConstructorNPE2() {
         try {
-            ExecutorService e = Executors.newCachedThreadPool();
-            new ExecutorCompletionService(e, null);
+            new ExecutorCompletionService(cachedThreadPool, null);
+            shouldThrow();
+        } catch (NullPointerException success) {}
+    }
+
+    /**
+     * ecs.submit(null) throws NullPointerException
+     */
+    public void testSubmitNullCallable() {
+        CompletionService cs = new ExecutorCompletionService(cachedThreadPool);
+        try {
+            cs.submit((Callable) null);
             shouldThrow();
         } catch (NullPointerException success) {}
     }
 
     /**
-     * Submitting a null callable throws NPE
+     * ecs.submit(null, val) throws NullPointerException
      */
-    public void testSubmitNPE() {
-        final ExecutorService e = Executors.newCachedThreadPool();
-        final ExecutorCompletionService ecs = new ExecutorCompletionService(e);
-        try (PoolCleaner cleaner = cleaner(e)) {
-            Callable c = null;
-            try {
-                ecs.submit(c);
-                shouldThrow();
-            } catch (NullPointerException success) {}
-        }
-    }
-
-    /**
-     * Submitting a null runnable throws NPE
-     */
-    public void testSubmitNPE2() {
-        final ExecutorService e = Executors.newCachedThreadPool();
-        final ExecutorCompletionService ecs = new ExecutorCompletionService(e);
-        try (PoolCleaner cleaner = cleaner(e)) {
-            Runnable r = null;
-            try {
-                ecs.submit(r, Boolean.TRUE);
-                shouldThrow();
-            } catch (NullPointerException success) {}
-        }
+    public void testSubmitNullRunnable() {
+        CompletionService cs = new ExecutorCompletionService(cachedThreadPool);
+        try {
+            cs.submit((Runnable) null, Boolean.TRUE);
+            shouldThrow();
+        } catch (NullPointerException success) {}
     }
 
     /**
      * A taken submitted task is completed
      */
-    public void testTake() throws InterruptedException {
-        final ExecutorService e = Executors.newCachedThreadPool();
-        final ExecutorCompletionService ecs = new ExecutorCompletionService(e);
-        try (PoolCleaner cleaner = cleaner(e)) {
-            Callable c = new StringTask();
-            ecs.submit(c);
-            Future f = ecs.take();
-            assertTrue(f.isDone());
-        }
+    public void testTake()
+        throws InterruptedException, ExecutionException {
+        CompletionService cs = new ExecutorCompletionService(cachedThreadPool);
+        cs.submit(new StringTask());
+        Future f = cs.take();
+        assertTrue(f.isDone());
+        assertSame(TEST_STRING, f.get());
     }
 
     /**
      * Take returns the same future object returned by submit
      */
     public void testTake2() throws InterruptedException {
-        final ExecutorService e = Executors.newCachedThreadPool();
-        final ExecutorCompletionService ecs = new ExecutorCompletionService(e);
-        try (PoolCleaner cleaner = cleaner(e)) {
-            Callable c = new StringTask();
-            Future f1 = ecs.submit(c);
-            Future f2 = ecs.take();
-            assertSame(f1, f2);
+        CompletionService cs = new ExecutorCompletionService(cachedThreadPool);
+        Future f1 = cs.submit(new StringTask());
+        Future f2 = cs.take();
+        assertSame(f1, f2);
+    }
+
+    /**
+     * poll returns non-null when the returned task is completed
+     */
+    public void testPoll1()
+        throws InterruptedException, ExecutionException {
+        CompletionService cs = new ExecutorCompletionService(cachedThreadPool);
+        assertNull(cs.poll());
+        cs.submit(new StringTask());
+
+        long startTime = System.nanoTime();
+        Future f;
+        while ((f = cs.poll()) == null) {
+            if (millisElapsedSince(startTime) > LONG_DELAY_MS)
+                fail("timed out");
+            Thread.yield();
         }
+        assertTrue(f.isDone());
+        assertSame(TEST_STRING, f.get());
+    }
+
+    /**
+     * timed poll returns non-null when the returned task is completed
+     */
+    public void testPoll2()
+        throws InterruptedException, ExecutionException {
+        CompletionService cs = new ExecutorCompletionService(cachedThreadPool);
+        assertNull(cs.poll());
+        cs.submit(new StringTask());
+
+        long startTime = System.nanoTime();
+        Future f;
+        while ((f = cs.poll(SHORT_DELAY_MS, MILLISECONDS)) == null) {
+            if (millisElapsedSince(startTime) > LONG_DELAY_MS)
+                fail("timed out");
+            Thread.yield();
+        }
+        assertTrue(f.isDone());
+        assertSame(TEST_STRING, f.get());
     }
 
     /**
-     * If poll returns non-null, the returned task is completed
+     * poll returns null before the returned task is completed
      */
-    public void testPoll1() throws Exception {
-        final ExecutorService e = Executors.newCachedThreadPool();
-        final ExecutorCompletionService ecs = new ExecutorCompletionService(e);
-        try (PoolCleaner cleaner = cleaner(e)) {
-            assertNull(ecs.poll());
-            Callable c = new StringTask();
-            ecs.submit(c);
-
-            long startTime = System.nanoTime();
-            Future f;
-            while ((f = ecs.poll()) == null) {
-                if (millisElapsedSince(startTime) > LONG_DELAY_MS)
-                    fail("timed out");
-                Thread.yield();
-            }
-            assertTrue(f.isDone());
-            assertSame(TEST_STRING, f.get());
-        }
+    public void testPollReturnsNull()
+        throws InterruptedException, ExecutionException {
+        CompletionService cs = new ExecutorCompletionService(cachedThreadPool);
+        final CountDownLatch proceed = new CountDownLatch(1);
+        cs.submit(new Callable() { public String call() throws Exception {
+            proceed.await();
+            return TEST_STRING;
+        }});
+        assertNull(cs.poll());
+        assertNull(cs.poll(0L, MILLISECONDS));
+        assertNull(cs.poll(Long.MIN_VALUE, MILLISECONDS));
+        long startTime = System.nanoTime();
+        assertNull(cs.poll(timeoutMillis(), MILLISECONDS));
+        assertTrue(millisElapsedSince(startTime) >= timeoutMillis());
+        proceed.countDown();
+        assertSame(TEST_STRING, cs.take().get());
     }
 
     /**
-     * If timed poll returns non-null, the returned task is completed
+     * successful and failed tasks are both returned
      */
-    public void testPoll2() throws InterruptedException {
-        final ExecutorService e = Executors.newCachedThreadPool();
-        final ExecutorCompletionService ecs = new ExecutorCompletionService(e);
-        try (PoolCleaner cleaner = cleaner(e)) {
-            assertNull(ecs.poll());
-            Callable c = new StringTask();
-            ecs.submit(c);
-            Future f = ecs.poll(SHORT_DELAY_MS, MILLISECONDS);
-            if (f != null)
-                assertTrue(f.isDone());
+    public void testTaskAssortment()
+        throws InterruptedException, ExecutionException {
+        CompletionService cs = new ExecutorCompletionService(cachedThreadPool);
+        ArithmeticException ex = new ArithmeticException();
+        for (int i = 0; i < 2; i++) {
+            cs.submit(new StringTask());
+            cs.submit(callableThrowing(ex));
+            cs.submit(runnableThrowing(ex), null);
         }
+        int normalCompletions = 0;
+        int exceptionalCompletions = 0;
+        for (int i = 0; i < 3 * 2; i++) {
+            try {
+                if (cs.take().get() == TEST_STRING)
+                    normalCompletions++;
+            }
+            catch (ExecutionException expected) {
+                assertTrue(expected.getCause() instanceof ArithmeticException);
+                exceptionalCompletions++;
+            }
+        }
+        assertEquals(2 * 1, normalCompletions);
+        assertEquals(2 * 2, exceptionalCompletions);
+        assertNull(cs.poll());
     }
 
     /**
@@ -184,7 +223,7 @@
         final AtomicBoolean done = new AtomicBoolean(false);
         class MyCallableFuture<V> extends FutureTask<V> {
             MyCallableFuture(Callable<V> c) { super(c); }
-            protected void done() { done.set(true); }
+            @Override protected void done() { done.set(true); }
         }
         final ExecutorService e =
             new ThreadPoolExecutor(1, 1,
@@ -193,15 +232,14 @@
                 protected <T> RunnableFuture<T> newTaskFor(Callable<T> c) {
                     return new MyCallableFuture<T>(c);
                 }};
-        ExecutorCompletionService<String> ecs =
-            new ExecutorCompletionService<String>(e);
+        CompletionService<String> cs = new ExecutorCompletionService<>(e);
         try (PoolCleaner cleaner = cleaner(e)) {
-            assertNull(ecs.poll());
+            assertNull(cs.poll());
             Callable<String> c = new StringTask();
-            Future f1 = ecs.submit(c);
+            Future f1 = cs.submit(c);
             assertTrue("submit must return MyCallableFuture",
                        f1 instanceof MyCallableFuture);
-            Future f2 = ecs.take();
+            Future f2 = cs.take();
             assertSame("submit and take must return same objects", f1, f2);
             assertTrue("completed task must have set done", done.get());
         }
@@ -215,7 +253,7 @@
         final AtomicBoolean done = new AtomicBoolean(false);
         class MyRunnableFuture<V> extends FutureTask<V> {
             MyRunnableFuture(Runnable t, V r) { super(t, r); }
-            protected void done() { done.set(true); }
+            @Override protected void done() { done.set(true); }
         }
         final ExecutorService e =
             new ThreadPoolExecutor(1, 1,
@@ -224,15 +262,14 @@
                 protected <T> RunnableFuture<T> newTaskFor(Runnable t, T r) {
                     return new MyRunnableFuture<T>(t, r);
                 }};
-        final ExecutorCompletionService<String> ecs =
-            new ExecutorCompletionService<String>(e);
+        CompletionService<String> cs = new ExecutorCompletionService<>(e);
         try (PoolCleaner cleaner = cleaner(e)) {
-            assertNull(ecs.poll());
+            assertNull(cs.poll());
             Runnable r = new NoOpRunnable();
-            Future f1 = ecs.submit(r, null);
+            Future f1 = cs.submit(r, null);
             assertTrue("submit must return MyRunnableFuture",
                        f1 instanceof MyRunnableFuture);
-            Future f2 = ecs.take();
+            Future f2 = cs.take();
             assertSame("submit and take must return same objects", f1, f2);
             assertTrue("completed task must have set done", done.get());
         }
--- a/jdk/test/java/util/concurrent/tck/JSR166TestCase.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/java/util/concurrent/tck/JSR166TestCase.java	Thu May 26 17:19:13 2016 +0000
@@ -39,6 +39,7 @@
  * @modules java.management
  * @build *
  * @run junit/othervm/timeout=1000 -Djsr166.testImplementationDetails=true JSR166TestCase
+ * @run junit/othervm/timeout=1000 -Djava.util.concurrent.ForkJoinPool.common.parallelism=0 -Djsr166.testImplementationDetails=true JSR166TestCase
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -85,6 +86,7 @@
 import java.util.concurrent.RecursiveTask;
 import java.util.concurrent.RejectedExecutionHandler;
 import java.util.concurrent.Semaphore;
+import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeoutException;
@@ -546,7 +548,7 @@
         // Java9+ test classes
         if (atLeastJava9()) {
             String[] java9TestClassNames = {
-                // Currently empty, but expecting varhandle tests
+                "ExecutorCompletionService9Test",
             };
             addNamedTestClasses(suite, java9TestClassNames);
         }
@@ -1860,4 +1862,19 @@
         } catch (NoSuchElementException success) {}
         assertFalse(it.hasNext());
     }
+
+    public <T> Callable<T> callableThrowing(final Exception ex) {
+        return new Callable<T>() { public T call() throws Exception { throw ex; }};
+    }
+
+    public Runnable runnableThrowing(final RuntimeException ex) {
+        return new Runnable() { public void run() { throw ex; }};
+    }
+
+    /** A reusable thread pool to be shared by tests. */
+    static final ExecutorService cachedThreadPool =
+        new ThreadPoolExecutor(0, Integer.MAX_VALUE,
+                               1000L, MILLISECONDS,
+                               new SynchronousQueue<Runnable>());
+
 }
--- a/jdk/test/jdk/net/Sockets/Test.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/jdk/net/Sockets/Test.java	Thu May 26 17:19:13 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
@@ -25,24 +25,35 @@
  * @test
  * @bug 8032808 8044773
  * @modules jdk.net
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
  * @run main/othervm -Xcheck:jni Test success
  * @run main/othervm/policy=policy.fail -Xcheck:jni Test fail
  * @run main/othervm/policy=policy.success -Xcheck:jni Test success
  */
 
-import java.net.*;
+import jdk.net.ExtendedSocketOptions;
+import jdk.net.SocketFlow;
+import jdk.net.Sockets;
+import jdk.testlibrary.OSInfo;
+
 import java.io.IOException;
-import java.nio.channels.*;
-import java.util.concurrent.*;
-import java.util.Set;
-import jdk.net.*;
+import java.net.*;
+import java.nio.channels.AsynchronousSocketChannel;
+import java.nio.channels.DatagramChannel;
+import java.nio.channels.SocketChannel;
+import java.util.concurrent.Future;
+
 import static java.lang.System.out;
+import static jdk.net.ExtendedSocketOptions.SO_FLOW_SLA;
 
 public class Test {
 
     interface Runner { void run() throws Exception; }
 
     static boolean expectSuccess;
+    private static final boolean expectSupport = checkExpectedOptionSupport();
+    private static final double solarisVersionToCheck = 11.2;
 
     public static void main(String[] args) throws Exception {
 
@@ -54,9 +65,8 @@
         expectSuccess = args[0].equals("success");
 
         // Main thing is to check for JNI problems
-        // Doesn't matter if current system does not support the option
-        // and currently setting the option with the loopback interface
-        // doesn't work either
+        // Doesn't matter if currently setting the option with the loopback
+        // interface doesn't work
 
         boolean sm = System.getSecurityManager() != null;
         out.println("Security Manager enabled: " + sm);
@@ -75,56 +85,70 @@
 
             final int udp_port = dg.getLocalPort();
 
-            // If option not available, end test
-            Set<SocketOption<?>> options = dg.supportedOptions();
-            if (!options.contains(ExtendedSocketOptions.SO_FLOW_SLA)) {
-                System.out.println("SO_FLOW_SLA not supported");
-                return;
-            }
-
             final Socket s = new Socket("127.0.0.1", tcp_port);
             final SocketChannel sc = SocketChannel.open();
             sc.connect(new InetSocketAddress("127.0.0.1", tcp_port));
 
             doTest("Sockets.setOption Socket", () -> {
                 out.println(flowIn);
-                Sockets.setOption(s, ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
+                if (s.supportedOptions().contains(SO_FLOW_SLA) != expectSupport) {
+                    throw new RuntimeException("Unexpected supportedOptions()");
+                }
+                Sockets.setOption(s, SO_FLOW_SLA, flowIn);
                 out.println(flowIn);
             });
-            doTest("Sockets.getOption Socket",() -> {
-                Sockets.getOption(s, ExtendedSocketOptions.SO_FLOW_SLA);
+
+            doTest("Sockets.getOption Socket", () -> {
+                Sockets.getOption(s, SO_FLOW_SLA);
                 out.println(flowIn);
             });
-            doTest("Sockets.setOption SocketChannel",() ->
-                sc.setOption(ExtendedSocketOptions.SO_FLOW_SLA, flowIn)
+
+            doTest("Sockets.setOption SocketChannel", () -> {
+                if (sc.supportedOptions().contains(SO_FLOW_SLA) != expectSupport) {
+                    throw new RuntimeException("Unexpected supportedOptions()");
+                }
+                sc.setOption(SO_FLOW_SLA, flowIn);
+            });
+            doTest("Sockets.getOption SocketChannel", () ->
+                    sc.getOption(SO_FLOW_SLA)
             );
-            doTest("Sockets.getOption SocketChannel",() ->
-                sc.getOption(ExtendedSocketOptions.SO_FLOW_SLA)
-            );
-            doTest("Sockets.setOption DatagramSocket",() -> {
+            doTest("Sockets.setOption DatagramSocket", () -> {
                 try (DatagramSocket dg1 = new DatagramSocket(0)) {
+                    if (dg1.supportedOptions().contains(SO_FLOW_SLA) != expectSupport) {
+                        throw new RuntimeException("Unexpected supportedOptions()");
+                    }
+
                     dg1.connect(loop, udp_port);
-                    Sockets.setOption(dg1, ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
+                    Sockets.setOption(dg1, SO_FLOW_SLA, flowIn);
                 }
             });
             doTest("Sockets.setOption DatagramSocket 2", () -> {
                 try (DatagramChannel dg2 = DatagramChannel.open()) {
+                    if (dg2.supportedOptions().contains(SO_FLOW_SLA) != expectSupport) {
+                        throw new RuntimeException("Unexpected supportedOptions()");
+                    }
                     dg2.bind(new InetSocketAddress(loop, 0));
                     dg2.connect(new InetSocketAddress(loop, udp_port));
-                    dg2.setOption(ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
+                    dg2.setOption(SO_FLOW_SLA, flowIn);
                 }
             });
             doTest("Sockets.setOption MulticastSocket", () -> {
                 try (MulticastSocket mc1 = new MulticastSocket(0)) {
+                    if (mc1.supportedOptions().contains(SO_FLOW_SLA) != expectSupport) {
+                        throw new RuntimeException("Unexpected supportedOptions()");
+                    }
                     mc1.connect(loop, udp_port);
-                    Sockets.setOption(mc1, ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
+                    Sockets.setOption(mc1, SO_FLOW_SLA, flowIn);
                 }
             });
             doTest("Sockets.setOption AsynchronousSocketChannel", () -> {
                 try (AsynchronousSocketChannel asc = AsynchronousSocketChannel.open()) {
+                    if (asc.supportedOptions().contains(SO_FLOW_SLA) != expectSupport) {
+                        throw new RuntimeException("Unexpected supportedOptions()");
+                    }
                     Future<Void> f = asc.connect(loopad);
                     f.get();
-                    asc.setOption(ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
+                    asc.setOption(SO_FLOW_SLA, flowIn);
                 }
             });
         }
@@ -144,14 +168,43 @@
                 throw new RuntimeException("Unexpected SecurityException", e);
             } else {
                 out.println("Caught expected: " + e);
+                return;
             }
         } catch (UnsupportedOperationException e) {
-            System.out.println(e);
+            if (expectSupport) {
+                throw new RuntimeException("Test failed: " +
+                        "unexpected UnsupportedOperationException");
+            }
+            out.println("UnsupportedOperationException as expected");
+            return;
         } catch (IOException e) {
             // Probably a permission error, but we're not
             // going to check unless a specific permission exception
             // is defined.
             System.out.println(e);
         }
+        if (!expectSupport) {
+            throw new RuntimeException("Test failed: " +
+                    "UnsupportedOperationException was not thrown");
+        }
     }
+
+    private static boolean checkExpectedOptionSupport() {
+        if (OSInfo.getOSType().equals(OSInfo.OSType.SOLARIS)) {
+            double solarisVersion = OSInfo.getSolarisVersion();
+            if (solarisVersion >= solarisVersionToCheck) {
+                System.out.println("This Solaris version (" + solarisVersion
+                        + ") should support SO_FLOW_SLA option");
+                return true;
+            } else {
+                System.out.println("This Solaris version (" + solarisVersion
+                        + ") should not support SO_FLOW_SLA option");
+            }
+        } else {
+            System.out.println("Not Solaris, SO_FLOW_SLA should not be " +
+                    "supported");
+        }
+        return false;
+    }
+
 }
--- a/jdk/test/jdk/net/Sockets/policy.fail	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/jdk/net/Sockets/policy.fail	Thu May 26 17:19:13 2016 +0000
@@ -1,4 +1,8 @@
 grant {
+    permission java.util.PropertyPermission "os.name", "read";
+    permission java.io.FilePermission "<<ALL FILES>>", "execute";
+    permission java.util.PropertyPermission "line.separator", "read";
+    permission java.io.FilePermission "/etc/release", "read";
     permission java.net.SocketPermission "127.0.0.1", "connect,accept" ;
     permission java.net.SocketPermission "localhost", "listen" ;
 };
--- a/jdk/test/jdk/net/Sockets/policy.success	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/jdk/net/Sockets/policy.success	Thu May 26 17:19:13 2016 +0000
@@ -1,4 +1,8 @@
 grant {
+    permission java.util.PropertyPermission "os.name", "read";
+    permission java.io.FilePermission "<<ALL FILES>>", "execute";
+    permission java.util.PropertyPermission "line.separator", "read";
+    permission java.io.FilePermission "/etc/release", "read";
     permission java.net.SocketPermission "127.0.0.1", "connect,accept" ;
     permission java.net.SocketPermission "localhost", "listen" ;
     permission jdk.net.NetworkPermission "setOption.SO_FLOW_SLA";
--- a/jdk/test/jdk/nio/zipfs/Basic.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/jdk/nio/zipfs/Basic.java	Thu May 26 17:19:13 2016 +0000
@@ -31,6 +31,7 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.nio.file.ProviderMismatchException;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.StandardCopyOption;
 import java.nio.file.attribute.BasicFileAttributes;
@@ -39,14 +40,15 @@
 import java.io.IOException;
 import java.util.Collections;
 import java.util.Map;
-
+import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
 /**
  * @test
- * @bug 8038500 8040059 8150366 8150496
+ * @bug 8038500 8040059 8150366 8150496 8147539
  * @summary Basic test for zip provider
  *
  * @run main Basic
  * @run main/othervm/java.security.policy=test.policy Basic
+ * @modules jdk.zipfs
  */
 
 public class Basic {
@@ -89,7 +91,7 @@
         found = false;
         try (DirectoryStream<Path> stream = Files.newDirectoryStream(fs.getPath("/"))) {
             for (Path entry: stream) {
-                found = entry.toString().equals("/META-INF/");
+                found = entry.toString().equals("/META-INF");
                 if (found) break;
             }
         }
@@ -117,6 +119,13 @@
         if (!store.supportsFileAttributeView("basic"))
             throw new RuntimeException("BasicFileAttributeView should be supported");
 
+        // Test: watch register should throw PME
+        try {
+            fs.getPath("/")
+              .register(FileSystems.getDefault().newWatchService(), ENTRY_CREATE);
+            throw new RuntimeException("watch service is not supported");
+        } catch (ProviderMismatchException x) { }
+
         // Test: ClosedFileSystemException
         fs.close();
         if (fs.isOpen())
--- a/jdk/test/jdk/nio/zipfs/MultiReleaseJarTest.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/jdk/nio/zipfs/MultiReleaseJarTest.java	Thu May 26 17:19:13 2016 +0000
@@ -28,6 +28,7 @@
  * @library /lib/testlibrary/java/util/jar
  * @build Compiler JarBuilder CreateMultiReleaseTestJars
  * @run testng MultiReleaseJarTest
+ * @modules jdk.zipfs
  */
 
 import java.io.IOException;
--- a/jdk/test/jdk/nio/zipfs/PathOps.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/jdk/nio/zipfs/PathOps.java	Thu May 26 17:19:13 2016 +0000
@@ -31,11 +31,12 @@
 /**
  *
  * @test
- * @bug 8038500 8040059
+ * @bug 8038500 8040059 8139956 8146754
  * @summary Tests path operations for zip provider.
  *
  * @run main PathOps
  * @run main/othervm/java.security.policy=test.policy PathOps
+ * @modules jdk.zipfs
  */
 
 public class PathOps {
@@ -424,6 +425,11 @@
         test("/")
             .relativize("/a", "a")
             .relativize("/a/c", "a/c");
+        // 8146754
+        test("/tmp/path")
+            .relativize("/tmp/path/a.txt", "a.txt");
+        test("/tmp/path/")
+            .relativize("/tmp/path/a.txt", "a.txt");
 
         // normalize
         test("/")
@@ -486,7 +492,16 @@
         // isSameFile
         test("/fileDoesNotExist")
             .isSameFile("/fileDoesNotExist");
-    }
+
+        // 8139956
+        out.println("check getNameCount");
+        int nc = fs.getPath("/").relativize(fs.getPath("/")).getNameCount();
+        if (nc != 1) {
+            out.format("\tExpected: 1\n");
+            out.format("\tActual: %d\n",  nc);
+            throw new RuntimeException("getNameCount of empty path failed");
+        }
+     }
 
     static void npes() {
         header("NullPointerException");
--- a/jdk/test/jdk/nio/zipfs/ZFSTests.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/jdk/nio/zipfs/ZFSTests.java	Thu May 26 17:19:13 2016 +0000
@@ -22,11 +22,12 @@
  */
 
 /* @test
- * @bug 7156873 8040059 8028480 8034773
+ * @bug 7156873 8040059 8028480 8034773 8153248
  * @summary ZipFileSystem regression tests
  *
  * @run main ZFSTests
  * @run main/othervm/java.security.policy=test.policy ZFSTests
+ * @modules jdk.zipfs
  */
 
 
@@ -42,7 +43,7 @@
 
     public static void main(String[] args) throws Throwable {
         test7156873();
-        testOpenOptions();
+        tests();
     }
 
     static void test7156873() throws Throwable {
@@ -61,7 +62,7 @@
         }
     }
 
-    static void testOpenOptions() throws Throwable {
+    static void tests() throws Throwable {
         Path path = Paths.get("file.zip");
         try {
             URI uri = URI.create("jar:" + path.toUri());
@@ -95,6 +96,18 @@
                 } catch (IllegalArgumentException x) {
                     // expected x.printStackTrace();
                 }
+
+                //8153248
+                Path dir = fs.getPath("/dir");
+                Path subdir = fs.getPath("/dir/subdir");
+                Files.createDirectory(dir);
+                Files.createDirectory(subdir);
+                Files.list(dir)
+                     .forEach( child -> {
+                             System.out.println("child:" + child);
+                             if (child.toString().endsWith("/"))
+                                 throw new RuntimeException("subdir names ends with /");
+                          });
             }
         } finally {
             Files.deleteIfExists(path);
--- a/jdk/test/jdk/nio/zipfs/ZipFSTester.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/jdk/nio/zipfs/ZipFSTester.java	Thu May 26 17:19:13 2016 +0000
@@ -74,6 +74,7 @@
  * @summary Test Zip filesystem provider
  * @run main ZipFSTester
  * @run main/othervm/java.security.policy=test.policy ZipFSTester
+ * @modules jdk.zipfs
  */
 
 public class ZipFSTester {
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/OSInfo.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/OSInfo.java	Thu May 26 17:19:13 2016 +0000
@@ -28,6 +28,9 @@
 import java.security.PrivilegedAction;
 import java.util.HashMap;
 import java.util.Map;
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.InputStreamReader;
 
 import static jdk.testlibrary.OSInfo.OSType.*;
 
@@ -147,6 +150,28 @@
         }
     }
 
+    public static double getSolarisVersion() {
+        try {
+            OutputAnalyzer output = ProcessTools.executeProcess("uname", "-v");
+            System.out.println("'uname -v' finished with code "
+                    + output.getExitValue());
+            return Double.parseDouble(output.getOutput());
+        } catch (Exception e) {
+            System.out.println("First attempt failed with: " + e.getMessage());
+        }
+
+        //Try to get Solaris version from /etc/release
+        try (BufferedReader in =
+                     new BufferedReader(new FileReader("/etc/release"))) {
+            String line = in.readLine().trim().split(" ")[2];
+            return Double.parseDouble(line);
+        } catch (Exception e) {
+            System.out.println("Second attempt failed with: " + e.getMessage());
+        }
+
+        throw new RuntimeException("Unable to get Solaris version");
+    }
+
     public static class WindowsVersion implements Comparable<WindowsVersion> {
         private final int major;
 
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java	Thu May 26 17:19:13 2016 +0000
@@ -423,7 +423,7 @@
      * @param cmds The command line to execute.
      * @return The output from the process.
      */
-    public static OutputAnalyzer executeProcess(String... cmds) throws Throwable {
+    public static OutputAnalyzer executeProcess(String... cmds) throws Exception {
         return executeProcess(new ProcessBuilder(cmds));
     }
 
--- a/jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/InetAddress/nameservice/dns/cname.sh	Thu May 26 17:19:13 2016 +0000
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2002, 2011, 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
@@ -26,6 +26,7 @@
 
 # @test
 # @bug 4763315
+# @modules java.naming
 # @build CanonicalName Lookup
 # @run shell/timeout=120 cname.sh
 # @summary Test DNS provider's handling of CNAME records
--- a/jdk/test/sun/net/www/http/ChunkedInputStream/ChunkedEncodingTest.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/http/ChunkedInputStream/ChunkedEncodingTest.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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 4333920
+ * @modules jdk.httpserver
  * @run main ChunkedEncodingTest
  * @summary ChunkedEncodingTest unit test
  */
--- a/jdk/test/sun/net/www/http/ChunkedInputStream/ChunkedEncodingWithProgressMonitorTest.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/http/ChunkedInputStream/ChunkedEncodingWithProgressMonitorTest.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -26,6 +26,7 @@
  * @bug 4333920 4994372
  * @summary ChunkedEncoding unit test; MeteredStream/ProgressData problem
  * @modules java.base/sun.net
+ *          jdk.httpserver
  * @run main ChunkedEncodingWithProgressMonitorTest
  */
 
--- a/jdk/test/sun/net/www/http/ChunkedInputStream/TestAvailable.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/http/ChunkedInputStream/TestAvailable.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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 6446990
+ * @modules jdk.httpserver
  * @run main/othervm TestAvailable
  * @summary HttpURLConnection#available() reads more and more data into memory
  */
--- a/jdk/test/sun/net/www/http/ChunkedOutputStream/Test.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/http/ChunkedOutputStream/Test.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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 5026745 6631048
+ * @modules jdk.httpserver
  * @run main/othervm/timeout=500 Test
  * @summary Cannot flush output stream when writing to an HttpUrlConnection
  */
--- a/jdk/test/sun/net/www/http/HttpClient/B7025238.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/http/HttpClient/B7025238.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -30,6 +30,7 @@
 /*
  * @test
  * @bug 7025238
+ * @modules jdk.httpserver
  * @summary HttpURLConnection does not handle URLs with an empty path component
  */
 public class B7025238 {
--- a/jdk/test/sun/net/www/http/HttpURLConnection/DigestAuth.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/http/HttpURLConnection/DigestAuth.java	Thu May 26 17:19:13 2016 +0000
@@ -41,6 +41,7 @@
  * @summary Tests for HTTP Digest auth
  *          The impl maintains a cache for auth info,
  *          the testcases run in a separate JVM to avoid cache hits
+ * @modules jdk.httpserver
  * @run main/othervm DigestAuth good
  * @run main/othervm DigestAuth only_nonce
  * @run main/othervm DigestAuth sha1
--- a/jdk/test/sun/net/www/http/HttpURLConnection/NTLMAuthWithSM.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/http/HttpURLConnection/NTLMAuthWithSM.java	Thu May 26 17:19:13 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
@@ -40,6 +40,7 @@
  * @test
  * @bug 8137174
  * @modules java.base/sun.net.www.protocol.http.ntlm
+ *          jdk.httpserver
  * @summary Checks if NTLM auth works fine if security manager set
  * @run main/othervm/java.security.policy=NTLMAuthWithSM.policy NTLMAuthWithSM
  */
--- a/jdk/test/sun/net/www/http/HttpURLConnection/PostOnDelete.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/http/HttpURLConnection/PostOnDelete.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -30,6 +30,7 @@
 /*
  * @test
  * @bug 7157360
+ * @modules jdk.httpserver
  * @summary HttpURLConnection: HTTP method DELETE doesn't support output
  */
 public class PostOnDelete {
--- a/jdk/test/sun/net/www/protocol/http/6550798/test.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/6550798/test.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test
  * @bug 6550798
  * @summary Using InputStream.skip with ResponseCache will cause partial data to be cached
+ * @modules jdk.httpserver
  * @run main/othervm test
  */
 
--- a/jdk/test/sun/net/www/protocol/http/AsyncDisconnect.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/AsyncDisconnect.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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 6358532
+ * @modules jdk.httpserver
  * @run main/othervm AsyncDisconnect
  * @summary HttpURLConnection.disconnect doesn't really do the job
  */
--- a/jdk/test/sun/net/www/protocol/http/B5017051.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/B5017051.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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 5017051 6360774
+ * @modules jdk.httpserver
  * @run main/othervm B5017051
  * @summary Tests CR 5017051 & 6360774
  */
--- a/jdk/test/sun/net/www/protocol/http/B6299712.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/B6299712.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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 6299712 7150552
+ * @modules jdk.httpserver
  * @run main/othervm B6299712
  * @summary  NullPointerException in sun.net.www.protocol.http.HttpURLConnection.followRedirect
  */
--- a/jdk/test/sun/net/www/protocol/http/B6369510.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/B6369510.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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 6369510
+ * @modules jdk.httpserver
  * @run main/othervm B6369510
  * @summary HttpURLConnection sets Content-Type to application/x-www-form-urlencoded
  */
--- a/jdk/test/sun/net/www/protocol/http/B6518816.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/B6518816.java	Thu May 26 17:19:13 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 6518816
+ * @modules jdk.httpserver
  * @run main/othervm B6518816
  */
 
--- a/jdk/test/sun/net/www/protocol/http/B6641309.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/B6641309.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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 6641309
+ * @modules jdk.httpserver
  * @summary Wrong Cookie separator used in HttpURLConnection
  */
 
--- a/jdk/test/sun/net/www/protocol/http/B6660405.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/B6660405.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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 6660405
+ * @modules jdk.httpserver
  * @summary HttpURLConnection returns the wrong InputStream
  */
 
--- a/jdk/test/sun/net/www/protocol/http/B8012625.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/B8012625.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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 8012625
+ * @modules jdk.httpserver
  * @run main B8012625
  */
 
--- a/jdk/test/sun/net/www/protocol/http/BasicLongCredentials.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/BasicLongCredentials.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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 6947917
+ * @modules jdk.httpserver
  * @summary  Error in basic authentication when user name and password are long
  */
 
--- a/jdk/test/sun/net/www/protocol/http/ChunkedErrorStream.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/ChunkedErrorStream.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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 6488669 6595324 6993490
+ * @modules jdk.httpserver
  * @run main/othervm ChunkedErrorStream
  * @summary Chunked ErrorStream tests
  */
--- a/jdk/test/sun/net/www/protocol/http/HttpOnly.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/HttpOnly.java	Thu May 26 17:19:13 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,6 +23,7 @@
 /**
  * @test
  * @bug 7095980 8007315
+ * @modules jdk.httpserver
  * @summary Ensure HttpURLConnection (and supporting APIs) don't expose
  *          HttpOnly cookies
  */
--- a/jdk/test/sun/net/www/protocol/http/HttpStreams.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/HttpStreams.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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 8011719
+ * @modules jdk.httpserver
  * @summary Basic checks to verify behavior of returned input streams
  */
 
--- a/jdk/test/sun/net/www/protocol/http/NoCache.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/NoCache.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 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
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 7133367
+ * @modules jdk.httpserver
  * @summary ResponseCache.put should not be called when setUseCaches(false)
  */
 
--- a/jdk/test/sun/net/www/protocol/http/RedirectOnPost.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/RedirectOnPost.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
  * @library /lib/testlibrary/
+ * @modules jdk.httpserver
  * @build jdk.testlibrary.SimpleSSLContext
  * @compile RedirectOnPost.java
  * @run main/othervm RedirectOnPost
--- a/jdk/test/sun/net/www/protocol/http/StreamingOutputStream.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/StreamingOutputStream.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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 6472250
+ * @modules jdk.httpserver
  * @run main/othervm StreamingOutputStream
  * @summary HttpURLConnection.getOutputStream streaming mode bug when called multiple times
  */
--- a/jdk/test/sun/net/www/protocol/http/UserAuth.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/UserAuth.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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 6421122
+ * @modules jdk.httpserver
  * @run main/othervm UserAuth
  * @summary Authorization header removed for preemptive authentication by user code
  */
--- a/jdk/test/sun/net/www/protocol/http/UserCookie.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/UserCookie.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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 6439651
+ * @modules jdk.httpserver
  * @run main/othervm UserAuth
  * @summary Sending "Cookie" header with JRE 1.5.0_07 doesn't work anymore
  */
--- a/jdk/test/sun/net/www/protocol/http/ZoneId.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/http/ZoneId.java	Thu May 26 17:19:13 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
@@ -26,6 +26,7 @@
  * @bug 8027308
  * @key intermittent
  * @modules java.base/sun.net.www.protocol.http
+ *          jdk.httpserver
  * @summary  verifies that HttpURLConnection does not send the zone id in the
  *           'Host' field of the header:
  *              Host: [fe80::a00:27ff:aaaa:aaaa] instead of
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/HttpsCreateSockTest.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/HttpsCreateSockTest.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -26,6 +26,7 @@
  * @bug 6771432
  * @summary createSocket() - smpatch fails using 1.6.0_10 because of
  *     "Unconnected sockets not implemented"
+ * @modules jdk.httpserver
  * @run main/othervm HttpsCreateSockTest
  *
  *     SunJSSE does not support dynamic system properties, no way to re-use
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/HttpsSocketFacTest.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/HttpsSocketFacTest.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test
  * @bug 6614957
  * @summary HttpsURLConnection not using the set SSLSocketFactory for creating all its Sockets
+ * @modules jdk.httpserver
  * @run main/othervm HttpsSocketFacTest
  *
  *     SunJSSE does not support dynamic system properties, no way to re-use
--- a/jdk/test/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java	Thu May 26 17:19:13 2016 +0000
@@ -26,6 +26,9 @@
  * @bug 8132734 8144062
  * @summary Test that URL connections to multi-release jars can be runtime versioned
  * @library /lib/testlibrary/java/util/jar
+ * @modules java.compiler
+ *          jdk.httpserver
+ *          jdk.jartool
  * @build Compiler JarBuilder CreateMultiReleaseTestJars SimpleHttpServer
  * @run testng MultiReleaseJarURLConnection
  */
--- a/jdk/test/sun/nio/ch/TestMaxCachedBufferSize.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/nio/ch/TestMaxCachedBufferSize.java	Thu May 26 17:19:13 2016 +0000
@@ -43,6 +43,7 @@
 /*
  * @test
  * @requires sun.arch.data.model == "64"
+ * @modules java.management
  * @build TestMaxCachedBufferSize
  * @run main/othervm TestMaxCachedBufferSize
  * @run main/othervm -Djdk.nio.maxCachedBufferSize=0 TestMaxCachedBufferSize
--- a/jdk/test/sun/security/provider/NSASuiteB/TestDSAGenParameterSpec.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/security/provider/NSASuiteB/TestDSAGenParameterSpec.java	Thu May 26 17:19:13 2016 +0000
@@ -33,6 +33,7 @@
 import java.security.spec.InvalidParameterSpecException;
 import java.util.Arrays;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /*
  * @test
@@ -41,26 +42,15 @@
  * @summary Verify that DSAGenParameterSpec can and can only be used to generate
  *          DSA within some certain range of key sizes as described in the class
  *          specification (L, N) as (1024, 160), (2048, 224), (2048, 256) and
- *          (3072, 256) should be OK for DSAGenParameterSpec. But the real
- *          implementation SUN doesn't support (3072, 256).
- * @run main TestDSAGenParameterSpec
+ *          (3072, 256) should be OK for DSAGenParameterSpec.
+ * @run main TestDSAGenParameterSpec 2048,256,true 2048,224,true 1024,160,true 4096,256 3072,224 2048,160 1024,224 512,160
+ * @run main TestDSAGenParameterSpec 3072,256,true
  */
 public class TestDSAGenParameterSpec {
 
     private static final String ALGORITHM_NAME = "DSA";
     private static final String PROVIDER_NAME = "SUN";
 
-    private static final List<DataTuple> DATA = Arrays.asList(
-            new DataTuple(1024, 160, true, true),
-            new DataTuple(2048, 224, true, true),
-            new DataTuple(2048, 256, true, true),
-            new DataTuple(3072, 256, true, false),
-            new DataTuple(1024, 224),
-            new DataTuple(2048, 160),
-            new DataTuple(4096, 256),
-            new DataTuple(512, 160),
-            new DataTuple(3072, 224));
-
     private static void testDSAGenParameterSpec(DataTuple dataTuple)
             throws NoSuchAlgorithmException, NoSuchProviderException,
             InvalidParameterSpecException, InvalidAlgorithmParameterException {
@@ -84,14 +74,7 @@
             checkParam(param, genParamSpec);
             System.out.println("Test case passed");
         } catch (InvalidParameterException ipe) {
-            // The DSAGenParameterSpec API support this, but the real
-            // implementation in SUN doesn't
-            if (!dataTuple.isSunProviderSupported) {
-                System.out.println("Test case passed: expected "
-                        + "InvalidParameterException is caught");
-            } else {
-                throw new RuntimeException("Test case failed.", ipe);
-            }
+            throw new RuntimeException("Test case failed.", ipe);
         }
     }
 
@@ -127,11 +110,9 @@
             throw new RuntimeException("Wrong seed length");
         }
 
-        // use the parameters to generate real DSA keys
         KeyPairGenerator keyGen = KeyPairGenerator.getInstance(ALGORITHM_NAME,
                 PROVIDER_NAME);
         keyGen.initialize(spec);
-        keyGen.generateKeyPair();
     }
 
     private static DSAGenParameterSpec createGenParameterSpec(
@@ -158,10 +139,21 @@
     }
 
     public static void main(String[] args) throws Exception {
-        for (DataTuple dataTuple : DATA) {
+        List<DataTuple> dataTuples = Arrays.stream(args)
+                .map(arg -> arg.split(",")).map(params -> {
+                    int primePLen = Integer.valueOf(params[0]);
+                    int subprimeQLen = Integer.valueOf(params[1]);
+                    boolean isDSASpecSupported = false;
+                    if (params.length == 3) {
+                        isDSASpecSupported = Boolean.valueOf(params[2]);
+                    }
+                    return new DataTuple(primePLen, subprimeQLen,
+                            isDSASpecSupported);
+                }).collect(Collectors.toList());
+
+        for (DataTuple dataTuple : dataTuples) {
             testDSAGenParameterSpec(dataTuple);
         }
-        System.out.println("All tests passed");
     }
 
     private static class DataTuple {
@@ -169,18 +161,13 @@
         private int primePLen;
         private int subprimeQLen;
         private boolean isDSASpecSupported;
-        private boolean isSunProviderSupported;
 
         private DataTuple(int primePLen, int subprimeQLen,
-                boolean isDSASpecSupported, boolean isSunProviderSupported) {
+                boolean isDSASpecSupported) {
             this.primePLen = primePLen;
             this.subprimeQLen = subprimeQLen;
             this.isDSASpecSupported = isDSASpecSupported;
-            this.isSunProviderSupported = isSunProviderSupported;
-        }
-
-        private DataTuple(int primePLen, int subprimeQLen) {
-            this(primePLen, subprimeQLen, false, false);
         }
     }
 }
+
--- a/jdk/test/sun/security/provider/PolicyFile/Modules.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/security/provider/PolicyFile/Modules.java	Thu May 26 17:19:13 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
@@ -25,6 +25,19 @@
  * @test
  * @bug 8047771
  * @summary check permissions and principals from various modules
+ * @modules java.desktop
+ *          java.logging
+ *          java.management
+ *          java.security.jgss
+ *          java.smartcardio
+ *          java.sql
+ *          java.xml
+ *          java.xml.bind
+ *          jdk.attach
+ *          jdk.jdi
+ *          jdk.net
+ *          jdk.security.auth
+ *          jdk.security.jgss
  * @compile -addmods java.xml.ws,java.smartcardio Modules.java
  * @run main/othervm/java.security.policy==modules.policy
  *     -addmods java.xml.ws,java.smartcardio Modules
--- a/jdk/test/sun/util/logging/SourceClassName.java	Thu May 26 16:02:16 2016 +0000
+++ b/jdk/test/sun/util/logging/SourceClassName.java	Thu May 26 17:19:13 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -28,6 +28,7 @@
  *          logger.
  *
  * @modules java.base/sun.util.logging
+ *          java.logging
  * @compile -XDignore.symbol.file SourceClassName.java
  * @run main/othervm SourceClassName
  */