Example #1
0
  /** Construct a log with given I/O redirections. */
  protected Log(
      Context context, PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter) {
    super(JCDiagnostic.Factory.instance(context));
    context.put(logKey, this);
    this.errWriter = errWriter;
    this.warnWriter = warnWriter;
    this.noticeWriter = noticeWriter;

    @SuppressWarnings("unchecked") // FIXME
    DiagnosticListener<? super JavaFileObject> dl = context.get(DiagnosticListener.class);
    this.diagListener = dl;

    diagnosticHandler = new DefaultDiagnosticHandler();

    messages = JavacMessages.instance(context);
    messages.add(Main.javacBundleName);

    final Options options = Options.instance(context);
    initOptions(options);
    options.addListener(
        new Runnable() {
          public void run() {
            initOptions(options);
          }
        });
  }
Example #2
0
 /** Get the Log instance for this context. */
 public static Log instance(Context context) {
   Log instance = context.get(logKey);
   if (instance == null) instance = new Log(context);
   return instance;
 }
Example #3
0
 /** The default writer for diagnostics */
 static PrintWriter defaultWriter(Context context) {
   PrintWriter result = context.get(outKey);
   if (result == null) context.put(outKey, result = new PrintWriter(System.err));
   return result;
 }