Java Code Examples for javax.tools.JavaCompiler.CompilationTask#setProcessors()

The following examples show how to use javax.tools.JavaCompiler.CompilationTask#setProcessors() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestGetResource2.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void testMissingResource(JavaCompiler javac) throws Exception {
    System.err.println("testMissingResource");
    File tmpdir = new File("testMissingResource");
    File srcdir = new File(tmpdir, "src");
    File destdir = new File(tmpdir, "dest");
    write(srcdir, "pkg/X.java", "package pkg; class X {}");
    destdir.mkdirs();

    CompilationTask task = javac.getTask(null, null, null,
            Arrays.asList("-sourcepath", srcdir.toString(), "-d", destdir.toString()),
            Collections.singleton("pkg.X"), null);
    task.setProcessors(Collections.singleton(new AnnoProc()));
    boolean result = task.call();
    System.err.println("javac result when missing resource: " + result);
    expect(result, false);

    if (errors > 0)
        throw new Exception(errors + " errors occurred");
}
 
Example 2
Source File: T7068437.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
void run() throws Exception {
    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    System.err.println("using " + compiler.getClass()
            + " from " + compiler.getClass().getProtectionDomain().getCodeSource());

    CompilationTask task = compiler.getTask(null, null, null,
            Collections.singleton("-proc:only"),
            Collections.singleton("java.lang.Object"),
            null);
    task.setProcessors(Collections.singleton(new Proc()));
    check("compilation", task.call());

    task = compiler.getTask(null, null, null,
            Arrays.asList("-proc:only", "-AexpectFile"),
            Collections.singleton("java.lang.Object"),
            null);
    task.setProcessors(Collections.singleton(new Proc()));
    check("compilation", task.call());
}
 
Example 3
Source File: TestGetResource2.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void testSingleSourceDir(JavaCompiler javac) throws Exception {
    System.err.println("testSingleSourceDir");
    File tmpdir = new File("testSingleSourceDir");
    File srcdir = new File(tmpdir, "src");
    File destdir = new File(tmpdir, "dest");
    write(srcdir, "pkg/X.java", "package pkg; class X {}");
    write(srcdir, "resources/file.txt", "hello");
    destdir.mkdirs();

    CompilationTask task = javac.getTask(null, null, null,
            Arrays.asList("-sourcepath", srcdir.toString(), "-d", destdir.toString()),
            Collections.singleton("pkg.X"), null);
    task.setProcessors(Collections.singleton(new AnnoProc()));
    boolean result = task.call();
    System.err.println("javac result with single source dir: " + result);
    expect(result, true);
}
 
Example 4
Source File: TestGetResource2.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void testMissingResource(JavaCompiler javac) throws Exception {
    System.err.println("testMissingResource");
    File tmpdir = new File("testMissingResource");
    File srcdir = new File(tmpdir, "src");
    File destdir = new File(tmpdir, "dest");
    write(srcdir, "pkg/X.java", "package pkg; class X {}");
    destdir.mkdirs();

    CompilationTask task = javac.getTask(null, null, null,
            Arrays.asList("-sourcepath", srcdir.toString(), "-d", destdir.toString()),
            Collections.singleton("pkg.X"), null);
    task.setProcessors(Collections.singleton(new AnnoProc()));
    boolean result = task.call();
    System.err.println("javac result when missing resource: " + result);
    expect(result, false);

    if (errors > 0)
        throw new Exception(errors + " errors occurred");
}
 
Example 5
Source File: TestGetResource2.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void testMissingResource(JavaCompiler javac) throws Exception {
    System.err.println("testMissingResource");
    File tmpdir = new File("testMissingResource");
    File srcdir = new File(tmpdir, "src");
    File destdir = new File(tmpdir, "dest");
    write(srcdir, "pkg/X.java", "package pkg; class X {}");
    destdir.mkdirs();

    CompilationTask task = javac.getTask(null, null, null,
            Arrays.asList("-sourcepath", srcdir.toString(), "-d", destdir.toString()),
            Collections.singleton("pkg.X"), null);
    task.setProcessors(Collections.singleton(new AnnoProc()));
    boolean result = task.call();
    System.err.println("javac result when missing resource: " + result);
    expect(result, false);

    if (errors > 0)
        throw new Exception(errors + " errors occurred");
}
 
