private static Context preRegister(Context context) {
    Bark.preRegister(context);

    if (context.get(JavaFileManager.class) == null) JavacFileManager.preRegister(context);

    return context;
  }
Esempio n. 2
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);
          }
        });
  }
Esempio n. 3
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;
 }
Esempio n. 4
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;
 }
 /** Get the JavaCompiler instance for this context. */
 public static AptJavaCompiler instance(Context context) {
   AptJavaCompiler instance = context.get(compilerKey);
   if (instance == null) instance = new AptJavaCompiler(context);
   return instance;
 }