Example usage for org.eclipse.jdt.internal.compiler Compiler Compiler

List of usage examples for org.eclipse.jdt.internal.compiler Compiler Compiler

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler Compiler Compiler.

Prototype

public Compiler(INameEnvironment environment, IErrorHandlingPolicy policy, CompilerOptions options,
            final ICompilerRequestor requestor, IProblemFactory problemFactory, PrintWriter out,
            CompilationProgress progress) 

Source Link

Usage

From source file:io.gige.compiler.internal.CompilationTaskImpl.java

License:Apache License

public void configure(PrintWriter out, JavaFileManager fileManager, StandardJavaFileManager standardManager,
        FileSystem environment, DiagnosticListener<? super JavaFileObject> diagnosticListener,
        Iterable<String> argv, Iterable<String> classes, Iterable<? extends JavaFileObject> compilationUnits) {

    this.problemFactory = new DefaultProblemFactory();
    this.errorTrapper = new DiagnosticListenerWrapper(diagnosticListener);

    Main main = parseOptions(out, argv, compilationUnits);
    CompilerOptions options = new CompilerOptions(main.options);
    options.verbose = main.verbose;//w  w w. jav a2 s.  c  o  m
    ICompilerRequestor requestor = new CompilerRequestorImpl(standardManager, this.errorTrapper);
    this.compiler = new Compiler(environment, getHandlingPolicy(), options, requestor, this.problemFactory, out,
            null);

    setTargets(compilationUnits);

    this.processingEnv = new AnnotationProcessingEnv(fileManager, errorTrapper, argv, compiler);
    this.processorManager = new AnnotationProcessorManager(this.processingEnv);
    this.processorManager.configure(argv);
    this.processorManager.setOut(out);
    this.processorManager.setErr(out);
    this.compiler.annotationProcessorManager = this.processorManager;
}

From source file:org.rapidoid.compile.impl.EcjCompiler.java

License:Apache License

public EcjCompiler(INameEnvironment environment, IProblemFactory problemFactory) {
    String version = System.getProperty("java.version").substring(0, 3);
    CompilerOptions options = new CompilerOptions(
            U.map(CompilerOptions.OPTION_Source, version, CompilerOptions.OPTION_TargetPlatform, version));
    compiler = new Compiler(environment, new ErrorPolicy(), options, this, problemFactory, null, null);
}

From source file:org.thiesen.ecj4ant.EcjTask.java

License:Open Source License

@Override
public void execute() {
    final long startTime = System.currentTimeMillis();

    final List<String> sourceFilenames = getSourceFilenames();
    final List<String> classPathEntries = getClassPathEntries();

    final FileSystem environment = getLibraryAccess(sourceFilenames, classPathEntries);

    log("Checking " + sourceFilenames.size() + " source files");

    final CompilerOptions compilerOptions = makeCompilerOptions();

    log(compilerOptions.toString(), Project.MSG_VERBOSE);

    final BatchRequestor requestor = getBatchRequestor();

    final Compiler batchCompiler = new Compiler(environment, getHandlingPolicy(), compilerOptions, requestor,
            getProblemFactory(), getOutputWrapper(), null);

    compilerOptions.verbose = false;/*from  ww  w .j a  v a  2  s.  co m*/

    batchCompiler.compile(getCompilationUnits(sourceFilenames));

    // cleanup
    environment.cleanup();

    final long endTime = System.currentTimeMillis() - startTime;

    log("Compile finished after " + endTime + "ms with " + requestor.getErrors() + " errors, "
            + requestor.getWarnings() + " warnings and " + requestor.getInfos() + " info messages");

    checkFailErrors(requestor.getErrors());
    checkFailWarnings(requestor.getWarnings());
}