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

    this.options = options;
    this.progress = progress;

    // wrap requestor in DebugRequestor if one is specified
    if (DebugRequestor == null) {
      this.requestor = requestor;
    } else {
      this.requestor =
          new ICompilerRequestor() {
            public void acceptResult(CompilationResult result) {
              if (DebugRequestor.isActive()) {
                DebugRequestor.acceptDebugResult(result);
              }
              requestor.acceptResult(result);
            }
          };
    }
    this.problemReporter = new ProblemReporter(policy, this.options, problemFactory);
    this.lookupEnvironment =
        new LookupEnvironment(this, this.options, this.problemReporter, environment);
    this.out = out == null ? new PrintWriter(System.out, true) : out;
    this.stats = new CompilerStats();
    initializeParser();
  }
Exemple #2
0
  public Compiler(
      INameEnvironment environment,
      IErrorHandlingPolicy policy,
      CompilerOptions options,
      final ICompilerRequestor requestor,
      IProblemFactory problemFactory,
      PrintWriter out,
      CompilationProgress progress) {

    this.options = options;
    this.progress = progress;

    // GROOVY start - temporary
    if (this.options.buildGroovyFiles == 0) {
      // demoted to error message, groovy disabled
      System.err.println(
          "Build groovy files option has not been set one way or the other: use 'options.put(CompilerOptions.OPTIONG_BuildGroovyFiles, CompilerOptions.ENABLED);'"); //$NON-NLS-1$
      this.options.buildGroovyFiles = 1;
      this.options.groovyFlags = 0;

      //			throw new RuntimeException("Build groovy files option has not been set one way or the
      // other: use 'options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,
      // CompilerOptions.ENABLED);'"); //$NON-NLS-1$
    }
    // GROOVY end

    // wrap requestor in DebugRequestor if one is specified
    if (DebugRequestor == null) {
      this.requestor = requestor;
    } else {
      this.requestor =
          new ICompilerRequestor() {
            public void acceptResult(CompilationResult result) {
              if (DebugRequestor.isActive()) {
                DebugRequestor.acceptDebugResult(result);
              }
              requestor.acceptResult(result);
            }
          };
    }
    this.problemReporter = new ProblemReporter(policy, this.options, problemFactory);
    this.lookupEnvironment =
        new LookupEnvironment(this, this.options, this.problemReporter, environment);
    this.out = out == null ? new PrintWriter(System.out, true) : out;
    this.stats = new CompilerStats();
    initializeParser();
  }