Merge
authorprr
Mon, 08 Feb 2016 09:41:53 -0800
changeset 35995 a4f500294ab3
parent 35994 3e67412f1556 (current diff)
parent 35716 07ecc6d51751 (diff)
child 35996 58d7e425291a
child 36443 d9d59282fc1a
Merge
jdk/test/jdk/internal/misc/JavaLangAccess/FormatUnsigned.java
--- a/jdk/.hgtags	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/.hgtags	Mon Feb 08 09:41:53 2016 -0800
@@ -346,3 +346,4 @@
 5e8370fb3ed925335164afe340d1e54beab2d4d5 jdk-9+101
 6eb3c8132e489dab81adde4ce29844904ce15482 jdk-9+102
 eee1ced1d8e78293f2a004af818ca474387dbebf jdk-9+103
+8faf1aec77a9517c69d2f4d8dd146429852ace7f jdk-9+104
--- a/jdk/make/lib/Awt2dLibraries.gmk	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Mon Feb 08 09:41:53 2016 -0800
@@ -235,6 +235,13 @@
   LIBAWT_MAPFILE :=
 endif
 
+# Turn off all warnings for debug_mem.c This is needed because the specific warning
+# about initializing a declared 'extern' cannot be turned off individually. Only
+# applies to debug builds.
+ifeq ($(TOOLCHAIN_TYPE), gcc)
+  BUILD_LIBAWT_debug_mem.c_CFLAGS := -w
+endif
+
 $(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
     LIBRARY := awt, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
@@ -248,7 +255,6 @@
     DISABLED_WARNINGS_clang := logical-op-parentheses extern-initializer, \
     DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
     DISABLED_WARNINGS_microsoft := 4297 4244 4267 4996, \
-    WARNINGS_AS_ERRORS_gcc := false, \
     ASFLAGS := $(LIBAWT_ASFLAGS), \
     MAPFILE := $(LIBAWT_MAPFILE), \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -343,6 +349,19 @@
       LIBAWT_XAWT_LIBS += -lpthread
     endif
 
+    ifeq ($(TOOLCHAIN_TYPE), gcc)
+      # Turn off all warnings for the following files since they contain warnings
+      # that cannot be turned of individually.
+      # redefining a macro
+      BUILD_LIBAWT_XAWT_gtk2_interface.c_CFLAGS := -w
+      # comparison between pointer and integer
+      BUILD_LIBAWT_XAWT_awt_Font.c_CFLAGS := -w
+      # initializing a declared 'extern'
+      BUILD_LIBAWT_XAWT_debug_mem.c_CFLAGS := -w
+      # decimal constant is unsigned only in ISO C90 (JAVASE_EMBEDDED)
+      BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS := -w
+   endif
+
     $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT, \
         LIBRARY := awt_xawt, \
         OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
@@ -356,7 +375,6 @@
             format-security int-to-pointer-cast parentheses, \
         DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
             E_ASSIGNMENT_TYPE_MISMATCH E_NON_CONST_INIT, \
-        WARNINGS_AS_ERRORS_gcc := false, \
         MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_xawt/mapfile-vers, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN) \
@@ -658,8 +676,11 @@
 
 LIBFONTMANAGER_CFLAGS += $(FONT_HEADERS) $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS
 
-# Turn off aliasing with GCC for ExtensionSubtables.cpp
-ifeq ($(OPENJDK_TARGET_OS), linux)
+ifeq ($(TOOLCHAIN_TYPE), gcc)
+  # Turn off all warnings for sunFont.c. This is needed because the specific warning
+  # about discarding 'const' qualifier cannot be turned off individually.
+  BUILD_LIBFONTMANAGER_sunFont.c_CFLAGS := -w
+  # Turn off aliasing with GCC for ExtensionSubtables.cpp
   BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS := -fno-strict-aliasing
 endif
 
@@ -674,14 +695,20 @@
     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
     OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
     CFLAGS_windows = -DCC_NOEX, \
-    DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast reorder \
-        delete-non-virtual-dtor type-limits missing-field-initializers, \
+    DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
+        type-limits missing-field-initializers, \
+    DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
+        maybe-uninitialized, \
     DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
         tautological-constant-out-of-range-compare int-to-pointer-cast, \
-    DISABLED_WARNINGS_solstudio := truncwarn, \
+    DISABLED_WARNINGS_C_solstudio = \
+        E_INTEGER_OVERFLOW_DETECTED \
+        E_ARG_INCOMPATIBLE_WITH_ARG_L \
+        E_ENUM_VAL_OVERFLOWS_INT_MAX, \
+    DISABLED_WARNINGS_CXX_solstudio := \
+        truncwarn wvarhidenmem wvarhidemem wbadlkginit identexpected \
+        hidevf w_novirtualdescr arrowrtn2, \
     DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090 4996 4146 4334, \
-    WARNINGS_AS_ERRORS_gcc := false, \
-    WARNINGS_AS_ERRORS_solstudio := false, \
     MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
     LDFLAGS := $(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/jdk/make/lib/CoreLibraries.gmk	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/make/lib/CoreLibraries.gmk	Mon Feb 08 09:41:53 2016 -0800
@@ -247,6 +247,13 @@
   LIBJIMAGE_TOOLCHAIN := TOOLCHAIN_LINK_CXX
 endif # OPENJDK_TARGET_OS aix
 
+JIMAGELIB_CPPFLAGS := \
+    -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
+    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
+    -I$(JDK_TOPDIR)/src/java.base/share/native/libjimage \
+    -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
+    #
+
 $(eval $(call SetupNativeCompilation,BUILD_LIBJIMAGE, \
     LIBRARY := jimage, \
     TOOLCHAIN := $(LIBJIMAGE_TOOLCHAIN), \
@@ -255,12 +262,8 @@
     SRC := $(JDK_TOPDIR)/src/java.base/share/native/libjimage \
         $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjimage, \
     EXCLUDES := $(LIBJIMAGE_EXCLUDES), \
-    CFLAGS := $(CFLAGS_JDKLIB) \
-        $(JIMAGELIB_CPPFLAGS) \
-        -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
-        -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-        -I$(JDK_TOPDIR)/src/java.base/share/native/libjimage \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
+    CFLAGS := $(CFLAGS_JDKLIB) $(JIMAGELIB_CPPFLAGS), \
+    CXXFLAGS := $(CXXFLAGS_JDKLIB) $(JIMAGELIB_CPPFLAGS), \
     CFLAGS_unix := -UDEBUG, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjimage/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
--- a/jdk/src/java.base/share/classes/java/lang/Long.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/lang/Long.java	Mon Feb 08 09:41:53 2016 -0800
@@ -401,18 +401,6 @@
      * @param offset the offset in the destination buffer to start at
      * @param len the number of characters to write
      */
-     static void formatUnsignedLong(long val, int shift, char[] buf, int offset, int len) {
-        // assert shift > 0 && shift <=5 : "Illegal shift value";
-        // assert offset >= 0 && offset < buf.length : "illegal offset";
-        // assert len > 0 && (offset + len) <= buf.length : "illegal length";
-        int charPos = offset + len;
-        int radix = 1 << shift;
-        int mask = radix - 1;
-        do {
-            buf[--charPos] = Integer.digits[((int) val) & mask];
-            val >>>= shift;
-        } while (charPos > offset);
-    }
 
     /** byte[]/LATIN1 version    */
     static void formatUnsignedLong0(long val, int shift, byte[] buf, int offset, int len) {
@@ -436,6 +424,39 @@
         } while (charPos > offset);
     }
 
+    static String fastUUID(long lsb, long msb) {
+        if (COMPACT_STRINGS) {
+            byte[] buf = new byte[36];
+            formatUnsignedLong0(lsb,        4, buf, 24, 12);
+            formatUnsignedLong0(lsb >>> 48, 4, buf, 19, 4);
+            formatUnsignedLong0(msb,        4, buf, 14, 4);
+            formatUnsignedLong0(msb >>> 16, 4, buf, 9,  4);
+            formatUnsignedLong0(msb >>> 32, 4, buf, 0,  8);
+
+            buf[23] = '-';
+            buf[18] = '-';
+            buf[13] = '-';
+            buf[8]  = '-';
+
+            return new String(buf, LATIN1);
+        } else {
+            byte[] buf = new byte[72];
+
+            formatUnsignedLong0UTF16(lsb,        4, buf, 24, 12);
+            formatUnsignedLong0UTF16(lsb >>> 48, 4, buf, 19, 4);
+            formatUnsignedLong0UTF16(msb,        4, buf, 14, 4);
+            formatUnsignedLong0UTF16(msb >>> 16, 4, buf, 9,  4);
+            formatUnsignedLong0UTF16(msb >>> 32, 4, buf, 0,  8);
+
+            StringUTF16.putChar(buf, 23, '-');
+            StringUTF16.putChar(buf, 18, '-');
+            StringUTF16.putChar(buf, 13, '-');
+            StringUTF16.putChar(buf,  8, '-');
+
+            return new String(buf, UTF16);
+        }
+    }
+
     /**
      * Returns a {@code String} object representing the specified
      * {@code long}.  The argument is converted to signed decimal
--- a/jdk/src/java.base/share/classes/java/lang/StringConcatHelper.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/lang/StringConcatHelper.java	Mon Feb 08 09:41:53 2016 -0800
@@ -342,4 +342,12 @@
         return new String(buf, coder);
     }
 
+    /**
+     * Provides the initial coder for the String.
+     * @return initial coder
+     */
+    static byte initialCoder() {
+        return String.COMPACT_STRINGS ? String.LATIN1 : String.UTF16;
+    }
+
 }
--- a/jdk/src/java.base/share/classes/java/lang/System.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/lang/System.java	Mon Feb 08 09:41:53 2016 -0800
@@ -1911,11 +1911,8 @@
             public void invokeFinalize(Object o) throws Throwable {
                 o.finalize();
             }
-            public void formatUnsignedLong(long val, int shift, char[] buf, int offset, int len) {
-                Long.formatUnsignedLong(val, shift, buf, offset, len);
-            }
-            public void formatUnsignedInt(int val, int shift, char[] buf, int offset, int len) {
-                Integer.formatUnsignedInt(val, shift, buf, offset, len);
+            public String fastUUID(long lsb, long msb) {
+                return Long.fastUUID(lsb, msb);
             }
         });
     }
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Mon Feb 08 09:41:53 2016 -0800
@@ -1043,7 +1043,8 @@
          * @param specialCaller the proposed calling class to perform the {@code invokespecial}
          * @return the desired method handle
          * @throws NoSuchMethodException if the method does not exist
