langtools/src/java.compiler/share/classes/javax/tools/JavaFileManager.java
author amurillo
Fri, 10 Jun 2016 15:13:40 -0700
changeset 38958 d8a4ce6d05ad
parent 36526 3b41f1c69604
child 42261 bb52b5514ad5
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
     2
 * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package javax.tools;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import java.io.Closeable;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
import java.io.Flushable;
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import java.io.IOException;
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
import java.util.Iterator;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
    32
import java.util.ServiceLoader;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
import java.util.Set;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
    34
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
import static javax.tools.JavaFileObject.Kind;
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * File manager for tools operating on Java™ programming language
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * source and class files.  In this context, <em>file</em> means an
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * abstraction of regular files and other sources of data.
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * <p>When constructing new JavaFileObjects, the file manager must
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * determine where to create them.  For example, if a file manager
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * manages regular files on a file system, it would most likely have a
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * current/working directory to use as default location when creating
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 * or finding files.  A number of hints can be provided to a file
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 * manager as to where to create files.  Any file manager might choose
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 * to ignore these hints.
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * <p>Some methods in this interface use class names.  Such class
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 * names must be given in the Java Virtual Machine internal form of
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 * fully qualified class and interface names.  For convenience '.'
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 * and '/' are interchangeable.  The internal form is defined in
9303
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 5848
diff changeset
    54
 * chapter four of
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 5848
diff changeset
    55
 * <cite>The Java&trade; Virtual Machine Specification</cite>.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
 * <blockquote><p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
 *   <i>Discussion:</i> this means that the names
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
 *   "java/lang.package-info", "java/lang/package-info",
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
 *   "java.lang.package-info", are valid and equivalent.  Compare to
