changeset 13486:abcef5a34091

Merge
author twisti
date Fri, 18 Dec 2015 10:00:55 -0800
parents 4591cb19f8ea 7205ee062a14
children 2d65c7859d7e
files src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java src/java.base/share/classes/sun/invoke/anon/ConstantPoolParser.java src/java.base/share/classes/sun/invoke/anon/ConstantPoolPatch.java src/java.base/share/classes/sun/invoke/anon/ConstantPoolVisitor.java src/java.base/share/classes/sun/invoke/anon/InvalidConstantPoolFormatException.java src/jdk.deploy.osx/macosx/classes/apple/applescript/AppleScriptEngine.java src/jdk.deploy.osx/macosx/classes/apple/applescript/AppleScriptEngineFactory.java src/jdk.deploy.osx/macosx/native/libapplescriptengine/AS_NS_ConversionUtils.h src/jdk.deploy.osx/macosx/native/libapplescriptengine/AS_NS_ConversionUtils.m src/jdk.deploy.osx/macosx/native/libapplescriptengine/AppleScriptEngine.m src/jdk.deploy.osx/macosx/native/libapplescriptengine/AppleScriptExecutionContext.h src/jdk.deploy.osx/macosx/native/libapplescriptengine/AppleScriptExecutionContext.m src/jdk.deploy.osx/macosx/native/libapplescriptengine/NS_Java_ConversionUtils.h src/jdk.deploy.osx/macosx/native/libapplescriptengine/NS_Java_ConversionUtils.m test/sun/invoke/anon/ConstantPoolPatch/OptimalMapSize.java
diffstat 99 files changed, 3924 insertions(+), 3775 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Dec 17 10:03:30 2015 +0100
+++ b/.hgtags	Fri Dec 18 10:00:55 2015 -0800
@@ -337,3 +337,5 @@
 6a5c99506f44538b879d8635a3979849ed587130 jdk9-b92
 2f12392d0dde768150c83087cdbdd0d33a4d866c jdk9-b93
 559b626b01179420a94feb9c3d0f246970d2e3fa jdk9-b94
+8581faf0d474472e32f589bbc16db7eec912d83f jdk-9+95
+c021b855f51e572e63982654b17742cb1f814fb4 jdk-9+96
--- a/make/CompileDemos.gmk	Thu Dec 17 10:03:30 2015 +0100
+++ b/make/CompileDemos.gmk	Fri Dec 18 10:00:55 2015 -0800
@@ -459,7 +459,7 @@
   # We can only compile native code after java has been compiled (since we
   # depend on generated .h files)
   $(SUPPORT_OUTPUTDIR)/demos/native/jni/Poller/Poller.o: \
-      $(BUILD_DEMO_JAVA_POLLER_COMPILE_TARGETS)
+      $(BUILD_DEMO_JAVA_Poller)
 
   # Copy to image
   $(SUPPORT_OUTPUTDIR)/demos/image/jni/Poller/README.txt: \
--- a/make/lib/Lib-jdk.deploy.osx.gmk	Thu Dec 17 10:03:30 2015 +0100
+++ b/make/lib/Lib-jdk.deploy.osx.gmk	Fri Dec 18 10:00:55 2015 -0800
@@ -29,32 +29,6 @@
 
   ################################################################################
 
