8219998: Eliminate inherently singleton lists

Reviewed-by: jjg
This commit is contained in:
Priya Lakshmi Muthuswamy 2019-04-23 18:28:48 +05:30
parent 4f2478e234
commit d0788ec07f
67 changed files with 913 additions and 448 deletions

View File

@ -498,7 +498,7 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter {
*/
@Override
public Content getInheritedSummaryHeader(TypeElement tElement) {
Content inheritedTree = writer.getMemberTreeHeader();
Content inheritedTree = writer.getMemberInheritedTree();
writer.addInheritedSummaryHeader(this, tElement, inheritedTree);
return inheritedTree;
}
@ -551,8 +551,8 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter {
*/
public Content getMemberTree(Content memberTree, boolean isLastContent) {
if (isLastContent)
return HtmlTree.UL(HtmlStyle.blockListLast, memberTree);
return HtmlTree.LI(HtmlStyle.blockListLast, memberTree);
else
return HtmlTree.UL(HtmlStyle.blockList, memberTree);
return HtmlTree.LI(HtmlStyle.blockList, memberTree);
}
}

View File

@ -118,7 +118,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
Content headingContent = contents.getContent(heading);
Content sectionHeading = HtmlTree.HEADING(Headings.CONTENT_HEADING, true,
headingContent);
HtmlTree htmlTree = HtmlTree.SECTION(sectionHeading);
HtmlTree htmlTree = HtmlTree.SECTION(HtmlStyle.hierarchy, sectionHeading);
addLevelInfo(!utils.isInterface(firstTypeElement) ? firstTypeElement : null,
sset, isEnums, htmlTree);
div.add(htmlTree);

View File

@ -152,11 +152,8 @@ public class AllClassesIndexWriter extends HtmlDocletWriter {
Content headerDiv = HtmlTree.DIV(HtmlStyle.header, pHeading);
content.add(headerDiv);
if (!table.isEmpty()) {
HtmlTree li = HtmlTree.LI(HtmlStyle.blockList, table.toContent());
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
HtmlTree div = new HtmlTree(HtmlTag.DIV);
HtmlTree div = new HtmlTree(HtmlTag.DIV, table.toContent());
div.setStyle(HtmlStyle.allClassesContainer);
div.add(ul);
content.add(div);
if (table.needsScript()) {
getMainBodyScript().append(table.getScript());

View File

@ -125,7 +125,6 @@ public class AllPackagesIndexWriter extends HtmlDocletWriter {
table.addRow(pkg, packageLinkContent, summaryContent);
}
}
HtmlTree li = HtmlTree.LI(HtmlStyle.blockList, table.toContent());
content.add(HtmlTree.UL(HtmlStyle.blockList, li));
content.add(table.toContent());
}
}

View File

@ -25,18 +25,18 @@
package jdk.javadoc.internal.doclets.formats.html;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeFieldWriter;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
@ -72,7 +72,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
Content memberSummaryTree) {
memberSummaryTree.add(
MarkerComments.START_OF_ANNOTATION_TYPE_FIELD_SUMMARY);
Content memberTree = writer.getMemberTreeHeader();
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, typeElement, memberTree);
return memberTree;
}
@ -88,7 +88,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
* {@inheritDoc}
*/
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
writer.addMemberTree(HtmlStyle.fieldSummary, memberSummaryTree, memberTree);
}
/**
@ -101,16 +101,17 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
/**
* {@inheritDoc}
*/
public void addAnnotationDetailsTreeHeader(TypeElement typeElement,
Content memberDetailsTree) {
public Content getAnnotationDetailsTreeHeader(TypeElement typeElement) {
Content memberDetailsTree = new ContentBuilder();
if (!writer.printedAnnotationFieldHeading) {
memberDetailsTree.add(links.createAnchor(
SectionName.ANNOTATION_TYPE_FIELD_DETAIL));
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
contents.fieldDetailsLabel);
memberDetailsTree.add(heading);
memberDetailsTree.add(links.createAnchor(
SectionName.ANNOTATION_TYPE_FIELD_DETAIL));
writer.printedAnnotationFieldHeading = true;
}
return memberDetailsTree;
}
/**
@ -118,12 +119,12 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
*/
public Content getAnnotationDocTreeHeader(Element member,
Content annotationDetailsTree) {
annotationDetailsTree.add(links.createAnchor(name(member)));
Content annotationDocTree = writer.getMemberTreeHeader();
Content annotationDocTree = new ContentBuilder();
Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
heading.add(name(member));
annotationDocTree.add(heading);
return annotationDocTree;
annotationDocTree.add(links.createAnchor(name(member)));
return HtmlTree.SECTION(HtmlStyle.detail, annotationDocTree);
}
/**
@ -171,8 +172,11 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
/**
* {@inheritDoc}
*/
public Content getAnnotationDetails(Content annotationDetailsTree) {
return HtmlTree.SECTION(getMemberTree(annotationDetailsTree));
public Content getAnnotationDetails(Content annotationDetailsTreeHeader, Content annotationDetailsTree) {
Content annotationDetails = new ContentBuilder();
annotationDetails.add(annotationDetailsTreeHeader);
annotationDetails.add(annotationDetailsTree);
return getMemberTree(HtmlTree.SECTION(HtmlStyle.fieldDetails, annotationDetails));
}
/**

View File

@ -25,14 +25,14 @@
package jdk.javadoc.internal.doclets.formats.html;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeOptionalMemberWriter;
@ -74,7 +74,7 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
Content memberSummaryTree) {
memberSummaryTree.add(
MarkerComments.START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY);
Content memberTree = writer.getMemberTreeHeader();
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, typeElement, memberTree);
return memberTree;
}
@ -84,7 +84,7 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
*/
@Override
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
writer.addMemberTree(HtmlStyle.memberSummary, memberSummaryTree, memberTree);
}
/**

View File

@ -25,18 +25,18 @@
package jdk.javadoc.internal.doclets.formats.html;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeRequiredMemberWriter;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
@ -74,7 +74,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
Content memberSummaryTree) {
memberSummaryTree.add(
MarkerComments.START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY);
Content memberTree = writer.getMemberTreeHeader();
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, typeElement, memberTree);
return memberTree;
}
@ -90,7 +90,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
* {@inheritDoc}
*/
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
writer.addMemberTree(HtmlStyle.memberSummary, memberSummaryTree, memberTree);
}
/**
@ -103,16 +103,17 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
/**
* {@inheritDoc}
*/
public void addAnnotationDetailsTreeHeader(TypeElement te,
Content memberDetailsTree) {
public Content getAnnotationDetailsTreeHeader(TypeElement te) {
Content memberDetailsTree = new ContentBuilder();
if (!writer.printedAnnotationHeading) {
memberDetailsTree.add(links.createAnchor(
SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL));
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
contents.annotationTypeDetailsLabel);
memberDetailsTree.add(heading);
memberDetailsTree.add(links.createAnchor(
SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL));
writer.printedAnnotationHeading = true;
}
return memberDetailsTree;
}
/**
@ -121,13 +122,13 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
@Override
public Content getAnnotationDocTreeHeader(Element member, Content annotationDetailsTree) {
String simpleName = name(member);
annotationDetailsTree.add(links.createAnchor(
simpleName + utils.signature((ExecutableElement) member)));
Content annotationDocTree = writer.getMemberTreeHeader();
Content annotationDocTree = new ContentBuilder();
Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
heading.add(simpleName);
annotationDocTree.add(heading);
return annotationDocTree;
annotationDocTree.add(links.createAnchor(
simpleName + utils.signature((ExecutableElement) member)));
return HtmlTree.SECTION(HtmlStyle.detail, annotationDocTree);
}
/**
@ -175,8 +176,9 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
/**
* {@inheritDoc}
*/
public Content getAnnotationDetails(Content annotationDetailsTree) {
return HtmlTree.SECTION(getMemberTree(annotationDetailsTree));
public Content getAnnotationDetails(Content annotationDetailsTreeHeader, Content annotationDetailsTree) {
Content annotationDetails = new ContentBuilder(annotationDetailsTreeHeader, annotationDetailsTree);
return getMemberTree(HtmlTree.SECTION(HtmlStyle.memberDetails, annotationDetails));
}
/**

View File

@ -171,7 +171,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
*/
@Override
public Content getAnnotationInfo(Content annotationInfoTree) {
return getMemberTree(HtmlStyle.description, annotationInfoTree);
return HtmlTree.SECTION(HtmlStyle.description, annotationInfoTree);
}
/**

View File

@ -249,14 +249,13 @@ public class ClassUseWriter extends SubWriterHolderWriter {
* @param contentTree the content tree to which the class use information will be added
*/
protected void addClassUse(Content contentTree) {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.setStyle(HtmlStyle.blockList);
Content content = new ContentBuilder();
if (configuration.packages.size() > 1) {
addPackageList(ul);
addPackageAnnotationList(ul);
addPackageList(content);
addPackageAnnotationList(content);
}
addClassList(ul);
contentTree.add(ul);
addClassList(content);
contentTree.add(content);
}
/**
@ -276,8 +275,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
for (PackageElement pkg : pkgSet) {
addPackageUse(pkg, table);
}
Content li = HtmlTree.LI(HtmlStyle.blockList, table.toContent());
contentTree.add(li);
contentTree.add(table.toContent());
}
/**
@ -305,8 +303,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
addSummaryComment(pkg, summary);
table.addRow(getPackageLink(pkg), summary);
}
Content li = HtmlTree.LI(HtmlStyle.blockList, table.toContent());
contentTree.add(li);
contentTree.add(table.toContent());
}
/**
@ -319,7 +316,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
ul.setStyle(HtmlStyle.blockList);
for (PackageElement pkg : pkgSet) {
Content markerAnchor = links.createAnchor(getPackageAnchorName(pkg));
HtmlTree htmlTree = HtmlTree.SECTION(markerAnchor);
HtmlTree htmlTree = HtmlTree.SECTION(HtmlStyle.detail, markerAnchor);
Content link = contents.getContent("doclet.ClassUse_Uses.of.0.in.1",
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
typeElement)),
@ -329,7 +326,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
addClassUse(pkg, htmlTree);
ul.add(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
}
Content li = HtmlTree.LI(HtmlStyle.blockList, ul);
Content li = HtmlTree.SECTION(HtmlStyle.classUses, ul);
contentTree.add(li);
}

View File

@ -157,7 +157,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
Content headingContent = contents.contentsHeading;
Content heading = HtmlTree.HEADING(Headings.CONTENT_HEADING, true,
headingContent);
HtmlTree section = HtmlTree.SECTION(heading);
HtmlTree section = HtmlTree.SECTION(HtmlStyle.packages, heading);
section.add(contentListTree);
div.add(section);
mainTree.add(div);
@ -194,7 +194,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
Content heading = HtmlTree.HEADING(Headings.ConstantsSummary.PACKAGE_HEADING, true,
pkgNameContent);
heading.add(headingContent);
summaryTree = HtmlTree.SECTION(heading);
summaryTree = HtmlTree.SECTION(HtmlStyle.constantsSummary, heading);
}
/**

View File

@ -25,25 +25,26 @@
package jdk.javadoc.internal.doclets.formats.html;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import java.util.*;
import java.util.Arrays;
import java.util.List;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import jdk.javadoc.internal.doclets.toolkit.ConstructorWriter;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
import static jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable.Kind.*;
import static jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable.Kind.CONSTRUCTORS;
/**
@ -98,7 +99,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
public Content getMemberSummaryHeader(TypeElement typeElement,
Content memberSummaryTree) {
memberSummaryTree.add(MarkerComments.START_OF_CONSTRUCTOR_SUMMARY);
Content memberTree = writer.getMemberTreeHeader();
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, typeElement, memberTree);
return memberTree;
}
@ -108,7 +109,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
*/
@Override
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
writer.addMemberTree(HtmlStyle.constructorSummary, memberSummaryTree, memberTree);
}
/**
@ -118,12 +119,12 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
public Content getConstructorDetailsTreeHeader(TypeElement typeElement,
Content memberDetailsTree) {
memberDetailsTree.add(MarkerComments.START_OF_CONSTRUCTOR_DETAILS);
Content constructorDetailsTree = writer.getMemberTreeHeader();
constructorDetailsTree.add(links.createAnchor(
SectionName.CONSTRUCTOR_DETAIL));
Content constructorDetailsTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
contents.constructorDetailsLabel);
constructorDetailsTree.add(heading);
constructorDetailsTree.add(links.createAnchor(
SectionName.CONSTRUCTOR_DETAIL));
return constructorDetailsTree;
}
@ -134,15 +135,15 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
public Content getConstructorDocTreeHeader(ExecutableElement constructor,
Content constructorDetailsTree) {
String erasureAnchor;
if ((erasureAnchor = getErasureAnchor(constructor)) != null) {
constructorDetailsTree.add(links.createAnchor((erasureAnchor)));
}
constructorDetailsTree.add(links.createAnchor(writer.getAnchor(constructor)));
Content constructorDocTree = writer.getMemberTreeHeader();
Content constructorDocTree = new ContentBuilder();
Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
heading.add(name(constructor));
constructorDocTree.add(heading);
return constructorDocTree;
if ((erasureAnchor = getErasureAnchor(constructor)) != null) {
constructorDocTree.add(links.createAnchor((erasureAnchor)));
}
constructorDocTree.add(links.createAnchor(writer.getAnchor(constructor)));
return HtmlTree.SECTION(HtmlStyle.detail, constructorDocTree);
}
/**
@ -194,8 +195,9 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
* {@inheritDoc}
*/
@Override
public Content getConstructorDetails(Content constructorDetailsTree) {
return HtmlTree.SECTION(getMemberTree(constructorDetailsTree));
public Content getConstructorDetails(Content constructorDetailsTreeHeader, Content constructorDetailsTree) {
Content constructorDetails = new ContentBuilder(constructorDetailsTreeHeader, constructorDetailsTree);
return getMemberTree(HtmlTree.SECTION(HtmlStyle.constructorDetails, constructorDetails));
}
/**
@ -303,4 +305,9 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
tdSummaryType.add(code);
}
}
@Override
public Content getMemberTreeHeader(){
return writer.getMemberTreeHeader();
}
}

View File

@ -26,17 +26,17 @@
package jdk.javadoc.internal.doclets.formats.html;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.EnumConstantWriter;
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
@ -70,7 +70,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
public Content getMemberSummaryHeader(TypeElement typeElement,
Content memberSummaryTree) {
memberSummaryTree.add(MarkerComments.START_OF_ENUM_CONSTANT_SUMMARY);
Content memberTree = writer.getMemberTreeHeader();
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, typeElement, memberTree);
return memberTree;
}
@ -80,7 +80,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
*/
@Override
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
writer.addMemberTree(HtmlStyle.constantsSummary, memberSummaryTree, memberTree);
}
/**
@ -90,12 +90,12 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
public Content getEnumConstantsDetailsTreeHeader(TypeElement typeElement,
Content memberDetailsTree) {
memberDetailsTree.add(MarkerComments.START_OF_ENUM_CONSTANT_DETAILS);
Content enumConstantsDetailsTree = writer.getMemberTreeHeader();
enumConstantsDetailsTree.add(links.createAnchor(
SectionName.ENUM_CONSTANT_DETAIL));
Content enumConstantsDetailsTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
contents.enumConstantDetailLabel);
enumConstantsDetailsTree.add(heading);
enumConstantsDetailsTree.add(links.createAnchor(
SectionName.ENUM_CONSTANT_DETAIL));
return enumConstantsDetailsTree;
}
@ -105,12 +105,12 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
@Override
public Content getEnumConstantsTreeHeader(VariableElement enumConstant,
Content enumConstantsDetailsTree) {
enumConstantsDetailsTree.add(links.createAnchor(name(enumConstant)));
Content enumConstantsTree = writer.getMemberTreeHeader();
Content enumConstantsTree = new ContentBuilder();
Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
heading.add(name(enumConstant));
enumConstantsTree.add(heading);
return enumConstantsTree;
enumConstantsTree.add(links.createAnchor(name(enumConstant)));
return HtmlTree.SECTION(HtmlStyle.detail, enumConstantsTree);
}
/**
@ -162,8 +162,11 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
* {@inheritDoc}
*/
@Override
public Content getEnumConstantsDetails(Content enumConstantsDetailsTree) {
return HtmlTree.SECTION(getMemberTree(enumConstantsDetailsTree));
public Content getEnumConstantsDetails(Content enumConstantsDetailsTreeHeader,
Content enumConstantsDetailsTree) {
Content enumConstantsDetails =
new ContentBuilder(enumConstantsDetailsTreeHeader, enumConstantsDetailsTree);
return getMemberTree(HtmlTree.SECTION(HtmlStyle.constantDetails, enumConstantsDetails));
}
/**
@ -261,4 +264,9 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
String name = utils.getFullyQualifiedName(member) + "." + member.getSimpleName();
return writer.getDocLink(LinkInfoImpl.Kind.MEMBER, member, name);
}
@Override
public Content getMemberTreeHeader(){
return writer.getMemberTreeHeader();
}
}

View File

@ -25,9 +25,6 @@
package jdk.javadoc.internal.doclets.formats.html;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import java.util.Arrays;
import java.util.List;
@ -35,10 +32,13 @@ import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.FieldWriter;
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
@ -74,7 +74,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
public Content getMemberSummaryHeader(TypeElement typeElement,
Content memberSummaryTree) {
memberSummaryTree.add(MarkerComments.START_OF_FIELD_SUMMARY);
Content memberTree = writer.getMemberTreeHeader();
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, typeElement, memberTree);
return memberTree;
}
@ -84,7 +84,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
*/
@Override
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
writer.addMemberTree(HtmlStyle.fieldSummary, memberSummaryTree, memberTree);
}
/**
@ -93,12 +93,12 @@ public class FieldWriterImpl extends AbstractMemberWriter
@Override
public Content getFieldDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) {
memberDetailsTree.add(MarkerComments.START_OF_FIELD_DETAILS);
Content fieldDetailsTree = writer.getMemberTreeHeader();
fieldDetailsTree.add(links.createAnchor(
SectionName.FIELD_DETAIL));
Content fieldDetailsTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
contents.fieldDetailsLabel);
fieldDetailsTree.add(heading);
fieldDetailsTree.add(links.createAnchor(
SectionName.FIELD_DETAIL));
return fieldDetailsTree;
}
@ -107,12 +107,12 @@ public class FieldWriterImpl extends AbstractMemberWriter
*/
@Override
public Content getFieldDocTreeHeader(VariableElement field, Content fieldDetailsTree) {
fieldDetailsTree.add(links.createAnchor(name(field)));
Content fieldTree = writer.getMemberTreeHeader();
Content fieldTree = new ContentBuilder();
Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
heading.add(name(field));
fieldTree.add(heading);
return fieldTree;
fieldTree.add(links.createAnchor(name(field)));
return HtmlTree.SECTION(HtmlStyle.detail, fieldTree);
}
/**
@ -166,8 +166,9 @@ public class FieldWriterImpl extends AbstractMemberWriter
* {@inheritDoc}
*/
@Override
public Content getFieldDetails(Content fieldDetailsTree) {
return HtmlTree.SECTION(getMemberTree(fieldDetailsTree));
public Content getFieldDetails(Content fieldDetailsTreeHeader, Content fieldDetailsTree) {
Content fieldDetails = new ContentBuilder(fieldDetailsTreeHeader, fieldDetailsTree);
return getMemberTree(HtmlTree.SECTION(HtmlStyle.fieldDetails, fieldDetails));
}
/**
@ -290,4 +291,9 @@ public class FieldWriterImpl extends AbstractMemberWriter
String name = utils.getFullyQualifiedName(member) + "." + member.getSimpleName();
return writer.getDocLink(LinkInfoImpl.Kind.MEMBER, member, name);
}
@Override
public Content getMemberTreeHeader(){
return writer.getMemberTreeHeader();
}
}

View File

@ -127,7 +127,7 @@ public class HelpWriter extends HtmlDocletWriter {
if (configuration.createoverview) {
Content overviewHeading = HtmlTree.HEADING(Headings.CONTENT_HEADING,
contents.overviewLabel);
htmlTree = HtmlTree.SECTION(overviewHeading);
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, overviewHeading);
String overviewKey = configuration.showModules
? "doclet.help.overview.modules.body"
: "doclet.help.overview.packages.body";
@ -143,7 +143,7 @@ public class HelpWriter extends HtmlDocletWriter {
if (configuration.showModules) {
Content moduleHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
contents.moduleLabel);
htmlTree = HtmlTree.SECTION(moduleHead);
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, moduleHead);
Content moduleIntro = contents.getContent("doclet.help.module.intro");
Content modulePara = HtmlTree.P(moduleIntro);
htmlTree.add(modulePara);
@ -158,7 +158,7 @@ public class HelpWriter extends HtmlDocletWriter {
// Package
Content packageHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
contents.packageLabel);
htmlTree = HtmlTree.SECTION(packageHead);
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, packageHead);
Content packageIntro = contents.getContent("doclet.help.package.intro");
Content packagePara = HtmlTree.P(packageIntro);
htmlTree.add(packagePara);
@ -175,7 +175,7 @@ public class HelpWriter extends HtmlDocletWriter {
// Class/interface
Content classHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
contents.getContent("doclet.help.class_interface.head"));
htmlTree = HtmlTree.SECTION(classHead);
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, classHead);
Content classIntro = contents.getContent("doclet.help.class_interface.intro");
Content classPara = HtmlTree.P(classIntro);
htmlTree.add(classPara);
@ -210,7 +210,7 @@ public class HelpWriter extends HtmlDocletWriter {
// Annotation Types
Content aHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
contents.annotationType);
htmlTree = HtmlTree.SECTION(aHead);
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, aHead);
Content aIntro = contents.getContent("doclet.help.annotation_type.intro");
Content aPara = HtmlTree.P(aIntro);
htmlTree.add(aPara);
@ -225,7 +225,7 @@ public class HelpWriter extends HtmlDocletWriter {
// Enums
Content enumHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.enum_);
htmlTree = HtmlTree.SECTION(enumHead);
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, enumHead);
Content eIntro = contents.getContent("doclet.help.enum.intro");
Content enumPara = HtmlTree.P(eIntro);
htmlTree.add(enumPara);
@ -241,7 +241,7 @@ public class HelpWriter extends HtmlDocletWriter {
if (configuration.classuse) {
Content useHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
contents.getContent("doclet.help.use.head"));
htmlTree = HtmlTree.SECTION(useHead);
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, useHead);
Content useBody = contents.getContent("doclet.help.use.body");
Content usePara = HtmlTree.P(useBody);
htmlTree.add(usePara);
@ -252,7 +252,7 @@ public class HelpWriter extends HtmlDocletWriter {
if (configuration.createtree) {
Content treeHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
contents.getContent("doclet.help.tree.head"));
htmlTree = HtmlTree.SECTION(treeHead);
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, treeHead);
Content treeIntro = contents.getContent("doclet.help.tree.intro",
links.createLink(DocPaths.OVERVIEW_TREE,
resources.getText("doclet.Class_Hierarchy")),
@ -270,7 +270,7 @@ public class HelpWriter extends HtmlDocletWriter {
if (!(configuration.nodeprecatedlist || configuration.nodeprecated)) {
Content dHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
contents.deprecatedAPI);
htmlTree = HtmlTree.SECTION(dHead);
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, dHead);
Content deprBody = contents.getContent("doclet.help.deprecated.body",
links.createLink(DocPaths.DEPRECATED_LIST,
resources.getText("doclet.Deprecated_API")));
@ -291,7 +291,7 @@ public class HelpWriter extends HtmlDocletWriter {
}
Content indexHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
contents.getContent("doclet.help.index.head"));
htmlTree = HtmlTree.SECTION(indexHead);
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, indexHead);
Content indexBody = contents.getContent("doclet.help.index.body", indexlink);
Content indexPara = HtmlTree.P(indexBody);
htmlTree.add(indexPara);
@ -301,7 +301,7 @@ public class HelpWriter extends HtmlDocletWriter {
// Serialized Form
Content sHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
contents.serializedForm);
htmlTree = HtmlTree.SECTION(sHead);
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, sHead);
Content serialBody = contents.getContent("doclet.help.serial_form.body");
Content serialPara = HtmlTree.P(serialBody);
htmlTree.add(serialPara);
@ -310,7 +310,7 @@ public class HelpWriter extends HtmlDocletWriter {
// Constant Field Values
Content constHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
contents.constantsSummaryTitle);
htmlTree = HtmlTree.SECTION(constHead);
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, constHead);
Content constantsBody = contents.getContent("doclet.help.constants.body",
links.createLink(DocPaths.CONSTANT_VALUES,
resources.getText("doclet.Constants_Summary")));
@ -321,7 +321,7 @@ public class HelpWriter extends HtmlDocletWriter {
// Search
Content searchHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
contents.getContent("doclet.help.search.head"));
htmlTree = HtmlTree.SECTION(searchHead);
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, searchHead);
Content searchBody = contents.getContent("doclet.help.search.body");
Content searchPara = HtmlTree.P(searchBody);
htmlTree.add(searchPara);

View File

@ -103,15 +103,14 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
* @return a content tree for the serializable fields content
*/
public Content getSerializableFields(String heading, Content serializableFieldsTree) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.setStyle(HtmlStyle.blockList);
HtmlTree section = HtmlTree.SECTION(HtmlStyle.detail);
if (serializableFieldsTree.isValid()) {
Content headingContent = new StringContent(heading);
Content serialHeading = HtmlTree.HEADING(Headings.SerializedForm.CLASS_SUBHEADING, headingContent);
li.add(serialHeading);
li.add(serializableFieldsTree);
section.add(serialHeading);
section.add(serializableFieldsTree);
}
return li;
return HtmlTree.LI(HtmlStyle.blockList, section);
}
@Override

