equal
deleted
inserted
replaced
25 |
25 |
26 package com.sun.tools.javac.code; |
26 package com.sun.tools.javac.code; |
27 |
27 |
28 import java.util.EnumSet; |
28 import java.util.EnumSet; |
29 import java.util.Map; |
29 import java.util.Map; |
|
30 import java.util.concurrent.ConcurrentHashMap; |
|
31 |
30 import com.sun.tools.javac.code.Symbol.*; |
32 import com.sun.tools.javac.code.Symbol.*; |
31 import com.sun.tools.javac.util.Context; |
33 import com.sun.tools.javac.util.Context; |
32 import com.sun.tools.javac.util.List; |
34 import com.sun.tools.javac.util.List; |
33 import com.sun.tools.javac.util.Options; |
35 import com.sun.tools.javac.util.Options; |
34 import com.sun.tools.javac.util.Pair; |
36 import com.sun.tools.javac.util.Pair; |
42 * deletion without notice.</b> |
44 * deletion without notice.</b> |
43 */ |
45 */ |
44 public class Lint |
46 public class Lint |
45 { |
47 { |
46 /** The context key for the root Lint object. */ |
48 /** The context key for the root Lint object. */ |
47 protected static final Context.Key<Lint> lintKey = new Context.Key<Lint>(); |
49 protected static final Context.Key<Lint> lintKey = new Context.Key<>(); |
48 |
50 |
49 /** Get the root Lint instance. */ |
51 /** Get the root Lint instance. */ |
50 public static Lint instance(Context context) { |
52 public static Lint instance(Context context) { |
51 Lint instance = context.get(lintKey); |
53 Lint instance = context.get(lintKey); |
52 if (instance == null) |
54 if (instance == null) |
81 private final AugmentVisitor augmentor; |
83 private final AugmentVisitor augmentor; |
82 |
84 |
83 private final EnumSet<LintCategory> values; |
85 private final EnumSet<LintCategory> values; |
84 private final EnumSet<LintCategory> suppressedValues; |
86 private final EnumSet<LintCategory> suppressedValues; |
85 |
87 |
86 private static final Map<String, LintCategory> map = |
88 private static final Map<String, LintCategory> map = new ConcurrentHashMap<>(20); |
87 new java.util.concurrent.ConcurrentHashMap<String, LintCategory>(20); |
|
88 |
89 |
89 protected Lint(Context context) { |
90 protected Lint(Context context) { |
90 // initialize values according to the lint options |
91 // initialize values according to the lint options |
91 Options options = Options.instance(context); |
92 Options options = Options.instance(context); |
92 values = EnumSet.noneOf(LintCategory.class); |
93 values = EnumSet.noneOf(LintCategory.class); |
240 return map.get(option); |
241 return map.get(option); |
241 } |
242 } |
242 |
243 |
243 public final String option; |
244 public final String option; |
244 public final boolean hidden; |
245 public final boolean hidden; |
245 }; |
246 } |
246 |
247 |
247 /** |
248 /** |
248 * Checks if a warning category is enabled. A warning category may be enabled |
249 * Checks if a warning category is enabled. A warning category may be enabled |
249 * on the command line, or by default, and can be temporarily disabled with |
250 * on the command line, or by default, and can be temporarily disabled with |
250 * the SuppressWarnings annotation. |
251 * the SuppressWarnings annotation. |
339 public void visitEnum(Attribute.Enum e) { |
340 public void visitEnum(Attribute.Enum e) { |
340 } |
341 } |
341 |
342 |
342 public void visitError(Attribute.Error e) { |
343 public void visitError(Attribute.Error e) { |
343 } |
344 } |
344 }; |
345 } |
345 } |
346 } |