author | hannesw |
Tue, 04 Jun 2019 16:33:37 +0200 | |
changeset 55197 | 0ca8e495bbba |
parent 54936 | 8c63164bd540 |
child 55266 | fb250e9cfe67 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
53863
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2 |
* Copyright (c) 1998, 2019, 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.formats.html; |
10 | 27 |
|
54610 | 28 |
import java.util.ArrayList; |
54936 | 29 |
import java.util.Collections; |
54610 | 30 |
import java.util.LinkedList; |
31 |
import java.util.List; |
|
32 |
import java.util.ListIterator; |
|
33 |
import java.util.Locale; |
|
34 |
import java.util.Map; |
|
35 |
import java.util.Set; |
|
24603
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
36 |
import java.util.regex.Matcher; |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
37 |
import java.util.regex.Pattern; |
10 | 38 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
39 |
import javax.lang.model.element.AnnotationMirror; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
40 |
import javax.lang.model.element.AnnotationValue; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
41 |
import javax.lang.model.element.Element; |
47328
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
42 |
import javax.lang.model.element.ElementKind; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
43 |
import javax.lang.model.element.ExecutableElement; |
36526 | 44 |
import javax.lang.model.element.ModuleElement; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
45 |
import javax.lang.model.element.Name; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
46 |
import javax.lang.model.element.PackageElement; |
53863
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
47 |
import javax.lang.model.element.QualifiedNameable; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
48 |
import javax.lang.model.element.TypeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
49 |
import javax.lang.model.element.VariableElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
50 |
import javax.lang.model.type.DeclaredType; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
51 |
import javax.lang.model.type.TypeMirror; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
52 |
import javax.lang.model.util.SimpleAnnotationValueVisitor9; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
53 |
import javax.lang.model.util.SimpleElementVisitor9; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
54 |
import javax.lang.model.util.SimpleTypeVisitor9; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
55 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
56 |
import com.sun.source.doctree.AttributeTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
57 |
import com.sun.source.doctree.AttributeTree.ValueKind; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
58 |
import com.sun.source.doctree.CommentTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
59 |
import com.sun.source.doctree.DocRootTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
60 |
import com.sun.source.doctree.DocTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
61 |
import com.sun.source.doctree.DocTree.Kind; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
62 |
import com.sun.source.doctree.EndElementTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
63 |
import com.sun.source.doctree.EntityTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
64 |
import com.sun.source.doctree.ErroneousTree; |
40587 | 65 |
import com.sun.source.doctree.IndexTree; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
66 |
import com.sun.source.doctree.InheritDocTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
67 |
import com.sun.source.doctree.LinkTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
68 |
import com.sun.source.doctree.LiteralTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
69 |
import com.sun.source.doctree.SeeTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
70 |
import com.sun.source.doctree.StartElementTree; |
46184
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
71 |
import com.sun.source.doctree.SummaryTree; |
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
51862
diff
changeset
|
72 |
import com.sun.source.doctree.SystemPropertyTree; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
73 |
import com.sun.source.doctree.TextTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
74 |
import com.sun.source.util.SimpleDocTreeVisitor; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
75 |
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; |
54610 | 76 |
import jdk.javadoc.internal.doclets.formats.html.markup.Entity; |
77 |
import jdk.javadoc.internal.doclets.formats.html.markup.Head; |
|
78 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
79 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlDocument; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
80 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
81 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
82 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
47850 | 83 |
import jdk.javadoc.internal.doclets.formats.html.markup.Links; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
84 |
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml; |
47847 | 85 |
import jdk.javadoc.internal.doclets.formats.html.markup.Script; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
86 |
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
54610 | 87 |
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
88 |
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
89 |
import jdk.javadoc.internal.doclets.toolkit.ClassWriter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
90 |
import jdk.javadoc.internal.doclets.toolkit.Content; |
40303 | 91 |
import jdk.javadoc.internal.doclets.toolkit.Messages; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
92 |
import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter; |
40303 | 93 |
import jdk.javadoc.internal.doclets.toolkit.Resources; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
94 |
import jdk.javadoc.internal.doclets.toolkit.taglets.DocRootTaglet; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
95 |
import jdk.javadoc.internal.doclets.toolkit.taglets.TagletWriter; |
40587 | 96 |
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
97 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFile; |
40587 | 98 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
99 |
import jdk.javadoc.internal.doclets.toolkit.util.DocLink; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
100 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
101 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
102 |
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
103 |
import jdk.javadoc.internal.doclets.toolkit.util.Utils; |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
104 |
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
105 |
|
54610 | 106 |
import static com.sun.source.doctree.DocTree.Kind.CODE; |
107 |
import static com.sun.source.doctree.DocTree.Kind.COMMENT; |
|
108 |
import static com.sun.source.doctree.DocTree.Kind.LINK; |
|
109 |
import static com.sun.source.doctree.DocTree.Kind.LINK_PLAIN; |
|
110 |
import static com.sun.source.doctree.DocTree.Kind.SEE; |
|
111 |
import static com.sun.source.doctree.DocTree.Kind.TEXT; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
112 |
import static jdk.javadoc.internal.doclets.toolkit.util.CommentHelper.SPACER; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
113 |
|
10 | 114 |
|
115 |
/** |
|
116 |
* Class for the Html Format Code Generation specific to JavaDoc. |
|
117 |
* This Class contains methods related to the Html Code Generation which |
|
118 |
* are used extensively while generating the entire documentation. |
|
119 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
120 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
121 |
* 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:
14259
diff
changeset
|
122 |
* This code and its internal interfaces are subject to change or |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
123 |
* deletion without notice.</b> |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
124 |
* |
10 | 125 |
* @author Atul M Dambalkar |
126 |
* @author Robert Field |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
127 |
* @author Bhavesh Patel (Modified) |
10 | 128 |
*/ |
47852 | 129 |
public class HtmlDocletWriter { |
10 | 130 |
|
131 |
/** |
|
132 |
* Relative path from the file getting generated to the destination |
|
133 |
* directory. For example, if the file getting generated is |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
134 |
* "java/lang/Object.html", then the path to the root is "../..". |
10 | 135 |
* This string can be empty if the file getting generated is in |
136 |
* the destination directory. |
|
137 |
*/ |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
138 |
public final DocPath pathToRoot; |
10 | 139 |
|
140 |
/** |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
141 |
* Platform-independent path from the current or the |
10 | 142 |
* destination directory to the file getting generated. |
143 |
* Used when creating the file. |
|
144 |
*/ |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
145 |
public final DocPath path; |
10 | 146 |
|
147 |
/** |
|
148 |
* Name of the file getting generated. If the file getting generated is |
|
149 |
* "java/lang/Object.html", then the filename is "Object.html". |
|
150 |
*/ |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
151 |
public final DocPath filename; |
10 | 152 |
|
153 |
/** |
|
154 |
* The global configuration information for this run. |
|
155 |
*/ |
|
45417 | 156 |
public final HtmlConfiguration configuration; |
10 | 157 |
|
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24603
diff
changeset
|
158 |
protected final Utils utils; |
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24603
diff
changeset
|
159 |
|
40303 | 160 |
protected final Contents contents; |
161 |
||
162 |
protected final Messages messages; |
|
163 |
||
164 |
protected final Resources resources; |
|
165 |
||
47850 | 166 |
protected final Links links; |
167 |
||
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48756
diff
changeset
|
168 |
protected final DocPaths docPaths; |
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48756
diff
changeset
|
169 |
|
10 | 170 |
/** |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
171 |
* To check whether annotation heading is printed or not. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
172 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
173 |
protected boolean printedAnnotationHeading = false; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
174 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
175 |
/** |
20237
b6d89903c867
8015249: javadoc fails to document static final fields in annotation types
bpatel
parents:
19920
diff
changeset
|
176 |
* To check whether annotation field heading is printed or not. |
b6d89903c867
8015249: javadoc fails to document static final fields in annotation types
bpatel
parents:
19920
diff
changeset
|
177 |
*/ |
b6d89903c867
8015249: javadoc fails to document static final fields in annotation types
bpatel
parents:
19920
diff
changeset
|
178 |
protected boolean printedAnnotationFieldHeading = false; |
b6d89903c867
8015249: javadoc fails to document static final fields in annotation types
bpatel
parents:
19920
diff
changeset
|
179 |
|
b6d89903c867
8015249: javadoc fails to document static final fields in annotation types
bpatel
parents:
19920
diff
changeset
|
180 |
/** |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
181 |
* To check whether the repeated annotations is documented or not. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
182 |
*/ |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
183 |
private boolean isAnnotationDocumented = false; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
184 |
|
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
185 |
/** |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
186 |
* To check whether the container annotations is documented or not. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
187 |
*/ |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
188 |
private boolean isContainerDocumented = false; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
189 |
|
33920 | 190 |
HtmlTree fixedNavDiv = new HtmlTree(HtmlTag.DIV); |
191 |
||
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
192 |
/** |
47847 | 193 |
* The window title of this file. |
194 |
*/ |
|
195 |
protected String winTitle; |
|
196 |
||
197 |
protected Script mainBodyScript; |
|
198 |
||
199 |
/** |
|
10 | 200 |
* Constructor to construct the HtmlStandardWriter object. |
201 |
* |
|
47852 | 202 |
* @param configuration the configuration for this doclet |
203 |
* @param path the file to be generated. |
|
10 | 204 |
*/ |
45417 | 205 |
public HtmlDocletWriter(HtmlConfiguration configuration, DocPath path) { |
10 | 206 |
this.configuration = configuration; |
40303 | 207 |
this.contents = configuration.contents; |
208 |
this.messages = configuration.messages; |
|
209 |
this.resources = configuration.resources; |
|
53562 | 210 |
this.links = new Links(path); |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24603
diff
changeset
|
211 |
this.utils = configuration.utils; |
10 | 212 |
this.path = path; |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
213 |
this.pathToRoot = path.parent().invert(); |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
214 |
this.filename = path.basename(); |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48756
diff
changeset
|
215 |
this.docPaths = configuration.docPaths; |
54350
4f9772f4403d
8215599: Remove support for javadoc "frames" mode
pmuthuswamy
parents:
54060
diff
changeset
|
216 |
this.mainBodyScript = new Script(); |
47852 | 217 |
|
218 |
messages.notice("doclet.Generating_0", |
|
219 |
DocFile.createFileForOutput(configuration, path).getPath()); |
|
10 | 220 |
} |
221 |
||
222 |
/** |
|
223 |
* Replace {@docRoot} tag used in options that accept HTML text, such |
|
224 |
* as -header, -footer, -top and -bottom, and when converting a relative |
|
225 |
* HREF where commentTagsToString inserts a {@docRoot} where one was |
|
226 |
* missing. (Also see DocRootTaglet for {@docRoot} tags in doc |
|
227 |
* comments.) |
|
228 |
* <p> |
|
229 |
* Replace {@docRoot} tag in htmlstr with the relative path to the |
|
230 |
* destination directory from the directory where the file is being |
|
231 |
* written, looping to handle all such tags in htmlstr. |
|
232 |
* <p> |
|
233 |
* For example, for "-d docs" and -header containing {@docRoot}, when |
|
234 |
* the HTML page for source file p/C1.java is being generated, the |
|
235 |
* {@docRoot} tag would be inserted into the header as "../", |
|
236 |
* the relative path from docs/p/ to docs/ (the document root). |
|
237 |
* <p> |
|
238 |
* Note: This doc comment was written with '&#064;' representing '@' |
|
239 |
* to prevent the inline tag from being interpreted. |
|
240 |
*/ |
|
241 |
public String replaceDocRootDir(String htmlstr) { |
|
242 |
// Return if no inline tags exist |
|
243 |
int index = htmlstr.indexOf("{@"); |
|
244 |
if (index < 0) { |
|
245 |
return htmlstr; |
|
246 |
} |
|
24603
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
247 |
Matcher docrootMatcher = docrootPattern.matcher(htmlstr); |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
248 |
if (!docrootMatcher.find()) { |
10 | 249 |
return htmlstr; |
250 |
} |
|
8631
664f84942e74
6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents:
7681
diff
changeset
|
251 |
StringBuilder buf = new StringBuilder(); |
24603
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
252 |
int prevEnd = 0; |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
253 |
do { |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
254 |
int match = docrootMatcher.start(); |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
255 |
// append htmlstr up to start of next {@docroot} |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
256 |
buf.append(htmlstr.substring(prevEnd, match)); |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
257 |
prevEnd = docrootMatcher.end(); |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
258 |
if (configuration.docrootparent.length() > 0 && htmlstr.startsWith("/..", prevEnd)) { |
22005
4270ada5dcd1
8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents:
21494
diff
changeset
|
259 |
// Insert the absolute link if {@docRoot} is followed by "/..". |
9608 | 260 |
buf.append(configuration.docrootparent); |
24603
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
261 |
prevEnd += 3; |
9608 | 262 |
} else { |
263 |
// Insert relative path where {@docRoot} was located |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
264 |
buf.append(pathToRoot.isEmpty() ? "." : pathToRoot.getPath()); |
22005
4270ada5dcd1
8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents:
21494
diff
changeset
|
265 |
} |
4270ada5dcd1
8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents:
21494
diff
changeset
|
266 |
// Append slash if next character is not a slash |
24603
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
267 |
if (prevEnd < htmlstr.length() && htmlstr.charAt(prevEnd) != '/') { |
22005
4270ada5dcd1
8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents:
21494
diff
changeset
|
268 |
buf.append('/'); |
10 | 269 |
} |
24603
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
270 |
} while (docrootMatcher.find()); |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
271 |
buf.append(htmlstr.substring(prevEnd)); |
10 | 272 |
return buf.toString(); |
273 |
} |
|
24603
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
274 |
//where: |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
275 |
// Note: {@docRoot} is not case sensitive when passed in w/command line option: |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
276 |
private static final Pattern docrootPattern = |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
277 |
Pattern.compile(Pattern.quote("{@docroot}"), Pattern.CASE_INSENSITIVE); |
10 | 278 |
|
279 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
280 |
* Get the script to show or hide the All classes link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
281 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
282 |
* @param id id of the element to show or hide |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
283 |
* @return a content tree for the script |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
284 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
285 |
public Content getAllClassesLinkScript(String id) { |
47847 | 286 |
Script script = new Script("<!--\n" + |
287 |
" allClassesLink = document.getElementById(") |
|
288 |
.appendStringLiteral(id) |
|
289 |
.append(");\n" + |
|
40303 | 290 |
" if(window==top) {\n" + |
291 |
" allClassesLink.style.display = \"block\";\n" + |
|
292 |
" }\n" + |
|
293 |
" else {\n" + |
|
294 |
" allClassesLink.style.display = \"none\";\n" + |
|
295 |
" }\n" + |
|
47847 | 296 |
" //-->\n"); |
297 |
Content div = HtmlTree.DIV(script.asContent()); |
|
40303 | 298 |
Content div_noscript = HtmlTree.DIV(contents.noScriptMessage); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
299 |
Content noScript = HtmlTree.NOSCRIPT(div_noscript); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
300 |
div.add(noScript); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
301 |
return div; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
302 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
303 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
304 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
305 |
* Add method information. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
306 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
307 |
* @param method the method to be documented |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
308 |
* @param dl the content tree to which the method information will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
309 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
310 |
private void addMethodInfo(ExecutableElement method, Content dl) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
311 |
TypeElement enclosing = utils.getEnclosingTypeElement(method); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
312 |
List<? extends TypeMirror> intfacs = enclosing.getInterfaces(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
313 |
ExecutableElement overriddenMethod = utils.overriddenMethod(method); |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
314 |
VisibleMemberTable vmt = configuration.getVisibleMemberTable(enclosing); |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
315 |
// Check whether there is any implementation or overridden info to be |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
316 |
// printed. If no overridden or implementation info needs to be |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
317 |
// printed, do not print this section. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
318 |
if ((!intfacs.isEmpty() |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
319 |
&& vmt.getImplementedMethods(method).isEmpty() == false) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
320 |
|| overriddenMethod != null) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
321 |
MethodWriterImpl.addImplementsInfo(this, method, dl); |
10 | 322 |
if (overriddenMethod != null) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
323 |
MethodWriterImpl.addOverridden(this, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
324 |
utils.overriddenType(method), |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
325 |
overriddenMethod, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
326 |
dl); |
10 | 327 |
} |
328 |
} |
|
329 |
} |
|
330 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
331 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
332 |
* Adds the tags information. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
333 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
334 |
* @param e the Element for which the tags will be generated |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
335 |
* @param htmltree the documentation tree to which the tags will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
336 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
337 |
protected void addTagsInfo(Element e, Content htmltree) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
338 |
if (configuration.nocomment) { |
10 | 339 |
return; |
340 |
} |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
341 |
Content dl = new HtmlTree(HtmlTag.DL); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
342 |
if (utils.isExecutableElement(e) && !utils.isConstructor(e)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
343 |
addMethodInfo((ExecutableElement)e, dl); |
10 | 344 |
} |
17574
044c7e1e4d53
8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents:
17573
diff
changeset
|
345 |
Content output = new ContentBuilder(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
346 |
TagletWriter.genTagOutput(configuration.tagletManager, e, |
50240 | 347 |
configuration.tagletManager.getBlockTaglets(e), |
10 | 348 |
getTagletWriterInstance(false), output); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
349 |
dl.add(output); |
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
350 |
htmltree.add(dl); |
10 | 351 |
} |
352 |
||
353 |
/** |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
354 |
* Check whether there are any tags for Serialization Overview |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
355 |
* section to be printed. |
2086
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
356 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
357 |
* @param field the VariableElement object to check for tags. |
2086
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
358 |
* @return true if there are tags to be printed else return false. |
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
359 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
360 |
protected boolean hasSerializationOverviewTags(VariableElement field) { |
17574
044c7e1e4d53
8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents:
17573
diff
changeset
|
361 |
Content output = new ContentBuilder(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
362 |
TagletWriter.genTagOutput(configuration.tagletManager, field, |
50240 | 363 |
configuration.tagletManager.getBlockTaglets(field), |
2086
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
364 |
getTagletWriterInstance(false), output); |
17574
044c7e1e4d53
8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents:
17573
diff
changeset
|
365 |
return !output.isEmpty(); |
2086
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
366 |
} |
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
367 |
|
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
368 |
/** |
10 | 369 |
* Returns a TagletWriter that knows how to write HTML. |
370 |
* |
|
51862 | 371 |
* @param isFirstSentence true if we want to write the first sentence |
10 | 372 |
* @return a TagletWriter that knows how to write HTML. |
373 |
*/ |
|
374 |
public TagletWriter getTagletWriterInstance(boolean isFirstSentence) { |
|
375 |
return new TagletWriterImpl(this, isFirstSentence); |
|
376 |
} |
|
377 |
||
378 |
/** |
|
51862 | 379 |
* Returns a TagletWriter that knows how to write HTML. |
380 |
* |
|
381 |
* @param isFirstSentence true if we want to write the first sentence |
|
382 |
* @param inSummary true if tags are to be added in a summary section |
|
383 |
* @return a TagletWriter |
|
384 |
*/ |
|
385 |
public TagletWriter getTagletWriterInstance(boolean isFirstSentence, boolean inSummary) { |
|
386 |
return new TagletWriterImpl(this, isFirstSentence, inSummary); |
|
387 |
} |
|
388 |
||
389 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
390 |
* Generates the HTML document tree and prints it out. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
391 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
392 |
* @param metakeywords Array of String keywords for META tag. Each element |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
393 |
* of the array is assigned to a separate META tag. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
394 |
* Pass in null for no array |
53863
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
395 |
* @param description the content for the description META tag. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
396 |
* @param body the body htmltree to be included in the document |
40587 | 397 |
* @throws DocFileIOException if there is a problem writing the file |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
398 |
*/ |
53863
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
399 |
public void printHtmlDocument(List<String> metakeywords, |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
400 |
String description, |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
401 |
Content body) |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
402 |
throws DocFileIOException { |
54936 | 403 |
printHtmlDocument(metakeywords, description, new ContentBuilder(), Collections.emptyList(), body); |
404 |
} |
|
405 |
||
406 |
/** |
|
407 |
* Generates the HTML document tree and prints it out. |
|
408 |
* |
|
409 |
* @param metakeywords Array of String keywords for META tag. Each element |
|
410 |
* of the array is assigned to a separate META tag. |
|
411 |
* Pass in null for no array |
|
412 |
* @param description the content for the description META tag. |
|
413 |
* @param localStylesheets local stylesheets to be included in the HEAD element |
|
414 |
* @param body the body htmltree to be included in the document |
|
415 |
* @throws DocFileIOException if there is a problem writing the file |
|
416 |
*/ |
|
417 |
public void printHtmlDocument(List<String> metakeywords, |
|
418 |
String description, |
|
419 |
List<DocPath> localStylesheets, |
|
420 |
Content body) |
|
421 |
throws DocFileIOException { |
|
422 |
printHtmlDocument(metakeywords, description, new ContentBuilder(), localStylesheets, body); |
|
53164
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52487
diff
changeset
|
423 |
} |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52487
diff
changeset
|
424 |
|
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52487
diff
changeset
|
425 |
/** |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52487
diff
changeset
|
426 |
* Generates the HTML document tree and prints it out. |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52487
diff
changeset
|
427 |
* |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52487
diff
changeset
|
428 |
* @param metakeywords Array of String keywords for META tag. Each element |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52487
diff
changeset
|
429 |
* of the array is assigned to a separate META tag. |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52487
diff
changeset
|
430 |
* Pass in null for no array |
53863
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
431 |
* @param description the content for the description META tag. |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
432 |
* @param extraHeadContent any additional content to be included in the HEAD element |
54936 | 433 |
* @param localStylesheets local stylesheets to be included in the HEAD element |
53164
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52487
diff
changeset
|
434 |
* @param body the body htmltree to be included in the document |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52487
diff
changeset
|
435 |
* @throws DocFileIOException if there is a problem writing the file |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52487
diff
changeset
|
436 |
*/ |
53863
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
437 |
public void printHtmlDocument(List<String> metakeywords, |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
438 |
String description, |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
439 |
Content extraHeadContent, |
54936 | 440 |
List<DocPath> localStylesheets, |
53863
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
441 |
Content body) |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
442 |
throws DocFileIOException { |
47848 | 443 |
Content htmlComment = contents.newPage; |
54936 | 444 |
List<DocPath> additionalStylesheets = configuration.getAdditionalStylesheets(); |
445 |
additionalStylesheets.addAll(localStylesheets); |
|
53562 | 446 |
Head head = new Head(path, configuration.docletVersion) |
47849 | 447 |
.setTimestamp(!configuration.notimestamp) |
53863
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
448 |
.setDescription(description) |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
449 |
.setGenerator(getGenerator(getClass())) |
47849 | 450 |
.setTitle(winTitle) |
451 |
.setCharset(configuration.charset) |
|
452 |
.addKeywords(metakeywords) |
|
54936 | 453 |
.setStylesheets(configuration.getMainStylesheet(), additionalStylesheets) |
53164
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52487
diff
changeset
|
454 |
.setIndex(configuration.createindex, mainBodyScript) |
53863
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
455 |
.addContent(extraHeadContent); |
47848 | 456 |
|
47849 | 457 |
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head.toContent(), body); |
53562 | 458 |
HtmlDocument htmlDocument = new HtmlDocument(htmlComment, htmlTree); |
47848 | 459 |
htmlDocument.write(DocFile.createFileForOutput(configuration, path)); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
460 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
461 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
462 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
463 |
* Get the window title. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
464 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
465 |
* @param title the title string to construct the complete window title |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
466 |
* @return the window title string |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
467 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
468 |
public String getWindowTitle(String title) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
469 |
if (configuration.windowtitle.length() > 0) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
470 |
title += " (" + configuration.windowtitle + ")"; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
471 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
472 |
return title; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
473 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
474 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
475 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
476 |
* Get user specified header and the footer. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
477 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
478 |
* @param header if true print the user provided header else print the |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
479 |
* user provided footer. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
480 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
481 |
public Content getUserHeaderFooter(boolean header) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
482 |
String content; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
483 |
if (header) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
484 |
content = replaceDocRootDir(configuration.header); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
485 |
} else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
486 |
if (configuration.footer.length() != 0) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
487 |
content = replaceDocRootDir(configuration.footer); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
488 |
} else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
489 |
content = replaceDocRootDir(configuration.header); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
490 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
491 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
492 |
Content rawContent = new RawHtml(content); |
19254
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
19253
diff
changeset
|
493 |
return rawContent; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
494 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
495 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
496 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
497 |
* Adds the user specified top. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
498 |
* |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
499 |
* @param htmlTree the content tree to which user specified top will be added |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
500 |
*/ |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
501 |
public void addTop(Content htmlTree) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
502 |
Content top = new RawHtml(replaceDocRootDir(configuration.top)); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
503 |
fixedNavDiv.add(top); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
504 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
505 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
506 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
507 |
* Adds the user specified bottom. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
508 |
* |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
509 |
* @param htmlTree the content tree to which user specified bottom will be added |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
510 |
*/ |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
511 |
public void addBottom(Content htmlTree) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
512 |
Content bottom = new RawHtml(replaceDocRootDir(configuration.bottom)); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
513 |
Content small = HtmlTree.SMALL(bottom); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
514 |
Content p = HtmlTree.P(HtmlStyle.legalCopy, small); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
515 |
htmlTree.add(p); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
516 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
517 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
518 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
519 |
* Get the overview tree link for the main tree. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
520 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
521 |
* @param label the label for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
522 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
523 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
524 |
protected Content getNavLinkMainTree(String label) { |
48654
36f58bd6269f
8195796: Reduce the size of relative URLs in generated docs
jjg
parents:
48295
diff
changeset
|
525 |
Content mainTreeContent = links.createLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
526 |
new StringContent(label)); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
527 |
Content li = HtmlTree.LI(mainTreeContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
528 |
return li; |
10 | 529 |
} |
530 |
||
531 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
532 |
* Get table caption. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
533 |
* |
47427 | 534 |
* @param title the content for the caption |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
535 |
* @return a content tree for the caption |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
536 |
*/ |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
537 |
public Content getTableCaption(Content title) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
538 |
Content captionSpan = HtmlTree.SPAN(title); |
54610 | 539 |
Content space = Entity.NO_BREAK_SPACE; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
540 |
Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, space); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
541 |
Content caption = HtmlTree.CAPTION(captionSpan); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
542 |
caption.add(tabSpan); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
543 |
return caption; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
544 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
545 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
546 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
547 |
* Returns a packagename content. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
548 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
549 |
* @param packageElement the package to check |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
550 |
* @return package name content |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
551 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
552 |
public Content getPackageName(PackageElement packageElement) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
553 |
return packageElement == null || packageElement.isUnnamed() |
40303 | 554 |
? contents.defaultPackageLabel |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
555 |
: getPackageLabel(packageElement.getQualifiedName()); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
556 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
557 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
558 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
559 |
* Returns a package name label. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
560 |
* |
14259 | 561 |
* @param packageName the package name |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
562 |
* @return the package name content |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
563 |
*/ |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
564 |
public Content getPackageLabel(CharSequence packageName) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
565 |
return new StringContent(packageName); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
566 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
567 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
568 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
569 |
* Return the path to the class page for a typeElement. |
10 | 570 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
571 |
* @param te TypeElement for which the path is requested. |
10 | 572 |
* @param name Name of the file(doesn't include path). |
573 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
574 |
protected DocPath pathString(TypeElement te, DocPath name) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
575 |
return pathString(utils.containingPackage(te), name); |
10 | 576 |
} |
577 |
||
578 |
/** |
|
579 |
* Return path to the given file name in the given package. So if the name |
|
580 |
* passed is "Object.html" and the name of the package is "java.lang", and |
|
581 |
* if the relative path is "../.." then returned string will be |
|
582 |
* "../../java/lang/Object.html" |
|
583 |
* |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
584 |
* @param packageElement Package in which the file name is assumed to be. |
10 | 585 |
* @param name File name, to which path string is. |
586 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
587 |
protected DocPath pathString(PackageElement packageElement, DocPath name) { |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48756
diff
changeset
|
588 |
return pathToRoot.resolve(docPaths.forPackage(packageElement).resolve(name)); |
10 | 589 |
} |
590 |
||
591 |
/** |
|
26900
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26665
diff
changeset
|
592 |
* Given a package, return the name to be used in HTML anchor tag. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
593 |
* @param packageElement the package. |
26900
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26665
diff
changeset
|
594 |
* @return the name to be used in HTML anchor tag. |
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26665
diff
changeset
|
595 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
596 |
public String getPackageAnchorName(PackageElement packageElement) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
597 |
return packageElement == null || packageElement.isUnnamed() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
598 |
? SectionName.UNNAMED_PACKAGE_ANCHOR.getName() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
599 |
: utils.getPackageName(packageElement); |
26900
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26665
diff
changeset
|
600 |
} |
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26665
diff
changeset
|
601 |
|
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26665
diff
changeset
|
602 |
/** |
10 | 603 |
* Return the link to the given package. |
604 |
* |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
605 |
* @param packageElement the package to link to. |
10 | 606 |
* @param label the label for the link. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
607 |
* @return a content tree for the package link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
608 |
*/ |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
609 |
public Content getPackageLink(PackageElement packageElement, CharSequence label) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
610 |
return getPackageLink(packageElement, new StringContent(label)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
611 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
612 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
613 |
public Content getPackageLink(PackageElement packageElement) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
614 |
StringContent content = packageElement.isUnnamed() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
615 |
? new StringContent() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
616 |
: new StringContent(utils.getPackageName(packageElement)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
617 |
return getPackageLink(packageElement, content); |
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
618 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
619 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
620 |
/** |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
621 |
* Return the link to the given package. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
622 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
623 |
* @param packageElement the package to link to. |
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
624 |
* @param label the label for the link. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
625 |
* @return a content tree for the package link. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
626 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
627 |
public Content getPackageLink(PackageElement packageElement, Content label) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
628 |
boolean included = packageElement != null && utils.isIncluded(packageElement); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
629 |
if (!included) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
630 |
for (PackageElement p : configuration.packages) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
631 |
if (p.equals(packageElement)) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
632 |
included = true; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
633 |
break; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
634 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
635 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
636 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
637 |
if (included || packageElement == null) { |
48654
36f58bd6269f
8195796: Reduce the size of relative URLs in generated docs
jjg
parents:
48295
diff
changeset
|
638 |
return links.createLink(pathString(packageElement, DocPaths.PACKAGE_SUMMARY), |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
639 |
label); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
640 |
} else { |
51861
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
641 |
DocLink crossPkgLink = getCrossPackageLink(packageElement); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
642 |
if (crossPkgLink != null) { |
48654
36f58bd6269f
8195796: Reduce the size of relative URLs in generated docs
jjg
parents:
48295
diff
changeset
|
643 |
return links.createLink(crossPkgLink, label); |
10 | 644 |
} else { |
645 |
return label; |
|
646 |
} |
|
647 |
} |
|
648 |
} |
|
649 |
||
36526 | 650 |
/** |
651 |
* Get Module link. |
|
652 |
* |
|
653 |
* @param mdle the module being documented |
|
654 |
* @param label tag for the link |
|
655 |
* @return a content for the module link |
|
656 |
*/ |
|
657 |
public Content getModuleLink(ModuleElement mdle, Content label) { |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
658 |
boolean included = utils.isIncluded(mdle); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
659 |
return (included) |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48756
diff
changeset
|
660 |
? links.createLink(pathToRoot.resolve(docPaths.moduleSummary(mdle)), label, "", "") |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
661 |
: label; |
36526 | 662 |
} |
663 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
664 |
public Content interfaceName(TypeElement typeElement, boolean qual) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
665 |
Content name = new StringContent((qual) |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
666 |
? typeElement.getQualifiedName() |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
667 |
: utils.getSimpleName(typeElement)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
668 |
return (utils.isInterface(typeElement)) ? HtmlTree.SPAN(HtmlStyle.interfaceName, name) : name; |
10 | 669 |
} |
670 |
||
671 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
672 |
* Add the link to the content tree. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
673 |
* |
50249
5715962c8831
8199307: NPE in jdk.javadoc.internal.doclets.toolkit.util.Utils.getLineNumber
pmuthuswamy
parents:
50240
diff
changeset
|
674 |
* @param element program element for which the link will be added |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
675 |
* @param label label for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
676 |
* @param htmltree the content tree to which the link will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
677 |
*/ |
50249
5715962c8831
8199307: NPE in jdk.javadoc.internal.doclets.toolkit.util.Utils.getLineNumber
pmuthuswamy
parents:
50240
diff
changeset
|
678 |
public void addSrcLink(Element element, Content label, Content htmltree) { |
5715962c8831
8199307: NPE in jdk.javadoc.internal.doclets.toolkit.util.Utils.getLineNumber
pmuthuswamy
parents:
50240
diff
changeset
|
679 |
if (element == null) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
680 |
return; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
681 |
} |
50249
5715962c8831
8199307: NPE in jdk.javadoc.internal.doclets.toolkit.util.Utils.getLineNumber
pmuthuswamy
parents:
50240
diff
changeset
|
682 |
TypeElement te = utils.getEnclosingTypeElement(element); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
683 |
if (te == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
684 |
// must be a typeElement since in has no containing class. |
50249
5715962c8831
8199307: NPE in jdk.javadoc.internal.doclets.toolkit.util.Utils.getLineNumber
pmuthuswamy
parents:
50240
diff
changeset
|
685 |
te = (TypeElement) element; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
686 |
} |
50249
5715962c8831
8199307: NPE in jdk.javadoc.internal.doclets.toolkit.util.Utils.getLineNumber
pmuthuswamy
parents:
50240
diff
changeset
|
687 |
if (utils.isIncluded(te)) { |
5715962c8831
8199307: NPE in jdk.javadoc.internal.doclets.toolkit.util.Utils.getLineNumber
pmuthuswamy
parents:
50240
diff
changeset
|
688 |
DocPath href = pathToRoot |
5715962c8831
8199307: NPE in jdk.javadoc.internal.doclets.toolkit.util.Utils.getLineNumber
pmuthuswamy
parents:
50240
diff
changeset
|
689 |
.resolve(DocPaths.SOURCE_OUTPUT) |
5715962c8831
8199307: NPE in jdk.javadoc.internal.doclets.toolkit.util.Utils.getLineNumber
pmuthuswamy
parents:
50240
diff
changeset
|
690 |
.resolve(docPaths.forClass(te)); |
5715962c8831
8199307: NPE in jdk.javadoc.internal.doclets.toolkit.util.Utils.getLineNumber
pmuthuswamy
parents:
50240
diff
changeset
|
691 |
Content content = links.createLink(href |
5715962c8831
8199307: NPE in jdk.javadoc.internal.doclets.toolkit.util.Utils.getLineNumber
pmuthuswamy
parents:
50240
diff
changeset
|
692 |
.fragment(SourceToHTMLConverter.getAnchorName(utils, element)), label, "", ""); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
693 |
htmltree.add(content); |
50249
5715962c8831
8199307: NPE in jdk.javadoc.internal.doclets.toolkit.util.Utils.getLineNumber
pmuthuswamy
parents:
50240
diff
changeset
|
694 |
} else { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
695 |
htmltree.add(label); |
50249
5715962c8831
8199307: NPE in jdk.javadoc.internal.doclets.toolkit.util.Utils.getLineNumber
pmuthuswamy
parents:
50240
diff
changeset
|
696 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
697 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
698 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
699 |
/** |
10 | 700 |
* Return the link to the given class. |
701 |
* |
|
702 |
* @param linkInfo the information about the link. |
|
703 |
* |
|
704 |
* @return the link for the given class. |
|
705 |
*/ |
|
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
706 |
public Content getLink(LinkInfoImpl linkInfo) { |
10 | 707 |
LinkFactoryImpl factory = new LinkFactoryImpl(this); |
17564
c329fe11193d
8011288: Erratic/inconsistent indentation of signatures
jjg
parents:
17563
diff
changeset
|
708 |
return factory.getLink(linkInfo); |
10 | 709 |
} |
710 |
||
711 |
/** |
|
712 |
* Return the type parameters for the given class. |
|
713 |
* |
|
714 |
* @param linkInfo the information about the link. |
|
715 |
* @return the type for the given class. |
|
716 |
*/ |
|
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
717 |
public Content getTypeParameterLinks(LinkInfoImpl linkInfo) { |
10 | 718 |
LinkFactoryImpl factory = new LinkFactoryImpl(this); |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
719 |
return factory.getTypeParameterLinks(linkInfo, false); |
10 | 720 |
} |
721 |
||
722 |
/************************************************************* |
|
723 |
* Return a class cross link to external class documentation. |
|
51861
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
724 |
* The -link option does not allow users to |
10 | 725 |
* link to external classes in the "default" package. |
726 |
* |
|
51861
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
727 |
* @param classElement the class element |
10 | 728 |
* @param refMemName the name of the member being referenced. This should |
729 |
* be null or empty string if no member is being referenced. |
|
730 |
* @param label the label for the external link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
731 |
* @param strong true if the link should be strong. |
10 | 732 |
* @param code true if the label should be code font. |
47851
6a9bb4f77d50
8190822: Remove dead code that could lead to invalid HTML
jjg
parents:
47850
diff
changeset
|
733 |
* @return the link |
10 | 734 |
*/ |
51861
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
735 |
public Content getCrossClassLink(TypeElement classElement, String refMemName, |
47851
6a9bb4f77d50
8190822: Remove dead code that could lead to invalid HTML
jjg
parents:
47850
diff
changeset
|
736 |
Content label, boolean strong, boolean code) { |
51861
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
737 |
if (classElement != null) { |
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
738 |
String className = utils.getSimpleName(classElement); |
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
739 |
PackageElement packageElement = utils.containingPackage(classElement); |
17560 | 740 |
Content defaultLabel = new StringContent(className); |
741 |
if (code) |
|
742 |
defaultLabel = HtmlTree.CODE(defaultLabel); |
|
51861
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
743 |
if (getCrossPackageLink(packageElement) != null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
744 |
/* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
745 |
The package exists in external documentation, so link to the external |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
746 |
class (assuming that it exists). This is definitely a limitation of |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
747 |
the -link option. There are ways to determine if an external package |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
748 |
exists, but no way to determine if the external class exists. We just |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
749 |
have to assume that it does. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
750 |
*/ |
51861
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
751 |
DocLink link = configuration.extern.getExternalLink(packageElement, pathToRoot, |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
752 |
className + ".html", refMemName); |
48654
36f58bd6269f
8195796: Reduce the size of relative URLs in generated docs
jjg
parents:
48295
diff
changeset
|
753 |
return links.createLink(link, |
17560 | 754 |
(label == null) || label.isEmpty() ? defaultLabel : label, |
47851
6a9bb4f77d50
8190822: Remove dead code that could lead to invalid HTML
jjg
parents:
47850
diff
changeset
|
755 |
strong, |
51861
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
756 |
resources.getText("doclet.Href_Class_Or_Interface_Title", |
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
757 |
utils.getPackageName(packageElement)), "", true); |
10 | 758 |
} |
759 |
} |
|
760 |
return null; |
|
761 |
} |
|
762 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
763 |
public boolean isClassLinkable(TypeElement typeElement) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
764 |
if (utils.isIncluded(typeElement)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
765 |
return configuration.isGeneratedDoc(typeElement); |
10 | 766 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
767 |
return configuration.extern.isExternal(typeElement); |
10 | 768 |
} |
769 |
||
51861
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
770 |
public DocLink getCrossPackageLink(PackageElement element) { |
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
771 |
return configuration.extern.getExternalLink(element, pathToRoot, |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
772 |
DocPaths.PACKAGE_SUMMARY.getPath()); |
10 | 773 |
} |
774 |
||
51861
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
775 |
public DocLink getCrossModuleLink(ModuleElement element) { |
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
776 |
return configuration.extern.getExternalLink(element, pathToRoot, |
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
777 |
docPaths.moduleSummary(utils.getModuleName(element)).getPath()); |
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48029
diff
changeset
|
778 |
} |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48029
diff
changeset
|
779 |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
780 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
781 |
* Get the class link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
782 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
783 |
* @param context the id of the context where the link will be added |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
784 |
* @param element to link to |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
785 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
786 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
787 |
public Content getQualifiedClassLink(LinkInfoImpl.Kind context, Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
788 |
LinkInfoImpl linkInfoImpl = new LinkInfoImpl(configuration, context, (TypeElement)element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
789 |
return getLink(linkInfoImpl.label(utils.getFullyQualifiedName(element))); |
10 | 790 |
} |
791 |
||
792 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
793 |
* Add the class link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
794 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
795 |
* @param context the id of the context where the link will be added |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
796 |
* @param typeElement to link to |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
797 |
* @param contentTree the content tree to which the link will be added |
10 | 798 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
799 |
public void addPreQualifiedClassLink(LinkInfoImpl.Kind context, TypeElement typeElement, Content contentTree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
800 |
addPreQualifiedClassLink(context, typeElement, false, contentTree); |
10 | 801 |
} |
802 |
||
803 |
/** |
|
804 |
* Retrieve the class link with the package portion of the label in |
|
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
805 |
* plain text. If the qualifier is excluded, it will not be included in the |
10 | 806 |
* link label. |
807 |
* |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
808 |
* @param typeElement the class to link to. |
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
809 |
* @param isStrong true if the link should be strong. |
10 | 810 |
* @return the link with the package portion of the label in plain text. |
811 |
*/ |
|
17560 | 812 |
public Content getPreQualifiedClassLink(LinkInfoImpl.Kind context, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
813 |
TypeElement typeElement, boolean isStrong) { |
17560 | 814 |
ContentBuilder classlink = new ContentBuilder(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
815 |
PackageElement pkg = utils.containingPackage(typeElement); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
816 |
if (pkg != null && ! configuration.shouldExcludeQualifier(pkg.getSimpleName().toString())) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
817 |
classlink.add(getEnclosingPackageName(typeElement)); |
10 | 818 |
} |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
819 |
classlink.add(getLink(new LinkInfoImpl(configuration, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
820 |
context, typeElement).label(utils.getSimpleName(typeElement)).strong(isStrong))); |
10 | 821 |
return classlink; |
822 |
} |
|
823 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
824 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
825 |
* Add the class link with the package portion of the label in |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
826 |
* plain text. If the qualifier is excluded, it will not be included in the |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
827 |
* link label. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
828 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
829 |
* @param context the id of the context where the link will be added |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
830 |
* @param typeElement the class to link to |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
831 |
* @param isStrong true if the link should be strong |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
832 |
* @param contentTree the content tree to which the link with be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
833 |
*/ |
17558
eee4ccf66cfd
8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents:
17547
diff
changeset
|
834 |
public void addPreQualifiedClassLink(LinkInfoImpl.Kind context, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
835 |
TypeElement typeElement, boolean isStrong, Content contentTree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
836 |
PackageElement pkg = utils.containingPackage(typeElement); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
837 |
if(pkg != null && ! configuration.shouldExcludeQualifier(pkg.getSimpleName().toString())) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
838 |
contentTree.add(getEnclosingPackageName(typeElement)); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
839 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
840 |
LinkInfoImpl linkinfo = new LinkInfoImpl(configuration, context, typeElement) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
841 |
.label(utils.getSimpleName(typeElement)) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
842 |
.strong(isStrong); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
843 |
Content link = getLink(linkinfo); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
844 |
contentTree.add(link); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
845 |
} |
10 | 846 |
|
847 |
/** |
|
47852 | 848 |
* Get the enclosed name of the package |
849 |
* |
|
850 |
* @param te TypeElement |
|
851 |
* @return the name |
|
852 |
*/ |
|
853 |
public String getEnclosingPackageName(TypeElement te) { |
|
854 |
||
855 |
PackageElement encl = configuration.utils.containingPackage(te); |
|
856 |
return (encl.isUnnamed()) ? "" : (encl.getQualifiedName() + "."); |
|
857 |
} |
|
858 |
||
859 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
860 |
* Add the class link, with only class name as the strong link and prefixing |
10 | 861 |
* plain package name. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
862 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
863 |
* @param context the id of the context where the link will be added |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
864 |
* @param typeElement the class to link to |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
865 |
* @param contentTree the content tree to which the link with be added |
10 | 866 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
867 |
public void addPreQualifiedStrongClassLink(LinkInfoImpl.Kind context, TypeElement typeElement, Content contentTree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
868 |
addPreQualifiedClassLink(context, typeElement, true, contentTree); |
10 | 869 |
} |
870 |
||
871 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
872 |
* Get the link for the given member. |
10 | 873 |
* |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
874 |
* @param context the id of the context where the link will be added |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
875 |
* @param element the member being linked to |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
876 |
* @param label the label for the link |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
877 |
* @return a content tree for the element link |
10 | 878 |
*/ |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
879 |
public Content getDocLink(LinkInfoImpl.Kind context, Element element, CharSequence label) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
880 |
return getDocLink(context, utils.getEnclosingTypeElement(element), element, |
17560 | 881 |
new StringContent(label)); |
10 | 882 |
} |
883 |
||
884 |
/** |
|
885 |
* Return the link for the given member. |
|
886 |
* |
|
887 |
* @param context the id of the context where the link will be printed. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
888 |
* @param element the member being linked to. |
10 | 889 |
* @param label the label for the link. |
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
890 |
* @param strong true if the link should be strong. |
10 | 891 |
* @return the link for the given member. |
892 |
*/ |
|
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
893 |
public Content getDocLink(LinkInfoImpl.Kind context, Element element, CharSequence label, |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
894 |
boolean strong) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
895 |
return getDocLink(context, utils.getEnclosingTypeElement(element), element, label, strong); |
10 | 896 |
} |
897 |
||
898 |
/** |
|
899 |
* Return the link for the given member. |
|
900 |
* |
|
901 |
* @param context the id of the context where the link will be printed. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
902 |
* @param typeElement the typeElement that we should link to. This is not |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
903 |
necessarily equal to element.containingClass(). We may be |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
904 |
inheriting comments. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
905 |
* @param element the member being linked to. |
10 | 906 |
* @param label the label for the link. |
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
907 |
* @param strong true if the link should be strong. |
10 | 908 |
* @return the link for the given member. |
909 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
910 |
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element, |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
911 |
CharSequence label, boolean strong) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
912 |
return getDocLink(context, typeElement, element, label, strong, false); |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
913 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
914 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
915 |
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element, |
17569 | 916 |
Content label, boolean strong) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
917 |
return getDocLink(context, typeElement, element, label, strong, false); |
17569 | 918 |
} |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
919 |
|
51190
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50612
diff
changeset
|
920 |
/** |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
921 |
* Return the link for the given member. |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
922 |
* |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
923 |
* @param context the id of the context where the link will be printed. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
924 |
* @param typeElement the typeElement that we should link to. This is not |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
925 |
necessarily equal to element.containingClass(). We may be |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
926 |
inheriting comments. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
927 |
* @param element the member being linked to. |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
928 |
* @param label the label for the link. |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
929 |
* @param strong true if the link should be strong. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
930 |
* @param isProperty true if the element parameter is a JavaFX property. |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
931 |
* @return the link for the given member. |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
932 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
933 |
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element, |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
934 |
CharSequence label, boolean strong, boolean isProperty) { |
50612
e10812a82a3b
8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents:
50249
diff
changeset
|
935 |
return getDocLink(context, typeElement, element, new StringContent(label), strong, isProperty); |
17560 | 936 |
} |
937 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
938 |
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element, |
17560 | 939 |
Content label, boolean strong, boolean isProperty) { |
51190
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50612
diff
changeset
|
940 |
if (!utils.isLinkable(typeElement, element)) { |
17560 | 941 |
return label; |
51190
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50612
diff
changeset
|
942 |
} |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50612
diff
changeset
|
943 |
|
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50612
diff
changeset
|
944 |
if (utils.isExecutableElement(element)) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
945 |
ExecutableElement ee = (ExecutableElement)element; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
946 |
return getLink(new LinkInfoImpl(configuration, context, typeElement) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
947 |
.label(label) |
47850 | 948 |
.where(links.getName(getAnchor(ee, isProperty))) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
949 |
.strong(strong)); |
51190
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50612
diff
changeset
|
950 |
} |
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50612
diff
changeset
|
951 |
|
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50612
diff
changeset
|
952 |
if (utils.isVariableElement(element) || utils.isTypeElement(element)) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
953 |
return getLink(new LinkInfoImpl(configuration, context, typeElement) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
954 |
.label(label) |
47850 | 955 |
.where(links.getName(element.getSimpleName().toString())) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
956 |
.strong(strong)); |
10 | 957 |
} |
51190
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50612
diff
changeset
|
958 |
|
fb4a7b894fac
8207214: Broken links in JDK API serialized-form page
jjg
parents:
50612
diff
changeset
|
959 |
return label; |
10 | 960 |
} |
961 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
962 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
963 |
* Return the link for the given member. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
964 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
965 |
* @param context the id of the context where the link will be added |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
966 |
* @param typeElement the typeElement that we should link to. This is not |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
967 |
necessarily equal to element.containingClass(). We may be |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
968 |
inheriting comments |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
969 |
* @param element the member being linked to |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
970 |
* @param label the label for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
971 |
* @return the link for the given member |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
972 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
973 |
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element, |
17560 | 974 |
Content label) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
975 |
if (! (utils.isIncluded(element) || utils.isLinkable(typeElement))) { |
17560 | 976 |
return label; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
977 |
} else if (utils.isExecutableElement(element)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
978 |
ExecutableElement emd = (ExecutableElement) element; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
979 |
return getLink(new LinkInfoImpl(configuration, context, typeElement) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
980 |
.label(label) |
47850 | 981 |
.where(links.getName(getAnchor(emd)))); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
982 |
} else if (utils.isVariableElement(element) || utils.isTypeElement(element)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
983 |
return getLink(new LinkInfoImpl(configuration, context, typeElement) |
47850 | 984 |
.label(label).where(links.getName(element.getSimpleName().toString()))); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
985 |
} else { |
17560 | 986 |
return label; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
987 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
988 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
989 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
990 |
public String getAnchor(ExecutableElement executableElement) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
991 |
return getAnchor(executableElement, false); |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
992 |
} |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
993 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
994 |
public String getAnchor(ExecutableElement executableElement, boolean isProperty) { |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
995 |
if (isProperty) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
996 |
return executableElement.getSimpleName().toString(); |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
997 |
} |
47328
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
998 |
String member = anchorName(executableElement); |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
999 |
String erasedSignature = utils.makeSignature(executableElement, true, true); |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1000 |
return member + erasedSignature; |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1001 |
} |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1002 |
|
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1003 |
public String anchorName(Element member) { |
53562 | 1004 |
if (member.getKind() == ElementKind.CONSTRUCTOR) { |
47328
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1005 |
return "<init>"; |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1006 |
} else { |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1007 |
return utils.getSimpleName(member); |
10 | 1008 |
} |
1009 |
} |
|
1010 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1011 |
public Content seeTagToContent(Element element, DocTree see) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1012 |
Kind kind = see.getKind(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1013 |
if (!(kind == LINK || kind == SEE || kind == LINK_PLAIN)) { |
17568
d9691936f5f9
8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents:
17567
diff
changeset
|
1014 |
return new ContentBuilder(); |
10 | 1015 |
} |
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1016 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1017 |
CommentHelper ch = utils.getCommentHelper(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1018 |
String tagName = ch.getTagName(see); |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1019 |
String seetext = replaceDocRootDir(utils.normalizeNewlines(ch.getText(see)).toString()); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1020 |
// Check if @see is an href or "string" |
10 | 1021 |
if (seetext.startsWith("<") || seetext.startsWith("\"")) { |
17568
d9691936f5f9
8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents:
17567
diff
changeset
|
1022 |
return new RawHtml(seetext); |
10 | 1023 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1024 |
boolean isLinkPlain = kind == LINK_PLAIN; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1025 |
Content label = plainOrCode(isLinkPlain, new RawHtml(ch.getLabel(configuration, see))); |
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1026 |
|
10 | 1027 |
//The text from the @see tag. We will output this text when a label is not specified. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1028 |
Content text = plainOrCode(kind == LINK_PLAIN, new RawHtml(seetext)); |
10 | 1029 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1030 |
TypeElement refClass = ch.getReferencedClass(configuration, see); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1031 |
String refClassName = ch.getReferencedClassName(configuration, see); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1032 |
Element refMem = ch.getReferencedMember(configuration, see); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1033 |
String refMemName = ch.getReferencedMemberName(see); |
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1034 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1035 |
if (refMemName == null && refMem != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1036 |
refMemName = refMem.toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1037 |
} |
10 | 1038 |
if (refClass == null) { |
1039 |
//@see is not referencing an included class |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1040 |
PackageElement refPackage = ch.getReferencedPackage(configuration, see); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1041 |
if (refPackage != null && utils.isIncluded(refPackage)) { |
10 | 1042 |
//@see is referencing an included package |
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1043 |
if (label.isEmpty()) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1044 |
label = plainOrCode(isLinkPlain, |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1045 |
new StringContent(refPackage.getQualifiedName())); |
17568
d9691936f5f9
8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents:
17567
diff
changeset
|
1046 |
return getPackageLink(refPackage, label); |
10 | 1047 |
} else { |
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48029
diff
changeset
|
1048 |
// @see is not referencing an included class, module or package. Check for cross links. |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48029
diff
changeset
|
1049 |
DocLink elementCrossLink = (configuration.extern.isModule(refClassName)) |
51861
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
1050 |
? getCrossModuleLink(utils.elementUtils.getModuleElement(refClassName)) : |
f7d40158eb2f
8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents:
51797
diff
changeset
|
1051 |
(refPackage != null) ? getCrossPackageLink(refPackage) : null; |
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48029
diff
changeset
|
1052 |
if (elementCrossLink != null) { |
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48029
diff
changeset
|
1053 |
// Element cross link found |
48654
36f58bd6269f
8195796: Reduce the size of relative URLs in generated docs
jjg
parents:
48295
diff
changeset
|
1054 |
return links.createLink(elementCrossLink, |
48295
c79d31ba84b9
8164407: Add module support for -link and -linkoffline javadoc option
bpatel
parents:
48029
diff
changeset
|
1055 |
(label.isEmpty() ? text : label), true); |
10 | 1056 |
} else { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1057 |
// No cross link found so print warning |
40303 | 1058 |
messages.warning(ch.getDocTreePath(see), |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1059 |
"doclet.see.class_or_package_not_found", |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1060 |
"@" + tagName, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1061 |
seetext); |
17568
d9691936f5f9
8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents:
17567
diff
changeset
|
1062 |
return (label.isEmpty() ? text: label); |
10 | 1063 |
} |
1064 |
} |
|
1065 |
} else if (refMemName == null) { |
|
1066 |
// Must be a class reference since refClass is not null and refMemName is null. |
|
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1067 |
if (label.isEmpty()) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1068 |
/* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1069 |
* it seems to me this is the right thing to do, but it causes comparator failures. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1070 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1071 |
if (!configuration.backwardCompatibility) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1072 |
StringContent content = utils.isEnclosingPackageIncluded(refClass) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1073 |
? new StringContent(utils.getSimpleName(refClass)) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1074 |
: new StringContent(utils.getFullyQualifiedName(refClass)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1075 |
label = plainOrCode(isLinkPlain, content); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1076 |
} else { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1077 |
label = plainOrCode(isLinkPlain, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1078 |
new StringContent(utils.getSimpleName(refClass))); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1079 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1080 |
|
10 | 1081 |
} |
17561 | 1082 |
return getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, refClass) |
17568
d9691936f5f9
8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents:
17567
diff
changeset
|
1083 |
.label(label)); |
10 | 1084 |
} else if (refMem == null) { |
1085 |
// Must be a member reference since refClass is not null and refMemName is not null. |
|
1086 |
// However, refMem is null, so this referenced member does not exist. |
|
17568
d9691936f5f9
8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents:
17567
diff
changeset
|
1087 |
return (label.isEmpty() ? text: label); |
10 | 1088 |
} else { |
1089 |
// Must be a member reference since refClass is not null and refMemName is not null. |
|
1090 |
// refMem is not null, so this @see tag must be referencing a valid member. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1091 |
TypeElement containing = utils.getEnclosingTypeElement(refMem); |
47395
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1092 |
|
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1093 |
// Find the enclosing type where the method is actually visible |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1094 |
// in the inheritance hierarchy. |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
1095 |
ExecutableElement overriddenMethod = null; |
47395
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1096 |
if (refMem.getKind() == ElementKind.METHOD) { |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
1097 |
VisibleMemberTable vmt = configuration.getVisibleMemberTable(containing); |
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
1098 |
overriddenMethod = vmt.getOverriddenMethod((ExecutableElement)refMem); |
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
1099 |
|
47395
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1100 |
if (overriddenMethod != null) |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1101 |
containing = utils.getEnclosingTypeElement(overriddenMethod); |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1102 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1103 |
if (ch.getText(see).trim().startsWith("#") && |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1104 |
! (utils.isPublic(containing) || utils.isLinkable(containing))) { |
10 | 1105 |
// Since the link is relative and the holder is not even being |
1106 |
// documented, this must be an inherited link. Redirect it. |
|
1107 |
// The current class either overrides the referenced member or |
|
1108 |
// inherits it automatically. |
|
3891
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1109 |
if (this instanceof ClassWriterImpl) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1110 |
containing = ((ClassWriterImpl) this).getTypeElement(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1111 |
} else if (!utils.isPublic(containing)) { |
40303 | 1112 |
messages.warning( |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1113 |
ch.getDocTreePath(see), "doclet.see.class_or_package_not_accessible", |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1114 |
tagName, utils.getFullyQualifiedName(containing)); |
3891
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1115 |
} else { |
40303 | 1116 |
messages.warning( |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1117 |
ch.getDocTreePath(see), "doclet.see.class_or_package_not_found", |
3891
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1118 |
tagName, seetext); |
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1119 |
} |
10 | 1120 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1121 |
if (configuration.currentTypeElement != containing) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1122 |
refMemName = (utils.isConstructor(refMem)) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1123 |
? refMemName |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1124 |
: utils.getSimpleName(containing) + "." + refMemName; |
10 | 1125 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1126 |
if (utils.isExecutableElement(refMem)) { |
10 | 1127 |
if (refMemName.indexOf('(') < 0) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1128 |
refMemName += utils.makeSignature((ExecutableElement)refMem, true); |
10 | 1129 |
} |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
1130 |
if (overriddenMethod != null) { |
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
1131 |
// The method to actually link. |
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
1132 |
refMem = overriddenMethod; |
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
1133 |
} |
10 | 1134 |
} |
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1135 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1136 |
text = plainOrCode(kind == LINK_PLAIN, new StringContent(refMemName)); |
10 | 1137 |
|
17558
eee4ccf66cfd
8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents:
17547
diff
changeset
|
1138 |
return getDocLink(LinkInfoImpl.Kind.SEE_TAG, containing, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1139 |
refMem, (label.isEmpty() ? text: label), false); |
10 | 1140 |
} |
1141 |
} |
|
1142 |
||
17560 | 1143 |
private Content plainOrCode(boolean plain, Content body) { |
1144 |
return (plain || body.isEmpty()) ? body : HtmlTree.CODE(body); |
|
1145 |
} |
|
1146 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1147 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1148 |
* Add the inline comment. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1149 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1150 |
* @param element the Element for which the inline comment will be added |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1151 |
* @param tag the inline tag to be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1152 |
* @param htmltree the content tree to which the comment will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1153 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1154 |
public void addInlineComment(Element element, DocTree tag, Content htmltree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1155 |
CommentHelper ch = utils.getCommentHelper(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1156 |
List<? extends DocTree> description = ch.getDescription(configuration, tag); |
51862 | 1157 |
addCommentTags(element, tag, description, false, false, false, htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1158 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1159 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1160 |
/** |
42816
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1161 |
* Get the deprecated phrase as content. |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1162 |
* |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1163 |
* @param e the Element for which the inline deprecated comment will be added |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1164 |
* @return a content tree for the deprecated phrase. |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1165 |
*/ |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1166 |
public Content getDeprecatedPhrase(Element e) { |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1167 |
return (utils.isDeprecatedForRemoval(e)) |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1168 |
? contents.deprecatedForRemovalPhrase |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1169 |
: contents.deprecatedPhrase; |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1170 |
} |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1171 |
|
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1172 |
/** |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1173 |
* Add the inline deprecated comment. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1174 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1175 |
* @param e the Element for which the inline deprecated comment will be added |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1176 |
* @param tag the inline tag to be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1177 |
* @param htmltree the content tree to which the comment will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1178 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1179 |
public void addInlineDeprecatedComment(Element e, DocTree tag, Content htmltree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1180 |
CommentHelper ch = utils.getCommentHelper(e); |
51862 | 1181 |
addCommentTags(e, ch.getBody(configuration, tag), true, false, false, htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1182 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1183 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1184 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1185 |
* Adds the summary content. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1186 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1187 |
* @param element the Element for which the summary will be generated |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1188 |
* @param htmltree the documentation tree to which the summary will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1189 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1190 |
public void addSummaryComment(Element element, Content htmltree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1191 |
addSummaryComment(element, utils.getFirstSentenceTrees(element), htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1192 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1193 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1194 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1195 |
* Adds the summary content. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1196 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1197 |
* @param element the Element for which the summary will be generated |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1198 |
* @param firstSentenceTags the first sentence tags for the doc |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1199 |
* @param htmltree the documentation tree to which the summary will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1200 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1201 |
public void addSummaryComment(Element element, List<? extends DocTree> firstSentenceTags, Content htmltree) { |
51862 | 1202 |
addCommentTags(element, firstSentenceTags, false, true, true, htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1203 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1204 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1205 |
public void addSummaryDeprecatedComment(Element element, DocTree tag, Content htmltree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1206 |
CommentHelper ch = utils.getCommentHelper(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1207 |
List<? extends DocTree> body = ch.getBody(configuration, tag); |
51862 | 1208 |
addCommentTags(element, ch.getFirstSentenceTrees(configuration, body), true, true, true, htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1209 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1210 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1211 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1212 |
* Adds the inline comment. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1213 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1214 |
* @param element the Element for which the inline comments will be generated |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1215 |
* @param htmltree the documentation tree to which the inline comments will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1216 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1217 |
public void addInlineComment(Element element, Content htmltree) { |
51862 | 1218 |
addCommentTags(element, utils.getFullBody(element), false, false, false, htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1219 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1220 |
|
10 | 1221 |
/** |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1222 |
* Adds the comment tags. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1223 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1224 |
* @param element the Element for which the comment tags will be generated |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1225 |
* @param tags the first sentence tags for the doc |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1226 |
* @param depr true if it is deprecated |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1227 |
* @param first true if the first sentence tags should be added |
51862 | 1228 |
* @param inSummary true if the comment tags are added into the summary section |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1229 |
* @param htmltree the documentation tree to which the comment tags will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1230 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1231 |
private void addCommentTags(Element element, List<? extends DocTree> tags, boolean depr, |
51862 | 1232 |
boolean first, boolean inSummary, Content htmltree) { |
1233 |
addCommentTags(element, null, tags, depr, first, inSummary, htmltree); |
|
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1234 |
} |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1235 |
|
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1236 |
/** |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1237 |
* Adds the comment tags. |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1238 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1239 |
* @param element for which the comment tags will be generated |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1240 |
* @param holderTag the block tag context for the inline tags |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1241 |
* @param tags the first sentence tags for the doc |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1242 |
* @param depr true if it is deprecated |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1243 |
* @param first true if the first sentence tags should be added |
51862 | 1244 |
* @param inSummary true if the comment tags are added into the summary section |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1245 |
* @param htmltree the documentation tree to which the comment tags will be added |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1246 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1247 |
private void addCommentTags(Element element, DocTree holderTag, List<? extends DocTree> tags, boolean depr, |
51862 | 1248 |
boolean first, boolean inSummary, Content htmltree) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1249 |
if(configuration.nocomment){ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1250 |
return; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1251 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1252 |
Content div; |
51862 | 1253 |
Content result = commentTagsToContent(null, element, tags, first, inSummary); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1254 |
if (depr) { |
47300
a905ce398074
8074407: javadoc: using <pre> after @deprecated tag causes warnings
bpatel
parents:
47216
diff
changeset
|
1255 |
div = HtmlTree.DIV(HtmlStyle.deprecationComment, result); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1256 |
htmltree.add(div); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1257 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1258 |
else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1259 |
div = HtmlTree.DIV(HtmlStyle.block, result); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1260 |
htmltree.add(div); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1261 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1262 |
if (tags.isEmpty()) { |
54610 | 1263 |
htmltree.add(Entity.NO_BREAK_SPACE); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1264 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1265 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1266 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1267 |
boolean ignoreNonInlineTag(DocTree dtree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1268 |
Name name = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1269 |
if (dtree.getKind() == Kind.START_ELEMENT) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1270 |
StartElementTree setree = (StartElementTree)dtree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1271 |
name = setree.getName(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1272 |
} else if (dtree.getKind() == Kind.END_ELEMENT) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1273 |
EndElementTree eetree = (EndElementTree)dtree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1274 |
name = eetree.getName(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1275 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1276 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1277 |
if (name != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1278 |
com.sun.tools.doclint.HtmlTag htmlTag = com.sun.tools.doclint.HtmlTag.get(name); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1279 |
if (htmlTag != null && |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1280 |
htmlTag.blockType != com.sun.tools.doclint.HtmlTag.BlockType.INLINE) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1281 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1282 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1283 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1284 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1285 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1286 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1287 |
boolean isAllWhiteSpace(String body) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1288 |
for (int i = 0 ; i < body.length(); i++) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1289 |
if (!Character.isWhitespace(body.charAt(i))) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1290 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1291 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1292 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1293 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1294 |
|
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1295 |
// Notify the next DocTree handler to take necessary action |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1296 |
private boolean commentRemoved = false; |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1297 |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1298 |
/** |
51862 | 1299 |
* Converts inline tags and text to Content, expanding the |
10 | 1300 |
* inline tags along the way. Called wherever text can contain |
1301 |
* an inline tag, such as in comments or in free-form text arguments |
|
51862 | 1302 |
* to block tags. |
10 | 1303 |
* |
1304 |
* @param holderTag specific tag where comment resides |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1305 |
* @param element specific element where comment resides |
10 | 1306 |
* @param tags array of text tags and inline tags (often alternating) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1307 |
present in the text of interest for this element |
10 | 1308 |
* @param isFirstSentence true if text is first sentence |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1309 |
* @return a Content object |
10 | 1310 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1311 |
public Content commentTagsToContent(DocTree holderTag, Element element, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1312 |
List<? extends DocTree> tags, boolean isFirstSentence) { |
51862 | 1313 |
return commentTagsToContent(holderTag, element, tags, isFirstSentence, false); |
1314 |
} |
|
1315 |
||
1316 |
/** |
|
1317 |
* Converts inline tags and text to text strings, expanding the |
|
1318 |
* inline tags along the way. Called wherever text can contain |
|
1319 |
* an inline tag, such as in comments or in free-form text arguments |
|
1320 |
* to block tags. |
|
1321 |
* |
|
1322 |
* @param holderTag specific tag where comment resides |
|
1323 |
* @param element specific element where comment resides |
|
1324 |
* @param tags array of text tags and inline tags (often alternating) |
|
1325 |
present in the text of interest for this element |
|
1326 |
* @param isFirstSentence true if text is first sentence |
|
1327 |
* @param inSummary if the comment tags are added into the summary section |
|
1328 |
* @return a Content object |
|
1329 |
*/ |
|
1330 |
public Content commentTagsToContent(DocTree holderTag, Element element, |
|
1331 |
List<? extends DocTree> tags, boolean isFirstSentence, boolean inSummary) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1332 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1333 |
final Content result = new ContentBuilder() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1334 |
@Override |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1335 |
public void add(CharSequence text) { |
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1336 |
super.add(utils.normalizeNewlines(text)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1337 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1338 |
}; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1339 |
CommentHelper ch = utils.getCommentHelper(element); |
10 | 1340 |
// Array of all possible inline tags for this javadoc run |
50240 | 1341 |
configuration.tagletManager.checkTags(element, tags, true); |
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1342 |
commentRemoved = false; |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1343 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1344 |
for (ListIterator<? extends DocTree> iterator = tags.listIterator(); iterator.hasNext();) { |
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1345 |
boolean isFirstNode = !iterator.hasPrevious(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1346 |
DocTree tag = iterator.next(); |
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1347 |
boolean isLastNode = !iterator.hasNext(); |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1348 |
|
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1349 |
if (isFirstSentence) { |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1350 |
// Ignore block tags |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1351 |
if (ignoreNonInlineTag(tag)) |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1352 |
continue; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1353 |
|
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1354 |
// Ignore any trailing whitespace OR whitespace after removed html comment |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1355 |
if ((isLastNode || commentRemoved) |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1356 |
&& tag.getKind() == TEXT |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1357 |
&& isAllWhiteSpace(ch.getText(tag))) |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1358 |
continue; |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1359 |
|
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1360 |
// Ignore any leading html comments |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1361 |
if ((isFirstNode || commentRemoved) && tag.getKind() == COMMENT) { |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1362 |
commentRemoved = true; |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1363 |
continue; |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1364 |
} |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1365 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1366 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1367 |
boolean allDone = new SimpleDocTreeVisitor<Boolean, Content>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1368 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1369 |
private boolean inAnAtag() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1370 |
if (utils.isStartElement(tag)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1371 |
StartElementTree st = (StartElementTree)tag; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1372 |
Name name = st.getName(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1373 |
if (name != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1374 |
com.sun.tools.doclint.HtmlTag htag = |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1375 |
com.sun.tools.doclint.HtmlTag.get(name); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1376 |
return htag != null && htag.equals(com.sun.tools.doclint.HtmlTag.A); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1377 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1378 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1379 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1380 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1381 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1382 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1383 |
public Boolean visitAttribute(AttributeTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1384 |
StringBuilder sb = new StringBuilder(SPACER).append(node.getName()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1385 |
if (node.getValueKind() == ValueKind.EMPTY) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1386 |
result.add(sb); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1387 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1388 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1389 |
sb.append("="); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1390 |
String quote; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1391 |
switch (node.getValueKind()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1392 |
case DOUBLE: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1393 |
quote = "\""; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1394 |
break; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1395 |
case SINGLE: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1396 |
quote = "\'"; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1397 |
break; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1398 |
default: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1399 |
quote = ""; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1400 |
break; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1401 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1402 |
sb.append(quote); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1403 |
result.add(sb); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1404 |
Content docRootContent = new ContentBuilder(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1405 |
|
48655
e1876e6b57b6
8195805: Doclet incorrectly updates all attributes in <a> tags when relocating links
jjg
parents:
48654
diff
changeset
|
1406 |
boolean isHRef = inAnAtag() && node.getName().toString().equalsIgnoreCase("href"); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1407 |
for (DocTree dt : node.getValue()) { |
48655
e1876e6b57b6
8195805: Doclet incorrectly updates all attributes in <a> tags when relocating links
jjg
parents:
48654
diff
changeset
|
1408 |
if (utils.isText(dt) && isHRef) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1409 |
String text = ((TextTree) dt).getBody(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1410 |
if (text.startsWith("/..") && !configuration.docrootparent.isEmpty()) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1411 |
result.add(configuration.docrootparent); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1412 |
docRootContent = new ContentBuilder(); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1413 |
result.add(textCleanup(text.substring(3), isLastNode)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1414 |
} else { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1415 |
if (!docRootContent.isEmpty()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1416 |
docRootContent = copyDocRootContent(docRootContent); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1417 |
} else { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1418 |
text = redirectRelativeLinks(element, (TextTree) dt); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1419 |
} |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1420 |
result.add(textCleanup(text, isLastNode)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1421 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1422 |
} else { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1423 |
docRootContent = copyDocRootContent(docRootContent); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1424 |
dt.accept(this, docRootContent); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1425 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1426 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1427 |
copyDocRootContent(docRootContent); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1428 |
result.add(quote); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1429 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1430 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1431 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1432 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1433 |
public Boolean visitComment(CommentTree node, Content c) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1434 |
result.add(new RawHtml(node.getBody())); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1435 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1436 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1437 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1438 |
private Content copyDocRootContent(Content content) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1439 |
if (!content.isEmpty()) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1440 |
result.add(content); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1441 |
return new ContentBuilder(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1442 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1443 |
return content; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1444 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1445 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1446 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1447 |
public Boolean visitDocRoot(DocRootTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1448 |
Content docRootContent = TagletWriter.getInlineTagOutput(element, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1449 |
configuration.tagletManager, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1450 |
holderTag, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1451 |
node, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1452 |
getTagletWriterInstance(isFirstSentence)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1453 |
if (c != null) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1454 |
c.add(docRootContent); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1455 |
} else { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1456 |
result.add(docRootContent); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1457 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1458 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1459 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1460 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1461 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1462 |
public Boolean visitEndElement(EndElementTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1463 |
RawHtml rawHtml = new RawHtml("</" + node.getName() + ">"); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1464 |
result.add(rawHtml); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1465 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1466 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1467 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1468 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1469 |
public Boolean visitEntity(EntityTree node, Content c) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1470 |
result.add(new RawHtml(node.toString())); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1471 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1472 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1473 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1474 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1475 |
public Boolean visitErroneous(ErroneousTree node, Content c) { |
40303 | 1476 |
messages.warning(ch.getDocTreePath(node), |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1477 |
"doclet.tag.invalid_usage", node); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1478 |
result.add(new RawHtml(node.toString())); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1479 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1480 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1481 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1482 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1483 |
public Boolean visitInheritDoc(InheritDocTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1484 |
Content output = TagletWriter.getInlineTagOutput(element, |
22005
4270ada5dcd1
8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents:
21494
diff
changeset
|
1485 |
configuration.tagletManager, holderTag, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1486 |
tag, getTagletWriterInstance(isFirstSentence)); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1487 |
result.add(output); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1488 |
// if we obtained the first sentence successfully, nothing more to do |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1489 |
return (isFirstSentence && !output.isEmpty()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1490 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1491 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1492 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1493 |
public Boolean visitIndex(IndexTree node, Content p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1494 |
Content output = TagletWriter.getInlineTagOutput(element, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1495 |
configuration.tagletManager, holderTag, tag, |
51862 | 1496 |
getTagletWriterInstance(isFirstSentence, inSummary)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1497 |
if (output != null) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1498 |
result.add(output); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1499 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1500 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1501 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1502 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1503 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1504 |
public Boolean visitLink(LinkTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1505 |
// we need to pass the DocTreeImpl here, so ignore node |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1506 |
result.add(seeTagToContent(element, tag)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1507 |
return false; |
10 | 1508 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1509 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1510 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1511 |
public Boolean visitLiteral(LiteralTree node, Content c) { |
50116
cebd0673feeb
8203176: javadoc handles non-ASCII characters incorrectly.
jjg
parents:
49879
diff
changeset
|
1512 |
String s = node.getBody().getBody(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1513 |
Content content = new StringContent(utils.normalizeNewlines(s)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1514 |
if (node.getKind() == CODE) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1515 |
content = HtmlTree.CODE(content); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1516 |
result.add(content); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1517 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1518 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1519 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1520 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1521 |
public Boolean visitSee(SeeTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1522 |
// we need to pass the DocTreeImpl here, so ignore node |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1523 |
result.add(seeTagToContent(element, tag)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1524 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1525 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1526 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1527 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1528 |
public Boolean visitStartElement(StartElementTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1529 |
String text = "<" + node.getName(); |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1530 |
RawHtml rawHtml = new RawHtml(utils.normalizeNewlines(text)); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1531 |
result.add(rawHtml); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1532 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1533 |
for (DocTree dt : node.getAttributes()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1534 |
dt.accept(this, null); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1535 |
} |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1536 |
result.add(new RawHtml(node.isSelfClosing() ? "/>" : ">")); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1537 |
return false; |
9608 | 1538 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1539 |
|
46184
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1540 |
@Override |
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1541 |
public Boolean visitSummary(SummaryTree node, Content c) { |
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1542 |
Content output = TagletWriter.getInlineTagOutput(element, |
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1543 |
configuration.tagletManager, holderTag, tag, |
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1544 |
getTagletWriterInstance(isFirstSentence)); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1545 |
result.add(output); |
46184
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1546 |
return false; |
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1547 |
} |
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1548 |
|
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
51862
diff
changeset
|
1549 |
@Override |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
51862
diff
changeset
|
1550 |
public Boolean visitSystemProperty(SystemPropertyTree node, Content p) { |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
51862
diff
changeset
|
1551 |
Content output = TagletWriter.getInlineTagOutput(element, |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
51862
diff
changeset
|
1552 |
configuration.tagletManager, holderTag, tag, |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
51862
diff
changeset
|
1553 |
getTagletWriterInstance(isFirstSentence, inSummary)); |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
51862
diff
changeset
|
1554 |
if (output != null) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1555 |
result.add(output); |
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
51862
diff
changeset
|
1556 |
} |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
51862
diff
changeset
|
1557 |
return false; |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
51862
diff
changeset
|
1558 |
} |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
51862
diff
changeset
|
1559 |
|
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1560 |
private CharSequence textCleanup(String text, boolean isLast) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1561 |
return textCleanup(text, isLast, false); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1562 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1563 |
|
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1564 |
private CharSequence textCleanup(String text, boolean isLast, boolean trimLeader) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1565 |
if (trimLeader) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1566 |
text = removeLeadingWhitespace(text); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1567 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1568 |
if (isFirstSentence && isLast) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1569 |
text = removeTrailingWhitespace(text); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1570 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1571 |
text = utils.replaceTabs(text); |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1572 |
return utils.normalizeNewlines(text); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1573 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1574 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1575 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1576 |
public Boolean visitText(TextTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1577 |
String text = node.getBody(); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1578 |
result.add(new RawHtml(textCleanup(text, isLastNode, commentRemoved))); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1579 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1580 |
} |
10 | 1581 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1582 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1583 |
protected Boolean defaultAction(DocTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1584 |
Content output = TagletWriter.getInlineTagOutput(element, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1585 |
configuration.tagletManager, holderTag, tag, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1586 |
getTagletWriterInstance(isFirstSentence)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1587 |
if (output != null) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1588 |
result.add(output); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1589 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1590 |
return false; |
10 | 1591 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1592 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1593 |
}.visit(tag, null); |
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1594 |
commentRemoved = false; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1595 |
if (allDone) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1596 |
break; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1597 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1598 |
return result; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1599 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1600 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1601 |
private String removeTrailingWhitespace(String text) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1602 |
char[] buf = text.toCharArray(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1603 |
for (int i = buf.length - 1; i > 0 ; i--) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1604 |
if (!Character.isWhitespace(buf[i])) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1605 |
return text.substring(0, i + 1); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1606 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1607 |
return text; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1608 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1609 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1610 |
private String removeLeadingWhitespace(String text) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1611 |
char[] buf = text.toCharArray(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1612 |
for (int i = 0; i < buf.length; i++) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1613 |
if (!Character.isWhitespace(buf[i])) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1614 |
return text.substring(i); |
10 | 1615 |
} |
1616 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1617 |
return text; |
10 | 1618 |
} |
1619 |
||
1620 |
/** |
|
1621 |
* Return true if relative links should not be redirected. |
|
1622 |
* |
|
1623 |
* @return Return true if a relative link should not be redirected. |
|
1624 |
*/ |
|
1625 |
private boolean shouldNotRedirectRelativeLinks() { |
|
1626 |
return this instanceof AnnotationTypeWriter || |
|
1627 |
this instanceof ClassWriter || |
|
1628 |
this instanceof PackageSummaryWriter; |
|
1629 |
} |
|
1630 |
||
1631 |
/** |
|
1632 |
* Suppose a piece of documentation has a relative link. When you copy |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1633 |
* that documentation to another place such as the index or class-use page, |
10 | 1634 |
* that relative link will no longer work. We should redirect those links |
1635 |
* so that they will work again. |
|
1636 |
* <p> |
|
1637 |
* Here is the algorithm used to fix the link: |
|
1638 |
* <p> |
|
13844 | 1639 |
* {@literal <relative link> => docRoot + <relative path to file> + <relative link> } |
10 | 1640 |
* <p> |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1641 |
* For example, suppose DocletEnvironment has this link: |
13844 | 1642 |
* {@literal <a href="package-summary.html">The package Page</a> } |
10 | 1643 |
* <p> |
1644 |
* If this link appeared in the index, we would redirect |
|
1645 |
* the link like this: |
|
1646 |
* |
|
53885
e03bbe023e50
8215584: Remove support for the "old" doclet API in com/sun/javadoc
pmuthuswamy
parents:
53880
diff
changeset
|
1647 |
* {@literal <a href="./jdk/javadoc/doclet/package-summary.html">The package Page</a>} |
10 | 1648 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1649 |
* @param element the Element object whose documentation is being written. |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
1650 |
* @param tt the text being written. |
10 | 1651 |
* |
1652 |
* @return the text, with all the relative links redirected to work. |
|
1653 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1654 |
private String redirectRelativeLinks(Element element, TextTree tt) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1655 |
String text = tt.getBody(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1656 |
if (element == null || utils.isOverviewElement(element) || shouldNotRedirectRelativeLinks()) { |
10 | 1657 |
return text; |
1658 |
} |
|
1659 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1660 |
DocPath redirectPathFromRoot = new SimpleElementVisitor9<DocPath, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1661 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1662 |
public DocPath visitType(TypeElement e, Void p) { |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48756
diff
changeset
|
1663 |
return docPaths.forPackage(utils.containingPackage(e)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1664 |
} |
10 | 1665 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1666 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1667 |
public DocPath visitPackage(PackageElement e, Void p) { |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48756
diff
changeset
|
1668 |
return docPaths.forPackage(e); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1669 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1670 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1671 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1672 |
public DocPath visitVariable(VariableElement e, Void p) { |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48756
diff
changeset
|
1673 |
return docPaths.forPackage(utils.containingPackage(e)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1674 |
} |
10 | 1675 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1676 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1677 |
public DocPath visitExecutable(ExecutableElement e, Void p) { |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48756
diff
changeset
|
1678 |
return docPaths.forPackage(utils.containingPackage(e)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1679 |
} |
23123
fd8ad69ac7fe
6457406: javadoc doesn't handle <a href='http://...'> properly in producing index pages
yan
parents:
22163
diff
changeset
|
1680 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1681 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1682 |
protected DocPath defaultAction(Element e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1683 |
return null; |
10 | 1684 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1685 |
}.visit(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1686 |
if (redirectPathFromRoot == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1687 |
return text; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1688 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1689 |
String lower = Utils.toLowerCase(text); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1690 |
if (!(lower.startsWith("mailto:") |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1691 |
|| lower.startsWith("http:") |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1692 |
|| lower.startsWith("https:") |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1693 |
|| lower.startsWith("file:"))) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1694 |
text = "{@" + (new DocRootTaglet()).getName() + "}/" |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1695 |
+ redirectPathFromRoot.resolve(text).getPath(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1696 |
text = replaceDocRootDir(text); |
10 | 1697 |
} |
1698 |
return text; |
|
1699 |
} |
|
1700 |
||
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
1701 |
/** |
9303
eae35c201e19
7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents:
8631
diff
changeset
|
1702 |
* According to |
eae35c201e19
7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents:
8631
diff
changeset
|
1703 |
* <cite>The Java™ Language Specification</cite>, |
eae35c201e19
7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents:
8631
diff
changeset
|
1704 |
* all the outer classes and static nested classes are core classes. |
10 | 1705 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1706 |
public boolean isCoreClass(TypeElement typeElement) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1707 |
return utils.getEnclosingTypeElement(typeElement) == null || utils.isStatic(typeElement); |
10 | 1708 |
} |
1709 |
||
1710 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1711 |
* Adds the annotation types for the given packageElement. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1712 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1713 |
* @param packageElement the package to write annotations for. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1714 |
* @param htmltree the documentation tree to which the annotation info will be |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1715 |
* added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1716 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1717 |
public void addAnnotationInfo(PackageElement packageElement, Content htmltree) { |
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1718 |
addAnnotationInfo(packageElement.getAnnotationMirrors(), htmltree); |
15385 | 1719 |
} |
1720 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1721 |
/* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1722 |
* this is a hack to delay dealing with Annotations in the writers, the assumption |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1723 |
* is that all necessary checks have been made to get here. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1724 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1725 |
public void addReceiverAnnotationInfo(ExecutableElement method, TypeMirror rcvrTypeMirror, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1726 |
List<? extends AnnotationMirror> annotationMirrors, Content htmltree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1727 |
TypeMirror rcvrType = method.getReceiverType(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1728 |
List<? extends AnnotationMirror> annotationMirrors1 = rcvrType.getAnnotationMirrors(); |
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1729 |
htmltree.add(getAnnotationInfo(annotationMirrors1, false)); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1730 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1731 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1732 |
/** |
47849 | 1733 |
* Adds the annotation types for the given element. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1734 |
* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1735 |
* @param element the package to write annotations for |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1736 |
* @param htmltree the content tree to which the annotation types will be added |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1737 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1738 |
public void addAnnotationInfo(Element element, Content htmltree) { |
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1739 |
addAnnotationInfo(element.getAnnotationMirrors(), htmltree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1740 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1741 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1742 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1743 |
* Add the annotatation types for the given element and parameter. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1744 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1745 |
* @param param the parameter to write annotations for. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1746 |
* @param tree the content tree to which the annotation types will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1747 |
*/ |
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1748 |
public boolean addAnnotationInfo(VariableElement param, Content tree) { |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1749 |
Content annotaionInfo = getAnnotationInfo(param.getAnnotationMirrors(), false); |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1750 |
if (annotaionInfo.isEmpty()) { |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1751 |
return false; |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1752 |
} |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1753 |
tree.add(annotaionInfo); |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1754 |
return true; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1755 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1756 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1757 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1758 |
* Adds the annotatation types for the given Element. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1759 |
* |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
1760 |
* @param descList a list of annotation mirrors. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1761 |
* @param htmltree the documentation tree to which the annotation info will be |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1762 |
* added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1763 |
*/ |
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1764 |
private void addAnnotationInfo(List<? extends AnnotationMirror> descList, Content htmltree) { |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1765 |
htmltree.add(getAnnotationInfo(descList, true)); |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1766 |
} |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1767 |
|
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1768 |
/** |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1769 |
* Return a content tree containing the annotation types for the given element. |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1770 |
* |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1771 |
* @param descList a list of annotation mirrors. |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1772 |
* @return the documentation tree containing the annotation info. |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1773 |
*/ |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1774 |
Content getAnnotationInfo(List<? extends AnnotationMirror> descList, boolean lineBreak) { |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1775 |
List<Content> annotations = getAnnotations(descList, lineBreak); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1776 |
String sep = ""; |
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1777 |
ContentBuilder builder = new ContentBuilder(); |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
1778 |
for (Content annotation: annotations) { |
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1779 |
builder.add(sep); |
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1780 |
builder.add(annotation); |
31943
72b69ab429c9
8062647: Wrong indentation of arguments of annotated methods
igerasim
parents:
31297
diff
changeset
|
1781 |
if (!lineBreak) { |
72b69ab429c9
8062647: Wrong indentation of arguments of annotated methods
igerasim
parents:
31297
diff
changeset
|
1782 |
sep = " "; |
72b69ab429c9
8062647: Wrong indentation of arguments of annotated methods
igerasim
parents:
31297
diff
changeset
|
1783 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1784 |
} |
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1785 |
return builder; |
15385 | 1786 |
} |
1787 |
||
1788 |
/** |
|
1789 |
* Return the string representations of the annotation types for |
|
1790 |
* the given doc. |
|
1791 |
* |
|
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
1792 |
* @param descList a list of annotation mirrors. |
15385 | 1793 |
* @param linkBreak if true, add new line between each member value. |
49879
601277b1d582
8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents:
49551
diff
changeset
|
1794 |
* @return a list of strings representing the annotations being |
15385 | 1795 |
* documented. |
1796 |
*/ |
|
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1797 |
public List<Content> getAnnotations(List<? extends AnnotationMirror> descList, boolean linkBreak) { |
22163 | 1798 |
List<Content> results = new ArrayList<>(); |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
1799 |
ContentBuilder annotation; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1800 |
for (AnnotationMirror aDesc : descList) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1801 |
TypeElement annotationElement = (TypeElement)aDesc.getAnnotationType().asElement(); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1802 |
// If an annotation is not documented, do not add it to the list. If |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1803 |
// the annotation is of a repeatable type, and if it is not documented |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1804 |
// and also if its container annotation is not documented, do not add it |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1805 |
// to the list. If an annotation of a repeatable type is not documented |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1806 |
// but its container is documented, it will be added to the list. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1807 |
if (!utils.isDocumentedAnnotation(annotationElement) && |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
1808 |
(!isAnnotationDocumented && !isContainerDocumented)) { |
10 | 1809 |
continue; |
1810 |
} |
|
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
1811 |
annotation = new ContentBuilder(); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1812 |
isAnnotationDocumented = false; |
14542 | 1813 |
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1814 |
LinkInfoImpl.Kind.ANNOTATION, annotationElement); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1815 |
Map<? extends ExecutableElement, ? extends AnnotationValue> pairs = aDesc.getElementValues(); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1816 |
// If the annotation is synthesized, do not print the container. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1817 |
if (utils.configuration.workArounds.isSynthesized(aDesc)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1818 |
for (ExecutableElement ee : pairs.keySet()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1819 |
AnnotationValue annotationValue = pairs.get(ee); |
22163 | 1820 |
List<AnnotationValue> annotationTypeValues = new ArrayList<>(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1821 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1822 |
new SimpleAnnotationValueVisitor9<Void, List<AnnotationValue>>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1823 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1824 |
public Void visitArray(List<? extends AnnotationValue> vals, List<AnnotationValue> p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1825 |
p.addAll(vals); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1826 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1827 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1828 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1829 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1830 |
protected Void defaultAction(Object o, List<AnnotationValue> p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1831 |
p.add(annotationValue); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1832 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1833 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1834 |
}.visit(annotationValue, annotationTypeValues); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1835 |
|
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1836 |
String sep = ""; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1837 |
for (AnnotationValue av : annotationTypeValues) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1838 |
annotation.add(sep); |
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1839 |
annotation.add(annotationValueToContent(av)); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1840 |
sep = " "; |
10 | 1841 |
} |
1842 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1843 |
} else if (isAnnotationArray(pairs)) { |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1844 |
// If the container has 1 or more value defined and if the |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1845 |
// repeatable type annotation is not documented, do not print |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1846 |
// the container. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1847 |
if (pairs.size() == 1 && isAnnotationDocumented) { |
22163 | 1848 |
List<AnnotationValue> annotationTypeValues = new ArrayList<>(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1849 |
for (AnnotationValue a : pairs.values()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1850 |
new SimpleAnnotationValueVisitor9<Void, List<AnnotationValue>>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1851 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1852 |
public Void visitArray(List<? extends AnnotationValue> vals, List<AnnotationValue> annotationTypeValues) { |
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1853 |
annotationTypeValues.addAll(vals); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1854 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1855 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1856 |
}.visit(a, annotationTypeValues); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1857 |
} |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1858 |
String sep = ""; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1859 |
for (AnnotationValue av : annotationTypeValues) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1860 |
annotation.add(sep); |
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1861 |
annotation.add(annotationValueToContent(av)); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1862 |
sep = " "; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1863 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1864 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1865 |
// If the container has 1 or more value defined and if the |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1866 |
// repeatable type annotation is not documented, print the container. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1867 |
else { |
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1868 |
addAnnotations(annotationElement, linkInfo, annotation, pairs, false); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1869 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1870 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1871 |
else { |
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1872 |
addAnnotations(annotationElement, linkInfo, annotation, pairs, linkBreak); |
10 | 1873 |
} |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1874 |
annotation.add(linkBreak ? DocletConstants.NL : ""); |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
1875 |
results.add(annotation); |
10 | 1876 |
} |
1877 |
return results; |
|
1878 |
} |
|
1879 |
||
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1880 |
/** |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1881 |
* Add annotation to the annotation string. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1882 |
* |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1883 |
* @param annotationDoc the annotation being documented |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1884 |
* @param linkInfo the information about the link |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1885 |
* @param annotation the annotation string to which the annotation will be added |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47852
diff
changeset
|
1886 |
* @param map annotation type element to annotation value pairs |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1887 |
* @param linkBreak if true, add new line between each member value |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1888 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1889 |
private void addAnnotations(TypeElement annotationDoc, LinkInfoImpl linkInfo, |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47852
diff
changeset
|
1890 |
ContentBuilder annotation, |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
47852
diff
changeset
|
1891 |
Map<? extends ExecutableElement, ? extends AnnotationValue> map, |
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1892 |
boolean linkBreak) { |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1893 |
linkInfo.label = new StringContent("@"); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1894 |
linkInfo.label.add(annotationDoc.getSimpleName()); |
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1895 |
annotation.add(getLink(linkInfo)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1896 |
if (!map.isEmpty()) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1897 |
annotation.add("("); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1898 |
boolean isFirst = true; |
36038
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
1899 |
Set<? extends ExecutableElement> keys = map.keySet(); |
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
1900 |
boolean multipleValues = keys.size() > 1; |
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
1901 |
for (ExecutableElement element : keys) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1902 |
if (isFirst) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1903 |
isFirst = false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1904 |
} else { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1905 |
annotation.add(","); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1906 |
if (linkBreak) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1907 |
annotation.add(DocletConstants.NL); |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1908 |
int spaces = annotationDoc.getSimpleName().length() + 2; |
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
1909 |
for (int k = 0; k < (spaces); k++) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1910 |
annotation.add(" "); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1911 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1912 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1913 |
} |
36038
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
1914 |
String simpleName = element.getSimpleName().toString(); |
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
1915 |
if (multipleValues || !"value".equals(simpleName)) { // Omit "value=" where unnecessary |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1916 |
annotation.add(getDocLink(LinkInfoImpl.Kind.ANNOTATION, |
36038
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
1917 |
element, simpleName, false)); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1918 |
annotation.add("="); |
36038
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
1919 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1920 |
AnnotationValue annotationValue = map.get(element); |
22163 | 1921 |
List<AnnotationValue> annotationTypeValues = new ArrayList<>(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1922 |
new SimpleAnnotationValueVisitor9<Void, AnnotationValue>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1923 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1924 |
public Void visitArray(List<? extends AnnotationValue> vals, AnnotationValue p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1925 |
annotationTypeValues.addAll(vals); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1926 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1927 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1928 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1929 |
protected Void defaultAction(Object o, AnnotationValue p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1930 |
annotationTypeValues.add(p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1931 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1932 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1933 |
}.visit(annotationValue, annotationValue); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1934 |
annotation.add(annotationTypeValues.size() == 1 ? "" : "{"); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1935 |
String sep = ""; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1936 |
for (AnnotationValue av : annotationTypeValues) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1937 |
annotation.add(sep); |
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1938 |
annotation.add(annotationValueToContent(av)); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1939 |
sep = ","; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1940 |
} |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1941 |
annotation.add(annotationTypeValues.size() == 1 ? "" : "}"); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1942 |
isContainerDocumented = false; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1943 |
} |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
1944 |
annotation.add(")"); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1945 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1946 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1947 |
|
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1948 |
/** |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1949 |
* Check if the annotation contains an array of annotation as a value. This |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1950 |
* check is to verify if a repeatable type annotation is present or not. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1951 |
* |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1952 |
* @param pairs annotation type element and value pairs |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1953 |
* |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1954 |
* @return true if the annotation contains an array of annotation as a value. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1955 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1956 |
private boolean isAnnotationArray(Map<? extends ExecutableElement, ? extends AnnotationValue> pairs) { |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1957 |
AnnotationValue annotationValue; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1958 |
for (ExecutableElement ee : pairs.keySet()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1959 |
annotationValue = pairs.get(ee); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1960 |
boolean rvalue = new SimpleAnnotationValueVisitor9<Boolean, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1961 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1962 |
public Boolean visitArray(List<? extends AnnotationValue> vals, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1963 |
if (vals.size() > 1) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1964 |
if (vals.get(0) instanceof AnnotationMirror) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1965 |
isContainerDocumented = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1966 |
return new SimpleAnnotationValueVisitor9<Boolean, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1967 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1968 |
public Boolean visitAnnotation(AnnotationMirror a, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1969 |
isContainerDocumented = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1970 |
Element asElement = a.getAnnotationType().asElement(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1971 |
if (utils.isDocumentedAnnotation((TypeElement)asElement)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1972 |
isAnnotationDocumented = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1973 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1974 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1975 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1976 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1977 |
protected Boolean defaultAction(Object o, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1978 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1979 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1980 |
}.visit(vals.get(0)); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1981 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1982 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1983 |
return false; |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1984 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1985 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1986 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1987 |
protected Boolean defaultAction(Object o, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1988 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1989 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1990 |
}.visit(annotationValue); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1991 |
if (rvalue) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1992 |
return true; |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1993 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1994 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1995 |
return false; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1996 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1997 |
|
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
1998 |
private Content annotationValueToContent(AnnotationValue annotationValue) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1999 |
return new SimpleAnnotationValueVisitor9<Content, Void>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2000 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2001 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2002 |
public Content visitType(TypeMirror t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2003 |
return new SimpleTypeVisitor9<Content, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2004 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2005 |
public Content visitDeclared(DeclaredType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2006 |
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2007 |
LinkInfoImpl.Kind.ANNOTATION, t); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2008 |
String name = utils.isIncluded(t.asElement()) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2009 |
? t.asElement().getSimpleName().toString() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2010 |
: utils.getFullyQualifiedName(t.asElement()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2011 |
linkInfo.label = new StringContent(name + utils.getDimension(t) + ".class"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2012 |
return getLink(linkInfo); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2013 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2014 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2015 |
protected Content defaultAction(TypeMirror e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2016 |
return new StringContent(t + utils.getDimension(t) + ".class"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2017 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2018 |
}.visit(t); |
10 | 2019 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2020 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2021 |
public Content visitAnnotation(AnnotationMirror a, Void p) { |
55197
0ca8e495bbba
8214126: Method signatures not formatted correctly in browser
hannesw
parents:
54936
diff
changeset
|
2022 |
List<Content> list = getAnnotations(List.of(a), false); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2023 |
ContentBuilder buf = new ContentBuilder(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2024 |
for (Content c : list) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
2025 |
buf.add(c); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2026 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2027 |
return buf; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2028 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2029 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2030 |
public Content visitEnumConstant(VariableElement c, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2031 |
return getDocLink(LinkInfoImpl.Kind.ANNOTATION, |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
2032 |
c, c.getSimpleName(), false); |
10 | 2033 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2034 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2035 |
public Content visitArray(List<? extends AnnotationValue> vals, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2036 |
ContentBuilder buf = new ContentBuilder(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2037 |
String sep = ""; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2038 |
for (AnnotationValue av : vals) { |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
2039 |
buf.add(sep); |
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
2040 |
buf.add(visit(av)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2041 |
sep = " "; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2042 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2043 |
return buf; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2044 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2045 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2046 |
protected Content defaultAction(Object o, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2047 |
return new StringContent(annotationValue.toString()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2048 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2049 |
}.visit(annotationValue); |
10 | 2050 |
} |
2051 |
||
47427 | 2052 |
protected TableHeader getPackageTableHeader() { |
2053 |
return new TableHeader(contents.packageLabel, contents.descriptionLabel); |
|
10 | 2054 |
} |
47846 | 2055 |
|
47847 | 2056 |
/** |
53863
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2057 |
* Generates a string for use in a description meta element, |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2058 |
* based on an element and its enclosing elements |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2059 |
* @param prefix a prefix for the string |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2060 |
* @param elem the element |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2061 |
* @return the description |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2062 |
*/ |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2063 |
static String getDescription(String prefix, Element elem) { |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2064 |
LinkedList<Element> chain = new LinkedList<>(); |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2065 |
for (Element e = elem; e != null; e = e.getEnclosingElement()) { |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2066 |
// ignore unnamed enclosing elements |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2067 |
if (e.getSimpleName().length() == 0 && e != elem) { |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2068 |
break; |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2069 |
} |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2070 |
chain.addFirst(e); |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2071 |
} |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2072 |
StringBuilder sb = new StringBuilder(); |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2073 |
for (Element e: chain) { |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2074 |
CharSequence name; |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2075 |
switch (e.getKind()) { |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2076 |
case MODULE: |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2077 |
case PACKAGE: |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2078 |
name = ((QualifiedNameable) e).getQualifiedName(); |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2079 |
if (name.length() == 0) { |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2080 |
name = "<unnamed>"; |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2081 |
} |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2082 |
break; |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2083 |
|
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2084 |
default: |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2085 |
name = e.getSimpleName(); |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2086 |
break; |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2087 |
} |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2088 |
|
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2089 |
if (sb.length() == 0) { |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2090 |
sb.append(prefix).append(": "); |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2091 |
} else { |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2092 |
sb.append(", "); |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2093 |
} |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2094 |
sb.append(e.getKind().toString().toLowerCase(Locale.US).replace("_", " ")) |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2095 |
.append(": ") |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2096 |
.append(name); |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2097 |
} |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2098 |
return sb.toString(); |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2099 |
} |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2100 |
|
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2101 |
static String getGenerator(Class<?> clazz) { |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2102 |
return "javadoc/" + clazz.getSimpleName(); |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2103 |
} |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2104 |
|
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2105 |
/** |
47847 | 2106 |
* Returns an HtmlTree for the SCRIPT tag. |
2107 |
* |
|
2108 |
* @return an HtmlTree for the SCRIPT tag |
|
2109 |
*/ |
|
2110 |
protected Script getWinTitleScript() { |
|
2111 |
Script script = new Script(); |
|
2112 |
if (winTitle != null && winTitle.length() > 0) { |
|
2113 |
script.append("<!--\n" + |
|
2114 |
" try {\n" + |
|
2115 |
" if (location.href.indexOf('is-external=true') == -1) {\n" + |
|
2116 |
" parent.document.title=") |
|
2117 |
.appendStringLiteral(winTitle) |
|
2118 |
.append(";\n" + |
|
2119 |
" }\n" + |
|
2120 |
" }\n" + |
|
2121 |
" catch(err) {\n" + |
|
2122 |
" }\n" + |
|
2123 |
"//-->\n"); |
|
2124 |
} |
|
47846 | 2125 |
return script; |
2126 |
} |
|
47847 | 2127 |
|
2128 |
/** |
|
2129 |
* Returns an HtmlTree for the BODY tag. |
|
2130 |
* |
|
2131 |
* @param title title for the window |
|
2132 |
* @return an HtmlTree for the BODY tag |
|
2133 |
*/ |
|
54350
4f9772f4403d
8215599: Remove support for javadoc "frames" mode
pmuthuswamy
parents:
54060
diff
changeset
|
2134 |
public HtmlTree getBody(String title) { |
47847 | 2135 |
HtmlTree body = new HtmlTree(HtmlTag.BODY); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
54002
diff
changeset
|
2136 |
body.put(HtmlAttr.CLASS, getBodyClass()); |
54002 | 2137 |
|
47847 | 2138 |
this.winTitle = title; |
2139 |
// Don't print windowtitle script for overview-frame, allclasses-frame |
|
2140 |
// and package-frame |
|
54350
4f9772f4403d
8215599: Remove support for javadoc "frames" mode
pmuthuswamy
parents:
54060
diff
changeset
|
2141 |
body.add(mainBodyScript.asContent()); |
4f9772f4403d
8215599: Remove support for javadoc "frames" mode
pmuthuswamy
parents:
54060
diff
changeset
|
2142 |
Content noScript = HtmlTree.NOSCRIPT(HtmlTree.DIV(contents.noScriptMessage)); |
4f9772f4403d
8215599: Remove support for javadoc "frames" mode
pmuthuswamy
parents:
54060
diff
changeset
|
2143 |
body.add(noScript); |
47847 | 2144 |
return body; |
2145 |
} |
|
2146 |
||
54002 | 2147 |
public String getBodyClass() { |
2148 |
return getClass().getSimpleName() |
|
2149 |
.replaceAll("(Writer)?(Impl)?$", "") |
|
2150 |
.replaceAll("AnnotationType", "Class") |
|
2151 |
.replaceAll("(.)([A-Z])", "$1-$2") |
|
2152 |
.replaceAll("(?i)^(module|package|class)$", "$1-declaration") |
|
2153 |
.toLowerCase(Locale.US); |
|
2154 |
} |
|
2155 |
||
47847 | 2156 |
Script getMainBodyScript() { |
2157 |
return mainBodyScript; |
|
2158 |
} |
|
53866
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
2159 |
|
54936 | 2160 |
/** |
2161 |
* Returns the path of module/package specific stylesheets for the element. |
|
2162 |
* @param element module/Package element |
|
2163 |
* @return list of path of module/package specific stylesheets |
|
2164 |
* @throws DocFileIOException |
|
2165 |
*/ |
|
2166 |
List<DocPath> getLocalStylesheets(Element element) throws DocFileIOException { |
|
2167 |
List<DocPath> stylesheets = new ArrayList<>(); |
|
2168 |
DocPath basePath = null; |
|
2169 |
if (element instanceof PackageElement) { |
|
2170 |
stylesheets.addAll(getModuleStylesheets((PackageElement)element)); |
|
2171 |
basePath = docPaths.forPackage((PackageElement)element); |
|
2172 |
} else if (element instanceof ModuleElement) { |
|
2173 |
basePath = DocPaths.forModule((ModuleElement)element); |
|
2174 |
} |
|
2175 |
for (DocPath stylesheet : getStylesheets(element)) { |
|
2176 |
stylesheets.add(basePath.resolve(stylesheet.getPath())); |
|
2177 |
} |
|
2178 |
return stylesheets; |
|
2179 |
} |
|
2180 |
||
2181 |
private List<DocPath> getModuleStylesheets(PackageElement pkgElement) throws |
|
2182 |
DocFileIOException { |
|
2183 |
List<DocPath> moduleStylesheets = new ArrayList<>(); |
|
2184 |
ModuleElement moduleElement = utils.containingModule(pkgElement); |
|
2185 |
if (moduleElement != null && !moduleElement.isUnnamed()) { |
|
2186 |
List<DocPath> localStylesheets = getStylesheets(moduleElement); |
|
2187 |
DocPath basePath = DocPaths.forModule(moduleElement); |
|
2188 |
for (DocPath stylesheet : localStylesheets) { |
|
2189 |
moduleStylesheets.add(basePath.resolve(stylesheet)); |
|
2190 |
} |
|
2191 |
} |
|
2192 |
return moduleStylesheets; |
|
2193 |
} |
|
2194 |
||
2195 |
private List<DocPath> getStylesheets(Element element) throws DocFileIOException { |
|
53866
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
2196 |
List<DocPath> localStylesheets = configuration.localStylesheetMap.get(element); |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
2197 |
if (localStylesheets == null) { |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
2198 |
DocFilesHandlerImpl docFilesHandler = (DocFilesHandlerImpl)configuration |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
2199 |
.getWriterFactory().getDocFilesHandler(element); |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
2200 |
localStylesheets = docFilesHandler.getStylesheets(); |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
2201 |
configuration.localStylesheetMap.put(element, localStylesheets); |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
2202 |
} |
54936 | 2203 |
return localStylesheets; |
53866
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
2204 |
} |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
2205 |
|
10 | 2206 |
} |