createSourceFile("foo.Bar")
...
createSourceFile("foo.Bar")
is disallowed as is opening a text file that happens to have
the same name as a source file:
createSourceFile("foo.Bar")
...
createTextFile(SOURCE_TREE, "foo", new File("Bar"), null)
Additionally, creating a source file that corresponds to an already created class file (or vice versa) also results in an IOException since each type can only be created once. However, if the Filer is used to create a text file named *.java that happens to correspond to an existing class file, a warning is *not* generated. Similarly, a warning is not generated for a binary file named *.class and an existing source file.
The reason for this difference is that source files and class files are registered with the tool and can get passed on as declarations to the next round of processing. Files that are just named *.java and *.class are not processed in that manner; although having extra source files and class files on the source path and class path can alter the behavior of the tool and any final compile.
This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
| Modifier and Type | Class and Description |
|---|---|
| private class | JavacFiler.
Wrap a JavaFileObject to manage reading by the Filer. |
| private class | |
| private class | JavacFiler.
Wrap a JavaFileObject to manage writing by the Filer. |
| private class | |
| private class | JavacFiler.
Wrap a |
| private class | JavacFiler.
Wrap a |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private final Set | aggregateGeneratedClassNames
Names of all created class files. |
| private final Set | aggregateGeneratedSourceNames
Names of all created source files. |
| private static final String | |
| pack-priv Context | |
| private final String | |
| pack-priv JavacElements | |
| pack-priv JavaFileManager | |
| private final Set | fileObjectHistory
Logical names of all created files. |
| private final Map | generatedClasses
Names and class files of the class files closed in this round. |
| private Set | generatedSourceFileObjects
JavaFileObjects for source files closed in this round. |
| private Set | generatedSourceNames
Names of source files closed in this round. |
| private final Set | |
| private final Set | initialInputs
Initial inputs passed to the tool. |
| pack-priv boolean | |
| pack-priv Log | |
| pack-priv Modules | |
| pack-priv Names | |
| private static final String | |
| private static final String | |
| private final Set | openTypeNames
Names of types that have had files created but not closed. |
| pack-priv Symtab |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private void | checkFileReopening(FileObject fileObject, boolean forWriting)
Check to see if the file has already been opened; if so, throw an exception, otherwise add it to the set of files. |
| private void | |
| private void | |
| private void | |
| private Pair | |
| private JavacFiler. | |
| private void | |
| public void | close()
Implements java. Closes this stream and releases any system resources associated with it. |
| private void | closeFileObject(Symbol.
Upon close, register files opened by create{Source, Class}File for annotation processing. |
| private boolean | |
| public JavaFileObject | createClassFile(CharSequence nameAndModule, Element... originatingElements)
Implements javax. Creates a new class file, and returns an object to allow writing to it. |
| public FileObject | createResource(JavaFileManager.
Implements javax. Creates a new auxiliary resource file for writing and returns a file object for it. |
| public JavaFileObject | createSourceFile(CharSequence nameAndModule, Element... originatingElements)
Implements javax. Creates a new source file and returns an object to allow writing to it. |
| private JavaFileObject | createSourceOrClassFile(Symbol.
|
| public void | |
| public Map | |
| public Set | |
| public Set | |
| public FileObject | getResource(JavaFileManager.
Implements javax. Returns an object for reading an existing resource. |
| private Symbol. | |
| private boolean | |
| private boolean | |
| private void | |
| public boolean | |
| public void | |
| private JavaFileObject[] | |
| public void | setInitialState(Collection<? extends JavaFileObject> initialInputs, Collection<String> initialClassNames)
|
| pack-priv void | |
| public String | |
| public void |