ModuleReference.java revision 16177:89ef4b822745
1/*
2 * Copyright (c) 2016, 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
26package com.sun.jdi;
27
28
29/**
30 * A module in the target VM.
31 * <p>
32 * Any method on {@code ModuleReference} which directly or
33 * indirectly takes {@code ModuleReference} as a parameter may throw
34 * {@link com.sun.jdi.VMDisconnectedException} if the target VM is
35 * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
36 * available to be read from the {@link com.sun.jdi.event.EventQueue}.
37 * <p>
38 * Any method on {@code ModuleReference} which directly or
39 * indirectly takes {@code ModuleReference} as a parameter may throw
40 * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
41 * <p>
42 * Any method on {@code ModuleReference} or which directly or indirectly takes
43 * {@code ModuleReference} as a parameter may throw
44 * {@link com.sun.jdi.InvalidModuleException} if the mirrored module
45 * has been unloaded.
46 *
47 * Not all target virtual machines support this class.
48 * Use {@link VirtualMachine#canGetModuleInfo()}
49 * to determine if the class is supported.
50 *
51 * @since  9
52 */
53public interface ModuleReference extends ObjectReference {
54
55    /**
56     * Returns the module name.
57     * This method returns {@code null}
58     * if this module is an unnamed module.
59     *
60     * @return the name of this module.
61     */
62    String name();
63
64    /**
65     * Returns the {@link ClassLoaderReference} object for this module.
66     *
67     * @return the {@link ClassLoaderReference} object for this module.
68     */
69    ClassLoaderReference classLoader();
70}
71