author | briangoetz |
Wed, 18 Dec 2013 16:05:18 -0500 | |
changeset 22163 | 3651128c74eb |
parent 22159 | 682da512ec17 |
child 22165 | ec53c8946fc2 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
15354 | 2 |
* Copyright (c) 1997, 2013, 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 |
||
26 |
package com.sun.tools.doclets.internal.toolkit; |
|
27 |
||
14258 | 28 |
import java.io.*; |
29 |
import java.util.*; |
|
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
30 |
import java.util.regex.Matcher; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
31 |
import java.util.regex.Pattern; |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19937
diff
changeset
|
32 |
import javax.tools.JavaFileManager; |
14258 | 33 |
|
34 |
import com.sun.javadoc.*; |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
35 |
import com.sun.tools.javac.sym.Profiles; |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
36 |
import com.sun.tools.javac.jvm.Profile; |
14258 | 37 |
import com.sun.tools.doclets.internal.toolkit.builders.BuilderFactory; |
10 | 38 |
import com.sun.tools.doclets.internal.toolkit.taglets.*; |
39 |
import com.sun.tools.doclets.internal.toolkit.util.*; |
|
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19937
diff
changeset
|
40 |
import com.sun.tools.javac.util.StringUtils; |
10 | 41 |
|
42 |
/** |
|
43 |
* Configure the output based on the options. Doclets should sub-class |
|
44 |
* Configuration, to configure and add their own options. This class contains |
|
45 |
* all user options which are supported by the 1.1 doclet and the standard |
|
46 |
* doclet. |
|
47 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
48 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
49 |
* 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
|
50 |
* 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
|
51 |
* deletion without notice.</b> |
10 | 52 |
* |
53 |
* @author Robert Field. |
|
54 |
* @author Atul Dambalkar. |
|
55 |
* @author Jamie Ho |
|
56 |
*/ |
|
57 |
public abstract class Configuration { |
|
58 |
||
59 |
/** |
|
16324 | 60 |
* Exception used to report a problem during setOptions. |
61 |
*/ |
|
16560 | 62 |
public static class Fault extends Exception { |
16324 | 63 |
private static final long serialVersionUID = 0; |
64 |
||
65 |
Fault(String msg) { |
|
66 |
super(msg); |
|
67 |
} |
|
68 |
||
69 |
Fault(String msg, Exception cause) { |
|
70 |
super(msg, cause); |
|
71 |
} |
|
72 |
} |
|
73 |
||
74 |
/** |
|
10 | 75 |
* The factory for builders. |
76 |
*/ |
|
77 |
protected BuilderFactory builderFactory; |
|
78 |
||
79 |
/** |
|
80 |
* The taglet manager. |
|
81 |
*/ |
|
82 |
public TagletManager tagletManager; |
|
83 |
||
84 |
/** |
|
85 |
* The path to the builder XML input file. |
|
86 |
*/ |
|
87 |
public String builderXMLPath; |
|
88 |
||
89 |
/** |
|
90 |
* The default path to the builder XML. |
|
91 |
*/ |
|
92 |
private static final String DEFAULT_BUILDER_XML = "resources/doclet.xml"; |
|
93 |
||
94 |
/** |
|
95 |
* The path to Taglets |
|
96 |
*/ |
|
97 |
public String tagletpath = ""; |
|
98 |
||
99 |
/** |
|
100 |
* 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
|
101 |
* suppress excessive warnings about serial tag. |
10 | 102 |
*/ |
103 |
public boolean serialwarn = false; |
|
104 |
||
105 |
/** |
|
106 |
* The specified amount of space between tab stops. |
|
107 |
*/ |
|
14542 | 108 |
public int sourcetab; |
109 |
||
110 |
public String tabSpaces; |
|
10 | 111 |
|
112 |
/** |
|
113 |
* True if we should generate browsable sources. |
|
114 |
*/ |
|
115 |
public boolean linksource = false; |
|
116 |
||
117 |
/** |
|
118 |
* True if command line option "-nosince" is used. Default value is |
|
119 |
* false. |
|
120 |
*/ |
|
121 |
public boolean nosince = false; |
|
122 |
||
123 |
/** |
|
124 |
* True if we should recursively copy the doc-file subdirectories |
|
125 |
*/ |
|
126 |
public boolean copydocfilesubdirs = false; |
|
127 |
||
128 |
/** |
|
129 |
* The META charset tag used for cross-platform viewing. |
|
130 |
*/ |
|
131 |
public String charset = ""; |
|
132 |
||
133 |
/** |
|
134 |
* True if user wants to add member names as meta keywords. |
|
135 |
* Set to false because meta keywords are ignored in general |
|
136 |
* by most Internet search engines. |
|
137 |
*/ |
|
138 |
public boolean keywords = false; |
|
139 |
||
140 |
/** |
|
1475 | 141 |
* The meta tag keywords instance. |
10 | 142 |
*/ |
1475 | 143 |
public final MetaKeywords metakeywords = new MetaKeywords(this); |
10 | 144 |
|
145 |
/** |
|
146 |
* The list of doc-file subdirectories to exclude |
|
147 |
*/ |
|
868 | 148 |
protected Set<String> excludedDocFileDirs; |
10 | 149 |
|
150 |
/** |
|
151 |
* The list of qualifiers to exclude |
|
152 |
*/ |
|
868 | 153 |
protected Set<String> excludedQualifiers; |
10 | 154 |
|
155 |
/** |
|
156 |
* The Root of the generated Program Structure from the Doclet API. |
|
157 |
*/ |
|
158 |
public RootDoc root; |
|
159 |
||
160 |
/** |
|
161 |
* Destination directory name, in which doclet will generate the entire |
|
162 |
* documentation. Default is current directory. |
|
163 |
*/ |
|
164 |
public String destDirName = ""; |
|
165 |
||
166 |
/** |
|
167 |
* Destination directory name, in which doclet will copy the doc-files to. |
|
168 |
*/ |
|
169 |
public String docFileDestDirName = ""; |
|
170 |
||
171 |
/** |
|
172 |
* Encoding for this document. Default is default encoding for this |
|
173 |
* platform. |
|
174 |
*/ |
|
175 |
public String docencoding = null; |
|
176 |
||
177 |
/** |
|
178 |
* True if user wants to suppress descriptions and tags. |
|
179 |
*/ |
|
180 |
public boolean nocomment = false; |
|
181 |
||
182 |
/** |
|
183 |
* Encoding for this document. Default is default encoding for this |
|
184 |
* platform. |
|
185 |
*/ |
|
186 |
public String encoding = null; |
|
187 |
||
188 |
/** |
|
189 |
* Generate author specific information for all the classes if @author |
|
190 |
* tag is used in the doc comment and if -author option is used. |
|
191 |
* <code>showauthor</code> is set to true if -author option is used. |
|
192 |
* Default is don't show author information. |
|
193 |
*/ |
|
194 |
public boolean showauthor = false; |
|
195 |
||
196 |
/** |
|
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
197 |
* 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
|
198 |
* 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
|
199 |
*/ |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
200 |
public boolean javafx = false; |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
201 |
|
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
202 |
/** |
10 | 203 |
* Generate version specific information for the all the classes |
204 |
* if @version tag is used in the doc comment and if -version option is |
|
205 |
* used. <code>showversion</code> is set to true if -version option is |
|
206 |
* used.Default is don't show version information. |
|
207 |
*/ |
|
208 |
public boolean showversion = false; |
|
209 |
||
210 |
/** |
|
211 |
* Sourcepath from where to read the source files. Default is classpath. |
|
212 |
* |
|
213 |
*/ |
|
214 |
public String sourcepath = ""; |
|
215 |
||
216 |
/** |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
217 |
* Argument for command line option "-Xprofilespath". |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
218 |
*/ |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
219 |
public String profilespath = ""; |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
220 |
|
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
221 |
/** |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
222 |
* Generate profiles documentation if profilespath is set and valid profiles |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
223 |
* are present. |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
224 |
*/ |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
225 |
public boolean showProfiles = false; |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
226 |
|
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
227 |
/** |
10 | 228 |
* Don't generate deprecated API information at all, if -nodeprecated |
229 |
* option is used. <code>nodepracted</code> is set to true if |
|
230 |
* -nodeprecated option is used. Default is generate deprected API |
|
231 |
* information. |
|
232 |
*/ |
|
233 |
public boolean nodeprecated = false; |
|
234 |
||
235 |
/** |
|
236 |
* The catalog of classes specified on the command-line |
|
237 |
*/ |
|
238 |
public ClassDocCatalog classDocCatalog; |
|
239 |
||
240 |
/** |
|
241 |
* Message Retriever for the doclet, to retrieve message from the resource |
|
242 |
* file for this Configuration, which is common for 1.1 and standard |
|
243 |
* doclets. |
|
244 |
* |
|
245 |
* TODO: Make this private!!! |
|
246 |
*/ |
|
247 |
public MessageRetriever message = null; |
|
248 |
||
249 |
/** |
|
250 |
* True if user wants to suppress time stamp in output. |
|
251 |
* Default is false. |
|
252 |
*/ |
|
253 |
public boolean notimestamp= false; |
|
254 |
||
255 |
/** |
|
1475 | 256 |
* The package grouping instance. |
10 | 257 |
*/ |
1475 | 258 |
public final Group group = new Group(this); |
10 | 259 |
|
260 |
/** |
|
1475 | 261 |
* The tracker of external package links. |
10 | 262 |
*/ |
263 |
public final Extern extern = new Extern(this); |
|
264 |
||
265 |
/** |
|
266 |
* Return the build date for the doclet. |
|
267 |
*/ |
|
268 |
public abstract String getDocletSpecificBuildDate(); |
|
269 |
||
270 |
/** |
|
271 |
* This method should be defined in all those doclets(configurations), |
|
272 |
* which want to derive themselves from this Configuration. This method |
|
273 |
* can be used to set its own command line options. |
|
274 |
* |
|
275 |
* @param options The array of option names and values. |
|
276 |
* @throws DocletAbortException |
|
277 |
*/ |
|
16324 | 278 |
public abstract void setSpecificDocletOptions(String[][] options) throws Fault; |
10 | 279 |
|
280 |
/** |
|
281 |
* Return the doclet specific {@link MessageRetriever} |
|
282 |
* @return the doclet specific MessageRetriever. |
|
283 |
*/ |
|
284 |
public abstract MessageRetriever getDocletSpecificMsg(); |
|
285 |
||
286 |
/** |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
287 |
* A profiles object used to access profiles across various pages. |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
288 |
*/ |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
289 |
public Profiles profiles; |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
290 |
|
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
291 |
/** |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
292 |
* An map of the profiles to packages. |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
293 |
*/ |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
294 |
public Map<String,PackageDoc[]> profilePackages; |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
295 |
|
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
296 |
/** |
10 | 297 |
* An array of the packages specified on the command-line merged |
298 |
* with the array of packages that contain the classes specified on the |
|
299 |
* command-line. The array is sorted. |
|
300 |
*/ |
|
301 |
public PackageDoc[] packages; |
|
302 |
||
303 |
/** |
|
304 |
* Constructor. Constructs the message retriever with resource file. |
|
305 |
*/ |
|
306 |
public Configuration() { |
|
307 |
message = |
|
308 |
new MessageRetriever(this, |
|
309 |
"com.sun.tools.doclets.internal.toolkit.resources.doclets"); |
|
22163 | 310 |
excludedDocFileDirs = new HashSet<>(); |
311 |
excludedQualifiers = new HashSet<>(); |
|
14542 | 312 |
setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH); |
10 | 313 |
} |
314 |
||
315 |
/** |
|
316 |
* Return the builder factory for this doclet. |
|
317 |
* |
|
318 |
* @return the builder factory for this doclet. |
|
319 |
*/ |
|
320 |
public BuilderFactory getBuilderFactory() { |
|
321 |
if (builderFactory == null) { |
|
322 |
builderFactory = new BuilderFactory(this); |
|
323 |
} |
|
324 |
return builderFactory; |
|
325 |
} |
|
326 |
||
327 |
/** |
|
328 |
* This method should be defined in all those doclets |
|
329 |
* which want to inherit from this Configuration. This method |
|
330 |
* should return the number of arguments to the command line |
|
331 |
* option (including the option name). For example, |
|
332 |
* -notimestamp is a single-argument option, so this method would |
|
333 |
* return 1. |
|
334 |
* |
|
335 |
* @param option Command line option under consideration. |
|
336 |
* @return number of arguments to option (including the |
|
337 |
* option name). Zero return means option not known. |
|
338 |
* Negative value means error occurred. |
|
339 |
*/ |
|
340 |
public int optionLength(String option) { |
|
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19937
diff
changeset
|
341 |
option = StringUtils.toLowerCase(option); |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
342 |
switch (option) { |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
343 |
case "-author": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
344 |
case "-docfilessubdirs": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
345 |
case "-javafx": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
346 |
case "-keywords": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
347 |
case "-linksource": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
348 |
case "-nocomment": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
349 |
case "-nodeprecated": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
350 |
case "-nosince": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
351 |
case "-notimestamp": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
352 |
case "-quiet": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
353 |
case "-xnodate": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
354 |
case "-version": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
355 |
return 1; |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
356 |
case "-d": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
357 |
case "-docencoding": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
358 |
case "-encoding": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
359 |
case "-excludedocfilessubdir": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
360 |
case "-link": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
361 |
case "-sourcetab": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
362 |
case "-noqualifier": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
363 |
case "-output": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
364 |
case "-sourcepath": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
365 |
case "-tag": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
366 |
case "-taglet": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
367 |
case "-tagletpath": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
368 |
case "-xprofilespath": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
369 |
return 2; |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
370 |
case "-group": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
371 |
case "-linkoffline": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
372 |
return 3; |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
373 |
default: |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
374 |
return -1; // indicate we don't know about it |
10 | 375 |
} |
376 |
} |
|
377 |
||
378 |
/** |
|
379 |
* Perform error checking on the given options. |
|
380 |
* |
|
381 |
* @param options the given options to check. |
|
382 |
* @param reporter the reporter used to report errors. |
|
383 |
*/ |
|
384 |
public abstract boolean validOptions(String options[][], |
|
385 |
DocErrorReporter reporter); |
|
386 |
||
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
387 |
private void initProfiles() throws IOException { |
19911 | 388 |
if (profilespath.isEmpty()) |
389 |
return; |
|
390 |
||
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
391 |
profiles = Profiles.read(new File(profilespath)); |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
392 |
|
19911 | 393 |
// Group the packages to be documented by the lowest profile (if any) |
394 |
// in which each appears |
|
22163 | 395 |
Map<Profile, List<PackageDoc>> interimResults = new EnumMap<>(Profile.class); |
19911 | 396 |
for (Profile p: Profile.values()) |
22163 | 397 |
interimResults.put(p, new ArrayList<>()); |
19911 | 398 |
|
399 |
for (PackageDoc pkg: packages) { |
|
19937
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
400 |
if (nodeprecated && Util.isDeprecated(pkg)) { |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
401 |
continue; |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
402 |
} |
19911 | 403 |
// the getProfile method takes a type name, not a package name, |
404 |
// but isn't particularly fussy about the simple name -- so just use * |
|
405 |
int i = profiles.getProfile(pkg.name().replace(".", "/") + "/*"); |
|
406 |
Profile p = Profile.lookup(i); |
|
407 |
if (p != null) { |
|
408 |
List<PackageDoc> pkgs = interimResults.get(p); |
|
409 |
pkgs.add(pkg); |
|
410 |
} |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
411 |
} |
19911 | 412 |
|
413 |
// Build the profilePackages structure used by the doclet |
|
22163 | 414 |
profilePackages = new HashMap<>(); |
19911 | 415 |
List<PackageDoc> prev = Collections.<PackageDoc>emptyList(); |
19937
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
416 |
int size; |
19911 | 417 |
for (Map.Entry<Profile,List<PackageDoc>> e: interimResults.entrySet()) { |
418 |
Profile p = e.getKey(); |
|
419 |
List<PackageDoc> pkgs = e.getValue(); |
|
420 |
pkgs.addAll(prev); // each profile contains all lower profiles |
|
421 |
Collections.sort(pkgs); |
|
19937
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
422 |
size = pkgs.size(); |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
423 |
// For a profile, if there are no packages to be documented, do not add |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
424 |
// it to profilePackages map. |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
425 |
if (size > 0) |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
426 |
profilePackages.put(p.name, pkgs.toArray(new PackageDoc[pkgs.size()])); |
19911 | 427 |
prev = pkgs; |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
428 |
} |
19911 | 429 |
|
430 |
// Generate profiles documentation if any profile contains any |
|
431 |
// of the packages to be documented. |
|
432 |
showProfiles = !prev.isEmpty(); |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
433 |
} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
434 |
|
10 | 435 |
private void initPackageArray() { |
22163 | 436 |
Set<PackageDoc> set = new HashSet<>(Arrays.asList(root.specifiedPackages())); |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
437 |
for (ClassDoc aClass : root.specifiedClasses()) { |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
438 |
set.add(aClass.containingPackage()); |
10 | 439 |
} |
22163 | 440 |
ArrayList<PackageDoc> results = new ArrayList<>(set); |
10 | 441 |
Collections.sort(results); |
868 | 442 |
packages = results.toArray(new PackageDoc[] {}); |
10 | 443 |
} |
444 |
||
445 |
/** |
|
446 |
* Set the command line options supported by this configuration. |
|
447 |
* |
|
448 |
* @param options the two dimensional array of options. |
|
449 |
*/ |
|
16324 | 450 |
public void setOptions(String[][] options) throws Fault { |
22163 | 451 |
LinkedHashSet<String[]> customTagStrs = new LinkedHashSet<>(); |
16324 | 452 |
|
453 |
// Some options, specifically -link and -linkoffline, require that |
|
454 |
// the output directory has already been created: so do that first. |
|
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
455 |
for (String[] os : options) { |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19937
diff
changeset
|
456 |
String opt = StringUtils.toLowerCase(os[0]); |
10 | 457 |
if (opt.equals("-d")) { |
458 |
destDirName = addTrailingFileSep(os[1]); |
|
459 |
docFileDestDirName = destDirName; |
|
16324 | 460 |
ensureOutputDirExists(); |
461 |
break; |
|
462 |
} |
|
463 |
} |
|
464 |
||
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
465 |
for (String[] os : options) { |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19937
diff
changeset
|
466 |
String opt = StringUtils.toLowerCase(os[0]); |
16324 | 467 |
if (opt.equals("-docfilessubdirs")) { |
10 | 468 |
copydocfilesubdirs = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
469 |
} else if (opt.equals("-docencoding")) { |
10 | 470 |
docencoding = os[1]; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
471 |
} else if (opt.equals("-encoding")) { |
10 | 472 |
encoding = os[1]; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
473 |
} else if (opt.equals("-author")) { |
10 | 474 |
showauthor = true; |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
475 |
} else if (opt.equals("-javafx")) { |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
476 |
javafx = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
477 |
} else if (opt.equals("-nosince")) { |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
478 |
nosince = true; |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
479 |
} else if (opt.equals("-version")) { |
10 | 480 |
showversion = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
481 |
} else if (opt.equals("-nodeprecated")) { |
10 | 482 |
nodeprecated = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
483 |
} else if (opt.equals("-sourcepath")) { |
10 | 484 |
sourcepath = os[1]; |
18898
0eab5f5e3d1d
8009924: some langtools tools do not accept -cp as an alias for -classpath
vromero
parents:
17570
diff
changeset
|
485 |
} else if ((opt.equals("-classpath") || opt.equals("-cp")) && |
10 | 486 |
sourcepath.length() == 0) { |
487 |
sourcepath = os[1]; |
|
488 |
} else if (opt.equals("-excludedocfilessubdir")) { |
|
489 |
addToSet(excludedDocFileDirs, os[1]); |
|
490 |
} else if (opt.equals("-noqualifier")) { |
|
491 |
addToSet(excludedQualifiers, os[1]); |
|
492 |
} else if (opt.equals("-linksource")) { |
|
493 |
linksource = true; |
|
494 |
} else if (opt.equals("-sourcetab")) { |
|
495 |
linksource = true; |
|
496 |
try { |
|
14542 | 497 |
setTabWidth(Integer.parseInt(os[1])); |
10 | 498 |
} catch (NumberFormatException e) { |
499 |
//Set to -1 so that warning will be printed |
|
500 |
//to indicate what is valid argument. |
|
501 |
sourcetab = -1; |
|
502 |
} |
|
503 |
if (sourcetab <= 0) { |
|
504 |
message.warning("doclet.sourcetab_warning"); |
|
14542 | 505 |
setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH); |
10 | 506 |
} |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
507 |
} else if (opt.equals("-notimestamp")) { |
10 | 508 |
notimestamp = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
509 |
} else if (opt.equals("-nocomment")) { |
10 | 510 |
nocomment = true; |
511 |
} else if (opt.equals("-tag") || opt.equals("-taglet")) { |
|
512 |
customTagStrs.add(os); |
|
513 |
} else if (opt.equals("-tagletpath")) { |
|
514 |
tagletpath = os[1]; |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
515 |
} else if (opt.equals("-xprofilespath")) { |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
516 |
profilespath = os[1]; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
517 |
} else if (opt.equals("-keywords")) { |
10 | 518 |
keywords = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
519 |
} else if (opt.equals("-serialwarn")) { |
10 | 520 |
serialwarn = true; |
521 |
} else if (opt.equals("-group")) { |
|
522 |
group.checkPackageGroups(os[1], os[2]); |
|
523 |
} else if (opt.equals("-link")) { |
|
524 |
String url = os[1]; |
|
14361
2814fa6977ac
8001219: Clean up use of URLs in javadoc Extern class
jjg
parents:
14263
diff
changeset
|
525 |
extern.link(url, url, root, false); |
10 | 526 |
} else if (opt.equals("-linkoffline")) { |
527 |
String url = os[1]; |
|
528 |
String pkglisturl = os[2]; |
|
14361
2814fa6977ac
8001219: Clean up use of URLs in javadoc Extern class
jjg
parents:
14263
diff
changeset
|
529 |
extern.link(url, pkglisturl, root, true); |
10 | 530 |
} |
531 |
} |
|
532 |
if (sourcepath.length() == 0) { |
|
533 |
sourcepath = System.getProperty("env.class.path") == null ? "" : |
|
534 |
System.getProperty("env.class.path"); |
|
535 |
} |
|
536 |
if (docencoding == null) { |
|
537 |
docencoding = encoding; |
|
538 |
} |
|
539 |
||
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
540 |
classDocCatalog = new ClassDocCatalog(root.specifiedClasses(), this); |
10 | 541 |
initTagletManager(customTagStrs); |
542 |
} |
|
543 |
||
544 |
/** |
|
545 |
* Set the command line options supported by this configuration. |
|
546 |
* |
|
547 |
* @throws DocletAbortException |
|
548 |
*/ |
|
16324 | 549 |
public void setOptions() throws Fault { |
10 | 550 |
initPackageArray(); |
551 |
setOptions(root.options()); |
|
19911 | 552 |
try { |
553 |
initProfiles(); |
|
554 |
} catch (Exception e) { |
|
555 |
throw new DocletAbortException(e); |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
556 |
} |
10 | 557 |
setSpecificDocletOptions(root.options()); |
558 |
} |
|
559 |
||
16324 | 560 |
private void ensureOutputDirExists() throws Fault { |
561 |
DocFile destDir = DocFile.createFileForDirectory(this, destDirName); |
|
562 |
if (!destDir.exists()) { |
|
563 |
//Create the output directory (in case it doesn't exist yet) |
|
564 |
root.printNotice(getText("doclet.dest_dir_create", destDirName)); |
|
565 |
destDir.mkdirs(); |
|
566 |
} else if (!destDir.isDirectory()) { |
|
567 |
throw new Fault(getText( |
|
568 |
"doclet.destination_directory_not_directory_0", |
|
569 |
destDir.getPath())); |
|
570 |
} else if (!destDir.canWrite()) { |
|
571 |
throw new Fault(getText( |
|
572 |
"doclet.destination_directory_not_writable_0", |
|
573 |
destDir.getPath())); |
|
574 |
} |
|
575 |
} |
|
576 |
||
10 | 577 |
|
578 |
/** |
|
579 |
* Initialize the taglet manager. The strings to initialize the simple custom tags should |
|
580 |
* be in the following format: "[tag name]:[location str]:[heading]". |
|
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14544
diff
changeset
|
581 |
* @param customTagStrs the set two dimensional arrays of strings. These arrays contain |
10 | 582 |
* either -tag or -taglet arguments. |
583 |
*/ |
|
1789
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1475
diff
changeset
|
584 |
private void initTagletManager(Set<String[]> customTagStrs) { |
10 | 585 |
tagletManager = tagletManager == null ? |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
586 |
new TagletManager(nosince, showversion, showauthor, javafx, message) : |
10 | 587 |
tagletManager; |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
588 |
for (String[] args : customTagStrs) { |
10 | 589 |
if (args[0].equals("-taglet")) { |
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14544
diff
changeset
|
590 |
tagletManager.addCustomTag(args[1], getFileManager(), tagletpath); |
10 | 591 |
continue; |
592 |
} |
|
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
593 |
String[] tokens = tokenize(args[1], |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
594 |
TagletManager.SIMPLE_TAGLET_OPT_SEPARATOR, 3); |
10 | 595 |
if (tokens.length == 1) { |
596 |
String tagName = args[1]; |
|
597 |
if (tagletManager.isKnownCustomTag(tagName)) { |
|
598 |
//reorder a standard tag |
|
599 |
tagletManager.addNewSimpleCustomTag(tagName, null, ""); |
|
600 |
} else { |
|
601 |
//Create a simple tag with the heading that has the same name as the tag. |
|
14263 | 602 |
StringBuilder heading = new StringBuilder(tagName + ":"); |
10 | 603 |
heading.setCharAt(0, Character.toUpperCase(tagName.charAt(0))); |
604 |
tagletManager.addNewSimpleCustomTag(tagName, heading.toString(), "a"); |
|
605 |
} |
|
606 |
} else if (tokens.length == 2) { |
|
607 |
//Add simple taglet without heading, probably to excluding it in the output. |
|
608 |
tagletManager.addNewSimpleCustomTag(tokens[0], tokens[1], ""); |
|
609 |
} else if (tokens.length >= 3) { |
|
610 |
tagletManager.addNewSimpleCustomTag(tokens[0], tokens[2], tokens[1]); |
|
611 |
} else { |
|
612 |
message.error("doclet.Error_invalid_custom_tag_argument", args[1]); |
|
613 |
} |
|
614 |
} |
|
615 |
} |
|
616 |
||
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
617 |
/** |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
618 |
* 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
|
619 |
* 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
|
620 |
* '\' character. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
621 |
* |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
622 |
* @param s the string to tokenize. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
623 |
* @param separator the separator char. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
624 |
* @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
|
625 |
* 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
|
626 |
* to the end of the last token. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
627 |
* |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
628 |
* @return an array of tokens. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
629 |
*/ |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
630 |
private String[] tokenize(String s, char separator, int maxTokens) { |
22163 | 631 |
List<String> tokens = new ArrayList<>(); |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
632 |
StringBuilder token = new StringBuilder (); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
633 |
boolean prevIsEscapeChar = false; |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
634 |
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
|
635 |
int currentChar = s.codePointAt(i); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
636 |
if (prevIsEscapeChar) { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
637 |
// Case 1: escaped character |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
638 |
token.appendCodePoint(currentChar); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
639 |
prevIsEscapeChar = false; |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
640 |
} else if (currentChar == separator && tokens.size() < maxTokens-1) { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
641 |
// Case 2: separator |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
642 |
tokens.add(token.toString()); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
643 |
token = new StringBuilder(); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
644 |
} else if (currentChar == '\\') { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
645 |
// Case 3: escape character |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
646 |
prevIsEscapeChar = true; |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
647 |
} else { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
648 |
// Case 4: regular character |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
649 |
token.appendCodePoint(currentChar); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
650 |
} |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
651 |
} |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
652 |
if (token.length() > 0) { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
653 |
tokens.add(token.toString()); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
654 |
} |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
655 |
return tokens.toArray(new String[] {}); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
656 |
} |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
657 |
|
868 | 658 |
private void addToSet(Set<String> s, String str){ |
10 | 659 |
StringTokenizer st = new StringTokenizer(str, ":"); |
660 |
String current; |
|
661 |
while(st.hasMoreTokens()){ |
|
662 |
current = st.nextToken(); |
|
663 |
s.add(current); |
|
664 |
} |
|
665 |
} |
|
666 |
||
667 |
/** |
|
14061
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
13842
diff
changeset
|
668 |
* 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
|
669 |
* 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
|
670 |
* UNC paths. |
10 | 671 |
* |
672 |
* @param path Path under consideration. |
|
673 |
* @return String Properly constructed path string. |
|
674 |
*/ |
|
14061
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
13842
diff
changeset
|
675 |
public static String addTrailingFileSep(String path) { |
10 | 676 |
String fs = System.getProperty("file.separator"); |
677 |
String dblfs = fs + fs; |
|
678 |
int indexDblfs; |
|
14061
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
13842
diff
changeset
|
679 |
while ((indexDblfs = path.indexOf(dblfs, 1)) >= 0) { |
10 | 680 |
path = path.substring(0, indexDblfs) + |
681 |
path.substring(indexDblfs + fs.length()); |
|
682 |
} |
|
683 |
if (!path.endsWith(fs)) |
|
684 |
path += fs; |
|
685 |
return path; |
|
686 |
} |
|
687 |
||
688 |
/** |
|
689 |
* This checks for the validity of the options used by the user. |
|
690 |
* This works exactly like |
|
691 |
* {@link com.sun.javadoc.Doclet#validOptions(String[][], |
|
692 |
* DocErrorReporter)}. This will validate the options which are shared |
|
693 |
* by our doclets. For example, this method will flag an error using |
|
694 |
* the DocErrorReporter if user has used "-nohelp" and "-helpfile" option |
|
695 |
* together. |
|
696 |
* |
|
697 |
* @param options options used on the command line. |
|
698 |
* @param reporter used to report errors. |
|
699 |
* @return true if all the options are valid. |
|
700 |
*/ |
|
701 |
public boolean generalValidOptions(String options[][], |
|
702 |
DocErrorReporter reporter) { |
|
703 |
boolean docencodingfound = false; |
|
704 |
String encoding = ""; |
|
705 |
for (int oi = 0; oi < options.length; oi++) { |
|
706 |
String[] os = options[oi]; |
|
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19937
diff
changeset
|
707 |
String opt = StringUtils.toLowerCase(os[0]); |
16324 | 708 |
if (opt.equals("-docencoding")) { |
10 | 709 |
docencodingfound = true; |
710 |
if (!checkOutputFileEncoding(os[1], reporter)) { |
|
711 |
return false; |
|
712 |
} |
|
713 |
} else if (opt.equals("-encoding")) { |
|
714 |
encoding = os[1]; |
|
715 |
} |
|
716 |
} |
|
717 |
if (!docencodingfound && encoding.length() > 0) { |
|
718 |
if (!checkOutputFileEncoding(encoding, reporter)) { |
|
719 |
return false; |
|
720 |
} |
|
721 |
} |
|
722 |
return true; |
|
723 |
} |
|
724 |
||
725 |
/** |
|
19937
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
726 |
* Check the validity of the given profile. Return false if there are no |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
727 |
* valid packages to be documented for the profile. |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
728 |
* |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
729 |
* @param profileName the profile that needs to be validated. |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
730 |
* @return true if the profile has valid packages to be documented. |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
731 |
*/ |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
732 |
public boolean shouldDocumentProfile(String profileName) { |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
733 |
return profilePackages.containsKey(profileName); |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
734 |
} |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
735 |
|
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
736 |
/** |
10 | 737 |
* Check the validity of the given Source or Output File encoding on this |
738 |
* platform. |
|
739 |
* |
|
740 |
* @param docencoding output file encoding. |
|
741 |
* @param reporter used to report errors. |
|
742 |
*/ |
|
743 |
private boolean checkOutputFileEncoding(String docencoding, |
|
744 |
DocErrorReporter reporter) { |
|
745 |
OutputStream ost= new ByteArrayOutputStream(); |
|
746 |
OutputStreamWriter osw = null; |
|
747 |
try { |
|
748 |
osw = new OutputStreamWriter(ost, docencoding); |
|
749 |
} catch (UnsupportedEncodingException exc) { |
|
750 |
reporter.printError(getText("doclet.Encoding_not_supported", |
|
751 |
docencoding)); |
|
752 |
return false; |
|
753 |
} finally { |
|
754 |
try { |
|
755 |
if (osw != null) { |
|
756 |
osw.close(); |
|
757 |
} |
|
758 |
} catch (IOException exc) { |
|
759 |
} |
|
760 |
} |
|
761 |
return true; |
|
762 |
} |
|
763 |
||
764 |
/** |
|
765 |
* Return true if the given doc-file subdirectory should be excluded and |
|
766 |
* false otherwise. |
|
767 |
* @param docfilesubdir the doc-files subdirectory to check. |
|
768 |
*/ |
|
769 |
public boolean shouldExcludeDocFileDir(String docfilesubdir){ |
|
770 |
if (excludedDocFileDirs.contains(docfilesubdir)) { |
|
771 |
return true; |
|
772 |
} else { |
|
773 |
return false; |
|
774 |
} |
|
775 |
} |
|
776 |
||
777 |
/** |
|
778 |
* Return true if the given qualifier should be excluded and false otherwise. |
|
779 |
* @param qualifier the qualifier to check. |
|
780 |
*/ |
|
781 |
public boolean shouldExcludeQualifier(String qualifier){ |
|
782 |
if (excludedQualifiers.contains("all") || |
|
783 |
excludedQualifiers.contains(qualifier) || |
|
784 |
excludedQualifiers.contains(qualifier + ".*")) { |
|
785 |
return true; |
|
786 |
} else { |
|
787 |
int index = -1; |
|
788 |
while ((index = qualifier.indexOf(".", index + 1)) != -1) { |
|
789 |
if (excludedQualifiers.contains(qualifier.substring(0, index + 1) + "*")) { |
|
790 |
return true; |
|
791 |
} |
|
792 |
} |
|
793 |
return false; |
|
794 |
} |
|
795 |
} |
|
796 |
||
797 |
/** |
|
798 |
* Return the qualified name of the <code>ClassDoc</code> if it's qualifier is not excluded. Otherwise, |
|
799 |
* return the unqualified <code>ClassDoc</code> name. |
|
800 |
* @param cd the <code>ClassDoc</code> to check. |
|
801 |
*/ |
|
802 |
public String getClassName(ClassDoc cd) { |
|
803 |
PackageDoc pd = cd.containingPackage(); |
|
804 |
if (pd != null && shouldExcludeQualifier(cd.containingPackage().name())) { |
|
805 |
return cd.name(); |
|
806 |
} else { |
|
807 |
return cd.qualifiedName(); |
|
808 |
} |
|
809 |
} |
|
810 |
||
811 |
public String getText(String key) { |
|
812 |
try { |
|
813 |
//Check the doclet specific properties file. |
|
814 |
return getDocletSpecificMsg().getText(key); |
|
815 |
} catch (Exception e) { |
|
816 |
//Check the shared properties file. |
|
817 |
return message.getText(key); |
|
818 |
} |
|
819 |
} |
|
820 |
||
821 |
public String getText(String key, String a1) { |
|
822 |
try { |
|
823 |
//Check the doclet specific properties file. |
|
824 |
return getDocletSpecificMsg().getText(key, a1); |
|
825 |
} catch (Exception e) { |
|
826 |
//Check the shared properties file. |
|
827 |
return message.getText(key, a1); |
|
828 |
} |
|
829 |
} |
|
830 |
||
831 |
public String getText(String key, String a1, String a2) { |
|
832 |
try { |
|
833 |
//Check the doclet specific properties file. |
|
834 |
return getDocletSpecificMsg().getText(key, a1, a2); |
|
835 |
} catch (Exception e) { |
|
836 |
//Check the shared properties file. |
|
837 |
return message.getText(key, a1, a2); |
|
838 |
} |
|
839 |
} |
|
840 |
||
841 |
public String getText(String key, String a1, String a2, String a3) { |
|
842 |
try { |
|
843 |
//Check the doclet specific properties file. |
|
844 |
return getDocletSpecificMsg().getText(key, a1, a2, a3); |
|
845 |
} catch (Exception e) { |
|
846 |
//Check the shared properties file. |
|
847 |
return message.getText(key, a1, a2, a3); |
|
848 |
} |
|
849 |
} |
|
850 |
||
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17563
diff
changeset
|
851 |
public abstract Content newContent(); |
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
852 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
853 |
/** |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
854 |
* Get the configuration string as a content. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
855 |
* |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
856 |
* @param key the key to look for in the configuration file |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
857 |
* @return a content tree for the text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
858 |
*/ |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
859 |
public Content getResource(String key) { |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17563
diff
changeset
|
860 |
Content c = newContent(); |
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
861 |
c.addContent(getText(key)); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
862 |
return c; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
863 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
864 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
865 |
/** |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
866 |
* Get the configuration string as a content. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
867 |
* |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
868 |
* @param key the key to look for in the configuration file |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
869 |
* @param o string or content argument added to configuration text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
870 |
* @return a content tree for the text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
871 |
*/ |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
872 |
public Content getResource(String key, Object o) { |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
873 |
return getResource(key, o, null, null); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
874 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
875 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
876 |
/** |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
877 |
* Get the configuration string as a content. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
878 |
* |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
879 |
* @param key the key to look for in the configuration file |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
880 |
* @param o string or content argument added to configuration text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
881 |
* @return a content tree for the text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
882 |
*/ |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
883 |
public Content getResource(String key, Object o1, Object o2) { |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
884 |
return getResource(key, o1, o2, null); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
885 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
886 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
887 |
/** |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
888 |
* Get the configuration string as a content. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
889 |
* |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
890 |
* @param key the key to look for in the configuration file |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
891 |
* @param o1 string or content argument added to configuration text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
892 |
* @param o2 string or content argument added to configuration text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
893 |
* @return a content tree for the text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
894 |
*/ |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
895 |
public Content getResource(String key, Object o0, Object o1, Object o2) { |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17563
diff
changeset
|
896 |
Content c = newContent(); |
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
897 |
Pattern p = Pattern.compile("\\{([012])\\}"); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
898 |
String text = getText(key); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
899 |
Matcher m = p.matcher(text); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
900 |
int start = 0; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
901 |
while (m.find(start)) { |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
902 |
c.addContent(text.substring(start, m.start())); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
903 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
904 |
Object o = null; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
905 |
switch (m.group(1).charAt(0)) { |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
906 |
case '0': o = o0; break; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
907 |
case '1': o = o1; break; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
908 |
case '2': o = o2; break; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
909 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
910 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
911 |
if (o == null) { |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
912 |
c.addContent("{" + m.group(1) + "}"); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
913 |
} else if (o instanceof String) { |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
914 |
c.addContent((String) o); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
915 |
} else if (o instanceof Content) { |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
916 |
c.addContent((Content) o); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
917 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
918 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
919 |
start = m.end(); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
920 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
921 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
922 |
c.addContent(text.substring(start)); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
923 |
return c; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
924 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
925 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
926 |
|
10 | 927 |
/** |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
928 |
* Return true if the ClassDoc element is getting documented, depending upon |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
929 |
* -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
|
930 |
* -nodeprecated is not used. Return false if -nodeprecated is used and if |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
931 |
* either ClassDoc element is deprecated or the containing package is deprecated. |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
932 |
* |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
933 |
* @param cd the ClassDoc for which the page generation is checked |
10 | 934 |
*/ |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
935 |
public boolean isGeneratedDoc(ClassDoc cd) { |
10 | 936 |
if (!nodeprecated) { |
937 |
return true; |
|
938 |
} |
|
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
939 |
return !(Util.isDeprecated(cd) || Util.isDeprecated(cd.containingPackage())); |
10 | 940 |
} |
941 |
||
942 |
/** |
|
943 |
* Return the doclet specific instance of a writer factory. |
|
944 |
* @return the {@link WriterFactory} for the doclet. |
|
945 |
*/ |
|
946 |
public abstract WriterFactory getWriterFactory(); |
|
947 |
||
948 |
/** |
|
949 |
* Return the input stream to the builder XML. |
|
950 |
* |
|
951 |
* @return the input steam to the builder XML. |
|
952 |
* @throws FileNotFoundException when the given XML file cannot be found. |
|
953 |
*/ |
|
14544 | 954 |
public InputStream getBuilderXML() throws IOException { |
10 | 955 |
return builderXMLPath == null ? |
956 |
Configuration.class.getResourceAsStream(DEFAULT_BUILDER_XML) : |
|
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
957 |
DocFile.createFileForInput(this, builderXMLPath).openInputStream(); |
10 | 958 |
} |
959 |
||
960 |
/** |
|
1863
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1789
diff
changeset
|
961 |
* Return the Locale for this document. |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1789
diff
changeset
|
962 |
*/ |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1789
diff
changeset
|
963 |
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
|
964 |
|
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1789
diff
changeset
|
965 |
/** |
14544 | 966 |
* Return the current file manager. |
967 |
*/ |
|
968 |
public abstract JavaFileManager getFileManager(); |
|
969 |
||
970 |
/** |
|
10 | 971 |
* Return the comparator that will be used to sort member documentation. |
972 |
* To no do any sorting, return null. |
|
973 |
* |
|
974 |
* @return the {@link java.util.Comparator} used to sort members. |
|
975 |
*/ |
|
868 | 976 |
public abstract Comparator<ProgramElementDoc> getMemberComparator(); |
14542 | 977 |
|
978 |
private void setTabWidth(int n) { |
|
979 |
sourcetab = n; |
|
980 |
tabSpaces = String.format("%" + n + "s", ""); |
|
981 |
} |
|
15354 | 982 |
|
983 |
public abstract boolean showMessage(SourcePosition pos, String key); |
|
10 | 984 |
} |