View File

@ -95,9 +95,9 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
public Content getSerializableMethods(String heading, Content serializableMethodContent) {
Content headingContent = new StringContent(heading);
Content serialHeading = HtmlTree.HEADING(Headings.SerializedForm.CLASS_SUBHEADING, headingContent);
Content li = HtmlTree.LI(HtmlStyle.blockList, serialHeading);
li.add(serializableMethodContent);
return li;
Content section = HtmlTree.SECTION(HtmlStyle.detail, serialHeading);
section.add(serializableMethodContent);
return HtmlTree.LI(HtmlStyle.blockList, section);
}
/**

View File

@ -25,9 +25,6 @@
package jdk.javadoc.internal.doclets.formats.html;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import java.util.SortedSet;
import java.util.TreeSet;
@ -36,10 +33,13 @@ import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
import jdk.javadoc.internal.doclets.toolkit.MethodWriter;
@ -87,7 +87,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
@Override
public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) {
memberSummaryTree.add(MarkerComments.START_OF_METHOD_SUMMARY);
Content memberTree = writer.getMemberTreeHeader();
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, typeElement, memberTree);
return memberTree;
}
@ -97,7 +97,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
*/
@Override
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
writer.addMemberTree(HtmlStyle.methodSummary, memberSummaryTree, memberTree);
}
/**
@ -106,11 +106,11 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
@Override
public Content getMethodDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) {
memberDetailsTree.add(MarkerComments.START_OF_METHOD_DETAILS);
Content methodDetailsTree = writer.getMemberTreeHeader();
methodDetailsTree.add(links.createAnchor(SectionName.METHOD_DETAIL));
Content methodDetailsTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
contents.methodDetailLabel);
methodDetailsTree.add(heading);
methodDetailsTree.add(links.createAnchor(SectionName.METHOD_DETAIL));
return methodDetailsTree;
}
@ -120,15 +120,15 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
@Override
public Content getMethodDocTreeHeader(ExecutableElement method, Content methodDetailsTree) {
String erasureAnchor;
if ((erasureAnchor = getErasureAnchor(method)) != null) {
methodDetailsTree.add(links.createAnchor((erasureAnchor)));
}
methodDetailsTree.add(links.createAnchor(writer.getAnchor(method)));
Content methodDocTree = writer.getMemberTreeHeader();
Content methodDocTree = new ContentBuilder();
Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
heading.add(name(method));
methodDocTree.add(heading);
return methodDocTree;
if ((erasureAnchor = getErasureAnchor(method)) != null) {
methodDocTree.add(links.createAnchor((erasureAnchor)));
}
methodDocTree.add(links.createAnchor(writer.getAnchor(method)));
return HtmlTree.SECTION(HtmlStyle.detail, methodDocTree);
}
/**
@ -210,8 +210,9 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
* {@inheritDoc}
*/
@Override
public Content getMethodDetails(Content methodDetailsTree) {
return HtmlTree.SECTION(getMemberTree(methodDetailsTree));
public Content getMethodDetails(Content methodDetailsTreeHeader, Content methodDetailsTree) {
Content methodDetails = new ContentBuilder(methodDetailsTreeHeader, methodDetailsTree);
return getMemberTree(HtmlTree.SECTION(HtmlStyle.methodDetails, methodDetails));
}
/**
@ -411,4 +412,9 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
htmltree.add(Contents.SPACE);
}
}
@Override
public Content getMemberTreeHeader(){
return writer.getMemberTreeHeader();
}
}

View File

@ -166,11 +166,6 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
*/
protected HtmlTree mainTree = HtmlTree.MAIN();
/**
* The HTML tree for section tag.
*/
protected HtmlTree sectionTree = HtmlTree.SECTION();
private final Navigation navBar;
/**
@ -237,9 +232,9 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
*/
@Override
public Content getSummaryHeader() {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.setStyle(HtmlStyle.blockList);
return li;
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.setStyle(HtmlStyle.blockList);
return ul;
}
/**
@ -249,8 +244,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
*/
@Override
public Content getSummaryTree(Content summaryContentTree) {
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
return ul;
return HtmlTree.SECTION(HtmlStyle.summary, summaryContentTree);
}
/**
@ -506,10 +500,9 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
TableHeader requiresTableHeader =
new TableHeader(contents.modifierLabel, contents.moduleLabel,
contents.descriptionLabel);
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.setStyle(HtmlStyle.blockList);
HtmlTree section = HtmlTree.SECTION(HtmlStyle.modulesSummary);
addSummaryHeader(MarkerComments.START_OF_MODULES_SUMMARY, SectionName.MODULES,
contents.navModules, li);
contents.navModules, section);
if (display(requires)) {
String text = resources.getText("doclet.Requires_Summary");
String tableSummary = resources.getText("doclet.Member_Table_Summary",
@ -519,7 +512,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
Table table = getTable3(caption, tableSummary, HtmlStyle.requiresSummary,
requiresTableHeader);
addModulesList(requires, table);
li.add(table.toContent());
section.add(table.toContent());
}
// Display indirect modules table in both "api" and "all" mode.
if (display(indirectModules)) {
@ -531,10 +524,9 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
Table amrTable = getTable3(amrCaption, amrTableSummary, HtmlStyle.requiresSummary,
requiresTableHeader);
addModulesList(indirectModules, amrTable);
li.add(amrTable.toContent());
section.add(amrTable.toContent());
}
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
summaryContentTree.add(ul);
summaryContentTree.add(HtmlTree.LI(HtmlStyle.blockList, section));
}
}
@ -558,12 +550,11 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
public void addPackagesSummary(Content summaryContentTree) {
if (display(packages)
|| display(indirectPackages) || display(indirectOpenPackages)) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.setStyle(HtmlStyle.blockList);
HtmlTree section = HtmlTree.SECTION(HtmlStyle.packagesSummary);
addSummaryHeader(MarkerComments.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES,
contents.navPackages, li);
contents.navPackages, section);
if (display(packages)) {
addPackageSummary(li);
addPackageSummary(section);
}
TableHeader indirectPackagesHeader =
new TableHeader(contents.fromLabel, contents.packagesLabel);
@ -572,17 +563,16 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
Table aepTable = getTable2(new StringContent(aepText),
HtmlStyle.packagesSummary, indirectPackagesHeader);
addIndirectPackages(aepTable, indirectPackages);
li.add(aepTable.toContent());
section.add(aepTable.toContent());
}
if (display(indirectOpenPackages)) {
String aopText = resources.getText("doclet.Indirect_Opens_Summary");
Table aopTable = getTable2(new StringContent(aopText), HtmlStyle.packagesSummary,
indirectPackagesHeader);
addIndirectPackages(aopTable, indirectOpenPackages);
li.add(aopTable.toContent());
section.add(aopTable.toContent());
}
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
summaryContentTree.add(ul);
summaryContentTree.add(HtmlTree.LI(HtmlStyle.blockList, section));
}
}
@ -737,10 +727,9 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
boolean haveProvides = displayServices(provides.keySet(), providesTrees);
if (haveProvides || haveUses) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.setStyle(HtmlStyle.blockList);
HtmlTree section = HtmlTree.SECTION(HtmlStyle.servicesSummary);
addSummaryHeader(MarkerComments.START_OF_SERVICES_SUMMARY, SectionName.SERVICES,
contents.navServices, li);
contents.navServices, section);
TableHeader usesProvidesTableHeader =
new TableHeader(contents.typeLabel, contents.descriptionLabel);
if (haveProvides) {
@ -749,7 +738,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
usesProvidesTableHeader);
addProvidesList(table);
if (!table.isEmpty()) {
li.add(table.toContent());
section.add(table.toContent());
}
}
if (haveUses){
@ -758,11 +747,10 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
usesProvidesTableHeader);
addUsesList(table);
if (!table.isEmpty()) {
li.add(table.toContent());
section.add(table.toContent());
}
}
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
summaryContentTree.add(ul);
summaryContentTree.add(HtmlTree.LI(HtmlStyle.blockList, section));
}
}
@ -866,7 +854,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
@Override
public void addModuleDescription(Content moduleContentTree) {
if (!utils.getFullBody(mdle).isEmpty()) {
Content tree = HtmlTree.SECTION();
Content tree = HtmlTree.SECTION(HtmlStyle.moduleDescription);
addDeprecationInfo(tree);
tree.add(MarkerComments.START_OF_MODULE_DESCRIPTION);
tree.add(links.createAnchor(SectionName.MODULE_DESCRIPTION));
@ -880,7 +868,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
*/
@Override
public void addModuleTags(Content moduleContentTree) {
Content tree = HtmlTree.SECTION();
Content tree = HtmlTree.SECTION(HtmlStyle.moduleTags);
addTagsInfo(mdle, tree);
moduleContentTree.add(tree);
}

View File

@ -25,18 +25,18 @@
package jdk.javadoc.internal.doclets.formats.html;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import java.util.Arrays;
import java.util.List;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
@ -71,7 +71,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
public Content getMemberSummaryHeader(TypeElement typeElement,
Content memberSummaryTree) {
memberSummaryTree.add(MarkerComments.START_OF_NESTED_CLASS_SUMMARY);
Content memberTree = writer.getMemberTreeHeader();
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, typeElement, memberTree);
return memberTree;
}
@ -81,7 +81,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
*/
@Override
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
writer.addMemberTree(HtmlStyle.nestedClassSummary, memberSummaryTree, memberTree);
}
/**

View File

@ -151,13 +151,12 @@ public class PackageUseWriter extends SubWriterHolderWriter {
* @param contentTree the content tree to which the package use information will be added
*/
protected void addPackageUse(Content contentTree) {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.setStyle(HtmlStyle.blockList);
Content content = new ContentBuilder();
if (configuration.packages.size() > 1) {
addPackageList(ul);
addPackageList(content);
}
addClassList(ul);
contentTree.add(ul);
addClassList(content);
contentTree.add(content);
}
/**
@ -185,8 +184,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
}
table.addRow(packageLink, summary);
}
Content li = HtmlTree.LI(HtmlStyle.blockList, table.toContent());
contentTree.add(li);
contentTree.add(table.toContent());
}
/**
@ -197,11 +195,12 @@ public class PackageUseWriter extends SubWriterHolderWriter {
protected void addClassList(Content contentTree) {
TableHeader classTableHeader = new TableHeader(
contents.classLabel, contents.descriptionLabel);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.setStyle(HtmlStyle.blockList);
for (String packageName : usingPackageToUsedClasses.keySet()) {
PackageElement usingPackage = utils.elementUtils.getPackageElement(packageName);
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.setStyle(HtmlStyle.blockList);
li.add(links.createAnchor(getPackageAnchorName(usingPackage)));
HtmlTree section = HtmlTree.SECTION(HtmlStyle.detail);
section.add(links.createAnchor(getPackageAnchorName(usingPackage)));
String tableSummary = resources.getText("doclet.Use_Table_Summary",
resources.getText("doclet.classes"));
Content caption = contents.getContent(
@ -223,9 +222,11 @@ public class PackageUseWriter extends SubWriterHolderWriter {
table.addRow(typeContent, summary);
}
li.add(table.toContent());
contentTree.add(li);
section.add(table.toContent());
ul.add(HtmlTree.LI(HtmlStyle.blockList, section));
}
Content li = HtmlTree.SECTION(HtmlStyle.packageUses, ul);
contentTree.add(li);
}
/**

View File

@ -77,7 +77,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
/**
* The HTML tree for section tag.
*/
protected HtmlTree sectionTree = HtmlTree.SECTION();
protected HtmlTree sectionTree = HtmlTree.SECTION(HtmlStyle.packageDescription, new ContentBuilder());
private final Navigation navBar;
@ -320,4 +320,12 @@ public class PackageWriterImpl extends HtmlDocletWriter
printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageElement),
description, stylesheetContent, contentTree);
}
/**
* {@inheritDoc}
*/
@Override
public Content getPackageSummary(Content summaryContentTree) {
return HtmlTree.SECTION(HtmlStyle.summary, summaryContentTree);
}
}

