示例#1
0
文件: Log.java 项目: karianna/jdk8_tl
  /** 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);
          }
        });
  }
示例#2
0
文件: Log.java 项目: karianna/jdk8_tl
 /** 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;
 }
示例#3
0
文件: Log.java 项目: karianna/jdk8_tl
 /** 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;
 }