author | jjg |
Wed, 10 Aug 2016 15:47:46 -0700 | |
changeset 40308 | 274367a99f98 |
parent 37393 | a9ba8bd6697b |
child 40508 | 74ef30d16fb9 |
permissions | -rw-r--r-- |
14543 | 1 |
/* |
36526 | 2 |
* Copyright (c) 2012, 2016, 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 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
26 |
package jdk.javadoc.internal.tool; |
14543 | 27 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
28 |
import java.util.ArrayList; |
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
29 |
import java.util.LinkedHashMap; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
30 |
import java.util.List; |
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
31 |
import java.util.Map; |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
32 |
import java.util.StringTokenizer; |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
33 |
|
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
34 |
import com.sun.tools.javac.main.Option; |
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
35 |
import com.sun.tools.javac.main.OptionHelper; |
14543 | 36 |
import com.sun.tools.javac.util.Options; |
37 |
||
38 |
/** |
|
39 |
* javadoc tool options. |
|
40 |
* |
|
41 |
* <p><b>This is NOT part of any supported API. |
|
42 |
* If you write code that depends on this, you do so at your own risk. |
|
43 |
* This code and its internal interfaces are subject to change or |
|
44 |
* deletion without notice.</b> |
|
45 |
*/ |
|
46 |
public enum ToolOption { |
|
47 |
// ----- options for underlying compiler ----- |
|
48 |
||
49 |
BOOTCLASSPATH("-bootclasspath", true) { |
|
50 |
@Override |
|
51 |
public void process(Helper helper, String arg) { |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
52 |
helper.setFileManagerOpt(Option.BOOT_CLASS_PATH, arg); |
14543 | 53 |
} |
54 |
}, |
|
55 |
||
56 |
CLASSPATH("-classpath", true) { |
|
57 |
@Override |
|
58 |
public void process(Helper helper, String arg) { |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
59 |
helper.setFileManagerOpt(Option.CLASS_PATH, arg); |
14543 | 60 |
} |
61 |
}, |
|
62 |
||
18898
0eab5f5e3d1d
8009924: some langtools tools do not accept -cp as an alias for -classpath
vromero
parents:
14543
diff
changeset
|
63 |
CP("-cp", true) { |
0eab5f5e3d1d
8009924: some langtools tools do not accept -cp as an alias for -classpath
vromero
parents:
14543
diff
changeset
|
64 |
@Override |
0eab5f5e3d1d
8009924: some langtools tools do not accept -cp as an alias for -classpath
vromero
parents:
14543
diff
changeset
|
65 |
public void process(Helper helper, String arg) { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
66 |
helper.setFileManagerOpt(Option.CLASS_PATH, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
67 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
68 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
69 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
70 |
CLASS_PATH("--class-path", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
71 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
72 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
73 |
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
|
74 |
} |
0eab5f5e3d1d
8009924: some langtools tools do not accept -cp as an alias for -classpath
vromero
parents:
14543
diff
changeset
|
75 |
}, |
0eab5f5e3d1d
8009924: some langtools tools do not accept -cp as an alias for -classpath
vromero
parents:
14543
diff
changeset
|
76 |
|
14543 | 77 |
EXTDIRS("-extdirs", true) { |
78 |
@Override |
|
79 |
public void process(Helper helper, String arg) { |
|
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
80 |
helper.setFileManagerOpt(Option.EXTDIRS, arg); |
14543 | 81 |
} |
82 |
}, |
|
83 |
||
84 |
SOURCEPATH("-sourcepath", true) { |
|
85 |
@Override |
|
86 |
public void process(Helper helper, String arg) { |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
87 |
helper.setFileManagerOpt(Option.SOURCE_PATH, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
88 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
89 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
90 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
91 |
SOURCE_PATH("--source-path", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
92 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
93 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
94 |
helper.setFileManagerOpt(Option.SOURCE_PATH, arg); |
14543 | 95 |
} |
96 |
}, |
|
97 |
||
98 |
SYSCLASSPATH("-sysclasspath", true) { |
|
99 |
@Override |
|
100 |
public void process(Helper helper, String arg) { |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
101 |
helper.setFileManagerOpt(Option.BOOT_CLASS_PATH, arg); |
14543 | 102 |
} |
103 |
}, |
|
104 |
||
36526 | 105 |
MODULESOURCEPATH("-modulesourcepath", true) { |
106 |
@Override |
|
107 |
public void process(Helper helper, String arg) { |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
108 |
helper.setFileManagerOpt(Option.MODULE_SOURCE_PATH, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
109 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
110 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
111 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
112 |
MODULE_SOURCE_PATH("--module-source-path", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
113 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
114 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
115 |
helper.setFileManagerOpt(Option.MODULE_SOURCE_PATH, arg); |
36526 | 116 |
} |
117 |
}, |
|
118 |
||
119 |
UPGRADEMODULEPATH("-upgrademodulepath", true) { |
|
120 |
@Override |
|
121 |
public void process(Helper helper, String arg) { |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
122 |
helper.setFileManagerOpt(Option.UPGRADE_MODULE_PATH, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
123 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
124 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
125 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
126 |
UPGRADE_MODULE_PATH("--upgrade-module-path", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
127 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
128 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
129 |
helper.setFileManagerOpt(Option.UPGRADE_MODULE_PATH, arg); |
36526 | 130 |
} |
131 |
}, |
|
132 |
||
133 |
SYSTEM("-system", true) { |
|
134 |
@Override |
|
135 |
public void process(Helper helper, String arg) { |
|
136 |
helper.setFileManagerOpt(Option.SYSTEM, arg); |
|
137 |
} |
|
138 |
}, |
|
139 |
||
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
140 |
SYSTEM_("--system", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
141 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
142 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
143 |
helper.setFileManagerOpt(Option.SYSTEM, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
144 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
145 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
146 |
|
36526 | 147 |
MODULEPATH("-modulepath", true) { |
148 |
@Override |
|
149 |
public void process(Helper helper, String arg) { |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
150 |
helper.setFileManagerOpt(Option.MODULE_PATH, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
151 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
152 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
153 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
154 |
MODULE_PATH("--module-path", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
155 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
156 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
157 |
helper.setFileManagerOpt(Option.MODULE_PATH, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
158 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
159 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
160 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
161 |
P("-p", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
162 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
163 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
164 |
helper.setFileManagerOpt(Option.MODULE_PATH, arg); |
36526 | 165 |
} |
166 |
}, |
|
167 |
||
168 |
ADDMODS("-addmods", true) { |
|
169 |
@Override |
|
170 |
public void process(Helper helper, String arg) { |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
171 |
Option.ADD_MODULES.process(helper.getOptionHelper(), opt, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
172 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
173 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
174 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
175 |
ADD_MODULES("--add-modules", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
176 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
177 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
178 |
Option.ADD_MODULES.process(helper.getOptionHelper(), opt, arg); |
36526 | 179 |
} |
180 |
}, |
|
181 |
||
182 |
LIMITMODS("-limitmods", true) { |
|
183 |
@Override |
|
184 |
public void process(Helper helper, String arg) { |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
185 |
Option.LIMIT_MODULES.process(helper.getOptionHelper(), opt, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
186 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
187 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
188 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
189 |
LIMIT_MODULES("--limit-modules", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
190 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
191 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
192 |
Option.LIMIT_MODULES.process(helper.getOptionHelper(), opt, arg); |
36526 | 193 |
} |
194 |
}, |
|
195 |
||
14543 | 196 |
ENCODING("-encoding", true) { |
197 |
@Override |
|
198 |
public void process(Helper helper, String arg) { |
|
199 |
helper.encoding = arg; |
|
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
200 |
helper.setFileManagerOpt(Option.ENCODING, arg); |
14543 | 201 |
} |
202 |
}, |
|
203 |
||
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
204 |
RELEASE("--release", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
205 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
206 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
207 |
Option.RELEASE.process(helper.getOptionHelper(), opt, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
208 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
209 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
210 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
211 |
RELEASE_OLD("-release", true) { |
31936 | 212 |
@Override |
213 |
public void process(Helper helper, String arg) { |
|
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
214 |
Option.RELEASE.process(helper.getOptionHelper(), opt, arg); |
31936 | 215 |
} |
216 |
}, |
|
217 |
||
14543 | 218 |
SOURCE("-source", true) { |
219 |
@Override |
|
220 |
public void process(Helper helper, String arg) { |
|
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
221 |
Option.SOURCE.process(helper.getOptionHelper(), opt, arg); |
14543 | 222 |
} |
223 |
}, |
|
224 |
||
225 |
XMAXERRS("-Xmaxerrs", true) { |
|
226 |
@Override |
|
227 |
public void process(Helper helper, String arg) { |
|
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
228 |
Option.XMAXERRS.process(helper.getOptionHelper(), opt, arg); |
14543 | 229 |
} |
230 |
}, |
|
231 |
||
232 |
XMAXWARNS("-Xmaxwarns", true) { |
|
233 |
@Override |
|
234 |
public void process(Helper helper, String arg) { |
|
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
235 |
Option.XMAXWARNS.process(helper.getOptionHelper(), opt, arg); |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
236 |
} |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
237 |
}, |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
238 |
|
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
239 |
XADDREADS("-XaddReads:", false) { |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
240 |
@Override |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
241 |
public void process(Helper helper, String arg) { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
242 |
Option.ADD_READS.process(helper.getOptionHelper(), arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
243 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
244 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
245 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
246 |
ADD_READS("--add-reads", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
247 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
248 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
249 |
Option.ADD_READS.process(helper.getOptionHelper(), opt, arg); |
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
250 |
} |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
251 |
}, |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
252 |
|
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
253 |
ADDEXPORTS("-XaddExports:", false) { |
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
254 |
@Override |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
255 |
public void process(Helper helper, String arg) { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
256 |
Option.ADD_EXPORTS.process(helper.getOptionHelper(), arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
257 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
258 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
259 |
|
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
260 |
ADD_EXPORTS("--add-exports", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
261 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
262 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
263 |
Option.ADD_EXPORTS.process(helper.getOptionHelper(), opt, arg); |
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
264 |
} |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
265 |
}, |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
266 |
|
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
267 |
XMODULE("-Xmodule:", false) { |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
268 |
@Override |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
269 |
public void process(Helper helper, String arg) { |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
270 |
Option.XMODULE.process(helper.getOptionHelper(), arg); |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
271 |
} |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
272 |
}, |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
273 |
|
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
274 |
XPATCH("-Xpatch:", false) { |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
275 |
@Override |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
276 |
public void process(Helper helper, String arg) { |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
277 |
Option.XMODULE.process(helper.getOptionHelper(), arg); |
14543 | 278 |
} |
279 |
}, |
|
280 |
||
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
281 |
PATCH_MODULE("--patch-module", true) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
282 |
@Override |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
283 |
public void process(Helper helper, String arg) { |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
284 |
Option.PATCH_MODULE.process(helper.getOptionHelper(), opt, arg); |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
285 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
286 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
287 |
|
14543 | 288 |
// ----- doclet options ----- |
289 |
||
290 |
DOCLET("-doclet", true), // handled in setDocletInvoker |
|
291 |
||
292 |
DOCLETPATH("-docletpath", true), // handled in setDocletInvoker |
|
293 |
||
294 |
// ----- selection options ----- |
|
295 |
||
296 |
SUBPACKAGES("-subpackages", true) { |
|
297 |
@Override |
|
298 |
public void process(Helper helper, String arg) { |
|
299 |
helper.addToList(helper.subPackages, arg); |
|
300 |
} |
|
301 |
}, |
|
302 |
||
303 |
EXCLUDE("-exclude", true) { |
|
304 |
@Override |
|
305 |
public void process(Helper helper, String arg) { |
|
306 |
helper.addToList(helper.excludedPackages, arg); |
|
307 |
} |
|
308 |
}, |
|
309 |
||
310 |
// ----- filtering options ----- |
|
311 |
||
312 |
PACKAGE("-package") { |
|
313 |
@Override |
|
314 |
public void process(Helper helper) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
315 |
helper.setFilter("package"); |
14543 | 316 |
} |
317 |
}, |
|
318 |
||
319 |
PRIVATE("-private") { |
|
320 |
@Override |
|
321 |
public void process(Helper helper) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
322 |
helper.setFilter("private"); |
14543 | 323 |
} |
324 |
}, |
|
325 |
||
326 |
PROTECTED("-protected") { |
|
327 |
@Override |
|
328 |
public void process(Helper helper) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
329 |
helper.setFilter("protected"); |
14543 | 330 |
} |
331 |
}, |
|
332 |
||
333 |
PUBLIC("-public") { |
|
334 |
@Override |
|
335 |
public void process(Helper helper) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
336 |
helper.setFilter("public"); |
14543 | 337 |
} |
338 |
}, |
|
339 |
||
340 |
// ----- output control options ----- |
|
341 |
||
342 |
PROMPT("-prompt") { |
|
343 |
@Override |
|
344 |
public void process(Helper helper) { |
|
345 |
helper.compOpts.put("-prompt", "-prompt"); |
|
346 |
helper.promptOnError = true; |
|
347 |
} |
|
348 |
}, |
|
349 |
||
350 |
QUIET("-quiet") { |
|
351 |
@Override |
|
352 |
public void process(Helper helper) { |
|
353 |
helper.quiet = true; |
|
354 |
} |
|
355 |
}, |
|
356 |
||
357 |
VERBOSE("-verbose") { |
|
358 |
@Override |
|
359 |
public void process(Helper helper) { |
|
360 |
helper.compOpts.put("-verbose", ""); |
|
361 |
} |
|
362 |
}, |
|
363 |
||
364 |
XWERROR("-Xwerror") { |
|
365 |
@Override |
|
366 |
public void process(Helper helper) { |
|
367 |
helper.rejectWarnings = true; |
|
368 |
||
369 |
} |
|
370 |
}, |
|
371 |
||
372 |
// ----- other options ----- |
|
373 |
||
374 |
BREAKITERATOR("-breakiterator") { |
|
375 |
@Override |
|
376 |
public void process(Helper helper) { |
|
377 |
helper.breakiterator = true; |
|
378 |
} |
|
379 |
}, |
|
380 |
||
381 |
LOCALE("-locale", true) { |
|
382 |
@Override |
|
383 |
public void process(Helper helper, String arg) { |
|
384 |
helper.docLocale = arg; |
|
385 |
} |
|
386 |
}, |
|
387 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
388 |
// the doclet consumes this |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
389 |
OVERVIEW("-overview", true) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
390 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
391 |
public void process(Helper helper, String arg) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
392 |
helper.setOverviewpath(arg); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
393 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
394 |
}, |
14543 | 395 |
|
396 |
XCLASSES("-Xclasses") { |
|
397 |
@Override |
|
398 |
public void process(Helper helper) { |
|
399 |
helper.docClasses = true; |
|
400 |
||
401 |
} |
|
402 |
}, |
|
403 |
||
404 |
// ----- help options ----- |
|
405 |
||
406 |
HELP("-help") { |
|
407 |
@Override |
|
408 |
public void process(Helper helper) { |
|
409 |
helper.usage(); |
|
410 |
} |
|
411 |
}, |
|
412 |
||
413 |
X("-X") { |
|
414 |
@Override |
|
415 |
public void process(Helper helper) { |
|
416 |
helper.Xusage(); |
|
417 |
} |
|
418 |
}; |
|
419 |
||
420 |
public final String opt; |
|
421 |
public final boolean hasArg; |
|
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
422 |
public final boolean hasSuffix; // ex: foo:bar or -foo=bar |
14543 | 423 |
|
424 |
ToolOption(String opt) { |
|
425 |
this(opt, false); |
|
426 |
} |
|
427 |
||
428 |
ToolOption(String opt, boolean hasArg) { |
|
429 |
this.opt = opt; |
|
430 |
this.hasArg = hasArg; |
|
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
431 |
char lastChar = opt.charAt(opt.length() - 1); |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
432 |
this.hasSuffix = lastChar == ':' || lastChar == '='; |
14543 | 433 |
} |
434 |
||
435 |
void process(Helper helper, String arg) { } |
|
436 |
||
437 |
void process(Helper helper) { } |
|
438 |
||
439 |
static ToolOption get(String name) { |
|
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
440 |
String oname = name; |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
441 |
if (name.contains(":")) { |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
442 |
oname = name.substring(0, name.indexOf(':') + 1); |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
443 |
} else if (name.contains("=")) { |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
444 |
oname = name.substring(0, name.indexOf('=') + 1); |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
445 |
} |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
446 |
for (ToolOption o : values()) { |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
447 |
if (oname.equals(o.opt)) { |
14543 | 448 |
return o; |
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
449 |
} |
14543 | 450 |
} |
451 |
return null; |
|
452 |
} |
|
453 |
||
454 |
static abstract class Helper { |
|
455 |
/** List of decoded options. */ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
456 |
final List<List<String>> options = new ArrayList<>(); |
14543 | 457 |
|
458 |
/** Selected packages, from -subpackages. */ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
459 |
final List<String> subPackages = new ArrayList<>(); |
14543 | 460 |
|
461 |
/** Excluded packages, from -exclude. */ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
462 |
final List<String> excludedPackages = new ArrayList<>(); |
14543 | 463 |
|
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
464 |
// File manager options |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
465 |
final Map<Option, String> fileManagerOpts = new LinkedHashMap<>(); |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
466 |
|
14543 | 467 |
/** javac options, set by various options. */ |
468 |
Options compOpts; // = Options.instance(context) |
|
469 |
||
470 |
/* Encoding for javac, and files written? set by -encoding. */ |
|
471 |
String encoding = null; |
|
472 |
||
473 |
/** Set by -breakiterator. */ |
|
474 |
boolean breakiterator = false; |
|
475 |
||
476 |
/** Set by -quiet. */ |
|
477 |
boolean quiet = false; |
|
478 |
||
479 |
/** Set by -Xclasses. */ |
|
480 |
boolean docClasses = false; |
|
481 |
||
482 |
/** Set by -Xwerror. */ |
|
483 |
boolean rejectWarnings = false; |
|
484 |
||
485 |
/** Set by -prompt. */ |
|
486 |
boolean promptOnError; |
|
487 |
||
488 |
/** Set by -locale. */ |
|
489 |
String docLocale = ""; |
|
490 |
||
491 |
/** Set by -public, private, -protected, -package. */ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
492 |
String showAccess = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
493 |
String overviewpath; |
14543 | 494 |
|
495 |
abstract void usage(); |
|
496 |
abstract void Xusage(); |
|
497 |
||
498 |
abstract void usageError(String msg, Object... args); |
|
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
499 |
abstract OptionHelper getOptionHelper(); |
14543 | 500 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
501 |
void addToList(List<String> list, String str){ |
14543 | 502 |
StringTokenizer st = new StringTokenizer(str, ":"); |
503 |
String current; |
|
504 |
while(st.hasMoreTokens()){ |
|
505 |
current = st.nextToken(); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
506 |
list.add(current); |
14543 | 507 |
} |
508 |
} |
|
509 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
510 |
void setFilter(String showAccess) { |
14543 | 511 |
if (showAccess != null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
512 |
if (!"public".equals(showAccess) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
513 |
&& !"protected".equals(showAccess) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
514 |
&& !"private".equals(showAccess) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
515 |
&& !"package".equals(showAccess)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
516 |
usageError("main.incompatible.access.flags"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
517 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
518 |
this.showAccess = showAccess; |
14543 | 519 |
} |
520 |
} |
|
521 |
||
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
522 |
void setFileManagerOpt(Option opt, String arg) { |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
523 |
fileManagerOpts.put(opt, arg); |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
524 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
525 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
526 |
private void setOverviewpath(String arg) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
527 |
this.overviewpath = arg; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
528 |
} |
14543 | 529 |
} |
530 |
} |