@Override
public javax.tools.FileObject getFileForOutput(final Location l, final String pkgName, final String relativeName, final javax.tools.FileObject sibling)
throws IOException, UnsupportedOperationException, IllegalArgumentException {
if (StandardLocation.SOURCE_PATH != l) {
throw new UnsupportedOperationException("Only StandardLocation.SOURCE_PATH is supported.");
}
final String rp = FileObjects.resolveRelativePath (pkgName, relativeName);
final FileObject[] fileRootPair = findFile(rp);
if (fileRootPair == null) {
final FileObject[] roots = this.sourceRoots.getRoots();
if (roots.length == 0) {
throw new UnsupportedOperationException("No source path");
}
final File rootFile = FileUtil.toFile(roots[0]);
if (rootFile == null) {
throw new UnsupportedOperationException("No source path");
}
return FileObjects.sourceFileObject(
BaseUtilities.toURI(new File(rootFile,FileObjects.convertFolder2Package(rp, File.separatorChar))).toURL(),
roots[0]);
} else {
return FileObjects.sourceFileObject(fileRootPair[0], fileRootPair[1]);
}
}