1 /*
   2  * Copyright (c) 2015, 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 
  29 /**
  30  * A module that currently exists in the target VM.
  31  * <p>
  32  * Any method on <code>Module</code> which directly or
  33  * indirectly takes <code>Module</code> as an 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>Module</code> which directly or
  39  * indirectly takes <code>Module</code> as an 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>Module</code> or which directly or indirectly takes
  43  * <code>Module</code> as parameter may throw
  44  * {@link com.sun.jdi.InvalidModuleException} if the mirrored module
  45  * has been unloaded.
  46  *
  47  * @since  1.9
  48  */
  49 @jdk.Exported
  50 public interface Module extends Mirror {
  51 
  52     /**
  53      * Returns the module name.
  54      * This method returns {@code null}
  55      * if this module is an unnamed module.
  56      *
  57      * @return the name of this module.
  58      * @throws java.lang.UnsupportedOperationException if
  59      * the target virtual machine does not support this
  60      * operation.
  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      * @throws java.lang.UnsupportedOperationException if
  69      * the target virtual machine does not support this
  70      * operation.
  71      */
  72     ClassLoaderReference classLoader();
  73 
  74     /**
  75      * Determines if this module has a read edge
  76      * with the target {@link Module} module.
  77      *
  78      * @return <code>true</code> if the target {@link Module}
  79      * module is readable, <code>false</code> otherwise.
  80      * @throws java.lang.UnsupportedOperationException if
  81      * the target virtual machine does not support this
  82      * operation.
  83      */
  84     boolean canRead(Module module);
  85 }