Tue, 25 Sep 2012 13:11:05 -0700
7196464: upgrade JavaCompiler.shouldStopPolicy to accomodate policies in face of error and no error
Reviewed-by: mcimadamore
jjg@450 | 1 | /* |
ohair@554 | 2 | * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
jjg@450 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jjg@450 | 4 | * |
jjg@450 | 5 | * This code is free software; you can redistribute it and/or modify it |
jjg@450 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@554 | 7 | * published by the Free Software Foundation. Oracle designates this |
jjg@450 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@554 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
jjg@450 | 10 | * |
jjg@450 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
jjg@450 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jjg@450 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jjg@450 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
jjg@450 | 15 | * accompanied this code). |
jjg@450 | 16 | * |
jjg@450 | 17 | * You should have received a copy of the GNU General Public License version |
jjg@450 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
jjg@450 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jjg@450 | 20 | * |
ohair@554 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@554 | 23 | * questions. |
jjg@450 | 24 | */ |
jjg@450 | 25 | |
jjg@450 | 26 | package com.sun.tools.javac.nio; |
jjg@450 | 27 | |
jjg@450 | 28 | import java.io.IOException; |
jjg@450 | 29 | import java.nio.file.FileSystem; |
jjg@450 | 30 | import java.nio.file.Path; |
jjg@450 | 31 | import javax.tools.FileObject; |
jjg@450 | 32 | import javax.tools.JavaFileManager; |
jjg@450 | 33 | import javax.tools.JavaFileObject; |
jjg@450 | 34 | |
jjg@450 | 35 | /** |
jjg@450 | 36 | * File manager based on {@linkplain File java.nio.file.Path}. |
jjg@450 | 37 | * |
jjg@450 | 38 | * Eventually, this should be moved to javax.tools. |
jjg@450 | 39 | * Also, JavaCompiler might reasonably provide a method getPathFileManager, |
jjg@450 | 40 | * similar to {@link javax.tools.JavaCompiler#getStandardFileManager |
jjg@450 | 41 | * getStandardFileManager}. However, would need to be handled carefully |
jjg@450 | 42 | * as another forward reference from langtools to jdk. |
jjg@450 | 43 | * |
jjg@581 | 44 | * <p><b>This is NOT part of any supported API. |
jjg@581 | 45 | * If you write code that depends on this, you do so at your own risk. |
jjg@450 | 46 | * This code and its internal interfaces are subject to change or |
jjg@450 | 47 | * deletion without notice.</b> |
jjg@450 | 48 | */ |
jjg@450 | 49 | public interface PathFileManager extends JavaFileManager { |
jjg@450 | 50 | /** |
jjg@450 | 51 | * Get the default file system used to create paths. If no value has been |
jjg@450 | 52 | * set, the default file system is {@link FileSystems#getDefault}. |
jjg@450 | 53 | */ |
jjg@450 | 54 | FileSystem getDefaultFileSystem(); |
jjg@450 | 55 | |
jjg@450 | 56 | /** |
jjg@450 | 57 | * Set the default file system used to create paths. |
jjg@450 | 58 | * @param fs the default file system used to create any new paths. |
jjg@450 | 59 | */ |
jjg@450 | 60 | void setDefaultFileSystem(FileSystem fs); |
jjg@450 | 61 | |
jjg@450 | 62 | /** |
jjg@450 | 63 | * Get file objects representing the given files. |
jjg@450 | 64 | * |
jjg@450 | 65 | * @param paths a list of paths |
jjg@450 | 66 | * @return a list of file objects |
jjg@450 | 67 | * @throws IllegalArgumentException if the list of paths includes |
jjg@450 | 68 | * a directory |
jjg@450 | 69 | */ |
jjg@450 | 70 | Iterable<? extends JavaFileObject> getJavaFileObjectsFromPaths( |
jjg@450 | 71 | Iterable<? extends Path> paths); |
jjg@450 | 72 | |
jjg@450 | 73 | /** |
jjg@450 | 74 | * Get file objects representing the given paths. |
jjg@450 | 75 | * Convenience method equivalent to: |
jjg@450 | 76 | * |
jjg@450 | 77 | * <pre> |
jjg@450 | 78 | * getJavaFileObjectsFromPaths({@linkplain java.util.Arrays#asList Arrays.asList}(paths)) |
jjg@450 | 79 | * </pre> |
jjg@450 | 80 | * |
jjg@450 | 81 | * @param paths an array of paths |
jjg@450 | 82 | * @return a list of file objects |
jjg@450 | 83 | * @throws IllegalArgumentException if the array of files includes |
jjg@450 | 84 | * a directory |
jjg@450 | 85 | * @throws NullPointerException if the given array contains null |
jjg@450 | 86 | * elements |
jjg@450 | 87 | */ |
jjg@450 | 88 | Iterable<? extends JavaFileObject> getJavaFileObjects(Path... paths); |
jjg@450 | 89 | |
jjg@450 | 90 | /** |
jjg@450 | 91 | * Return the Path for a file object that has been obtained from this |
jjg@450 | 92 | * file manager. |
jjg@450 | 93 | * |
jjg@450 | 94 | * @param fo A file object that has been obtained from this file manager. |
jjg@450 | 95 | * @return The underlying Path object. |
jjg@450 | 96 | * @throws IllegalArgumentException is the file object was not obtained from |
jjg@450 | 97 | * from this file manager. |
jjg@450 | 98 | */ |
jjg@450 | 99 | Path getPath(FileObject fo); |
jjg@450 | 100 | |
jjg@450 | 101 | /** |
jjg@450 | 102 | * Get the search path associated with the given location. |
jjg@450 | 103 | * |
jjg@450 | 104 | * @param location a location |
jjg@450 | 105 | * @return a list of paths or {@code null} if this location has no |
jjg@450 | 106 | * associated search path |
jjg@450 | 107 | * @see #setLocation |
jjg@450 | 108 | */ |
jjg@450 | 109 | Iterable<? extends Path> getLocation(Location location); |
jjg@450 | 110 | |
jjg@450 | 111 | /** |
jjg@450 | 112 | * Associate the given search path with the given location. Any |
jjg@450 | 113 | * previous value will be discarded. |
jjg@450 | 114 | * |
jjg@450 | 115 | * @param location a location |
jjg@450 | 116 | * @param searchPath a list of files, if {@code null} use the default |
jjg@450 | 117 | * search path for this location |
jjg@450 | 118 | * @see #getLocation |
jjg@450 | 119 | * @throws IllegalArgumentException if location is an output |
jjg@450 | 120 | * location and searchpath does not contain exactly one element |
jjg@450 | 121 | * @throws IOException if location is an output location and searchpath |
jjg@450 | 122 | * does not represent an existing directory |
jjg@450 | 123 | */ |
jjg@450 | 124 | void setLocation(Location location, Iterable<? extends Path> searchPath) throws IOException; |
jjg@450 | 125 | } |