23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.tools.javac.main; |
26 package com.sun.tools.javac.main; |
27 |
27 |
|
28 import java.io.File; |
|
29 import java.io.FileWriter; |
|
30 import java.io.PrintWriter; |
28 import java.util.Collections; |
31 import java.util.Collections; |
29 import com.sun.tools.javac.util.Log.PrefixKind; |
32 import java.util.EnumSet; |
30 import com.sun.tools.javac.util.Log.WriterKind; |
33 import java.util.LinkedHashMap; |
31 import com.sun.tools.javac.util.Log; |
34 import java.util.Map; |
|
35 import java.util.Set; |
|
36 |
|
37 import javax.lang.model.SourceVersion; |
|
38 |
|
39 import com.sun.tools.doclint.DocLint; |
32 import com.sun.tools.javac.code.Lint; |
40 import com.sun.tools.javac.code.Lint; |
33 import com.sun.tools.javac.code.Source; |
41 import com.sun.tools.javac.code.Source; |
34 import com.sun.tools.javac.code.Type; |
42 import com.sun.tools.javac.code.Type; |
35 import com.sun.tools.javac.jvm.Target; |
43 import com.sun.tools.javac.jvm.Target; |
|
44 import com.sun.tools.javac.processing.JavacProcessingEnvironment; |
|
45 import com.sun.tools.javac.util.Log; |
|
46 import com.sun.tools.javac.util.Log.PrefixKind; |
|
47 import com.sun.tools.javac.util.Log.WriterKind; |
36 import com.sun.tools.javac.util.Options; |
48 import com.sun.tools.javac.util.Options; |
37 import com.sun.tools.javac.processing.JavacProcessingEnvironment; |
|
38 import java.io.File; |
|
39 import java.io.FileWriter; |
|
40 import java.io.PrintWriter; |
|
41 import java.util.EnumSet; |
|
42 import java.util.LinkedHashMap; |
|
43 import java.util.Map; |
|
44 import java.util.Set; |
|
45 import javax.lang.model.SourceVersion; |
|
46 |
|
47 import static com.sun.tools.javac.main.Option.ChoiceKind.*; |
49 import static com.sun.tools.javac.main.Option.ChoiceKind.*; |
|
50 import static com.sun.tools.javac.main.Option.OptionGroup.*; |
48 import static com.sun.tools.javac.main.Option.OptionKind.*; |
51 import static com.sun.tools.javac.main.Option.OptionKind.*; |
49 import static com.sun.tools.javac.main.Option.OptionGroup.*; |
|
50 |
52 |
51 /** |
53 /** |
52 * Options for javac. The specific Option to handle a command-line option |
54 * Options for javac. The specific Option to handle a command-line option |
53 * is identified by searching the members of this enum in order, looking |
55 * is identified by searching the members of this enum in order, looking |
54 * the first {@link #matches match}. The action for an Option is performed |
56 * the first {@link #matches match}. The action for an Option is performed |
76 |
78 |
77 XLINT("-Xlint", "opt.Xlint", EXTENDED, BASIC), |
79 XLINT("-Xlint", "opt.Xlint", EXTENDED, BASIC), |
78 |
80 |
79 XLINT_CUSTOM("-Xlint:", "opt.Xlint.suboptlist", |
81 XLINT_CUSTOM("-Xlint:", "opt.Xlint.suboptlist", |
80 EXTENDED, BASIC, ANYOF, getXLintChoices()), |
82 EXTENDED, BASIC, ANYOF, getXLintChoices()), |
|
83 |
|
84 XDOCLINT("-Xdoclint", "opt.Xdoclint", EXTENDED, BASIC), |
|
85 |
|
86 XDOCLINT_CUSTOM("-Xdoclint:", "opt.Xdoclint.subopts", "opt.Xdoclint.custom", EXTENDED, BASIC) { |
|
87 @Override |
|
88 public boolean matches(String option) { |
|
89 return DocLint.isValidOption( |
|
90 option.replace(XDOCLINT_CUSTOM.text, DocLint.XMSGS_CUSTOM_PREFIX)); |
|
91 } |
|
92 |
|
93 @Override |
|
94 public boolean process(OptionHelper helper, String option) { |
|
95 String prev = helper.get(XDOCLINT_CUSTOM); |
|
96 String next = (prev == null) ? option : (prev + " " + option); |
|
97 helper.put(XDOCLINT_CUSTOM.text, next); |
|
98 return false; |
|
99 } |
|
100 }, |
81 |
101 |
82 // -nowarn is retained for command-line backward compatibility |
102 // -nowarn is retained for command-line backward compatibility |
83 NOWARN("-nowarn", "opt.nowarn", STANDARD, BASIC) { |
103 NOWARN("-nowarn", "opt.nowarn", STANDARD, BASIC) { |
84 @Override |
104 @Override |
85 public boolean process(OptionHelper helper, String option) { |
105 public boolean process(OptionHelper helper, String option) { |