コード例 #1
0
 @SuppressWarnings("fallthrough")
 public RichConfiguration(Options options, AbstractDiagnosticFormatter formatter) {
   super(formatter.getConfiguration());
   features =
       formatter.isRaw()
           ? EnumSet.noneOf(RichFormatterFeature.class)
           : EnumSet.of(
               RichFormatterFeature.SIMPLE_NAMES,
               RichFormatterFeature.WHERE_CLAUSES,
               RichFormatterFeature.UNIQUE_TYPEVAR_NAMES);
   String diagOpts = options.get("diags");
   if (diagOpts != null) {
     for (String args : diagOpts.split(",")) {
       if (args.equals("-where")) {
         features.remove(RichFormatterFeature.WHERE_CLAUSES);
       } else if (args.equals("where")) {
         features.add(RichFormatterFeature.WHERE_CLAUSES);
       }
       if (args.equals("-simpleNames")) {
         features.remove(RichFormatterFeature.SIMPLE_NAMES);
       } else if (args.equals("simpleNames")) {
         features.add(RichFormatterFeature.SIMPLE_NAMES);
       }
       if (args.equals("-disambiguateTvars")) {
         features.remove(RichFormatterFeature.UNIQUE_TYPEVAR_NAMES);
       } else if (args.equals("disambiguateTvars")) {
         features.add(RichFormatterFeature.UNIQUE_TYPEVAR_NAMES);
       }
     }
   }
 }
コード例 #2
0
 protected RichDiagnosticFormatter(Context context) {
   super((AbstractDiagnosticFormatter) Log.instance(context).getDiagnosticFormatter());
   setRichPrinter(new RichPrinter());
   this.syms = Symtab.instance(context);
   this.diags = JCDiagnostic.Factory.instance(context);
   this.types = Types.instance(context);
   this.messages = JavacMessages.instance(context);
   whereClauses = new LinkedHashMap<WhereClauseKind, Map<Type, JCDiagnostic>>();
   configuration = new RichConfiguration(Options.instance(context), formatter);
   for (WhereClauseKind kind : WhereClauseKind.values())
     whereClauses.put(kind, new LinkedHashMap<Type, JCDiagnostic>());
 }