-  LIBAPPLESCRIPTENGINE_SRC := $(JDK_TOPDIR)/src/jdk.deploy.osx/macosx/native/libapplescriptengine
-
-  $(eval $(call SetupNativeCompilation,BUILD_LIBAPPLESCRIPTENGINE, \
-      LIBRARY := AppleScriptEngine, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
-      SRC := $(LIBAPPLESCRIPTENGINE_SRC), \
-      OPTIMIZATION := LOW, \
-      CFLAGS := $(CFLAGS_JDKLIB) \
-          -I$(LIBAPPLESCRIPTENGINE_SRC) \
-          -I$(SUPPORT_OUTPUTDIR)/headers/jdk.deploy.osx, \
-      DISABLED_WARNINGS_clang := implicit-function-declaration format, \
-      LDFLAGS := $(LDFLAGS_JDKLIB) \
-          $(call SET_SHARED_LIBRARY_ORIGIN), \
-      LIBS := -framework Cocoa \
-          -framework Carbon \
-          -framework JavaNativeFoundation \
-          $(JDKLIB_LIBS), \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libAppleScriptEngine, \
-      DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-  $(BUILD_LIBAPPLESCRIPTENGINE): $(call FindLib, java.base, java)
-
-  TARGETS += $(BUILD_LIBAPPLESCRIPTENGINE)
-
-  ################################################################################
-
   LIBOSX_DIRS := $(JDK_TOPDIR)/src/jdk.deploy.osx/macosx/native/libosx
   LIBOSX_CFLAGS := -I$(LIBOSX_DIRS) \
       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
--- a/make/mapfiles/libnio/mapfile-linux	Thu Dec 17 10:03:30 2015 +0100
+++ b/make/mapfiles/libnio/mapfile-linux	Fri Dec 18 10:00:55 2015 -0800
@@ -173,7 +173,7 @@
 		Java_sun_nio_fs_UnixNativeDispatcher_futimes;
 		Java_sun_nio_fs_UnixNativeDispatcher_open0;
 		Java_sun_nio_fs_UnixNativeDispatcher_openat0;
-		Java_sun_nio_fs_UnixNativeDispatcher_close;
+		Java_sun_nio_fs_UnixNativeDispatcher_close0;
 		Java_sun_nio_fs_UnixNativeDispatcher_read;
 		Java_sun_nio_fs_UnixNativeDispatcher_write;
 		Java_sun_nio_fs_UnixNativeDispatcher_fopen0;
--- a/make/mapfiles/libnio/mapfile-macosx	Thu Dec 17 10:03:30 2015 +0100
+++ b/make/mapfiles/libnio/mapfile-macosx	Fri Dec 18 10:00:55 2015 -0800
@@ -150,7 +150,7 @@
 		Java_sun_nio_fs_UnixNativeDispatcher_futimes;
 		Java_sun_nio_fs_UnixNativeDispatcher_open0;
 		Java_sun_nio_fs_UnixNativeDispatcher_openat0;
-		Java_sun_nio_fs_UnixNativeDispatcher_close;
+		Java_sun_nio_fs_UnixNativeDispatcher_close0;
 		Java_sun_nio_fs_UnixNativeDispatcher_read;
 		Java_sun_nio_fs_UnixNativeDispatcher_write;
 		Java_sun_nio_fs_UnixNativeDispatcher_fopen0;
--- a/make/mapfiles/libnio/mapfile-solaris	Thu Dec 17 10:03:30 2015 +0100
+++ b/make/mapfiles/libnio/mapfile-solaris	Fri Dec 18 10:00:55 2015 -0800
@@ -150,7 +150,7 @@
 		Java_sun_nio_fs_UnixNativeDispatcher_futimes;
 		Java_sun_nio_fs_UnixNativeDispatcher_open0;
 		Java_sun_nio_fs_UnixNativeDispatcher_openat0;
-		Java_sun_nio_fs_UnixNativeDispatcher_close;
+		Java_sun_nio_fs_UnixNativeDispatcher_close0;
 		Java_sun_nio_fs_UnixNativeDispatcher_read;
 		Java_sun_nio_fs_UnixNativeDispatcher_write;
 		Java_sun_nio_fs_UnixNativeDispatcher_fopen0;
--- a/make/src/native/genconstants/fs/genUnixConstants.c	Thu Dec 17 10:03:30 2015 +0100
+++ b/make/src/native/genconstants/fs/genUnixConstants.c	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,6 +104,7 @@
 
     // errors
     DEF(ENOENT);
+    DEF(ENXIO);
     DEF(EACCES);
     DEF(EEXIST);
     DEF(ENOTDIR);
--- a/src/java.base/linux/classes/sun/nio/fs/LinuxDosFileAttributeView.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/linux/classes/sun/nio/fs/LinuxDosFileAttributeView.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -117,8 +117,9 @@
     public DosFileAttributes readAttributes() throws IOException {
         file.checkRead();
 
-        int fd = file.openForAttributeAccess(followLinks);
+        int fd = -1;
         try {
+             fd = file.openForAttributeAccess(followLinks);
              final UnixFileAttributes attrs = UnixFileAttributes.get(fd);
              final int dosAttribute = getDosAttribute(fd);
 
@@ -253,8 +254,9 @@
     private void updateDosAttribute(int flag, boolean enable) throws IOException {
         file.checkWrite();
 
-        int fd = file.openForAttributeAccess(followLinks);
+        int fd = -1;
         try {
+            fd = file.openForAttributeAccess(followLinks);
             int oldValue = getDosAttribute(fd);
             int newValue = oldValue;
             if (enable) {
--- a/src/java.base/linux/classes/sun/nio/fs/LinuxFileStore.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/linux/classes/sun/nio/fs/LinuxFileStore.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -94,22 +94,20 @@
     // returns true if extended attributes enabled on file system where given
     // file resides, returns false if disabled or unable to determine.
     private boolean isExtendedAttributesEnabled(UnixPath path) {
+        int fd = -1;
         try {
-            int fd = path.openForAttributeAccess(false);
-            try {
-                // fgetxattr returns size if called with size==0
-                byte[] name = Util.toBytes("user.java");
-                LinuxNativeDispatcher.fgetxattr(fd, name, 0L, 0);
+            fd = path.openForAttributeAccess(false);
+
+            // fgetxattr returns size if called with size==0
+            byte[] name = Util.toBytes("user.java");
+            LinuxNativeDispatcher.fgetxattr(fd, name, 0L, 0);
+            return true;
+        } catch (UnixException e) {
+            // attribute does not exist
+            if (e.errno() == UnixConstants.ENODATA)
                 return true;
-            } catch (UnixException e) {
-                // attribute does not exist
-                if (e.errno() == UnixConstants.ENODATA)
-                    return true;
-            } finally {
-                UnixNativeDispatcher.close(fd);
-            }
-        } catch (IOException ignore) {
-            // nothing we can do
+        } finally {
+            UnixNativeDispatcher.close(fd);
         }
         return false;
     }
--- a/src/java.base/linux/classes/sun/nio/fs/LinuxUserDefinedFileAttributeView.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/linux/classes/sun/nio/fs/LinuxUserDefinedFileAttributeView.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -97,7 +97,12 @@
         if (System.getSecurityManager() != null)
             checkAccess(file.getPathForPermissionCheck(), true, false);
 
-        int fd = file.openForAttributeAccess(followLinks);
+        int fd = -1;
+        try {
+            fd = file.openForAttributeAccess(followLinks);
+        } catch (UnixException x) {
+            x.rethrowAsIOException(file);
+        }
         NativeBuffer buffer = null;
         try {
             int size = 1024;
@@ -133,7 +138,12 @@
         if (System.getSecurityManager() != null)
             checkAccess(file.getPathForPermissionCheck(), true, false);
 
-        int fd = file.openForAttributeAccess(followLinks);
+        int fd = -1;
+        try {
+            fd = file.openForAttributeAccess(followLinks);
+        } catch (UnixException x) {
+            x.rethrowAsIOException(file);
+        }
         try {
             // fgetxattr returns size if called with size==0
             return fgetxattr(fd, nameAsBytes(file,name), 0L, 0);
@@ -169,7 +179,12 @@
             address = nb.address();
         }
 
-        int fd = file.openForAttributeAccess(followLinks);
+        int fd = -1;
+        try {
+            fd = file.openForAttributeAccess(followLinks);
+        } catch (UnixException x) {
+            x.rethrowAsIOException(file);
+        }
         try {
             try {
                 int n = fgetxattr(fd, nameAsBytes(file,name), address, rem);
@@ -236,7 +251,12 @@
             }
         }
 
-        int fd = file.openForAttributeAccess(followLinks);
+        int fd = -1;
+        try {
+            fd = file.openForAttributeAccess(followLinks);
+        } catch (UnixException x) {
+            x.rethrowAsIOException(file);
+        }
         try {
             try {
                 fsetxattr(fd, nameAsBytes(file,name), address, rem);
@@ -260,7 +280,12 @@
         if (System.getSecurityManager() != null)
             checkAccess(file.getPathForPermissionCheck(), false, true);
 
-        int fd = file.openForAttributeAccess(followLinks);
+        int fd = -1;
+        try {
+            fd = file.openForAttributeAccess(followLinks);
+        } catch (UnixException x) {
+            x.rethrowAsIOException(file);
+        }
         try {
             fremovexattr(fd, nameAsBytes(file,name));
         } catch (UnixException x) {
--- a/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Fri Dec 18 10:00:55 2015 -0800
@@ -324,27 +324,54 @@
             emitIconstInsn((int) con);
             return;
         }
+        if (con instanceof Byte) {
+            emitIconstInsn((byte)con);
+            return;
+        }
+        if (con instanceof Short) {
+            emitIconstInsn((short)con);
+            return;
+        }
+        if (con instanceof Character) {
+            emitIconstInsn((char)con);
+            return;
+        }
         if (con instanceof Long) {
             long x = (long) con;
-            if (x == (short) x) {
-                emitIconstInsn((int) x);
-                mv.visitInsn(Opcodes.I2L);
+            short sx = (short)x;
+            if (x == sx) {
+                if (sx >= 0 && sx <= 1) {
+                    mv.visitInsn(Opcodes.LCONST_0 + (int) sx);
+                } else {
+                    emitIconstInsn((int) x);
+                    mv.visitInsn(Opcodes.I2L);
+                }
                 return;
             }
         }
         if (con instanceof Float) {
             float x = (float) con;
-            if (x == (short) x) {
-                emitIconstInsn((int) x);
-                mv.visitInsn(Opcodes.I2F);
+            short sx = (short)x;
+            if (x == sx) {
+                if (sx >= 0 && sx <= 2) {
+                    mv.visitInsn(Opcodes.FCONST_0 + (int) sx);
+                } else {
+                    emitIconstInsn((int) x);
+                    mv.visitInsn(Opcodes.I2F);
+                }
                 return;
             }
         }
         if (con instanceof Double) {
             double x = (double) con;
-            if (x == (short) x) {
-                emitIconstInsn((int) x);
-                mv.visitInsn(Opcodes.I2D);
+            short sx = (short)x;
+            if (x == sx) {
+                if (sx >= 0 && sx <= 1) {
+                    mv.visitInsn(Opcodes.DCONST_0 + (int) sx);
+                } else {
+                    emitIconstInsn((int) x);
+                    mv.visitInsn(Opcodes.I2D);
+                }
                 return;
             }
         }
@@ -356,26 +383,16 @@
         mv.visitLdcInsn(con);
     }
 
-    private void emitIconstInsn(int i) {
-        int opcode;
-        switch (i) {
-        case 0:  opcode = Opcodes.ICONST_0;  break;
-        case 1:  opcode = Opcodes.ICONST_1;  break;
-        case 2:  opcode = Opcodes.ICONST_2;  break;
-        case 3:  opcode = Opcodes.ICONST_3;  break;
-        case 4:  opcode = Opcodes.ICONST_4;  break;
-        case 5:  opcode = Opcodes.ICONST_5;  break;
-        default:
-            if (i == (byte) i) {
-                mv.visitIntInsn(Opcodes.BIPUSH, i & 0xFF);
-            } else if (i == (short) i) {
-                mv.visitIntInsn(Opcodes.SIPUSH, (char) i);
-            } else {
-                mv.visitLdcInsn(i);
-            }
-            return;
+    private void emitIconstInsn(final int cst) {
+        if (cst >= -1 && cst <= 5) {
+            mv.visitInsn(Opcodes.ICONST_0 + cst);
+        } else if (cst >= Byte.MIN_VALUE && cst <= Byte.MAX_VALUE) {
+            mv.visitIntInsn(Opcodes.BIPUSH, cst);
+        } else if (cst >= Short.MIN_VALUE && cst <= Short.MAX_VALUE) {
+            mv.visitIntInsn(Opcodes.SIPUSH, cst);
+        } else {
+            mv.visitLdcInsn(cst);
         }
-        mv.visitInsn(opcode);
     }
 
     /*
--- a/src/java.base/share/classes/java/math/BigInteger.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/java/math/BigInteger.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2410,6 +2410,53 @@
     }
 
     /**
+     * Returns the integer square root of this BigInteger.  The integer square
+     * root of the corresponding mathematical integer {@code n} is the largest
+     * mathematical integer {@code s} such that {@code s*s <= n}.  It is equal
+     * to the value of {@code floor(sqrt(n))}, where {@code sqrt(n)} denotes the
+     * real square root of {@code n} treated as a real.  Note that the integer
+     * square root will be less than the real square root if the latter is not
+     * representable as an integral value.
+     *
+     * @return the integer square root of {@code this}
+     * @throws ArithmeticException if {@code this} is negative.  (The square
+     *         root of a negative integer {@code val} is
+     *         {@code (i * sqrt(-val))} where <i>i</i> is the
+     *         <i>imaginary unit</i> and is equal to
+     *         {@code sqrt(-1)}.)
+     * @since  1.9
+     */
+    public BigInteger sqrt() {
+        if (this.signum < 0) {
+            throw new ArithmeticException("Negative BigInteger");
+        }
+
+        return new MutableBigInteger(this.mag).sqrt().toBigInteger();
+    }
+
+    /**
+     * Returns an array of two BigIntegers containing the integer square root
+     * {@code s} of {@code this} and its remainder {@code this - s*s},
+     * respectively.
+     *
+     * @return an array of two BigIntegers with the integer square root at
+     *         offset 0 and the remainder at offset 1
+     * @throws ArithmeticException if {@code this} is negative.  (The square
+     *         root of a negative integer {@code val} is
+     *         {@code (i * sqrt(-val))} where <i>i</i> is the
+     *         <i>imaginary unit</i> and is equal to
+     *         {@code sqrt(-1)}.)
+     * @see #sqrt()
+     * @since  1.9
+     */
+    public BigInteger[] sqrtAndRemainder() {
+        BigInteger s = sqrt();
+        BigInteger r = this.subtract(s.square());
+        assert r.compareTo(BigInteger.ZERO) >= 0;
+        return new BigInteger[] {s, r};
+    }
+
+    /**
      * Returns a BigInteger whose value is the greatest common divisor of
      * {@code abs(this)} and {@code abs(val)}.  Returns 0 if
      * {@code this == 0 && val == 0}.
--- a/src/java.base/share/classes/java/math/MutableBigInteger.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/java/math/MutableBigInteger.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1867,6 +1867,96 @@
     }
 
     /**
+     * Calculate the integer square root {@code floor(sqrt(this))} where
+     * {@code sqrt(.)} denotes the mathematical square root. The contents of
+     * {@code this} are <b>not</b> changed. The value of {@code this} is assumed
+     * to be non-negative.
+     *
+     * @implNote The implementation is based on the material in Henry S. Warren,
+     * Jr., <i>Hacker's Delight (2nd ed.)</i> (Addison Wesley, 2013), 279-282.
+     *
+     * @throws ArithmeticException if the value returned by {@code bitLength()}
+     * overflows the range of {@code int}.
+     * @return the integer square root of {@code this}
+     * @since 1.9
+     */
+    MutableBigInteger sqrt() {
+        // Special cases.
+        if (this.isZero()) {
+            return new MutableBigInteger(0);
+        } else if (this.value.length == 1
+                && (this.value[0] & LONG_MASK) < 4) { // result is unity
+            return ONE;
+        }
+
+        if (bitLength() <= 63) {
+            // Initial estimate is the square root of the positive long value.
+            long v = new BigInteger(this.value, 1).longValueExact();
+            long xk = (long)Math.floor(Math.sqrt(v));
+
+            // Refine the estimate.
+            do {
+                long xk1 = (xk + v/xk)/2;
+
+                // Terminate when non-decreasing.
+                if (xk1 >= xk) {
+                    return new MutableBigInteger(new int[] {
+                        (int)(xk >>> 32), (int)(xk & LONG_MASK)
+                    });
+                }
+
+                xk = xk1;
+            } while (true);
+        } else {
+            // Set up the initial estimate of the iteration.
+
+            // Obtain the bitLength > 63.
+            int bitLength = (int) this.bitLength();
+            if (bitLength != this.bitLength()) {
+                throw new ArithmeticException("bitLength() integer overflow");
+            }
+
+            // Determine an even valued right shift into positive long range.
+            int shift = bitLength - 63;
+            if (shift % 2 == 1) {
+                shift++;
+            }
+
+            // Shift the value into positive long range.
+            MutableBigInteger xk = new MutableBigInteger(this);
+            xk.rightShift(shift);
+            xk.normalize();
+
+            // Use the square root of the shifted value as an approximation.
+            double d = new BigInteger(xk.value, 1).doubleValue();
+            BigInteger bi = BigInteger.valueOf((long)Math.ceil(Math.sqrt(d)));
+            xk = new MutableBigInteger(bi.mag);
+
+            // Shift the approximate square root back into the original range.
+            xk.leftShift(shift / 2);
+
+            // Refine the estimate.
+            MutableBigInteger xk1 = new MutableBigInteger();
+            do {
+                // xk1 = (xk + n/xk)/2
+                this.divide(xk, xk1, false);
+                xk1.add(xk);
+                xk1.rightShift(1);
+
+                // Terminate when non-decreasing.
+                if (xk1.compare(xk) >= 0) {
+                    return xk;
+                }
+
+                // xk = xk1
+                xk.copyValue(xk1);
+
+                xk1.reset();
+            } while (true);
+        }
+    }
+
+    /**
      * Calculate GCD of this and b. This and b are changed by the computation.
      */
     MutableBigInteger hybridGCD(MutableBigInteger b) {
--- a/src/java.base/share/classes/java/security/acl/package-info.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/java/security/acl/package-info.java	Fri Dec 18 10:00:55 2015 -0800
@@ -24,12 +24,11 @@
  */
 
 /**
- * The classes and interfaces in this package have been deprecated.
- * The {@code java.security} package contains suitable replacements.
- * See that package and, for example, {@code java.security.Permission}
- * for details.
+ * The classes and interfaces in this package have been deprecated. New
+ * classes should not be added to this package. The {@code java.security}
+ * package contains suitable replacements. See {@link java.security.Policy}
+ * and related classes for details.
  *
  * @since 1.1
  */
-@Deprecated
 package java.security.acl;
--- a/src/java.base/share/classes/java/time/Duration.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/java/time/Duration.java	Fri Dec 18 10:00:55 2015 -0800
@@ -61,6 +61,7 @@
  */
 package java.time;
 
+import static java.time.LocalTime.MINUTES_PER_HOUR;
 import static java.time.LocalTime.NANOS_PER_SECOND;
 import static java.time.LocalTime.SECONDS_PER_DAY;
 import static java.time.LocalTime.SECONDS_PER_HOUR;
@@ -973,7 +974,7 @@
         if (multiplicand == 1) {
             return this;
         }
-        return create(toSeconds().multiply(BigDecimal.valueOf(multiplicand)));
+        return create(toBigDecimalSeconds().multiply(BigDecimal.valueOf(multiplicand)));
      }
 
     /**
@@ -992,7 +993,7 @@
         if (divisor == 1) {
             return this;
         }
-        return create(toSeconds().divide(BigDecimal.valueOf(divisor), RoundingMode.DOWN));
+        return create(toBigDecimalSeconds().divide(BigDecimal.valueOf(divisor), RoundingMode.DOWN));
      }
 
     /**
@@ -1001,7 +1002,7 @@
      *
      * @return the total length of the duration in seconds, with a scale of 9, not null
      */
-    private BigDecimal toSeconds() {
+    private BigDecimal toBigDecimalSeconds() {
         return BigDecimal.valueOf(seconds).add(BigDecimal.valueOf(nanos, 9));
     }
 
@@ -1168,6 +1169,19 @@
     }
 
     /**
+     * Gets the number of seconds in this duration.
+     * <p>
+     * This returns the total number of whole seconds in the duration.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @return the whole seconds part of the length of the duration, positive or negative
+     */
+    public long toSeconds() {
+        return seconds;
+    }
+
+    /**
      * Converts this duration to the total length in milliseconds.
      * <p>
      * If this duration is too large to fit in a {@code long} milliseconds, then an
@@ -1201,6 +1215,100 @@
         return totalNanos;
     }
 
+    /**
+     * Extracts the number of days in the duration.
+     * <p>
+     * This returns the total number of days in the duration by dividing the
+     * number of seconds by 86400.
+     * This is based on the standard definition of a day as 24 hours.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @return the number of days in the duration, may be negative
+     */
+    public long toDaysPart(){
+        return seconds / SECONDS_PER_DAY;
+    }
+
+    /**
+     * Extracts the number of hours part in the duration.
+     * <p>
+     * This returns the number of remaining hours when dividing {@link #toHours}
+     * by hours in a day.
+     * This is based on the standard definition of a day as 24 hours.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @return the number of hours part in the duration, may be negative
+     */
+    public int toHoursPart(){
+        return (int) (toHours() % 24);
+    }
+
+    /**
+     * Extracts the number of minutes part in the duration.
+     * <p>
+     * This returns the number of remaining minutes when dividing {@link #toMinutes}
+     * by minutes in an hour.
+     * This is based on the standard definition of an hour as 60 minutes.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @return the number of minutes parts in the duration, may be negative
+     * may be negative
+     */
+    public int toMinutesPart(){
+        return (int) (toMinutes() % MINUTES_PER_HOUR);
+    }
+
+    /**
+     * Extracts the number of seconds part in the duration.
+     * <p>
+     * This returns the remaining seconds when dividing {@link #toSeconds}
+     * by seconds in a minute.
+     * This is based on the standard definition of a minute as 60 seconds.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @return the number of seconds parts in the duration, may be negative
+     */
+    public int toSecondsPart(){
+        return (int) (seconds % SECONDS_PER_MINUTE);
+    }
+
+    /**
+     * Extracts the number of milliseconds part of the duration.
+     * <p>
+     * This returns the milliseconds part by dividing the number of nanoseconds by 1,000,000.
+     * The length of the duration is stored using two fields - seconds and nanoseconds.
+     * The nanoseconds part is a value from 0 to 999,999,999 that is an adjustment to
+     * the length in seconds.
+     * The total duration is defined by calling {@link #getNano()} and {@link #getSeconds()}.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @return the number of milliseconds part of the duration.
+     */
+    public int toMillisPart(){
+        return nanos / 1000_000;
+    }
+
+    /**
+     * Get the nanoseconds part within seconds of the duration.
+     * <p>
+     * The length of the duration is stored using two fields - seconds and nanoseconds.
+     * The nanoseconds part is a value from 0 to 999,999,999 that is an adjustment to
+     * the length in seconds.
+     * The total duration is defined by calling {@link #getNano()} and {@link #getSeconds()}.
+     * <p>
+     * This instance is immutable and unaffected by this method call.
+     *
+     * @return the nanoseconds within the second part of the length of the duration, from 0 to 999,999,999
+     */
+    public int toNanosPart(){
+        return nanos;
+    }
+
     //-----------------------------------------------------------------------
     /**
      * Compares this duration to the specified {@code Duration}.
@@ -1208,7 +1316,7 @@
      * The comparison is based on the total length of the durations.
      * It is "consistent with equals", as defined by {@link Comparable}.
      *
-     * @param otherDuration  the other duration to compare to, not null
+     * @param otherDuration the other duration to compare to, not null
      * @return the comparator value, negative if less, positive if greater
      */
     @Override
@@ -1226,7 +1334,7 @@
      * <p>
      * The comparison is based on the total length of the durations.
      *
-     * @param otherDuration  the other duration, null returns false
+     * @param otherDuration the other duration, null returns false
      * @return true if the other duration is equal to this one
      */
     @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/java/util/KeyValueHolder.java	Fri Dec 18 10:00:55 2015 -0800
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.util;
+
+/**
+ * An immutable container for a key and a value, suitable for use
+ * in creating and populating {@code Map} instances.
+ *
+ * <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
+ * class; use of identity-sensitive operations (including reference equality
+ * ({@code ==}), identity hash code, or synchronization) on instances of
+ * {@code KeyValueHolder} may have unpredictable results and should be avoided.
+ *
+ * @apiNote
+ * This class is not public. Instances can be created using the
+ * {@link Map#entry Map.entry(k, v)} factory method, which is public.
+ *
+ * <p>This class differs from AbstractMap.SimpleImmutableEntry in the following ways:
+ * it is not serializable, it is final, and its key and value must be non-null.
+ *
+ * @param <K> the key type
+ * @param <V> the value type
+ *
+ * @see Map#ofEntries Map.ofEntries()
+ * @since 9
+ */
+final class KeyValueHolder<K,V> implements Map.Entry<K,V> {
+    final K key;
+    final V value;
+
+    KeyValueHolder(K k, V v) {
+        key = Objects.requireNonNull(k);
+        value = Objects.requireNonNull(v);
+    }
+
+    /**
+     * Gets the key from this holder.
+     *
+     * @return the key
+     */
+    @Override
+    public K getKey() {
+        return key;
+    }
+
+    /**
+     * Gets the value from this holder.
+     *
+     * @return the value
+     */
+    @Override
+    public V getValue() {
+        return value;
+    }
+
+    /**
+     * Throws {@link UnsupportedOperationException}.
+     *
+     * @param value ignored
+     * @return never returns normally
+     */
+    @Override
+    public V setValue(V value) {
+        throw new UnsupportedOperationException("not supported");
+    }
+
+    /**
+     * Compares the specified object with this entry for equality.
+     * Returns {@code true} if the given object is also a map entry and
+     * the two entries' keys and values are equal. Note that key and
+     * value are non-null, so equals() can be called safely on them.
+     */
+    @Override
+    public boolean equals(Object o) {
+        if (!(o instanceof Map.Entry))
+            return false;
+        Map.Entry<?,?> e = (Map.Entry<?,?>)o;
+        return key.equals(e.getKey()) && value.equals(e.getValue());
+    }
+
+    /**
+     * Returns the hash code value for this map entry. The hash code
+     * is {@code key.hashCode() ^ value.hashCode()}. Note that key and
+     * value are non-null, so hashCode() can be called safely on them.
+     */
+    @Override
+    public int hashCode() {
+        return key.hashCode() ^ value.hashCode();
+    }
+
+    /**
+     * Returns a String representation of this map entry.  This
+     * implementation returns the string representation of this
+     * entry's key followed by the equals character ("{@code =}")
+     * followed by the string representation of this entry's value.
+     *
+     * @return a String representation of this map entry
+     */
+    @Override
+    public String toString() {
+        return key + "=" + value;
+    }
+}
--- a/src/java.base/share/classes/java/util/List.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/java/util/List.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,6 +87,28 @@
  * Such exceptions are marked as "optional" in the specification for this
  * interface.
  *
+ * <h2><a name="immutable">Immutable List Static Factory Methods</a></h2>
+ * <p>The {@link List#of(Object...) List.of()} static factory methods
+ * provide a convenient way to create immutable lists. The {@code List}
+ * instances created by these methods have the following characteristics:
+ *
+ * <ul>
+ * <li>They are <em>structurally immutable</em>. Elements cannot be added, removed,
+ * or replaced. Attempts to do so result in {@code UnsupportedOperationException}.
+ * However, if the contained elements are themselves mutable,
+ * this may cause the List's contents to appear to change.
+ * <li>They disallow {@code null} elements. Attempts to create them with
+ * {@code null} elements result in {@code NullPointerException}.
+ * <li>They are serializable if all elements are serializable.
+ * <li>The order of elements in the list is the same as the order of the
+ * provided arguments, or of the elements in the provided array.
+ * <li>They are <a href="../lang/doc-files/ValueBased.html">value-based</a>.
+ * Callers should make no assumptions about the identity of the returned instances.
+ * Factories are free to create new instances or reuse existing ones. Therefore,
+ * identity-sensitive operations on these instances (reference equality ({@code ==}),
+ * identity hash code, and synchronization) are unreliable and should be avoided.
+ * </ul>
+ *
  * <p>This interface is a member of the
  * <a href="{@docRoot}/../technotes/guides/collections/index.html">
  * Java Collections Framework</a>.
@@ -731,4 +753,312 @@
     default Spliterator<E> spliterator() {
         return Spliterators.spliterator(this, Spliterator.ORDERED);
     }
+
+    /**
+     * Returns an immutable list containing zero elements.
+     *
+     * See <a href="#immutable">Immutable List Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code List}'s element type
+     * @return an empty {@code List}
+     *
+     * @since 9
+     */
+    static <E> List<E> of() {
+        return Collections.emptyList();
+    }
+
+    /**
+     * Returns an immutable list containing one element.
+     *
+     * See <a href="#immutable">Immutable List Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code List}'s element type
+     * @param e1 the single element
+     * @return a {@code List} containing the specified element
+     * @throws NullPointerException if the element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> List<E> of(E e1) {
+        return Collections.singletonList(Objects.requireNonNull(e1));
+    }
+
+    /**
+     * Returns an immutable list containing two elements.
+     *
+     * See <a href="#immutable">Immutable List Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code List}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @return a {@code List} containing the specified elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> List<E> of(E e1, E e2) {
+        return Collections.unmodifiableList(
+            Arrays.asList(Objects.requireNonNull(e1),
+                          Objects.requireNonNull(e2)));
+    }
+
+    /**
+     * Returns an immutable list containing three elements.
+     *
+     * See <a href="#immutable">Immutable List Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code List}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @return a {@code List} containing the specified elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> List<E> of(E e1, E e2, E e3) {
+        return Collections.unmodifiableList(
+            Arrays.asList(Objects.requireNonNull(e1),
+                          Objects.requireNonNull(e2),
+                          Objects.requireNonNull(e3)));
+    }
+
+    /**
+     * Returns an immutable list containing four elements.
+     *
+     * See <a href="#immutable">Immutable List Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code List}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @param e4 the fourth element
+     * @return a {@code List} containing the specified elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> List<E> of(E e1, E e2, E e3, E e4) {
+        return Collections.unmodifiableList(
+            Arrays.asList(Objects.requireNonNull(e1),
+                          Objects.requireNonNull(e2),
+                          Objects.requireNonNull(e3),
+                          Objects.requireNonNull(e4)));
+    }
+
+    /**
+     * Returns an immutable list containing five elements.
+     *
+     * See <a href="#immutable">Immutable List Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code List}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @param e4 the fourth element
+     * @param e5 the fifth element
+     * @return a {@code List} containing the specified elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> List<E> of(E e1, E e2, E e3, E e4, E e5) {
+        return Collections.unmodifiableList(
+            Arrays.asList(Objects.requireNonNull(e1),
+                          Objects.requireNonNull(e2),
+                          Objects.requireNonNull(e3),
+                          Objects.requireNonNull(e4),
+                          Objects.requireNonNull(e5)));
+    }
+
+    /**
+     * Returns an immutable list containing six elements.
+     *
+     * See <a href="#immutable">Immutable List Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code List}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @param e4 the fourth element
+     * @param e5 the fifth element
+     * @param e6 the sixth element
+     * @return a {@code List} containing the specified elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6) {
+        return Collections.unmodifiableList(
+            Arrays.asList(Objects.requireNonNull(e1),
+                          Objects.requireNonNull(e2),
+                          Objects.requireNonNull(e3),
+                          Objects.requireNonNull(e4),
+                          Objects.requireNonNull(e5),
+                          Objects.requireNonNull(e6)));
+    }
+
+    /**
+     * Returns an immutable list containing seven elements.
+     *
+     * See <a href="#immutable">Immutable List Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code List}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @param e4 the fourth element
+     * @param e5 the fifth element
+     * @param e6 the sixth element
+     * @param e7 the seventh element
+     * @return a {@code List} containing the specified elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) {
+        return Collections.unmodifiableList(
+            Arrays.asList(Objects.requireNonNull(e1),
+                          Objects.requireNonNull(e2),
+                          Objects.requireNonNull(e3),
+                          Objects.requireNonNull(e4),
+                          Objects.requireNonNull(e5),
+                          Objects.requireNonNull(e6),
+                          Objects.requireNonNull(e7)));
+    }
+
+    /**
+     * Returns an immutable list containing eight elements.
+     *
+     * See <a href="#immutable">Immutable List Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code List}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @param e4 the fourth element
+     * @param e5 the fifth element
+     * @param e6 the sixth element
+     * @param e7 the seventh element
+     * @param e8 the eighth element
+     * @return a {@code List} containing the specified elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) {
+        return Collections.unmodifiableList(
+            Arrays.asList(Objects.requireNonNull(e1),
+                          Objects.requireNonNull(e2),
+                          Objects.requireNonNull(e3),
+                          Objects.requireNonNull(e4),
+                          Objects.requireNonNull(e5),
+                          Objects.requireNonNull(e6),
+                          Objects.requireNonNull(e7),
+                          Objects.requireNonNull(e8)));
+    }
+
+    /**
+     * Returns an immutable list containing nine elements.
+     *
+     * See <a href="#immutable">Immutable List Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code List}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @param e4 the fourth element
+     * @param e5 the fifth element
+     * @param e6 the sixth element
+     * @param e7 the seventh element
+     * @param e8 the eighth element
+     * @param e9 the ninth element
+     * @return a {@code List} containing the specified elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) {
+        return Collections.unmodifiableList(
+            Arrays.asList(Objects.requireNonNull(e1),
+                          Objects.requireNonNull(e2),
+                          Objects.requireNonNull(e3),
+                          Objects.requireNonNull(e4),
+                          Objects.requireNonNull(e5),
+                          Objects.requireNonNull(e6),
+                          Objects.requireNonNull(e7),
+                          Objects.requireNonNull(e8),
+                          Objects.requireNonNull(e9)));
+    }
+
+    /**
+     * Returns an immutable list containing ten elements.
+     *
+     * See <a href="#immutable">Immutable List Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code List}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @param e4 the fourth element
+     * @param e5 the fifth element
+     * @param e6 the sixth element
+     * @param e7 the seventh element
+     * @param e8 the eighth element
+     * @param e9 the ninth element
+     * @param e10 the tenth element
+     * @return a {@code List} containing the specified elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) {
+        return Collections.unmodifiableList(
+            Arrays.asList(Objects.requireNonNull(e1),
+                          Objects.requireNonNull(e2),
+                          Objects.requireNonNull(e3),
+                          Objects.requireNonNull(e4),
+                          Objects.requireNonNull(e5),
+                          Objects.requireNonNull(e6),
+                          Objects.requireNonNull(e7),
+                          Objects.requireNonNull(e8),
+                          Objects.requireNonNull(e9),
+                          Objects.requireNonNull(e10)));
+    }
+
+    /**
+     * Returns an immutable list containing an arbitrary number of elements.
+     * See <a href="#immutable">Immutable List Static Factory Methods</a> for details.
+     *
+     * @apiNote
+     * This method also accepts a single array as an argument. The element type of
+     * the resulting list will be the component type of the array, and the size of
+     * the list will be equal to the length of the array. To create a list with
+     * a single element that is an array, do the following:
+     *
+     * <pre>{@code
+     *     String[] array = ... ;
+     *     List<String[]> list = List.<String[]>of(array);
+     * }</pre>
+     *
+     * This will cause the {@link List#of(Object) List.of(E)} method
+     * to be invoked instead.
+     *
+     * @param <E> the {@code List}'s element type
+     * @param elements the elements to be contained in the list
+     * @return a {@code List} containing the specified elements
+     * @throws NullPointerException if an element is {@code null} or if the array is {@code null}
+     *
+     * @since 9
+     */
+    @SafeVarargs
+    @SuppressWarnings("varargs")
+    static <E> List<E> of(E... elements) {
+        elements = elements.clone(); // throws NPE if es is null
+        for (E e : elements) {
+            Objects.requireNonNull(e);
+        }
+        return Collections.unmodifiableList(Arrays.asList(elements));
+    }
 }
--- a/src/java.base/share/classes/java/util/Locale.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/java/util/Locale.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1248,7 +1248,7 @@
      * object, consisting of language, country, variant, script,
      * and extensions as below:
      * <blockquote>
-     * language + "_" + country + "_" + (variant + "_#" | "#") + script + "-" + extensions
+     * language + "_" + country + "_" + (variant + "_#" | "#") + script + "_" + extensions
      * </blockquote>
      *
      * Language is always lower case, country is always upper case, script is always title
@@ -1278,7 +1278,7 @@
      * <li>{@code en_US_WIN}</li>
      * <li>{@code de__POSIX}</li>
      * <li>{@code zh_CN_#Hans}</li>
-     * <li>{@code zh_TW_#Hant-x-java}</li>
+     * <li>{@code zh_TW_#Hant_x-java}</li>
      * <li>{@code th_TH_TH_#u-nu-thai}</li></ul>
      *
      * @return A string representation of the Locale, for debugging.
--- a/src/java.base/share/classes/java/util/Map.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/java/util/Map.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -110,6 +110,31 @@
  * Implementations may optionally handle the self-referential scenario, however
  * most current implementations do not do so.
  *
+ * <h2><a name="immutable">Immutable Map Static Factory Methods</a></h2>
+ * <p>The {@link Map#of() Map.of()} and
+ * {@link Map#ofEntries(Map.Entry...) Map.ofEntries()}
+ * static factory methods provide a convenient way to create immutable maps.
+ * The {@code Map}
+ * instances created by these methods have the following characteristics:
+ *
+ * <ul>
+ * <li>They are <em>structurally immutable</em>. Keys and values cannot be added,
+ * removed, or updated. Attempts to do so result in {@code UnsupportedOperationException}.
+ * However, if the contained keys or values are themselves mutable, this may cause the
+ * Map to behave inconsistently or its contents to appear to change.
+ * <li>They disallow {@code null} keys and values. Attempts to create them with
+ * {@code null} keys or values result in {@code NullPointerException}.
+ * <li>They are serializable if all keys and values are serializable.
+ * <li>They reject duplicate keys at creation time. Duplicate keys
+ * passed to a static factory method result in {@code IllegalArgumentException}.
+ * <li>The iteration order of mappings is unspecified and is subject to change.
+ * <li>They are <a href="../lang/doc-files/ValueBased.html">value-based</a>.
+ * Callers should make no assumptions about the identity of the returned instances.
+ * Factories are free to create new instances or reuse existing ones. Therefore,
+ * identity-sensitive operations on these instances (reference equality ({@code ==}),
+ * identity hash code, and synchronization) are unreliable and should be avoided.
+ * </ul>
+ *
  * <p>This interface is a member of the
  * <a href="{@docRoot}/../technotes/guides/collections/index.html">
  * Java Collections Framework</a>.
@@ -126,7 +151,7 @@
  * @see Set
  * @since 1.2
  */
-public interface Map<K,V> {
+public interface Map<K, V> {
     // Query Operations
 
     /**
@@ -373,7 +398,7 @@
      * @see Map#entrySet()
      * @since 1.2
      */
-    interface Entry<K,V> {
+    interface Entry<K, V> {
         /**
          * Returns the key corresponding to this entry.
          *
@@ -468,7 +493,7 @@
          * @see Comparable
          * @since 1.8
          */
-        public static <K extends Comparable<? super K>, V> Comparator<Map.Entry<K,V>> comparingByKey() {
+        public static <K extends Comparable<? super K>, V> Comparator<Map.Entry<K, V>> comparingByKey() {
             return (Comparator<Map.Entry<K, V>> & Serializable)
                 (c1, c2) -> c1.getKey().compareTo(c2.getKey());
         }
@@ -485,7 +510,7 @@
          * @see Comparable
          * @since 1.8
          */
-        public static <K, V extends Comparable<? super V>> Comparator<Map.Entry<K,V>> comparingByValue() {
+        public static <K, V extends Comparable<? super V>> Comparator<Map.Entry<K, V>> comparingByValue() {
             return (Comparator<Map.Entry<K, V>> & Serializable)
                 (c1, c2) -> c1.getValue().compareTo(c2.getValue());
         }
@@ -1233,4 +1258,465 @@
         }
         return newValue;
     }
+
+    /**
+     * Returns an immutable map containing zero mappings.
+     * See <a href="#immutable">Immutable Map Static Factory Methods</a> for details.
+     *
+     * @param <K> the {@code Map}'s key type
+     * @param <V> the {@code Map}'s value type
+     * @return an empty {@code Map}
+     *
+     * @since 9
+     */
+    static <K, V> Map<K, V> of() {
+        return Collections.emptyMap();
+    }
+
+    /**
+     * Returns an immutable map containing a single mapping.
+     * See <a href="#immutable">Immutable Map Static Factory Methods</a> for details.
+     *
+     * @param <K> the {@code Map}'s key type
+     * @param <V> the {@code Map}'s value type
+     * @param k1 the mapping's key
+     * @param v1 the mapping's value
+     * @return a {@code Map} containing the specified mapping
+     * @throws NullPointerException if the key or the value is {@code null}
+     *
+     * @since 9
+     */
+    static <K, V> Map<K, V> of(K k1, V v1) {
+        return Collections.singletonMap(Objects.requireNonNull(k1), Objects.requireNonNull(v1));
+    }
+
+    /**
+     * Returns an immutable map containing two mappings.
+     * See <a href="#immutable">Immutable Map Static Factory Methods</a> for details.
+     *
+     * @param <K> the {@code Map}'s key type
+     * @param <V> the {@code Map}'s value type
+     * @param k1 the first mapping's key
+     * @param v1 the first mapping's value
+     * @param k2 the second mapping's key
+     * @param v2 the second mapping's value
+     * @return a {@code Map} containing the specified mappings
+     * @throws IllegalArgumentException if the keys are duplicates
+     * @throws NullPointerException if any key or value is {@code null}
+     *
+     * @since 9
+     */
+    static <K, V> Map<K, V> of(K k1, V v1, K k2, V v2) {
+        Map<K, V> map = new HashMap<>(3); // specify number of buckets to avoid resizing
+        map.put(Objects.requireNonNull(k1), Objects.requireNonNull(v1));
+        map.put(Objects.requireNonNull(k2), Objects.requireNonNull(v2));
+        if (map.size() != 2) {
+            throw new IllegalArgumentException("duplicate keys");
+        }
+        return Collections.unmodifiableMap(map);
+    }
+
+    /**
+     * Returns an immutable map containing three mappings.
+     * See <a href="#immutable">Immutable Map Static Factory Methods</a> for details.
+     *
+     * @param <K> the {@code Map}'s key type
+     * @param <V> the {@code Map}'s value type
+     * @param k1 the first mapping's key
+     * @param v1 the first mapping's value
+     * @param k2 the second mapping's key
+     * @param v2 the second mapping's value
+     * @param k3 the third mapping's key
+     * @param v3 the third mapping's value
+     * @return a {@code Map} containing the specified mappings
+     * @throws IllegalArgumentException if there are any duplicate keys
+     * @throws NullPointerException if any key or value is {@code null}
+     *
+     * @since 9
+     */
+    static <K, V> Map<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3) {
+        Map<K, V> map = new HashMap<>(5); // specify number of buckets to avoid resizing
+        map.put(Objects.requireNonNull(k1), Objects.requireNonNull(v1));
+        map.put(Objects.requireNonNull(k2), Objects.requireNonNull(v2));
+        map.put(Objects.requireNonNull(k3), Objects.requireNonNull(v3));
+        if (map.size() != 3) {
+            throw new IllegalArgumentException("duplicate keys");
+        }
+        return Collections.unmodifiableMap(map);
+    }
+
+    /**
+     * Returns an immutable map containing four mappings.
+     * See <a href="#immutable">Immutable Map Static Factory Methods</a> for details.
+     *
+     * @param <K> the {@code Map}'s key type
+     * @param <V> the {@code Map}'s value type
+     * @param k1 the first mapping's key
+     * @param v1 the first mapping's value
+     * @param k2 the second mapping's key
+     * @param v2 the second mapping's value
+     * @param k3 the third mapping's key
+     * @param v3 the third mapping's value
+     * @param k4 the fourth mapping's key
+     * @param v4 the fourth mapping's value
+     * @return a {@code Map} containing the specified mappings
+     * @throws IllegalArgumentException if there are any duplicate keys
+     * @throws NullPointerException if any key or value is {@code null}
+     *
+     * @since 9
+     */
+    static <K, V> Map<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) {
+        Map<K, V> map = new HashMap<>(6); // specify number of buckets to avoid resizing
+        map.put(Objects.requireNonNull(k1), Objects.requireNonNull(v1));
+        map.put(Objects.requireNonNull(k2), Objects.requireNonNull(v2));
+        map.put(Objects.requireNonNull(k3), Objects.requireNonNull(v3));
+        map.put(Objects.requireNonNull(k4), Objects.requireNonNull(v4));
+        if (map.size() != 4) {
+            throw new IllegalArgumentException("duplicate keys");
+        }
+        return Collections.unmodifiableMap(map);
+    }
+
+    /**
+     * Returns an immutable map containing five mappings.
+     * See <a href="#immutable">Immutable Map Static Factory Methods</a> for details.
+     *
+     * @param <K> the {@code Map}'s key type
+     * @param <V> the {@code Map}'s value type
+     * @param k1 the first mapping's key
+     * @param v1 the first mapping's value
+     * @param k2 the second mapping's key
+     * @param v2 the second mapping's value
+     * @param k3 the third mapping's key
+     * @param v3 the third mapping's value
+     * @param k4 the fourth mapping's key
+     * @param v4 the fourth mapping's value
+     * @param k5 the fifth mapping's key
+     * @param v5 the fifth mapping's value
+     * @return a {@code Map} containing the specified mappings
+     * @throws IllegalArgumentException if there are any duplicate keys
+     * @throws NullPointerException if any key or value is {@code null}
+     *
+     * @since 9
+     */
+    static <K, V> Map<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
+        Map<K, V> map = new HashMap<>(7); // specify number of buckets to avoid resizing
+        map.put(Objects.requireNonNull(k1), Objects.requireNonNull(v1));
+        map.put(Objects.requireNonNull(k2), Objects.requireNonNull(v2));
+        map.put(Objects.requireNonNull(k3), Objects.requireNonNull(v3));
+        map.put(Objects.requireNonNull(k4), Objects.requireNonNull(v4));
+        map.put(Objects.requireNonNull(k5), Objects.requireNonNull(v5));
+        if (map.size() != 5) {
+            throw new IllegalArgumentException("duplicate keys");
+        }
+        return Collections.unmodifiableMap(map);
+    }
+
+    /**
+     * Returns an immutable map containing six mappings.
+     * See <a href="#immutable">Immutable Map Static Factory Methods</a> for details.
+     *
+     * @param <K> the {@code Map}'s key type
+     * @param <V> the {@code Map}'s value type
+     * @param k1 the first mapping's key
+     * @param v1 the first mapping's value
+     * @param k2 the second mapping's key
+     * @param v2 the second mapping's value
+     * @param k3 the third mapping's key
+     * @param v3 the third mapping's value
+     * @param k4 the fourth mapping's key
+     * @param v4 the fourth mapping's value
+     * @param k5 the fifth mapping's key
+     * @param v5 the fifth mapping's value
+     * @param k6 the sixth mapping's key
+     * @param v6 the sixth mapping's value
+     * @return a {@code Map} containing the specified mappings
+     * @throws IllegalArgumentException if there are any duplicate keys
+     * @throws NullPointerException if any key or value is {@code null}
+     *
+     * @since 9
+     */
+    static <K, V> Map<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5,
+                               K k6, V v6) {
+        Map<K, V> map = new HashMap<>(9); // specify number of buckets to avoid resizing
+        map.put(Objects.requireNonNull(k1), Objects.requireNonNull(v1));
+        map.put(Objects.requireNonNull(k2), Objects.requireNonNull(v2));
+        map.put(Objects.requireNonNull(k3), Objects.requireNonNull(v3));
+        map.put(Objects.requireNonNull(k4), Objects.requireNonNull(v4));
+        map.put(Objects.requireNonNull(k5), Objects.requireNonNull(v5));
+        map.put(Objects.requireNonNull(k6), Objects.requireNonNull(v6));
+        if (map.size() != 6) {
+            throw new IllegalArgumentException("duplicate keys");
+        }
+        return Collections.unmodifiableMap(map);
+    }
+
+    /**
+     * Returns an immutable map containing seven mappings.
+     * See <a href="#immutable">Immutable Map Static Factory Methods</a> for details.
+     *
+     * @param <K> the {@code Map}'s key type
+     * @param <V> the {@code Map}'s value type
+     * @param k1 the first mapping's key
+     * @param v1 the first mapping's value
+     * @param k2 the second mapping's key
+     * @param v2 the second mapping's value
+     * @param k3 the third mapping's key
+     * @param v3 the third mapping's value
+     * @param k4 the fourth mapping's key
+     * @param v4 the fourth mapping's value
+     * @param k5 the fifth mapping's key
+     * @param v5 the fifth mapping's value
+     * @param k6 the sixth mapping's key
+     * @param v6 the sixth mapping's value
+     * @param k7 the seventh mapping's key
+     * @param v7 the seventh mapping's value
+     * @return a {@code Map} containing the specified mappings
+     * @throws IllegalArgumentException if there are any duplicate keys
+     * @throws NullPointerException if any key or value is {@code null}
+     *
+     * @since 9
+     */
+    static <K, V> Map<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5,
+                               K k6, V v6, K k7, V v7) {
+        Map<K, V> map = new HashMap<>(10); // specify number of buckets to avoid resizing
+        map.put(Objects.requireNonNull(k1), Objects.requireNonNull(v1));
+        map.put(Objects.requireNonNull(k2), Objects.requireNonNull(v2));
+        map.put(Objects.requireNonNull(k3), Objects.requireNonNull(v3));
+        map.put(Objects.requireNonNull(k4), Objects.requireNonNull(v4));
+        map.put(Objects.requireNonNull(k5), Objects.requireNonNull(v5));
+        map.put(Objects.requireNonNull(k6), Objects.requireNonNull(v6));
+        map.put(Objects.requireNonNull(k7), Objects.requireNonNull(v7));
+        if (map.size() != 7) {
+            throw new IllegalArgumentException("duplicate keys");
+        }
+        return Collections.unmodifiableMap(map);
+    }
+
+    /**
+     * Returns an immutable map containing eight mappings.
+     * See <a href="#immutable">Immutable Map Static Factory Methods</a> for details.
+     *
+     * @param <K> the {@code Map}'s key type
+     * @param <V> the {@code Map}'s value type
+     * @param k1 the first mapping's key
+     * @param v1 the first mapping's value
+     * @param k2 the second mapping's key
+     * @param v2 the second mapping's value
+     * @param k3 the third mapping's key
+     * @param v3 the third mapping's value
+     * @param k4 the fourth mapping's key
+     * @param v4 the fourth mapping's value
+     * @param k5 the fifth mapping's key
+     * @param v5 the fifth mapping's value
+     * @param k6 the sixth mapping's key
+     * @param v6 the sixth mapping's value
+     * @param k7 the seventh mapping's key
+     * @param v7 the seventh mapping's value
+     * @param k8 the eighth mapping's key
+     * @param v8 the eighth mapping's value
+     * @return a {@code Map} containing the specified mappings
+     * @throws IllegalArgumentException if there are any duplicate keys
+     * @throws NullPointerException if any key or value is {@code null}
+     *
+     * @since 9
+     */
+    static <K, V> Map<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5,
+                               K k6, V v6, K k7, V v7, K k8, V v8) {
+        Map<K, V> map = new HashMap<>(11); // specify number of buckets to avoid resizing
+        map.put(Objects.requireNonNull(k1), Objects.requireNonNull(v1));
+        map.put(Objects.requireNonNull(k2), Objects.requireNonNull(v2));
+        map.put(Objects.requireNonNull(k3), Objects.requireNonNull(v3));
+        map.put(Objects.requireNonNull(k4), Objects.requireNonNull(v4));
+        map.put(Objects.requireNonNull(k5), Objects.requireNonNull(v5));
+        map.put(Objects.requireNonNull(k6), Objects.requireNonNull(v6));
+        map.put(Objects.requireNonNull(k7), Objects.requireNonNull(v7));
+        map.put(Objects.requireNonNull(k8), Objects.requireNonNull(v8));
+        if (map.size() != 8) {
+            throw new IllegalArgumentException("duplicate keys");
+        }
+        return Collections.unmodifiableMap(map);
+    }
+
+    /**
+     * Returns an immutable map containing nine mappings.
+     * See <a href="#immutable">Immutable Map Static Factory Methods</a> for details.
+     *
+     * @param <K> the {@code Map}'s key type
+     * @param <V> the {@code Map}'s value type
+     * @param k1 the first mapping's key
+     * @param v1 the first mapping's value
+     * @param k2 the second mapping's key
+     * @param v2 the second mapping's value
+     * @param k3 the third mapping's key
+     * @param v3 the third mapping's value
+     * @param k4 the fourth mapping's key
+     * @param v4 the fourth mapping's value
+     * @param k5 the fifth mapping's key
+     * @param v5 the fifth mapping's value
+     * @param k6 the sixth mapping's key
+     * @param v6 the sixth mapping's value
+     * @param k7 the seventh mapping's key
+     * @param v7 the seventh mapping's value
+     * @param k8 the eighth mapping's key
+     * @param v8 the eighth mapping's value
+     * @param k9 the ninth mapping's key
+     * @param v9 the ninth mapping's value
+     * @return a {@code Map} containing the specified mappings
+     * @throws IllegalArgumentException if there are any duplicate keys
+     * @throws NullPointerException if any key or value is {@code null}
+     *
+     * @since 9
+     */
+    static <K, V> Map<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5,
+                               K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) {
+        Map<K, V> map = new HashMap<>(13); // specify number of buckets to avoid resizing
+        map.put(Objects.requireNonNull(k1), Objects.requireNonNull(v1));
+        map.put(Objects.requireNonNull(k2), Objects.requireNonNull(v2));
+        map.put(Objects.requireNonNull(k3), Objects.requireNonNull(v3));
+        map.put(Objects.requireNonNull(k4), Objects.requireNonNull(v4));
+        map.put(Objects.requireNonNull(k5), Objects.requireNonNull(v5));
+        map.put(Objects.requireNonNull(k6), Objects.requireNonNull(v6));
+        map.put(Objects.requireNonNull(k7), Objects.requireNonNull(v7));
+        map.put(Objects.requireNonNull(k8), Objects.requireNonNull(v8));
+        map.put(Objects.requireNonNull(k9), Objects.requireNonNull(v9));
+        if (map.size() != 9) {
+            throw new IllegalArgumentException("duplicate keys");
+        }
+        return Collections.unmodifiableMap(map);
+    }
+
+    /**
+     * Returns an immutable map containing ten mappings.
+     * See <a href="#immutable">Immutable Map Static Factory Methods</a> for details.
+     *
+     * @param <K> the {@code Map}'s key type
+     * @param <V> the {@code Map}'s value type
+     * @param k1 the first mapping's key
+     * @param v1 the first mapping's value
+     * @param k2 the second mapping's key
+     * @param v2 the second mapping's value
+     * @param k3 the third mapping's key
+     * @param v3 the third mapping's value
+     * @param k4 the fourth mapping's key
+     * @param v4 the fourth mapping's value
+     * @param k5 the fifth mapping's key
+     * @param v5 the fifth mapping's value
+     * @param k6 the sixth mapping's key
+     * @param v6 the sixth mapping's value
+     * @param k7 the seventh mapping's key
+     * @param v7 the seventh mapping's value
+     * @param k8 the eighth mapping's key
+     * @param v8 the eighth mapping's value
+     * @param k9 the ninth mapping's key
+     * @param v9 the ninth mapping's value
+     * @param k10 the tenth mapping's key
+     * @param v10 the tenth mapping's value
+     * @return a {@code Map} containing the specified mappings
+     * @throws IllegalArgumentException if there are any duplicate keys
+     * @throws NullPointerException if any key or value is {@code null}
+     *
+     * @since 9
+     */
+    static <K, V> Map<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5,
+                               K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) {
+        Map<K, V> map = new HashMap<>(14); // specify number of buckets to avoid resizing
+        map.put(Objects.requireNonNull(k1), Objects.requireNonNull(v1));
+        map.put(Objects.requireNonNull(k2), Objects.requireNonNull(v2));
+        map.put(Objects.requireNonNull(k3), Objects.requireNonNull(v3));
+        map.put(Objects.requireNonNull(k4), Objects.requireNonNull(v4));
+        map.put(Objects.requireNonNull(k5), Objects.requireNonNull(v5));
+        map.put(Objects.requireNonNull(k6), Objects.requireNonNull(v6));
+        map.put(Objects.requireNonNull(k7), Objects.requireNonNull(v7));
+        map.put(Objects.requireNonNull(k8), Objects.requireNonNull(v8));
+        map.put(Objects.requireNonNull(k9), Objects.requireNonNull(v9));
+        map.put(Objects.requireNonNull(k10), Objects.requireNonNull(v10));
+        if (map.size() != 10) {
+            throw new IllegalArgumentException("duplicate keys");
+        }
+        return Collections.unmodifiableMap(map);
+    }
+
+    /**
+     * Returns an immutable map containing keys and values extracted from the given entries.
+     * The entries themselves are not stored in the map.
+     * See <a href="#immutable">Immutable Map Static Factory Methods</a> for details.
+     *
+     * @apiNote
+     * It is convenient to create the map entries using the {@link Map#entry Map.entry()} method.
+     * For example,
+     *
+     * <pre>{@code
+     *     import static java.util.Map.entry;
+     *
+     *     Map<Integer,String> map = Map.ofEntries(
+     *         entry(1, "a"),
+     *         entry(2, "b"),
+     *         entry(3, "c"),
+     *         ...
+     *         entry(26, "z"));
+     * }</pre>
+     *
+     * @param <K> the {@code Map}'s key type
+     * @param <V> the {@code Map}'s value type
+     * @param entries {@code Map.Entry}s containing the keys and values from which the map is populated
+     * @return a {@code Map} containing the specified mappings
+     * @throws IllegalArgumentException if there are any duplicate keys
+     * @throws NullPointerException if any entry, key, or value is {@code null}, or if
+     *         the {@code entries} array is {@code null}
+     *
+     * @see Map#entry Map.entry()
+     * @since 9
+     */
+    @SafeVarargs
+    @SuppressWarnings("varargs")
+    static <K, V> Map<K, V> ofEntries(Entry<? extends K, ? extends V>... entries) {
+        Map<K, V> map = new HashMap<>(entries.length * 4 / 3 + 1); // throws NPE if entries is null
+        for (Entry<? extends K, ? extends V> e : entries) {
+            // next line throws NPE if e is null
+            map.put(Objects.requireNonNull(e.getKey()), Objects.requireNonNull(e.getValue()));
+        }
+        if (map.size() != entries.length) {
+            throw new IllegalArgumentException("duplicate keys");
+        }
+        return Collections.unmodifiableMap(map);
+    }
+
+    /**
+     * Returns an immutable {@link Entry} containing the given key and value.
+     * These entries are suitable for populating {@code Map} instances using the
+     * {@link Map#ofEntries Map.ofEntries()} method.
+     * The {@code Entry} instances created by this method have the following characteristics:
+     *
+     * <ul>
+     * <li>They disallow {@code null} keys and values. Attempts to create them using a {@code null}
+     * key or value result in {@code NullPointerException}.
+     * <li>They are immutable. Calls to {@link Entry#setValue Entry.setValue()}
+     * on a returned {@code Entry} result in {@code UnsupportedOperationException}.
+     * <li>They are not serializable.
+     * <li>They are <a href="../lang/doc-files/ValueBased.html">value-based</a>.
+     * Callers should make no assumptions about the identity of the returned instances.
+     * This method is free to create new instances or reuse existing ones. Therefore,
+     * identity-sensitive operations on these instances (reference equality ({@code ==}),
+     * identity hash code, and synchronization) are unreliable and should be avoided.
+     * </ul>
+     *
+     * @apiNote
+     * For a serializable {@code Entry}, see {@link AbstractMap.SimpleEntry} or
+     * {@link AbstractMap.SimpleImmutableEntry}.
+     *
+     * @param <K> the key's type
+     * @param <V> the value's type
+     * @param k the key
+     * @param v the value
+     * @return an {@code Entry} containing the specified key and value
+     * @throws NullPointerException if the key or value is {@code null}
+     *
+     * @see Map#ofEntries Map.ofEntries()
+     * @since 9
+     */
+    static <K, V> Entry<K, V> entry(K k, V v) {
+        // KeyValueHolder checks for nulls
+        return new KeyValueHolder<>(k, v);
+    }
 }
--- a/src/java.base/share/classes/java/util/Set.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/java/util/Set.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,6 +63,29 @@
  * Such exceptions are marked as "optional" in the specification for this
  * interface.
  *
+ * <h2><a name="immutable">Immutable Set Static Factory Methods</a></h2>
+ * <p>The {@link Set#of(Object...) Set.of()} static factory methods
+ * provide a convenient way to create immutable sets. The {@code Set}
+ * instances created by these methods have the following characteristics:
+ *
+ * <ul>
+ * <li>They are <em>structurally immutable</em>. Elements cannot be added or
+ * removed. Attempts to do so result in {@code UnsupportedOperationException}.
+ * However, if the contained elements are themselves mutable, this may cause the
+ * Set to behave inconsistently or its contents to appear to change.
+ * <li>They disallow {@code null} elements. Attempts to create them with
+ * {@code null} elements result in {@code NullPointerException}.
+ * <li>They are serializable if all elements are serializable.
+ * <li>They reject duplicate elements at creation time. Duplicate elements
+ * passed to a static factory method result in {@code IllegalArgumentException}.
+ * <li>The iteration order of set elements is unspecified and is subject to change.
+ * <li>They are <a href="../lang/doc-files/ValueBased.html">value-based</a>.
+ * Callers should make no assumptions about the identity of the returned instances.
+ * Factories are free to create new instances or reuse existing ones. Therefore,
+ * identity-sensitive operations on these instances (reference equality ({@code ==}),
+ * identity hash code, and synchronization) are unreliable and should be avoided.
+ * </ul>
+ *
  * <p>This interface is a member of the
  * <a href="{@docRoot}/../technotes/guides/collections/index.html">
  * Java Collections Framework</a>.
@@ -410,4 +433,341 @@
     default Spliterator<E> spliterator() {
         return Spliterators.spliterator(this, Spliterator.DISTINCT);
     }
+
+    /**
+     * Returns an immutable set containing zero elements.
+     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code Set}'s element type
+     * @return an empty {@code Set}
+     *
+     * @since 9
+     */
+    static <E> Set<E> of() {
+        return Collections.emptySet();
+    }
+
+    /**
+     * Returns an immutable set containing one element.
+     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code Set}'s element type
+     * @param e1 the single element
+     * @return a {@code Set} containing the specified element
+     * @throws NullPointerException if the element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> Set<E> of(E e1) {
+        return Collections.singleton(Objects.requireNonNull(e1));
+    }
+
+    /**
+     * Returns an immutable set containing two elements.
+     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code Set}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @return a {@code Set} containing the specified elements
+     * @throws IllegalArgumentException if the elements are duplicates
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> Set<E> of(E e1, E e2) {
+        Set<E> set = new HashSet<>(Arrays.asList(Objects.requireNonNull(e1),
+                                                 Objects.requireNonNull(e2)));
+        if (set.size() != 2) {
+            throw new IllegalArgumentException("duplicate elements");
+        }
+        return Collections.unmodifiableSet(set);
+    }
+
+    /**
+     * Returns an immutable set containing three elements.
+     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code Set}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @return a {@code Set} containing the specified elements
+     * @throws IllegalArgumentException if there are any duplicate elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> Set<E> of(E e1, E e2, E e3) {
+        Set<E> set = new HashSet<>(Arrays.asList(Objects.requireNonNull(e1),
+                                                 Objects.requireNonNull(e2),
+                                                 Objects.requireNonNull(e3)));
+        if (set.size() != 3) {
+            throw new IllegalArgumentException("duplicate elements");
+        }
+        return Collections.unmodifiableSet(set);
+    }
+
+    /**
+     * Returns an immutable set containing four elements.
+     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code Set}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @param e4 the fourth element
+     * @return a {@code Set} containing the specified elements
+     * @throws IllegalArgumentException if there are any duplicate elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> Set<E> of(E e1, E e2, E e3, E e4) {
+        Set<E> set = new HashSet<>(Arrays.asList(Objects.requireNonNull(e1),
+                                                 Objects.requireNonNull(e2),
+                                                 Objects.requireNonNull(e3),
+                                                 Objects.requireNonNull(e4)));
+        if (set.size() != 4) {
+            throw new IllegalArgumentException("duplicate elements");
+        }
+        return Collections.unmodifiableSet(set);
+    }
+
+    /**
+     * Returns an immutable set containing five elements.
+     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code Set}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @param e4 the fourth element
+     * @param e5 the fifth element
+     * @return a {@code Set} containing the specified elements
+     * @throws IllegalArgumentException if there are any duplicate elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> Set<E> of(E e1, E e2, E e3, E e4, E e5) {
+        Set<E> set = new HashSet<>(Arrays.asList(Objects.requireNonNull(e1),
+                                                 Objects.requireNonNull(e2),
+                                                 Objects.requireNonNull(e3),
+                                                 Objects.requireNonNull(e4),
+                                                 Objects.requireNonNull(e5)));
+        if (set.size() != 5) {
+            throw new IllegalArgumentException("duplicate elements");
+        }
+        return Collections.unmodifiableSet(set);
+    }
+
+    /**
+     * Returns an immutable set containing six elements.
+     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code Set}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @param e4 the fourth element
+     * @param e5 the fifth element
+     * @param e6 the sixth element
+     * @return a {@code Set} containing the specified elements
+     * @throws IllegalArgumentException if there are any duplicate elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> Set<E> of(E e1, E e2, E e3, E e4, E e5, E e6) {
+        Set<E> set = new HashSet<>(Arrays.asList(Objects.requireNonNull(e1),
+                                                 Objects.requireNonNull(e2),
+                                                 Objects.requireNonNull(e3),
+                                                 Objects.requireNonNull(e4),
+                                                 Objects.requireNonNull(e5),
+                                                 Objects.requireNonNull(e6)));
+        if (set.size() != 6) {
+            throw new IllegalArgumentException("duplicate elements");
+        }
+        return Collections.unmodifiableSet(set);
+    }
+
+    /**
+     * Returns an immutable set containing seven elements.
+     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code Set}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @param e4 the fourth element
+     * @param e5 the fifth element
+     * @param e6 the sixth element
+     * @param e7 the seventh element
+     * @return a {@code Set} containing the specified elements
+     * @throws IllegalArgumentException if there are any duplicate elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> Set<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) {
+        Set<E> set = new HashSet<>(Arrays.asList(Objects.requireNonNull(e1),
+                                                 Objects.requireNonNull(e2),
+                                                 Objects.requireNonNull(e3),
+                                                 Objects.requireNonNull(e4),
+                                                 Objects.requireNonNull(e5),
+                                                 Objects.requireNonNull(e6),
+                                                 Objects.requireNonNull(e7)));
+        if (set.size() != 7) {
+            throw new IllegalArgumentException("duplicate elements");
+        }
+        return Collections.unmodifiableSet(set);
+    }
+
+    /**
+     * Returns an immutable set containing eight elements.
+     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code Set}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @param e4 the fourth element
+     * @param e5 the fifth element
+     * @param e6 the sixth element
+     * @param e7 the seventh element
+     * @param e8 the eighth element
+     * @return a {@code Set} containing the specified elements
+     * @throws IllegalArgumentException if there are any duplicate elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> Set<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) {
+        Set<E> set = new HashSet<>(Arrays.asList(Objects.requireNonNull(e1),
+                                                 Objects.requireNonNull(e2),
+                                                 Objects.requireNonNull(e3),
+                                                 Objects.requireNonNull(e4),
+                                                 Objects.requireNonNull(e5),
+                                                 Objects.requireNonNull(e6),
+                                                 Objects.requireNonNull(e7),
+                                                 Objects.requireNonNull(e8)));
+        if (set.size() != 8) {
+            throw new IllegalArgumentException("duplicate elements");
+        }
+        return Collections.unmodifiableSet(set);
+    }
+
+    /**
+     * Returns an immutable set containing nine elements.
+     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code Set}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @param e4 the fourth element
+     * @param e5 the fifth element
+     * @param e6 the sixth element
+     * @param e7 the seventh element
+     * @param e8 the eighth element
+     * @param e9 the ninth element
+     * @return a {@code Set} containing the specified elements
+     * @throws IllegalArgumentException if there are any duplicate elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> Set<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) {
+        Set<E> set = new HashSet<>(Arrays.asList(Objects.requireNonNull(e1),
+                                                 Objects.requireNonNull(e2),
+                                                 Objects.requireNonNull(e3),
+                                                 Objects.requireNonNull(e4),
+                                                 Objects.requireNonNull(e5),
+                                                 Objects.requireNonNull(e6),
+                                                 Objects.requireNonNull(e7),
+                                                 Objects.requireNonNull(e8),
+                                                 Objects.requireNonNull(e9)));
+        if (set.size() != 9) {
+            throw new IllegalArgumentException("duplicate elements");
+        }
+        return Collections.unmodifiableSet(set);
+    }
+
+    /**
+     * Returns an immutable set containing ten elements.
+     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
+     *
+     * @param <E> the {@code Set}'s element type
+     * @param e1 the first element
+     * @param e2 the second element
+     * @param e3 the third element
+     * @param e4 the fourth element
+     * @param e5 the fifth element
+     * @param e6 the sixth element
+     * @param e7 the seventh element
+     * @param e8 the eighth element
+     * @param e9 the ninth element
+     * @param e10 the tenth element
+     * @return a {@code Set} containing the specified elements
+     * @throws IllegalArgumentException if there are any duplicate elements
+     * @throws NullPointerException if an element is {@code null}
+     *
+     * @since 9
+     */
+    static <E> Set<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) {
+        Set<E> set = new HashSet<>(Arrays.asList(Objects.requireNonNull(e1),
+                                                 Objects.requireNonNull(e2),
+                                                 Objects.requireNonNull(e3),
+                                                 Objects.requireNonNull(e4),
+                                                 Objects.requireNonNull(e5),
+                                                 Objects.requireNonNull(e6),
+                                                 Objects.requireNonNull(e7),
+                                                 Objects.requireNonNull(e8),
+                                                 Objects.requireNonNull(e9),
+                                                 Objects.requireNonNull(e10)));
+        if (set.size() != 10) {
+            throw new IllegalArgumentException("duplicate elements");
+        }
+        return Collections.unmodifiableSet(set);
+    }
+
+    /**
+     * Returns an immutable set containing an arbitrary number of elements.
+     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
+     *
+     * @apiNote
+     * This method also accepts a single array as an argument. The element type of
+     * the resulting set will be the component type of the array, and the size of
+     * the set will be equal to the length of the array. To create a set with
+     * a single element that is an array, do the following:
+     *
+     * <pre>{@code
+     *     String[] array = ... ;
+     *     Set<String[]> list = Set.<String[]>of(array);
+     * }</pre>
+     *
+     * This will cause the {@link Set#of(Object) Set.of(E)} method
+     * to be invoked instead.
+     *
+     * @param <E> the {@code Set}'s element type
+     * @param elements the elements to be contained in the set
+     * @return a {@code Set} containing the specified elements
+     * @throws IllegalArgumentException if there are any duplicate elements
+     * @throws NullPointerException if an element is {@code null} or if the array is {@code null}
+     *
+     * @since 9
+     */
+    @SafeVarargs
+    static <E> Set<E> of(E... elements) {
+        for (E e : elements) { // throws NPE if es is null
+            Objects.requireNonNull(e);
+        }
+        @SuppressWarnings("varargs")
+        Set<E> set = new HashSet<>(Arrays.asList(elements));
+        if (set.size() != elements.length) {
+            throw new IllegalArgumentException("duplicate elements");
+        }
+        return Collections.unmodifiableSet(set);
+    }
 }
--- a/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java	Fri Dec 18 10:00:55 2015 -0800
@@ -39,6 +39,7 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.concurrent.TimeUnit;
+import jdk.internal.vm.annotation.ReservedStackAccess;
 
 /**
  * Provides a framework for implementing blocking locks and related
@@ -886,6 +887,7 @@
      * @param arg the acquire argument
      * @return {@code true} if interrupted while waiting
      */
+    @ReservedStackAccess
     final boolean acquireQueued(final Node node, int arg) {
         try {
             boolean interrupted = false;
@@ -1218,6 +1220,7 @@
      *        {@link #tryAcquire} but is otherwise uninterpreted and
      *        can represent anything you like.
      */
+    @ReservedStackAccess
     public final void acquire(int arg) {
         if (!tryAcquire(arg) &&
             acquireQueued(addWaiter(Node.EXCLUSIVE), arg))
@@ -1281,6 +1284,7 @@
      *        can represent anything you like.
      * @return the value returned from {@link #tryRelease}
      */
+    @ReservedStackAccess
     public final boolean release(int arg) {
         if (tryRelease(arg)) {
             Node h = head;
@@ -1361,6 +1365,7 @@
      *        and can represent anything you like.
      * @return the value returned from {@link #tryReleaseShared}
      */
+    @ReservedStackAccess
     public final boolean releaseShared(int arg) {
         if (tryReleaseShared(arg)) {
             doReleaseShared();
--- a/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java	Fri Dec 18 10:00:55 2015 -0800
@@ -37,6 +37,7 @@
 
 import java.util.Collection;
 import java.util.concurrent.TimeUnit;
+import jdk.internal.vm.annotation.ReservedStackAccess;
 
 /**
  * A reentrant mutual exclusion {@link Lock} with the same basic
@@ -127,6 +128,7 @@
          * Performs non-fair tryLock.  tryAcquire is implemented in
          * subclasses, but both need nonfair try for trylock method.
          */
+        @ReservedStackAccess
         final boolean nonfairTryAcquire(int acquires) {
             final Thread current = Thread.currentThread();
             int c = getState();
@@ -146,6 +148,7 @@
             return false;
         }
 
+        @ReservedStackAccess
         protected final boolean tryRelease(int releases) {
             int c = getState() - releases;
             if (Thread.currentThread() != getExclusiveOwnerThread())
@@ -203,6 +206,7 @@
          * Performs lock.  Try immediate barge, backing up to normal
          * acquire on failure.
          */
+        @ReservedStackAccess
         final void lock() {
             if (compareAndSetState(0, 1))
                 setExclusiveOwnerThread(Thread.currentThread());
@@ -229,6 +233,7 @@
          * Fair version of tryAcquire.  Don't grant access unless
          * recursive call or no waiters or is first.
          */
+        @ReservedStackAccess
         protected final boolean tryAcquire(int acquires) {
             final Thread current = Thread.currentThread();
             int c = getState();
--- a/src/java.base/share/classes/javax/security/cert/package-info.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/javax/security/cert/package-info.java	Fri Dec 18 10:00:55 2015 -0800
@@ -26,16 +26,16 @@
 /**
  * Provides classes for public key certificates.
  *
- * This package has been deprecated. These classes include a simplified
- * version of the {@code java.security.cert} package.  These classes were
- * developed as part of the Java Secure Socket
- * Extension (JSSE).  When JSSE was added to the J2SE version 1.4, this
- * package was added for backward-compatibility reasons only.
+ * The classes in this package have been deprecated. New classes should not
+ * be added to this package. These classes include a simplified version of
+ * the {@code java.security.cert} package.  These classes were developed as
+ * part of the Java Secure Socket Extension (JSSE).  When JSSE was added to
+ * the J2SE version 1.4, this package was added for backward-compatibility
+ * reasons only.
  *
  * New applications should not use this package, but rather
  * {@code java.security.cert}.
  *
  * @since 1.4
  */
-@Deprecated
 package javax.security.cert;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/vm/annotation/ReservedStackAccess.java	Fri Dec 18 10:00:55 2015 -0800
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.vm.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p>An annotation expressing that a method is especially sensitive
+ * to stack overflows. This is a hint the JVM can use to grant access to
+ * extra stack space when executing this code if such feature is supported
+ * by the JVM. The JVM is free to ignore this annotation.
+ *
+ * A possible way for the JVM to improve the execution context for methods
+ * with this annotation is to reserve part of the thread's execution stack
+ * for them. Access to this section of the stack would be denied by default
+ * but could be granted if the JVM detects a possible stack overflow and
+ * the thread's call stack includes at least one annotated method. Even if
+ * access to this reserved area has been granted, the JVM might decide to
+ * throw a delayed StackOverflowError when the thread exits the annotated
+ * method.
+ *
+ * @since 1.9
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+public @interface ReservedStackAccess { }
--- a/src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +0,0 @@
-/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.invoke.anon;
-
-import java.io.EOFException;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/**
- * Anonymous class loader.  Will load any valid classfile, producing
- * a {@link Class} metaobject, without installing that class in the
- * system dictionary.  Therefore, {@link Class#forName(String)} will never
- * produce a reference to an anonymous class.
- * <p>
- * The access permissions of the anonymous class are borrowed from
- * a <em>host class</em>.  The new class behaves as if it were an
- * inner class of the host class.  It can access the host's private
- * members, if the creator of the class loader has permission to
- * do so (or to create accessible reflective objects).
- * <p>
- * When the anonymous class is loaded, elements of its constant pool
- * can be patched to new values.  This provides a hook to pre-resolve
- * named classes in the constant pool to other classes, including
- * anonymous ones.  Also, string constants can be pre-resolved to
- * any reference.  (The verifier treats non-string, non-class reference
- * constants as plain objects.)
- *  <p>
- * Why include the patching function?  It makes some use cases much easier.
- * Second, the constant pool needed some internal patching anyway,
- * to anonymize the loaded class itself.  Finally, if you are going
- * to use this seriously, you'll want to build anonymous classes
- * on top of pre-existing anonymous classes, and that requires patching.
- *
- * <p>%%% TO-DO:
- * <ul>
- * <li>needs better documentation</li>
- * <li>needs more security work (for safe delegation)</li>
- * <li>needs a clearer story about error processing</li>
- * <li>patch member references also (use ';' as delimiter char)</li>
- * <li>patch method references to (conforming) method handles</li>
- * </ul>
- *
- * @author jrose
- * @author Remi Forax
- * @see <a href="http://blogs.sun.com/jrose/entry/anonymous_classes_in_the_vm">
- *      http://blogs.sun.com/jrose/entry/anonymous_classes_in_the_vm</a>
- */
-
-public class AnonymousClassLoader {
-    final Class<?> hostClass;
-
-    // Privileged constructor.
-    private AnonymousClassLoader(Class<?> hostClass) {
-        this.hostClass = hostClass;
-    }
-
-    public static AnonymousClassLoader make(jdk.internal.misc.Unsafe unsafe, Class<?> hostClass) {
-        if (unsafe == null)  throw new NullPointerException();
-        return new AnonymousClassLoader(hostClass);
-    }
-
-    public Class<?> loadClass(byte[] classFile) {
-        if (defineAnonymousClass == null) {
-            // no JVM support; try to fake an approximation
-            try {
-                return fakeLoadClass(new ConstantPoolParser(classFile).createPatch());
-            } catch (InvalidConstantPoolFormatException ee) {
-                throw new IllegalArgumentException(ee);
-            }
-        }
-        return loadClass(classFile, null);
-    }
-
-    public Class<?> loadClass(ConstantPoolPatch classPatch) {
-        if (defineAnonymousClass == null) {
-            // no JVM support; try to fake an approximation
-            return fakeLoadClass(classPatch);
-        }
-        Object[] patches = classPatch.patchArray;
-        // Convert class names (this late in the game)
-        // to use slash '/' instead of dot '.'.
-        // Java likes dots, but the JVM likes slashes.
-        for (int i = 0; i < patches.length; i++) {
-            Object value = patches[i];
-            if (value != null) {
-                byte tag = classPatch.getTag(i);
-                switch (tag) {
-                case ConstantPoolVisitor.CONSTANT_Class:
-                    if (value instanceof String) {
-                        if (patches == classPatch.patchArray)
-                            patches = patches.clone();
-                        patches[i] = ((String)value).replace('.', '/');
-                    }
-                    break;
-                case ConstantPoolVisitor.CONSTANT_Fieldref:
-                case ConstantPoolVisitor.CONSTANT_Methodref:
-                case ConstantPoolVisitor.CONSTANT_InterfaceMethodref:
-                case ConstantPoolVisitor.CONSTANT_NameAndType:
-                    // When/if the JVM supports these patches,
-                    // we'll probably need to reformat them also.
-                    // Meanwhile, let the class loader create the error.
-                    break;
-                }
-            }
-        }
-        return loadClass(classPatch.outer.classFile, classPatch.patchArray);
-    }
-
-    private Class<?> loadClass(byte[] classFile, Object[] patchArray) {
-        try {
-            return (Class<?>)
-                defineAnonymousClass.invoke(unsafe,
-                                            hostClass, classFile, patchArray);
-        } catch (Exception ex) {
-            throwReflectedException(ex);
-            throw new RuntimeException("error loading into "+hostClass, ex);
-        }
-    }
-
-    private static void throwReflectedException(Exception ex) {
-        if (ex instanceof InvocationTargetException) {
-            Throwable tex = ((InvocationTargetException)ex).getTargetException();
-            if (tex instanceof Error)
-                throw (Error) tex;
-            ex = (Exception) tex;
-        }
-        if (ex instanceof RuntimeException) {
-            throw (RuntimeException) ex;
-        }
-    }
-
-    private Class<?> fakeLoadClass(ConstantPoolPatch classPatch) {
-        // Implementation:
-        // 1. Make up a new name nobody has used yet.
-        // 2. Inspect the tail-header of the class to find the this_class index.
-        // 3. Patch the CONSTANT_Class for this_class to the new name.
-        // 4. Add other CP entries required by (e.g.) string patches.
-        // 5. Flatten Class constants down to their names, making sure that
-        //    the host class loader can pick them up again accurately.
-        // 6. Generate the edited class file bytes.
-        //
-        // Potential limitations:
-        // * The class won't be truly anonymous, and may interfere with others.
-        // * Flattened class constants might not work, because of loader issues.
-        // * Pseudo-string constants will not flatten down to real strings.
-        // * Method handles will (of course) fail to flatten to linkage strings.
-        if (true)  throw new UnsupportedOperationException("NYI");
-        Object[] cpArray;
-        try {
-            cpArray = classPatch.getOriginalCP();
-        } catch (InvalidConstantPoolFormatException ex) {
-            throw new RuntimeException(ex);
-        }
-        int thisClassIndex = classPatch.getParser().getThisClassIndex();
-        String thisClassName = (String) cpArray[thisClassIndex];
-        synchronized (AnonymousClassLoader.class) {
-            thisClassName = thisClassName+"\\|"+(++fakeNameCounter);
-        }
-        classPatch.putUTF8(thisClassIndex, thisClassName);
-        byte[] classFile = null;
-        return unsafe.defineClass(null, classFile, 0, classFile.length,
-                                  hostClass.getClassLoader(),
-                                  hostClass.getProtectionDomain());
-    }
-    private static int fakeNameCounter = 99999;
-
-    // ignore two warnings on this line:
-    private static jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
-    // preceding line requires that this class be on the boot class path
-
-    private static final Method defineAnonymousClass;
-    static {
-        Method dac = null;
-        Class<? extends jdk.internal.misc.Unsafe> unsafeClass = unsafe.getClass();
-        try {
-            dac = unsafeClass.getMethod("defineAnonymousClass",
-                                        Class.class,
-                                        byte[].class,
-                                        Object[].class);
-        } catch (Exception ee) {
-            dac = null;
-        }
-        defineAnonymousClass = dac;
-    }
-
-    private static void noJVMSupport() {
-        throw new UnsupportedOperationException("no JVM support for anonymous classes");
-    }
-
-
-    private static native Class<?> loadClassInternal(Class<?> hostClass,
-                                                     byte[] classFile,
-                                                     Object[] patchArray);
-
-    public static byte[] readClassFile(Class<?> templateClass) throws IOException {
-        String templateName = templateClass.getName();
-        int lastDot = templateName.lastIndexOf('.');
-        java.net.URL url = templateClass.getResource(templateName.substring(lastDot+1)+".class");
-        java.net.URLConnection connection = url.openConnection();
-        int contentLength = connection.getContentLength();
-        if (contentLength < 0)
-            throw new IOException("invalid content length "+contentLength);
-
-        byte[] b = connection.getInputStream().readAllBytes();
-        if (b.length != contentLength)
-            throw new EOFException("Expected:" + contentLength + ", read:" + b.length);
-
-        return b;
-    }
-}
--- a/src/java.base/share/classes/sun/invoke/anon/ConstantPoolParser.java	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,368 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.invoke.anon;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.BufferUnderflowException;
-import java.nio.ByteBuffer;
-
-import static sun.invoke.anon.ConstantPoolVisitor.*;
-
-/** A constant pool parser.
- */
-public class ConstantPoolParser {
-    final byte[] classFile;
-    final byte[] tags;
-    final char[] firstHeader;  // maghi, maglo, minor, major, cplen
-
-    // these are filled in on first parse:
-    int endOffset;
-    char[] secondHeader;       // flags, this_class, super_class, intlen
-
-    // used to decode UTF8 array
-    private char[] charArray = new char[80];
-
-    /** Creates a constant pool parser.
-     * @param classFile an array of bytes containing a class.
-     * @throws InvalidConstantPoolFormatException if the header of the class has errors.
-     */
-    public ConstantPoolParser(byte[] classFile) throws InvalidConstantPoolFormatException {
-        this.classFile = classFile;
-        this.firstHeader = parseHeader(classFile);
-        this.tags = new byte[firstHeader[4]];
-    }
-
-    /** Create a constant pool parser by loading the bytecodes of the
-     *  class taken as argument.
-     *
-     * @param templateClass the class to parse.
-     *
-     * @throws IOException raised if an I/O occurs when loading
-     *  the bytecode of the template class.
-     * @throws InvalidConstantPoolFormatException if the header of the class has errors.
-     *
-     * @see #ConstantPoolParser(byte[])
-     * @see AnonymousClassLoader#readClassFile(Class)
-     */
-    public ConstantPoolParser(Class<?> templateClass) throws IOException, InvalidConstantPoolFormatException {
-        this(AnonymousClassLoader.readClassFile(templateClass));
-    }
-
-    /** Creates an empty patch to patch the class file
-     *  used by the current parser.
-     * @return a new class patch.
-     */
-    public ConstantPoolPatch createPatch() {
-        return new ConstantPoolPatch(this);
-    }
-
-    /** Report the tag of the indicated CP entry.
-     * @param index
-     * @return one of {@link ConstantPoolVisitor#CONSTANT_Utf8}, etc.
-     */
-    public byte getTag(int index) {
-        getEndOffset();  // trigger an exception if we haven't parsed yet
-        return tags[index];
-    }
-
-    /** Report the length of the constant pool. */
-    public int getLength() {
-        return firstHeader[4];
-    }
-
-    /** Report the offset, within the class file, of the start of the constant pool. */
-    public int getStartOffset() {
-        return firstHeader.length * 2;
-    }
-
-    /** Report the offset, within the class file, of the end of the constant pool. */
-    public int getEndOffset() {
-        if (endOffset == 0)
-            throw new IllegalStateException("class file has not yet been parsed");
-        return endOffset;
-    }
-
-    /** Report the CP index of this class's own name. */
-    public int getThisClassIndex() {
-        getEndOffset();   // provoke exception if not yet parsed
-        return secondHeader[1];
-    }
-
-    /** Report the total size of the class file. */
-    public int getTailLength() {
-        return classFile.length - getEndOffset();
-    }
-
-    /** Write the head (header plus constant pool)
-     *  of the class file to the indicated stream.
-     */
-    public void writeHead(OutputStream out) throws IOException {
-        out.write(classFile, 0, getEndOffset());
-    }
-
-    /** Write the head (header plus constant pool)
-     *  of the class file to the indicated stream,
-     *  incorporating the non-null entries of the given array
-     *  as patches.
-     */
-    void writePatchedHead(OutputStream out, Object[] patchArray) {
-        // this will be useful to partially emulate the class loader on old JVMs
-        throw new UnsupportedOperationException("Not yet implemented");
-    }
-
-    /** Write the tail (everything after the constant pool)
-     *  of the class file to the indicated stream.
-     */
-    public void writeTail(OutputStream out) throws IOException {
-        out.write(classFile, getEndOffset(), getTailLength());
-    }
-
-    private static char[] parseHeader(byte[] classFile) throws InvalidConstantPoolFormatException {
-        char[] result = new char[5];
-        ByteBuffer buffer = ByteBuffer.wrap(classFile);
-        for (int i = 0; i < result.length; i++)
-            result[i] = (char) getUnsignedShort(buffer);
-        int magic = result[0] << 16 | result[1] << 0;
-        if (magic != 0xCAFEBABE)
-            throw new InvalidConstantPoolFormatException("invalid magic number "+magic);
-        // skip major, minor version
-        int len = result[4];
-        if (len < 1)
-            throw new InvalidConstantPoolFormatException("constant pool length < 1");
-        return result;
-    }
-
-    /** Parse the constant pool of the class
-     *  calling a method visit* each time a constant pool entry is parsed.
-     *
-     *  The order of the calls to visit* is not guaranteed to be the same
-     *  than the order of the constant pool entry in the bytecode array.
-     *
-     * @param visitor
-     * @throws InvalidConstantPoolFormatException
-     */
-    public void parse(ConstantPoolVisitor visitor) throws InvalidConstantPoolFormatException {
-        ByteBuffer buffer = ByteBuffer.wrap(classFile);
-        buffer.position(getStartOffset()); //skip header
-
-        Object[] values = new Object[getLength()];
-        try {
-            parseConstantPool(buffer, values, visitor);
-        } catch(BufferUnderflowException e) {
-            throw new InvalidConstantPoolFormatException(e);
-        }
-        if (endOffset == 0) {
-            endOffset = buffer.position();
-            secondHeader = new char[4];
-            for (int i = 0; i < secondHeader.length; i++) {
-                secondHeader[i] = (char) getUnsignedShort(buffer);
-            }
-        }
-        resolveConstantPool(values, visitor);
-    }
-
-    private char[] getCharArray(int utfLength) {
-        if (utfLength <= charArray.length)
-            return charArray;
-        return charArray = new char[utfLength];
-    }
-
-    private void parseConstantPool(ByteBuffer buffer, Object[] values, ConstantPoolVisitor visitor) throws InvalidConstantPoolFormatException {
-        for (int i = 1; i < tags.length; ) {
-            byte tag = (byte) getUnsignedByte(buffer);
-            assert(tags[i] == 0 || tags[i] == tag);
-            tags[i] = tag;
-            switch (tag) {
-                case CONSTANT_Utf8:
-                    int utfLen = getUnsignedShort(buffer);
-                    String value = getUTF8(buffer, utfLen, getCharArray(utfLen));
-                    visitor.visitUTF8(i, CONSTANT_Utf8, value);
-                    tags[i] = tag;
-                    values[i++] = value;
-                    break;
-                case CONSTANT_Integer:
-                    visitor.visitConstantValue(i, tag, buffer.getInt());
-                    i++;
-                    break;
-                case CONSTANT_Float:
-                    visitor.visitConstantValue(i, tag, buffer.getFloat());
-                    i++;
-                    break;
-                case CONSTANT_Long:
-                    visitor.visitConstantValue(i, tag, buffer.getLong());
-                    i+=2;
-                    break;
-                case CONSTANT_Double:
-                    visitor.visitConstantValue(i, tag, buffer.getDouble());
-                    i+=2;
-                    break;
-
-                case CONSTANT_Class:    // fall through:
-                case CONSTANT_String:
-                    tags[i] = tag;
-                    values[i++] = new int[] { getUnsignedShort(buffer) };
-                    break;
-
-                case CONSTANT_Fieldref:           // fall through:
-                case CONSTANT_Methodref:          // fall through:
-                case CONSTANT_InterfaceMethodref: // fall through:
-                case CONSTANT_NameAndType:
-                    tags[i] = tag;
-                    values[i++] = new int[] { getUnsignedShort(buffer), getUnsignedShort(buffer) };
-                    break;
-                default:
-                    throw new AssertionError("invalid constant "+tag);
-            }
-        }
-    }
-
-    private void resolveConstantPool(Object[] values, ConstantPoolVisitor visitor) {
-        // clean out the int[] values, which are temporary
-        for (int beg = 1, end = values.length-1, beg2, end2;
-             beg <= end;
-             beg = beg2, end = end2) {
-             beg2 = end; end2 = beg-1;
-             //System.out.println("CP resolve pass: "+beg+".."+end);
-             for (int i = beg; i <= end; i++) {
-                  Object value = values[i];
-                  if (!(value instanceof int[]))
-                      continue;
-                  int[] array = (int[]) value;
-                  byte tag = tags[i];
-                  switch (tag) {
-                      case CONSTANT_String:
-                          String stringBody = (String) values[array[0]];
-                          visitor.visitConstantString(i, tag, stringBody, array[0]);
-                          values[i] = null;
-                          break;
-                      case CONSTANT_Class: {
-                          String className = (String) values[array[0]];
-                          // use the external form favored by Class.forName:
-                          className = className.replace('/', '.');
-                          visitor.visitConstantString(i, tag, className, array[0]);
-                          values[i] = className;
-                          break;
-                      }
-                      case CONSTANT_NameAndType: {
-                          String memberName = (String) values[array[0]];
-                          String signature  = (String) values[array[1]];
-                          visitor.visitDescriptor(i, tag, memberName, signature,
-                                                  array[0], array[1]);
-                          values[i] = new String[] {memberName, signature};
-                          break;
-                      }
-                      case CONSTANT_Fieldref:           // fall through:
-                      case CONSTANT_Methodref:          // fall through:
-                      case CONSTANT_InterfaceMethodref: {
-                              Object className   = values[array[0]];
-                              Object nameAndType = values[array[1]];
-                              if (!(className instanceof String) ||
-                                  !(nameAndType instanceof String[])) {
-                                   // one more pass is needed
-                                   if (beg2 > i)  beg2 = i;
-                                   if (end2 < i)  end2 = i;
-                                   continue;
-                              }
-                              String[] nameAndTypeArray = (String[]) nameAndType;
-                              visitor.visitMemberRef(i, tag,
-                                  (String)className,
-                                  nameAndTypeArray[0],
-                                  nameAndTypeArray[1],
-                                  array[0], array[1]);
-                              values[i] = null;
-                          }
-                          break;
-                      default:
-                          continue;
-                }
-            }
-        }
-    }
-
-    private static int getUnsignedByte(ByteBuffer buffer) {
-        return buffer.get() & 0xFF;
-    }
-
-    private static int getUnsignedShort(ByteBuffer buffer) {
-        int b1 = getUnsignedByte(buffer);
-        int b2 = getUnsignedByte(buffer);
-        return (b1 << 8) + (b2 << 0);
-    }
-
-    private static String getUTF8(ByteBuffer buffer, int utfLen, char[] charArray) throws InvalidConstantPoolFormatException {
-      int utfLimit = buffer.position() + utfLen;
-      int index = 0;
-      while (buffer.position() < utfLimit) {
-          int c = buffer.get() & 0xff;
-          if (c > 127) {
-              buffer.position(buffer.position() - 1);
-              return getUTF8Extended(buffer, utfLimit, charArray, index);
-          }
-          charArray[index++] = (char)c;
-      }
-      return new String(charArray, 0, index);
-    }
-
-    private static String getUTF8Extended(ByteBuffer buffer, int utfLimit, char[] charArray, int index) throws InvalidConstantPoolFormatException {
-        int c, c2, c3;
-        while (buffer.position() < utfLimit) {
-            c = buffer.get() & 0xff;
-            switch (c >> 4) {
-                case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
-                    /* 0xxxxxxx*/
-                    charArray[index++] = (char)c;
-                    break;
-                case 12: case 13:
-                    /* 110x xxxx   10xx xxxx*/
-                    c2 = buffer.get();
-                    if ((c2 & 0xC0) != 0x80)
-                        throw new InvalidConstantPoolFormatException(
-                            "malformed input around byte " + buffer.position());
-                     charArray[index++] = (char)(((c  & 0x1F) << 6) |
-                                                  (c2 & 0x3F));
-                    break;
-                case 14:
-                    /* 1110 xxxx  10xx xxxx  10xx xxxx */
-                    c2 = buffer.get();
-                    c3 = buffer.get();
-                    if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80))
-                       throw new InvalidConstantPoolFormatException(
-                          "malformed input around byte " + (buffer.position()));
-                    charArray[index++] = (char)(((c  & 0x0F) << 12) |
-                                                ((c2 & 0x3F) << 6)  |
-                                                ((c3 & 0x3F) << 0));
-                    break;
-                default:
-                    /* 10xx xxxx,  1111 xxxx */
-                    throw new InvalidConstantPoolFormatException(
-                        "malformed input around byte " + buffer.position());
-            }
-        }
-        // The number of chars produced may be less than utflen
-        return new String(charArray, 0, index);
-    }
-}
--- a/src/java.base/share/classes/sun/invoke/anon/ConstantPoolPatch.java	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,503 +0,0 @@
-/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.invoke.anon;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.Map;
-
-import static sun.invoke.anon.ConstantPoolVisitor.*;
-
-/** A class and its patched constant pool.
- *
- *  This class allow to modify (patch) a constant pool
- *  by changing the value of its entry.
- *  Entry are referenced using index that can be get
- *  by parsing the constant pool using
- *  {@link ConstantPoolParser#parse(ConstantPoolVisitor)}.
- *
- * @see ConstantPoolVisitor
- * @see ConstantPoolParser#createPatch()
- */
-public class ConstantPoolPatch {
-    final ConstantPoolParser outer;
-    final Object[] patchArray;
-
-    ConstantPoolPatch(ConstantPoolParser outer) {
-        this.outer      = outer;
-        this.patchArray = new Object[outer.getLength()];
-    }
-
-    /** Create a {@link ConstantPoolParser} and
-     *  a {@link ConstantPoolPatch} in one step.
-     *  Equivalent to {@code new ConstantPoolParser(classFile).createPatch()}.
-     *
-     * @param classFile an array of bytes containing a class.
-     * @see #ConstantPoolParser(Class)
-     */
-    public ConstantPoolPatch(byte[] classFile) throws InvalidConstantPoolFormatException {
-        this(new ConstantPoolParser(classFile));
-    }
-
-    /** Create a {@link ConstantPoolParser} and
-     *  a {@link ConstantPoolPatch} in one step.
-     *  Equivalent to {@code new ConstantPoolParser(templateClass).createPatch()}.
-     *
-     * @param templateClass the class to parse.
-     * @see #ConstantPoolParser(Class)
-     */
-    public ConstantPoolPatch(Class<?> templateClass) throws IOException, InvalidConstantPoolFormatException {
-        this(new ConstantPoolParser(templateClass));
-    }
-
-
-    /** Creates a patch from an existing patch.
-     *  All changes are copied from that patch.
-     * @param patch a patch
-     *
-     * @see ConstantPoolParser#createPatch()
-     */
-    public ConstantPoolPatch(ConstantPoolPatch patch) {
-        outer      = patch.outer;
-        patchArray = patch.patchArray.clone();
-    }
-
-    /** Which parser built this patch? */
-    public ConstantPoolParser getParser() {
-        return outer;
-    }
-
-    /** Report the tag at the given index in the constant pool. */
-    public byte getTag(int index) {
-        return outer.getTag(index);
-    }
-
-    /** Report the current patch at the given index of the constant pool.
-     *  Null means no patch will be made.
-     *  To observe the unpatched entry at the given index, use
-     *  {@link #getParser()}{@code .}@link ConstantPoolParser#parse(ConstantPoolVisitor)}
-     */
-    public Object getPatch(int index) {
-        Object value = patchArray[index];
-        if (value == null)  return null;
-        switch (getTag(index)) {
-        case CONSTANT_Fieldref:
-        case CONSTANT_Methodref:
-        case CONSTANT_InterfaceMethodref:
-            if (value instanceof String)
-                value = stripSemis(2, (String) value);
-            break;
-        case CONSTANT_NameAndType:
-            if (value instanceof String)
-                value = stripSemis(1, (String) value);
-            break;
-        }
-        return value;
-    }
-
-    /** Clear all patches. */
-    public void clear() {
-        Arrays.fill(patchArray, null);
-    }
-
-    /** Clear one patch. */
-    public void clear(int index) {
-        patchArray[index] = null;
-    }
-
-    /** Produce the patches as an array. */
-    public Object[] getPatches() {
-        return patchArray.clone();
-    }
-
-    /** Produce the original constant pool as an array. */
-    public Object[] getOriginalCP() throws InvalidConstantPoolFormatException {
-        return getOriginalCP(0, patchArray.length, -1);
-    }
-
-    /** Walk the constant pool, applying patches using the given map.
-     *
-     * @param utf8Map Utf8 strings to modify, if encountered
-     * @param classMap Classes (or their names) to modify, if encountered
-     * @param valueMap Constant values to modify, if encountered
-     * @param deleteUsedEntries if true, delete map entries that are used
-     */
-    public void putPatches(final Map<String,String> utf8Map,
-                           final Map<String,Object> classMap,
-                           final Map<Object,Object> valueMap,
-                           boolean deleteUsedEntries) throws InvalidConstantPoolFormatException {
-        final HashSet<String> usedUtf8Keys;
-        final HashSet<String> usedClassKeys;
-        final HashSet<Object> usedValueKeys;
-        if (deleteUsedEntries) {
-            usedUtf8Keys  = (utf8Map  == null) ? null : new HashSet<String>();
-            usedClassKeys = (classMap == null) ? null : new HashSet<String>();
-            usedValueKeys = (valueMap == null) ? null : new HashSet<Object>();
-        } else {
-            usedUtf8Keys = null;
-            usedClassKeys = null;
-            usedValueKeys = null;
-        }
-
-        outer.parse(new ConstantPoolVisitor() {
-
-            @Override
-            public void visitUTF8(int index, byte tag, String utf8) {
-                putUTF8(index, utf8Map.get(utf8));
-                if (usedUtf8Keys != null)  usedUtf8Keys.add(utf8);
-            }
-
-            @Override
-            public void visitConstantValue(int index, byte tag, Object value) {
-                putConstantValue(index, tag, valueMap.get(value));
-                if (usedValueKeys != null)  usedValueKeys.add(value);
-            }
-
-            @Override
-            public void visitConstantString(int index, byte tag, String name, int nameIndex) {
-                if (tag == CONSTANT_Class) {
-                    putConstantValue(index, tag, classMap.get(name));
-                    if (usedClassKeys != null)  usedClassKeys.add(name);
-                } else {
-                    assert(tag == CONSTANT_String);
-                    visitConstantValue(index, tag, name);
-                }
-            }
-        });
-        if (usedUtf8Keys != null)   utf8Map.keySet().removeAll(usedUtf8Keys);
-        if (usedClassKeys != null)  classMap.keySet().removeAll(usedClassKeys);
-        if (usedValueKeys != null)  valueMap.keySet().removeAll(usedValueKeys);
-    }
-
-    Object[] getOriginalCP(final int startIndex,
-                           final int endIndex,
-                           final int tagMask) throws InvalidConstantPoolFormatException {
-        final Object[] cpArray = new Object[endIndex - startIndex];
-        outer.parse(new ConstantPoolVisitor() {
-
-            void show(int index, byte tag, Object value) {
-                if (index < startIndex || index >= endIndex)  return;
-                if (((1 << tag) & tagMask) == 0)  return;
-                cpArray[index - startIndex] = value;
-            }
-
-            @Override
-            public void visitUTF8(int index, byte tag, String utf8) {
-                show(index, tag, utf8);
-            }
-
-            @Override
-            public void visitConstantValue(int index, byte tag, Object value) {
-                assert(tag != CONSTANT_String);
-                show(index, tag, value);
-            }
-
-            @Override
-            public void visitConstantString(int index, byte tag,
-                                            String value, int j) {
-                show(index, tag, value);
-            }
-
-            @Override
-            public void visitMemberRef(int index, byte tag,
-                    String className, String memberName,
-                    String signature,
-                    int j, int k) {
-                show(index, tag, new String[]{ className, memberName, signature });
-            }
-
-            @Override
-            public void visitDescriptor(int index, byte tag,
-                    String memberName, String signature,
-                    int j, int k) {
-                show(index, tag, new String[]{ memberName, signature });
-            }
-        });
-        return cpArray;
-    }
-
-    /** Write the head (header plus constant pool)
-     *  of the patched class file to the indicated stream.
-     */
-    void writeHead(OutputStream out) throws IOException {
-        outer.writePatchedHead(out, patchArray);
-    }
-
-    /** Write the tail (everything after the constant pool)
-     *  of the patched class file to the indicated stream.
-     */
-    void writeTail(OutputStream out) throws IOException {
-        outer.writeTail(out);
-    }
-
-    private void checkConstantTag(byte tag, Object value) {
-        if (value == null)
-            throw new IllegalArgumentException(
-                    "invalid null constant value");
-        if (classForTag(tag) != value.getClass())
-            throw new IllegalArgumentException(
-                    "invalid constant value"
-                    + (tag == CONSTANT_None ? ""
-                        : " for tag "+tagName(tag))
-                    + " of class "+value.getClass());
-    }
-
-    private void checkTag(int index, byte putTag) {
-        byte tag = outer.tags[index];
-        if (tag != putTag)
-            throw new IllegalArgumentException(
-                "invalid put operation"
-                + " for " + tagName(putTag)
-                + " at index " + index + " found " + tagName(tag));
-    }
-
-    private void checkTagMask(int index, int tagBitMask) {
-        byte tag = outer.tags[index];
-        int tagBit = ((tag & 0x1F) == tag) ? (1 << tag) : 0;
-        if ((tagBit & tagBitMask) == 0)
-            throw new IllegalArgumentException(
-                "invalid put operation"
-                + " at index " + index + " found " + tagName(tag));
-    }
-
-    private static void checkMemberName(String memberName) {
-        if (memberName.indexOf(';') >= 0)
-            throw new IllegalArgumentException("memberName " + memberName + " contains a ';'");
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new string.
-     *
-     * @param index an index to a constant pool entry containing a
-     *        {@link ConstantPoolVisitor#CONSTANT_Utf8} value.
-     * @param utf8 a string
-     *
-     * @see ConstantPoolVisitor#visitUTF8(int, byte, String)
-     */
-    public void putUTF8(int index, String utf8) {
-        if (utf8 == null) { clear(index); return; }
-        checkTag(index, CONSTANT_Utf8);
-        patchArray[index] = utf8;
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new value, depending on its dynamic type.
-     *
-     * @param index an index to a constant pool entry containing a
-     *        one of the following structures:
-     *        {@link ConstantPoolVisitor#CONSTANT_Integer},
-     *        {@link ConstantPoolVisitor#CONSTANT_Float},
-     *        {@link ConstantPoolVisitor#CONSTANT_Long},
-     *        {@link ConstantPoolVisitor#CONSTANT_Double},
-     *        {@link ConstantPoolVisitor#CONSTANT_String}, or
-     *        {@link ConstantPoolVisitor#CONSTANT_Class}
-     * @param value a boxed int, float, long or double; or a string or class object
-     * @throws IllegalArgumentException if the type of the constant does not
-     *         match the constant pool entry type,
-     *         as reported by {@link #getTag(int)}
-     *
-     * @see #putConstantValue(int, byte, Object)
-     * @see ConstantPoolVisitor#visitConstantValue(int, byte, Object)
-     * @see ConstantPoolVisitor#visitConstantString(int, byte, String, int)
-     */
-    public void putConstantValue(int index, Object value) {
-        if (value == null) { clear(index); return; }
-        byte tag = tagForConstant(value.getClass());
-        checkConstantTag(tag, value);
-        checkTag(index, tag);
-        patchArray[index] = value;
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new value.
-     *
-     * @param index an index to a constant pool entry matching the given tag
-     * @param tag one of the following values:
-     *        {@link ConstantPoolVisitor#CONSTANT_Integer},
-     *        {@link ConstantPoolVisitor#CONSTANT_Float},
-     *        {@link ConstantPoolVisitor#CONSTANT_Long},
-     *        {@link ConstantPoolVisitor#CONSTANT_Double},
-     *        {@link ConstantPoolVisitor#CONSTANT_String}, or
-     *        {@link ConstantPoolVisitor#CONSTANT_Class}
-     * @param value a boxed number, string, or class object
-     * @throws IllegalArgumentException if the type of the constant does not
-     *         match the constant pool entry type, or if a class name contains
-     *         '/' or ';'
-     *
-     * @see #putConstantValue(int, Object)
-     * @see ConstantPoolVisitor#visitConstantValue(int, byte, Object)
-     * @see ConstantPoolVisitor#visitConstantString(int, byte, String, int)
-     */
-    public void putConstantValue(int index, byte tag, Object value) {
-        if (value == null) { clear(index); return; }
-        checkTag(index, tag);
-        if (tag == CONSTANT_Class && value instanceof String) {
-            checkClassName((String) value);
-        } else if (tag == CONSTANT_String) {
-            // the JVM accepts any object as a patch for a string
-        } else {
-            // make sure the incoming value is the right type
-            checkConstantTag(tag, value);
-        }
-        checkTag(index, tag);
-        patchArray[index] = value;
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new {@link ConstantPoolVisitor#CONSTANT_NameAndType} value.
-     *
-     * @param index an index to a constant pool entry containing a
-     *        {@link ConstantPoolVisitor#CONSTANT_NameAndType} value.
-     * @param memberName a memberName
-     * @param signature a signature
-     * @throws IllegalArgumentException if memberName contains the character ';'
-     *
-     * @see ConstantPoolVisitor#visitDescriptor(int, byte, String, String, int, int)
-     */
-    public void putDescriptor(int index, String memberName, String signature) {
-        checkTag(index, CONSTANT_NameAndType);
-        checkMemberName(memberName);
-        patchArray[index] = addSemis(memberName, signature);
-    }
-
-    /** Set the entry of the constant pool indexed by index to
-     *  a new {@link ConstantPoolVisitor#CONSTANT_Fieldref},
-     *  {@link ConstantPoolVisitor#CONSTANT_Methodref}, or
-     *  {@link ConstantPoolVisitor#CONSTANT_InterfaceMethodref} value.
-     *
-     * @param index an index to a constant pool entry containing a member reference
-     * @param className a class name
-     * @param memberName a field or method name
-     * @param signature a field or method signature
-     * @throws IllegalArgumentException if memberName contains the character ';'
-     *             or signature is not a correct signature
-     *
-     * @see ConstantPoolVisitor#visitMemberRef(int, byte, String, String, String, int, int)
-     */
-    public void putMemberRef(int index, byte tag,
-                    String className, String memberName, String signature) {
-        checkTagMask(tag, CONSTANT_MemberRef_MASK);
-        checkTag(index, tag);
-        checkClassName(className);
-        checkMemberName(memberName);
-        if (signature.startsWith("(") == (tag == CONSTANT_Fieldref))
-            throw new IllegalArgumentException("bad signature: "+signature);
-        patchArray[index] = addSemis(className, memberName, signature);
-    }
-
-    private static final int CONSTANT_MemberRef_MASK =
-              CONSTANT_Fieldref
-            | CONSTANT_Methodref
-            | CONSTANT_InterfaceMethodref;
-
-    private static final Map<Class<?>, Byte> CONSTANT_VALUE_CLASS_TAG
-        = new IdentityHashMap<Class<?>, Byte>(6);
-    private static final Class<?>[] CONSTANT_VALUE_CLASS = new Class<?>[16];
-    static {
-        Object[][] values = {
-            {Integer.class, CONSTANT_Integer},
-            {Long.class, CONSTANT_Long},
-            {Float.class, CONSTANT_Float},
-            {Double.class, CONSTANT_Double},
-            {String.class, CONSTANT_String},
-            {Class.class, CONSTANT_Class}
-        };
-        for (Object[] value : values) {
-            Class<?> cls = (Class<?>)value[0];
-            Byte     tag = (Byte) value[1];
-            CONSTANT_VALUE_CLASS_TAG.put(cls, tag);
-            CONSTANT_VALUE_CLASS[(byte)tag] = cls;
-        }
-    }
-
-    static Class<?> classForTag(byte tag) {
-        if ((tag & 0xFF) >= CONSTANT_VALUE_CLASS.length)
-            return null;
-        return CONSTANT_VALUE_CLASS[tag];
-    }
-
-    static byte tagForConstant(Class<?> cls) {
-        Byte tag = CONSTANT_VALUE_CLASS_TAG.get(cls);
-        return (tag == null) ? CONSTANT_None : (byte)tag;
-    }
-
-    private static void checkClassName(String className) {
-        if (className.indexOf('/') >= 0 || className.indexOf(';') >= 0)
-            throw new IllegalArgumentException("invalid class name " + className);
-    }
-
-    static String addSemis(String name, String... names) {
-        StringBuilder buf = new StringBuilder(name.length() * 5);
-        buf.append(name);
-        for (String name2 : names) {
-            buf.append(';').append(name2);
-        }
-        String res = buf.toString();
-        assert(stripSemis(names.length, res)[0].equals(name));
-        assert(stripSemis(names.length, res)[1].equals(names[0]));
-        assert(names.length == 1 ||
-               stripSemis(names.length, res)[2].equals(names[1]));
-        return res;
-    }
-
-    static String[] stripSemis(int count, String string) {
-        String[] res = new String[count+1];
-        int pos = 0;
-        for (int i = 0; i < count; i++) {
-            int pos2 = string.indexOf(';', pos);
-            if (pos2 < 0)  pos2 = string.length();  // yuck
-            res[i] = string.substring(pos, pos2);
-            pos = pos2;
-        }
-        res[count] = string.substring(pos);
-        return res;
-    }
-
-    public String toString() {
-        StringBuilder buf = new StringBuilder(this.getClass().getName());
-        buf.append("{");
-        Object[] origCP = null;
-        for (int i = 0; i < patchArray.length; i++) {
-            if (patchArray[i] == null)  continue;
-            if (origCP != null) {
-                buf.append(", ");
-            } else {
-                try {
-                    origCP = getOriginalCP();
-                } catch (InvalidConstantPoolFormatException ee) {
-                    origCP = new Object[0];
-                }
-            }
-            Object orig = (i < origCP.length) ? origCP[i] : "?";
-            buf.append(orig).append("=").append(patchArray[i]);
-        }
-        buf.append("}");
-        return buf.toString();
-    }
-}
--- a/src/java.base/share/classes/sun/invoke/anon/ConstantPoolVisitor.java	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.invoke.anon;
-
-/**
- * A visitor called by {@link ConstantPoolParser#parse(ConstantPoolVisitor)}
- * when a constant pool entry is parsed.
- * <p>
- * A visit* method is called when a constant pool entry is parsed.
- * The first argument is always the constant pool index.
- * The second argument is always the constant pool tag,
- * even for methods like {@link #visitUTF8(int, byte, String)} which only apply to one tag.
- * String arguments refer to Utf8 or NameAndType entries declared elsewhere,
- * and are always accompanied by the indexes of those entries.
- * <p>
- * The order of the calls to the visit* methods is not necessarily related
- * to the order of the entries in the constant pool.
- * If one entry has a reference to another entry, the latter (lower-level)
- * entry will be visited first.
- * <p>
- * The following table shows the relation between constant pool entry
- * types and the corresponding visit* methods:
- *
- * <table border=1 cellpadding=5 summary="constant pool visitor methods">
- * <tr><th>Tag(s)</th><th>Method</th></tr>
- * <tr>
- *   <td>{@link #CONSTANT_Utf8}</td>
- *   <td>{@link #visitUTF8(int, byte, String)}</td>
- * </tr><tr>
- *   <td>{@link #CONSTANT_Integer}, {@link #CONSTANT_Float},
- *       {@link #CONSTANT_Long}, {@link #CONSTANT_Double}</td>
- *   <td>{@link #visitConstantValue(int, byte, Object)}</td>
- * </tr><tr>
- *   <td>{@link #CONSTANT_String}, {@link #CONSTANT_Class}</td>
- *   <td>{@link #visitConstantString(int, byte, String, int)}</td>
- * </tr><tr>
- *   <td>{@link #CONSTANT_NameAndType}</td>
- *   <td>{@link #visitDescriptor(int, byte, String, String, int, int)}</td>
- * </tr><tr>
- *   <td>{@link #CONSTANT_Fieldref},
- *       {@link #CONSTANT_Methodref},
- *       {@link #CONSTANT_InterfaceMethodref}</td>
- *   <td>{@link #visitMemberRef(int, byte, String, String, String, int, int)}</td>
- * </tr>
- * </table>
- *
- * @see ConstantPoolPatch
- * @author Remi Forax
- * @author jrose
- */
-public class ConstantPoolVisitor {
-  /** Called each time an UTF8 constant pool entry is found.
-   * @param index the constant pool index
-   * @param tag always {@link #CONSTANT_Utf8}
-   * @param utf8 string encoded in modified UTF-8 format passed as a {@code String}
-   *
-   * @see ConstantPoolPatch#putUTF8(int, String)
-   */
-  public void visitUTF8(int index, byte tag, String utf8) {
-    // do nothing
-  }
-
-  /** Called for each constant pool entry that encodes an integer,
-   *  a float, a long, or a double.
-   *  Constant strings and classes are not managed by this method but
-   *  by {@link #visitConstantString(int, byte, String, int)}.
-   *
-   * @param index the constant pool index
-   * @param tag one of {@link #CONSTANT_Integer},
-   *            {@link #CONSTANT_Float},
-   *            {@link #CONSTANT_Long},
-   *            or {@link #CONSTANT_Double}
-   * @param value encoded value
-   *
-   * @see ConstantPoolPatch#putConstantValue(int, Object)
-   */
-  public void visitConstantValue(int index, byte tag, Object value) {
-    // do nothing
-  }
-
-  /** Called for each constant pool entry that encodes a string or a class.
-   * @param index the constant pool index
-   * @param tag one of {@link #CONSTANT_String},
-   *            {@link #CONSTANT_Class},
-   * @param name string body or class name (using dot separator)
-   * @param nameIndex the index of the Utf8 string for the name
-   *
-   * @see ConstantPoolPatch#putConstantValue(int, byte, Object)
-   */
-  public void visitConstantString(int index, byte tag,
-                                  String name, int nameIndex) {
-    // do nothing
-  }
-
-  /** Called for each constant pool entry that encodes a name and type.
-   * @param index the constant pool index
-   * @param tag always {@link #CONSTANT_NameAndType}
-   * @param memberName a field or method name
-   * @param signature the member signature
-   * @param memberNameIndex index of the Utf8 string for the member name
-   * @param signatureIndex index of the Utf8 string for the signature
-   *
-   * @see ConstantPoolPatch#putDescriptor(int, String, String)
-   */
-  public void visitDescriptor(int index, byte tag,
-                              String memberName, String signature,
-                              int memberNameIndex, int signatureIndex) {
-    // do nothing
-  }
-
-  /** Called for each constant pool entry that encodes a field or method.
-   * @param index the constant pool index
-   * @param tag one of {@link #CONSTANT_Fieldref},
-   *            or {@link #CONSTANT_Methodref},
-   *            or {@link #CONSTANT_InterfaceMethodref}
-   * @param className the class name (using dot separator)
-   * @param memberName name of the field or method
-   * @param signature the field or method signature
-   * @param classNameIndex index of the Utf8 string for the class name
-   * @param descriptorIndex index of the NameAndType descriptor constant
-   *
-   * @see ConstantPoolPatch#putMemberRef(int, byte, String, String, String)
-   */
-  public void visitMemberRef(int index, byte tag,
-                             String className, String memberName, String signature,
-                             int classNameIndex, int descriptorIndex) {
-    // do nothing
-  }
-
-    public static final byte
-      CONSTANT_None = 0,
-      CONSTANT_Utf8 = 1,
-      //CONSTANT_Unicode = 2,               /* unused */
-      CONSTANT_Integer = 3,
-      CONSTANT_Float = 4,
-      CONSTANT_Long = 5,
-      CONSTANT_Double = 6,
-      CONSTANT_Class = 7,
-      CONSTANT_String = 8,
-      CONSTANT_Fieldref = 9,
-      CONSTANT_Methodref = 10,
-      CONSTANT_InterfaceMethodref = 11,
-      CONSTANT_NameAndType = 12;
-
-    private static String[] TAG_NAMES = {
-        "Empty",
-        "Utf8",
-        null, //"Unicode",
-        "Integer",
-        "Float",
-        "Long",
-        "Double",
-        "Class",
-        "String",
-        "Fieldref",
-        "Methodref",
-        "InterfaceMethodref",
-        "NameAndType"
-    };
-
-    public static String tagName(byte tag) {
-        String name = null;
-        if ((tag & 0xFF) < TAG_NAMES.length)
-            name = TAG_NAMES[tag];
-        if (name == null)
-            name = "Unknown#"+(tag&0xFF);
-        return name;
-    }
-}
--- a/src/java.base/share/classes/sun/invoke/anon/InvalidConstantPoolFormatException.java	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.invoke.anon;
-
-/** Exception used when there is an error in the constant pool
- *  format.
- */
-public class InvalidConstantPoolFormatException extends Exception {
-    private static final long serialVersionUID=-6103888330523770949L;
-
-    public InvalidConstantPoolFormatException(String message,Throwable cause) {
-        super(message,cause);
-    }
-
-    public InvalidConstantPoolFormatException(String message) {
-        super(message);
-    }
-
-    public InvalidConstantPoolFormatException(Throwable cause) {
-        super(cause);
-    }
-}
--- a/src/java.base/share/classes/sun/nio/cs/StringUTF16.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/sun/nio/cs/StringUTF16.java	Fri Dec 18 10:00:55 2015 -0800
@@ -25,8 +25,8 @@
 
 package sun.nio.cs;
 
-import static sun.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET;
-import static sun.misc.Unsafe.ARRAY_BYTE_INDEX_SCALE;
+import static jdk.internal.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET;
+import static jdk.internal.misc.Unsafe.ARRAY_BYTE_INDEX_SCALE;
 
 class StringUTF16 {
 
@@ -35,5 +35,5 @@
                               ARRAY_BYTE_BASE_OFFSET + ARRAY_BYTE_INDEX_SCALE * index * 2L);
     }
 
-    private static final sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
+    private static final jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
 }
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Fri Dec 18 10:00:55 2015 -0800
@@ -766,17 +766,27 @@
         // records, so this also increases robustness.
         //
         if (length > 0) {
+            IOException ioe = null;
+            byte description = 0;    // 0: never used, make the compiler happy
             writeLock.lock();
             try {
                 outputRecord.deliver(source, offset, length);
             } catch (SSLHandshakeException she) {
                 // may be record sequence number overflow
-                fatal(Alerts.alert_handshake_failure, she);
+                description = Alerts.alert_handshake_failure;
+                ioe = she;
             } catch (IOException e) {
-                fatal(Alerts.alert_unexpected_message, e);
+                description = Alerts.alert_unexpected_message;
+                ioe = e;
             } finally {
                 writeLock.unlock();
             }
+
+            // Be care of deadlock. Please don't place the call to fatal()
+            // into the writeLock locked block.
+            if (ioe != null) {
+                fatal(description, ioe);
+            }
         }
 
         /*
--- a/src/java.base/share/classes/sun/security/util/AlgorithmDecomposer.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/share/classes/sun/security/util/AlgorithmDecomposer.java	Fri Dec 18 10:00:55 2015 -0800
@@ -35,8 +35,10 @@
 public class AlgorithmDecomposer {
 
     private static final Pattern transPattern = Pattern.compile("/");
+
+    // '(?<!padd)in': match 'in' but not preceded with 'padd'.
     private static final Pattern pattern =
-                    Pattern.compile("with|and|in", Pattern.CASE_INSENSITIVE);
+            Pattern.compile("with|and|(?<!padd)in", Pattern.CASE_INSENSITIVE);
 
     /**
      * Decompose the standard algorithm name into sub-elements.
--- a/src/java.base/solaris/classes/sun/nio/fs/SolarisAclFileAttributeView.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/solaris/classes/sun/nio/fs/SolarisAclFileAttributeView.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -309,7 +309,12 @@
         checkAccess(file, true, false);
 
         // open file (will fail if file is a link and not following links)
-        int fd = file.openForAttributeAccess(followLinks);
+        int fd = -1;
+        try {
+            fd = file.openForAttributeAccess(followLinks);
+        } catch (UnixException x) {
+            x.rethrowAsIOException(file);
+        }
         try {
             long address = unsafe.allocateMemory(SIZEOF_ACE_T * MAX_ACL_ENTRIES);
             try {
@@ -338,7 +343,12 @@
         checkAccess(file, false, true);
 
         // open file (will fail if file is a link and not following links)
-        int fd = file.openForAttributeAccess(followLinks);
+        int fd = -1;
+        try {
+            fd = file.openForAttributeAccess(followLinks);
+        } catch (UnixException x) {
+            x.rethrowAsIOException(file);
+        }
         try {
             // SECURITY: need to copy list as can change during processing
             acl = new ArrayList<AclEntry>(acl);
--- a/src/java.base/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,9 +71,11 @@
         if (System.getSecurityManager() != null)
             checkAccess(file.getPathForPermissionCheck(), true, false);
 
-        int fd = file.openForAttributeAccess(followLinks);
+        int fd = -1;
         try {
             try {
+                fd = file.openForAttributeAccess(followLinks);
+
                 // open extended attribute directory
                 int dfd = openat(fd, HERE, (O_RDONLY|O_XATTR), 0);
                 long dp;
@@ -112,9 +114,11 @@
         if (System.getSecurityManager() != null)
             checkAccess(file.getPathForPermissionCheck(), true, false);
 
-        int fd = file.openForAttributeAccess(followLinks);
+        int fd = -1;
         try {
             try {
+                fd = file.openForAttributeAccess(followLinks);
+
                 // open attribute file
                 int afd = openat(fd, nameAsBytes(file,name), (O_RDONLY|O_XATTR), 0);
                 try {
@@ -142,9 +146,11 @@
         if (System.getSecurityManager() != null)
             checkAccess(file.getPathForPermissionCheck(), true, false);
 
-        int fd = file.openForAttributeAccess(followLinks);
+        int fd = -1;
         try {
             try {
+                fd = file.openForAttributeAccess(followLinks);
+
                 // open attribute file
                 int afd = openat(fd, nameAsBytes(file,name), (O_RDONLY|O_XATTR), 0);
 
@@ -181,9 +187,11 @@
         if (System.getSecurityManager() != null)
             checkAccess(file.getPathForPermissionCheck(), false, true);
 
-        int fd = file.openForAttributeAccess(followLinks);
+        int fd = -1;
         try {
             try {
+                fd = file.openForAttributeAccess(followLinks);
+
                 // open/create attribute file
                 int afd = openat(fd, nameAsBytes(file,name),
                                  (O_CREAT|O_WRONLY|O_TRUNC|O_XATTR),
@@ -217,8 +225,10 @@
         if (System.getSecurityManager() != null)
             checkAccess(file.getPathForPermissionCheck(), false, true);
 
-        int fd = file.openForAttributeAccess(followLinks);
+        int fd = -1;
         try {
+            fd = file.openForAttributeAccess(followLinks);
+
             int dfd = openat(fd, HERE, (O_RDONLY|O_XATTR), 0);
             try {
                 unlinkat(dfd, nameAsBytes(file,name), 0);
--- a/src/java.base/unix/classes/sun/nio/fs/UnixException.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/unix/classes/sun/nio/fs/UnixException.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,6 +86,9 @@
             return new NoSuchFileException(file, other, null);
         if (errno() == UnixConstants.EEXIST)
             return new FileAlreadyExistsException(file, other, null);
+        if (errno() == UnixConstants.ELOOP)
+            return new FileSystemException(file, other, errorString()
+                + " or unable to access attributes of symbolic link");
 
         // fallback to the more general exception
         return new FileSystemException(file, other, errorString());
--- a/src/java.base/unix/classes/sun/nio/fs/UnixFileAttributeViews.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/unix/classes/sun/nio/fs/UnixFileAttributeViews.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,14 +71,30 @@
             // permission check
             file.checkWrite();
 
-            int fd = file.openForAttributeAccess(followLinks);
+            boolean haveFd = false;
+            boolean useFutimes = false;
+            int fd = -1;
+            try {
+                fd = file.openForAttributeAccess(followLinks);
+                if (fd != -1) {
+                    haveFd = true;
+                    useFutimes = futimesSupported();
+                }
+            } catch (UnixException x) {
+                if (x.errno() != UnixConstants.ENXIO) {
+                    x.rethrowAsIOException(file);
+                }
+            }
+
             try {
                 // assert followLinks || !UnixFileAttributes.get(fd).isSymbolicLink();
 
                 // if not changing both attributes then need existing attributes
                 if (lastModifiedTime == null || lastAccessTime == null) {
                     try {
-                        UnixFileAttributes attrs = UnixFileAttributes.get(fd);
+                        UnixFileAttributes attrs = haveFd ?
+                            UnixFileAttributes.get(fd) :
+                            UnixFileAttributes.get(file, followLinks);
                         if (lastModifiedTime == null)
                             lastModifiedTime = attrs.lastModifiedTime();
                         if (lastAccessTime == null)
@@ -94,7 +110,7 @@
 
                 boolean retry = false;
                 try {
-                    if (futimesSupported()) {
+                    if (useFutimes) {
                         futimes(fd, accessValue, modValue);
                     } else {
                         utimes(file, accessValue, modValue);
@@ -113,7 +129,7 @@
                     if (modValue < 0L) modValue = 0L;
                     if (accessValue < 0L) accessValue= 0L;
                     try {
-                        if (futimesSupported()) {
+                        if (useFutimes) {
                             futimes(fd, accessValue, modValue);
                         } else {
                             utimes(file, accessValue, modValue);
--- a/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -91,9 +91,14 @@
         throws UnixException;
 
     /**
-     * close(int filedes)
+     * close(int filedes). If fd is -1 this is a no-op.
      */
-    static native void close(int fd);
+    static void close(int fd) {
+        if (fd != -1) {
+            close0(fd);
+        }
+    }
+    private static native void close0(int fd);
 
     /**
      * FILE* fopen(const char *filename, const char* mode);
--- a/src/java.base/unix/classes/sun/nio/fs/UnixPath.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/unix/classes/sun/nio/fs/UnixPath.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -764,11 +764,12 @@
     // -- file operations --
 
     // package-private
-    int openForAttributeAccess(boolean followLinks) throws IOException {
+    int openForAttributeAccess(boolean followLinks) throws UnixException {
         int flags = O_RDONLY;
         if (!followLinks) {
             if (O_NOFOLLOW == 0)
-                throw new IOException("NOFOLLOW_LINKS is not supported on this platform");
+                throw new UnixException
+                    ("NOFOLLOW_LINKS is not supported on this platform");
             flags |= O_NOFOLLOW;
         }
         try {
@@ -778,12 +779,7 @@
             if (getFileSystem().isSolaris() && x.errno() == EINVAL)
                 x.setError(ELOOP);
 
-            if (x.errno() == ELOOP)
-                throw new FileSystemException(getPathForExceptionMessage(), null,
-                    x.getMessage() + " or unable to access attributes of symbolic link");
-
-            x.rethrowAsIOException(this);
-            return -1; // keep compile happy
+            throw x;
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/unix/conf/ppc64le/jvm.cfg	Fri Dec 18 10:00:55 2015 -0800
@@ -0,0 +1,34 @@
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+# List of JVMs that can be used as an option to java, javac, etc.
+# Order is important -- first in this list is the default JVM.
+# NOTE that this both this file and its format are UNSUPPORTED and
+# WILL GO AWAY in a future release.
+#
+# You may also select a JVM in an arbitrary location with the
+# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
+# and may not be available in a future release.
+#
+-server KNOWN
+-client IGNORE
--- a/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -408,7 +408,7 @@
 }
 
 JNIEXPORT void JNICALL
-Java_sun_nio_fs_UnixNativeDispatcher_close(JNIEnv* env, jclass this, jint fd) {
+Java_sun_nio_fs_UnixNativeDispatcher_close0(JNIEnv* env, jclass this, jint fd) {
     int err;
     /* TDB - need to decide if EIO and other errors should cause exception */
     RESTARTABLE(close((int)fd), err);
--- a/src/java.base/windows/native/libnet/Inet4AddressImpl.c	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.base/windows/native/libnet/Inet4AddressImpl.c	Fri Dec 18 10:00:55 2015 -0800
@@ -295,6 +295,7 @@
     char SendData[32] = {0};
     LPVOID ReplyBuffer = NULL;
     DWORD ReplySize = 0;
+    jboolean ret = JNI_FALSE;
 
     hIcmpFile = IcmpCreateFile();
     if (hIcmpFile == INVALID_HANDLE_VALUE) {
@@ -318,7 +319,11 @@
                                 NULL,       // PIP_OPTION_INFORMATION RequestOptions,
                                 ReplyBuffer,// LPVOID ReplyBuffer,
                                 ReplySize,  // DWORD ReplySize,
-                                timeout);   // DWORD Timeout
+                                // Note: IcmpSendEcho and its derivatives
+                                // seem to have an undocumented minimum
+                                // timeout of 1000ms below which the
+                                // api behaves inconsistently.
+                                (timeout < 1000) ? 1000 : timeout);   // DWORD Timeout
     } else {
         dwRetVal = IcmpSendEcho2Ex(hIcmpFile,  // HANDLE IcmpHandle,
                                    NULL,       // HANDLE Event
@@ -331,17 +336,19 @@
                                    NULL,       // PIP_OPTION_INFORMATION RequestOptions,
                                    ReplyBuffer,// LPVOID ReplyBuffer,
                                    ReplySize,  // DWORD ReplySize,
-                                   timeout);   // DWORD Timeout
+                                   (timeout < 1000) ? 1000 : timeout);   // DWORD Timeout
+    }
+
+    if (dwRetVal != 0) {
+        PICMP_ECHO_REPLY pEchoReply = (PICMP_ECHO_REPLY)ReplyBuffer;
+        if ((int)pEchoReply->RoundTripTime <= timeout)
+            ret = JNI_TRUE;
     }
 
     free(ReplyBuffer);
     IcmpCloseHandle(hIcmpFile);
 
-    if (dwRetVal != 0) {
-        return JNI_TRUE;
-    } else {
-        return JNI_FALSE;
-    }
+    return ret;
 }
 
 /*
--- a/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-atomic-private.hh	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-atomic-private.hh	Fri Dec 18 10:00:55 2015 -0800
@@ -119,6 +119,31 @@
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)       ( ({__machine_rw_barrier ();}), atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? true : false)
 
 
+#elif !defined(HB_NO_MT) && defined(_AIX) && defined(__IBMCPP__)
+
+#include <builtins.h>
+
+
+static inline int hb_fetch_and_add(volatile int* AI, unsigned int V) {
+  __lwsync();
+  int result = __fetch_and_add(AI, V);
+  __isync();
+  return result;
+}
+static inline int hb_compare_and_swaplp(volatile long* P, long O, long N) {
+  __sync();
+  int result = __compare_and_swaplp (P, &O, N);
+  __sync();
+  return result;
+}
+
+typedef int hb_atomic_int_impl_t;
+#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
+#define hb_atomic_int_impl_add(AI, V)           hb_fetch_and_add (&(AI), (V))
+
+#define hb_atomic_ptr_impl_get(P)               (__sync(), (void *) *(P))
+#define hb_atomic_ptr_impl_cmpexch(P,O,N)       hb_compare_and_swaplp ((long*)(P), (long)(O), (long)(N))
+
 #elif !defined(HB_NO_MT)
 
 #define HB_ATOMIC_INT_NIL 1 /* Warn that fallback implementation is in use. */
--- a/src/java.logging/share/classes/java/util/logging/LogRecord.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.logging/share/classes/java/util/logging/LogRecord.java	Fri Dec 18 10:00:55 2015 -0800
@@ -468,12 +468,11 @@
      * @implSpec This is equivalent to calling
      *      {@link #getInstant() getInstant().toEpochMilli()}.
      *
-     * @deprecated To get the full nanosecond resolution event time,
+     * @apiNote To get the full nanosecond resolution event time,
      *             use {@link #getInstant()}.
      *
      * @see #getInstant()
      */
-    @Deprecated
     public long getMillis() {
         return instant.toEpochMilli();
     }
@@ -487,8 +486,10 @@
      *      {@link #setInstant(java.time.Instant)
      *      setInstant(Instant.ofEpochMilli(millis))}.
      *
-     * @deprecated To set event time with nanosecond resolution,
-     *             use {@link #setInstant(java.time.Instant)}.
+     * @deprecated LogRecord maintains timestamps with nanosecond resolution,
+     *             using {@link Instant} values. For this reason,
+     *             {@link #setInstant(java.time.Instant) setInstant()}
+     *             should be used in preference to {@code setMillis()}.
      *
      * @see #setInstant(java.time.Instant)
      */
@@ -510,14 +511,23 @@
 
     /**
      * Sets the instant that the event occurred.
+     * <p>
+     * If the given {@code instant} represents a point on the time-line too
+     * far in the future or past to fit in a {@code long} milliseconds and
+     * nanoseconds adjustment, then an {@code ArithmeticException} will be
+     * thrown.
      *
      * @param instant the instant that the event occurred.
      *
      * @throws NullPointerException if {@code instant} is null.
+     * @throws ArithmeticException if numeric overflow would occur while
+     *         calling {@link Instant#toEpochMilli() instant.toEpochMilli()}.
+     *
      * @since 1.9
      */
     public void setInstant(Instant instant) {
-        this.instant = Objects.requireNonNull(instant);
+        instant.toEpochMilli();
+        this.instant = instant;
     }
 
     /**
--- a/src/java.management/share/classes/sun/management/Agent.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/java.management/share/classes/sun/management/Agent.java	Fri Dec 18 10:00:55 2015 -0800
@@ -37,9 +37,13 @@
 import java.net.MalformedURLException;
 import java.net.UnknownHostException;
 import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.MissingResourceException;
 import java.util.Properties;
 import java.util.ResourceBundle;
+import java.util.function.Function;
+import java.util.function.Predicate;
 
 import javax.management.remote.JMXConnectorServer;
 import javax.management.remote.JMXServiceURL;
@@ -60,6 +64,30 @@
      * Agent status collector strategy class
      */
     private static abstract class StatusCollector {
+        protected static final Map<String, String> DEFAULT_PROPS = new HashMap<>();
+
+        static {
+            DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.PORT,
+                              ConnectorBootstrap.DefaultValues.PORT);
+            DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.USE_LOCAL_ONLY,
+                              ConnectorBootstrap.DefaultValues.USE_LOCAL_ONLY);
+            DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.USE_AUTHENTICATION,
+                              ConnectorBootstrap.DefaultValues.USE_AUTHENTICATION);
+            DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.USE_SSL,
+                              ConnectorBootstrap.DefaultValues.USE_SSL);
+            DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.USE_REGISTRY_SSL,
+                              ConnectorBootstrap.DefaultValues.USE_REGISTRY_SSL);
+            DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.SSL_NEED_CLIENT_AUTH,
+                              ConnectorBootstrap.DefaultValues.SSL_NEED_CLIENT_AUTH);
+            DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.CONFIG_FILE_NAME,
+                              ConnectorBootstrap.DefaultValues.CONFIG_FILE_NAME);
+            DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.PASSWORD_FILE_NAME,
+                              ConnectorBootstrap.DefaultValues.PASSWORD_FILE_NAME);
+            DEFAULT_PROPS.put(ConnectorBootstrap.PropertyNames.ACCESS_FILE_NAME,
+                              ConnectorBootstrap.DefaultValues.ACCESS_FILE_NAME);
+
+        }
+
         final protected StringBuilder sb = new StringBuilder();
         final public String collect() {
             Properties agentProps = VMSupport.getAgentProperties();
@@ -93,28 +121,49 @@
         private void addConnection(boolean remote, JMXServiceURL u) {
             appendConnectionHeader(remote);
             addConnectionDetails(u);
-            if (remote) {
-                addConfigProperties();
-            }
+            addConfigProperties();
             appendConnectionFooter(remote);
         }
 
         private void addConfigProperties() {
             appendConfigPropsHeader();
-            boolean[] first = new boolean[] {true};
-            Properties props = configProps != null ?
-                                   configProps : getManagementProperties();
 
-            props.entrySet().stream().forEach((e) -> {
-                String key = (String)e.getKey();
-                if (key.startsWith("com.sun.management.")) {
-                    addConfigProp(key, e.getValue(), first[0]);
-                    first[0] = false;
+            Properties remoteProps = configProps != null ?
+                                        configProps : getManagementProperties();
+            Map<Object, Object> props = new HashMap<>(DEFAULT_PROPS);
+
+            if (remoteProps == null) {
+                // local connector only
+                String loc_only = System.getProperty(
+                    ConnectorBootstrap.PropertyNames.USE_LOCAL_ONLY
+                );
+
+                if (loc_only != null &&
+                    !ConnectorBootstrap.DefaultValues.USE_LOCAL_ONLY.equals(loc_only)) {
+                    props.put(
+                        ConnectorBootstrap.PropertyNames.USE_LOCAL_ONLY,
+                        loc_only
+                    );
                 }
-            });
+            } else {
+                props.putAll(remoteProps);
+            }
+
+            props.entrySet().stream()
+                .filter(preprocess(Map.Entry::getKey, StatusCollector::isManagementProp))
+                .forEach(this::addConfigProp);
+
             appendConfigPropsFooter();
         }
 
+        private static boolean isManagementProp(Object pName) {
+            return pName != null && pName.toString().startsWith("com.sun.management.");
+        }
+
+        private static <T, V> Predicate<T> preprocess(Function<T, V> f, Predicate<V> p) {
+            return (T t) -> p.test(f.apply(t));
+        }
+
         abstract protected void addAgentStatus(boolean enabled);
         abstract protected void appendConnectionsHeader();
         abstract protected void appendConnectionsFooter();
@@ -123,7 +172,7 @@
         abstract protected void appendConnectionFooter(boolean remote);
         abstract protected void appendConfigPropsHeader();
         abstract protected void appendConfigPropsFooter();
-        abstract protected void addConfigProp(String key, Object value, boolean first);
+        abstract protected void addConfigProp(Map.Entry<?, ?> prop);
     }
 
     /**
@@ -159,11 +208,14 @@
         }
 
         @Override
-        protected void addConfigProp(String key, Object value, boolean first) {
-            if (!first) {
-                sb.append('\n');
+        protected void addConfigProp(Map.Entry<?, ?> prop) {
+            sb.append("  ").append(prop.getKey()).append(" = ")
+              .append(prop.getValue());
+            Object defVal = DEFAULT_PROPS.get(prop.getKey());
+            if (defVal != null && defVal.equals(prop.getValue())) {
+                sb.append(" [default]");
             }
-            sb.append("  ").append(key).append(" = ").append(value);
+            sb.append("\n");
         }
 
         @Override
--- a/src/jdk.deploy.osx/macosx/classes/apple/applescript/AppleScriptEngine.java	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,389 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package apple.applescript;
-
-import java.io.*;
-import java.nio.file.Files;
-import java.util.*;
-import java.util.Map.Entry;
-
-import javax.script.*;
-
-/**
- * AppleScriptEngine implements JSR 223 for AppleScript on Mac OS X
- */
-public class AppleScriptEngine implements ScriptEngine {
-    private static native void initNative();
-
-    private static native long createContextFrom(final Object object);
-    private static native Object createObjectFrom(final long context);
-    private static native void disposeContext(final long context);
-
-    private static native long evalScript(final String script, long contextptr);
-    private static native long evalScriptFromURL(final String filename, long contextptr);
-
-    static {
-        System.loadLibrary("AppleScriptEngine");
-        initNative();
-        TRACE("<static-init>");
-    }
-
-    static void checkSecurity() {
-        final SecurityManager securityManager = System.getSecurityManager();
-        if (securityManager != null) securityManager.checkExec("/usr/bin/osascript");
-    }
-
-    static void TRACE(final String str) {
-//        System.out.println(AppleScriptEngine.class.getName() + "." + str);
-    }
-
-    /**
-     * Accessor for the ScriptEngine's long name variable
-     * @return the long name of the ScriptEngine
-     */
-    protected static String getEngine() {
-        TRACE("getEngine()");
-        return AppleScriptEngineFactory.ENGINE_NAME;
-    }
-
-    /**
-     * Accessor for the ScriptEngine's version
-     * @return the version of the ScriptEngine
-     */
-    protected static String getEngineVersion() {
-        TRACE("getEngineVersion()");
-        return AppleScriptEngineFactory.ENGINE_VERSION;
-    }
-
-    /**
-     * Accessor for the ScriptEngine's short name
-     * @return the short name of the ScriptEngine
-     */
-    protected static String getName() {
-        TRACE("getName()");
-        return AppleScriptEngineFactory.ENGINE_SHORT_NAME;
-    }
-
-    /**
-     * Accessor for the ScriptEngine's supported language name
-     * @return the language the ScriptEngine supports
-     */
-    protected static String getLanguage() {
-        TRACE("getLanguage()");
-        return AppleScriptEngineFactory.LANGUAGE;
-    }
-
-    /**
-     * The no argument constructor sets up the object with default members,
-     * a factory for the engine and a fresh context.
-     * @see com.apple.applescript.AppleScriptEngine#init()
-     */
-    public AppleScriptEngine() {
-        TRACE("<ctor>()");
-        // set our parent factory to be a new factory
-        factory = AppleScriptEngineFactory.getFactory();
-
-        // set up our noarg bindings
-        setContext(new SimpleScriptContext());
-        put(ARGV, "");
-
-        init();
-    }
-
-    /**
-     * All AppleScriptEngines share the same ScriptEngineFactory
-     */
-    private final ScriptEngineFactory factory;
-
-    /**
-     * The local context for the AppleScriptEngine
-     */
-    private ScriptContext context;
-
-    /**
-     * The constructor taking a factory as an argument sets the parent factory for
-     * this engine to be the passed factory, and sets up the engine with a fresh context
-     * @param factory
-     * @see com.apple.applescript.AppleScriptEngine#init()
-     */
-    public AppleScriptEngine(final ScriptEngineFactory factory) {
-        // inherit the factory passed to us
-        this.factory = factory;
-
-        // set up our noarg bindings
-        setContext(new SimpleScriptContext());
-        put(ARGV, "");
-
-        init();
-    }
-
-    /**
-     * The initializer populates the local context with some useful predefined variables:
-     * <ul><li><code>javax_script_language_version</code> - the version of AppleScript that the AppleScriptEngine supports.</li>
-     * <li><code>javax_script_language</code> - "AppleScript" -- the language supported by the AppleScriptEngine.</li>
-     * <li><code>javax_script_engine</code> - "AppleScriptEngine" -- the name of the ScriptEngine.</li>
-     * <li><code>javax_script_engine_version</code> - the version of the AppleScriptEngine</li>
-     * <li><code>javax_script_argv</code> - "" -- AppleScript does not take arguments from the command line</li>
-     * <li><code>javax_script_filename</code> - "" -- the currently executing filename</li>
-     * <li><code>javax_script_name</code> - "AppleScriptEngine" -- the short name of the AppleScriptEngine</li>
-     * <li><code>THREADING</code> - null -- the AppleScriptEngine does not support concurrency, you will have to implement thread-safeness yourself.</li></ul>
-     */
-    private void init() {
-        TRACE("init()");
-        // set up our context
-/* TODO -- name of current executable?  bad java documentation at:
- * http://docs.oracle.com/javase/6/docs/api/javax/script/ScriptEngine.html#FILENAME */
-        put(ScriptEngine.FILENAME, "");
-        put(ScriptEngine.ENGINE, getEngine());
-        put(ScriptEngine.ENGINE_VERSION, getEngineVersion());
-        put(ScriptEngine.NAME, getName());
-        put(ScriptEngine.LANGUAGE, getLanguage());
-        put(ScriptEngine.LANGUAGE_VERSION, getLanguageVersion());
-
-        // TODO -- for now, err on the side of caution and say that we are NOT thread-safe
-        put("THREADING", null);
-    }
-
-    /**
-     * Uses the AppleScriptEngine to get the local AppleScript version
-     * @return the version of AppleScript running on the system
-     */
-    protected String getLanguageVersion() {
-        TRACE("AppleScriptEngine.getLanguageVersion()");
-        try {
-            final Object result = eval("get the version of AppleScript");
-            if (result instanceof String) return (String)result;
-        } catch (final ScriptException e) { e.printStackTrace(); }
-        return "unknown";
-    }
-
-    /**
-     * Implementation required by ScriptEngine parent<br />
-     * Returns the factory parent of this AppleScriptEngine
-     */
-    public ScriptEngineFactory getFactory() {
-        return factory;
-    }
-
-    /**
-     * Implementation required by ScriptEngine parent<br />
-     * Return the engine's context
-     * @return this ScriptEngine's context
-     */
-    public ScriptContext getContext() {
-        return context;
-    }
-
-    /**
-     * Implementation required by ScriptEngine parent<br />
-     * Set a new context for the engine
-     * @param context the new context to install in the engine
-     */
-    public void setContext(final ScriptContext context) {
-        this.context = context;
-    }
-
-    /**
-     * Implementation required by ScriptEngine parent<br />
-     * Create and return a new set of simple bindings.
-     * @return a new and empty set of bindings
-     */
-    public Bindings createBindings() {
-        return new SimpleBindings();
-    }
-
-    /**
-     * Implementation required by ScriptEngine parent<br />
-     * Return the engines bindings for the context indicated by the argument.
-     * @param scope contextual scope to return.
-     * @return the bindings in the engine for the scope indicated by the parameter
-     */
-    public Bindings getBindings(final int scope) {
-        return context.getBindings(scope);
-    }
-
-    /**
-     * Implementation required by ScriptEngine parent<br />
-     * Sets the bindings for the indicated scope
-     * @param bindings a set of bindings to assign to the engine
-     * @param scope the scope that the passed bindings should be assigned to
-     */
-    public void setBindings(final Bindings bindings, final int scope) {
-        context.setBindings(bindings, scope);
-    }
-
-    /**
-     * Implementation required by ScriptEngine parent<br />
-     * Insert a key and value into the engine's bindings (scope: engine)
-     * @param key the key of the pair
-     * @param value the value of the pair
-     */
-    public void put(final String key, final Object value) {
-        getBindings(ScriptContext.ENGINE_SCOPE).put(key, value);
-    }
-
-    /**
-     * Implementation required by ScriptEngine parent<br />
-     * Get a value from the engine's bindings using a key (scope: engine)
-     * @param key the key of the pair
-     * @return the value of the pair
-     */
-    public Object get(final String key) {
-        return getBindings(ScriptContext.ENGINE_SCOPE).get(key);
-    }
-
-    /**
-     * Implementation required by ScriptEngine parent<br />
-     * Passes the Reader argument, as well as the engine's context to a lower evaluation function.<br />
-     * Prefers FileReader or BufferedReader wrapping FileReader as argument.
-     * @param reader a Reader to AppleScript source or compiled AppleScript
-     * @return an Object corresponding to the return value of the script
-     * @see com.apple.applescript.AppleScriptEngine#eval(Reader, ScriptContext)
-     */
-    public Object eval(final Reader reader) throws ScriptException {
-        return eval(reader, getContext());
-    }
-
-    /**
-     * Implementation required by ScriptEngine parent<br />
-     * Uses the passed bindings as the context for executing the passed script.
-     * @param reader a stream to AppleScript source or compiled AppleScript
-     * @param bindings a Bindings object representing the contexts to execute inside
-     * @return the return value of the script
-     * @see com.apple.applescript.AppleScriptEngine#eval(Reader, ScriptContext)
-     */
-    public Object eval(final Reader reader, final Bindings bindings) throws ScriptException {
-        final Bindings tmp = getContext().getBindings(ScriptContext.ENGINE_SCOPE);
-        getContext().setBindings(bindings, ScriptContext.ENGINE_SCOPE);
-        final Object retval = eval(reader);
-        getContext().setBindings(tmp, ScriptContext.ENGINE_SCOPE);
-        return retval;
-    }
-
-    /**
-     * Implementation required by ScriptEngine parent<br />
-     * This function can execute either AppleScript source or compiled AppleScript and functions by writing the
-     * contents of the Reader to a temporary file and then executing it with the engine's context.
-     * @param reader
-     * @param scriptContext
-     * @return an Object corresponding to the return value of the script
-     */
-    public Object eval(final Reader reader, final ScriptContext context) throws ScriptException {
-        checkSecurity();
-
-        // write our passed reader to a temporary file
-        File tmpfile;
-        FileWriter tmpwrite;
-        try {
-            tmpfile = Files.createTempFile("AppleScriptEngine.", ".scpt").toFile();
-            tmpwrite = new FileWriter(tmpfile);
-
-            // read in our input and write directly to tmpfile
-            /* TODO -- this may or may not be avoidable for certain Readers,
-             * if a filename can be grabbed, it would be faster to get that and
-             * use the underlying file than writing a temp file.
-             */
-            int data;
-            while ((data = reader.read()) != -1) {
-                tmpwrite.write(data);
-            }
-            tmpwrite.close();
-
-            // set up our context business
-            final long contextptr = scriptContextToNSDictionary(context);
-            try {
-                final long retCtx = evalScriptFromURL("file://" + tmpfile.getCanonicalPath(), contextptr);
-                Object retVal = (retCtx == 0) ? null : createObjectFrom(retCtx);
-                disposeContext(retCtx);
-                return retVal;
-            } finally {
-                disposeContext(contextptr);
-                tmpfile.delete();
-            }
-        } catch (final IOException e) {
-            throw new ScriptException(e);
-        }
-    }
-
-    /**
-     * Implementation required by ScriptEngine parent<br />
-     * Evaluate an AppleScript script passed as a source string. Using the engine's built in context.
-     * @param script the string to execute.
-     * @return an Object representing the return value of the script
-     * @see com.apple.applescript.AppleScriptEngine#eval(String, ScriptContext)
-     */
-    public Object eval(final String script) throws ScriptException {
-        return eval(script, getContext());
-    }
-
-    /**
-     * Implementation required by ScriptEngine parent<br />
-     * Evaluate an AppleScript script passed as a source string with a custom ScriptContext.
-     * @param script the AppleScript source to compile and execute.
-     * @param scriptContext the context to execute the script under
-     * @see com.apple.applescript.AppleScriptEngine#eval(String, ScriptContext)
-     */
-    public Object eval(final String script, final Bindings bindings) throws ScriptException {
-        final Bindings tmp = getContext().getBindings(ScriptContext.ENGINE_SCOPE);
-        getContext().setBindings(bindings, ScriptContext.ENGINE_SCOPE);
-
-        final Object retval = eval(script);
-        getContext().setBindings(tmp, ScriptContext.ENGINE_SCOPE);
-
-        return retval;
-    }
-
-    /**
-     * Implementation required by ScriptEngine parent
-     * @param script
-     * @param scriptContext
-     */
-    public Object eval(final String script, final ScriptContext context) throws ScriptException {
-        checkSecurity();
-        final long ctxPtr = scriptContextToNSDictionary(context);
-        try {
-            final long retCtx = evalScript(script, ctxPtr);
-            Object retVal = (retCtx == 0) ? null : createObjectFrom(retCtx);
-            disposeContext(retCtx);
-            return retVal;
-        } finally {
-            disposeContext(ctxPtr);
-        }
-    }
-
-    /**
-     * Converts a ScriptContext into an NSDictionary
-     * @param context ScriptContext for the engine
-     * @return a pointer to an NSDictionary
-     */
-    private long scriptContextToNSDictionary(final ScriptContext context) throws ScriptException {
-        final Map<String, Object> contextAsMap = new HashMap<String, Object>();
-        for (final Entry<String, Object> e : context.getBindings(ScriptContext.ENGINE_SCOPE).entrySet()) {
-            contextAsMap.put(e.getKey().replaceAll("\\.", "_"), e.getValue());
-        }
-        return createContextFrom(contextAsMap);
-    }
-}
--- a/src/jdk.deploy.osx/macosx/classes/apple/applescript/AppleScriptEngineFactory.java	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package apple.applescript;
-
-import java.security.*;
-import java.util.*;
-import javax.script.*;
-
-public class AppleScriptEngineFactory implements ScriptEngineFactory {
-    private static volatile boolean initialized = false;
-
-    private static native void initNative();
-
-    static void TRACE(final String str) {
-//        System.out.println(AppleScriptEngineFactory.class.getName() + "." + str);
-    }
-
-    /**
-     * The name of this ScriptEngine
-     */
-    static final String ENGINE_NAME = "AppleScriptEngine";
-
-    /**
-     * The version of this ScriptEngine
-     */
-    static final String ENGINE_VERSION = "1.1";
-
-    /**
-     * The name of this ScriptEngine (yes, again)
-     */
-    static final String ENGINE_SHORT_NAME = ENGINE_NAME;
-
-    /**
-     * The name of the language supported by this ScriptEngine
-     */
-    static final String LANGUAGE = "AppleScript";
-
-    static ScriptEngineFactory getFactory() {
-        TRACE("getFactory()");
-        return new AppleScriptEngineFactory();
-    }
-
-    /**
-     * Initialize a new AppleScriptEngineFactory, replete with a member AppleScriptEngine
-     */
-    public AppleScriptEngineFactory() {
-        TRACE("<ctor>()");
-    }
-
-    /**
-     * Returns the full name of the ScriptEngine.
-     *
-     * @return full name of the ScriptEngine
-     */
-    @Override
-    public String getEngineName() {
-        TRACE("getEngineName()");
-        return ENGINE_NAME;
-    }
-
-    /**
-     * Returns the version of the ScriptEngine.
-     *
-     * @return version of the ScriptEngine
-     */
-    @Override
-    public String getEngineVersion() {
-        TRACE("getEngineVersion()");
-        return ENGINE_VERSION;
-    }
-
-    /**
-     * Returns the name of the scripting language supported by this ScriptEngine.
-     *
-     * @return name of the language supported by the ScriptEngine(Factory)
-     */
-    @Override
-    public String getLanguageName() {
-        TRACE("getLanguageName()");
-        return LANGUAGE;
-    }
-
-    /**
-     * Returns the version of the scripting language supported by this ScriptEngine(Factory).
-     *
-     * @return language version supported by the ScriptEngine(Factory)
-     */
-    @Override
-    public String getLanguageVersion() {
-        TRACE("getLanguageVersion()");
-        return AccessController.doPrivileged(new PrivilegedAction<String>() {
-            public String run() {
-                final AppleScriptEngine engine = getScriptEngine();
-                return engine.getLanguageVersion();
-            }
-        });
-    }
-
-    /**
-     * Returns an immutable list of filename extensions, which generally identify
-     * scripts written in the language supported by this ScriptEngine.
-     *
-     * @return ArrayList of file extensions AppleScript associates with
-     */
-    @Override
-    public List<String> getExtensions() {
-        TRACE("getExtensions()");
-        return Arrays.asList("scpt", "applescript", "app");
-    }
-
-    /**
-     * Returns an immutable list of mimetypes, associated with scripts
-     * that can be executed by the engine.
-     *
-     * @return ArrayList of mimetypes that AppleScript associates with
-     */
-    @Override
-    public List<String> getMimeTypes() {
-        TRACE("getMimeTypes()");
-        return Arrays.asList("application/x-applescript", "text/plain", "text/applescript");
-    }
-
-    /**
-     * Returns an immutable list of short names for the ScriptEngine,
-     * which may be used to identify the ScriptEngine by the ScriptEngineManager.
-     *
-     * @return
-     */
-    @Override
-    public List<String> getNames() {
-        TRACE("getNames()");
-        return Arrays.asList("AppleScriptEngine", "AppleScript", "OSA");
-    }
-
-    /**
-     * Returns a String which can be used to invoke a method of a Java
-     * object using the syntax of the supported scripting language.
-     *
-     * @param obj
-     *            unused -- AppleScript does not support objects
-     * @param m
-     *            function name
-     * @param args
-     *            arguments to the function
-     * @return the AppleScript string calling the method
-     */
-    @Override
-    public String getMethodCallSyntax(final String obj, final String fname, final String ... args) {
-//        StringBuilder builder = new StringBuilder();
-//        builder.append("my " + fname + "(");
-//        // TODO -- do
-//        builder.append(")\n");
-//        return builder.toString();
-
-        return null;
-    }
-
-    /**
-     * Returns a String that can be used as a statement to display the specified String using the syntax of the supported scripting language.
-     *
-     * @param toDisplay
-     * @return
-     */
-    @Override
-    public String getOutputStatement(final String toDisplay) {
-        // TODO -- this might even be good enough? XD
-        return getMethodCallSyntax(null, "print", toDisplay);
-    }
-
-    /**
-     * Returns the value of an attribute whose meaning may be implementation-specific.
-     *
-     * @param key
-     *            the key to look up
-     * @return the static preseeded value for the key in the ScriptEngine, if it exists, otherwise <code>null</code>
-     */
-    @Override
-    public Object getParameter(final String key) {
-        final AppleScriptEngine engine = getScriptEngine();
-        if (!engine.getBindings(ScriptContext.ENGINE_SCOPE).containsKey(key)) return null;
-        return engine.getBindings(ScriptContext.ENGINE_SCOPE).get(key);
-    }
-
-    /**
-     * Returns A valid scripting language executable program with given statements.
-     *
-     * @param statements
-     * @return
-     */
-    @Override
-    public String getProgram(final String ... statements) {
-        final StringBuilder program = new StringBuilder();
-        for (final String statement : statements) {
-            program.append(statement + "\n");
-        }
-        return program.toString();
-    }
-
-    /**
-     * Returns an instance of the ScriptEngine associated with this ScriptEngineFactory.
-     *
-     * @return new AppleScriptEngine with this factory as it's parent
-     */
-    @Override
-    public AppleScriptEngine getScriptEngine() {
-        AppleScriptEngine.checkSecurity();
-        ensureInitialized();
-
-        return new AppleScriptEngine(this);
-    }
-
-    private static synchronized void ensureInitialized() {
-        if (!initialized) {
-            initialized = true;
-
-            java.awt.Toolkit.getDefaultToolkit();
-            System.loadLibrary("AppleScriptEngine");
-            initNative();
-        }
-    }
-}
--- a/src/jdk.deploy.osx/macosx/native/libapplescriptengine/AS_NS_ConversionUtils.h	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-#import <Foundation/Foundation.h>
-
-
-// A 'collection' (responds to -objectEnumerator) is translated to an AS list.
-// For any other object obj, this returns [[obj description] aeDescriptorValue], mainly
-// intended for debugging purposes.
-@interface NSObject (JavaAppleScriptEngineAdditions)
-- (NSAppleEventDescriptor *) aeDescriptorValue;
-@end
-
-@interface NSAppleEventDescriptor (JavaAppleScriptEngineAdditions)
-- (id) objCObjectValue;
-@end
--- a/src/jdk.deploy.osx/macosx/native/libapplescriptengine/AS_NS_ConversionUtils.m	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,793 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-//
-//    Most of this is adapted from Ken Ferry's KFAppleScript Additions, contributed with permission
-//    http://homepage.mac.com/kenferry/software.html
-//
-
-#import "AS_NS_ConversionUtils.h"
-
-#import <Cocoa/Cocoa.h>
-#import <Carbon/Carbon.h>
-
-
-@interface NSAppleEventDescriptor (JavaAppleScriptEngineAdditionsPrivate)
-
-// just returns self.  This means that you can pass custom descriptors
-// to -[NSAppleScript executeHandler:error:withParameters:].
-- (NSAppleEventDescriptor *)aeDescriptorValue;
-
-// working with primitive descriptor types
-+ (id)descriptorWithInt16:(SInt16)val;
-- (SInt16)int16Value;
-+ (id)descriptorWithUnsignedInt32:(UInt32)val;
-- (UInt32)unsignedInt32Value;
-+ (id)descriptorWithFloat32:(Float32)val;
-- (Float32)float32Value;
-+ (id)descriptorWithFloat64:(Float64)val;
-- (Float64)float64Value;
-+ (id)descriptorWithLongDateTime:(LongDateTime)val;
-- (LongDateTime)longDateTimeValue;
-
-
-// These are the methods for converting AS objects to objective-C objects.
-// -[NSAppleEventDescriptor objCObjectValue] is the general method for converting
-// AS objects to ObjC objects, and is called by -[NSAppleScript executeHandler:error:withParameters:].
-// It does no work itself.  It finds a handler based on the type of the descriptor and lets that
-// handler object do the work.  If there is no handler type registered for a the type of a descriptor,
-// the raw descriptor is returned.
-//
-// You can designate a handlers for descriptor types with
-// +[NSAppleEventDescriptor registerConversionHandler:selector:forDescriptorTypes:].  Please note
-// that this method does _not_ retain the handler object (for now anyway).  The selector should
-// take a single argument, a descriptor to translate, and should return an object.  An example such
-// selector is @selector(dictionaryWithAEDesc:), for which the handler object would be [NSDictionary class].
-//
-// A number of handlers are designated by default.  The methods and objects can be easily inferred (or check
-// the implementation), but the automatically handled types are
-//    typeUnicodeText,
-//    typeText,
-//    typeUTF8Text,
-//    typeCString,
-//    typeChar,
-//    typeBoolean,
-//    typeTrue,
-//    typeFalse,
-//    typeSInt16,
-//    typeSInt32,
-//    typeUInt32,
-//    typeSInt64,
-//    typeIEEE32BitFloatingPoint,
-//    typeIEEE64BitFloatingPoint,
-//    type128BitFloatingPoint,
-//    typeAEList,
-//    typeAERecord,
-//    typeLongDateTime,
-//    typeNull.
-+ (void)registerConversionHandler:(id)anObject selector:(SEL)aSelector forDescriptorTypes:(DescType)firstType, ...;
-+ (void) jaseSetUpHandlerDict;
-@end
-
-// wrap the NSAppleEventDescriptor string methods
-@interface NSString (JavaAppleScriptEngineAdditions)
-- (NSAppleEventDescriptor *)aeDescriptorValue;
-+ (NSString *)stringWithAEDesc:(NSAppleEventDescriptor *)desc;
-@end
-
-// wrap the NSAppleEventDescriptor longDateTime methods
-@interface NSDate (JavaAppleScriptEngineAdditions)
-- (NSAppleEventDescriptor *)aeDescriptorValue;
-+ (NSDate *)dateWithAEDesc:(NSAppleEventDescriptor *)desc;
-@end
-
-// these are fairly complicated methods, due to having to try to match up the various
-// AS number types (see NSAppleEventDescriptor for the primitive number methods)
-// with NSNumber variants.  For complete behavior it's best to look at the implementation.
-// Some notes:
-//    NSNumbers created with numberWithBool should be correctly translated to AS booleans and vice versa.
-//    NSNumbers created with large integer types may have to be translated to AS doubles,
-//      so be careful if checking equality (you may have to check equality within epsilon).
-//    Since NSNumbers can't remember if they were created with an unsigned value,
-//      [[NSNumber numberWithUnsignedChar:255] aeDescriptorValue] is going to get you an AS integer
-//      with value -1.  If you really need a descriptor with an unsigned value, you'll need to do it
-//      manually using the primitive methods on NSAppleEventDescriptor.  The resulting descriptor
-//      can still be passed to AS with -[NSAppleScript executeHandler:error:withParameters:].
-@interface NSNumber (JavaAppleScriptEngineAdditions)
-- (NSAppleEventDescriptor *)aeDescriptorValue;
-+ (id)numberWithAEDesc:(NSAppleEventDescriptor *)desc;
-@end
-
-// Here we're following the behavior described in the CocoaScripting release note.
-//
-// NSPoint -> list of two numbers: {x, y}
-// NSRange -> list of two numbers: {begin offset, end offset}
-// NSRect  -> list of four numbers: {left, bottom, right, top}
-// NSSize  -> list of two numbers: {width, height}
-@interface NSValue (JavaAppleScriptEngineAdditions)
-- (NSAppleEventDescriptor *)aeDescriptorValue;
-@end
-
-// No need for ObjC -> AS conversion here, we fall through to NSObject as a collection.
-// For AS -> ObjC conversion, we build an array using the primitive list methods on
-// NSAppleEventDescriptor.
-@interface NSArray (JavaAppleScriptEngineAdditions)
-+ (NSArray *)arrayWithAEDesc:(NSAppleEventDescriptor *)desc;
-@end
-
-
-// Please see the CocoaScripting release note for behavior.  It's kind of complicated.
-//
-// methods wrap the primitive record methods on NSAppleEventDescriptor.
-@interface NSDictionary (JavaAppleScriptEngineAdditions)
-- (NSAppleEventDescriptor *)aeDescriptorValue;
-+ (NSDictionary *)dictionaryWithAEDesc:(NSAppleEventDescriptor *)desc;
-@end
-
-// be aware that a null descriptor does not correspond to the 'null' keyword in
-// AppleScript - it's more like nothing at all.  For example, the return
-// from an empty handler.
-@interface NSNull (JavaAppleScriptEngineAdditions)
-- (NSAppleEventDescriptor *)aeDescriptorValue;
-+ (NSNull *)nullWithAEDesc:(NSAppleEventDescriptor *)desc;
-@end
-
-
-@interface NSNumber (JavaAppleScriptEngineAdditionsPrivate)
-+ (id) jaseNumberWithSignedIntP:(void *)int_p byteCount:(int)bytes;
-+ (id) jaseNumberWithUnsignedIntP:(void *)int_p byteCount:(int)bytes;
-+ (id) jaseNumberWithFloatP:(void *)float_p byteCount:(int)bytes;
-@end
-
-
-@implementation NSObject (JavaAppleScriptEngineAdditions)
-
-- (NSAppleEventDescriptor *)aeDescriptorValue {
-    // collections go to lists
-    if (![self respondsToSelector:@selector(objectEnumerator)]) {
-        // encode the description as a fallback - this is pretty useless, only helpful for debugging
-        return [[self description] aeDescriptorValue];
-    }
-
-    NSAppleEventDescriptor *resultDesc = [NSAppleEventDescriptor listDescriptor];
-    NSEnumerator *objectEnumerator = [(id)self objectEnumerator];
-
-    unsigned int i = 1; // apple event descriptors are 1-indexed
-    id currentObject;
-    while((currentObject = [objectEnumerator nextObject]) != nil) {
-        [resultDesc insertDescriptor:[currentObject aeDescriptorValue] atIndex:i++];
-    }
-
-    return resultDesc;
-}
-
-@end
-
-
-@implementation NSArray (JavaAppleScriptEngineAdditions)
-
-// don't need to override aeDescriptorValue, the NSObject will treat the array as a collection
-+ (NSArray *)arrayWithAEDesc:(NSAppleEventDescriptor *)desc {
-    NSAppleEventDescriptor *listDesc = [desc coerceToDescriptorType:typeAEList];
-    NSMutableArray *resultArray = [NSMutableArray array];
-
-    // apple event descriptors are 1-indexed
-    unsigned int listCount = [listDesc numberOfItems];
-    unsigned int i;
-    for (i = 1; i <= listCount; i++) {
-        [resultArray addObject:[[listDesc descriptorAtIndex:i] objCObjectValue]];
-    }
-
-    return resultArray;
-}
-
-@end
-
-
-@implementation NSDictionary (JavaAppleScriptEngineAdditions)
-
-- (NSAppleEventDescriptor *)aeDescriptorValue {
-    NSAppleEventDescriptor *resultDesc = [NSAppleEventDescriptor recordDescriptor];
-    NSMutableArray *userFields = [NSMutableArray array];
-    NSArray *keys = [self allKeys];
-
-    unsigned int keyCount = [keys count];
-    unsigned int i;
-    for (i = 0; i < keyCount; i++) {
-        id key = [keys objectAtIndex:i];
-
-        if ([key isKindOfClass:[NSNumber class]]) {
-            [resultDesc setDescriptor:[[self objectForKey:key] aeDescriptorValue] forKeyword:[(NSNumber *)key intValue]];
-        } else if ([key isKindOfClass:[NSString class]]) {
-            [userFields addObject:key];
-            [userFields addObject:[self objectForKey:key]];
-        }
-    }
-
-    if ([userFields count] > 0) {
-        [resultDesc setDescriptor:[userFields aeDescriptorValue] forKeyword:keyASUserRecordFields];
-    }
-
-    return resultDesc;
-}
-
-+ (NSDictionary *)dictionaryWithAEDesc:(NSAppleEventDescriptor *)desc {
-    NSAppleEventDescriptor *recDescriptor = [desc coerceToDescriptorType:typeAERecord];
-    NSMutableDictionary *resultDict = [NSMutableDictionary dictionary];
-
-    // NSAppleEventDescriptor uses 1 indexing
-    unsigned int recordCount = [recDescriptor numberOfItems];
-    unsigned int recordIndex;
-    for (recordIndex = 1; recordIndex <= recordCount; recordIndex++) {
-        AEKeyword keyword = [recDescriptor keywordForDescriptorAtIndex:recordIndex];
-
-        if(keyword == keyASUserRecordFields) {
-            NSAppleEventDescriptor *listDescriptor = [recDescriptor descriptorAtIndex:recordIndex];
-
-            // NSAppleEventDescriptor uses 1 indexing
-            unsigned int listCount = [listDescriptor numberOfItems];
-            unsigned int listIndex;
-            for (listIndex = 1; listIndex <= listCount; listIndex += 2) {
-                id keyObj = [[listDescriptor descriptorAtIndex:listIndex] objCObjectValue];
-                id valObj = [[listDescriptor descriptorAtIndex:listIndex+1] objCObjectValue];
-
-                [resultDict setObject:valObj forKey:keyObj];
-            }
-        } else {
-            id keyObj = [NSNumber numberWithInt:keyword];
-            id valObj = [[recDescriptor descriptorAtIndex:recordIndex] objCObjectValue];
-
-            [resultDict setObject:valObj forKey:keyObj];
-        }
-    }
-
-    return resultDict;
-}
-
-@end
-
-
-@implementation NSString (JavaAppleScriptEngineAdditions)
-
-- (NSAppleEventDescriptor *)aeDescriptorValue {
-    return [NSAppleEventDescriptor descriptorWithString:self];
-}
-
-+ (NSString *)stringWithAEDesc:(NSAppleEventDescriptor *)desc {
-    return [desc stringValue];
-}
-
-+ (NSString *)versionWithAEDesc:(NSAppleEventDescriptor *)desc {
-    const AEDesc *aeDesc = [desc aeDesc];
-    VersRec v;
-    AEGetDescData(aeDesc, &v, sizeof(v));
-    return [[[NSString alloc] initWithBytes:&v.shortVersion[1] length:StrLength(v.shortVersion) encoding:NSUTF8StringEncoding] autorelease];
-}
-
-@end
-
-
-@implementation NSNull (JavaAppleScriptEngineAdditions)
-
-- (NSAppleEventDescriptor *)aeDescriptorValue {
-    return [NSAppleEventDescriptor nullDescriptor];
-}
-
-+ (NSNull *)nullWithAEDesc:(NSAppleEventDescriptor *)desc {
-    return [NSNull null];
-}
-
-@end
-
-
-@implementation NSDate (JavaAppleScriptEngineAdditions)
-
-- (NSAppleEventDescriptor *)aeDescriptorValue {
-    LongDateTime ldt;
-    UCConvertCFAbsoluteTimeToLongDateTime(CFDateGetAbsoluteTime((CFDateRef)self), &ldt);
-    return [NSAppleEventDescriptor descriptorWithLongDateTime:ldt];
-}
-
-+ (NSDate *)dateWithAEDesc:(NSAppleEventDescriptor *)desc {
-    CFAbsoluteTime absTime;
-    UCConvertLongDateTimeToCFAbsoluteTime([desc longDateTimeValue], &absTime);
-    NSDate *resultDate = (NSDate *)CFDateCreate(NULL, absTime);
-    return [resultDate autorelease];
-}
-
-@end
-
-
-
-static inline int areEqualEncodings(const char *enc1, const char *enc2) {
-    return (strcmp(enc1, enc2) == 0);
-}
-
-@implementation NSNumber (JavaAppleScriptEngineAdditions)
-
--(id)jaseDescriptorValueWithFloatP:(void *)float_p byteCount:(int)bytes {
-    float floatVal;
-    if (bytes < sizeof(Float32)) {
-        floatVal = [self floatValue];
-        float_p = &floatVal;
-        bytes = sizeof(floatVal);
-    }
-
-    double doubleVal;
-    if (bytes > sizeof(Float64)) {
-        doubleVal = [self doubleValue];
-        float_p = &doubleVal;
-        bytes = sizeof(doubleVal);
-    }
-
-    if (bytes == sizeof(Float32)) {
-        return [NSAppleEventDescriptor descriptorWithFloat32:*(Float32 *)float_p];
-    }
-
-    if (bytes == sizeof(Float64)) {
-        return [NSAppleEventDescriptor descriptorWithFloat64:*(Float64 *)float_p];
-    }
-
-    [NSException raise:NSInvalidArgumentException
-                format:@"Cannot create an NSAppleEventDescriptor for float with %d bytes of data.",  bytes];
-
-    return nil;
-}
-
--(id)jaseDescriptorValueWithSignedIntP:(void *)int_p byteCount:(int)bytes {
-    int intVal;
-
-    if (bytes < sizeof(SInt16)) {
-        intVal = [self intValue];
-        int_p = &intVal;
-        bytes = sizeof(intVal);
-    }
-
-    if (bytes == sizeof(SInt16)) {
-        return [NSAppleEventDescriptor descriptorWithInt16:*(SInt16 *)int_p];
-    }
-
-    if (bytes == sizeof(SInt32)) {
-        return [NSAppleEventDescriptor descriptorWithInt32:*(SInt32 *)int_p];
-    }
-
-    double val = [self doubleValue];
-    return [self jaseDescriptorValueWithFloatP:&val byteCount:sizeof(val)];
-}
-
--(id)jaseDescriptorValueWithUnsignedIntP:(void *)int_p byteCount:(int)bytes {
-    unsigned int uIntVal;
-
-    if (bytes < sizeof(UInt32)) {
-        uIntVal = [self unsignedIntValue];
-        int_p = &uIntVal;
-        bytes = sizeof(uIntVal);
-    }
-
-    if (bytes == sizeof(UInt32)) {
-        return [NSAppleEventDescriptor descriptorWithUnsignedInt32:*(UInt32 *)int_p];
-    }
-
-    double val = (double)[self unsignedLongLongValue];
-    return [self jaseDescriptorValueWithFloatP:&val byteCount:sizeof(val)];
-}
-
-- (NSAppleEventDescriptor *)aeDescriptorValue {
-    // NSNumber is unfortunately complicated, because the applescript
-    // type we should use depends on the c type that our NSNumber corresponds to
-
-    const char *type = [self objCType];
-
-    // convert
-    if (areEqualEncodings(type, @encode(BOOL))) {
-        return [NSAppleEventDescriptor descriptorWithBoolean:[self boolValue]];
-    }
-
-    if (areEqualEncodings(type, @encode(char))) {
-        char val = [self charValue];
-        return [self jaseDescriptorValueWithSignedIntP:&val byteCount:sizeof(val)];
-    }
-
-    if (areEqualEncodings(type, @encode(short))) {
-        short val = [self shortValue];
-        return [self jaseDescriptorValueWithSignedIntP:&val byteCount:sizeof(val)];
-    }
-
-    if (areEqualEncodings(type, @encode(int))) {
-        int val = [self intValue];
-        return [self jaseDescriptorValueWithSignedIntP:&val byteCount:sizeof(val)];
-    }
-
-    if (areEqualEncodings(type, @encode(long))) {
-        long val = [self longValue];
-        return [self jaseDescriptorValueWithSignedIntP:&val byteCount:sizeof(val)];
-    }
-
-    if (areEqualEncodings(type, @encode(long long))) {
-        long long val = [self longLongValue];
-        return [self jaseDescriptorValueWithSignedIntP:&val byteCount:sizeof(val)];
-    }
-
-    if (areEqualEncodings(type, @encode(unsigned char))) {
-        unsigned char val = [self unsignedCharValue];
-        return [self jaseDescriptorValueWithUnsignedIntP:&val byteCount:sizeof(val)];
-    }
-
-    if (areEqualEncodings(type, @encode(unsigned short))) {
-        unsigned short val = [self unsignedShortValue];
-        return [self jaseDescriptorValueWithUnsignedIntP:&val byteCount:sizeof(val)];
-    }
-
-    if (areEqualEncodings(type, @encode(unsigned int))) {
-        unsigned int val = [self unsignedIntValue];
-        return [self jaseDescriptorValueWithUnsignedIntP:&val byteCount:sizeof(val)];
-    }
-
-    if (areEqualEncodings(type, @encode(unsigned long))) {
-        unsigned long val = [self unsignedLongValue];
-        return [self jaseDescriptorValueWithUnsignedIntP:&val byteCount:sizeof(val)];
-    }
-
-    if (areEqualEncodings(type, @encode(unsigned long long))) {
-        unsigned long long val = [self unsignedLongLongValue];
-        return [self jaseDescriptorValueWithUnsignedIntP:&val byteCount:sizeof(val)];
-    }
-
-    if (areEqualEncodings(type, @encode(float))) {
-        float val = [self floatValue];
-        return [self jaseDescriptorValueWithFloatP:&val byteCount:sizeof(val)];
-    }
-
-    if (areEqualEncodings(type, @encode(double))) {
-        double val = [self doubleValue];
-        return [self jaseDescriptorValueWithFloatP:&val byteCount:sizeof(val)];
-    }
-
-    [NSException raise:@"jaseUnsupportedAEDescriptorConversion"
-                format:@"JavaAppleScriptEngineAdditions: conversion of an NSNumber with objCType '%s' to an aeDescriptor is not supported.", type];
-
-    return nil;
-}
-
-+ (id)numberWithAEDesc:(NSAppleEventDescriptor *)desc {
-    DescType type = [desc descriptorType];
-
-    if ((type == typeTrue) || (type == typeFalse) || (type == typeBoolean)) {
-        return [NSNumber numberWithBool:[desc booleanValue]];
-    }
-
-    if (type == typeSInt16) {
-        SInt16 val = [desc int16Value];
-        return [NSNumber jaseNumberWithSignedIntP:&val byteCount:sizeof(val)];
-    }
-
-    if (type == typeSInt32) {
-        SInt32 val = [desc int32Value];
-        return [NSNumber jaseNumberWithSignedIntP:&val byteCount:sizeof(val)];
-    }
-
-    if (type == typeUInt32) {
-        UInt32 val = [desc unsignedInt32Value];
-        return [NSNumber jaseNumberWithUnsignedIntP:&val byteCount:sizeof(val)];
-    }
-
-    if (type == typeIEEE32BitFloatingPoint) {
-        Float32 val = [desc float32Value];
-        return [NSNumber jaseNumberWithFloatP:&val byteCount:sizeof(val)];
-    }
-
-    if (type == typeIEEE64BitFloatingPoint) {
-        Float64 val = [desc float64Value];
-        return [NSNumber jaseNumberWithFloatP:&val byteCount:sizeof(val)];
-    }
-
-    // try to coerce to 64bit floating point
-    desc = [desc coerceToDescriptorType:typeIEEE64BitFloatingPoint];
-    if (desc != nil) {
-        Float64 val = [desc float64Value];
-        return [NSNumber jaseNumberWithFloatP:&val byteCount:sizeof(val)];
-    }
-
-    [NSException raise:@"jaseUnsupportedAEDescriptorConversion"
-                format:@"JavaAppleScriptEngineAdditions: conversion of an NSAppleEventDescriptor with objCType '%s' to an aeDescriptor is not supported.", type];
-
-    return nil;
-}
-
-+ (id) jaseNumberWithSignedIntP:(void *)int_p byteCount:(int)bytes {
-    if (bytes == sizeof(char)) {
-        return [NSNumber numberWithChar:*(char *)int_p];
-    }
-
-    if (bytes == sizeof(short)) {
-        return [NSNumber numberWithShort:*(short *)int_p];
-    }
-
-    if (bytes == sizeof(int)) {
-        return [NSNumber numberWithInt:*(int *)int_p];
-    }
-
-    if (bytes == sizeof(long)) {
-        return [NSNumber numberWithLong:*(long *)int_p];
-    }
-
-    if (bytes == sizeof(long long)) {
-        return [NSNumber numberWithLongLong:*(long long *)int_p];
-    }
-
-    [NSException raise:NSInvalidArgumentException
-                format:@"NSNumber jaseNumberWithSignedIntP:byteCount: number with %i bytes not supported.", bytes];
-
-    return nil;
-}
-
-+ (id) jaseNumberWithUnsignedIntP:(void *)int_p byteCount:(int)bytes {
-    if (bytes == sizeof(unsigned char)) {
-        return [NSNumber numberWithUnsignedChar:*(unsigned char *)int_p];
-    }
-
-    if (bytes == sizeof(unsigned short)) {
-        return [NSNumber numberWithUnsignedShort:*(unsigned short *)int_p];
-    }
-
-    if (bytes == sizeof(unsigned int)) {
-        return [NSNumber numberWithUnsignedInt:*(unsigned int *)int_p];
-    }
-
-    if (bytes == sizeof(unsigned long)) {
-        return [NSNumber numberWithUnsignedLong:*(unsigned long *)int_p];
-    }
-
-    if (bytes == sizeof(unsigned long long)) {
-        return [NSNumber numberWithUnsignedLongLong:*(unsigned long long *)int_p];
-    }
-
-    [NSException raise:NSInvalidArgumentException
-                format:@"NSNumber numberWithUnsignedInt:byteCount: number with %i bytes not supported.", bytes];
-
-    return nil;
-}
-
-+ (id) jaseNumberWithFloatP:(void *)float_p byteCount:(int)bytes {
-    if (bytes == sizeof(float)) {
-        return [NSNumber numberWithFloat:*(float *)float_p];
-    }
-
-    if (bytes == sizeof(double)) {
-        return [NSNumber numberWithFloat:*(double *)float_p];
-    }
-
-    [NSException raise:NSInvalidArgumentException
-                format:@"NSNumber numberWithFloat:byteCount: floating point number with %i bytes not supported.", bytes];
-
-    return nil;
-}
-
-@end
-
-@implementation NSValue (JavaAppleScriptEngineAdditions)
-
-- (NSAppleEventDescriptor *)aeDescriptorValue {
-    const char *type = [self objCType];
-
-    if (areEqualEncodings(type, @encode(NSSize))) {
-        NSSize size = [self sizeValue];
-        return [[NSArray arrayWithObjects:
-                 [NSNumber numberWithFloat:size.width],
-                 [NSNumber numberWithFloat:size.height], nil] aeDescriptorValue];
-    }
-
-    if (areEqualEncodings(type, @encode(NSPoint))) {
-        NSPoint point = [self pointValue];
-        return [[NSArray arrayWithObjects:
-                 [NSNumber numberWithFloat:point.x],
-                 [NSNumber numberWithFloat:point.y], nil] aeDescriptorValue];
-    }
-
-    if (areEqualEncodings(type, @encode(NSRange))) {
-        NSRange range = [self rangeValue];
-        return [[NSArray arrayWithObjects:
-                 [NSNumber numberWithUnsignedInt:range.location],
-                 [NSNumber numberWithUnsignedInt:range.location + range.length], nil] aeDescriptorValue];
-    }
-
-    if (areEqualEncodings(type, @encode(NSRect))) {
-        NSRect rect = [self rectValue];
-        return [[NSArray arrayWithObjects:
-                 [NSNumber numberWithFloat:rect.origin.x],
-                 [NSNumber numberWithFloat:rect.origin.y],
-                 [NSNumber numberWithFloat:rect.origin.x + rect.size.width],
-                 [NSNumber numberWithFloat:rect.origin.y + rect.size.height], nil] aeDescriptorValue];
-    }
-
-    [NSException raise:@"jaseUnsupportedAEDescriptorConversion"
-                format:@"JavaAppleScriptEngineAdditions: conversion of an NSNumber with objCType '%s' to an aeDescriptor is not supported.", type];
-
-    return nil;
-}
-
-@end
-
-
-@implementation NSImage (JavaAppleScriptEngineAdditions)
-
-- (NSAppleEventDescriptor *)aeDescriptorValue {
-    NSData *data = [self TIFFRepresentation];
-    return [NSAppleEventDescriptor descriptorWithDescriptorType:typeTIFF data:data];
-}
-
-+ (NSImage *)imageWithAEDesc:(NSAppleEventDescriptor *)desc {
-    const AEDesc *d = [desc aeDesc];
-    NSMutableData *data = [NSMutableData dataWithLength:AEGetDescDataSize(d)];
-    AEGetDescData(d, [data mutableBytes], [data length]);
-    return [[[NSImage alloc] initWithData:data] autorelease];
-}
-
-@end
-
-
-
-@implementation NSAppleEventDescriptor (JavaAppleScriptEngineAdditions)
-
-// we're going to leak this.  It doesn't matter much for running apps, but
-// for developers it might be nice to try to dispose of it (so it would not clutter the
-// output when testing for leaks)
-static NSMutableDictionary *handlerDict = nil;
-
-- (id)objCObjectValue {
-    if (handlerDict == nil) [NSAppleEventDescriptor jaseSetUpHandlerDict];
-
-    id returnObj;
-    DescType type = [self descriptorType];
-    NSInvocation *handlerInvocation = [handlerDict objectForKey:[NSValue valueWithBytes:&type objCType:@encode(DescType)]];
-    if (handlerInvocation == nil) {
-        if (type == typeType) {
-            DescType subType;
-            AEGetDescData([self aeDesc], &subType, sizeof(subType));
-            if (subType == typeNull) return [NSNull null];
-        }
-        // return raw apple event descriptor if no handler is registered
-        returnObj = self;
-    } else {
-        [handlerInvocation setArgument:&self atIndex:2];
-        [handlerInvocation invoke];
-        [handlerInvocation getReturnValue:&returnObj];
-    }
-
-    return returnObj;
-}
-
-// FIXME - error checking, non nil handler
-+ (void)registerConversionHandler:(id)anObject selector:(SEL)aSelector forDescriptorTypes:(DescType)firstType, ... {
-    if (handlerDict == nil) [NSAppleEventDescriptor jaseSetUpHandlerDict];
-
-    NSInvocation *handlerInvocation = [NSInvocation invocationWithMethodSignature:[anObject methodSignatureForSelector:aSelector]];
-    [handlerInvocation setTarget:anObject];
-    [handlerInvocation setSelector:aSelector];
-
-    DescType aType = firstType;
-    va_list typesList;
-    va_start(typesList, firstType);
-    do {
-        NSValue *type = [NSValue valueWithBytes:&aType objCType:@encode(DescType)];
-        [handlerDict setObject:handlerInvocation forKey:type];
-    } while((aType = va_arg(typesList, DescType)) != 0);
-    va_end(typesList);
-}
-
-
-- (NSAppleEventDescriptor *)aeDescriptorValue {
-    return self;
-}
-
-+ (id)descriptorWithInt16:(SInt16)val {
-    return [NSAppleEventDescriptor descriptorWithDescriptorType:typeSInt16 bytes:&val length:sizeof(val)];
-}
-
-- (SInt16)int16Value {
-    SInt16 retValue;
-    [[[self coerceToDescriptorType:typeSInt16] data] getBytes:&retValue];
-    return retValue;
-}
-
-+ (id)descriptorWithUnsignedInt32:(UInt32)val {
-    return [NSAppleEventDescriptor descriptorWithDescriptorType:typeUInt32 bytes:&val length:sizeof(val)];
-}
-
-- (UInt32)unsignedInt32Value {
-    UInt32 retValue;
-    [[[self coerceToDescriptorType:typeUInt32] data] getBytes:&retValue];
-    return retValue;
-}
-
-
-+ (id)descriptorWithFloat32:(Float32)val {
-    return [NSAppleEventDescriptor descriptorWithDescriptorType:typeIEEE32BitFloatingPoint bytes:&val length:sizeof(val)];
-}
-
-- (Float32)float32Value {
-    Float32 retValue;
-    [[[self coerceToDescriptorType:typeIEEE32BitFloatingPoint] data] getBytes:&retValue];
-    return retValue;
-}
-
-
-+ (id)descriptorWithFloat64:(Float64)val {
-    return [NSAppleEventDescriptor descriptorWithDescriptorType:typeIEEE64BitFloatingPoint bytes:&val length:sizeof(val)];
-}
-
-- (Float64)float64Value {
-    Float64 retValue;
-    [[[self coerceToDescriptorType:typeIEEE64BitFloatingPoint] data] getBytes:&retValue];
-    return retValue;
-}
-
-+ (id)descriptorWithLongDateTime:(LongDateTime)val {
-    return [NSAppleEventDescriptor descriptorWithDescriptorType:typeLongDateTime bytes:&val length:sizeof(val)];
-}
-
-- (LongDateTime)longDateTimeValue {
-    LongDateTime retValue;
-    [[[self coerceToDescriptorType:typeLongDateTime] data] getBytes:&retValue];
-    return retValue;
-}
-
-+ (void)jaseSetUpHandlerDict {
-    handlerDict = [[NSMutableDictionary alloc] init];
-
-    // register default handlers
-    // types are culled from AEDataModel.h and AERegistry.h
-
-    // string -> NSStrings
-    [NSAppleEventDescriptor registerConversionHandler:[NSString class] selector:@selector(stringWithAEDesc:) forDescriptorTypes:
-     typeUnicodeText, typeText, typeUTF8Text, typeCString, typeChar, nil];
-
-    // number/bool -> NSNumber
-    [NSAppleEventDescriptor registerConversionHandler:[NSNumber class] selector:@selector(numberWithAEDesc:) forDescriptorTypes:
-     typeBoolean, typeTrue, typeFalse,
-     typeSInt16, typeSInt32, typeUInt32, typeSInt64,
-     typeIEEE32BitFloatingPoint, typeIEEE64BitFloatingPoint, type128BitFloatingPoint, nil];
-
-    // list -> NSArray
-    [NSAppleEventDescriptor registerConversionHandler:[NSArray class] selector:@selector(arrayWithAEDesc:) forDescriptorTypes:typeAEList, nil];
-
-    // record -> NSDictionary
-    [NSAppleEventDescriptor registerConversionHandler:[NSDictionary class] selector:@selector(dictionaryWithAEDesc:) forDescriptorTypes:typeAERecord, nil];
-
-    // date -> NSDate
-    [NSAppleEventDescriptor registerConversionHandler:[NSDate class] selector:@selector(dateWithAEDesc:) forDescriptorTypes:typeLongDateTime, nil];
-
-    // images -> NSImage
-    [NSAppleEventDescriptor registerConversionHandler:[NSImage class] selector:@selector(imageWithAEDesc:) forDescriptorTypes:
-     typeTIFF, typeJPEG, typeGIF, typePict, typeIconFamily, typeIconAndMask, nil];
-
-    // vers -> NSString
-    [NSAppleEventDescriptor registerConversionHandler:[NSString class] selector:@selector(versionWithAEDesc:) forDescriptorTypes:typeVersion, nil];
-
-    // null -> NSNull
-    [NSAppleEventDescriptor registerConversionHandler:[NSNull class] selector:@selector(nullWithAEDesc:) forDescriptorTypes:typeNull, nil];
-}
-
-@end
--- a/src/jdk.deploy.osx/macosx/native/libapplescriptengine/AppleScriptEngine.m	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#import "apple_applescript_AppleScriptEngine.h"
-#import "apple_applescript_AppleScriptEngineFactory.h"
-
-// Must include this before JavaNativeFoundation.h to get jni.h from build
-#include "jni.h"
-#include "jni_util.h"
-
-#import <JavaNativeFoundation/JavaNativeFoundation.h>
-
-#import "NS_Java_ConversionUtils.h"
-#import "AppleScriptExecutionContext.h"
-
-//#define DEBUG 1
-
-/*
- * Declare library specific JNI_Onload entry if static build
- */
-DEF_STATIC_JNI_OnLoad
-
-/*
- * Class:     apple_applescript_AppleScriptEngineFactory
- * Method:    initNative
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_apple_applescript_AppleScriptEngineFactory_initNative
-(JNIEnv *env, jclass clazz)
-{
-    return;
-}
-
-
-/*
- * Class:     apple_applescript_AppleScriptEngine
- * Method:    initNative
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_apple_applescript_AppleScriptEngine_initNative
-(JNIEnv *env, jclass clazz)
-{
-    return;
-}
-
-
-/*
- * Class:     apple_applescript_AppleScriptEngine
- * Method:    createContextFrom
- * Signature: (Ljava/lang/Object;)J
- */
-JNIEXPORT jlong JNICALL Java_apple_applescript_AppleScriptEngine_createContextFrom
-(JNIEnv *env, jclass clazz, jobject javaContext)
-{
-    NSObject *obj = nil;
-
-JNF_COCOA_ENTER(env);
-
-    obj = [[JavaAppleScriptEngineCoercion coercer] coerceJavaObject:javaContext withEnv:env];
-
-#ifdef DEBUG
-    NSLog(@"converted context: %@", obj);
-#endif
-
-    CFRetain(obj);
-
-JNF_COCOA_EXIT(env);
-
-    return ptr_to_jlong(obj);
-}
-
-
-/*
- * Class:     apple_applescript_AppleScriptEngine
- * Method:    createObjectFrom
- * Signature: (J)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_apple_applescript_AppleScriptEngine_createObjectFrom
-(JNIEnv *env, jclass clazz, jlong nativeContext)
-{
-    jobject obj = NULL;
-
-JNF_COCOA_ENTER(env);
-
-    obj = [[JavaAppleScriptEngineCoercion coercer] coerceNSObject:(id)jlong_to_ptr(nativeContext) withEnv:env];
-
-JNF_COCOA_EXIT(env);
-
-    return obj;
-}
-
-
-/*
- * Class:     apple_applescript_AppleScriptEngine
- * Method:    disposeContext
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_apple_applescript_AppleScriptEngine_disposeContext
-(JNIEnv *env, jclass clazz, jlong nativeContext)
-{
-
-JNF_COCOA_ENTER(env);
-
-    id obj = (id)jlong_to_ptr(nativeContext);
-    if (obj != nil) CFRelease(obj);
-
-JNF_COCOA_EXIT(env);
-
-}
-
-
-/*
- * Class:     apple_applescript_AppleScriptEngine
- * Method:    evalScript
- * Signature: (Ljava/lang/String;J)J
- */
-JNIEXPORT jlong JNICALL Java_apple_applescript_AppleScriptEngine_evalScript
-(JNIEnv *env, jclass clazz, jstring ascript, jlong contextptr)
-{
-    id retval = nil;
-
-JNF_COCOA_ENTER(env);
-
-    NSDictionary *ncontext = jlong_to_ptr(contextptr);
-    NSString *source = JNFJavaToNSString(env, ascript);
-
-#ifdef DEBUG
-    NSLog(@"evalScript(source:\"%@\" context: %@)", source, ncontext);
-#endif
-
-    AppleScriptExecutionContext *scriptInvocationCtx = [[[AppleScriptExecutionContext alloc] initWithSource:source context:ncontext] autorelease];
-    retval = [scriptInvocationCtx invokeWithEnv:env];
-
-#ifdef DEBUG
-    NSLog(@"returning: %@", retval);
-#endif
-
-    if (retval) CFRetain(retval);
-
-JNF_COCOA_EXIT(env);
-
-    return ptr_to_jlong(retval);
-}
-
-
-/*
- * Class:     apple_applescript_AppleScriptEngine
- * Method:    evalScriptFromURL
- * Signature: (Ljava/lang/String;J)J
- */
-JNIEXPORT jlong JNICALL Java_apple_applescript_AppleScriptEngine_evalScriptFromURL
-(JNIEnv *env, jclass clazz, jstring afilename, jlong contextptr)
-{
-    id retval = nil;
-
-JNF_COCOA_ENTER(env);
-
-    NSDictionary *ncontext = jlong_to_ptr(contextptr);
-    NSString *filename = JNFJavaToNSString(env, afilename);
-
-#ifdef DEBUG
-    NSLog(@"evalScript(filename:\"%@\" context: %@)", filename, ncontext);
-#endif
-
-    AppleScriptExecutionContext *scriptInvocationCtx = [[[AppleScriptExecutionContext alloc] initWithFile:filename context:ncontext] autorelease];
-    retval = [scriptInvocationCtx invokeWithEnv:env];
-
-#ifdef DEBUG
-    NSLog(@"returning: %@", retval);
-#endif
-
-    if (retval) CFRetain(retval);
-
-JNF_COCOA_EXIT(env);
-
-    return ptr_to_jlong(retval);
-}
--- a/src/jdk.deploy.osx/macosx/native/libapplescriptengine/AppleScriptExecutionContext.h	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-#import <JavaNativeFoundation/JavaNativeFoundation.h>
-
-
-@interface AppleScriptExecutionContext : NSObject {
-    NSString *source;
-    BOOL isFile;
-    NSDictionary *context;
-    NSDictionary *error;
-    id returnValue;
-}
-
-@property (nonatomic, retain) NSString *source;
-@property (nonatomic, retain) NSDictionary *context;
-@property (nonatomic, retain) NSDictionary *error;
-@property (nonatomic, retain) id returnValue;
-
-- (id) initWithSource:(NSString *)source context:(NSDictionary *)context;
-- (id) initWithFile:(NSString *)filename context:(NSDictionary *)context;
-- (id) invokeWithEnv:(JNIEnv *)env;
-
-@end
--- a/src/jdk.deploy.osx/macosx/native/libapplescriptengine/AppleScriptExecutionContext.m	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-#import "AppleScriptExecutionContext.h"
-
-#import <Carbon/Carbon.h>
-
-#import "AS_NS_ConversionUtils.h"
-
-
-@implementation AppleScriptExecutionContext
-
-@synthesize source;
-@synthesize context;
-@synthesize error;
-@synthesize returnValue;
-
-- (id) init:(NSString *)sourceIn context:(id)contextIn {
-    self = [super init];
-    if (!self) return self;
-
-    self.source = sourceIn;
-    self.context = contextIn;
-    self.returnValue = nil;
-    self.error = nil;
-
-    return self;
-}
-
-- (id) initWithSource:(NSString *)sourceIn context:(NSDictionary *)contextIn {
-    self = [self init:sourceIn context:contextIn];
-    isFile = NO;
-    return self;
-}
-
-- (id) initWithFile:(NSString *)filenameIn context:(NSDictionary *)contextIn {
-    self = [self init:filenameIn context:contextIn];
-    isFile = YES;
-    return self;
-}
-
-- (void) dealloc {
-    self.source = nil;
-    self.context = nil;
-    self.returnValue = nil;
-    self.error = nil;
-
-    [super dealloc];
-}
-
-- (NSAppleScript *) scriptFromURL {
-    NSURL *url = [NSURL URLWithString:source];
-    NSDictionary *err = nil;
-    NSAppleScript *script = [[[NSAppleScript alloc] initWithContentsOfURL:url error:(&err)] autorelease];
-    if (err != nil) self.error = err;
-    return script;
-}
-
-- (NSAppleScript *) scriptFromSource {
-    return [[[NSAppleScript alloc] initWithSource:source] autorelease];
-}
-
-- (NSAppleEventDescriptor *) functionInvocationEvent {
-    NSString *function = [[context objectForKey:@"javax_script_function"] description];
-    if (function == nil) return nil;
-
-    // wrap the arg in an array if it is not already a list
-    id args = [context objectForKey:@"javax_script_argv"];
-    if (![args isKindOfClass:[NSArray class]]) {
-        args = [NSArray arrayWithObjects:args, nil];
-    }
-
-    // triangulate our target
-    int pid = [[NSProcessInfo processInfo] processIdentifier];
-    NSAppleEventDescriptor* targetAddress = [NSAppleEventDescriptor descriptorWithDescriptorType:typeKernelProcessID
-                                                                                           bytes:&pid
-                                                                                          length:sizeof(pid)];
-
-    // create the event to call a subroutine in the script
-    NSAppleEventDescriptor* event = [[NSAppleEventDescriptor alloc] initWithEventClass:kASAppleScriptSuite
-                                                                               eventID:kASSubroutineEvent
-                                                                      targetDescriptor:targetAddress
-                                                                              returnID:kAutoGenerateReturnID
-                                                                         transactionID:kAnyTransactionID];
-
-    // set up the handler
-    NSAppleEventDescriptor* subroutineDescriptor = [NSAppleEventDescriptor descriptorWithString:[function lowercaseString]];
-    [event setParamDescriptor:subroutineDescriptor forKeyword:keyASSubroutineName];
-
-    // set up the arguments
-    [event setParamDescriptor:[args aeDescriptorValue] forKeyword:keyDirectObject];
-
-    return [event autorelease];
-}
-
-- (void) invoke {
-    // create our script
-    NSAppleScript *script = isFile ? [self scriptFromURL] : [self scriptFromSource];
-    if (self.error != nil) return;
-
-    // find out if we have a subroutine to call
-    NSAppleEventDescriptor *fxnInvkEvt = [self functionInvocationEvent];
-
-    // exec!
-    NSAppleEventDescriptor *desc = nil;
-    NSDictionary *err = nil;
-    if (fxnInvkEvt == nil) {
-        desc = [script executeAndReturnError:(&err)];
-    } else {
-        desc = [script executeAppleEvent:fxnInvkEvt error:(&err)];
-    }
-
-    // if we encountered an exception, stash and bail
-    if (err != nil) {
-        self.error = err;
-        return;
-    }
-
-    // convert to NSObjects, and return in ivar
-    self.returnValue = [desc objCObjectValue];
-}
-
-- (id) invokeWithEnv:(JNIEnv *)env {
-    BOOL useAnyThread = [@"any-thread" isEqual:[context valueForKey:@"javax_script_threading"]];
-
-    // check if we are already on the AppKit thread, if desired
-    if(pthread_main_np() || useAnyThread) {
-        [self invoke];
-    } else {
-        [JNFRunLoop performOnMainThread:@selector(invoke) on:self withObject:nil waitUntilDone:YES];
-    }
-
-    // if we have an exception parked in our ivar, snarf the message (if there is one), and toss a ScriptException
-    if (self.error != nil) {
-        NSString *asErrString = [self.error objectForKey:NSAppleScriptErrorMessage];
-        if (!asErrString) asErrString = @"AppleScriptEngine failed to execute script."; // usually when we fail to load a file
-        [JNFException raise:env as:"javax/script/ScriptException" reason:[asErrString UTF8String]];
-    }
-
-    return self.returnValue;
-}
-
-@end
--- a/src/jdk.deploy.osx/macosx/native/libapplescriptengine/NS_Java_ConversionUtils.h	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-#import <JavaNativeFoundation/JavaNativeFoundation.h>
-
-
-@interface JavaAppleScriptEngineCoercion : NSObject
-
-+ (JNFTypeCoercer *) coercer;
-
-@end
--- a/src/jdk.deploy.osx/macosx/native/libapplescriptengine/NS_Java_ConversionUtils.m	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-#import "NS_Java_ConversionUtils.h"
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface JavaAppleScriptBaseConverter : NSObject <JNFTypeCoercion>
-@end
-
-@interface JavaAppleScriptImageConverter : NSObject <JNFTypeCoercion>
-@end
-
-@interface JavaAppleScriptVersionConverter : NSObject <JNFTypeCoercion>
-@end
-
-@interface JavaAppleScriptNullConverter : NSObject <JNFTypeCoercion>
-@end
-
-
-@implementation JavaAppleScriptEngineCoercion
-
-static JNFTypeCoercer *appleScriptCoercer = nil;
-
-+ (JNFTypeCoercer *) coercer {
-    if (appleScriptCoercer) return appleScriptCoercer;
-
-    id asSpecificCoercions = [[JNFDefaultCoercions defaultCoercer] deriveCoercer];
-    [asSpecificCoercions addCoercion:[[[JavaAppleScriptImageConverter alloc] init] autorelease] forNSClass:[NSImage class] javaClass:@"java/awt/Image"];
-    [asSpecificCoercions addCoercion:[[[JavaAppleScriptVersionConverter alloc] init] autorelease] forNSClass:[NSAppleEventDescriptor class] javaClass:nil];
-    [asSpecificCoercions addCoercion:[[[JavaAppleScriptNullConverter alloc] init] autorelease] forNSClass:[NSNull class] javaClass:nil];
-
-    return appleScriptCoercer = [asSpecificCoercions retain];
-}
-
-@end
-
-
-// [NSObject description] <-> java.lang.Object.toString()
-@implementation JavaAppleScriptBaseConverter
-
-// by default, bizzare NSObjects will have -description called on them, and passed back to Java like that
-- (jobject) coerceNSObject:(id)obj withEnv:(JNIEnv *)env usingCoercer:(JNFTypeCoercion *)coercer {
-    return JNFNSToJavaString(env, [obj description]);
-}
-
-// by default, bizzare Java objects will be toString()'d and passed to AppleScript like that
-- (id) coerceJavaObject:(jobject)obj withEnv:(JNIEnv *)env usingCoercer:(JNFTypeCoercion *)coercer {
-    return JNFObjectToString(env, obj);
-}
-
-@end
-
-
-// NSImage <-> apple.awt.CImage
-@implementation JavaAppleScriptImageConverter
-
-static JNF_CLASS_CACHE(jc_CImage, "apple/awt/CImage");
-static JNF_STATIC_MEMBER_CACHE(jm_CImage_getCreator, jc_CImage, "getCreator", "()Lapple/awt/CImage$Creator;");
-static JNF_MEMBER_CACHE(jm_CImage_getNSImage, jc_CImage, "getNSImage", "()J");
-
-static JNF_CLASS_CACHE(jc_CImage_Generator, "apple/awt/CImage$Creator");
-static JNF_MEMBER_CACHE(jm_CImage_Generator_createImageFromPtr, jc_CImage_Generator, "createImage", "(J)Ljava/awt/image/BufferedImage;");
-static JNF_MEMBER_CACHE(jm_CImage_Generator_createImageFromImg, jc_CImage_Generator, "createImage", "(Ljava/awt/Image;)Lapple/awt/CImage;");
-
-- (jobject) coerceNSObject:(id)obj withEnv:(JNIEnv *)env usingCoercer:(JNFTypeCoercion *)coercer {
-    NSImage *img = (NSImage *)obj;
-    CFRetain(img);
-    jobject creator = JNFCallStaticObjectMethod(env, jm_CImage_getCreator);
-    jobject jobj = JNFCallObjectMethod(env, creator, jm_CImage_Generator_createImageFromPtr, ptr_to_jlong(img));
-    return jobj;
-}
-
-- (id) coerceJavaObject:(jobject)obj withEnv:(JNIEnv *)env usingCoercer:(JNFTypeCoercion *)coercer {
-    jobject cimage = obj;
-    if (!JNFIsInstanceOf(env, obj, &jc_CImage)) {
-        jobject creator = JNFCallStaticObjectMethod(env, jm_CImage_getCreator);
-        cimage = JNFCallObjectMethod(env, creator, jm_CImage_Generator_createImageFromImg, obj);
-    }
-
-    jlong nsImagePtr = JNFCallLongMethod(env, cimage, jm_CImage_getNSImage);
-
-    NSImage *img = (NSImage *)jlong_to_ptr(nsImagePtr);
-    return [[img retain] autorelease];
-}
-
-@end
-
-
-// NSAppleEventDescriptor('vers') -> java.lang.String
-@implementation JavaAppleScriptVersionConverter
-
-- (jobject) coerceNSObject:(id)obj withEnv:(JNIEnv *)env usingCoercer:(JNFTypeCoercion *)coercer {
-    NSAppleEventDescriptor *desc = (NSAppleEventDescriptor *)obj;
-
-    const AEDesc *aeDesc = [desc aeDesc];
-    if (aeDesc->descriptorType == typeNull) {
-        return NULL;
-    }
-
-    return JNFNSToJavaString(env, [obj description]);
-}
-
-- (id) coerceJavaObject:(jobject)obj withEnv:(JNIEnv *)env usingCoercer:(JNFTypeCoercion *)coercer {
-    return nil; // there is no Java object that represents a "version"
-}
-
-@end
-
-
-// NSNull <-> null
-@implementation JavaAppleScriptNullConverter
-
-- (jobject) coerceNSObject:(id)obj withEnv:(JNIEnv *)env usingCoercer:(JNFTypeCoercion *)coercer {
-    return NULL;
-}
-
-- (id) coerceJavaObject:(jobject)obj withEnv:(JNIEnv *)env usingCoercer:(JNFTypeCoercion *)coercer {
-    return nil;
-}
-
-@end
--- a/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSigner.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSigner.java	Fri Dec 18 10:00:55 2015 -0800
@@ -35,7 +35,7 @@
  *
  * @since 1.5
  * @author Vincent Ryan
- * @deprecated This package has been deprecated.
+ * @deprecated This class has been deprecated.
  */
 
 @jdk.Exported
--- a/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSignerParameters.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSignerParameters.java	Fri Dec 18 10:00:55 2015 -0800
@@ -34,7 +34,7 @@
  *
  * @since 1.5
  * @author Vincent Ryan
- * @deprecated This package has been deprecated.
+ * @deprecated This class has been deprecated.
  */
 @jdk.Exported
 @Deprecated
--- a/src/jdk.jartool/share/classes/com/sun/jarsigner/package-info.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/src/jdk.jartool/share/classes/com/sun/jarsigner/package-info.java	Fri Dec 18 10:00:55 2015 -0800
@@ -30,9 +30,10 @@
  * tool by supplying an alternative implementation of
  * {@link com.sun.jarsigner.ContentSigner}.
  *
- * This package has been deprecated.
+ * The classes in this package have been deprecated. New classes should not be
+ * added to this package. Use the {@link jdk.security.jarsigner.JarSigner} API
+ * to sign JAR files.
  */
 
 @jdk.Exported
-@Deprecated
 package com.sun.jarsigner;
--- a/test/ProblemList.txt	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/ProblemList.txt	Fri Dec 18 10:00:55 2015 -0800
@@ -407,3 +407,10 @@
 sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java    generic-all
 
 ############################################################################
+
+# jdk_other
+
+############################################################################
+
+# 8141370
+com/sun/jndi/ldap/DeadSSLLdapTimeoutTest.java			linux-i586,macosx-all
--- a/test/TEST.groups	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/TEST.groups	Fri Dec 18 10:00:55 2015 -0800
@@ -30,7 +30,9 @@
     -java/lang/ProcessHandle/TreeTest.java \
     -java/util/zip/TestLocalTime.java \
     :jdk_util \
+    -java/util/WeakHashMap/GCDuringIteration.java \
     -java/util/concurrent/Phaser/Basic.java \
+    -java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java
     sun/nio/cs/ISO8859x.java \
     java/nio/Buffer \
     com/sun/crypto/provider/Cipher \
@@ -40,6 +42,8 @@
     java/lang/ProcessHandle/TreeTest.java \
     java/util/zip/TestLocalTime.java \
     java/util/concurrent/Phaser/Basic.java \
+    java/util/WeakHashMap/GCDuringIteration.java \
+    java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
     :jdk_io \
     :jdk_nio \
     -sun/nio/cs/ISO8859x.java \
--- a/test/com/sun/jdi/SuspendThreadTest.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/com/sun/jdi/SuspendThreadTest.java	Fri Dec 18 10:00:55 2015 -0800
@@ -42,6 +42,7 @@
 
 class SuspendThreadTarg {
     public static long count;
+    public static boolean active = true;
 
     public static void bkpt() {
         count++;
@@ -53,7 +54,7 @@
         // We need this to be running so the bkpt
         // can be hit immediately when it is enabled
         // in the back-end.
-        while(count >= 0) {
+        while(active) {
             bkpt();
         }
         System.out.println("Goodbye from SuspendThreadTarg, count = " + count);
@@ -82,9 +83,9 @@
     // to guard against spurious wakeups from bkptSignal.wait()
     boolean signalSent;
     // signal that a breakpoint has happened
-    Object bkptSignal = new Object() {};
+    final private Object bkptSignal = new Object() {};
     BreakpointRequest bkptRequest;
-    Field debuggeeCountField;
+    Field debuggeeCountField, debuggeeActiveField;
 
     // When we get a bkpt we want to disable the request,
     // resume the debuggee, and then re-enable the request
@@ -119,65 +120,71 @@
     /********** test core **********/
 
     protected void runTests() throws Exception {
-        /*
-         * Get to the top of main()
-         * to determine targetClass and mainThread
-         */
-        BreakpointEvent bpe = startToMain("SuspendThreadTarg");
-        targetClass = (ClassType)bpe.location().declaringType();
-        mainThread = bpe.thread();
-        EventRequestManager erm = vm().eventRequestManager();
+        try {
+            /*
+             * Get to the top of main()
+             * to determine targetClass and mainThread
+             */
+            BreakpointEvent bpe = startToMain("SuspendThreadTarg");
+            targetClass = (ClassType)bpe.location().declaringType();
+            mainThread = bpe.thread();
+            EventRequestManager erm = vm().eventRequestManager();
 
-        Location loc1 = findMethod(targetClass, "bkpt", "()V").location();
+            Location loc1 = findMethod(targetClass, "bkpt", "()V").location();
 
-        bkptRequest = erm.createBreakpointRequest(loc1);
+            bkptRequest = erm.createBreakpointRequest(loc1);
 
-        // Without this, it is a SUSPEND_ALL bkpt and the test will pass
-        bkptRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
-        bkptRequest.enable();
+            // Without this, it is a SUSPEND_ALL bkpt and the test will pass
+            bkptRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
+            bkptRequest.enable();
 
-        debuggeeCountField = targetClass.fieldByName("count");
-        try {
-            addListener (this);
-        } catch (Exception ex){
-            ex.printStackTrace();
-            failure("failure: Could not add listener");
-            throw new Exception("SuspendThreadTest: failed", ex);
-        }
+            debuggeeCountField = targetClass.fieldByName("count");
+            debuggeeActiveField = targetClass.fieldByName("active");
+            try {
+                addListener (this);
+            } catch (Exception ex){
+                ex.printStackTrace();
+                failure("failure: Could not add listener");
+                throw new Exception("SuspendThreadTest: failed", ex);
+            }
 
-        int prevBkptCount;
-        vm().resume();
-        synchronized (bkptSignal) {
-            while (bkptCount < maxBkpts) {
-                prevBkptCount = bkptCount;
-                // If we don't get a bkpt within 5 secs,
-                // the test fails
-                signalSent = false;
-                do {
-                    try {
-                        bkptSignal.wait(5000);
-                    } catch (InterruptedException ee) {
+            int prevBkptCount;
+            vm().resume();
+            synchronized (bkptSignal) {
+                while (bkptCount < maxBkpts) {
+                    prevBkptCount = bkptCount;
+                    // If we don't get a bkpt within 5 secs,
+                    // the test fails
+                    signalSent = false;
+                    do {
+                        try {
+                            bkptSignal.wait(5000);
+                        } catch (InterruptedException ee) {
+                        }
+                    } while (signalSent == false);
+                    if (prevBkptCount == bkptCount) {
+                        failure("failure: test hung");
+                        break;
                     }
-                } while (signalSent == false);
-                if (prevBkptCount == bkptCount) {
-                    failure("failure: test hung");
-                    break;
                 }
             }
-        }
-        println("done with loop");
-        bkptRequest.disable();
-        removeListener(this);
+            println("done with loop");
+            bkptRequest.disable();
+            removeListener(this);
 
-
-        /*
-         * deal with results of test
-         * if anything has called failure("foo") testFailed will be true
-         */
-        if (!testFailed) {
-            println("SuspendThreadTest: passed");
-        } else {
-            throw new Exception("SuspendThreadTest: failed");
+            /*
+             * deal with results of test
+             * if anything has called failure("foo") testFailed will be true
+             */
+            if (!testFailed) {
+                println("SuspendThreadTest: passed");
+            } else {
+                throw new Exception("SuspendThreadTest: failed");
+            }
+        } finally {
+            if (targetClass != null && debuggeeActiveField != null) {
+                targetClass.setValue(debuggeeActiveField, vm().mirrorOf(false));
+            }
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/jndi/ldap/DeadSSLLdapTimeoutTest.java	Fri Dec 18 10:00:55 2015 -0800
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2011, 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.
+ */
+
+/**
+ * @test
+ * @run main/othervm DeadSSLLdapTimeoutTest
+ * @bug 8141370
+ * @key intermittent
+ */
+
+import java.net.Socket;
+import java.net.ServerSocket;
+import java.net.SocketTimeoutException;
+import java.io.*;
+import javax.naming.*;
+import javax.naming.directory.*;
+import java.util.List;
+import java.util.Hashtable;
+import java.util.ArrayList;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.TimeUnit;
+import javax.net.ssl.SSLHandshakeException;
+
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+
+
+class DeadServerTimeoutSSLTest implements Callable {
+
+    Hashtable env;
+    DeadSSLServer server;
+    boolean passed = false;
+    private int HANGING_TEST_TIMEOUT = 20_000;
+
+    public DeadServerTimeoutSSLTest(Hashtable env) throws IOException {
+        this.server = new DeadSSLServer();
+        this.env = env;
+    }
+
+    public void performOp(InitialContext ctx) throws NamingException {}
+
+    public void handleNamingException(NamingException e, long start, long end) {
+        if (e.getCause() instanceof SocketTimeoutException) {
+            // SSL connect will timeout via readReply using
+            // SocketTimeoutException
+            e.printStackTrace();
+            pass();
+        } else if (e.getCause() instanceof SSLHandshakeException
+                && e.getCause().getCause() instanceof EOFException) {
+            // test seems to be failing intermittently on some
+            // platforms.
+            pass();
+        } else {
+            fail(e);
+        }
+    }
+
+    public void pass() {
+        this.passed = true;
+    }
+
+    public void fail() {
+        throw new RuntimeException("Test failed");
+    }
+
+    public void fail(Exception e) {
+        throw new RuntimeException("Test failed", e);
+    }
+
+    boolean shutItDown(InitialContext ctx) {
+        try {
+            if (ctx != null) ctx.close();
+            return true;
+        } catch (NamingException ex) {
+            return false;
+        }
+    }
+
+    public Boolean call() {
+        InitialContext ctx = null;
+        ScheduledFuture killer = null;
+        long start = System.nanoTime();
+
+        try {
+            while(!server.accepting())
+                Thread.sleep(200); // allow the server to start up
+            Thread.sleep(200); // to be sure
+
+            env.put(Context.PROVIDER_URL, "ldap://localhost:" +
+                    server.getLocalPort());
+
+            try {
+                ctx = new InitialDirContext(env);
+                performOp(ctx);
+                fail();
+            } catch (NamingException e) {
+                long end = System.nanoTime();
+                System.out.println(this.getClass().toString() + " - elapsed: "
+                        + NANOSECONDS.toMillis(end - start));
+                handleNamingException(e, start, end);
+            } finally {
+                if (killer != null && !killer.isDone())
+                    killer.cancel(true);
+                shutItDown(ctx);
+                server.close();
+            }
+            return passed;
+        } catch (IOException|InterruptedException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
+
+class DeadSSLServer extends Thread {
+    ServerSocket serverSock;
+    boolean accepting = false;
+
+    public DeadSSLServer() throws IOException {
+        this.serverSock = new ServerSocket(0);
+        start();
+    }
+
+    public void run() {
+        while(true) {
+            try {
+                accepting = true;
+                Socket socket = serverSock.accept();
+            } catch (Exception e) {
+                break;
+            }
+        }
+    }
+
+    public int getLocalPort() {
+        return serverSock.getLocalPort();
+    }
+
+    public boolean accepting() {
+        return accepting;
+    }
+
+    public void close() throws IOException {
+        serverSock.close();
+    }
+}
+
+public class DeadSSLLdapTimeoutTest {
+
+    static Hashtable createEnv() {
+        Hashtable env = new Hashtable(11);
+        env.put(Context.INITIAL_CONTEXT_FACTORY,
+            "com.sun.jndi.ldap.LdapCtxFactory");
+        return env;
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        InitialContext ctx = null;
+
+        //
+        // Running this test serially as it seems to tickle a problem
+        // on older kernels
+        //
+        // run the DeadServerTest with connect / read timeouts set
+        // and ssl enabled
+        // this should exit with a SocketTimeoutException as the root cause
+        // it should also use the connect timeout instead of the read timeout
+        System.out.println("Running connect timeout test with 10ms connect timeout, 3000ms read timeout & SSL");
+        Hashtable sslenv = createEnv();
+        sslenv.put("com.sun.jndi.ldap.connect.timeout", "10");
+        sslenv.put("com.sun.jndi.ldap.read.timeout", "3000");
+        sslenv.put(Context.SECURITY_PROTOCOL, "ssl");
+        boolean testFailed =
+            (new DeadServerTimeoutSSLTest(sslenv).call()) ? false : true;
+
+        if (testFailed) {
+            throw new AssertionError("some tests failed");
+        }
+
+    }
+
+}
+
--- a/test/com/sun/jndi/ldap/LdapTimeoutTest.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/com/sun/jndi/ldap/LdapTimeoutTest.java	Fri Dec 18 10:00:55 2015 -0800
@@ -225,29 +225,6 @@
     }
 }
 
-class DeadServerTimeoutSSLTest extends DeadServerTest {
-
-    public DeadServerTimeoutSSLTest(Hashtable env) throws IOException {
-        super(env);
-    }
-
-    public void handleNamingException(NamingException e, long start, long end) {
-        if (e.getCause() instanceof SocketTimeoutException) {
-            // SSL connect will timeout via readReply using
-            // SocketTimeoutException
-            e.printStackTrace();
-            pass();
-        } else if (e.getCause() instanceof SSLHandshakeException
-                && e.getCause().getCause() instanceof EOFException) {
-            // test seems to be failing intermittently on some
-            // platforms.
-            pass();
-        } else {
-            fail(e);
-        }
-    }
-}
-
 
 class ReadServerNoTimeoutTest extends ReadServerTest {
 
@@ -454,21 +431,6 @@
                 }
             }
 
-            //
-            // Running this test serially as it seems to tickle a problem
-            // on older kernels
-            //
-            // run the DeadServerTest with connect / read timeouts set
-            // and ssl enabled
-            // this should exit with a SocketTimeoutException as the root cause
-            // it should also use the connect timeout instead of the read timeout
-            System.out.println("Running connect timeout test with 10ms connect timeout, 3000ms read timeout & SSL");
-            Hashtable sslenv = createEnv();
-            sslenv.put("com.sun.jndi.ldap.connect.timeout", "10");
-            sslenv.put("com.sun.jndi.ldap.read.timeout", "3000");
-            sslenv.put(Context.SECURITY_PROTOCOL, "ssl");
-            testFailed = (new DeadServerTimeoutSSLTest(sslenv).call()) ? false : true;
-
             if (testFailed) {
                 throw new AssertionError("some tests failed");
             }
--- a/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Fri Dec 18 10:00:55 2015 -0800
@@ -62,7 +62,7 @@
             ProcessBuilder pb = ProcessTools.
                 createJavaProcessBuilder(
                     "-XX:+UseConcMarkSweepGC",  // this will cause UseParNewGC to be FLAG_SET_ERGO
-                    "-XX:+PrintGCDetails",
+                    "-XX:+UseCodeAging",
                     "-XX:+UseCerealGC",         // Should be ignored.
                     "-XX:Flags=" + flagsFile.getAbsolutePath(),
                     "-cp", System.getProperty("test.class.path"),
@@ -97,7 +97,7 @@
             // Not set, so should be default
             checkOrigin("ManagementServer", Origin.DEFAULT);
             // Set on the command line
-            checkOrigin("PrintGCDetails", Origin.VM_CREATION);
+            checkOrigin("UseCodeAging", Origin.VM_CREATION);
             // Set in _JAVA_OPTIONS
             checkOrigin("TraceExceptions", Origin.ENVIRON_VAR);
             // Set in JAVA_TOOL_OPTIONS
--- a/test/com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java	Fri Dec 18 10:00:55 2015 -0800
@@ -28,7 +28,7 @@
  * @author  Mandy Chung
  *
  * @modules jdk.management
- * @run main/othervm -XX:+PrintGCDetails GetVMOption
+ * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError GetVMOption
  */
 
 import com.sun.management.HotSpotDiagnosticMXBean;
@@ -38,7 +38,7 @@
 import javax.management.MBeanServer;
 
 public class GetVMOption {
-    private static final String PRINT_GC_DETAILS = "PrintGCDetails";
+    private static final String HEAP_DUMP_ON_OOM = "HeapDumpOnOutOfMemoryError";
     private static final String EXPECTED_VALUE = "true";
     private static final String BAD_OPTION = "BadOption";
     private static final String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME =
@@ -58,7 +58,7 @@
     }
 
     private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
-        VMOption option = mbean.getVMOption(PRINT_GC_DETAILS);
+        VMOption option = mbean.getVMOption(HEAP_DUMP_ON_OOM);
         if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
             throw new RuntimeException("Unexpected value: " +
                 option.getValue() + " expected: " + EXPECTED_VALUE);
--- a/test/com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java	Fri Dec 18 10:00:55 2015 -0800
@@ -30,7 +30,7 @@
  * @author  Jaroslav Bachorik
  *
  * @modules jdk.management
- * @run main/othervm -XX:+PrintGCDetails SetVMOption
+ * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError SetVMOption
  */
 
 import java.lang.management.ManagementFactory;
@@ -40,7 +40,7 @@
 import com.sun.management.VMOption.Origin;
 
 public class SetVMOption {
-    private static final String PRINT_GC_DETAILS = "PrintGCDetails";
+    private static final String HEAP_DUMP_ON_OOM = "HeapDumpOnOutOfMemoryError";
     private static final String EXPECTED_VALUE = "true";
     private static final String BAD_VALUE = "yes";
     private static final String NEW_VALUE = "false";
@@ -51,7 +51,7 @@
         mbean =
             ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
 
-        VMOption option = findPrintGCDetailsOption();
+        VMOption option = findHeapDumpOnOomOption();
         if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
             throw new RuntimeException("Unexpected value: " +
                 option.getValue() + " expected: " + EXPECTED_VALUE);
@@ -61,14 +61,14 @@
                 option.getOrigin() + " expected: VM_CREATION");
         }
         if (!option.isWriteable()) {
-            throw new RuntimeException("Expected " + PRINT_GC_DETAILS +
+            throw new RuntimeException("Expected " + HEAP_DUMP_ON_OOM +
                 " to be writeable");
         }
 
         // set VM option to a new value
-        mbean.setVMOption(PRINT_GC_DETAILS, NEW_VALUE);
+        mbean.setVMOption(HEAP_DUMP_ON_OOM, NEW_VALUE);
 
-        option = findPrintGCDetailsOption();
+        option = findHeapDumpOnOomOption();
         if (!option.getValue().equalsIgnoreCase(NEW_VALUE)) {
             throw new RuntimeException("Unexpected value: " +
                 option.getValue() + " expected: " + NEW_VALUE);
@@ -77,7 +77,7 @@
             throw new RuntimeException("Unexpected origin: " +
                 option.getOrigin() + " expected: MANAGEMENT");
         }
-        VMOption o = mbean.getVMOption(PRINT_GC_DETAILS);
+        VMOption o = mbean.getVMOption(HEAP_DUMP_ON_OOM);
         if (!option.getValue().equals(o.getValue())) {
             throw new RuntimeException("Unmatched value: " +
                 option.getValue() + " expected: " + o.getValue());
@@ -123,17 +123,17 @@
         }
     }
 
-    public static VMOption findPrintGCDetailsOption() {
+    public static VMOption findHeapDumpOnOomOption() {
         List<VMOption> options = mbean.getDiagnosticOptions();
         VMOption gcDetails = null;
         for (VMOption o : options) {
-            if (o.getName().equals(PRINT_GC_DETAILS)) {
+            if (o.getName().equals(HEAP_DUMP_ON_OOM)) {
                  gcDetails = o;
                  break;
             }
         }
         if (gcDetails == null) {
-            throw new RuntimeException("VM option " + PRINT_GC_DETAILS +
+            throw new RuntimeException("VM option " + HEAP_DUMP_ON_OOM +
                 " not found");
         }
         return gcDetails;
--- a/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Fri Dec 18 10:00:55 2015 -0800
@@ -100,7 +100,7 @@
         opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
         opts.add("-cp");
         opts.add(System.getProperty("test.class.path", "test.class.path"));
-        opts.add("-XX:+PrintGCDetails");
+        opts.add("-Xlog:gc*=debug");
         opts.addAll(Arrays.asList(testOpts));
         opts.add(classMain);
 
--- a/test/java/lang/management/MemoryMXBean/RunUtil.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/java/lang/management/MemoryMXBean/RunUtil.java	Fri Dec 18 10:00:55 2015 -0800
@@ -66,7 +66,7 @@
         opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
         opts.add("-cp");
         opts.add(System.getProperty("test.class.path", "test.class.path"));
-        opts.add("-XX:+PrintGCDetails");
+        opts.add("-Xlog:gc*=debug");
 
         if (clearGcOpts) {
             opts = Utils.removeGcOpts(opts);
--- a/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh	Fri Dec 18 10:00:55 2015 -0800
@@ -48,8 +48,8 @@
 
 runOne InputArgument 
 
-runOne -XX:+UseFastJNIAccessors -XX:+PrintGCDetails InputArgument -XX:+PrintGCDetails
-runOne -XX:+UseFastJNIAccessors -XX:+PrintGCDetails InputArgument -XX:+UseFastJNIAccessors
+runOne -XX:+UseFastJNIAccessors -Xlog:gc*=debug InputArgument
+runOne -XX:+UseFastJNIAccessors -Xlog:gc*=debug InputArgument -XX:+UseFastJNIAccessors
 runOne "-Dprops=one two three" InputArgument "-Dprops=one two three"
 
 exit 0
--- a/test/java/math/BigInteger/BigIntegerTest.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/java/math/BigInteger/BigIntegerTest.java	Fri Dec 18 10:00:55 2015 -0800
@@ -26,7 +26,7 @@
  * @library /lib/testlibrary/
  * @build jdk.testlibrary.*
  * @run main BigIntegerTest
- * @bug 4181191 4161971 4227146 4194389 4823171 4624738 4812225 4837946 4026465 8074460 8078672
+ * @bug 4181191 4161971 4227146 4194389 4823171 4624738 4812225 4837946 4026465 8074460 8078672 8032027
  * @summary tests methods in BigInteger (use -Dseed=X to set PRNG seed)
  * @run main/timeout=400 BigIntegerTest
  * @author madbot
@@ -38,8 +38,15 @@
 import java.io.FileOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.Random;
+import java.util.function.ToIntFunction;
+import java.util.stream.Collectors;
+import java.util.stream.DoubleStream;
+import java.util.stream.IntStream;
+import java.util.stream.LongStream;
+import java.util.stream.Stream;
 import jdk.testlibrary.RandomFactory;
 
 /**
@@ -243,6 +250,146 @@
         report("square for " + order + " bits", failCount1);
     }
 
+    private static void printErr(String msg) {
+        System.err.println(msg);
+    }
+
+    private static int checkResult(BigInteger expected, BigInteger actual,
+        String failureMessage) {
+        if (expected.compareTo(actual) != 0) {
+            printErr(failureMessage + " - expected: " + expected
+                + ", actual: " + actual);
+            return 1;
+        }
+        return 0;
+    }
+
+    private static void squareRootSmall() {
+        int failCount = 0;
+
+        // A negative value should cause an exception.
+        BigInteger n = BigInteger.ONE.negate();
+        BigInteger s;
+        try {
+            s = n.sqrt();
+            // If sqrt() does not throw an exception that is a failure.
+            failCount++;
+            printErr("sqrt() of negative number did not throw an exception");
+        } catch (ArithmeticException expected) {
+            // A negative value should cause an exception and is not a failure.
+        }
+
+        // A zero value should return BigInteger.ZERO.
+        failCount += checkResult(BigInteger.ZERO, BigInteger.ZERO.sqrt(),
+            "sqrt(0) != BigInteger.ZERO");
+
+        // 1 <= value < 4 should return BigInteger.ONE.
+        long[] smalls = new long[] {1, 2, 3};
+        for (long small : smalls) {
+            failCount += checkResult(BigInteger.ONE,
+                BigInteger.valueOf(small).sqrt(), "sqrt("+small+") != 1");
+        }
+
+        report("squareRootSmall", failCount);
+    }
+
+    public static void squareRoot() {
+        squareRootSmall();
+
+        ToIntFunction<BigInteger> f = (n) -> {
+            int failCount = 0;
+
+            // square root of n^2 -> n
+            BigInteger n2 = n.pow(2);
+            failCount += checkResult(n, n2.sqrt(), "sqrt() n^2 -> n");
+
+            // square root of n^2 + 1 -> n
+            BigInteger n2up = n2.add(BigInteger.ONE);
+            failCount += checkResult(n, n2up.sqrt(), "sqrt() n^2 + 1 -> n");
+
+            // square root of (n + 1)^2 - 1 -> n
+            BigInteger up =
+                n.add(BigInteger.ONE).pow(2).subtract(BigInteger.ONE);
+            failCount += checkResult(n, up.sqrt(), "sqrt() (n + 1)^2 - 1 -> n");
+
+            // sqrt(n)^2 <= n
+            BigInteger s = n.sqrt();
+            if (s.multiply(s).compareTo(n) > 0) {
+                failCount++;
+                printErr("sqrt(n)^2 > n for n = " + n);
+            }
+
+            // (sqrt(n) + 1)^2 > n
+            if (s.add(BigInteger.ONE).pow(2).compareTo(n) <= 0) {
+                failCount++;
+                printErr("(sqrt(n) + 1)^2 <= n for n = " + n);
+            }
+
+            return failCount;
+        };
+
+        Stream.Builder<BigInteger> sb = Stream.builder();
+        int maxExponent = Double.MAX_EXPONENT + 1;
+        for (int i = 1; i <= maxExponent; i++) {
+            BigInteger p2 = BigInteger.ONE.shiftLeft(i);
+            sb.add(p2.subtract(BigInteger.ONE));
+            sb.add(p2);
+            sb.add(p2.add(BigInteger.ONE));
+        }
+        sb.add((new BigDecimal(Double.MAX_VALUE)).toBigInteger());
+        sb.add((new BigDecimal(Double.MAX_VALUE)).toBigInteger().add(BigInteger.ONE));
+        report("squareRoot for 2^N and 2^N - 1, 1 <= N <= Double.MAX_EXPONENT",
+            sb.build().collect(Collectors.summingInt(f)));
+
+        IntStream ints = random.ints(SIZE, 4, Integer.MAX_VALUE);
+        report("squareRoot for int", ints.mapToObj(x ->
+            BigInteger.valueOf(x)).collect(Collectors.summingInt(f)));
+
+        LongStream longs = random.longs(SIZE, (long)Integer.MAX_VALUE + 1L,
+            Long.MAX_VALUE);
+        report("squareRoot for long", longs.mapToObj(x ->
+            BigInteger.valueOf(x)).collect(Collectors.summingInt(f)));
+
+        DoubleStream doubles = random.doubles(SIZE,
+            (double) Long.MAX_VALUE + 1.0, Math.sqrt(Double.MAX_VALUE));
+        report("squareRoot for double", doubles.mapToObj(x ->
+            BigDecimal.valueOf(x).toBigInteger()).collect(Collectors.summingInt(f)));
+    }
+
+    public static void squareRootAndRemainder() {
+        ToIntFunction<BigInteger> g = (n) -> {
+            int failCount = 0;
+            BigInteger n2 = n.pow(2);
+
+            // square root of n^2 -> n
+            BigInteger[] actual = n2.sqrtAndRemainder();
+            failCount += checkResult(n, actual[0], "sqrtAndRemainder()[0]");
+            failCount += checkResult(BigInteger.ZERO, actual[1],
+                "sqrtAndRemainder()[1]");
+
+            // square root of n^2 + 1 -> n
+            BigInteger n2up = n2.add(BigInteger.ONE);
+            actual = n2up.sqrtAndRemainder();
+            failCount += checkResult(n, actual[0], "sqrtAndRemainder()[0]");
+            failCount += checkResult(BigInteger.ONE, actual[1],
+                "sqrtAndRemainder()[1]");
+
+            // square root of (n + 1)^2 - 1 -> n
+            BigInteger up =
+                n.add(BigInteger.ONE).pow(2).subtract(BigInteger.ONE);
+            actual = up.sqrtAndRemainder();
+            failCount += checkResult(n, actual[0], "sqrtAndRemainder()[0]");
+            BigInteger r = up.subtract(n2);
+            failCount += checkResult(r, actual[1], "sqrtAndRemainder()[1]");
+
+            return failCount;
+        };
+
+        IntStream bits = random.ints(SIZE, 3, Short.MAX_VALUE);
+        report("sqrtAndRemainder", bits.mapToObj(x ->
+            BigInteger.valueOf(x)).collect(Collectors.summingInt(g)));
+    }
+
     public static void arithmetic(int order) {
         int failCount = 0;
 
@@ -1101,6 +1248,9 @@
         square(ORDER_KARATSUBA_SQUARE);
         square(ORDER_TOOM_COOK_SQUARE);
 
+        squareRoot();
+        squareRootAndRemainder();
+
         bitCount();
         bitLength();
         bitOps(order1);
--- a/test/java/nio/file/FileSystem/Basic.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/java/nio/file/FileSystem/Basic.java	Fri Dec 18 10:00:55 2015 -0800
@@ -67,8 +67,6 @@
         } catch (ProviderNotFoundException pnfe) {
             System.out.println("Expected ProviderNotFoundException caught: "
                 + "\"" + pnfe.getMessage() + "\"");
-        } finally {
-            FileUtils.deleteFileWithRetry(path);
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/nio/file/attribute/BasicFileAttributeView/UnixSocketFile.java	Fri Dec 18 10:00:55 2015 -0800
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8139133
+ * @summary Verify ability to set time attributes of socket files with no device
+ * @requires os.family == "linux"
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardWatchEventKinds;
+import java.nio.file.WatchKey;
+import java.nio.file.WatchService;
+import java.nio.file.attribute.BasicFileAttributeView;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.attribute.FileTime;
+
+public class UnixSocketFile {
+    private static final String TEST_SUB_DIR = "UnixSocketFile";
+    private static final String SOCKET_FILE_NAME = "mysocket";
+    private static final String CMD_BASE = "nc -lU";
+
+    public static void main(String[] args)
+        throws InterruptedException, IOException {
+
+        // Create a new sub-directory of the nominal test directory in which
+        // 'nc' will create the socket file.
+        String testSubDir = System.getProperty("test.dir", ".")
+            + File.separator + TEST_SUB_DIR;
+        Path socketTestDir = Paths.get(testSubDir);
+        Files.createDirectory(socketTestDir);
+
+        // Set the path of the socket file.
+        String socketFilePath = testSubDir + File.separator
+            + SOCKET_FILE_NAME;
+
+        // Create a process which executes the nc (netcat) utility to create
+        // a socket file at the indicated location.
+        Process proc;
+        FileSystem fs = FileSystems.getDefault();
+        try (WatchService ws = fs.newWatchService()) {
+            // Watch the test sub-directory to receive notification when an
+            // entry, i.e., the socket file, is added to the sub-directory.
+            WatchKey wk = socketTestDir.register(ws,
+                    StandardWatchEventKinds.ENTRY_CREATE);
+
+            // Execute the 'nc' command.
+            proc = Runtime.getRuntime().exec(CMD_BASE + " " + socketFilePath);
+
+            // Wait until the socket file is created.
+            WatchKey key = ws.take();
+            if (key != wk) {
+                throw new RuntimeException("Unknown entry created - expected: "
+                    + wk.watchable() + ", actual: " + key.watchable());
+            }
+            wk.cancel();
+        }
+
+        // Verify that the socket file in fact exists.
+        Path socketPath = fs.getPath(socketFilePath);
+        if (!Files.exists(socketPath)) {
+            throw new RuntimeException("Socket file " + socketFilePath
+                + " was not created by \"nc\" command.");
+        }
+
+        // Retrieve the most recent access and modification times of the
+        // socket file; print the values.
+        BasicFileAttributeView attributeView = Files.getFileAttributeView(
+                socketPath, BasicFileAttributeView.class);
+        BasicFileAttributes oldAttributes = attributeView.readAttributes();
+        FileTime oldAccessTime = oldAttributes.lastAccessTime();
+        FileTime oldModifiedTime = oldAttributes.lastModifiedTime();
+        System.out.println("Old times: " + oldAccessTime
+            + " " + oldModifiedTime);
+
+        // Calculate the time to which the access and modification times of the
+        // socket file will be changed.
+        FileTime newFileTime =
+            FileTime.fromMillis(oldAccessTime.toMillis() + 1066);
+
+        try {
+            // Set the access and modification times of the socket file.
+            attributeView.setTimes(newFileTime, newFileTime, null);
+
+            // Retrieve the updated access and modification times of the
+            // socket file; print the values.
+            FileTime newAccessTime = null;
+            FileTime newModifiedTime = null;
+            BasicFileAttributes newAttributes = attributeView.readAttributes();
+            newAccessTime = newAttributes.lastAccessTime();
+            newModifiedTime = newAttributes.lastModifiedTime();
+            System.out.println("New times: " + newAccessTime + " "
+                + newModifiedTime);
+
+            // Verify that the updated times have the expected values.
+            if ((newAccessTime != null && !newAccessTime.equals(newFileTime))
+                || (newModifiedTime != null
+                    && !newModifiedTime.equals(newFileTime))) {
+                throw new RuntimeException("Failed to set correct times.");
+            }
+        } finally {
+            // Destry the process running netcat and delete the socket file.
+            proc.destroy();
+            Files.delete(socketPath);
+        }
+    }
+}
--- a/test/java/text/Format/DecimalFormat/FormatMicroBenchmark.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/java/text/Format/DecimalFormat/FormatMicroBenchmark.java	Fri Dec 18 10:00:55 2015 -0800
@@ -51,7 +51,7 @@
  *    getting reliable numbers. Otherwise GC activity may corrupt results.
  *    As of jdk80b48 using "-Xms500m -Xmx500m -XX:NewSize=400m" covers
  *    all cases.
- *  - Optionally using "-XX:+printGC" option provides information that
+ *  - Optionally using "-Xlog:gc" option provides information that
  *    helps checking any GC activity while benches are run.
  *
  * Vm Options:
@@ -60,7 +60,7 @@
  *     non fast-path case:  -Xms500m -Xmx500m -XX:NewSize=400m
  *    or use worst case (non fast-path above) with both types of algorithm.
  *
- *  - use -XX:+PrintGC to verify memory consumption of the benchmarks.
+ *  - use -Xlog:gc to verify memory consumption of the benchmarks.
  *    (See "Checking Memory Consumption" below).
  *
  * Description:
@@ -166,7 +166,7 @@
  *  but  is   not enough,  since  any   unexpected  incremental  GC  may  lower
  *  artificially the estimation of the memory consumption.
  *
- *  Options to  set are -Xms, -Xmx,  -XX:NewSize, plus -XX:+PrintGC to evaluate
+ *  Options to  set are -Xms, -Xmx,  -XX:NewSize, plus -Xlog:gc to evaluate
  *  correctly  the  values of  these options. When  running "-verbose", varying
  *  numbers reported for memory consumption may  indicate bad choices for these
  *  options.
@@ -217,7 +217,7 @@
             "   getting reliable numbers. Otherwise GC activity may corrupt results.\n" +
             "   As of jdk80b48 using \"-Xms500m -Xmx500m -XX:NewSize=400m\" covers \n" +
             "   all cases.\n" +
-            " - Optionally using \"-XX:+printGC\" option provides information that \n" +
+            " - Optionally using \"-Xlog:gc\" option provides information that \n" +
             "   helps checking any GC activity while benches are run.\n\n" +
             "Look at the heading comments and description in source code for " +
             "detailed information.\n");
--- a/test/java/time/tck/java/time/TCKDuration.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/java/time/tck/java/time/TCKDuration.java	Fri Dec 18 10:00:55 2015 -0800
@@ -2475,6 +2475,147 @@
     }
 
     //-----------------------------------------------------------------------
+    // toSeconds()
+    //-----------------------------------------------------------------------
+    @DataProvider(name="toSeconds_provider")
+    Object[][] provider_toSeconds() {
+        return new Object[][] {
+            {Duration.ofSeconds(365 * 86400 + 5 * 3600 + 48 * 60 + 46, 123_456_789), 31556926L},
+            {Duration.ofSeconds(-365 * 86400 - 5 * 3600 - 48 * 60 - 46, -123_456_789), -31556927L},
+            {Duration.ofSeconds(-365 * 86400 - 5 * 3600 - 48 * 60 - 46, 123_456_789), -31556926L},
+            {Duration.ofSeconds(0), 0L},
+            {Duration.ofSeconds(0, 123_456_789), 0L},
+            {Duration.ofSeconds(0, -123_456_789), -1L},
+            {Duration.ofSeconds(Long.MAX_VALUE), 9223372036854775807L},
+            {Duration.ofSeconds(Long.MIN_VALUE), -9223372036854775808L},
+        };
+    }
+
+    @Test(dataProvider="toSeconds_provider")
+    public void test_toSeconds(Duration dur, long seconds) {
+        assertEquals(dur.toSeconds(), seconds);
+    }
+
+    //-----------------------------------------------------------------------
+    // toDaysPart()
+    //-----------------------------------------------------------------------
+    @DataProvider(name="toDaysPart_provider")
+    Object[][] provider_toDaysPart() {
+        return new Object[][] {
+            {Duration.ofSeconds(365 * 86400 + 5 * 3600 + 48 * 60 + 46, 123_456_789), 365L},
+            {Duration.ofSeconds(-365 * 86400 - 5 * 3600 - 48 * 60 - 46, -123_456_789), -365L},
+            {Duration.ofSeconds(5 * 3600 + 48 * 60 + 46, 123_456_789), 0L},
+            {Duration.ofDays(365), 365L},
+            {Duration.ofHours(2), 0L},
+            {Duration.ofHours(-2), 0L},
+        };
+    }
+
+    @Test(dataProvider="toDaysPart_provider")
+    public void test_toDaysPart(Duration dur, long days) {
+        assertEquals(dur.toDaysPart(), days);
+    }
+
+    //-----------------------------------------------------------------------
+    // toHoursPart()
+    //-----------------------------------------------------------------------
+    @DataProvider(name="toHoursPart_provider")
+    Object[][] provider_toHoursPart() {
+        return new Object[][] {
+            {Duration.ofSeconds(365 * 86400 + 5 * 3600 + 48 * 60 + 46, 123_456_789), 5},
+            {Duration.ofSeconds(-365 * 86400 - 5 * 3600 - 48 * 60 - 46, -123_456_789), -5},
+            {Duration.ofSeconds(48 * 60 + 46, 123_456_789), 0},
+            {Duration.ofHours(2), 2},
+            {Duration.ofHours(-2), -2},
+        };
+    }
+
+    @Test(dataProvider="toHoursPart_provider")
+    public void test_toHoursPart(Duration dur, int hours) {
+        assertEquals(dur.toHoursPart(), hours);
+    }
+
+    //-----------------------------------------------------------------------
+    // toMinutesPart()
+    //-----------------------------------------------------------------------
+    @DataProvider(name="toMinutesPart_provider")
+    Object[][] provider_toMinutesPart() {
+        return new Object[][] {
+            {Duration.ofSeconds(365 * 86400 + 5 * 3600 + 48 * 60 + 46, 123_456_789), 48},
+            {Duration.ofSeconds(-365 * 86400 - 5 * 3600 - 48 * 60 - 46, -123_456_789), -48},
+            {Duration.ofSeconds(46, 123_456_789),0},
+            {Duration.ofMinutes(48), 48},
+            {Duration.ofHours(2), 0},
+            {Duration.ofHours(-2),0},
+        };
+    }
+
+    @Test(dataProvider="toMinutesPart_provider")
+    public void test_toMinutesPart(Duration dur, int minutes) {
+        assertEquals(dur.toMinutesPart(), minutes);
+    }
+
+    //-----------------------------------------------------------------------
+    // toSecondsPart()
+    //-----------------------------------------------------------------------
+    @DataProvider(name="toSecondsPart_provider")
+    Object[][] provider_toSecondsPart() {
+        return new Object[][] {
+            {Duration.ofSeconds(365 * 86400 + 5 * 3600 + 48 * 60 + 46, 123_456_789), 46},
+            {Duration.ofSeconds(-365 * 86400 - 5 * 3600 - 48 * 60 - 46, -123_456_789), -47},
+            {Duration.ofSeconds(0, 123_456_789), 0},
+            {Duration.ofSeconds(46), 46},
+            {Duration.ofHours(2), 0},
+            {Duration.ofHours(-2), 0},
+        };
+    }
+
+    @Test(dataProvider="toSecondsPart_provider")
+    public void test_toSecondsPart(Duration dur, int seconds) {
+        assertEquals(dur.toSecondsPart(), seconds);
+    }
+
+    //-----------------------------------------------------------------------
+    // toMillisPart()
+    //-----------------------------------------------------------------------
+    @DataProvider(name="toMillisPart_provider")
+    Object[][] provider_toMillisPart() {
+        return new Object[][] {
+            {Duration.ofSeconds(365 * 86400 + 5 * 3600 + 48 * 60 + 46, 123_456_789), 123},
+            {Duration.ofSeconds(-365 * 86400 - 5 * 3600 - 48 * 60 - 46, -123_456_789), 876},
+            {Duration.ofSeconds(5 * 3600 + 48 * 60 + 46, 0), 0},
+            {Duration.ofMillis(123), 123},
+            {Duration.ofHours(2), 0},
+            {Duration.ofHours(-2), 0},
+        };
+    }
+
+    @Test(dataProvider="toMillisPart_provider")
+    public void test_toMillisPart(Duration dur, int millis) {
+        assertEquals(dur.toMillisPart(), millis);
+    }
+
+    //-----------------------------------------------------------------------
+    // toNanosPart()
+    //-----------------------------------------------------------------------
+    @DataProvider(name="toNanosPart_provider")
+    Object[][] provider_toNanosPart() {
+        return new Object[][] {
+            {Duration.ofSeconds(365 * 86400 + 5 * 3600 + 48 * 60 + 46, 123_456_789), 123_456_789},
+            {Duration.ofSeconds(-365 * 86400 - 5 * 3600 - 48 * 60 - 46, -123_456_789), 876_543_211},
+            {Duration.ofSeconds(5 * 3600 + 48 * 60 + 46, 0), 0},
+            {Duration.ofNanos(123_456_789), 123_456_789},
+            {Duration.ofHours(2), 0},
+            {Duration.ofHours(-2), 0},
+        };
+    }
+
+    @Test(dataProvider="toNanosPart_provider")
+    public void test_toNanosPart(Duration dur, int nanos) {
+        assertEquals(dur.toNanosPart(), nanos);
+    }
+
+    //-----------------------------------------------------------------------
     // compareTo()
     //-----------------------------------------------------------------------
     @Test
--- a/test/java/util/Collection/MOAT.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/java/util/Collection/MOAT.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,6 +58,21 @@
 import java.lang.reflect.*;
 
 public class MOAT {
+    // Collections under test must not be initialized to contain this value,
+    // and maps under test must not contain this value as a key.
+    // It's used as a sentinel for absent-element testing.
+    static final int ABSENT_VALUE = 778347983;
+
+    static final Integer[] integerArray;
+    static {
+        Integer[] ia = new Integer[20];
+        // fill with 1..20 inclusive
+        for (int i = 0; i < ia.length; i++) {
+            ia[i] = i + 1;
+        }
+        integerArray = ia;
+    }
+
     public static void realMain(String[] args) {
 
         testCollection(new NewAbstractCollection<Integer>());
@@ -178,6 +193,70 @@
         equal(singletonMap.size(), 1);
         testMap(singletonMap);
         testImmutableMap(singletonMap);
+
+        // Immutable List
+        testEmptyList(List.of());
+        for (List<Integer> list : Arrays.asList(
+                List.<Integer>of(),
+                List.of(1),
+                List.of(1, 2),
+                List.of(1, 2, 3),
+                List.of(1, 2, 3, 4),
+                List.of(1, 2, 3, 4, 5),
+                List.of(1, 2, 3, 4, 5, 6),
+                List.of(1, 2, 3, 4, 5, 6, 7),
+                List.of(1, 2, 3, 4, 5, 6, 7, 8),
+                List.of(1, 2, 3, 4, 5, 6, 7, 8, 9),
+                List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
+                List.of(integerArray))) {
+            testCollection(list);
+            testImmutableList(list);
+        }
+
+        // Immutable Set
+        testEmptySet(Set.of());
+        for (Set<Integer> set : Arrays.asList(
+                Set.<Integer>of(),
+                Set.of(1),
+                Set.of(1, 2),
+                Set.of(1, 2, 3),
+                Set.of(1, 2, 3, 4),
+                Set.of(1, 2, 3, 4, 5),
+                Set.of(1, 2, 3, 4, 5, 6),
+                Set.of(1, 2, 3, 4, 5, 6, 7),
+                Set.of(1, 2, 3, 4, 5, 6, 7, 8),
+                Set.of(1, 2, 3, 4, 5, 6, 7, 8, 9),
+                Set.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
+                Set.of(integerArray))) {
+            testCollection(set);
+            testImmutableSet(set);
+        }
+
+        // Immutable Map
+
+        @SuppressWarnings("unchecked")
+        Map.Entry<Integer,Integer>[] ea = (Map.Entry<Integer,Integer>[])new Map.Entry<?,?>[20];
+        for (int i = 0; i < ea.length; i++) {
+            ea[i] = Map.entry(i+1, i+101);
+        }
+
+        testEmptyMap(Map.of());
+        for (Map<Integer,Integer> map : Arrays.asList(
+                Map.<Integer,Integer>of(),
+                Map.of(1, 101),
+                Map.of(1, 101, 2, 202),
+                Map.of(1, 101, 2, 202, 3, 303),
+                Map.of(1, 101, 2, 202, 3, 303, 4, 404),
+                Map.of(1, 101, 2, 202, 3, 303, 4, 404, 5, 505),
+                Map.of(1, 101, 2, 202, 3, 303, 4, 404, 5, 505, 6, 606),
+                Map.of(1, 101, 2, 202, 3, 303, 4, 404, 5, 505, 6, 606, 7, 707),
+                Map.of(1, 101, 2, 202, 3, 303, 4, 404, 5, 505, 6, 606, 7, 707, 8, 808),
+                Map.of(1, 101, 2, 202, 3, 303, 4, 404, 5, 505, 6, 606, 7, 707, 8, 808, 9, 909),
+                Map.of(1, 101, 2, 202, 3, 303, 4, 404, 5, 505, 6, 606, 7, 707, 8, 808, 9, 909, 10, 1010),
+                Map.ofEntries(ea))) {
+            testMap(map);
+            testImmutableMap(map);
+        }
     }
 
     private static void checkContainsSelf(Collection<Integer> c) {
@@ -190,6 +269,17 @@
         check(c.containsAll(new ArrayList<Integer>()));
     }
 
+    private static void checkUnique(Set<Integer> s) {
+        for (Integer i : s) {
+            int count = 0;
+            for (Integer j : s) {
+                if (Objects.equals(i,j))
+                    ++count;
+            }
+            check(count == 1);
+        }
+    }
+
     private static <T> void testEmptyCollection(Collection<T> c) {
         check(c.isEmpty());
         equal(c.size(), 0);
@@ -330,19 +420,19 @@
     }
 
     private static boolean supportsAdd(Collection<Integer> c) {
-        try { check(c.add(778347983)); }
+        try { check(c.add(ABSENT_VALUE)); }
         catch (UnsupportedOperationException t) { return false; }
         catch (Throwable t) { unexpected(t); }
 
         try {
-            check(c.contains(778347983));
-            check(c.remove(778347983));
+            check(c.contains(ABSENT_VALUE));
+            check(c.remove(ABSENT_VALUE));
         } catch (Throwable t) { unexpected(t); }
         return true;
     }
 
     private static boolean supportsRemove(Collection<Integer> c) {
-        try { check(! c.remove(19134032)); }
+        try { check(! c.remove(ABSENT_VALUE)); }
         catch (UnsupportedOperationException t) { return false; }
         catch (Throwable t) { unexpected(t); }
         return true;
@@ -359,6 +449,7 @@
             checkContainsSelf(c);
             checkContainsEmpty(c);
             check(c.size() != 0 ^ c.isEmpty());
+            check(! c.contains(ABSENT_VALUE));
 
             {
                 int size = 0;
@@ -366,6 +457,10 @@
                 check(c.size() == size);
             }
 
+            if (c instanceof Set) {
+                checkUnique((Set<Integer>)c);
+            }
+
             check(c.toArray().length == c.size());
             check(c.toArray().getClass() == Object[].class
                   ||
@@ -861,6 +956,20 @@
         checkFunctionalInvariants(m.keySet());
         checkFunctionalInvariants(m.values());
         check(m.size() != 0 ^ m.isEmpty());
+        check(! m.containsKey(ABSENT_VALUE));
+
+        if (m instanceof Serializable) {
+            //System.out.printf("Serializing %s%n", m.getClass().getName());
+            try {
+                Object clone = serialClone(m);
+                equal(m instanceof Serializable,
+                      clone instanceof Serializable);
+                equal(m, clone);
+            } catch (Error xxx) {
+                if (! (xxx.getCause() instanceof NotSerializableException))
+                    throw xxx;
+            }
+        }
     }
 
     private static void testMap(Map<Integer,Integer> m) {
@@ -910,13 +1019,13 @@
         // We're asking for .equals(...) semantics
         if (m instanceof IdentityHashMap) return false;
 
-        try { check(m.put(778347983,12735) == null); }
+        try { check(m.put(ABSENT_VALUE,12735) == null); }
         catch (UnsupportedOperationException t) { return false; }
         catch (Throwable t) { unexpected(t); }
 
         try {
-            check(m.containsKey(778347983));
-            check(m.remove(778347983) != null);
+            check(m.containsKey(ABSENT_VALUE));
+            check(m.remove(ABSENT_VALUE) != null);
         } catch (Throwable t) { unexpected(t); }
         return true;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/Collection/SetFactories.java	Fri Dec 18 10:00:55 2015 -0800
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+/*
+ * @test
+ * @bug 8048330
+ * @summary Test convenience static factory methods on Set.
+ * @run testng SetFactories
+ */
+
+
+public class SetFactories {
+
+    static final int NUM_STRINGS = 20; // should be larger than the largest fixed-arg overload
+    static final String[] stringArray;
+    static {
+        String[] sa = new String[NUM_STRINGS];
+        for (int i = 0; i < NUM_STRINGS; i++) {
+            sa[i] = String.valueOf((char)('a' + i));
+        }
+        stringArray = sa;
+    }
+
+    static Object[] a(Set<String> act, Set<String> exp) {
+        return new Object[] { act, exp };
+    }
+
+    static Set<String> hashSetOf(String... args) {
+        return new HashSet<>(Arrays.asList(args));
+    }
+
+    @DataProvider(name="empty")
+    public Iterator<Object[]> empty() {
+        return Collections.singletonList(
+            // actual, expected
+            a(Set.of(), Collections.emptySet())
+        ).iterator();
+    }
+
+    @DataProvider(name="nonempty")
+    public Iterator<Object[]> nonempty() {
+        return Arrays.asList(
+            // actual, expected
+            a(   Set.of("a"),
+              hashSetOf("a")),
+            a(   Set.of("a", "b"),
+              hashSetOf("a", "b")),
+            a(   Set.of("a", "b", "c"),
+              hashSetOf("a", "b", "c")),
+            a(   Set.of("a", "b", "c", "d"),
+              hashSetOf("a", "b", "c", "d")),
+            a(   Set.of("a", "b", "c", "d", "e"),
+              hashSetOf("a", "b", "c", "d", "e")),
+            a(   Set.of("a", "b", "c", "d", "e", "f"),
+              hashSetOf("a", "b", "c", "d", "e", "f")),
+            a(   Set.of("a", "b", "c", "d", "e", "f", "g"),
+              hashSetOf("a", "b", "c", "d", "e", "f", "g")),
+            a(   Set.of("a", "b", "c", "d", "e", "f", "g", "h"),
+              hashSetOf("a", "b", "c", "d", "e", "f", "g", "h")),
+            a(   Set.of("a", "b", "c", "d", "e", "f", "g", "h", "i"),
+              hashSetOf("a", "b", "c", "d", "e", "f", "g", "h", "i")),
+            a(   Set.of("a", "b", "c", "d", "e", "f", "g", "h", "i", "j"),
+              hashSetOf("a", "b", "c", "d", "e", "f", "g", "h", "i", "j")),
+            a(   Set.of(stringArray),
+              hashSetOf(stringArray))
+        ).iterator();
+    }
+
+    @DataProvider(name="all")
+    public Iterator<Object[]> all() {
+        List<Object[]> all = new ArrayList<>();
+        empty().forEachRemaining(all::add);
+        nonempty().forEachRemaining(all::add);
+        return all.iterator();
+    }
+
+    @Test(dataProvider="all", expectedExceptions=UnsupportedOperationException.class)
+    public void cannotAdd(Set<String> act, Set<String> exp) {
+        act.add("x");
+    }
+
+    @Test(dataProvider="nonempty", expectedExceptions=UnsupportedOperationException.class)
+    public void cannotRemove(Set<String> act, Set<String> exp) {
+        act.remove(act.iterator().next());
+    }
+
+    @Test(dataProvider="all")
+    public void contentsMatch(Set<String> act, Set<String> exp) {
+        assertEquals(act, exp);
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupsDisallowed2() {
+        Set<String> set = Set.of("a", "a");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupsDisallowed3() {
+        Set<String> set = Set.of("a", "b", "a");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupsDisallowed4() {
+        Set<String> set = Set.of("a", "b", "c", "a");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupsDisallowed5() {
+        Set<String> set = Set.of("a", "b", "c", "d", "a");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupsDisallowed6() {
+        Set<String> set = Set.of("a", "b", "c", "d", "e", "a");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupsDisallowed7() {
+        Set<String> set = Set.of("a", "b", "c", "d", "e", "f", "a");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupsDisallowed8() {
+        Set<String> set = Set.of("a", "b", "c", "d", "e", "f", "g", "a");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupsDisallowed9() {
+        Set<String> set = Set.of("a", "b", "c", "d", "e", "f", "g", "h", "a");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupsDisallowed10() {
+        Set<String> set = Set.of("a", "b", "c", "d", "e", "f", "g", "h", "i", "a");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupsDisallowedN() {
+        String[] array = stringArray.clone();
+        array[0] = array[1];
+        Set<String> set = Set.of(array);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed1() {
+        Set.of((String)null); // force one-arg overload
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed2a() {
+        Set.of("a", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed2b() {
+        Set.of(null, "b");
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed3() {
+        Set.of("a", "b", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed4() {
+        Set.of("a", "b", "c", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed5() {
+        Set.of("a", "b", "c", "d", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed6() {
+        Set.of("a", "b", "c", "d", "e", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed7() {
+        Set.of("a", "b", "c", "d", "e", "f", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed8() {
+        Set.of("a", "b", "c", "d", "e", "f", "g", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed9() {
+        Set.of("a", "b", "c", "d", "e", "f", "g", "h", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed10() {
+        Set.of("a", "b", "c", "d", "e", "f", "g", "h", "i", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowedN() {
+        String[] array = stringArray.clone();
+        array[0] = null;
+        Set.of(array);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullArrayDisallowed() {
+        Set.of((Object[])null);
+    }
+
+    @Test(dataProvider="all")
+    public void serialEquality(Set<String> act, Set<String> exp) {
+        // assume that act.equals(exp) tested elsewhere
+        Set<String> copy = serialClone(act);
+        assertEquals(act, copy);
+        assertEquals(copy, exp);
+    }
+
+    @SuppressWarnings("unchecked")
+    static <T> T serialClone(T obj) {
+        try {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            ObjectOutputStream oos = new ObjectOutputStream(baos);
+            oos.writeObject(obj);
+            oos.close();
+            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+            ObjectInputStream ois = new ObjectInputStream(bais);
+            return (T) ois.readObject();
+        } catch (IOException | ClassNotFoundException e) {
+            throw new AssertionError(e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/List/ListFactories.java	Fri Dec 18 10:00:55 2015 -0800
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static java.util.Arrays.asList;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+/*
+ * @test
+ * @bug 8048330
+ * @summary Test convenience static factory methods on List.
+ * @run testng ListFactories
+ */
+
+public class ListFactories {
+
+    static final int NUM_STRINGS = 20; // should be larger than the largest fixed-arg overload
+    static final String[] stringArray;
+    static {
+        String[] sa = new String[NUM_STRINGS];
+        for (int i = 0; i < NUM_STRINGS; i++) {
+            sa[i] = String.valueOf((char)('a' + i));
+        }
+        stringArray = sa;
+    }
+
+    // returns array of [actual, expected]
+    static Object[] a(List<String> act, List<String> exp) {
+        return new Object[] { act, exp };
+    }
+
+    @DataProvider(name="empty")
+    public Iterator<Object[]> empty() {
+        return Collections.singletonList(
+            a(List.of(), Collections.emptyList())
+        ).iterator();
+    }
+
+    @DataProvider(name="nonempty")
+    public Iterator<Object[]> nonempty() {
+        return asList(
+            a(List.of("a"),
+               asList("a")),
+            a(List.of("a", "b"),
+               asList("a", "b")),
+            a(List.of("a", "b", "c"),
+               asList("a", "b", "c")),
+            a(List.of("a", "b", "c", "d"),
+               asList("a", "b", "c", "d")),
+            a(List.of("a", "b", "c", "d", "e"),
+               asList("a", "b", "c", "d", "e")),
+            a(List.of("a", "b", "c", "d", "e", "f"),
+               asList("a", "b", "c", "d", "e", "f")),
+            a(List.of("a", "b", "c", "d", "e", "f", "g"),
+               asList("a", "b", "c", "d", "e", "f", "g")),
+            a(List.of("a", "b", "c", "d", "e", "f", "g", "h"),
+               asList("a", "b", "c", "d", "e", "f", "g", "h")),
+            a(List.of("a", "b", "c", "d", "e", "f", "g", "h", "i"),
+               asList("a", "b", "c", "d", "e", "f", "g", "h", "i")),
+            a(List.of("a", "b", "c", "d", "e", "f", "g", "h", "i", "j"),
+               asList("a", "b", "c", "d", "e", "f", "g", "h", "i", "j")),
+            a(List.of(stringArray),
+               asList(stringArray))
+        ).iterator();
+    }
+
+    @DataProvider(name="all")
+    public Iterator<Object[]> all() {
+        List<Object[]> all = new ArrayList<>();
+        empty().forEachRemaining(all::add);
+        nonempty().forEachRemaining(all::add);
+        return all.iterator();
+    }
+
+    @Test(dataProvider="all", expectedExceptions=UnsupportedOperationException.class)
+    public void cannotAddLast(List<String> act, List<String> exp) {
+        act.add("x");
+    }
+
+    @Test(dataProvider="all", expectedExceptions=UnsupportedOperationException.class)
+    public void cannotAddFirst(List<String> act, List<String> exp) {
+        act.add(0, "x");
+    }
+
+    @Test(dataProvider="nonempty", expectedExceptions=UnsupportedOperationException.class)
+    public void cannotRemove(List<String> act, List<String> exp) {
+        act.remove(0);
+    }
+
+    @Test(dataProvider="nonempty", expectedExceptions=UnsupportedOperationException.class)
+    public void cannotSet(List<String> act, List<String> exp) {
+        act.set(0, "x");
+    }
+
+    @Test(dataProvider="all")
+    public void contentsMatch(List<String> act, List<String> exp) {
+        assertEquals(act, exp);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed1() {
+        List.of((Object)null); // force one-arg overload
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed2a() {
+        List.of("a", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed2b() {
+        List.of(null, "b");
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed3() {
+        List.of("a", "b", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed4() {
+        List.of("a", "b", "c", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed5() {
+        List.of("a", "b", "c", "d", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed6() {
+        List.of("a", "b", "c", "d", "e", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed7() {
+        List.of("a", "b", "c", "d", "e", "f", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed8() {
+        List.of("a", "b", "c", "d", "e", "f", "g", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed9() {
+        List.of("a", "b", "c", "d", "e", "f", "g", "h", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowed10() {
+        List.of("a", "b", "c", "d", "e", "f", "g", "h", "i", null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullDisallowedN() {
+        String[] array = stringArray.clone();
+        array[0] = null;
+        List.of(array);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullArrayDisallowed() {
+        List.of((Object[])null);
+    }
+
+    @Test
+    public void ensureArrayCannotModifyList() {
+        String[] array = stringArray.clone();
+        List<String> list = List.of(array);
+        array[0] = "xyzzy";
+        assertEquals(list, Arrays.asList(stringArray));
+    }
+
+    @Test(dataProvider="all")
+    public void serialEquality(List<String> act, List<String> exp) {
+        // assume that act.equals(exp) tested elsewhere
+        List<String> copy = serialClone(act);
+        assertEquals(act, copy);
+        assertEquals(copy, exp);
+    }
+
+    @SuppressWarnings("unchecked")
+    static <T> T serialClone(T obj) {
+        try {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            ObjectOutputStream oos = new ObjectOutputStream(baos);
+            oos.writeObject(obj);
+            oos.close();
+            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+            ObjectInputStream ois = new ObjectInputStream(bais);
+            return (T) ois.readObject();
+        } catch (IOException | ClassNotFoundException e) {
+            throw new AssertionError(e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/Map/MapFactories.java	Fri Dec 18 10:00:55 2015 -0800
@@ -0,0 +1,389 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.AbstractMap;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+/*
+ * @test
+ * @bug 8048330
+ * @summary Test convenience static factory methods on Map.
+ * @run testng MapFactories
+ */
+
+public class MapFactories {
+
+    static final int MAX_ENTRIES = 20; // should be larger than the largest fixed-arg overload
+    static String valueFor(int i) {
+        // the String literal below should be of length MAX_ENTRIES
+        return "abcdefghijklmnopqrst".substring(i, i+1);
+    }
+
+    // for "expected" values
+    Map<Integer,String> genMap(int n) {
+        Map<Integer,String> result = new HashMap<>();
+        for (int i = 0; i < n; i++) {
+            result.put(i, valueFor(i));
+        }
+        return result;
+    }
+
+    // for varargs Map.Entry methods
+    @SuppressWarnings("unchecked")
+    Map.Entry<Integer,String>[] genEntries(int n) {
+        return IntStream.range(0, n)
+            .mapToObj(i -> Map.entry(i, valueFor(i)))
+            .toArray(Map.Entry[]::new);
+    }
+
+    // returns array of [actual, expected]
+    static Object[] a(Map<Integer,String> act, Map<Integer,String> exp) {
+        return new Object[] { act, exp };
+    }
+
+    @DataProvider(name="empty")
+    public Iterator<Object[]> empty() {
+        return Collections.singletonList(
+            a(Map.of(), genMap(0))
+        ).iterator();
+    }
+
+    @DataProvider(name="nonempty")
+    @SuppressWarnings("unchecked")
+    public Iterator<Object[]> nonempty() {
+        return Arrays.asList(
+            a(Map.of(0, "a"), genMap(1)),
+            a(Map.of(0, "a", 1, "b"), genMap(2)),
+            a(Map.of(0, "a", 1, "b", 2, "c"), genMap(3)),
+            a(Map.of(0, "a", 1, "b", 2, "c", 3, "d"), genMap(4)),
+            a(Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e"), genMap(5)),
+            a(Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f"), genMap(6)),
+            a(Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6, "g"), genMap(7)),
+            a(Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6, "g", 7, "h"), genMap(8)),
+            a(Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6, "g", 7, "h", 8, "i"), genMap(9)),
+            a(Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e", 5, "f", 6, "g", 7, "h", 8, "i", 9, "j"), genMap(10)),
+            a(Map.ofEntries(genEntries(MAX_ENTRIES)), genMap(MAX_ENTRIES))
+        ).iterator();
+    }
+
+    @DataProvider(name="all")
+    public Iterator<Object[]> all() {
+        List<Object[]> all = new ArrayList<>();
+        empty().forEachRemaining(all::add);
+        nonempty().forEachRemaining(all::add);
+        return all.iterator();
+    }
+
+    @Test(dataProvider="all", expectedExceptions=UnsupportedOperationException.class)
+    public void cannotPutNew(Map<Integer,String> act, Map<Integer,String> exp) {
+        act.put(-1, "xyzzy");
+    }
+
+    @Test(dataProvider="nonempty", expectedExceptions=UnsupportedOperationException.class)
+    public void cannotPutOld(Map<Integer,String> act, Map<Integer,String> exp) {
+        act.put(0, "a");
+    }
+
+    @Test(dataProvider="nonempty", expectedExceptions=UnsupportedOperationException.class)
+    public void cannotRemove(Map<Integer,String> act, Map<Integer,String> exp) {
+        act.remove(act.keySet().iterator().next());
+    }
+
+    @Test(dataProvider="all")
+    public void contentsMatch(Map<Integer,String> act, Map<Integer,String> exp) {
+        assertEquals(act, exp);
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupKeysDisallowed2() {
+        Map<Integer, String> map = Map.of(0, "a", 0, "b");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupKeysDisallowed3() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 0, "c");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupKeysDisallowed4() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 0, "d");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupKeysDisallowed5() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 0, "e");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupKeysDisallowed6() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          0, "f");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupKeysDisallowed7() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          5, "f", 0, "g");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupKeysDisallowed8() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          5, "f", 6, "g", 0, "h");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupKeysDisallowed9() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          5, "f", 6, "g", 7, "h", 0, "i");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupKeysDisallowed10() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          5, "f", 6, "g", 7, "h", 8, "i", 0, "j");
+    }
+
+    @Test(expectedExceptions=IllegalArgumentException.class)
+    public void dupKeysDisallowedN() {
+        Map.Entry<Integer,String>[] entries = genEntries(MAX_ENTRIES);
+        entries[MAX_ENTRIES-1] = Map.entry(0, "xxx");
+        Map<Integer, String> map = Map.ofEntries(entries);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullKeyDisallowed1() {
+        Map<Integer, String> map = Map.of(null, "a");
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullValueDisallowed1() {
+        Map<Integer, String> map = Map.of(0, null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullKeyDisallowed2() {
+        Map<Integer, String> map = Map.of(0, "a", null, "b");
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullValueDisallowed2() {
+        Map<Integer, String> map = Map.of(0, "a", 1, null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullKeyDisallowed3() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", null, "c");
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullValueDisallowed3() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullKeyDisallowed4() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", null, "d");
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullValueDisallowed4() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullKeyDisallowed5() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", null, "e");
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullValueDisallowed5() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullKeyDisallowed6() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          null, "f");
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullValueDisallowed6() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          5, null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullKeyDisallowed7() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          5, "f", null, "g");
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullValueDisallowed7() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          5, "f", 6, null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullKeyDisallowed8() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          5, "f", 6, "g", null, "h");
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullValueDisallowed8() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          5, "f", 6, "g", 7, null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullKeyDisallowed9() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          5, "f", 6, "g", 7, "h", null, "i");
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullValueDisallowed9() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          5, "f", 6, "g", 7, "h", 8, null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullKeyDisallowed10() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          5, "f", 6, "g", 7, "h", 8, "i", null, "j");
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullValueDisallowed10() {
+        Map<Integer, String> map = Map.of(0, "a", 1, "b", 2, "c", 3, "d", 4, "e",
+                                          5, "f", 6, "g", 7, "h", 8, "i", 9, null);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullKeyDisallowedN() {
+        Map.Entry<Integer,String>[] entries = genEntries(MAX_ENTRIES);
+        entries[0] = new AbstractMap.SimpleImmutableEntry(null, "a");
+        Map<Integer, String> map = Map.ofEntries(entries);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullValueDisallowedN() {
+        Map.Entry<Integer,String>[] entries = genEntries(MAX_ENTRIES);
+        entries[0] = new AbstractMap.SimpleImmutableEntry(0, null);
+        Map<Integer, String> map = Map.ofEntries(entries);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullEntryDisallowedN() {
+        Map.Entry<Integer,String>[] entries = genEntries(MAX_ENTRIES);
+        entries[5] = null;
+        Map<Integer, String> map = Map.ofEntries(entries);
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void nullArrayDisallowed() {
+        Map.ofEntries(null);
+    }
+
+    @Test(dataProvider="all")
+    public void serialEquality(Map<Integer, String> act, Map<Integer, String> exp) {
+        // assume that act.equals(exp) tested elsewhere
+        Map<Integer, String> copy = serialClone(act);
+        assertEquals(act, copy);
+        assertEquals(copy, exp);
+    }
+
+    @SuppressWarnings("unchecked")
+    static <T> T serialClone(T obj) {
+        try {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            ObjectOutputStream oos = new ObjectOutputStream(baos);
+            oos.writeObject(obj);
+            oos.close();
+            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+            ObjectInputStream ois = new ObjectInputStream(bais);
+            return (T) ois.readObject();
+        } catch (IOException | ClassNotFoundException e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    // Map.entry() tests
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void entryWithNullKeyDisallowed() {
+        Map.Entry<Integer,String> e = Map.entry(null, "x");
+    }
+
+    @Test(expectedExceptions=NullPointerException.class)
+    public void entryWithNullValueDisallowed() {
+        Map.Entry<Integer,String> e = Map.entry(0, null);
+    }
+
+    @Test
+    public void entryBasicTests() {
+        Map.Entry<String,String> kvh1 = Map.entry("xyzzy", "plugh");
+        Map.Entry<String,String> kvh2 = Map.entry("foobar", "blurfl");
+        Map.Entry<String,String> sie = new AbstractMap.SimpleImmutableEntry("xyzzy", "plugh");
+
+        assertTrue(kvh1.equals(sie));
+        assertTrue(sie.equals(kvh1));
+        assertFalse(kvh2.equals(sie));
+        assertFalse(sie.equals(kvh2));
+        assertEquals(sie.hashCode(), kvh1.hashCode());
+        assertEquals(sie.toString(), kvh1.toString());
+    }
+
+    // compile-time test of wildcards
+    @Test
+    public void entryWildcardTests() {
+        Map.Entry<Integer,Double> e1 = Map.entry(1, 2.0);
+        Map.Entry<Float,Long> e2 = Map.entry(3.0f, 4L);
+        Map<Number,Number> map = Map.ofEntries(e1, e2);
+        assertEquals(map.size(), 2);
+    }
+
+}
--- a/test/java/util/WeakHashMap/GCDuringIteration.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/java/util/WeakHashMap/GCDuringIteration.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,13 +24,17 @@
 /*
  * @test
  * @bug 6499848
+ * @library /lib/testlibrary/
+ * @build jdk.testlibrary.RandomFactory
+ * @run main GCDuringIteration
  * @summary Check that iterators work properly in the presence of
  *          concurrent finalization and removal of elements.
- * @key randomness
+ * @key randomness intermittent
  */
 
 import java.util.*;
 import java.util.concurrent.CountDownLatch;
+import jdk.testlibrary.RandomFactory;
 
 public class GCDuringIteration {
     private static void waitForFinalizersToRun() {
@@ -65,8 +69,9 @@
         equal(map.values().iterator().next(), v);
     }
 
+    static final Random rnd = RandomFactory.getRandom();
+
     void checkIterator(final Iterator<Map.Entry<Foo, Integer>> it, int first) {
-        final Random rnd = new Random();
         for (int i = first; i >= 0; --i) {
             if (rnd.nextBoolean()) check(it.hasNext());
             equal(it.next().getValue(), i);
@@ -86,7 +91,7 @@
         final int n = 10;
         // Create array of strong refs
         final Foo[] foos = new Foo[2*n];
-        final Map<Foo,Integer> map = new WeakHashMap<Foo,Integer>(foos.length);
+        final Map<Foo,Integer> map = new WeakHashMap<>(foos.length);
         check(map.isEmpty());
         equal(map.size(), 0);
 
--- a/test/java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,10 @@
  * @test
  * @bug 6450200
  * @summary Test proper handling of pool state changes
+ * @library /lib/testlibrary/
+ * @build jdk.testlibrary.RandomFactory
  * @run main/othervm ConfigChanges
+ * @key randomness intermittent
  * @author Martin Buchholz
  */
 
@@ -42,11 +45,12 @@
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.atomic.AtomicInteger;
+import jdk.testlibrary.RandomFactory;
 
 public class ConfigChanges {
     static final ThreadGroup tg = new ThreadGroup("pool");
 
-    static final Random rnd = new Random();
+    static final Random rnd = RandomFactory.getRandom();
 
     static void report(ThreadPoolExecutor tpe) {
         try {
--- a/test/java/util/logging/HigherResolutionTimeStamps/LogRecordWithNanosAPI.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/java/util/logging/HigherResolutionTimeStamps/LogRecordWithNanosAPI.java	Fri Dec 18 10:00:55 2015 -0800
@@ -33,7 +33,7 @@
 
 /**
  * @test
- * @bug 8072645
+ * @bug 8072645 8144262
  * @summary tests the new methods added to LogRecord.
  * @run main LogRecordWithNanosAPI
  * @author danielfuchs
@@ -299,10 +299,37 @@
 
         try {
             record.setInstant(null);
+            throw new RuntimeException("Expected NullPointerException not thrown");
         } catch (NullPointerException x) {
             System.out.println("Got expected NPE when trying to call record.setInstant(null): " + x);
         }
 
+        // This instant is the biggest for which toEpochMilli will not throw...
+        final Instant max = Instant.ofEpochMilli(Long.MAX_VALUE).plusNanos(999_999L);
+        record.setInstant(max);
+        assertEquals(Long.MAX_VALUE / 1000L,
+                     record.getInstant().getEpochSecond(),
+                     "max instant seconds [record.getInstant().getEpochSecond()]");
+        assertEquals(Long.MAX_VALUE,
+                     record.getInstant().toEpochMilli(),
+                     "max instant millis [record.getInstant().toEpochMilli()]");
+        assertEquals(Long.MAX_VALUE, record.getMillis(),
+                     "max instant millis [record.getMillis()]");
+        assertEquals((Long.MAX_VALUE % 1000L)*1000_000L + 999_999L,
+                     record.getInstant().getNano(),
+                     "max instant nanos [record.getInstant().getNano()]");
+
+        // Too big by 1 ns.
+        final Instant tooBig = max.plusNanos(1L);
+        try {
+            record.setInstant(tooBig);
+            throw new RuntimeException("Expected ArithmeticException not thrown");
+        } catch (ArithmeticException x) {
+            System.out.println("Got expected ArithmeticException when trying"
+                    + " to call record.setInstant(Instant.ofEpochMilli(Long.MAX_VALUE)"
+                    + ".plusNanos(999_999L).plusNanos(1L)): " + x);
+        }
+
     }
 
 }
--- a/test/java/util/regex/RegExTest.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/java/util/regex/RegExTest.java	Fri Dec 18 10:00:55 2015 -0800
@@ -32,7 +32,7 @@
  * 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133
  * 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
  * 7067045 7014640 7189363 8007395 8013252 8013254 8012646 8023647 6559590
- * 8027645 8035076 8039124 8035975 8074678 6854417
+ * 8027645 8035076 8039124 8035975 8074678 6854417 8143854
  * @library /lib/testlibrary
  * @build jdk.testlibrary.*
  * @run main RegExTest
@@ -3568,7 +3568,7 @@
 
                 // Avoid patterns that start and end with the same substring
                 // See JDK-6854417
-                for (int x=1; x <patternLength; x++) {
+                for (int x=1; x < pattern.length(); x++) {
                     if (pattern.startsWith(pattern.substring(x)))
                         continue retry;
                 }
--- a/test/lib/testlibrary/jdk/testlibrary/Asserts.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/lib/testlibrary/jdk/testlibrary/Asserts.java	Fri Dec 18 10:00:55 2015 -0800
@@ -42,7 +42,11 @@
  * multiple times, then the line number won't provide enough context to
  * understand the failure.
  * </pre>
+ *
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib}
  */
+@Deprecated
 public class Asserts {
 
     /**
--- a/test/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java	Fri Dec 18 10:00:55 2015 -0800
@@ -27,6 +27,11 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+/**
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib}
+ */
+@Deprecated
 public final class JDKToolFinder {
 
     private JDKToolFinder() {
--- a/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java	Fri Dec 18 10:00:55 2015 -0800
@@ -38,15 +38,17 @@
  * <pre>
  * {@code
  * JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
- *                                       .addVMArg("-XX:+PrintGC");
- *                                       .addVMArg("-XX:+PrintGCDetails")
+ *                                       .addVMArg("-Xlog:gc*=debug")
  *                                       .addToolArg("-heap")
  *                                       .addToolArg(pid);
  * ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
  * Process p = pb.start();
  * }
  * </pre>
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib}
  */
+@Deprecated
 public class JDKToolLauncher {
     private final String executable;
     private final List<String> vmArgs = new ArrayList<String>();
--- a/test/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java	Fri Dec 18 10:00:55 2015 -0800
@@ -33,7 +33,12 @@
 
 /**
  * Utility class for verifying output and exit value from a {@code Process}.
+ *
+ * @deprecated  This class is deprecated. Use the one from
+ *              {@code <root>/test/lib/share/classes/jdk/test/lib/process}
+ *
  */
+@Deprecated
 public final class OutputAnalyzer {
     private final OutputBuffer output;
     private final String stdout;
--- a/test/lib/testlibrary/jdk/testlibrary/OutputBuffer.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/lib/testlibrary/jdk/testlibrary/OutputBuffer.java	Fri Dec 18 10:00:55 2015 -0800
@@ -28,6 +28,11 @@
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 
+/**
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib/process}
+ */
+@Deprecated
 class OutputBuffer {
     private static class OutputBufferException extends RuntimeException {
         private static final long serialVersionUID = 8528687792643129571L;
--- a/test/lib/testlibrary/jdk/testlibrary/Platform.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/lib/testlibrary/jdk/testlibrary/Platform.java	Fri Dec 18 10:00:55 2015 -0800
@@ -27,6 +27,11 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 
+/**
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib}
+ */
+@Deprecated
 public class Platform {
     private static final String osName      = System.getProperty("os.name");
     private static final String dataModel   = System.getProperty("sun.arch.data.model");
--- a/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java	Fri Dec 18 10:00:55 2015 -0800
@@ -27,8 +27,6 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -42,6 +40,12 @@
 import java.util.function.Consumer;
 import java.util.stream.Collectors;
 
+
+/**
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib/process}
+ */
+@Deprecated
 public final class ProcessTools {
     private static final class LineForwarder extends StreamPumper.LinePump {
         private final PrintStream ps;
--- a/test/lib/testlibrary/jdk/testlibrary/StreamPumper.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/lib/testlibrary/jdk/testlibrary/StreamPumper.java	Fri Dec 18 10:00:55 2015 -0800
@@ -34,6 +34,11 @@
 import java.util.concurrent.FutureTask;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+/**
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib/process}
+ */
+@Deprecated
 public final class StreamPumper implements Runnable {
 
     private static final int BUF_SIZE = 256;
--- a/test/lib/testlibrary/jdk/testlibrary/Utils.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/lib/testlibrary/jdk/testlibrary/Utils.java	Fri Dec 18 10:00:55 2015 -0800
@@ -41,7 +41,11 @@
 
 /**
  * Common library for various test helper functions.
+ *
+ * @deprecated This class is deprecated. Use the one from
+ *             {@code <root>/test/lib/share/classes/jdk/test/lib}
  */
+@Deprecated
 public final class Utils {
 
     /**
--- a/test/sun/invoke/anon/ConstantPoolPatch/OptimalMapSize.java	Thu Dec 17 10:03:30 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @bug 8080535
- * @summary Static storages should be initialized with optimal capacity
- * @library /lib/testlibrary
- * @build jdk.testlibrary.OptimalCapacity
- * @run main OptimalMapSize
- */
-
-import jdk.testlibrary.OptimalCapacity;
-
-public class OptimalMapSize {
-    public static void main(String[] args) throws Throwable {
-        OptimalCapacity.ofIdentityHashMap(
-                Class.forName("sun.invoke.anon.ConstantPoolPatch"),
-                "CONSTANT_VALUE_CLASS_TAG", 6);
-    }
-}
--- a/test/sun/management/jmxremote/startstop/JMXStatusTest.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/sun/management/jmxremote/startstop/JMXStatusTest.java	Fri Dec 18 10:00:55 2015 -0800
@@ -33,7 +33,7 @@
 
 /**
  * @test
- * @bug 8023093 8138748
+ * @bug 8023093 8138748 8142398
  * @summary Performs a sanity test for the ManagementAgent.status diagnostic command.
  *          Management agent may be disabled, started (only local connections) and started.
  *          The test asserts that the expected text is being printed.
@@ -56,7 +56,8 @@
         "Connection Type\\s*\\:\\s*local\\n+" +
         "Protocol\\s*\\:\\s*[a-z]+\\n+" +
         "Host\\s*\\:\\s*.+\\n+" +
-        "URL\\s*\\:\\s*service\\:jmx\\:.+",
+        "URL\\s*\\:\\s*service\\:jmx\\:.+\\n+" +
+        "Properties\\s*\\:\\n+(\\s*\\S+\\s*=\\s*\\S+(\\s+\\[default\\])?\\n*)+",
         Pattern.MULTILINE
     );
 
@@ -67,7 +68,7 @@
         "Protocol\\s*\\: [a-z]+\\n+" +
         "Host\\s*\\: .+\\n+" +
         "URL\\s*\\: service\\:jmx\\:.+\\n+" +
-        "Properties\\s*\\:\\n+(\\s*\\S+\\s*=\\s*\\S+\\n*)+",
+        "Properties\\s*\\:\\n+(\\s*\\S+\\s*=\\s*\\S+(\\s+\\[default\\])?\\n*)+",
         Pattern.MULTILINE | Pattern.DOTALL
     );
 
--- a/test/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,15 +21,20 @@
  * questions.
  */
 
+//
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+//
+
 /*
  * @test
  * @bug 6216082
  * @summary  Redirect problem with HttpsURLConnection using a proxy
- *     SunJSSE does not support dynamic system properties, no way to re-use
- *     system properties in samevm/agentvm mode.
  * @modules java.base/sun.net.www
  * @library ..
- * @build HttpCallback TestHttpsServer ClosedChannelList HttpTransaction TunnelProxy
+ * @build HttpCallback TestHttpsServer ClosedChannelList
+ *        HttpTransaction TunnelProxy
+ * @key intermittent
  * @run main/othervm B6216082
  */
 
--- a/test/sun/net/www/protocol/https/HttpsURLConnection/RetryHttps.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/sun/net/www/protocol/https/HttpsURLConnection/RetryHttps.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,7 @@
     /*
      * Turn on SSL debugging?
      */
-    static boolean debug = false;
+    static boolean debug = true;
 
     private SSLServerSocket sslServerSocket = null;
 
--- a/test/sun/security/krb5/auto/KDC.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/sun/security/krb5/auto/KDC.java	Fri Dec 18 10:00:55 2015 -0800
@@ -1280,7 +1280,11 @@
                         System.out.println(">>>>> TCP connection established");
                         DataInputStream in = new DataInputStream(socket.getInputStream());
                         DataOutputStream out = new DataOutputStream(socket.getOutputStream());
-                        byte[] token = new byte[in.readInt()];
+                        int len = in.readInt();
+                        if (len > 65535) {
+                            throw new Exception("Huge request not supported");
+                        }
+                        byte[] token = new byte[len];
                         in.readFully(token);
                         q.put(new Job(processMessage(token), socket, out));
                     } catch (Exception e) {
--- a/test/sun/security/pkcs11/PKCS11Test.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/sun/security/pkcs11/PKCS11Test.java	Fri Dec 18 10:00:55 2015 -0800
@@ -540,6 +540,7 @@
             "/usr/lib/x86_64-linux-gnu/", "/usr/lib/x86_64-linux-gnu/nss/",
             "/usr/lib64/"});
         osMap.put("Linux-ppc64-64", new String[]{"/usr/lib64/"});
+        osMap.put("Linux-ppc64le-64", new String[]{"/usr/lib64/"});
         osMap.put("Windows-x86-32", new String[]{
             PKCS11_BASE + "/nss/lib/windows-i586/".replace('/', SEP)});
         osMap.put("Windows-amd64-64", new String[]{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/security/util/AlgorithmConstraints/DecomposeAlgorithms.java	Fri Dec 18 10:00:55 2015 -0800
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8136410
+ * @summary AlgorithmDecomposer is not parsing padding correctly
+ * @modules java.base/sun.security.util
+ */
+
+import sun.security.util.AlgorithmDecomposer;
+import java.util.Set;
+
+public class DecomposeAlgorithms {
+
+    public static void main(String[] args) throws Exception {
+        AlgorithmDecomposer decomposer = new AlgorithmDecomposer();
+
+        check(decomposer, "AES/CBC/NoPadding", new String[] {
+                "AES", "CBC", "NoPadding"});
+        check(decomposer, "DES/CBC/PKCS5Padding", new String[] {
+                "DES", "CBC", "PKCS5Padding"});
+        check(decomposer, "RSA/ECB/OAEPWithSHA-1AndMGF1Padding", new String[] {
+                "RSA", "ECB", "OAEP", "SHA1", "SHA-1", "MGF1Padding"});
+        check(decomposer, "OAEPWithSHA-512AndMGF1Padding", new String[] {
+                "OAEP", "SHA512", "SHA-512", "MGF1Padding"});
+        check(decomposer, "OAEPWithSHA-512AndMGF1Padding", new String[] {
+                "OAEP", "SHA512", "SHA-512", "MGF1Padding"});
+        check(decomposer, "PBEWithSHA1AndRC2_40", new String[] {
+                "PBE", "SHA1", "SHA-1", "RC2_40"});
+        check(decomposer, "PBEWithHmacSHA224AndAES_128", new String[] {
+                "PBE", "HmacSHA224", "AES_128"});
+    }
+
+    private static void check(AlgorithmDecomposer parser,
+            String fullAlgName, String[] components) throws Exception {
+
+        Set<String> parsed = parser.decompose(fullAlgName);
+        if (parsed.size() != components.length) {
+            throw new Exception("Not expected components number: " + parsed);
+        }
+
+        for (String component : components) {
+            if (!parsed.contains(component)) {
+                throw new Exception("Not a expected component: " + component);
+            }
+        }
+
+        System.out.println("OK: " + fullAlgName);
+    }
+}
--- a/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java	Fri Dec 18 10:00:55 2015 -0800
@@ -60,30 +60,30 @@
     }
 
     private static void testFlagPlus() throws Exception {
-        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+PrintGC");
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output = JInfoHelper.jinfo("-flag", "PrintGC");
+        output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output.shouldContain("+PrintGC");
-        verifyIsEnabled("PrintGC");
+        output.shouldContain("+HeapDumpOnOutOfMemoryError");
+        verifyIsEnabled("HeapDumpOnOutOfMemoryError");
     }
 
     private static void testFlagMinus() throws Exception {
-        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "-PrintGC");
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "-HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output = JInfoHelper.jinfo("-flag", "PrintGC");
+        output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output.shouldContain("-PrintGC");
-        verifyIsDisabled("PrintGC");
+        output.shouldContain("-HeapDumpOnOutOfMemoryError");
+        verifyIsDisabled("HeapDumpOnOutOfMemoryError");
     }
 
     private static void testFlagEqual() throws Exception {
-        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "PrintGC=1");
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError=1");
         output.shouldHaveExitValue(0);
-        output = JInfoHelper.jinfo("-flag", "PrintGC");
+        output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
         output.shouldHaveExitValue(0);
-        output.shouldContain("+PrintGC");
-        verifyIsEnabled("PrintGC");
+        output.shouldContain("+HeapDumpOnOutOfMemoryError");
+        verifyIsEnabled("HeapDumpOnOutOfMemoryError");
     }
 
     private static void testInvalidFlag() throws Exception {
--- a/test/sun/tools/jps/JpsHelper.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/sun/tools/jps/JpsHelper.java	Fri Dec 18 10:00:55 2015 -0800
@@ -98,7 +98,7 @@
      * -XX:+UsePerfData is required for running the tests on embedded platforms.
      */
     public static final String[] VM_ARGS = {
-        "-XX:+UsePerfData", "-Xmx512m", "-XX:+PrintGCDetails",
+        "-XX:+UsePerfData", "-Xmx512m", "-Xlog:gc",
         "-Dmultiline.prop=value1\nvalue2\r\nvalue3"
     };
     /**
--- a/test/tools/launcher/Settings.java	Thu Dec 17 10:03:30 2015 +0100
+++ b/test/tools/launcher/Settings.java	Fri Dec 18 10:00:55 2015 -0800
@@ -74,7 +74,7 @@
 
     static void runTestOptionDefault() throws IOException {
         String stackSize = "256"; // in kb
-        if (getArch().equals("ppc64")) {
+        if (getArch().equals("ppc64") || getArch().equals("ppc64le")) {
             stackSize = "800";
         }
         TestResult tr = null;