コード例 #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
 /**
  * Is a given feature enabled on this formatter?
  *
  * @param feature feature to be tested
  */
 public boolean isEnabled(RichFormatterFeature feature) {
   return features.contains(feature);
 }
コード例 #3
0
 /**
  * Disable a specific feature on this rich formatter.
  *
  * @param feature feature to be disabled
  */
 public void disable(RichFormatterFeature feature) {
   features.remove(feature);
 }
コード例 #4
0
 /**
  * Enable a specific feature on this rich formatter.
  *
  * @param feature feature to be enabled
  */
 public void enable(RichFormatterFeature feature) {
   features.add(feature);
 }