diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java index 9c20777e137..23f4f00cd7f 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java @@ -305,6 +305,6 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite buf.append(t.dimension()); } buf.append(")"); - return foundTypeVariable ? buf.toString() : null; + return foundTypeVariable ? writer.getName(buf.toString()) : null; } } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java index 87a5bce3367..4b7ca05e384 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java @@ -89,10 +89,11 @@ public class AbstractIndexWriter extends HtmlDocletWriter { * @param memberlist List of members for the unicode character * @param contentTree the content tree to which the information will be added */ - protected void addContents(Character unicode, List extends Doc> memberlist, + protected void addContents(Character uc, List extends Doc> memberlist, Content contentTree) { - contentTree.addContent(getMarkerAnchor("_" + unicode + "_")); - Content headContent = new StringContent(unicode.toString()); + String unicode = uc.toString(); + contentTree.addContent(getMarkerAnchorForIndex(unicode)); + Content headContent = new StringContent(unicode); Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, false, HtmlStyle.title, headContent); contentTree.addContent(heading); @@ -253,4 +254,24 @@ public class AbstractIndexWriter extends HtmlDocletWriter { addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing, false, contentTree); } + + /** + * Get the marker anchor which will be added to the index documentation tree. + * + * @param anchorNameForIndex the anchor name attribute for index page + * @return a content tree for the marker anchor + */ + public Content getMarkerAnchorForIndex(String anchorNameForIndex) { + return getMarkerAnchor(getNameForIndex(anchorNameForIndex), null); + } + + /** + * Generate a valid HTML name for member index page. + * + * @param unicode the string that needs to be converted to valid HTML name. + * @return a valid HTML name string. + */ + public String getNameForIndex(String unicode) { + return "I:" + getName(unicode); + } } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java index f4c7c68f565..bb936d37324 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java @@ -88,7 +88,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter Content memberDetailsTree) { if (!writer.printedAnnotationFieldHeading) { memberDetailsTree.addContent(writer.getMarkerAnchor( - "annotation_type_field_detail")); + SectionName.ANNOTATION_TYPE_FIELD_DETAIL)); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.fieldDetailsLabel); memberDetailsTree.addContent(heading); @@ -217,7 +217,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { memberTree.addContent(writer.getMarkerAnchor( - "annotation_type_field_summary")); + SectionName.ANNOTATION_TYPE_FIELD_SUMMARY)); } /** @@ -272,7 +272,8 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink("annotation_type_field_summary", + return writer.getHyperLink( + SectionName.ANNOTATION_TYPE_FIELD_SUMMARY, writer.getResource("doclet.navField")); } else { return writer.getResource("doclet.navField"); @@ -284,7 +285,8 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(writer.getHyperLink("annotation_type_field_detail", + liNav.addContent(writer.getHyperLink( + SectionName.ANNOTATION_TYPE_FIELD_DETAIL, writer.getResource("doclet.navField"))); } else { liNav.addContent(writer.getResource("doclet.navField")); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java index ff8fc100f0a..9a586a017f3 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java @@ -133,7 +133,7 @@ public class AnnotationTypeOptionalMemberWriterImpl extends */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { memberTree.addContent(writer.getMarkerAnchor( - "annotation_type_optional_element_summary")); + SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY)); } /** @@ -141,7 +141,8 @@ public class AnnotationTypeOptionalMemberWriterImpl extends */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink("annotation_type_optional_element_summary", + return writer.getHyperLink( + SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY, writer.getResource("doclet.navAnnotationTypeOptionalMember")); } else { return writer.getResource("doclet.navAnnotationTypeOptionalMember"); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java index 1833d262db3..bdbe8d547c2 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java @@ -89,7 +89,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter Content memberDetailsTree) { if (!writer.printedAnnotationHeading) { memberDetailsTree.addContent(writer.getMarkerAnchor( - "annotation_type_element_detail")); + SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL)); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.annotationTypeDetailsLabel); memberDetailsTree.addContent(heading); @@ -219,7 +219,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { memberTree.addContent(writer.getMarkerAnchor( - "annotation_type_required_element_summary")); + SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY)); } /** @@ -274,7 +274,8 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink("annotation_type_required_element_summary", + return writer.getHyperLink( + SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY, writer.getResource("doclet.navAnnotationTypeRequiredMember")); } else { return writer.getResource("doclet.navAnnotationTypeRequiredMember"); @@ -286,7 +287,8 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(writer.getHyperLink("annotation_type_element_detail", + liNav.addContent(writer.getHyperLink( + SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL, writer.getResource("doclet.navAnnotationTypeMember"))); } else { liNav.addContent(writer.getResource("doclet.navAnnotationTypeMember")); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java index cb9ab3e3078..21f0c215038 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java @@ -107,7 +107,8 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter //add link to summary Content link; if (packageName.length() == 0) { - link = getHyperLink(DocLink.fragment(DocletConstants.UNNAMED_PACKAGE_ANCHOR), + link = getHyperLink(getDocLink( + SectionName.UNNAMED_PACKAGE_ANCHOR), defaultPackageLabel, "", ""); } else { Content packageNameContent = getPackageLabel(parsedPackageName); @@ -153,7 +154,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter Content pkgNameContent; if (parsedPackageName.length() == 0) { summariesTree.addContent(getMarkerAnchor( - DocletConstants.UNNAMED_PACKAGE_ANCHOR)); + SectionName.UNNAMED_PACKAGE_ANCHOR)); pkgNameContent = defaultPackageLabel; } else { summariesTree.addContent(getMarkerAnchor( diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java index 496737078dd..856a4827e3c 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java @@ -97,7 +97,8 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter Content memberDetailsTree) { memberDetailsTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_DETAILS); Content constructorDetailsTree = writer.getMemberTreeHeader(); - constructorDetailsTree.addContent(writer.getMarkerAnchor("constructor_detail")); + constructorDetailsTree.addContent(writer.getMarkerAnchor( + SectionName.CONSTRUCTOR_DETAIL)); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.constructorDetailsLabel); constructorDetailsTree.addContent(heading); @@ -256,7 +257,8 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter * {@inheritDoc} */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { - memberTree.addContent(writer.getMarkerAnchor("constructor_summary")); + memberTree.addContent(writer.getMarkerAnchor( + SectionName.CONSTRUCTOR_SUMMARY)); } /** @@ -280,7 +282,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink("constructor_summary", + return writer.getHyperLink(SectionName.CONSTRUCTOR_SUMMARY, writer.getResource("doclet.navConstructor")); } else { return writer.getResource("doclet.navConstructor"); @@ -292,7 +294,8 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(writer.getHyperLink("constructor_detail", + liNav.addContent(writer.getHyperLink( + SectionName.CONSTRUCTOR_DETAIL, writer.getResource("doclet.navConstructor"))); } else { liNav.addContent(writer.getResource("doclet.navConstructor")); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java index 00135fc6cec..63c81438956 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java @@ -48,8 +48,8 @@ public class DeprecatedListWriter extends SubWriterHolderWriter { private static final String[] ANCHORS = new String[] { "package", "interface", "class", "enum", "exception", "error", - "annotation_type", "field", "method", "constructor", "enum_constant", - "annotation_type_member" + "annotation.type", "field", "method", "constructor", "enum.constant", + "annotation.type.member" }; private static final String[] HEADING_KEYS = new String[] { diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java index 382f16f1f00..b971d07668d 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java @@ -73,7 +73,8 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter Content memberDetailsTree) { memberDetailsTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_DETAILS); Content enumConstantsDetailsTree = writer.getMemberTreeHeader(); - enumConstantsDetailsTree.addContent(writer.getMarkerAnchor("enum_constant_detail")); + enumConstantsDetailsTree.addContent(writer.getMarkerAnchor( + SectionName.ENUM_CONSTANT_DETAIL)); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.enumConstantsDetailsLabel); enumConstantsDetailsTree.addContent(heading); @@ -202,7 +203,8 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter * {@inheritDoc} */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { - memberTree.addContent(writer.getMarkerAnchor("enum_constant_summary")); + memberTree.addContent(writer.getMarkerAnchor( + SectionName.ENUM_CONSTANT_SUMMARY)); } /** @@ -263,11 +265,14 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink((cd == null)? - "enum_constant_summary": - "enum_constants_inherited_from_class_" + - configuration.getClassName(cd), - writer.getResource("doclet.navEnum")); + if (cd == null) { + return writer.getHyperLink(SectionName.ENUM_CONSTANT_SUMMARY, + writer.getResource("doclet.navEnum")); + } else { + return writer.getHyperLink( + SectionName.ENUM_CONSTANTS_INHERITANCE, + configuration.getClassName(cd), writer.getResource("doclet.navEnum")); + } } else { return writer.getResource("doclet.navEnum"); } @@ -278,7 +283,8 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(writer.getHyperLink("enum_constant_detail", + liNav.addContent(writer.getHyperLink( + SectionName.ENUM_CONSTANT_DETAIL, writer.getResource("doclet.navEnum"))); } else { liNav.addContent(writer.getResource("doclet.navEnum")); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java index f599ac2ff6b..104967129f7 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java @@ -74,7 +74,8 @@ public class FieldWriterImpl extends AbstractMemberWriter Content memberDetailsTree) { memberDetailsTree.addContent(HtmlConstants.START_OF_FIELD_DETAILS); Content fieldDetailsTree = writer.getMemberTreeHeader(); - fieldDetailsTree.addContent(writer.getMarkerAnchor("field_detail")); + fieldDetailsTree.addContent(writer.getMarkerAnchor( + SectionName.FIELD_DETAIL)); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.fieldDetailsLabel); fieldDetailsTree.addContent(heading); @@ -224,7 +225,8 @@ public class FieldWriterImpl extends AbstractMemberWriter * {@inheritDoc} */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { - memberTree.addContent(writer.getMarkerAnchor("field_summary")); + memberTree.addContent(writer.getMarkerAnchor( + SectionName.FIELD_SUMMARY)); } /** @@ -232,7 +234,7 @@ public class FieldWriterImpl extends AbstractMemberWriter */ public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) { inheritedTree.addContent(writer.getMarkerAnchor( - "fields_inherited_from_class_" + configuration.getClassName(cd))); + SectionName.FIELDS_INHERITANCE, configuration.getClassName(cd))); } /** @@ -293,11 +295,15 @@ public class FieldWriterImpl extends AbstractMemberWriter */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink((cd == null)? - "field_summary": - "fields_inherited_from_class_" + - configuration.getClassName(cd), - writer.getResource("doclet.navField")); + if (cd == null) { + return writer.getHyperLink( + SectionName.FIELD_SUMMARY, + writer.getResource("doclet.navField")); + } else { + return writer.getHyperLink( + SectionName.FIELDS_INHERITANCE, + configuration.getClassName(cd), writer.getResource("doclet.navField")); + } } else { return writer.getResource("doclet.navField"); } @@ -308,7 +314,8 @@ public class FieldWriterImpl extends AbstractMemberWriter */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(writer.getHyperLink("field_detail", + liNav.addContent(writer.getHyperLink( + SectionName.FIELD_DETAIL, writer.getResource("doclet.navField"))); } else { liNav.addContent(writer.getResource("doclet.navField")); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java index 3bdcf6a3b10..19a578c85cb 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java @@ -509,28 +509,28 @@ public class HtmlDocletWriter extends HtmlDocWriter { body.addContent(HtmlConstants.START_OF_TOP_NAVBAR); navDiv.addStyle(HtmlStyle.topNav); allClassesId += "navbar_top"; - Content a = getMarkerAnchor("navbar_top"); + Content a = getMarkerAnchor(SectionName.NAVBAR_TOP); //WCAG - Hyperlinks should contain text or an image with alt text - for AT tools navDiv.addContent(a); Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink( - DocLink.fragment("skip-navbar_top"), skipNavLinks, + getDocLink(SectionName.SKIP_NAVBAR_TOP), skipNavLinks, skipNavLinks.toString(), "")); navDiv.addContent(skipLinkContent); } else { body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR); navDiv.addStyle(HtmlStyle.bottomNav); allClassesId += "navbar_bottom"; - Content a = getMarkerAnchor("navbar_bottom"); + Content a = getMarkerAnchor(SectionName.NAVBAR_BOTTOM); navDiv.addContent(a); Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink( - DocLink.fragment("skip-navbar_bottom"), skipNavLinks, + getDocLink(SectionName.SKIP_NAVBAR_BOTTOM), skipNavLinks, skipNavLinks.toString(), "")); navDiv.addContent(skipLinkContent); } if (header) { - navDiv.addContent(getMarkerAnchor("navbar_top_firstrow")); + navDiv.addContent(getMarkerAnchor(SectionName.NAVBAR_TOP_FIRSTROW)); } else { - navDiv.addContent(getMarkerAnchor("navbar_bottom_firstrow")); + navDiv.addContent(getMarkerAnchor(SectionName.NAVBAR_BOTTOM_FIRSTROW)); } HtmlTree navList = new HtmlTree(HtmlTag.UL); navList.addStyle(HtmlStyle.navList); @@ -577,11 +577,11 @@ public class HtmlDocletWriter extends HtmlDocWriter { subDiv.addContent(getAllClassesLinkScript(allClassesId.toString())); addSummaryDetailLinks(subDiv); if (header) { - subDiv.addContent(getMarkerAnchor("skip-navbar_top")); + subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_TOP)); body.addContent(subDiv); body.addContent(HtmlConstants.END_OF_TOP_NAVBAR); } else { - subDiv.addContent(getMarkerAnchor("skip-navbar_bottom")); + subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_BOTTOM)); body.addContent(subDiv); body.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR); } @@ -886,7 +886,28 @@ public class HtmlDocletWriter extends HtmlDocWriter { * @return a content tree for the marker anchor */ public Content getMarkerAnchor(String anchorName) { - return getMarkerAnchor(anchorName, null); + return getMarkerAnchor(getName(anchorName), null); + } + + /** + * Get the marker anchor which will be added to the documentation tree. + * + * @param sectionName the section name anchor attribute for page + * @return a content tree for the marker anchor + */ + public Content getMarkerAnchor(SectionName sectionName) { + return getMarkerAnchor(sectionName.getName(), null); + } + + /** + * Get the marker anchor which will be added to the documentation tree. + * + * @param sectionName the section name anchor attribute for page + * @param anchorName the anchor name combined with section name attribute for the page + * @return a content tree for the marker anchor + */ + public Content getMarkerAnchor(SectionName sectionName, String anchorName) { + return getMarkerAnchor(sectionName.getName() + getName(anchorName), null); } /** @@ -1291,10 +1312,10 @@ public class HtmlDocletWriter extends HtmlDocWriter { } else if (doc instanceof ExecutableMemberDoc) { ExecutableMemberDoc emd = (ExecutableMemberDoc)doc; return getLink(new LinkInfoImpl(configuration, context, classDoc) - .label(label).where(getAnchor(emd, isProperty)).strong(strong)); + .label(label).where(getName(getAnchor(emd, isProperty))).strong(strong)); } else if (doc instanceof MemberDoc) { return getLink(new LinkInfoImpl(configuration, context, classDoc) - .label(label).where(doc.name()).strong(strong)); + .label(label).where(getName(doc.name())).strong(strong)); } else { return label; } @@ -1319,10 +1340,10 @@ public class HtmlDocletWriter extends HtmlDocWriter { } else if (doc instanceof ExecutableMemberDoc) { ExecutableMemberDoc emd = (ExecutableMemberDoc) doc; return getLink(new LinkInfoImpl(configuration, context, classDoc) - .label(label).where(getAnchor(emd))); + .label(label).where(getName(getAnchor(emd)))); } else if (doc instanceof MemberDoc) { return getLink(new LinkInfoImpl(configuration, context, classDoc) - .label(label).where(doc.name())); + .label(label).where(getName(doc.name()))); } else { return label; } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java index 8918889a4c1..8597adaeba2 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java @@ -49,8 +49,6 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl implements SerializedFormWriter.SerialFieldWriter { ProgramElementDoc[] members = null; - private boolean printedOverallAnchor = false; - public HtmlSerialFieldWriter(SubWriterHolderWriter writer, ClassDoc classdoc) { super(writer, classdoc); @@ -98,10 +96,6 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl HtmlTree li = new HtmlTree(HtmlTag.LI); li.addStyle(HtmlStyle.blockList); if (serializableFieldsTree.isValid()) { - if (!printedOverallAnchor) { - li.addContent(writer.getMarkerAnchor("serializedForm")); - printedOverallAnchor = true; - } Content headingContent = new StringContent(heading); Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, headingContent); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java index 4e5da21fc7f..082745db179 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java @@ -85,12 +85,10 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements * @return a content tree for the serializable methods content */ public Content getSerializableMethods(String heading, Content serializableMethodContent) { - Content li = HtmlTree.LI(HtmlStyle.blockList, writer.getMarkerAnchor( - "serialized_methods")); Content headingContent = new StringContent(heading); Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, headingContent); - li.addContent(serialHeading); + Content li = HtmlTree.LI(HtmlStyle.blockList, serialHeading); li.addContent(serializableMethodContent); return li; } @@ -113,8 +111,6 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements * @param methodsContentTree the content tree to which the member header will be added */ public void addMemberHeader(MethodDoc member, Content methodsContentTree) { - methodsContentTree.addContent(writer.getMarkerAnchor( - writer.getAnchor(member))); methodsContentTree.addContent(getHead(member)); methodsContentTree.addContent(getSignature(member)); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java index bb67b99c200..8b3712d3594 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java @@ -85,7 +85,8 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter Content memberDetailsTree) { memberDetailsTree.addContent(HtmlConstants.START_OF_METHOD_DETAILS); Content methodDetailsTree = writer.getMemberTreeHeader(); - methodDetailsTree.addContent(writer.getMarkerAnchor("method_detail")); + methodDetailsTree.addContent(writer.getMarkerAnchor( + SectionName.METHOD_DETAIL)); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.methodDetailsLabel); methodDetailsTree.addContent(heading); @@ -244,7 +245,8 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter * {@inheritDoc} */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { - memberTree.addContent(writer.getMarkerAnchor("method_summary")); + memberTree.addContent(writer.getMarkerAnchor( + SectionName.METHOD_SUMMARY)); } /** @@ -252,8 +254,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter */ public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) { inheritedTree.addContent(writer.getMarkerAnchor( - "methods_inherited_from_class_" + - configuration.getClassName(cd))); + SectionName.METHODS_INHERITANCE, configuration.getClassName(cd))); } /** @@ -318,7 +319,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter Content methlink = writer.getLink( new LinkInfoImpl(writer.configuration, LinkInfoImpl.Kind.MEMBER, overriddenType.asClassDoc()) - .where(writer.getAnchor(method)).label(name)); + .where(writer.getName(writer.getAnchor(method))).label(name)); Content codeMethLink = HtmlTree.CODE(methlink); Content dd = HtmlTree.DD(codeMethLink); dd.addContent(writer.getSpace()); @@ -400,11 +401,15 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink((cd == null)? - "method_summary": - "methods_inherited_from_class_" + - configuration.getClassName(cd), - writer.getResource("doclet.navMethod")); + if (cd == null) { + return writer.getHyperLink( + SectionName.METHOD_SUMMARY, + writer.getResource("doclet.navMethod")); + } else { + return writer.getHyperLink( + SectionName.METHODS_INHERITANCE, + configuration.getClassName(cd), writer.getResource("doclet.navMethod")); + } } else { return writer.getResource("doclet.navMethod"); } @@ -415,8 +420,8 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(writer.getHyperLink("method_detail", - writer.getResource("doclet.navMethod"))); + liNav.addContent(writer.getHyperLink( + SectionName.METHOD_DETAIL, writer.getResource("doclet.navMethod"))); } else { liNav.addContent(writer.getResource("doclet.navMethod")); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java index d44dd25feb0..d0537af4a41 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java @@ -132,7 +132,8 @@ public class NestedClassWriterImpl extends AbstractMemberWriter * {@inheritDoc} */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { - memberTree.addContent(writer.getMarkerAnchor("nested_class_summary")); + memberTree.addContent(writer.getMarkerAnchor( + SectionName.NESTED_CLASS_SUMMARY)); } /** @@ -140,7 +141,8 @@ public class NestedClassWriterImpl extends AbstractMemberWriter */ public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) { inheritedTree.addContent(writer.getMarkerAnchor( - "nested_classes_inherited_from_class_" + cd.qualifiedName())); + SectionName.NESTED_CLASSES_INHERITANCE, + cd.qualifiedName())); } /** @@ -202,9 +204,15 @@ public class NestedClassWriterImpl extends AbstractMemberWriter */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink((cd == null) ? "nested_class_summary": - "nested_classes_inherited_from_class_" + cd.qualifiedName(), - writer.getResource("doclet.navNested")); + if (cd == null) { + return writer.getHyperLink( + SectionName.NESTED_CLASS_SUMMARY, + writer.getResource("doclet.navNested")); + } else { + return writer.getHyperLink( + SectionName.NESTED_CLASSES_INHERITANCE, + cd.qualifiedName(), writer.getResource("doclet.navNested")); + } } else { return writer.getResource("doclet.navNested"); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java index caf0e0976a6..ffb93b73f21 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java @@ -203,8 +203,9 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter { Content see = seeLabel; see.addContent(" "); Content descPara = HtmlTree.P(see); - Content descLink = getHyperLink(DocLink.fragment("overview_description"), - descriptionLabel, "", ""); + Content descLink = getHyperLink(getDocLink( + SectionName.OVERVIEW_DESCRIPTION), + descriptionLabel, "", ""); descPara.addContent(descLink); div.addContent(descPara); body.addContent(div); @@ -220,7 +221,8 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter { */ protected void addOverviewComment(Content htmltree) { if (root.inlineTags().length > 0) { - htmltree.addContent(getMarkerAnchor("overview_description")); + htmltree.addContent( + getMarkerAnchor(SectionName.OVERVIEW_DESCRIPTION)); addInlineComment(root, htmltree); } } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java index f0325b5b953..c19bf2d6549 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java @@ -112,7 +112,8 @@ public class PackageWriterImpl extends HtmlDocletWriter addSummaryComment(packageDoc, docSummaryDiv); div.addContent(docSummaryDiv); Content space = getSpace(); - Content descLink = getHyperLink(DocLink.fragment("package_description"), + Content descLink = getHyperLink(getDocLink( + SectionName.PACKAGE_DESCRIPTION), descriptionLabel, "", ""); Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink); div.addContent(descPara); @@ -211,7 +212,8 @@ public class PackageWriterImpl extends HtmlDocletWriter */ public void addPackageDescription(Content packageContentTree) { if (packageDoc.inlineTags().length > 0) { - packageContentTree.addContent(getMarkerAnchor("package_description")); + packageContentTree.addContent( + getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION)); Content h2Content = new StringContent( configuration.getText("doclet.Package_Description", packageDoc.name())); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java index 1de03f40898..7f2c6e61111 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java @@ -129,7 +129,8 @@ public class ProfilePackageWriterImpl extends HtmlDocletWriter addSummaryComment(packageDoc, docSummaryDiv); div.addContent(docSummaryDiv); Content space = getSpace(); - Content descLink = getHyperLink(DocLink.fragment("package_description"), + Content descLink = getHyperLink(getDocLink( + SectionName.PACKAGE_DESCRIPTION), descriptionLabel, "", ""); Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink); div.addContent(descPara); @@ -192,7 +193,8 @@ public class ProfilePackageWriterImpl extends HtmlDocletWriter */ public void addPackageDescription(Content packageContentTree) { if (packageDoc.inlineTags().length > 0) { - packageContentTree.addContent(getMarkerAnchor("package_description")); + packageContentTree.addContent( + getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION)); Content h2Content = new StringContent( configuration.getText("doclet.Package_Description", packageDoc.name())); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java index 838732b5212..9bf4bf0ca26 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java @@ -70,7 +70,8 @@ public class PropertyWriterImpl extends AbstractMemberWriter Content memberDetailsTree) { memberDetailsTree.addContent(HtmlConstants.START_OF_PROPERTY_DETAILS); Content propertyDetailsTree = writer.getMemberTreeHeader(); - propertyDetailsTree.addContent(writer.getMarkerAnchor("property_detail")); + propertyDetailsTree.addContent(writer.getMarkerAnchor( + SectionName.PROPERTY_DETAIL)); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.propertyDetailsLabel); propertyDetailsTree.addContent(heading); @@ -220,7 +221,8 @@ public class PropertyWriterImpl extends AbstractMemberWriter * {@inheritDoc} */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { - memberTree.addContent(writer.getMarkerAnchor("property_summary")); + memberTree.addContent(writer.getMarkerAnchor( + SectionName.PROPERTY_SUMMARY)); } /** @@ -228,7 +230,8 @@ public class PropertyWriterImpl extends AbstractMemberWriter */ public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) { inheritedTree.addContent(writer.getMarkerAnchor( - "properties_inherited_from_class_" + configuration.getClassName(cd))); + SectionName.PROPERTIES_INHERITANCE, + configuration.getClassName(cd))); } /** @@ -297,11 +300,15 @@ public class PropertyWriterImpl extends AbstractMemberWriter */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink((cd == null)? - "property_summary": - "properties_inherited_from_class_" + - configuration.getClassName(cd), + if (cd == null) { + return writer.getHyperLink( + SectionName.PROPERTY_SUMMARY, writer.getResource("doclet.navProperty")); + } else { + return writer.getHyperLink( + SectionName.PROPERTIES_INHERITANCE, + configuration.getClassName(cd), writer.getResource("doclet.navProperty")); + } } else { return writer.getResource("doclet.navProperty"); } @@ -312,7 +319,8 @@ public class PropertyWriterImpl extends AbstractMemberWriter */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(writer.getHyperLink("property_detail", + liNav.addContent(writer.getHyperLink( + SectionName.PROPERTY_DETAIL, writer.getResource("doclet.navProperty"))); } else { liNav.addContent(writer.getResource("doclet.navProperty")); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SectionName.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SectionName.java new file mode 100644 index 00000000000..b27949fe988 --- /dev/null +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SectionName.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.tools.doclets.formats.html; + +/** + * Enum representing various section names of generated API documentation. + * + *
This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.
+ *
+ * @author Bhavesh Patel
+ */
+public enum SectionName {
+
+ ANNOTATION_TYPE_ELEMENT_DETAIL("annotation.type.element.detail"),
+ ANNOTATION_TYPE_FIELD_DETAIL("annotation.type.field.detail"),
+ ANNOTATION_TYPE_FIELD_SUMMARY("annotation.type.field.summary"),
+ ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY("annotation.type.optional.element.summary"),
+ ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY("annotation.type.required.element.summary"),
+ CONSTRUCTOR_DETAIL("constructor.detail"),
+ CONSTRUCTOR_SUMMARY("constructor.summary"),
+ ENUM_CONSTANT_DETAIL("enum.constant.detail"),
+ ENUM_CONSTANTS_INHERITANCE("enum.constants.inherited.from.class."),
+ ENUM_CONSTANT_SUMMARY("enum.constant.summary"),
+ FIELD_DETAIL("field.detail"),
+ FIELDS_INHERITANCE("fields.inherited.from.class."),
+ FIELD_SUMMARY("field.summary"),
+ METHOD_DETAIL("method.detail"),
+ METHODS_INHERITANCE("methods.inherited.from.class."),
+ METHOD_SUMMARY("method.summary"),
+ NAVBAR_BOTTOM("navbar.bottom"),
+ NAVBAR_BOTTOM_FIRSTROW("navbar.bottom.firstrow"),
+ NAVBAR_TOP("navbar.top"),
+ NAVBAR_TOP_FIRSTROW("navbar.top.firstrow"),
+ NESTED_CLASSES_INHERITANCE("nested.classes.inherited.from.class."),
+ NESTED_CLASS_SUMMARY("nested.class.summary"),
+ OVERVIEW_DESCRIPTION("overview.description"),
+ PACKAGE_DESCRIPTION("package.description"),
+ PROPERTY_DETAIL("property.detail"),
+ PROPERTIES_INHERITANCE("properties.inherited.from.class."),
+ PROPERTY_SUMMARY("property.summary"),
+ SKIP_NAVBAR_BOTTOM("skip.navbar.bottom"),
+ SKIP_NAVBAR_TOP("skip.navbar.top"),
+ UNNAMED_PACKAGE_ANCHOR("unnamed.package");
+
+ private final String value;
+
+ SectionName(String sName) {
+ this.value = sName;
+ }
+
+ public String getName() {
+ return this.value;
+ }
+}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java
index 43718e4699c..a561a0395d0 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java
@@ -115,7 +115,8 @@ public class SingleIndexWriter extends AbstractIndexWriter {
for (int i = 0; i < indexbuilder.elements().length; i++) {
String unicode = (indexbuilder.elements())[i].toString();
contentTree.addContent(
- getHyperLink("_" + unicode + "_", new StringContent(unicode)));
+ getHyperLink(getNameForIndex(unicode),
+ new StringContent(unicode)));
contentTree.addContent(getSpace());
}
}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
index c780e962cac..ee8cc9cb12e 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
@@ -30,6 +30,7 @@ import java.util.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.ConfigurationImpl;
+import com.sun.tools.doclets.formats.html.SectionName;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.DocFile;
import com.sun.tools.doclets.internal.toolkit.util.DocLink;
@@ -78,7 +79,7 @@ public abstract class HtmlDocWriter extends HtmlWriter {
}
/**
- * Get Html Hyper Link string.
+ * Get Html Hyper Link Content.
*
* @param where Position of the link in the file. Character '#' is not
* needed.
@@ -87,7 +88,125 @@ public abstract class HtmlDocWriter extends HtmlWriter {
*/
public Content getHyperLink(String where,
Content label) {
- return getHyperLink(DocLink.fragment(where), label, "", "");
+ return getHyperLink(getDocLink(where), label, "", "");
+ }
+
+ /**
+ * Get Html Hyper Link Content.
+ *
+ * @param sectionName The section name to which the link will be created.
+ * @param label Tag for the link.
+ * @return a content tree for the hyper link
+ */
+ public Content getHyperLink(SectionName sectionName,
+ Content label) {
+ return getHyperLink(getDocLink(sectionName), label, "", "");
+ }
+
+ /**
+ * Get Html Hyper Link Content.
+ *
+ * @param sectionName The section name combined with where to which the link
+ * will be created.
+ * @param where The fragment combined with sectionName to which the link
+ * will be created.
+ * @param label Tag for the link.
+ * @return a content tree for the hyper link
+ */
+ public Content getHyperLink(SectionName sectionName, String where,
+ Content label) {
+ return getHyperLink(getDocLink(sectionName, where), label, "", "");
+ }
+
+ /**
+ * Get the link.
+ *
+ * @param where Position of the link in the file.
+ * @return a DocLink object for the hyper link
+ */
+ public DocLink getDocLink(String where) {
+ return DocLink.fragment(getName(where));
+ }
+
+ /**
+ * Get the link.
+ *
+ * @param sectionName The section name to which the link will be created.
+ * @return a DocLink object for the hyper link
+ */
+ public DocLink getDocLink(SectionName sectionName) {
+ return DocLink.fragment(sectionName.getName());
+ }
+
+ /**
+ * Get the link.
+ *
+ * @param sectionName The section name combined with where to which the link
+ * will be created.
+ * @param where The fragment combined with sectionName to which the link
+ * will be created.
+ * @return a DocLink object for the hyper link
+ */
+ public DocLink getDocLink(SectionName sectionName, String where) {
+ return DocLink.fragment(sectionName.getName() + getName(where));
+ }
+
+ /**
+ * Convert the name to a valid HTML name.
+ *
+ * @param name the name that needs to be converted to valid HTML name.
+ * @return a valid HTML name string.
+ */
+ public String getName(String name) {
+ StringBuilder sb = new StringBuilder();
+ char ch;
+ /* The HTML 4 spec at http://www.w3.org/TR/html4/types.html#h-6.2 mentions
+ * that the name/id should begin with a letter followed by other valid characters.
+ * The HTML 5 spec (draft) is more permissive on names/ids where the only restriction
+ * is that it should be at least one character long and should not contain spaces.
+ * The spec draft is @ http://www.w3.org/html/wg/drafts/html/master/dom.html#the-id-attribute.
+ *
+ * For HTML 4, we need to check for non-characters at the beginning of the name and
+ * substitute it accordingly, "_" and "$" can appear at the beginning of a member name.
+ * The method substitutes "$" with "Z:Z:D" and will prefix "_" with "Z:Z".
+ */
+ for (int i = 0; i < name.length(); i++) {
+ ch = name.charAt(i);
+ switch (ch) {
+ case '(':
+ case ')':
+ case '<':
+ case '>':
+ case ',':
+ sb.append('-');
+ break;
+ case ' ':
+ case '[':
+ break;
+ case ']':
+ sb.append(":A");
+ break;
+ // Any appearance of $ needs to be substituted with ":D" and not with hyphen
+ // since a field name "P$$ and a method P(), both valid member names, can end
+ // up as "P--". A member name beginning with $ needs to be substituted with
+ // "Z:Z:D".
+ case '$':
+ if (i == 0)
+ sb.append("Z:Z");
+ sb.append(":D");
+ break;
+ // A member name beginning with _ needs to be prefixed with "Z:Z" since valid anchor
+ // names can only begin with a letter.
+ case '_':
+ if (i == 0)
+ sb.append("Z:Z");
+ sb.append(ch);
+ break;
+ default:
+ sb.append(ch);
+ }
+ }
+ return sb.toString();
}
/**
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java
index c76b2ed26c1..5742cd0bf6a 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java
@@ -58,9 +58,4 @@ public class DocletConstants {
* The default package file name.
*/
public static final String DEFAULT_PACKAGE_FILE_NAME = "default";
-
- /**
- * The anchor for the default package.
- */
- public static final String UNNAMED_PACKAGE_ANCHOR = "unnamed_package";
}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
index 990ea0d06e0..7f45ee6e57b 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
@@ -64,6 +64,8 @@ public abstract class Attribute implements AnnotationValue {
return false;
}
+ public TypeAnnotationPosition getPosition() { return null; };
+
/** The value for an annotation element of primitive type or String. */
public static class Constant extends Attribute {
public final Object value;
@@ -191,8 +193,13 @@ public abstract class Attribute implements AnnotationValue {
}
public Attribute member(Name member) {
+ PairLink to external class BigDecimal"},
{BUG_ID + FS + "C.html",
- "Link to external member gcd"},
{BUG_ID + FS + "C.html",
"" + NL + "
"},
{BUG_ID + FS + "pkg1" + FS + "C1.html", "read in class " +
"FilterReaderreadInt in interface " +
"DataInput" + NL + "
"},
{BUG_ID + FS + "pkg1" + FS + "C1.html", "setUndecorated(boolean)"+ NL + "
"},
{BUG_ID + FS + "pkg1" + FS + "C1.html", "title" +
" - the titletest - boolean value" +
@@ -79,11 +79,11 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
"if decorations are to be enabled.readObject()" +
+ "readObject()" +
"" + NL + "
"},
{BUG_ID + FS + "pkg1" + FS + "C2.html", "java.io.IOExceptionsetUndecorated(boolean)" + NL + "
"},
{BUG_ID + FS + "serialized-form.html", "Deprecated." +
" As of JDK version 1.5, replaced by" + NL +
- " " +
+ " " +
"set - boolean" + NL + "
" +
"java.io.IOExceptionC1.setUndecorated(boolean)setUndecorated(boolean)." + NL +
"" + NL + "
"},
{BUG_ID + FS + "serialized-form.html", "Deprecated." +
" As of JDK version 1.5, replaced by" + NL +
- " " +
+ " " +
"C1.setUndecorated(boolean)setUndecorated(boolean)." + NL +
"" + NL + "
false if decorations are to be enabled." +
"readObject()" + NL + "
"},
{BUG_ID + FS + "serialized-form.html", "java.io.IOExceptionsetUndecorated(boolean)" + NL + "
"},
{BUG_ID + FS + "serialized-form.html", "Deprecated." +
" As of JDK version 1.5, replaced by" + NL +
- " " +
+ " " +
"" +
"java.io.IOExceptionC1.setUndecorated(boolean)setUndecorated(boolean)." + NL +
"" + NL + "
"},
{BUG_ID + FS + "serialized-form.html", "Deprecated." +
" As of JDK version 1.5, replaced by" + NL +
- " " +
+ " " +
"C1.setUndecorated(boolean)setUndecorated(boolean)." + NL +
"" + NL + "
"},
{BUG_ID + FS + "serialized-form.html", "Deprecated." +
" As of JDK version 1.5, replaced by" + NL +
- " " +
+ " " +
"boolean " +
"undecorated" + NL + "" +
+ " " +
"setUndecorated(boolean).setUndecorated(boolean)." + NL + ""}};
// Test for valid HTML generation which should not comprise of empty
diff --git a/langtools/test/com/sun/javadoc/testInterface/TestInterface.java b/langtools/test/com/sun/javadoc/testInterface/TestInterface.java
index cfaff523fde..39f8e212629 100644
--- a/langtools/test/com/sun/javadoc/testInterface/TestInterface.java
+++ b/langtools/test/com/sun/javadoc/testInterface/TestInterface.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4682448 4947464 5029946
+ * @bug 4682448 4947464 5029946 8025633
* @summary Verify that the public modifier does not show up in the
* documentation for public methods, as recommended by the JLS.
* If A implements I and B extends A, B should be in the list of
@@ -84,7 +84,7 @@ public class TestInterface extends JavadocTester {
//Make sure "Specified By" has substituted type parameters.
{BUG_ID + FS + "pkg" + FS + "Child.html",
"method" +
+ "method" +
" in interface " +
"" +
"Interface<" +
@@ -93,7 +93,7 @@ public class TestInterface extends JavadocTester {
//Make sure "Overrides" has substituted type parameters.
{BUG_ID + FS + "pkg" + FS + "Child.html",
""},
};
private static final String[] ARGS =
new String[] {
diff --git a/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java b/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java
index fdbb664deff..eff1de42046 100644
--- a/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java
+++ b/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4951228 6290760
+ * @bug 4951228 6290760 8025633
* @summary Test the case where the overriden method returns a different
* type than the method in the child class. Make sure the
* documentation is inherited but the return type isn't.
@@ -49,7 +49,7 @@ public class TestMemberSummary extends JavadocTester {
// Check return type in member summary.
{BUG_ID + FS + "pkg" + FS + "PublicChild.html",
"method" +
+ ""},
+ "staticMethodmethod" +
" in class Parent<T>getRate(), " + NL +
- "setRate(double)getRate(), " + NL +
+ "setRate(double)public final void setRate(double value)
" + NL +
" " },
+ "setTestMethodProperty() " },
{"./" + BUG_ID + "/C.html",
"setTestMethodProperty() isPaused
" + NL +
"public final double isPaused()
" + NL +
diff --git a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
index ef9dd2bbb9a..49ce35d0700 100644
--- a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
+++ b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4732864 6280605 7064544 8014636 8016328
+ * @bug 4732864 6280605 7064544 8014636 8016328 8025633
* @summary Make sure that you can link from one member to another using
* non-qualified name, furthermore, ensure the right one is linked.
* @author jamieh
@@ -49,9 +49,9 @@ public class TestLinkTaglet extends JavadocTester {
"Qualified Link: C.InnerC.
" + NL +
" Unqualified Link1: C.InnerC.
" + NL +
" Unqualified Link2: C.InnerC.
" + NL +
- " Qualified Link: method(pkg.C.InnerC, pkg.C.InnerC2).
" + NL +
- " Unqualified Link: method(C.InnerC, C.InnerC2).
" + NL +
- " Unqualified Link: method(InnerC, InnerC2).
"
+ " Qualified Link: method(pkg.C.InnerC, pkg.C.InnerC2).
" + NL +
+ " Unqualified Link: method(C.InnerC, C.InnerC2).
" + NL +
+ " Unqualified Link: method(InnerC, InnerC2).
"
},
{BUG_ID + FS + "pkg" + FS + "C.InnerC.html",
"Link to member in outer class: C.MEMBER
" + NL +
diff --git a/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java b/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
index 4d90d8791fb..62b9235e952 100644
--- a/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
+++ b/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4638588 4635809 6256068 6270645
+ * @bug 4638588 4635809 6256068 6270645 8025633
* @summary Test to make sure that members are inherited properly in the Javadoc.
* Verify that inheritence labels are correct.
* @author jamieh
@@ -44,7 +44,7 @@ public class TestMemberInheritence extends JavadocTester {
//Public method should be inherited
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
- ""},
+ ""},
//Public inner class should be inherited.
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
@@ -56,7 +56,7 @@ public class TestMemberInheritence extends JavadocTester {
//Protected method should be inherited
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
- ""},
+ ""},
//Protected inner class should be inherited.
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
@@ -73,14 +73,14 @@ public class TestMemberInheritence extends JavadocTester {
// Test overriding/implementing methods with generic parameters.
{BUG_ID + FS + "pkg" + FS + "BaseClass.html",
"" + NL + "
"},
// Test diamond inheritence member summary (6256068)
{BUG_ID + FS + "diamond" + FS + "Z.html",
- "" +
+ "" +
"getAnnotation in interface " +
"" +
"BaseInterfaceaMethod"},
+ "aMethod"},
// Test that doc is inherited from closed parent (6270645)
{BUG_ID + FS + "inheritDist" + FS + "C.html",
@@ -90,7 +90,7 @@ public class TestMemberInheritence extends JavadocTester {
private static final String[][] NEGATED_TEST = {
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
- "staticMethodPublicChild" + NL +
- " "
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
"" +
+ " " +
"returnTypeTest()"
},
// Check return type in member detail.
@@ -60,9 +60,9 @@ public class TestMemberSummary extends JavadocTester {
// Legacy anchor dimensions (6290760)
{BUG_ID + FS + "pkg2" + FS + "A.html",
- "" + NL +
+ "" + NL +
"" + NL +
- "" + NL +
+ "" + NL +
"" + NL +
""
},
diff --git a/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java b/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java
index 4466eb87d0e..d8187147bd2 100644
--- a/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java
+++ b/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4131628 4664607 7025314 8023700 7198273
+ * @bug 4131628 4664607 7025314 8023700 7198273 8025633
* @summary Make sure the Next/Prev Class links iterate through all types.
* Make sure the navagation is 2 columns, not 3.
* @author jamieh
@@ -60,7 +60,7 @@ public class TestNavigation extends JavadocTester {
{BUG_ID + FS + "pkg" + FS + "I.html", "@AnnotationType(" +
- "optional" +
+ "optional" +
"=\"Class Annotation\"," + NL +
- " " +
+ " " +
"required=1994)" + NL + "public class " +
"AnnotationTypeUsage" + NL + "extends java.lang.Object
"},
@@ -205,36 +205,36 @@ public class TestNewLanguageFeatures extends JavadocTester {
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"@AnnotationType(" +
- "optional" +
+ "optional" +
"=\"Field Annotation\"," + NL +
- " " +
+ " " +
"required=1994)" + NL + "public int field
"},
//CONSTRUCTOR
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"@AnnotationType(" +
- "optional" +
+ "optional" +
"=\"Constructor Annotation\"," + NL +
- " " +
+ " " +
"required=1994)" + NL + "public AnnotationTypeUsage()
"},
//METHOD
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"@AnnotationType(" +
- "optional" +
+ "optional" +
"=\"Method Annotation\"," + NL +
- " " +
+ " " +
"required=1994)" + NL + "public void method()
"},
//METHOD PARAMS
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"public void methodWithParams(" +
"" +
- "@AnnotationType(" +
+ "@AnnotationType(" +
"optional=\"Parameter Annotation\",required=1994)" + NL +
+ "href=\"../pkg/AnnotationType.html#required--\">required=1994)" + NL +
" int documented," + NL +
" int undocmented)"},
@@ -242,9 +242,9 @@ public class TestNewLanguageFeatures extends JavadocTester {
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"public AnnotationTypeUsage(" +
- "@AnnotationType(" +
+ "@AnnotationType(" +
"optional=\"Constructor Param Annotation\",required=1994)" + NL +
+ "href=\"../pkg/AnnotationType.html#required--\">required=1994)" + NL +
" int documented," + NL +
" int undocmented)
"},
@@ -254,43 +254,43 @@ public class TestNewLanguageFeatures extends JavadocTester {
//Integer
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "d=3.14,"},
+ "d=3.14,"},
//Double
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "d=3.14,"},
+ "d=3.14,"},
//Boolean
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "b=true,"},
+ "b=true,"},
//String
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "s=\"sigh\","},
+ "s=\"sigh\","},
//Class
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "c=Foo.class,"},
+ "c=Foo.class,"},
//Bounded Class
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "w=TypeParameterSubClass.class,"},
+ "w=TypeParameterSubClass.class,"},
//Enum
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "e=Penny,"},
+ "e=Penny,"},
//Annotation Type
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "a=@AnnotationType(optional=\"foo\",required=1994),"},
+ "a=@AnnotationType(optional=\"foo\",required=1994),"},
//String Array
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "sa={\"up\",\"down\"},"},
+ "sa={\"up\",\"down\"},"},
//Primitive
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "primitiveClassTest=boolean.class,"},
+ "primitiveClassTest=boolean.class,"},
//XXX: Add array test case after this if fixed:
//5020899: Incorrect internal representation of class-valued annotation elements
@@ -335,7 +335,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
"ClassUseTest1." +
" "
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
@@ -388,7 +388,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
"method" +
+ "ClassUseTest1.html#method-T-\">method" +
"(T t) " +
"ClassUseTest1. "
},
@@ -417,7 +417,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
"method" +
+ "pkg2/ClassUseTest1.html#method-T-\">method" +
"(T t) ClassUseTest2." +
" "
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
@@ -472,7 +472,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
"method" +
+ "ClassUseTest2.html#method-T-\">method" +
"(T t) ClassUseTest2." +
" "
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
@@ -517,7 +517,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
"method" +
+ "ClassUseTest2.html#method-T-\">method" +
"(T t) ClassUseTest3" +
". "
+ "html#method-T-\">method(T t)method(T t) "
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
@@ -588,7 +588,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
"<T extends ClassUseTest3." +
"" +
" method(T t)" +
+ "html#method-T-\">method(T t) " + NL +
"voidClassUseTest3." +
" " + NL +
"" + NL + ""
@@ -663,14 +663,14 @@ public class TestNewLanguageFeatures extends JavadocTester {
// TYPE PARAMETER IN INDEX
//=================================
{BUG_ID + FS + "index-all.html",
- "" +
+ "" +
"method(Vector<Object>)"
},
//=================================
// TYPE PARAMETER IN INDEX
//=================================
{BUG_ID + FS + "index-all.html",
- "" +
+ "" +
"method(Vector<Object>)"
},
};
diff --git a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java
index 68999480d44..506fde14a71 100644
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java
+++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4368820
+ * @bug 4368820 8025633
* @summary Inherited comment should link directly to member, not just
* class
* @author jamieh
@@ -47,7 +47,7 @@ public class TestOverridenMethodDocCopy extends JavadocTester {
private static final String[][] TEST = {
{BUG_ID + FS + "pkg1" + FS + "SubClass.html",
"Description copied from class: method(java." +
+ "html#method-java.util.Set-\">method(java." +
"util.Set<Foo4> p) " +
- "" +
+ "" +
"BaseClass"
}
};
diff --git a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
index 702c54c8309..018f04a2817 100644
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
+++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4634891
+ * @bug 4634891 8025633
* @summary Determine if overriden methods are properly documented when
* -protected (default) visibility flag is used.
* @author jamieh
@@ -41,14 +41,14 @@ public class TestOverridenPrivateMethodsWithPackageFlag extends JavadocTester {
//The public method should be overriden
{BUG_ID + FS + "pkg1" + FS + "SubClass.html",
"" +
+ "" +
"publicMethod in class " +
"BaseClass" +
+ "" +
"publicMethod in class " +
"BaseClass" +
+ "" +
"packagePrivateMethod in class " +
"BaseClass" +
+ "" +
"methodOverridenFromParent in class " +
"" +
"PrivateParent" +
+ "" +
"methodInterface in interface " +
"" +
"PrivateInterface" +
- "I"},
+ "Ihello" +
+ "hello" +
" in interface " +
"I" +
"<java.lang.String>" + NL +
"
" +
"java.io.IOExceptionC1.setUndecorated(boolean)setUndecorated(boolean)." + NL +
"" + NL + "
"},
{BUG_ID + FS + "serialized-form.html", "Deprecated." +
" As of JDK version 1.5, replaced by" + NL +
- " " +
+ " " +
"C1.setUndecorated(boolean)setUndecorated(boolean)." + NL +
"" + NL + "
"}
};
private static final String[][] NEGATED_TEST_4654308 = NO_TEST;
diff --git a/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java b/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java
index 61d5758bb5d..d1eb1179aee 100644
--- a/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java
+++ b/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8005091 8009686
+ * @bug 8005091 8009686 8025633
* @summary Make sure that type annotations are displayed correctly
* @author Bhavesh Patel
* @library ../lib/
@@ -272,13 +272,13 @@ public class TestTypeAnnotations extends JavadocTester {
"" +
@@ -75,12 +75,12 @@ public class TestSerializedFormDeprecationInfo extends JavadocTester {
{BUG_ID + FS + "serialized-form.html", "boolean undecorated
" + NL +
"" +
+ " " +
"setUndecorated(boolean).setUndecorated(boolean)." + NL + ""}};
// Test with -nodeprecated option. The serialized-form.html should
diff --git a/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java b/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java
index 53461390e52..e49e857e6fe 100644
--- a/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java
+++ b/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4654308 4767038
+ * @bug 4654308 4767038 8025633
* @summary Use a Taglet and include some inline tags such as {@link}. The
* inline tags should be interpreted properly.
* Run Javadoc on some sample source that uses {@inheritDoc}. Make
@@ -56,7 +56,7 @@ public class TestTaglets extends JavadocTester {
//Input for string search tests.
private static final String[][] TEST_4654308 = new String[][] {
{"4654308" + FS + "C.html", "Foo:" +
- "here" +
+ "here" +
"void oneException()" + NL +
" throws @ThrB(value=\"m\") java.lang.Exception"
+ "ThrB.html#value--\">value=\"m\") java.lang.Exception"
},
{BUG_ID + FS + "typeannos" + FS + "ThrWithValue.html",
"void twoExceptions()" + NL +
" throws @ThrB(value=\"m\") java.lang.RuntimeException," + NL +
+ "ThrB.html#value--\">value=\"m\") java.lang.RuntimeException," + NL +
" @ThrA java.lang.Exception"
},
@@ -307,14 +307,14 @@ public class TestTypeAnnotations extends JavadocTester {
"void wcSuper(MyList<? super @WldB(value=\"m\") java.lang." +
+ "../typeannos/WldB.html#value--\">value=\"m\") java.lang." +
"String> l)
"
},
{BUG_ID + FS + "typeannos" + FS + "BoundWithValue.html",
"MyList<? extends @WldB(value=\"m\") java.lang.String" +
+ "typeannos/WldB.html#value--\">value=\"m\") java.lang.String" +
"> returnWcExtends()
"
},
@@ -329,7 +329,7 @@ public class TestTypeAnnotations extends JavadocTester {
"java.lang.String nonVoid(@RcvrA @RcvrB" +
- "(value=\"m\")" +
+ "(value=\"m\")" +
" DefaultUnmodified this)
"
},
{BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html",
@@ -354,7 +354,7 @@ public class TestTypeAnnotations extends JavadocTester {
{BUG_ID + FS + "typeannos" + FS + "WithValue.html",
"<T extends java.lang.Runnable> void accept(" +
"@RcvrB(" +
+ "typeannos\">@RcvrB(" +
"value=\"m\") WithValue this," + NL +
" T r)" + NL +
" throws java.lang.Exception"
@@ -362,7 +362,7 @@ public class TestTypeAnnotations extends JavadocTester {
{BUG_ID + FS + "typeannos" + FS + "WithFinal.html",
"java.lang.String nonVoid(@RcvrB(value=\"m\") WithFinal" +
+ "typeannos/RcvrB.html#value--\">value=\"m\") WithFinal" +
" this)
"
},
{BUG_ID + FS + "typeannos" + FS + "WithBody.html",
diff --git a/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java b/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java
index ee352a1b385..14e7ba47a6a 100644
--- a/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java
+++ b/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4927167 4974929 7010344
+ * @bug 4927167 4974929 7010344 8025633
* @summary When the type parameters are more than 10 characters in length,
* make sure there is a line break between type params and return type
* in member summary. Also, test for type parameter links in package-summary and
@@ -71,7 +71,7 @@ public class TestTypeParameters extends JavadocTester {
},
//Nested type parameters
{BUG_ID + FS + "pkg" + FS + "C.html",
- "" + NL +
+ "" + NL +
"" + NL +
""
},
diff --git a/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java b/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java
index d5f697a213e..7152cced990 100644
--- a/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java
+++ b/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4515705 4804296 4702454 4697036
+ * @bug 4515705 4804296 4702454 4697036 8025633
* @summary Make sure that first sentence warning only appears once.
* Make sure that only warnings/errors are printed when quiet is used.
* Make sure that links to private/unincluded methods do not cause
@@ -65,8 +65,8 @@ public class TestWarnings extends JavadocTester {
};
private static final String[][] TEST2 = {
- {BUG_ID + FS + "pkg" + FS + "X.html", "m()
"},
- {BUG_ID + FS + "pkg" + FS + "X.html", "X()
"},
+ {BUG_ID + FS + "pkg" + FS + "X.html", "m()
"},
+ {BUG_ID + FS + "pkg" + FS + "X.html", "X()
"},
{BUG_ID + FS + "pkg" + FS + "X.html", "f
"},
};
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java
new file mode 100644
index 00000000000..0ce59a87b0c
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java
@@ -0,0 +1,439 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8005085 8008762 8008751 8013065 8015323 8015257
+ * @summary Type annotations on anonymous and inner class.
+ * Six TYPE_USE annotations are repeated(or not); Four combinations create
+ * four test files, and each results in the test class and 2 anonymous classes.
+ * Each element of these three classes is checked for expected number of the
+ * four annotation Attributes. Expected annotation counts depend on type of
+ * annotation place on type of element (a FIELD&TYPE_USE element on a field
+ * results in 2). Elements with no annotations expect 0.
+ * Source template is read in from testanoninner.template
+ *
+ */
+import java.lang.annotation.*;
+import java.io.*;
+import java.util.List;
+import java.util.LinkedList;
+import com.sun.tools.classfile.*;
+import java.nio.file.Files;
+import java.nio.charset.*;
+import java.io.File;
+import java.io.IOException;
+
+
+import java.lang.annotation.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+
+/*
+ * A source template is read in and testname and annotations are inserted
+ * via replace().
+ */
+public class TestAnonInnerClasses extends ClassfileTestHelper {
+ // tally errors and test cases
+ int errors = 0;
+ int checks = 0;
+ //Note expected test count in case of skips due to bugs.
+ int tc = 0, xtc = 180; // 45 x 4 variations of repeated annotations.
+ File testSrc = new File(System.getProperty("test.src"));
+
+ String[] AnnoAttributes = {
+ Attribute.RuntimeVisibleTypeAnnotations,
+ Attribute.RuntimeInvisibleTypeAnnotations,
+ Attribute.RuntimeVisibleAnnotations,
+ Attribute.RuntimeInvisibleAnnotations
+ };
+
+ // template for source files
+ String srcTemplate = "testanoninner.template";
+
+ // Four test files generated based on combinations of repeating annotations.
+ Boolean As= false, Bs=true, Cs=false, Ds=false, TAs=false,TBs=false;
+ Boolean[][] bRepeat = new Boolean[][]{
+ /* no repeats */ {false, false, false, false, false, false},
+ /* repeat A,C,TA */ {true, false, true, false, true, false},
+ /* repeat B,D,TB */ {false, true, false, true, false, true},
+ /* repeat all */ {true, true, true, true, true, true}
+ };
+ // Save descriptions of failed test case; does not terminate upon a failure.
+ List