public Writer createSourceFile(String typename) throws IOException {
if (incrSrcGen)
seenTypes.add(typename);
if (typename.indexOf('$') > 0)
{
typename =
typename.substring( 0, typename.lastIndexOf( '.' ) ) + "." +
typename.substring( typename.indexOf( '$' ) + 1 );
}
String filename = typename.replace('.', File.separatorChar) + ".java";
File sourcefile = new File(srcdir, filename);
sourcefile.getParentFile().mkdirs();
if (verbose)
System.err.println("created source: " + sourcefile.getAbsolutePath());
sourceFiles.add(sourcefile);
if (incrSrcGen && sourcefile.exists())
{
// Generate the file in a buffer and then compare it to the
// file already on disk
return new IncrFileWriter(sourcefile, repackager);
}
else
{
return repackager == null ?
(Writer) writerForFile( sourcefile ) :
(Writer) new RepackagingWriter( sourcefile, repackager );
}
}
Creates a new binding source file (.java) and returns a writer for it. |