8149146: [javadoc] eliminate doclet.xml
authorjjg
Thu, 15 Jun 2017 10:55:35 -0700
changeset 45599 8bc3a019f948
parent 45507 e6d70017f5b9
child 45601 f0530afb3b91
8149146: [javadoc] eliminate doclet.xml Reviewed-by: ksrini, bpatel
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeRequiredMemberWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/BuilderFactory.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/LayoutParser.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/XMLNode.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclet.xml
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Thu Jun 15 10:55:35 2017 -0700
@@ -375,7 +375,7 @@
         Content li = HtmlTree.LI(contents.summaryLabel);
         li.addContent(Contents.SPACE);
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
-        MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
+        MemberSummaryBuilder memberSummaryBuilder =
                 configuration.getBuilderFactory().getMemberSummaryBuilder(this);
         Content liNavField = new HtmlTree(HtmlTag.LI);
         addNavSummaryLink(memberSummaryBuilder,
@@ -426,7 +426,7 @@
         Content li = HtmlTree.LI(contents.detailLabel);
         li.addContent(Contents.SPACE);
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
-        MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
+        MemberSummaryBuilder memberSummaryBuilder =
                 configuration.getBuilderFactory().getMemberSummaryBuilder(this);
         AbstractMemberWriter writerField =
                 ((AbstractMemberWriter) memberSummaryBuilder.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Thu Jun 15 10:55:35 2017 -0700
@@ -688,7 +688,7 @@
         Content li = HtmlTree.LI(contents.summaryLabel);
         li.addContent(Contents.SPACE);
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
-        MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
+        MemberSummaryBuilder memberSummaryBuilder =
                 configuration.getBuilderFactory().getMemberSummaryBuilder(this);
         for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.summarySet) {
             Content liNav = new HtmlTree(HtmlTag.LI);
@@ -724,7 +724,7 @@
         Content li = HtmlTree.LI(contents.detailLabel);
         li.addContent(Contents.SPACE);
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
-        MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
+        MemberSummaryBuilder memberSummaryBuilder =
                 configuration.getBuilderFactory().getMemberSummaryBuilder(this);
         for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.detailSet) {
             Content liNav = new HtmlTree(HtmlTag.LI);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeRequiredMemberWriter.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeRequiredMemberWriter.java	Thu Jun 15 10:55:35 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -25,10 +25,9 @@
 
 package jdk.javadoc.internal.doclets.toolkit;
 
-import java.io.*;
-
 import javax.lang.model.element.Element;
 import javax.lang.model.element.TypeElement;
+
 /**
  * The interface for writing annotation type required member output.
  *
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -25,28 +25,22 @@
 
 package jdk.javadoc.internal.doclets.toolkit.builders;
 
-import java.lang.reflect.*;
 import java.util.*;
 
 import javax.lang.model.element.PackageElement;
 
 import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
-import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.DocletException;
 import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.Resources;
-import jdk.javadoc.internal.doclets.toolkit.util.UncheckedDocletException;
-import jdk.javadoc.internal.doclets.toolkit.util.InternalException;
-import jdk.javadoc.internal.doclets.toolkit.util.SimpleDocletException;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 
-import static javax.tools.Diagnostic.Kind.*;
 
 /**
  * The superclass for all builders.  A builder is a class that provides
  * the structure and content of API documentation.  A builder is completely
  * doclet independent which means that any doclet can use builders to
- * construct documentation, as long as it impelements the appropriate
+ * construct documentation, as long as it implements the appropriate
  * writer interfaces.  For example, if a doclet wanted to use
  * {@link ConstantsSummaryBuilder} to build a constant summary, all it has to
  * do is implement the ConstantsSummaryWriter interface and pass it to the
@@ -74,17 +68,9 @@
          */
         final Set<PackageElement> containingPackagesSeen;
 
-        /**
-         * Shared parser for the builder XML file
-         */
-        final LayoutParser layoutParser;
-
-        Context(BaseConfiguration configuration,
-                Set<PackageElement> containingPackagesSeen,
-                LayoutParser layoutParser) {
+        Context(BaseConfiguration configuration, Set<PackageElement> containingPackagesSeen) {
             this.configuration = configuration;
             this.containingPackagesSeen = containingPackagesSeen;
-            this.layoutParser = layoutParser;
         }
     }
 
@@ -93,6 +79,7 @@
      */
     protected final BaseConfiguration configuration;
 
+    protected final BuilderFactory builderFactory;
     protected final Messages messages;
     protected final Resources resources;
     protected final Utils utils;
@@ -104,99 +91,23 @@
      */
     protected final Set<PackageElement> containingPackagesSeen;
 
-    protected final LayoutParser layoutParser;
-
-    /**
-     * True if we want to print debug output.
-     */
-    protected static final boolean DEBUG = false;
-
     /**
      * Construct a Builder.
      * @param c a context providing information used in this run of the doclet
      */
     public AbstractBuilder(Context c) {
         this.configuration = c.configuration;
+        this.builderFactory = configuration.getBuilderFactory();
         this.messages = configuration.getMessages();
         this.resources = configuration.getResources();
         this.utils = configuration.utils;
         this.containingPackagesSeen = c.containingPackagesSeen;
-        this.layoutParser = c.layoutParser;
     }
 
     /**
-     * Return the name of this builder.
-     *
-     * @return the name of the builder.
-     */
-    public abstract String getName();
-
-    /**
      * Build the documentation.
      *
      * @throws DocletException if there is a problem building the documentation
      */
     public abstract void build() throws DocletException;
-
-    /**
-     * Build the documentation, as specified by the given XML element.
-     *
-     * @param node the XML element that specifies which component to document.
-     * @param contentTree content tree to which the documentation will be added
-     * @throws DocletException if there is a problem building the documentation
-     */
-    protected void build(XMLNode node, Content contentTree) throws DocletException {
-        String component = node.name;
-        try {
-            String methodName = "build" + component;
-            if (DEBUG) {
-                configuration.reporter.print(ERROR,
-                        "DEBUG: " + getClass().getName() + "." + methodName);
-            }
-            Method method = getClass().getMethod(methodName, XMLNode.class, Content.class);
-            method.invoke(this, node, contentTree);
-
-        } catch (NoSuchMethodException e) {
-            // Use SimpleDocletException instead of InternalException because there is nothing
-            // informative about about the place the exception occurred, here in this method.
-            // The problem is either a misconfigured doclet.xml file or a missing method in the
-            // user-supplied(?) doclet
-            String message = resources.getText("doclet.builder.unknown.component", component);
-            throw new SimpleDocletException(message, e);
-
-        } catch (InvocationTargetException e) {
-            Throwable cause = e.getCause();
-            if (cause instanceof DocletException) {
-                throw (DocletException) cause;
-            } else if (cause instanceof UncheckedDocletException) {
-                throw (DocletException) cause.getCause();
-            } else {
-                // use InternalException, so that a stacktrace showing the position of
-                // the internal exception is generated
-                String message = resources.getText("doclet.builder.exception.in.component", component,
-                        e.getCause());
-                throw new InternalException(message, e.getCause());
-            }
-
-        } catch (ReflectiveOperationException e) {
-            // Use SimpleDocletException instead of InternalException because there is nothing
-            // informative about about the place the exception occurred, here in this method.
-            // The problem is specific to the method being invoked, such as illegal access
-            // or illegal argument.
-            String message = resources.getText("doclet.builder.exception.in.component", component, e);
-            throw new SimpleDocletException(message, e.getCause());
-        }
-    }
-
-    /**
-     * Build the documentation, as specified by the children of the given XML element.
-     *
-     * @param node the XML element that specifies which components to document.
-     * @param contentTree content tree to which the documentation will be added
-     * @throws DocletException if there is a problem while building the children
-     */
-    protected void buildChildren(XMLNode node, Content contentTree) throws DocletException {
-        for (XMLNode child : node.children)
-            build(child, contentTree);
-    }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -25,14 +25,6 @@
 
 package jdk.javadoc.internal.doclets.toolkit.builders;
 
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import javax.lang.model.element.Element;
-
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.DocletException;
 
@@ -50,7 +42,6 @@
  */
 public abstract class AbstractMemberBuilder extends AbstractBuilder {
 
-    public final Comparator<Element> comparator;
     /**
      * Construct a SubBuilder.
      * @param context a context object, providing information used in this run
@@ -58,7 +49,6 @@
      */
     public AbstractMemberBuilder(Context context) {
         super(context);
-        comparator = utils.makeGeneralPurposeComparator();
     }
 
     /**
@@ -72,20 +62,14 @@
         throw new AssertionError();
     }
 
-
     /**
-     * Builds the sub component if there is anything to document.
+     *
+     * Build the documentation.
      *
-     * @param node the XML element that specifies which components to document.
-     * @param contentTree content tree to which the documentation will be added
-     * @throws DocletException if there is a problem while building the documentation
+     * @param contentTree The content tree into which to add the documention
+     * @throws DocletException  if there is a problem building the documentation
      */
-    @Override
-    public void build(XMLNode node, Content contentTree) throws DocletException {
-        if (hasMembersToDocument()) {
-            super.build(node, contentTree);
-        }
-    }
+    public abstract void build(Content contentTree) throws DocletException;
 
     /**
      * Returns true if this subbuilder has anything to document.
@@ -93,10 +77,4 @@
      * @return true if this subbuilder has anything to document
      */
     public abstract boolean hasMembersToDocument();
-
-    public SortedSet<Element> asSortedSet(Collection<Element> members) {
-        SortedSet<Element> out = new TreeSet<>(comparator);
-        out.addAll(members);
-        return out;
-    }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -47,11 +47,6 @@
 public class AnnotationTypeBuilder extends AbstractBuilder {
 
     /**
-     * The root element of the annotation type XML is {@value}.
-     */
-    public static final String ROOT = "AnnotationTypeDoc";
-
-    /**
      * The annotation type being documented.
      */
     private final TypeElement annotationType;
@@ -100,29 +95,24 @@
      */
     @Override
     public void build() throws DocletException {
-        build(layoutParser.parseXML(ROOT), contentTree);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getName() {
-        return ROOT;
+        buildAnnotationTypeDoc(contentTree);
     }
 
     /**
      * Build the annotation type documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param contentTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem building the documentation
      */
-    public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws DocletException {
+    protected void buildAnnotationTypeDoc(Content contentTree) throws DocletException {
         contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") +
                " " + utils.getSimpleName(annotationType));
         Content annotationContentTree = writer.getAnnotationContentHeader();
-        buildChildren(node, annotationContentTree);
+
+        buildAnnotationTypeInfo(annotationContentTree);
+        buildMemberSummary(annotationContentTree);
+        buildAnnotationTypeMemberDetails(annotationContentTree);
+
         writer.addAnnotationContentTree(contentTree, annotationContentTree);
         writer.addFooter(contentTree);
         writer.printDocument(contentTree);
@@ -136,7 +126,7 @@
      */
     private void copyDocFiles() throws DocletException {
         PackageElement containingPackage = utils.containingPackage(annotationType);
-        if((configuration.packages == null ||
+        if ((configuration.packages == null ||
             !configuration.packages.contains(containingPackage) &&
             !containingPackagesSeen.contains(containingPackage))){
             //Only copy doc files dir if the containing package is not
@@ -150,34 +140,36 @@
     /**
      * Build the annotation information tree documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationContentTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem building the documentation
      */
-    public void buildAnnotationTypeInfo(XMLNode node, Content annotationContentTree)
+    protected void buildAnnotationTypeInfo(Content annotationContentTree)
             throws DocletException {
         Content annotationInfoTree = writer.getAnnotationInfoTreeHeader();
-        buildChildren(node, annotationInfoTree);
+
+        buildDeprecationInfo(annotationInfoTree);
+        buildAnnotationTypeSignature(annotationInfoTree);
+        buildAnnotationTypeDescription(annotationInfoTree);
+        buildAnnotationTypeTagInfo(annotationInfoTree);
+
         annotationContentTree.addContent(writer.getAnnotationInfo(annotationInfoTree));
     }
 
     /**
      * If this annotation is deprecated, build the appropriate information.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationInfoTree the content tree to which the documentation will be added
      */
-    public void buildDeprecationInfo (XMLNode node, Content annotationInfoTree) {
+    protected void buildDeprecationInfo(Content annotationInfoTree) {
         writer.addAnnotationTypeDeprecationInfo(annotationInfoTree);
     }
 
     /**
      * Build the signature of the current annotation type.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationInfoTree the content tree to which the documentation will be added
      */
-    public void buildAnnotationTypeSignature(XMLNode node, Content annotationInfoTree) {
+    protected void buildAnnotationTypeSignature(Content annotationInfoTree) {
         writer.addAnnotationTypeSignature(utils.modifiersToString(annotationType, true),
                 annotationInfoTree);
     }
@@ -185,48 +177,47 @@
     /**
      * Build the annotation type description.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationInfoTree the content tree to which the documentation will be added
      */
-    public void buildAnnotationTypeDescription(XMLNode node, Content annotationInfoTree) {
+    protected void buildAnnotationTypeDescription(Content annotationInfoTree) {
         writer.addAnnotationTypeDescription(annotationInfoTree);
     }
 
     /**
      * Build the tag information for the current annotation type.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationInfoTree the content tree to which the documentation will be added
      */
-    public void buildAnnotationTypeTagInfo(XMLNode node, Content annotationInfoTree) {
+    protected void buildAnnotationTypeTagInfo(Content annotationInfoTree) {
         writer.addAnnotationTypeTagInfo(annotationInfoTree);
     }
 
     /**
      * Build the member summary contents of the page.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationContentTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem building the documentation
      */
-    public void buildMemberSummary(XMLNode node, Content annotationContentTree) throws DocletException {
+    protected void buildMemberSummary(Content annotationContentTree) throws DocletException {
         Content memberSummaryTree = writer.getMemberTreeHeader();
-        configuration.getBuilderFactory().
-                getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
+        builderFactory.getMemberSummaryBuilder(writer).build(memberSummaryTree);
         annotationContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
     }
 
     /**
      * Build the member details contents of the page.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationContentTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem building the documentation
      */
-    public void buildAnnotationTypeMemberDetails(XMLNode node, Content annotationContentTree)
+    protected void buildAnnotationTypeMemberDetails(Content annotationContentTree)
             throws DocletException {
         Content memberDetailsTree = writer.getMemberTreeHeader();
-        buildChildren(node, memberDetailsTree);
+
+        buildAnnotationTypeFieldDetails(memberDetailsTree);
+        buildAnnotationTypeRequiredMemberDetails(memberDetailsTree);
+        buildAnnotationTypeOptionalMemberDetails(memberDetailsTree);
+
         if (memberDetailsTree.isValid()) {
             annotationContentTree.addContent(writer.getMemberDetailsTree(memberDetailsTree));
         }
@@ -235,39 +226,33 @@
     /**
      * Build the annotation type field documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem building the documentation
      */
-    public void buildAnnotationTypeFieldDetails(XMLNode node, Content memberDetailsTree)
+    protected void buildAnnotationTypeFieldDetails(Content memberDetailsTree)
             throws DocletException {
-        configuration.getBuilderFactory().
-                getAnnotationTypeFieldsBuilder(writer).buildChildren(node, memberDetailsTree);
+        builderFactory.getAnnotationTypeFieldsBuilder(writer).build(memberDetailsTree);
     }
 
     /**
      * Build the annotation type optional member documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem building the documentation
      */
-    public void buildAnnotationTypeOptionalMemberDetails(XMLNode node, Content memberDetailsTree)
+    protected void buildAnnotationTypeOptionalMemberDetails(Content memberDetailsTree)
             throws DocletException {
-        configuration.getBuilderFactory().
-                getAnnotationTypeOptionalMemberBuilder(writer).buildChildren(node, memberDetailsTree);
+        builderFactory.getAnnotationTypeOptionalMemberBuilder(writer).build(memberDetailsTree);
     }
 
     /**
      * Build the annotation type required member documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem building the documentation
      */
-    public void buildAnnotationTypeRequiredMemberDetails(XMLNode node, Content memberDetailsTree)
+    protected void buildAnnotationTypeRequiredMemberDetails(Content memberDetailsTree)
             throws DocletException {
-        configuration.getBuilderFactory().
-                getAnnotationTypeRequiredMemberBuilder(writer).buildChildren(node, memberDetailsTree);
+        builderFactory.getAnnotationTypeRequiredMemberBuilder(writer).build(memberDetailsTree);
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -111,15 +111,6 @@
     }
 
     /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getName() {
-        return "AnnotationTypeFieldDetails";
-    }
-
-
-    /**
      * Returns whether or not there are members to document.
      * @return whether or not there are members to document
      */
@@ -129,25 +120,31 @@
     }
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void build(Content contentTree) throws DocletException {
+        buildAnnotationTypeField(contentTree);
+    }
+
+    /**
      * Build the annotation type field documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildAnnotationTypeField(XMLNode node, Content memberDetailsTree)
+    protected void buildAnnotationTypeField(Content memberDetailsTree)
             throws DocletException {
-        buildAnnotationTypeMember(node, memberDetailsTree);
+        buildAnnotationTypeMember(memberDetailsTree);
     }
 
     /**
      * Build the member documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree)
+    protected void buildAnnotationTypeMember(Content memberDetailsTree)
             throws DocletException {
         if (writer == null) {
             return;
@@ -162,7 +159,12 @@
                 writer.addAnnotationDetailsTreeHeader(typeElement, detailsTree);
                 Content annotationDocTree = writer.getAnnotationDocTreeHeader(currentMember,
                         detailsTree);
-                buildChildren(node, annotationDocTree);
+
+                buildSignature(annotationDocTree);
+                buildDeprecationInfo(annotationDocTree);
+                buildMemberComments(annotationDocTree);
+                buildTagInfo(annotationDocTree);
+
                 detailsTree.addContent(writer.getAnnotationDoc(
                         annotationDocTree, currentMember == lastElement));
                 memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree));
@@ -173,10 +175,9 @@
     /**
      * Build the signature.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationDocTree the content tree to which the documentation will be added
      */
-    public void buildSignature(XMLNode node, Content annotationDocTree) {
+    protected void buildSignature(Content annotationDocTree) {
         annotationDocTree.addContent(
                 writer.getSignature(currentMember));
     }
@@ -184,10 +185,9 @@
     /**
      * Build the deprecation information.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationDocTree the content tree to which the documentation will be added
      */
-    public void buildDeprecationInfo(XMLNode node, Content annotationDocTree) {
+    protected void buildDeprecationInfo(Content annotationDocTree) {
         writer.addDeprecated(currentMember, annotationDocTree);
     }
 
@@ -195,11 +195,10 @@
      * Build the comments for the member.  Do nothing if
      * {@link BaseConfiguration#nocomment} is set to true.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationDocTree the content tree to which the documentation will be added
      */
-    public void buildMemberComments(XMLNode node, Content annotationDocTree) {
-        if(! configuration.nocomment){
+    protected void buildMemberComments(Content annotationDocTree) {
+        if (!configuration.nocomment) {
             writer.addComments(currentMember, annotationDocTree);
         }
     }
@@ -207,10 +206,9 @@
     /**
      * Build the tag information.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationDocTree the content tree to which the documentation will be added
      */
-    public void buildTagInfo(XMLNode node, Content annotationDocTree) {
+    protected void buildTagInfo(Content annotationDocTree) {
         writer.addTags(currentMember, annotationDocTree);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -81,29 +81,33 @@
      * {@inheritDoc}
      */
     @Override
-    public String getName() {
-        return "AnnotationTypeOptionalMemberDetails";
+    public void build(Content contentTree) throws DocletException {
+        buildAnnotationTypeOptionalMember(contentTree);
     }
 
     /**
      * Build the annotation type optional member documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildAnnotationTypeOptionalMember(XMLNode node, Content memberDetailsTree)
+    protected void buildAnnotationTypeOptionalMember(Content memberDetailsTree)
                 throws DocletException {
-        buildAnnotationTypeMember(node, memberDetailsTree);
+        buildAnnotationTypeMember(memberDetailsTree);
+    }
+
+    @Override
+    protected void buildAnnotationTypeMemberChildren(Content annotationDocTree) {
+        super.buildAnnotationTypeMemberChildren(annotationDocTree);
+        buildDefaultValueInfo(annotationDocTree);
     }
 
     /**
      * Build the default value for this optional member.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationDocTree the content tree to which the documentation will be added
      */
-    public void buildDefaultValueInfo(XMLNode node, Content annotationDocTree) {
+    protected void buildDefaultValueInfo(Content annotationDocTree) {
         ((AnnotationTypeOptionalMemberWriter) writer).addDefaultValueInfo(currentMember,
                 annotationDocTree);
     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -113,14 +113,6 @@
     }
 
     /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getName() {
-        return "AnnotationTypeRequiredMemberDetails";
-    }
-
-    /**
      * Returns whether or not there are members to document.
      * @return whether or not there are members to document
      */
@@ -130,25 +122,31 @@
     }
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void build(Content contentTree) throws DocletException {
+        buildAnnotationTypeRequiredMember(contentTree);
+    }
+
+    /**
      * Build the annotation type required member documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildAnnotationTypeRequiredMember(XMLNode node, Content memberDetailsTree)
+    protected void buildAnnotationTypeRequiredMember(Content memberDetailsTree)
             throws DocletException {
-        buildAnnotationTypeMember(node, memberDetailsTree);
+        buildAnnotationTypeMember(memberDetailsTree);
     }
 
     /**
      * Build the member documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if an error occurs
      */
-    public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree)
+    protected void buildAnnotationTypeMember(Content memberDetailsTree)
             throws DocletException {
         if (writer == null) {
             return;
@@ -162,7 +160,9 @@
                 writer.addAnnotationDetailsTreeHeader(typeElement, detailsTree);
                 Content annotationDocTree = writer.getAnnotationDocTreeHeader(
                         currentMember, detailsTree);
-                buildChildren(node, annotationDocTree);
+
+                buildAnnotationTypeMemberChildren(annotationDocTree);
+
                 detailsTree.addContent(writer.getAnnotationDoc(
                         annotationDocTree, currentMember == lastMember));
                 memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree));
@@ -170,23 +170,28 @@
         }
     }
 
+    protected void buildAnnotationTypeMemberChildren(Content annotationDocTree) {
+        buildSignature(annotationDocTree);
+        buildDeprecationInfo(annotationDocTree);
+        buildMemberComments(annotationDocTree);
+        buildTagInfo(annotationDocTree);
+    }
+
     /**
      * Build the signature.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationDocTree the content tree to which the documentation will be added
      */
-    public void buildSignature(XMLNode node, Content annotationDocTree) {
+    protected void buildSignature(Content annotationDocTree) {
         annotationDocTree.addContent(writer.getSignature(currentMember));
     }
 
     /**
      * Build the deprecation information.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationDocTree the content tree to which the documentation will be added
      */
-    public void buildDeprecationInfo(XMLNode node, Content annotationDocTree) {
+    protected void buildDeprecationInfo(Content annotationDocTree) {
         writer.addDeprecated(currentMember, annotationDocTree);
     }
 
@@ -194,11 +199,10 @@
      * Build the comments for the member.  Do nothing if
      * {@link BaseConfiguration#nocomment} is set to true.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationDocTree the content tree to which the documentation will be added
      */
-    public void buildMemberComments(XMLNode node, Content annotationDocTree) {
-        if(! configuration.nocomment) {
+    protected void buildMemberComments(Content annotationDocTree) {
+        if (!configuration.nocomment) {
             writer.addComments(currentMember, annotationDocTree);
         }
     }
@@ -206,10 +210,9 @@
     /**
      * Build the tag information.
      *
-     * @param node the XML element that specifies which components to document
      * @param annotationDocTree the content tree to which the documentation will be added
      */
-    public void buildTagInfo(XMLNode node, Content annotationDocTree) {
+    protected void buildTagInfo(Content annotationDocTree) {
         writer.addTags(currentMember, annotationDocTree);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/BuilderFactory.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/BuilderFactory.java	Thu Jun 15 10:55:35 2017 -0700
@@ -54,11 +54,6 @@
 public class BuilderFactory {
 
     /**
-     * The current configuration of the doclet.
-     */
-    private final BaseConfiguration configuration;
-
-    /**
      * The factory to retrieve the required writers from.
      */
     private final WriterFactory writerFactory;
@@ -71,12 +66,10 @@
      * being executed.
      */
     public BuilderFactory (BaseConfiguration configuration) {
-        this.configuration = configuration;
         this.writerFactory = configuration.getWriterFactory();
 
         Set<PackageElement> containingPackagesSeen = new HashSet<>();
-        context = new AbstractBuilder.Context(configuration, containingPackagesSeen,
-                LayoutParser.getInstance(configuration));
+        context = new AbstractBuilder.Context(configuration, containingPackagesSeen);
     }
 
     /**
@@ -150,9 +143,10 @@
     /**
      * Return an instance of the method builder for the given class.
      *
+     * @param classWriter the writer for the enclosing class
      * @return an instance of the method builder for the given class.
      */
-    public AbstractBuilder getMethodBuilder(ClassWriter classWriter) {
+    public AbstractMemberBuilder getMethodBuilder(ClassWriter classWriter) {
         return MethodBuilder.getInstance(context, classWriter.getTypeElement(),
             writerFactory.getMethodWriter(classWriter));
     }
@@ -161,10 +155,11 @@
      * Return an instance of the annotation type fields builder for the given
      * class.
      *
+     * @param annotationTypeWriter the writer for the enclosing annotation type
      * @return an instance of the annotation type field builder for the given
      *         annotation type.
      */
-    public AbstractBuilder getAnnotationTypeFieldsBuilder(
+    public AbstractMemberBuilder getAnnotationTypeFieldsBuilder(
             AnnotationTypeWriter annotationTypeWriter) {
         return AnnotationTypeFieldBuilder.getInstance(context,
                 annotationTypeWriter.getAnnotationTypeElement(),
@@ -175,10 +170,11 @@
      * Return an instance of the annotation type member builder for the given
      * class.
      *
+     * @param annotationTypeWriter the writer for the enclosing annotation type
      * @return an instance of the annotation type member builder for the given
      *         annotation type.
      */
-    public AbstractBuilder getAnnotationTypeOptionalMemberBuilder(
+    public AbstractMemberBuilder getAnnotationTypeOptionalMemberBuilder(
             AnnotationTypeWriter annotationTypeWriter) {
         return AnnotationTypeOptionalMemberBuilder.getInstance(context,
             annotationTypeWriter.getAnnotationTypeElement(),
@@ -189,10 +185,11 @@
      * Return an instance of the annotation type member builder for the given
      * class.
      *
+     * @param annotationTypeWriter the writer for the enclosing annotation type
      * @return an instance of the annotation type member builder for the given
      *         annotation type.
      */
-    public AbstractBuilder getAnnotationTypeRequiredMemberBuilder(
+    public AbstractMemberBuilder getAnnotationTypeRequiredMemberBuilder(
             AnnotationTypeWriter annotationTypeWriter) {
         return AnnotationTypeRequiredMemberBuilder.getInstance(context,
             annotationTypeWriter.getAnnotationTypeElement(),
@@ -202,9 +199,10 @@
     /**
      * Return an instance of the enum constants builder for the given class.
      *
+     * @param classWriter the writer for the enclosing class
      * @return an instance of the enum constants builder for the given class.
      */
-    public AbstractBuilder getEnumConstantsBuilder(ClassWriter classWriter) {
+    public AbstractMemberBuilder getEnumConstantsBuilder(ClassWriter classWriter) {
         return EnumConstantBuilder.getInstance(context, classWriter.getTypeElement(),
                 writerFactory.getEnumConstantWriter(classWriter));
     }
@@ -212,9 +210,10 @@
     /**
      * Return an instance of the field builder for the given class.
      *
+     * @param classWriter the writer for the enclosing class
      * @return an instance of the field builder for the given class.
      */
-    public AbstractBuilder getFieldBuilder(ClassWriter classWriter) {
+    public AbstractMemberBuilder getFieldBuilder(ClassWriter classWriter) {
         return FieldBuilder.getInstance(context, classWriter.getTypeElement(),
             writerFactory.getFieldWriter(classWriter));
     }
@@ -222,9 +221,10 @@
     /**
      * Return an instance of the property builder for the given class.
      *
+     * @param classWriter the writer for the enclosing class
      * @return an instance of the field builder for the given class.
      */
-    public AbstractBuilder getPropertyBuilder(ClassWriter classWriter) {
+    public AbstractMemberBuilder getPropertyBuilder(ClassWriter classWriter) {
         final PropertyWriter propertyWriter =
                 writerFactory.getPropertyWriter(classWriter);
         return PropertyBuilder.getInstance(context,
@@ -235,9 +235,10 @@
     /**
      * Return an instance of the constructor builder for the given class.
      *
+     * @param classWriter the writer for the enclosing class
      * @return an instance of the constructor builder for the given class.
      */
-    public AbstractBuilder getConstructorBuilder(ClassWriter classWriter) {
+    public AbstractMemberBuilder getConstructorBuilder(ClassWriter classWriter) {
         return ConstructorBuilder.getInstance(context, classWriter.getTypeElement(),
             writerFactory.getConstructorWriter(classWriter));
     }
@@ -245,9 +246,10 @@
     /**
      * Return an instance of the member summary builder for the given class.
      *
+     * @param classWriter the writer for the enclosing class
      * @return an instance of the member summary builder for the given class.
      */
-    public AbstractBuilder getMemberSummaryBuilder(ClassWriter classWriter) {
+    public MemberSummaryBuilder getMemberSummaryBuilder(ClassWriter classWriter) {
         return MemberSummaryBuilder.getInstance(classWriter, context);
     }
 
@@ -255,10 +257,11 @@
      * Return an instance of the member summary builder for the given annotation
      * type.
      *
+     * @param annotationTypeWriter the writer for the enclosing annotation type
      * @return an instance of the member summary builder for the given
      *         annotation type.
      */
-    public AbstractBuilder getMemberSummaryBuilder(AnnotationTypeWriter annotationTypeWriter) {
+    public MemberSummaryBuilder getMemberSummaryBuilder(AnnotationTypeWriter annotationTypeWriter) {
         return MemberSummaryBuilder.getInstance(annotationTypeWriter, context);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -48,11 +48,6 @@
 public class ClassBuilder extends AbstractBuilder {
 
     /**
-     * The root element of the class XML is {@value}.
-     */
-    public static final String ROOT = "ClassDoc";
-
-    /**
      * The class being documented.
      */
     private final TypeElement typeElement;
@@ -112,8 +107,7 @@
      * @param writer the doclet specific writer.
      * @return the new ClassBuilder
      */
-    public static ClassBuilder getInstance(Context context,
-            TypeElement typeElement, ClassWriter writer) {
+    public static ClassBuilder getInstance(Context context, TypeElement typeElement, ClassWriter writer) {
         return new ClassBuilder(context, typeElement, writer);
     }
 
@@ -122,153 +116,151 @@
      */
     @Override
     public void build() throws DocletException {
-        build(layoutParser.parseXML(ROOT), contentTree);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getName() {
-        return ROOT;
+        buildClassDoc(contentTree);
     }
 
      /**
       * Handles the {@literal <TypeElement>} tag.
       *
-      * @param node the XML element that specifies which components to document
       * @param contentTree the content tree to which the documentation will be added
-     * @throws DocletException if there is a problem while building the documentation
+      * @throws DocletException if there is a problem while building the documentation
       */
-     public void buildClassDoc(XMLNode node, Content contentTree) throws DocletException {
-         String key;
-         if (isInterface) {
-             key =  "doclet.Interface";
-         } else if (isEnum) {
-             key = "doclet.Enum";
-         } else {
-             key =  "doclet.Class";
-         }
-         contentTree = writer.getHeader(configuration.getText(key) + " " +
-                 utils.getSimpleName(typeElement));
-         Content classContentTree = writer.getClassContentHeader();
-         buildChildren(node, classContentTree);
-         writer.addClassContentTree(contentTree, classContentTree);
-         writer.addFooter(contentTree);
-         writer.printDocument(contentTree);
-         copyDocFiles();
-     }
+     protected void buildClassDoc(Content contentTree) throws DocletException {
+        String key;
+        if (isInterface) {
+            key = "doclet.Interface";
+        } else if (isEnum) {
+            key = "doclet.Enum";
+        } else {
+            key = "doclet.Class";
+        }
+        contentTree = writer.getHeader(configuration.getText(key) + " "
+                + utils.getSimpleName(typeElement));
+        Content classContentTree = writer.getClassContentHeader();
+
+        buildClassTree(classContentTree);
+        buildClassInfo(classContentTree);
+        buildMemberSummary(classContentTree);
+        buildMemberDetails(classContentTree);
+
+        writer.addClassContentTree(contentTree, classContentTree);
+        writer.addFooter(contentTree);
+        writer.printDocument(contentTree);
+        copyDocFiles();
+    }
 
      /**
       * Build the class tree documentation.
       *
-      * @param node the XML element that specifies which components to document
       * @param classContentTree the content tree to which the documentation will be added
       */
-    public void buildClassTree(XMLNode node, Content classContentTree) {
+    protected void buildClassTree(Content classContentTree) {
         writer.addClassTree(classContentTree);
     }
 
     /**
      * Build the class information tree documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param classContentTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildClassInfo(XMLNode node, Content classContentTree) throws DocletException {
+    protected void buildClassInfo(Content classContentTree) throws DocletException {
         Content classInfoTree = writer.getClassInfoTreeHeader();
-        buildChildren(node, classInfoTree);
+
+        buildTypeParamInfo(classInfoTree);
+        buildSuperInterfacesInfo(classInfoTree);
+        buildImplementedInterfacesInfo(classInfoTree);
+        buildSubClassInfo(classInfoTree);
+        buildSubInterfacesInfo(classInfoTree);
+        buildInterfaceUsageInfo(classInfoTree);
+        buildNestedClassInfo(classInfoTree);
+        buildFunctionalInterfaceInfo(classInfoTree);
+        buildDeprecationInfo(classInfoTree);
+        buildClassSignature(classInfoTree);
+        buildClassDescription(classInfoTree);
+        buildClassTagInfo(classInfoTree);
+
         classContentTree.addContent(writer.getClassInfo(classInfoTree));
     }
 
     /**
      * Build the type parameters of this class.
      *
-     * @param node the XML element that specifies which components to document
      * @param classInfoTree the content tree to which the documentation will be added
      */
-    public void buildTypeParamInfo(XMLNode node, Content classInfoTree) {
+    protected void buildTypeParamInfo(Content classInfoTree) {
         writer.addTypeParamInfo(classInfoTree);
     }
 
     /**
      * If this is an interface, list all super interfaces.
      *
-     * @param node the XML element that specifies which components to document
      * @param classInfoTree the content tree to which the documentation will be added
      */
-    public void buildSuperInterfacesInfo(XMLNode node, Content classInfoTree) {
+    protected void buildSuperInterfacesInfo(Content classInfoTree) {
         writer.addSuperInterfacesInfo(classInfoTree);
     }
 
     /**
      * If this is a class, list all interfaces implemented by this class.
      *
-     * @param node the XML element that specifies which components to document
      * @param classInfoTree the content tree to which the documentation will be added
      */
-    public void buildImplementedInterfacesInfo(XMLNode node, Content classInfoTree) {
+    protected void buildImplementedInterfacesInfo(Content classInfoTree) {
         writer.addImplementedInterfacesInfo(classInfoTree);
     }
 
     /**
      * List all the classes extend this one.
      *
-     * @param node the XML element that specifies which components to document
      * @param classInfoTree the content tree to which the documentation will be added
      */
-    public void buildSubClassInfo(XMLNode node, Content classInfoTree) {
+    protected void buildSubClassInfo(Content classInfoTree) {
         writer.addSubClassInfo(classInfoTree);
     }
 
     /**
      * List all the interfaces that extend this one.
      *
-     * @param node the XML element that specifies which components to document
      * @param classInfoTree the content tree to which the documentation will be added
      */
-    public void buildSubInterfacesInfo(XMLNode node, Content classInfoTree) {
+    protected void buildSubInterfacesInfo(Content classInfoTree) {
         writer.addSubInterfacesInfo(classInfoTree);
     }
 
     /**
      * If this is an interface, list all classes that implement this interface.
      *
-     * @param node the XML element that specifies which components to document
      * @param classInfoTree the content tree to which the documentation will be added
      */
-    public void buildInterfaceUsageInfo(XMLNode node, Content classInfoTree) {
+    protected void buildInterfaceUsageInfo(Content classInfoTree) {
         writer.addInterfaceUsageInfo(classInfoTree);
     }
 
     /**
      * If this is an functional interface, display appropriate message.
      *
-     * @param node the XML element that specifies which components to document
      * @param classInfoTree the content tree to which the documentation will be added
      */
-    public void buildFunctionalInterfaceInfo(XMLNode node, Content classInfoTree) {
+    protected void buildFunctionalInterfaceInfo(Content classInfoTree) {
         writer.addFunctionalInterfaceInfo(classInfoTree);
     }
 
     /**
      * If this class is deprecated, build the appropriate information.
      *
-     * @param node the XML element that specifies which components to document
      * @param classInfoTree the content tree to which the documentation will be added
      */
-    public void buildDeprecationInfo (XMLNode node, Content classInfoTree) {
+    protected void buildDeprecationInfo(Content classInfoTree) {
         writer.addClassDeprecationInfo(classInfoTree);
     }
 
     /**
      * If this is an inner class or interface, list the enclosing class or interface.
      *
-     * @param node the XML element that specifies which components to document
      * @param classInfoTree the content tree to which the documentation will be added
      */
-    public void buildNestedClassInfo (XMLNode node, Content classInfoTree) {
+    protected void buildNestedClassInfo(Content classInfoTree) {
         writer.addNestedClassInfo(classInfoTree);
     }
 
@@ -279,7 +271,7 @@
      */
      private void copyDocFiles() throws DocFileIOException {
         PackageElement containingPackage = utils.containingPackage(typeElement);
-        if((configuration.packages == null ||
+        if ((configuration.packages == null ||
             !configuration.packages.contains(containingPackage)) &&
             !containingPackagesSeen.contains(containingPackage)) {
             //Only copy doc files dir if the containing package is not
@@ -293,122 +285,107 @@
     /**
      * Build the signature of the current class.
      *
-     * @param node the XML element that specifies which components to document
      * @param classInfoTree the content tree to which the documentation will be added
      */
-    public void buildClassSignature(XMLNode node, Content classInfoTree) {
+    protected void buildClassSignature(Content classInfoTree) {
         writer.addClassSignature(utils.modifiersToString(typeElement, true), classInfoTree);
     }
 
     /**
      * Build the class description.
      *
-     * @param node the XML element that specifies which components to document
      * @param classInfoTree the content tree to which the documentation will be added
      */
-    public void buildClassDescription(XMLNode node, Content classInfoTree) {
+    protected void buildClassDescription(Content classInfoTree) {
        writer.addClassDescription(classInfoTree);
     }
 
     /**
      * Build the tag information for the current class.
      *
-     * @param node the XML element that specifies which components to document
      * @param classInfoTree the content tree to which the documentation will be added
      */
-    public void buildClassTagInfo(XMLNode node, Content classInfoTree) {
+    protected void buildClassTagInfo(Content classInfoTree) {
        writer.addClassTagInfo(classInfoTree);
     }
 
     /**
      * Build the member summary contents of the page.
      *
-     * @param node the XML element that specifies which components to document
      * @param classContentTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildMemberSummary(XMLNode node, Content classContentTree) throws DocletException {
+    protected void buildMemberSummary(Content classContentTree) throws DocletException {
         Content memberSummaryTree = writer.getMemberTreeHeader();
-        configuration.getBuilderFactory().
-                getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
+        builderFactory.getMemberSummaryBuilder(writer).build(memberSummaryTree);
         classContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
     }
 
     /**
      * Build the member details contents of the page.
      *
-     * @param node the XML element that specifies which components to document
      * @param classContentTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildMemberDetails(XMLNode node, Content classContentTree) throws DocletException {
+    protected void buildMemberDetails(Content classContentTree) throws DocletException {
         Content memberDetailsTree = writer.getMemberTreeHeader();
-        buildChildren(node, memberDetailsTree);
+
+        buildEnumConstantsDetails(memberDetailsTree);
+        buildPropertyDetails(memberDetailsTree);
+        buildFieldDetails(memberDetailsTree);
+        buildConstructorDetails(memberDetailsTree);
+        buildMethodDetails(memberDetailsTree);
+
         classContentTree.addContent(writer.getMemberDetailsTree(memberDetailsTree));
     }
 
     /**
      * Build the enum constants documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildEnumConstantsDetails(XMLNode node,
-            Content memberDetailsTree) throws DocletException {
-        configuration.getBuilderFactory().
-                getEnumConstantsBuilder(writer).buildChildren(node, memberDetailsTree);
+    protected void buildEnumConstantsDetails(Content memberDetailsTree) throws DocletException {
+        builderFactory.getEnumConstantsBuilder(writer).build(memberDetailsTree);
     }
 
     /**
      * Build the field documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildFieldDetails(XMLNode node,
-            Content memberDetailsTree) throws DocletException {
-        configuration.getBuilderFactory().
-                getFieldBuilder(writer).buildChildren(node, memberDetailsTree);
+    protected void buildFieldDetails(Content memberDetailsTree) throws DocletException {
+        builderFactory.getFieldBuilder(writer).build(memberDetailsTree);
     }
 
     /**
      * Build the property documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildPropertyDetails(XMLNode node,
-            Content memberDetailsTree) throws DocletException {
-        configuration.getBuilderFactory().
-                getPropertyBuilder(writer).buildChildren(node, memberDetailsTree);
+    public void buildPropertyDetails( Content memberDetailsTree) throws DocletException {
+        builderFactory.getPropertyBuilder(writer).build(memberDetailsTree);
     }
 
     /**
      * Build the constructor documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildConstructorDetails(XMLNode node,
-            Content memberDetailsTree) throws DocletException {
-        configuration.getBuilderFactory().
-                getConstructorBuilder(writer).buildChildren(node, memberDetailsTree);
+    protected void buildConstructorDetails(Content memberDetailsTree) throws DocletException {
+        builderFactory.getConstructorBuilder(writer).build(memberDetailsTree);
     }
 
     /**
      * Build the method documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildMethodDetails(XMLNode node,
-            Content memberDetailsTree) throws DocletException {
-        configuration.getBuilderFactory().
-                getMethodBuilder(writer).buildChildren(node, memberDetailsTree);
+    protected void buildMethodDetails(Content memberDetailsTree) throws DocletException {
+        builderFactory.getMethodBuilder(writer).build(memberDetailsTree);
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -52,11 +52,6 @@
 public class ConstantsSummaryBuilder extends AbstractBuilder {
 
     /**
-     * The root element of the constant summary XML is {@value}.
-     */
-    public static final String ROOT = "ConstantSummary";
-
-    /**
      * The maximum number of package directories shown in the constant
      * value index.
      */
@@ -133,27 +128,21 @@
             //Doclet does not support this output.
             return;
         }
-        build(layoutParser.parseXML(ROOT), contentTree);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getName() {
-        return ROOT;
+        buildConstantSummary(contentTree);
     }
 
     /**
      * Build the constant summary.
      *
-     * @param node the XML element that specifies which components to document
      * @param contentTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildConstantSummary(XMLNode node, Content contentTree) throws DocletException {
+    protected void buildConstantSummary(Content contentTree) throws DocletException {
         contentTree = writer.getHeader();
-        buildChildren(node, contentTree);
+
+        buildContents(contentTree);
+        buildConstantSummaries(contentTree);
+
         writer.addFooter(contentTree);
         writer.printDocument(contentTree);
     }
@@ -161,10 +150,9 @@
     /**
      * Build the list of packages.
      *
-     * @param node the XML element that specifies which components to document
      * @param contentTree the content tree to which the content list will be added
      */
-    public void buildContents(XMLNode node, Content contentTree) {
+    protected void buildContents(Content contentTree) {
         Content contentListTree = writer.getContentsHeader();
         printedPackageHeaders.clear();
         for (PackageElement pkg : configuration.packages) {
@@ -178,18 +166,20 @@
     /**
      * Build the summary for each documented package.
      *
-     * @param node the XML element that specifies which components to document
      * @param contentTree the tree to which the summaries will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildConstantSummaries(XMLNode node, Content contentTree) throws DocletException {
+    protected void buildConstantSummaries(Content contentTree) throws DocletException {
         printedPackageHeaders.clear();
         Content summariesTree = writer.getConstantSummaries();
         for (PackageElement aPackage : configuration.packages) {
             if (hasConstantField(aPackage)) {
                 currentPackage = aPackage;
                 //Build the documentation for the current package.
-                buildChildren(node, summariesTree);
+
+                buildPackageHeader(summariesTree);
+                buildClassConstantSummary(summariesTree);
+
                 first = false;
             }
         }
@@ -199,10 +189,9 @@
     /**
      * Build the header for the given package.
      *
-     * @param node the XML element that specifies which components to document
      * @param summariesTree the tree to which the package header will be added
      */
-    public void buildPackageHeader(XMLNode node, Content summariesTree) {
+    protected void buildPackageHeader(Content summariesTree) {
         PackageElement abbrevPkg = configuration.workArounds.getAbbreviatedPackageElement(currentPackage);
         if (!printedPackageHeaders.contains(abbrevPkg)) {
             writer.addPackageName(currentPackage, summariesTree, first);
@@ -213,12 +202,11 @@
     /**
      * Build the summary for the current class.
      *
-     * @param node the XML element that specifies which components to document
      * @param summariesTree the tree to which the class constant summary will be added
      * @throws DocletException if there is a problem while building the documentation
      *
      */
-    public void buildClassConstantSummary(XMLNode node, Content summariesTree)
+    protected void buildClassConstantSummary(Content summariesTree)
             throws DocletException {
         SortedSet<TypeElement> classes = !currentPackage.isUnnamed()
                 ? utils.getAllClasses(currentPackage)
@@ -231,7 +219,9 @@
             }
             currentClass = te;
             //Build the documentation for the current class.
-            buildChildren(node, classConstantTree);
+
+            buildConstantMembers(classConstantTree);
+
         }
         writer.addClassConstant(summariesTree, classConstantTree);
     }
@@ -239,12 +229,11 @@
     /**
      * Build the summary of constant members in the class.
      *
-     * @param node the XML element that specifies which components to document
      * @param classConstantTree the tree to which the constant members table
      *                          will be added
      */
-    public void buildConstantMembers(XMLNode node, Content classConstantTree) {
-        new ConstantFieldBuilder(currentClass).buildMembersSummary(node, classConstantTree);
+    protected void buildConstantMembers(Content classConstantTree) {
+        new ConstantFieldBuilder(currentClass).buildMembersSummary(classConstantTree);
     }
 
     /**
@@ -338,11 +327,10 @@
         /**
          * Builds the table of constants for a given class.
          *
-         * @param node the XML element that specifies which components to document
          * @param classConstantTree the tree to which the class constants table
          *                          will be added
          */
-        protected void buildMembersSummary(XMLNode node, Content classConstantTree) {
+        protected void buildMembersSummary(Content classConstantTree) {
             SortedSet<VariableElement> members = members();
             if (!members.isEmpty()) {
                 writer.addConstantMembers(typeElement, members, classConstantTree);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -52,11 +52,6 @@
 public class ConstructorBuilder extends AbstractMemberBuilder {
 
     /**
-     * The name of this builder.
-     */
-    public static final String NAME = "ConstructorDetails";
-
-    /**
      * The current constructor that is being documented at this point in time.
      */
     private ExecutableElement currentConstructor;
@@ -85,7 +80,7 @@
      * Construct a new ConstructorBuilder.
      *
      * @param context  the build context.
-     * @param typeElement the class whoses members are being documented.
+     * @param typeElement the class whose members are being documented.
      * @param writer the doclet specific writer.
      */
     private ConstructorBuilder(Context context,
@@ -108,7 +103,7 @@
      * Construct a new ConstructorBuilder.
      *
      * @param context  the build context.
-     * @param typeElement the class whoses members are being documented.
+     * @param typeElement the class whose members are being documented.
      * @param writer the doclet specific writer.
      * @return the new ConstructorBuilder
      */
@@ -121,14 +116,6 @@
      * {@inheritDoc}
      */
     @Override
-    public String getName() {
-        return NAME;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
     public boolean hasMembersToDocument() {
         return !constructors.isEmpty();
     }
@@ -143,13 +130,20 @@
     }
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void build(Content contentTree) throws DocletException {
+        buildConstructorDoc(contentTree);
+    }
+
+    /**
      * Build the constructor documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException is there is a problem while building the documentation
      */
-    public void buildConstructorDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
+    protected void buildConstructorDoc(Content memberDetailsTree) throws DocletException {
         if (writer == null) {
             return;
         }
@@ -161,7 +155,12 @@
             for (Element contructor : constructors) {
                 currentConstructor = (ExecutableElement)contructor;
                 Content constructorDocTree = writer.getConstructorDocTreeHeader(currentConstructor, constructorDetailsTree);
-                buildChildren(node, constructorDocTree);
+
+                buildSignature(constructorDocTree);
+                buildDeprecationInfo(constructorDocTree);
+                buildConstructorComments(constructorDocTree);
+                buildTagInfo(constructorDocTree);
+
                 constructorDetailsTree.addContent(writer.getConstructorDoc(constructorDocTree,
                         currentConstructor == lastElement));
             }
@@ -173,20 +172,18 @@
     /**
      * Build the signature.
      *
-     * @param node the XML element that specifies which components to document
      * @param constructorDocTree the content tree to which the documentation will be added
      */
-    public void buildSignature(XMLNode node, Content constructorDocTree) {
+    protected void buildSignature(Content constructorDocTree) {
         constructorDocTree.addContent(writer.getSignature(currentConstructor));
     }
 
     /**
      * Build the deprecation information.
      *
-     * @param node the XML element that specifies which components to document
      * @param constructorDocTree the content tree to which the documentation will be added
      */
-    public void buildDeprecationInfo(XMLNode node, Content constructorDocTree) {
+    protected void buildDeprecationInfo(Content constructorDocTree) {
         writer.addDeprecated(currentConstructor, constructorDocTree);
     }
 
@@ -194,10 +191,9 @@
      * Build the comments for the constructor.  Do nothing if
      * {@link BaseConfiguration#nocomment} is set to true.
      *
-     * @param node the XML element that specifies which components to document
      * @param constructorDocTree the content tree to which the documentation will be added
      */
-    public void buildConstructorComments(XMLNode node, Content constructorDocTree) {
+    protected void buildConstructorComments(Content constructorDocTree) {
         if (!configuration.nocomment) {
             writer.addComments(currentConstructor, constructorDocTree);
         }
@@ -206,10 +202,9 @@
     /**
      * Build the tag information.
      *
-     * @param node the XML element that specifies which components to document
      * @param constructorDocTree the content tree to which the documentation will be added
      */
-    public void buildTagInfo(XMLNode node, Content constructorDocTree) {
+    protected void buildTagInfo(Content constructorDocTree) {
         writer.addTags(currentConstructor, constructorDocTree);
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -108,14 +108,6 @@
     }
 
     /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getName() {
-        return "EnumConstantDetails";
-    }
-
-    /**
      * Returns whether or not there are members to document.
      *
      * @return whether or not there are members to document
@@ -126,13 +118,20 @@
     }
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void build(Content contentTree) throws DocletException {
+        buildEnumConstant(contentTree);
+    }
+
+    /**
      * Build the enum constant documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException is there is a problem while building the documentation
      */
-    public void buildEnumConstant(XMLNode node, Content memberDetailsTree) throws DocletException {
+    protected void buildEnumConstant(Content memberDetailsTree) throws DocletException {
         if (writer == null) {
             return;
         }
@@ -144,7 +143,12 @@
                 currentElement = (VariableElement)enumConstant;
                 Content enumConstantsTree = writer.getEnumConstantsTreeHeader(currentElement,
                         enumConstantsDetailsTree);
-                buildChildren(node, enumConstantsTree);
+
+                buildSignature(enumConstantsTree);
+                buildDeprecationInfo(enumConstantsTree);
+                buildEnumConstantComments(enumConstantsTree);
+                buildTagInfo(enumConstantsTree);
+
                 enumConstantsDetailsTree.addContent(writer.getEnumConstants(
                         enumConstantsTree, currentElement == lastElement));
             }
@@ -156,20 +160,18 @@
     /**
      * Build the signature.
      *
-     * @param node the XML element that specifies which components to document
      * @param enumConstantsTree the content tree to which the documentation will be added
      */
-    public void buildSignature(XMLNode node, Content enumConstantsTree) {
+    protected void buildSignature(Content enumConstantsTree) {
         enumConstantsTree.addContent(writer.getSignature(currentElement));
     }
 
     /**
      * Build the deprecation information.
      *
-     * @param node the XML element that specifies which components to document
      * @param enumConstantsTree the content tree to which the documentation will be added
      */
-    public void buildDeprecationInfo(XMLNode node, Content enumConstantsTree) {
+    protected void buildDeprecationInfo(Content enumConstantsTree) {
         writer.addDeprecated(currentElement, enumConstantsTree);
     }
 
@@ -177,10 +179,9 @@
      * Build the comments for the enum constant.  Do nothing if
      * {@link BaseConfiguration#nocomment} is set to true.
      *
-     * @param node the XML element that specifies which components to document
      * @param enumConstantsTree the content tree to which the documentation will be added
      */
-    public void buildEnumConstantComments(XMLNode node, Content enumConstantsTree) {
+    protected void buildEnumConstantComments(Content enumConstantsTree) {
         if (!configuration.nocomment) {
             writer.addComments(currentElement, enumConstantsTree);
         }
@@ -189,10 +190,9 @@
     /**
      * Build the tag information.
      *
-     * @param node the XML element that specifies which components to document
      * @param enumConstantsTree the content tree to which the documentation will be added
      */
-    public void buildTagInfo(XMLNode node, Content enumConstantsTree) {
+    protected void buildTagInfo(Content enumConstantsTree) {
         writer.addTags(currentElement, enumConstantsTree);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -110,14 +110,6 @@
     }
 
     /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getName() {
-        return "FieldDetails";
-    }
-
-    /**
      * Returns whether or not there are members to document.
      *
      * @return whether or not there are members to document
@@ -128,13 +120,20 @@
     }
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void build(Content contentTree) throws DocletException {
+        buildFieldDoc(contentTree);
+    }
+
+    /**
      * Build the field documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildFieldDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
+    protected void buildFieldDoc(Content memberDetailsTree) throws DocletException {
         if (writer == null) {
             return;
         }
@@ -145,7 +144,12 @@
             for (Element element : fields) {
                 currentElement = (VariableElement)element;
                 Content fieldDocTree = writer.getFieldDocTreeHeader(currentElement, fieldDetailsTree);
-                buildChildren(node, fieldDocTree);
+
+                buildSignature(fieldDocTree);
+                buildDeprecationInfo(fieldDocTree);
+                buildFieldComments(fieldDocTree);
+                buildTagInfo(fieldDocTree);
+
                 fieldDetailsTree.addContent(writer.getFieldDoc(
                         fieldDocTree, currentElement == lastElement));
             }
@@ -157,20 +161,18 @@
     /**
      * Build the signature.
      *
-     * @param node the XML element that specifies which components to document
      * @param fieldDocTree the content tree to which the documentation will be added
      */
-    public void buildSignature(XMLNode node, Content fieldDocTree) {
+    protected void buildSignature(Content fieldDocTree) {
         fieldDocTree.addContent(writer.getSignature(currentElement));
     }
 
     /**
      * Build the deprecation information.
      *
-     * @param node the XML element that specifies which components to document
      * @param fieldDocTree the content tree to which the documentation will be added
      */
-    public void buildDeprecationInfo(XMLNode node, Content fieldDocTree) {
+    protected void buildDeprecationInfo(Content fieldDocTree) {
         writer.addDeprecated(currentElement, fieldDocTree);
     }
 
@@ -178,10 +180,9 @@
      * Build the comments for the field.  Do nothing if
      * {@link BaseConfiguration#nocomment} is set to true.
      *
-     * @param node the XML element that specifies which components to document
      * @param fieldDocTree the content tree to which the documentation will be added
      */
-    public void buildFieldComments(XMLNode node, Content fieldDocTree) {
+    protected void buildFieldComments(Content fieldDocTree) {
         if (!configuration.nocomment) {
             writer.addComments(currentElement, fieldDocTree);
         }
@@ -190,10 +191,9 @@
     /**
      * Build the tag information.
      *
-     * @param node the XML element that specifies which components to document
      * @param fieldDocTree the content tree to which the documentation will be added
      */
-    public void buildTagInfo(XMLNode node, Content fieldDocTree) {
+    protected void buildTagInfo(Content fieldDocTree) {
         writer.addTags(currentElement, fieldDocTree);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/LayoutParser.java	Wed Jul 05 23:40:27 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.javadoc.internal.doclets.toolkit.builders;
-
-import java.io.*;
-import java.util.*;
-
-import javax.xml.parsers.*;
-
-import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
-import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
-import jdk.javadoc.internal.doclets.toolkit.util.SimpleDocletException;
-import org.xml.sax.*;
-import org.xml.sax.helpers.DefaultHandler;
-
-
-/**
- * Parse the XML that specified the order of operation for the builders.  This
- * Parser uses SAX parsing.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- *
- * @author Jamie Ho
- * @see SAXParser
- */
-public class LayoutParser extends DefaultHandler {
-
-    /**
-     * The map of XML elements that have been parsed.
-     */
-    private final Map<String,XMLNode> xmlElementsMap;
-    private XMLNode currentNode;
-    private final BaseConfiguration configuration;
-    private String currentRoot;
-    private boolean isParsing;
-
-    private LayoutParser(BaseConfiguration configuration) {
-        xmlElementsMap = new HashMap<>();
-        this.configuration = configuration;
-    }
-
-    /**
-     * Return an instance of the BuilderXML.
-     *
-     * @param configuration the current configuration of the doclet.
-     * @return an instance of the BuilderXML.
-     */
-    public static LayoutParser getInstance(BaseConfiguration configuration) {
-        return new LayoutParser(configuration);
-    }
-
-    /**
-     * Parse the XML specifying the layout of the documentation.
-     *
-     * @param root the name of the desired node
-     * @return the list of XML elements parsed.
-     * @throws DocFileIOException if there is a problem reading a user-supplied build file
-     * @throws SimpleDocletException if there is a problem reading the system build file
-     */
-    public XMLNode parseXML(String root) throws DocFileIOException, SimpleDocletException {
-        if (!xmlElementsMap.containsKey(root)) {
-            try {
-                currentRoot = root;
-                isParsing = false;
-                SAXParserFactory factory = SAXParserFactory.newInstance();
-                SAXParser saxParser = factory.newSAXParser();
-                InputStream in = configuration.getBuilderXML();
-                saxParser.parse(in, this);
-            } catch (IOException | ParserConfigurationException | SAXException e) {
-                String message = (configuration.builderXMLPath == null)
-                        ? configuration.getResources().getText("doclet.exception.read.resource",
-                                BaseConfiguration.DEFAULT_BUILDER_XML, e)
-                        : configuration.getResources().getText("doclet.exception.read.file",
-                                configuration.builderXMLPath, e);
-                throw new SimpleDocletException(message, e);
-            }
-        }
-        return xmlElementsMap.get(root);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void startElement(String namespaceURI, String sName, String qName, Attributes attrs)
-            throws SAXException {
-        if (isParsing || qName.equals(currentRoot)) {
-            isParsing = true;
-            currentNode = new XMLNode(currentNode, qName);
-            for (int i = 0; i < attrs.getLength(); i++)
-                currentNode.attrs.put(attrs.getLocalName(i), attrs.getValue(i));
-            if (qName.equals(currentRoot))
-                xmlElementsMap.put(qName, currentNode);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void endElement(String namespaceURI, String sName, String qName)
-    throws SAXException {
-        if (! isParsing) {
-            return;
-        }
-        currentNode = currentNode.parent;
-        isParsing = ! qName.equals(currentRoot);
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -32,12 +32,6 @@
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.element.VariableElement;
-import javax.lang.model.type.ArrayType;
-import javax.lang.model.type.DeclaredType;
-import javax.lang.model.type.ExecutableType;
-import javax.lang.model.type.PrimitiveType;
-import javax.lang.model.type.TypeMirror;
-import javax.lang.model.util.SimpleTypeVisitor9;
 
 import com.sun.source.doctree.DocTree;
 import com.sun.source.doctree.DocTree.Kind;
@@ -53,6 +47,9 @@
 
 /**
  * Builds the member summary.
+ * There are two anonymous subtype variants of this builder, created
+ * in the {@link #getInstance} methods. One is for general types;
+ * the other is for annotation types.
  *
  *  <p><b>This is NOT part of any supported API.
  *  If you write code that depends on this, you do so at your own risk.
@@ -62,12 +59,12 @@
  * @author Jamie Ho
  * @author Bhavesh Patel (Modified)
  */
-public class MemberSummaryBuilder extends AbstractMemberBuilder {
+public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
 
-    /**
-     * The XML root for this builder.
+    /*
+     * Comparator used to sort the members in the summary.
      */
-    public static final String NAME = "MemberSummary";
+    private final Comparator<Element> comparator;
 
     /**
      * The member summary writers for the given class.
@@ -77,7 +74,7 @@
     /**
      * The type being documented.
      */
-    private final TypeElement typeElement;
+    protected final TypeElement typeElement;
 
     /**
      * Construct a new MemberSummaryBuilder.
@@ -90,22 +87,45 @@
         super(context);
         this.typeElement = typeElement;
         memberSummaryWriters = new EnumMap<>(VisibleMemberMap.Kind.class);
+
+        comparator = utils.makeGeneralPurposeComparator();
     }
 
     /**
-     * Construct a new MemberSummaryBuilder.
+     * Construct a new MemberSummaryBuilder for a general type.
      *
      * @param classWriter   the writer for the class whose members are being
      *                      summarized.
      * @param context       the build context.
+     * @return              the instance
      */
     public static MemberSummaryBuilder getInstance(
             ClassWriter classWriter, Context context) {
-        MemberSummaryBuilder builder = new MemberSummaryBuilder(context,
-                classWriter.getTypeElement());
+        MemberSummaryBuilder builder = new MemberSummaryBuilder(context, classWriter.getTypeElement()) {
+            @Override
+            public void build(Content contentTree) {
+                buildPropertiesSummary(contentTree);
+                buildNestedClassesSummary(contentTree);
+                buildEnumConstantsSummary(contentTree);
+                buildFieldsSummary(contentTree);
+                buildConstructorsSummary(contentTree);
+                buildMethodsSummary(contentTree);
+            }
+
+            @Override
+            public boolean hasMembersToDocument() {
+                for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
+                    VisibleMemberMap members = getVisibleMemberMap(kind);
+                    if (!members.noVisibleMembers()) {
+                        return true;
+                    }
+                }
+                return false;
+            }
+        };
         WriterFactory wf = context.configuration.getWriterFactory();
         for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
-            MemberSummaryWriter msw =  builder.getVisibleMemberMap(kind).noVisibleMembers()
+            MemberSummaryWriter msw = builder.getVisibleMemberMap(kind).noVisibleMembers()
                     ? null
                     : wf.getMemberSummaryWriter(classWriter, kind);
             builder.memberSummaryWriters.put(kind, msw);
@@ -114,16 +134,29 @@
     }
 
     /**
-     * Construct a new MemberSummaryBuilder.
+     * Construct a new MemberSummaryBuilder for an annotation type.
      *
      * @param annotationTypeWriter the writer for the class whose members are
      *                             being summarized.
-     * @param configuration the current configuration of the doclet.
+     * @param context       the build context.
+     * @return              the instance
      */
     public static MemberSummaryBuilder getInstance(
             AnnotationTypeWriter annotationTypeWriter, Context context) {
         MemberSummaryBuilder builder = new MemberSummaryBuilder(context,
-                annotationTypeWriter.getAnnotationTypeElement());
+                annotationTypeWriter.getAnnotationTypeElement()) {
+            @Override
+            public void build(Content contentTree) {
+                buildAnnotationTypeFieldsSummary(contentTree);
+                buildAnnotationTypeRequiredMemberSummary(contentTree);
+                buildAnnotationTypeOptionalMemberSummary(contentTree);
+            }
+
+            @Override
+            public boolean hasMembersToDocument() {
+                return !utils.getAnnotationMembers(typeElement).isEmpty();
+            }
+        };
         WriterFactory wf = context.configuration.getWriterFactory();
         for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
             MemberSummaryWriter msw = builder.getVisibleMemberMap(kind).noVisibleMembers()
@@ -135,14 +168,6 @@
     }
 
     /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getName() {
-        return NAME;
-    }
-
-    /**
      * Return the specified visible member map.
      *
      * @param kind the kind of visible member map to return.
@@ -182,31 +207,11 @@
     }
 
     /**
-     * Return true it there are any members to summarize.
-     *
-     * @return true if there are any members to summarize.
-     */
-    @Override
-    public boolean hasMembersToDocument() {
-        if (utils.isAnnotationType(typeElement)) {
-            return !utils.getAnnotationMethods(typeElement).isEmpty();
-        }
-        for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
-            VisibleMemberMap members = getVisibleMemberMap(kind);
-            if (!members.noVisibleMembers()) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
      * Build the summary for the enum constants.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberSummaryTree the content tree to which the documentation will be added
      */
-    public void buildEnumConstantsSummary(XMLNode node, Content memberSummaryTree) {
+    protected void buildEnumConstantsSummary(Content memberSummaryTree) {
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.ENUM_CONSTANTS);
         VisibleMemberMap visibleMemberMap =
@@ -217,10 +222,9 @@
     /**
      * Build the summary for fields.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberSummaryTree the content tree to which the documentation will be added
      */
-    public void buildAnnotationTypeFieldsSummary(XMLNode node, Content memberSummaryTree) {
+    protected void buildAnnotationTypeFieldsSummary(Content memberSummaryTree) {
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS);
         VisibleMemberMap visibleMemberMap =
@@ -231,10 +235,9 @@
     /**
      * Build the summary for the optional members.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberSummaryTree the content tree to which the documentation will be added
      */
-    public void buildAnnotationTypeOptionalMemberSummary(XMLNode node, Content memberSummaryTree) {
+    protected void buildAnnotationTypeOptionalMemberSummary(Content memberSummaryTree) {
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_OPTIONAL);
         VisibleMemberMap visibleMemberMap =
@@ -245,10 +248,9 @@
     /**
      * Build the summary for the optional members.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberSummaryTree the content tree to which the documentation will be added
      */
-    public void buildAnnotationTypeRequiredMemberSummary(XMLNode node, Content memberSummaryTree) {
+    protected void buildAnnotationTypeRequiredMemberSummary(Content memberSummaryTree) {
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_REQUIRED);
         VisibleMemberMap visibleMemberMap =
@@ -259,10 +261,9 @@
     /**
      * Build the summary for the fields.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberSummaryTree the content tree to which the documentation will be added
      */
-    public void buildFieldsSummary(XMLNode node, Content memberSummaryTree) {
+    protected void buildFieldsSummary(Content memberSummaryTree) {
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.FIELDS);
         VisibleMemberMap visibleMemberMap =
@@ -272,8 +273,10 @@
 
     /**
      * Build the summary for the fields.
+     *
+     * @param memberSummaryTree the content tree to which the documentation will be added
      */
-    public void buildPropertiesSummary(XMLNode node, Content memberSummaryTree) {
+    protected void buildPropertiesSummary(Content memberSummaryTree) {
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.PROPERTIES);
         VisibleMemberMap visibleMemberMap =
@@ -284,10 +287,9 @@
     /**
      * Build the summary for the nested classes.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberSummaryTree the content tree to which the documentation will be added
      */
-    public void buildNestedClassesSummary(XMLNode node, Content memberSummaryTree) {
+    protected void buildNestedClassesSummary(Content memberSummaryTree) {
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.INNER_CLASSES);
         VisibleMemberMap visibleMemberMap =
@@ -298,10 +300,9 @@
     /**
      * Build the method summary.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberSummaryTree the content tree to which the documentation will be added
      */
-    public void buildMethodsSummary(XMLNode node, Content memberSummaryTree) {
+    protected void buildMethodsSummary(Content memberSummaryTree) {
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.METHODS);
         VisibleMemberMap visibleMemberMap =
@@ -312,10 +313,9 @@
     /**
      * Build the constructor summary.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberSummaryTree the content tree to which the documentation will be added
      */
-    public void buildConstructorsSummary(XMLNode node, Content memberSummaryTree) {
+    protected void buildConstructorsSummary(Content memberSummaryTree) {
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.CONSTRUCTORS);
         VisibleMemberMap visibleMemberMap =
@@ -521,4 +521,10 @@
             writer.addMemberTree(memberSummaryTree, memberTree);
         }
     }
+
+    private SortedSet<Element> asSortedSet(Collection<Element> members) {
+        SortedSet<Element> out = new TreeSet<>(comparator);
+        out.addAll(members);
+        return out;
+    }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -116,26 +116,25 @@
      * {@inheritDoc}
      */
     @Override
-    public String getName() {
-        return "MethodDetails";
+    public boolean hasMembersToDocument() {
+        return !methods.isEmpty();
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public boolean hasMembersToDocument() {
-        return !methods.isEmpty();
+    public void build(Content contentTree) throws DocletException {
+        buildMethodDoc(contentTree);
     }
 
     /**
      * Build the method documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildMethodDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
+    protected void buildMethodDoc(Content memberDetailsTree) throws DocletException {
         if (writer == null) {
             return;
         }
@@ -147,7 +146,12 @@
             for (Element method : methods) {
                 currentMethod = (ExecutableElement)method;
                 Content methodDocTree = writer.getMethodDocTreeHeader(currentMethod, methodDetailsTree);
-                buildChildren(node, methodDocTree);
+
+                buildSignature(methodDocTree);
+                buildDeprecationInfo(methodDocTree);
+                buildMethodComments(methodDocTree);
+                buildTagInfo(methodDocTree);
+
                 methodDetailsTree.addContent(writer.getMethodDoc(
                         methodDocTree, currentMethod == lastElement));
             }
@@ -158,20 +162,18 @@
     /**
      * Build the signature.
      *
-     * @param node the XML element that specifies which components to document
      * @param methodDocTree the content tree to which the documentation will be added
      */
-    public void buildSignature(XMLNode node, Content methodDocTree) {
+    protected void buildSignature(Content methodDocTree) {
         methodDocTree.addContent(writer.getSignature(currentMethod));
     }
 
     /**
      * Build the deprecation information.
      *
-     * @param node the XML element that specifies which components to document
      * @param methodDocTree the content tree to which the documentation will be added
      */
-    public void buildDeprecationInfo(XMLNode node, Content methodDocTree) {
+    protected void buildDeprecationInfo(Content methodDocTree) {
         writer.addDeprecated(currentMethod, methodDocTree);
     }
 
@@ -179,10 +181,9 @@
      * Build the comments for the method.  Do nothing if
      * {@link BaseConfiguration#nocomment} is set to true.
      *
-     * @param node the XML element that specifies which components to document
      * @param methodDocTree the content tree to which the documentation will be added
      */
-    public void buildMethodComments(XMLNode node, Content methodDocTree) {
+    protected void buildMethodComments(Content methodDocTree) {
         if (!configuration.nocomment) {
             ExecutableElement method = currentMethod;
             if (utils.getFullBody(currentMethod).isEmpty()) {
@@ -199,10 +200,9 @@
     /**
      * Build the tag information.
      *
-     * @param node the XML element that specifies which components to document
      * @param methodDocTree the content tree to which the documentation will be added
      */
-    public void buildTagInfo(XMLNode node, Content methodDocTree) {
+    protected void buildTagInfo(Content methodDocTree) {
         writer.addTags(currentMethod, methodDocTree);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, 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
@@ -26,8 +26,6 @@
 package jdk.javadoc.internal.doclets.toolkit.builders;
 
 import javax.lang.model.element.ModuleElement;
-import javax.lang.model.element.PackageElement;
-import javax.tools.StandardLocation;
 
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.DocletException;
@@ -46,10 +44,6 @@
  * @author Bhavesh Patel
  */
 public class ModuleSummaryBuilder extends AbstractBuilder {
-    /**
-     * The root element of the module summary XML is {@value}.
-     */
-    public static final String ROOT = "ModuleDoc";
 
     /**
      * The module being documented.
@@ -67,11 +61,6 @@
     private Content contentTree;
 
     /**
-     * The module package being documented.
-     */
-    private PackageElement pkg;
-
-    /**
      * Construct a new ModuleSummaryBuilder.
      *
      * @param context  the build context.
@@ -112,27 +101,20 @@
             //Doclet does not support this output.
             return;
         }
-        build(layoutParser.parseXML(ROOT), contentTree);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getName() {
-        return ROOT;
+        buildModuleDoc(contentTree);
     }
 
     /**
      * Build the module documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param contentTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildModuleDoc(XMLNode node, Content contentTree) throws DocletException {
+    protected void buildModuleDoc(Content contentTree) throws DocletException {
         contentTree = moduleWriter.getModuleHeader(mdle.getSimpleName().toString());
-        buildChildren(node, contentTree);
+
+        buildContent(contentTree);
+
         moduleWriter.addModuleFooter(contentTree);
         moduleWriter.printDocument(contentTree);
         utils.copyDirectory(mdle, DocPaths.moduleSummary(mdle));
@@ -141,70 +123,72 @@
     /**
      * Build the content for the module doc.
      *
-     * @param node the XML element that specifies which components to document
      * @param contentTree the content tree to which the module contents
      *                    will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildContent(XMLNode node, Content contentTree) throws DocletException {
+    protected void buildContent(Content contentTree) throws DocletException {
         Content moduleContentTree = moduleWriter.getContentHeader();
-        buildChildren(node, moduleContentTree);
+
+        buildModuleDescription(moduleContentTree);
+        buildModuleTags(moduleContentTree);
+        buildSummary(moduleContentTree);
+
         moduleWriter.addModuleContent(contentTree, moduleContentTree);
     }
 
     /**
      * Build the module summary.
      *
-     * @param node the XML element that specifies which components to document
      * @param moduleContentTree the module content tree to which the summaries will
      *                           be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildSummary(XMLNode node, Content moduleContentTree) throws DocletException {
+    protected void buildSummary(Content moduleContentTree) throws DocletException {
         Content summaryContentTree = moduleWriter.getSummaryHeader();
-        buildChildren(node, summaryContentTree);
+
+        buildPackagesSummary(summaryContentTree);
+        buildModulesSummary(summaryContentTree);
+        buildServicesSummary(summaryContentTree);
+
         moduleContentTree.addContent(moduleWriter.getSummaryTree(summaryContentTree));
     }
 
     /**
      * Build the modules summary.
      *
-     * @param node the XML element that specifies which components to document
      * @param summaryContentTree the content tree to which the summaries will
      *                           be added
      */
-    public void buildModulesSummary(XMLNode node, Content summaryContentTree) {
+    protected void buildModulesSummary(Content summaryContentTree) {
         moduleWriter.addModulesSummary(summaryContentTree);
     }
 
     /**
      * Build the package summary.
      *
-     * @param node the XML element that specifies which components to document
      * @param summaryContentTree the content tree to which the summaries will be added
      */
-    public void buildPackagesSummary(XMLNode node, Content summaryContentTree) {
+    protected void buildPackagesSummary(Content summaryContentTree) {
         moduleWriter.addPackagesSummary(summaryContentTree);
-        }
+    }
 
     /**
      * Build the services summary.
      *
-     * @param node the XML element that specifies which components to document
      * @param summaryContentTree the content tree to which the summaries will be added
      */
-    public void buildServicesSummary(XMLNode node, Content summaryContentTree) {
+    protected void buildServicesSummary(Content summaryContentTree) {
         moduleWriter.addServicesSummary(summaryContentTree);
     }
 
     /**
      * Build the description for the module.
      *
-     * @param node the XML element that specifies which components to document
      * @param moduleContentTree the tree to which the module description will
      *                           be added
      */
-    public void buildModuleDescription(XMLNode node, Content moduleContentTree) {
+    protected void buildModuleDescription(Content moduleContentTree) {
         if (!configuration.nocomment) {
             moduleWriter.addModuleDescription(moduleContentTree);
         }
@@ -213,10 +197,9 @@
     /**
      * Build the tags of the summary.
      *
-     * @param node the XML element that specifies which components to document
      * @param moduleContentTree the tree to which the module tags will be added
      */
-    public void buildModuleTags(XMLNode node, Content moduleContentTree) {
+    protected void buildModuleTags(Content moduleContentTree) {
         if (!configuration.nocomment) {
             moduleWriter.addModuleTags(moduleContentTree);
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -50,10 +50,6 @@
  * @author Bhavesh Patel (Modified)
  */
 public class PackageSummaryBuilder extends AbstractBuilder {
-    /**
-     * The root element of the package summary XML is {@value}.
-     */
-    public static final String ROOT = "PackageDoc";
 
     /**
      * The package being documented.
@@ -112,27 +108,20 @@
             //Doclet does not support this output.
             return;
         }
-        build(layoutParser.parseXML(ROOT), contentTree);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getName() {
-        return ROOT;
+        buildPackageDoc(contentTree);
     }
 
     /**
      * Build the package documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param contentTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildPackageDoc(XMLNode node, Content contentTree) throws DocletException {
+    protected void buildPackageDoc(Content contentTree) throws DocletException {
         contentTree = packageWriter.getPackageHeader(utils.getPackageName(packageElement));
-        buildChildren(node, contentTree);
+
+        buildContent(contentTree);
+
         packageWriter.addPackageFooter(contentTree);
         packageWriter.printDocument(contentTree);
         utils.copyDocFiles(packageElement);
@@ -141,39 +130,47 @@
     /**
      * Build the content for the package.
      *
-     * @param node the XML element that specifies which components to document
      * @param contentTree the content tree to which the package contents
      *                    will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildContent(XMLNode node, Content contentTree) throws DocletException {
+    protected void buildContent(Content contentTree) throws DocletException {
         Content packageContentTree = packageWriter.getContentHeader();
-        buildChildren(node, packageContentTree);
+
+        buildPackageDescription(packageContentTree);
+        buildPackageTags(packageContentTree);
+        buildSummary(packageContentTree);
+
         packageWriter.addPackageContent(contentTree, packageContentTree);
     }
 
     /**
      * Build the package summary.
      *
-     * @param node the XML element that specifies which components to document
      * @param packageContentTree the package content tree to which the summaries will
      *                           be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildSummary(XMLNode node, Content packageContentTree) throws DocletException {
+    protected void buildSummary(Content packageContentTree) throws DocletException {
         Content summaryContentTree = packageWriter.getSummaryHeader();
-        buildChildren(node, summaryContentTree);
+
+        buildInterfaceSummary(summaryContentTree);
+        buildClassSummary(summaryContentTree);
+        buildEnumSummary(summaryContentTree);
+        buildExceptionSummary(summaryContentTree);
+        buildErrorSummary(summaryContentTree);
+        buildAnnotationTypeSummary(summaryContentTree);
+
         packageContentTree.addContent(summaryContentTree);
     }
 
     /**
      * Build the summary for the interfaces in this package.
      *
-     * @param node the XML element that specifies which components to document
      * @param summaryContentTree the summary tree to which the interface summary
      *                           will be added
      */
-    public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) {
+    protected void buildInterfaceSummary(Content summaryContentTree) {
         String interfaceTableSummary =
                 configuration.getText("doclet.Member_Table_Summary",
                 configuration.getText("doclet.Interface_Summary"),
@@ -195,11 +192,10 @@
     /**
      * Build the summary for the classes in this package.
      *
-     * @param node the XML element that specifies which components to document
      * @param summaryContentTree the summary tree to which the class summary will
      *                           be added
      */
-    public void buildClassSummary(XMLNode node, Content summaryContentTree) {
+    protected void buildClassSummary(Content summaryContentTree) {
         String classTableSummary =
                 configuration.getText("doclet.Member_Table_Summary",
                 configuration.getText("doclet.Class_Summary"),
@@ -220,11 +216,10 @@
     /**
      * Build the summary for the enums in this package.
      *
-     * @param node the XML element that specifies which components to document
      * @param summaryContentTree the summary tree to which the enum summary will
      *                           be added
      */
-    public void buildEnumSummary(XMLNode node, Content summaryContentTree) {
+    protected void buildEnumSummary(Content summaryContentTree) {
         String enumTableSummary =
                 configuration.getText("doclet.Member_Table_Summary",
                 configuration.getText("doclet.Enum_Summary"),
@@ -245,11 +240,10 @@
     /**
      * Build the summary for the exceptions in this package.
      *
-     * @param node the XML element that specifies which components to document
      * @param summaryContentTree the summary tree to which the exception summary will
      *                           be added
      */
-    public void buildExceptionSummary(XMLNode node, Content summaryContentTree) {
+    protected void buildExceptionSummary(Content summaryContentTree) {
         String exceptionTableSummary =
                 configuration.getText("doclet.Member_Table_Summary",
                 configuration.getText("doclet.Exception_Summary"),
@@ -272,11 +266,10 @@
     /**
      * Build the summary for the errors in this package.
      *
-     * @param node the XML element that specifies which components to document
      * @param summaryContentTree the summary tree to which the error summary will
      *                           be added
      */
-    public void buildErrorSummary(XMLNode node, Content summaryContentTree) {
+    protected void buildErrorSummary(Content summaryContentTree) {
         String errorTableSummary =
                 configuration.getText("doclet.Member_Table_Summary",
                 configuration.getText("doclet.Error_Summary"),
@@ -298,11 +291,10 @@
     /**
      * Build the summary for the annotation type in this package.
      *
-     * @param node the XML element that specifies which components to document
      * @param summaryContentTree the summary tree to which the annotation type
      *                           summary will be added
      */
-    public void buildAnnotationTypeSummary(XMLNode node, Content summaryContentTree) {
+    protected void buildAnnotationTypeSummary(Content summaryContentTree) {
         String annotationtypeTableSummary =
                 configuration.getText("doclet.Member_Table_Summary",
                 configuration.getText("doclet.Annotation_Types_Summary"),
@@ -327,11 +319,10 @@
     /**
      * Build the description of the summary.
      *
-     * @param node the XML element that specifies which components to document
      * @param packageContentTree the tree to which the package description will
      *                           be added
      */
-    public void buildPackageDescription(XMLNode node, Content packageContentTree) {
+    protected void buildPackageDescription(Content packageContentTree) {
         if (configuration.nocomment) {
             return;
         }
@@ -341,10 +332,9 @@
     /**
      * Build the tags of the summary.
      *
-     * @param node the XML element that specifies which components to document
      * @param packageContentTree the tree to which the package tags will be added
      */
-    public void buildPackageTags(XMLNode node, Content packageContentTree) {
+    protected void buildPackageTags(Content packageContentTree) {
         if (configuration.nocomment) {
             return;
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -110,14 +110,6 @@
     }
 
     /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getName() {
-        return "PropertyDetails";
-    }
-
-    /**
      * Returns whether or not there are members to document.
      *
      * @return whether or not there are members to document
@@ -128,13 +120,20 @@
     }
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void build(Content contentTree) throws DocletException {
+        buildPropertyDoc(contentTree);
+    }
+
+    /**
      * Build the property documentation.
      *
-     * @param node the XML element that specifies which components to document
      * @param memberDetailsTree the content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildPropertyDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
+    protected void buildPropertyDoc(Content memberDetailsTree) throws DocletException {
         if (writer == null) {
             return;
         }
@@ -146,7 +145,11 @@
                 currentProperty = (ExecutableElement)property;
                 Content propertyDocTree = writer.getPropertyDocTreeHeader(currentProperty,
                         propertyDetailsTree);
-                buildChildren(node, propertyDocTree);
+
+                buildSignature(propertyDocTree);
+                buildPropertyComments(propertyDocTree);
+                buildTagInfo(propertyDocTree);
+
                 propertyDetailsTree.addContent(writer.getPropertyDoc(
                         propertyDocTree, currentProperty == lastElement));
             }
@@ -158,20 +161,18 @@
     /**
      * Build the signature.
      *
-     * @param node the XML element that specifies which components to document
      * @param propertyDocTree the content tree to which the documentation will be added
      */
-    public void buildSignature(XMLNode node, Content propertyDocTree) {
+    protected void buildSignature(Content propertyDocTree) {
         propertyDocTree.addContent(writer.getSignature(currentProperty));
     }
 
     /**
      * Build the deprecation information.
      *
-     * @param node the XML element that specifies which components to document
      * @param propertyDocTree the content tree to which the documentation will be added
      */
-    public void buildDeprecationInfo(XMLNode node, Content propertyDocTree) {
+    protected void buildDeprecationInfo(Content propertyDocTree) {
         writer.addDeprecated(currentProperty, propertyDocTree);
     }
 
@@ -179,10 +180,9 @@
      * Build the comments for the property.  Do nothing if
      * {@link BaseConfiguration#nocomment} is set to true.
      *
-     * @param node the XML element that specifies which components to document
      * @param propertyDocTree the content tree to which the documentation will be added
      */
-    public void buildPropertyComments(XMLNode node, Content propertyDocTree) {
+    protected void buildPropertyComments(Content propertyDocTree) {
         if (!configuration.nocomment) {
             writer.addComments(currentProperty, propertyDocTree);
         }
@@ -191,10 +191,9 @@
     /**
      * Build the tag information.
      *
-     * @param node the XML element that specifies which components to document
      * @param propertyDocTree the content tree to which the documentation will be added
      */
-    public void buildTagInfo(XMLNode node, Content propertyDocTree) {
+    protected void buildTagInfo(Content propertyDocTree) {
         writer.addTags(currentProperty, propertyDocTree);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java	Thu Jun 15 10:55:35 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -25,7 +25,10 @@
 
 package jdk.javadoc.internal.doclets.toolkit.builders;
 
-import java.util.*;
+
+import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
 
 import javax.lang.model.element.Element;
 import javax.lang.model.element.ExecutableElement;
@@ -55,11 +58,6 @@
 public class SerializedFormBuilder extends AbstractBuilder {
 
     /**
-     * The root element of the serialized form XML is {@value}.
-     */
-    public static final String NAME = "SerializedForm";
-
-    /**
      * The writer for this builder.
      */
     private SerializedFormWriter writer;
@@ -139,28 +137,21 @@
             //Doclet does not support this output.
             return;
         }
-        build(layoutParser.parseXML(NAME), contentTree);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getName() {
-        return NAME;
+        buildSerializedForm(contentTree);
     }
 
     /**
      * Build the serialized form.
      *
-     * @param node the XML element that specifies which components to document
      * @param serializedTree content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildSerializedForm(XMLNode node, Content serializedTree) throws DocletException {
+    protected void buildSerializedForm(Content serializedTree) throws DocletException {
         serializedTree = writer.getHeader(configuration.getText(
                 "doclet.Serialized_Form"));
-        buildChildren(node, serializedTree);
+
+        buildSerializedFormSummaries(serializedTree);
+
         writer.addFooter(serializedTree);
         writer.printDocument(serializedTree);
     }
@@ -168,16 +159,16 @@
     /**
      * Build the serialized form summaries.
      *
-     * @param node the XML element that specifies which components to document
      * @param serializedTree content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildSerializedFormSummaries(XMLNode node, Content serializedTree)
+    protected void buildSerializedFormSummaries(Content serializedTree)
             throws DocletException {
         Content serializedSummariesTree = writer.getSerializedSummariesHeader();
         for (PackageElement pkg : configuration.packages) {
             currentPackage = pkg;
-            buildChildren(node, serializedSummariesTree);
+
+            buildPackageSerializedForm(serializedSummariesTree);
         }
         serializedTree.addContent(writer.getSerializedContent(
                 serializedSummariesTree));
@@ -186,11 +177,10 @@
     /**
      * Build the package serialized form for the current package being processed.
      *
-     * @param node the XML element that specifies which components to document
      * @param serializedSummariesTree content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildPackageSerializedForm(XMLNode node, Content serializedSummariesTree) throws DocletException {
+    protected void buildPackageSerializedForm(Content serializedSummariesTree) throws DocletException {
         Content packageSerializedTree = writer.getPackageSerializedHeader();
         SortedSet<TypeElement> classes = utils.getAllClassesUnfiltered(currentPackage);
         if (classes.isEmpty()) {
@@ -202,17 +192,19 @@
         if (!serialClassFoundToDocument(classes)) {
             return;
         }
-        buildChildren(node, packageSerializedTree);
+
+        buildPackageHeader(packageSerializedTree);
+        buildClassSerializedForm(packageSerializedTree);
+
         writer.addPackageSerializedTree(serializedSummariesTree, packageSerializedTree);
     }
 
     /**
      * Build the package header.
      *
-     * @param node the XML element that specifies which components to document
      * @param packageSerializedTree content tree to which the documentation will be added
      */
-    public void buildPackageHeader(XMLNode node, Content packageSerializedTree) {
+    protected void buildPackageHeader(Content packageSerializedTree) {
         packageSerializedTree.addContent(writer.getPackageHeader(
                 utils.getPackageName(currentPackage)));
     }
@@ -220,11 +212,10 @@
     /**
      * Build the class serialized form.
      *
-     * @param node the XML element that specifies which components to document
      * @param packageSerializedTree content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildClassSerializedForm(XMLNode node, Content packageSerializedTree)
+    protected void buildClassSerializedForm(Content packageSerializedTree)
             throws DocletException {
         Content classSerializedTree = writer.getClassSerializedHeader();
         SortedSet<TypeElement> typeElements = utils.getAllClassesUnfiltered(currentPackage);
@@ -237,7 +228,10 @@
                     continue;
                 }
                 Content classTree = writer.getClassHeader(currentTypeElement);
-                buildChildren(node, classTree);
+
+                buildSerialUIDInfo(classTree);
+                buildClassContent(classTree);
+
                 classSerializedTree.addContent(classTree);
             }
         }
@@ -247,10 +241,9 @@
     /**
      * Build the serial UID information for the given class.
      *
-     * @param node the XML element that specifies which components to document
      * @param classTree content tree to which the serial UID information will be added
      */
-    public void buildSerialUIDInfo(XMLNode node, Content classTree) {
+    protected void buildSerialUIDInfo(Content classTree) {
         Content serialUidTree = writer.getSerialUIDInfoHeader();
         for (Element e : utils.getFieldsUnfiltered(currentTypeElement)) {
             VariableElement field = (VariableElement)e;
@@ -267,25 +260,26 @@
     /**
      * Build the summaries for the methods and fields.
      *
-     * @param node the XML element that specifies which components to document
      * @param classTree content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildClassContent(XMLNode node, Content classTree) throws DocletException {
+    protected void buildClassContent(Content classTree) throws DocletException {
         Content classContentTree = writer.getClassContentHeader();
-        buildChildren(node, classContentTree);
+
+        buildSerializableMethods(classContentTree);
+        buildFieldHeader(classContentTree);
+        buildSerializableFields(classContentTree);
+
         classTree.addContent(classContentTree);
     }
 
     /**
-     * Build the summaries for the methods that belong to the given
-     * class.
+     * Build the summaries for the methods that belong to the given class.
      *
-     * @param node the XML element that specifies which components to document
      * @param classContentTree content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildSerializableMethods(XMLNode node, Content classContentTree) throws DocletException {
+    protected void buildSerializableMethods(Content classContentTree) throws DocletException {
         Content serializableMethodTree = methodWriter.getSerializableMethodsHeader();
         SortedSet<ExecutableElement> members = utils.serializationMethods(currentTypeElement);
         if (!members.isEmpty()) {
@@ -293,7 +287,11 @@
                 currentMember = member;
                 Content methodsContentTree = methodWriter.getMethodsContentHeader(
                         currentMember == members.last());
-                buildChildren(node, methodsContentTree);
+
+                buildMethodSubHeader(methodsContentTree);
+                buildDeprecatedMethodInfo(methodsContentTree);
+                buildMethodInfo(methodsContentTree);
+
                 serializableMethodTree.addContent(methodsContentTree);
             }
         }
@@ -316,54 +314,51 @@
     /**
      * Build the method sub header.
      *
-     * @param node the XML element that specifies which components to document
      * @param methodsContentTree content tree to which the documentation will be added
      */
-    public void buildMethodSubHeader(XMLNode node, Content methodsContentTree)  {
+    protected void buildMethodSubHeader(Content methodsContentTree)  {
         methodWriter.addMemberHeader((ExecutableElement)currentMember, methodsContentTree);
     }
 
     /**
      * Build the deprecated method description.
      *
-     * @param node the XML element that specifies which components to document
      * @param methodsContentTree content tree to which the documentation will be added
      */
-    public void buildDeprecatedMethodInfo(XMLNode node, Content methodsContentTree) {
+    protected void buildDeprecatedMethodInfo(Content methodsContentTree) {
         methodWriter.addDeprecatedMemberInfo((ExecutableElement)currentMember, methodsContentTree);
     }
 
     /**
      * Build the information for the method.
      *
-     * @param node the XML element that specifies which components to document
      * @param methodsContentTree content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildMethodInfo(XMLNode node, Content methodsContentTree) throws DocletException  {
-        if(configuration.nocomment){
+    protected void buildMethodInfo(Content methodsContentTree) throws DocletException  {
+        if (configuration.nocomment) {
             return;
         }
-        buildChildren(node, methodsContentTree);
+
+        buildMethodDescription(methodsContentTree);
+        buildMethodTags(methodsContentTree);
     }
 
     /**
      * Build method description.
      *
-     * @param node the XML element that specifies which components to document
      * @param methodsContentTree content tree to which the documentation will be added
      */
-    public void buildMethodDescription(XMLNode node, Content methodsContentTree) {
+    protected void buildMethodDescription(Content methodsContentTree) {
         methodWriter.addMemberDescription((ExecutableElement)currentMember, methodsContentTree);
     }
 
     /**
      * Build the method tags.
      *
-     * @param node the XML element that specifies which components to document
      * @param methodsContentTree content tree to which the documentation will be added
      */
-    public void buildMethodTags(XMLNode node, Content methodsContentTree) {
+    protected void buildMethodTags(Content methodsContentTree) {
         methodWriter.addMemberTags((ExecutableElement)currentMember, methodsContentTree);
         ExecutableElement method = (ExecutableElement)currentMember;
         if (method.getSimpleName().toString().compareTo("writeExternal") == 0
@@ -380,10 +375,9 @@
     /**
      * Build the field header.
      *
-     * @param node the XML element that specifies which components to document
      * @param classContentTree content tree to which the documentation will be added
      */
-    public void buildFieldHeader(XMLNode node, Content classContentTree) {
+    protected void buildFieldHeader(Content classContentTree) {
         if (!utils.serializableFields(currentTypeElement).isEmpty()) {
             buildFieldSerializationOverview(currentTypeElement, classContentTree);
         }
@@ -419,11 +413,10 @@
     /**
      * Build the summaries for the fields that belong to the given class.
      *
-     * @param node the XML element that specifies which components to document
      * @param classContentTree content tree to which the documentation will be added
      * @throws DocletException if there is a problem while building the documentation
      */
-    public void buildSerializableFields(XMLNode node, Content classContentTree)
+    protected void buildSerializableFields(Content classContentTree)
             throws DocletException {
         SortedSet<VariableElement> members = utils.serializableFields(currentTypeElement);
         if (!members.isEmpty()) {
@@ -433,7 +426,11 @@
                 if (!utils.definesSerializableFields(currentTypeElement)) {
                     Content fieldsContentTree = fieldWriter.getFieldsContentHeader(
                             currentMember == members.last());
-                    buildChildren(node, fieldsContentTree);
+
+                    buildFieldSubHeader(fieldsContentTree);
+                    buildFieldDeprecationInfo(fieldsContentTree);
+                    buildFieldInfo(fieldsContentTree);
+
                     serializableFieldsTree.addContent(fieldsContentTree);
                 } else {
                     buildSerialFieldTagsInfo(serializableFieldsTree);
@@ -448,10 +445,9 @@
     /**
      * Build the field sub header.
      *
-     * @param node the XML element that specifies which components to document
      * @param fieldsContentTree content tree to which the documentation will be added
      */
-    public void buildFieldSubHeader(XMLNode node, Content fieldsContentTree) {
+    protected void buildFieldSubHeader(Content fieldsContentTree) {
         if (!utils.definesSerializableFields(currentTypeElement)) {
             VariableElement field = (VariableElement) currentMember;
             fieldWriter.addMemberHeader(utils.asTypeElement(field.asType()),
@@ -464,10 +460,9 @@
     /**
      * Build the field deprecation information.
      *
-     * @param node the XML element that specifies which components to document
      * @param fieldsContentTree content tree to which the documentation will be added
      */
-    public void buildFieldDeprecationInfo(XMLNode node, Content fieldsContentTree) {
+    protected void buildFieldDeprecationInfo(Content fieldsContentTree) {
         if (!utils.definesSerializableFields(currentTypeElement)) {
             fieldWriter.addMemberDeprecatedInfo((VariableElement)currentMember,
                     fieldsContentTree);
@@ -479,8 +474,8 @@
      *
      * @param serializableFieldsTree content tree to which the documentation will be added
      */
-    public void buildSerialFieldTagsInfo(Content serializableFieldsTree) {
-        if(configuration.nocomment){
+    protected void buildSerialFieldTagsInfo(Content serializableFieldsTree) {
+        if (configuration.nocomment) {
             return;
         }
         VariableElement field = (VariableElement)currentMember;
@@ -524,17 +519,16 @@
     /**
      * Build the field information.
      *
-     * @param node the XML element that specifies which components to document
      * @param fieldsContentTree content tree to which the documentation will be added
      */
-    public void buildFieldInfo(XMLNode node, Content fieldsContentTree) {
-        if(configuration.nocomment){
+    protected void buildFieldInfo(Content fieldsContentTree) {
+        if (configuration.nocomment) {
             return;
         }
         VariableElement field = (VariableElement)currentMember;
         TypeElement te = utils.getEnclosingTypeElement(currentMember);
         // Process default Serializable field.
-        if ((utils.getSerialTrees(field).isEmpty()) /*&& ! field.isSynthetic()*/
+        if ((utils.getSerialTrees(field).isEmpty()) /*&& !field.isSynthetic()*/
                 && configuration.serialwarn) {
             messages.warning(field,
                     "doclet.MissingSerialTag", utils.getFullyQualifiedName(te),
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/XMLNode.java	Wed Jul 05 23:40:27 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.javadoc.internal.doclets.toolkit.builders;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Simple class to represent the attribute and elements of an XML node.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class XMLNode {
-    XMLNode(XMLNode parent, String qname) {
-        this.parent = parent;
-        name = qname;
-        attrs = new HashMap<>();
-        children = new ArrayList<>();
-
-        if (parent != null)
-            parent.children.add(this);
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("<");
-        sb.append(name);
-        for (Map.Entry<String,String> e: attrs.entrySet())
-            sb.append(" " + e.getKey() + "=\"" + e.getValue() + "\"");
-        if (children.size() == 0)
-            sb.append("/>");
-        else {
-            sb.append(">");
-            for (XMLNode c: children)
-                sb.append(c.toString());
-            sb.append("</" + name + ">");
-        }
-        return sb.toString();
-    }
-
-    final XMLNode parent;
-    final String name;
-    final Map<String,String> attrs;
-    final List<XMLNode> children;
-}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclet.xml	Wed Jul 05 23:40:27 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,202 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-
-<!--
- Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-
-<Doclet>
-
-    <ModuleDoc>
-        <Content>
-            <ModuleDescription/>
-            <ModuleTags/>
-            <Summary>
-                <PackagesSummary/>
-                <ModulesSummary/>
-                <ServicesSummary/>
-            </Summary>
-        </Content>
-    </ModuleDoc>
-
-    <PackageDoc>
-        <Content>
-            <PackageDescription/>
-            <PackageTags/>
-            <Summary>
-                <InterfaceSummary/>
-                <ClassSummary/>
-                <EnumSummary/>
-                <ExceptionSummary/>
-                <ErrorSummary/>
-                <AnnotationTypeSummary/>
-            </Summary>
-        </Content>
-    </PackageDoc>
-
-    <AnnotationTypeDoc>
-        <AnnotationTypeInfo>
-            <DeprecationInfo/>
-            <AnnotationTypeSignature/>
-            <AnnotationTypeDescription/>
-            <AnnotationTypeTagInfo/>
-        </AnnotationTypeInfo>
-        <MemberSummary>
-            <AnnotationTypeFieldsSummary/>
-            <AnnotationTypeRequiredMemberSummary/>
-            <AnnotationTypeOptionalMemberSummary/>
-        </MemberSummary>
-        <AnnotationTypeMemberDetails>
-            <AnnotationTypeFieldDetails>
-                <AnnotationTypeField>
-                    <Signature/>
-                    <DeprecationInfo/>
-                    <MemberComments/>
-                    <TagInfo/>
-                </AnnotationTypeField>
-            </AnnotationTypeFieldDetails>
-            <AnnotationTypeRequiredMemberDetails>
-                <AnnotationTypeRequiredMember>
-                    <Signature/>
-                    <DeprecationInfo/>
-                    <MemberComments/>
-                    <TagInfo/>
-                </AnnotationTypeRequiredMember>
-            </AnnotationTypeRequiredMemberDetails>
-            <AnnotationTypeOptionalMemberDetails>
-                <AnnotationTypeOptionalMember>
-                    <Signature/>
-                    <DeprecationInfo/>
-                    <MemberComments/>
-                    <TagInfo/>
-                    <DefaultValueInfo/>
-                </AnnotationTypeOptionalMember>
-            </AnnotationTypeOptionalMemberDetails>
-        </AnnotationTypeMemberDetails>
-    </AnnotationTypeDoc>
-
-    <ClassDoc>
-        <ClassTree/>
-        <ClassInfo>
-            <TypeParamInfo/>
-            <SuperInterfacesInfo/>
-            <ImplementedInterfacesInfo/>
-            <SubClassInfo/>
-            <SubInterfacesInfo/>
-            <InterfaceUsageInfo/>
-            <NestedClassInfo/>
-            <FunctionalInterfaceInfo/>
-            <DeprecationInfo/>
-            <ClassSignature/>
-            <ClassDescription/>
-            <ClassTagInfo/>
-        </ClassInfo>
-        <MemberSummary>
-            <PropertiesSummary/>
-            <NestedClassesSummary/>
-            <EnumConstantsSummary/>
-            <FieldsSummary/>
-            <ConstructorsSummary/>
-            <MethodsSummary/>
-        </MemberSummary>
-        <MemberDetails>
-            <EnumConstantsDetails>
-                <EnumConstant>
-                    <Signature/>
-                    <DeprecationInfo/>
-                    <EnumConstantComments/>
-                    <TagInfo/>
-                </EnumConstant>
-            </EnumConstantsDetails>
-            <PropertyDetails>
-                <PropertyDoc>
-                    <Signature/>
-                    <PropertyComments/>
-                    <TagInfo/>
-                </PropertyDoc>
-            </PropertyDetails>
-            <FieldDetails>
-                <FieldDoc>
-                    <Signature/>
-                    <DeprecationInfo/>
-                    <FieldComments/>
-                    <TagInfo/>
-                </FieldDoc>
-            </FieldDetails>
-            <ConstructorDetails>
-                <ConstructorDoc>
-                    <Signature/>
-                    <DeprecationInfo/>
-                    <ConstructorComments/>
-                    <TagInfo/>
-                </ConstructorDoc>
-            </ConstructorDetails>
-            <MethodDetails>
-                <MethodDoc>
-                    <Signature/>
-                    <DeprecationInfo/>
-                    <MethodComments/>
-                    <TagInfo/>
-                </MethodDoc>
-            </MethodDetails>
-        </MemberDetails>
-    </ClassDoc>
-
-    <ConstantSummary>
-        <Contents/>
-        <ConstantSummaries>
-            <PackageHeader/>
-            <ClassConstantSummary>
-                <ConstantMembers/>
-            </ClassConstantSummary>
-        </ConstantSummaries>
-    </ConstantSummary>
-
-    <SerializedForm>
-        <SerializedFormSummaries>
-            <PackageSerializedForm>
-                <PackageHeader/>
-                <ClassSerializedForm>
-                    <SerialUIDInfo/>
-                    <ClassContent>
-                        <SerializableMethods>
-                            <MethodSubHeader/>
-                            <DeprecatedMethodInfo/>
-                            <MethodInfo>
-                                <MethodDescription/>
-                                <MethodTags/>
-                            </MethodInfo>
-                        </SerializableMethods>
-                        <FieldHeader/>
-                        <SerializableFields>
-                            <FieldSubHeader/>
-                            <FieldDeprecationInfo/>
-                            <FieldInfo/>
-                        </SerializableFields>
-                    </ClassContent>
-                </ClassSerializedForm>
-            </PackageSerializedForm>
-        </SerializedFormSummaries>
-    </SerializedForm>
-</Doclet>
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties	Wed Jul 05 23:40:27 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties	Thu Jun 15 10:55:35 2017 -0700
@@ -14,9 +14,6 @@
 doclet.Option_doclint_no_qualifiers=Access qualifiers not permitted for -Xdoclint arguments
 doclet.Option_doclint_invalid_arg=Invalid argument for -Xdoclint option
 doclet.Option_doclint_package_invalid_arg=Invalid argument for -Xdoclint/package option
-doclet.builder.exception.in.component=An exception occurred while building a component: {0}\n\
-\t({1})
-doclet.builder.unknown.component=Unknown component referenced in doclet build file: {0}
 doclet.error.initializing.dest.dir=Error initializing destination directory: {0}
 doclet.exception.read.file=Error reading file: {0}\n\
 \t({1})