-         * @throws IllegalAccessException if access checking fails
+         * @throws IllegalAccessException if access checking fails,
+         *                                or if the method is {@code static},
          *                                or if the method's variable arity modifier bit
          *                                is set and {@code asVarargsCollector} fails
          * @exception SecurityException if a security manager is present and it
@@ -1275,7 +1276,8 @@
          * @param m the reflected method
          * @param specialCaller the class nominally calling the method
          * @return a method handle which can invoke the reflected method
-         * @throws IllegalAccessException if access checking fails
+         * @throws IllegalAccessException if access checking fails,
+         *                                or if the method is {@code static},
          *                                or if the method's variable arity modifier bit
          *                                is set and {@code asVarargsCollector} fails
          * @throws NullPointerException if any argument is null
--- a/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Mon Feb 08 09:41:53 2016 -0800
@@ -30,7 +30,7 @@
 import jdk.internal.org.objectweb.asm.MethodVisitor;
 import jdk.internal.org.objectweb.asm.Opcodes;
 import jdk.internal.vm.annotation.ForceInline;
-import sun.misc.Unsafe;
+import jdk.internal.misc.Unsafe;
 
 import java.lang.invoke.MethodHandles.Lookup;
 import java.security.AccessController;
@@ -1497,7 +1497,7 @@
             //
             // The method handle shape after all length and coder mixers is:
             //   (int, byte, <args>)String = ("index", "coder", <args>)