Example 6
Source File: TestGetResource2.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void testSingleSourceDir(JavaCompiler javac) throws Exception {
    System.err.println("testSingleSourceDir");
    File tmpdir = new File("testSingleSourceDir");
    File srcdir = new File(tmpdir, "src");
    File destdir = new File(tmpdir, "dest");
    write(srcdir, "pkg/X.java", "package pkg; class X {}");
    write(srcdir, "resources/file.txt", "hello");
    destdir.mkdirs();

    CompilationTask task = javac.getTask(null, null, null,
            Arrays.asList("-sourcepath", srcdir.toString(), "-d", destdir.toString()),
            Collections.singleton("pkg.X"), null);
    task.setProcessors(Collections.singleton(new AnnoProc()));
    boolean result = task.call();
    System.err.println("javac result with single source dir: " + result);
    expect(result, true);
}
 
Example 7
Source File: T7068437.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
void run() throws Exception {
    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    System.err.println("using " + compiler.getClass()
            + " from " + compiler.getClass().getProtectionDomain().getCodeSource());

    CompilationTask task = compiler.getTask(null, null, null,
            Collections.singleton("-proc:only"),
            Collections.singleton("java.lang.Object"),
            null);
    task.setProcessors(Collections.singleton(new Proc()));
    check("compilation", task.call());

    task = compiler.getTask(null, null, null,
            Arrays.asList("-proc:only", "-AexpectFile"),
            Collections.singleton("java.lang.Object"),
            null);
    task.setProcessors(Collections.singleton(new Proc()));
    check("compilation", task.call());
}
 
Example 8
Source File: SimpleServiceTest.java    From grpc-nebula-java with Apache License 2.0 6 votes vote down vote up
@Test
public void testRpcMethodAnnotations() throws Exception {
  File grpcJavaFile =
      new File("./src/generated/main/grpc/io/grpc/testing/protobuf/SimpleServiceGrpc.java");
  Assume.assumeTrue(grpcJavaFile.exists());

  JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
  StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
  AnnotationProcessor processor = new AnnotationProcessor();
  Iterable<? extends JavaFileObject> obs = fileManager.getJavaFileObjects(grpcJavaFile);

  CompilationTask task =
      compiler.getTask(
          null,
          fileManager,
          null,
          Collections.singleton("-proc:only"),
          Collections.singleton(SimpleServiceGrpc.class.getCanonicalName()),
          obs);
  task.setProcessors(Collections.singleton(processor));
  assertTrue(task.call());
  assertTrue(processor.processedClass);
  fileManager.close();
}
 
Example 9
Source File: TestGetResource2.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void testCompositeSourcePath(JavaCompiler javac) throws Exception {
    System.err.println("testCompositeSearchPath");
    File tmpdir = new File("testCompositeSourcePath");
    File srcdir = new File(tmpdir, "src");
    File rsrcdir = new File(tmpdir, "rsrc");
    File destdir = new File(tmpdir, "dest");
    write(srcdir, "pkg/X.java", "package pkg; class X {}");
    write(rsrcdir, "resources/file.txt", "hello");
    destdir.mkdirs();

    CompilationTask task = javac.getTask(null, null, null,
            Arrays.asList("-sourcepath", srcdir + File.pathSeparator + rsrcdir, "-d", destdir.toString()),
            Collections.singleton("pkg.X"), null);
    task.setProcessors(Collections.singleton(new AnnoProc()));
    boolean result = task.call();
    System.err.println("javac result with composite source path: " + result);
    expect(result, true);
}
 
