langtools/src/share/classes/com/sun/tools/doclint/Messages.java
changeset 22163 3651128c74eb
parent 22153 f9f06fcca59d
equal deleted inserted replaced
22162:3b3e23e67329 22163:3651128c74eb
    74         static boolean accepts(String opt) {
    74         static boolean accepts(String opt) {
    75             for (Group g: values())
    75             for (Group g: values())
    76                 if (opt.equals(g.optName())) return true;
    76                 if (opt.equals(g.optName())) return true;
    77             return false;
    77             return false;
    78         }
    78         }
    79     };
    79     }
    80 
    80 
    81     private final Options options;
    81     private final Options options;
    82     private final Stats stats;
    82     private final Stats stats;
    83 
    83 
    84     ResourceBundle bundle;
    84     ResourceBundle bundle;
   152 
   152 
   153     /**
   153     /**
   154      * Handler for (sub)options specific to message handling.
   154      * Handler for (sub)options specific to message handling.
   155      */
   155      */
   156     static class Options {
   156     static class Options {
   157         Map<String, Env.AccessKind> map = new HashMap<String, Env.AccessKind>();
   157         Map<String, Env.AccessKind> map = new HashMap<>();
   158         private final Stats stats;
   158         private final Stats stats;
   159 
   159 
   160         static boolean isValidOptions(String opts) {
   160         static boolean isValidOptions(String opts) {
   161             for (String opt: opts.split(",")) {
   161             for (String opt: opts.split(",")) {
   162                 if (!isValidOption(StringUtils.toLowerCase(opt.trim())))
   162                 if (!isValidOption(StringUtils.toLowerCase(opt.trim())))
   254 
   254 
   255         void setEnabled(boolean b) {
   255         void setEnabled(boolean b) {
   256             if (b) {
   256             if (b) {
   257                 groupCounts = new int[Messages.Group.values().length];
   257                 groupCounts = new int[Messages.Group.values().length];
   258                 dkindCounts = new int[Diagnostic.Kind.values().length];
   258                 dkindCounts = new int[Diagnostic.Kind.values().length];
   259                 codeCounts = new HashMap<String, Integer>();
   259                 codeCounts = new HashMap<>();
   260             } else {
   260             } else {
   261                 groupCounts = null;
   261                 groupCounts = null;
   262                 dkindCounts = null;
   262                 dkindCounts = null;
   263                 codeCounts = null;
   263                 codeCounts = null;
   264             }
   264             }
   319 
   319 
   320                 public int compare(Integer o1, Integer o2) {
   320                 public int compare(Integer o1, Integer o2) {
   321                     return o2.compareTo(o1);
   321                     return o2.compareTo(o1);
   322                 }
   322                 }
   323             };
   323             };
   324             private final TreeMap<Integer, Set<String>> map = new TreeMap<Integer, Set<String>>(DECREASING);
   324             private final TreeMap<Integer, Set<String>> map = new TreeMap<>(DECREASING);
   325 
   325 
   326             void put(String label, int n) {
   326             void put(String label, int n) {
   327                 if (n == 0) {
   327                 if (n == 0) {
   328                     return;
   328                     return;
   329                 }
   329                 }
   330                 Set<String> labels = map.get(n);
   330                 Set<String> labels = map.get(n);
   331                 if (labels == null) {
   331                 if (labels == null) {
   332                     map.put(n, labels = new TreeSet<String>());
   332                     map.put(n, labels = new TreeSet<>());
   333                 }
   333                 }
   334                 labels.add(label);
   334                 labels.add(label);
   335             }
   335             }
   336 
   336 
   337             void print(PrintWriter out) {
   337             void print(PrintWriter out) {