author | ksrini |
Tue, 24 Apr 2018 11:54:03 -0700 | |
changeset 49879 | 601277b1d582 |
parent 48029 | e9dab2492924 |
child 50240 | b9c483223a91 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48029
diff
changeset
|
2 |
* Copyright (c) 2001, 2018, 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:
33920
diff
changeset
|
26 |
package jdk.javadoc.internal.doclets.toolkit.taglets; |
10 | 27 |
|
28 |
import java.io.*; |
|
29 |
import java.util.*; |
|
30 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
31 |
import javax.lang.model.element.Element; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
32 |
import javax.lang.model.element.ExecutableElement; |
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
33 |
import javax.lang.model.element.ModuleElement; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
34 |
import javax.lang.model.element.PackageElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
35 |
import javax.lang.model.element.TypeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
36 |
import javax.lang.model.element.VariableElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
37 |
import javax.lang.model.util.SimpleElementVisitor9; |
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14368
diff
changeset
|
38 |
import javax.tools.JavaFileManager; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
39 |
import javax.tools.StandardJavaFileManager; |
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14368
diff
changeset
|
40 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
41 |
import com.sun.source.doctree.DocTree; |
44388 | 42 |
import jdk.javadoc.doclet.Doclet; |
43 |
import jdk.javadoc.doclet.DocletEnvironment; |
|
45417 | 44 |
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47216
diff
changeset
|
45 |
import jdk.javadoc.internal.doclets.toolkit.DocletElement; |
40303 | 46 |
import jdk.javadoc.internal.doclets.toolkit.Messages; |
47 |
import jdk.javadoc.internal.doclets.toolkit.Resources; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
48 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
49 |
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
50 |
import jdk.javadoc.internal.doclets.toolkit.util.Utils; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
51 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
52 |
import static javax.tools.DocumentationTool.Location.*; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
53 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
54 |
import static com.sun.source.doctree.DocTree.Kind.*; |
14258 | 55 |
|
10 | 56 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
57 |
* Manages the {@code Taglet}s used by doclets. |
10 | 58 |
* |
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
59 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
60 |
* 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
|
61 |
* 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
|
62 |
* deletion without notice.</b> |
10 | 63 |
* |
64 |
* @author Jamie Ho |
|
65 |
*/ |
|
66 |
||
67 |
public class TagletManager { |
|
68 |
||
69 |
/** |
|
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14368
diff
changeset
|
70 |
* The default separator for the simple tag option. |
10 | 71 |
*/ |
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14368
diff
changeset
|
72 |
public static final char SIMPLE_TAGLET_OPT_SEPARATOR = ':'; |
10 | 73 |
|
74 |
/** |
|
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14368
diff
changeset
|
75 |
* The alternate separator for simple tag options. Use this |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14368
diff
changeset
|
76 |
* when you want the default separator to be in the name of the |
10 | 77 |
* custom tag. |
78 |
*/ |
|
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14368
diff
changeset
|
79 |
public static final String ALT_SIMPLE_TAGLET_OPT_SEPARATOR = "-"; |
10 | 80 |
|
81 |
/** |
|
82 |
* The map of custom tags. |
|
83 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
84 |
private final LinkedHashMap<String,Taglet> customTags; |
10 | 85 |
|
86 |
/** |
|
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
87 |
* The array of custom tags that can appear in modules. |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
88 |
*/ |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
89 |
private List<Taglet> moduleTags; |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
90 |
|
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
91 |
/** |
10 | 92 |
* The array of custom tags that can appear in packages. |
93 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
94 |
private List<Taglet> packageTags; |
10 | 95 |
|
96 |
/** |
|
97 |
* The array of custom tags that can appear in classes or interfaces. |
|
98 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
99 |
private List<Taglet> typeTags; |
10 | 100 |
|
101 |
/** |
|
102 |
* The array of custom tags that can appear in fields. |
|
103 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
104 |
private List<Taglet> fieldTags; |
10 | 105 |
|
106 |
/** |
|
107 |
* The array of custom tags that can appear in constructors. |
|
108 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
109 |
private List<Taglet> constructorTags; |
10 | 110 |
|
111 |
/** |
|
112 |
* The array of custom tags that can appear in methods. |
|
113 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
114 |
private List<Taglet> methodTags; |
10 | 115 |
|
116 |
/** |
|
117 |
* The array of custom tags that can appear in the overview. |
|
118 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
119 |
private List<Taglet> overviewTags; |
10 | 120 |
|
121 |
/** |
|
122 |
* The array of custom tags that can appear in comments. |
|
123 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
124 |
private List<Taglet> inlineTags; |
10 | 125 |
|
126 |
/** |
|
127 |
* The array of custom tags that can appear in the serialized form. |
|
128 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
129 |
private List<Taglet> serializedFormTags; |
10 | 130 |
|
44388 | 131 |
private final DocletEnvironment docEnv; |
132 |
private final Doclet doclet; |
|
133 |
||
40303 | 134 |
private final Messages messages; |
135 |
private final Resources resources; |
|
10 | 136 |
|
137 |
/** |
|
138 |
* Keep track of standard tags. |
|
139 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
140 |
private final Set<String> standardTags; |
10 | 141 |
|
142 |
/** |
|
143 |
* Keep track of standard tags in lowercase to compare for better |
|
144 |
* error messages when a tag like @docRoot is mistakenly spelled |
|
145 |
* lowercase @docroot. |
|
146 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
147 |
private final Set<String> standardTagsLowercase; |
10 | 148 |
|
149 |
/** |
|
150 |
* Keep track of overriden standard tags. |
|
151 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
152 |
private final Set<String> overridenStandardTags; |
10 | 153 |
|
154 |
/** |
|
155 |
* Keep track of the tags that may conflict |
|
156 |
* with standard tags in the future (any custom tag without |
|
157 |
* a period in its name). |
|
158 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
159 |
private final Set<String> potentiallyConflictingTags; |
10 | 160 |
|
161 |
/** |
|
162 |
* The set of unseen custom tags. |
|
163 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
164 |
private final Set<String> unseenCustomTags; |
10 | 165 |
|
166 |
/** |
|
167 |
* True if we do not want to use @since tags. |
|
168 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
169 |
private final boolean nosince; |
10 | 170 |
|
171 |
/** |
|
172 |
* True if we want to use @version tags. |
|
173 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
174 |
private final boolean showversion; |
10 | 175 |
|
176 |
/** |
|
177 |
* True if we want to use @author tags. |
|
178 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
179 |
private final boolean showauthor; |
10 | 180 |
|
181 |
/** |
|
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
48029
diff
changeset
|
182 |
* True if we want to use JavaFX-related tags (@defaultValue, @treatAsPrivate). |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
183 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
184 |
private final boolean javafx; |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
185 |
|
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
186 |
/** |
10 | 187 |
* Construct a new <code>TagletManager</code>. |
188 |
* @param nosince true if we do not want to use @since tags. |
|
189 |
* @param showversion true if we want to use @version tags. |
|
190 |
* @param showauthor true if we want to use @author tags. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
191 |
* @param javafx indicates whether javafx is active. |
44388 | 192 |
* @param configuration the configuration for this taglet manager |
10 | 193 |
*/ |
194 |
public TagletManager(boolean nosince, boolean showversion, |
|
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
195 |
boolean showauthor, boolean javafx, |
45417 | 196 |
BaseConfiguration configuration) { |
22163 | 197 |
overridenStandardTags = new HashSet<>(); |
198 |
potentiallyConflictingTags = new HashSet<>(); |
|
199 |
standardTags = new HashSet<>(); |
|
200 |
standardTagsLowercase = new HashSet<>(); |
|
201 |
unseenCustomTags = new HashSet<>(); |
|
202 |
customTags = new LinkedHashMap<>(); |
|
10 | 203 |
this.nosince = nosince; |
204 |
this.showversion = showversion; |
|
205 |
this.showauthor = showauthor; |
|
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
206 |
this.javafx = javafx; |
44388 | 207 |
this.docEnv = configuration.docEnv; |
208 |
this.doclet = configuration.doclet; |
|
40303 | 209 |
this.messages = configuration.getMessages(); |
210 |
this.resources = configuration.getResources(); |
|
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
211 |
initStandardTaglets(); |
10 | 212 |
initStandardTagsLowercase(); |
213 |
} |
|
214 |
||
215 |
/** |
|
216 |
* Add a new <code>CustomTag</code>. This is used to add a Taglet from within |
|
217 |
* a Doclet. No message is printed to indicate that the Taglet is properly |
|
218 |
* registered because these Taglets are typically added for every execution of the |
|
219 |
* Doclet. We don't want to see this type of error message every time. |
|
220 |
* @param customTag the new <code>CustomTag</code> to add. |
|
221 |
*/ |
|
222 |
public void addCustomTag(Taglet customTag) { |
|
223 |
if (customTag != null) { |
|
224 |
String name = customTag.getName(); |
|
225 |
if (customTags.containsKey(name)) { |
|
226 |
customTags.remove(name); |
|
227 |
} |
|
228 |
customTags.put(name, customTag); |
|
229 |
checkTagName(name); |
|
230 |
} |
|
231 |
} |
|
232 |
||
21500
475e59d3b40c
8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
18659
diff
changeset
|
233 |
public Set<String> getCustomTagNames() { |
475e59d3b40c
8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
18659
diff
changeset
|
234 |
return customTags.keySet(); |
475e59d3b40c
8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
18659
diff
changeset
|
235 |
} |
475e59d3b40c
8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
18659
diff
changeset
|
236 |
|
10 | 237 |
/** |
238 |
* Add a new <code>Taglet</code>. Print a message to indicate whether or not |
|
239 |
* the Taglet was registered properly. |
|
240 |
* @param classname the name of the class representing the custom tag. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
241 |
* @param fileManager the filemanager to load classes and resources. |
10 | 242 |
* @param tagletPath the path to the class representing the custom tag. |
243 |
*/ |
|
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14368
diff
changeset
|
244 |
public void addCustomTag(String classname, JavaFileManager fileManager, String tagletPath) { |
10 | 245 |
try { |
44388 | 246 |
ClassLoader tagClassLoader; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
247 |
if (!fileManager.hasLocation(TAGLET_PATH)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
248 |
List<File> paths = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
249 |
if (tagletPath != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
250 |
for (String pathname : tagletPath.split(File.pathSeparator)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
251 |
paths.add(new File(pathname)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
252 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
253 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
254 |
if (fileManager instanceof StandardJavaFileManager) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
255 |
((StandardJavaFileManager) fileManager).setLocation(TAGLET_PATH, paths); |
10 | 256 |
} |
257 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
258 |
tagClassLoader = fileManager.getClassLoader(TAGLET_PATH); |
44388 | 259 |
Class<? extends jdk.javadoc.doclet.Taglet> customTagClass = |
260 |
tagClassLoader.loadClass(classname).asSubclass(jdk.javadoc.doclet.Taglet.class); |
|
261 |
jdk.javadoc.doclet.Taglet instance = customTagClass.getConstructor().newInstance(); |
|
262 |
instance.init(docEnv, doclet); |
|
263 |
Taglet newLegacy = new UserTaglet(instance); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
264 |
String tname = newLegacy.getName(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
265 |
Taglet t = customTags.get(tname); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
266 |
if (t != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
267 |
customTags.remove(tname); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
268 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
269 |
customTags.put(tname, newLegacy); |
40303 | 270 |
messages.notice("doclet.Notice_taglet_registered", classname); |
10 | 271 |
} catch (Exception exc) { |
40303 | 272 |
messages.error("doclet.Error_taglet_not_registered", exc.getClass().getName(), classname); |
10 | 273 |
} |
274 |
} |
|
275 |
||
276 |
/** |
|
277 |
* Add a new <code>SimpleTaglet</code>. If this tag already exists |
|
278 |
* and the header passed as an argument is null, move tag to the back of the |
|
279 |
* list. If this tag already exists and the header passed as an argument is |
|
280 |
* not null, overwrite previous tag with new one. Otherwise, add new |
|
281 |
* SimpleTaglet to list. |
|
282 |
* @param tagName the name of this tag |
|
283 |
* @param header the header to output. |
|
284 |
* @param locations the possible locations that this tag |
|
285 |
* can appear in. |
|
286 |
*/ |
|
287 |
public void addNewSimpleCustomTag(String tagName, String header, String locations) { |
|
288 |
if (tagName == null || locations == null) { |
|
289 |
return; |
|
290 |
} |
|
868 | 291 |
Taglet tag = customTags.get(tagName); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
292 |
locations = Utils.toLowerCase(locations); |
10 | 293 |
if (tag == null || header != null) { |
294 |
customTags.remove(tagName); |
|
295 |
customTags.put(tagName, new SimpleTaglet(tagName, header, locations)); |
|
296 |
if (locations != null && locations.indexOf('x') == -1) { |
|
297 |
checkTagName(tagName); |
|
298 |
} |
|
299 |
} else { |
|
300 |
//Move to back |
|
301 |
customTags.remove(tagName); |
|
302 |
customTags.put(tagName, tag); |
|
303 |
} |
|
304 |
} |
|
305 |
||
306 |
/** |
|
307 |
* Given a tag name, add it to the set of tags it belongs to. |
|
308 |
*/ |
|
309 |
private void checkTagName(String name) { |
|
310 |
if (standardTags.contains(name)) { |
|
311 |
overridenStandardTags.add(name); |
|
312 |
} else { |
|
313 |
if (name.indexOf('.') == -1) { |
|
314 |
potentiallyConflictingTags.add(name); |
|
315 |
} |
|
316 |
unseenCustomTags.add(name); |
|
317 |
} |
|
318 |
} |
|
319 |
||
320 |
/** |
|
321 |
* Check the taglet to see if it is a legacy taglet. Also |
|
322 |
* check its name for errors. |
|
323 |
*/ |
|
324 |
private void checkTaglet(Object taglet) { |
|
325 |
if (taglet instanceof Taglet) { |
|
326 |
checkTagName(((Taglet) taglet).getName()); |
|
44189 | 327 |
} else if (taglet instanceof jdk.javadoc.doclet.Taglet) { |
328 |
jdk.javadoc.doclet.Taglet legacyTaglet = (jdk.javadoc.doclet.Taglet) taglet; |
|
10 | 329 |
customTags.remove(legacyTaglet.getName()); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
330 |
customTags.put(legacyTaglet.getName(), new UserTaglet(legacyTaglet)); |
10 | 331 |
checkTagName(legacyTaglet.getName()); |
332 |
} else { |
|
333 |
throw new IllegalArgumentException("Given object is not a taglet."); |
|
334 |
} |
|
335 |
} |
|
336 |
||
337 |
/** |
|
338 |
* Given a name of a seen custom tag, remove it from the set of unseen |
|
339 |
* custom tags. |
|
340 |
* @param name the name of the seen custom tag. |
|
341 |
*/ |
|
342 |
public void seenCustomTag(String name) { |
|
343 |
unseenCustomTags.remove(name); |
|
344 |
} |
|
345 |
||
346 |
/** |
|
347 |
* Given an array of <code>Tag</code>s, check for spelling mistakes. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
348 |
* @param utils the utility class to use |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
349 |
* @param element the tags holder |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
350 |
* @param trees the trees containing the comments |
10 | 351 |
* @param areInlineTags true if the array of tags are inline and false otherwise. |
352 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
353 |
public void checkTags(final Utils utils, Element element, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
354 |
Iterable<? extends DocTree> trees, boolean areInlineTags) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
355 |
if (trees == null) { |
10 | 356 |
return; |
357 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
358 |
CommentHelper ch = utils.getCommentHelper(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
359 |
for (DocTree tag : trees) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
360 |
String name = tag.getKind().tagName; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
361 |
if (name == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
362 |
continue; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
363 |
} |
10 | 364 |
if (name.length() > 0 && name.charAt(0) == '@') { |
365 |
name = name.substring(1, name.length()); |
|
366 |
} |
|
367 |
if (! (standardTags.contains(name) || customTags.containsKey(name))) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
368 |
if (standardTagsLowercase.contains(Utils.toLowerCase(name))) { |
40303 | 369 |
messages.warning(ch.getDocTreePath(tag), "doclet.UnknownTagLowercase", ch.getTagName(tag)); |
10 | 370 |
continue; |
371 |
} else { |
|
40303 | 372 |
messages.warning(ch.getDocTreePath(tag), "doclet.UnknownTag", ch.getTagName(tag)); |
10 | 373 |
continue; |
374 |
} |
|
375 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
376 |
final Taglet taglet = customTags.get(name); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
377 |
// Check and verify tag usage |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
378 |
if (taglet != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
379 |
if (areInlineTags && !taglet.isInlineTag()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
380 |
printTagMisuseWarn(ch, taglet, tag, "inline"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
381 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
382 |
// nothing more to do |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
383 |
if (element == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
384 |
return; |
10 | 385 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
386 |
new SimpleElementVisitor9<Void, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40303
diff
changeset
|
387 |
@Override |
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
388 |
public Void visitModule(ModuleElement e, Void p) { |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
389 |
if (!taglet.inModule()) { |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
390 |
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "module"); |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
391 |
} |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
392 |
return null; |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
393 |
} |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
394 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40303
diff
changeset
|
395 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
396 |
public Void visitPackage(PackageElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
397 |
if (!taglet.inPackage()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
398 |
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "package"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
399 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
400 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
401 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
402 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40303
diff
changeset
|
403 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
404 |
public Void visitType(TypeElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
405 |
if (!taglet.inType()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
406 |
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "class"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
407 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
408 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
409 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
410 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40303
diff
changeset
|
411 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
412 |
public Void visitExecutable(ExecutableElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
413 |
if (utils.isConstructor(e) && !taglet.inConstructor()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
414 |
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "constructor"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
415 |
} else if (!taglet.inMethod()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
416 |
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "method"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
417 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
418 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
419 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
420 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40303
diff
changeset
|
421 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
422 |
public Void visitVariable(VariableElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
423 |
if (utils.isField(e) && !taglet.inField()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
424 |
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "field"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
425 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
426 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
427 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
428 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40303
diff
changeset
|
429 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
430 |
public Void visitUnknown(Element e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
431 |
if (utils.isOverviewElement(e) && !taglet.inOverview()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
432 |
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "overview"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
433 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
434 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
435 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
436 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40303
diff
changeset
|
437 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
438 |
protected Void defaultAction(Element e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
439 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
440 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
441 |
}.visit(element); |
10 | 442 |
} |
443 |
} |
|
444 |
} |
|
445 |
||
446 |
/** |
|
447 |
* Given the taglet, the tag and the type of documentation that the tag |
|
448 |
* was found in, print a tag misuse warning. |
|
449 |
* @param taglet the taglet representing the misused tag. |
|
450 |
* @param tag the misused tag. |
|
451 |
* @param holderType the type of documentation that the misused tag was found in. |
|
452 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
453 |
private void printTagMisuseWarn(CommentHelper ch, Taglet taglet, DocTree tag, String holderType) { |
22163 | 454 |
Set<String> locationsSet = new LinkedHashSet<>(); |
10 | 455 |
if (taglet.inOverview()) { |
456 |
locationsSet.add("overview"); |
|
457 |
} |
|
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
458 |
if (taglet.inModule()) { |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
459 |
locationsSet.add("module"); |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
460 |
} |
10 | 461 |
if (taglet.inPackage()) { |
462 |
locationsSet.add("package"); |
|
463 |
} |
|
464 |
if (taglet.inType()) { |
|
465 |
locationsSet.add("class/interface"); |
|
466 |
} |
|
467 |
if (taglet.inConstructor()) { |
|
468 |
locationsSet.add("constructor"); |
|
469 |
} |
|
470 |
if (taglet.inField()) { |
|
471 |
locationsSet.add("field"); |
|
472 |
} |
|
473 |
if (taglet.inMethod()) { |
|
474 |
locationsSet.add("method"); |
|
475 |
} |
|
476 |
if (taglet.isInlineTag()) { |
|
477 |
locationsSet.add("inline text"); |
|
478 |
} |
|
868 | 479 |
String[] locations = locationsSet.toArray(new String[]{}); |
10 | 480 |
if (locations == null || locations.length == 0) { |
481 |
//This known tag is excluded. |
|
482 |
return; |
|
483 |
} |
|
14263 | 484 |
StringBuilder combined_locations = new StringBuilder(); |
10 | 485 |
for (int i = 0; i < locations.length; i++) { |
486 |
if (i > 0) { |
|
487 |
combined_locations.append(", "); |
|
488 |
} |
|
489 |
combined_locations.append(locations[i]); |
|
490 |
} |
|
40303 | 491 |
messages.warning(ch.getDocTreePath(tag), "doclet.tag_misuse", |
10 | 492 |
"@" + taglet.getName(), holderType, combined_locations.toString()); |
493 |
} |
|
494 |
||
495 |
/** |
|
496 |
* Return the array of <code>Taglet</code>s that can |
|
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
497 |
* appear in modules. |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
498 |
* @return the array of <code>Taglet</code>s that can |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
499 |
* appear in modules. |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
500 |
*/ |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
501 |
public List<Taglet> getModuleCustomTaglets() { |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
502 |
if (moduleTags == null) { |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
503 |
initCustomTaglets(); |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
504 |
} |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
505 |
return moduleTags; |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
506 |
} |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
507 |
|
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
508 |
/** |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
509 |
* Return the array of <code>Taglet</code>s that can |
10 | 510 |
* appear in packages. |
511 |
* @return the array of <code>Taglet</code>s that can |
|
512 |
* appear in packages. |
|
513 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
514 |
public List<Taglet> getPackageCustomTaglets() { |
10 | 515 |
if (packageTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
516 |
initCustomTaglets(); |
10 | 517 |
} |
518 |
return packageTags; |
|
519 |
} |
|
520 |
||
521 |
/** |
|
522 |
* Return the array of <code>Taglet</code>s that can |
|
523 |
* appear in classes or interfaces. |
|
524 |
* @return the array of <code>Taglet</code>s that can |
|
525 |
* appear in classes or interfaces. |
|
526 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
527 |
public List<Taglet> getTypeCustomTaglets() { |
10 | 528 |
if (typeTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
529 |
initCustomTaglets(); |
10 | 530 |
} |
531 |
return typeTags; |
|
532 |
} |
|
533 |
||
534 |
/** |
|
535 |
* Return the array of inline <code>Taglet</code>s that can |
|
536 |
* appear in comments. |
|
537 |
* @return the array of <code>Taglet</code>s that can |
|
538 |
* appear in comments. |
|
539 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
540 |
public List<Taglet> getInlineCustomTaglets() { |
10 | 541 |
if (inlineTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
542 |
initCustomTaglets(); |
10 | 543 |
} |
544 |
return inlineTags; |
|
545 |
} |
|
546 |
||
547 |
/** |
|
548 |
* Return the array of <code>Taglet</code>s that can |
|
549 |
* appear in fields. |
|
550 |
* @return the array of <code>Taglet</code>s that can |
|
551 |
* appear in field. |
|
552 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
553 |
public List<Taglet> getFieldCustomTaglets() { |
10 | 554 |
if (fieldTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
555 |
initCustomTaglets(); |
10 | 556 |
} |
557 |
return fieldTags; |
|
558 |
} |
|
559 |
||
560 |
/** |
|
561 |
* Return the array of <code>Taglet</code>s that can |
|
562 |
* appear in the serialized form. |
|
563 |
* @return the array of <code>Taglet</code>s that can |
|
564 |
* appear in the serialized form. |
|
565 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
566 |
public List<Taglet> getSerializedFormTaglets() { |
10 | 567 |
if (serializedFormTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
568 |
initCustomTaglets(); |
10 | 569 |
} |
570 |
return serializedFormTags; |
|
571 |
} |
|
572 |
||
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47216
diff
changeset
|
573 |
@SuppressWarnings("fallthrough") |
10 | 574 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
575 |
* Returns the custom tags for a given element. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
576 |
* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
577 |
* @param e the element to get custom tags for |
10 | 578 |
* @return the array of <code>Taglet</code>s that can |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
579 |
* appear in the given element. |
10 | 580 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
581 |
public List<Taglet> getCustomTaglets(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
582 |
switch (e.getKind()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
583 |
case CONSTRUCTOR: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
584 |
return getConstructorCustomTaglets(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
585 |
case METHOD: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
586 |
return getMethodCustomTaglets(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
587 |
case ENUM_CONSTANT: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
588 |
case FIELD: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
589 |
return getFieldCustomTaglets(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
590 |
case ANNOTATION_TYPE: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
591 |
case INTERFACE: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
592 |
case CLASS: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
593 |
case ENUM: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
594 |
return getTypeCustomTaglets(); |
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
595 |
case MODULE: |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
596 |
return getModuleCustomTaglets(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
597 |
case PACKAGE: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
598 |
return getPackageCustomTaglets(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
599 |
case OTHER: |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47216
diff
changeset
|
600 |
if (e instanceof DocletElement) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47216
diff
changeset
|
601 |
DocletElement de = (DocletElement)e; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47216
diff
changeset
|
602 |
switch (de.getSubKind()) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47216
diff
changeset
|
603 |
case DOCFILE: |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47216
diff
changeset
|
604 |
return getPackageCustomTaglets(); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47216
diff
changeset
|
605 |
case OVERVIEW: |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47216
diff
changeset
|
606 |
return getOverviewCustomTaglets(); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47216
diff
changeset
|
607 |
default: |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47216
diff
changeset
|
608 |
// fall through |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47216
diff
changeset
|
609 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47216
diff
changeset
|
610 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
611 |
default: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
612 |
throw new AssertionError("unknown element: " + e + " ,kind: " + e.getKind()); |
10 | 613 |
} |
614 |
} |
|
615 |
||
616 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
617 |
* Return a List of <code>Taglet</code>s that can |
10 | 618 |
* appear in constructors. |
619 |
* @return the array of <code>Taglet</code>s that can |
|
620 |
* appear in constructors. |
|
621 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
622 |
public List<Taglet> getConstructorCustomTaglets() { |
10 | 623 |
if (constructorTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
624 |
initCustomTaglets(); |
10 | 625 |
} |
626 |
return constructorTags; |
|
627 |
} |
|
628 |
||
629 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
630 |
* Return a List of <code>Taglet</code>s that can |
10 | 631 |
* appear in methods. |
632 |
* @return the array of <code>Taglet</code>s that can |
|
633 |
* appear in methods. |
|
634 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
635 |
public List<Taglet> getMethodCustomTaglets() { |
10 | 636 |
if (methodTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
637 |
initCustomTaglets(); |
10 | 638 |
} |
639 |
return methodTags; |
|
640 |
} |
|
641 |
||
642 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
643 |
* Return a List of <code>Taglet</code>s that can |
10 | 644 |
* appear in an overview. |
645 |
* @return the array of <code>Taglet</code>s that can |
|
646 |
* appear in overview. |
|
647 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
648 |
public List<Taglet> getOverviewCustomTaglets() { |
10 | 649 |
if (overviewTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
650 |
initCustomTaglets(); |
10 | 651 |
} |
652 |
return overviewTags; |
|
653 |
} |
|
654 |
||
655 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
656 |
* Initialize the custom tag Lists. |
10 | 657 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
658 |
private void initCustomTaglets() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
659 |
|
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
660 |
moduleTags = new ArrayList<>(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
661 |
packageTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
662 |
typeTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
663 |
fieldTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
664 |
constructorTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
665 |
methodTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
666 |
inlineTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
667 |
overviewTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
668 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
669 |
for (Taglet current : customTags.values()) { |
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
670 |
if (current.inModule() && !current.isInlineTag()) { |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
671 |
moduleTags.add(current); |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
672 |
} |
10 | 673 |
if (current.inPackage() && !current.isInlineTag()) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
674 |
packageTags.add(current); |
10 | 675 |
} |
676 |
if (current.inType() && !current.isInlineTag()) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
677 |
typeTags.add(current); |
10 | 678 |
} |
679 |
if (current.inField() && !current.isInlineTag()) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
680 |
fieldTags.add(current); |
10 | 681 |
} |
682 |
if (current.inConstructor() && !current.isInlineTag()) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
683 |
constructorTags.add(current); |
10 | 684 |
} |
685 |
if (current.inMethod() && !current.isInlineTag()) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
686 |
methodTags.add(current); |
10 | 687 |
} |
688 |
if (current.isInlineTag()) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
689 |
inlineTags.add(current); |
10 | 690 |
} |
691 |
if (current.inOverview() && !current.isInlineTag()) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
692 |
overviewTags.add(current); |
10 | 693 |
} |
694 |
} |
|
695 |
||
696 |
//Init the serialized form tags |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
697 |
serializedFormTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
698 |
serializedFormTags.add(customTags.get(SERIAL_DATA.tagName)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
699 |
serializedFormTags.add(customTags.get(THROWS.tagName)); |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
5520
diff
changeset
|
700 |
if (!nosince) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
701 |
serializedFormTags.add(customTags.get(SINCE.tagName)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
702 |
serializedFormTags.add(customTags.get(SEE.tagName)); |
10 | 703 |
} |
704 |
||
705 |
/** |
|
706 |
* Initialize standard Javadoc tags for ordering purposes. |
|
707 |
*/ |
|
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
708 |
private void initStandardTaglets() { |
18659
5fe5650da7f9
8015720: since tag isn't copied while generating JavaFX documentation
janvalenta
parents:
17573
diff
changeset
|
709 |
if (javafx) { |
5fe5650da7f9
8015720: since tag isn't copied while generating JavaFX documentation
janvalenta
parents:
17573
diff
changeset
|
710 |
initJavaFXTaglets(); |
5fe5650da7f9
8015720: since tag isn't copied while generating JavaFX documentation
janvalenta
parents:
17573
diff
changeset
|
711 |
} |
5fe5650da7f9
8015720: since tag isn't copied while generating JavaFX documentation
janvalenta
parents:
17573
diff
changeset
|
712 |
|
10 | 713 |
Taglet temp; |
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
714 |
addStandardTaglet(new ParamTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
715 |
addStandardTaglet(new ReturnTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
716 |
addStandardTaglet(new ThrowsTaglet()); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
717 |
addStandardTaglet(new SimpleTaglet(EXCEPTION.tagName, null, |
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
718 |
SimpleTaglet.METHOD + SimpleTaglet.CONSTRUCTOR)); |
40303 | 719 |
addStandardTaglet(!nosince, new SimpleTaglet(SINCE.tagName, resources.getText("doclet.Since"), |
37009
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
720 |
SimpleTaglet.ALL)); |
40303 | 721 |
addStandardTaglet(showversion, new SimpleTaglet(VERSION.tagName, resources.getText("doclet.Version"), |
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
722 |
SimpleTaglet.MODULE + SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW)); |
40303 | 723 |
addStandardTaglet(showauthor, new SimpleTaglet(AUTHOR.tagName, resources.getText("doclet.Author"), |
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37759
diff
changeset
|
724 |
SimpleTaglet.MODULE + SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW)); |
40303 | 725 |
addStandardTaglet(new SimpleTaglet(SERIAL_DATA.tagName, resources.getText("doclet.SerialData"), |
37009
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
726 |
SimpleTaglet.EXCLUDED)); |
40303 | 727 |
addStandardTaglet(new SimpleTaglet(HIDDEN.tagName, resources.getText("doclet.Hidden"), |
37009
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
728 |
SimpleTaglet.FIELD + SimpleTaglet.METHOD + SimpleTaglet.TYPE)); |
40303 | 729 |
customTags.put((temp = new SimpleTaglet("factory", resources.getText("doclet.Factory"), |
37009
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
730 |
SimpleTaglet.METHOD)).getName(), temp); |
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
731 |
addStandardTaglet(new SeeTaglet()); |
10 | 732 |
//Standard inline tags |
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
733 |
addStandardTaglet(new DocRootTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
734 |
addStandardTaglet(new InheritDocTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
735 |
addStandardTaglet(new ValueTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
736 |
addStandardTaglet(new LiteralTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
737 |
addStandardTaglet(new CodeTaglet()); |
33920 | 738 |
addStandardTaglet(new IndexTaglet()); |
46184
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
45417
diff
changeset
|
739 |
addStandardTaglet(new SummaryTaglet()); |
10 | 740 |
|
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
741 |
// Keep track of the names of standard tags for error |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
742 |
// checking purposes. The following are not handled above. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
743 |
standardTags.add(DEPRECATED.tagName); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
744 |
standardTags.add(LINK.tagName); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
745 |
standardTags.add(LINK_PLAIN.tagName); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
746 |
standardTags.add(SERIAL.tagName); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
747 |
standardTags.add(SERIAL_FIELD.tagName); |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
748 |
} |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
749 |
|
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
750 |
/** |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
751 |
* Initialize JavaFX-related tags. |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
752 |
*/ |
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
753 |
private void initJavaFXTaglets() { |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
754 |
addStandardTaglet(new PropertyGetterTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
755 |
addStandardTaglet(new PropertySetterTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
756 |
addStandardTaglet(new SimpleTaglet("propertyDescription", |
40303 | 757 |
resources.getText("doclet.PropertyDescription"), |
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
758 |
SimpleTaglet.FIELD + SimpleTaglet.METHOD)); |
40303 | 759 |
addStandardTaglet(new SimpleTaglet("defaultValue", resources.getText("doclet.DefaultValue"), |
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
760 |
SimpleTaglet.FIELD + SimpleTaglet.METHOD)); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
761 |
addStandardTaglet(new SimpleTaglet("treatAsPrivate", null, |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
762 |
SimpleTaglet.FIELD + SimpleTaglet.METHOD + SimpleTaglet.TYPE)); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
763 |
} |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
764 |
|
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
765 |
void addStandardTaglet(Taglet taglet) { |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
766 |
String name = taglet.getName(); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
767 |
customTags.put(name, taglet); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
768 |
standardTags.add(name); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
769 |
} |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
770 |
|
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
771 |
void addStandardTaglet(boolean enable, Taglet taglet) { |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
772 |
String name = taglet.getName(); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
773 |
if (enable) |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
774 |
customTags.put(name, taglet); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
775 |
standardTags.add(name); |
10 | 776 |
} |
777 |
||
778 |
/** |
|
779 |
* Initialize lowercase version of standard Javadoc tags. |
|
780 |
*/ |
|
781 |
private void initStandardTagsLowercase() { |
|
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
782 |
for (String standardTag : standardTags) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
783 |
standardTagsLowercase.add(Utils.toLowerCase(standardTag)); |
10 | 784 |
} |
785 |
} |
|
786 |
||
787 |
public boolean isKnownCustomTag(String tagName) { |
|
788 |
return customTags.containsKey(tagName); |
|
789 |
} |
|
790 |
||
791 |
/** |
|
792 |
* Print a list of {@link Taglet}s that might conflict with |
|
793 |
* standard tags in the future and a list of standard tags |
|
794 |
* that have been overriden. |
|
795 |
*/ |
|
796 |
public void printReport() { |
|
797 |
printReportHelper("doclet.Notice_taglet_conflict_warn", potentiallyConflictingTags); |
|
798 |
printReportHelper("doclet.Notice_taglet_overriden", overridenStandardTags); |
|
799 |
printReportHelper("doclet.Notice_taglet_unseen", unseenCustomTags); |
|
800 |
} |
|
801 |
||
868 | 802 |
private void printReportHelper(String noticeKey, Set<String> names) { |
10 | 803 |
if (names.size() > 0) { |
868 | 804 |
String[] namesArray = names.toArray(new String[] {}); |
10 | 805 |
String result = " "; |
806 |
for (int i = 0; i < namesArray.length; i++) { |
|
807 |
result += "@" + namesArray[i]; |
|
808 |
if (i + 1 < namesArray.length) { |
|
809 |
result += ", "; |
|
810 |
} |
|
811 |
} |
|
40303 | 812 |
messages.notice(noticeKey, result); |
10 | 813 |
} |
814 |
} |
|
815 |
||
816 |
/** |
|
817 |
* Given the name of a tag, return the corresponding taglet. |
|
818 |
* Return null if the tag is unknown. |
|
819 |
* |
|
820 |
* @param name the name of the taglet to retrieve. |
|
821 |
* @return return the corresponding taglet. Return null if the tag is |
|
822 |
* unknown. |
|
823 |
*/ |
|
824 |
public Taglet getTaglet(String name) { |
|
825 |
if (name.indexOf("@") == 0) { |
|
868 | 826 |
return customTags.get(name.substring(1)); |
10 | 827 |
} else { |
868 | 828 |
return customTags.get(name); |
10 | 829 |
} |
830 |
||
831 |
} |
|
832 |
} |