View File

@ -26,17 +26,17 @@
package jdk.javadoc.internal.doclets.formats.html;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
import jdk.javadoc.internal.doclets.toolkit.PropertyWriter;
@ -68,7 +68,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter
@Override
public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) {
memberSummaryTree.add(MarkerComments.START_OF_PROPERTY_SUMMARY);
Content memberTree = writer.getMemberTreeHeader();
Content memberTree = new ContentBuilder();
writer.addSummaryHeader(this, typeElement, memberTree);
return memberTree;
}
@ -78,7 +78,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter
*/
@Override
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
writer.addMemberTree(HtmlStyle.propertySummary, memberSummaryTree, memberTree);
}
/**
@ -88,11 +88,11 @@ public class PropertyWriterImpl extends AbstractMemberWriter
public Content getPropertyDetailsTreeHeader(TypeElement typeElement,
Content memberDetailsTree) {
memberDetailsTree.add(MarkerComments.START_OF_PROPERTY_DETAILS);
Content propertyDetailsTree = writer.getMemberTreeHeader();
propertyDetailsTree.add(links.createAnchor(SectionName.PROPERTY_DETAIL));
Content propertyDetailsTree = new ContentBuilder();
Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING,
contents.propertyDetailsLabel);
propertyDetailsTree.add(heading);
propertyDetailsTree.add(links.createAnchor(SectionName.PROPERTY_DETAIL));
return propertyDetailsTree;
}
@ -102,12 +102,12 @@ public class PropertyWriterImpl extends AbstractMemberWriter
@Override
public Content getPropertyDocTreeHeader(ExecutableElement property,
Content propertyDetailsTree) {
propertyDetailsTree.add(links.createAnchor(name(property)));
Content propertyDocTree = writer.getMemberTreeHeader();
Content propertyDocTree = new ContentBuilder();
Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING);
heading.add(utils.getPropertyLabel(name(property)));
propertyDocTree.add(heading);
return propertyDocTree;
propertyDocTree.add(links.createAnchor(name(property)));
return HtmlTree.SECTION(HtmlStyle.detail, propertyDocTree);
}
/**
@ -181,8 +181,9 @@ public class PropertyWriterImpl extends AbstractMemberWriter
* {@inheritDoc}
*/
@Override
public Content getPropertyDetails(Content propertyDetailsTree) {
return HtmlTree.SECTION(getMemberTree(propertyDetailsTree));
public Content getPropertyDetails(Content propertyDetailsTreeHeader, Content propertyDetailsTree) {
Content propertyDetails = new ContentBuilder(propertyDetailsTreeHeader, propertyDetailsTree);
return getMemberTree(HtmlTree.SECTION(HtmlStyle.propertyDetails, propertyDetails));
}
/**
@ -312,4 +313,9 @@ public class PropertyWriterImpl extends AbstractMemberWriter
return writer.getDocLink(LinkInfoImpl.Kind.MEMBER, member,
utils.getFullyQualifiedName(member));
}
@Override
public Content getMemberTreeHeader(){
return writer.getMemberTreeHeader();
}
}

View File

@ -109,7 +109,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
* @return the package serialized form header tree
*/
public Content getPackageSerializedHeader() {
return HtmlTree.SECTION();
return HtmlTree.SECTION(HtmlStyle.serializedPackageContainer);
}
/**
@ -158,7 +158,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
? getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, typeElement)
.label(configuration.getClassName(typeElement)))
: new StringContent(utils.getFullyQualifiedName(typeElement));
Content li = HtmlTree.LI(HtmlStyle.blockList, links.createAnchor(
Content section = HtmlTree.SECTION(HtmlStyle.serializedClassDetails, links.createAnchor(
utils.getFullyQualifiedName(typeElement)));
Content superClassLink = typeElement.getSuperclass() != null
? getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.SERIALIZED_FORM,
@ -172,8 +172,8 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
contents.getContent(
"doclet.Class_0_extends_implements_serializable", classLink,
superClassLink);
li.add(HtmlTree.HEADING(Headings.SerializedForm.CLASS_HEADING, className));
return li;
section.add(HtmlTree.HEADING(Headings.SerializedForm.CLASS_HEADING, className));
return section;
}
/**

View File

@ -90,8 +90,8 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
*/
public void addInheritedSummaryHeader(AbstractMemberWriter mw, TypeElement typeElement,
Content inheritedTree) {
mw.addInheritedSummaryAnchor(typeElement, inheritedTree);
mw.addInheritedSummaryLabel(typeElement, inheritedTree);
mw.addInheritedSummaryAnchor(typeElement, inheritedTree);
}
/**
@ -212,23 +212,29 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
/**
* Get the member header tree
*
* @return a content tree the member header
* @return a content tree for the member header
*/
public Content getMemberTreeHeader() {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.setStyle(HtmlStyle.blockList);
return li;
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.setStyle(HtmlStyle.blockList);
return ul;
}
public Content getMemberInheritedTree() {
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.setStyle(HtmlStyle.inheritedList);
return div;
}
/**
* Add the member tree.
*
* Adds the member tree with css style.
* @param style the css style to be applied to member tree
* @param memberSummaryTree the content tree representing the member summary
* @param memberTree the content tree representing the member
*/
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(memberTree));
memberSummaryTree.add(htmlTree);
public void addMemberTree(HtmlStyle style, Content memberSummaryTree, Content memberTree) {
HtmlTree htmlTree = HtmlTree.SECTION(style, memberTree);
memberSummaryTree.add(getMemberTree(htmlTree));
}
/**
@ -238,8 +244,7 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
* @return a content tree for the member
*/
public Content getMemberTree(Content contentTree) {
Content ul = HtmlTree.UL(HtmlStyle.blockList, contentTree);
return ul;
return HtmlTree.LI(HtmlStyle.blockList, contentTree);
}
/**
@ -249,7 +254,7 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
* @return a content tree for the member summary
*/
public Content getMemberSummaryTree(Content contentTree) {
return getMemberTree(HtmlStyle.summary, contentTree);
return HtmlTree.SECTION(HtmlStyle.summary, contentTree);
}
/**
@ -259,7 +264,7 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
* @return a content tree for the member details
*/
public Content getMemberDetailsTree(Content contentTree) {
return getMemberTree(HtmlStyle.details, contentTree);
return HtmlTree.SECTION(HtmlStyle.details, contentTree);
}
/**
@ -270,7 +275,6 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
* @return the member tree
*/
public Content getMemberTree(HtmlStyle style, Content contentTree) {
Content div = HtmlTree.DIV(style, getMemberTree(contentTree));
return div;
return HtmlTree.SECTION(style, contentTree);
}
}

