blob: 892117fff34f67d7b00639bf1cf2aefcc2bb98a5 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1998-2004 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package com.sun.jdi;
27
28import 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 */
42public 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 the revised
75 * <a href="http://java.sun.com/docs/books/vmspec/">Java
76 * Virtual Machine Specification</a> section
77 * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#72007">5.3
78 * Creation and Loading</a>
79 * for more information on the initiating classloader.
80 * <p>
81 * Note that unlike {@link #definedClasses()}
82 * and {@link VirtualMachine#allClasses()},
83 * some of the returned reference types may not be prepared.
84 * Attempts to perform some operations on unprepared reference types
85 * (e.g. {@link ReferenceType#fields() fields()}) will throw
86 * a {@link ClassNotPreparedException}.
87 * Use {@link ReferenceType#isPrepared()} to determine if
88 * a reference type is prepared.
89 *
90 * @return a List of {@link ReferenceType} objects mirroring classes
91 * initiated by this class loader. The list has length 0 if no classes
92 * are visible to this classloader.
93 */
94 List<ReferenceType> visibleClasses();
95}