コード例 #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
 /**
  * Enable a specific feature on this rich formatter.
  *
  * @param feature feature to be enabled
  */
 public void enable(RichFormatterFeature feature) {
   features.add(feature);
 }