View File

@ -48,12 +48,16 @@ public enum HtmlStyle {
bottomNav,
circle,
classUseContainer,
classUses,
colConstructorName,
colDeprecatedItemName,
colFirst,
colLast,
colSecond,
constantsSummary,
constructorDetails,
constructorSummary,
constantDetails,
constantValuesContainer,
contentContainer,
deprecatedLabel,
@ -63,40 +67,58 @@ public enum HtmlStyle {
description,
descfrmTypeLabel,
details,
detail,
docSummary,
emphasizedPhrase,
externalLink,
fieldDetails,
fieldSummary,
fixedNav,
header,
helpSection,
hierarchy,
horizontal,
footer,
implementationLabel,
indexContainer,
indexNav,
inheritance,
inheritedList,
interfaceName,
leftContainer,
leftTop,
leftBottom,
legalCopy,
mainContainer,
memberDetails,
memberNameLabel,
memberNameLink,
memberSummary,
methodDetails,
methodSignature,
methodSummary,
moduleDescription,
moduleLabelInPackage,
moduleLabelInType,
moduleTags,
modulesSummary,
nameValue,
navBarCell1Rev,
navList,
navListSearch,
navPadding,
nestedClassSummary,
overrideSpecifyLabel,
overviewSummary,
packages,
packageDescription,
packageHierarchyLabel,
packageLabelInType,
packagesSummary,
packageUses,
paramLabel,
propertyDetails,
propertySummary,
providesSummary,
requiresSummary,
returnLabel,
@ -107,6 +129,9 @@ public enum HtmlStyle {
searchTagResult,
seeLabel,
serializedFormContainer,
serializedPackageContainer,
serializedClassDetails,
servicesSummary,
simpleTagLabel,
skipNav,
sourceContainer,

View File

@ -717,22 +717,30 @@ public class HtmlTree extends Content {
}
/**
* Generates a SECTION tag with role attribute.
* Generates a SECTION tag with style class attribute.
*
* @param styleClass the style class for the tag
* @return an HtmlTree object for the SECTION tag
*/
public static HtmlTree SECTION() {
return new HtmlTree(HtmlTag.SECTION);
public static HtmlTree SECTION(HtmlStyle styleClass) {
HtmlTree htmlTree = new HtmlTree(HtmlTag.SECTION);
htmlTree.setStyle(styleClass);
return htmlTree;
}
/**
* Generates a SECTION tag with role attribute and some content.
* Generates a SECTION tag with style class attribute and some content.
*
* @param styleClass the style class for the tag
* @param body content of the section tag
* @return an HtmlTree object for the SECTION tag
*/
public static HtmlTree SECTION(Content body) {
return new HtmlTree(HtmlTag.SECTION, nullCheck(body));
public static HtmlTree SECTION(HtmlStyle styleClass, Content body) {
HtmlTree htmlTree = new HtmlTree(HtmlTag.SECTION, nullCheck(body));
if (styleClass != null) {
htmlTree.setStyle(styleClass);
}
return htmlTree;
}
/**

View File

@ -935,11 +935,10 @@ public class Navigation {
String reset = "reset";
HtmlTree inputText = HtmlTree.INPUT("text", searchValueId, searchValueId);
HtmlTree inputReset = HtmlTree.INPUT(reset, reset, reset);
HtmlTree liInput = HtmlTree.LI(HtmlTree.LABEL(searchValueId, searchLabel));
liInput.add(inputText);
liInput.add(inputReset);
HtmlTree ulSearch = HtmlTree.UL(HtmlStyle.navListSearch, liInput);
tree.add(ulSearch);
HtmlTree searchDiv = HtmlTree.DIV(HtmlStyle.navListSearch, HtmlTree.LABEL(searchValueId, searchLabel));
searchDiv.add(inputText);
searchDiv.add(inputReset);
tree.add(searchDiv);
}
private void addFixedNavScript(Content tree) {

View File

@ -62,10 +62,8 @@ public interface AnnotationTypeFieldWriter {
* Add the annotation type details tree header.
*
* @param typeElement the annotation type being documented
* @param memberDetailsTree the content tree representing member details
*/
public void addAnnotationDetailsTreeHeader(TypeElement typeElement,
Content memberDetailsTree);
public Content getAnnotationDetailsTreeHeader(TypeElement typeElement);
/**
* Get the annotation type documentation tree header.
@ -79,10 +77,11 @@ public interface AnnotationTypeFieldWriter {
/**
* Get the annotation type details tree.
*
* @param annotationDetailsTreeHeader the content tree representing annotation type details header
* @param annotationDetailsTree the content tree representing annotation type details
* @return content tree for the annotation type details
*/
public Content getAnnotationDetails(Content annotationDetailsTree);
public Content getAnnotationDetails(Content annotationDetailsTreeHeader, Content annotationDetailsTree);
/**
* Get the annotation type documentation.

View File

@ -61,10 +61,8 @@ public interface AnnotationTypeRequiredMemberWriter {
* Add the annotation type details tree header.
*
* @param typeElement the annotation type being documented
* @param memberDetailsTree the content tree representing member details
*/
public void addAnnotationDetailsTreeHeader(TypeElement typeElement,
Content memberDetailsTree);
public Content getAnnotationDetailsTreeHeader(TypeElement typeElement);
/**
* Get the annotation type documentation tree header.
@ -79,10 +77,11 @@ public interface AnnotationTypeRequiredMemberWriter {
/**
* Get the annotation type details tree.
*
* @param annotationDetailsTreeHeader the content tree representing annotation type details header
* @param annotationDetailsTree the content tree representing annotation type details
* @return content tree for the annotation type details
*/
public Content getAnnotationDetails(Content annotationDetailsTree);
public Content getAnnotationDetails(Content annotationDetailsTreeHeader, Content annotationDetailsTree);
/**
* Get the annotation type documentation.

View File

@ -99,10 +99,11 @@ public interface ConstructorWriter {
/**
* Get the constructor details tree.
*
* memberDetailsTreeHeader the content tree representing member details header
* @param memberDetailsTree the content tree representing member details
* @return content tree for the constructor details
*/
public Content getConstructorDetails(Content memberDetailsTree);
public Content getConstructorDetails(Content memberDetailsTreeHeader, Content memberDetailsTree);
/**
* Get the constructor documentation.
@ -119,4 +120,11 @@ public interface ConstructorWriter {
* @param foundNonPubConstructor true if we found a non public constructor.
*/
public void setFoundNonPubConstructor(boolean foundNonPubConstructor);
/**
* Gets the member header tree.
*
* @return a content tree for the member header
*/
public Content getMemberTreeHeader();
}

View File

@ -102,7 +102,7 @@ public interface EnumConstantWriter {
* @param memberDetailsTree the content tree representing member details
* @return content tree for the enum constant details
*/
public Content getEnumConstantsDetails(Content memberDetailsTree);
public Content getEnumConstantsDetails(Content memberDetailsTreeHeader, Content memberDetailsTree);
/**
* Get the enum constants documentation.
@ -112,4 +112,11 @@ public interface EnumConstantWriter {
* @return content tree for the enum constants documentation
*/
public Content getEnumConstants(Content enumConstantsTree, boolean isLastContent);
/**
* Gets the member header tree.
*
* @return a content tree for the member header
*/
public Content getMemberTreeHeader();
}

View File

@ -100,10 +100,11 @@ public interface FieldWriter {
/**
* Get the field details tree.
*
* @param memberDetailsTreeHeader the content tree representing member details tree header
* @param memberDetailsTree the content tree representing member details
* @return content tree for the field details
*/
public Content getFieldDetails(Content memberDetailsTree);
public Content getFieldDetails(Content memberDetailsTreeHeader, Content memberDetailsTree);
/**
* Get the field documentation.
@ -113,4 +114,11 @@ public interface FieldWriter {
* @return content tree for the field documentation
*/
public Content getFieldDoc(Content fieldDocTree, boolean isLastContent);
/**
* Gets the member header tree.
*
* @return a content tree for the member header
*/
public Content getMemberTreeHeader();
}

View File

@ -101,10 +101,11 @@ public interface MethodWriter {
/**
* Get the method details tree.
*
* @param methodDetailsTreeHeader the content tree representing method details header
* @param methodDetailsTree the content tree representing method details
* @return content tree for the method details
*/
public Content getMethodDetails(Content methodDetailsTree);
public Content getMethodDetails(Content methodDetailsTreeHeader, Content methodDetailsTree);
/**
* Get the method documentation.
@ -114,4 +115,11 @@ public interface MethodWriter {
* @return content tree for the method documentation
*/
public Content getMethodDoc(Content methodDocTree, boolean isLastContent);
/**
* Gets the member header tree.
*
* @return a content tree for the member header
*/
public Content getMemberTreeHeader();
}

View File

@ -163,4 +163,11 @@ public interface PackageSummaryWriter {
*/
public abstract void printDocument(Content contentTree) throws DocFileIOException;
/**
* Gets the package summary tree.
* @param summaryContentTree the content tree representing the package summary
* @return a content tree for the package summary
*/
public abstract Content getPackageSummary(Content summaryContentTree);
}

View File

@ -99,10 +99,11 @@ public interface PropertyWriter {
/**
* Get the property details tree.
*
* @param memberDetailsTreeHeader the content tree representing member details header
* @param memberDetailsTree the content tree representing member details
* @return content tree for the property details
*/
public Content getPropertyDetails(Content memberDetailsTree);
public Content getPropertyDetails(Content memberDetailsTreeHeader, Content memberDetailsTree);
/**
* Get the property documentation.
@ -112,4 +113,11 @@ public interface PropertyWriter {
* @return content tree for the property documentation
*/
public Content getPropertyDoc(Content propertyDocTree, boolean isLastContent);
/**
* Gets the member header tree.
*
* @return a content tree for the member header
*/
public Content getMemberTreeHeader();
}

View File

@ -162,6 +162,14 @@ public interface SerializedFormWriter {
*/
public abstract void printDocument(Content serializedTree) throws DocFileIOException;
/**
* Gets the member tree.
*
* @param contentTree the tree used to generate the complete member tree
* @return a content tree for the member
*/
public Content getMemberTree(Content contentTree);
/**
* Write the serialized form for a given field.
*/

View File

@ -28,6 +28,7 @@ package jdk.javadoc.internal.doclets.toolkit.builders;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.DocFilesHandler;
@ -149,8 +150,7 @@ public class AnnotationTypeBuilder extends AbstractBuilder {
*/
protected void buildAnnotationTypeInfo(Content annotationContentTree)
throws DocletException {
Content annotationInfoTree = writer.getAnnotationInfoTreeHeader();
Content annotationInfoTree = new ContentBuilder();
buildAnnotationTypeSignature(annotationInfoTree);
buildDeprecationInfo(annotationInfoTree);
buildAnnotationTypeDescription(annotationInfoTree);

View File

@ -139,12 +139,12 @@ public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder {
}
if (hasMembersToDocument()) {
writer.addAnnotationFieldDetailsMarker(memberDetailsTree);
Content annotationDetailsTreeHeader = writer.getAnnotationDetailsTreeHeader(typeElement);
Content detailsTree = writer.getMemberTreeHeader();
Element lastElement = members.get(members.size() - 1);
for (Element member : members) {
currentMember = member;
Content detailsTree = writer.getMemberTreeHeader();
writer.addAnnotationDetailsTreeHeader(typeElement, detailsTree);
Content annotationDocTree = writer.getAnnotationDocTreeHeader(currentMember,
detailsTree);
@ -155,8 +155,8 @@ public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder {
detailsTree.add(writer.getAnnotationDoc(
annotationDocTree, currentMember == lastElement));
memberDetailsTree.add(writer.getAnnotationDetails(detailsTree));
}
memberDetailsTree.add(writer.getAnnotationDetails(annotationDetailsTreeHeader, detailsTree));
}
}

View File

@ -142,11 +142,11 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder {
}
if (hasMembersToDocument()) {
writer.addAnnotationDetailsMarker(memberDetailsTree);
Content annotationDetailsTreeHeader = writer.getAnnotationDetailsTreeHeader(typeElement);
Content detailsTree = writer.getMemberTreeHeader();
Element lastMember = members.get((members.size() - 1));
for (Element member : members) {
currentMember = member;
Content detailsTree = writer.getMemberTreeHeader();
writer.addAnnotationDetailsTreeHeader(typeElement, detailsTree);
Content annotationDocTree = writer.getAnnotationDocTreeHeader(
currentMember, detailsTree);
@ -154,8 +154,8 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder {
detailsTree.add(writer.getAnnotationDoc(
annotationDocTree, currentMember == lastMember));
memberDetailsTree.add(writer.getAnnotationDetails(detailsTree));
}
memberDetailsTree.add(writer.getAnnotationDetails(annotationDetailsTreeHeader, detailsTree));
}
}

View File

@ -28,6 +28,7 @@ package jdk.javadoc.internal.doclets.toolkit.builders;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.toolkit.ClassWriter;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.DocFilesHandler;
@ -166,8 +167,7 @@ public class ClassBuilder extends AbstractBuilder {
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildClassInfo(Content classContentTree) throws DocletException {
Content classInfoTree = writer.getClassInfoTreeHeader();
Content classInfoTree = new ContentBuilder();
buildTypeParamInfo(classInfoTree);
buildSuperInterfacesInfo(classInfoTree);
buildImplementedInterfacesInfo(classInfoTree);

View File

@ -135,8 +135,9 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
return;
}
if (hasMembersToDocument()) {
Content constructorDetailsTree = writer.getConstructorDetailsTreeHeader(typeElement,
Content constructorDetailsTreeHeader = writer.getConstructorDetailsTreeHeader(typeElement,
memberDetailsTree);
Content constructorDetailsTree = writer.getMemberTreeHeader();
Element lastElement = constructors.get(constructors.size() - 1);
for (Element contructor : constructors) {
@ -152,7 +153,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
currentConstructor == lastElement));
}
memberDetailsTree.add(
writer.getConstructorDetails(constructorDetailsTree));
writer.getConstructorDetails(constructorDetailsTreeHeader, constructorDetailsTree));
}
}

View File

@ -123,8 +123,9 @@ public class EnumConstantBuilder extends AbstractMemberBuilder {
return;
}
if (hasMembersToDocument()) {
Content enumConstantsDetailsTree = writer.getEnumConstantsDetailsTreeHeader(typeElement,
Content enumConstantsDetailsTreeHeader = writer.getEnumConstantsDetailsTreeHeader(typeElement,
memberDetailsTree);
Content enumConstantsDetailsTree = writer.getMemberTreeHeader();
Element lastElement = enumConstants.get(enumConstants.size() - 1);
for (Element enumConstant : enumConstants) {
currentElement = (VariableElement)enumConstant;
@ -140,7 +141,7 @@ public class EnumConstantBuilder extends AbstractMemberBuilder {
enumConstantsTree, currentElement == lastElement));
}
memberDetailsTree.add(
writer.getEnumConstantsDetails(enumConstantsDetailsTree));
writer.getEnumConstantsDetails(enumConstantsDetailsTreeHeader, enumConstantsDetailsTree));
}
}

View File

@ -125,7 +125,8 @@ public class FieldBuilder extends AbstractMemberBuilder {
return;
}
if (!fields.isEmpty()) {
Content fieldDetailsTree = writer.getFieldDetailsTreeHeader(typeElement, memberDetailsTree);
Content fieldDetailsTreeHeader = writer.getFieldDetailsTreeHeader(typeElement, memberDetailsTree);
Content fieldDetailsTree = writer.getMemberTreeHeader();
Element lastElement = fields.get(fields.size() - 1);
for (Element element : fields) {
@ -141,7 +142,7 @@ public class FieldBuilder extends AbstractMemberBuilder {
fieldDocTree, currentElement == lastElement));
}
memberDetailsTree.add(
writer.getFieldDetails(fieldDetailsTree));
writer.getFieldDetails(fieldDetailsTreeHeader, fieldDetailsTree));
}
}

