--- old/src/share/classes/java/lang/Class.java Wed Aug 22 13:19:23 2012 +++ new/src/share/classes/java/lang/Class.java Wed Aug 22 13:19:23 2012 @@ -605,7 +605,7 @@ SecurityManager sm = System.getSecurityManager(); if (sm != null) { ClassLoader ccl = ClassLoader.getCallerClassLoader(); - if (ccl != null && ccl != cl && !cl.isAncestor(ccl)) { + if (ClassLoader.needsClassLoaderPermissionCheck(ccl, cl)) { sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION); } } @@ -2170,8 +2170,7 @@ if (s != null) { s.checkMemberAccess(this, which); ClassLoader cl = getClassLoader0(); - if ((ccl != null) && (ccl != cl) && - ((cl == null) || !cl.isAncestor(ccl))) { + if (sun.reflect.misc.ReflectUtil.needsPackageAccessCheck(ccl, cl)) { String name = this.getName(); int i = name.lastIndexOf('.'); if (i != -1) {