1 /* 2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.jdi; 27 28 import java.util.List; 29 30 /** 31 * A class loader object from the target VM. 32 * A ClassLoaderReference is an {@link ObjectReference} with additional 33 * access to classloader-specific information from the target VM. Instances 34 * ClassLoaderReference are obtained through calls to 35 * {@link ReferenceType#classLoader} 36 * 37 * @see ObjectReference 38 * 39 * @author Gordon Hirsch 40 * @since 1.3 41 */ 42 @jdk.Exported 43 public interface ClassLoaderReference extends ObjectReference { 44 45 /** 46 * Returns a list of all loaded classes that were defined by this 47 * class loader. No ordering of this list guaranteed. 48 * <P> 49 * The returned list will include reference types 50 * loaded at least to the point of preparation and 51 * types (like array) for which preparation is 52 * not defined. 53 * 54 * @return a List of {@link ReferenceType} objects mirroring types 55 * loaded by this class loader. The list has length 0 if no types 56 * have been defined by this classloader. 57 */ definedClasses()58 List<ReferenceType> definedClasses(); 59 60 /** 61 * Returns a list of all classes for which this class loader has 62 * been recorded as the initiating loader in the target VM. 63 * The list contains ReferenceTypes defined directly by this loader 64 * (as returned by {@link #definedClasses}) and any types for which 65 * loading was delegated by this class loader to another class loader. 66 * <p> 67 * The visible class list has useful properties with respect to 68 * the type namespace. A particular type name will occur at most 69 * once in the list. Each field or variable declared with that 70 * type name in a class defined by 71 * this class loader must be resolved to that single type. 72 * <p> 73 * No ordering of the returned list is guaranteed. 74 * <p> 75 * See 76 * <cite>The Java™ Virtual Machine Specification</cite>, 77 * section 5.3 - Creation and Loading 78 * for more information on the initiating classloader. 79 * <p> 80 * Note that unlike {@link #definedClasses()} 81 * and {@link VirtualMachine#allClasses()}, 82 * some of the returned reference types may not be prepared. 83 * Attempts to perform some operations on unprepared reference types 84 * (e.g. {@link ReferenceType#fields() fields()}) will throw 85 * a {@link ClassNotPreparedException}. 86 * Use {@link ReferenceType#isPrepared()} to determine if 87 * a reference type is prepared. 88 * 89 * @return a List of {@link ReferenceType} objects mirroring classes 90 * initiated by this class loader. The list has length 0 if no classes 91 * are visible to this classloader. 92 */ visibleClasses()93 List<ReferenceType> visibleClasses(); 94 } 95