Path: blob/master/src/jdk.jdi/share/classes/com/sun/jdi/ClassLoaderReference.java
41159 views
/*1* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.jdi;2627import java.util.List;2829/**30* A class loader object from the target VM.31* A ClassLoaderReference is an {@link ObjectReference} with additional32* access to classloader-specific information from the target VM. Instances33* ClassLoaderReference are obtained through calls to34* {@link ReferenceType#classLoader}35*36* @see ObjectReference37*38* @author Gordon Hirsch39* @since 1.340*/41public interface ClassLoaderReference extends ObjectReference {4243/**44* Returns a list of all classes defined by this class loader.45* No ordering of this list guaranteed.46* The returned list will include all reference types, including47* {@linkplain Class#isHidden hidden classes or interfaces}, loaded48* at least to the point of preparation, and types (like array)49* for which preparation is not defined.50*51* @return a {@code List} of {@link ReferenceType} objects mirroring types52* defined by this class loader. The list has length 0 if no types53* have been defined by this classloader.54*/55List<ReferenceType> definedClasses();5657/**58* Returns a list of all classes which this class loader59* can find by name via {@link ClassLoader#loadClass(String, boolean)60* ClassLoader::loadClass}, {@link Class#forName(String) Class::forName}61* and bytecode linkage in the target VM. That is, all classes for62* which this class loader has been recorded as an initiating loader.63* <p>64* Each class in the returned list was created by this class loader65* either by defining it directly or by delegation to another class loader66* (see JVMS {@jvms 5.3}).67* <p>68* The returned list does not include {@linkplain Class#isHidden()69* hidden classes or interfaces} or array classes whose70* {@linkplain ArrayType#componentType() element type} is a71* {@linkplain Class#isHidden() hidden class or interface}.72* as they cannot be discovered by any class loader73* <p>74* The visible class list has useful properties with respect to75* the type namespace. A particular type name will occur at most76* once in the list. Each field or variable declared with that77* type name in a class defined by78* this class loader must be resolved to that single type.79* <p>80* No ordering of the returned list is guaranteed.81* <p>82* Note that unlike {@link #definedClasses()}83* and {@link VirtualMachine#allClasses()},84* some of the returned reference types may not be prepared.85* Attempts to perform some operations on unprepared reference types86* (e.g. {@link ReferenceType#fields() fields()}) will throw87* a {@link ClassNotPreparedException}.88* Use {@link ReferenceType#isPrepared()} to determine if89* a reference type is prepared.90*91* @return a {@code List} of {@link ReferenceType} objects mirroring92* classes which this class loader can find by name. The list93* has length 0 if no classes are visible to this classloader.94*95* @see <a href="{@docRoot}/../specs/jvmti/jvmti.html#GetClassLoaderClasses">96* JVM TI GetClassLoaderClasses</a>97*/98List<ReferenceType> visibleClasses();99}100101102