src/java.compiler/share/classes/javax/tools/JavaFileManager.java
author naoto
Fri, 16 Feb 2018 14:03:34 -0800
changeset 48910 67cdc215ed70
parent 47216 71c04702a3d5
permissions -rw-r--r--
8198228: Spec clarification: j.u.Locale.getDisplayName() Reviewed-by: rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
44063
5f0cf4126949 8175560: Drop String pkgName from javax.tools.JavaFileManager.getLocationForModule(Location location, JavaFileObject fo, String pkgName)
jlahoda
parents: 43860
diff changeset
     2
 * Copyright (c) 2005, 2017, 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
 *
44878
9dd9cf7919ff 8179299: Fix HTML 5 errors in java.compiler module
jjg
parents: 44822
diff changeset
    73
 * <p><em><a id="relative_name">Relative names</a>:</em> some
10
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.
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   112
     *
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   113
     * <p>Informally, a {@code Location} corresponds to a "search path", such as a class
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   114
     * path or module path, as used by command-line tools that use the default file system.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   115
     *
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   116
     * <p>Some locations are typically used to identify a place in which
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   117
     * a tool can find files to be read; others are typically used to identify
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   118
     * a place where a tool can write files. If a location is used to identify
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   119
     * a place for reading files, those files may be organized in a simple
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   120
     * <em>package/class</em> hierarchy: such locations are described as
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   121
     * <strong>package-oriented</strong>.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   122
     * Alternatively, the files may be organized in a <em>module/package/class</em>
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   123
     * hierarchy: such locations are described as <strong>module-oriented</strong>.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   124
     * If a location is typically used to identify a place where a tool can write files,
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   125
     * it is up to the tool that writes the files to specify how those files will be
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   126
     * organized.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   127
     *
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   128
     * <p>You can access the classes in a package-oriented location using methods like
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   129
     * {@link JavaFileManager#getJavaFileForInput} or {@link JavaFileManager#list}.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   130
     * It is not possible to directly list the classes in a module-oriented
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   131
     * location. Instead, you can get a package-oriented location for any specific module
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   132
     * using methods like {@link JavaFileManager#getLocationForModule} or
43860
e1f41df9a00c 8174860: Fix bad javadoc link in javax.tools.JavaFileManager
darcy
parents: 43767
diff changeset
   133
     * {@link JavaFileManager#listLocationsForModules}.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    interface Location {
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
        /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 9303
diff changeset
   137
         * Returns the name of this location.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
         *
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
         * @return a name
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
        String getName();
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
        /**
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   144
         * Determines if this is an output location.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   145
         * An output location is a location that is conventionally used for
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
         * output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
         *
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   148
         * @apiNote An output location may be used to write files in either
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   149
         * a package-oriented organization or in a module-oriented organization.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   150
         *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
         * @return true if this is an output location, false otherwise
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
         */
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
        boolean isOutputLocation();
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   154
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   155
        /**
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   156
         * Indicates if this location is module-oriented location, and therefore
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   157
         * expected to contain classes in a <em>module/package/class</em>
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   158
         * hierarchy, as compared to a package-oriented location, which
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   159
         * is expected to contain classes in a <em>package/class</em> hierarchy.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   160
         * The result of this method is undefined if this is an output
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   161
         * location.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   162
         *
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   163
         * @implNote This implementation returns true if the name includes
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   164
         * the word "MODULE".
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   165
         *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   166
         * @return true if this location is expected to contain modules
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   167
         * @since 9
43767
9cff98a149cb 8173393: Module system implementation refresh (2/2017)
alanb
parents: 42814
diff changeset
   168
         * @spec JPMS
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   169
         */
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   170
        default boolean isModuleOrientedLocation() {
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   171
            return getName().matches("\\bMODULE\\b");
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   172
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 9303
diff changeset
   176
     * Returns a class loader for loading plug-ins from the given
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   177
     * package-oriented location.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   178
     * For example, to load annotation processors,
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   179
     * a compiler will request a class loader for the {@link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
     * StandardLocation#ANNOTATION_PROCESSOR_PATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
     * ANNOTATION_PROCESSOR_PATH} location.
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
     * @param location a location
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
     * @return a class loader for the given location; or {@code null}
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
     * if loading plug-ins from the given location is disabled or if
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
     * the location is not known
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
     * @throws SecurityException if a class loader can not be created
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
     * in the current security context
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
     * @throws IllegalStateException if {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
     * and this file manager cannot be reopened
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   191
     * @throws IllegalArgumentException if the location is a module-oriented location
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
    ClassLoader getClassLoader(Location location);
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
     * Lists all file objects matching the given criteria in the given
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   197
     * package-oriented location.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   198
     * List file objects in "subpackages" if recurse is true.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
     * <p>Note: even if the given location is unknown to this file
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
     * manager, it may not return {@code null}.  Also, an unknown
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
     * location may not cause an exception.
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     * @param location     a location
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
     * @param packageName  a package name
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
     * @param kinds        return objects only of these kinds
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
     * @param recurse      if true include "subpackages"
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
     * @return an Iterable of file objects matching the given criteria
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
     * @throws IOException if an I/O error occurred, or if {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
     * #close} has been called and this file manager cannot be
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
     * reopened
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   212
     * @throws IllegalArgumentException if the location is a module-oriented location
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
     * @throws IllegalStateException if {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
    Iterable<JavaFileObject> list(Location location,
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
                                  String packageName,
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
                                  Set<Kind> kinds,
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
                                  boolean recurse)
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
        throws IOException;
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
    /**
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   223
     * Infers a binary name of a file object based on a package-oriented location.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   224
     * The binary name returned might not be a valid binary name according to
9303
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 5848
diff changeset
   225
     * <cite>The Java&trade; Language Specification</cite>.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
     * @param location a location
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
     * @param file a file object
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
     * @return a binary name or {@code null} the file object is not
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
     * found in the given location
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   231
     * @throws IllegalArgumentException if the location is a module-oriented location
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
     * @throws IllegalStateException if {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
    String inferBinaryName(Location location, JavaFileObject file);
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
     * Compares two file objects and return true if they represent the
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
     * same underlying object.
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
     * @param a a file object
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
     * @param b a file object
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
     * @return true if the given file objects represent the same
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
     * underlying object
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
     * @throws IllegalArgumentException if either of the arguments
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
     * were created with another file manager and this file manager
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
     * does not support foreign file objects
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
    boolean isSameFile(FileObject a, FileObject b);
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
     * Handles one option.  If {@code current} is an option to this
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
     * file manager it will consume any arguments to that option from
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
     * {@code remaining} and return true, otherwise return false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
     * @param current current option
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
     * @param remaining remaining options
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
     * @return true if this option was handled by this file manager,
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
     * false otherwise
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
     * @throws IllegalArgumentException if this option to this file
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
     * manager is used incorrectly
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
     * @throws IllegalStateException if {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
    boolean handleOption(String current, Iterator<String> remaining);
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
     * Determines if a location is known to this file manager.
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
     * @param location a location
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
     * @return true if the location is known
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
    boolean hasLocation(Location location);
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 9303
diff changeset
   277
     * Returns a {@linkplain JavaFileObject file object} for input
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
     * representing the specified class of the specified kind in the
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   279
     * given package-oriented location.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
     * @param location a location
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
     * @param className the name of a class
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
     * @param kind the kind of file, must be one of {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
     * JavaFileObject.Kind#SOURCE SOURCE} or {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
     * JavaFileObject.Kind#CLASS CLASS}
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
     * @return a file object, might return {@code null} if the
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
     * file does not exist
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
     * @throws IllegalArgumentException if the location is not known
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
     * to this file manager and the file manager does not support
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   290
     * unknown locations, or if the kind is not valid, or if the
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   291
     * location is a module-oriented location
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
     * @throws IOException if an I/O error occurred, or if {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
     * #close} has been called and this file manager cannot be
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
     * reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
     * @throws IllegalStateException if {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
    JavaFileObject getJavaFileForInput(Location location,
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
                                       String className,
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
                                       Kind kind)
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 JavaFileObject file object} for output
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
     * representing the specified class of the specified kind in the
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   306
     * given package-oriented location.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
     * <p>Optionally, this file manager might consider the sibling as
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
     * 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
   310
     * this hint is unspecified.  The JDK compiler, javac, for
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
     * example, will place class files in the same directories as
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
     * originating source files unless a class file output directory
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
     * is provided.  To facilitate this behavior, javac might provide
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
     * the originating source file as sibling when calling this
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
     * method.
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
     *
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   317
     * @param location a package-oriented location
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
     * @param className the name of a class
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
     * @param kind the kind of file, must be one of {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
     * JavaFileObject.Kind#SOURCE SOURCE} or {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
     * JavaFileObject.Kind#CLASS CLASS}
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
     * @param sibling a file object to be used as hint for placement;
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
     * might be {@code null}
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
     * @return a file object for output
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
     * @throws IllegalArgumentException if sibling is not known to
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
     * this file manager, or if the location is not known to this file
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
     * manager and the file manager does not support unknown
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   328
     * locations, or if the kind is not valid, or if the location is
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   329
     * not an output location
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
     * @throws IOException if an I/O error occurred, or if {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
     * #close} has been called and this file manager cannot be
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
     * reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
     * @throws IllegalStateException {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
    JavaFileObject getJavaFileForOutput(Location location,
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
                                        String className,
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
                                        Kind kind,
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
                                        FileObject sibling)
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
        throws IOException;
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 9303
diff changeset
   343
     * Returns a {@linkplain FileObject file object} for input
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
     * representing the specified <a href="JavaFileManager.html#relative_name">relative
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   345
     * name</a> in the specified package in the given package-oriented location.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
     * <p>If the returned object represents a {@linkplain
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
     * JavaFileObject.Kind#SOURCE source} or {@linkplain
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
     * JavaFileObject.Kind#CLASS class} file, it must be an instance
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
     * of {@link JavaFileObject}.
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
     * <p>Informally, the file object returned by this method is
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
     * located in the concatenation of the location, package name, and
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
     * relative name.  For example, to locate the properties file
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
     * "resources/compiler.properties" in the package
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
     * "com.sun.tools.javac" in the {@linkplain
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
     * StandardLocation#SOURCE_PATH SOURCE_PATH} location, this method
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
     * might be called like so:
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
     * <pre>getFileForInput(SOURCE_PATH, "com.sun.tools.javac", "resources/compiler.properties");</pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
     * <p>If the call was executed on Windows, with SOURCE_PATH set to
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
     * <code>"C:\Documents&nbsp;and&nbsp;Settings\UncleBob\src\share\classes"</code>,
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
     * a valid result would be a file object representing the file
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
     * <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
   366
     *
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   367
     * @param location a package-oriented location
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
     * @param packageName a package name
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
     * @param relativeName a relative name
06bc494ca11e Initial load
duke
parents:
diff changeset
   370
     * @return a file object, might return {@code null} if the file
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
     * does not exist
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
     * @throws IllegalArgumentException if the location is not known
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
     * to this file manager and the file manager does not support
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   374
     * unknown locations, or if {@code relativeName} is not valid,
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   375
     * or if the location is a module-oriented location
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
     * @throws IOException if an I/O error occurred, or if {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
     * #close} has been called and this file manager cannot be
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
     * reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
     * @throws IllegalStateException if {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
    FileObject getFileForInput(Location location,
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
                               String packageName,
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
                               String relativeName)
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
        throws IOException;
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
    /**
25287
d2440361b323 8046614: Fill in missing doc comments
jjg
parents: 9303
diff changeset
   388
     * Returns a {@linkplain FileObject file object} for output
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
     * representing the specified <a href="JavaFileManager.html#relative_name">relative
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
     * name</a> in the specified package in the given location.
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
     * <p>Optionally, this file manager might consider the sibling as
06bc494ca11e Initial load
duke
parents:
diff changeset
   393
     * 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
   394
     * this hint is unspecified.  The JDK compiler, javac, for
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
     * example, will place class files in the same directories as
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
     * originating source files unless a class file output directory
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
     * is provided.  To facilitate this behavior, javac might provide
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
     * the originating source file as sibling when calling this
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
     * method.
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
     * <p>If the returned object represents a {@linkplain
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
     * JavaFileObject.Kind#SOURCE source} or {@linkplain
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
     * JavaFileObject.Kind#CLASS class} file, it must be an instance
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
     * of {@link JavaFileObject}.
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
     * <p>Informally, the file object returned by this method is
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
     * located in the concatenation of the location, package name, and
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
     * relative name or next to the sibling argument.  See {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
     * #getFileForInput getFileForInput} for an example.
06bc494ca11e Initial load
duke
parents:
diff changeset
   410
     *
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   411
     * @param location an output location
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   412
     * @param packageName a package name
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
     * @param relativeName a relative name
06bc494ca11e Initial load
duke
parents:
diff changeset
   414
     * @param sibling a file object to be used as hint for placement;
06bc494ca11e Initial load
duke
parents:
diff changeset
   415
     * might be {@code null}
06bc494ca11e Initial load
duke
parents:
diff changeset
   416
     * @return a file object
06bc494ca11e Initial load
duke
parents:
diff changeset
   417
     * @throws IllegalArgumentException if sibling is not known to
06bc494ca11e Initial load
duke
parents:
diff changeset
   418
     * this file manager, or if the location is not known to this file
06bc494ca11e Initial load
duke
parents:
diff changeset
   419
     * manager and the file manager does not support unknown
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   420
     * locations, or if {@code relativeName} is not valid,
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   421
     * or if the location is not an output location
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   422
     * @throws IOException if an I/O error occurred, or if {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
   423
     * #close} has been called and this file manager cannot be
06bc494ca11e Initial load
duke
parents:
diff changeset
   424
     * reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   425
     * @throws IllegalStateException if {@link #close} has been called
06bc494ca11e Initial load
duke
parents:
diff changeset
   426
     * and this file manager cannot be reopened
06bc494ca11e Initial load
duke
parents:
diff changeset
   427
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   428
    FileObject getFileForOutput(Location location,
06bc494ca11e Initial load
duke
parents:
diff changeset
   429
                                String packageName,
06bc494ca11e Initial load
duke
parents:
diff changeset
   430
                                String relativeName,
06bc494ca11e Initial load
duke
parents:
diff changeset
   431
                                FileObject sibling)
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
        throws IOException;
06bc494ca11e Initial load
duke
parents:
diff changeset
   433
06bc494ca11e Initial load
duke
parents:
diff changeset
   434
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   435
     * Flushes any resources opened for output by this file manager
06bc494ca11e Initial load
duke
parents:
diff changeset
   436
     * directly or indirectly.  Flushing a closed file manager has no
06bc494ca11e Initial load
duke
parents:
diff changeset
   437
     * effect.
06bc494ca11e Initial load
duke
parents:
diff changeset
   438
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   439
     * @throws IOException if an I/O error occurred
06bc494ca11e Initial load
duke
parents:
diff changeset
   440
     * @see #close
06bc494ca11e Initial load
duke
parents:
diff changeset
   441
     */
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   442
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   443
    void flush() throws IOException;
06bc494ca11e Initial load
duke
parents:
diff changeset
   444
06bc494ca11e Initial load
duke
parents:
diff changeset
   445
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   446
     * Releases any resources opened by this file manager directly or
06bc494ca11e Initial load
duke
parents:
diff changeset
   447
     * indirectly.  This might render this file manager useless and
06bc494ca11e Initial load
duke
parents:
diff changeset
   448
     * the effect of subsequent calls to methods on this object or any
06bc494ca11e Initial load
duke
parents:
diff changeset
   449
     * objects obtained through this object is undefined unless
06bc494ca11e Initial load
duke
parents:
diff changeset
   450
     * explicitly allowed.  However, closing a file manager which has
06bc494ca11e Initial load
duke
parents:
diff changeset
   451
     * already been closed has no effect.
06bc494ca11e Initial load
duke
parents:
diff changeset
   452
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   453
     * @throws IOException if an I/O error occurred
06bc494ca11e Initial load
duke
parents:
diff changeset
   454
     * @see #flush
06bc494ca11e Initial load
duke
parents:
diff changeset
   455
     */
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   456
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   457
    void close() throws IOException;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   458
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   459
    /**
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   460
     * Gets a location for a named module within a location, which may be either
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   461
     * a module-oriented location or an output location.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   462
     * The result will be an output location if the given location is
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   463
     * an output location, or it will be a package-oriented location.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   464
     *
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   465
     * @implSpec This implementation throws {@code UnsupportedOperationException}.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   466
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   467
     * @param location the module-oriented location
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   468
     * @param moduleName the name of the module to be found
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   469
     * @return the location for the named module
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   470
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   471
     * @throws IOException if an I/O error occurred
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   472
     * @throws UnsupportedOperationException if this operation if not supported by this file manager
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   473
     * @throws IllegalArgumentException if the location is neither an output location nor a
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   474
     * module-oriented location
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   475
     * @since 9
43767
9cff98a149cb 8173393: Module system implementation refresh (2/2017)
alanb
parents: 42814
diff changeset
   476
     * @spec JPMS
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   477
     */ // TODO: describe failure modes
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   478
    default Location getLocationForModule(Location location, String moduleName) throws IOException {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   479
        throw new UnsupportedOperationException();
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
    /**
44063
5f0cf4126949 8175560: Drop String pkgName from javax.tools.JavaFileManager.getLocationForModule(Location location, JavaFileObject fo, String pkgName)
jlahoda
parents: 43860
diff changeset
   483
     * Gets a location for the module containing a specific file
5f0cf4126949 8175560: Drop String pkgName from javax.tools.JavaFileManager.getLocationForModule(Location location, JavaFileObject fo, String pkgName)
jlahoda
parents: 43860
diff changeset
   484
     * to be found within a location, which may be either
42814
058fc03646d9 8171005: Fix JavaFileManager.getLocationForModule(Location location, JavaFileObject fo, String pkgName) to work with location == CLASS_OUTPUT
jlahoda
parents: 42261
diff changeset
   485
     * a module-oriented location or an output location.
058fc03646d9 8171005: Fix JavaFileManager.getLocationForModule(Location location, JavaFileObject fo, String pkgName) to work with location == CLASS_OUTPUT
jlahoda
parents: 42261
diff changeset
   486
     * The result will be an output location if the given location is
058fc03646d9 8171005: Fix JavaFileManager.getLocationForModule(Location location, JavaFileObject fo, String pkgName) to work with location == CLASS_OUTPUT
jlahoda
parents: 42261
diff changeset
   487
     * an output location, or it will be a package-oriented location.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   488
     *
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   489
     * @implSpec This implementation throws {@code UnsupportedOperationException}.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   490
     *
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   491
     * @param location the module-oriented location
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   492
     * @param fo the file
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   493
     * @return the module containing the file
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   494
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   495
     * @throws IOException if an I/O error occurred
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   496
     * @throws UnsupportedOperationException if this operation if not supported by this file manager
42814
058fc03646d9 8171005: Fix JavaFileManager.getLocationForModule(Location location, JavaFileObject fo, String pkgName) to work with location == CLASS_OUTPUT
jlahoda
parents: 42261
diff changeset
   497
     * @throws IllegalArgumentException if the location is neither an output location nor a
058fc03646d9 8171005: Fix JavaFileManager.getLocationForModule(Location location, JavaFileObject fo, String pkgName) to work with location == CLASS_OUTPUT
jlahoda
parents: 42261
diff changeset
   498
     * module-oriented location
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   499
     * @since 9
43767
9cff98a149cb 8173393: Module system implementation refresh (2/2017)
alanb
parents: 42814
diff changeset
   500
     * @spec JPMS
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   501
     */
44063
5f0cf4126949 8175560: Drop String pkgName from javax.tools.JavaFileManager.getLocationForModule(Location location, JavaFileObject fo, String pkgName)
jlahoda
parents: 43860
diff changeset
   502
    default Location getLocationForModule(Location location, JavaFileObject fo) throws IOException {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   503
        throw new UnsupportedOperationException();
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   504
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   505
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   506
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   507
     * Get a service loader for a specific service class from a given location.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   508
     *
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   509
     * If the location is a module-oriented location, the service loader will use the
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   510
     * service declarations in the modules found in that location. Otherwise, a service loader
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   511
     * is created using the package-oriented location, in which case, the services are
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   512
     * determined using the provider-configuration files in {@code META-INF/services}.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   513
     *
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   514
     * @implSpec This implementation throws {@code UnsupportedOperationException}.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   515
     *
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   516
     * @param location the module-oriented location
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   517
     * @param service  the {@code Class} object of the service class
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   518
     * @param <S> the service class
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   519
     * @return a service loader for the given service class
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   520
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   521
     * @throws IOException if an I/O error occurred
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   522
     * @throws UnsupportedOperationException if this operation if not supported by this file manager
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   523
     * @since 9
43767
9cff98a149cb 8173393: Module system implementation refresh (2/2017)
alanb
parents: 42814
diff changeset
   524
     * @spec JPMS
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   525
     */ // TODO: describe failure modes
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   526
    default <S> ServiceLoader<S> getServiceLoader(Location location, Class<S> service) throws  IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   527
        throw new UnsupportedOperationException();
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   528
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   529
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   530
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   531
     * Infer the name of the module from its location, as returned by
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   532
     * {@code getLocationForModule} or {@code listModuleLocations}.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   533
     *
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   534
     * @implSpec This implementation throws {@code UnsupportedOperationException}.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   535
     *
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   536
     * @param location a package-oriented location representing a module
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   537
     * @return the name of the module
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   538
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   539
     * @throws IOException if an I/O error occurred
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   540
     * @throws UnsupportedOperationException if this operation if not supported by this file manager
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   541
     * @throws IllegalArgumentException if the location is not one known to this file manager
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   542
     * @since 9
43767
9cff98a149cb 8173393: Module system implementation refresh (2/2017)
alanb
parents: 42814
diff changeset
   543
     * @spec JPMS
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   544
     */ // TODO: describe failure modes
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   545
    default String inferModuleName(Location location) throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   546
        throw new UnsupportedOperationException();
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   547
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   548
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   549
    /**
42814
058fc03646d9 8171005: Fix JavaFileManager.getLocationForModule(Location location, JavaFileObject fo, String pkgName) to work with location == CLASS_OUTPUT
jlahoda
parents: 42261
diff changeset
   550
     * Lists the locations for all the modules in a module-oriented location or an output location.
058fc03646d9 8171005: Fix JavaFileManager.getLocationForModule(Location location, JavaFileObject fo, String pkgName) to work with location == CLASS_OUTPUT
jlahoda
parents: 42261
diff changeset
   551
     * The locations that are returned will be output locations if the given location is an output,
058fc03646d9 8171005: Fix JavaFileManager.getLocationForModule(Location location, JavaFileObject fo, String pkgName) to work with location == CLASS_OUTPUT
jlahoda
parents: 42261
diff changeset
   552
     * or it will be a package-oriented locations.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   553
     *
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   554
     * @implSpec This implementation throws {@code UnsupportedOperationException}.
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   555
     *
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   556
     * @param location  the module-oriented location for which to list the modules
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   557
     * @return  a series of sets of locations containing modules
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   558
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   559
     * @throws IOException if an I/O error occurred
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   560
     * @throws UnsupportedOperationException if this operation if not supported by this file manager
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   561
     * @throws IllegalArgumentException if the location is not a module-oriented location
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   562
     * @since 9
43767
9cff98a149cb 8173393: Module system implementation refresh (2/2017)
alanb
parents: 42814
diff changeset
   563
     * @spec JPMS
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   564
     */ // TODO: describe failure modes
42261
bb52b5514ad5 8163190: Clarify JavaFileManager use of \"module location\"
jjg
parents: 36526
diff changeset
   565
    default Iterable<Set<Location>> listLocationsForModules(Location location) throws IOException {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   566
        throw new UnsupportedOperationException();
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   567
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 25874
diff changeset
   568
44822
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   569
    /**
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   570
     * Determines whether or not a given file object is "contained in" a specified location.
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   571
     *
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   572
     * <p>For a package-oriented location, a file object is contained in the location if there exist
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   573
     * values for <i>packageName</i> and <i>relativeName</i> such that either of the following
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   574
     * calls would return the {@link #isSameFile same} file object:
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   575
     * <pre>
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   576
     *     getFileForInput(location, <i>packageName</i>, <i>relativeName</i>)
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   577
     *     getFileForOutput(location, <i>packageName</i>, <i>relativeName</i>, null)
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   578
     * </pre>
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   579
     *
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   580
     * <p>For a module-oriented location, a file object is contained in the location if there exists
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   581
     * a module that may be obtained by the call:
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   582
     * <pre>
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   583
     *     getLocationForModule(location, <i>moduleName</i>)
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   584
     * </pre>
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   585
     * such that the file object is contained in the (package-oriented) location for that module.
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   586
     *
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   587
     * @implSpec This implementation throws {@code UnsupportedOperationException}.
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   588
     *
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   589
     * @param location the location
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   590
     * @param fo the file object
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   591
     * @return whether or not the file is contained in the location
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   592
     *
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   593
     * @throws IOException if there is a problem determining the result
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   594
     * @throws UnsupportedOperationException if the method is not supported
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   595
     *
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   596
     * @since 9
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   597
     */
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   598
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   599
    default boolean contains(Location location, FileObject fo) throws IOException {
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   600
        throw new UnsupportedOperationException();
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   601
    }
2f24758e7ae0 8176327: javac produces wrong module-info
jjg
parents: 44063
diff changeset
   602
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   603
}