5897N/A * Copyright (c) 2005, 2013 Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Reflection.ensureMemberAccess is overly-restrictive 0N/A * due to a bug. We awkwardly work around it for now. 0N/A * See if we fail because of class modifiers 0N/A * We're still here so class access was ok. 0N/A * Now try with default field access. 0N/A * We're still here so access is ok without 0N/A * checking for protected. 0N/A * Access failed but we're 'protected' so 0N/A * if the test below succeeds then we're ok. 6328N/A * Checks package access on the given class. 6328N/A * If it is a {@link Proxy#isProxyClass(java.lang.Class)} that implements 6328N/A * a non-public interface (i.e. may be in a non-restricted package), 6328N/A * also check the package access on the proxy interfaces. 6328N/A * Checks package access on the given classname. 6328N/A * This method is typically called when the Class instance is not 6328N/A * available and the caller attempts to load a class on behalf 6328N/A * the true caller (application). 5682N/A // Returns true if p is an ancestor of cl i.e. class loader 'p' can 5682N/A // be found in the cl's delegation chain 5682N/A * Returns true if package access check is needed for reflective 5682N/A * access from a class loader 'from' to classes or members in 5682N/A * a class defined by class loader 'to'. This method returns true 5682N/A * if 'from' is not the same as or an ancestor of 'to'. All code 5682N/A * in a system domain are granted with all permission and so this 5682N/A * method returns false if 'from' class loader is a class loader 5682N/A * loading system classes. On the other hand, if a class loader 5682N/A * attempts to access system domain classes, it requires package 5682N/A * access check and this method will return true. 6328N/A * Check package access on the proxy interfaces that the given proxy class 6328N/A * @param clazz Proxy class object 6328N/A // check proxy interfaces if the given class is a proxy class 5682N/A * Access check on the interfaces that a proxy class implements and throw 6328N/A * {@code SecurityException} if it accesses a restricted package from 6328N/A * the caller's class loader. 5682N/A * @param ccl the caller's class loader 5682N/A * @param interfaces the list of interfaces that a proxy class implements 6328N/A * Test if the given class is a proxy class that implements 6328N/A * non-public interface. Such proxy class may be in a non-restricted 6328N/A * package that bypasses checkPackageAccess.