changeset 8416:d4bd8bd71ca7 jdk7u80-b05

Merge
author asaha
date Fri, 16 Jan 2015 13:34:22 -0800
parents 238f0af20f18 (current diff) 1c3c47064b5c (diff)
children 70e3553d9d6e 4b5c996d4905
files
diffstat 17 files changed, 627 insertions(+), 82 deletions(-) [+]
line wrap: on
line diff
--- a/make/java/zip/Makefile	Wed Jan 07 12:34:11 2015 -0800
+++ b/make/java/zip/Makefile	Fri Jan 16 13:34:22 2015 -0800
@@ -68,6 +68,16 @@
     FILES_reorder += reorder-$(ARCH)
   endif
 endif
+
+#
+# Use mapfile unconditionally (even with fastdebug).
+# JDK's internal zlib is incompatible with stock zlib, because the
+# size of struct z_stream has been changed, so internal zlib
+# implementation must not be allowed to leak outside of libzip.so,
+# else you get hard to debug failures with fastdebug jdk when user
+# native code includes stock zlib.
+#
+FILES_m = mapfile-vers
 include $(BUILDDIR)/common/Mapfile-vers.gmk
 include $(BUILDDIR)/common/Library.gmk
 
--- a/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java	Wed Jan 07 12:34:11 2015 -0800
+++ b/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java	Fri Jan 16 13:34:22 2015 -0800
@@ -777,7 +777,7 @@
                     JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
             connServer.start();
         } catch (IOException e) {
-            if (connServer == null) {
+            if (connServer == null || connServer.getAddress() == null) {
                 throw new AgentConfigurationError(CONNECTOR_SERVER_IO_ERROR,
                         e, url.toString());
             } else {
--- a/src/share/classes/sun/nio/ch/FileChannelImpl.java	Wed Jan 07 12:34:11 2015 -0800
+++ b/src/share/classes/sun/nio/ch/FileChannelImpl.java	Fri Jan 16 13:34:22 2015 -0800
@@ -397,30 +397,13 @@
     //
     private static volatile boolean fileSupported = true;
 
-    private long transferToDirectly(long position, int icount,
-                                    WritableByteChannel target)
+    private long transferToDirectlyInternal(long position, int icount,
+                                            WritableByteChannel target,
+                                            FileDescriptor targetFD)
         throws IOException
     {
-        if (!transferSupported)
-            return IOStatus.UNSUPPORTED;
-
-        FileDescriptor targetFD = null;
-        if (target instanceof FileChannelImpl) {
-            if (!fileSupported)
-                return IOStatus.UNSUPPORTED_CASE;
-            targetFD = ((FileChannelImpl)target).fd;
-        } else if (target instanceof SelChImpl) {
-            // Direct transfer to pipe causes EINVAL on some configurations
-            if ((target instanceof SinkChannelImpl) && !pipeSupported)
-                return IOStatus.UNSUPPORTED_CASE;
-            targetFD = ((SelChImpl)target).getFD();
-        }
-        if (targetFD == null)
-            return IOStatus.UNSUPPORTED;
-        int thisFDVal = IOUtil.fdVal(fd);
-        int targetFDVal = IOUtil.fdVal(targetFD);
-        if (thisFDVal == targetFDVal) // Not supported on some configurations
-            return IOStatus.UNSUPPORTED;
+        assert !nd.transferToDirectlyNeedsPositionLock() ||
+               Thread.holdsLock(positionLock);
 
         long n = -1;
         int ti = -1;
@@ -430,7 +413,7 @@
             if (!isOpen())
                 return -1;
             do {
-                n = transferTo0(thisFDVal, position, icount, targetFDVal);
+                n = transferTo0(fd, position, icount, targetFD);
             } while ((n == IOStatus.INTERRUPTED) && isOpen());
             if (n == IOStatus.UNSUPPORTED_CASE) {
                 if (target instanceof SinkChannelImpl)
@@ -451,6 +434,54 @@
         }
     }
 
+    private long transferToDirectly(long position, int icount,
+                                    WritableByteChannel target)
+        throws IOException
+    {
+        if (!transferSupported)
+            return IOStatus.UNSUPPORTED;
+
+        FileDescriptor targetFD = null;
+        if (target instanceof FileChannelImpl) {
+            if (!fileSupported)
+                return IOStatus.UNSUPPORTED_CASE;
+            targetFD = ((FileChannelImpl)target).fd;
+        } else if (target instanceof SelChImpl) {
+            // Direct transfer to pipe causes EINVAL on some configurations
+            if ((target instanceof SinkChannelImpl) && !pipeSupported)
+                return IOStatus.UNSUPPORTED_CASE;
+
+            // Platform-specific restrictions. Now there is only one:
+            // Direct transfer to non-blocking channel could be forbidden
+            SelectableChannel sc = (SelectableChannel)target;
+            if (!nd.canTransferToDirectly(sc))
+                return IOStatus.UNSUPPORTED_CASE;
+
+            targetFD = ((SelChImpl)target).getFD();
+        }
+
+        if (targetFD == null)
+            return IOStatus.UNSUPPORTED;
+        int thisFDVal = IOUtil.fdVal(fd);
+        int targetFDVal = IOUtil.fdVal(targetFD);
+        if (thisFDVal == targetFDVal) // Not supported on some configurations
+            return IOStatus.UNSUPPORTED;
+
+        if (nd.transferToDirectlyNeedsPositionLock()) {
+            synchronized (positionLock) {
+                long pos = position();
+                try {
+                    return transferToDirectlyInternal(position, icount,
+                                                      target, targetFD);
+                } finally {
+                    position(pos);
+                }
+            }
+        } else {
+            return transferToDirectlyInternal(position, icount, target, targetFD);
+        }
+    }
+
     // Maximum size to map when using a mapped buffer
     private static final long MAPPED_TRANSFER_SIZE = 8L*1024L*1024L;
 
@@ -1157,7 +1188,8 @@
     private static native int unmap0(long address, long length);
 
     // Transfers from src to dst, or returns -2 if kernel can't do that
-    private native long transferTo0(int src, long position, long count, int dst);
+    private native long transferTo0(FileDescriptor src, long position,
+                                    long count, FileDescriptor dst);
 
     // Sets or reports this file's position
     // If offset is -1, the current position is returned
--- a/src/share/classes/sun/nio/ch/FileDispatcher.java	Wed Jan 07 12:34:11 2015 -0800
+++ b/src/share/classes/sun/nio/ch/FileDispatcher.java	Fri Jan 16 13:34:22 2015 -0800
@@ -25,7 +25,9 @@
 
 package sun.nio.ch;
 
-import java.io.*;
+import java.io.FileDescriptor;
+import java.io.IOException;
+import java.nio.channels.SelectableChannel;
 
 abstract class FileDispatcher extends NativeDispatcher {
 
@@ -53,4 +55,8 @@
      */
     abstract FileDescriptor duplicateForMapping(FileDescriptor fd)
         throws IOException;
+
+    abstract boolean canTransferToDirectly(SelectableChannel sc);
+
+    abstract boolean transferToDirectlyNeedsPositionLock();
 }
--- a/src/share/classes/sun/reflect/generics/repository/ClassRepository.java	Wed Jan 07 12:34:11 2015 -0800
+++ b/src/share/classes/sun/reflect/generics/repository/ClassRepository.java	Fri Jan 16 13:34:22 2015 -0800
@@ -40,8 +40,11 @@
  */
 public class ClassRepository extends GenericDeclRepository<ClassSignature> {
 
-    private volatile Type superclass; // caches the generic superclass info
-    private volatile Type[] superInterfaces; // caches the generic superinterface info
+    /** The generic superclass info.  Lazily initialized. */
+    private volatile Type superclass;
+
+    /** The generic superinterface info.  Lazily initialized. */
+    private volatile Type[] superInterfaces;
 
  // private, to enforce use of static factory
     private ClassRepository(String rawSig, GenericsFactory f) {
@@ -77,7 +80,7 @@
  * with which the repository was created.
  */
 
-    public Type getSuperclass(){
+    public Type getSuperclass() {
         Type superclass = this.superclass;
         if (superclass == null) { // lazily initialize superclass
             Reifier r = getReifier(); // obtain visitor
@@ -86,25 +89,24 @@
             // extract result from visitor and cache it
             superclass = r.getResult();
             this.superclass = superclass;
-            }
+        }
         return superclass; // return cached result
     }
 
-    public Type[] getSuperInterfaces(){
+    public Type[] getSuperInterfaces() {
         Type[] superInterfaces = this.superInterfaces;
         if (superInterfaces == null) { // lazily initialize super interfaces
             // first, extract super interface subtree(s) from AST
             TypeTree[] ts  = getTree().getSuperInterfaces();
             // create array to store reified subtree(s)
-            Type[] sis = new Type[ts.length];
+            superInterfaces = new Type[ts.length];
             // reify all subtrees
             for (int i = 0; i < ts.length; i++) {
                 Reifier r = getReifier(); // obtain visitor
                 ts[i].accept(r);// reify subtree
                 // extract result from visitor and store it
-                sis[i] = r.getResult();
+                superInterfaces[i] = r.getResult();
             }
-            superInterfaces = sis; // cache overall result
             this.superInterfaces = superInterfaces;
         }
         return superInterfaces.clone(); // return cached result
--- a/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java	Wed Jan 07 12:34:11 2015 -0800
+++ b/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java	Fri Jan 16 13:34:22 2015 -0800
@@ -42,7 +42,8 @@
 public abstract class GenericDeclRepository<S extends Signature>
     extends AbstractRepository<S> {
 
-    private volatile TypeVariable[] typeParams; // caches the formal type parameters
+    /** The formal type parameters.  Lazily initialized. */
+    private volatile TypeVariable[] typeParams;
 
     protected GenericDeclRepository(String rawSig, GenericsFactory f) {
         super(rawSig, f);
@@ -55,8 +56,7 @@
  * If the corresponding field is non-null, it is returned.
  * If not, it is created lazily. This is done by selecting the appropriate
  * part of the tree and transforming it into a reflective object
- * using a visitor.
- * a visitor, which is created by feeding it the factory
+ * using a visitor, which is created by feeding it the factory
  * with which the repository was created.
  */
 
@@ -64,22 +64,21 @@
      * Return the formal type parameters of this generic declaration.
      * @return the formal type parameters of this generic declaration
      */
-    public TypeVariable/*<?>*/[] getTypeParameters(){
+    public TypeVariable/*<?>*/[] getTypeParameters() {
         TypeVariable[] typeParams = this.typeParams;
         if (typeParams == null) { // lazily initialize type parameters
             // first, extract type parameter subtree(s) from AST
             FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
             // create array to store reified subtree(s)
-            TypeVariable[] tps = new TypeVariable[ftps.length];
+            typeParams = new TypeVariable[ftps.length];
             // reify all subtrees
             for (int i = 0; i < ftps.length; i++) {
                 Reifier r = getReifier(); // obtain visitor
                 ftps[i].accept(r); // reify subtree
                 // extract result from visitor and store it
-                tps[i] = (TypeVariable<?>) r.getResult();
+                typeParams[i] = (TypeVariable) r.getResult();
             }
-            typeParams = tps; // cache overall result
-            this.typeParams = typeParams;
+            this.typeParams = typeParams; // cache overall result
         }
         return typeParams.clone(); // return cached result
     }
--- a/src/share/classes/sun/reflect/generics/scope/AbstractScope.java	Wed Jan 07 12:34:11 2015 -0800
+++ b/src/share/classes/sun/reflect/generics/scope/AbstractScope.java	Fri Jan 16 13:34:22 2015 -0800
@@ -42,7 +42,9 @@
     implements Scope {
 
     private final D recvr; // the declaration whose scope this instance represents
-    private volatile Scope enclosingScope; // the enclosing scope of this scope
+
+    /** The enclosing scope of this scope.  Lazily initialized. */
+    private volatile Scope enclosingScope;
 
     /**
      * Constructor. Takes a reflective object whose scope the newly
--- a/src/share/native/java/util/zip/Deflater.c	Wed Jan 07 12:34:11 2015 -0800
+++ b/src/share/native/java/util/zip/Deflater.c	Fri Jan 16 13:34:22 2015 -0800
@@ -68,10 +68,11 @@
         JNU_ThrowOutOfMemoryError(env, 0);
         return jlong_zero;
     } else {
-        char *msg;
-        switch (deflateInit2(strm, level, Z_DEFLATED,
-                             nowrap ? -MAX_WBITS : MAX_WBITS,
-                             DEF_MEM_LEVEL, strategy)) {
+        const char *msg;
+        int ret = deflateInit2(strm, level, Z_DEFLATED,
+                               nowrap ? -MAX_WBITS : MAX_WBITS,
+                               DEF_MEM_LEVEL, strategy);
+        switch (ret) {
           case Z_OK:
             return ptr_to_jlong(strm);
           case Z_MEM_ERROR:
@@ -83,7 +84,11 @@
             JNU_ThrowIllegalArgumentException(env, 0);
             return jlong_zero;
           default:
-            msg = strm->msg;
+            msg = ((strm->msg != NULL) ? strm->msg :
+                   (ret == Z_VERSION_ERROR) ?
+                   "zlib returned Z_VERSION_ERROR: "
+                   "compile time and runtime zlib implementations differ" :
+                   "unknown error initializing zlib library");
             free(strm);
             JNU_ThrowInternalError(env, msg);
             return jlong_zero;
--- a/src/share/native/java/util/zip/Inflater.c	Wed Jan 07 12:34:11 2015 -0800
+++ b/src/share/native/java/util/zip/Inflater.c	Fri Jan 16 13:34:22 2015 -0800
@@ -27,6 +27,7 @@
  * Native method support for java.util.zip.Inflater
  */
 
+#include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -60,12 +61,13 @@
 {
     z_stream *strm = calloc(1, sizeof(z_stream));
 
-    if (strm == 0) {
+    if (strm == NULL) {
         JNU_ThrowOutOfMemoryError(env, 0);
         return jlong_zero;
     } else {
-        char *msg;
-        switch (inflateInit2(strm, nowrap ? -MAX_WBITS : MAX_WBITS)) {
+        const char *msg;
+        int ret = inflateInit2(strm, nowrap ? -MAX_WBITS : MAX_WBITS);
+        switch (ret) {
           case Z_OK:
             return ptr_to_jlong(strm);
           case Z_MEM_ERROR:
@@ -73,7 +75,13 @@
             JNU_ThrowOutOfMemoryError(env, 0);
             return jlong_zero;
           default:
-            msg = strm->msg;
+            msg = ((strm->msg != NULL) ? strm->msg :
+                   (ret == Z_VERSION_ERROR) ?
+                   "zlib returned Z_VERSION_ERROR: "
+                   "compile time and runtime zlib implementations differ" :
+                   (ret == Z_STREAM_ERROR) ?
+                   "inflateInit2 returned Z_STREAM_ERROR" :
+                   "unknown error initializing zlib library");
             free(strm);
             JNU_ThrowInternalError(env, msg);
             return jlong_zero;
--- a/src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java	Wed Jan 07 12:34:11 2015 -0800
+++ b/src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java	Fri Jan 16 13:34:22 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -97,6 +97,7 @@
      * @param handler the synthetic error handler to set
      */
     public static void WITH_XERROR_HANDLER(XErrorHandler handler) {
+        XSync();
         saved_error = null;
         current_error_handler = handler;
     }
@@ -105,15 +106,9 @@
      * Unsets a current synthetic error handler. Must be called with the acquired AWT lock.
      */
     public static void RESTORE_XERROR_HANDLER() {
-        RESTORE_XERROR_HANDLER(true);
-    }
-
-    private static void RESTORE_XERROR_HANDLER(boolean doXSync) {
-        if (doXSync) {
-            // Wait until all requests are processed by the X server
-            // and only then uninstall the error handler.
-            XSync();
-        }
+        // Wait until all requests are processed by the X server
+        // and only then uninstall the error handler.
+        XSync();
         current_error_handler = null;
     }
 
--- a/src/solaris/classes/sun/nio/ch/FileDispatcherImpl.java	Wed Jan 07 12:34:11 2015 -0800
+++ b/src/solaris/classes/sun/nio/ch/FileDispatcherImpl.java	Fri Jan 16 13:34:22 2015 -0800
@@ -25,10 +25,10 @@
 
 package sun.nio.ch;
 
-import java.io.*;
+import java.io.FileDescriptor;
+import java.io.IOException;
 
-class FileDispatcherImpl extends FileDispatcher
-{
+class FileDispatcherImpl extends FileDispatcher {
 
     static {
         Util.load();
@@ -108,6 +108,14 @@
         return new FileDescriptor();
     }
 
+    boolean canTransferToDirectly(java.nio.channels.SelectableChannel sc) {
+        return true;
+    }
+
+    boolean transferToDirectlyNeedsPositionLock() {
+        return false;
+    }
+
     // -- Native methods --
 
     static native int read0(FileDescriptor fd, long address, int len)
--- a/src/solaris/native/sun/nio/ch/FileChannelImpl.c	Wed Jan 07 12:34:11 2015 -0800
+++ b/src/solaris/native/sun/nio/ch/FileChannelImpl.c	Fri Jan 16 13:34:22 2015 -0800
@@ -152,10 +152,13 @@
 
 JNIEXPORT jlong JNICALL
 Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
-                                            jint srcFD,
+                                            jobject srcFDO,
                                             jlong position, jlong count,
-                                            jint dstFD)
+                                            jobject dstFDO)
 {
+    jint srcFD = fdval(env, srcFDO);
+    jint dstFD = fdval(env, dstFDO);
+
 #if defined(__linux__)
     off64_t offset = (off64_t)position;
     jlong n = sendfile64(dstFD, srcFD, &offset, (size_t)count);
--- a/src/windows/classes/sun/nio/ch/FileDispatcherImpl.java	Wed Jan 07 12:34:11 2015 -0800
+++ b/src/windows/classes/sun/nio/ch/FileDispatcherImpl.java	Fri Jan 16 13:34:22 2015 -0800
@@ -25,15 +25,16 @@
 
 package sun.nio.ch;
 
-import java.io.*;
+import java.io.FileDescriptor;
+import java.io.IOException;
+import java.security.PrivilegedAction;
 import sun.misc.SharedSecrets;
 import sun.misc.JavaIOFileDescriptorAccess;
 
-class FileDispatcherImpl extends FileDispatcher
-{
-    static {
-        Util.load();
-    }
+class FileDispatcherImpl extends FileDispatcher {
+
+    // set to true if fast file transmission (TransmitFile) is enabled
+    private static final boolean fastFileTransfer;
 
     /**
      * Indicates if the dispatcher should first advance the file position
@@ -120,6 +121,36 @@
         return result;
     }
 
+    boolean canTransferToDirectly(java.nio.channels.SelectableChannel sc) {
+        return fastFileTransfer && sc.isBlocking();
+    }
+
+    boolean transferToDirectlyNeedsPositionLock() {
+        return true;
+    }
+
+    static boolean isFastFileTransferRequested() {
+        String fileTransferProp = java.security.AccessController.doPrivileged(
+            new PrivilegedAction<String>() {
+                @Override
+                public String run() {
+                    return System.getProperty("jdk.nio.enableFastFileTransfer");
+                }
+            });
+        boolean enable;
+        if ("".equals(fileTransferProp)) {
+            enable = true;
+        } else {
+            enable = Boolean.parseBoolean(fileTransferProp);
+        }
+        return enable;
+    }
+
+    static {
+        Util.load();
+        fastFileTransfer = isFastFileTransferRequested();
+    }
+
     //-- Native methods
 
     static native int read0(FileDescriptor fd, long address, int len)
--- a/src/windows/native/sun/nio/ch/FileChannelImpl.c	Wed Jan 07 12:34:11 2015 -0800
+++ b/src/windows/native/sun/nio/ch/FileChannelImpl.c	Fri Jan 16 13:34:22 2015 -0800
@@ -31,6 +31,11 @@
 #include "nio.h"
 #include "nio_util.h"
 #include "sun_nio_ch_FileChannelImpl.h"
+#include "java_lang_Integer.h"
+
+#include <winsock2.h>
+#include <Mswsock.h>
+#pragma comment(lib, "Mswsock.lib")
 
 static jfieldID chan_fd; /* id for jobject 'fd' in java.io.FileChannel */
 
@@ -174,9 +179,42 @@
 
 JNIEXPORT jlong JNICALL
 Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
-                                            jint srcFD,
+                                            jobject srcFD,
                                             jlong position, jlong count,
-                                            jint dstFD)
+                                            jobject dstFD)
 {
-    return IOS_UNSUPPORTED;
+    const int PACKET_SIZE = 524288;
+
+    HANDLE src = (HANDLE)(handleval(env, srcFD));
+    SOCKET dst = (SOCKET)(fdval(env, dstFD));
+    DWORD chunkSize = (count > java_lang_Integer_MAX_VALUE) ?
+        java_lang_Integer_MAX_VALUE : (DWORD)count;
+    BOOL result = 0;
+
+    jlong pos = Java_sun_nio_ch_FileChannelImpl_position0(env, this, srcFD, position);
+    if (pos == IOS_THROWN) {
+        return IOS_THROWN;
+    }
+
+    result = TransmitFile(
+        dst,
+        src,
+        chunkSize,
+        PACKET_SIZE,
+        NULL,
+        NULL,
+        TF_USE_KERNEL_APC
+    );
+    if (!result) {
+        int error = WSAGetLastError();
+        if (WSAEINVAL == error && count >= 0) {
+            return IOS_UNSUPPORTED_CASE;
+        }
+        if (WSAENOTSOCK == error) {
+            return IOS_UNSUPPORTED_CASE;
+        }
+        JNU_ThrowIOExceptionWithLastError(env, "transfer failed");
+        return IOS_THROWN;
+    }
+    return chunkSize;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java	Fri Jan 16 13:34:22 2015 -0800
@@ -0,0 +1,393 @@
+/*
+ * 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 8065552
+ * @summary test that all fields returned by getDeclaredFields() can be
+ * set accessible if the right permission is granted; this test
+ * loads all the classes in the BCL, get their declared fields,
+ * and call setAccessible(false) followed by setAccessible(true);
+ *
+ * @run main/othervm -XX:PermSize=128m FieldSetAccessibleTest UNSECURE
+ * @run main/othervm -XX:PermSize=128m FieldSetAccessibleTest SECURE
+ *
+ * @author danielfuchs
+ */
+
+import java.io.File;
+import java.io.FilePermission;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.lang.reflect.ReflectPermission;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.PropertyPermission;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+public class FieldSetAccessibleTest {
+
+    static final List<String> skipped = new ArrayList<>();
+    static final List<String> cantread = new ArrayList<>();
+    static final List<String> failed = new ArrayList<>();
+    static final AtomicLong classCount = new AtomicLong();
+    static final AtomicLong fieldCount = new AtomicLong();
+    static long startIndex = 0;
+    static long maxSize = Long.MAX_VALUE;
+    static long maxIndex = Long.MAX_VALUE;
+
+
+    // Test that all fields for any given class can be made accessibles
+    static void testSetFieldsAccessible(Class<?> c) {
+        for (Field f : c.getDeclaredFields()) {
+            fieldCount.incrementAndGet();
+            f.setAccessible(false);
+            f.setAccessible(true);
+        }
+    }
+
+    // Performs a series of test on the given class.
+    // At this time, we only call testSetFieldsAccessible(c)
+    public static boolean test(Class<?> c) {
+        //System.out.println(c.getName());
+        classCount.incrementAndGet();
+
+        // Call getDeclaredFields() and try to set their accessible flag.
+        testSetFieldsAccessible(c);
+
+        // add more tests here...
+
+        return c == Class.class;
+    }
+
+    // Prints a summary at the end of the test.
+    static void printSummary(long secs, long millis, long nanos) {
+        System.out.println("Tested " + fieldCount.get() + " fields of "
+                + classCount.get() + " classes in "
+                + secs + "s " + millis + "ms " + nanos + "ns");
+    }
+
+    public static void main(String[] args) throws Exception {
+        TestCase.valueOf(args[0]).run();
+    }
+
+    public static void run(TestCase test) {
+        System.out.println("Testing " + test);
+        test(listAllClassNames());
+        System.out.println("Passed " + test);
+    }
+
+    static Iterable<String> listAllClassNames() {
+        boolean sort = startIndex != 0 || maxIndex != Long.MAX_VALUE;
+        return new ClassNameListBuilder(sort);
+    }
+
+    static void test(Iterable<String> iterable) {
+        final long start = System.nanoTime();
+        boolean classFound = false;
+        int index = 0;
+        for (String s: iterable) {
+            if (index == maxIndex) break;
+            try {
+                if (index < startIndex) continue;
+                if (test(s)) {
+                    classFound = true;
+                }
+            } finally {
+                index++;
+            }
+        }
+        long elapsed = System.nanoTime() - start;
+        long secs = elapsed / 1000_000_000;
+        long millis = (elapsed % 1000_000_000) / 1000_000;
+        long nanos  = elapsed % 1000_000;
+        System.out.println("Unreadable path elements: " + cantread);
+        System.out.println("Skipped path elements: " + skipped);
+        System.out.println("Failed path elements: " + failed);
+        printSummary(secs, millis, nanos);
+
+        if (!failed.isEmpty()) {
+            throw new RuntimeException("Test failed for the following classes: " + failed);
+        }
+        if (!classFound && startIndex == 0 && index < maxIndex) {
+            // this is just to verify that we have indeed parsed rt.jar
+            // (or the java.base module)
+            throw  new RuntimeException("Test failed: Class.class not found...");
+        }
+        if (classCount.get() == 0 && startIndex == 0) {
+            throw  new RuntimeException("Test failed: no class found?");
+        }
+    }
+
+    static boolean test(String s) {
+        try {
+            if (s.startsWith("WrapperGenerator")) {
+                System.out.println("Skipping "+ s);
+                return false;
+            }
+            final Class<?> c = Class.forName(
+                    s.replace('/', '.').substring(0, s.length() - 6),
+                    false,
+                    null);
+            return test(c);
+        } catch (Exception t) {
+            t.printStackTrace(System.err);
+            failed.add(s);
+        } catch (NoClassDefFoundError e) {
+            e.printStackTrace(System.err);
+            failed.add(s);
+        }
+        return false;
+    }
+
+    static class ClassNameListBuilder implements Iterable<String> {
+        String[] bcp;
+        boolean sort;
+        ClassNameListBuilder(boolean sort) {
+            bcp = System.getProperty("sun.boot.class.path").split(File.pathSeparator);
+            this.sort = sort;
+        }
+
+        public List<String> build() {
+            return findClasses();
+        }
+
+        List<String> findClasses() {
+            List<String> list = new ArrayList<>();
+
+            for (String s : bcp) {
+                System.out.println("boot class path element: " + s);
+                if (s.endsWith(".jar")) {
+                    addJarEntries(s, list);
+                } else {
+                    addFolderEntries(new File(s), s, list);
+                }
+            }
+
+            if (sort) {
+                System.out.println("Sorting class names...");
+                Collections.sort(list);
+                System.out.println("\t... Sorted.");
+            }
+            return list;
+        }
+
+        void addJarEntries(String jarName, List<String> classNames) {
+            File f = new File(jarName);
+            if (f.canRead() && f.isFile()) {
+                try {
+                    JarFile jarFile = new JarFile(f);
+                    for (Enumeration<JarEntry> entries = jarFile.entries() ; entries.hasMoreElements() ;) {
+                        JarEntry e = entries.nextElement();
+                        if (e.isDirectory()) {
+                            continue;
+                        }
+                        if (e.getName().endsWith(".class")) {
+                            classNames.add(e.getName());
+                        }
+                    }
+                } catch (IOException e) {
+                    e.printStackTrace();
+                    skipped.add(jarName);
+                }
+            } else {
+                cantread.add(jarName);
+            }
+        }
+
+        void addFolderEntries(File root, String folderName, List<String> classNames) {
+            File f = new File(folderName);
+            if (f.canRead()) {
+               if (f.isDirectory()) {
+                   for (String child :  f.list()) {
+                       addFolderEntries(root, new File(f,child).getPath(), classNames);
+                   }
+               } else if (f.isFile() && f.getName().endsWith(".class")) {
+                   String className = root.toPath().relativize(f.toPath()).toString()
+                           .replace(File.separatorChar, '/');
+                   System.out.println("adding: " + className);
+                   classNames.add(className);
+               }
+            } else {
+                cantread.add(folderName);
+            }
+        }
+
+        @Override
+        public Iterator<String> iterator() {
+            return build().iterator();
+        }
+
+    }
+
+    // Test with or without a security manager
+    public static enum TestCase {
+        UNSECURE, SECURE;
+        public void run() throws Exception {
+            System.out.println("Running test case: " + name());
+            Configure.setUp(this);
+            FieldSetAccessibleTest.run(this);
+        }
+    }
+
+    // A helper class to configure the security manager for the test,
+    // and bypass it when needed.
+    static class Configure {
+        static Policy policy = null;
+        static final ThreadLocal<AtomicBoolean> allowAll = new ThreadLocal<AtomicBoolean>() {
+            @Override
+            protected AtomicBoolean initialValue() {
+                return  new AtomicBoolean(false);
+            }
+        };
+        static void setUp(TestCase test) {
+            switch (test) {
+                case SECURE:
+                    if (policy == null && System.getSecurityManager() != null) {
+                        throw new IllegalStateException("SecurityManager already set");
+                    } else if (policy == null) {
+                        policy = new SimplePolicy(TestCase.SECURE, allowAll);
+                        Policy.setPolicy(policy);
+                        System.setSecurityManager(new SecurityManager());
+                    }
+                    if (System.getSecurityManager() == null) {
+                        throw new IllegalStateException("No SecurityManager.");
+                    }
+                    if (policy == null) {
+                        throw new IllegalStateException("policy not configured");
+                    }
+                    break;
+                case UNSECURE:
+                    if (System.getSecurityManager() != null) {
+                        throw new IllegalStateException("SecurityManager already set");
+                    }
+                    break;
+                default:
+                    throw new InternalError("No such testcase: " + test);
+            }
+        }
+        static void doPrivileged(Runnable run) {
+            allowAll.get().set(true);
+            try {
+                run.run();
+            } finally {
+                allowAll.get().set(false);
+            }
+        }
+    }
+
+    // A Helper class to build a set of permissions.
+    final static class PermissionsBuilder {
+        final Permissions perms;
+        public PermissionsBuilder() {
+            this(new Permissions());
+        }
+        public PermissionsBuilder(Permissions perms) {
+            this.perms = perms;
+        }
+        public PermissionsBuilder add(Permission p) {
+            perms.add(p);
+            return this;
+        }
+        public PermissionsBuilder addAll(PermissionCollection col) {
+            if (col != null) {
+                for (Enumeration<Permission> e = col.elements(); e.hasMoreElements(); ) {
+                    perms.add(e.nextElement());
+                }
+            }
+            return this;
+        }
+        public Permissions toPermissions() {
+            final PermissionsBuilder builder = new PermissionsBuilder();
+            builder.addAll(perms);
+            return builder.perms;
+        }
+    }
+
+    // Policy for the test...
+    public static class SimplePolicy extends Policy {
+
+        final Permissions permissions;
+        final Permissions allPermissions;
+        final ThreadLocal<AtomicBoolean> allowAll;
+        public SimplePolicy(TestCase test, ThreadLocal<AtomicBoolean> allowAll) {
+            this.allowAll = allowAll;
+
+            // Permission needed by the tested code exercised in the test
+            permissions = new Permissions();
+            permissions.add(new RuntimePermission("fileSystemProvider"));
+            permissions.add(new RuntimePermission("createClassLoader"));
+            permissions.add(new RuntimePermission("closeClassLoader"));
+            permissions.add(new RuntimePermission("getClassLoader"));
+            permissions.add(new RuntimePermission("accessDeclaredMembers"));
+            permissions.add(new ReflectPermission("suppressAccessChecks"));
+            permissions.add(new PropertyPermission("*", "read"));
+            permissions.add(new FilePermission("<<ALL FILES>>", "read"));
+
+            // these are used for configuring the test itself...
+            allPermissions = new Permissions();
+            allPermissions.add(new java.security.AllPermission());
+        }
+
+        @Override
+        public boolean implies(ProtectionDomain domain, Permission permission) {
+            if (allowAll.get().get()) return allPermissions.implies(permission);
+            if (permissions.implies(permission)) return true;
+            if (permission instanceof java.lang.RuntimePermission) {
+                if (permission.getName().startsWith("accessClassInPackage.")) {
+                    // add these along to the set of permission we have, when we
+                    // discover that we need them.
+                    permissions.add(permission);
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        @Override
+        public PermissionCollection getPermissions(CodeSource codesource) {
+            return new PermissionsBuilder().addAll(allowAll.get().get()
+                    ? allPermissions : permissions).toPermissions();
+        }
+
+        @Override
+        public PermissionCollection getPermissions(ProtectionDomain domain) {
+            return new PermissionsBuilder().addAll(allowAll.get().get()
+                    ? allPermissions : permissions).toPermissions();
+        }
+    }
+
+}
--- a/test/java/lang/reflect/Method/GenericStringTest.java	Wed Jan 07 12:34:11 2015 -0800
+++ b/test/java/lang/reflect/Method/GenericStringTest.java	Fri Jan 16 13:34:22 2015 -0800
@@ -47,10 +47,18 @@
                 if (egs != null) {
                     String actual = method.toGenericString();
                     System.out.println(actual);
-                    if (! egs.value().equals(actual)) {
-                        failures++;
-                        System.err.printf("ERROR: Expected ''%s''; got ''%s''.\n",
-                                          egs.value(), actual);
+                    if (method.isBridge()) {
+                        if (! egs.bridgeValue().equals(actual)) {
+                            failures++;
+                            System.err.printf("ERROR: Expected ''%s''; got ''%s''.\n",
+                                              egs.value(), actual);
+                        }
+                    } else {
+                        if (! egs.value().equals(actual)) {
+                            failures++;
+                            System.err.printf("ERROR: Expected ''%s''; got ''%s''.\n",
+                                              egs.value(), actual);
+                        }
                     }
                 }
 
@@ -116,7 +124,8 @@
 
 class Roebling implements Comparable<Roebling> {
     @ExpectedGenericString(
-   "public int Roebling.compareTo(Roebling)")
+    value="public int Roebling.compareTo(Roebling)",
+    bridgeValue="public int Roebling.compareTo(java.lang.Object)")
     public int compareTo(Roebling r) {
         throw new IllegalArgumentException();
     }
@@ -132,9 +141,11 @@
 @Retention(RetentionPolicy.RUNTIME)
 @interface ExpectedGenericString {
     String value();
+    String bridgeValue() default "";
 }
 
 @Retention(RetentionPolicy.RUNTIME)
 @interface ExpectedString {
     String value();
 }
+
--- a/test/java/nio/channels/FileChannel/TransferToChannel.java	Wed Jan 07 12:34:11 2015 -0800
+++ b/test/java/nio/channels/FileChannel/TransferToChannel.java	Fri Jan 16 13:34:22 2015 -0800
@@ -22,8 +22,10 @@
  */
 
 /* @test
- * @bug 4652496
+ * @bug 4652496 8064407 8068507
  * @summary Test transferTo with different target channels
+ * @run main TransferToChannel
+ * @run main/othervm -Djdk.nio.enableFastFileTransfer TransferToChannel
  */
 
 import java.nio.channels.FileChannel;