Example 10
Source File: TestGetResource2.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void testCompositeSourcePath(JavaCompiler javac) throws Exception {
    System.err.println("testCompositeSearchPath");
    File tmpdir = new File("testCompositeSourcePath");
    File srcdir = new File(tmpdir, "src");
    File rsrcdir = new File(tmpdir, "rsrc");
    File destdir = new File(tmpdir, "dest");
    write(srcdir, "pkg/X.java", "package pkg; class X {}");
    write(rsrcdir, "resources/file.txt", "hello");
    destdir.mkdirs();

    CompilationTask task = javac.getTask(null, null, null,
            Arrays.asList("-sourcepath", srcdir + File.pathSeparator + rsrcdir, "-d", destdir.toString()),
            Collections.singleton("pkg.X"), null);
    task.setProcessors(Collections.singleton(new AnnoProc()));
    boolean result = task.call();
    System.err.println("javac result with composite source path: " + result);
    expect(result, true);
}
 
Example 11
Source File: TestGetResource2.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void testMissingResource(JavaCompiler javac) throws Exception {
    System.err.println("testMissingResource");
    File tmpdir = new File("testMissingResource");
    File srcdir = new File(tmpdir, "src");
    File destdir = new File(tmpdir, "dest");
    write(srcdir, "pkg/X.java", "package pkg; class X {}");
    destdir.mkdirs();

    CompilationTask task = javac.getTask(null, null, null,
            Arrays.asList("-sourcepath", srcdir.toString(), "-d", destdir.toString()),
            Collections.singleton("pkg.X"), null);
    task.setProcessors(Collections.singleton(new AnnoProc()));
    boolean result = task.call();
    System.err.println("javac result when missing resource: " + result);
    expect(result, false);

    if (errors > 0)
        throw new Exception(errors + " errors occurred");
}
 
Example 12
Source File: TestGetResource2.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void testMissingResource(JavaCompiler javac) throws Exception {
    System.err.println("testMissingResource");
    File tmpdir = new File("testMissingResource");
    File srcdir = new File(tmpdir, "src");
    File destdir = new File(tmpdir, "dest");
    write(srcdir, "pkg/X.java", "package pkg; class X {}");
    destdir.mkdirs();

    CompilationTask task = javac.getTask(null, null, null,
            Arrays.asList("-sourcepath", srcdir.toString(), "-d", destdir.toString()),
            Collections.singleton("pkg.X"), null);
    task.setProcessors(Collections.singleton(new AnnoProc()));
    boolean result = task.call();
    System.err.println("javac result when missing resource: " + result);
    expect(result, false);

    if (errors > 0)
        throw new Exception(errors + " errors occurred");
}
 
Example 13
Source File: TestGetResource2.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void testCompositeSourcePath(JavaCompiler javac) throws Exception {
    System.err.println("testCompositeSearchPath");
    File tmpdir = new File("testCompositeSourcePath");
    File srcdir = new File(tmpdir, "src");
    File rsrcdir = new File(tmpdir, "rsrc");
    File destdir = new File(tmpdir, "dest");
    write(srcdir, "pkg/X.java", "package pkg; class X {}");
    write(rsrcdir, "resources/file.txt", "hello");
    destdir.mkdirs();

    CompilationTask task = javac.getTask(null, null, null,
            Arrays.asList("-sourcepath", srcdir + File.pathSeparator + rsrcdir, "-d", destdir.toString()),
            Collections.singleton("pkg.X"), null);
    task.setProcessors(Collections.singleton(new AnnoProc()));
    boolean result = task.call();
    System.err.println("javac result with composite source path: " + result);
    expect(result, true);
}
 
