src/share/classes/javax/annotation/processing/Filer.java

Print this page
rev 223 : 6501749: 6501749 Filer should state connection between created files and root elements
Reviewed-by: jjg


  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any questions.
  24  */
  25 
  26 package javax.annotation.processing;
  27 
  28 import javax.tools.JavaFileManager;
  29 import javax.tools.*;
  30 import javax.lang.model.element.Element;
  31 import java.io.IOException;
  32 
  33 /**
  34  * This interface supports the creation of new files by an annotation
  35  * processor.  Files created in this way will be known to the
  36  * annotation processing tool implementing this interface, better
  37  * enabling the tool to manage them.  Source and class files so
  38  * created will be considered for processing by the tool after the
  39  * {@code close} method has been called on the {@code Writer} or
  40  * {@code OutputStream} used to write the contents of the file.


  41  *
  42  * Three kinds of files are distinguished: source files, class files,
  43  * and auxiliary resource files.
  44  *
  45  * <p> There are two distinguished supported locations (subtrees
  46  * within the logical file system) where newly created files are
  47  * placed: one for {@linkplain
  48  * javax.tools.StandardLocation#SOURCE_OUTPUT new source files}, and
  49  * one for {@linkplain javax.tools.StandardLocation#CLASS_OUTPUT new
  50  * class files}.  (These might be specified on a tool's command line,
  51  * for example, using flags such as {@code -s} and {@code -d}.)  The
  52  * actual locations for new source files and new class files may or
  53  * may not be distinct on a particular run of the tool.  Resource
  54  * files may be created in either location.  The methods for reading
  55  * and writing resources take a relative name argument.  A relative
  56  * name is a non-null, non-empty sequence of path segments separated
  57  * by {@code '/'}; {@code '.'} and {@code '..'} are invalid path
  58  * segments.  A valid relative name must match the
  59  * &quot;path-rootless&quot; rule of <a
  60  * href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>, section




  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any questions.
  24  */
  25 
  26 package javax.annotation.processing;
  27 
  28 import javax.tools.JavaFileManager;
  29 import javax.tools.*;
  30 import javax.lang.model.element.Element;
  31 import java.io.IOException;
  32 
  33 /**
  34  * This interface supports the creation of new files by an annotation
  35  * processor.  Files created in this way will be known to the
  36  * annotation processing tool implementing this interface, better
  37  * enabling the tool to manage them.  Source and class files so
  38  * created will be {@linkplain RoundEnvironment#getRootElements
  39  * considered for processing} by the tool in a subsequent {@linkplain
  40  * RoundEnvironment round of processing} after the {@code close}
  41  * method has been called on the {@code Writer} or {@code
  42  * OutputStream} used to write the contents of the file.
  43  *
  44  * Three kinds of files are distinguished: source files, class files,
  45  * and auxiliary resource files.
  46  *
  47  * <p> There are two distinguished supported locations (subtrees
  48  * within the logical file system) where newly created files are
  49  * placed: one for {@linkplain
  50  * javax.tools.StandardLocation#SOURCE_OUTPUT new source files}, and
  51  * one for {@linkplain javax.tools.StandardLocation#CLASS_OUTPUT new
  52  * class files}.  (These might be specified on a tool's command line,
  53  * for example, using flags such as {@code -s} and {@code -d}.)  The
  54  * actual locations for new source files and new class files may or
  55  * may not be distinct on a particular run of the tool.  Resource
  56  * files may be created in either location.  The methods for reading
  57  * and writing resources take a relative name argument.  A relative
  58  * name is a non-null, non-empty sequence of path segments separated
  59  * by {@code '/'}; {@code '.'} and {@code '..'} are invalid path
  60  * segments.  A valid relative name must match the
  61  * &quot;path-rootless&quot; rule of <a
  62  * href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>, section