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 public interface ClassLoaderReference extends ObjectReference { 43 44 /** 45 * Returns a list of all loaded classes that were defined by this 46 * class loader. No ordering of this list guaranteed. 47 * <P> 48 * The returned list will include reference types 49 * loaded at least to the point of preparation and 50 * types (like array) for which preparation is 51 * not defined. 52 * 53 * @return a List of {@link ReferenceType} objects mirroring types 54 * loaded by this class loader. The list has length 0 if no types 55 * have been defined by this classloader. 56 */ 57 List<ReferenceType> definedClasses(); 58 59 /** 60 * Returns a list of all classes for which this class loader has 61 * been recorded as the initiating loader in the target VM. 62 * The list contains ReferenceTypes defined directly by this loader 63 * (as returned by {@link #definedClasses}) and any types for which 64 * loading was delegated by this class loader to another class loader. 65 * <p> 66 * The visible class list has useful properties with respect to 67 * the type namespace. A particular type name will occur at most 68 * once in the list. Each field or variable declared with that 69 * type name in a class defined by 70 * this class loader must be resolved to that single type. 71 * <p> 72 * No ordering of the returned list is guaranteed. 73 * <p> 74 * See 75 * <cite>The Java™ Virtual Machine Specification</cite>, 76 * section 5.3 - Creation and Loading 77 * for more information on the initiating classloader. 78 * <p> 79 * Note that unlike {@link #definedClasses()} 80 * and {@link VirtualMachine#allClasses()}, 81 * some of the returned reference types may not be prepared. 82 * Attempts to perform some operations on unprepared reference types 83 * (e.g. {@link ReferenceType#fields() fields()}) will throw 84 * a {@link ClassNotPreparedException}. 85 * Use {@link ReferenceType#isPrepared()} to determine if 86 * a reference type is prepared. 87 * 88 * @return a List of {@link ReferenceType} objects mirroring classes 89 * initiated by this class loader. The list has length 0 if no classes 90 * are visible to this classloader. 91 */ 92 List<ReferenceType> visibleClasses(); 93 }