View File

@ -465,7 +465,7 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
Content linksTree = writer.getInheritedSummaryLinksTree();
addSummaryFootNote(inheritedClass, inheritedMembers, linksTree, writer);
inheritedTree.add(linksTree);
summaryTreeList.add(writer.getMemberTree(inheritedTree));
summaryTreeList.add(inheritedTree);
}
}
}

View File

@ -126,8 +126,9 @@ public class MethodBuilder extends AbstractMemberBuilder {
return;
}
if (hasMembersToDocument()) {
Content methodDetailsTree = writer.getMethodDetailsTreeHeader(typeElement,
Content methodDetailsTreeHeader = writer.getMethodDetailsTreeHeader(typeElement,
memberDetailsTree);
Content methodDetailsTree = writer.getMemberTreeHeader();
Element lastElement = methods.get(methods.size() - 1);
for (Element method : methods) {
@ -142,7 +143,7 @@ public class MethodBuilder extends AbstractMemberBuilder {
methodDetailsTree.add(writer.getMethodDoc(
methodDocTree, currentMethod == lastElement));
}
memberDetailsTree.add(writer.getMethodDetails(methodDetailsTree));
memberDetailsTree.add(writer.getMethodDetails(methodDetailsTreeHeader, methodDetailsTree));
}
}

View File

@ -163,7 +163,7 @@ public class PackageSummaryBuilder extends AbstractBuilder {
buildErrorSummary(summaryContentTree);
buildAnnotationTypeSummary(summaryContentTree);
packageContentTree.add(summaryContentTree);
packageContentTree.add(packageWriter.getPackageSummary(summaryContentTree));
}
/**

View File

@ -125,8 +125,9 @@ public class PropertyBuilder extends AbstractMemberBuilder {
return;
}
if (hasMembersToDocument()) {
Content propertyDetailsTree = writer.getPropertyDetailsTreeHeader(typeElement,
Content propertyDetailsTreeHeader = writer.getPropertyDetailsTreeHeader(typeElement,
memberDetailsTree);
Content propertyDetailsTree = writer.getMemberTreeHeader();
Element lastElement = properties.get(properties.size() - 1);
for (Element property : properties) {
currentProperty = (ExecutableElement)property;
@ -141,7 +142,7 @@ public class PropertyBuilder extends AbstractMemberBuilder {
propertyDocTree, currentProperty == lastElement));
}
memberDetailsTree.add(
writer.getPropertyDetails(propertyDetailsTree));
writer.getPropertyDetails(propertyDetailsTreeHeader, propertyDetailsTree));
}
}

View File

@ -232,7 +232,7 @@ public class SerializedFormBuilder extends AbstractBuilder {
buildSerialUIDInfo(classTree);
buildClassContent(classTree);
classSerializedTree.add(classTree);
classSerializedTree.add(writer.getMemberTree(classTree));
}
}
packageSerializedTree.add(classSerializedTree);

View File

@ -207,18 +207,13 @@ ul.navList li{
padding: 5px 6px;
text-transform:uppercase;
}
ul.navListSearch {
.subNav .navListSearch {
float:right;
margin:0 0 0 0;
padding:0;
padding:5px 6px;
clear:none;
}
ul.navListSearch li {
list-style:none;
float:right;
padding: 5px 6px;
text-transform:uppercase;
}
ul.navListSearch li label {
.navListSearch label {
position:relative;
right:-16px;
}
@ -304,7 +299,8 @@ body.module-declaration .blockList h2 {
margin:15px 0;
}
body.class-declaration .summary h3,
body.class-declaration .details h3 {
body.class-declaration .details h3,
body.class-declaration .summary .inheritedList h2 {
background-color:#dee3e9;
border:1px solid #d0d9e0;
margin:0 0 6px -8px;
@ -385,32 +381,11 @@ ul.blockList, ul.blockListLast {
margin:10px 0 10px 0;
padding:0;
}
ul.blockList li.blockList, ul.blockListLast li.blockList {
ul.blockList li.blockList, ul.blockList li.blockListLast {
list-style:none;
margin-bottom:15px;
line-height:1.4;
}
ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList {
padding:0px 20px 5px 10px;
border:1px solid #ededed;
background-color:#f8f8f8;
}
ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList {
padding:0 0 5px 8px;
background-color:#ffffff;
border:none;
}
ul.blockList ul.blockList ul.blockList ul.blockList li.blockList {
margin-left:0;
padding-left:0;
padding-bottom:15px;
border:none;
}
ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast {
list-style:none;
border-bottom:none;
padding-bottom:0;
}
table tr td dl, table tr td dl dt, table tr td dl dd {
margin-top:0;
margin-bottom:1px;
@ -787,6 +762,23 @@ ul.ui-autocomplete li {
.methodSignature {
white-space:normal;
}
.inheritedList {
margin: 10px 0 10px 0;
}
section.description {
line-height: 1.4;
}
.summary section[class$="Summary"], .details section[class$="Details"],
.classUses .detail, .serializedClassDetails {
padding: 0px 20px 5px 10px;
border: 1px solid #ededed;
background-color: #f8f8f8;
}
.inheritedList, section[class$="Details"] .detail {
padding:0 0 5px 8px;
background-color:#ffffff;
border:none;
}
/*
* Styles for user-provided tables.

View File

@ -62,6 +62,9 @@ public class TestAnnotationTypes extends JavadocTester {
+ "</code></th>",
"<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->",
"<h3>DEFAULT_NAME</h3>\n"
+ "<a id=\"DEFAULT_NAME\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<pre>static final&nbsp;java."
+ "lang.String&nbsp;DEFAULT_NAME</pre>");
@ -74,17 +77,20 @@ public class TestAnnotationTypes extends JavadocTester {
checkOutput("pkg/AnnotationType.html", true,
"<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->",
"<ul class=\"blockList\">",
"<li class=\"blockList\"><a id=\"annotation.type.element.detail\">",
"<li class=\"blockList\">",
"<section class=\"memberDetails\">",
"<h2>Element Detail</h2>",
"<a id=\"annotation.type.element.detail\">",
"<!-- -->",
"</a>",
"<h2>Element Detail</h2>",
"<ul class=\"blockList\">",
"<li class=\"blockListLast\">",
"<section class=\"detail\">",
"<h3>value</h3>",
"<a id=\"value()\">",
"<!-- -->",
"</a>",
"<ul class=\"blockListLast\">",
"<li class=\"blockList\">",
"<h3>value</h3>",
"<pre>int&nbsp;value</pre>" );
"<pre>int&nbsp;value</pre>");
checkOutput("pkg/AnnotationType.html", false,
"<HR>\n\n"

View File

@ -68,10 +68,11 @@ public class TestHiddenTag extends JavadocTester {
"<code><a href=\"A.html#visibleMethod()\">visibleMethod</a></code>",
"<h2>Nested classes/interfaces inherited from class&nbsp;pkg1." +
"<a href=\"A.html\" title=\"class in pkg1\">A</a></h2>\n" +
"<code><a href=\"A.VisibleInner.html\" title=\"class in pkg1\">" +
"<a id=\"nested.classes.inherited.from.class.pkg1.A\">\n" +
"<!-- -->\n" +
"</a><code><a href=\"A.VisibleInner.html\" title=\"class in pkg1\">" +
"A.VisibleInner</a>, <a href=\"A.VisibleInnerExtendsInvisibleInner.html\" " +
"title=\"class in pkg1\">A.VisibleInnerExtendsInvisibleInner</a></code></li>\n" +
"</ul>");
"title=\"class in pkg1\">A.VisibleInnerExtendsInvisibleInner</a></code></div>\n");
checkOutput("pkg1/A.VisibleInner.html", false,
"../pkg1/A.VisibleInner.html#VisibleInner()",
@ -82,7 +83,7 @@ public class TestHiddenTag extends JavadocTester {
"<pre>public static class <span class=\"typeNameLabel\">" +
"A.VisibleInnerExtendsInvisibleInner</span>\n" +
"extends <a href=\"A.html\" title=\"class in pkg1\">A</a></pre>",
"<code><a href=\"A.html#visibleField\">visibleField</a></code></li>",
"<code><a href=\"A.html#visibleField\">visibleField</a></code>",
"<code><a href=\"A.html#visibleMethod()\">visibleMethod</a></code>");
checkOutput("pkg1/A.VisibleInnerExtendsInvisibleInner.html", false,

View File

@ -375,10 +375,12 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
checkOutput("pkg1/C1.html", expectFound,
"<pre class=\"methodSignature\">public&nbsp;void&nbsp;readObject()\n" +
" throws java.io.IOException</pre>\n" +
"</section>\n" +
"</li>");
checkOutput("pkg1/C2.html", expectFound,
"<pre>public&nbsp;C2()</pre>\n" +
"</section>\n" +
"</li>");
checkOutput("pkg1/C1.ModalExclusionType.html", expectFound,
@ -386,6 +388,7 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
"static final&nbsp;<a href=\"C1.ModalExclusionType.html\" " +
"title=\"enum in pkg1\">C1.ModalExclusionType</a> " +
"APPLICATION_EXCLUDE</pre>\n" +
"</section>\n" +
"</li>");
checkOutput("serialized-form.html", expectFound,

View File

@ -109,7 +109,7 @@ public class TestHtmlTag extends JavadocTester {
checkOutput("pkg3/package-summary.html", true,
"<div class=\"contentContainer\">\n"
+ "<section><a id=\"package.description\">\n"
+ "<section class=\"packageDescription\"><a id=\"package.description\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<div class=\"block\"><p>This is the first line. Note the newlines before the &lt;p&gt; is relevant.</div>\n"

View File

@ -100,7 +100,7 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section><a id=\"package.description\">\n"
"<section class=\"packageDescription\"><a id=\"package.description\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<div class=\"block\">Test package.</div>",
@ -110,6 +110,7 @@ public class TestHtmlVersion extends JavadocTester {
// No package description
checkOutput("pkg1/package-summary.html", true,
"<div class=\"contentContainer\">\n"
+ "<section class=\"summary\">\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\">\n"
+ "<div class=\"typeSummary\">\n<table>\n"
@ -129,13 +130,13 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section>\n"
"<section class=\"hierarchy\">\n"
+ "<h2 title=\"Class Hierarchy\">Class Hierarchy</h2>",
"<section>\n"
"<section class=\"hierarchy\">\n"
+ "<h2 title=\"Interface Hierarchy\">Interface Hierarchy</h2>",
"<section>\n"
"<section class=\"hierarchy\">\n"
+ "<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>",
"<section>\n"
"<section class=\"hierarchy\">\n"
+ "<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
@ -173,9 +174,9 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section>\n"
"<section class=\"packages\">\n"
+ "<h2 title=\"Contents\">Contents</h2>\n",
"<section>\n"
"<section class=\"constantsSummary\">\n"
+ "<h2 title=\"pkg\">pkg.*</h2>\n",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
@ -212,7 +213,7 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section>\n"
"<section class=\"serializedPackageContainer\">\n"
+ "<h2 title=\"Package\">Package&nbsp;pkg</h2>\n",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
@ -232,13 +233,13 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section>\n"
"<section class=\"hierarchy\">\n"
+ "<h2 title=\"Class Hierarchy\">Class Hierarchy</h2>\n",
"<section>\n"
"<section class=\"hierarchy\">\n"
+ "<h2 title=\"Interface Hierarchy\">Interface Hierarchy</h2>\n",
"<section>\n"
"<section class=\"hierarchy\">\n"
+ "<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>\n",
"<section>\n"
"<section class=\"hierarchy\">\n"
+ "<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>\n",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
@ -280,11 +281,11 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section>\n"
"<section class=\"helpSection\">\n"
+ "<h2>Overview</h2>\n",
"<section>\n"
"<section class=\"helpSection\">\n"
+ "<h2>Package</h2>\n",
"<section>\n"
"<section class=\"helpSection\">\n"
+ "<h2>Class or Interface</h2>\n",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
@ -303,51 +304,40 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"nested.class.summary\">\n"
"<section class=\"nestedClassSummary\"><a id=\"nested.class.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Nested Class Summary</h2>\n"
+ "<div class=\"memberSummary\">\n<table>",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"field.summary\">\n"
"<section class=\"fieldSummary\"><a id=\"field.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Field Summary</h2>\n"
+ "<div class=\"memberSummary\">\n<table>",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"constructor.summary\">\n"
"<section class=\"constructorSummary\"><a id=\"constructor.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Constructor Summary</h2>\n"
+ "<div class=\"memberSummary\">\n<table>",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"method.summary\">\n"
"<section class=\"methodSummary\"><a id=\"method.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Method Summary</h2>",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"field.detail\">\n"
"<section class=\"fieldDetails\">\n"
+ "<h2>Field Detail</h2>\n"
+ "<a id=\"field.detail\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Field Detail</h2>",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"constructor.detail\">\n"
+ "</a>",
"<section class=\"constructorDetails\">\n"
+ "<h2>Constructor Detail</h2>\n"
+ "<a id=\"constructor.detail\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Constructor Detail</h2>",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"method.detail\">\n"
+ "</a>",
"<section class=\"methodDetails\">\n"
+ "<h2>Method Detail</h2>\n"
+ "<a id=\"method.detail\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Method Detail</h2>",
+ "</a>",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
+ "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
@ -365,34 +355,28 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"enum.constant.summary\">\n"
"<section class=\"constantsSummary\"><a id=\"enum.constant.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Enum Constant Summary</h2>\n"
+ "<div class=\"memberSummary\">\n",
"<table aria-labelledby=\"t0\">\n",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"method.summary\">\n"
"<section class=\"methodSummary\"><a id=\"method.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Method Summary</h2>\n"
+ "<div class=\"memberSummary\">\n",
"<table aria-labelledby=\"t0\">",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"enum.constant.detail\">\n"
"<section class=\"constantDetails\">\n"
+ "<h2>Enum Constant Detail</h2>\n"
+ "<a id=\"enum.constant.detail\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Enum Constant Detail</h2>",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"method.detail\">\n"
+ "</a>\n",
"<section class=\"methodDetails\">\n"
+ "<h2>Method Detail</h2>\n"
+ "<a id=\"method.detail\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Method Detail</h2>",
+ "</a>\n",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
+ "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
@ -410,20 +394,17 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"method.summary\">\n"
"<section class=\"methodSummary\"><a id=\"method.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Method Summary</h2>\n"
+ "<div class=\"memberSummary\">\n",
"<table aria-labelledby=\"t0\">\n",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"method.detail\">\n"
"<section class=\"methodDetails\">\n"
+ "<h2>Method Detail</h2>\n"
+ "<a id=\"method.detail\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Method Detail</h2>",
+ "</a>\n",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
+ "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
@ -441,18 +422,15 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"constructor.summary\">\n"
"<section class=\"constructorSummary\"><a id=\"constructor.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Constructor Summary</h2>",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"constructor.detail\">\n"
"<section class=\"constructorDetails\">\n"
+ "<h2>Constructor Detail</h2>\n"
+ "<a id=\"constructor.detail\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Constructor Detail</h2>",
+ "</a>\n",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
+ "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
@ -470,18 +448,15 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"constructor.summary\">\n"
"<section class=\"constructorSummary\"><a id=\"constructor.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Constructor Summary</h2>",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"constructor.detail\">\n"
"<section class=\"constructorDetails\">\n"
+ "<h2>Constructor Detail</h2>\n"
+ "<a id=\"constructor.detail\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Constructor Detail</h2>",
+ "</a>\n",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
+ "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
@ -499,26 +474,21 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"annotation.type.required.element.summary\">\n"
"<section class=\"memberSummary\"><a id=\"annotation.type.required.element.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Required Element Summary</h2>\n"
+ "<div class=\"memberSummary\">\n<table>",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"annotation.type.optional.element.summary\">\n"
"<section class=\"memberSummary\"><a id=\"annotation.type.optional.element.summary\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Optional Element Summary</h2>\n"
+ "<div class=\"memberSummary\">\n<table>",
"<section>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\"><a id=\"annotation.type.element.detail\">\n"
"<section class=\"memberDetails\">\n"
+ "<h2>Element Detail</h2>\n"
+ "<a id=\"annotation.type.element.detail\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Element Detail</h2>",
+ "</a>\n",
"<footer role=\"contentinfo\">\n"
+ "<nav role=\"navigation\">\n"
+ "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
@ -537,7 +507,7 @@ public class TestHtmlVersion extends JavadocTester {
"<main role=\"main\">\n"
+ "<div class=\"header\">",
"<div class=\"useSummary\">\n<table>",
"<section><a id=\"pkg\">\n"
"<section class=\"detail\"><a id=\"pkg\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h2>Uses of <a href=\"../RegClass.html\" title=\"class in pkg1\">RegClass</a> in <a href=\"../../pkg/package-summary.html\">pkg</a></h2>\n"
@ -569,7 +539,7 @@ public class TestHtmlVersion extends JavadocTester {
+ "<!-- -->\n"
+ "</a>",
"<section>\n"
+ "<h2 title=\"Package pkg Description\">Package pkg Description</h2>\n",
+ "<h2 title=\"PackagAnotherClass.ModalExclusionType.htmle pkg Description\">Package pkg Description</h2>\n",
"<div class=\"typeSummary\">\n<table summary=\"Interface Summary table, listing interfaces, and an explanation\">",
"<div class=\"typeSummary\">\n<table summary=\"Class Summary table, listing classes, and an explanation\">",
"<div class=\"typeSummary\">\n<table summary=\"Enum Summary table, listing enums, and an explanation\">",

View File

@ -132,6 +132,9 @@ public class TestInterface extends JavadocTester {
checkOutput("pkg/ClassWithStaticMembers.html", true,
"<h3>f</h3>\n"
+ "<a id=\"f\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<pre>public static&nbsp;int f</pre>\n"
+ "<div class=\"block\">A hider field</div>",
@ -143,6 +146,9 @@ public class TestInterface extends JavadocTester {
+ "</td>\n",
"<h3>staticMethod</h3>\n"
+ "<a id=\"staticMethod()\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<pre class=\"methodSignature\">public static&nbsp;void&nbsp;staticMethod()</pre>\n"
+ "<div class=\"block\"><span class=\"descfrmTypeLabel\">"
+ "Description copied from interface:&nbsp;<code>"
@ -185,7 +191,9 @@ public class TestInterface extends JavadocTester {
// Ensure the correct type parameters are displayed correctly
"<h2>Nested classes/interfaces inherited from interface&nbsp;pkg2."
+ "<a href=\"Spliterator.html\" title=\"interface in pkg2\">Spliterator</a></h2>\n"
+ "<code><a href=\"Spliterator.OfDouble.html\" title=\"interface in pkg2\">"
+ "<a id=\"nested.classes.inherited.from.class.pkg2.Spliterator\">\n"
+ "<!-- -->\n"
+ "</a><code><a href=\"Spliterator.OfDouble.html\" title=\"interface in pkg2\">"
+ "Spliterator.OfDouble</a>, <a href=\"Spliterator.OfInt.html\" "
+ "title=\"interface in pkg2\">Spliterator.OfInt</a>&lt;"
+ "<a href=\"Spliterator.OfInt.html\" title=\"type parameter in Spliterator.OfInt\">"

View File

@ -87,13 +87,22 @@ public class TestJavaFX extends JavadocTester {
+ "<td class=\"colLast\">\n"
+ "<div class=\"block\">Defines if paused.</div>",
"<h3>paused</h3>\n"
+ "<a id=\"pausedProperty\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<pre>public final&nbsp;<a href=\"C.BooleanProperty.html\" "
+ "title=\"class in pkg1\">C.BooleanProperty</a> pausedProperty</pre>\n"
+ "<div class=\"block\">Defines if paused. The second line.</div>",
"<h3>isPaused</h3>\n"
+ "<a id=\"isPaused()\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<pre class=\"methodSignature\">public final&nbsp;double&nbsp;isPaused()</pre>\n"
+ "<div class=\"block\">Gets the value of the property paused.</div>",
"<h3>setPaused</h3>\n"
+ "<a id=\"setPaused(boolean)\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<pre class=\"methodSignature\">public final&nbsp;void&nbsp;setPaused&#8203;(boolean&nbsp;value)</pre>\n"
+ "<div class=\"block\">Sets the value of the property paused.</div>\n"
+ "<dl>\n"
@ -102,6 +111,9 @@ public class TestJavaFX extends JavadocTester {
+ "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n"
+ "<dd>false</dd>",
"<h3>isPaused</h3>\n"
+ "<a id=\"isPaused()\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<pre class=\"methodSignature\">public final&nbsp;double&nbsp;isPaused()</pre>\n"
+ "<div class=\"block\">Gets the value of the property paused.</div>\n"
+ "<dl>\n"
@ -110,12 +122,18 @@ public class TestJavaFX extends JavadocTester {
+ "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n"
+ "<dd>false</dd>",
"<h3>rate</h3>\n"
+ "<a id=\"rateProperty\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<pre>public final&nbsp;<a href=\"C.DoubleProperty.html\" "
+ "title=\"class in pkg1\">C.DoubleProperty</a> rateProperty</pre>\n"
+ "<div class=\"block\">Defines the direction/speed at which the "
+ "<code>Timeline</code> is expected to\n"
+ " be played. This is the second line.</div>",
"<h3>setRate</h3>\n"
+ "<a id=\"setRate(double)\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<pre class=\"methodSignature\">public final&nbsp;void&nbsp;setRate&#8203;(double&nbsp;value)</pre>\n"
+ "<div class=\"block\">Sets the value of the property rate.</div>\n"
+ "<dl>\n"
@ -127,6 +145,9 @@ public class TestJavaFX extends JavadocTester {
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>JavaFX 8.0</dd>",
"<h3>getRate</h3>\n"
+ "<a id=\"getRate()\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<pre class=\"methodSignature\">public final&nbsp;double&nbsp;getRate()</pre>\n"
+ "<div class=\"block\">Gets the value of the property rate.</div>\n"
+ "<dl>\n"
@ -170,8 +191,10 @@ public class TestJavaFX extends JavadocTester {
checkOutput("pkg1/D.html", true,
"<h3>Properties inherited from class&nbsp;pkg1."
+ "<a href=\"C.html\" title=\"class in pkg1\">C</a></h3>\n"
+ "<code><a href=\"C.html#pausedProperty\">"
+ "paused</a>, <a href=\"C.html#rateProperty\">rate</a></code></li>");
+ "<a id=\"properties.inherited.from.class.pkg1.C\">\n"
+ "<!-- -->\n"
+ "</a><code><a href=\"C.html#pausedProperty\">"
+ "paused</a>, <a href=\"C.html#rateProperty\">rate</a></code></div>");
checkOutput("pkg1/D.html", false, "shouldNotAppear");
}
@ -191,36 +214,40 @@ public class TestJavaFX extends JavadocTester {
checkExit(Exit.OK);
checkOutput("pkg2/Test.html", true,
"<h2>Property Detail</h2>\n"
+ "<a id=\"property.detail\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\">\n"
+ "<section class=\"detail\">\n"
+ "<h3>beta</h3>\n"
+ "<a id=\"betaProperty\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\">\n"
+ "<h3>beta</h3>\n"
+ "<pre>public&nbsp;java.lang.Object betaProperty</pre>\n"
+ "</section>\n"
+ "</li>\n"
+ "</ul>\n"
+ "<li class=\"blockList\">\n"
+ "<section class=\"detail\">\n"
+ "<h3>gamma</h3>\n"
+ "<a id=\"gammaProperty\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\">\n"
+ "<h3>gamma</h3>\n"
+ "<pre>public final&nbsp;java.util.List&lt;java.lang.String&gt; gammaProperty</pre>\n"
+ "</section>\n"
+ "</li>\n"
+ "</ul>\n"
+ "<li class=\"blockListLast\">\n"
+ "<section class=\"detail\">\n"
+ "<h3>delta</h3>\n"
+ "<a id=\"deltaProperty\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<ul class=\"blockListLast\">\n"
+ "<li class=\"blockList\">\n"
+ "<h3>delta</h3>\n"
+ "<pre>public final&nbsp;java.util.List&lt;"
+ "java.util.Set&lt;? super java.lang.Object&gt;&gt; deltaProperty</pre>\n"
+ "</section>\n"
+ "</li>\n"
+ "</ul>\n"
+ "</li>\n"
+ "</ul>",
+ "</section>",
"<h2>Property Summary</h2>\n"
+ "<div class=\"memberSummary\">\n<table>\n"
+ "<caption><span>Properties</span><span class=\"tabEnd\">&nbsp;</span></caption>");

View File

@ -478,7 +478,7 @@ public class TestModules extends JavadocTester {
void checkHtml5Description(boolean found) {
checkOutput("moduleA/module-summary.html", found,
"<section>\n"
"<section class=\"moduleDescription\">\n"
+ "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
+ " This API element is subject to removal in a future version.</span>\n"
+ "<div class=\"deprecationComment\">This module is deprecated.</div>\n"
@ -490,7 +490,7 @@ public class TestModules extends JavadocTester {
+ "<div class=\"block\">This is a test description for the moduleA module with a Search "
+ "phrase <a id=\"searchphrase\" class=\"searchTagResult\">search phrase</a>.</div>");
checkOutput("moduleB/module-summary.html", found,
"<section>\n"
"<section class=\"moduleDescription\">\n"
+ "<!-- ============ MODULE DESCRIPTION =========== -->\n"
+ "<a id=\"module.description\">\n"
+ "<!-- -->\n"
@ -523,17 +523,17 @@ public class TestModules extends JavadocTester {
void checkHtml5NoDescription(boolean found) {
checkOutput("moduleA/module-summary.html", found,
"<div class=\"contentContainer\">\n"
+ "<section class=\"summary\">\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\">\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\">\n"
+ "<section class=\"packagesSummary\">\n"
+ "<!-- ============ PACKAGES SUMMARY =========== -->");
checkOutput("moduleB/module-summary.html", found,
"<div class=\"contentContainer\">\n"
+ "<section class=\"summary\">\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\">\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\">\n"
+ "<section class=\"packagesSummary\">\n"
+ "<!-- ============ PACKAGES SUMMARY =========== -->");
}

View File

@ -193,10 +193,18 @@ public class TestOptions extends JavadocTester {
"<pre>@Documented\npublic @interface <a href="
+ "\"../src-html/linksource/AnnotationTypeField.html#line.31\">"
+ "AnnotationTypeField</a></pre>",
"<h3>DEFAULT_NAME</h3>\n<pre>static final&nbsp;java.lang.String&nbsp;"
"<h3>DEFAULT_NAME</h3>\n"
+ "<a id=\"DEFAULT_NAME\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<pre>static final&nbsp;java.lang.String&nbsp;"
+ "<a href=\"../src-html/linksource/AnnotationTypeField.html#line.32\">"
+ "DEFAULT_NAME</a></pre>",
"<h3>name</h3>\n<pre>java.lang.String&nbsp;<a href="
"<h3>name</h3>\n"
+ "<a id=\"name()\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<pre>java.lang.String&nbsp;<a href="
+ "\"../src-html/linksource/AnnotationTypeField.html#line.34\">name</a></pre>");
checkOutput("src-html/linksource/AnnotationTypeField.html", true,

View File

@ -52,10 +52,13 @@ public class TestBadOverride extends JavadocTester {
checkExit(Exit.OK);
checkOutput("pkg4/Foo.html", true,
"<li class=\"blockList\">\n"
"<section class=\"detail\">\n"
+ "<h3>toString</h3>\n"
+ "<a id=\"toString()\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<pre class=\"methodSignature\">public&nbsp;void&nbsp;toString()</pre>\n"
+ "<div class=\"block\">Why can't I do this ?</div>\n"
+ "</li>");
+ "</section>");
}
}

View File

@ -381,8 +381,8 @@ public class TestSearch extends JavadocTester {
"<script type=\"text/javascript\" src=\"script-dir/jquery-ui.js\"></script>",
"var pathtoroot = \"./\";\n"
+ "loadScripts(document, 'script');",
"<ul class=\"navListSearch\">\n",
"<li><label for=\"search\">SEARCH:</label>\n"
"<div class=\"navListSearch\">",
"<label for=\"search\">SEARCH:</label>\n"
+ "<input type=\"text\" id=\"search\" value=\"search\" disabled=\"disabled\">\n"
+ "<input type=\"reset\" id=\"reset\" value=\"reset\" disabled=\"disabled\">\n");
checkOutput(fileName, true,

View File

@ -0,0 +1,323 @@
/*
* Copyright (c) 2019, 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 8219998
* @summary Eliminate inherently singleton lists
* @library /tools/lib ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.main
* jdk.javadoc/jdk.javadoc.internal.api
* jdk.javadoc/jdk.javadoc.internal.tool
* @build toolbox.ToolBox toolbox.JavacTask javadoc.tester.*
* @run main TestSingletonLists
*/
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import java.util.TreeMap;
import java.util.function.Function;
import javadoc.tester.HtmlChecker;
import javadoc.tester.JavadocTester;
import toolbox.ModuleBuilder;
import toolbox.ToolBox;
public class TestSingletonLists extends JavadocTester {
public static void main(String... args) throws Exception {
TestSingletonLists tester = new TestSingletonLists();
tester.runTests();
}
enum Index { SINGLE, SPLIT };
enum Source { PACKAGES, MODULES };
final ToolBox tb = new ToolBox();
public void runTests() throws Exception {
for (Source s : Source.values()) {
Path src = genSource(s);
for (Index i : Index.values()) {
List<String> args = new ArrayList<>();
args.add("-d");
args.add(String.format("out-%s-%s", s, i));
args.add("-use");
if (s != Source.MODULES) {
args.add("-linksource"); // broken, with modules: JDK-8219060
}
if (i == Index.SPLIT) {
args.add("-splitIndex");
}
if (s == Source.PACKAGES) {
args.add("-sourcepath");
args.add(src.toString());
args.add("p1");
args.add("p2");
args.add("p3");
} else {
args.add("--module-source-path");
args.add(src.toString());
args.add("--module");
args.add("mA,mB,mC");
}
javadoc(args.toArray(new String[args.size()]));
checkExit(Exit.OK);
checkLists();
}
}
printSummary();
}
Path genSource(Source s) throws IOException {
Path src = Path.of("src-" + s);
switch (s) {
case PACKAGES:
for (String p : new String[] { "1", "2", "3" }) {
tb.writeJavaFiles(src, genClasses("p" + p));
}
break;
case MODULES:
for (String m : new String[] { "A", "B", "C"}) {
ModuleBuilder mb = new ModuleBuilder(tb, "m" + m);
for (String p : new String[] { "1", "2", "3" } ) {
mb.exports("p" + m + p);
mb.classes(genClasses("p" + m + p));
}
mb.write(src);
}
break;
}
return src;
}
String[] genClasses(String pkg) {
List<String> list = new ArrayList<>();
list.add("package " + pkg + ";");
for (int i = 0; i < 3; i++) {
list.add(genClass(pkg, i));
list.add(genAnno(pkg, i));
list.add(genEnum(pkg, i));
}
return list.toArray(new String[list.size()]);
}
String genClass(String pkg, int index) {
String cn = (pkg + "c" + index).toUpperCase();
StringBuilder sb = new StringBuilder();
int pkgIndex = Character.getNumericValue(pkg.charAt(pkg.length()-1));
String pkgdependency = pkg.substring(0, pkg.length()-1) + (pkgIndex == 3 ? 1 : pkgIndex + 1);
String enumClassName = pkgdependency.toUpperCase() + "E" + index;
sb.append("package ").append(pkg).append(";\n")
.append("import " + pkgdependency + ".*;\n")
.append("public class ").append(cn).append(" {\n");
// fields
for (int f = 0; f < 3; f++) {
sb.append("public int f").append(f).append(";\n");
}
// constructors
for (int c = 0; c < 3; c++) {
sb.append("public ").append(cn).append("(");
for (int i = 0; i < c; i++) {
sb.append(i == 0 ? "" : ", ").append("int i").append(i);
}
sb.append(") { }\n");
}
// methods
for (int m = 0; m < 3; m++) {
sb.append("public void m").append(m).append("() { }\n");
}
sb.append("public void n(").append(enumClassName).append(" e){}");
sb.append("}\n");
return sb.toString();
}
String genAnno(String pkg, int index) {
String an = (pkg + "a" + index).toUpperCase();
StringBuilder sb = new StringBuilder();
sb.append("package ").append(pkg).append(";\n")
.append("public @interface ").append(an).append(" {\n");
// fields
for (int f = 0; f < 3; f++) {
sb.append("public static final int f").append(f).append(" = 0;\n");
}
// values
for (int v = 0; v < 6; v++) {
sb.append("public int v").append(v).append("()").append(v< 3 ? "" : " default " + v).append(";\n");
}
sb.append("}\n");
return sb.toString();
}
String genEnum(String pkg, int index) {
String en = (pkg + "e" + index).toUpperCase();
StringBuilder sb = new StringBuilder();
sb.append("package ").append(pkg).append(";\n")
.append("public enum ").append(en).append(" {\n");
// enum members
for (int e = 0; e < 3; e++) {
sb.append(e == 0 ? "" : ", ").append("E").append(e);
}
sb.append(";\n");
// fields
for (int f = 0; f < 3; f++) {
sb.append("public int f").append(f).append(";\n");
}
// methods
for (int m = 0; m < 3; m++) {
sb.append("public void m").append(m).append("() { }\n");
}
sb.append("}\n");
return sb.toString();
}
void checkLists() {
checking("Check lists");
ListChecker c = new ListChecker(out, this::readFile);
try {
c.checkDirectory(outputDir.toPath());
c.report();
int errors = c.getErrorCount();
if (errors == 0) {
passed("No list errors found");
} else {
failed(errors + " errors found when checking lists");
}
} catch (IOException e) {
failed("exception thrown when reading files: " + e);
}
}
/**
* A class to check the presence of singleton lists.
*/
public class ListChecker extends HtmlChecker {
private int listErrors;
private boolean inBody;
private boolean inNoScript;
private Stack<Map<String,Integer>> counts = new Stack<>();
private int regionErrors;
private String fileName;
private boolean inheritanceClass;
private List<String> excludeFiles = List.of("overview-tree.html","package-tree.html","module-summary.html");
ListChecker(PrintStream out, Function<Path,String> fileReader) {
super(out, fileReader);
}
protected int getErrorCount() {
return errors;
}
@Override
public void report() {
if (listErrors == 0) {
out.println("All lists OK");
} else {
out.println(listErrors + " list errors");
}
if (regionErrors == 0) {
out.println("All regions OK");
} else {
out.println(regionErrors + " errors in regions");
}
}
@Override
public void startFile(Path path) {
fileName = path.getFileName().toString();
}
@Override
public void endFile() {
}
@Override
public void docType(String doctype) {
}
@Override
public void startElement(String name, Map<String,String> attrs, boolean selfClosing) {
switch (name) {
case "ul": case "ol": case "dl":
counts.push(new TreeMap<>());
if (!attrs.isEmpty() && attrs.containsKey("class")
&& attrs.containsValue("inheritance")) {
inheritanceClass = true;
}
break;
case "li": case "dd": case "dt": {
Map<String, Integer> c = counts.peek();
c.put(name, 1 + c.computeIfAbsent(name, n -> 0));
break;
}
}
}
@Override
public void endElement(String name) {
switch (name) {
case "ul": case "ol": {
Map<String,Integer> c = counts.pop();
if (c.get("li") == 0) {
error(currFile, getLineNumber(), "empty list");
} else if (c.get("li") == 1 && fileName != null && !excludeFiles.contains(fileName)) {
if (!inheritanceClass) {
error(currFile, getLineNumber(), "singleton list");
} else {
inheritanceClass = false;
}
}
break;
}
case "dl": {
Map<String, Integer> c = counts.pop();
if (c.get("dd") == 0 || c.get("dt") == 0) {
error(currFile, getLineNumber(), "empty list");
}
/*if (c.get("dd") == 1 || c.get("dt") == 1) {
error(currFile, getLineNumber(), "singleton list");
}*/
break;
}
}
}
}
}

View File

@ -85,11 +85,14 @@ public class TestSummaryTag extends JavadocTester {
// make sure the second @summary's content is displayed correctly
checkOutput("p1/A.html", true,
"<li class=\"blockList\">\n"
"<section class=\"detail\">\n"
+ "<h3>m3</h3>\n"
+ "<a id=\"m3()\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<pre class=\"methodSignature\">public&nbsp;void&nbsp;m3()</pre>\n"
+ "<div class=\"block\">First sentence some text maybe second sentence.</div>\n"
+ "</li>\n"
+ "</section>\n"
);
checkOutput("p1/package-summary.html", true,

View File

@ -151,7 +151,7 @@ public class TestUseOption extends JavadocTester {
);
checkOutput("class-use/UsedInC.html", true,
"<li class=\"blockList\">\n"
+ "<section><a id=\"unnamed.package\">"
+ "<section class=\"detail\"><a id=\"unnamed.package\">"
);
checkOutput("package-use.html", true,
"<th class=\"colFirst\" scope=\"row\">"

View File

@ -48,7 +48,7 @@ public class A11yChecker extends HtmlChecker {
super(out, fileReader);
}
int getErrorCount() {
protected int getErrorCount() {
return errors;
}

View File

@ -43,15 +43,15 @@ public abstract class HtmlChecker extends HtmlParser {
protected int files;
protected int errors;
HtmlChecker(PrintStream out, Function<Path,String> fileReader) {
protected HtmlChecker(PrintStream out, Function<Path,String> fileReader) {
super(out, fileReader);
}
void checkDirectory(Path dir) throws IOException {
public void checkDirectory(Path dir) throws IOException {
checkFiles(List.of(dir), false, Collections.emptySet());
}
void checkFiles(List<Path> files, boolean skipSubdirs, Set<Path> excludeFiles) throws IOException {
public void checkFiles(List<Path> files, boolean skipSubdirs, Set<Path> excludeFiles) throws IOException {
for (Path file : files) {
Files.walkFileTree(file, new SimpleFileVisitor<Path>() {
int depth = 0;
@ -86,7 +86,7 @@ public abstract class HtmlChecker extends HtmlParser {
}
}
void checkFile(Path file) {
protected void checkFile(Path file) {
try {
currFile = file.toAbsolutePath().normalize();
read(file);
@ -96,9 +96,9 @@ public abstract class HtmlChecker extends HtmlParser {
}
}
abstract void report();
protected abstract void report();
int getErrorCount() {
protected int getErrorCount() {
return errors;
}

View File

@ -101,7 +101,7 @@ public abstract class HtmlParser {
}
int getLineNumber() {
protected int getLineNumber() {
return lineNumber;
}

View File

@ -772,7 +772,7 @@ public abstract class JavadocTester {
return readFile(new File(baseDir), fileName);
}
private String readFile(Path file) {
protected String readFile(Path file) {
File baseDir;
if (file.startsWith(outputDir.toPath())) {
baseDir = outputDir;