/** Construct a new compiler from a shared context. */
  public AptJavaCompiler(Context context) {
    super(preRegister(context));

    context.put(compilerKey, this);
    apt = Apt.instance(context);

    ClassReader classReader = ClassReader.instance(context);
    classReader.preferSource = true;

    // TEMPORARY NOTE: bark==log, but while refactoring, we maintain their
    // original identities, to remember the original intent.
    log = Log.instance(context);
    bark = Bark.instance(context);

    Options options = Options.instance(context);
    classOutput = options.get("-retrofit") == null;
    nocompile = options.get("-nocompile") != null;
    print = options.get("-print") != null;
    classesAsDecls = options.get("-XclassesAsDecls") != null;

    genSourceFileNames = new java.util.LinkedHashSet<String>();
    genClassFileNames = new java.util.LinkedHashSet<String>();

    // this forces a copy of the line map to be kept in the tree,
    // for use by com.sun.mirror.util.SourcePosition.
    lineDebugInfo = true;
  }
示例#2
0
文件: Log.java 项目: karianna/jdk8_tl
 private int getIntOption(Options options, Option option, int defaultValue) {
   String s = options.get(option);
   try {
     if (s != null) {
       int n = Integer.parseInt(s);
       return (n <= 0 ? Integer.MAX_VALUE : n);
     }
   } catch (NumberFormatException e) {
     // silently ignore ill-formed numbers
   }
   return defaultValue;
 }
示例#3
0
文件: Log.java 项目: karianna/jdk8_tl
  // where
  private void initOptions(Options options) {
    this.dumpOnError = options.isSet(DOE);
    this.promptOnError = options.isSet(PROMPT);
    this.emitWarnings = options.isUnset(XLINT_CUSTOM, "none");
    this.suppressNotes = options.isSet("suppressNotes");
    this.MaxErrors = getIntOption(options, XMAXERRS, getDefaultMaxErrors());
    this.MaxWarnings = getIntOption(options, XMAXWARNS, getDefaultMaxWarnings());

    boolean rawDiagnostics = options.isSet("rawDiagnostics");
    this.diagFormatter =
        rawDiagnostics
            ? new RawDiagnosticFormatter(options)
            : new BasicDiagnosticFormatter(options, messages);

    String ek = options.get("expectKeys");
    if (ek != null) expectDiagKeys = new HashSet<String>(Arrays.asList(ek.split(", *")));
  }