author | ksrini |
Mon, 10 Oct 2016 11:21:00 -0700 | |
changeset 41452 | ddaef4bba083 |
parent 35426 | 374342e56a56 |
child 45417 | f7479ee8de69 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
2 |
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 24 |
*/ |
25 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
26 |
package jdk.javadoc.internal.doclets.toolkit.util; |
10 | 27 |
|
14258 | 28 |
import java.util.*; |
29 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
30 |
import javax.lang.model.element.Element; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
31 |
import javax.lang.model.element.ExecutableElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
32 |
import javax.lang.model.element.TypeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
33 |
import javax.lang.model.type.TypeMirror; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
34 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
35 |
import com.sun.source.doctree.DocTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
36 |
import jdk.javadoc.internal.doclets.toolkit.Configuration; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
37 |
import jdk.javadoc.internal.doclets.toolkit.taglets.InheritableTaglet; |
10 | 38 |
|
39 |
/** |
|
40 |
* Search for the requested documentation. Inherit documentation if necessary. |
|
41 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
42 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
43 |
* If you write code that depends on this, you do so at your own risk. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
44 |
* This code and its internal interfaces are subject to change or |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
45 |
* deletion without notice.</b> |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
46 |
* |
10 | 47 |
* @author Jamie Ho |
48 |
*/ |
|
49 |
public class DocFinder { |
|
50 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
51 |
public static final class DocTreeInfo { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
52 |
public final DocTree docTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
53 |
public final Element element; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
54 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
55 |
public DocTreeInfo() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
56 |
this.docTree = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
57 |
this.element = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
58 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
59 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
60 |
public DocTreeInfo(DocTree docTree, Element baseElement) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
61 |
this.docTree = docTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
62 |
this.element = baseElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
63 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
64 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
65 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
66 |
public String toString() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
67 |
return "DocTreeInfo{" + "docTree=" + docTree + ", element=" + element + '}'; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
68 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
69 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
70 |
|
10 | 71 |
/** |
72 |
* The class that encapsulates the input. |
|
73 |
*/ |
|
74 |
public static class Input { |
|
75 |
/** |
|
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
76 |
* The element to search documentation from. |
10 | 77 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
78 |
public Element element; |
10 | 79 |
/** |
80 |
* The taglet to search for documentation on behalf of. Null if we want |
|
81 |
* to search for overall documentation. |
|
82 |
*/ |
|
83 |
public InheritableTaglet taglet = null; |
|
84 |
||
85 |
/** |
|
86 |
* The id of the tag to retrieve documentation for. |
|
87 |
*/ |
|
88 |
public String tagId = null; |
|
89 |
||
90 |
/** |
|
91 |
* The tag to retrieve documentation for. This is only used for the |
|
92 |
* inheritDoc tag. |
|
93 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
94 |
public final DocTreeInfo docTreeInfo; |
10 | 95 |
|
96 |
/** |
|
97 |
* True if we only want to search for the first sentence. |
|
98 |
*/ |
|
99 |
public boolean isFirstSentence = false; |
|
100 |
||
101 |
/** |
|
102 |
* True if we are looking for documentation to replace the inheritDocTag. |
|
103 |
*/ |
|
104 |
public boolean isInheritDocTag = false; |
|
105 |
||
106 |
/** |
|
107 |
* Used to distinguish between type variable param tags and regular |
|
108 |
* param tags. |
|
109 |
*/ |
|
110 |
public boolean isTypeVariableParamTag = false; |
|
111 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
112 |
public final Utils utils; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
113 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
114 |
public Input(Utils utils, Element element, InheritableTaglet taglet, DocTreeInfo dtInfo, |
10 | 115 |
boolean isFirstSentence, boolean isInheritDocTag) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
116 |
this.utils = utils; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
117 |
this.element = element; |
10 | 118 |
this.taglet = taglet; |
119 |
this.isFirstSentence = isFirstSentence; |
|
120 |
this.isInheritDocTag = isInheritDocTag; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
121 |
this.docTreeInfo = dtInfo; |
10 | 122 |
} |
123 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
124 |
public Input(Utils utils, Element element, InheritableTaglet taglet, String tagId) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
125 |
this(utils, element); |
10 | 126 |
this.taglet = taglet; |
127 |
this.tagId = tagId; |
|
128 |
} |
|
129 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
130 |
public Input(Utils utils, Element element, InheritableTaglet taglet, String tagId, |
10 | 131 |
boolean isTypeVariableParamTag) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
132 |
this(utils, element); |
10 | 133 |
this.taglet = taglet; |
134 |
this.tagId = tagId; |
|
135 |
this.isTypeVariableParamTag = isTypeVariableParamTag; |
|
136 |
} |
|
137 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
138 |
public Input(Utils utils, Element element, InheritableTaglet taglet) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
139 |
this(utils, element); |
10 | 140 |
this.taglet = taglet; |
141 |
} |
|
142 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
143 |
public Input(Utils utils, Element element) { |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
144 |
if (element == null) |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
145 |
throw new NullPointerException(); |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
146 |
this.element = element; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
147 |
this.utils = utils; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
148 |
this.docTreeInfo = new DocTreeInfo(); |
10 | 149 |
} |
150 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
151 |
public Input(Utils utils, Element element, boolean isFirstSentence) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
152 |
this(utils, element); |
10 | 153 |
this.isFirstSentence = isFirstSentence; |
154 |
} |
|
155 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
156 |
public Input copy(Utils utils) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
157 |
if (this.element == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
158 |
throw new NullPointerException(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
159 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
160 |
Input clone = new Input(utils, this.element, this.taglet, this.docTreeInfo, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
161 |
this.isFirstSentence, this.isInheritDocTag); |
10 | 162 |
clone.tagId = this.tagId; |
163 |
clone.isTypeVariableParamTag = this.isTypeVariableParamTag; |
|
164 |
return clone; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
165 |
} |
10 | 166 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
167 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
168 |
* For debugging purposes |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
169 |
* @return string representation |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
170 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
171 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
172 |
public String toString() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
173 |
String encl = element == null ? "" : element.getEnclosingElement().toString() + "::"; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
174 |
return "Input{" + "element=" + encl + element |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
175 |
+ ", taglet=" + taglet |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
176 |
+ ", tagId=" + tagId + ", tag=" + docTreeInfo |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
177 |
+ ", isFirstSentence=" + isFirstSentence |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
178 |
+ ", isInheritDocTag=" + isInheritDocTag |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
179 |
+ ", isTypeVariableParamTag=" + isTypeVariableParamTag |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
180 |
+ ", utils=" + utils + '}'; |
10 | 181 |
} |
182 |
} |
|
183 |
||
184 |
/** |
|
185 |
* The class that encapsulates the output. |
|
186 |
*/ |
|
187 |
public static class Output { |
|
188 |
/** |
|
189 |
* The tag that holds the documentation. Null if documentation |
|
190 |
* is not held by a tag. |
|
191 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
192 |
public DocTree holderTag; |
10 | 193 |
|
194 |
/** |
|
195 |
* The Doc object that holds the documentation. |
|
196 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
197 |
public Element holder; |
10 | 198 |
|
199 |
/** |
|
200 |
* The inherited documentation. |
|
201 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
202 |
public List<? extends DocTree> inlineTags = Collections.emptyList(); |
10 | 203 |
|
204 |
/** |
|
205 |
* False if documentation could not be inherited. |
|
206 |
*/ |
|
207 |
public boolean isValidInheritDocTag = true; |
|
208 |
||
209 |
/** |
|
210 |
* When automatically inheriting throws tags, you sometime must inherit |
|
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
211 |
* more than one tag. For example if the element declares that it throws |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
212 |
* IOException and the overridden element has throws tags for IOException and |
10 | 213 |
* ZipException, both tags would be inherited because ZipException is a |
214 |
* subclass of IOException. This subclass of DocFinder.Output allows |
|
215 |
* multiple tag inheritence. |
|
216 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
217 |
public List<DocTree> tagList = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
218 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
219 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
220 |
* Returns a string representation for debugging purposes |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
221 |
* @return string |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
222 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
223 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
224 |
public String toString() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
225 |
String encl = holder == null ? "" : holder.getEnclosingElement().toString() + "::"; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
226 |
return "Output{" + "holderTag=" + holderTag |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
227 |
+ ", holder=" + encl + holder |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
228 |
+ ", inlineTags=" + inlineTags |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
229 |
+ ", isValidInheritDocTag=" + isValidInheritDocTag |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
230 |
+ ", tagList=" + tagList + '}'; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
231 |
} |
10 | 232 |
} |
233 |
||
234 |
/** |
|
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
235 |
* Search for the requested comments in the given element. If it does not |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
236 |
* have comments, return documentation from the overridden element if possible. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
237 |
* If the overridden element does not exist or does not have documentation to |
10 | 238 |
* inherit, search for documentation to inherit from implemented methods. |
239 |
* |
|
240 |
* @param input the input object used to perform the search. |
|
241 |
* |
|
242 |
* @return an Output object representing the documentation that was found. |
|
243 |
*/ |
|
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
22163
diff
changeset
|
244 |
public static Output search(Configuration configuration, Input input) { |
10 | 245 |
Output output = new Output(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
246 |
Utils utils = configuration.utils; |
10 | 247 |
if (input.isInheritDocTag) { |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
248 |
//Do nothing because "element" does not have any documentation. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
249 |
//All it has is {@inheritDoc}. |
10 | 250 |
} else if (input.taglet == null) { |
251 |
//We want overall documentation. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
252 |
output.inlineTags = input.isFirstSentence |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
253 |
? utils.getFirstSentenceTrees(input.element) |
41452 | 254 |
: utils.getFullBody(input.element); |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
255 |
output.holder = input.element; |
10 | 256 |
} else { |
257 |
input.taglet.inherit(input, output); |
|
258 |
} |
|
259 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
260 |
if (output.inlineTags != null && !output.inlineTags.isEmpty()) { |
10 | 261 |
return output; |
262 |
} |
|
263 |
output.isValidInheritDocTag = false; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
264 |
Input inheritedSearchInput = input.copy(configuration.utils); |
10 | 265 |
inheritedSearchInput.isInheritDocTag = false; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
266 |
if (utils.isMethod(input.element)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
267 |
ExecutableElement overriddenMethod = utils.overriddenMethod((ExecutableElement) input.element); |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
268 |
if (overriddenMethod != null) { |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
269 |
inheritedSearchInput.element = overriddenMethod; |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
22163
diff
changeset
|
270 |
output = search(configuration, inheritedSearchInput); |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
271 |
output.isValidInheritDocTag = true; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
272 |
if (!output.inlineTags.isEmpty()) { |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
273 |
return output; |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
274 |
} |
10 | 275 |
} |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
276 |
//NOTE: When we fix the bug where ClassDoc.interfaceTypes() does |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
277 |
// not pass all implemented interfaces, we will use the |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
278 |
// appropriate element here. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
279 |
ImplementedMethods implMethods |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
280 |
= new ImplementedMethods((ExecutableElement) input.element, configuration); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
281 |
List<ExecutableElement> implementedMethods = implMethods.build(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
282 |
for (ExecutableElement implementedMethod : implementedMethods) { |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
17547
diff
changeset
|
283 |
inheritedSearchInput.element = implementedMethod; |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
22163
diff
changeset
|
284 |
output = search(configuration, inheritedSearchInput); |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
285 |
output.isValidInheritDocTag = true; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
286 |
if (!output.inlineTags.isEmpty()) { |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
287 |
return output; |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
288 |
} |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
289 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
290 |
} else if (utils.isTypeElement(input.element)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
291 |
TypeMirror t = ((TypeElement) input.element).getSuperclass(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
292 |
Element superclass = utils.asTypeElement(t); |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
293 |
if (superclass != null) { |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
294 |
inheritedSearchInput.element = superclass; |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
22163
diff
changeset
|
295 |
output = search(configuration, inheritedSearchInput); |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
296 |
output.isValidInheritDocTag = true; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
297 |
if (!output.inlineTags.isEmpty()) { |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
298 |
return output; |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
14260
diff
changeset
|
299 |
} |
10 | 300 |
} |
301 |
} |
|
302 |
return output; |
|
303 |
} |
|
304 |
} |