author | ksrini |
Mon, 05 Jun 2017 13:45:34 -0700 | |
changeset 45417 | f7479ee8de69 |
parent 45157 | langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java@f5f796453339 |
child 45420 | 036dbf8b3817 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
43872
b5ce3bc28931
8174839: javadoc crashes with a method which does not override a super.
ksrini
parents:
43261
diff
changeset
|
2 |
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
10 | 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 |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 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 |
* |
|
5520 | 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. |
|
10 | 24 |
*/ |
25 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
26 |
package jdk.javadoc.internal.doclets.toolkit; |
10 | 27 |
|
14258 | 28 |
import java.io.*; |
44460 | 29 |
import java.lang.ref.*; |
14258 | 30 |
import java.util.*; |
35419 | 31 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
32 |
import javax.lang.model.element.Element; |
36526 | 33 |
import javax.lang.model.element.ModuleElement; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
34 |
import javax.lang.model.element.PackageElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
35 |
import javax.lang.model.element.TypeElement; |
42277 | 36 |
import javax.lang.model.util.SimpleElementVisitor9; |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19937
diff
changeset
|
37 |
import javax.tools.JavaFileManager; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
38 |
import javax.tools.JavaFileObject; |
14258 | 39 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
40 |
import com.sun.source.util.DocTreePath; |
42277 | 41 |
import com.sun.tools.javac.util.DefinedBy; |
42 |
import com.sun.tools.javac.util.DefinedBy.Api; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
43 |
import jdk.javadoc.doclet.Doclet; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
44 |
import jdk.javadoc.doclet.DocletEnvironment; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
45 |
import jdk.javadoc.doclet.Reporter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
46 |
import jdk.javadoc.internal.doclets.toolkit.builders.BuilderFactory; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
47 |
import jdk.javadoc.internal.doclets.toolkit.taglets.TagletManager; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
48 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFile; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
49 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFileFactory; |
40587 | 50 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
51 |
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
52 |
import jdk.javadoc.internal.doclets.toolkit.util.Extern; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
53 |
import jdk.javadoc.internal.doclets.toolkit.util.Group; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
54 |
import jdk.javadoc.internal.doclets.toolkit.util.MetaKeywords; |
40587 | 55 |
import jdk.javadoc.internal.doclets.toolkit.util.SimpleDocletException; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
56 |
import jdk.javadoc.internal.doclets.toolkit.util.TypeElementCatalog; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
57 |
import jdk.javadoc.internal.doclets.toolkit.util.Utils; |
44460 | 58 |
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
59 |
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap.GetterSetter; |
44460 | 60 |
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap.Kind; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
61 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
62 |
import static javax.tools.Diagnostic.Kind.*; |
10 | 63 |
|
64 |
/** |
|
65 |
* Configure the output based on the options. Doclets should sub-class |
|
45417 | 66 |
* BaseConfiguration, to configure and add their own options. This class contains |
10 | 67 |
* all user options which are supported by the 1.1 doclet and the standard |
68 |
* doclet. |
|
69 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
70 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
71 |
* If you write code that depends on this, you do so at your own risk. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
72 |
* This code and its internal interfaces are subject to change or |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
73 |
* deletion without notice.</b> |
10 | 74 |
* |
75 |
* @author Robert Field. |
|
76 |
* @author Atul Dambalkar. |
|
77 |
* @author Jamie Ho |
|
78 |
*/ |
|
45417 | 79 |
public abstract class BaseConfiguration { |
44388 | 80 |
/** |
81 |
* The doclet that created this configuration. |
|
82 |
*/ |
|
83 |
public final Doclet doclet; |
|
10 | 84 |
|
85 |
/** |
|
86 |
* The factory for builders. |
|
87 |
*/ |
|
88 |
protected BuilderFactory builderFactory; |
|
89 |
||
90 |
/** |
|
91 |
* The taglet manager. |
|
92 |
*/ |
|
93 |
public TagletManager tagletManager; |
|
94 |
||
95 |
/** |
|
96 |
* The path to the builder XML input file. |
|
97 |
*/ |
|
98 |
public String builderXMLPath; |
|
99 |
||
100 |
/** |
|
101 |
* The default path to the builder XML. |
|
102 |
*/ |
|
40587 | 103 |
public static final String DEFAULT_BUILDER_XML = "resources/doclet.xml"; |
10 | 104 |
|
105 |
/** |
|
106 |
* The path to Taglets |
|
107 |
*/ |
|
42277 | 108 |
public String tagletpath = null; |
10 | 109 |
|
110 |
/** |
|
111 |
* This is true if option "-serialwarn" is used. Defualt value is false to |
|
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14544
diff
changeset
|
112 |
* suppress excessive warnings about serial tag. |
10 | 113 |
*/ |
114 |
public boolean serialwarn = false; |
|
115 |
||
116 |
/** |
|
117 |
* The specified amount of space between tab stops. |
|
118 |
*/ |
|
14542 | 119 |
public int sourcetab; |
120 |
||
121 |
public String tabSpaces; |
|
10 | 122 |
|
123 |
/** |
|
124 |
* True if we should generate browsable sources. |
|
125 |
*/ |
|
126 |
public boolean linksource = false; |
|
127 |
||
128 |
/** |
|
129 |
* True if command line option "-nosince" is used. Default value is |
|
130 |
* false. |
|
131 |
*/ |
|
132 |
public boolean nosince = false; |
|
133 |
||
134 |
/** |
|
135 |
* True if we should recursively copy the doc-file subdirectories |
|
136 |
*/ |
|
137 |
public boolean copydocfilesubdirs = false; |
|
138 |
||
139 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
140 |
* Maintain backward compatibility with previous javadoc version |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
141 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
142 |
public boolean backwardCompatibility = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
143 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
144 |
/** |
10 | 145 |
* The META charset tag used for cross-platform viewing. |
146 |
*/ |
|
147 |
public String charset = ""; |
|
148 |
||
149 |
/** |
|
150 |
* True if user wants to add member names as meta keywords. |
|
151 |
* Set to false because meta keywords are ignored in general |
|
152 |
* by most Internet search engines. |
|
153 |
*/ |
|
154 |
public boolean keywords = false; |
|
155 |
||
156 |
/** |
|
1475 | 157 |
* The meta tag keywords instance. |
10 | 158 |
*/ |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
159 |
public final MetaKeywords metakeywords; |
10 | 160 |
|
161 |
/** |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
162 |
* The set of doc-file subdirectories to exclude |
10 | 163 |
*/ |
868 | 164 |
protected Set<String> excludedDocFileDirs; |
10 | 165 |
|
166 |
/** |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
167 |
* The set of qualifiers to exclude |
10 | 168 |
*/ |
868 | 169 |
protected Set<String> excludedQualifiers; |
10 | 170 |
|
171 |
/** |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
172 |
* The doclet environment. |
10 | 173 |
*/ |
39364
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
39181
diff
changeset
|
174 |
public DocletEnvironment docEnv; |
10 | 175 |
|
176 |
/** |
|
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
177 |
* An utility class for commonly used helpers |
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
178 |
*/ |
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
179 |
public Utils utils; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
180 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
181 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
182 |
* All the temporary accessors to javac internals. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
183 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
184 |
public WorkArounds workArounds; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
185 |
|
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
186 |
/** |
10 | 187 |
* Destination directory name, in which doclet will generate the entire |
188 |
* documentation. Default is current directory. |
|
189 |
*/ |
|
190 |
public String destDirName = ""; |
|
191 |
||
192 |
/** |
|
193 |
* Destination directory name, in which doclet will copy the doc-files to. |
|
194 |
*/ |
|
195 |
public String docFileDestDirName = ""; |
|
196 |
||
197 |
/** |
|
198 |
* Encoding for this document. Default is default encoding for this |
|
199 |
* platform. |
|
200 |
*/ |
|
201 |
public String docencoding = null; |
|
202 |
||
203 |
/** |
|
204 |
* True if user wants to suppress descriptions and tags. |
|
205 |
*/ |
|
206 |
public boolean nocomment = false; |
|
207 |
||
208 |
/** |
|
209 |
* Encoding for this document. Default is default encoding for this |
|
210 |
* platform. |
|
211 |
*/ |
|
212 |
public String encoding = null; |
|
213 |
||
214 |
/** |
|
215 |
* Generate author specific information for all the classes if @author |
|
216 |
* tag is used in the doc comment and if -author option is used. |
|
217 |
* <code>showauthor</code> is set to true if -author option is used. |
|
218 |
* Default is don't show author information. |
|
219 |
*/ |
|
220 |
public boolean showauthor = false; |
|
221 |
||
222 |
/** |
|
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
223 |
* Generate documentation for JavaFX getters and setters automatically |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
224 |
* by copying it from the appropriate property definition. |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
225 |
*/ |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
226 |
public boolean javafx = false; |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
227 |
|
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
228 |
/** |
10 | 229 |
* Generate version specific information for the all the classes |
230 |
* if @version tag is used in the doc comment and if -version option is |
|
231 |
* used. <code>showversion</code> is set to true if -version option is |
|
232 |
* used.Default is don't show version information. |
|
233 |
*/ |
|
234 |
public boolean showversion = false; |
|
235 |
||
236 |
/** |
|
43261 | 237 |
* Allow JavaScript in doc comments. |
238 |
*/ |
|
239 |
private boolean allowScriptInComments = false; |
|
240 |
||
241 |
/** |
|
36526 | 242 |
* Sourcepath from where to read the source files. Default is classpath. |
243 |
* |
|
244 |
*/ |
|
245 |
public String sourcepath = ""; |
|
246 |
||
247 |
/** |
|
248 |
* Generate modules documentation if more than one module is present. |
|
249 |
*/ |
|
250 |
public boolean showModules = false; |
|
251 |
||
252 |
/** |
|
10 | 253 |
* Don't generate deprecated API information at all, if -nodeprecated |
254 |
* option is used. <code>nodepracted</code> is set to true if |
|
255 |
* -nodeprecated option is used. Default is generate deprected API |
|
256 |
* information. |
|
257 |
*/ |
|
258 |
public boolean nodeprecated = false; |
|
259 |
||
260 |
/** |
|
261 |
* The catalog of classes specified on the command-line |
|
262 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
263 |
public TypeElementCatalog typeElementCatalog; |
10 | 264 |
|
265 |
/** |
|
266 |
* True if user wants to suppress time stamp in output. |
|
267 |
* Default is false. |
|
268 |
*/ |
|
269 |
public boolean notimestamp= false; |
|
270 |
||
271 |
/** |
|
1475 | 272 |
* The package grouping instance. |
10 | 273 |
*/ |
1475 | 274 |
public final Group group = new Group(this); |
10 | 275 |
|
276 |
/** |
|
1475 | 277 |
* The tracker of external package links. |
10 | 278 |
*/ |
279 |
public final Extern extern = new Extern(this); |
|
280 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
281 |
public Reporter reporter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
282 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
283 |
public Locale locale; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
284 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
285 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
286 |
* Suppress all messages |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
287 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
288 |
public boolean quiet = false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
289 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
290 |
private String urlForLink; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
291 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
292 |
private String pkglistUrlForLink; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
293 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
294 |
private String urlForLinkOffline; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
295 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
296 |
private String pkglistUrlForLinkOffline; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
297 |
|
41451 | 298 |
public boolean dumpOnError = false; |
299 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
300 |
private List<GroupContainer> groups; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
301 |
|
44460 | 302 |
private final Map<TypeElement, EnumMap<Kind, Reference<VisibleMemberMap>>> typeElementMemberCache; |
303 |
||
40303 | 304 |
public abstract Messages getMessages(); |
305 |
public abstract Resources getResources(); |
|
306 |
||
10 | 307 |
/** |
308 |
* Return the build date for the doclet. |
|
40587 | 309 |
* |
310 |
* @return the build date |
|
10 | 311 |
*/ |
312 |
public abstract String getDocletSpecificBuildDate(); |
|
313 |
||
314 |
/** |
|
40587 | 315 |
* This method should be defined in all those doclets (configurations), |
45417 | 316 |
* which want to derive themselves from this BaseConfiguration. This method |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
317 |
* can be used to finish up the options setup. |
40587 | 318 |
* |
319 |
* @return true if successful and false otherwise |
|
10 | 320 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
321 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
322 |
public abstract boolean finishOptionSettings(); |
10 | 323 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
324 |
public CommentUtils cmtUtils; |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
325 |
|
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
326 |
/** |
41633
eec0f5b0465f
8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents:
41451
diff
changeset
|
327 |
* A sorted set of included packages. |
10 | 328 |
*/ |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
329 |
public SortedSet<PackageElement> packages = null; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
330 |
|
42277 | 331 |
public OverviewElement overviewElement; |
10 | 332 |
|
35419 | 333 |
// The following three fields provide caches for use by all instances of VisibleMemberMap. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
334 |
public final Map<TypeElement, List<Element>> propertiesCache = new HashMap<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
335 |
public final Map<Element, Element> classPropertiesMap = new HashMap<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
336 |
public final Map<Element, GetterSetter> getterSetterMap = new HashMap<>(); |
35419 | 337 |
|
35420 | 338 |
public DocFileFactory docFileFactory; |
339 |
||
10 | 340 |
/** |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
341 |
* A sorted map, giving the (specified|included|other) packages for each module. |
36526 | 342 |
*/ |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
343 |
public SortedMap<ModuleElement, Set<PackageElement>> modulePackages; |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
344 |
|
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
345 |
/** |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
346 |
* The list of known modules, that should be documented. |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
347 |
*/ |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
348 |
public SortedSet<ModuleElement> modules; |
36526 | 349 |
|
40303 | 350 |
protected static final String sharedResourceBundleName = |
351 |
"jdk.javadoc.internal.doclets.toolkit.resources.doclets"; |
|
36526 | 352 |
/** |
42277 | 353 |
* Constructs the configurations needed by the doclet. |
44388 | 354 |
* @param doclet the doclet that created this configuration |
10 | 355 |
*/ |
45417 | 356 |
public BaseConfiguration(Doclet doclet) { |
44388 | 357 |
this.doclet = doclet; |
22163 | 358 |
excludedDocFileDirs = new HashSet<>(); |
359 |
excludedQualifiers = new HashSet<>(); |
|
14542 | 360 |
setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH); |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
361 |
metakeywords = new MetaKeywords(this); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
362 |
groups = new ArrayList<>(0); |
44460 | 363 |
typeElementMemberCache = new HashMap<>(); |
42277 | 364 |
} |
365 |
||
366 |
private boolean initialized = false; |
|
367 |
||
368 |
protected void initConfiguration(DocletEnvironment docEnv) { |
|
369 |
if (initialized) { |
|
370 |
throw new IllegalStateException("configuration previously initialized"); |
|
371 |
} |
|
372 |
initialized = true; |
|
373 |
this.docEnv = docEnv; |
|
39364
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
39181
diff
changeset
|
374 |
overviewElement = new OverviewElement(docEnv); |
42277 | 375 |
Splitter specifiedSplitter = new Splitter(docEnv, false); |
376 |
specifiedModuleElements = Collections.unmodifiableSet(specifiedSplitter.mset); |
|
377 |
specifiedPackageElements = Collections.unmodifiableSet(specifiedSplitter.pset); |
|
378 |
specifiedTypeElements = Collections.unmodifiableSet(specifiedSplitter.tset); |
|
379 |
||
380 |
Splitter includedSplitter = new Splitter(docEnv, true); |
|
381 |
includedModuleElements = Collections.unmodifiableSet(includedSplitter.mset); |
|
382 |
includedPackageElements = Collections.unmodifiableSet(includedSplitter.pset); |
|
383 |
includedTypeElements = Collections.unmodifiableSet(includedSplitter.tset); |
|
10 | 384 |
} |
385 |
||
386 |
/** |
|
387 |
* Return the builder factory for this doclet. |
|
388 |
* |
|
389 |
* @return the builder factory for this doclet. |
|
390 |
*/ |
|
391 |
public BuilderFactory getBuilderFactory() { |
|
392 |
if (builderFactory == null) { |
|
393 |
builderFactory = new BuilderFactory(this); |
|
394 |
} |
|
395 |
return builderFactory; |
|
396 |
} |
|
397 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
398 |
public Reporter getReporter() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
399 |
return this.reporter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
400 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
401 |
|
42277 | 402 |
private Set<ModuleElement> specifiedModuleElements; |
403 |
public Set<ModuleElement> getSpecifiedModuleElements() { |
|
404 |
return specifiedModuleElements; |
|
405 |
} |
|
406 |
||
407 |
private Set<PackageElement> specifiedPackageElements; |
|
408 |
public Set<PackageElement> getSpecifiedPackageElements() { |
|
409 |
return specifiedPackageElements; |
|
410 |
} |
|
411 |
||
412 |
private Set<TypeElement> specifiedTypeElements; |
|
413 |
public Set<TypeElement> getSpecifiedTypeElements() { |
|
414 |
return specifiedTypeElements; |
|
415 |
} |
|
416 |
||
417 |
private Set<ModuleElement> includedModuleElements; |
|
418 |
public Set<ModuleElement> getIncludedModuleElements() { |
|
419 |
return includedModuleElements; |
|
420 |
} |
|
421 |
||
422 |
private Set<PackageElement> includedPackageElements; |
|
423 |
public Set<PackageElement> getIncludedPackageElements() { |
|
424 |
return includedPackageElements; |
|
425 |
} |
|
426 |
||
427 |
private Set<TypeElement> includedTypeElements; |
|
428 |
public Set<TypeElement> getIncludedTypeElements() { |
|
429 |
return includedTypeElements; |
|
430 |
} |
|
431 |
||
36526 | 432 |
private void initModules() { |
433 |
// Build the modules structure used by the doclet |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
434 |
modules = new TreeSet<>(utils.makeModuleComparator()); |
42277 | 435 |
modules.addAll(getSpecifiedModuleElements()); |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
436 |
|
36526 | 437 |
modulePackages = new TreeMap<>(utils.makeModuleComparator()); |
438 |
for (PackageElement p: packages) { |
|
39364
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
39181
diff
changeset
|
439 |
ModuleElement mdle = docEnv.getElementUtils().getModuleOf(p); |
36526 | 440 |
if (mdle != null && !mdle.isUnnamed()) { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
441 |
Set<PackageElement> s = modulePackages |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
442 |
.computeIfAbsent(mdle, m -> new TreeSet<>(utils.makePackageComparator())); |
36526 | 443 |
s.add(p); |
444 |
} |
|
445 |
} |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
446 |
|
42277 | 447 |
for (PackageElement p: getIncludedPackageElements()) { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
448 |
ModuleElement mdle = docEnv.getElementUtils().getModuleOf(p); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
449 |
if (mdle != null && !mdle.isUnnamed()) { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
450 |
Set<PackageElement> s = modulePackages |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
451 |
.computeIfAbsent(mdle, m -> new TreeSet<>(utils.makePackageComparator())); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
452 |
s.add(p); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
453 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
454 |
} |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
455 |
|
44293
2f47b2c16612
8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents:
43872
diff
changeset
|
456 |
// add entries for modules which may not have exported packages |
2f47b2c16612
8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents:
43872
diff
changeset
|
457 |
modules.forEach((ModuleElement mdle) -> { |
2f47b2c16612
8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents:
43872
diff
changeset
|
458 |
modulePackages.computeIfAbsent(mdle, m -> Collections.emptySet()); |
2f47b2c16612
8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents:
43872
diff
changeset
|
459 |
}); |
2f47b2c16612
8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents:
43872
diff
changeset
|
460 |
|
37943
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
37848
diff
changeset
|
461 |
modules.addAll(modulePackages.keySet()); |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
462 |
showModules = !modules.isEmpty(); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
463 |
for (Set<PackageElement> pkgs : modulePackages.values()) { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
464 |
packages.addAll(pkgs); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40314
diff
changeset
|
465 |
} |
36526 | 466 |
} |
467 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
468 |
private void initPackages() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
469 |
packages = new TreeSet<>(utils.makePackageComparator()); |
41633
eec0f5b0465f
8167383: Javadoc does not handle packages correctly when used with module option.
ksrini
parents:
41451
diff
changeset
|
470 |
// add all the included packages |
42277 | 471 |
packages.addAll(includedPackageElements); |
10 | 472 |
} |
473 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
474 |
public Set<Doclet.Option> getSupportedOptions() { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
475 |
Resources resources = getResources(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
476 |
Doclet.Option[] options = { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
477 |
new Option(resources, "-author") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
478 |
@Override |
42277 | 479 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
480 |
showauthor = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
481 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
482 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
483 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
484 |
new Option(resources, "-d", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
485 |
@Override |
42277 | 486 |
public boolean process(String opt, List<String> args) { |
487 |
destDirName = addTrailingFileSep(args.get(0)); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
488 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
489 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
490 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
491 |
new Option(resources, "-docencoding", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
492 |
@Override |
42277 | 493 |
public boolean process(String opt, List<String> args) { |
494 |
docencoding = args.get(0); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
495 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
496 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
497 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
498 |
new Option(resources, "-docfilessubdirs") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
499 |
@Override |
42277 | 500 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
501 |
copydocfilesubdirs = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
502 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
503 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
504 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
505 |
new Hidden(resources, "-encoding", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
506 |
@Override |
42277 | 507 |
public boolean process(String opt, List<String> args) { |
508 |
encoding = args.get(0); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
509 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
510 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
511 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
512 |
new Option(resources, "-excludedocfilessubdir", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
513 |
@Override |
42277 | 514 |
public boolean process(String opt, List<String> args) { |
515 |
addToSet(excludedDocFileDirs, args.get(0)); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
516 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
517 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
518 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
519 |
new Option(resources, "-group", 2) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
520 |
@Override |
42277 | 521 |
public boolean process(String opt, List<String> args) { |
522 |
groups.add(new GroupContainer(args.get(0), args.get(1))); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
523 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
524 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
525 |
}, |
44815
2a0f6c7033bd
8178830: standard doclet: -javafx option should be unhidden
ksrini
parents:
44460
diff
changeset
|
526 |
new Option(resources, "--javafx -javafx") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
527 |
@Override |
42277 | 528 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
529 |
javafx = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
530 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
531 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
532 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
533 |
new Option(resources, "-keywords") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
534 |
@Override |
42277 | 535 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
536 |
keywords = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
537 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
538 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
539 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
540 |
new Option(resources, "-link", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
541 |
@Override |
42277 | 542 |
public boolean process(String opt, List<String> args) { |
543 |
urlForLink = args.get(0); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
544 |
pkglistUrlForLink = urlForLink; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
545 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
546 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
547 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
548 |
new Option(resources, "-linksource") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
549 |
@Override |
42277 | 550 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
551 |
linksource = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
552 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
553 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
554 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
555 |
new Option(resources, "-linkoffline", 2) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
556 |
@Override |
42277 | 557 |
public boolean process(String opt, List<String> args) { |
558 |
urlForLinkOffline = args.get(0); |
|
559 |
pkglistUrlForLinkOffline = args.get(1); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
560 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
561 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
562 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
563 |
new Option(resources, "-nocomment") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
564 |
@Override |
42277 | 565 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
566 |
nocomment = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
567 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
568 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
569 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
570 |
new Option(resources, "-nodeprecated") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
571 |
@Override |
42277 | 572 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
573 |
nodeprecated = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
574 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
575 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
576 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
577 |
new Option(resources, "-nosince") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
578 |
@Override |
42277 | 579 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
580 |
nosince = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
581 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
582 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
583 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
584 |
new Option(resources, "-notimestamp") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
585 |
@Override |
42277 | 586 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
587 |
notimestamp = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
588 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
589 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
590 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
591 |
new Option(resources, "-noqualifier", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
592 |
@Override |
42277 | 593 |
public boolean process(String opt, List<String> args) { |
594 |
addToSet(excludedQualifiers, args.get(0)); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
595 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
596 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
597 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
598 |
new Hidden(resources, "-quiet") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
599 |
@Override |
42277 | 600 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
601 |
quiet = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
602 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
603 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
604 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
605 |
new Option(resources, "-serialwarn") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
606 |
@Override |
42277 | 607 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
608 |
serialwarn = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
609 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
610 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
611 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
612 |
new Option(resources, "-sourcetab", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
613 |
@Override |
42277 | 614 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
615 |
linksource = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
616 |
try { |
42277 | 617 |
setTabWidth(Integer.parseInt(args.get(0))); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
618 |
} catch (NumberFormatException e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
619 |
//Set to -1 so that warning will be printed |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
620 |
//to indicate what is valid argument. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
621 |
sourcetab = -1; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
622 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
623 |
if (sourcetab <= 0) { |
40303 | 624 |
getMessages().warning("doclet.sourcetab_warning"); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
625 |
setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
626 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
627 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
628 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
629 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
630 |
new Option(resources, "-tag", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
631 |
@Override |
42277 | 632 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
633 |
ArrayList<String> list = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
634 |
list.add(opt); |
42277 | 635 |
list.add(args.get(0)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
636 |
customTagStrs.add(list); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
637 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
638 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
639 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
640 |
new Option(resources, "-taglet", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
641 |
@Override |
42277 | 642 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
643 |
ArrayList<String> list = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
644 |
list.add(opt); |
42277 | 645 |
list.add(args.get(0)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
646 |
customTagStrs.add(list); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
647 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
648 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
649 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
650 |
new Option(resources, "-tagletpath", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
651 |
@Override |
42277 | 652 |
public boolean process(String opt, List<String> args) { |
653 |
tagletpath = args.get(0); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
654 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
655 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
656 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
657 |
new Option(resources, "-version") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
658 |
@Override |
42277 | 659 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
660 |
showversion = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
661 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
662 |
} |
41451 | 663 |
}, |
664 |
new Hidden(resources, "--dump-on-error") { |
|
665 |
@Override |
|
42277 | 666 |
public boolean process(String opt, List<String> args) { |
41451 | 667 |
dumpOnError = true; |
668 |
return true; |
|
669 |
} |
|
43261 | 670 |
}, |
671 |
new Option(resources, "--allow-script-in-comments") { |
|
672 |
@Override |
|
673 |
public boolean process(String opt, List<String> args) { |
|
674 |
allowScriptInComments = true; |
|
675 |
return true; |
|
676 |
} |
|
19937
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
677 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
678 |
}; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
679 |
Set<Doclet.Option> set = new TreeSet<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
680 |
set.addAll(Arrays.asList(options)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
681 |
return set; |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
682 |
} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
683 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
684 |
final LinkedHashSet<List<String>> customTagStrs = new LinkedHashSet<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
685 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
686 |
/* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
687 |
* when this is called all the option have been set, this method, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
688 |
* initializes certain components before anything else is started. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
689 |
*/ |
40587 | 690 |
private void finishOptionSettings0() throws DocletException { |
691 |
initDestDirectory(); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
692 |
if (urlForLink != null && pkglistUrlForLink != null) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
693 |
extern.link(urlForLink, pkglistUrlForLink, reporter, false); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
694 |
if (urlForLinkOffline != null && pkglistUrlForLinkOffline != null) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
695 |
extern.link(urlForLinkOffline, pkglistUrlForLinkOffline, reporter, true); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
696 |
if (docencoding == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
697 |
docencoding = encoding; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
698 |
} |
42277 | 699 |
typeElementCatalog = new TypeElementCatalog(includedTypeElements, this); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
700 |
initTagletManager(customTagStrs); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
701 |
groups.stream().forEach((grp) -> { |
45157
f5f796453339
8178043: Support grouping modules in unified javadoc
bpatel
parents:
44815
diff
changeset
|
702 |
if (showModules) { |
f5f796453339
8178043: Support grouping modules in unified javadoc
bpatel
parents:
44815
diff
changeset
|
703 |
group.checkModuleGroups(grp.value1, grp.value2); |
f5f796453339
8178043: Support grouping modules in unified javadoc
bpatel
parents:
44815
diff
changeset
|
704 |
} else { |
f5f796453339
8178043: Support grouping modules in unified javadoc
bpatel
parents:
44815
diff
changeset
|
705 |
group.checkPackageGroups(grp.value1, grp.value2); |
f5f796453339
8178043: Support grouping modules in unified javadoc
bpatel
parents:
44815
diff
changeset
|
706 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
707 |
}); |
10 | 708 |
} |
709 |
||
710 |
/** |
|
711 |
* Set the command line options supported by this configuration. |
|
712 |
* |
|
36526 | 713 |
* @return true if the options are set successfully |
40587 | 714 |
* @throws DocletException if there is a problem while setting the options |
10 | 715 |
*/ |
40587 | 716 |
public boolean setOptions() throws DocletException { |
717 |
initPackages(); |
|
718 |
initModules(); |
|
719 |
finishOptionSettings0(); |
|
720 |
if (!finishOptionSettings()) |
|
721 |
return false; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
722 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
723 |
return true; |
10 | 724 |
} |
725 |
||
40587 | 726 |
private void initDestDirectory() throws DocletException { |
727 |
if (!destDirName.isEmpty()) { |
|
728 |
DocFile destDir = DocFile.createFileForDirectory(this, destDirName); |
|
729 |
if (!destDir.exists()) { |
|
730 |
//Create the output directory (in case it doesn't exist yet) |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
731 |
reporter.print(NOTE, getText("doclet.dest_dir_create", destDirName)); |
40587 | 732 |
destDir.mkdirs(); |
733 |
} else if (!destDir.isDirectory()) { |
|
734 |
throw new SimpleDocletException(getText( |
|
735 |
"doclet.destination_directory_not_directory_0", |
|
736 |
destDir.getPath())); |
|
737 |
} else if (!destDir.canWrite()) { |
|
738 |
throw new SimpleDocletException(getText( |
|
739 |
"doclet.destination_directory_not_writable_0", |
|
740 |
destDir.getPath())); |
|
741 |
} |
|
16324 | 742 |
} |
40587 | 743 |
DocFileFactory.getFactory(this).setDestDir(destDirName); |
16324 | 744 |
} |
745 |
||
10 | 746 |
/** |
747 |
* Initialize the taglet manager. The strings to initialize the simple custom tags should |
|
748 |
* be in the following format: "[tag name]:[location str]:[heading]". |
|
40587 | 749 |
* |
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14544
diff
changeset
|
750 |
* @param customTagStrs the set two dimensional arrays of strings. These arrays contain |
10 | 751 |
* either -tag or -taglet arguments. |
752 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
753 |
private void initTagletManager(Set<List<String>> customTagStrs) { |
10 | 754 |
tagletManager = tagletManager == null ? |
40303 | 755 |
new TagletManager(nosince, showversion, showauthor, javafx, this) : |
10 | 756 |
tagletManager; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
757 |
for (List<String> args : customTagStrs) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
758 |
if (args.get(0).equals("-taglet")) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
759 |
tagletManager.addCustomTag(args.get(1), getFileManager(), tagletpath); |
10 | 760 |
continue; |
761 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
762 |
List<String> tokens = tokenize(args.get(1), TagletManager.SIMPLE_TAGLET_OPT_SEPARATOR, 3); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
763 |
if (tokens.size() == 1) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
764 |
String tagName = args.get(1); |
10 | 765 |
if (tagletManager.isKnownCustomTag(tagName)) { |
766 |
//reorder a standard tag |
|
767 |
tagletManager.addNewSimpleCustomTag(tagName, null, ""); |
|
768 |
} else { |
|
769 |
//Create a simple tag with the heading that has the same name as the tag. |
|
14263 | 770 |
StringBuilder heading = new StringBuilder(tagName + ":"); |
10 | 771 |
heading.setCharAt(0, Character.toUpperCase(tagName.charAt(0))); |
772 |
tagletManager.addNewSimpleCustomTag(tagName, heading.toString(), "a"); |
|
773 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
774 |
} else if (tokens.size() == 2) { |
10 | 775 |
//Add simple taglet without heading, probably to excluding it in the output. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
776 |
tagletManager.addNewSimpleCustomTag(tokens.get(0), tokens.get(1), ""); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
777 |
} else if (tokens.size() >= 3) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
778 |
tagletManager.addNewSimpleCustomTag(tokens.get(0), tokens.get(2), tokens.get(1)); |
10 | 779 |
} else { |
40303 | 780 |
Messages messages = getMessages(); |
781 |
messages.error("doclet.Error_invalid_custom_tag_argument", args.get(1)); |
|
10 | 782 |
} |
783 |
} |
|
784 |
} |
|
785 |
||
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
786 |
/** |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
787 |
* Given a string, return an array of tokens. The separator can be escaped |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
788 |
* with the '\' character. The '\' character may also be escaped by the |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
789 |
* '\' character. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
790 |
* |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
791 |
* @param s the string to tokenize. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
792 |
* @param separator the separator char. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
793 |
* @param maxTokens the maximum number of tokens returned. If the |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
794 |
* max is reached, the remaining part of s is appended |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
795 |
* to the end of the last token. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
796 |
* |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
797 |
* @return an array of tokens. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
798 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
799 |
private List<String> tokenize(String s, char separator, int maxTokens) { |
22163 | 800 |
List<String> tokens = new ArrayList<>(); |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
801 |
StringBuilder token = new StringBuilder (); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
802 |
boolean prevIsEscapeChar = false; |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
803 |
for (int i = 0; i < s.length(); i += Character.charCount(i)) { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
804 |
int currentChar = s.codePointAt(i); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
805 |
if (prevIsEscapeChar) { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
806 |
// Case 1: escaped character |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
807 |
token.appendCodePoint(currentChar); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
808 |
prevIsEscapeChar = false; |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
809 |
} else if (currentChar == separator && tokens.size() < maxTokens-1) { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
810 |
// Case 2: separator |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
811 |
tokens.add(token.toString()); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
812 |
token = new StringBuilder(); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
813 |
} else if (currentChar == '\\') { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
814 |
// Case 3: escape character |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
815 |
prevIsEscapeChar = true; |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
816 |
} else { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
817 |
// Case 4: regular character |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
818 |
token.appendCodePoint(currentChar); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
819 |
} |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
820 |
} |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
821 |
if (token.length() > 0) { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
822 |
tokens.add(token.toString()); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
823 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
824 |
return tokens; |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
825 |
} |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
826 |
|
868 | 827 |
private void addToSet(Set<String> s, String str){ |
10 | 828 |
StringTokenizer st = new StringTokenizer(str, ":"); |
829 |
String current; |
|
830 |
while(st.hasMoreTokens()){ |
|
831 |
current = st.nextToken(); |
|
832 |
s.add(current); |
|
833 |
} |
|
834 |
} |
|
835 |
||
836 |
/** |
|
14061
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
13842
diff
changeset
|
837 |
* Add a trailing file separator, if not found. Remove superfluous |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
13842
diff
changeset
|
838 |
* file separators if any. Preserve the front double file separator for |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
13842
diff
changeset
|
839 |
* UNC paths. |
10 | 840 |
* |
841 |
* @param path Path under consideration. |
|
842 |
* @return String Properly constructed path string. |
|
843 |
*/ |
|
14061
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
13842
diff
changeset
|
844 |
public static String addTrailingFileSep(String path) { |
10 | 845 |
String fs = System.getProperty("file.separator"); |
846 |
String dblfs = fs + fs; |
|
847 |
int indexDblfs; |
|
14061
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
13842
diff
changeset
|
848 |
while ((indexDblfs = path.indexOf(dblfs, 1)) >= 0) { |
10 | 849 |
path = path.substring(0, indexDblfs) + |
850 |
path.substring(indexDblfs + fs.length()); |
|
851 |
} |
|
852 |
if (!path.endsWith(fs)) |
|
853 |
path += fs; |
|
854 |
return path; |
|
855 |
} |
|
856 |
||
857 |
/** |
|
42277 | 858 |
* |
10 | 859 |
* This checks for the validity of the options used by the user. |
42277 | 860 |
* As of this writing, this checks only docencoding. |
10 | 861 |
* |
862 |
* @return true if all the options are valid. |
|
863 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
864 |
public boolean generalValidOptions() { |
42277 | 865 |
if (docencoding != null) { |
866 |
if (!checkOutputFileEncoding(docencoding)) { |
|
867 |
return false; |
|
40587 | 868 |
} |
10 | 869 |
} |
42277 | 870 |
if (docencoding == null && (encoding != null && !encoding.isEmpty())) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
871 |
if (!checkOutputFileEncoding(encoding)) { |
10 | 872 |
return false; |
873 |
} |
|
874 |
} |
|
875 |
return true; |
|
876 |
} |
|
877 |
||
878 |
/** |
|
879 |
* Check the validity of the given Source or Output File encoding on this |
|
880 |
* platform. |
|
881 |
* |
|
882 |
* @param docencoding output file encoding. |
|
883 |
* @param reporter used to report errors. |
|
884 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
885 |
private boolean checkOutputFileEncoding(String docencoding) { |
10 | 886 |
OutputStream ost= new ByteArrayOutputStream(); |
887 |
OutputStreamWriter osw = null; |
|
888 |
try { |
|
889 |
osw = new OutputStreamWriter(ost, docencoding); |
|
890 |
} catch (UnsupportedEncodingException exc) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
891 |
reporter.print(ERROR, getText("doclet.Encoding_not_supported", docencoding)); |
10 | 892 |
return false; |
893 |
} finally { |
|
894 |
try { |
|
895 |
if (osw != null) { |
|
896 |
osw.close(); |
|
897 |
} |
|
898 |
} catch (IOException exc) { |
|
899 |
} |
|
900 |
} |
|
901 |
return true; |
|
902 |
} |
|
903 |
||
904 |
/** |
|
905 |
* Return true if the given doc-file subdirectory should be excluded and |
|
906 |
* false otherwise. |
|
40587 | 907 |
* |
10 | 908 |
* @param docfilesubdir the doc-files subdirectory to check. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
909 |
* @return true if the directory is excluded. |
10 | 910 |
*/ |
911 |
public boolean shouldExcludeDocFileDir(String docfilesubdir){ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
912 |
return excludedDocFileDirs.contains(docfilesubdir); |
10 | 913 |
} |
914 |
||
915 |
/** |
|
916 |
* Return true if the given qualifier should be excluded and false otherwise. |
|
40587 | 917 |
* |
10 | 918 |
* @param qualifier the qualifier to check. |
40587 | 919 |
* @return true if the qualifier should be excluded |
10 | 920 |
*/ |
921 |
public boolean shouldExcludeQualifier(String qualifier){ |
|
922 |
if (excludedQualifiers.contains("all") || |
|
923 |
excludedQualifiers.contains(qualifier) || |
|
924 |
excludedQualifiers.contains(qualifier + ".*")) { |
|
925 |
return true; |
|
926 |
} else { |
|
927 |
int index = -1; |
|
928 |
while ((index = qualifier.indexOf(".", index + 1)) != -1) { |
|
929 |
if (excludedQualifiers.contains(qualifier.substring(0, index + 1) + "*")) { |
|
930 |
return true; |
|
931 |
} |
|
932 |
} |
|
933 |
return false; |
|
934 |
} |
|
935 |
} |
|
936 |
||
937 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
938 |
* Return the qualified name of the Element if its qualifier is not excluded. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
939 |
* Otherwise return the unqualified Element name. |
40587 | 940 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
941 |
* @param te the TypeElement to check. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
942 |
* @return the class name |
10 | 943 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
944 |
public String getClassName(TypeElement te) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
945 |
PackageElement pkg = utils.containingPackage(te); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
946 |
return shouldExcludeQualifier(utils.getPackageName(pkg)) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
947 |
? utils.getSimpleName(te) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
948 |
: utils.getFullyQualifiedName(te); |
10 | 949 |
} |
950 |
||
40303 | 951 |
/** |
952 |
* Convenience method to obtain a resource from the doclet's |
|
953 |
* {@link Resources resources}. |
|
954 |
* Equivalent to <code>getResources.getText(key);</code>. |
|
40587 | 955 |
* |
40303 | 956 |
* @param key the key for the desired string |
957 |
* @return the string for the given key |
|
958 |
* @throws MissingResourceException if the key is not found in either |
|
959 |
* bundle. |
|
960 |
*/ |
|
961 |
public abstract String getText(String key); |
|
10 | 962 |
|
40303 | 963 |
/** |
964 |
* Convenience method to obtain a resource from the doclet's |
|
965 |
* {@link Resources resources}. |
|
966 |
* Equivalent to <code>getResources.getText(key, args);</code>. |
|
40587 | 967 |
* |
40303 | 968 |
* @param key the key for the desired string |
969 |
* @param args values to be substituted into the resulting string |
|
970 |
* @return the string for the given key |
|
971 |
* @throws MissingResourceException if the key is not found in either |
|
972 |
* bundle. |
|
973 |
*/ |
|
974 |
public abstract String getText(String key, String... args); |
|
10 | 975 |
|
40303 | 976 |
/** |
977 |
* Convenience method to obtain a resource from the doclet's |
|
978 |
* {@link Resources resources} as a {@code Content} object. |
|
979 |
* |
|
980 |
* @param key the key for the desired string |
|
981 |
* @return a content tree for the text |
|
982 |
*/ |
|
983 |
public abstract Content getContent(String key); |
|
10 | 984 |
|
40303 | 985 |
/** |
986 |
* Convenience method to obtain a resource from the doclet's |
|
987 |
* {@link Resources resources} as a {@code Content} object. |
|
988 |
* |
|
989 |
* @param key the key for the desired string |
|
990 |
* @param o string or content argument added to configuration text |
|
991 |
* @return a content tree for the text |
|
992 |
*/ |
|
993 |
public abstract Content getContent(String key, Object o); |
|
10 | 994 |
|
40303 | 995 |
/** |
996 |
* Convenience method to obtain a resource from the doclet's |
|
997 |
* {@link Resources resources} as a {@code Content} object. |
|
998 |
* |
|
999 |
* @param key the key for the desired string |
|
1000 |
* @param o1 resource argument |
|
1001 |
* @param o2 resource argument |
|
1002 |
* @return a content tree for the text |
|
1003 |
*/ |
|
1004 |
public abstract Content getContent(String key, Object o1, Object o2); |
|
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
1005 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
1006 |
/** |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
1007 |
* Get the configuration string as a content. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
1008 |
* |
40303 | 1009 |
* @param key the key for the desired string |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1010 |
* @param o0 string or content argument added to configuration text |
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
1011 |
* @param o1 string or content argument added to configuration text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
1012 |
* @param o2 string or content argument added to configuration text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
1013 |
* @return a content tree for the text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
1014 |
*/ |
40303 | 1015 |
public abstract Content getContent(String key, Object o0, Object o1, Object o2); |
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
1016 |
|
10 | 1017 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1018 |
* Return true if the TypeElement element is getting documented, depending upon |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
1019 |
* -nodeprecated option and the deprecation information. Return true if |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
1020 |
* -nodeprecated is not used. Return false if -nodeprecated is used and if |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1021 |
* either TypeElement element is deprecated or the containing package is deprecated. |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
1022 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1023 |
* @param te the TypeElement for which the page generation is checked |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1024 |
* @return true if it is a generated doc. |
10 | 1025 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1026 |
public boolean isGeneratedDoc(TypeElement te) { |
10 | 1027 |
if (!nodeprecated) { |
1028 |
return true; |
|
1029 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1030 |
return !(utils.isDeprecated(te) || utils.isDeprecated(utils.containingPackage(te))); |
10 | 1031 |
} |
1032 |
||
1033 |
/** |
|
1034 |
* Return the doclet specific instance of a writer factory. |
|
40587 | 1035 |
* |
10 | 1036 |
* @return the {@link WriterFactory} for the doclet. |
1037 |
*/ |
|
1038 |
public abstract WriterFactory getWriterFactory(); |
|
1039 |
||
1040 |
/** |
|
1041 |
* Return the input stream to the builder XML. |
|
1042 |
* |
|
1043 |
* @return the input steam to the builder XML. |
|
40587 | 1044 |
* @throws DocFileIOException when the given XML file cannot be found or opened. |
10 | 1045 |
*/ |
40587 | 1046 |
public InputStream getBuilderXML() throws DocFileIOException { |
10 | 1047 |
return builderXMLPath == null ? |
45417 | 1048 |
BaseConfiguration.class.getResourceAsStream(DEFAULT_BUILDER_XML) : |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
1049 |
DocFile.createFileForInput(this, builderXMLPath).openInputStream(); |
10 | 1050 |
} |
1051 |
||
1052 |
/** |
|
1863
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1789
diff
changeset
|
1053 |
* Return the Locale for this document. |
40587 | 1054 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1055 |
* @return the current locale |
1863
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1789
diff
changeset
|
1056 |
*/ |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1789
diff
changeset
|
1057 |
public abstract Locale getLocale(); |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1789
diff
changeset
|
1058 |
|
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1789
diff
changeset
|
1059 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1060 |
* Return the path of the overview file and null if it does not exist. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1061 |
* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1062 |
* @return the path of the overview file. |
14544 | 1063 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1064 |
public abstract JavaFileObject getOverviewPath(); |
14544 | 1065 |
|
1066 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1067 |
* Return the current file manager. |
40587 | 1068 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1069 |
* @return JavaFileManager |
10 | 1070 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1071 |
public abstract JavaFileManager getFileManager(); |
14542 | 1072 |
|
1073 |
private void setTabWidth(int n) { |
|
1074 |
sourcetab = n; |
|
1075 |
tabSpaces = String.format("%" + n + "s", ""); |
|
1076 |
} |
|
15354 | 1077 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1078 |
public abstract boolean showMessage(DocTreePath path, String key); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1079 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1080 |
public abstract boolean showMessage(Element e, String key); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1081 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1082 |
public static abstract class Option implements Doclet.Option, Comparable<Option> { |
42277 | 1083 |
private final String[] names; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1084 |
private final String parameters; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1085 |
private final String description; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1086 |
private final int argCount; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1087 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1088 |
protected Option(Resources resources, String name, int argCount) { |
44815
2a0f6c7033bd
8178830: standard doclet: -javafx option should be unhidden
ksrini
parents:
44460
diff
changeset
|
1089 |
this(resources, null, name, argCount); |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1090 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1091 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1092 |
protected Option(Resources resources, String keyBase, String name, int argCount) { |
42277 | 1093 |
this.names = name.trim().split("\\s+"); |
44815
2a0f6c7033bd
8178830: standard doclet: -javafx option should be unhidden
ksrini
parents:
44460
diff
changeset
|
1094 |
if (keyBase == null) { |
2a0f6c7033bd
8178830: standard doclet: -javafx option should be unhidden
ksrini
parents:
44460
diff
changeset
|
1095 |
keyBase = "doclet.usage." + names[0].toLowerCase().replaceAll("^-+", ""); |
2a0f6c7033bd
8178830: standard doclet: -javafx option should be unhidden
ksrini
parents:
44460
diff
changeset
|
1096 |
} |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1097 |
String desc = getOptionsMessage(resources, keyBase + ".description"); |
40314
52f8470ce3e4
8163524: doclet resources doclet.usage.NAME.name are redundant
jjg
parents:
40303
diff
changeset
|
1098 |
if (desc.isEmpty()) { |
52f8470ce3e4
8163524: doclet resources doclet.usage.NAME.name are redundant
jjg
parents:
40303
diff
changeset
|
1099 |
this.description = "<MISSING KEY>"; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1100 |
this.parameters = "<MISSING KEY>"; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1101 |
} else { |
40314
52f8470ce3e4
8163524: doclet resources doclet.usage.NAME.name are redundant
jjg
parents:
40303
diff
changeset
|
1102 |
this.description = desc; |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1103 |
this.parameters = getOptionsMessage(resources, keyBase + ".parameters"); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1104 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1105 |
this.argCount = argCount; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1106 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1107 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1108 |
protected Option(Resources resources, String name) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1109 |
this(resources, name, 0); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1110 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1111 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1112 |
private String getOptionsMessage(Resources resources, String key) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1113 |
try { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1114 |
return resources.getText(key); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1115 |
} catch (MissingResourceException ignore) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1116 |
return ""; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1117 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1118 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1119 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1120 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1121 |
public String getDescription() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1122 |
return description; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1123 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1124 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1125 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1126 |
public Option.Kind getKind() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1127 |
return Doclet.Option.Kind.STANDARD; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1128 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1129 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1130 |
@Override |
42277 | 1131 |
public List<String> getNames() { |
1132 |
return Arrays.asList(names); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1133 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1134 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1135 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1136 |
public String getParameters() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1137 |
return parameters; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1138 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1139 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1140 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1141 |
public String toString() { |
43872
b5ce3bc28931
8174839: javadoc crashes with a method which does not override a super.
ksrini
parents:
43261
diff
changeset
|
1142 |
return Arrays.toString(names); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1143 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1144 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1145 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1146 |
public int getArgumentCount() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1147 |
return argCount; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1148 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1149 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1150 |
public boolean matches(String option) { |
42277 | 1151 |
for (String name : names) { |
1152 |
boolean matchCase = name.startsWith("--"); |
|
1153 |
if (option.startsWith("--") && option.contains("=")) { |
|
1154 |
return name.equals(option.substring(option.indexOf("=") + 1)); |
|
1155 |
} else if (matchCase) { |
|
1156 |
return name.equals(option); |
|
1157 |
} |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1158 |
return name.toLowerCase().equals(option.toLowerCase()); |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1159 |
} |
42277 | 1160 |
return false; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1161 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1162 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1163 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1164 |
public int compareTo(Option that) { |
42277 | 1165 |
return this.getNames().get(0).compareTo(that.getNames().get(0)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1166 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1167 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1168 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1169 |
public abstract class XOption extends Option { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1170 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1171 |
public XOption(Resources resources, String prefix, String name, int argCount) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1172 |
super(resources, prefix, name, argCount); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1173 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1174 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1175 |
public XOption(Resources resources, String name, int argCount) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1176 |
super(resources, name, argCount); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1177 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1178 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1179 |
public XOption(Resources resources, String name) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1180 |
this(resources, name, 0); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1181 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1182 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1183 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1184 |
public Option.Kind getKind() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1185 |
return Doclet.Option.Kind.EXTENDED; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1186 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1187 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1188 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1189 |
public abstract class Hidden extends Option { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1190 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1191 |
public Hidden(Resources resources, String name, int argCount) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1192 |
super(resources, name, argCount); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1193 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1194 |
|
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1195 |
public Hidden(Resources resources, String name) { |
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
1196 |
this(resources, name, 0); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1197 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1198 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1199 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1200 |
public Option.Kind getKind() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1201 |
return Doclet.Option.Kind.OTHER; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1202 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1203 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1204 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1205 |
/* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1206 |
* Stores a pair of Strings. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1207 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1208 |
protected static class GroupContainer { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1209 |
final String value1; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1210 |
final String value2; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1211 |
public GroupContainer(String value1, String value2) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1212 |
this.value1 = value1; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1213 |
this.value2 = value2; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1214 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
35420
diff
changeset
|
1215 |
} |
42277 | 1216 |
|
1217 |
/* |
|
1218 |
* Splits the elements in a collection to its individual |
|
1219 |
* collection. |
|
1220 |
*/ |
|
1221 |
static private class Splitter { |
|
1222 |
||
1223 |
final Set<ModuleElement> mset = new LinkedHashSet<>(); |
|
1224 |
final Set<PackageElement> pset = new LinkedHashSet<>(); |
|
1225 |
final Set<TypeElement> tset = new LinkedHashSet<>(); |
|
1226 |
||
1227 |
Splitter(DocletEnvironment docEnv, boolean included) { |
|
1228 |
||
1229 |
Set<? extends Element> inset = included |
|
1230 |
? docEnv.getIncludedElements() |
|
1231 |
: docEnv.getSpecifiedElements(); |
|
1232 |
||
1233 |
for (Element e : inset) { |
|
1234 |
new SimpleElementVisitor9<Void, Void>() { |
|
1235 |
@Override |
|
1236 |
@DefinedBy(Api.LANGUAGE_MODEL) |
|
1237 |
public Void visitModule(ModuleElement e, Void p) { |
|
1238 |
mset.add(e); |
|
1239 |
return null; |
|
1240 |
} |
|
1241 |
||
1242 |
@Override |
|
1243 |
@DefinedBy(Api.LANGUAGE_MODEL) |
|
1244 |
public Void visitPackage(PackageElement e, Void p) { |
|
1245 |
pset.add(e); |
|
1246 |
return null; |
|
1247 |
} |
|
1248 |
||
1249 |
@Override |
|
1250 |
@DefinedBy(Api.LANGUAGE_MODEL) |
|
1251 |
public Void visitType(TypeElement e, Void p) { |
|
1252 |
tset.add(e); |
|
1253 |
return null; |
|
1254 |
} |
|
1255 |
||
1256 |
@Override |
|
1257 |
@DefinedBy(Api.LANGUAGE_MODEL) |
|
1258 |
protected Void defaultAction(Element e, Void p) { |
|
1259 |
throw new AssertionError("unexpected element: " + e); |
|
1260 |
} |
|
1261 |
||
1262 |
}.visit(e); |
|
1263 |
} |
|
1264 |
} |
|
1265 |
} |
|
43261 | 1266 |
|
1267 |
/** |
|
1268 |
* Returns whether or not to allow JavaScript in comments. |
|
1269 |
* Default is off; can be set true from a command line option. |
|
1270 |
* @return the allowScriptInComments |
|
1271 |
*/ |
|
1272 |
public boolean isAllowScriptInComments() { |
|
1273 |
return allowScriptInComments; |
|
1274 |
} |
|
44460 | 1275 |
|
1276 |
public VisibleMemberMap getVisibleMemberMap(TypeElement te, VisibleMemberMap.Kind kind) { |
|
1277 |
EnumMap<Kind, Reference<VisibleMemberMap>> cacheMap = typeElementMemberCache |
|
1278 |
.computeIfAbsent(te, k -> new EnumMap<>(VisibleMemberMap.Kind.class)); |
|
1279 |
||
1280 |
Reference<VisibleMemberMap> vmapRef = cacheMap.get(kind); |
|
1281 |
// recompute, if referent has been garbage collected |
|
1282 |
VisibleMemberMap vMap = vmapRef == null ? null : vmapRef.get(); |
|
1283 |
if (vMap == null) { |
|
1284 |
vMap = new VisibleMemberMap(te, kind, this); |
|
1285 |
cacheMap.put(kind, new SoftReference<>(vMap)); |
|
1286 |
} |
|
1287 |
return vMap; |
|
1288 |
} |
|
10 | 1289 |
} |