Example 14
Source File: TestGetResource2.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void testSingleSourceDir(JavaCompiler javac) throws Exception {
    System.err.println("testSingleSourceDir");
    File tmpdir = new File("testSingleSourceDir");
    File srcdir = new File(tmpdir, "src");
    File destdir = new File(tmpdir, "dest");
    write(srcdir, "pkg/X.java", "package pkg; class X {}");
    write(srcdir, "resources/file.txt", "hello");
    destdir.mkdirs();

    CompilationTask task = javac.getTask(null, null, null,
            Arrays.asList("-sourcepath", srcdir.toString(), "-d", destdir.toString()),
            Collections.singleton("pkg.X"), null);
    task.setProcessors(Collections.singleton(new AnnoProc()));
    boolean result = task.call();
    System.err.println("javac result with single source dir: " + result);
    expect(result, true);
}
 
Example 15
Source File: T7068451.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
void run() throws Exception {
    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    System.err.println("using " + compiler.getClass() + " from " + compiler.getClass().getProtectionDomain().getCodeSource());

    File tmp = new File("tmp");
    tmp.mkdir();
    for (File f: tmp.listFiles())
        f.delete();

    File input = writeFile(tmp, "X.java", "package p; class X { { p.C.first(); } }");

    List<String> opts = Arrays.asList(
            "-s", tmp.getPath(),
            "-d", tmp.getPath(),
            "-XprintRounds");

    System.err.println();
    System.err.println("FIRST compilation");
    System.err.println();

    CompilationTask task = compiler.getTask(null, null, null, opts, null,
            compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
    task.setProcessors(Collections.singleton(new Proc("first")));
    check("compilation", task.call());

    writeFile(tmp, "X.java", "package p; class X { { p.C.second(); } }");

    //Thread.sleep(2000);

    System.err.println();
    System.err.println("SECOND compilation");
    System.err.println();

    task = compiler.getTask(null, null, null, opts, null,
            compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
    task.setProcessors(Collections.singleton(new Proc("second")));
    check("compilation", task.call());

    //Thread.sleep(2000);

    System.err.println();
    System.err.println("SECOND compilation, REPEATED");
    System.err.println();

    task = compiler.getTask(null, null, null, opts, null,
            compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
    task.setProcessors(Collections.singleton(new Proc("second")));
    check("compilation", task.call());
}
 
Example 16
Source File: T7068451.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
void run() throws Exception {
    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    System.err.println("using " + compiler.getClass() + " from " + compiler.getClass().getProtectionDomain().getCodeSource());

    File tmp = new File("tmp");
    tmp.mkdir();
    for (File f: tmp.listFiles())
        f.delete();

    File input = writeFile(tmp, "X.java", "package p; class X { { p.C.first(); } }");

    List<String> opts = Arrays.asList(
            "-s", tmp.getPath(),
            "-d", tmp.getPath(),
            "-XprintRounds");

    System.err.println();
    System.err.println("FIRST compilation");
    System.err.println();

    CompilationTask task = compiler.getTask(null, null, null, opts, null,
            compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
    task.setProcessors(Collections.singleton(new Proc("first")));
    check("compilation", task.call());

    writeFile(tmp, "X.java", "package p; class X { { p.C.second(); } }");

    //Thread.sleep(2000);

    System.err.println();
    System.err.println("SECOND compilation");
    System.err.println();

    task = compiler.getTask(null, null, null, opts, null,
            compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
    task.setProcessors(Collections.singleton(new Proc("second")));
    check("compilation", task.call());

    //Thread.sleep(2000);

    System.err.println();
    System.err.println("SECOND compilation, REPEATED");
    System.err.println();

    task = compiler.getTask(null, null, null, opts, null,
            compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
    task.setProcessors(Collections.singleton(new Proc("second")));
    check("compilation", task.call());
}
 
Example 17
Source File: JavahTask.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public boolean run() throws Util.Exit {

        Util util = new Util(log, diagnosticListener);

        if (noArgs || help) {
            showHelp();
            return help; // treat noArgs as an error for purposes of exit code
        }

        if (version || fullVersion) {
            showVersion(fullVersion);
            return true;
        }

        util.verbose = verbose;

        Gen g;

        if (llni)
            g = new LLNI(doubleAlign, util);
        else {
//            if (stubs)
//                throw new BadArgs("jni.no.stubs");
            g = new JNI(util);
        }

        if (ofile != null) {
            if (!(fileManager instanceof StandardJavaFileManager)) {
                diagnosticListener.report(createDiagnostic("err.cant.use.option.for.fm", "-o"));
                return false;
            }
            Iterable<? extends JavaFileObject> iter =
                    ((StandardJavaFileManager) fileManager).getJavaFileObjectsFromFiles(Collections.singleton(ofile));
            JavaFileObject fo = iter.iterator().next();
            g.setOutFile(fo);
        } else {
            if (odir != null) {
                if (!(fileManager instanceof StandardJavaFileManager)) {
                    diagnosticListener.report(createDiagnostic("err.cant.use.option.for.fm", "-d"));
                    return false;
                }

                if (!odir.exists())
                    if (!odir.mkdirs())
                        util.error("cant.create.dir", odir.toString());
                try {
                    ((StandardJavaFileManager) fileManager).setLocation(StandardLocation.CLASS_OUTPUT, Collections.singleton(odir));
                } catch (IOException e) {
                    Object msg = e.getLocalizedMessage();
                    if (msg == null) {
                        msg = e;
                    }
                    diagnosticListener.report(createDiagnostic("err.ioerror", odir, msg));
                    return false;
                }
            }
            g.setFileManager(fileManager);
        }

        /*
         * Force set to false will turn off smarts about checking file
         * content before writing.
         */
        g.setForce(force);

        if (fileManager instanceof JavahFileManager)
            ((JavahFileManager) fileManager).setSymbolFileEnabled(false);

        JavaCompiler c = ToolProvider.getSystemJavaCompiler();
        List<String> opts = new ArrayList<String>();
        opts.add("-proc:only");
        opts.addAll(javac_extras);
        CompilationTask t = c.getTask(log, fileManager, diagnosticListener, opts, classes, null);
        JavahProcessor p = new JavahProcessor(g);
        t.setProcessors(Collections.singleton(p));

        boolean ok = t.call();
        if (p.exit != null)
            throw new Util.Exit(p.exit);
        return ok;
    }
 
Example 18
Source File: T7068451.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
void run() throws Exception {
    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    System.err.println("using " + compiler.getClass() + " from " + compiler.getClass().getProtectionDomain().getCodeSource());

    File tmp = new File("tmp");
    tmp.mkdir();
    for (File f: tmp.listFiles())
        f.delete();

    File input = writeFile(tmp, "X.java", "package p; class X { { p.C.first(); } }");

    List<String> opts = Arrays.asList(
            "-s", tmp.getPath(),
            "-d", tmp.getPath(),
            "-XprintRounds");

    System.err.println();
    System.err.println("FIRST compilation");
    System.err.println();

    CompilationTask task = compiler.getTask(null, null, null, opts, null,
            compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
    task.setProcessors(Collections.singleton(new Proc("first")));
    check("compilation", task.call());

    writeFile(tmp, "X.java", "package p; class X { { p.C.second(); } }");

    //Thread.sleep(2000);

    System.err.println();
    System.err.println("SECOND compilation");
    System.err.println();

    task = compiler.getTask(null, null, null, opts, null,
            compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
    task.setProcessors(Collections.singleton(new Proc("second")));
    check("compilation", task.call());

    //Thread.sleep(2000);

    System.err.println();
    System.err.println("SECOND compilation, REPEATED");
    System.err.println();

    task = compiler.getTask(null, null, null, opts, null,
            compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
    task.setProcessors(Collections.singleton(new Proc("second")));
    check("compilation", task.call());
}
 
Example 19
Source File: T7068451.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
void run() throws Exception {
    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    System.err.println("using " + compiler.getClass() + " from " + compiler.getClass().getProtectionDomain().getCodeSource());

    File tmp = new File("tmp");
    tmp.mkdir();
    for (File f: tmp.listFiles())
        f.delete();

    File input = writeFile(tmp, "X.java", "package p; class X { { p.C.first(); } }");

    List<String> opts = Arrays.asList(
            "-s", tmp.getPath(),
            "-d", tmp.getPath(),
            "-XprintRounds");

    System.err.println();
    System.err.println("FIRST compilation");
    System.err.println();

    try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
        CompilationTask task = compiler.getTask(null, fm, null, opts, null,
                fm.getJavaFileObjects(input));
        task.setProcessors(Collections.singleton(new Proc("first")));
        check("compilation", task.call());

        writeFile(tmp, "X.java", "package p; class X { { p.C.second(); } }");

        //Thread.sleep(2000);

        System.err.println();
        System.err.println("SECOND compilation");
        System.err.println();

        task = compiler.getTask(null, fm, null, opts, null,
                fm.getJavaFileObjects(input));
        task.setProcessors(Collections.singleton(new Proc("second")));
        check("compilation", task.call());

        //Thread.sleep(2000);

        System.err.println();
        System.err.println("SECOND compilation, REPEATED");
        System.err.println();

        task = compiler.getTask(null, fm, null, opts, null,
                fm.getJavaFileObjects(input));
        task.setProcessors(Collections.singleton(new Proc("second")));
        check("compilation", task.call());
    }
}
 
Example 20
Source File: JavahTask.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public boolean run() throws Util.Exit {

        Util util = new Util(log, diagnosticListener);

        if (noArgs || help) {
            showHelp();
            return help; // treat noArgs as an error for purposes of exit code
        }

        if (version || fullVersion) {
            showVersion(fullVersion);
            return true;
        }

        util.verbose = verbose;

        Gen g;

        if (llni)
            g = new LLNI(doubleAlign, util);
        else {
//            if (stubs)
//                throw new BadArgs("jni.no.stubs");
            g = new JNI(util);
        }

        if (ofile != null) {
            if (!(fileManager instanceof StandardJavaFileManager)) {
                diagnosticListener.report(createDiagnostic("err.cant.use.option.for.fm", "-o"));
                return false;
            }
            Iterable<? extends JavaFileObject> iter =
                    ((StandardJavaFileManager) fileManager).getJavaFileObjectsFromFiles(Collections.singleton(ofile));
            JavaFileObject fo = iter.iterator().next();
            g.setOutFile(fo);
        } else {
            if (odir != null) {
                if (!(fileManager instanceof StandardJavaFileManager)) {
                    diagnosticListener.report(createDiagnostic("err.cant.use.option.for.fm", "-d"));
                    return false;
                }

                if (!odir.exists())
                    if (!odir.mkdirs())
                        util.error("cant.create.dir", odir.toString());
                try {
                    ((StandardJavaFileManager) fileManager).setLocation(StandardLocation.CLASS_OUTPUT, Collections.singleton(odir));
                } catch (IOException e) {
                    Object msg = e.getLocalizedMessage();
                    if (msg == null) {
                        msg = e;
                    }
                    diagnosticListener.report(createDiagnostic("err.ioerror", odir, msg));
                    return false;
                }
            }
            g.setFileManager(fileManager);
        }

        /*
         * Force set to false will turn off smarts about checking file
         * content before writing.
         */
        g.setForce(force);

        if (fileManager instanceof JavahFileManager)
            ((JavahFileManager) fileManager).setSymbolFileEnabled(false);

        JavaCompiler c = ToolProvider.getSystemJavaCompiler();
        List<String> opts = new ArrayList<String>();
        opts.add("-proc:only");
        opts.addAll(javac_extras);
        CompilationTask t = c.getTask(log, fileManager, diagnosticListener, opts, classes, null);
        JavahProcessor p = new JavahProcessor(g);
        t.setProcessors(Collections.singleton(p));

        boolean ok = t.call();
        if (p.exit != null)
            throw new Util.Exit(p.exit);
        return ok;
    }