Package com.sun.source.util

Examples of com.sun.source.util.JavacTask.call()


        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
        JavaSource source = new JavaSource();
        ErrorChecker ec = new ErrorChecker();
        JavacTask ct = (JavacTask)tool.getTask(null, fm, ec,
                null, null, Arrays.asList(source));
        ct.call();
        check(source, ec);
    }

    void check(JavaSource source, ErrorChecker ec) {
        checkCount++;
View Full Code Here


            Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(testFile);

            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            JavacTask task = tool.getTask(pw, fm, null, null, null, files);
            boolean ok = task.call();
            String out = showOutput(sw.toString());

            checkCompilationOK(ok);
            checkOutput(out, expectWarnings);
        }
View Full Code Here

            public CharSequence getCharContent(boolean ignoreEncodingErrors) {
                return out;
            }
        };
        JavacTask t2 = tool2.getTask(null, fm, null, null, null, Collections.singleton(fo));
        boolean ok = t2.call();
        if (!ok)
            throw new Exception("compilation of generated code failed");

        File expectedClass = new File(test.getName().replace(".java", ".class"));
        if (!expectedClass.exists())
View Full Code Here

        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        JavacTask task = tool.getTask(pw, fm, dl, args, null, files);
        task.setProcessors(Arrays.asList(new AnnoProc()));
        boolean ok = task.call();
        pw.close();

        System.err.println("ok:" + ok + " diags:" + dl.counts);
        if (sw.toString().length() > 0) {
            System.err.println("output:\n" + sw.toString());
View Full Code Here

   
    private void compile(String pathname, String destDir, String moduleName) throws Exception {
        CeyloncTool compiler = new CeyloncTool();
        List<String> options = Arrays.asList("-src", pathname, "-out", destDir, "-cp", CompilerTest.getClassPathAsPath());
        JavacTask task = compiler.getTask(null, null, null, options, Arrays.asList(moduleName), null);
        Boolean ret = task.call();
        Assert.assertEquals("Compilation failed", Boolean.TRUE, ret);
    }

    private void compileJavaModule(String pathname, String... fileNames) throws Exception {
        CeyloncTool compiler = new CeyloncTool();
View Full Code Here

        for(String name : fileNames){
            qualifiedNames.add(pathname + File.separator + name);
        }
        Iterable<? extends JavaFileObject> fileObjects = fileManager.getJavaFileObjectsFromStrings(qualifiedNames);
        JavacTask task = compiler.getTask(null, null, null, options, null, fileObjects);
        Boolean ret = task.call();
        Assert.assertEquals("Compilation failed", Boolean.TRUE, ret);
    }
   
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.