changeset 1409:bfec2a1cc869

8000800: javadoc uses static non-final fields Reviewed-by: bpatel
author jjg
date Thu, 15 Nov 2012 09:18:36 -0800
parents 33abf479f202
children 467f4f754368
files src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/InheritDocTaglet.java src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletWriter.java src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java src/share/classes/com/sun/tools/javadoc/ParamTagImpl.java test/com/sun/javadoc/MetaTag/MetaTag.java test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java
diffstat 56 files changed, 794 insertions(+), 713 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Thu Nov 15 09:18:36 2012 -0800
@@ -45,7 +45,7 @@
 public abstract class AbstractExecutableMemberWriter extends AbstractMemberWriter {
 
     public AbstractExecutableMemberWriter(SubWriterHolderWriter writer,
-                                     ClassDoc classdoc) {
+            ClassDoc classdoc) {
         super(writer, classdoc);
     }
 
@@ -61,7 +61,7 @@
      * @return the display length required to write this information.
      */
     protected int addTypeParameters(ExecutableMemberDoc member, Content htmltree) {
-        LinkInfoImpl linkInfo = new LinkInfoImpl(
+        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
             LinkInfoImpl.CONTEXT_MEMBER_TYPE_PARAMS, member, false);
         String typeParameters = writer.getTypeParameterLinks(linkInfo);
         if (linkInfo.displayLength > 0) {
@@ -129,8 +129,8 @@
         boolean isVarArg, Content tree) {
         if (param.type() != null) {
             Content link = new RawHtml(writer.getLink(new LinkInfoImpl(
-                    LinkInfoImpl.CONTEXT_EXECUTABLE_MEMBER_PARAM, param.type(),
-                    isVarArg)));
+                    configuration, LinkInfoImpl.CONTEXT_EXECUTABLE_MEMBER_PARAM,
+                    param.type(), isVarArg)));
             tree.addContent(link);
         }
         if(param.name().length() > 0) {
@@ -161,7 +161,7 @@
         htmltree.addContent("(");
         Parameter[] params = member.parameters();
         String indent = makeSpace(writer.displayLength);
-        if (configuration().linksource) {
+        if (configuration.linksource) {
             //add spaces to offset indentation changes caused by link.
             indent+= makeSpace(member.name().length());
         }
@@ -212,7 +212,7 @@
     protected void addExceptions(ExecutableMemberDoc member, Content htmltree) {
         Type[] exceptions = member.thrownExceptionTypes();
         if(exceptions.length > 0) {
-            LinkInfoImpl memberTypeParam = new LinkInfoImpl(
+            LinkInfoImpl memberTypeParam = new LinkInfoImpl(configuration,
                     LinkInfoImpl.CONTEXT_MEMBER, member, false);
             int retlen = getReturnTypeLength(member);
             writer.getTypeParameterLinks(memberTypeParam);
@@ -224,7 +224,7 @@
             htmltree.addContent(indent);
             htmltree.addContent("throws ");
             indent += "       ";
-            Content link = new RawHtml(writer.getLink(new LinkInfoImpl(
+            Content link = new RawHtml(writer.getLink(new LinkInfoImpl(configuration,
                     LinkInfoImpl.CONTEXT_MEMBER, exceptions[0])));
             htmltree.addContent(link);
             for(int i = 1; i < exceptions.length; i++) {
@@ -232,7 +232,7 @@
                 htmltree.addContent(DocletConstants.NL);
                 htmltree.addContent(indent);
                 Content exceptionLink = new RawHtml(writer.getLink(new LinkInfoImpl(
-                        LinkInfoImpl.CONTEXT_MEMBER, exceptions[i])));
+                        configuration, LinkInfoImpl.CONTEXT_MEMBER, exceptions[i])));
                 htmltree.addContent(exceptionLink);
             }
         }
@@ -246,7 +246,7 @@
                 return rettype.typeName().length() +
                        rettype.dimension().length();
             } else {
-                LinkInfoImpl linkInfo = new LinkInfoImpl(
+                LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
                     LinkInfoImpl.CONTEXT_MEMBER, rettype);
                 writer.getLink(linkInfo);
                 return linkInfo.displayLength;
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Thu Nov 15 09:18:36 2012 -0800
@@ -140,7 +140,8 @@
      */
     protected void addDescription(ClassDoc cd, Content dlTree) {
         Content link = new RawHtml(
-                getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_INDEX, cd, true)));
+                getLink(new LinkInfoImpl(configuration,
+                        LinkInfoImpl.CONTEXT_INDEX, cd, true)));
         Content dt = HtmlTree.DT(link);
         dt.addContent(" - ");
         addClassInfo(cd, dt);
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Thu Nov 15 09:18:36 2012 -0800
@@ -49,15 +49,17 @@
  */
 public abstract class AbstractMemberWriter {
 
-    protected boolean printedSummaryHeader = false;
+    protected final ConfigurationImpl configuration;
     protected final SubWriterHolderWriter writer;
     protected final ClassDoc classdoc;
     public final boolean nodepr;
 
-    public AbstractMemberWriter(SubWriterHolderWriter writer,
-                             ClassDoc classdoc) {
+    protected boolean printedSummaryHeader = false;
+
+    public AbstractMemberWriter(SubWriterHolderWriter writer, ClassDoc classdoc) {
+        this.configuration = writer.configuration;
         this.writer = writer;
-        this.nodepr = configuration().nodeprecated;
+        this.nodepr = configuration.nodeprecated;
         this.classdoc = classdoc;
     }
 
@@ -281,11 +283,11 @@
                     code.addContent(new HtmlTree(HtmlTag.BR));
                 }
                 code.addContent(new RawHtml(
-                        writer.getLink(new LinkInfoImpl(
+                        writer.getLink(new LinkInfoImpl(configuration,
                         LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type))));
             } else {
                 code.addContent(new RawHtml(
-                        writer.getLink(new LinkInfoImpl(
+                        writer.getLink(new LinkInfoImpl(configuration,
                         LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type))));
             }
 
@@ -305,7 +307,7 @@
         } else if (member.isPrivate()) {
             code.addContent("private ");
         } else if (!member.isPublic()) { // Package private
-            code.addContent(configuration().getText("doclet.Package_private"));
+            code.addContent(configuration.getText("doclet.Package_private"));
             code.addContent(" ");
         }
         if (member.isMethod() && ((MethodDoc)member).isAbstract()) {
@@ -389,7 +391,7 @@
             String tableSummary, String[] tableHeader, Content contentTree) {
         if (deprmembers.size() > 0) {
             Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
-                writer.getTableCaption(configuration().getText(headingKey)));
+                writer.getTableCaption(configuration.getText(headingKey)));
             table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
             Content tbody = new HtmlTree(HtmlTag.TBODY);
             for (int i = 0; i < deprmembers.size(); i++) {
@@ -507,8 +509,8 @@
     }
 
     protected void serialWarning(SourcePosition pos, String key, String a1, String a2) {
-        if (configuration().serialwarn) {
-            ConfigurationImpl.getInstance().getDocletSpecificMsg().warning(pos, key, a1, a2);
+        if (configuration.serialwarn) {
+            configuration.getDocletSpecificMsg().warning(pos, key, a1, a2);
         }
     }
 
@@ -516,10 +518,6 @@
         return nodepr? Util.excludeDeprecatedMembers(members): members;
     }
 
-    public ConfigurationImpl configuration() {
-        return writer.configuration;
-    }
-
     /**
      * Add the member summary for the given class.
      *
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java	Thu Nov 15 09:18:36 2012 -0800
@@ -138,7 +138,7 @@
             for (int i = 0; i < interfaces.length; i++) {
                 if (parent != interfaces[i]) {
                     if (! (interfaces[i].isPublic() ||
-                            Util.isLinkable(interfaces[i], configuration()))) {
+                            Util.isLinkable(interfaces[i], configuration))) {
                         continue;
                     }
                     if (counter == 0) {
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Thu Nov 15 09:18:36 2012 -0800
@@ -159,10 +159,11 @@
             String label = italicsClassName(cd, false);
             Content linkContent;
             if(wantFrames){
-                linkContent = new RawHtml(getLink(new LinkInfoImpl(
+                linkContent = new RawHtml(getLink(new LinkInfoImpl(configuration,
                         LinkInfoImpl.ALL_CLASSES_FRAME, cd, label, "classFrame")));
             } else {
-                linkContent = new RawHtml(getLink(new LinkInfoImpl(cd, label)));
+                linkContent = new RawHtml(getLink(new LinkInfoImpl(
+                        configuration, cd, label)));
             }
             Content li = HtmlTree.LI(linkContent);
             content.addContent(li);
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -103,16 +103,16 @@
      * {@inheritDoc}
      */
     public String getTableSummary() {
-        return configuration().getText("doclet.Member_Table_Summary",
-                configuration().getText("doclet.Annotation_Type_Optional_Member_Summary"),
-                configuration().getText("doclet.annotation_type_optional_members"));
+        return configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Annotation_Type_Optional_Member_Summary"),
+                configuration.getText("doclet.annotation_type_optional_members"));
     }
 
     /**
      * {@inheritDoc}
      */
     public String getCaption() {
-        return configuration().getText("doclet.Annotation_Type_Optional_Members");
+        return configuration.getText("doclet.Annotation_Type_Optional_Members");
     }
 
     /**
@@ -121,9 +121,9 @@
     public String[] getSummaryTableHeader(ProgramElementDoc member) {
         String[] header = new String[] {
             writer.getModifierTypeHeader(),
-            configuration().getText("doclet.0_and_1",
-                    configuration().getText("doclet.Annotation_Type_Optional_Member"),
-                    configuration().getText("doclet.Description"))
+            configuration.getText("doclet.0_and_1",
+                    configuration.getText("doclet.Annotation_Type_Optional_Member"),
+                    configuration.getText("doclet.Description"))
         };
         return header;
     }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -52,7 +52,7 @@
      * @param annotationType the AnnotationType that holds this member.
      */
     public AnnotationTypeRequiredMemberWriterImpl(SubWriterHolderWriter writer,
-        AnnotationTypeDoc annotationType) {
+            AnnotationTypeDoc annotationType) {
         super(writer, annotationType);
     }
 
@@ -106,11 +106,11 @@
         writer.addAnnotationInfo(member, pre);
         addModifiers(member, pre);
         Content link = new RawHtml(
-                writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
-                getType(member))));
+                writer.getLink(new LinkInfoImpl(configuration,
+                        LinkInfoImpl.CONTEXT_MEMBER, getType(member))));
         pre.addContent(link);
         pre.addContent(writer.getSpace());
-        if (configuration().linksource) {
+        if (configuration.linksource) {
             Content memberName = new StringContent(member.name());
             writer.addSrcLink(member, memberName, pre);
         } else {
@@ -175,16 +175,16 @@
      * {@inheritDoc}
      */
     public String getTableSummary() {
-        return configuration().getText("doclet.Member_Table_Summary",
-                configuration().getText("doclet.Annotation_Type_Required_Member_Summary"),
-                configuration().getText("doclet.annotation_type_required_members"));
+        return configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Annotation_Type_Required_Member_Summary"),
+                configuration.getText("doclet.annotation_type_required_members"));
     }
 
     /**
      * {@inheritDoc}
      */
     public String getCaption() {
-        return configuration().getText("doclet.Annotation_Type_Required_Members");
+        return configuration.getText("doclet.Annotation_Type_Required_Members");
     }
 
     /**
@@ -193,9 +193,9 @@
     public String[] getSummaryTableHeader(ProgramElementDoc member) {
         String[] header = new String[] {
             writer.getModifierTypeHeader(),
-            configuration().getText("doclet.0_and_1",
-                    configuration().getText("doclet.Annotation_Type_Required_Member"),
-                    configuration().getText("doclet.Description"))
+            configuration.getText("doclet.0_and_1",
+                    configuration.getText("doclet.Annotation_Type_Required_Member"),
+                    configuration.getText("doclet.Description"))
         };
         return header;
     }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -65,10 +65,10 @@
      * @param prevType the previous class that was documented.
      * @param nextType the next class being documented.
      */
-    public AnnotationTypeWriterImpl(AnnotationTypeDoc annotationType,
-            Type prevType, Type nextType)
+    public AnnotationTypeWriterImpl(ConfigurationImpl configuration,
+            AnnotationTypeDoc annotationType, Type prevType, Type nextType)
             throws Exception {
-        super(ConfigurationImpl.getInstance(), DocPath.forClass(annotationType));
+        super(configuration, DocPath.forClass(annotationType));
         this.annotationType = annotationType;
         configuration.currentcd = annotationType.asClassDoc();
         this.prev = prevType;
@@ -116,7 +116,7 @@
     public Content getNavLinkPrevious() {
         Content li;
         if (prev != null) {
-            Content prevLink = new RawHtml(getLink(new LinkInfoImpl(
+            Content prevLink = new RawHtml(getLink(new LinkInfoImpl(configuration,
                     LinkInfoImpl.CONTEXT_CLASS, prev.asClassDoc(), "",
                     configuration.getText("doclet.Prev_Class"), true)));
             li = HtmlTree.LI(prevLink);
@@ -134,7 +134,7 @@
     public Content getNavLinkNext() {
         Content li;
         if (next != null) {
-            Content nextLink = new RawHtml(getLink(new LinkInfoImpl(
+            Content nextLink = new RawHtml(getLink(new LinkInfoImpl(configuration,
                     LinkInfoImpl.CONTEXT_CLASS, next.asClassDoc(), "",
                     configuration.getText("doclet.Next_Class"), true)));
             li = HtmlTree.LI(nextLink);
@@ -162,7 +162,7 @@
             Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
             div.addContent(pkgNameDiv);
         }
-        LinkInfoImpl linkInfo = new LinkInfoImpl(
+        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
                 LinkInfoImpl.CONTEXT_CLASS_HEADER, annotationType, false);
         Content headerContent = new StringContent(header);
         Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
@@ -219,11 +219,11 @@
         Content pre = new HtmlTree(HtmlTag.PRE);
         addAnnotationInfo(annotationType, pre);
         pre.addContent(modifiers);
-        LinkInfoImpl linkInfo = new LinkInfoImpl(
+        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
                 LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, annotationType, false);
         Content annotationName = new StringContent(annotationType.name());
         Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo));
-        if (configuration().linksource) {
+        if (configuration.linksource) {
             addSrcLink(annotationType, annotationName, pre);
             pre.addContent(parameterLinks);
         } else {
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Thu Nov 15 09:18:36 2012 -0800
@@ -256,9 +256,9 @@
      */
     protected void addPackageList(Content contentTree) throws IOException {
         Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
-                getTableCaption(configuration().getText(
+                getTableCaption(configuration.getText(
                 "doclet.ClassUse_Packages.that.use.0",
-                getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
+                getLink(new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
                 false)))));
         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
         Content tbody = new HtmlTree(HtmlTag.TBODY);
@@ -287,14 +287,14 @@
     protected void addPackageAnnotationList(Content contentTree) throws IOException {
         if ((!classdoc.isAnnotationType()) ||
                 pkgToPackageAnnotations == null ||
-                pkgToPackageAnnotations.size() == 0) {
+                pkgToPackageAnnotations.isEmpty()) {
             return;
         }
         Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
-                getTableCaption(configuration().getText(
+                getTableCaption(configuration.getText(
                 "doclet.ClassUse_PackageAnnotation",
-                getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
-                false)))));
+                getLink(new LinkInfoImpl(configuration,
+                        LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, false)))));
         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
         Content tbody = new HtmlTree(HtmlTag.TBODY);
         Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
@@ -333,7 +333,7 @@
             Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(pkg.name()));
             Content link = new RawHtml(
                     configuration.getText("doclet.ClassUse_Uses.of.0.in.1",
-                    getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER,
+                    getLink(new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_CLASS_USE_HEADER,
                     classdoc, false)),
                     getPackageLinkString(pkg, Util.getPackageName(pkg), false)));
             Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
@@ -368,7 +368,7 @@
      * @param contentTree the content tree to which the class use information will be added
      */
     protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException {
-        String classLink = getLink(new LinkInfoImpl(
+        String classLink = getLink(new LinkInfoImpl(configuration,
             LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, false));
         String pkgLink = getPackageLinkString(pkg, Util.getPackageName(pkg), false);
         classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()),
@@ -477,8 +477,8 @@
      */
     protected Content getNavLinkClass() {
         Content linkContent = new RawHtml(getLink(new LinkInfoImpl(
-                LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, "",
-                configuration.getText("doclet.Class"), false)));
+                configuration, LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
+                "", configuration.getText("doclet.Class"), false)));
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -34,6 +34,7 @@
 import com.sun.tools.doclets.internal.toolkit.builders.*;
 import com.sun.tools.doclets.internal.toolkit.taglets.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
+import java.io.IOException;
 
 /**
  * Generate the Class Information Page.
@@ -56,24 +57,25 @@
 public class ClassWriterImpl extends SubWriterHolderWriter
         implements ClassWriter {
 
-    protected ClassDoc classDoc;
+    protected final ClassDoc classDoc;
 
-    protected ClassTree classtree;
+    protected final ClassTree classtree;
 
-    protected ClassDoc prev;
+    protected final ClassDoc prev;
 
-    protected ClassDoc next;
+    protected final ClassDoc next;
 
     /**
+     * @param configuration the configuration data for the doclet
      * @param classDoc the class being documented.
      * @param prevClass the previous class that was documented.
      * @param nextClass the next class being documented.
      * @param classTree the class tree for the given class.
      */
-    public ClassWriterImpl (ClassDoc classDoc,
+    public ClassWriterImpl (ConfigurationImpl configuration, ClassDoc classDoc,
             ClassDoc prevClass, ClassDoc nextClass, ClassTree classTree)
-            throws Exception {
-        super(ConfigurationImpl.getInstance(), DocPath.forClass(classDoc));
+            throws IOException {
+        super(configuration, DocPath.forClass(classDoc));
         this.classDoc = classDoc;
         configuration.currentcd = classDoc;
         this.classtree = classTree;
@@ -122,7 +124,7 @@
     public Content getNavLinkPrevious() {
         Content li;
         if (prev != null) {
-            Content prevLink = new RawHtml(getLink(new LinkInfoImpl(
+            Content prevLink = new RawHtml(getLink(new LinkInfoImpl(configuration,
                     LinkInfoImpl.CONTEXT_CLASS, prev, "",
                     configuration.getText("doclet.Prev_Class"), true)));
             li = HtmlTree.LI(prevLink);
@@ -140,7 +142,7 @@
     public Content getNavLinkNext() {
         Content li;
         if (next != null) {
-            Content nextLink = new RawHtml(getLink(new LinkInfoImpl(
+            Content nextLink = new RawHtml(getLink(new LinkInfoImpl(configuration,
                     LinkInfoImpl.CONTEXT_CLASS, next, "",
                     configuration.getText("doclet.Next_Class"), true)));
             li = HtmlTree.LI(nextLink);
@@ -168,8 +170,8 @@
             Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
             div.addContent(pkgNameDiv);
         }
-        LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl.CONTEXT_CLASS_HEADER,
-                classDoc, false);
+        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
+                LinkInfoImpl.CONTEXT_CLASS_HEADER, classDoc, false);
         //Let's not link to ourselves in the header.
         linkInfo.linkToSelf = false;
         Content headerContent = new StringContent(header);
@@ -228,13 +230,13 @@
         Content pre = new HtmlTree(HtmlTag.PRE);
         addAnnotationInfo(classDoc, pre);
         pre.addContent(modifiers);
-        LinkInfoImpl linkInfo = new LinkInfoImpl(
+        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
                 LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, classDoc, false);
         //Let's not link to ourselves in the signature.
         linkInfo.linkToSelf = false;
         Content className = new StringContent(classDoc.name());
         Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo));
-        if (configuration().linksource) {
+        if (configuration.linksource) {
             addSrcLink(classDoc, className, pre);
             pre.addContent(parameterLinks);
         } else {
@@ -244,11 +246,11 @@
         }
         if (!isInterface) {
             Type superclass = Util.getFirstVisibleSuperClass(classDoc,
-                    configuration());
+                    configuration);
             if (superclass != null) {
                 pre.addContent(DocletConstants.NL);
                 pre.addContent("extends ");
-                Content link = new RawHtml(getLink(new LinkInfoImpl(
+                Content link = new RawHtml(getLink(new LinkInfoImpl(configuration,
                         LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME,
                         superclass)));
                 pre.addContent(link);
@@ -260,7 +262,7 @@
             for (int i = 0; i < implIntfacs.length; i++) {
                 ClassDoc classDoc = implIntfacs[i].asClassDoc();
                 if (! (classDoc.isPublic() ||
-                        Util.isLinkable(classDoc, configuration()))) {
+                        Util.isLinkable(classDoc, configuration))) {
                     continue;
                 }
                 if (counter == 0) {
@@ -269,7 +271,7 @@
                 } else {
                     pre.addContent(", ");
                 }
-                Content link = new RawHtml(getLink(new LinkInfoImpl(
+                Content link = new RawHtml(getLink(new LinkInfoImpl(configuration,
                         LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME,
                         implIntfacs[i])));
                 pre.addContent(link);
@@ -315,7 +317,7 @@
         do {
             sup = Util.getFirstVisibleSuperClass(
                     type instanceof ClassDoc ? (ClassDoc) type : type.asClassDoc(),
-                    configuration());
+                    configuration);
             if (sup != null) {
                 HtmlTree ul = new HtmlTree(HtmlTag.UL);
                 ul.addStyle(HtmlStyle.inheritance);
@@ -345,7 +347,7 @@
         Content li = new HtmlTree(HtmlTag.LI);
         if (type.equals(classDoc)) {
             String typeParameters = getTypeParameterLinks(
-                    new LinkInfoImpl(LinkInfoImpl.CONTEXT_TREE,
+                    new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_TREE,
                     classDoc, false));
             if (configuration.shouldExcludeQualifier(
                     classDoc.containingPackage().name())) {
@@ -356,7 +358,7 @@
                 li.addContent(new RawHtml(typeParameters));
             }
         } else {
-            Content link = new RawHtml(getLink(new LinkInfoImpl(
+            Content link = new RawHtml(getLink(new LinkInfoImpl(configuration,
                     LinkInfoImpl.CONTEXT_CLASS_TREE_PARENT,
                     type instanceof ClassDoc ? (ClassDoc) type : type,
                     configuration.getClassName(type.asClassDoc()), false)));
@@ -504,8 +506,8 @@
             Content dt = HtmlTree.DT(label);
             Content dl = HtmlTree.DL(dt);
             Content dd = new HtmlTree(HtmlTag.DD);
-            dd.addContent(new RawHtml(getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, outerClass,
-                    false))));
+            dd.addContent(new RawHtml(getLink(new LinkInfoImpl(configuration,
+                    LinkInfoImpl.CONTEXT_CLASS, outerClass, false))));
             dl.addContent(dd);
             classInfoTree.addContent(dl);
         }
@@ -549,11 +551,11 @@
             }
             if (typeList[i] instanceof ClassDoc) {
                 Content link = new RawHtml(getLink(
-                        new LinkInfoImpl(context, (ClassDoc)(typeList[i]))));
+                        new LinkInfoImpl(configuration, context, (ClassDoc)(typeList[i]))));
                 dd.addContent(link);
             } else {
                 Content link = new RawHtml(getLink(
-                        new LinkInfoImpl(context, (Type)(typeList[i]))));
+                        new LinkInfoImpl(configuration, context, (Type)(typeList[i]))));
                 dd.addContent(link);
             }
         }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -57,8 +57,6 @@
  */
 public class ConfigurationImpl extends Configuration {
 
-    private static ConfigurationImpl instance = new ConfigurationImpl();
-
     /**
      * The build date.  Note: For now, we will use
      * a version number instead of a date.
@@ -183,32 +181,18 @@
     /**
      * The classdoc for the class file getting generated.
      */
-    public ClassDoc currentcd = null;  // Set this classdoc in the
-    // ClassWriter.
+    public ClassDoc currentcd = null;  // Set this classdoc in the ClassWriter.
 
     /**
      * Constructor. Initializes resource for the
      * {@link com.sun.tools.doclets.internal.toolkit.util.MessageRetriever MessageRetriever}.
      */
-    private ConfigurationImpl() {
+    public ConfigurationImpl() {
         standardmessage = new MessageRetriever(this,
             "com.sun.tools.doclets.formats.html.resources.standard");
     }
 
     /**
-     * Reset to a fresh new ConfigurationImpl, to allow multiple invocations
-     * of javadoc within a single VM. It would be better not to be using
-     * static fields at all, but .... (sigh).
-     */
-    public static void reset() {
-        instance = new ConfigurationImpl();
-    }
-
-    public static ConfigurationImpl getInstance() {
-        return instance;
-    }
-
-    /**
      * Return the build date for the doclet.
      */
     public String getDocletSpecificBuildDate() {
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -184,9 +184,9 @@
      */
     public Content getConstantMembersHeader(ClassDoc cd) {
         //generate links backward only to public classes.
-        String classlink = (cd.isPublic() || cd.isProtected())?
-            getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, cd,
-                false)) :
+        String classlink = (cd.isPublic() || cd.isProtected()) ?
+            getLink(new LinkInfoImpl(configuration,
+                    LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, cd, false)) :
             cd.qualifiedName();
         String name = cd.containingPackage().name();
         if (name.length() > 0) {
@@ -260,7 +260,7 @@
             code.addContent(modifier);
             code.addContent(getSpace());
         }
-        Content type = new RawHtml(getLink(new LinkInfoImpl(
+        Content type = new RawHtml(getLink(new LinkInfoImpl(configuration,
                 LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member.type())));
         code.addContent(type);
         tdType.addContent(code);
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -60,7 +60,7 @@
             ClassDoc classDoc) {
         super(writer, classDoc);
         VisibleMemberMap visibleMemberMap = new VisibleMemberMap(classDoc,
-            VisibleMemberMap.CONSTRUCTORS, configuration().nodeprecated);
+            VisibleMemberMap.CONSTRUCTORS, configuration.nodeprecated);
         List<ProgramElementDoc> constructors = new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
         for (int i = 0; i < constructors.size(); i++) {
             if ((constructors.get(i)).isProtected() ||
@@ -130,7 +130,7 @@
         Content pre = new HtmlTree(HtmlTag.PRE);
         writer.addAnnotationInfo(constructor, pre);
         addModifiers(constructor, pre);
-        if (configuration().linksource) {
+        if (configuration.linksource) {
             Content constructorName = new StringContent(constructor.name());
             writer.addSrcLink(constructor, constructorName, pre);
         } else {
@@ -217,16 +217,16 @@
      * {@inheritDoc}
      */
     public String getTableSummary() {
-        return configuration().getText("doclet.Member_Table_Summary",
-                configuration().getText("doclet.Constructor_Summary"),
-                configuration().getText("doclet.constructors"));
+        return configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Constructor_Summary"),
+                configuration.getText("doclet.constructors"));
     }
 
     /**
      * {@inheritDoc}
      */
     public String getCaption() {
-        return configuration().getText("doclet.Constructors");
+        return configuration.getText("doclet.Constructors");
     }
 
     /**
@@ -236,17 +236,17 @@
         String[] header;
         if (foundNonPubConstructor) {
             header = new String[] {
-                configuration().getText("doclet.Modifier"),
-                configuration().getText("doclet.0_and_1",
-                        configuration().getText("doclet.Constructor"),
-                        configuration().getText("doclet.Description"))
+                configuration.getText("doclet.Modifier"),
+                configuration.getText("doclet.0_and_1",
+                        configuration.getText("doclet.Constructor"),
+                        configuration.getText("doclet.Description"))
             };
         }
         else {
             header = new String[] {
-                configuration().getText("doclet.0_and_1",
-                        configuration().getText("doclet.Constructor"),
-                        configuration().getText("doclet.Description"))
+                configuration.getText("doclet.0_and_1",
+                        configuration.getText("doclet.Constructor"),
+                        configuration.getText("doclet.Description"))
             };
         }
         return header;
@@ -313,7 +313,7 @@
                 code.addContent(writer.getSpace());
             } else {
                 code.addContent(
-                        configuration().getText("doclet.Package_private"));
+                        configuration.getText("doclet.Package_private"));
             }
             tdSummaryType.addContent(code);
         }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -101,11 +101,11 @@
         Content pre = new HtmlTree(HtmlTag.PRE);
         writer.addAnnotationInfo(enumConstant, pre);
         addModifiers(enumConstant, pre);
-        Content enumConstantLink = new RawHtml(writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
-                enumConstant.type())));
+        Content enumConstantLink = new RawHtml(writer.getLink(new LinkInfoImpl(
+                configuration, LinkInfoImpl.CONTEXT_MEMBER, enumConstant.type())));
         pre.addContent(enumConstantLink);
         pre.addContent(" ");
-        if (configuration().linksource) {
+        if (configuration.linksource) {
             Content enumConstantName = new StringContent(enumConstant.name());
             writer.addSrcLink(enumConstant, enumConstantName, pre);
         } else {
@@ -174,16 +174,16 @@
      * {@inheritDoc}
      */
     public String getTableSummary() {
-        return configuration().getText("doclet.Member_Table_Summary",
-                configuration().getText("doclet.Enum_Constant_Summary"),
-                configuration().getText("doclet.enum_constants"));
+        return configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Enum_Constant_Summary"),
+                configuration.getText("doclet.enum_constants"));
     }
 
     /**
      * {@inheritDoc}
      */
     public String getCaption() {
-        return configuration().getText("doclet.Enum_Constants");
+        return configuration.getText("doclet.Enum_Constants");
     }
 
     /**
@@ -191,9 +191,9 @@
      */
     public String[] getSummaryTableHeader(ProgramElementDoc member) {
         String[] header = new String[] {
-            configuration().getText("doclet.0_and_1",
-                    configuration().getText("doclet.Enum_Constant"),
-                    configuration().getText("doclet.Description"))
+            configuration.getText("doclet.0_and_1",
+                    configuration.getText("doclet.Enum_Constant"),
+                    configuration.getText("doclet.Description"))
         };
         return header;
     }
@@ -266,7 +266,7 @@
             return writer.getHyperLink((cd == null)?
                 "enum_constant_summary":
                 "enum_constants_inherited_from_class_" +
-                configuration().getClassName(cd),
+                configuration.getClassName(cd),
                 writer.getResource("doclet.navEnum"));
         } else {
             return writer.getResource("doclet.navEnum");
--- a/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -102,11 +102,11 @@
         Content pre = new HtmlTree(HtmlTag.PRE);
         writer.addAnnotationInfo(field, pre);
         addModifiers(field, pre);
-        Content fieldlink = new RawHtml(writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
-                field.type())));
+        Content fieldlink = new RawHtml(writer.getLink(new LinkInfoImpl(
+                configuration, LinkInfoImpl.CONTEXT_MEMBER, field.type())));
         pre.addContent(fieldlink);
         pre.addContent(" ");
-        if (configuration().linksource) {
+        if (configuration.linksource) {
             Content fieldName = new StringContent(field.name());
             writer.addSrcLink(field, fieldName, pre);
         } else {
@@ -129,7 +129,7 @@
         ClassDoc holder = field.containingClass();
         if (field.inlineTags().length > 0) {
             if (holder.equals(classdoc) ||
-                    (! (holder.isPublic() || Util.isLinkable(holder, configuration())))) {
+                    (! (holder.isPublic() || Util.isLinkable(holder, configuration)))) {
                 writer.addInlineComment(field, fieldDocTree);
             } else {
                 Content link = new RawHtml(
@@ -195,16 +195,16 @@
      * {@inheritDoc}
      */
     public String getTableSummary() {
-        return configuration().getText("doclet.Member_Table_Summary",
-                configuration().getText("doclet.Field_Summary"),
-                configuration().getText("doclet.fields"));
+        return configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Field_Summary"),
+                configuration.getText("doclet.fields"));
     }
 
     /**
      * {@inheritDoc}
      */
     public String getCaption() {
-        return configuration().getText("doclet.Fields");
+        return configuration.getText("doclet.Fields");
     }
 
     /**
@@ -213,9 +213,9 @@
     public String[] getSummaryTableHeader(ProgramElementDoc member) {
         String[] header = new String[] {
             writer.getModifierTypeHeader(),
-            configuration().getText("doclet.0_and_1",
-                    configuration().getText("doclet.Field"),
-                    configuration().getText("doclet.Description"))
+            configuration.getText("doclet.0_and_1",
+                    configuration.getText("doclet.Field"),
+                    configuration.getText("doclet.Description"))
         };
         return header;
     }
@@ -232,7 +232,7 @@
      */
     public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
         inheritedTree.addContent(writer.getMarkerAnchor(
-                "fields_inherited_from_class_" + configuration().getClassName(cd)));
+                "fields_inherited_from_class_" + configuration.getClassName(cd)));
     }
 
     /**
@@ -242,8 +242,8 @@
         Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
                 LinkInfoImpl.CONTEXT_MEMBER, cd, false));
         Content label = new StringContent(cd.isClass() ?
-            configuration().getText("doclet.Fields_Inherited_From_Class") :
-            configuration().getText("doclet.Fields_Inherited_From_Interface"));
+            configuration.getText("doclet.Fields_Inherited_From_Class") :
+            configuration.getText("doclet.Fields_Inherited_From_Interface"));
         Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
                 label);
         labelHeading.addContent(writer.getSpace());
@@ -296,7 +296,7 @@
             return writer.getHyperLink((cd == null)?
                 "field_summary":
                 "fields_inherited_from_class_" +
-                configuration().getClassName(cd),
+                configuration.getClassName(cd),
                 writer.getResource("doclet.navField"));
         } else {
             return writer.getResource("doclet.navField");
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Thu Nov 15 09:18:36 2012 -0800
@@ -46,14 +46,17 @@
  *
  */
 public class HtmlDoclet extends AbstractDoclet {
+    // An instance will be created by validOptions, and used by start.
+    private static HtmlDoclet docletToStart = null;
+
     public HtmlDoclet() {
-        configuration = (ConfigurationImpl) configuration();
+        configuration = new ConfigurationImpl();
     }
 
     /**
      * The global configuration information for this run.
      */
-    public ConfigurationImpl configuration;
+    public final ConfigurationImpl configuration;
 
     /**
      * The "start" method as required by Javadoc.
@@ -63,12 +66,16 @@
      * @return true if the doclet ran without encountering any errors.
      */
     public static boolean start(RootDoc root) {
-        try {
-            HtmlDoclet doclet = new HtmlDoclet();
-            return doclet.start(doclet, root);
-        } finally {
-            ConfigurationImpl.reset();
+        // In typical use, options will have been set up by calling validOptions,
+        // which will create an HtmlDoclet for use here.
+        HtmlDoclet doclet;
+        if (docletToStart != null) {
+            doclet = docletToStart;
+            docletToStart = null;
+        } else {
+            doclet = new HtmlDoclet();
         }
+        return doclet.start(doclet, root);
     }
 
     /**
@@ -77,7 +84,7 @@
      * configuration.
      */
     public Configuration configuration() {
-        return ConfigurationImpl.getInstance();
+        return configuration;
     }
 
     /**
@@ -220,6 +227,9 @@
         }
     }
 
+    public static final ConfigurationImpl sharedInstanceForOptions =
+            new ConfigurationImpl();
+
     /**
      * Check for doclet added options here.
      *
@@ -228,7 +238,7 @@
      */
     public static int optionLength(String option) {
         // Construct temporary configuration for check
-        return (ConfigurationImpl.getInstance()).optionLength(option);
+        return sharedInstanceForOptions.optionLength(option);
     }
 
     /**
@@ -244,8 +254,8 @@
      */
     public static boolean validOptions(String options[][],
             DocErrorReporter reporter) {
-        // Construct temporary configuration for check
-        return (ConfigurationImpl.getInstance()).validOptions(options, reporter);
+        docletToStart = new HtmlDoclet();
+        return docletToStart.configuration.validOptions(options, reporter);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Thu Nov 15 09:18:36 2012 -0800
@@ -82,7 +82,7 @@
     /**
      * The global configuration information for this run.
      */
-    public ConfigurationImpl configuration;
+    public final ConfigurationImpl configuration;
 
     /**
      * To check whether annotation heading is printed or not.
@@ -302,7 +302,7 @@
      */
     public void printHtmlDocument(String[] metakeywords, boolean includeScript,
             Content body) throws IOException {
-        Content htmlDocType = DocType.Transitional();
+        Content htmlDocType = DocType.TRANSITIONAL;
         Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
         Content head = new HtmlTree(HtmlTag.HEAD);
         if (!configuration.notimestamp) {
@@ -835,7 +835,7 @@
             String tableSummary, String[] tableHeader, Content contentTree) {
         if (deprPkgs.size() > 0) {
             Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
-                    getTableCaption(configuration().getText(headingKey)));
+                    getTableCaption(configuration.getText(headingKey)));
             table.addContent(getSummaryTableHeader(tableHeader, "col"));
             Content tbody = new HtmlTree(HtmlTag.TBODY);
             for (int i = 0; i < deprPkgs.size(); i++) {
@@ -1079,7 +1079,7 @@
      * @return a content tree for the link
      */
     public Content getQualifiedClassLink(int context, ClassDoc cd) {
-        return new RawHtml(getLink(new LinkInfoImpl(context, cd,
+        return new RawHtml(getLink(new LinkInfoImpl(configuration, context, cd,
                 configuration.getClassName(cd), "")));
     }
 
@@ -1110,7 +1110,8 @@
         if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) {
             classlink = getPkgName(cd);
         }
-        classlink += getLink(new LinkInfoImpl(context, cd, cd.name(), isStrong));
+        classlink += getLink(new LinkInfoImpl(configuration,
+                context, cd, cd.name(), isStrong));
         return classlink;
     }
 
@@ -1130,7 +1131,7 @@
         if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) {
             contentTree.addContent(getPkgName(cd));
         }
-        contentTree.addContent(new RawHtml(getLink(new LinkInfoImpl(
+        contentTree.addContent(new RawHtml(getLink(new LinkInfoImpl(configuration,
                 context, cd, cd.name(), isStrong))));
     }
 
@@ -1187,14 +1188,14 @@
     public String getDocLink(int context, ClassDoc classDoc, MemberDoc doc,
         String label, boolean strong) {
         if (! (doc.isIncluded() ||
-            Util.isLinkable(classDoc, configuration()))) {
+            Util.isLinkable(classDoc, configuration))) {
             return label;
         } else if (doc instanceof ExecutableMemberDoc) {
             ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
-            return getLink(new LinkInfoImpl(context, classDoc,
+            return getLink(new LinkInfoImpl(configuration, context, classDoc,
                 getAnchor(emd), label, strong));
         } else if (doc instanceof MemberDoc) {
-            return getLink(new LinkInfoImpl(context, classDoc,
+            return getLink(new LinkInfoImpl(configuration, context, classDoc,
                 doc.name(), label, strong));
         } else {
             return label;
@@ -1215,14 +1216,14 @@
     public Content getDocLink(int context, ClassDoc classDoc, MemberDoc doc,
         String label) {
         if (! (doc.isIncluded() ||
-            Util.isLinkable(classDoc, configuration()))) {
+            Util.isLinkable(classDoc, configuration))) {
             return new StringContent(label);
         } else if (doc instanceof ExecutableMemberDoc) {
             ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
-            return new RawHtml(getLink(new LinkInfoImpl(context, classDoc,
+            return new RawHtml(getLink(new LinkInfoImpl(configuration, context, classDoc,
                 getAnchor(emd), label, false)));
         } else if (doc instanceof MemberDoc) {
-            return new RawHtml(getLink(new LinkInfoImpl(context, classDoc,
+            return new RawHtml(getLink(new LinkInfoImpl(configuration, context, classDoc,
                 doc.name(), label, false)));
         } else {
             return new StringContent(label);
@@ -1302,7 +1303,7 @@
             if (label.isEmpty()) {
                 label = plainOrCodeText(plain, refClass.name());
             }
-            return getLink(new LinkInfoImpl(refClass, label));
+            return getLink(new LinkInfoImpl(configuration, refClass, label));
         } else if (refMem == null) {
             // Must be a member reference since refClass is not null and refMemName is not null.
             // However, refMem is null, so this referenced member does not exist.
@@ -1313,7 +1314,7 @@
             ClassDoc containing = refMem.containingClass();
             if (see.text().trim().startsWith("#") &&
                 ! (containing.isPublic() ||
-                Util.isLinkable(containing, configuration()))) {
+                Util.isLinkable(containing, configuration))) {
                 // Since the link is relative and the holder is not even being
                 // documented, this must be an inherited link.  Redirect it.
                 // The current class either overrides the referenced member or
@@ -1502,7 +1503,7 @@
                 StringBuilder textBuff = new StringBuilder();
                 while (lines.hasMoreTokens()) {
                     StringBuilder line = new StringBuilder(lines.nextToken());
-                    Util.replaceTabs(configuration.sourcetab, line);
+                    Util.replaceTabs(configuration, line);
                     textBuff.append(line.toString());
                 }
                 result.append(textBuff);
@@ -1784,7 +1785,7 @@
                 continue;
             }
             annotation = new StringBuilder();
-            LinkInfoImpl linkInfo = new LinkInfoImpl(
+            LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
                 LinkInfoImpl.CONTEXT_ANNOTATION, annotationDoc);
             linkInfo.label = "@" + annotationDoc.name();
             annotation.append(getLink(linkInfo));
@@ -1835,7 +1836,7 @@
         if (annotationValue.value() instanceof Type) {
             Type type = (Type) annotationValue.value();
             if (type.asClassDoc() != null) {
-                LinkInfoImpl linkInfo = new LinkInfoImpl(
+                LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
                     LinkInfoImpl.CONTEXT_ANNOTATION, type);
                     linkInfo.label = (type.asClassDoc().isIncluded() ?
                         type.typeName() :
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java	Thu Nov 15 09:18:36 2012 -0800
@@ -130,7 +130,7 @@
             pre.addContent(fieldTypeStr);
         } else {
             Content fieldContent = new RawHtml(writer.getLink(new LinkInfoImpl(
-                    LinkInfoImpl.CONTEXT_SERIAL_MEMBER, fieldType)));
+                    configuration, LinkInfoImpl.CONTEXT_SERIAL_MEMBER, fieldType)));
             pre.addContent(fieldContent);
         }
         pre.addContent(fieldDimensions + " ");
@@ -187,8 +187,8 @@
      */
     public void addMemberTags(FieldDoc field, Content contentTree) {
         TagletOutputImpl output = new TagletOutputImpl("");
-        TagletWriter.genTagOuput(configuration().tagletManager, field,
-                configuration().tagletManager.getCustomTags(field),
+        TagletWriter.genTagOuput(configuration.tagletManager, field,
+                configuration.tagletManager.getCustomTags(field),
                 writer.getTagletWriterInstance(false), output);
         String outputString = output.toString().trim();
         Content dlTags = new HtmlTree(HtmlTag.DL);
@@ -208,7 +208,7 @@
      * @return true if overview details need to be printed
      */
     public boolean shouldPrintOverview(FieldDoc field) {
-        if (!configuration().nocomment) {
+        if (!configuration.nocomment) {
             if(!field.commentText().isEmpty() ||
                     writer.hasSerializationOverviewTags(field))
                 return true;
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java	Thu Nov 15 09:18:36 2012 -0800
@@ -148,7 +148,7 @@
     public void addMemberTags(MethodDoc member, Content methodsContentTree) {
         TagletOutputImpl output = new TagletOutputImpl("");
         TagletManager tagletManager =
-            ConfigurationImpl.getInstance().tagletManager;
+            configuration.tagletManager;
         TagletWriter.genTagOuput(tagletManager, member,
             tagletManager.getSerializedFormTags(),
             writer.getTagletWriterInstance(false), output);
--- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -74,7 +74,7 @@
         StringBuilder label = new StringBuilder(
             classLinkInfo.getClassLinkLabel(m_writer.configuration));
         classLinkInfo.displayLength += label.length();
-        Configuration configuration = ConfigurationImpl.getInstance();
+        Configuration configuration = m_writer.configuration;
         LinkOutputImpl linkOutput = new LinkOutputImpl();
         if (classDoc.isIncluded()) {
             if (configuration.isGeneratedDoc(classDoc)) {
@@ -118,8 +118,8 @@
      */
     protected LinkOutput getTypeParameterLink(LinkInfo linkInfo,
         Type typeParam) {
-        LinkInfoImpl typeLinkInfo = new LinkInfoImpl(linkInfo.getContext(),
-            typeParam);
+        LinkInfoImpl typeLinkInfo = new LinkInfoImpl(m_writer.configuration,
+                linkInfo.getContext(), typeParam);
         typeLinkInfo.excludeTypeBounds = linkInfo.excludeTypeBounds;
         typeLinkInfo.excludeTypeParameterLinks = linkInfo.excludeTypeParameterLinks;
         typeLinkInfo.linkToSelf = linkInfo.linkToSelf;
@@ -135,10 +135,10 @@
      * @return the tool tip for the appropriate class.
      */
     private String getClassToolTip(ClassDoc classDoc, boolean isTypeLink) {
-        Configuration configuration = ConfigurationImpl.getInstance();
+        Configuration configuration = m_writer.configuration;
         if (isTypeLink) {
             return configuration.getText("doclet.Href_Type_Param_Title",
-            classDoc.name());
+                classDoc.name());
         } else if (classDoc.isInterface()){
             return configuration.getText("doclet.Href_Interface_Title",
                 Util.getPackageName(classDoc.containingPackage()));
--- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -198,6 +198,8 @@
      */
     public static final int CONTEXT_CLASS_USE_HEADER = 33;
 
+    public final ConfigurationImpl configuration;
+
     /**
      * The integer indicating the location of the link.
      */
@@ -214,20 +216,22 @@
     public String styleName ="";
 
     /**
-     * The valueof the target.
+     * The value of the target.
      */
     public String target = "";
 
     /**
      * Construct a LinkInfo object.
      *
+     * @param configuration the configuration data for the doclet
      * @param context    the context of the link.
      * @param classDoc   the class to link to.
      * @param label      the label for the link.
      * @param target     the value of the target attribute.
      */
-    public LinkInfoImpl (int context, ClassDoc classDoc, String label,
-            String target){
+    public LinkInfoImpl(ConfigurationImpl configuration,
+            int context, ClassDoc classDoc, String label, String target) {
+        this.configuration = configuration;
         this.classDoc = classDoc;
         this.label = label;
         this.target = target;
@@ -237,6 +241,7 @@
     /**
      * Construct a LinkInfo object.
      *
+     * @param configuration the configuration data for the doclet
      * @param context    the context of the link.
      * @param classDoc   the class to link to.
      * @param where      the value of the marker #.
@@ -244,8 +249,10 @@
      * @param isStrong       true if the link should be strong.
      * @param styleName  String style of text defined in style sheet.
      */
-    public LinkInfoImpl (int context, ClassDoc classDoc, String where, String label,
-            boolean isStrong, String styleName){
+    public LinkInfoImpl(ConfigurationImpl configuration,
+            int context, ClassDoc classDoc, String where, String label,
+            boolean isStrong, String styleName) {
+        this.configuration = configuration;
         this.classDoc = classDoc;
         this.where = where;
         this.label = label;
@@ -257,14 +264,17 @@
     /**
      * Construct a LinkInfo object.
      *
+     * @param configuration the configuration data for the doclet
      * @param context    the context of the link.
      * @param classDoc   the class to link to.
      * @param where      the value of the marker #.
      * @param label      the label for the link.
      * @param isStrong       true if the link should be strong.
      */
-    public LinkInfoImpl (int context, ClassDoc classDoc, String where, String label,
-            boolean isStrong){
+    public LinkInfoImpl(ConfigurationImpl configuration,
+            int context, ClassDoc classDoc, String where, String label,
+            boolean isStrong) {
+        this.configuration = configuration;
         this.classDoc = classDoc;
         this.where = where;
         this.label = label;
@@ -275,10 +285,13 @@
     /**
      * Construct a LinkInfo object.
      *
+     * @param configuration the configuration data for the doclet
      * @param classDoc   the class to link to.
      * @param label      the label for the link.
      */
-    public LinkInfoImpl (ClassDoc classDoc, String label){
+    public LinkInfoImpl(ConfigurationImpl configuration,
+            ClassDoc classDoc, String label) {
+        this.configuration = configuration;
         this.classDoc = classDoc;
         this.label = label;
         setContext(context);
@@ -287,12 +300,15 @@
     /**
      * Construct a LinkInfo object.
      *
+     * @param configuration the configuration data for the doclet
      * @param context               the context of the link.
      * @param executableMemberDoc   the member to link to.
      * @param isStrong                true if the link should be strong.
      */
-    public LinkInfoImpl (int context, ExecutableMemberDoc executableMemberDoc,
-            boolean isStrong){
+    public LinkInfoImpl(ConfigurationImpl configuration,
+            int context, ExecutableMemberDoc executableMemberDoc,
+            boolean isStrong) {
+        this.configuration = configuration;
         this.executableMemberDoc = executableMemberDoc;
         this.isStrong = isStrong;
         setContext(context);
@@ -301,11 +317,14 @@
     /**
      * Construct a LinkInfo object.
      *
+     * @param configuration the configuration data for the doclet
      * @param context    the context of the link.
      * @param classDoc   the class to link to.
      * @param isStrong       true if the link should be strong.
      */
-    public LinkInfoImpl (int context, ClassDoc classDoc,  boolean isStrong){
+    public LinkInfoImpl(ConfigurationImpl configuration,
+            int context, ClassDoc classDoc,  boolean isStrong) {
+        this.configuration = configuration;
         this.classDoc = classDoc;
         this.isStrong = isStrong;
         setContext(context);
@@ -314,10 +333,13 @@
     /**
      * Construct a LinkInfo object.
      *
+     * @param configuration the configuration data for the doclet
      * @param context    the context of the link.
      * @param type       the class to link to.
      */
-    public LinkInfoImpl (int context, Type type){
+    public LinkInfoImpl(ConfigurationImpl configuration,
+            int context, Type type) {
+        this.configuration = configuration;
         this.type = type;
         setContext(context);
     }
@@ -325,11 +347,14 @@
     /**
      * Construct a LinkInfo object.
      *
+     * @param configuration the configuration data for the doclet
      * @param context    the context of the link.
      * @param type       the class to link to.
      * @param isVarArg   true if this is a link to a var arg.
      */
-    public LinkInfoImpl (int context, Type type, boolean isVarArg){
+    public LinkInfoImpl(ConfigurationImpl configuration,
+            int context, Type type, boolean isVarArg) {
+        this.configuration = configuration;
         this.type = type;
         this.isVarArg = isVarArg;
         setContext(context);
@@ -338,13 +363,16 @@
     /**
      * Construct a LinkInfo object.
      *
+     * @param configuration the configuration data for the doclet
      * @param context    the context of the link.
      * @param type       the class to link to.
      * @param label      the label for the link.
      * @param isStrong     true if the link should be strong.
      */
-    public LinkInfoImpl (int context, Type type, String label,
-            boolean isStrong){
+    public LinkInfoImpl(ConfigurationImpl configuration,
+            int context, Type type, String label,
+            boolean isStrong) {
+        this.configuration = configuration;
         this.type = type;
         this.label = label;
         this.isStrong = isStrong;
@@ -354,13 +382,16 @@
     /**
      * Construct a LinkInfo object.
      *
+     * @param configuration the configuration data for the doclet
      * @param context    the context of the link.
      * @param classDoc   the class to link to.
      * @param label      the label for the link.
      * @param isStrong       true if the link should be strong.
      */
-    public LinkInfoImpl (int context, ClassDoc classDoc, String label,
-            boolean isStrong){
+    public LinkInfoImpl(ConfigurationImpl configuration,
+            int context, ClassDoc classDoc, String label,
+            boolean isStrong) {
+        this.configuration = configuration;
         this.classDoc = classDoc;
         this.label = label;
         this.isStrong = isStrong;
@@ -448,6 +479,6 @@
      * desired place.
      */
     public boolean isLinkable() {
-        return Util.isLinkable(classDoc, ConfigurationImpl.getInstance());
+        return Util.isLinkable(classDoc, configuration);
     }
 }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -123,7 +123,7 @@
         addModifiers(method, pre);
         addTypeParameters(method, pre);
         addReturnType(method, pre);
-        if (configuration().linksource) {
+        if (configuration.linksource) {
             Content methodName = new StringContent(method.name());
             writer.addSrcLink(method, methodName, pre);
         } else {
@@ -149,7 +149,7 @@
         if (method.inlineTags().length > 0) {
             if (holder.asClassDoc().equals(classdoc) ||
                     (! (holderClassDoc.isPublic() ||
-                    Util.isLinkable(holderClassDoc, configuration())))) {
+                    Util.isLinkable(holderClassDoc, configuration)))) {
                 writer.addInlineComment(method, methodDocTree);
             } else {
                 Content link = new RawHtml(
@@ -215,16 +215,16 @@
      * {@inheritDoc}
      */
     public String getTableSummary() {
-        return configuration().getText("doclet.Member_Table_Summary",
-                configuration().getText("doclet.Method_Summary"),
-                configuration().getText("doclet.methods"));
+        return configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Method_Summary"),
+                configuration.getText("doclet.methods"));
     }
 
     /**
      * {@inheritDoc}
      */
     public String getCaption() {
-        return configuration().getText("doclet.Methods");
+        return configuration.getText("doclet.Methods");
     }
 
     /**
@@ -233,9 +233,9 @@
     public String[] getSummaryTableHeader(ProgramElementDoc member) {
         String[] header = new String[] {
             writer.getModifierTypeHeader(),
-            configuration().getText("doclet.0_and_1",
-                    configuration().getText("doclet.Method"),
-                    configuration().getText("doclet.Description"))
+            configuration.getText("doclet.0_and_1",
+                    configuration.getText("doclet.Method"),
+                    configuration.getText("doclet.Description"))
         };
         return header;
     }
@@ -253,7 +253,7 @@
     public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
         inheritedTree.addContent(writer.getMarkerAnchor(
                 "methods_inherited_from_class_" +
-                configuration().getClassName(cd)));
+                configuration.getClassName(cd)));
     }
 
     /**
@@ -263,8 +263,8 @@
         Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
                 LinkInfoImpl.CONTEXT_MEMBER, cd, false));
         Content label = new StringContent(cd.isClass() ?
-            configuration().getText("doclet.Methods_Inherited_From_Class") :
-            configuration().getText("doclet.Methods_Inherited_From_Interface"));
+            configuration.getText("doclet.Methods_Inherited_From_Class") :
+            configuration.getText("doclet.Methods_Inherited_From_Interface"));
         Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
                 label);
         labelHeading.addContent(writer.getSpace());
@@ -285,12 +285,12 @@
      */
     protected static void addOverridden(HtmlDocletWriter writer,
             Type overriddenType, MethodDoc method, Content dl) {
-        if(writer.configuration.nocomment){
+        if (writer.configuration.nocomment) {
             return;
         }
         ClassDoc holderClassDoc = overriddenType.asClassDoc();
         if (! (holderClassDoc.isPublic() ||
-            Util.isLinkable(holderClassDoc, writer.configuration()))) {
+            Util.isLinkable(holderClassDoc, writer.configuration))) {
             //This is an implementation detail that should not be documented.
             return;
         }
@@ -303,7 +303,7 @@
         int context = LinkInfoImpl.CONTEXT_METHOD_OVERRIDES;
 
         if (method != null) {
-            if(overriddenType.asClassDoc().isAbstract() && method.isAbstract()){
+            if (overriddenType.asClassDoc().isAbstract() && method.isAbstract()){
                 //Abstract method is implemented from abstract class,
                 //not overridden
                 label = writer.specifiedByLabel;
@@ -312,11 +312,11 @@
             Content dt = HtmlTree.DT(HtmlTree.STRONG(label));
             dl.addContent(dt);
             Content overriddenTypeLink = new RawHtml(
-                    writer.getLink(new LinkInfoImpl(context, overriddenType)));
+                    writer.getLink(new LinkInfoImpl(writer.configuration, context, overriddenType)));
             Content codeOverridenTypeLink = HtmlTree.CODE(overriddenTypeLink);
             String name = method.name();
             Content methlink = new RawHtml(writer.getLink(
-                    new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
+                    new LinkInfoImpl(writer.configuration, LinkInfoImpl.CONTEXT_MEMBER,
                     overriddenType.asClassDoc(),
                     writer.getAnchor(method), name, false)));
             Content codeMethLink = HtmlTree.CODE(methlink);
@@ -362,7 +362,7 @@
             MethodDoc implementedMeth = implementedMethods[i];
             Type intfac = implementedMethodsFinder.getMethodHolder(implementedMeth);
             Content intfaclink = new RawHtml(writer.getLink(new LinkInfoImpl(
-                    LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY, intfac)));
+                    writer.configuration, LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY, intfac)));
             Content codeIntfacLink = HtmlTree.CODE(intfaclink);
             Content dt = HtmlTree.DT(HtmlTree.STRONG(writer.specifiedByLabel));
             dl.addContent(dt);
@@ -389,7 +389,7 @@
         Type type = method.returnType();
         if (type != null) {
             Content linkContent = new RawHtml(writer.getLink(
-                    new LinkInfoImpl(LinkInfoImpl.CONTEXT_RETURN_TYPE, type)));
+                    new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_RETURN_TYPE, type)));
             htmltree.addContent(linkContent);
             htmltree.addContent(writer.getSpace());
         }
@@ -403,7 +403,7 @@
             return writer.getHyperLink((cd == null)?
                 "method_summary":
                 "methods_inherited_from_class_" +
-                configuration().getClassName(cd),
+                configuration.getClassName(cd),
                 writer.getResource("doclet.navMethod"));
         } else {
             return writer.getResource("doclet.navMethod");
--- a/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -93,16 +93,16 @@
      * {@inheritDoc}
      */
     public String getTableSummary() {
-        return configuration().getText("doclet.Member_Table_Summary",
-                configuration().getText("doclet.Nested_Class_Summary"),
-                configuration().getText("doclet.nested_classes"));
+        return configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Nested_Class_Summary"),
+                configuration.getText("doclet.nested_classes"));
     }
 
     /**
      * {@inheritDoc}
      */
     public String getCaption() {
-        return configuration().getText("doclet.Nested_Classes");
+        return configuration.getText("doclet.Nested_Classes");
     }
 
     /**
@@ -113,17 +113,17 @@
         if (member.isInterface()) {
             header = new String[] {
                 writer.getModifierTypeHeader(),
-                configuration().getText("doclet.0_and_1",
-                        configuration().getText("doclet.Interface"),
-                        configuration().getText("doclet.Description"))
+                configuration.getText("doclet.0_and_1",
+                        configuration.getText("doclet.Interface"),
+                        configuration.getText("doclet.Description"))
             };
         }
         else {
             header = new String[] {
                 writer.getModifierTypeHeader(),
-                configuration().getText("doclet.0_and_1",
-                        configuration().getText("doclet.Class"),
-                        configuration().getText("doclet.Description"))
+                configuration.getText("doclet.0_and_1",
+                        configuration.getText("doclet.Class"),
+                        configuration.getText("doclet.Description"))
             };
         }
         return header;
@@ -151,8 +151,8 @@
         Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
                 LinkInfoImpl.CONTEXT_MEMBER, cd, false));
         Content label = new StringContent(cd.isInterface() ?
-            configuration().getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") :
-            configuration().getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
+            configuration.getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") :
+            configuration.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
         Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
                 label);
         labelHeading.addContent(writer.getSpace());
@@ -166,7 +166,7 @@
     protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
             Content tdSummary) {
         Content strong = HtmlTree.STRONG(new RawHtml(
-                writer.getLink(new LinkInfoImpl(context, (ClassDoc)member, false))));
+                writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member, false))));
         Content code = HtmlTree.CODE(strong);
         tdSummary.addContent(code);
     }
@@ -177,7 +177,7 @@
     protected void addInheritedSummaryLink(ClassDoc cd,
             ProgramElementDoc member, Content linksTree) {
         linksTree.addContent(new RawHtml(
-                writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
+                writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_MEMBER,
                 (ClassDoc)member, false))));
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Thu Nov 15 09:18:36 2012 -0800
@@ -121,7 +121,7 @@
      * @param contentTree the content tree to which the listing will be added
      */
     protected void addClassListing(Content contentTree) {
-        Configuration config = configuration();
+        Configuration config = configuration;
         if (packageDoc.isIncluded()) {
             addClassKindListing(packageDoc.interfaces(),
                 getResource("doclet.Interfaces"), contentTree);
@@ -181,7 +181,7 @@
                     contentTree.addContent(heading);
                     printedHeader = true;
                 }
-                Content link = new RawHtml (getLink(new LinkInfoImpl(
+                Content link = new RawHtml (getLink(new LinkInfoImpl(configuration,
                         LinkInfoImpl.PACKAGE_FRAME, arr[i],
                         (arr[i].isInterface() ? italicsText(arr[i].name()) :
                             arr[i].name()),"classFrame")));
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Thu Nov 15 09:18:36 2012 -0800
@@ -152,7 +152,7 @@
      */
     protected void addPackageList(Content contentTree) throws IOException {
         Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
-                getTableCaption(configuration().getText(
+                getTableCaption(configuration.getText(
                 "doclet.ClassUse_Packages.that.use.0",
                 getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false))));
         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
@@ -197,7 +197,7 @@
             String tableSummary = configuration.getText("doclet.Use_Table_Summary",
                     configuration.getText("doclet.classes"));
             Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
-                    getTableCaption(configuration().getText(
+                    getTableCaption(configuration.getText(
                     "doclet.ClassUse_Classes.in.0.used.by.1",
                     getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false),
                     getPackageLinkString(usingPackage,Util.getPackageName(usingPackage), false))));
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -179,7 +179,8 @@
                     continue;
                 }
                 Content classContent = new RawHtml(getLink(new LinkInfoImpl(
-                        LinkInfoImpl.CONTEXT_PACKAGE, classes[i], false)));
+                        configuration, LinkInfoImpl.CONTEXT_PACKAGE, classes[i],
+                        false)));
                 Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
                 HtmlTree tr = HtmlTree.TR(tdClass);
                 if (i%2 == 0)
--- a/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -46,11 +46,13 @@
     implements SerializedFormWriter {
 
     /**
+     * @param configuration the configuration data for the doclet
      * @throws IOException
      * @throws DocletAbortException
      */
-    public SerializedFormWriterImpl() throws IOException {
-        super(ConfigurationImpl.getInstance(), DocPaths.SERIALIZED_FORM);
+    public SerializedFormWriterImpl(ConfigurationImpl configuration)
+            throws IOException {
+        super(configuration, DocPaths.SERIALIZED_FORM);
     }
 
     /**
@@ -126,15 +128,16 @@
      */
     public Content getClassHeader(ClassDoc classDoc) {
         String classLink = (classDoc.isPublic() || classDoc.isProtected())?
-            getLink(new LinkInfoImpl(classDoc,
+            getLink(new LinkInfoImpl(configuration, classDoc,
             configuration.getClassName(classDoc))):
             classDoc.qualifiedName();
         Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(
                 classDoc.qualifiedName()));
         String superClassLink =
             classDoc.superclassType() != null ?
-                getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_SERIALIZED_FORM,
-                classDoc.superclassType())) :
+                getLink(new LinkInfoImpl(configuration,
+                        LinkInfoImpl.CONTEXT_SERIALIZED_FORM,
+                        classDoc.superclassType())) :
                 null;
 
         //Print the heading.
--- a/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java	Thu Nov 15 09:18:36 2012 -0800
@@ -60,16 +60,24 @@
      */
     private static final Content NEW_LINE = new RawHtml(DocletConstants.NL);
 
+    private final ConfigurationImpl configuration;
+
+    private final RootDoc rootDoc;
+
+    private DocPath outputdir;
+
     /**
      * Relative path from the documentation root to the file that is being
      * generated.
      */
-    private static DocPath relativePath = DocPath.empty;
+    private DocPath relativePath = DocPath.empty;
 
-    /**
-     * Source is converted to HTML using static methods below.
-     */
-    private SourceToHTMLConverter() {}
+    private SourceToHTMLConverter(ConfigurationImpl configuration, RootDoc rd,
+            DocPath outputdir) {
+        this.configuration  = configuration;
+        this.rootDoc = rd;
+        this.outputdir = outputdir;
+    }
 
     /**
      * Convert the Classes in the given RootDoc to an HTML.
@@ -80,36 +88,38 @@
      */
     public static void convertRoot(ConfigurationImpl configuration, RootDoc rd,
             DocPath outputdir) {
-        if (rd == null || outputdir == null) {
+        new SourceToHTMLConverter(configuration, rd, outputdir).generate();
+    }
+
+    void generate() {
+        if (rootDoc == null || outputdir == null) {
             return;
         }
-        PackageDoc[] pds = rd.specifiedPackages();
+        PackageDoc[] pds = rootDoc.specifiedPackages();
         for (int i = 0; i < pds.length; i++) {
             // If -nodeprecated option is set and the package is marked as deprecated,
             // do not convert the package files to HTML.
             if (!(configuration.nodeprecated && Util.isDeprecated(pds[i])))
-                convertPackage(configuration, pds[i], outputdir);
+                convertPackage(pds[i], outputdir);
         }
-        ClassDoc[] cds = rd.specifiedClasses();
+        ClassDoc[] cds = rootDoc.specifiedClasses();
         for (int i = 0; i < cds.length; i++) {
             // If -nodeprecated option is set and the class is marked as deprecated
             // or the containing package is deprecated, do not convert the
             // package files to HTML.
             if (!(configuration.nodeprecated &&
                     (Util.isDeprecated(cds[i]) || Util.isDeprecated(cds[i].containingPackage()))))
-                convertClass(configuration, cds[i], outputdir);
+                convertClass(cds[i], outputdir);
         }
     }
 
     /**
      * Convert the Classes in the given Package to an HTML.
      *
-     * @param configuration the configuration.
      * @param pd the Package to convert.
      * @param outputdir the name of the directory to output to.
      */
-    public static void convertPackage(ConfigurationImpl configuration, PackageDoc pd,
-            DocPath outputdir) {
+    public void convertPackage(PackageDoc pd, DocPath outputdir) {
         if (pd == null) {
             return;
         }
@@ -120,19 +130,17 @@
             // containing package deprecation since it is already check in
             // the calling method above.
             if (!(configuration.nodeprecated && Util.isDeprecated(cds[i])))
-                convertClass(configuration, cds[i], outputdir);
+                convertClass(cds[i], outputdir);
         }
     }
 
     /**
      * Convert the given Class to an HTML.
      *
-     * @param configuration the configuration.
      * @param cd the class to convert.
      * @param outputdir the name of the directory to output to.
      */
-    public static void convertClass(ConfigurationImpl configuration, ClassDoc cd,
-            DocPath outputdir) {
+    public void convertClass(ClassDoc cd, DocPath outputdir) {
         if (cd == null) {
             return;
         }
@@ -164,7 +172,7 @@
             try {
                 while ((line = reader.readLine()) != null) {
                     addLineNo(pre, lineno);
-                    addLine(pre, line, configuration.sourcetab, lineno);
+                    addLine(pre, line, lineno);
                     lineno++;
                 }
             } finally {
@@ -173,7 +181,7 @@
             addBlankLines(pre);
             Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
             body.addContent(div);
-            writeToFile(body, outputdir.resolve(DocPath.forClass(cd)), configuration);
+            writeToFile(body, outputdir.resolve(DocPath.forClass(cd)));
         } catch (IOException e) {
             e.printStackTrace();
         }
@@ -184,15 +192,13 @@
      *
      * @param body the documentation content to be written to the file.
      * @param path the path for the file.
-     * @param configuration the Doclet configuration to pass notices to.
      */
-    private static void writeToFile(Content body, DocPath path,
-            ConfigurationImpl configuration) throws IOException {
-        Content htmlDocType = DocType.Transitional();
+    private void writeToFile(Content body, DocPath path) throws IOException {
+        Content htmlDocType = DocType.TRANSITIONAL;
         Content head = new HtmlTree(HtmlTag.HEAD);
         head.addContent(HtmlTree.TITLE(new StringContent(
                 configuration.getText("doclet.Window_Source_title"))));
-        head.addContent(getStyleSheetProperties(configuration));
+        head.addContent(getStyleSheetProperties());
         Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
                 head, body);
         Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree);
@@ -210,10 +216,9 @@
     /**
      * Returns a link to the stylesheet file.
      *
-     * @param configuration the doclet configuration for the current run of javadoc
      * @return an HtmlTree for the lINK tag which provides the stylesheet location
      */
-    public static HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) {
+    public HtmlTree getStyleSheetProperties() {
         String filename = configuration.stylesheetfile;
         DocPath stylesheet;
         if (filename.length() > 0) {
@@ -260,14 +265,13 @@
      *
      * @param pre the content tree to which the line will be added.
      * @param line the string to format.
-     * @param tabLength the number of spaces for each tab.
      * @param currentLineNo the current number.
      */
-    private static void addLine(Content pre, String line, int tabLength,
-            int currentLineNo) {
+    private void addLine(Content pre, String line, int currentLineNo) {
         if (line != null) {
-            StringBuilder lineBuffer = new StringBuilder(Util.escapeHtmlChars(line));
-            Util.replaceTabs(tabLength, lineBuffer);
+            StringBuilder lineBuffer = new StringBuilder(line);
+            Util.replaceTabs(configuration, lineBuffer);
+            Util.escapeHtmlChars(lineBuffer);
             pre.addContent(new RawHtml(lineBuffer.toString()));
             Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo));
             pre.addContent(anchor);
--- a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -46,11 +46,13 @@
 
 public class TagletWriterImpl extends TagletWriter {
 
-    private HtmlDocletWriter htmlWriter;
+    private final HtmlDocletWriter htmlWriter;
+    private final ConfigurationImpl configuration;
 
     public TagletWriterImpl(HtmlDocletWriter htmlWriter, boolean isFirstSentence) {
+        super(isFirstSentence);
         this.htmlWriter = htmlWriter;
-        this.isFirstSentence = isFirstSentence;
+        configuration = htmlWriter.configuration;
     }
 
     /**
@@ -64,8 +66,8 @@
      * {@inheritDoc}
      */
     public TagletOutput getDocRootOutput() {
-        if (htmlWriter.configuration.docrootparent.length() > 0)
-            return new TagletOutputImpl(htmlWriter.configuration.docrootparent);
+        if (configuration.docrootparent.length() > 0)
+            return new TagletOutputImpl(configuration.docrootparent);
         else if (htmlWriter.pathToRoot.isEmpty())
             return new TagletOutputImpl(".");
         else
@@ -81,7 +83,7 @@
         if (doc instanceof ClassDoc) {
             if (Util.isDeprecated((ProgramElementDoc) doc)) {
                 output.append("<span class=\"strong\">" +
-                    ConfigurationImpl.getInstance().
+                    configuration.
                         getText("doclet.Deprecated") + "</span>&nbsp;");
                 if (deprs.length > 0) {
                     Tag[] commentTags = deprs[0].inlineTags();
@@ -97,7 +99,7 @@
             MemberDoc member = (MemberDoc) doc;
             if (Util.isDeprecated((ProgramElementDoc) doc)) {
                 output.append("<span class=\"strong\">" +
-                    ConfigurationImpl.getInstance().
+                    configuration.
                             getText("doclet.Deprecated") + "</span>&nbsp;");
                 if (deprs.length > 0) {
                     output.append("<i>");
@@ -108,7 +110,7 @@
             } else {
                 if (Util.isDeprecated(member.containingClass())) {
                     output.append("<span class=\"strong\">" +
-                    ConfigurationImpl.getInstance().
+                    configuration.
                             getText("doclet.Deprecated") + "</span>&nbsp;");
                 }
             }
@@ -120,7 +122,7 @@
      * {@inheritDoc}
      */
     public MessageRetriever getMsgRetriever() {
-        return htmlWriter.configuration.message;
+        return configuration.message;
     }
 
     /**
@@ -147,7 +149,7 @@
      */
     public TagletOutput returnTagOutput(Tag returnTag) {
         TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "<dt>" +
-            "<span class=\"strong\">" + htmlWriter.configuration.getText("doclet.Returns") +
+            "<span class=\"strong\">" + configuration.getText("doclet.Returns") +
             "</span>" + "</dt>" + "<dd>" +
             htmlWriter.commentTagsToString(returnTag, null, returnTag.inlineTags(),
             false) + "</dd>");
@@ -178,7 +180,7 @@
                     ((ClassWriterImpl) htmlWriter).getClassDoc().qualifiedName() + "." + ((FieldDoc) holder).name();
             DocLink link = constantsPath.fragment(whichConstant);
             result += htmlWriter.getHyperLinkString(link,
-                    htmlWriter.configuration.getText("doclet.Constants_Summary"),
+                    configuration.getText("doclet.Constants_Summary"),
                     false);
         }
         if (holder.isClass() && ((ClassDoc)holder).isSerializable()) {
@@ -189,7 +191,7 @@
                 DocPath serialPath = htmlWriter.pathToRoot.resolve(DocPaths.SERIALIZED_FORM);
                 DocLink link = serialPath.fragment(((ClassDoc)holder).qualifiedName());
                 result += htmlWriter.getHyperLinkString(link,
-                        htmlWriter.configuration.getText("doclet.Serialized_Form"), false);
+                        configuration.getText("doclet.Serialized_Form"), false);
             }
         }
         return result.equals("") ? null : new TagletOutputImpl(result + "</dd>");
@@ -200,7 +202,7 @@
             return result + ", " + DocletConstants.NL;
         } else {
             return "<dt><span class=\"strong\">" +
-                    htmlWriter.configuration().getText("doclet.See_Also") + "</span></dt><dd>";
+                    configuration.getText("doclet.See_Also") + "</span></dt><dd>";
         }
      }
 
@@ -234,7 +236,7 @@
      */
     public TagletOutput getThrowsHeader() {
         return new TagletOutputImpl(DocletConstants.NL + "<dt>" + "<span class=\"strong\">" +
-            htmlWriter.configuration().getText("doclet.Throws") + "</span></dt>");
+            configuration.getText("doclet.Throws") + "</span></dt>");
     }
 
     /**
@@ -245,7 +247,7 @@
         result += throwsTag.exceptionType() == null ?
             htmlWriter.codeText(throwsTag.exceptionName()) :
             htmlWriter.codeText(
-                htmlWriter.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
+                htmlWriter.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_MEMBER,
                 throwsTag.exceptionType())));
         TagletOutput text = new TagletOutputImpl(
             htmlWriter.commentTagsToString(throwsTag, null,
@@ -263,7 +265,7 @@
     public TagletOutput throwsTagOutput(Type throwsType) {
         return new TagletOutputImpl(DocletConstants.NL + "<dd>" +
             htmlWriter.codeText(htmlWriter.getLink(
-                new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, throwsType))) + "</dd>");
+                new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_MEMBER, throwsType))) + "</dd>");
     }
 
     /**
@@ -303,7 +305,7 @@
      * {@inheritDoc}
      */
     public Configuration configuration() {
-        return htmlWriter.configuration();
+        return configuration;
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -25,6 +25,8 @@
 
 package com.sun.tools.doclets.formats.html;
 
+import java.io.IOException;
+
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -42,7 +44,7 @@
  */
 public class WriterFactoryImpl implements WriterFactory {
 
-    private ConfigurationImpl configuration;
+    private final ConfigurationImpl configuration;
 
     public WriterFactoryImpl(ConfigurationImpl configuration) {
         this.configuration = configuration;
@@ -60,7 +62,7 @@
      */
     public PackageSummaryWriter getPackageSummaryWriter(PackageDoc packageDoc,
         PackageDoc prevPkg, PackageDoc nextPkg) throws Exception {
-        return new PackageWriterImpl(ConfigurationImpl.getInstance(), packageDoc,
+        return new PackageWriterImpl(configuration, packageDoc,
             prevPkg, nextPkg);
     }
 
@@ -68,9 +70,9 @@
      * {@inheritDoc}
      */
     public ClassWriter getClassWriter(ClassDoc classDoc, ClassDoc prevClass,
-            ClassDoc nextClass, ClassTree classTree)
-            throws Exception {
-        return new ClassWriterImpl(classDoc, prevClass, nextClass, classTree);
+            ClassDoc nextClass, ClassTree classTree) throws IOException {
+        return new ClassWriterImpl(configuration, classDoc,
+                prevClass, nextClass, classTree);
     }
 
     /**
@@ -79,7 +81,8 @@
     public AnnotationTypeWriter getAnnotationTypeWriter(
         AnnotationTypeDoc annotationType, Type prevType, Type nextType)
     throws Exception {
-        return new AnnotationTypeWriterImpl(annotationType, prevType, nextType);
+        return new AnnotationTypeWriterImpl(configuration,
+                annotationType, prevType, nextType);
     }
 
     /**
@@ -106,7 +109,7 @@
     /**
      * {@inheritDoc}
      */
-    public EnumConstantWriter getEnumConstantWriter(ClassWriter classWriter)
+    public EnumConstantWriterImpl getEnumConstantWriter(ClassWriter classWriter)
             throws Exception {
         return new EnumConstantWriterImpl((SubWriterHolderWriter) classWriter,
             classWriter.getClassDoc());
@@ -115,7 +118,7 @@
     /**
      * {@inheritDoc}
      */
-    public FieldWriter getFieldWriter(ClassWriter classWriter)
+    public FieldWriterImpl getFieldWriter(ClassWriter classWriter)
             throws Exception {
         return new FieldWriterImpl((SubWriterHolderWriter) classWriter,
             classWriter.getClassDoc());
@@ -124,7 +127,7 @@
     /**
      * {@inheritDoc}
      */
-    public  MethodWriter getMethodWriter(ClassWriter classWriter)
+    public MethodWriterImpl getMethodWriter(ClassWriter classWriter)
             throws Exception {
         return new MethodWriterImpl((SubWriterHolderWriter) classWriter,
             classWriter.getClassDoc());
@@ -133,7 +136,7 @@
     /**
      * {@inheritDoc}
      */
-    public ConstructorWriter getConstructorWriter(ClassWriter classWriter)
+    public ConstructorWriterImpl getConstructorWriter(ClassWriter classWriter)
             throws Exception {
         return new ConstructorWriterImpl((SubWriterHolderWriter) classWriter,
             classWriter.getClassDoc());
@@ -143,20 +146,20 @@
      * {@inheritDoc}
      */
     public MemberSummaryWriter getMemberSummaryWriter(
-        ClassWriter classWriter, int memberType)
-    throws Exception {
+            ClassWriter classWriter, int memberType)
+            throws Exception {
         switch (memberType) {
             case VisibleMemberMap.CONSTRUCTORS:
-                return (ConstructorWriterImpl) getConstructorWriter(classWriter);
+                return getConstructorWriter(classWriter);
             case VisibleMemberMap.ENUM_CONSTANTS:
-                return (EnumConstantWriterImpl) getEnumConstantWriter(classWriter);
+                return getEnumConstantWriter(classWriter);
             case VisibleMemberMap.FIELDS:
-                return (FieldWriterImpl) getFieldWriter(classWriter);
+                return getFieldWriter(classWriter);
             case VisibleMemberMap.INNERCLASSES:
                 return new NestedClassWriterImpl((SubWriterHolderWriter)
                     classWriter, classWriter.getClassDoc());
             case VisibleMemberMap.METHODS:
-                return (MethodWriterImpl) getMethodWriter(classWriter);
+                return getMethodWriter(classWriter);
             default:
                 return null;
         }
@@ -184,6 +187,6 @@
      * {@inheritDoc}
      */
     public SerializedFormWriter getSerializedFormWriter() throws Exception {
-        return new SerializedFormWriterImpl();
+        return new SerializedFormWriterImpl(configuration);
     }
 }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java	Thu Nov 15 09:18:36 2012 -0800
@@ -41,13 +41,15 @@
  *
  * @author Bhavesh Patel
  */
-public class DocType extends Content{
+public class DocType extends Content {
 
     private String docType;
 
-    private static DocType transitional;
+    public static final DocType TRANSITIONAL =
+            new DocType("Transitional", "http://www.w3.org/TR/html4/loose.dtd");
 
-    private static DocType frameset;
+    public static final DocType FRAMESET =
+            new DocType("Frameset", "http://www.w3.org/TR/html4/frameset.dtd");
 
     /**
      * Constructor to construct a DocType object.
@@ -59,28 +61,6 @@
                 "//EN\" \"" + dtd + "\">" + DocletConstants.NL;
     }
 
-     /**
-     * Construct and return a HTML 4.01 transitional DocType content
-     *
-     * @return a content tree for transitional DocType
-     */
-    public static DocType Transitional() {
-        if (transitional == null)
-            transitional = new DocType("Transitional", "http://www.w3.org/TR/html4/loose.dtd");
-        return transitional;
-    }
-
-    /**
-     * Construct and return a HTML 4.01 frameset DocType content
-     *
-     * @return a content tree for frameset DocType
-     */
-    public static DocType Frameset() {
-        if (frameset == null)
-            frameset = new DocType("Frameset", "http://www.w3.org/TR/html4/frameset.dtd");
-        return frameset;
-    }
-
     /**
      * This method is not supported by the class.
      *
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java	Thu Nov 15 09:18:36 2012 -0800
@@ -254,7 +254,7 @@
      */
     public void printFramesetDocument(String title, boolean noTimeStamp,
             Content frameset) throws IOException {
-        Content htmlDocType = DocType.Frameset();
+        Content htmlDocType = DocType.FRAMESET;
         Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
         Content head = new HtmlTree(HtmlTag.HEAD);
         if (! noTimeStamp) {
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Thu Nov 15 09:18:36 2012 -0800
@@ -51,8 +51,8 @@
     /**
      * The only doclet that may use this toolkit is {@value}
      */
-    private static final String TOOLKIT_DOCLET_NAME = new
-        com.sun.tools.doclets.formats.html.HtmlDoclet().getClass().getName();
+    private static final String TOOLKIT_DOCLET_NAME =
+        com.sun.tools.doclets.formats.html.HtmlDoclet.class.getName();
 
     /**
      * Verify that the only doclet that is using this toolkit is
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Thu Nov 15 09:18:36 2012 -0800
@@ -84,7 +84,9 @@
     /**
      * The specified amount of space between tab stops.
      */
-    public int sourcetab = DocletConstants.DEFAULT_TAB_STOP_LENGTH;
+    public int sourcetab;
+
+    public String tabSpaces;
 
     /**
      * True if we should generate browsable sources.
@@ -259,6 +261,7 @@
             "com.sun.tools.doclets.internal.toolkit.resources.doclets");
         excludedDocFileDirs = new HashSet<String>();
         excludedQualifiers = new HashSet<String>();
+        setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
     }
 
     /**
@@ -382,7 +385,7 @@
             } else if (opt.equals("-sourcetab")) {
                 linksource = true;
                 try {
-                    sourcetab = Integer.parseInt(os[1]);
+                    setTabWidth(Integer.parseInt(os[1]));
                 } catch (NumberFormatException e) {
                     //Set to -1 so that warning will be printed
                     //to indicate what is valid argument.
@@ -390,7 +393,7 @@
                 }
                 if (sourcetab <= 0) {
                     message.warning("doclet.sourcetab_warning");
-                    sourcetab = DocletConstants.DEFAULT_TAB_STOP_LENGTH;
+                    setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
                 }
             } else if (opt.equals("-notimestamp")) {
                 notimestamp = true;
@@ -767,4 +770,9 @@
      * @return the {@link java.util.Comparator} used to sort members.
      */
     public abstract Comparator<ProgramElementDoc> getMemberComparator();
+
+    private void setTabWidth(int n) {
+        sourcetab = n;
+        tabSpaces = String.format("%" + n + "s", "");
+    }
 }
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java	Thu Nov 15 09:18:36 2012 -0800
@@ -52,18 +52,46 @@
  */
 
 public abstract class AbstractBuilder {
+    public static class Context {
+        /**
+         * The configuration used in this run of the doclet.
+         */
+        final Configuration configuration;
+
+        /**
+         * Keep track of which packages we have seen for
+         * efficiency purposes.  We don't want to copy the
+         * doc files multiple times for a single package.
+         */
+        final Set<String> containingPackagesSeen;
+
+        /**
+         * Shared parser for the builder XML file
+         */
+        final LayoutParser layoutParser;
+
+        Context(Configuration configuration,
+                Set<String> containingPackagesSeen,
+                LayoutParser layoutParser) {
+            this.configuration = configuration;
+            this.containingPackagesSeen = containingPackagesSeen;
+            this.layoutParser = layoutParser;
+        }
+    }
 
     /**
      * The configuration used in this run of the doclet.
      */
-    protected Configuration configuration;
+    protected final Configuration configuration;
 
     /**
      * Keep track of which packages we have seen for
      * efficiency purposes.  We don't want to copy the
      * doc files multiple times for a single package.
      */
-    protected static Set<String> containingPackagesSeen;
+    protected final Set<String> containingPackagesSeen;
+
+    protected final LayoutParser layoutParser;
 
     /**
      * True if we want to print debug output.
@@ -75,8 +103,10 @@
      * @param configuration the configuration used in this run
      *        of the doclet.
      */
-    public AbstractBuilder(Configuration configuration) {
-        this.configuration = configuration;
+    public AbstractBuilder(Context c) {
+        this.configuration = c.configuration;
+        this.containingPackagesSeen = c.containingPackagesSeen;
+        this.layoutParser = c.layoutParser;
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java	Thu Nov 15 09:18:36 2012 -0800
@@ -25,6 +25,8 @@
 
 package com.sun.tools.doclets.internal.toolkit.builders;
 
+import java.util.Set;
+
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
@@ -48,8 +50,8 @@
      * @param configuration the configuration used in this run
      *        of the doclet.
      */
-    public AbstractMemberBuilder(Configuration configuration) {
-        super(configuration);
+    public AbstractMemberBuilder(Context context) {
+        super(context);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java	Thu Nov 15 09:18:36 2012 -0800
@@ -54,12 +54,12 @@
     /**
      * The annotation type being documented.
      */
-    private AnnotationTypeDoc annotationTypeDoc;
+    private final AnnotationTypeDoc annotationTypeDoc;
 
     /**
      * The doclet specific writer.
      */
-    private AnnotationTypeWriter writer;
+    private final AnnotationTypeWriter writer;
 
     /**
      * The content tree for the annotation documentation.
@@ -69,38 +69,37 @@
     /**
      * Construct a new ClassBuilder.
      *
-     * @param configuration the current configuration of the
-     *                      doclet.
+     * @param context           the build context.
+     * @param annotationTypeDoc the class being documented.
+     * @param writer            the doclet specific writer.
      */
-    private AnnotationTypeBuilder(Configuration configuration) {
-        super(configuration);
+    private AnnotationTypeBuilder(Context context,
+            AnnotationTypeDoc annotationTypeDoc,
+            AnnotationTypeWriter writer) {
+        super(context);
+        this.annotationTypeDoc = annotationTypeDoc;
+        this.writer = writer;
     }
 
     /**
      * Construct a new ClassBuilder.
      *
-     * @param configuration     the current configuration of the doclet.
+     * @param context           the build context.
      * @param annotationTypeDoc the class being documented.
      * @param writer            the doclet specific writer.
      */
-    public static AnnotationTypeBuilder getInstance(Configuration configuration,
-        AnnotationTypeDoc annotationTypeDoc, AnnotationTypeWriter writer)
-    throws Exception {
-        AnnotationTypeBuilder builder = new AnnotationTypeBuilder(configuration);
-        builder.configuration = configuration;
-        builder.annotationTypeDoc = annotationTypeDoc;
-        builder.writer = writer;
-        if(containingPackagesSeen == null) {
-            containingPackagesSeen = new HashSet<String>();
-        }
-        return builder;
+    public static AnnotationTypeBuilder getInstance(Context context,
+            AnnotationTypeDoc annotationTypeDoc,
+            AnnotationTypeWriter writer)
+            throws Exception {
+        return new AnnotationTypeBuilder(context, annotationTypeDoc, writer);
     }
 
     /**
      * {@inheritDoc}
      */
     public void build() throws IOException {
-        build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree);
+        build(layoutParser.parseXML(ROOT), contentTree);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java	Thu Nov 15 09:18:36 2012 -0800
@@ -25,8 +25,6 @@
 
 package com.sun.tools.doclets.internal.toolkit.builders;
 
-import java.util.*;
-
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -44,43 +42,36 @@
  * @since 1.5
  */
 public class AnnotationTypeOptionalMemberBuilder extends
-    AnnotationTypeRequiredMemberBuilder {
+        AnnotationTypeRequiredMemberBuilder {
 
 
     /**
      * Construct a new AnnotationTypeMemberBuilder.
      *
-     * @param configuration the current configuration of the
-     *                      doclet.
+     * @param context  the build context.
+     * @param classDoc the class whose members are being documented.
+     * @param writer the doclet specific writer.
      */
-    private AnnotationTypeOptionalMemberBuilder(Configuration configuration) {
-        super(configuration);
+    private AnnotationTypeOptionalMemberBuilder(Context context,
+            ClassDoc classDoc,
+            AnnotationTypeOptionalMemberWriter writer) {
+        super(context, classDoc, writer,
+                VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL);
     }
 
 
     /**
      * Construct a new AnnotationTypeMemberBuilder.
      *
-     * @param configuration the current configuration of the doclet.
-     * @param classDoc the class whoses members are being documented.
+     * @param context  the build context.
+     * @param classDoc the class whose members are being documented.
      * @param writer the doclet specific writer.
      */
     public static AnnotationTypeOptionalMemberBuilder getInstance(
-            Configuration configuration, ClassDoc classDoc,
+            Context context, ClassDoc classDoc,
             AnnotationTypeOptionalMemberWriter writer) {
-        AnnotationTypeOptionalMemberBuilder builder =
-            new AnnotationTypeOptionalMemberBuilder(configuration);
-        builder.classDoc = classDoc;
-        builder.writer = writer;
-        builder.visibleMemberMap = new VisibleMemberMap(classDoc,
-            VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL, configuration.nodeprecated);
-        builder.members = new ArrayList<ProgramElementDoc>(
-            builder.visibleMemberMap.getMembersFor(classDoc));
-        if (configuration.getMemberComparator() != null) {
-            Collections.sort(builder.members,
-                configuration.getMemberComparator());
-        }
-        return builder;
+        return new AnnotationTypeOptionalMemberBuilder(context,
+                classDoc, writer);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java	Thu Nov 15 09:18:36 2012 -0800
@@ -74,37 +74,40 @@
     /**
      * Construct a new AnnotationTypeRequiredMemberBuilder.
      *
-     * @param configuration the current configuration of the
-     *                      doclet.
+     * @param context  the build context.
+     * @param classDoc the class whose members are being documented.
+     * @param writer the doclet specific writer.
      */
-    protected AnnotationTypeRequiredMemberBuilder(Configuration configuration) {
-        super(configuration);
+    protected AnnotationTypeRequiredMemberBuilder(Context context,
+            ClassDoc classDoc,
+            AnnotationTypeRequiredMemberWriter writer,
+            int memberType) {
+        super(context);
+        this.classDoc = classDoc;
+        this.writer = writer;
+        this.visibleMemberMap = new VisibleMemberMap(classDoc, memberType,
+            configuration.nodeprecated);
+        this.members = new ArrayList<ProgramElementDoc>(
+            this.visibleMemberMap.getMembersFor(classDoc));
+        if (configuration.getMemberComparator() != null) {
+            Collections.sort(this.members, configuration.getMemberComparator());
+        }
     }
 
 
     /**
      * Construct a new AnnotationTypeMemberBuilder.
      *
-     * @param configuration the current configuration of the doclet.
-     * @param classDoc the class whoses members are being documented.
+     * @param context  the build context.
+     * @param classDoc the class whose members are being documented.
      * @param writer the doclet specific writer.
      */
     public static AnnotationTypeRequiredMemberBuilder getInstance(
-            Configuration configuration, ClassDoc classDoc,
+            Context context, ClassDoc classDoc,
             AnnotationTypeRequiredMemberWriter writer) {
-        AnnotationTypeRequiredMemberBuilder builder =
-            new AnnotationTypeRequiredMemberBuilder(configuration);
-        builder.classDoc = classDoc;
-        builder.writer = writer;
-        builder.visibleMemberMap = new VisibleMemberMap(classDoc,
-            VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED, configuration.nodeprecated);
-        builder.members = new ArrayList<ProgramElementDoc>(
-            builder.visibleMemberMap.getMembersFor(classDoc));
-        if (configuration.getMemberComparator() != null) {
-            Collections.sort(builder.members,
-                configuration.getMemberComparator());
-        }
-        return builder;
+        return new AnnotationTypeRequiredMemberBuilder(context, classDoc,
+                    writer,
+                    VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Thu Nov 15 09:18:36 2012 -0800
@@ -25,6 +25,9 @@
 
 package com.sun.tools.doclets.internal.toolkit.builders;
 
+import java.util.HashSet;
+import java.util.Set;
+
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -46,12 +49,14 @@
     /**
      * The current configuration of the doclet.
      */
-    private Configuration configuration;
+    private final Configuration configuration;
 
     /**
      * The factory to retrieve the required writers from.
      */
-    private WriterFactory writerFactory;
+    private final WriterFactory writerFactory;
+
+    private final AbstractBuilder.Context context;
 
     /**
      * Construct a builder factory using the given configuration.
@@ -61,6 +66,10 @@
     public BuilderFactory (Configuration configuration) {
         this.configuration = configuration;
         this.writerFactory = configuration.getWriterFactory();
+
+        Set<String> containingPackagesSeen = new HashSet<String>();
+        context = new AbstractBuilder.Context(configuration, containingPackagesSeen,
+                LayoutParser.getInstance(configuration));
     }
 
     /**
@@ -68,7 +77,7 @@
      * @return the builder that builds the constant summary.
      */
     public AbstractBuilder getConstantsSummaryBuider() throws Exception {
-        return ConstantsSummaryBuilder.getInstance(configuration,
+        return ConstantsSummaryBuilder.getInstance(context,
             writerFactory.getConstantsSummaryWriter());
     }
 
@@ -82,7 +91,7 @@
      */
     public AbstractBuilder getPackageSummaryBuilder(PackageDoc pkg, PackageDoc prevPkg,
             PackageDoc nextPkg) throws Exception {
-        return PackageSummaryBuilder.getInstance(configuration, pkg,
+        return PackageSummaryBuilder.getInstance(context, pkg,
             writerFactory.getPackageSummaryWriter(pkg, prevPkg, nextPkg));
     }
 
@@ -97,9 +106,9 @@
      * writer is not supported by the doclet.
      */
     public AbstractBuilder getClassBuilder(ClassDoc classDoc,
-        ClassDoc prevClass, ClassDoc nextClass, ClassTree classTree)
+            ClassDoc prevClass, ClassDoc nextClass, ClassTree classTree)
             throws Exception {
-        return ClassBuilder.getInstance(configuration, classDoc,
+        return ClassBuilder.getInstance(context, classDoc,
             writerFactory.getClassWriter(classDoc, prevClass, nextClass,
                 classTree));
     }
@@ -117,9 +126,8 @@
         AnnotationTypeDoc annotationType,
         Type prevType, Type nextType)
             throws Exception {
-        return AnnotationTypeBuilder.getInstance(configuration, annotationType,
-            writerFactory.getAnnotationTypeWriter(annotationType, prevType,
-            nextType));
+        return AnnotationTypeBuilder.getInstance(context, annotationType,
+            writerFactory.getAnnotationTypeWriter(annotationType, prevType, nextType));
     }
 
     /**
@@ -129,7 +137,7 @@
      */
     public AbstractBuilder getMethodBuilder(ClassWriter classWriter)
            throws Exception {
-        return MethodBuilder.getInstance(configuration,
+        return MethodBuilder.getInstance(context,
             classWriter.getClassDoc(),
             writerFactory.getMethodWriter(classWriter));
     }
@@ -144,7 +152,7 @@
     public AbstractBuilder getAnnotationTypeOptionalMemberBuilder(
             AnnotationTypeWriter annotationTypeWriter)
     throws Exception {
-        return AnnotationTypeOptionalMemberBuilder.getInstance(configuration,
+        return AnnotationTypeOptionalMemberBuilder.getInstance(context,
             annotationTypeWriter.getAnnotationTypeDoc(),
             writerFactory.getAnnotationTypeOptionalMemberWriter(
                 annotationTypeWriter));
@@ -160,7 +168,7 @@
     public AbstractBuilder getAnnotationTypeRequiredMemberBuilder(
             AnnotationTypeWriter annotationTypeWriter)
     throws Exception {
-        return AnnotationTypeRequiredMemberBuilder.getInstance(configuration,
+        return AnnotationTypeRequiredMemberBuilder.getInstance(context,
             annotationTypeWriter.getAnnotationTypeDoc(),
             writerFactory.getAnnotationTypeRequiredMemberWriter(
                 annotationTypeWriter));
@@ -173,7 +181,7 @@
      */
     public AbstractBuilder getEnumConstantsBuilder(ClassWriter classWriter)
             throws Exception {
-        return EnumConstantBuilder.getInstance(configuration, classWriter.getClassDoc(),
+        return EnumConstantBuilder.getInstance(context, classWriter.getClassDoc(),
             writerFactory.getEnumConstantWriter(classWriter));
     }
 
@@ -184,7 +192,7 @@
      */
     public AbstractBuilder getFieldBuilder(ClassWriter classWriter)
             throws Exception {
-        return FieldBuilder.getInstance(configuration, classWriter.getClassDoc(),
+        return FieldBuilder.getInstance(context, classWriter.getClassDoc(),
             writerFactory.getFieldWriter(classWriter));
     }
 
@@ -195,9 +203,9 @@
      */
     public AbstractBuilder getConstructorBuilder(ClassWriter classWriter)
             throws Exception {
-        return ConstructorBuilder.getInstance(configuration,
-            classWriter.getClassDoc(), writerFactory.getConstructorWriter(
-            classWriter));
+        return ConstructorBuilder.getInstance(context,
+            classWriter.getClassDoc(),
+            writerFactory.getConstructorWriter(classWriter));
     }
 
     /**
@@ -207,7 +215,7 @@
      */
     public AbstractBuilder getMemberSummaryBuilder(ClassWriter classWriter)
             throws Exception {
-        return MemberSummaryBuilder.getInstance(classWriter, configuration);
+        return MemberSummaryBuilder.getInstance(classWriter, context);
     }
 
     /**
@@ -220,8 +228,7 @@
     public AbstractBuilder getMemberSummaryBuilder(
             AnnotationTypeWriter annotationTypeWriter)
     throws Exception {
-        return MemberSummaryBuilder.getInstance(annotationTypeWriter,
-            configuration);
+        return MemberSummaryBuilder.getInstance(annotationTypeWriter, context);
     }
 
     /**
@@ -231,6 +238,6 @@
      */
     public AbstractBuilder getSerializedFormBuilder()
             throws Exception {
-        return SerializedFormBuilder.getInstance(configuration);
+        return SerializedFormBuilder.getInstance(context);
     }
 }
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java	Thu Nov 15 09:18:36 2012 -0800
@@ -54,22 +54,22 @@
     /**
      * The class being documented.
      */
-    private ClassDoc classDoc;
+    private final ClassDoc classDoc;
 
     /**
      * The doclet specific writer.
      */
-    private ClassWriter writer;
+    private final ClassWriter writer;
 
     /**
      * Keep track of whether or not this classdoc is an interface.
      */
-    private boolean isInterface = false;
+    private final boolean isInterface;
 
     /**
      * Keep track of whether or not this classdoc is an enum.
      */
-    private boolean isEnum = false;
+    private final boolean isEnum;
 
     /**
      * The content tree for the class documentation.
@@ -79,44 +79,45 @@
     /**
      * Construct a new ClassBuilder.
      *
-     * @param configuration the current configuration of the
-     *                      doclet.
+     * @param context  the build context
+     * @param classDoc the class being documented.
+     * @param writer the doclet specific writer.
      */
-    private ClassBuilder(Configuration configuration) {
-        super(configuration);
+    private ClassBuilder(Context context,
+            ClassDoc classDoc, ClassWriter writer) {
+        super(context);
+        this.classDoc = classDoc;
+        this.writer = writer;
+        if (classDoc.isInterface()) {
+            isInterface = true;
+            isEnum = false;
+        } else if (classDoc.isEnum()) {
+            isInterface = false;
+            isEnum = true;
+            Util.setEnumDocumentation(configuration, classDoc);
+        } else {
+            isInterface = false;
+            isEnum = false;
+        }
     }
 
     /**
      * Construct a new ClassBuilder.
      *
-     * @param configuration the current configuration of the doclet.
+     * @param context  the build context
      * @param classDoc the class being documented.
      * @param writer the doclet specific writer.
      */
-    public static ClassBuilder getInstance(Configuration configuration,
-        ClassDoc classDoc, ClassWriter writer)
-    throws Exception {
-        ClassBuilder builder = new ClassBuilder(configuration);
-        builder.configuration = configuration;
-        builder.classDoc = classDoc;
-        builder.writer = writer;
-        if (classDoc.isInterface()) {
-            builder.isInterface = true;
-        } else if (classDoc.isEnum()) {
-            builder.isEnum = true;
-            Util.setEnumDocumentation(configuration, classDoc);
-        }
-        if(containingPackagesSeen == null) {
-            containingPackagesSeen = new HashSet<String>();
-        }
-        return builder;
+    public static ClassBuilder getInstance(Context context,
+            ClassDoc classDoc, ClassWriter writer) {
+        return new ClassBuilder(context, classDoc, writer);
     }
 
     /**
      * {@inheritDoc}
      */
     public void build() throws IOException {
-        build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree);
+        build(layoutParser.parseXML(ROOT), contentTree);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java	Thu Nov 15 09:18:36 2012 -0800
@@ -60,12 +60,12 @@
     /**
      * The writer used to write the results.
      */
-    protected ConstantsSummaryWriter writer;
+    protected final ConstantsSummaryWriter writer;
 
     /**
      * The set of ClassDocs that have constant fields.
      */
-    protected Set<ClassDoc> classDocsWithConstFields;
+    protected final Set<ClassDoc> classDocsWithConstFields;
 
     /**
      * The set of printed package headers.
@@ -90,27 +90,25 @@
     /**
      * Construct a new ConstantsSummaryBuilder.
      *
-     * @param configuration the current configuration of the
-     *                      doclet.
+     * @param context       the build context.
+     * @param writer        the writer for the summary.
      */
-    private ConstantsSummaryBuilder(Configuration configuration) {
-        super(configuration);
+    private ConstantsSummaryBuilder(Context context,
+            ConstantsSummaryWriter writer) {
+        super(context);
+        this.writer = writer;
+        this.classDocsWithConstFields = new HashSet<ClassDoc>();
     }
 
     /**
      * Construct a ConstantsSummaryBuilder.
      *
-     * @param configuration the configuration used in this run
-     *                      of the doclet.
+     * @param context       the build context.
      * @param writer        the writer for the summary.
      */
-    public static ConstantsSummaryBuilder getInstance(
-        Configuration configuration, ConstantsSummaryWriter writer) {
-        ConstantsSummaryBuilder builder = new ConstantsSummaryBuilder(
-            configuration);
-        builder.writer = writer;
-        builder.classDocsWithConstFields = new HashSet<ClassDoc>();
-        return builder;
+    public static ConstantsSummaryBuilder getInstance(Context context,
+            ConstantsSummaryWriter writer) {
+        return new ConstantsSummaryBuilder(context, writer);
     }
 
     /**
@@ -121,7 +119,7 @@
             //Doclet does not support this output.
             return;
         }
-        build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree);
+        build(layoutParser.parseXML(ROOT), contentTree);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java	Thu Nov 15 09:18:36 2012 -0800
@@ -59,66 +59,64 @@
     /**
      * The class whose constructors are being documented.
      */
-    private ClassDoc classDoc;
+    private final ClassDoc classDoc;
 
     /**
      * The visible constructors for the given class.
      */
-    private VisibleMemberMap visibleMemberMap;
+    private final VisibleMemberMap visibleMemberMap;
 
     /**
      * The writer to output the constructor documentation.
      */
-    private ConstructorWriter writer;
+    private final ConstructorWriter writer;
 
     /**
      * The constructors being documented.
      */
-    private List<ProgramElementDoc> constructors;
+    private final List<ProgramElementDoc> constructors;
 
     /**
      * Construct a new ConstructorBuilder.
      *
-     * @param configuration the current configuration of the
-     *                      doclet.
+     * @param context  the build context.
+     * @param classDoc the class whoses members are being documented.
+     * @param writer the doclet specific writer.
      */
-    private ConstructorBuilder(Configuration configuration) {
-        super(configuration);
+    private ConstructorBuilder(Context context,
+            ClassDoc classDoc,
+            ConstructorWriter writer) {
+        super(context);
+        this.classDoc = classDoc;
+        this.writer = writer;
+        visibleMemberMap =
+                new VisibleMemberMap(
+                classDoc,
+                VisibleMemberMap.CONSTRUCTORS,
+                configuration.nodeprecated);
+        constructors =
+                new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
+        for (int i = 0; i < constructors.size(); i++) {
+            if (constructors.get(i).isProtected()
+                    || constructors.get(i).isPrivate()) {
+                writer.setFoundNonPubConstructor(true);
+            }
+        }
+        if (configuration.getMemberComparator() != null) {
+            Collections.sort(constructors,configuration.getMemberComparator());
+        }
     }
 
     /**
      * Construct a new ConstructorBuilder.
      *
-     * @param configuration the current configuration of the doclet.
+     * @param context  the build context.
      * @param classDoc the class whoses members are being documented.
      * @param writer the doclet specific writer.
      */
-    public static ConstructorBuilder getInstance(
-            Configuration configuration,
-            ClassDoc classDoc,
-            ConstructorWriter writer) {
-        ConstructorBuilder builder = new ConstructorBuilder(configuration);
-        builder.classDoc = classDoc;
-        builder.writer = writer;
-        builder.visibleMemberMap =
-                new VisibleMemberMap(
-                classDoc,
-                VisibleMemberMap.CONSTRUCTORS,
-                configuration.nodeprecated);
-        builder.constructors =
-                new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getMembersFor(classDoc));
-        for (int i = 0; i < builder.constructors.size(); i++) {
-            if (builder.constructors.get(i).isProtected()
-                    || builder.constructors.get(i).isPrivate()) {
-                writer.setFoundNonPubConstructor(true);
-            }
-        }
-        if (configuration.getMemberComparator() != null) {
-            Collections.sort(
-                    builder.constructors,
-                    configuration.getMemberComparator());
-        }
-        return builder;
+    public static ConstructorBuilder getInstance(Context context,
+            ClassDoc classDoc, ConstructorWriter writer) {
+        return new ConstructorBuilder(context, classDoc, writer);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java	Thu Nov 15 09:18:36 2012 -0800
@@ -48,22 +48,22 @@
     /**
      * The class whose enum constants are being documented.
      */
-    private ClassDoc classDoc;
+    private final ClassDoc classDoc;
 
     /**
      * The visible enum constantss for the given class.
      */
-    private VisibleMemberMap visibleMemberMap;
+    private final VisibleMemberMap visibleMemberMap;
 
     /**
      * The writer to output the enum constants documentation.
      */
-    private EnumConstantWriter writer;
+    private final EnumConstantWriter writer;
 
     /**
      * The list of enum constants being documented.
      */
-    private List<ProgramElementDoc> enumConstants;
+    private final List<ProgramElementDoc> enumConstants;
 
     /**
      * The index of the current enum constant that is being documented at this point
@@ -74,40 +74,37 @@
     /**
      * Construct a new EnumConstantsBuilder.
      *
-     * @param configuration the current configuration of the
-     *                      doclet.
+     * @param context  the build context.
+     * @param classDoc the class whoses members are being documented.
+     * @param writer the doclet specific writer.
      */
-    private EnumConstantBuilder(Configuration configuration) {
-        super(configuration);
+    private EnumConstantBuilder(Context context,
+            ClassDoc classDoc, EnumConstantWriter writer) {
+        super(context);
+        this.classDoc = classDoc;
+        this.writer = writer;
+        visibleMemberMap =
+                new VisibleMemberMap(
+                classDoc,
+                VisibleMemberMap.ENUM_CONSTANTS,
+                configuration.nodeprecated);
+        enumConstants =
+                new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
+        if (configuration.getMemberComparator() != null) {
+            Collections.sort(enumConstants, configuration.getMemberComparator());
+        }
     }
 
     /**
      * Construct a new EnumConstantsBuilder.
      *
-     * @param configuration the current configuration of the doclet.
+     * @param context  the build context.
      * @param classDoc the class whoses members are being documented.
      * @param writer the doclet specific writer.
      */
-    public static EnumConstantBuilder getInstance(
-            Configuration configuration,
-            ClassDoc classDoc,
-            EnumConstantWriter writer) {
-        EnumConstantBuilder builder = new EnumConstantBuilder(configuration);
-        builder.classDoc = classDoc;
-        builder.writer = writer;
-        builder.visibleMemberMap =
-                new VisibleMemberMap(
-                classDoc,
-                VisibleMemberMap.ENUM_CONSTANTS,
-                configuration.nodeprecated);
-        builder.enumConstants =
-                new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getMembersFor(classDoc));
-        if (configuration.getMemberComparator() != null) {
-            Collections.sort(
-                    builder.enumConstants,
-                    configuration.getMemberComparator());
-        }
-        return builder;
+    public static EnumConstantBuilder getInstance(Context context,
+            ClassDoc classDoc, EnumConstantWriter writer) {
+        return new EnumConstantBuilder(context, classDoc, writer);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java	Thu Nov 15 09:18:36 2012 -0800
@@ -48,22 +48,22 @@
     /**
      * The class whose fields are being documented.
      */
-    private ClassDoc classDoc;
+    private final ClassDoc classDoc;
 
     /**
      * The visible fields for the given class.
      */
-    private VisibleMemberMap visibleMemberMap;
+    private final VisibleMemberMap visibleMemberMap;
 
     /**
      * The writer to output the field documentation.
      */
-    private FieldWriter writer;
+    private final FieldWriter writer;
 
     /**
      * The list of fields being documented.
      */
-    private List<ProgramElementDoc> fields;
+    private final List<ProgramElementDoc> fields;
 
     /**
      * The index of the current field that is being documented at this point
@@ -74,41 +74,40 @@
     /**
      * Construct a new FieldBuilder.
      *
-     * @param configuration the current configuration of the
-     *                      doclet.
+     * @param context  the build context.
+     * @param classDoc the class whoses members are being documented.
+     * @param writer the doclet specific writer.
      */
-    private FieldBuilder(Configuration configuration) {
-        super(configuration);
+    private FieldBuilder(Context context,
+            ClassDoc classDoc,
+            FieldWriter writer) {
+        super(context);
+        this.classDoc = classDoc;
+        this.writer = writer;
+        visibleMemberMap =
+                new VisibleMemberMap(
+                classDoc,
+                VisibleMemberMap.FIELDS,
+                configuration.nodeprecated);
+        fields =
+                new ArrayList<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
+                configuration));
+        if (configuration.getMemberComparator() != null) {
+            Collections.sort(fields, configuration.getMemberComparator());
+        }
     }
 
     /**
      * Construct a new FieldBuilder.
      *
-     * @param configuration the current configuration of the doclet.
+     * @param context  the build context.
      * @param classDoc the class whoses members are being documented.
      * @param writer the doclet specific writer.
      */
-    public static FieldBuilder getInstance(
-            Configuration configuration,
+    public static FieldBuilder getInstance(Context context,
             ClassDoc classDoc,
             FieldWriter writer) {
-        FieldBuilder builder = new FieldBuilder(configuration);
-        builder.classDoc = classDoc;
-        builder.writer = writer;
-        builder.visibleMemberMap =
-                new VisibleMemberMap(
-                classDoc,
-                VisibleMemberMap.FIELDS,
-                configuration.nodeprecated);
-        builder.fields =
-                new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getLeafClassMembers(
-                configuration));
-        if (configuration.getMemberComparator() != null) {
-            Collections.sort(
-                    builder.fields,
-                    configuration.getMemberComparator());
-        }
-        return builder;
+        return new FieldBuilder(context, classDoc, writer);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java	Thu Nov 15 09:18:36 2012 -0800
@@ -55,14 +55,10 @@
      */
     private Map<String,XMLNode> xmlElementsMap;
     private XMLNode currentNode;
-    private Configuration configuration;
-    private static LayoutParser instance;
+    private final Configuration configuration;
     private String currentRoot;
     private boolean isParsing;
 
-    /**
-     * This class is a singleton.
-     */
     private LayoutParser(Configuration configuration) {
         xmlElementsMap = new HashMap<String,XMLNode>();
         this.configuration = configuration;
@@ -75,10 +71,7 @@
      * @return an instance of the BuilderXML.
      */
     public static LayoutParser getInstance(Configuration configuration) {
-        if (instance == null) {
-            instance = new LayoutParser(configuration);
-        }
-        return instance;
+        return new LayoutParser(configuration);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Thu Nov 15 09:18:36 2012 -0800
@@ -53,7 +53,7 @@
     /**
      * The visible members for the given class.
      */
-    private VisibleMemberMap[] visibleMemberMaps;
+    private final VisibleMemberMap[] visibleMemberMaps;
 
     /**
      * The member summary writers for the given class.
@@ -63,10 +63,27 @@
     /**
      * The type being documented.
      */
-    private ClassDoc classDoc;
+    private final ClassDoc classDoc;
 
-    private MemberSummaryBuilder(Configuration configuration) {
-        super(configuration);
+    /**
+     * Construct a new MemberSummaryBuilder.
+     *
+     * @param classWriter   the writer for the class whose members are being
+     *                      summarized.
+     * @param context       the build context.
+     */
+    private MemberSummaryBuilder(Context context, ClassDoc classDoc) {
+        super(context);
+        this.classDoc = classDoc;
+        visibleMemberMaps =
+                new VisibleMemberMap[VisibleMemberMap.NUM_MEMBER_TYPES];
+        for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
+            visibleMemberMaps[i] =
+                    new VisibleMemberMap(
+                    classDoc,
+                    i,
+                    configuration.nodeprecated);
+        }
     }
 
     /**
@@ -74,14 +91,22 @@
      *
      * @param classWriter   the writer for the class whose members are being
      *                      summarized.
-     * @param configuration the current configuration of the doclet.
+     * @param context       the build context.
      */
     public static MemberSummaryBuilder getInstance(
-            ClassWriter classWriter, Configuration configuration)
+            ClassWriter classWriter, Context context)
             throws Exception {
-        MemberSummaryBuilder builder = new MemberSummaryBuilder(configuration);
-        builder.classDoc = classWriter.getClassDoc();
-        builder.init(classWriter);
+        MemberSummaryBuilder builder = new MemberSummaryBuilder(context,
+                classWriter.getClassDoc());
+        builder.memberSummaryWriters =
+                new MemberSummaryWriter[VisibleMemberMap.NUM_MEMBER_TYPES];
+        WriterFactory wf = context.configuration.getWriterFactory();
+        for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
+                builder.memberSummaryWriters[i] =
+                    builder.visibleMemberMaps[i].noVisibleMembers() ?
+                        null :
+                        wf.getMemberSummaryWriter(classWriter, i);
+        }
         return builder;
     }
 
@@ -93,44 +118,23 @@
      * @param configuration the current configuration of the doclet.
      */
     public static MemberSummaryBuilder getInstance(
-            AnnotationTypeWriter annotationTypeWriter, Configuration configuration)
+            AnnotationTypeWriter annotationTypeWriter, Context context)
             throws Exception {
-        MemberSummaryBuilder builder = new MemberSummaryBuilder(configuration);
-        builder.classDoc = annotationTypeWriter.getAnnotationTypeDoc();
-        builder.init(annotationTypeWriter);
+        MemberSummaryBuilder builder = new MemberSummaryBuilder(context,
+                annotationTypeWriter.getAnnotationTypeDoc());
+        builder.memberSummaryWriters =
+                new MemberSummaryWriter[VisibleMemberMap.NUM_MEMBER_TYPES];
+        WriterFactory wf = context.configuration.getWriterFactory();
+        for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
+                builder.memberSummaryWriters[i] =
+                    builder.visibleMemberMaps[i].noVisibleMembers()?
+                        null :
+                        wf.getMemberSummaryWriter(
+                        annotationTypeWriter, i);
+        }
         return builder;
     }
 
-    private void init(Object writer) throws Exception {
-        visibleMemberMaps =
-                new VisibleMemberMap[VisibleMemberMap.NUM_MEMBER_TYPES];
-        for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
-            visibleMemberMaps[i] =
-                    new VisibleMemberMap(
-                    classDoc,
-                    i,
-                    configuration.nodeprecated);
-        }
-        memberSummaryWriters =
-                new MemberSummaryWriter[VisibleMemberMap.NUM_MEMBER_TYPES];
-        for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
-            if (classDoc.isAnnotationType()) {
-                memberSummaryWriters[i] =
-                    visibleMemberMaps[i].noVisibleMembers()?
-                        null :
-                        configuration.getWriterFactory().getMemberSummaryWriter(
-                        (AnnotationTypeWriter) writer, i);
-            } else {
-                memberSummaryWriters[i] =
-                    visibleMemberMaps[i].noVisibleMembers()?
-                        null :
-                        configuration.getWriterFactory().getMemberSummaryWriter(
-                        (ClassWriter) writer, i);
-            }
-        }
-
-    }
-
     /**
      * {@inheritDoc}
      */
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java	Thu Nov 15 09:18:36 2012 -0800
@@ -54,57 +54,61 @@
     /**
      * The class whose methods are being documented.
      */
-    private ClassDoc classDoc;
+    private final ClassDoc classDoc;
 
     /**
      * The visible methods for the given class.
      */
-    private VisibleMemberMap visibleMemberMap;
+    private final VisibleMemberMap visibleMemberMap;
 
     /**
      * The writer to output the method documentation.
      */
-    private MethodWriter writer;
+    private final MethodWriter writer;
 
     /**
      * The methods being documented.
      */
     private List<ProgramElementDoc> methods;
 
-    private MethodBuilder(Configuration configuration) {
-        super(configuration);
+
+    /**
+     * Construct a new MethodBuilder.
+     *
+     * @param context       the build context.
+     * @param classDoc the class whoses members are being documented.
+     * @param writer the doclet specific writer.
+     */
+    private MethodBuilder(Context context,
+            ClassDoc classDoc,
+            MethodWriter writer) {
+        super(context);
+        this.classDoc = classDoc;
+        this.writer = writer;
+        visibleMemberMap = new VisibleMemberMap(
+                classDoc,
+                VisibleMemberMap.METHODS,
+                configuration.nodeprecated);
+        methods =
+                new ArrayList<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
+                configuration));
+        if (configuration.getMemberComparator() != null) {
+            Collections.sort(methods, configuration.getMemberComparator());
+        }
     }
 
     /**
      * Construct a new MethodBuilder.
      *
-     * @param configuration the current configuration of the doclet.
+     * @param context       the build context.
      * @param classDoc the class whoses members are being documented.
      * @param writer the doclet specific writer.
      *
      * @return an instance of a MethodBuilder.
      */
-    public static MethodBuilder getInstance(
-            Configuration configuration,
-            ClassDoc classDoc,
-            MethodWriter writer) {
-        MethodBuilder builder = new MethodBuilder(configuration);
-        builder.classDoc = classDoc;
-        builder.writer = writer;
-        builder.visibleMemberMap =
-                new VisibleMemberMap(
-                classDoc,
-                VisibleMemberMap.METHODS,
-                configuration.nodeprecated);
-        builder.methods =
-                new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getLeafClassMembers(
-                configuration));
-        if (configuration.getMemberComparator() != null) {
-            Collections.sort(
-                    builder.methods,
-                    configuration.getMemberComparator());
-        }
-        return builder;
+    public static MethodBuilder getInstance(Context context,
+            ClassDoc classDoc, MethodWriter writer) {
+        return new MethodBuilder(context, classDoc, writer);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java	Thu Nov 15 09:18:36 2012 -0800
@@ -52,40 +52,47 @@
     /**
      * The package being documented.
      */
-    private PackageDoc packageDoc;
+    private final PackageDoc packageDoc;
 
     /**
      * The doclet specific writer that will output the result.
      */
-    private PackageSummaryWriter packageWriter;
+    private final PackageSummaryWriter packageWriter;
 
     /**
      * The content that will be added to the package summary documentation tree.
      */
     private Content contentTree;
 
-    private PackageSummaryBuilder(Configuration configuration) {
-        super(configuration);
+    /**
+     * Construct a new PackageSummaryBuilder.
+     *
+     * @param context  the build context.
+     * @param pkg the package being documented.
+     * @param packageWriter the doclet specific writer that will output the
+     *        result.
+     */
+    private PackageSummaryBuilder(Context context,
+            PackageDoc pkg,
+            PackageSummaryWriter packageWriter) {
+        super(context);
+        this.packageDoc = pkg;
+        this.packageWriter = packageWriter;
     }
 
     /**
      * Construct a new PackageSummaryBuilder.
-     * @param configuration the current configuration of the doclet.
+     *
+     * @param context  the build context.
      * @param pkg the package being documented.
      * @param packageWriter the doclet specific writer that will output the
      *        result.
      *
      * @return an instance of a PackageSummaryBuilder.
      */
-    public static PackageSummaryBuilder getInstance(
-        Configuration configuration,
-        PackageDoc pkg,
-        PackageSummaryWriter packageWriter) {
-        PackageSummaryBuilder builder =
-                new PackageSummaryBuilder(configuration);
-        builder.packageDoc = pkg;
-        builder.packageWriter = packageWriter;
-        return builder;
+    public static PackageSummaryBuilder getInstance(Context context,
+            PackageDoc pkg, PackageSummaryWriter packageWriter) {
+        return new PackageSummaryBuilder(context, pkg, packageWriter);
     }
 
     /**
@@ -96,7 +103,7 @@
             //Doclet does not support this output.
             return;
         }
-        build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree);
+        build(layoutParser.parseXML(ROOT), contentTree);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java	Thu Nov 15 09:18:36 2012 -0800
@@ -93,17 +93,21 @@
      */
     private Content contentTree;
 
-    private SerializedFormBuilder(Configuration configuration) {
-        super(configuration);
+
+    /**
+     * Construct a new SerializedFormBuilder.
+     * @param context  the build context.
+     */
+    private SerializedFormBuilder(Context context) {
+        super(context);
     }
 
     /**
      * Construct a new SerializedFormBuilder.
-     * @param configuration the current configuration of the doclet.
+     * @param context  the build context.
      */
-    public static SerializedFormBuilder getInstance(Configuration configuration) {
-        SerializedFormBuilder builder = new SerializedFormBuilder(configuration);
-        return builder;
+    public static SerializedFormBuilder getInstance(Context context) {
+        return new SerializedFormBuilder(context);
     }
 
     /**
@@ -123,7 +127,7 @@
         } catch (Exception e) {
             throw new DocletAbortException();
         }
-        build(LayoutParser.getInstance(configuration).parseXML(NAME), contentTree);
+        build(layoutParser.parseXML(NAME), contentTree);
         writer.close();
     }
 
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/InheritDocTaglet.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/InheritDocTaglet.java	Thu Nov 15 09:18:36 2012 -0800
@@ -26,6 +26,7 @@
 package com.sun.tools.doclets.internal.toolkit.taglets;
 
 import com.sun.javadoc.*;
+import com.sun.tools.doclets.internal.toolkit.Configuration;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
 /**
@@ -104,7 +105,7 @@
 
     /**
      * Given a <code>MethodDoc</code> item, a <code>Tag</code> in the
-     * <code>MethodDoc</code> item and a String, replace all occurances
+     * <code>MethodDoc</code> item and a String, replace all occurrences
      * of @inheritDoc with documentation from it's superclass or superinterface.
      *
      * @param writer the writer that is writing the output.
@@ -116,12 +117,13 @@
             MethodDoc md, Tag holderTag, boolean isFirstSentence) {
         TagletOutput replacement = writer.getTagletOutputInstance();
 
+        Configuration configuration = writer.configuration();
         Taglet inheritableTaglet = holderTag == null ?
-            null : writer.configuration().tagletManager.getTaglet(holderTag.name());
+            null : configuration.tagletManager.getTaglet(holderTag.name());
         if (inheritableTaglet != null &&
             !(inheritableTaglet instanceof InheritableTaglet)) {
                 //This tag does not support inheritence.
-                writer.configuration().message.warning(md.position(),
+                configuration.message.warning(md.position(),
                 "doclet.noInheritedDoc", md.name() + md.flatSignature());
          }
         DocFinder.Output inheritedDoc =
@@ -129,7 +131,7 @@
                 (InheritableTaglet) inheritableTaglet, holderTag,
                 isFirstSentence, true));
         if (inheritedDoc.isValidInheritDocTag == false) {
-            writer.configuration().message.warning(md.position(),
+            configuration.message.warning(md.position(),
                 "doclet.noInheritedDoc", md.name() + md.flatSignature());
         } else if (inheritedDoc.inlineTags.length > 0) {
             replacement = writer.commentTagsToOutput(inheritedDoc.holderTag,
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletWriter.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletWriter.java	Thu Nov 15 09:18:36 2012 -0800
@@ -46,7 +46,11 @@
     /**
      * True if we only want to write the first sentence.
      */
-    protected boolean isFirstSentence = false;
+    protected final boolean isFirstSentence;
+
+    protected TagletWriter(boolean isFirstSentence) {
+        this.isFirstSentence = isFirstSentence;
+    }
 
     /**
      * @return an instance of the output object.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Thu Nov 15 09:18:36 2012 -0800
@@ -46,13 +46,6 @@
 public class Util {
 
     /**
-     * A mapping between characters and their
-     * corresponding HTML escape character.
-     */
-    public static final String[][] HTML_ESCAPE_CHARS =
-    {{"&", "&amp;"}, {"<", "&lt;"}, {">", "&gt;"}};
-
-    /**
      * Return array of class members whose documentation is to be generated.
      * If the member is deprecated do not include such a member in the
      * returned array.
@@ -424,18 +417,44 @@
      * return the result.
      *
      * @param s The string to check.
-     * @return the original string with all of the HTML characters
-     * escaped.
-     *
-     * @see #HTML_ESCAPE_CHARS
+     * @return the original string with all of the HTML characters escaped.
      */
     public static String escapeHtmlChars(String s) {
-        String result = s;
-        for (int i = 0; i < HTML_ESCAPE_CHARS.length; i++) {
-            result = Util.replaceText(result,
-                    HTML_ESCAPE_CHARS[i][0], HTML_ESCAPE_CHARS[i][1]);
+        for (int i = 0; i < s.length(); i++) {
+            char ch = s.charAt(i);
+            switch (ch) {
+                // only start building a new string if we need to
+                case '<': case '>': case '&':
+                    StringBuilder sb = new StringBuilder(s.substring(0, i));
+                    for ( ; i < s.length(); i++) {
+                        ch = s.charAt(i);
+                        switch (ch) {
+                            case '<': sb.append("&lt;");  break;
+                            case '>': sb.append("&gt;");  break;
+                            case '&': sb.append("&amp;"); break;
+                            default:  sb.append(ch);      break;
+                        }
+                    }
+                    return sb.toString();
+            }
         }
-        return result;
+        return s;
+    }
+
+    /**
+     * Escape all special html characters in a string buffer.
+     *
+     * @param sb The string buffer to update
+     */
+    public static void escapeHtmlChars(StringBuilder sb) {
+        // scan backwards, replacing characters as needed.
+        for (int i = sb.length() - 1; i >= 0; i--) {
+            switch (sb.charAt(i)) {
+                case '<': sb.replace(i, i+1, "&lt;"); break;
+                case '>': sb.replace(i, i+1, "&gt;"); break;
+                case '&': sb.replace(i, i+1, "&amp;"); break;
+            }
+        }
     }
 
     /**
@@ -579,22 +598,21 @@
     }
 
     /**
-     * Given a string, replace all tabs with the appropriate
-     * number of spaces.
-     * @param tabLength the length of each tab.
-     * @param s the String to scan.
+     * Replace all tabs with the appropriate number of spaces.
+     * @param configuration the doclet configuration defining the setting for the
+     *                      tab length.
+     * @param sb the StringBuilder in which to replace the tabs
      */
-    public static void replaceTabs(int tabLength, StringBuilder s) {
-        if (whitespace == null || whitespace.length() < tabLength)
-            whitespace = String.format("%" + tabLength + "s", " ");
+    public static void replaceTabs(Configuration configuration, StringBuilder sb) {
+        int tabLength = configuration.sourcetab;
+        String whitespace = configuration.tabSpaces;
         int index = 0;
-        while ((index = s.indexOf("\t", index)) != -1) {
+        while ((index = sb.indexOf("\t", index)) != -1) {
             int spaceCount = tabLength - index % tabLength;
-            s.replace(index, index+1, whitespace.substring(0, spaceCount));
+            sb.replace(index, index+1, whitespace.substring(0, spaceCount));
             index += spaceCount;
         }
     }
-    private static String whitespace;
 
     /**
      * The documentation for values() and valueOf() in Enums are set by the
--- a/src/share/classes/com/sun/tools/javadoc/ParamTagImpl.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/src/share/classes/com/sun/tools/javadoc/ParamTagImpl.java	Thu Nov 15 09:18:36 2012 -0800
@@ -43,7 +43,7 @@
  */
 class ParamTagImpl extends TagImpl implements ParamTag {
 
-    private static Pattern typeParamRE = Pattern.compile("<([^<>]+)>");
+    private static final Pattern typeParamRE = Pattern.compile("<([^<>]+)>");
 
     private final String parameterName;
     private final String parameterComment;
--- a/test/com/sun/javadoc/MetaTag/MetaTag.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/test/com/sun/javadoc/MetaTag/MetaTag.java	Thu Nov 15 09:18:36 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, 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
@@ -24,9 +24,6 @@
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
-import com.sun.tools.doclets.formats.html.ConfigurationImpl;
-import com.sun.tools.doclets.internal.toolkit.Configuration;
-
 /*
  * @test
  * @bug      4034096 4764726 6235799
@@ -135,13 +132,7 @@
      */
     public static void main(String[] args) {
         MetaTag tester = new MetaTag();
-        Configuration config = ConfigurationImpl.getInstance();
-        boolean defaultKeywordsSetting = config.keywords;
-        boolean defaultTimestampSetting = config.notimestamp;
         run(tester, ARGS, TEST, NEGATED_TEST);
-        //Variable needs to be reset because Configuration is a singleton.
-        config.keywords = defaultKeywordsSetting;
-        config.notimestamp = defaultTimestampSetting;
         run(tester, ARGS_NO_TIMESTAMP_NO_KEYWORDS, TEST2, NEGATED_TEST2);
         tester.printSummary();
     }
--- a/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java	Wed Nov 14 17:23:10 2012 -0800
+++ b/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java	Thu Nov 15 09:18:36 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2012, 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
@@ -60,7 +60,7 @@
     // Generate the HTML output using the HTML document generation within doclet.
     public static String generateHtmlTree() {
         // Document type for the HTML document
-        DocType htmlDocType = DocType.Transitional();
+        DocType htmlDocType = DocType.TRANSITIONAL;
         HtmlTree html = new HtmlTree(HtmlTag.HTML);
         HtmlTree head = new HtmlTree(HtmlTag.HEAD);
         HtmlTree title = new HtmlTree(HtmlTag.TITLE);