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