The FilerImplementation class must maintain a number of
constraints. First, multiple attempts to open the same path within
the same invocation of the tool results in an IOException being
thrown. For example, trying to open the same source file twice:
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 API supported by Sun Microsystems.
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.
|