1011N/A * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. 450N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 450N/A * This code is free software; you can redistribute it and/or modify it 450N/A * under the terms of the GNU General Public License version 2 only, as 553N/A * published by the Free Software Foundation. Oracle designates this 450N/A * particular file as subject to the "Classpath" exception as provided 553N/A * by Oracle in the LICENSE file that accompanied this code. 450N/A * This code is distributed in the hope that it will be useful, but WITHOUT 450N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 450N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 450N/A * version 2 for more details (a copy is included in the LICENSE file that 450N/A * accompanied this code). 450N/A * You should have received a copy of the GNU General Public License version 450N/A * 2 along with this work; if not, write to the Free Software Foundation, 450N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 553N/A * or visit www.oracle.com if you need additional information or have any 450N/A * A framework for determining {@link Dependency dependencies} between class files. 450N/A * A {@link Dependency.Finder finder} is used to identify the dependencies of 450N/A * individual classes. Some finders may return subtypes of {@code Dependency} to 450N/A * further characterize the type of dependency, such as a dependency on a 450N/A * method within a class. 450N/A * A {@link Dependency.Filter filter} may be used to restrict the set of 450N/A * dependencies found by a finder. 450N/A * Dependencies that are found may be passed to a {@link Dependencies.Recorder 450N/A * recorder} so that the dependencies can be stored in a custom data structure. 450N/A * Thrown when a class file cannot be found. 450N/A * Thrown when an exception is found processing a class file. 450N/A * Service provider interface to locate and read class files. 450N/A * Get the ClassFile object for a specified class. 450N/A * @param className the name of the class to be returned. 450N/A * @return the ClassFile for the given class 450N/A * @throws Dependencies#ClassFileNotFoundException if the classfile cannot be 450N/A * Service provide interface to handle results. 450N/A * Record a dependency that has been found. 450N/A * Get the default finder used to locate the dependencies for a class. 450N/A * @return the default finder 450N/A * Get a finder used to locate the API dependencies for a class. 450N/A * These include the superclass, superinterfaces, and classes referenced in 450N/A * the declarations of fields and methods. The fields and methods that 450N/A * are checked can be limited according to a specified access. 450N/A * The access parameter must be one of {@link AccessFlags#ACC_PUBLIC ACC_PUBLIC}, 450N/A * {@link AccessFlags#ACC_PRIVATE ACC_PRIVATE}, 450N/A * {@link AccessFlags#ACC_PROTECTED ACC_PROTECTED}, or 0 for 450N/A * package private access. Members with greater than or equal accessibility 450N/A * to that specified will be searched for dependencies. 450N/A * @param access the access of members to be checked 450N/A * @return an API finder 450N/A * Get the finder used to locate the dependencies for a class. 450N/A * Set the finder used to locate the dependencies for a class. 450N/A * Get the default filter used to determine included when searching 450N/A * the transitive closure of all the dependencies. 450N/A * Unless overridden, the default filter accepts all dependencies. 450N/A * @return the default filter. 450N/A * Get a filter which uses a regular expression on the target's class name 450N/A * to determine if a dependency is of interest. 450N/A * @param pattern the pattern used to match the target's class name 450N/A * @return a filter for matching the target class name with a regular expression 450N/A * Get a filter which checks the package of a target's class name 450N/A * to determine if a dependency is of interest. The filter checks if the 450N/A * package of the target's class matches any of a set of given package 450N/A * names. The match may optionally match subpackages of the given names as well. 450N/A * @param packageNames the package names used to match the target's class name 450N/A * @param matchSubpackages whether or not to match subpackages as well 450N/A * @return a filter for checking the target package name against a list of package names 450N/A * Get the filter used to determine the dependencies included when searching 450N/A * the transitive closure of all the dependencies. 450N/A * Unless overridden, the default filter accepts all dependencies. 450N/A * Set the filter used to determine the dependencies included when searching 450N/A * the transitive closure of all the dependencies. 450N/A * Find the dependencies of a class, using the current 450N/A * {@link Dependencies#getFinder finder} and 450N/A * {@link Dependencies#getFilter filter}. 450N/A * The search may optionally include the transitive closure of all the 450N/A * filtered dependencies, by also searching in the classes named in those 450N/A * @param classFinder a finder to locate class files 450N/A * @param rootClassNames the names of the root classes from which to begin 450N/A * @param transitiveClosure whether or not to also search those classes 450N/A * named in any filtered dependencies that are found. 450N/A * @return the set of dependencies that were found 450N/A * @throws ClassFileNotFoundException if a required class file cannot be found 450N/A * @throws ClassFileError if an error occurs while processing a class file, 450N/A * such as an error in the internal class file structure. 450N/A * Find the dependencies of a class, using the current 450N/A * {@link Dependencies#getFinder finder} and 450N/A * {@link Dependencies#getFilter filter}. 450N/A * The search may optionally include the transitive closure of all the 450N/A * filtered dependencies, by also searching in the classes named in those 450N/A * @param classFinder a finder to locate class files 450N/A * @param rootClassNames the names of the root classes from which to begin 450N/A * @param transitiveClosure whether or not to also search those classes 450N/A * named in any filtered dependencies that are found. 450N/A * @param recorder a recorder for handling the results 450N/A * @throws ClassFileNotFoundException if a required class file cannot be found 450N/A * @throws ClassFileError if an error occurs while processing a class file, 450N/A * such as an error in the internal class file structure. 450N/A // Work queue of names of classfiles to be searched. 450N/A // Entries will be unique, and for classes that do not yet have 450N/A // dependencies in the results map. 450N/A // The following code just applies the filter to the dependencies 450N/A // followed for the transitive closure. 450N/A * A location identifying a class. 450N/A * Get the name of the class being depended on. This name will be used to 450N/A * locate the class file for transitive dependency analysis. 450N/A * @return the name of the class being depended on 450N/A * A dependency of one class on another. 450N/A * This class accepts all dependencies. 450N/A * This class accepts those dependencies whose target's class name matches a 450N/A * This class accepts those dependencies whose class name is in a given 450N/A * This class identifies class names directly or indirectly in the constant pool. 450N/A * This class identifies class names in the signatures of classes, fields, 450N/A * and methods in a class. 450N/A // code copied from javap.Options.checkAccess 450N/A // ConstantPool.Visitor methods 450N/A // Type.Visitor methods