9303
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 5848
diff changeset
    61
 *   binary name as defined in
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 5848
diff changeset
    62
 *   <cite>The Java&trade; Language Specification</cite>,
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 5848
diff changeset
    63
 *   section 13.1 "The Form of a Binary".
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
 * </p></blockquote>
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
 * <p>The case of names is significant.  All names should be treated
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
 * as case-sensitive.  For example, some file systems have
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
 * case-insensitive, case-aware file names.  File objects representing
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
 * such files should take care to preserve case by using {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
 * java.io.File#getCanonicalFile} or similar means.  If the system is
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
 * not case-aware, file objects must use other means to preserve case.
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
 * <p><em><a name="relative_name">Relative names</a>:</em> some
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
 * methods in this interface use relative names.  A relative name is a
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
 * non-null, non-empty sequence of path segments separated by '/'.
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
 * '.' or '..'  are invalid path segments.  A valid relative name must
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
 * match the "path-rootless" rule of <a
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
 * href="http://www.ietf.org/rfc/rfc3986.txt">RFC&nbsp;3986</a>,
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
 * section&nbsp;3.3.  Informally, this should be true:
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
 * <!-- URI.create(relativeName).normalize().getPath().equals(relativeName) -->
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
 * <pre>  URI.{@linkplain java.net.URI#create create}(relativeName).{@linkplain java.net.URI#normalize normalize}().{@linkplain java.net.URI#getPath getPath}().equals(relativeName)</pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
 * <p>All methods in this interface might throw a SecurityException.
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
 * <p>An object of this interface is not required to support
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
 * multi-threaded access, that is, be synchronized.  However, it must
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
 * support concurrent access to different file objects created by this
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
 * object.
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
 * <p><em>Implementation note:</em> a consequence of this requirement
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
 * is that a trivial implementation of output to a {@linkplain
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
 * java.util.jar.JarOutputStream} is not a sufficient implementation.
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
 * That is, rather than creating a JavaFileObject that returns the
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
 * JarOutputStream directly, the contents must be cached until closed
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
 * and then written to the JarOutputStream.
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
 * <p>Unless explicitly allowed, all methods in this interface might
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
 * throw a NullPointerException if given a {@code null} argument.
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
 * @author Peter von der Ah&eacute;
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
 * @author Jonathan Gibbons
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
 * @see JavaFileObject
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
 * @see FileObject
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
 * @since 1.6
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
public interface JavaFileManager extends Closeable, Flushable, OptionChecker {
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     * Interface for locations of file objects.  Used by file managers
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     * to determine where to place or search for file objects.
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    interface Location {
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
        /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 9303
diff changeset
   115
         * Returns the name of this location.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
         *
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
         * @return a name
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
        String getName();
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
        /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
         * Determines if this is an output location.  An output
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
         * location is a location that is conventionally used for
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
         * output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
         *
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
         * @return true if this is an output location, false otherwise
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
        boolean isOutputLocation();
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   129
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   130
        /**
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   131
         * Indicates if this location is expected to contain modules,
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   132
         * as compared to a location which contains packages and classes.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   133
         *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   134
         * @return true if this location is expected to contain modules
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   135
         * @since 9
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   136
         */
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   137
        default boolean isModuleLocation() {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   138
            return false;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   139
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 9303
diff changeset
   143
     * Returns a class loader for loading plug-ins from the given
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
     * location.  For example, to load annotation processors, a
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
     * compiler will request a class loader for the {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
     * StandardLocation#ANNOTATION_PROCESSOR_PATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
     * ANNOTATION_PROCESSOR_PATH} location.
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
     * @param location a location
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
     * @return a class loader for the given location; or {@code null}
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     * if loading plug-ins from the given location is disabled or if
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     * the location is not known
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
     * @throws SecurityException if a class loader can not be created
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
     * in the current security context
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
     * @throws IllegalStateException if {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
    ClassLoader getClassLoader(Location location);
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
     * Lists all file objects matching the given criteria in the given
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
     * location.  List file objects in "subpackages" if recurse is
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
     * true.
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
     * <p>Note: even if the given location is unknown to this file
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
     * manager, it may not return {@code null}.  Also, an unknown
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
     * location may not cause an exception.
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
     * @param location     a location
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
     * @param packageName  a package name
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
     * @param kinds        return objects only of these kinds
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
     * @param recurse      if true include "subpackages"
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
     * @return an Iterable of file objects matching the given criteria
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
     * @throws IOException if an I/O error occurred, or if {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
     * #close} has been called and this file manager cannot be
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
     * reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
     * @throws IllegalStateException if {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
    Iterable<JavaFileObject> list(Location location,
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
                                  String packageName,
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
                                  Set<Kind> kinds,
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
                                  boolean recurse)
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
        throws IOException;
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
     * Infers a binary name of a file object based on a location.  The
9303
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 5848
diff changeset
   188
     * binary name returned might not be a valid binary name according to
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 5848
diff changeset
   189
     * <cite>The Java&trade; Language Specification</cite>.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
     * @param location a location
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
     * @param file a file object
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
     * @return a binary name or {@code null} the file object is not
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     * found in the given location
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
     * @throws IllegalStateException if {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
    String inferBinaryName(Location location, JavaFileObject file);
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
     * Compares two file objects and return true if they represent the
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
     * same underlying object.
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     * @param a a file object
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
     * @param b a file object
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
     * @return true if the given file objects represent the same
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
     * underlying object
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
     * @throws IllegalArgumentException if either of the arguments
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
     * were created with another file manager and this file manager
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
     * does not support foreign file objects
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
    boolean isSameFile(FileObject a, FileObject b);
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
     * Handles one option.  If {@code current} is an option to this
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
     * file manager it will consume any arguments to that option from
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
     * {@code remaining} and return true, otherwise return false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
     * @param current current option
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
     * @param remaining remaining options
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
     * @return true if this option was handled by this file manager,
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
     * false otherwise
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
     * @throws IllegalArgumentException if this option to this file
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
     * manager is used incorrectly
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
     * @throws IllegalStateException if {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
    boolean handleOption(String current, Iterator<String> remaining);
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
     * Determines if a location is known to this file manager.
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
     * @param location a location
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
     * @return true if the location is known
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
    boolean hasLocation(Location location);
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 9303
diff changeset
   240
     * Returns a {@linkplain JavaFileObject file object} for input
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
     * representing the specified class of the specified kind in the
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
     * given location.
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
     * @param location a location
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
     * @param className the name of a class
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
     * @param kind the kind of file, must be one of {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
     * JavaFileObject.Kind#SOURCE SOURCE} or {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
     * JavaFileObject.Kind#CLASS CLASS}
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
     * @return a file object, might return {@code null} if the
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
     * file does not exist
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
     * @throws IllegalArgumentException if the location is not known
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
     * to this file manager and the file manager does not support
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
     * unknown locations, or if the kind is not valid
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
     * @throws IOException if an I/O error occurred, or if {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
     * #close} has been called and this file manager cannot be
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
     * reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
     * @throws IllegalStateException if {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
    JavaFileObject getJavaFileForInput(Location location,
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
                                       String className,
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
                                       Kind kind)
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
        throws IOException;
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 9303
diff changeset
   266
     * Returns a {@linkplain JavaFileObject file object} for output
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
     * representing the specified class of the specified kind in the
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
     * given location.
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
     * <p>Optionally, this file manager might consider the sibling as
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
     * a hint for where to place the output.  The exact semantics of
5848
c5a4ce47e780 6960407: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5520
diff changeset
   272
     * this hint is unspecified.  The JDK compiler, javac, for
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
     * example, will place class files in the same directories as
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
     * originating source files unless a class file output directory
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
     * is provided.  To facilitate this behavior, javac might provide
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
     * the originating source file as sibling when calling this
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
     * method.
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
     * @param location a location
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
     * @param className the name of a class
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
     * @param kind the kind of file, must be one of {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
     * JavaFileObject.Kind#SOURCE SOURCE} or {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
     * JavaFileObject.Kind#CLASS CLASS}
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
     * @param sibling a file object to be used as hint for placement;
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
     * might be {@code null}
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
     * @return a file object for output
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
     * @throws IllegalArgumentException if sibling is not known to
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
     * this file manager, or if the location is not known to this file
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
     * manager and the file manager does not support unknown
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
     * locations, or if the kind is not valid
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
     * @throws IOException if an I/O error occurred, or if {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
     * #close} has been called and this file manager cannot be
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
     * reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
     * @throws IllegalStateException {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
    JavaFileObject getJavaFileForOutput(Location location,
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
                                        String className,
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
                                        Kind kind,
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
                                        FileObject sibling)
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
        throws IOException;
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 9303
diff changeset
   304
     * Returns a {@linkplain FileObject file object} for input
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
     * representing the specified <a href="JavaFileManager.html#relative_name">relative
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
     * name</a> in the specified package in the given location.
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
     * <p>If the returned object represents a {@linkplain
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
     * JavaFileObject.Kind#SOURCE source} or {@linkplain
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
     * JavaFileObject.Kind#CLASS class} file, it must be an instance
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
     * of {@link JavaFileObject}.
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
     * <p>Informally, the file object returned by this method is
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
     * located in the concatenation of the location, package name, and
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
     * relative name.  For example, to locate the properties file
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
     * "resources/compiler.properties" in the package
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
     * "com.sun.tools.javac" in the {@linkplain
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
     * StandardLocation#SOURCE_PATH SOURCE_PATH} location, this method
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
     * might be called like so:
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
     * <pre>getFileForInput(SOURCE_PATH, "com.sun.tools.javac", "resources/compiler.properties");</pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
     * <p>If the call was executed on Windows, with SOURCE_PATH set to
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
     * <code>"C:\Documents&nbsp;and&nbsp;Settings\UncleBob\src\share\classes"</code>,
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
     * a valid result would be a file object representing the file
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
     * <code>"C:\Documents&nbsp;and&nbsp;Settings\UncleBob\src\share\classes\com\sun\tools\javac\resources\compiler.properties"</code>.
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
     * @param location a location
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
     * @param packageName a package name
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
     * @param relativeName a relative name
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
     * @return a file object, might return {@code null} if the file
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
     * does not exist
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
     * @throws IllegalArgumentException if the location is not known
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
     * to this file manager and the file manager does not support
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
     * unknown locations, or if {@code relativeName} is not valid
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
     * @throws IOException if an I/O error occurred, or if {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
     * #close} has been called and this file manager cannot be
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
     * reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
     * @throws IllegalStateException if {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
    FileObject getFileForInput(Location location,
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
                               String packageName,
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
                               String relativeName)
06bc494ca11e Initial load
duke
parents:
diff changeset
   345
        throws IOException;
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 9303
diff changeset
   348
     * Returns a {@linkplain FileObject file object} for output
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
     * representing the specified <a href="JavaFileManager.html#relative_name">relative
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
     * name</a> in the specified package in the given location.
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
     * <p>Optionally, this file manager might consider the sibling as
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
     * a hint for where to place the output.  The exact semantics of
5848
c5a4ce47e780 6960407: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5520
diff changeset
   354
     * this hint is unspecified.  The JDK compiler, javac, for
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
     * example, will place class files in the same directories as
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
     * originating source files unless a class file output directory
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
     * is provided.  To facilitate this behavior, javac might provide
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
     * the originating source file as sibling when calling this
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
     * method.
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
     * <p>If the returned object represents a {@linkplain
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
     * JavaFileObject.Kind#SOURCE source} or {@linkplain
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
     * JavaFileObject.Kind#CLASS class} file, it must be an instance
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
     * of {@link JavaFileObject}.
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   366
     * <p>Informally, the file object returned by this method is
06bc494ca11e Initial load
duke
parents:
diff changeset
   367
     * located in the concatenation of the location, package name, and
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
     * relative name or next to the sibling argument.  See {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
     * #getFileForInput getFileForInput} for an example.
06bc494ca11e Initial load
duke
parents:
diff changeset
   370
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
     * @param location a location
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
     * @param packageName a package name
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
     * @param relativeName a relative name
06bc494ca11e Initial load
duke
parents:
diff changeset
   374
     * @param sibling a file object to be used as hint for placement;
06bc494ca11e Initial load
duke
parents:
diff changeset
   375
     * might be {@code null}
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
     * @return a file object
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
     * @throws IllegalArgumentException if sibling is not known to
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
     * this file manager, or if the location is not known to this file
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
     * manager and the file manager does not support unknown
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
     * locations, or if {@code relativeName} is not valid
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
     * @throws IOException if an I/O error occurred, or if {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
     * #close} has been called and this file manager cannot be
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
     * reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
     * @throws IllegalStateException if {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
    FileObject getFileForOutput(Location location,
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
                                String packageName,
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
                                String relativeName,
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
                                FileObject sibling)
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
        throws IOException;
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
06bc494ca11e Initial load
duke
parents:
diff changeset
   393
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
     * Flushes any resources opened for output by this file manager
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
     * directly or indirectly.  Flushing a closed file manager has no
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
     * effect.
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
     * @throws IOException if an I/O error occurred
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
     * @see #close
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
     */
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   401
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
    void flush() throws IOException;
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
     * Releases any resources opened by this file manager directly or
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
     * indirectly.  This might render this file manager useless and
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
     * the effect of subsequent calls to methods on this object or any
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
     * objects obtained through this object is undefined unless
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
     * explicitly allowed.  However, closing a file manager which has
06bc494ca11e Initial load
duke
parents:
diff changeset
   410
     * already been closed has no effect.
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   412
     * @throws IOException if an I/O error occurred
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
     * @see #flush
06bc494ca11e Initial load
duke
parents:
diff changeset
   414
     */
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   415
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   416
    void close() throws IOException;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   417
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   418
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   419
     * Gets a location for a named module within a module-oriented location.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   420
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   421
     * @param location the module-oriented location
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   422
     * @param moduleName the name of the module to be found
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   423
     * @return the location for the named module
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   424
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   425
     * @throws IOException if an I/O error occurred
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   426
     * @throws UnsupportedOperationException if this operation if not supported by this file manager
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   427
     * @since 9
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   428
     */ // TODO: describe failure modes
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   429
    default Location getModuleLocation(Location location, String moduleName) throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   430
        throw new UnsupportedOperationException();
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   431
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   432
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   433
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   434
     * Gets a location for the module containing a specific file representing a Java
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   435
     * source or class.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   436
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   437
     * @param location a module-oriented location
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   438
     * @param fo the file
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   439
     * @param pkgName the package name for the class(es) defined in this file
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   440
     * @return the module containing the file
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   441
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   442
     * @throws IOException if an I/O error occurred
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   443
     * @throws UnsupportedOperationException if this operation if not supported by this file manager
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   444
     * @since 9
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   445
     */ // TODO: describe failure modes
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   446
    default Location getModuleLocation(Location location, JavaFileObject fo, String pkgName) throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   447
        throw new UnsupportedOperationException();
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   448
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   449
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   450
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   451
     * Get a service loader for a specific service class from a given location.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   452
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   453
     * @param location the location
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   454
     * @param service  the {@code Class} object of the service class
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   455
     * @param <S> the service class
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   456
     * @return a service loader for the given service class
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   457
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   458
     * @throws IOException if an I/O error occurred
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   459
     * @throws UnsupportedOperationException if this operation if not supported by this file manager
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   460
     * @since 9
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   461
     */ // TODO: describe failure modes
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   462
    default <S> ServiceLoader<S> getServiceLoader(Location location, Class<S> service) throws  IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   463
        throw new UnsupportedOperationException();
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   464
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   465
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   466
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   467
     * Infer the name of the module from its location, as returned by
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   468
     * getModuleLocation or listModuleLocations.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   469
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   470
     * @param location a location representing a module
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   471
     * @return the name of the module
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   472
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   473
     * @throws IOException if an I/O error occurred
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   474
     * @throws UnsupportedOperationException if this operation if not supported by this file manager
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   475
     * @since 9
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   476
     */ // TODO: describe failure modes
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   477
    default String inferModuleName(Location location) throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   478
        throw new UnsupportedOperationException();
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   479
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   480
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   481
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   482
     * Lists the modules in a module-oriented location.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   483
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   484
     * @param location  the location for which to list the modules
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   485
     * @return  a series of sets of locations containing modules
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   486
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   487
     * @throws IOException if an I/O error occurred
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   488
     * @throws UnsupportedOperationException if this operation if not supported by this file manager
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   489
     * @since 9
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   490
     */ // TODO: describe failure modes
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   491
    default Iterable<Set<Location>> listModuleLocations(Location location) throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   492
        throw new UnsupportedOperationException();
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   493
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   494
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   495
}