-            byte initialCoder = 0; // initial coder
+            byte initialCoder = INITIAL_CODER;
             int initialLen = 0;    // initial length, in characters
             for (RecipeElement el : recipe.getElements()) {
                 switch (el.getTag()) {
@@ -1630,11 +1630,14 @@
         private static final ConcurrentMap<Class<?>, MethodHandle> LENGTH_MIXERS;
         private static final ConcurrentMap<Class<?>, MethodHandle> CODER_MIXERS;
         private static final Class<?> STRING_HELPER;
+        private static final byte INITIAL_CODER;
 
         static {
             try {
                 STRING_HELPER = Class.forName("java.lang.StringConcatHelper");
-            } catch (ClassNotFoundException e) {
+                MethodHandle initCoder = lookupStatic(Lookup.IMPL_LOOKUP, STRING_HELPER, "initialCoder", byte.class);
+                INITIAL_CODER = (byte) initCoder.invoke();
+            } catch (Throwable e) {
                 throw new AssertionError(e);
             }
 
--- a/jdk/src/java.base/share/classes/java/nio/file/Path.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/nio/file/Path.java	Mon Feb 08 09:41:53 2016 -0800
@@ -150,7 +150,7 @@
      * #normalize normalize} method, to eliminate redundant names, for cases where
      * <em>shell-like</em> navigation is required.
      *
-     * <p> If this path has one or more elements, and no root component, then
+     * <p> If this path has more than one element, and no root component, then
      * this method is equivalent to evaluating the expression:
      * <blockquote><pre>
      * subpath(0,&nbsp;getNameCount()-1);
--- a/jdk/src/java.base/share/classes/java/time/Duration.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/time/Duration.java	Mon Feb 08 09:41:53 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, 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
@@ -62,6 +62,7 @@
 package java.time;
 
 import static java.time.LocalTime.MINUTES_PER_HOUR;
+import static java.time.LocalTime.NANOS_PER_MILLI;
 import static java.time.LocalTime.NANOS_PER_SECOND;
 import static java.time.LocalTime.SECONDS_PER_DAY;
 import static java.time.LocalTime.SECONDS_PER_HOUR;
@@ -1214,8 +1215,16 @@
      * @throws ArithmeticException if numeric overflow occurs
      */
     public long toMillis() {
-        long millis = Math.multiplyExact(seconds, 1000);
-        millis = Math.addExact(millis, nanos / 1000_000);
+        long tempSeconds = seconds;
+        long tempNanos = nanos;
+        if (tempSeconds < 0) {
+            // change the seconds and nano value to
+            // handle Long.MIN_VALUE case
+            tempSeconds = tempSeconds + 1;
+            tempNanos = tempNanos - NANOS_PER_SECOND;
+        }
+        long millis = Math.multiplyExact(tempSeconds, 1000);
+        millis = Math.addExact(millis, tempNanos / NANOS_PER_MILLI);
         return millis;
     }
 
@@ -1229,8 +1238,16 @@
      * @throws ArithmeticException if numeric overflow occurs
      */
     public long toNanos() {
-        long totalNanos = Math.multiplyExact(seconds, NANOS_PER_SECOND);
-        totalNanos = Math.addExact(totalNanos, nanos);
+        long tempSeconds = seconds;
+        long tempNanos = nanos;
+        if (tempSeconds < 0) {
+            // change the seconds and nano value to
+            // handle Long.MIN_VALUE case
+            tempSeconds = tempSeconds + 1;
+            tempNanos = tempNanos - NANOS_PER_SECOND;
+        }
+        long totalNanos = Math.multiplyExact(tempSeconds, NANOS_PER_SECOND);
+        totalNanos = Math.addExact(totalNanos, tempNanos);
         return totalNanos;
     }
 
--- a/jdk/src/java.base/share/classes/java/util/UUID.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/util/UUID.java	Mon Feb 08 09:41:53 2016 -0800
@@ -392,17 +392,7 @@
      * @return  A string representation of this {@code UUID}
      */
     public String toString() {
-        char[] chars = new char[36];
-        jla.formatUnsignedLong(mostSigBits >> 32, 4, chars, 0, 8);
-        chars[8] = '-';
-        jla.formatUnsignedLong(mostSigBits >> 16, 4, chars, 9, 4);
-        chars[13] = '-';
-        jla.formatUnsignedLong(mostSigBits, 4, chars, 14, 4);
-        chars[18] = '-';
-        jla.formatUnsignedLong(leastSigBits >> 48, 4, chars, 19, 4);
-        chars[23] = '-';
-        jla.formatUnsignedLong(leastSigBits, 4, chars, 24, 12);
-        return jla.newStringUnsafe(chars);
+        return jla.fastUUID(leastSigBits, mostSigBits);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/util/stream/FindOps.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/util/stream/FindOps.java	Mon Feb 08 09:41:53 2016 -0800
@@ -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
@@ -107,7 +107,7 @@
      */
     private static final class FindOp<T, O> implements TerminalOp<T, O> {
         private final StreamShape shape;
-        final boolean mustFindFirst;
+        final int opFlags;
         final O emptyValue;
         final Predicate<O> presentPredicate;
         final Supplier<TerminalSink<T, O>> sinkSupplier;
@@ -129,7 +129,7 @@
                        O emptyValue,
                        Predicate<O> presentPredicate,
                        Supplier<TerminalSink<T, O>> sinkSupplier) {
-            this.mustFindFirst = mustFindFirst;
+            this.opFlags = StreamOpFlag.IS_SHORT_CIRCUIT | (mustFindFirst ? 0 : StreamOpFlag.NOT_ORDERED);
             this.shape = shape;
             this.emptyValue = emptyValue;
             this.presentPredicate = presentPredicate;
@@ -138,7 +138,7 @@
 
         @Override
         public int getOpFlags() {
-            return StreamOpFlag.IS_SHORT_CIRCUIT | (mustFindFirst ? 0 : StreamOpFlag.NOT_ORDERED);
+            return opFlags;
         }
 
         @Override
@@ -156,7 +156,10 @@
         @Override
         public <P_IN> O evaluateParallel(PipelineHelper<T> helper,
                                          Spliterator<P_IN> spliterator) {
-            return new FindTask<>(this, helper, spliterator).invoke();
+            // This takes into account the upstream ops flags and the terminal
+            // op flags and therefore takes into account findFirst or findAny
+            boolean mustFindFirst = StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags());
+            return new FindTask<>(this, mustFindFirst, helper, spliterator).invoke();
         }
     }
 
@@ -250,16 +253,20 @@
     private static final class FindTask<P_IN, P_OUT, O>
             extends AbstractShortCircuitTask<P_IN, P_OUT, O, FindTask<P_IN, P_OUT, O>> {
         private final FindOp<P_OUT, O> op;
+        private final boolean mustFindFirst;
 
         FindTask(FindOp<P_OUT, O> op,
+                 boolean mustFindFirst,
                  PipelineHelper<P_OUT> helper,
                  Spliterator<P_IN> spliterator) {
             super(helper, spliterator);
+            this.mustFindFirst = mustFindFirst;
             this.op = op;
         }
 
         FindTask(FindTask<P_IN, P_OUT, O> parent, Spliterator<P_IN> spliterator) {
             super(parent, spliterator);
+            this.mustFindFirst = parent.mustFindFirst;
             this.op = parent.op;
         }
 
@@ -283,7 +290,7 @@
         @Override
         protected O doLeaf() {
             O result = helper.wrapAndCopyInto(op.sinkSupplier.get(), spliterator).get();
-            if (!op.mustFindFirst) {
+            if (!mustFindFirst) {
                 if (result != null)
                     shortCircuit(result);
                 return null;
@@ -300,7 +307,7 @@
 
         @Override
         public void onCompletion(CountedCompleter<?> caller) {
-            if (op.mustFindFirst) {
+            if (mustFindFirst) {
                     for (FindTask<P_IN, P_OUT, O> child = leftChild, p = null; child != p;
                          p = child, child = rightChild) {
                     O result = child.getLocalResult();
--- a/jdk/src/java.base/share/classes/java/util/stream/SliceOps.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/util/stream/SliceOps.java	Mon Feb 08 09:41:53 2016 -0800
@@ -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
@@ -139,7 +139,7 @@
                 }
                 else {
                     // @@@ OOMEs will occur for LongStream.range(0, Long.MAX_VALUE).filter(i -> true).limit(n)
-                    //     regardless of the value of n
+                    //     when n * parallelismLevel is sufficiently large.
                     //     Need to adjust the target size of splitting for the
                     //     SliceTask from say (size / k) to say min(size / k, 1 << 14)
                     //     This will limit the size of the buffers created at the leaf nodes
@@ -604,8 +604,15 @@
                 return nb.build();
             }
             else {
-                Node<P_OUT> node = helper.wrapAndCopyInto(helper.makeNodeBuilder(-1, generator),
-                                                          spliterator).build();
+                final Node.Builder<P_OUT> nb = op.makeNodeBuilder(-1, generator);
+                if (targetOffset == 0) { // limit only
+                    Sink<P_OUT> opSink = op.opWrapSink(helper.getStreamAndOpFlags(), nb);
+                    helper.copyIntoWithCancel(helper.wrapSink(opSink), spliterator);
+                }
+                else {
+                    helper.wrapAndCopyInto(nb, spliterator);
+                }
+                Node<P_OUT> node = nb.build();
                 thisNodeSize = node.count();
                 completed = true;
                 spliterator = null;
--- a/jdk/src/java.base/share/classes/java/util/stream/StreamSpliterators.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/util/stream/StreamSpliterators.java	Mon Feb 08 09:41:53 2016 -0800
@@ -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
@@ -186,7 +186,7 @@
 
         @Override
         public Spliterator<P_OUT> trySplit() {
-            if (isParallel && !finished) {
+            if (isParallel && buffer == null && !finished) {
                 init();
 
                 Spliterator<P_IN> split = spliterator.trySplit();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/Version.java	Mon Feb 08 09:41:53 2016 -0800
@@ -0,0 +1,609 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk;
+
+import java.math.BigInteger;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * A representation of the JDK version-string which contains a version
+ * number optionally followed by pre-release and build information.
+ *
+ * <h2><a name="verNum">Version numbers</a></h2>
+ *
+ * A <em>version number</em>, {@code $VNUM}, is a non-empty sequence of
+ * non-negative integer numerals, without leading or trailing zeroes,
+ * separated by period characters (U+002E); i.e., it matches the regular
+ * expression {@code ^[1-9][0-9]*(((\.0)*\.[1-9][0-9]*)*)*$}. The sequence may
+ * be of arbitrary length but the first three elements are assigned specific
+ * meanings, as follows:
+ *
+ * <blockquote><pre>
+ *     $MAJOR.$MINOR.$SECURITY
+ * </pre></blockquote>
+ *
+ * <ul>
+ *
+ * <li><p> <a name="major">{@code $MAJOR}</a> --- The major version number,
+ * incremented for a major release that contains significant new features as
+ * specified in a new edition of the Java&#160;SE Platform Specification,
+ * <em>e.g.</em>, <a href="https://jcp.org/en/jsr/detail?id=337">JSR 337</a>
+ * for Java&#160;SE&#160;8. Features may be removed in a major release, given
+ * advance notice at least one major release ahead of time, and incompatible
+ * changes may be made when justified. The {@code $MAJOR} version number of
+ * JDK&#160;8 was {@code 8}; the {@code $MAJOR} version number of JDK&#160;9
+ * is {@code 9}. </p></li>
+ *
+ * <li><p> <a name="minor">{@code $MINOR}</a> --- The minor version number,
+ * incremented for a minor update release that may contain compatible bug
+ * fixes, revisions to standard APIs mandated by a <a
+ * href="https://jcp.org/en/procedures/jcp2#5.3">Maintenance Release</a> of
+ * the relevant Platform Specification, and implementation features outside
+ * the scope of that Specification such as new JDK-specific APIs, additional
+ * service providers, new garbage collectors, and ports to new hardware
+ * architectures. {@code $MINOR} is reset to zero when {@code $MAJOR} is
+ * incremented. </p></li>
+ *
+ * <li><p> <a name="security">{@code $SECURITY}</a> --- The security level,
+ * incremented for a security-update release that contains critical fixes
+ * including those necessary to improve security. {@code $SECURITY} is reset
+ * to zero <strong>only</strong> when {@code $MAJOR} is incremented. A higher
+ * value of {@code $SECURITY} for a given {@code $MAJOR} value, therefore,
+ * always indicates a more secure release, regardless of the value of {@code
+ * $MINOR}. </p></li>
+ *
+ * </ul>
+ *
+ * <p> The fourth and later elements of a version number are free for use by
+ * downstream consumers of the JDK code base.  Such a consumer may,
+ * <em>e.g.</em>, use the fourth element to identify patch releases which
+ * contain a small number of critical non-security fixes in addition to the
+ * security fixes in the corresponding security release. </p>
+ *
+ * <p> The version number does not include trailing zero elements;
+ * <em>i.e.</em>, {@code $SECURITY} is omitted if it has the value zero, and
+ * {@code $MINOR} is omitted if both {@code $MINOR} and {@code $SECURITY} have
+ * the value zero. </p>
+ *
+ * <p> The sequence of numerals in a version number is compared to another
+ * such sequence in numerical, pointwise fashion; <em>e.g.</em>, {@code 9.9.1}
+ * is less than {@code 9.10.0}. If one sequence is shorter than another then
+ * the missing elements of the shorter sequence are considered to be zero;
+ * <em>e.g.</em>, {@code 9.1.2} is equal to {@code 9.1.2.0} but less than
+ * {@code 9.1.2.1}. </p>
+ *
+ * <h2><a name="verStr">Version strings</a></h2>
+ *
+ * <p> A <em>version string</em> {@code $VSTR} consists of a version number
+ * {@code $VNUM}, as described above, optionally followed by pre-release and
+ * build information, in the format </p>
+ *
+ * <blockquote><pre>
+ *     $VNUM(-$PRE)?(\+($BUILD)?(-$OPT)?)?
+ * </pre></blockquote>
+ *
+ * <p> where: </p>
+ *
+ * <ul>
+ *
+ * <li><p> <a name="pre">{@code $PRE}</a>, matching {@code ([a-zA-Z0-9]+)} ---
+ * A pre-release identifier.  Typically {@code ea}, for an early-access
+ * release that's under active development and potentially unstable, or {@code
+ * internal}, for an internal developer build.
+ *
+ * <li><p> <a name="build">{@code $BUILD}</a>, matching {@code
+ * (0|[1-9][0-9]*)} --- The build number, incremented for each promoted build.
+ * {@code $BUILD} is reset to {@code 1} when any portion of {@code $VNUM} is
+ * incremented. </p>
+ *
+ * <li><p> <a name="opt">{@code $OPT}</a>, matching {@code ([-a-zA-Z0-9\.]+)}
+ * --- Additional build information, if desired.  In the case of an {@code
+ * internal} build this will often contain the date and time of the
+ * build. </p>
+ *
+ * </ul>
+ *
+ * <p> When comparing two version strings the value of {@code $OPT}, if
+ * present, may or may not be significant depending on the chosen comparison
+ * method.  The comparison methods {@link #compareTo(Version) compareTo()} and
+ * {@link #compareToIgnoreOpt(Version) compareToIgnoreOpt{}} should be used
+ * consistently with the corresponding methods {@link #equals(Object) equals()}
+ * and {@link #equalsIgnoreOpt(Object) equalsIgnoreOpt()}.  </p>
+ *
+ * <p> A <em>short version string</em> ({@code $SVSTR}), often useful in less
+ * formal contexts, is simply {@code $VNUM} optionally ended with {@code
+ * -$PRE}. </p>
+ *
+ * @since  9
+ */
+public final class Version
+    implements Comparable<Version>
+{
+    private final List<Integer>     version;
+    private final Optional<String>  pre;
+    private final Optional<Integer> build;
+    private final Optional<String>  optional;
+
+    private static Version current;
+
+    // $VNUM(-$PRE)?(\+($BUILD)?(\-$OPT)?)?
+    // RE limits the format of version strings
+    // ([1-9][0-9]*(?:(?:\.0)*\.[1-9][0-9]*)*)(?:-([a-zA-Z0-9]+))?(?:(\+)(0|[1-9][0-9]*)?)?(?:-([-a-zA-Z0-9.]+))?
+
+    private static final String VNUM
+        = "(?<VNUM>[1-9][0-9]*(?:(?:\\.0)*\\.[1-9][0-9]*)*)";
+    private static final String VNUM_GROUP  = "VNUM";
+
+    private static final String PRE      = "(?:-(?<PRE>[a-zA-Z0-9]+))?";
+    private static final String PRE_GROUP   = "PRE";
+
+    private static final String BUILD
+        = "(?:(?<PLUS>\\+)(?<BUILD>0|[1-9][0-9]*)?)?";
+    private static final String PLUS_GROUP  = "PLUS";
+    private static final String BUILD_GROUP = "BUILD";
+
+    private static final String OPT      = "(?:-(?<OPT>[-a-zA-Z0-9.]+))?";
+    private static final String OPT_GROUP   = "OPT";
+
+    private static final String VSTR_FORMAT
+        = "^" + VNUM + PRE + BUILD + OPT + "$";
+    private static final Pattern VSTR_PATTERN = Pattern.compile(VSTR_FORMAT);
+
+    /**
+     * Constructs a valid JDK <a href="verStr">version string</a> containing a
+     * <a href="#verNum">version number</a> followed by pre-release and build
+     * information.
+     *
+     * @param  s
+     *         A string to be interpreted as a version
+     *
+     * @throws  IllegalArgumentException
+     *          If the given string cannot be interpreted a valid version
+     *
+     * @throws  NullPointerException
+     *          If {@code s} is {@code null}
+     *
+     * @throws  NumberFormatException
+     *          If an element of the version number or the build number cannot
+     *          be represented as an {@link Integer}
+     */
+    private Version(String s) {
+        if (s == null)
+            throw new NullPointerException();
+
+        Matcher m = VSTR_PATTERN.matcher(s);
+        if (!m.matches())
+            throw new IllegalArgumentException("Invalid version string: '"
+                                               + s + "'");
+
+        // $VNUM is a dot-separated list of integers of arbitrary length
+        version
+            = Collections.unmodifiableList(
+                  Arrays.stream(m.group(VNUM_GROUP).split("\\."))
+                  .map(Integer::parseInt)
+                  .collect(Collectors.toList()));
+
+        pre = Optional.ofNullable(m.group(PRE_GROUP));
+
+        String b = m.group(BUILD_GROUP);
+        // $BUILD is an integer
+        build = (b == null)
+             ? Optional.<Integer>empty()
+             : Optional.ofNullable(Integer.parseInt(b));
+
+        optional = Optional.ofNullable(m.group(OPT_GROUP));
+
+        // empty '+'
+        if ((m.group(PLUS_GROUP) != null) && !build.isPresent()) {
+            if (optional.isPresent()) {
+                if (pre.isPresent())
+                    throw new IllegalArgumentException("'+' found with"
+                        + " pre-release and optional components:'" + s + "'");
+            } else {
+                throw new IllegalArgumentException("'+' found with neither"
+                    + " build or optional components: '" + s + "'");
+            }
+        }
+    }
+
+    /**
+     * Parses the given string as a valid JDK <a
+     * href="#verStr">version string</a> containing a <a
+     * href="#verNum">version number</a> followed by pre-release and
+     * build information.
+     *
+     * @param  s
+     *         A string to interpret as a version
+     *
+     * @throws  IllegalArgumentException
+     *          If the given string cannot be interpreted a valid version
+     *
+     * @throws  NullPointerException
+     *          If the given string is {@code null}
+     *
+     * @throws  NumberFormatException
+     *          If an element of the version number or the build number cannot
+     *          be represented as an {@link Integer}
+     *
+     * @return  This version
+     */
+    public static Version parse(String s) {
+        return new Version(s);
+    }
+
+    /**
+     * Returns {@code System.getProperty("java.version")} as a Version.
+     *
+     * @throws  SecurityException
+     *          If a security manager exists and its {@link
+     *          SecurityManager#checkPropertyAccess(String)
+     *          checkPropertyAccess} method does not allow access to the
+     *          system property "java.version"
+     *
+     * @return  {@code System.getProperty("java.version")} as a Version
+     */
+    public static Version current() {
+        if (current == null) {
+            current = parse(AccessController.doPrivileged(
+                new PrivilegedAction<>() {
+                    public String run() {
+                        return System.getProperty("java.version");
+                    }
+                }));
+        }
+        return current;
+    }
+
+    /**
+     * Returns the <a href="#major">major</a> version number.
+     *
+     * @return  The major version number
+     */
+    public int major() {
+        return version.get(0);
+    }
+
+    /**
+     * Returns the <a href="#minor">minor</a> version number or zero if it was
+     * not set.
+     *
+     * @return  The minor version number or zero if it was not set
+     */
+    public int minor() {
+        return (version.size() > 1 ? version.get(1) : 0);
+    }
+
+    /**
+     * Returns the <a href="#security">security</a> version number or zero if
+     * it was not set.
+     *
+     * @return  The security version number or zero if it was not set
+     */
+    public int security() {
+        return (version.size() > 2 ? version.get(2) : 0);
+    }
+
+    /**
+     * Returns an unmodifiable {@link java.util.List List} of the
+     * integer numerals contained in the <a href="#verNum">version
+     * number</a>.  The {@code List} always contains at least one
+     * element corresponding to the <a href="#major">major version
+     * number</a>.
+     *
+     * @return  An unmodifiable list of the integer numerals
+     *          contained in the version number
+     */
+    public List<Integer> version() {
+        return version;
+    }
+
+    /**
+     * Returns the optional <a href="#pre">pre-release</a> information.
+     *
+     * @return  The optional pre-release information as a String
+     */
+    public Optional<String> pre() {
+        return pre;
+    }
+
+    /**
+     * Returns the <a href="#build">build number</a>.
+     *
+     * @return The optional build number.
+     */
+    public Optional<Integer> build() {
+        return build;
+    }
+
+    /**
+     * Returns <a href="#opt">optional</a> additional identifying build
+     * information.
+     *
+     * @return  Additional build information as a String
+     */
+    public Optional<String> optional() {
+        return optional;
+    }
+
+    /**
+     * Compares this version to another.
+     *
+     * <p> Each of the components in the <a href="#verStr">version</a> is
+     * compared in the follow order of precedence: version numbers,
+     * pre-release identifiers, build numbers, optional build information. </p>
+     *
+     * <p> Comparison begins by examining the sequence of version numbers.  If
+     * one sequence is shorter than another, then the missing elements of the
+     * shorter sequence are considered to be zero. </p>
+     *
+     * <p> A version with a pre-release identifier is always considered to be
+     * less than a version without one.  Pre-release identifiers are compared
+     * numerically when they consist only of digits, and lexicographically
+     * otherwise.  Numeric identifiers are considered to be less than
+     * non-numeric identifiers.  </p>
+     *
+     * <p> A version without a build number is always less than one with a
+     * build number; otherwise build numbers are compared numerically. </p>
+     *
+     * <p> The optional build information is compared lexicographically.
+     * During this comparison, a version with optional build information is
+     * considered to be greater than a version without one. </p>
+     *
+     * <p> A version is not comparable to any other type of object.
+     *
+     * @param  ob
+     *         The object to be compared
+     *
+     * @return  A negative integer, zero, or a positive integer if this
+     *          {@code Version} is less than, equal to, or greater than the
+     *          given {@code Version}
+     *
+     * @throws  NullPointerException
+     *          If the given object is {@code null}
+     */
+    @Override
+    public int compareTo(Version ob) {
+        return compare(ob, false);
+    }
+
+    /**
+     * Compares this version to another disregarding optional build
+     * information.
+     *
+     * <p> Two versions are compared by examining the version string as
+     * described in {@link #compareTo(Version)} with the exception that the
+     * optional build information is always ignored. </p>
+     *
+     * <p> A version is not comparable to any other type of object.
+     *
+     * @param  ob
+     *         The object to be compared
+     *
+     * @return  A negative integer, zero, or a positive integer if this
+     *          {@code Version} is less than, equal to, or greater than the
+     *          given {@code Version}
+     *
+     * @throws  NullPointerException
+     *          If the given object is {@code null}
+     */
+    public int compareToIgnoreOpt(Version ob) {
+        return compare(ob, true);
+    }
+
+    private int compare(Version ob, boolean ignoreOpt) {
+        if (ob == null)
+            throw new NullPointerException("Invalid argument");
+
+        int ret = compareVersion(ob);
+        if (ret != 0)
+            return ret;
+
+        ret = comparePre(ob);
+        if (ret != 0)
+            return ret;
+
+        ret = compareBuild(ob);
+        if (ret != 0)
+            return ret;
+
+        if (!ignoreOpt)
+            return compareOpt(ob);
+
+        return 0;
+    }
+
+    private int compareVersion(Version ob) {
+        int size = version.size();
+        int oSize = ob.version().size();
+        int min = Math.min(size, oSize);
+        for (int i = 0; i < min; i++) {
+            Integer val = version.get(i);
+            Integer oVal = ob.version().get(i);
+            if (val != oVal)
+                return val - oVal;
+        }
+        if (size != oSize)
+            return size - oSize;
+        return 0;
+    }
+
+    private int comparePre(Version ob) {
+        Optional<String> oPre = ob.pre();
+        if (!pre.isPresent()) {
+            if (oPre.isPresent())
+                return 1;
+        } else {
+            if (!oPre.isPresent())
+                return -1;
+            String val = pre.get();
+            String oVal = oPre.get();
+            if (val.matches("\\d+")) {
+                return (oVal.matches("\\d+")
+                        ? (new BigInteger(val)).compareTo(new BigInteger(oVal))
+                        : -1);
+            } else {
+                return (oVal.matches("\\d+")
+                        ? 1
+                        : val.compareTo(oVal));
+            }
+        }
+        return 0;
+    }
+
+    private int compareBuild(Version ob) {
+        Optional<Integer> oBuild = ob.build();
+        if (oBuild.isPresent()) {
+            return (build.isPresent()
+                   ? build.get().compareTo(oBuild.get())
+                   : 1);
+        } else if (build.isPresent()) {
+            return -1;
+        }
+        return 0;
+    }
+
+    private int compareOpt(Version ob) {
+        Optional<String> oOpt = ob.optional();
+        if (!optional.isPresent()) {
+            if (oOpt.isPresent())
+                return -1;
+        } else {
+            if (!oOpt.isPresent())
+                return 1;
+            return optional.get().compareTo(oOpt.get());
+        }
+        return 0;
+    }
+
+    /**
+     * Returns a string representation of this version.
+     *
+     * @return  The version string
+     */
+    @Override
+    public String toString() {
+        StringBuilder sb
+            = new StringBuilder(version.stream()
+                                .map(Object::toString)
+                                .collect(Collectors.joining(".")));
+        pre.ifPresent(v -> sb.append("-").append(v));
+
+        if (build.isPresent()) {
+            sb.append("+").append(build.get());
+            if (optional.isPresent())
+                sb.append("-").append(optional.get());
+        } else {
+            if (optional.isPresent()) {
+                sb.append(pre.isPresent() ? "-" : "+-");
+                sb.append(optional.get());
+            }
+        }
+
+        return sb.toString();
+    }
+
+    /**
+     * Determines whether this {@code Version} is equal to another object.
+     *
+     * <p> Two {@code Version}s are equal if and only if they represent the
+     * same version string.
+     *
+     * <p> This method satisfies the general contract of the {@link
+     * Object#equals(Object) Object.equals} method. </p>
+     *
+     * @param  ob
+     *         The object to which this {@code Version} is to be compared
+     *
+     * @return  {@code true} if, and only if, the given object is a {@code
+     *          Version} that is identical to this {@code Version}
+     *
+     */
+    @Override
+    public boolean equals(Object ob) {
+        boolean ret = equalsIgnoreOpt(ob);
+        if (!ret)
+            return false;
+
+        Version that = (Version)ob;
+        return (this.optional().equals(that.optional()));
+    }
+
+    /**
+     * Determines whether this {@code Version} is equal to another
+     * disregarding optional build information.
+     *
+     * <p> Two {@code Version}s are equal if and only if they represent the
+     * same version string disregarding the optional build information.
+     *
+     * @param  ob
+     *         The object to which this {@code Version} is to be compared
+     *
+     * @return  {@code true} if, and only if, the given object is a {@code
+     *          Version} that is identical to this {@code Version}
+     *          ignoring the optinal build information
+     *
+     */
+    public boolean equalsIgnoreOpt(Object ob) {
+        if (this == ob)
+            return true;
+        if (!(ob instanceof Version))
+            return false;
+
+        Version that = (Version)ob;
+        return (this.version().equals(that.version())
+                && this.pre().equals(that.pre())
+                && this.build().equals(that.build()));
+    }
+
+    /**
+     * Returns the hash code of this version.
+     *
+     * <p> This method satisfies the general contract of the {@link
+     * Object#hashCode Object.hashCode} method.
+     *
+     * @return  The hashcode of this version
+     */
+    @Override
+    public int hashCode() {
+        int h = 1;
+        int p = 17;
+
+        h = p * h + version.hashCode();
+        h = p * h + pre.hashCode();
+        h = p * h + build.hashCode();
+        h = p * h + optional.hashCode();
+
+        return h;
+    }
+}
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java	Mon Feb 08 09:41:53 2016 -0800
@@ -124,12 +124,7 @@
     void invokeFinalize(Object o) throws Throwable;
 
     /**
-     * Invokes Long.formatUnsignedLong(long val, int shift, char[] buf, int offset, int len)
+     * Invokes Long.fastUUID
      */
-    void formatUnsignedLong(long val, int shift, char[] buf, int offset, int len);
-
-    /**
-     * Invokes Integer.formatUnsignedInt(long val, int shift, char[] buf, int offset, int len)
-     */
-    void formatUnsignedInt(int val, int shift, char[] buf, int offset, int len);
+    String fastUUID(long lsb, long msb);
 }
--- a/jdk/src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp	Mon Feb 08 09:41:53 2016 -0800
@@ -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
@@ -210,7 +210,7 @@
     // Locate resource location data.
     ImageLocation location;
     bool found = reader->find_location(path, location);
-    delete path;
+    delete[] path;
     // Resource not found.
     if (!found) return NULL;
     // Expand stream into array.
--- a/jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp	Mon Feb 08 09:41:53 2016 -0800
@@ -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
@@ -86,7 +86,7 @@
 }
 
 void ImageDecompressor::image_decompressor_close() {
-    delete _decompressors;
+    delete[] _decompressors;
 }
 
 /*
@@ -135,13 +135,13 @@
             decompressor->decompress_resource(compressed_resource, decompressed_resource,
                 &_header, strings);
             if (compressed_resource_base != compressed) {
-                delete compressed_resource_base;
+                delete[] compressed_resource_base;
             }
             compressed_resource = decompressed_resource;
         }
     } while (has_header);
     memcpy(uncompressed, decompressed_resource, uncompressed_size);
-    delete decompressed_resource;
+    delete[] decompressed_resource;
 }
 
 // Zip decompressor
@@ -190,8 +190,8 @@
             { // String in Strings table
                 *uncompressed_resource = 1;
                 uncompressed_resource += 1;
-                int i = decompress_int(data);
-                const char * string = strings->get(i);
+                int k = decompress_int(data);
+                const char * string = strings->get(k);
                 int str_length = (int) strlen(string);
                 Endian::set_java(uncompressed_resource, str_length);
                 uncompressed_resource += 2;
@@ -241,7 +241,7 @@
                                 *fullpkg = '/';
                                 memcpy(uncompressed_resource, pkg_base, len);
                                 uncompressed_resource += len;
-                                delete pkg_base;
+                                delete[] pkg_base;
                                 desc_length += len;
                             } else { // Empty package
                                 // Nothing to do.
--- a/jdk/test/ProblemList.txt	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/ProblemList.txt	Mon Feb 08 09:41:53 2016 -0800
@@ -315,6 +315,9 @@
 ############################################################################
 
 # jdk_imageio
+javax/imageio/plugins/shared/CanWriteSequence.java              generic-all
+javax/imageio/plugins/tiff/MultiPageTest/MultiPageTest.java     generic-all
+javax/imageio/plugins/tiff/WriteToSequenceAfterAbort.java       generic-all
 
 ############################################################################
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/String/concat/CompactStringsInitialCoder.java	Mon Feb 08 09:41:53 2016 -0800
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @summary StringConcatFactory MH_INLINE_SIZED_EXACT strategy does not work with -XX:-CompactStrings
+ * @bug 8148869
+ *
+ * @compile -XDstringConcat=indy -source 1.9 -target 1.9 CompactStringsInitialCoder.java
+ *
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                           -XX:+CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED                     -XX:+CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED                     -XX:+CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT               -XX:+CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT               -XX:+CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT           -XX:+CompactStrings   CompactStringsInitialCoder
+ *
+ * @compile -XDstringConcat=indyWithConstants -source 1.9 -target 1.9 CompactStringsInitialCoder.java
+ *
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                           -XX:+CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED                     -XX:+CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED                     -XX:+CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT               -XX:+CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT               -XX:+CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT           -XX:+CompactStrings   CompactStringsInitialCoder
+ *
+ * @compile -XDstringConcat=indy -source 1.9 -target 1.9 CompactStringsInitialCoder.java
+ *
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                           -XX:-CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED                     -XX:-CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED                     -XX:-CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT               -XX:-CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT               -XX:-CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT           -XX:-CompactStrings   CompactStringsInitialCoder
+ *
+ * @compile -XDstringConcat=indyWithConstants -source 1.9 -target 1.9 CompactStringsInitialCoder.java
+ *
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                           -XX:-CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED                     -XX:-CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED                     -XX:-CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT               -XX:-CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT               -XX:-CompactStrings   CompactStringsInitialCoder
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT           -XX:-CompactStrings   CompactStringsInitialCoder
+*/
+import java.lang.StringBuilder;
+
+public class CompactStringsInitialCoder {
+
+    static String strEmpty   = "";
+    static String strLatin1  = "\u0042";
+    static String strUTF16   = "\u4242";
+    static char   charLatin1 = '\u0042';
+    static char   charUTF16  = '\u4242';
+
+    public static void main(String[] args) throws Exception {
+        test("\u0042", "" + '\u0042');
+        test("\u4242", "" + '\u4242');
+
+        test("\u0042", "" + charLatin1);
+        test("\u4242", "" + charUTF16);
+
+        test("\u0042", strEmpty + '\u0042');
+        test("\u4242", strEmpty + '\u4242');
+
+        test("\u0042\u0042", strLatin1 + '\u0042');
+        test("\u0042\u4242", strLatin1 + '\u4242');
+        test("\u4242\u0042", strUTF16  + '\u0042');
+        test("\u4242\u4242", strUTF16  + '\u4242');
+
+        test("\u0042\u0042", "\u0042" + charLatin1);
+        test("\u0042\u4242", "\u0042" + charUTF16);
+        test("\u4242\u0042", "\u4242" + charLatin1);
+        test("\u4242\u4242", "\u4242" + charUTF16);
+
+        test("\u0042\u0042", "" + charLatin1 + charLatin1);
+        test("\u0042\u4242", "" + charLatin1 + charUTF16);
+        test("\u4242\u0042", "" + charUTF16  + charLatin1);
+        test("\u4242\u4242", "" + charUTF16  + charUTF16);
+    }
+
+    public static void test(String expected, String actual) {
+       if (!expected.equals(actual)) {
+           StringBuilder sb = new StringBuilder();
+           sb.append("Expected = ");
+           sb.append(expected);
+           sb.append(", actual = ");
+           sb.append(actual);
+           throw new IllegalStateException(sb.toString());
+       }
+    }
+
+
+}
--- a/jdk/test/java/net/NetworkInterface/NetworkInterfaceStreamTest.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/java/net/NetworkInterface/NetworkInterfaceStreamTest.java	Mon Feb 08 09:41:53 2016 -0800
@@ -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
@@ -28,6 +28,7 @@
  * @build java.util.stream.OpTestCase
  * @run testng/othervm NetworkInterfaceStreamTest
  * @run testng/othervm -Djava.net.preferIPv4Stack=true NetworkInterfaceStreamTest
+ * @key intermittent
  */
 
 import org.testng.annotations.Test;
--- a/jdk/test/java/rmi/Naming/DefaultRegistryPort.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/java/rmi/Naming/DefaultRegistryPort.java	Mon Feb 08 09:41:53 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -33,6 +33,7 @@
  *          java.rmi/sun.rmi.transport.tcp
  * @build TestLibrary
  * @run main/othervm DefaultRegistryPort
+ * @key intermittent
  */
 
 /*
--- a/jdk/test/java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java	Mon Feb 08 09:41:53 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -33,6 +33,7 @@
  *          java.rmi/sun.rmi.transport.tcp
  * @build TestLibrary Legal LegalRegistryNames_Stub
  * @run main/othervm LegalRegistryNames
+ * @key intermittent
  */
 
 import java.net.InetAddress;
--- a/jdk/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java	Mon Feb 08 09:41:53 2016 -0800
@@ -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
@@ -37,6 +37,7 @@
  *          java.rmi/sun.rmi.transport.tcp
  * @build TestLibrary
  * @run main/othervm CloseServerSocket
+ * @key intermittent
  */
 
 import java.io.IOException;
--- a/jdk/test/java/time/tck/java/time/TCKDuration.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/java/time/tck/java/time/TCKDuration.java	Mon Feb 08 09:41:53 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, 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
@@ -2496,8 +2496,9 @@
     //-----------------------------------------------------------------------
     @Test
     public void test_toNanos() {
-        Duration test = Duration.ofSeconds(321, 123456789);
-        assertEquals(test.toNanos(), 321123456789L);
+        assertEquals(Duration.ofSeconds(321, 123456789).toNanos(), 321123456789L);
+        assertEquals(Duration.ofNanos(Long.MAX_VALUE).toNanos(), 9223372036854775807L);
+        assertEquals(Duration.ofNanos(Long.MIN_VALUE).toNanos(), -9223372036854775808L);
     }
 
     @Test
@@ -2512,13 +2513,26 @@
         test.toNanos();
     }
 
+    @Test
+    public void test_toNanos_min() {
+        Duration test = Duration.ofSeconds(0, Long.MIN_VALUE);
+        assertEquals(test.toNanos(), Long.MIN_VALUE);
+    }
+
+    @Test(expectedExceptions=ArithmeticException.class)
+    public void test_toNanos_tooSmall() {
+        Duration test = Duration.ofSeconds(0, Long.MIN_VALUE).minusNanos(1);
+        test.toNanos();
+    }
+
     //-----------------------------------------------------------------------
     // toMillis()
     //-----------------------------------------------------------------------
     @Test
     public void test_toMillis() {
-        Duration test = Duration.ofSeconds(321, 123456789);
-        assertEquals(test.toMillis(), 321000 + 123);
+        assertEquals(Duration.ofSeconds(321, 123456789).toMillis(), 321000 + 123);
+        assertEquals(Duration.ofMillis(Long.MAX_VALUE).toMillis(), 9223372036854775807L);
+        assertEquals(Duration.ofMillis(Long.MIN_VALUE).toMillis(), -9223372036854775808L);
     }
 
     @Test
@@ -2533,6 +2547,18 @@
         test.toMillis();
     }
 
+    @Test
+    public void test_toMillis_min() {
+        Duration test = Duration.ofSeconds(Long.MIN_VALUE / 1000, (Long.MIN_VALUE % 1000) * 1000000);
+        assertEquals(test.toMillis(), Long.MIN_VALUE);
+    }
+
+    @Test(expectedExceptions=ArithmeticException.class)
+    public void test_toMillis_tooSmall() {
+        Duration test = Duration.ofSeconds(Long.MIN_VALUE / 1000, ((Long.MIN_VALUE % 1000) - 1) * 1000000);
+        test.toMillis();
+    }
+
     //-----------------------------------------------------------------------
     // toSeconds()
     //-----------------------------------------------------------------------
--- a/jdk/test/java/util/UUID/UUIDTest.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/java/util/UUID/UUIDTest.java	Mon Feb 08 09:41:53 2016 -0800
@@ -22,9 +22,11 @@
  */
 
 /* @test
- * @bug 4173528 5068772
+ * @bug 4173528 5068772 8148936
  * @summary Unit tests for java.util.UUID
  * @key randomness
+ * @run main/othervm -XX:+CompactStrings UUIDTest
+ * @run main/othervm -XX:-CompactStrings UUIDTest
  */
 
 import java.util.*;
--- a/jdk/test/java/util/stream/bootlib/java.base/java/util/stream/LambdaTestHelpers.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/java/util/stream/bootlib/java.base/java/util/stream/LambdaTestHelpers.java	Mon Feb 08 09:41:53 2016 -0800
@@ -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
@@ -47,6 +47,7 @@
 
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
 
 /**
  * LambdaTestHelpers -- assertion methods and useful objects for lambda test cases
@@ -400,6 +401,16 @@
         assertEquals(toBoxedMultiset(actual), toBoxedMultiset(expected));
     }
 
+    public static<T> void assertContains(Optional<T> actual, Iterator<T> it) {
+        actual.ifPresentOrElse(r -> {
+            boolean contained = false;
+            while (!contained && it.hasNext()) {
+                contained = Objects.equals(r, it.next());
+            }
+            assertTrue(contained, "Not found: "+r);
+        }, () -> assertFalse(it.hasNext()));
+    }
+
     public static void launderAssertion(Runnable r, Supplier<String> additionalInfo) {
         try {
             r.run();
--- a/jdk/test/java/util/stream/bootlib/java.base/java/util/stream/StreamTestDataProvider.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/java/util/stream/bootlib/java.base/java/util/stream/StreamTestDataProvider.java	Mon Feb 08 09:41:53 2016 -0800
@@ -47,6 +47,7 @@
 
     private static final Object[][] testData;
     private static final Object[][] testSmallData;
+    private static final Object[][] testMiniData;
     private static final Object[][] withNullTestData;
     private static final Object[][] spliteratorTestData;
 
@@ -85,6 +86,7 @@
 
     static {
         {
+            List<Object[]> listMini = new ArrayList<>();
             List<Object[]> listSmall = new ArrayList<>();
             List<Object[]> list1000 = new ArrayList<>();
             List<Object[]> list = null;
@@ -93,7 +95,7 @@
                 final Integer[] ints = (Integer[])data[1];
                 final List<Integer> intsAsList = Arrays.asList(ints);
 
-                list = ints.length >= 1000 ? list1000 : listSmall;
+                list = ints.length >= 1000 ? list1000 : (ints.length >= 100 ? listSmall : listMini);
 
                 list.add(arrayDataDescr("array:" + name, ints));
                 list.add(collectionDataDescr("ArrayList.asList:" + name, intsAsList));
@@ -119,6 +121,8 @@
 
                 // @@@ Add more
             }
+            testMiniData = listMini.toArray(new Object[0][]);
+            listSmall.addAll(listMini);
             testSmallData = listSmall.toArray(new Object[0][]);
             list1000.addAll(listSmall);
             testData = list1000.toArray(new Object[0][]);
@@ -204,6 +208,11 @@
         return testSmallData;
     }
 
+    @DataProvider(name = "StreamTestData<Integer>.mini")
+    public static Object[][] makeMiniStreamTestData() {
+        return testMiniData;
+    }
+
     @DataProvider(name = "withNull:StreamTestData<Integer>")
     public static Object[][] makeStreamWithNullTestData() {
         return withNullTestData;
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/FindAnyOpTest.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/FindAnyOpTest.java	Mon Feb 08 09:41:53 2016 -0800
@@ -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
@@ -20,6 +20,12 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
+/**
+ * @test
+ * @bug 8148115
+ */
+
 package org.openjdk.tests.java.util.stream;
 
 import java.util.*;
@@ -61,18 +67,7 @@
 
     void exerciseStream(TestData.OfRef<Integer> data, Function<Stream<Integer>, Stream<Integer>> fs) {
         Optional<Integer> or = withData(data).terminal(fs, s -> s.findAny()).equalator(VALID_ANSWER).exercise();
-        if (or.isPresent()) {
-            Integer r = or.get();
-            Iterator<Integer> it = fs.apply(data.stream()).iterator();
-            boolean contained = false;
-            while (!contained && it.hasNext()) {
-                contained = Objects.equals(r, it.next());
-            }
-            assertTrue(contained);
-        }
-        else {
-            assertFalse(fs.apply(data.stream()).iterator().hasNext());
-        }
+        assertContains(or, fs.apply(data.stream()).iterator());
     }
 
     @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/FindFirstOpTest.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/FindFirstOpTest.java	Mon Feb 08 09:41:53 2016 -0800
@@ -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
@@ -20,6 +20,12 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
+/**
+ * @test
+ * @bug 8148115
+ */
+
 package org.openjdk.tests.java.util.stream;
 
 import java.util.*;
@@ -59,15 +65,19 @@
     }
 
     void exerciseStream(TestData.OfRef<Integer> data, Function<Stream<Integer>, Stream<Integer>> fs) {
-        Optional<Integer> r = exerciseTerminalOps(data, fs, s -> s.findFirst());
-        if (r.isPresent()) {
-            Iterator<Integer> i = fs.apply(data.stream()).iterator();
-            assertTrue(i.hasNext());
-            assertEquals(i.next(), r.get());
-        }
-        else {
-            assertFalse(fs.apply(data.stream()).iterator().hasNext());
-        }
+        Iterator<Integer> i = fs.apply(data.stream()).iterator();
+        Optional<Integer> expected = i.hasNext() ? Optional.of(i.next()) : Optional.empty();
+        withData(data).terminal(fs, s -> s.findFirst())
+                      .expectedResult(expected)
+                      .resultAsserter((act, exp, ord, par) -> {
+                          if (par & !ord) {
+                              assertContains(act, fs.apply(data.stream()).iterator());
+                          }
+                          else {
+                              assertEquals(act, exp);
+                          }
+                      })
+                      .exercise();
     }
 
     @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SequentialOpTest.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SequentialOpTest.java	Mon Feb 08 09:41:53 2016 -0800
@@ -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
@@ -94,7 +94,7 @@
     }
 
     @SuppressWarnings({"rawtypes", "unchecked"})
-    @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
+    @Test(dataProvider = "StreamTestData<Integer>.mini", dataProviderClass = StreamTestDataProvider.class)
     public void testMixedSeqPar(String name, TestData.OfRef<Integer> data) {
         Function<Integer, Integer> id = LambdaTestHelpers.identity();
         UnaryOperator<Stream<Integer>>[] changers
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SliceOpTest.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SliceOpTest.java	Mon Feb 08 09:41:53 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, 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
@@ -20,6 +20,12 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
+/*
+ * @test
+ * @bug 8148250
+ */
+
 package org.openjdk.tests.java.util.stream;
 
 import org.testng.annotations.Test;
@@ -341,4 +347,13 @@
             return Arrays.asList(0, 1, size / 2, size - 1, size, size + 1, 2 * size);
         }
     }
+
+    public void testLimitParallelHugeInput() {
+        for (int n : new int[] {10, 100, 1000, 10000}) {
+            long[] actual = LongStream.range(0, Long.MAX_VALUE)
+                                  .parallel().filter(x -> true) // remove SIZED
+                                  .limit(n).toArray();
+            assertEquals(LongStream.range(0, n).toArray(), actual);
+        }
+    }
 }
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamSpliteratorTest.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamSpliteratorTest.java	Mon Feb 08 09:41:53 2016 -0800
@@ -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
@@ -20,6 +20,12 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
+/**
+ * @test
+ * @bug 8148838
+ */
+
 package org.openjdk.tests.java.util.stream;
 
 import java.util.Arrays;
@@ -282,7 +288,7 @@
         }
     }
 
-    @Test(dataProvider = "StreamTestData<Integer>",
+    @Test(dataProvider = "StreamTestData<Integer>.small",
           dataProviderClass = StreamTestDataProvider.class,
           groups = { "serialization-hostile" })
     public void testStreamSpliterators(String name, TestData.OfRef<Integer> data) {
@@ -303,14 +309,14 @@
         }
     }
 
-    @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
+    @Test(dataProvider = "StreamTestData<Integer>.small", dataProviderClass = StreamTestDataProvider.class)
     public void testSpliterators(String name, TestData.OfRef<Integer> data) {
         for (Function<Stream<Integer>, Stream<Integer>> f : streamFunctions()) {
             SpliteratorTestHelper.testSpliterator(() -> f.apply(data.stream()).spliterator());
         }
     }
 
-    @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
+    @Test(dataProvider = "StreamTestData<Integer>.small", dataProviderClass = StreamTestDataProvider.class)
     public void testParSpliterators(String name, TestData.OfRef<Integer> data) {
         for (Function<Stream<Integer>, Stream<Integer>> f : streamFunctions()) {
             SpliteratorTestHelper.testSpliterator(() -> f.apply(data.parallelStream()).spliterator());
@@ -323,7 +329,7 @@
         if (streamFunctions == null) {
             List<Function<Stream<Integer>, Stream<Integer>>> opFunctions = Arrays.asList(
                     s -> s.filter(pEven),
-                    s -> s.map(mDoubler),
+                    s -> s.flatMap(x -> Stream.of(x, x)),
                     // @@@ Add distinct once asserting results with or without order
                     //     is correctly supported
 //                    s -> s.distinct(),
@@ -378,7 +384,7 @@
         }
     }
 
-    @Test(dataProvider = "IntStreamTestData",
+    @Test(dataProvider = "IntStreamTestData.small",
           dataProviderClass = IntStreamTestDataProvider.class,
           groups = { "serialization-hostile" })
     public void testIntStreamSpliterators(String name, TestData.OfInt data) {
@@ -399,14 +405,14 @@
         }
     }
 
-    @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
+    @Test(dataProvider = "IntStreamTestData.small", dataProviderClass = IntStreamTestDataProvider.class)
     public void testIntSpliterators(String name, TestData.OfInt data) {
         for (Function<IntStream, IntStream> f : intStreamFunctions()) {
             SpliteratorTestHelper.testIntSpliterator(() -> f.apply(data.stream()).spliterator());
         }
     }
 
-    @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
+    @Test(dataProvider = "IntStreamTestData.small", dataProviderClass = IntStreamTestDataProvider.class)
     public void testIntParSpliterators(String name, TestData.OfInt data) {
         for (Function<IntStream, IntStream> f : intStreamFunctions()) {
             SpliteratorTestHelper.testIntSpliterator(() -> f.apply(data.parallelStream()).spliterator());
@@ -419,7 +425,7 @@
         if (intStreamFunctions == null) {
             List<Function<IntStream, IntStream>> opFunctions = Arrays.asList(
                     s -> s.filter(ipEven),
-                    s -> s.map(irDoubler),
+                    s -> s.flatMap(x -> IntStream.of(x, x)),
                     s -> s.sorted());
 
             intStreamFunctions = permuteStreamFunctions(opFunctions);
@@ -471,7 +477,7 @@
         }
     }
 
-    @Test(dataProvider = "LongStreamTestData",
+    @Test(dataProvider = "LongStreamTestData.small",
           dataProviderClass = LongStreamTestDataProvider.class,
           groups = { "serialization-hostile" })
     public void testLongStreamSpliterators(String name, TestData.OfLong data) {
@@ -492,14 +498,14 @@
         }
     }
 
-    @Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
+    @Test(dataProvider = "LongStreamTestData.small", dataProviderClass = LongStreamTestDataProvider.class)
     public void testLongSpliterators(String name, TestData.OfLong data) {
         for (Function<LongStream, LongStream> f : longStreamFunctions()) {
             SpliteratorTestHelper.testLongSpliterator(() -> f.apply(data.stream()).spliterator());
         }
     }
 
-    @Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
+    @Test(dataProvider = "LongStreamTestData.small", dataProviderClass = LongStreamTestDataProvider.class)
     public void testLongParSpliterators(String name, TestData.OfLong data) {
         for (Function<LongStream, LongStream> f : longStreamFunctions()) {
             SpliteratorTestHelper.testLongSpliterator(() -> f.apply(data.parallelStream()).spliterator());
@@ -512,7 +518,7 @@
         if (longStreamFunctions == null) {
             List<Function<LongStream, LongStream>> opFunctions = Arrays.asList(
                     s -> s.filter(lpEven),
-                    s -> s.map(x -> x * 2L),
+                    s -> s.flatMap(x -> LongStream.of(x, x)),
                     s -> s.sorted());
 
             longStreamFunctions = permuteStreamFunctions(opFunctions);
@@ -564,7 +570,7 @@
         }
     }
 
-    @Test(dataProvider = "DoubleStreamTestData",
+    @Test(dataProvider = "DoubleStreamTestData.small",
           dataProviderClass = DoubleStreamTestDataProvider.class,
           groups = { "serialization-hostile" })
     public void testDoubleStreamSpliterators(String name, TestData.OfDouble data) {
@@ -585,14 +591,14 @@
         }
     }
 
-    @Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class)
+    @Test(dataProvider = "DoubleStreamTestData.small", dataProviderClass = DoubleStreamTestDataProvider.class)
     public void testDoubleSpliterators(String name, TestData.OfDouble data) {
         for (Function<DoubleStream, DoubleStream> f : doubleStreamFunctions()) {
             SpliteratorTestHelper.testDoubleSpliterator(() -> f.apply(data.stream()).spliterator());
         }
     }
 
-    @Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class)
+    @Test(dataProvider = "DoubleStreamTestData.small", dataProviderClass = DoubleStreamTestDataProvider.class)
     public void testDoubleParSpliterators(String name, TestData.OfDouble data) {
         for (Function<DoubleStream, DoubleStream> f : doubleStreamFunctions()) {
             SpliteratorTestHelper.testDoubleSpliterator(() -> f.apply(data.parallelStream()).spliterator());
@@ -605,7 +611,7 @@
         if (doubleStreamFunctions == null) {
             List<Function<DoubleStream, DoubleStream>> opFunctions = Arrays.asList(
                     s -> s.filter(dpEven),
-                    s -> s.map(x -> x * 2.0),
+                    s -> s.flatMap(x -> DoubleStream.of(x, x)),
                     s -> s.sorted());
 
             doubleStreamFunctions = permuteStreamFunctions(opFunctions);
--- a/jdk/test/javax/sound/sampled/DirectAudio/bug6400879.java	Mon Feb 08 11:43:08 2016 +0300
+++ b/jdk/test/javax/sound/sampled/DirectAudio/bug6400879.java	Mon Feb 08 09:41:53 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013, 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
@@ -21,12 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 6400879
-   @bug 7100140
-   @summary Tests that Start/Stop sequence doesn't hang
-   @author Alexey Menkov
-   @run main bug6400879
+/*
+ * @test
+ * @bug 6400879 7100140
+ * @summary Tests that Start/Stop sequence doesn't hang
+ * @author Alexey Menkov
+ * @run main bug6400879
+ * @key intermittent
  */
 
 import javax.sound.sampled.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/Version/Basic.java	Mon Feb 08 09:41:53 2016 -0800
@@ -0,0 +1,400 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Unit test for jdk.Version.
+ * @bug 8072379
+ */
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.math.BigInteger;
+import java.util.stream.Collectors;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+import jdk.Version;
+import static java.lang.System.out;
+
+public class Basic {
+    private static final Class<? extends Throwable> IAE
+        = IllegalArgumentException.class;
+    private static final Class<? extends Throwable> NPE
+        = NullPointerException.class;
+    private static final Class<? extends Throwable> NFE
+        = NumberFormatException.class;
+    private static final Class<?> VERSION = Version.class;
+
+    private static final BigInteger TOO_BIG
+        = (BigInteger.valueOf(Integer.MAX_VALUE)).add(BigInteger.ONE);
+    private static final String TOO_BIG_STR = TOO_BIG.toString();
+
+    public static void main(String ... args) {
+
+        //// Tests for parse(), major(), minor(), security(), pre(),
+        //// build(), opt(), version(), toString()
+        //   v                          M     m sec pre bld opt
+
+        // $VNUM
+        test("9",                       9,    0, 0, "", 0, "");
+        test("9.1",                     9,    1, 0, "", 0, "");
+        test("9.0.1",                   9,    0, 1, "", 0, "");
+        test("404.1.2",                 404,  1, 2, "", 0, "");
+        test("9.1.2.3",                 9,    1, 2, "", 0, "");
+        test("1000.0.0.0.0.0.99999999", 1000, 0, 0, "", 0, "");
+
+        tryCatch(null,    NPE);
+        tryCatch("",      IAE);
+        tryCatch("foo",   IAE);
+        tryCatch("7a",    IAE);
+        tryCatch("0",     IAE);
+        tryCatch("09",    IAE);
+        tryCatch("9.0",   IAE);
+        tryCatch("9.0.",  IAE);
+        tryCatch("1.9,1", IAE);
+        tryCatch(TOO_BIG_STR, NFE);
+
+        // $PRE
+        test("9-ea",       9, 0, 0, "ea",       0, "");
+        test("9-internal", 9, 0, 0, "internal", 0, "");
+        test("9-0",        9, 0, 0, "0",        0, "");
+        test("9.2.7-8",    9, 2, 7, "8",        0, "");
+        test("1-ALL",      1, 0, 0, "ALL",      0, "");
+        test("2.3.4.5-1a", 2, 3, 4, "1a",       0, "");
+        test("1-" + TOO_BIG_STR, 1, 0, 0, TOO_BIG_STR, 0, "");
+
+        tryCatch("9:-ea",     IAE);
+        tryCatch("3.14159-",  IAE);
+        tryCatch("3.14159-%", IAE);
+
+        // $BUILD
+        test("9+0",            9, 0,  0,  "",      0,       "");
+        test("3.14+9999900",   3, 14, 0,  "",      9999900, "");
+        test("9-pre+105",      9, 0,  0,  "pre",   105,     "");
+        test("6.0.42-8beta+4", 6, 0,  42, "8beta", 4,       "");
+
+        tryCatch("9+",     IAE);
+        tryCatch("7+a",    IAE);
+        tryCatch("9+00",   IAE);
+        tryCatch("4.2+01", IAE);
+        tryCatch("4.2+1a", IAE);
+        tryCatch("1+" + TOO_BIG_STR, NFE);
+
+        // $OPT
+        test("9+-foo",          9,   0, 0, "",       0,  "foo");
+        test("9-pre-opt",       9,   0, 0, "pre",    0,  "opt");
+        test("42+---bar",       42,  0, 0, "",       0,  "--bar");
+        test("2.91+-8061493-",  2,  91, 0, "",       0,  "8061493-");
+        test("24+-foo.bar",     24,  0, 0, "",       0,  "foo.bar");
+        test("9-ribbit+17-...", 9,   0, 0, "ribbit", 17, "...");
+        test("7+1-" + TOO_BIG_STR, 7,0, 0, "",       1,  TOO_BIG_STR);
+
+        tryCatch("9-pre+-opt", IAE);
+        tryCatch("1.4142+-",   IAE);
+        tryCatch("2.9979+-%",  IAE);
+
+        //// Test for current()
+        testCurrent();
+
+        //// Test for equals{IgnoreOpt}?(), hashCode(), compareTo{IgnoreOpt}?()
+        // compare: after "<" == -1, equal == 0, before ">" == 1
+        //      v0            v1                  eq     eqNO  cmp  cmpNO
+        testEHC("9",          "9",                true,  true,   0,    0);
+
+        testEHC("8",          "9",                false, false, -1,   -1);
+        testEHC("9",          "10",               false, false, -1,   -1);
+        testEHC("9",          "8",                false, false,  1,    1);
+
+        // $OPT comparison
+        testEHC("9",          "9+-oink",          false, true,  -1,    0);
+        testEHC("9+-ribbit",  "9+-moo",           false, true,   1,    0);
+        testEHC("9-quack+3-ribbit",
+                              "9-quack+3-moo",    false, true,   1,    0);
+        testEHC("9.1+7",      "9.1+7-moo-baa-la", false, true,  -1,    0);
+
+        // numeric vs. non-numeric $PRE
+        testEHC("9.1.1.2-2a", "9.1.1.2-12",       false, false,  1,    1);
+        testEHC("9.1.1.2-12", "9.1.1.2-4",        false, false,  1,    1);
+
+        testEHC("27.16",      "27.16+120",        false, false,  1,    1);
+        testEHC("10",         "10-ea",            false, false,  1,    1);
+        testEHC("10.1+1",     "10.1-ea+1",        false, false,  1,    1);
+        testEHC("10.0.1+22",  "10.0.1+21",        false, false,  1,    1);
+
+        // numeric vs. non-numeric $PRE
+        testEHC("9.1.1.2-12", "9.1.1.2-a2",       false, false, -1,   -1);
+        testEHC("9.1.1.2-1",  "9.1.1.2-4",        false, false, -1,   -1);
+
+        testEHC("9-internal", "9",                false, false, -1,   -1);
+        testEHC("9-ea+120",   "9+120",            false, false, -1,   -1);
+        testEHC("9-ea+120",   "9+120",            false, false, -1,   -1);
+        testEHC("9+101",      "9",                false, false, -1,   -1);
+        testEHC("9+101",      "9+102",            false, false, -1,   -1);
+        testEHC("1.9-ea",     "9-ea",             false, false, -1,   -1);
+
+        if (fail != 0)
+            throw new RuntimeException((fail + pass) + " tests: "
+                                       + fail + " failure(s), first", first);
+        else
+            out.println("all " + (fail + pass) + " tests passed");
+
+    }
+
+    private static void test(String s, Integer major, Integer minor,
+                             Integer sec, String pre, Integer build,
+                             String opt)
+    {
+        Version v = testParse(s);
+
+        testStr(v.toString(), s);
+
+        testInt(v.major(), major);
+        testInt(v.minor(), minor);
+        testInt(v.security(), sec);
+        testStr((v.pre().isPresent() ? v.pre().get() : ""), pre);
+        testInt((v.build().isPresent() ? v.build().get() : 0), build);
+        testStr((v.optional().isPresent() ? v.optional().get() : ""), opt);
+
+        testVersion(v.version(), s);
+    }
+
+    private static Version testParse(String s) {
+        Version v = Version.parse(s);
+        pass();
+        return v;
+    }
+
+    private static void testInt(int got, int exp) {
+        if (got != exp) {
+            fail("testInt()", Integer.toString(exp), Integer.toString(got));
+        } else {
+            pass();
+        }
+     }
+
+    private static void testStr(String got, String exp) {
+        if (!got.equals(exp)) {
+            fail("testStr()", exp, got);
+        } else {
+            pass();
+        }
+    }
+
+    private static void tryCatch(String s, Class<? extends Throwable> ex) {
+        Throwable t = null;
+        try {
+            Version.parse(s);
+        } catch (Throwable x) {
+            if (ex.isAssignableFrom(x.getClass())) {
+                t = x;
+            } else
+                x.printStackTrace();
+        }
+        if ((t == null) && (ex != null))
+            fail(s, ex);
+        else
+            pass();
+    }
+
+    private static void testCurrent() {
+        Version current = Version.current();
+        String javaVer = System.getProperty("java.version");
+
+        // java.version == $VNUM(\-$PRE)
+        String [] ver = javaVer.split("-");
+        List<Integer> javaVerVNum
+            = Arrays.stream(ver[0].split("\\."))
+            .map(v -> Integer.parseInt(v))
+            .collect(Collectors.toList());
+        if (!javaVerVNum.equals(current.version())) {
+            fail("testCurrent() version()", javaVerVNum.toString(),
+                 current.version().toString());
+        } else {
+            pass();
+        }
+
+        Optional<String> javaVerPre
+            = (ver.length == 2)
+            ? Optional.ofNullable(ver[1])
+            : Optional.empty();
+        if (!javaVerPre.equals(current.pre())) {
+            fail("testCurrent() pre()", javaVerPre.toString(),
+                 current.pre().toString());
+        } else {
+            pass();
+        }
+
+        testEHC(current.toString(), javaVer, true, true, 0, 0);
+    }
+
+    private static void testVersion(List<Integer> vnum, String s) {
+        List<Integer> svnum = new ArrayList<Integer>();
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < s.length(); i++) {
+            Character c = s.charAt(i);
+            if (Character.isDigit(c)) {
+                sb.append(c);
+            } else {
+                svnum.add(Integer.parseInt(sb.toString()));
+                sb = new StringBuilder();
+                if (c == '+' || c == '-') {
+                    break;
+                }
+            }
+        }
+        if (sb.length() > 0) {
+            svnum.add(Integer.parseInt(sb.toString()));
+        }
+
+        if (!svnum.equals(vnum)) {
+            fail("testVersion() equals()", svnum.toString(), vnum.toString());
+        } else {
+            pass();
+        }
+    }
+
+    private static void testEHC(String s0, String s1, boolean eq, boolean eqNO,
+                                int cmp, int cmpNO)
+    {
+        Version v0 = Version.parse(s0);
+        Version v1 = Version.parse(s1);
+
+        testEquals(v0, v1, eq);
+        testEqualsNO(v0, v1, eqNO);
+
+        testHashCode(v0, v1, eq);
+
+        testCompare(v0, v1, cmp);
+        testCompareNO(v0, v1, cmpNO);
+    }
+
+    private static void testEqualsNO(Version v0, Version v1, boolean eq) {
+        if ((eq && !v0.equalsIgnoreOpt(v1))
+            || (!eq && v0.equalsIgnoreOpt(v1))) {
+            fail("equalsIgnoreOpt() " + Boolean.toString(eq),
+                 v0.toString(), v1.toString());
+        } else {
+            pass();
+        }
+    }
+
+    private static void testEquals(Version v0, Version v1, boolean eq) {
+        if ((eq && !v0.equals(v1)) || (!eq && v0.equals(v1))) {
+            fail("equals() " + Boolean.toString(eq),
+                 v0.toString(), v1.toString());
+        } else {
+            pass();
+        }
+    }
+
+    private static void testHashCode(Version v0, Version v1, boolean eq) {
+        int h0 = v0.hashCode();
+        int h1 = v1.hashCode();
+        if (eq) {
+            testInt(h0, h1);
+        } else if (h0 == h1) {
+            fail(String.format("hashCode() %s", h0),
+                 Integer.toString(h0),
+                 Integer.toString(h1));
+        } else { // !eq && (h0 != h1)
+            pass();
+        }
+    }
+
+    private static void testCompareNO(Version v0, Version v1, int compare)
+    {
+        try {
+            Method m = VERSION.getMethod("compareToIgnoreOpt", VERSION);
+            int cmp = (int) m.invoke(v0, v1);
+            checkCompare(v0, v1, compare, cmp);
+        } catch (IllegalAccessException | InvocationTargetException |
+                 NoSuchMethodException ex) {
+            fail(String.format("compareToIgnoreOpt() invocation: %s",
+                               ex.getClass()),
+                 null);
+        }
+    }
+
+    private static void testCompare(Version v0, Version v1, int compare) {
+        try {
+            Method m = VERSION.getMethod("compareTo", VERSION);
+            int cmp = (int) m.invoke(v0, v1);
+            checkCompare(v0, v1, compare, cmp);
+        } catch (IllegalAccessException | InvocationTargetException |
+                 NoSuchMethodException ex) {
+            fail(String.format("compareTo() invocation: %s", ex.getClass()),
+                 null);
+        }
+    }
+
+    private static void checkCompare(Version v0, Version v1,
+                                     int compare, int cmp)
+    {
+        if (((cmp == 0) && (compare == 0))
+            || (compare == (cmp / Math.abs(cmp == 0 ? 1 : cmp)))) {
+            pass();
+        } else {
+            fail(String.format("compare() (cmp = %s) (compare = %s)",
+                               cmp, compare),
+                 v0.toString(), v1.toString());
+        }
+    }
+
+    private static int fail = 0;
+    private static int pass = 0;
+
+    private static Throwable first;
+
+    static void pass() {
+        pass++;
+    }
+
+    static void fail(String fs, Class ex) {
+        String s = "'" + fs + "'";
+        if (ex != null)
+            s += ": " + ex.getName() + " not thrown";
+        if (first == null)
+            setFirst(s);
+        System.err.println("FAILED: " + s);
+        fail++;
+    }
+
+    static void fail(String t, String exp, String got) {
+        String s = t + ": Expected '" + exp + "', got '" + got + "'";
+        if (first == null)
+            setFirst(s);
+        System.err.println("FAILED: " + s);
+        fail++;
+     }
+
+    private static void setFirst(String s) {
+        try {
+            throw new RuntimeException(s);
+        } catch (RuntimeException x) {
+            first = x;
+        }
+    }
+}
--- a/jdk/test/jdk/internal/misc/JavaLangAccess/FormatUnsigned.java	Mon Feb 08 11:43:08 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import jdk.internal.misc.JavaLangAccess;
-import jdk.internal.misc.SharedSecrets;
-
-/*
- * @test
- * @bug 8050114
- * @summary Test JavaLangAccess.formatUnsignedInt/-Long
- * @modules java.base/jdk.internal.misc
- */
-public class FormatUnsigned {
-
-    static final JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
-
-    public static void testFormatUnsignedInt() {
-        testFormatUnsignedInt("7fffffff", Integer.MAX_VALUE, 8, 4, 0, 8);
-        testFormatUnsignedInt("80000000", Integer.MIN_VALUE, 8, 4, 0, 8);
-        testFormatUnsignedInt("4711", 04711, 4, 3, 0, 4);
-        testFormatUnsignedInt("4711", 0x4711, 4, 4, 0, 4);
-        testFormatUnsignedInt("1010", 0b1010, 4, 1, 0, 4);
-        testFormatUnsignedInt("00001010", 0b1010, 8, 1, 0, 8);
-        testFormatUnsignedInt("\u0000\u000000001010", 0b1010, 10, 1, 2, 8);
-    }
-
-    public static void testFormatUnsignedLong() {
-        testFormatUnsignedLong("7fffffffffffffff", Long.MAX_VALUE, 16, 4, 0, 16);
-        testFormatUnsignedLong("8000000000000000", Long.MIN_VALUE, 16, 4, 0, 16);
-        testFormatUnsignedLong("4711", 04711L, 4, 3, 0, 4);
-        testFormatUnsignedLong("4711", 0x4711L, 4, 4, 0, 4);
-        testFormatUnsignedLong("1010", 0b1010L, 4, 1, 0, 4);
-        testFormatUnsignedLong("00001010", 0b1010L, 8, 1, 0, 8);
-        testFormatUnsignedLong("\u0000\u000000001010", 0b1010L, 10, 1, 2, 8);
-    }
-
-    public static void testFormatUnsignedInt(String expected, int value, int arraySize, int shift, int offset, int length) {
-        char[] chars = new char[arraySize];
-        jla.formatUnsignedInt(value, shift, chars, offset, length);
-        String s = new String(chars);
-        if (!expected.equals(s)) {
-            throw new Error(s + " should be equal to expected " + expected);
-        }
-    }
-
-    public static void testFormatUnsignedLong(String expected, long value, int arraySize, int shift, int offset, int length) {
-        char[] chars = new char[arraySize];
-        jla.formatUnsignedLong(value, shift, chars, offset, length);
-        String s = new String(chars);
-        if (!expected.equals(s)) {
-            throw new Error(s + " should be equal to expected " + expected);
-        }
-    }
-
-    public static void main(String[] args) {
-        testFormatUnsignedInt();
-        testFormatUnsignedLong();
-    }
-}