Wed, 18 Sep 2013 17:13:26 -0700
8015249: javadoc fails to document static final fields in annotation types
Reviewed-by: jjg
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java Wed Sep 18 17:13:26 2013 -0700 1.3 @@ -0,0 +1,301 @@ 1.4 +/* 1.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +package com.sun.tools.doclets.formats.html; 1.30 + 1.31 +import java.io.*; 1.32 + 1.33 +import com.sun.javadoc.*; 1.34 +import com.sun.tools.doclets.formats.html.markup.*; 1.35 +import com.sun.tools.doclets.internal.toolkit.*; 1.36 + 1.37 +/** 1.38 + * Writes annotation type field documentation in HTML format. 1.39 + * 1.40 + * <p><b>This is NOT part of any supported API. 1.41 + * If you write code that depends on this, you do so at your own risk. 1.42 + * This code and its internal interfaces are subject to change or 1.43 + * deletion without notice.</b> 1.44 + * 1.45 + * @author Bhavesh Patel 1.46 + */ 1.47 +public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter 1.48 + implements AnnotationTypeFieldWriter, MemberSummaryWriter { 1.49 + 1.50 + /** 1.51 + * Construct a new AnnotationTypeFieldWriterImpl. 1.52 + * 1.53 + * @param writer the writer that will write the output. 1.54 + * @param annotationType the AnnotationType that holds this member. 1.55 + */ 1.56 + public AnnotationTypeFieldWriterImpl(SubWriterHolderWriter writer, 1.57 + AnnotationTypeDoc annotationType) { 1.58 + super(writer, annotationType); 1.59 + } 1.60 + 1.61 + /** 1.62 + * {@inheritDoc} 1.63 + */ 1.64 + public Content getMemberSummaryHeader(ClassDoc classDoc, 1.65 + Content memberSummaryTree) { 1.66 + memberSummaryTree.addContent( 1.67 + HtmlConstants.START_OF_ANNOTATION_TYPE_FIELD_SUMMARY); 1.68 + Content memberTree = writer.getMemberTreeHeader(); 1.69 + writer.addSummaryHeader(this, classDoc, memberTree); 1.70 + return memberTree; 1.71 + } 1.72 + 1.73 + /** 1.74 + * {@inheritDoc} 1.75 + */ 1.76 + public Content getMemberTreeHeader() { 1.77 + return writer.getMemberTreeHeader(); 1.78 + } 1.79 + 1.80 + /** 1.81 + * {@inheritDoc} 1.82 + */ 1.83 + public void addAnnotationFieldDetailsMarker(Content memberDetails) { 1.84 + memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_FIELD_DETAILS); 1.85 + } 1.86 + 1.87 + /** 1.88 + * {@inheritDoc} 1.89 + */ 1.90 + public void addAnnotationDetailsTreeHeader(ClassDoc classDoc, 1.91 + Content memberDetailsTree) { 1.92 + if (!writer.printedAnnotationFieldHeading) { 1.93 + memberDetailsTree.addContent(writer.getMarkerAnchor( 1.94 + "annotation_type_field_detail")); 1.95 + Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, 1.96 + writer.fieldDetailsLabel); 1.97 + memberDetailsTree.addContent(heading); 1.98 + writer.printedAnnotationFieldHeading = true; 1.99 + } 1.100 + } 1.101 + 1.102 + /** 1.103 + * {@inheritDoc} 1.104 + */ 1.105 + public Content getAnnotationDocTreeHeader(MemberDoc member, 1.106 + Content annotationDetailsTree) { 1.107 + annotationDetailsTree.addContent( 1.108 + writer.getMarkerAnchor(member.name())); 1.109 + Content annotationDocTree = writer.getMemberTreeHeader(); 1.110 + Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); 1.111 + heading.addContent(member.name()); 1.112 + annotationDocTree.addContent(heading); 1.113 + return annotationDocTree; 1.114 + } 1.115 + 1.116 + /** 1.117 + * {@inheritDoc} 1.118 + */ 1.119 + public Content getSignature(MemberDoc member) { 1.120 + Content pre = new HtmlTree(HtmlTag.PRE); 1.121 + writer.addAnnotationInfo(member, pre); 1.122 + addModifiers(member, pre); 1.123 + Content link = 1.124 + writer.getLink(new LinkInfoImpl(configuration, 1.125 + LinkInfoImpl.Kind.MEMBER, getType(member))); 1.126 + pre.addContent(link); 1.127 + pre.addContent(writer.getSpace()); 1.128 + if (configuration.linksource) { 1.129 + Content memberName = new StringContent(member.name()); 1.130 + writer.addSrcLink(member, memberName, pre); 1.131 + } else { 1.132 + addName(member.name(), pre); 1.133 + } 1.134 + return pre; 1.135 + } 1.136 + 1.137 + /** 1.138 + * {@inheritDoc} 1.139 + */ 1.140 + public void addDeprecated(MemberDoc member, Content annotationDocTree) { 1.141 + addDeprecatedInfo(member, annotationDocTree); 1.142 + } 1.143 + 1.144 + /** 1.145 + * {@inheritDoc} 1.146 + */ 1.147 + public void addComments(MemberDoc member, Content annotationDocTree) { 1.148 + addComment(member, annotationDocTree); 1.149 + } 1.150 + 1.151 + /** 1.152 + * {@inheritDoc} 1.153 + */ 1.154 + public void addTags(MemberDoc member, Content annotationDocTree) { 1.155 + writer.addTagsInfo(member, annotationDocTree); 1.156 + } 1.157 + 1.158 + /** 1.159 + * {@inheritDoc} 1.160 + */ 1.161 + public Content getAnnotationDetails(Content annotationDetailsTree) { 1.162 + return getMemberTree(annotationDetailsTree); 1.163 + } 1.164 + 1.165 + /** 1.166 + * {@inheritDoc} 1.167 + */ 1.168 + public Content getAnnotationDoc(Content annotationDocTree, 1.169 + boolean isLastContent) { 1.170 + return getMemberTree(annotationDocTree, isLastContent); 1.171 + } 1.172 + 1.173 + /** 1.174 + * Close the writer. 1.175 + */ 1.176 + public void close() throws IOException { 1.177 + writer.close(); 1.178 + } 1.179 + 1.180 + /** 1.181 + * {@inheritDoc} 1.182 + */ 1.183 + public void addSummaryLabel(Content memberTree) { 1.184 + Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, 1.185 + writer.getResource("doclet.Field_Summary")); 1.186 + memberTree.addContent(label); 1.187 + } 1.188 + 1.189 + /** 1.190 + * {@inheritDoc} 1.191 + */ 1.192 + public String getTableSummary() { 1.193 + return configuration.getText("doclet.Member_Table_Summary", 1.194 + configuration.getText("doclet.Field_Summary"), 1.195 + configuration.getText("doclet.fields")); 1.196 + } 1.197 + 1.198 + /** 1.199 + * {@inheritDoc} 1.200 + */ 1.201 + public Content getCaption() { 1.202 + return configuration.getResource("doclet.Fields"); 1.203 + } 1.204 + 1.205 + /** 1.206 + * {@inheritDoc} 1.207 + */ 1.208 + public String[] getSummaryTableHeader(ProgramElementDoc member) { 1.209 + String[] header = new String[] { 1.210 + writer.getModifierTypeHeader(), 1.211 + configuration.getText("doclet.0_and_1", 1.212 + configuration.getText("doclet.Fields"), 1.213 + configuration.getText("doclet.Description")) 1.214 + }; 1.215 + return header; 1.216 + } 1.217 + 1.218 + /** 1.219 + * {@inheritDoc} 1.220 + */ 1.221 + public void addSummaryAnchor(ClassDoc cd, Content memberTree) { 1.222 + memberTree.addContent(writer.getMarkerAnchor( 1.223 + "annotation_type_field_summary")); 1.224 + } 1.225 + 1.226 + /** 1.227 + * {@inheritDoc} 1.228 + */ 1.229 + public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) { 1.230 + } 1.231 + 1.232 + /** 1.233 + * {@inheritDoc} 1.234 + */ 1.235 + public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) { 1.236 + } 1.237 + 1.238 + /** 1.239 + * {@inheritDoc} 1.240 + */ 1.241 + protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, 1.242 + Content tdSummary) { 1.243 + Content strong = HtmlTree.SPAN(HtmlStyle.strong, 1.244 + writer.getDocLink(context, (MemberDoc) member, member.name(), false)); 1.245 + Content code = HtmlTree.CODE(strong); 1.246 + tdSummary.addContent(code); 1.247 + } 1.248 + 1.249 + /** 1.250 + * {@inheritDoc} 1.251 + */ 1.252 + protected void addInheritedSummaryLink(ClassDoc cd, 1.253 + ProgramElementDoc member, Content linksTree) { 1.254 + //Not applicable. 1.255 + } 1.256 + 1.257 + /** 1.258 + * {@inheritDoc} 1.259 + */ 1.260 + protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) { 1.261 + MemberDoc m = (MemberDoc)member; 1.262 + addModifierAndType(m, getType(m), tdSummaryType); 1.263 + } 1.264 + 1.265 + /** 1.266 + * {@inheritDoc} 1.267 + */ 1.268 + protected Content getDeprecatedLink(ProgramElementDoc member) { 1.269 + return writer.getDocLink(LinkInfoImpl.Kind.MEMBER, 1.270 + (MemberDoc) member, ((MemberDoc)member).qualifiedName()); 1.271 + } 1.272 + 1.273 + /** 1.274 + * {@inheritDoc} 1.275 + */ 1.276 + protected Content getNavSummaryLink(ClassDoc cd, boolean link) { 1.277 + if (link) { 1.278 + return writer.getHyperLink("annotation_type_field_summary", 1.279 + writer.getResource("doclet.navField")); 1.280 + } else { 1.281 + return writer.getResource("doclet.navField"); 1.282 + } 1.283 + } 1.284 + 1.285 + /** 1.286 + * {@inheritDoc} 1.287 + */ 1.288 + protected void addNavDetailLink(boolean link, Content liNav) { 1.289 + if (link) { 1.290 + liNav.addContent(writer.getHyperLink("annotation_type_field_detail", 1.291 + writer.getResource("doclet.navField"))); 1.292 + } else { 1.293 + liNav.addContent(writer.getResource("doclet.navField")); 1.294 + } 1.295 + } 1.296 + 1.297 + private Type getType(MemberDoc member) { 1.298 + if (member instanceof FieldDoc) { 1.299 + return ((FieldDoc) member).type(); 1.300 + } else { 1.301 + return ((MethodDoc) member).returnType(); 1.302 + } 1.303 + } 1.304 +}
2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Wed Sep 18 14:39:27 2013 +0200 2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Wed Sep 18 17:13:26 2013 -0700 2.3 @@ -71,6 +71,20 @@ 2.4 /** 2.5 * {@inheritDoc} 2.6 */ 2.7 + public Content getMemberTreeHeader() { 2.8 + return writer.getMemberTreeHeader(); 2.9 + } 2.10 + 2.11 + /** 2.12 + * {@inheritDoc} 2.13 + */ 2.14 + public void addAnnotationDetailsMarker(Content memberDetails) { 2.15 + memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_DETAILS); 2.16 + } 2.17 + 2.18 + /** 2.19 + * {@inheritDoc} 2.20 + */ 2.21 public void addAnnotationDetailsTreeHeader(ClassDoc classDoc, 2.22 Content memberDetailsTree) { 2.23 if (!writer.printedAnnotationHeading) {
3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Wed Sep 18 14:39:27 2013 +0200 3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Wed Sep 18 17:13:26 2013 -0700 3.3 @@ -278,13 +278,6 @@ 3.4 /** 3.5 * {@inheritDoc} 3.6 */ 3.7 - public void addAnnotationDetailsMarker(Content memberDetails) { 3.8 - memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_DETAILS); 3.9 - } 3.10 - 3.11 - /** 3.12 - * {@inheritDoc} 3.13 - */ 3.14 protected Content getNavLinkTree() { 3.15 Content treeLinkContent = getHyperLink(DocPaths.PACKAGE_TREE, 3.16 treeLabel, "", ""); 3.17 @@ -319,6 +312,12 @@ 3.18 Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li); 3.19 MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder) 3.20 configuration.getBuilderFactory().getMemberSummaryBuilder(this); 3.21 + Content liNavField = new HtmlTree(HtmlTag.LI); 3.22 + addNavSummaryLink(memberSummaryBuilder, 3.23 + "doclet.navField", 3.24 + VisibleMemberMap.ANNOTATION_TYPE_FIELDS, liNavField); 3.25 + addNavGap(liNavField); 3.26 + ulNav.addContent(liNavField); 3.27 Content liNavReq = new HtmlTree(HtmlTag.LI); 3.28 addNavSummaryLink(memberSummaryBuilder, 3.29 "doclet.navAnnotationTypeRequiredMember", 3.30 @@ -364,12 +363,23 @@ 3.31 Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li); 3.32 MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder) 3.33 configuration.getBuilderFactory().getMemberSummaryBuilder(this); 3.34 + AbstractMemberWriter writerField = 3.35 + ((AbstractMemberWriter) memberSummaryBuilder. 3.36 + getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_FIELDS)); 3.37 AbstractMemberWriter writerOptional = 3.38 ((AbstractMemberWriter) memberSummaryBuilder. 3.39 getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL)); 3.40 AbstractMemberWriter writerRequired = 3.41 ((AbstractMemberWriter) memberSummaryBuilder. 3.42 getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED)); 3.43 + Content liNavField = new HtmlTree(HtmlTag.LI); 3.44 + if (writerField != null){ 3.45 + writerField.addNavDetailLink(annotationType.fields().length > 0, liNavField); 3.46 + } else { 3.47 + liNavField.addContent(getResource("doclet.navField")); 3.48 + } 3.49 + addNavGap(liNavField); 3.50 + ulNav.addContent(liNavField); 3.51 if (writerOptional != null){ 3.52 Content liNavOpt = new HtmlTree(HtmlTag.LI); 3.53 writerOptional.addNavDetailLink(annotationType.elements().length > 0, liNavOpt);
4.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Wed Sep 18 14:39:27 2013 +0200 4.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Wed Sep 18 17:13:26 2013 -0700 4.3 @@ -85,6 +85,11 @@ 4.4 protected boolean printedAnnotationHeading = false; 4.5 4.6 /** 4.7 + * To check whether annotation field heading is printed or not. 4.8 + */ 4.9 + protected boolean printedAnnotationFieldHeading = false; 4.10 + 4.11 + /** 4.12 * To check whether the repeated annotations is documented or not. 4.13 */ 4.14 private boolean isAnnotationDocumented = false;
5.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java Wed Sep 18 14:39:27 2013 +0200 5.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java Wed Sep 18 17:13:26 2013 -0700 5.3 @@ -107,6 +107,16 @@ 5.4 /** 5.5 * {@inheritDoc} 5.6 */ 5.7 + public AnnotationTypeFieldWriter 5.8 + getAnnotationTypeFieldWriter(AnnotationTypeWriter annotationTypeWriter) throws Exception { 5.9 + return new AnnotationTypeFieldWriterImpl( 5.10 + (SubWriterHolderWriter) annotationTypeWriter, 5.11 + annotationTypeWriter.getAnnotationTypeDoc()); 5.12 + } 5.13 + 5.14 + /** 5.15 + * {@inheritDoc} 5.16 + */ 5.17 public AnnotationTypeOptionalMemberWriter 5.18 getAnnotationTypeOptionalMemberWriter( 5.19 AnnotationTypeWriter annotationTypeWriter) throws Exception { 5.20 @@ -202,6 +212,9 @@ 5.21 AnnotationTypeWriter annotationTypeWriter, int memberType) 5.22 throws Exception { 5.23 switch (memberType) { 5.24 + case VisibleMemberMap.ANNOTATION_TYPE_FIELDS: 5.25 + return (AnnotationTypeFieldWriterImpl) 5.26 + getAnnotationTypeFieldWriter(annotationTypeWriter); 5.27 case VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL: 5.28 return (AnnotationTypeOptionalMemberWriterImpl) 5.29 getAnnotationTypeOptionalMemberWriter(annotationTypeWriter);
6.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java Wed Sep 18 14:39:27 2013 +0200 6.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java Wed Sep 18 17:13:26 2013 -0700 6.3 @@ -94,6 +94,12 @@ 6.4 new Comment("=========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY ==========="); 6.5 6.6 /** 6.7 + * Marker to identify start of annotation type required member summary. 6.8 + */ 6.9 + public static final Content START_OF_ANNOTATION_TYPE_FIELD_SUMMARY = 6.10 + new Comment("=========== ANNOTATION TYPE FIELD SUMMARY ==========="); 6.11 + 6.12 + /** 6.13 * Marker to identify start of constructor summary. 6.14 */ 6.15 public static final Content START_OF_CONSTRUCTOR_SUMMARY = 6.16 @@ -130,6 +136,12 @@ 6.17 new Comment("============ ANNOTATION TYPE MEMBER DETAIL ==========="); 6.18 6.19 /** 6.20 + * Marker to identify start of annotation type field details. 6.21 + */ 6.22 + public static final Content START_OF_ANNOTATION_TYPE_FIELD_DETAILS = 6.23 + new Comment("============ ANNOTATION TYPE FIELD DETAIL ==========="); 6.24 + 6.25 + /** 6.26 * Marker to identify start of method details. 6.27 */ 6.28 public static final Content START_OF_METHOD_DETAILS =
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeFieldWriter.java Wed Sep 18 17:13:26 2013 -0700 7.3 @@ -0,0 +1,132 @@ 7.4 +/* 7.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.7 + * 7.8 + * This code is free software; you can redistribute it and/or modify it 7.9 + * under the terms of the GNU General Public License version 2 only, as 7.10 + * published by the Free Software Foundation. Oracle designates this 7.11 + * particular file as subject to the "Classpath" exception as provided 7.12 + * by Oracle in the LICENSE file that accompanied this code. 7.13 + * 7.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 7.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 7.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 7.17 + * version 2 for more details (a copy is included in the LICENSE file that 7.18 + * accompanied this code). 7.19 + * 7.20 + * You should have received a copy of the GNU General Public License version 7.21 + * 2 along with this work; if not, write to the Free Software Foundation, 7.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 7.23 + * 7.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 7.25 + * or visit www.oracle.com if you need additional information or have any 7.26 + * questions. 7.27 + */ 7.28 + 7.29 +package com.sun.tools.doclets.internal.toolkit; 7.30 + 7.31 +import java.io.*; 7.32 +import com.sun.javadoc.*; 7.33 + 7.34 +/** 7.35 + * The interface for writing annotation type field output. 7.36 + * 7.37 + * <p><b>This is NOT part of any supported API. 7.38 + * If you write code that depends on this, you do so at your own risk. 7.39 + * This code and its internal interfaces are subject to change or 7.40 + * deletion without notice.</b> 7.41 + * 7.42 + * 7.43 + * @author Bhavesh Patel 7.44 + * @since 1.8 7.45 + */ 7.46 + 7.47 +public interface AnnotationTypeFieldWriter { 7.48 + 7.49 + /** 7.50 + * Add the annotation type member tree header. 7.51 + * 7.52 + * @return content tree for the member tree header 7.53 + */ 7.54 + public Content getMemberTreeHeader(); 7.55 + 7.56 + /** 7.57 + * Add the annotation type field details marker. 7.58 + * 7.59 + * @param memberDetails the content tree representing field details marker 7.60 + */ 7.61 + public void addAnnotationFieldDetailsMarker(Content memberDetails); 7.62 + 7.63 + /** 7.64 + * Add the annotation type details tree header. 7.65 + * 7.66 + * @param classDoc the annotation type being documented 7.67 + * @param memberDetailsTree the content tree representing member details 7.68 + */ 7.69 + public void addAnnotationDetailsTreeHeader(ClassDoc classDoc, 7.70 + Content memberDetailsTree); 7.71 + 7.72 + /** 7.73 + * Get the annotation type documentation tree header. 7.74 + * 7.75 + * @param member the annotation type being documented 7.76 + * @param annotationDetailsTree the content tree representing annotation type details 7.77 + * @return content tree for the annotation type documentation header 7.78 + */ 7.79 + public Content getAnnotationDocTreeHeader(MemberDoc member, 7.80 + Content annotationDetailsTree); 7.81 + 7.82 + /** 7.83 + * Get the annotation type details tree. 7.84 + * 7.85 + * @param annotationDetailsTree the content tree representing annotation type details 7.86 + * @return content tree for the annotation type details 7.87 + */ 7.88 + public Content getAnnotationDetails(Content annotationDetailsTree); 7.89 + 7.90 + /** 7.91 + * Get the annotation type documentation. 7.92 + * 7.93 + * @param annotationDocTree the content tree representing annotation type documentation 7.94 + * @param isLastContent true if the content to be added is the last content 7.95 + * @return content tree for the annotation type documentation 7.96 + */ 7.97 + public Content getAnnotationDoc(Content annotationDocTree, boolean isLastContent); 7.98 + 7.99 + /** 7.100 + * Get the signature for the given member. 7.101 + * 7.102 + * @param member the member being documented 7.103 + * @return content tree for the annotation type signature 7.104 + */ 7.105 + public Content getSignature(MemberDoc member); 7.106 + 7.107 + /** 7.108 + * Add the deprecated output for the given member. 7.109 + * 7.110 + * @param member the member being documented 7.111 + * @param annotationDocTree content tree to which the deprecated information will be added 7.112 + */ 7.113 + public void addDeprecated(MemberDoc member, Content annotationDocTree); 7.114 + 7.115 + /** 7.116 + * Add the comments for the given member. 7.117 + * 7.118 + * @param member the member being documented 7.119 + * @param annotationDocTree the content tree to which the comments will be added 7.120 + */ 7.121 + public void addComments(MemberDoc member, Content annotationDocTree); 7.122 + 7.123 + /** 7.124 + * Add the tags for the given member. 7.125 + * 7.126 + * @param member the member being documented 7.127 + * @param annotationDocTree the content tree to which the tags will be added 7.128 + */ 7.129 + public void addTags(MemberDoc member, Content annotationDocTree); 7.130 + 7.131 + /** 7.132 + * Close the writer. 7.133 + */ 7.134 + public void close() throws IOException; 7.135 +}
8.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java Wed Sep 18 14:39:27 2013 +0200 8.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java Wed Sep 18 17:13:26 2013 -0700 8.3 @@ -1,5 +1,5 @@ 8.4 /* 8.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 8.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 8.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.8 * 8.9 * This code is free software; you can redistribute it and/or modify it 8.10 @@ -45,6 +45,20 @@ 8.11 public interface AnnotationTypeRequiredMemberWriter { 8.12 8.13 /** 8.14 + * Add the annotation type member tree header. 8.15 + * 8.16 + * @return content tree for the member tree header 8.17 + */ 8.18 + public Content getMemberTreeHeader(); 8.19 + 8.20 + /** 8.21 + * Add the annotation type details marker. 8.22 + * 8.23 + * @param memberDetails the content tree representing details marker 8.24 + */ 8.25 + public void addAnnotationDetailsMarker(Content memberDetails); 8.26 + 8.27 + /** 8.28 * Add the annotation type details tree header. 8.29 * 8.30 * @param classDoc the annotation type being documented
9.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java Wed Sep 18 14:39:27 2013 +0200 9.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java Wed Sep 18 17:13:26 2013 -0700 9.3 @@ -1,5 +1,5 @@ 9.4 /* 9.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 9.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 9.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.8 * 9.9 * This code is free software; you can redistribute it and/or modify it 9.10 @@ -104,13 +104,6 @@ 9.11 public void addAnnotationTypeDeprecationInfo (Content annotationInfoTree); 9.12 9.13 /** 9.14 - * Add the annotation type details marker. 9.15 - * 9.16 - * @param memberDetails the content tree representing member details marker 9.17 - */ 9.18 - public void addAnnotationDetailsMarker(Content memberDetails); 9.19 - 9.20 - /** 9.21 * Get the member tree header for the annotation type. 9.22 * 9.23 * @return a content tree for the member tree header
10.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java Wed Sep 18 14:39:27 2013 +0200 10.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java Wed Sep 18 17:13:26 2013 -0700 10.3 @@ -130,6 +130,18 @@ 10.4 throws Exception; 10.5 10.6 /** 10.7 + * Return the annotation type field writer for a given annotation type. 10.8 + * 10.9 + * @param annotationTypeWriter the writer for the annotation type 10.10 + * being documented. 10.11 + * @return the member writer for the given annotation type. Return null if 10.12 + * this writer is not supported by the doclet. 10.13 + */ 10.14 + public abstract AnnotationTypeFieldWriter 10.15 + getAnnotationTypeFieldWriter( 10.16 + AnnotationTypeWriter annotationTypeWriter) throws Exception; 10.17 + 10.18 + /** 10.19 * Return the annotation type optional member writer for a given annotation 10.20 * type. 10.21 *
11.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java Wed Sep 18 14:39:27 2013 +0200 11.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java Wed Sep 18 17:13:26 2013 -0700 11.3 @@ -223,14 +223,23 @@ 11.4 Content memberDetailsTree = writer.getMemberTreeHeader(); 11.5 buildChildren(node, memberDetailsTree); 11.6 if (memberDetailsTree.isValid()) { 11.7 - Content memberDetails = writer.getMemberTreeHeader(); 11.8 - writer.addAnnotationDetailsMarker(memberDetails); 11.9 - memberDetails.addContent(writer.getMemberTree(memberDetailsTree)); 11.10 - annotationContentTree.addContent(writer.getMemberDetailsTree(memberDetails)); 11.11 + annotationContentTree.addContent(writer.getMemberDetailsTree(memberDetailsTree)); 11.12 } 11.13 } 11.14 11.15 /** 11.16 + * Build the annotation type field documentation. 11.17 + * 11.18 + * @param node the XML element that specifies which components to document 11.19 + * @param memberDetailsTree the content tree to which the documentation will be added 11.20 + */ 11.21 + public void buildAnnotationTypeFieldDetails(XMLNode node, Content memberDetailsTree) 11.22 + throws Exception { 11.23 + configuration.getBuilderFactory(). 11.24 + getAnnotationTypeFieldsBuilder(writer).buildChildren(node, memberDetailsTree); 11.25 + } 11.26 + 11.27 + /** 11.28 * Build the annotation type optional member documentation. 11.29 * 11.30 * @param node the XML element that specifies which components to document
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeFieldBuilder.java Wed Sep 18 17:13:26 2013 -0700 12.3 @@ -0,0 +1,240 @@ 12.4 +/* 12.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 12.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.7 + * 12.8 + * This code is free software; you can redistribute it and/or modify it 12.9 + * under the terms of the GNU General Public License version 2 only, as 12.10 + * published by the Free Software Foundation. Oracle designates this 12.11 + * particular file as subject to the "Classpath" exception as provided 12.12 + * by Oracle in the LICENSE file that accompanied this code. 12.13 + * 12.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 12.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12.17 + * version 2 for more details (a copy is included in the LICENSE file that 12.18 + * accompanied this code). 12.19 + * 12.20 + * You should have received a copy of the GNU General Public License version 12.21 + * 2 along with this work; if not, write to the Free Software Foundation, 12.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 12.23 + * 12.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 12.25 + * or visit www.oracle.com if you need additional information or have any 12.26 + * questions. 12.27 + */ 12.28 + 12.29 +package com.sun.tools.doclets.internal.toolkit.builders; 12.30 + 12.31 +import java.util.*; 12.32 + 12.33 +import com.sun.javadoc.*; 12.34 +import com.sun.tools.doclets.internal.toolkit.*; 12.35 +import com.sun.tools.doclets.internal.toolkit.util.*; 12.36 + 12.37 +/** 12.38 + * Builds documentation for annotation type fields. 12.39 + * 12.40 + * <p><b>This is NOT part of any supported API. 12.41 + * If you write code that depends on this, you do so at your own risk. 12.42 + * This code and its internal interfaces are subject to change or 12.43 + * deletion without notice.</b> 12.44 + * 12.45 + * @author Bhavesh Patel 12.46 + * @since 1.8 12.47 + */ 12.48 +public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder { 12.49 + 12.50 + /** 12.51 + * The annotation type whose members are being documented. 12.52 + */ 12.53 + protected ClassDoc classDoc; 12.54 + 12.55 + /** 12.56 + * The visible members for the given class. 12.57 + */ 12.58 + protected VisibleMemberMap visibleMemberMap; 12.59 + 12.60 + /** 12.61 + * The writer to output the member documentation. 12.62 + */ 12.63 + protected AnnotationTypeFieldWriter writer; 12.64 + 12.65 + /** 12.66 + * The list of members being documented. 12.67 + */ 12.68 + protected List<ProgramElementDoc> members; 12.69 + 12.70 + /** 12.71 + * The index of the current member that is being documented at this point 12.72 + * in time. 12.73 + */ 12.74 + protected int currentMemberIndex; 12.75 + 12.76 + /** 12.77 + * Construct a new AnnotationTypeFieldsBuilder. 12.78 + * 12.79 + * @param context the build context. 12.80 + * @param classDoc the class whose members are being documented. 12.81 + * @param writer the doclet specific writer. 12.82 + * @param memberType the type of member that is being documented. 12.83 + */ 12.84 + protected AnnotationTypeFieldBuilder(Context context, 12.85 + ClassDoc classDoc, 12.86 + AnnotationTypeFieldWriter writer, 12.87 + int memberType) { 12.88 + super(context); 12.89 + this.classDoc = classDoc; 12.90 + this.writer = writer; 12.91 + this.visibleMemberMap = new VisibleMemberMap(classDoc, memberType, 12.92 + configuration); 12.93 + this.members = new ArrayList<ProgramElementDoc>( 12.94 + this.visibleMemberMap.getMembersFor(classDoc)); 12.95 + if (configuration.getMemberComparator() != null) { 12.96 + Collections.sort(this.members, configuration.getMemberComparator()); 12.97 + } 12.98 + } 12.99 + 12.100 + 12.101 + /** 12.102 + * Construct a new AnnotationTypeFieldBuilder. 12.103 + * 12.104 + * @param context the build context. 12.105 + * @param classDoc the class whose members are being documented. 12.106 + * @param writer the doclet specific writer. 12.107 + */ 12.108 + public static AnnotationTypeFieldBuilder getInstance( 12.109 + Context context, ClassDoc classDoc, 12.110 + AnnotationTypeFieldWriter writer) { 12.111 + return new AnnotationTypeFieldBuilder(context, classDoc, 12.112 + writer, VisibleMemberMap.ANNOTATION_TYPE_FIELDS); 12.113 + } 12.114 + 12.115 + /** 12.116 + * {@inheritDoc} 12.117 + */ 12.118 + public String getName() { 12.119 + return "AnnotationTypeFieldDetails"; 12.120 + } 12.121 + 12.122 + /** 12.123 + * Returns a list of members that will be documented for the given class. 12.124 + * This information can be used for doclet specific documentation 12.125 + * generation. 12.126 + * 12.127 + * @param classDoc the {@link ClassDoc} we want to check. 12.128 + * @return a list of members that will be documented. 12.129 + */ 12.130 + public List<ProgramElementDoc> members(ClassDoc classDoc) { 12.131 + return visibleMemberMap.getMembersFor(classDoc); 12.132 + } 12.133 + 12.134 + /** 12.135 + * Returns the visible member map for the members of this class. 12.136 + * 12.137 + * @return the visible member map for the members of this class. 12.138 + */ 12.139 + public VisibleMemberMap getVisibleMemberMap() { 12.140 + return visibleMemberMap; 12.141 + } 12.142 + 12.143 + /** 12.144 + * summaryOrder.size() 12.145 + */ 12.146 + public boolean hasMembersToDocument() { 12.147 + return members.size() > 0; 12.148 + } 12.149 + 12.150 + /** 12.151 + * Build the annotation type field documentation. 12.152 + * 12.153 + * @param node the XML element that specifies which components to document 12.154 + * @param memberDetailsTree the content tree to which the documentation will be added 12.155 + */ 12.156 + public void buildAnnotationTypeField(XMLNode node, Content memberDetailsTree) { 12.157 + buildAnnotationTypeMember(node, memberDetailsTree); 12.158 + } 12.159 + 12.160 + /** 12.161 + * Build the member documentation. 12.162 + * 12.163 + * @param node the XML element that specifies which components to document 12.164 + * @param memberDetailsTree the content tree to which the documentation will be added 12.165 + */ 12.166 + public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree) { 12.167 + if (writer == null) { 12.168 + return; 12.169 + } 12.170 + int size = members.size(); 12.171 + if (size > 0) { 12.172 + writer.addAnnotationFieldDetailsMarker(memberDetailsTree); 12.173 + for (currentMemberIndex = 0; currentMemberIndex < size; 12.174 + currentMemberIndex++) { 12.175 + Content detailsTree = writer.getMemberTreeHeader(); 12.176 + writer.addAnnotationDetailsTreeHeader(classDoc, detailsTree); 12.177 + Content annotationDocTree = writer.getAnnotationDocTreeHeader( 12.178 + (MemberDoc) members.get(currentMemberIndex), 12.179 + detailsTree); 12.180 + buildChildren(node, annotationDocTree); 12.181 + detailsTree.addContent(writer.getAnnotationDoc( 12.182 + annotationDocTree, (currentMemberIndex == size - 1))); 12.183 + memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree)); 12.184 + } 12.185 + } 12.186 + } 12.187 + 12.188 + /** 12.189 + * Build the signature. 12.190 + * 12.191 + * @param node the XML element that specifies which components to document 12.192 + * @param annotationDocTree the content tree to which the documentation will be added 12.193 + */ 12.194 + public void buildSignature(XMLNode node, Content annotationDocTree) { 12.195 + annotationDocTree.addContent( 12.196 + writer.getSignature((MemberDoc) members.get(currentMemberIndex))); 12.197 + } 12.198 + 12.199 + /** 12.200 + * Build the deprecation information. 12.201 + * 12.202 + * @param node the XML element that specifies which components to document 12.203 + * @param annotationDocTree the content tree to which the documentation will be added 12.204 + */ 12.205 + public void buildDeprecationInfo(XMLNode node, Content annotationDocTree) { 12.206 + writer.addDeprecated((MemberDoc) members.get(currentMemberIndex), 12.207 + annotationDocTree); 12.208 + } 12.209 + 12.210 + /** 12.211 + * Build the comments for the member. Do nothing if 12.212 + * {@link Configuration#nocomment} is set to true. 12.213 + * 12.214 + * @param node the XML element that specifies which components to document 12.215 + * @param annotationDocTree the content tree to which the documentation will be added 12.216 + */ 12.217 + public void buildMemberComments(XMLNode node, Content annotationDocTree) { 12.218 + if(! configuration.nocomment){ 12.219 + writer.addComments((MemberDoc) members.get(currentMemberIndex), 12.220 + annotationDocTree); 12.221 + } 12.222 + } 12.223 + 12.224 + /** 12.225 + * Build the tag information. 12.226 + * 12.227 + * @param node the XML element that specifies which components to document 12.228 + * @param annotationDocTree the content tree to which the documentation will be added 12.229 + */ 12.230 + public void buildTagInfo(XMLNode node, Content annotationDocTree) { 12.231 + writer.addTags((MemberDoc) members.get(currentMemberIndex), 12.232 + annotationDocTree); 12.233 + } 12.234 + 12.235 + /** 12.236 + * Return the annotation type field writer for this builder. 12.237 + * 12.238 + * @return the annotation type field writer for this builder. 12.239 + */ 12.240 + public AnnotationTypeFieldWriter getWriter() { 12.241 + return writer; 12.242 + } 12.243 +}
13.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java Wed Sep 18 14:39:27 2013 +0200 13.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java Wed Sep 18 17:13:26 2013 -0700 13.3 @@ -167,16 +167,17 @@ 13.4 } 13.5 int size = members.size(); 13.6 if (size > 0) { 13.7 - writer.addAnnotationDetailsTreeHeader( 13.8 - classDoc, memberDetailsTree); 13.9 + writer.addAnnotationDetailsMarker(memberDetailsTree); 13.10 for (currentMemberIndex = 0; currentMemberIndex < size; 13.11 - currentMemberIndex++) { 13.12 + currentMemberIndex++) { 13.13 + Content detailsTree = writer.getMemberTreeHeader(); 13.14 + writer.addAnnotationDetailsTreeHeader(classDoc, detailsTree); 13.15 Content annotationDocTree = writer.getAnnotationDocTreeHeader( 13.16 - (MemberDoc) members.get(currentMemberIndex), 13.17 - memberDetailsTree); 13.18 + (MemberDoc) members.get(currentMemberIndex), detailsTree); 13.19 buildChildren(node, annotationDocTree); 13.20 - memberDetailsTree.addContent(writer.getAnnotationDoc( 13.21 + detailsTree.addContent(writer.getAnnotationDoc( 13.22 annotationDocTree, (currentMemberIndex == size - 1))); 13.23 + memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree)); 13.24 } 13.25 } 13.26 }
14.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java Wed Sep 18 14:39:27 2013 +0200 14.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java Wed Sep 18 17:13:26 2013 -0700 14.3 @@ -174,10 +174,26 @@ 14.4 } 14.5 14.6 /** 14.7 + * Return an instance of the annotation type fields builder for the given 14.8 + * class. 14.9 + * 14.10 + * @return an instance of the annotation type field builder for the given 14.11 + * annotation type. 14.12 + */ 14.13 + public AbstractBuilder getAnnotationTypeFieldsBuilder( 14.14 + AnnotationTypeWriter annotationTypeWriter) 14.15 + throws Exception { 14.16 + return AnnotationTypeFieldBuilder.getInstance(context, 14.17 + annotationTypeWriter.getAnnotationTypeDoc(), 14.18 + writerFactory.getAnnotationTypeFieldWriter( 14.19 + annotationTypeWriter)); 14.20 + } 14.21 + 14.22 + /** 14.23 * Return an instance of the annotation type member builder for the given 14.24 * class. 14.25 * 14.26 - * @return an instance of the annotation type memebr builder for the given 14.27 + * @return an instance of the annotation type member builder for the given 14.28 * annotation type. 14.29 */ 14.30 public AbstractBuilder getAnnotationTypeOptionalMemberBuilder( 14.31 @@ -193,7 +209,7 @@ 14.32 * Return an instance of the annotation type member builder for the given 14.33 * class. 14.34 * 14.35 - * @return an instance of the annotation type memebr builder for the given 14.36 + * @return an instance of the annotation type member builder for the given 14.37 * annotation type. 14.38 */ 14.39 public AbstractBuilder getAnnotationTypeRequiredMemberBuilder(
15.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java Wed Sep 18 14:39:27 2013 +0200 15.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java Wed Sep 18 17:13:26 2013 -0700 15.3 @@ -213,6 +213,20 @@ 15.4 } 15.5 15.6 /** 15.7 + * Build the summary for fields. 15.8 + * 15.9 + * @param node the XML element that specifies which components to document 15.10 + * @param memberSummaryTree the content tree to which the documentation will be added 15.11 + */ 15.12 + public void buildAnnotationTypeFieldsSummary(XMLNode node, Content memberSummaryTree) { 15.13 + MemberSummaryWriter writer = 15.14 + memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_FIELDS]; 15.15 + VisibleMemberMap visibleMemberMap = 15.16 + visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_FIELDS]; 15.17 + addSummary(writer, visibleMemberMap, false, memberSummaryTree); 15.18 + } 15.19 + 15.20 + /** 15.21 * Build the summary for the optional members. 15.22 * 15.23 * @param node the XML element that specifies which components to document
16.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml Wed Sep 18 14:39:27 2013 +0200 16.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml Wed Sep 18 17:13:26 2013 -0700 16.3 @@ -66,10 +66,19 @@ 16.4 <AnnotationTypeTagInfo/> 16.5 </AnnotationTypeInfo> 16.6 <MemberSummary> 16.7 + <AnnotationTypeFieldsSummary/> 16.8 <AnnotationTypeRequiredMemberSummary/> 16.9 <AnnotationTypeOptionalMemberSummary/> 16.10 </MemberSummary> 16.11 <AnnotationTypeMemberDetails> 16.12 + <AnnotationTypeFieldDetails> 16.13 + <AnnotationTypeField> 16.14 + <Signature/> 16.15 + <DeprecationInfo/> 16.16 + <MemberComments/> 16.17 + <TagInfo/> 16.18 + </AnnotationTypeField> 16.19 + </AnnotationTypeFieldDetails> 16.20 <AnnotationTypeRequiredMemberDetails> 16.21 <AnnotationTypeRequiredMember> 16.22 <Signature/>
17.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java Wed Sep 18 14:39:27 2013 +0200 17.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java Wed Sep 18 17:13:26 2013 -0700 17.3 @@ -55,14 +55,15 @@ 17.4 public static final int FIELDS = 2; 17.5 public static final int CONSTRUCTORS = 3; 17.6 public static final int METHODS = 4; 17.7 - public static final int ANNOTATION_TYPE_MEMBER_OPTIONAL = 5; 17.8 - public static final int ANNOTATION_TYPE_MEMBER_REQUIRED = 6; 17.9 - public static final int PROPERTIES = 7; 17.10 + public static final int ANNOTATION_TYPE_FIELDS = 5; 17.11 + public static final int ANNOTATION_TYPE_MEMBER_OPTIONAL = 6; 17.12 + public static final int ANNOTATION_TYPE_MEMBER_REQUIRED = 7; 17.13 + public static final int PROPERTIES = 8; 17.14 17.15 /** 17.16 * The total number of member types is {@value}. 17.17 */ 17.18 - public static final int NUM_MEMBER_TYPES = 8; 17.19 + public static final int NUM_MEMBER_TYPES = 9; 17.20 17.21 public static final String STARTLEVEL = "start"; 17.22 17.23 @@ -433,6 +434,9 @@ 17.24 } 17.25 ProgramElementDoc[] members = null; 17.26 switch (kind) { 17.27 + case ANNOTATION_TYPE_FIELDS: 17.28 + members = cd.fields(filter); 17.29 + break; 17.30 case ANNOTATION_TYPE_MEMBER_OPTIONAL: 17.31 members = cd.isAnnotationType() ? 17.32 filter((AnnotationTypeDoc) cd, false) :
18.1 --- a/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java Wed Sep 18 14:39:27 2013 +0200 18.2 +++ b/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java Wed Sep 18 17:13:26 2013 -0700 18.3 @@ -1,5 +1,5 @@ 18.4 /* 18.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 18.6 + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. 18.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.8 * 18.9 * This code is free software; you can redistribute it and/or modify it 18.10 @@ -23,20 +23,19 @@ 18.11 18.12 /* 18.13 * @test 18.14 - * @bug 4973609 18.15 + * @bug 4973609 8015249 18.16 * @summary Make sure that annotation types with 0 members does not have 18.17 * extra HR tags. 18.18 * @author jamieh 18.19 * @library ../lib/ 18.20 - * @build JavadocTester 18.21 - * @build TestAnnotationTypes 18.22 + * @build JavadocTester TestAnnotationTypes 18.23 * @run main TestAnnotationTypes 18.24 */ 18.25 18.26 public class TestAnnotationTypes extends JavadocTester { 18.27 18.28 //Test information. 18.29 - private static final String BUG_ID = "4973609"; 18.30 + private static final String BUG_ID = "4973609-8015249"; 18.31 18.32 //Javadoc arguments. 18.33 private static final String[] ARGS = new String[] { 18.34 @@ -44,7 +43,31 @@ 18.35 }; 18.36 18.37 //Input for string search tests. 18.38 - private static final String[][] TEST = NO_TEST; 18.39 + private static final String[][] TEST = { 18.40 + {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", 18.41 + "<li>Summary: </li>" + NL + "<li><a href=\"#annotation_type_" + 18.42 + "field_summary\">Field</a> | </li>"}, 18.43 + {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", 18.44 + "<li>Detail: </li>" + NL + "<li><a href=\"#annotation_type_" + 18.45 + "field_detail\">Field</a> | </li>"}, 18.46 + {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", 18.47 + "<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->"}, 18.48 + {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", 18.49 + "<h3>Field Summary</h3>"}, 18.50 + {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", 18.51 + "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../" + 18.52 + "pkg/AnnotationTypeField.html#DEFAULT_NAME\">DEFAULT_NAME</a></span>" + 18.53 + "</code> </td>"}, 18.54 + {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", 18.55 + "<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->"}, 18.56 + {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", 18.57 + "<h4>DEFAULT_NAME</h4>" + NL + "<pre>public static final java." + 18.58 + "lang.String DEFAULT_NAME</pre>"}, 18.59 + {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", 18.60 + "<li>Summary: </li>" + NL + "<li>Field | </li>"}, 18.61 + {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", 18.62 + "<li>Detail: </li>" + NL + "<li>Field | </li>"}, 18.63 + }; 18.64 private static final String[][] NEGATED_TEST = { 18.65 {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", 18.66 "<HR>" + NL + NL + "<P>" + NL + NL + "<P>" +
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 19.2 +++ b/test/com/sun/javadoc/testAnnotationTypes/pkg/AnnotationTypeField.java Wed Sep 18 17:13:26 2013 -0700 19.3 @@ -0,0 +1,35 @@ 19.4 +/* 19.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 19.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.7 + * 19.8 + * This code is free software; you can redistribute it and/or modify it 19.9 + * under the terms of the GNU General Public License version 2 only, as 19.10 + * published by the Free Software Foundation. 19.11 + * 19.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 19.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19.15 + * version 2 for more details (a copy is included in the LICENSE file that 19.16 + * accompanied this code). 19.17 + * 19.18 + * You should have received a copy of the GNU General Public License version 19.19 + * 2 along with this work; if not, write to the Free Software Foundation, 19.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19.21 + * 19.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19.23 + * or visit www.oracle.com if you need additional information or have any 19.24 + * questions. 19.25 + */ 19.26 + 19.27 +package pkg; 19.28 + 19.29 +import java.lang.annotation.*; 19.30 + 19.31 +/** 19.32 + * This is just a test for annotation type fields. 19.33 + */ 19.34 +@Documented public @interface AnnotationTypeField { 19.35 + String DEFAULT_NAME = "test"; 19.36 + 19.37 + String name() default DEFAULT_NAME; 19.38 +}
20.1 --- a/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Wed Sep 18 14:39:27 2013 +0200 20.2 +++ b/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Wed Sep 18 17:13:26 2013 -0700 20.3 @@ -155,13 +155,13 @@ 20.4 //================================= 20.5 //Make sure the summary links are correct. 20.6 {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", 20.7 - "<li>Summary: </li>" + NL + 20.8 + "<li>Summary: </li>" + NL + "<li>Field | </li>" + NL + 20.9 "<li><a href=\"#annotation_type_required_element_summary\">" + 20.10 "Required</a> | </li>" + NL + "<li>" + 20.11 "<a href=\"#annotation_type_optional_element_summary\">Optional</a></li>"}, 20.12 //Make sure the detail links are correct. 20.13 {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", 20.14 - "<li>Detail: </li>" + NL + 20.15 + "<li>Detail: </li>" + NL + "<li>Field | </li>" + NL + 20.16 "<li><a href=\"#annotation_type_element_detail\">Element</a></li>"}, 20.17 //Make sure the heading is correct. 20.18 {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",