8017291: Cast Proxies Aside
authormchung
Mon, 15 Jul 2013 20:24:39 -0700
changeset 20817 a842c616ae88
parent 20816 b44a353664b8
child 20819 7b5054561658
8017291: Cast Proxies Aside Reviewed-by: alanb, ahgross
jdk/src/share/classes/java/lang/ClassLoader.java
--- a/jdk/src/share/classes/java/lang/ClassLoader.java	Mon Jul 15 14:44:50 2013 +0200
+++ b/jdk/src/share/classes/java/lang/ClassLoader.java	Mon Jul 15 20:24:39 2013 -0700
@@ -57,6 +57,7 @@
 import sun.misc.VM;
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
+import sun.reflect.misc.ReflectUtil;
 import sun.security.util.SecurityConstants;
 
 /**
@@ -486,6 +487,13 @@
     private void checkPackageAccess(Class<?> cls, ProtectionDomain pd) {
         final SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
+            if (ReflectUtil.isNonPublicProxyClass(cls)) {
+                for (Class intf: cls.getInterfaces()) {
+                    checkPackageAccess(intf, pd);
+                }
+                return;
+            }
+
             final String name = cls.getName();
             final int i = name.lastIndexOf('.');
             if (i != -1) {