Package com.sun.source.util

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


    public static void main(String[] args) throws IOException {
        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
        JavacTask task = (JavacTask) compiler.getTask(null, null, null, null, null, List.of(new MyFileObject()));
        trees = Trees.instance(task);
        Iterable<? extends CompilationUnitTree> asts = task.parse();
        task.analyze();
        for (CompilationUnitTree ast : asts) {
            new MyVisitor().scan(ast, null);
        }
    }
View Full Code Here


        List<? extends JavaFileObject> files = Arrays.asList(sfo);
        String bootPath = System.getProperty("sun.boot.class.path");
        List<String> opts = Arrays.asList("-bootclasspath",  bootPath, "-Xjcov");
        JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
        JavacTask ct = (JavacTask)tool.getTask(null, null, null,opts,null,files);
        ct.analyze();
    }
}
View Full Code Here

    }

    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
                null, null, Arrays.asList(source));
        ct.analyze();
        check();
    }

    void check() {
        boolean badActual = !constructorKind.matches(argumentKind);
View Full Code Here

                null, null, Arrays.asList(source));
        ct.setProcessors(Arrays.asList(new ContainTypesTester(ParameterType.contains(ptA, ctA, ptB, ctB), source)));
        System.err.println("A = " + ptA +" / " + ptA.instantiate(ctA));
        System.err.println("B = " + ptB +" / " + ptB.instantiate(ctB));
        System.err.println("Source = " + source.source);
        ct.analyze();
    }

    @SupportedSourceVersion(SourceVersion.RELEASE_7)
    static class ContainTypesTester extends AbstractProcessor {
View Full Code Here

    }

    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
                null, null, Arrays.asList(source));
        ct.analyze();
        check();
    }

    void check() {
View Full Code Here

      Timers.start("parse-java");
      CompilationUnitTree cu = javacTask.parse().iterator().next();
      Timers.end("parse-java");

      Timers.start("analyze-java");
      javacTask.analyze();
      Timers.end("analyze-java");

      context.setCompilationUnit(cu);

      return cu;
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.