author | jlahoda |
Fri, 09 Mar 2018 09:42:10 +0100 | |
changeset 49197 | cc2673fa8c20 |
parent 48543 | 7067fe4e054e |
child 50055 | 0b63526d1550 |
permissions | -rw-r--r-- |
14543 | 1 |
/* |
48515 | 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 |
||
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; |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
29 |
import java.util.Arrays; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
30 |
import java.util.EnumMap; |
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
31 |
import java.util.LinkedHashMap; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
32 |
import java.util.List; |
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
33 |
import java.util.Map; |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
34 |
|
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
35 |
import javax.lang.model.element.ElementKind; |
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
36 |
|
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
37 |
import com.sun.tools.javac.main.Option; |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
38 |
import com.sun.tools.javac.main.Option.InvalidValueException; |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
39 |
import com.sun.tools.javac.main.Option.OptionKind; |
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
40 |
import com.sun.tools.javac.main.OptionHelper; |
14543 | 41 |
import com.sun.tools.javac.util.Options; |
42 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
43 |
import static com.sun.tools.javac.main.Option.OptionKind.*; |
41451 | 44 |
import static jdk.javadoc.internal.tool.Main.Result.*; |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
45 |
|
14543 | 46 |
/** |
47 |
* javadoc tool options. |
|
48 |
* |
|
49 |
* <p><b>This is NOT part of any supported API. |
|
50 |
* If you write code that depends on this, you do so at your own risk. |
|
51 |
* This code and its internal interfaces are subject to change or |
|
52 |
* deletion without notice.</b> |
|
53 |
*/ |
|
54 |
public enum ToolOption { |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
55 |
|
14543 | 56 |
// ----- options for underlying compiler ----- |
57 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
58 |
BOOTCLASSPATH("-bootclasspath", STANDARD, true) { |
14543 | 59 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
60 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41990
ffaf4e59538a
8166379: IAE while invoking javadoc with --patch-module
ksrini
parents:
41451
diff
changeset
|
61 |
Option.BOOT_CLASS_PATH.process(helper.getOptionHelper(), primaryName, arg); |
14543 | 62 |
} |
63 |
}, |
|
64 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
65 |
CLASS_PATH("--class-path -classpath -cp", STANDARD, true) { |
14543 | 66 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
67 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41990
ffaf4e59538a
8166379: IAE while invoking javadoc with --patch-module
ksrini
parents:
41451
diff
changeset
|
68 |
Option.CLASS_PATH.process(helper.getOptionHelper(), primaryName, arg); |
14543 | 69 |
} |
70 |
}, |
|
71 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
72 |
EXTDIRS("-extdirs", STANDARD, true) { |
14543 | 73 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
74 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41990
ffaf4e59538a
8166379: IAE while invoking javadoc with --patch-module
ksrini
parents:
41451
diff
changeset
|
75 |
Option.EXTDIRS.process(helper.getOptionHelper(), primaryName, arg); |
14543 | 76 |
} |
77 |
}, |
|
78 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
79 |
SOURCE_PATH("--source-path -sourcepath", STANDARD, true) { |
14543 | 80 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
81 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41990
ffaf4e59538a
8166379: IAE while invoking javadoc with --patch-module
ksrini
parents:
41451
diff
changeset
|
82 |
Option.SOURCE_PATH.process(helper.getOptionHelper(), primaryName, arg); |
14543 | 83 |
} |
84 |
}, |
|
85 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
86 |
MODULE_SOURCE_PATH("--module-source-path", STANDARD, true) { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
87 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
88 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41990
ffaf4e59538a
8166379: IAE while invoking javadoc with --patch-module
ksrini
parents:
41451
diff
changeset
|
89 |
Option.MODULE_SOURCE_PATH.process(helper.getOptionHelper(), primaryName, arg); |
36526 | 90 |
} |
91 |
}, |
|
92 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
93 |
UPGRADE_MODULE_PATH("--upgrade-module-path", STANDARD, true) { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
94 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
95 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41990
ffaf4e59538a
8166379: IAE while invoking javadoc with --patch-module
ksrini
parents:
41451
diff
changeset
|
96 |
Option.UPGRADE_MODULE_PATH.process(helper.getOptionHelper(), primaryName, arg); |
36526 | 97 |
} |
98 |
}, |
|
99 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
100 |
SYSTEM("--system", STANDARD, true) { |
36526 | 101 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
102 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41990
ffaf4e59538a
8166379: IAE while invoking javadoc with --patch-module
ksrini
parents:
41451
diff
changeset
|
103 |
Option.SYSTEM.process(helper.getOptionHelper(), primaryName, arg); |
36526 | 104 |
} |
105 |
}, |
|
106 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
107 |
MODULE_PATH("--module-path -p", STANDARD, true) { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
108 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
109 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41990
ffaf4e59538a
8166379: IAE while invoking javadoc with --patch-module
ksrini
parents:
41451
diff
changeset
|
110 |
Option.MODULE_PATH.process(helper.getOptionHelper(), primaryName, arg); |
36526 | 111 |
} |
112 |
}, |
|
113 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
114 |
ADD_MODULES("--add-modules", STANDARD, true) { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
115 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
116 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
117 |
Option.ADD_MODULES.process(helper.getOptionHelper(), primaryName, arg); |
36526 | 118 |
} |
119 |
}, |
|
120 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
121 |
LIMIT_MODULES("--limit-modules", STANDARD, true) { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
122 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
123 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
124 |
Option.LIMIT_MODULES.process(helper.getOptionHelper(), primaryName, arg); |
36526 | 125 |
} |
126 |
}, |
|
127 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
128 |
MODULE("--module", STANDARD, true) { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
129 |
@Override |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
130 |
public void process(Helper helper, String arg) { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
131 |
helper.addToList(this, ",", arg); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
132 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
133 |
}, |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
134 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
135 |
ENCODING("-encoding", STANDARD, true) { |
14543 | 136 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
137 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41990
ffaf4e59538a
8166379: IAE while invoking javadoc with --patch-module
ksrini
parents:
41451
diff
changeset
|
138 |
Option.ENCODING.process(helper.getOptionHelper(), primaryName, arg); |
14543 | 139 |
} |
140 |
}, |
|
141 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
142 |
RELEASE("--release", STANDARD, true) { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
143 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
144 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
145 |
Option.RELEASE.process(helper.getOptionHelper(), primaryName, arg); |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
146 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
147 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
148 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
149 |
SOURCE("-source", STANDARD, true) { |
14543 | 150 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
151 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
152 |
Option.SOURCE.process(helper.getOptionHelper(), primaryName, arg); |
47867
2053c5489a9e
8187588: Error generating using JDK 9 javadoc against a JDK 8 source repository
ksrini
parents:
47216
diff
changeset
|
153 |
Option.TARGET.process(helper.getOptionHelper(), Option.TARGET.primaryName, arg); |
14543 | 154 |
} |
155 |
}, |
|
156 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
157 |
XMAXERRS("-Xmaxerrs", EXTENDED, true) { |
14543 | 158 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
159 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
160 |
Option.XMAXERRS.process(helper.getOptionHelper(), primaryName, arg); |
14543 | 161 |
} |
162 |
}, |
|
163 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
164 |
XMAXWARNS("-Xmaxwarns", EXTENDED, true) { |
14543 | 165 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
166 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
167 |
Option.XMAXWARNS.process(helper.getOptionHelper(), primaryName, arg); |
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
168 |
} |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
169 |
}, |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
170 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
171 |
ADD_READS("--add-reads", EXTENDED, true) { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
172 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
173 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
174 |
Option.ADD_READS.process(helper.getOptionHelper(), primaryName, arg); |
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
175 |
} |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
176 |
}, |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
177 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
178 |
ADD_EXPORTS("--add-exports", EXTENDED, true) { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
179 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
180 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
181 |
Option.ADD_EXPORTS.process(helper.getOptionHelper(), primaryName, arg); |
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
182 |
} |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
183 |
}, |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
184 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
185 |
PATCH_MODULE("--patch-module", EXTENDED, true) { |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
186 |
@Override |
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
187 |
public void process(Helper helper, String arg) throws InvalidValueException { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
188 |
Option.PATCH_MODULE.process(helper.getOptionHelper(), primaryName, arg); |
40308
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
189 |
} |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
190 |
}, |
274367a99f98
8136930: Simplify use of module-system options by custom launchers
jjg
parents:
37393
diff
changeset
|
191 |
|
48515 | 192 |
ADD_OPENS("--add-opens", HIDDEN, true) { |
193 |
@Override |
|
194 |
public void process(Helper helper, String arg) throws InvalidValueException { |
|
195 |
Option.ADD_OPENS.process(helper.getOptionHelper(), primaryName, arg); |
|
196 |
} |
|
197 |
}, |
|
198 |
||
14543 | 199 |
// ----- doclet options ----- |
200 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
201 |
DOCLET("-doclet", STANDARD, true), // handled in setDocletInvoker |
14543 | 202 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
203 |
DOCLETPATH("-docletpath", STANDARD, true), // handled in setDocletInvoker |
14543 | 204 |
|
205 |
// ----- selection options ----- |
|
206 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
207 |
SUBPACKAGES("-subpackages", STANDARD, true) { |
14543 | 208 |
@Override |
209 |
public void process(Helper helper, String arg) { |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
210 |
helper.addToList(this, ":", arg); |
14543 | 211 |
} |
212 |
}, |
|
213 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
214 |
EXCLUDE("-exclude", STANDARD, true) { |
14543 | 215 |
@Override |
216 |
public void process(Helper helper, String arg) { |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
217 |
helper.addToList(this, ":", arg); |
14543 | 218 |
} |
219 |
}, |
|
220 |
||
221 |
// ----- filtering options ----- |
|
222 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
223 |
PACKAGE("-package", STANDARD) { |
14543 | 224 |
@Override |
41451 | 225 |
public void process(Helper helper) throws OptionException { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
226 |
helper.setSimpleFilter("package"); |
14543 | 227 |
} |
228 |
}, |
|
229 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
230 |
PRIVATE("-private", STANDARD) { |
14543 | 231 |
@Override |
41451 | 232 |
public void process(Helper helper) throws OptionException { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
233 |
helper.setSimpleFilter("private"); |
14543 | 234 |
} |
235 |
}, |
|
236 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
237 |
PROTECTED("-protected", STANDARD) { |
14543 | 238 |
@Override |
41451 | 239 |
public void process(Helper helper) throws OptionException { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
240 |
helper.setSimpleFilter("protected"); |
14543 | 241 |
} |
242 |
}, |
|
243 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
244 |
PUBLIC("-public", STANDARD) { |
14543 | 245 |
@Override |
41451 | 246 |
public void process(Helper helper) throws OptionException { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
247 |
helper.setSimpleFilter("public"); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
248 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
249 |
}, |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
250 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
251 |
SHOW_MEMBERS("--show-members", STANDARD, true) { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
252 |
@Override |
41451 | 253 |
public void process(Helper helper, String arg) throws OptionException { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
254 |
helper.setFilter(this, arg); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
255 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
256 |
}, |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
257 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
258 |
SHOW_TYPES("--show-types", STANDARD, true) { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
259 |
@Override |
41451 | 260 |
public void process(Helper helper, String arg) throws OptionException { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
261 |
helper.setFilter(this, arg); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
262 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
263 |
}, |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
264 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
265 |
SHOW_PACKAGES("--show-packages", STANDARD, true) { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
266 |
@Override |
41451 | 267 |
public void process(Helper helper, String arg) throws OptionException { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
268 |
helper.setShowPackageAccess(SHOW_PACKAGES, arg); |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
269 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
270 |
}, |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
271 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
272 |
SHOW_MODULE_CONTENTS("--show-module-contents", STANDARD, true) { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
273 |
@Override |
41451 | 274 |
public void process(Helper helper, String arg) throws OptionException { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
275 |
helper.setShowModuleContents(SHOW_MODULE_CONTENTS, arg); |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
276 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
277 |
}, |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
278 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
279 |
EXPAND_REQUIRES("--expand-requires", STANDARD, true) { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
280 |
@Override |
41451 | 281 |
public void process(Helper helper, String arg) throws OptionException { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
282 |
helper.setExpandRequires(EXPAND_REQUIRES, arg); |
14543 | 283 |
} |
284 |
}, |
|
285 |
||
286 |
// ----- output control options ----- |
|
287 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
288 |
QUIET("-quiet", STANDARD) { |
14543 | 289 |
@Override |
290 |
public void process(Helper helper) { |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
291 |
helper.jdtoolOpts.put(QUIET, true); |
14543 | 292 |
} |
293 |
}, |
|
294 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
295 |
VERBOSE("-verbose", STANDARD) { |
14543 | 296 |
@Override |
297 |
public void process(Helper helper) { |
|
298 |
helper.compOpts.put("-verbose", ""); |
|
299 |
} |
|
300 |
}, |
|
301 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
302 |
XWERROR("-Xwerror", HIDDEN) { |
14543 | 303 |
@Override |
304 |
public void process(Helper helper) { |
|
305 |
helper.rejectWarnings = true; |
|
306 |
||
307 |
} |
|
308 |
}, |
|
309 |
||
310 |
// ----- other options ----- |
|
311 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
312 |
BREAKITERATOR("-breakiterator", STANDARD) { |
14543 | 313 |
@Override |
314 |
public void process(Helper helper) { |
|
315 |
helper.breakiterator = true; |
|
316 |
} |
|
317 |
}, |
|
318 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
319 |
LOCALE("-locale", STANDARD, true) { |
14543 | 320 |
@Override |
321 |
public void process(Helper helper, String arg) { |
|
322 |
helper.docLocale = arg; |
|
323 |
} |
|
324 |
}, |
|
325 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
326 |
XCLASSES("-Xclasses", HIDDEN) { |
14543 | 327 |
@Override |
328 |
public void process(Helper helper) { |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
329 |
helper.jdtoolOpts.put(XCLASSES, true); |
14543 | 330 |
} |
331 |
}, |
|
332 |
||
41451 | 333 |
DUMPONERROR("--dump-on-error", HIDDEN) { |
334 |
@Override |
|
335 |
public void process(Helper helper) { |
|
336 |
helper.dumpOnError = true; |
|
337 |
} |
|
338 |
}, |
|
339 |
||
44287
829205b133d4
8175219: javadoc should exit when it encounters compilation errors.
ksrini
parents:
43878
diff
changeset
|
340 |
IGNORE_SOURCE_ERRORS("--ignore-source-errors", HIDDEN) { |
829205b133d4
8175219: javadoc should exit when it encounters compilation errors.
ksrini
parents:
43878
diff
changeset
|
341 |
@Override |
829205b133d4
8175219: javadoc should exit when it encounters compilation errors.
ksrini
parents:
43878
diff
changeset
|
342 |
public void process(Helper helper) { |
829205b133d4
8175219: javadoc should exit when it encounters compilation errors.
ksrini
parents:
43878
diff
changeset
|
343 |
helper.jdtoolOpts.put(IGNORE_SOURCE_ERRORS, true); |
829205b133d4
8175219: javadoc should exit when it encounters compilation errors.
ksrini
parents:
43878
diff
changeset
|
344 |
} |
829205b133d4
8175219: javadoc should exit when it encounters compilation errors.
ksrini
parents:
43878
diff
changeset
|
345 |
}, |
829205b133d4
8175219: javadoc should exit when it encounters compilation errors.
ksrini
parents:
43878
diff
changeset
|
346 |
|
14543 | 347 |
// ----- help options ----- |
348 |
||
48543
7067fe4e054e
8189102: All tools should support -?, -h and --help
goetz
parents:
48515
diff
changeset
|
349 |
HELP("--help -help -? -h", STANDARD) { |
14543 | 350 |
@Override |
41451 | 351 |
public void process(Helper helper) throws OptionException { |
352 |
throw new OptionException(OK, helper::usage); |
|
14543 | 353 |
} |
354 |
}, |
|
355 |
||
43875
d0e60aa1f18b
8175047: javadoc should support --help-extra as a synonym for -X
jjg
parents:
43772
diff
changeset
|
356 |
HELP_EXTRA("--help-extra -X", STANDARD) { |
14543 | 357 |
@Override |
41451 | 358 |
public void process(Helper helper) throws OptionException { |
359 |
throw new OptionException(OK, helper::Xusage); |
|
14543 | 360 |
} |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
361 |
}, |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
362 |
|
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
363 |
// This option exists only for the purpose of documenting itself. |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
364 |
// It's actually implemented by the launcher. |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
365 |
J("-J", STANDARD, true) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
366 |
@Override |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
367 |
public void process(Helper helper) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
368 |
throw new AssertionError("the -J flag should be caught by the launcher."); |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
369 |
} |
45912
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
370 |
}, |
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
371 |
|
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
372 |
VERSION("--version", STANDARD) { |
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
373 |
@Override |
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
374 |
public void process(Helper helper) throws OptionException { |
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
375 |
throw new OptionException(OK, helper::version); |
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
376 |
} |
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
377 |
}, |
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
378 |
|
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
379 |
FULLVERSION("--full-version", HIDDEN) { |
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
380 |
@Override |
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
381 |
public void process(Helper helper) throws OptionException { |
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
382 |
throw new OptionException(OK, helper::fullVersion); |
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
383 |
} |
14543 | 384 |
}; |
385 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
386 |
public final String primaryName; |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
387 |
public final List<String> names; |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
388 |
public final OptionKind kind; |
14543 | 389 |
public final boolean hasArg; |
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
390 |
public final boolean hasSuffix; // ex: foo:bar or -foo=bar |
14543 | 391 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
392 |
ToolOption(String opt, OptionKind kind) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
393 |
this(opt, kind, false); |
14543 | 394 |
} |
395 |
||
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
396 |
ToolOption(String names, OptionKind kind, boolean hasArg) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
397 |
this.names = Arrays.asList(names.split("\\s+")); |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
398 |
this.primaryName = this.names.get(0); |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
399 |
this.kind = kind; |
14543 | 400 |
this.hasArg = hasArg; |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
401 |
char lastChar = names.charAt(names.length() - 1); |
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
402 |
this.hasSuffix = lastChar == ':' || lastChar == '='; |
14543 | 403 |
} |
404 |
||
42260
2b4da2bf6660
8169676: boolean result of Option.process is often ignored
jjg
parents:
41990
diff
changeset
|
405 |
void process(Helper helper, String arg) throws OptionException, Option.InvalidValueException { } |
14543 | 406 |
|
41451 | 407 |
void process(Helper helper) throws OptionException { } |
14543 | 408 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
409 |
List<String> getNames() { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
410 |
return names; |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
411 |
} |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
412 |
|
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
413 |
String getParameters(Messager messager) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
414 |
return (hasArg || primaryName.endsWith(":")) |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
415 |
? messager.getText(getKey(primaryName, ".arg")) |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
416 |
: null; |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
417 |
} |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
418 |
|
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
419 |
String getDescription(Messager messager) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
420 |
return messager.getText(getKey(primaryName, ".desc")); |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
421 |
} |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
422 |
|
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
423 |
private String getKey(String optionName, String suffix) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
424 |
return "main.opt." |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
425 |
+ optionName |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
426 |
.replaceAll("^-*", "") // remove leading '-' |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
427 |
.replaceAll("[^A-Za-z0-9]+$", "") // remove trailing non-alphanumeric |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
428 |
.replaceAll("[^A-Za-z0-9]", ".") // replace internal non-alphanumeric |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
429 |
+ suffix; |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
430 |
} |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
431 |
|
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
432 |
|
14543 | 433 |
static ToolOption get(String name) { |
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
434 |
String oname = name; |
43878
4b0a3bda61d3
8175048: javadoc does not decode options containing '=' and ':' correctly
jjg
parents:
43875
diff
changeset
|
435 |
if (name.startsWith("--") && name.contains("=")) { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
436 |
oname = name.substring(0, name.indexOf('=')); |
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
437 |
} |
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
438 |
for (ToolOption o : values()) { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
439 |
for (String n : o.names) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
440 |
if (oname.equals(n)) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
441 |
return o; |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40762
diff
changeset
|
442 |
} |
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
443 |
} |
14543 | 444 |
} |
445 |
return null; |
|
446 |
} |
|
447 |
||
448 |
static abstract class Helper { |
|
449 |
||
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
450 |
// File manager options |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
451 |
final Map<Option, String> fileManagerOpts = new LinkedHashMap<>(); |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
452 |
|
14543 | 453 |
/** javac options, set by various options. */ |
454 |
Options compOpts; // = Options.instance(context) |
|
455 |
||
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
456 |
/** Javadoc tool options */ |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
457 |
final Map<ToolOption, Object> jdtoolOpts = new EnumMap<>(ToolOption.class); |
14543 | 458 |
|
41451 | 459 |
/** dump stack traces for debugging etc.*/ |
460 |
boolean dumpOnError = false; |
|
461 |
||
14543 | 462 |
/** Set by -breakiterator. */ |
463 |
boolean breakiterator = false; |
|
464 |
||
465 |
/** Set by -Xwerror. */ |
|
466 |
boolean rejectWarnings = false; |
|
467 |
||
468 |
/** Set by -prompt. */ |
|
469 |
boolean promptOnError; |
|
470 |
||
471 |
/** Set by -locale. */ |
|
472 |
String docLocale = ""; |
|
473 |
||
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
474 |
Helper() { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
475 |
populateDefaultAccessMap(); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
476 |
} |
14543 | 477 |
|
478 |
abstract void usage(); |
|
479 |
abstract void Xusage(); |
|
480 |
||
45912
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
481 |
abstract void version(); |
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
482 |
abstract void fullVersion(); |
865870b7fe9b
8177048: javadoc should support -version and/or --version
pmuthuswamy
parents:
45742
diff
changeset
|
483 |
|
41451 | 484 |
abstract String getLocalizedMessage(String msg, Object... args); |
485 |
||
37393
a9ba8bd6697b
8152818: Javadoc must support module options supported by javac.
ksrini
parents:
36526
diff
changeset
|
486 |
abstract OptionHelper getOptionHelper(); |
14543 | 487 |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
488 |
@SuppressWarnings("unchecked") |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
489 |
void addToList(ToolOption opt, String delimiter, String str) { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
490 |
List<String> list = (List<String>) jdtoolOpts.computeIfAbsent(opt, v -> new ArrayList<>()); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
491 |
list.addAll(Arrays.asList(str.split(delimiter))); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
492 |
jdtoolOpts.put(opt, list); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
493 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
494 |
|
41451 | 495 |
void setExpandRequires(ToolOption opt, String arg) throws OptionException { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
496 |
switch (arg) { |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41990
diff
changeset
|
497 |
case "transitive": |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
498 |
jdtoolOpts.put(opt, AccessKind.PUBLIC); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
499 |
break; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
500 |
case "all": |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
501 |
jdtoolOpts.put(opt, AccessKind.PRIVATE); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
502 |
break; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
503 |
default: |
41451 | 504 |
String text = getLocalizedMessage("main.illegal_option_value", arg); |
505 |
throw new IllegalOptionValue(this::usage, text); |
|
14543 | 506 |
} |
507 |
} |
|
508 |
||
41451 | 509 |
void setShowModuleContents(ToolOption opt, String arg) throws OptionException { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
510 |
switch (arg) { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
511 |
case "api": |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
512 |
jdtoolOpts.put(opt, AccessKind.PUBLIC); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
513 |
break; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
514 |
case "all": |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
515 |
jdtoolOpts.put(opt, AccessKind.PRIVATE); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
516 |
break; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
517 |
default: |
41451 | 518 |
String text = getLocalizedMessage("main.illegal_option_value", arg); |
519 |
throw new IllegalOptionValue(this::usage, text); |
|
14543 | 520 |
} |
521 |
} |
|
522 |
||
41451 | 523 |
void setShowPackageAccess(ToolOption opt, String arg) throws OptionException { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
524 |
switch (arg) { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
525 |
case "exported": |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
526 |
jdtoolOpts.put(opt, AccessKind.PUBLIC); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
527 |
break; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
528 |
case "all": |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
529 |
jdtoolOpts.put(opt, AccessKind.PRIVATE); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
530 |
break; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
531 |
default: |
41451 | 532 |
String text = getLocalizedMessage("main.illegal_option_value", arg); |
533 |
throw new IllegalOptionValue(this::usage, text); |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
534 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
535 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
536 |
|
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
537 |
|
41451 | 538 |
void setFilter(ToolOption opt, String arg) throws OptionException { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
539 |
jdtoolOpts.put(opt, getAccessValue(arg)); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
540 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
541 |
|
41451 | 542 |
void setSimpleFilter(String arg) throws OptionException { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
543 |
handleSimpleOption(arg); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
544 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
545 |
|
24897
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
546 |
void setFileManagerOpt(Option opt, String arg) { |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
547 |
fileManagerOpts.put(opt, arg); |
655b72d7b96e
7026941: 199: path options ignored when reusing filemanager across tasks
jjg
parents:
22163
diff
changeset
|
548 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
549 |
|
41451 | 550 |
void handleSimpleOption(String arg) throws OptionException { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
551 |
populateSimpleAccessMap(getAccessValue(arg)); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
552 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
553 |
|
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
554 |
/* |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
555 |
* This method handles both the simple options -package, |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
556 |
* -private, so on, in addition to the new ones such as |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
557 |
* --show-types:public and so on. |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
558 |
*/ |
41451 | 559 |
private AccessKind getAccessValue(String arg) throws OptionException { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
560 |
int colon = arg.indexOf(':'); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
561 |
String value = (colon > 0) |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
562 |
? arg.substring(colon + 1) |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
563 |
: arg; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
564 |
switch (value) { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
565 |
case "public": |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
566 |
return AccessKind.PUBLIC; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
567 |
case "protected": |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
568 |
return AccessKind.PROTECTED; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
569 |
case "package": |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
570 |
return AccessKind.PACKAGE; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
571 |
case "private": |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
572 |
return AccessKind.PRIVATE; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
573 |
default: |
41451 | 574 |
String text = getLocalizedMessage("main.illegal_option_value", value); |
575 |
throw new IllegalOptionValue(this::usage, text); |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
576 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
577 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
578 |
|
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
579 |
/* |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
580 |
* Sets the entire kind map to PROTECTED this is the default. |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
581 |
*/ |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
582 |
private void populateDefaultAccessMap() { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
583 |
populateSimpleAccessMap(AccessKind.PROTECTED); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
584 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
585 |
|
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
586 |
/* |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
587 |
* This sets access to all the allowed kinds in the |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
588 |
* access map. |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
589 |
*/ |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
590 |
void populateSimpleAccessMap(AccessKind accessValue) { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
591 |
for (ElementKind kind : ElementsTable.ModifierFilter.ALLOWED_KINDS) { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
592 |
switch (kind) { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
593 |
case METHOD: |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
594 |
jdtoolOpts.put(SHOW_MEMBERS, accessValue); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
595 |
break; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
596 |
case CLASS: |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
597 |
jdtoolOpts.put(SHOW_TYPES, accessValue); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
598 |
break; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
599 |
case PACKAGE: |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
600 |
jdtoolOpts.put(SHOW_PACKAGES, accessValue); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
601 |
break; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
602 |
case MODULE: |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
603 |
jdtoolOpts.put(SHOW_MODULE_CONTENTS, accessValue); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
604 |
break; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
605 |
default: |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
606 |
throw new AssertionError("unknown element kind:" + kind); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
607 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40308
diff
changeset
|
608 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
31936
diff
changeset
|
609 |
} |
14543 | 610 |
} |
611 |
} |