public PrintWriter createSourceFile(String name) throws IOException {
        String pathname = nameToPath(name, ".java");
        File file = new File(locations.get(SOURCE_TREE),
                             pathname);
        PrintWriter pw = getPrintWriter(file, encoding, name, FileKind.SOURCE);
        return pw;
    }