author | ksrini |
Fri, 09 Feb 2018 13:58:17 -0800 | |
changeset 48840 | 5e2d2067da48 |
parent 48515 | 0da9fb7d7d04 |
child 51891 | 9d9ab30af97d |
permissions | -rw-r--r-- |
14543 | 1 |
/* |
48445
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. |
14543 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
37938
42baa89d2156
8075703: jdk.javadoc module exports com.sun.tools.javadoc package which contains a lot of internal API.
jjg
parents:
36526
diff
changeset
|
26 |
package com.sun.tools.javadoc.main; |
14543 | 27 |
|
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
28 |
import java.util.LinkedHashMap; |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
29 |
import java.util.Map; |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
30 |
import java.util.StringTokenizer; |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
31 |
|
14543 | 32 |
import com.sun.tools.javac.code.Flags; |
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
33 |
import com.sun.tools.javac.main.Option; |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
40762
diff
changeset
|
34 |
import com.sun.tools.javac.main.Option.InvalidValueException; |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
35 |
import com.sun.tools.javac.main.OptionHelper; |
14543 | 36 |
import com.sun.tools.javac.util.ListBuffer; |
37 |
import com.sun.tools.javac.util.Options; |
|
38 |
||
39 |
||
40 |
/** |
|
41 |
* javadoc tool options. |
|
42 |
* |
|
43 |
* <p><b>This is NOT part of any supported API. |
|
44 |
* If you write code that depends on this, you do so at your own risk. |
|
45 |
* This code and its internal interfaces are subject to change or |
|
46 |
* deletion without notice.</b> |
|
47 |
*/ |
|
48840
5e2d2067da48
8194651: javadoc: mark the com.sun.javadoc API for removal
ksrini
parents:
48515
diff
changeset
|
48 |
@Deprecated(since="9", forRemoval=true) |
5e2d2067da48
8194651: javadoc: mark the com.sun.javadoc API for removal
ksrini
parents:
48515
diff
changeset
|
49 |
@SuppressWarnings("removal") |
14543 | 50 |
public enum ToolOption { |
51 |
// ----- options for underlying compiler ----- |
|
52 |
||
53 |
BOOTCLASSPATH("-bootclasspath", true) { |
|
54 |
@Override |
|
55 |
public void process(Helper helper, String arg) { |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
56 |
helper.setFileManagerOpt(Option.BOOT_CLASS_PATH, arg); |
14543 | 57 |
} |
58 |
}, |
|
59 |
||
60 |
CLASSPATH("-classpath", true) { |
|
61 |
@Override |
|
62 |
public void process(Helper helper, String arg) { |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
63 |
helper.setFileManagerOpt(Option.CLASS_PATH, arg); |
14543 | 64 |
} |
65 |
}, |
|
66 |
||
18898
0eab5f5e3d1d
8009924: some langtools tools do not accept -cp as an alias for -classpath
vromero
parents:
14543
diff
changeset
|
67 |
CP("-cp", true) { |
0eab5f5e3d1d
8009924: some langtools tools do not accept -cp as an alias for -classpath
vromero
parents:
14543
diff
changeset
|
68 |
@Override |
0eab5f5e3d1d
8009924: some langtools tools do not accept -cp as an alias for -classpath
vromero
parents:
14543
diff
changeset
|
69 |
public void process(Helper helper, String arg) { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
70 |
helper.setFileManagerOpt(Option.CLASS_PATH, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
71 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
72 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
73 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
74 |
CLASS_PATH("--class-path", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
75 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
76 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
77 |
helper.setFileManagerOpt(Option.CLASS_PATH, arg); |
18898
0eab5f5e3d1d
8009924: some langtools tools do not accept -cp as an alias for -classpath
vromero
parents:
14543
diff
changeset
|
78 |
} |
0eab5f5e3d1d
8009924: some langtools tools do not accept -cp as an alias for -classpath
vromero
parents:
14543
diff
changeset
|
79 |
}, |
0eab5f5e3d1d
8009924: some langtools tools do not accept -cp as an alias for -classpath
vromero
parents:
14543
diff
changeset
|
80 |
|
14543 | 81 |
EXTDIRS("-extdirs", true) { |
82 |
@Override |
|
83 |
public void process(Helper helper, String arg) { |
|
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
84 |
helper.setFileManagerOpt(Option.EXTDIRS, arg); |
14543 | 85 |
} |
86 |
}, |
|
87 |
||
88 |
SOURCEPATH("-sourcepath", true) { |
|
89 |
@Override |
|
90 |
public void process(Helper helper, String arg) { |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
91 |
helper.setFileManagerOpt(Option.SOURCE_PATH, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
92 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
93 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
94 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
95 |
SOURCE_PATH("--source-path", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
96 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
97 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
98 |
helper.setFileManagerOpt(Option.SOURCE_PATH, arg); |
14543 | 99 |
} |
100 |
}, |
|
101 |
||
102 |
SYSCLASSPATH("-sysclasspath", true) { |
|
103 |
@Override |
|
104 |
public void process(Helper helper, String arg) { |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
105 |
helper.setFileManagerOpt(Option.BOOT_CLASS_PATH, arg); |
14543 | 106 |
} |
107 |
}, |
|
108 |
||
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
109 |
MODULE_SOURCE_PATH("--module-source-path", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
110 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
111 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
112 |
helper.setFileManagerOpt(Option.MODULE_SOURCE_PATH, arg); |
36526 | 113 |
} |
114 |
}, |
|
115 |
||
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
116 |
UPGRADE_MODULE_PATH("--upgrade-module-path", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
117 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
118 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
119 |
helper.setFileManagerOpt(Option.UPGRADE_MODULE_PATH, arg); |
36526 | 120 |
} |
121 |
}, |
|
122 |
||
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
123 |
SYSTEM_("--system", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
124 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
125 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
126 |
helper.setFileManagerOpt(Option.SYSTEM, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
127 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
128 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
129 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
130 |
MODULE_PATH("--module-path", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
131 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
132 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
133 |
helper.setFileManagerOpt(Option.MODULE_PATH, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
134 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
135 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
136 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
137 |
P("-p", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
138 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
139 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
140 |
helper.setFileManagerOpt(Option.MODULE_PATH, arg); |
36526 | 141 |
} |
142 |
}, |
|
143 |
||
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
144 |
ADD_MODULES("--add-modules", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
145 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
40762
diff
changeset
|
146 |
public void process(Helper helper, String arg) throws InvalidValueException { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
147 |
Option.ADD_MODULES.process(helper.getOptionHelper(), opt, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
148 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
149 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
150 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
151 |
LIMIT_MODULES("--limit-modules", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
152 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
40762
diff
changeset
|
153 |
public void process(Helper helper, String arg) throws InvalidValueException { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
154 |
Option.LIMIT_MODULES.process(helper.getOptionHelper(), opt, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
155 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
156 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
157 |
|
14543 | 158 |
ENCODING("-encoding", true) { |
159 |
@Override |
|
160 |
public void process(Helper helper, String arg) { |
|
161 |
helper.encoding = arg; |
|
162 |
helper.setCompilerOpt(opt, arg); |
|
48445
cb7926b6b3d6
8188649: javadoc -encoding doesn't work when using the old doclet API
jjg
parents:
47216
diff
changeset
|
163 |
helper.setFileManagerOpt(Option.ENCODING, arg); |
14543 | 164 |
} |
165 |
}, |
|
166 |
||
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
167 |
RELEASE("--release", true) { |
31936 | 168 |
@Override |
169 |
public void process(Helper helper, String arg) { |
|
170 |
helper.setCompilerOpt(opt, arg); |
|
171 |
} |
|
172 |
}, |
|
173 |
||
14543 | 174 |
SOURCE("-source", true) { |
175 |
@Override |
|
176 |
public void process(Helper helper, String arg) { |
|
177 |
helper.setCompilerOpt(opt, arg); |
|
178 |
} |
|
179 |
}, |
|
180 |
||
181 |
XMAXERRS("-Xmaxerrs", true) { |
|
182 |
@Override |
|
183 |
public void process(Helper helper, String arg) { |
|
184 |
helper.setCompilerOpt(opt, arg); |
|
185 |
} |
|
186 |
}, |
|
187 |
||
188 |
XMAXWARNS("-Xmaxwarns", true) { |
|
189 |
@Override |
|
190 |
public void process(Helper helper, String arg) { |
|
191 |
helper.setCompilerOpt(opt, arg); |
|
192 |
} |
|
193 |
}, |
|
194 |
||
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
195 |
ADD_READS("--add-reads", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
196 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
40762
diff
changeset
|
197 |
public void process(Helper helper, String arg) throws InvalidValueException { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
198 |
Option.ADD_READS.process(helper.getOptionHelper(), opt, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
199 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
200 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
201 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
202 |
ADD_EXPORTS("--add-exports", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
203 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
40762
diff
changeset
|
204 |
public void process(Helper helper, String arg) throws InvalidValueException { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
205 |
Option.ADD_EXPORTS.process(helper.getOptionHelper(), opt, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
206 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
207 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
208 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
209 |
PATCH_MODULE("--patch-module", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
210 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
40762
diff
changeset
|
211 |
public void process(Helper helper, String arg) throws InvalidValueException { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
212 |
Option.PATCH_MODULE.process(helper.getOptionHelper(), opt, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
213 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
214 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
215 |
|
48515 | 216 |
ADD_OPENS("--add-opens", true) { |
217 |
@Override |
|
218 |
public void process(Helper helper, String arg) throws InvalidValueException { |
|
219 |
Option.ADD_OPENS.process(helper.getOptionHelper(), opt, arg); |
|
220 |
} |
|
221 |
}, |
|
222 |
||
14543 | 223 |
// ----- doclet options ----- |
224 |
||
225 |
DOCLET("-doclet", true), // handled in setDocletInvoker |
|
226 |
||
227 |
DOCLETPATH("-docletpath", true), // handled in setDocletInvoker |
|
228 |
||
229 |
// ----- selection options ----- |
|
230 |
||
231 |
SUBPACKAGES("-subpackages", true) { |
|
232 |
@Override |
|
233 |
public void process(Helper helper, String arg) { |
|
234 |
helper.addToList(helper.subPackages, arg); |
|
235 |
} |
|
236 |
}, |
|
237 |
||
238 |
EXCLUDE("-exclude", true) { |
|
239 |
@Override |
|
240 |
public void process(Helper helper, String arg) { |
|
241 |
helper.addToList(helper.excludedPackages, arg); |
|
242 |
} |
|
243 |
}, |
|
244 |
||
245 |
// ----- filtering options ----- |
|
246 |
||
247 |
PACKAGE("-package") { |
|
248 |
@Override |
|
249 |
public void process(Helper helper) { |
|
250 |
helper.setFilter( |
|
251 |
Flags.PUBLIC | Flags.PROTECTED | ModifierFilter.PACKAGE); |
|
252 |
} |
|
253 |
}, |
|
254 |
||
255 |
PRIVATE("-private") { |
|
256 |
@Override |
|
257 |
public void process(Helper helper) { |
|
258 |
helper.setFilter(ModifierFilter.ALL_ACCESS); |
|
259 |
} |
|
260 |
}, |
|
261 |
||
262 |
PROTECTED("-protected") { |
|
263 |
@Override |
|
264 |
public void process(Helper helper) { |
|
265 |
helper.setFilter(Flags.PUBLIC | Flags.PROTECTED); |
|
266 |
} |
|
267 |
}, |
|
268 |
||
269 |
PUBLIC("-public") { |
|
270 |
@Override |
|
271 |
public void process(Helper helper) { |
|
272 |
helper.setFilter(Flags.PUBLIC); |
|
273 |
} |
|
274 |
}, |
|
275 |
||
276 |
// ----- output control options ----- |
|
277 |
||
278 |
PROMPT("-prompt") { |
|
279 |
@Override |
|
280 |
public void process(Helper helper) { |
|
281 |
helper.compOpts.put("-prompt", "-prompt"); |
|
282 |
helper.promptOnError = true; |
|
283 |
} |
|
284 |
}, |
|
285 |
||
286 |
QUIET("-quiet") { |
|
287 |
@Override |
|
288 |
public void process(Helper helper) { |
|
289 |
helper.quiet = true; |
|
290 |
} |
|
291 |
}, |
|
292 |
||
293 |
VERBOSE("-verbose") { |
|
294 |
@Override |
|
295 |
public void process(Helper helper) { |
|
296 |
helper.compOpts.put("-verbose", ""); |
|
297 |
} |
|
298 |
}, |
|
299 |
||
300 |
XWERROR("-Xwerror") { |
|
301 |
@Override |
|
302 |
public void process(Helper helper) { |
|
303 |
helper.rejectWarnings = true; |
|
304 |
||
305 |
} |
|
306 |
}, |
|
307 |
||
308 |
// ----- other options ----- |
|
309 |
||
310 |
BREAKITERATOR("-breakiterator") { |
|
311 |
@Override |
|
312 |
public void process(Helper helper) { |
|
313 |
helper.breakiterator = true; |
|
314 |
} |
|
315 |
}, |
|
316 |
||
317 |
LOCALE("-locale", true) { |
|
318 |
@Override |
|
319 |
public void process(Helper helper, String arg) { |
|
320 |
helper.docLocale = arg; |
|
321 |
} |
|
322 |
}, |
|
323 |
||
324 |
OVERVIEW("-overview", true), |
|
325 |
||
326 |
XCLASSES("-Xclasses") { |
|
327 |
@Override |
|
328 |
public void process(Helper helper) { |
|
329 |
helper.docClasses = true; |
|
330 |
||
331 |
} |
|
332 |
}, |
|
333 |
||
334 |
// ----- help options ----- |
|
335 |
||
336 |
HELP("-help") { |
|
337 |
@Override |
|
338 |
public void process(Helper helper) { |
|
339 |
helper.usage(); |
|
340 |
} |
|
341 |
}, |
|
342 |
||
343 |
X("-X") { |
|
344 |
@Override |
|
345 |
public void process(Helper helper) { |
|
346 |
helper.Xusage(); |
|
347 |
} |
|
348 |
}; |
|
349 |
||
350 |
public final String opt; |
|
351 |
public final boolean hasArg; |
|
352 |
||
353 |
ToolOption(String opt) { |
|
354 |
this(opt, false); |
|
355 |
} |
|
356 |
||
357 |
ToolOption(String opt, boolean hasArg) { |
|
358 |
this.opt = opt; |
|
359 |
this.hasArg = hasArg; |
|
360 |
} |
|
361 |
||
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
40762
diff
changeset
|
362 |
void process(Helper helper, String arg) throws Option.InvalidValueException { } |
14543 | 363 |
|
364 |
void process(Helper helper) { } |
|
365 |
||
366 |
static ToolOption get(String name) { |
|
367 |
for (ToolOption o: values()) { |
|
368 |
if (name.equals(o.opt)) |
|
369 |
return o; |
|
370 |
} |
|
371 |
return null; |
|
372 |
} |
|
373 |
||
374 |
static abstract class Helper { |
|
375 |
/** List of decoded options. */ |
|
22163 | 376 |
final ListBuffer<String[]> options = new ListBuffer<>(); |
14543 | 377 |
|
378 |
/** Selected packages, from -subpackages. */ |
|
22163 | 379 |
final ListBuffer<String> subPackages = new ListBuffer<>(); |
14543 | 380 |
|
381 |
/** Excluded packages, from -exclude. */ |
|
22163 | 382 |
final ListBuffer<String> excludedPackages = new ListBuffer<>(); |
14543 | 383 |
|
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
384 |
// File manager options |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
385 |
final Map<Option, String> fileManagerOpts = new LinkedHashMap<>(); |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
386 |
|
14543 | 387 |
/** javac options, set by various options. */ |
388 |
Options compOpts; // = Options.instance(context) |
|
389 |
||
390 |
/* Encoding for javac, and files written? set by -encoding. */ |
|
391 |
String encoding = null; |
|
392 |
||
393 |
/** Set by -breakiterator. */ |
|
394 |
boolean breakiterator = false; |
|
395 |
||
396 |
/** Set by -quiet. */ |
|
397 |
boolean quiet = false; |
|
398 |
||
399 |
/** Set by -Xclasses. */ |
|
400 |
boolean docClasses = false; |
|
401 |
||
402 |
/** Set by -Xwerror. */ |
|
403 |
boolean rejectWarnings = false; |
|
404 |
||
405 |
/** Set by -prompt. */ |
|
406 |
boolean promptOnError; |
|
407 |
||
408 |
/** Set by -locale. */ |
|
409 |
String docLocale = ""; |
|
410 |
||
411 |
/** Set by -public, private, -protected, -package. */ |
|
412 |
ModifierFilter showAccess = null; |
|
413 |
||
414 |
abstract void usage(); |
|
415 |
abstract void Xusage(); |
|
416 |
||
417 |
abstract void usageError(String msg, Object... args); |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
38617
diff
changeset
|
418 |
abstract OptionHelper getOptionHelper(); |
14543 | 419 |
|
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
420 |
void addToList(ListBuffer<String> list, String str){ |
14543 | 421 |
StringTokenizer st = new StringTokenizer(str, ":"); |
422 |
String current; |
|
423 |
while(st.hasMoreTokens()){ |
|
424 |
current = st.nextToken(); |
|
425 |
list.append(current); |
|
426 |
} |
|
427 |
} |
|
428 |
||
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
429 |
void setFilter(long filterBits) { |
14543 | 430 |
if (showAccess != null) { |
431 |
usageError("main.incompatible.access.flags"); |
|
432 |
} |
|
433 |
showAccess = new ModifierFilter(filterBits); |
|
434 |
} |
|
435 |
||
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
436 |
void setCompilerOpt(String opt, String arg) { |
14543 | 437 |
if (compOpts.get(opt) != null) { |
438 |
usageError("main.option.already.seen", opt); |
|
439 |
} |
|
440 |
compOpts.put(opt, arg); |
|
441 |
} |
|
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
442 |
|
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
443 |
void setFileManagerOpt(Option opt, String arg) { |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
444 |
fileManagerOpts.put(opt, arg); |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
445 |
} |
14543 | 446 |
} |
447 |
} |