author | ksrini |
Mon, 02 May 2016 15:01:54 -0700 | |
changeset 37757 | f38cc75b6fa0 |
parent 37009 | 476d8d615222 |
child 37759 | f0b5daef41b6 |
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); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
249 |
Object instance = customTagClass.newInstance(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
250 |
Taglet newLegacy = new UserTaglet((jdk.javadoc.doclet.taglet.Taglet)instance); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
251 |
String tname = newLegacy.getName(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
252 |
Taglet t = customTags.get(tname); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
253 |
if (t != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
254 |
customTags.remove(tname); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
255 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
256 |
customTags.put(tname, newLegacy); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
257 |
message.notice("doclet.Notice_taglet_registered", classname); |
10 | 258 |
} catch (Exception exc) { |
259 |
message.error("doclet.Error_taglet_not_registered", exc.getClass().getName(), classname); |
|
260 |
} |
|
261 |
} |
|
262 |
||
263 |
/** |
|
264 |
* Add a new <code>SimpleTaglet</code>. If this tag already exists |
|
265 |
* and the header passed as an argument is null, move tag to the back of the |
|
266 |
* list. If this tag already exists and the header passed as an argument is |
|
267 |
* not null, overwrite previous tag with new one. Otherwise, add new |
|
268 |
* SimpleTaglet to list. |
|
269 |
* @param tagName the name of this tag |
|
270 |
* @param header the header to output. |
|
271 |
* @param locations the possible locations that this tag |
|
272 |
* can appear in. |
|
273 |
*/ |
|
274 |
public void addNewSimpleCustomTag(String tagName, String header, String locations) { |
|
275 |
if (tagName == null || locations == null) { |
|
276 |
return; |
|
277 |
} |
|
868 | 278 |
Taglet tag = customTags.get(tagName); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
279 |
locations = Utils.toLowerCase(locations); |
10 | 280 |
if (tag == null || header != null) { |
281 |
customTags.remove(tagName); |
|
282 |
customTags.put(tagName, new SimpleTaglet(tagName, header, locations)); |
|
283 |
if (locations != null && locations.indexOf('x') == -1) { |
|
284 |
checkTagName(tagName); |
|
285 |
} |
|
286 |
} else { |
|
287 |
//Move to back |
|
288 |
customTags.remove(tagName); |
|
289 |
customTags.put(tagName, tag); |
|
290 |
} |
|
291 |
} |
|
292 |
||
293 |
/** |
|
294 |
* Given a tag name, add it to the set of tags it belongs to. |
|
295 |
*/ |
|
296 |
private void checkTagName(String name) { |
|
297 |
if (standardTags.contains(name)) { |
|
298 |
overridenStandardTags.add(name); |
|
299 |
} else { |
|
300 |
if (name.indexOf('.') == -1) { |
|
301 |
potentiallyConflictingTags.add(name); |
|
302 |
} |
|
303 |
unseenCustomTags.add(name); |
|
304 |
} |
|
305 |
} |
|
306 |
||
307 |
/** |
|
308 |
* Check the taglet to see if it is a legacy taglet. Also |
|
309 |
* check its name for errors. |
|
310 |
*/ |
|
311 |
private void checkTaglet(Object taglet) { |
|
312 |
if (taglet instanceof Taglet) { |
|
313 |
checkTagName(((Taglet) taglet).getName()); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
314 |
} else if (taglet instanceof jdk.javadoc.doclet.taglet.Taglet) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
315 |
jdk.javadoc.doclet.taglet.Taglet legacyTaglet = (jdk.javadoc.doclet.taglet.Taglet) taglet; |
10 | 316 |
customTags.remove(legacyTaglet.getName()); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
317 |
customTags.put(legacyTaglet.getName(), new UserTaglet(legacyTaglet)); |
10 | 318 |
checkTagName(legacyTaglet.getName()); |
319 |
} else { |
|
320 |
throw new IllegalArgumentException("Given object is not a taglet."); |
|
321 |
} |
|
322 |
} |
|
323 |
||
324 |
/** |
|
325 |
* Given a name of a seen custom tag, remove it from the set of unseen |
|
326 |
* custom tags. |
|
327 |
* @param name the name of the seen custom tag. |
|
328 |
*/ |
|
329 |
public void seenCustomTag(String name) { |
|
330 |
unseenCustomTags.remove(name); |
|
331 |
} |
|
332 |
||
333 |
/** |
|
334 |
* 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
|
335 |
* @param utils the utility class to use |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
336 |
* @param element the tags holder |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
337 |
* @param trees the trees containing the comments |
10 | 338 |
* @param areInlineTags true if the array of tags are inline and false otherwise. |
339 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
340 |
public void checkTags(final Utils utils, Element element, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
341 |
Iterable<? extends DocTree> trees, boolean areInlineTags) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
342 |
if (trees == null) { |
10 | 343 |
return; |
344 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
345 |
CommentHelper ch = utils.getCommentHelper(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
346 |
for (DocTree tag : trees) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
347 |
String name = tag.getKind().tagName; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
348 |
if (name == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
349 |
continue; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
350 |
} |
10 | 351 |
if (name.length() > 0 && name.charAt(0) == '@') { |
352 |
name = name.substring(1, name.length()); |
|
353 |
} |
|
354 |
if (! (standardTags.contains(name) || customTags.containsKey(name))) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
355 |
if (standardTagsLowercase.contains(Utils.toLowerCase(name))) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
356 |
message.warning(ch.getDocTreePath(tag), "doclet.UnknownTagLowercase", ch.getTagName(tag)); |
10 | 357 |
continue; |
358 |
} else { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
359 |
message.warning(ch.getDocTreePath(tag), "doclet.UnknownTag", ch.getTagName(tag)); |
10 | 360 |
continue; |
361 |
} |
|
362 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
363 |
final Taglet taglet = customTags.get(name); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
364 |
// Check and verify tag usage |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
365 |
if (taglet != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
366 |
if (areInlineTags && !taglet.isInlineTag()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
367 |
printTagMisuseWarn(ch, taglet, tag, "inline"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
368 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
369 |
// nothing more to do |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
370 |
if (element == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
371 |
return; |
10 | 372 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
373 |
new SimpleElementVisitor9<Void, Void>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
374 |
@Override @DefinedBy(Api.LANGUAGE_MODEL) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
375 |
public Void visitPackage(PackageElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
376 |
if (!taglet.inPackage()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
377 |
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "package"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
378 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
379 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
380 |
} |
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 |
@Override @DefinedBy(Api.LANGUAGE_MODEL) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
383 |
public Void visitType(TypeElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
384 |
if (!taglet.inType()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
385 |
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "class"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
386 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
387 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
388 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
389 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
390 |
@Override @DefinedBy(Api.LANGUAGE_MODEL) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
391 |
public Void visitExecutable(ExecutableElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
392 |
if (utils.isConstructor(e) && !taglet.inConstructor()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
393 |
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "constructor"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
394 |
} else if (!taglet.inMethod()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
395 |
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "method"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
396 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
397 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
398 |
} |
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 |
@Override @DefinedBy(Api.LANGUAGE_MODEL) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
401 |
public Void visitVariable(VariableElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
402 |
if (utils.isField(e) && !taglet.inField()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
403 |
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "field"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
404 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
405 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
406 |
} |
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 |
@Override @DefinedBy(Api.LANGUAGE_MODEL) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
409 |
public Void visitUnknown(Element e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
410 |
if (utils.isOverviewElement(e) && !taglet.inOverview()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
411 |
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "overview"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
412 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
413 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
414 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
415 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
416 |
@Override @DefinedBy(Api.LANGUAGE_MODEL) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
417 |
protected Void defaultAction(Element e, Void p) { |
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 |
}.visit(element); |
10 | 421 |
} |
422 |
} |
|
423 |
} |
|
424 |
||
425 |
/** |
|
426 |
* Given the taglet, the tag and the type of documentation that the tag |
|
427 |
* was found in, print a tag misuse warning. |
|
428 |
* @param taglet the taglet representing the misused tag. |
|
429 |
* @param tag the misused tag. |
|
430 |
* @param holderType the type of documentation that the misused tag was found in. |
|
431 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
432 |
private void printTagMisuseWarn(CommentHelper ch, Taglet taglet, DocTree tag, String holderType) { |
22163 | 433 |
Set<String> locationsSet = new LinkedHashSet<>(); |
10 | 434 |
if (taglet.inOverview()) { |
435 |
locationsSet.add("overview"); |
|
436 |
} |
|
437 |
if (taglet.inPackage()) { |
|
438 |
locationsSet.add("package"); |
|
439 |
} |
|
440 |
if (taglet.inType()) { |
|
441 |
locationsSet.add("class/interface"); |
|
442 |
} |
|
443 |
if (taglet.inConstructor()) { |
|
444 |
locationsSet.add("constructor"); |
|
445 |
} |
|
446 |
if (taglet.inField()) { |
|
447 |
locationsSet.add("field"); |
|
448 |
} |
|
449 |
if (taglet.inMethod()) { |
|
450 |
locationsSet.add("method"); |
|
451 |
} |
|
452 |
if (taglet.isInlineTag()) { |
|
453 |
locationsSet.add("inline text"); |
|
454 |
} |
|
868 | 455 |
String[] locations = locationsSet.toArray(new String[]{}); |
10 | 456 |
if (locations == null || locations.length == 0) { |
457 |
//This known tag is excluded. |
|
458 |
return; |
|
459 |
} |
|
14263 | 460 |
StringBuilder combined_locations = new StringBuilder(); |
10 | 461 |
for (int i = 0; i < locations.length; i++) { |
462 |
if (i > 0) { |
|
463 |
combined_locations.append(", "); |
|
464 |
} |
|
465 |
combined_locations.append(locations[i]); |
|
466 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
467 |
message.warning(ch.getDocTreePath(tag), "doclet.tag_misuse", |
10 | 468 |
"@" + taglet.getName(), holderType, combined_locations.toString()); |
469 |
} |
|
470 |
||
471 |
/** |
|
472 |
* Return the array of <code>Taglet</code>s that can |
|
473 |
* appear in packages. |
|
474 |
* @return the array of <code>Taglet</code>s that can |
|
475 |
* appear in packages. |
|
476 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
477 |
public List<Taglet> getPackageCustomTaglets() { |
10 | 478 |
if (packageTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
479 |
initCustomTaglets(); |
10 | 480 |
} |
481 |
return packageTags; |
|
482 |
} |
|
483 |
||
484 |
/** |
|
485 |
* Return the array of <code>Taglet</code>s that can |
|
486 |
* appear in classes or interfaces. |
|
487 |
* @return the array of <code>Taglet</code>s that can |
|
488 |
* appear in classes or interfaces. |
|
489 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
490 |
public List<Taglet> getTypeCustomTaglets() { |
10 | 491 |
if (typeTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
492 |
initCustomTaglets(); |
10 | 493 |
} |
494 |
return typeTags; |
|
495 |
} |
|
496 |
||
497 |
/** |
|
498 |
* Return the array of inline <code>Taglet</code>s that can |
|
499 |
* appear in comments. |
|
500 |
* @return the array of <code>Taglet</code>s that can |
|
501 |
* appear in comments. |
|
502 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
503 |
public List<Taglet> getInlineCustomTaglets() { |
10 | 504 |
if (inlineTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
505 |
initCustomTaglets(); |
10 | 506 |
} |
507 |
return inlineTags; |
|
508 |
} |
|
509 |
||
510 |
/** |
|
511 |
* Return the array of <code>Taglet</code>s that can |
|
512 |
* appear in fields. |
|
513 |
* @return the array of <code>Taglet</code>s that can |
|
514 |
* appear in field. |
|
515 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
516 |
public List<Taglet> getFieldCustomTaglets() { |
10 | 517 |
if (fieldTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
518 |
initCustomTaglets(); |
10 | 519 |
} |
520 |
return fieldTags; |
|
521 |
} |
|
522 |
||
523 |
/** |
|
524 |
* Return the array of <code>Taglet</code>s that can |
|
525 |
* appear in the serialized form. |
|
526 |
* @return the array of <code>Taglet</code>s that can |
|
527 |
* appear in the serialized form. |
|
528 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
529 |
public List<Taglet> getSerializedFormTaglets() { |
10 | 530 |
if (serializedFormTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
531 |
initCustomTaglets(); |
10 | 532 |
} |
533 |
return serializedFormTags; |
|
534 |
} |
|
535 |
||
536 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
537 |
* Returns the custom tags for a given element. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
538 |
* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
539 |
* @param e the element to get custom tags for |
10 | 540 |
* @return the array of <code>Taglet</code>s that can |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
541 |
* appear in the given element. |
10 | 542 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
543 |
public List<Taglet> getCustomTaglets(Element e) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
544 |
switch (e.getKind()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
545 |
case CONSTRUCTOR: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
546 |
return getConstructorCustomTaglets(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
547 |
case METHOD: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
548 |
return getMethodCustomTaglets(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
549 |
case ENUM_CONSTANT: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
550 |
case FIELD: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
551 |
return getFieldCustomTaglets(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
552 |
case ANNOTATION_TYPE: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
553 |
case INTERFACE: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
554 |
case CLASS: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
555 |
case ENUM: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
556 |
return getTypeCustomTaglets(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
557 |
case PACKAGE: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
558 |
return getPackageCustomTaglets(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
559 |
case OTHER: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
560 |
return getOverviewCustomTaglets(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
561 |
default: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
562 |
throw new AssertionError("unknown element: " + e + " ,kind: " + e.getKind()); |
10 | 563 |
} |
564 |
} |
|
565 |
||
566 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
567 |
* Return a List of <code>Taglet</code>s that can |
10 | 568 |
* appear in constructors. |
569 |
* @return the array of <code>Taglet</code>s that can |
|
570 |
* appear in constructors. |
|
571 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
572 |
public List<Taglet> getConstructorCustomTaglets() { |
10 | 573 |
if (constructorTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
574 |
initCustomTaglets(); |
10 | 575 |
} |
576 |
return constructorTags; |
|
577 |
} |
|
578 |
||
579 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
580 |
* Return a List of <code>Taglet</code>s that can |
10 | 581 |
* appear in methods. |
582 |
* @return the array of <code>Taglet</code>s that can |
|
583 |
* appear in methods. |
|
584 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
585 |
public List<Taglet> getMethodCustomTaglets() { |
10 | 586 |
if (methodTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
587 |
initCustomTaglets(); |
10 | 588 |
} |
589 |
return methodTags; |
|
590 |
} |
|
591 |
||
592 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
593 |
* Return a List of <code>Taglet</code>s that can |
10 | 594 |
* appear in an overview. |
595 |
* @return the array of <code>Taglet</code>s that can |
|
596 |
* appear in overview. |
|
597 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
598 |
public List<Taglet> getOverviewCustomTaglets() { |
10 | 599 |
if (overviewTags == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
600 |
initCustomTaglets(); |
10 | 601 |
} |
602 |
return overviewTags; |
|
603 |
} |
|
604 |
||
605 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
606 |
* Initialize the custom tag Lists. |
10 | 607 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
608 |
private void initCustomTaglets() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
609 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
610 |
packageTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
611 |
typeTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
612 |
fieldTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
613 |
constructorTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
614 |
methodTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
615 |
inlineTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
616 |
overviewTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
617 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
618 |
for (Taglet current : customTags.values()) { |
10 | 619 |
if (current.inPackage() && !current.isInlineTag()) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
620 |
packageTags.add(current); |
10 | 621 |
} |
622 |
if (current.inType() && !current.isInlineTag()) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
623 |
typeTags.add(current); |
10 | 624 |
} |
625 |
if (current.inField() && !current.isInlineTag()) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
626 |
fieldTags.add(current); |
10 | 627 |
} |
628 |
if (current.inConstructor() && !current.isInlineTag()) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
629 |
constructorTags.add(current); |
10 | 630 |
} |
631 |
if (current.inMethod() && !current.isInlineTag()) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
632 |
methodTags.add(current); |
10 | 633 |
} |
634 |
if (current.isInlineTag()) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
635 |
inlineTags.add(current); |
10 | 636 |
} |
637 |
if (current.inOverview() && !current.isInlineTag()) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
638 |
overviewTags.add(current); |
10 | 639 |
} |
640 |
} |
|
641 |
||
642 |
//Init the serialized form tags |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
643 |
serializedFormTags = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
644 |
serializedFormTags.add(customTags.get(SERIAL_DATA.tagName)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
645 |
serializedFormTags.add(customTags.get(THROWS.tagName)); |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
5520
diff
changeset
|
646 |
if (!nosince) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
647 |
serializedFormTags.add(customTags.get(SINCE.tagName)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
648 |
serializedFormTags.add(customTags.get(SEE.tagName)); |
10 | 649 |
} |
650 |
||
651 |
/** |
|
652 |
* Initialize standard Javadoc tags for ordering purposes. |
|
653 |
*/ |
|
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
654 |
private void initStandardTaglets() { |
18659
5fe5650da7f9
8015720: since tag isn't copied while generating JavaFX documentation
janvalenta
parents:
17573
diff
changeset
|
655 |
if (javafx) { |
5fe5650da7f9
8015720: since tag isn't copied while generating JavaFX documentation
janvalenta
parents:
17573
diff
changeset
|
656 |
initJavaFXTaglets(); |
5fe5650da7f9
8015720: since tag isn't copied while generating JavaFX documentation
janvalenta
parents:
17573
diff
changeset
|
657 |
} |
5fe5650da7f9
8015720: since tag isn't copied while generating JavaFX documentation
janvalenta
parents:
17573
diff
changeset
|
658 |
|
10 | 659 |
Taglet temp; |
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
660 |
addStandardTaglet(new ParamTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
661 |
addStandardTaglet(new ReturnTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
662 |
addStandardTaglet(new ThrowsTaglet()); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
663 |
addStandardTaglet(new SimpleTaglet(EXCEPTION.tagName, null, |
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
664 |
SimpleTaglet.METHOD + SimpleTaglet.CONSTRUCTOR)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
665 |
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
|
666 |
SimpleTaglet.ALL)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
667 |
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
|
668 |
SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
669 |
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
|
670 |
SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
671 |
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
|
672 |
SimpleTaglet.EXCLUDED)); |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
673 |
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
|
674 |
SimpleTaglet.FIELD + SimpleTaglet.METHOD + SimpleTaglet.TYPE)); |
10 | 675 |
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
|
676 |
SimpleTaglet.METHOD)).getName(), temp); |
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
677 |
addStandardTaglet(new SeeTaglet()); |
10 | 678 |
//Standard inline tags |
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
679 |
addStandardTaglet(new DocRootTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
680 |
addStandardTaglet(new InheritDocTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
681 |
addStandardTaglet(new ValueTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
682 |
addStandardTaglet(new LiteralTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
683 |
addStandardTaglet(new CodeTaglet()); |
33920 | 684 |
addStandardTaglet(new IndexTaglet()); |
10 | 685 |
|
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
686 |
// Keep track of the names of standard tags for error |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
687 |
// checking purposes. The following are not handled above. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
688 |
standardTags.add(DEPRECATED.tagName); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
689 |
standardTags.add(LINK.tagName); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
690 |
standardTags.add(LINK_PLAIN.tagName); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
691 |
standardTags.add(SERIAL.tagName); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
692 |
standardTags.add(SERIAL_FIELD.tagName); |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
693 |
} |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
694 |
|
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
695 |
/** |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
696 |
* Initialize JavaFX-related tags. |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
697 |
*/ |
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
698 |
private void initJavaFXTaglets() { |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
699 |
addStandardTaglet(new PropertyGetterTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
700 |
addStandardTaglet(new PropertySetterTaglet()); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
701 |
addStandardTaglet(new SimpleTaglet("propertyDescription", |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
702 |
message.getText("doclet.PropertyDescription"), |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
703 |
SimpleTaglet.FIELD + SimpleTaglet.METHOD)); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
704 |
addStandardTaglet(new SimpleTaglet("defaultValue", message.getText("doclet.DefaultValue"), |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
705 |
SimpleTaglet.FIELD + SimpleTaglet.METHOD)); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
706 |
addStandardTaglet(new SimpleTaglet("treatAsPrivate", null, |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
707 |
SimpleTaglet.FIELD + SimpleTaglet.METHOD + SimpleTaglet.TYPE)); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
708 |
} |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
14545
diff
changeset
|
709 |
|
17573
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
710 |
void addStandardTaglet(Taglet taglet) { |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
711 |
String name = taglet.getName(); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
712 |
customTags.put(name, taglet); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
713 |
standardTags.add(name); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
714 |
} |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
715 |
|
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
716 |
void addStandardTaglet(boolean enable, Taglet taglet) { |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
717 |
String name = taglet.getName(); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
718 |
if (enable) |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
719 |
customTags.put(name, taglet); |
0e20dec17c87
8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents:
17572
diff
changeset
|
720 |
standardTags.add(name); |
10 | 721 |
} |
722 |
||
723 |
/** |
|
724 |
* Initialize lowercase version of standard Javadoc tags. |
|
725 |
*/ |
|
726 |
private void initStandardTagsLowercase() { |
|
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
727 |
for (String standardTag : standardTags) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
728 |
standardTagsLowercase.add(Utils.toLowerCase(standardTag)); |
10 | 729 |
} |
730 |
} |
|
731 |
||
732 |
public boolean isKnownCustomTag(String tagName) { |
|
733 |
return customTags.containsKey(tagName); |
|
734 |
} |
|
735 |
||
736 |
/** |
|
737 |
* Print a list of {@link Taglet}s that might conflict with |
|
738 |
* standard tags in the future and a list of standard tags |
|
739 |
* that have been overriden. |
|
740 |
*/ |
|
741 |
public void printReport() { |
|
742 |
printReportHelper("doclet.Notice_taglet_conflict_warn", potentiallyConflictingTags); |
|
743 |
printReportHelper("doclet.Notice_taglet_overriden", overridenStandardTags); |
|
744 |
printReportHelper("doclet.Notice_taglet_unseen", unseenCustomTags); |
|
745 |
} |
|
746 |
||
868 | 747 |
private void printReportHelper(String noticeKey, Set<String> names) { |
10 | 748 |
if (names.size() > 0) { |
868 | 749 |
String[] namesArray = names.toArray(new String[] {}); |
10 | 750 |
String result = " "; |
751 |
for (int i = 0; i < namesArray.length; i++) { |
|
752 |
result += "@" + namesArray[i]; |
|
753 |
if (i + 1 < namesArray.length) { |
|
754 |
result += ", "; |
|
755 |
} |
|
756 |
} |
|
757 |
message.notice(noticeKey, result); |
|
758 |
} |
|
759 |
} |
|
760 |
||
761 |
/** |
|
762 |
* Given the name of a tag, return the corresponding taglet. |
|
763 |
* Return null if the tag is unknown. |
|
764 |
* |
|
765 |
* @param name the name of the taglet to retrieve. |
|
766 |
* @return return the corresponding taglet. Return null if the tag is |
|
767 |
* unknown. |
|
768 |
*/ |
|
769 |
public Taglet getTaglet(String name) { |
|
770 |
if (name.indexOf("@") == 0) { |
|
868 | 771 |
return customTags.get(name.substring(1)); |
10 | 772 |
} else { |
868 | 773 |
return customTags.get(name); |
10 | 774 |
} |
775 |
||
776 |
} |
|
777 |
} |