8160697: HTMLWriter needs perf cleanup
authorjjg
Tue, 09 Aug 2016 13:22:57 -0700
changeset 40303 96a1226aca18
parent 40302 8c0d8d2c3519
child 40304 0318f4e75c6d
8160697: HTMLWriter needs perf cleanup Reviewed-by: ksrini, bpatel
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/FixedStringContent.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/RawHtml.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeFieldWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeRequiredMemberWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ClassWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ConstantsSummaryWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ConstructorWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/EnumConstantWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/FieldWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/MemberSummaryWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Messages.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/MethodWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ModuleSummaryWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/NestedClassWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/PackageSummaryWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/PropertyWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Resources.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/SerializedFormWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritDocTaglet.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ParamTaglet.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ReturnTaglet.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ValueTaglet.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassTree.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/MessageRetriever.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/PackageListWriter.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -80,7 +80,7 @@
         Content typeParameters = getTypeParameters(member);
         if (!typeParameters.isEmpty()) {
             htmltree.addContent(typeParameters);
-            htmltree.addContent(writer.getSpace());
+            htmltree.addContent(Contents.SPACE);
         }
     }
 
@@ -157,7 +157,7 @@
                 param.asType()).varargs(isVarArg));
         tree.addContent(link);
         if(name(param).length() > 0) {
-            tree.addContent(writer.getSpace());
+            tree.addContent(Contents.SPACE);
             tree.addContent(name(param));
         }
     }
@@ -173,11 +173,11 @@
     protected void addReceiverAnnotations(ExecutableElement member, TypeMirror rcvrType,
             List<? extends AnnotationMirror> annotationMirrors, Content tree) {
         writer.addReceiverAnnotationInfo(member, rcvrType, annotationMirrors, tree);
-        tree.addContent(writer.getSpace());
+        tree.addContent(Contents.SPACE);
         tree.addContent(utils.getTypeName(rcvrType, false));
         LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, RECEIVER_TYPE, rcvrType);
         tree.addContent(writer.getTypeParameterLinks(linkInfo));
-        tree.addContent(writer.getSpace());
+        tree.addContent(Contents.SPACE);
         tree.addContent("this");
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -82,8 +82,7 @@
      */
     protected AbstractIndexWriter(ConfigurationImpl configuration,
                                   DocPath path,
-                                  IndexBuilder indexbuilder)
-                                  throws IOException {
+                                  IndexBuilder indexbuilder) {
         super(configuration, path);
         this.indexbuilder = indexbuilder;
     }
@@ -94,7 +93,7 @@
      * @return a content tree for the tree label
      */
     protected Content getNavLinkIndex() {
-        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, indexLabel);
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.indexLabel);
         return li;
     }
 
@@ -216,10 +215,10 @@
     protected void addDescription(PackageElement pkg, Content dlTree, SearchIndexItem si) {
         Content link = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
         si.setLabel(utils.getPackageName(pkg));
-        si.setCategory(getResource("doclet.Packages").toString());
+        si.setCategory(resources.getText("doclet.Packages"));
         Content dt = HtmlTree.DT(link);
         dt.addContent(" - ");
-        dt.addContent(getResource("doclet.package"));
+        dt.addContent(contents.package_);
         dt.addContent(" " + utils.getPackageName(pkg));
         dlTree.addContent(dt);
         Content dd = new HtmlTree(HtmlTag.DD);
@@ -238,7 +237,7 @@
                         LinkInfoImpl.Kind.INDEX, typeElement).strong(true));
         si.setContainingPackage(utils.getPackageName(utils.containingPackage(typeElement)));
         si.setLabel(utils.getSimpleName(typeElement));
-        si.setCategory(getResource("doclet.Types").toString());
+        si.setCategory(resources.getText("doclet.Types"));
         Content dt = HtmlTree.DT(link);
         dt.addContent(" - ");
         addClassInfo(typeElement, dt);
@@ -256,7 +255,7 @@
      * @param contentTree the content tree to which the class info will be added
      */
     protected void addClassInfo(TypeElement te, Content contentTree) {
-        contentTree.addContent(getResource("doclet.in",
+        contentTree.addContent(contents.getContent("doclet.in",
                 utils.getTypeElementName(te, false),
                 getPackageLink(utils.containingPackage(te),
                     utils.getPackageName(utils.containingPackage(te)))
@@ -286,7 +285,7 @@
         }  else {
             si.setLabel(name);
         }
-        si.setCategory(getResource("doclet.Members").toString());
+        si.setCategory(resources.getText("doclet.Members"));
         Content span = HtmlTree.SPAN(HtmlStyle.memberNameLink,
                 getDocLink(LinkInfoImpl.Kind.INDEX, member, name));
         Content dt = HtmlTree.DT(span);
@@ -304,11 +303,11 @@
         HtmlTree labelLink = HtmlTree.A(path, new StringContent(sii.getLabel()));
         Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.searchTagLink, labelLink));
         dt.addContent(" - ");
-        dt.addContent(getResource("doclet.Search_tag_in", sii.getHolder()));
+        dt.addContent(contents.getContent("doclet.Search_tag_in", sii.getHolder()));
         dlTree.addContent(dt);
         Content dd = new HtmlTree(HtmlTag.DD);
         if (sii.getDescription().isEmpty()) {
-            dd.addContent(getSpace());
+            dd.addContent(Contents.SPACE);
         } else {
             dd.addContent(sii.getDescription());
         }
@@ -326,7 +325,7 @@
      */
     protected void addComment(Element element, Content contentTree) {
         List<? extends DocTree> tags;
-        Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
+        Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.block);
         if (utils.isDeprecated(element)) {
@@ -360,15 +359,15 @@
         TypeElement containing = utils.getEnclosingTypeElement(member);
         String classdesc = utils.getTypeElementName(containing, true) + " ";
         if (utils.isField(member)) {
-            Content resource = getResource(utils.isStatic(member)
+            Content resource = contents.getContent(utils.isStatic(member)
                     ? "doclet.Static_variable_in"
                     : "doclet.Variable_in", classdesc);
             contentTree.addContent(resource);
         } else if (utils.isConstructor(member)) {
             contentTree.addContent(
-                    getResource("doclet.Constructor_for", classdesc));
+                    contents.getContent("doclet.Constructor_for", classdesc));
         } else if (utils.isMethod(member)) {
-            Content resource = getResource(utils.isStatic(member)
+            Content resource = contents.getContent(utils.isStatic(member)
                     ? "doclet.Static_method_in"
                     : "doclet.Method_in", classdesc);
             contentTree.addContent(resource);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -33,13 +33,9 @@
 import javax.lang.model.element.Modifier;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.element.TypeParameterElement;
-import javax.lang.model.element.VariableElement;
 import javax.lang.model.type.TypeMirror;
-import javax.lang.model.util.SimpleElementVisitor9;
 
 import com.sun.source.doctree.DocTree;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
 
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
@@ -48,6 +44,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Resources;
 import jdk.javadoc.internal.doclets.toolkit.taglets.DeprecatedTaglet;
 import jdk.javadoc.internal.doclets.toolkit.util.MethodTypes;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
@@ -73,6 +70,9 @@
     protected final ConfigurationImpl configuration;
     protected final Utils utils;
     protected final SubWriterHolderWriter writer;
+    protected final Contents contents;
+    protected final Resources resources;
+
     protected final TypeElement typeElement;
     protected Map<String, Integer> typeMap = new LinkedHashMap<>();
     protected Set<MethodTypes> methodTypes = EnumSet.noneOf(MethodTypes.class);
@@ -86,7 +86,9 @@
         this.writer = writer;
         this.nodepr = configuration.nodeprecated;
         this.typeElement = typeElement;
-        this.utils = writer.configuration.utils;
+        this.utils = configuration.utils;
+        this.contents = configuration.contents;
+        this.resources = configuration.resources;
     }
 
     public AbstractMemberWriter(SubWriterHolderWriter writer) {
@@ -258,7 +260,7 @@
         if (!set.isEmpty()) {
             String mods = set.stream().map(m -> m.toString()).collect(Collectors.joining(" "));
             htmltree.addContent(mods);
-            htmltree.addContent(writer.getSpace());
+            htmltree.addContent(Contents.SPACE);
         }
     }
 
@@ -286,7 +288,7 @@
         addModifier(member, code);
         if (type == null) {
             code.addContent(utils.isClass(member) ? "class" : "interface");
-            code.addContent(writer.getSpace());
+            code.addContent(Contents.SPACE);
         } else {
             List<? extends TypeParameterElement> list = utils.isExecutableElement(member)
                     ? ((ExecutableElement)member).getTypeParameters()
@@ -299,7 +301,7 @@
                 if (typeParameters.charCount() > 10) {
                     code.addContent(new HtmlTree(HtmlTag.BR));
                 } else {
-                    code.addContent(writer.getSpace());
+                    code.addContent(Contents.SPACE);
                 }
                 code.addContent(
                         writer.getLink(new LinkInfoImpl(configuration,
@@ -394,6 +396,7 @@
     * @param ped The <code>ProgramElement</code> being checked.
     * return true if the <code>ProgramElement</code> is being inherited and
     * false otherwise.
+     *@return true if inherited
     */
     protected boolean isInherited(Element ped){
         return (!utils.isPrivate(ped) &&
@@ -413,7 +416,7 @@
     protected void addDeprecatedAPI(Collection<Element> deprmembers, String headingKey,
             String tableSummary, List<String> tableHeader, Content contentTree) {
         if (deprmembers.size() > 0) {
-            Content caption = writer.getTableCaption(configuration.getResource(headingKey));
+            Content caption = writer.getTableCaption(configuration.getContent(headingKey));
             Content table = (configuration.isOutputHtml5())
                     ? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
                     : HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption);
@@ -536,7 +539,7 @@
 
     protected void serialWarning(Element e, String key, String a1, String a2) {
         if (configuration.serialwarn) {
-            configuration.getDocletSpecificMsg().warning(e, key, a1, a2);
+            configuration.messages.warning(e, key, a1, a2);
         }
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -66,7 +66,7 @@
      * @param filename Name of the module index file to be generated.
      */
     public AbstractModuleIndexWriter(ConfigurationImpl configuration,
-                                      DocPath filename) throws IOException {
+                                      DocPath filename) {
         super(configuration, filename);
         modules = configuration.modulePackages;
     }
@@ -259,7 +259,7 @@
      * @return a Content object to be added to the documentation tree
      */
     protected Content getNavLinkContents() {
-        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel);
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.overviewLabel);
         return li;
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, 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
@@ -65,7 +65,7 @@
      * @param filename Name of the package index file to be generated.
      */
     public AbstractPackageIndexWriter(ConfigurationImpl configuration,
-                                      DocPath filename) throws IOException {
+                                      DocPath filename) {
         super(configuration, filename);
         packages = configuration.packages;
     }
@@ -191,7 +191,7 @@
      * @return a Content object to be added to the documentation tree
      */
     protected Content getNavLinkContents() {
-        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel);
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.overviewLabel);
         return li;
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -71,8 +71,7 @@
      * @throws DocletAbortException
      */
     protected AbstractTreeWriter(ConfigurationImpl configuration,
-                                 DocPath filename, ClassTree classtree)
-                                 throws IOException {
+                                 DocPath filename, ClassTree classtree) {
         super(configuration, filename);
         this.classtree = classtree;
     }
@@ -121,7 +120,7 @@
                            HtmlTree div, boolean isEnums) {
         if (!sset.isEmpty()) {
             TypeElement firstTypeElement = sset.first();
-            Content headingContent = getResource(heading);
+            Content headingContent = contents.getContent(heading);
             Content sectionHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
                     headingContent);
             HtmlTree htmlTree;
@@ -162,7 +161,7 @@
                             isFirst = false;
                             if (utils.isInterface(typeElement)) {
                                 contentTree.addContent(" (");
-                                contentTree.addContent(getResource("doclet.also"));
+                                contentTree.addContent(contents.also);
                                 contentTree.addContent(" extends ");
                             } else {
                                 contentTree.addContent(" (implements ");
@@ -196,7 +195,7 @@
      * @return a content tree for the tree label
      */
     protected Content getNavLinkTree() {
-        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, treeLabel);
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.treeLabel);
         return li;
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -35,6 +35,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
@@ -78,8 +79,7 @@
      * @throws DocletAbortException
      */
     public AllClassesFrameWriter(ConfigurationImpl configuration,
-                                 DocPath filename, IndexBuilder indexbuilder)
-                              throws IOException {
+                                 DocPath filename, IndexBuilder indexbuilder) {
         super(configuration, filename);
         this.indexbuilder = indexbuilder;
     }
@@ -100,15 +100,13 @@
             allclassgen = new AllClassesFrameWriter(configuration,
                                                     filename, indexbuilder);
             allclassgen.buildAllClassesFile(true);
-            allclassgen.close();
             filename = DocPaths.ALLCLASSES_NOFRAME;
             allclassgen = new AllClassesFrameWriter(configuration,
                                                     filename, indexbuilder);
             allclassgen.buildAllClassesFile(false);
-            allclassgen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.
-                     error("doclet.exception_encountered",
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
                            exc.toString(), filename);
             throw new DocletAbortException(exc);
         }
@@ -122,7 +120,7 @@
         String label = configuration.getText("doclet.All_Classes");
         Content body = getBody(false, getWindowTitle(label));
         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
-                HtmlStyle.bar, allclassesLabel);
+                HtmlStyle.bar, contents.allClassesLabel);
         body.addContent(heading);
         Content ul = new HtmlTree(HtmlTag.UL);
         // Generate the class links and add it to the tdFont tree.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -111,7 +111,7 @@
             memberDetailsTree.addContent(writer.getMarkerAnchor(
                     SectionName.ANNOTATION_TYPE_FIELD_DETAIL));
             Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
-                    writer.fieldDetailsLabel);
+                    contents.fieldDetailsLabel);
             memberDetailsTree.addContent(heading);
             writer.printedAnnotationFieldHeading = true;
         }
@@ -142,7 +142,7 @@
                 writer.getLink(new LinkInfoImpl(configuration,
                         LinkInfoImpl.Kind.MEMBER, getType(member)));
         pre.addContent(link);
-        pre.addContent(writer.getSpace());
+        pre.addContent(Contents.SPACE);
         if (configuration.linksource) {
             Content memberName = new StringContent(name(member));
             writer.addSrcLink(member, memberName, pre);
@@ -193,18 +193,11 @@
     }
 
     /**
-     * Close the writer.
-     */
-    public void close() throws IOException {
-        writer.close();
-    }
-
-    /**
      * {@inheritDoc}
      */
     public void addSummaryLabel(Content memberTree) {
         Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
-                writer.getResource("doclet.Field_Summary"));
+                contents.fieldSummaryLabel);
         memberTree.addContent(label);
     }
 
@@ -221,7 +214,7 @@
      * {@inheritDoc}
      */
     public Content getCaption() {
-        return configuration.getResource("doclet.Fields");
+        return configuration.getContent("doclet.Fields");
     }
 
     /**
@@ -296,9 +289,9 @@
         if (link) {
             return writer.getHyperLink(
                     SectionName.ANNOTATION_TYPE_FIELD_SUMMARY,
-                    writer.getResource("doclet.navField"));
+                    contents.navField);
         } else {
-            return writer.getResource("doclet.navField");
+            return contents.navField;
         }
     }
 
@@ -309,9 +302,9 @@
         if (link) {
             liNav.addContent(writer.getHyperLink(
                     SectionName.ANNOTATION_TYPE_FIELD_DETAIL,
-                    writer.getResource("doclet.navField")));
+                    contents.navField));
         } else {
-            liNav.addContent(writer.getResource("doclet.navField"));
+            liNav.addContent(contents.navField);
         }
     }
     private TypeMirror getType(Element member) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -25,8 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
-
 import java.util.Arrays;
 import java.util.List;
 
@@ -96,7 +94,7 @@
             ExecutableElement ee = (ExecutableElement)member;
             AnnotationValue value = ee.getDefaultValue();
             if (value != null) {
-                Content dt = HtmlTree.DT(writer.getResource("doclet.Default"));
+                Content dt = HtmlTree.DT(contents.default_);
                 Content dl = HtmlTree.DL(dt);
                 Content dd = HtmlTree.DD(new StringContent(value.toString()));
                 dl.addContent(dd);
@@ -108,16 +106,9 @@
     /**
      * {@inheritDoc}
      */
-    public void close() throws IOException {
-        writer.close();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
     public void addSummaryLabel(Content memberTree) {
         Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
-                writer.getResource("doclet.Annotation_Type_Optional_Member_Summary"));
+                contents.annotateTypeOptionalMemberSummaryLabel);
         memberTree.addContent(label);
     }
 
@@ -125,16 +116,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 resources.getText("doclet.Member_Table_Summary",
+                resources.getText("doclet.Annotation_Type_Optional_Member_Summary"),
+                resources.getText("doclet.annotation_type_optional_members"));
     }
 
     /**
      * {@inheritDoc}
      */
     public Content getCaption() {
-        return configuration.getResource("doclet.Annotation_Type_Optional_Members");
+        return configuration.getContent("doclet.Annotation_Type_Optional_Members");
     }
 
     /**
@@ -163,9 +154,9 @@
         if (link) {
             return writer.getHyperLink(
                     SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY,
-                    writer.getResource("doclet.navAnnotationTypeOptionalMember"));
+                    contents.navAnnotationTypeOptionalMember);
         } else {
-            return writer.getResource("doclet.navAnnotationTypeOptionalMember");
+            return contents.navAnnotationTypeOptionalMember;
         }
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -111,7 +111,7 @@
             memberDetailsTree.addContent(writer.getMarkerAnchor(
                     SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL));
             Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
-                    writer.annotationTypeDetailsLabel);
+                    contents.annotationTypeDetailsLabel);
             memberDetailsTree.addContent(heading);
             writer.printedAnnotationHeading = true;
         }
@@ -143,7 +143,7 @@
                 writer.getLink(new LinkInfoImpl(configuration,
                         LinkInfoImpl.Kind.MEMBER, getType(member)));
         pre.addContent(link);
-        pre.addContent(writer.getSpace());
+        pre.addContent(Contents.SPACE);
         if (configuration.linksource) {
             Content memberName = new StringContent(name(member));
             writer.addSrcLink(member, memberName, pre);
@@ -194,18 +194,11 @@
     }
 
     /**
-     * Close the writer.
-     */
-    public void close() throws IOException {
-        writer.close();
-    }
-
-    /**
      * {@inheritDoc}
      */
     public void addSummaryLabel(Content memberTree) {
         Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
-                writer.getResource("doclet.Annotation_Type_Required_Member_Summary"));
+                contents.annotateTypeRequiredMemberSummaryLabel);
         memberTree.addContent(label);
     }
 
@@ -222,7 +215,7 @@
      * {@inheritDoc}
      */
     public Content getCaption() {
-        return configuration.getResource("doclet.Annotation_Type_Required_Members");
+        return configuration.getContent("doclet.Annotation_Type_Required_Members");
     }
 
     /**
@@ -297,9 +290,9 @@
         if (link) {
             return writer.getHyperLink(
                     SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY,
-                    writer.getResource("doclet.navAnnotationTypeRequiredMember"));
+                    contents.navAnnotationTypeRequiredMember);
         } else {
-            return writer.getResource("doclet.navAnnotationTypeRequiredMember");
+            return contents.navAnnotationTypeRequiredMember;
         }
     }
 
@@ -310,9 +303,9 @@
         if (link) {
             liNav.addContent(writer.getHyperLink(
                     SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL,
-                    writer.getResource("doclet.navAnnotationTypeMember")));
+                    contents.navAnnotationTypeMember));
         } else {
-            liNav.addContent(writer.getResource("doclet.navAnnotationTypeMember"));
+            liNav.addContent(contents.navAnnotationTypeMember);
         }
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -98,7 +98,7 @@
     @Override
     protected Content getNavLinkModule() {
         Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(annotationType),
-                moduleLabel);
+                contents.moduleLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -111,7 +111,7 @@
     @Override
     protected Content getNavLinkPackage() {
         Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
-                packageLabel);
+                contents.packageLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -123,7 +123,7 @@
      */
     @Override
     protected Content getNavLinkClass() {
-        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, classLabel);
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.classLabel);
         return li;
     }
 
@@ -134,7 +134,7 @@
      */
     @Override
     protected Content getNavLinkClassUse() {
-        Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), useLabel);
+        Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), contents.useLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -150,11 +150,11 @@
         if (prev != null) {
             Content prevLink = getLink(new LinkInfoImpl(configuration,
                     LinkInfoImpl.Kind.CLASS, utils.asTypeElement(prev))
-                    .label(prevclassLabel).strong(true));
+                    .label(contents.prevClassLabel).strong(true));
             li = HtmlTree.LI(prevLink);
         }
         else
-            li = HtmlTree.LI(prevclassLabel);
+            li = HtmlTree.LI(contents.prevClassLabel);
         return li;
     }
 
@@ -169,11 +169,11 @@
         if (next != null) {
             Content nextLink = getLink(new LinkInfoImpl(configuration,
                     LinkInfoImpl.Kind.CLASS, utils.asTypeElement(next))
-                    .label(nextclassLabel).strong(true));
+                    .label(contents.nextClassLabel).strong(true));
             li = HtmlTree.LI(nextLink);
         }
         else
-            li = HtmlTree.LI(nextclassLabel);
+            li = HtmlTree.LI(contents.nextClassLabel);
         return li;
     }
 
@@ -320,13 +320,13 @@
         List<? extends DocTree> deprs = utils.getBlockTags(annotationType, DocTree.Kind.DEPRECATED);
         if (utils.isDeprecated(annotationType)) {
             CommentHelper ch = utils.getCommentHelper(annotationType);
-            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
+            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
             Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
             if (!deprs.isEmpty()) {
 
                 List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
                 if (!commentTags.isEmpty()) {
-                    div.addContent(getSpace());
+                    div.addContent(Contents.SPACE);
                     addInlineDeprecatedComment(annotationType, deprs.get(0), div);
                 }
             }
@@ -340,7 +340,7 @@
     @Override
     protected Content getNavLinkTree() {
         Content treeLinkContent = getHyperLink(DocPaths.PACKAGE_TREE,
-                treeLabel, "", "");
+                contents.treeLabel, "", "");
         Content li = HtmlTree.LI(treeLinkContent);
         return li;
     }
@@ -368,8 +368,8 @@
      * @throws java.lang.Exception
      */
     protected Content getNavSummaryLinks() throws Exception {
-        Content li = HtmlTree.LI(summaryLabel);
-        li.addContent(getSpace());
+        Content li = HtmlTree.LI(contents.summaryLabel);
+        li.addContent(Contents.SPACE);
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
         MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
                 configuration.getBuilderFactory().getMemberSummaryBuilder(this);
@@ -406,7 +406,7 @@
         AbstractMemberWriter writer = ((AbstractMemberWriter) builder.
                 getMemberSummaryWriter(type));
         if (writer == null) {
-            liNav.addContent(getResource(label));
+            liNav.addContent(contents.getContent(label));
         } else {
             liNav.addContent(writer.getNavSummaryLink(null,
                     ! builder.getVisibleMemberMap(type).noVisibleMembers()));
@@ -420,8 +420,8 @@
      * @throws java.lang.Exception
      */
     protected Content getNavDetailLinks() throws Exception {
-        Content li = HtmlTree.LI(detailLabel);
-        li.addContent(getSpace());
+        Content li = HtmlTree.LI(contents.detailLabel);
+        li.addContent(Contents.SPACE);
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
         MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
                 configuration.getBuilderFactory().getMemberSummaryBuilder(this);
@@ -438,7 +438,7 @@
         if (writerField != null) {
             writerField.addNavDetailLink(!utils.getAnnotationFields(annotationType).isEmpty(), liNavField);
         } else {
-            liNavField.addContent(getResource("doclet.navField"));
+            liNavField.addContent(contents.navField);
         }
         addNavGap(liNavField);
         ulNav.addContent(liNavField);
@@ -451,7 +451,7 @@
             writerRequired.addNavDetailLink(!annotationType.getAnnotationMirrors().isEmpty(), liNavReq);
             ulNav.addContent(liNavReq);
         } else {
-            Content liNav = HtmlTree.LI(getResource("doclet.navAnnotationTypeMember"));
+            Content liNav = HtmlTree.LI(contents.navAnnotationTypeMember);
             ulNav.addContent(liNav);
         }
         return ulNav;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -47,6 +47,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassUseMapper;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
@@ -226,11 +227,10 @@
         try {
             clsgen = new ClassUseWriter(configuration, mapper, path, typeElement);
             clsgen.generateClassUseFile();
-            clsgen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.
-                error("doclet.exception_encountered",
-                      exc.toString(), path.getPath());
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
+                    exc.toString(), path.getPath());
             throw new DocletAbortException(exc);
         }
     }
@@ -245,7 +245,7 @@
         if (pkgSet.size() > 0) {
             addClassUse(div);
         } else {
-            div.addContent(getResource("doclet.ClassUse_No.usage.of.0",
+            div.addContent(contents.getContent("doclet.ClassUse_No.usage.of.0",
                     utils.getFullyQualifiedName(typeElement)));
         }
         if (configuration.allowTag(HtmlTag.MAIN)) {
@@ -287,7 +287,7 @@
      * @param contentTree the content tree to which the packages elements will be added
      */
     protected void addPackageList(Content contentTree) throws IOException {
-        Content caption = getTableCaption(configuration.getResource(
+        Content caption = getTableCaption(configuration.getContent(
                 "doclet.ClassUse_Packages.that.use.0",
                 getLink(new LinkInfoImpl(configuration,
                         LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement))));
@@ -320,7 +320,7 @@
                 pkgToPackageAnnotations.isEmpty()) {
             return;
         }
-        Content caption = getTableCaption(configuration.getResource(
+        Content caption = getTableCaption(configuration.getContent(
                 "doclet.ClassUse_PackageAnnotation",
                 getLink(new LinkInfoImpl(configuration,
                         LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement))));
@@ -360,10 +360,10 @@
             HtmlTree htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                     ? HtmlTree.SECTION(markerAnchor)
                     : HtmlTree.LI(HtmlStyle.blockList, markerAnchor);
-            Content link = getResource("doclet.ClassUse_Uses.of.0.in.1",
-                                       getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
-                                                                typeElement)),
-                                       getPackageLink(pkg, utils.getPackageName(pkg)));
+            Content link = contents.getContent("doclet.ClassUse_Uses.of.0.in.1",
+                    getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
+                            typeElement)),
+                    getPackageLink(pkg, utils.getPackageName(pkg)));
             Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
             htmlTree.addContent(heading);
             addClassUse(pkg, htmlTree);
@@ -404,67 +404,67 @@
             LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement));
         Content pkgLink = getPackageLink(pkg, utils.getPackageName(pkg));
         classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg),
-                configuration.getResource("doclet.ClassUse_Annotation", classLink,
+                configuration.getContent("doclet.ClassUse_Annotation", classLink,
                 pkgLink), classUseTableSummary, contentTree);
         classSubWriter.addUseInfo(pkgToClassTypeParameter.get(pkg),
-                configuration.getResource("doclet.ClassUse_TypeParameter", classLink,
+                configuration.getContent("doclet.ClassUse_TypeParameter", classLink,
                 pkgLink), classUseTableSummary, contentTree);
         classSubWriter.addUseInfo(pkgToSubclass.get(pkg),
-                configuration.getResource("doclet.ClassUse_Subclass", classLink,
+                configuration.getContent("doclet.ClassUse_Subclass", classLink,
                 pkgLink), subclassUseTableSummary, contentTree);
         classSubWriter.addUseInfo(pkgToSubinterface.get(pkg),
-                configuration.getResource("doclet.ClassUse_Subinterface", classLink,
+                configuration.getContent("doclet.ClassUse_Subinterface", classLink,
                 pkgLink), subinterfaceUseTableSummary, contentTree);
         classSubWriter.addUseInfo(pkgToImplementingClass.get(pkg),
-                configuration.getResource("doclet.ClassUse_ImplementingClass", classLink,
+                configuration.getContent("doclet.ClassUse_ImplementingClass", classLink,
                 pkgLink), classUseTableSummary, contentTree);
         fieldSubWriter.addUseInfo(pkgToField.get(pkg),
-                configuration.getResource("doclet.ClassUse_Field", classLink,
+                configuration.getContent("doclet.ClassUse_Field", classLink,
                 pkgLink), fieldUseTableSummary, contentTree);
         fieldSubWriter.addUseInfo(pkgToFieldAnnotations.get(pkg),
-                configuration.getResource("doclet.ClassUse_FieldAnnotations", classLink,
+                configuration.getContent("doclet.ClassUse_FieldAnnotations", classLink,
                 pkgLink), fieldUseTableSummary, contentTree);
         fieldSubWriter.addUseInfo(pkgToFieldTypeParameter.get(pkg),
-                configuration.getResource("doclet.ClassUse_FieldTypeParameter", classLink,
+                configuration.getContent("doclet.ClassUse_FieldTypeParameter", classLink,
                 pkgLink), fieldUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodAnnotations.get(pkg),
-                configuration.getResource("doclet.ClassUse_MethodAnnotations", classLink,
+                configuration.getContent("doclet.ClassUse_MethodAnnotations", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodParameterAnnotations.get(pkg),
-                configuration.getResource("doclet.ClassUse_MethodParameterAnnotations", classLink,
+                configuration.getContent("doclet.ClassUse_MethodParameterAnnotations", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodTypeParameter.get(pkg),
-                configuration.getResource("doclet.ClassUse_MethodTypeParameter", classLink,
+                configuration.getContent("doclet.ClassUse_MethodTypeParameter", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodReturn.get(pkg),
-                configuration.getResource("doclet.ClassUse_MethodReturn", classLink,
+                configuration.getContent("doclet.ClassUse_MethodReturn", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodReturnTypeParameter.get(pkg),
-                configuration.getResource("doclet.ClassUse_MethodReturnTypeParameter", classLink,
+                configuration.getContent("doclet.ClassUse_MethodReturnTypeParameter", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodArgs.get(pkg),
-                configuration.getResource("doclet.ClassUse_MethodArgs", classLink,
+                configuration.getContent("doclet.ClassUse_MethodArgs", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodArgTypeParameter.get(pkg),
-                configuration.getResource("doclet.ClassUse_MethodArgsTypeParameters", classLink,
+                configuration.getContent("doclet.ClassUse_MethodArgsTypeParameters", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodThrows.get(pkg),
-                configuration.getResource("doclet.ClassUse_MethodThrows", classLink,
+                configuration.getContent("doclet.ClassUse_MethodThrows", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         constrSubWriter.addUseInfo(pkgToConstructorAnnotations.get(pkg),
-                configuration.getResource("doclet.ClassUse_ConstructorAnnotations", classLink,
+                configuration.getContent("doclet.ClassUse_ConstructorAnnotations", classLink,
                 pkgLink), constructorUseTableSummary, contentTree);
         constrSubWriter.addUseInfo(pkgToConstructorParameterAnnotations.get(pkg),
-                configuration.getResource("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
+                configuration.getContent("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
                 pkgLink), constructorUseTableSummary, contentTree);
         constrSubWriter.addUseInfo(pkgToConstructorArgs.get(pkg),
-                configuration.getResource("doclet.ClassUse_ConstructorArgs", classLink,
+                configuration.getContent("doclet.ClassUse_ConstructorArgs", classLink,
                 pkgLink), constructorUseTableSummary, contentTree);
         constrSubWriter.addUseInfo(pkgToConstructorArgTypeParameter.get(pkg),
-                configuration.getResource("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
+                configuration.getContent("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
                 pkgLink), constructorUseTableSummary, contentTree);
         constrSubWriter.addUseInfo(pkgToConstructorThrows.get(pkg),
-                configuration.getResource("doclet.ClassUse_ConstructorThrows", classLink,
+                configuration.getContent("doclet.ClassUse_ConstructorThrows", classLink,
                 pkgLink), constructorUseTableSummary, contentTree);
     }
 
@@ -490,7 +490,7 @@
             bodyTree.addContent(htmlTree);
         }
         ContentBuilder headContent = new ContentBuilder();
-        headContent.addContent(getResource("doclet.ClassUse_Title", cltype));
+        headContent.addContent(contents.getContent("doclet.ClassUse_Title", cltype));
         headContent.addContent(new HtmlTree(HtmlTag.BR));
         headContent.addContent(clname);
         Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING,
@@ -512,7 +512,7 @@
     @Override
     protected Content getNavLinkModule() {
         Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(typeElement),
-                moduleLabel);
+                contents.moduleLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -524,7 +524,7 @@
      */
     protected Content getNavLinkPackage() {
         Content linkContent =
-                getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_SUMMARY), packageLabel);
+                getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_SUMMARY), contents.packageLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -548,7 +548,7 @@
      * @return a content tree for the use link
      */
     protected Content getNavLinkClassUse() {
-        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, useLabel);
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.useLabel);
         return li;
     }
 
@@ -559,8 +559,8 @@
      */
     protected Content getNavLinkTree() {
         Content linkContent = utils.isEnclosingPackageIncluded(typeElement)
-                ? getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_TREE), treeLabel)
-                : getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), treeLabel);
+                ? getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_TREE), contents.treeLabel)
+                : getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), contents.treeLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -112,7 +112,7 @@
     @Override
     protected Content getNavLinkModule() {
         Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(typeElement),
-                moduleLabel);
+                contents.moduleLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -125,7 +125,7 @@
     @Override
     protected Content getNavLinkPackage() {
         Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
-                packageLabel);
+                contents.packageLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -137,7 +137,7 @@
      */
     @Override
     protected Content getNavLinkClass() {
-        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, classLabel);
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.classLabel);
         return li;
     }
 
@@ -148,7 +148,7 @@
      */
     @Override
     protected Content getNavLinkClassUse() {
-        Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), useLabel);
+        Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), contents.useLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -164,11 +164,11 @@
         if (prev != null) {
             Content prevLink = getLink(new LinkInfoImpl(configuration,
                     LinkInfoImpl.Kind.CLASS, prev)
-                    .label(prevclassLabel).strong(true));
+                    .label(contents.prevClassLabel).strong(true));
             li = HtmlTree.LI(prevLink);
         }
         else
-            li = HtmlTree.LI(prevclassLabel);
+            li = HtmlTree.LI(contents.prevClassLabel);
         return li;
     }
 
@@ -183,11 +183,11 @@
         if (next != null) {
             Content nextLink = getLink(new LinkInfoImpl(configuration,
                     LinkInfoImpl.Kind.CLASS, next)
-                    .label(nextclassLabel).strong(true));
+                    .label(contents.nextClassLabel).strong(true));
             li = HtmlTree.LI(nextLink);
         }
         else
-            li = HtmlTree.LI(nextclassLabel);
+            li = HtmlTree.LI(contents.nextClassLabel);
         return li;
     }
 
@@ -210,18 +210,18 @@
         div.addStyle(HtmlStyle.header);
         ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(typeElement);
         if (mdle != null && !mdle.isUnnamed()) {
-            Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInClass, moduleLabel);
+            Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInClass, contents.moduleLabel);
             Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
-            moduleNameDiv.addContent(getSpace());
+            moduleNameDiv.addContent(Contents.SPACE);
             moduleNameDiv.addContent(getModuleLink(mdle,
                     new StringContent(mdle.getQualifiedName().toString())));
             div.addContent(moduleNameDiv);
         }
         PackageElement pkg = utils.containingPackage(typeElement);
         if (!pkg.isUnnamed()) {
-            Content classPackageLabel = HtmlTree.SPAN(HtmlStyle.packageLabelInClass, packageLabel);
+            Content classPackageLabel = HtmlTree.SPAN(HtmlStyle.packageLabelInClass, contents.packageLabel);
             Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classPackageLabel);
-            pkgNameDiv.addContent(getSpace());
+            pkgNameDiv.addContent(Contents.SPACE);
             Content pkgNameContent = getPackageLink(pkg,
                     new StringContent(utils.getPackageName(pkg)));
             pkgNameDiv.addContent(pkgNameContent);
@@ -469,8 +469,7 @@
             }
             Set<TypeElement> subclasses = classtree.directSubClasses(typeElement, false);
             if (!subclasses.isEmpty()) {
-                Content label = getResource(
-                        "doclet.Subclasses");
+                Content label = contents.subclassesLabel;
                 Content dt = HtmlTree.DT(label);
                 Content dl = HtmlTree.DL(dt);
                 dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUBCLASSES,
@@ -488,8 +487,7 @@
         if (utils.isInterface(typeElement)) {
             Set<TypeElement> subInterfaces = classtree.allSubClasses(typeElement, false);
             if (!subInterfaces.isEmpty()) {
-                Content label = getResource(
-                        "doclet.Subinterfaces");
+                Content label = contents.subinterfacesLabel;
                 Content dt = HtmlTree.DT(label);
                 Content dl = HtmlTree.DL(dt);
                 dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUBINTERFACES,
@@ -513,8 +511,7 @@
         }
         Set<TypeElement> implcl = classtree.implementingClasses(typeElement);
         if (!implcl.isEmpty()) {
-            Content label = getResource(
-                    "doclet.Implementing_Classes");
+            Content label = contents.implementingClassesLabel;
             Content dt = HtmlTree.DT(label);
             Content dl = HtmlTree.DL(dt);
             dl.addContent(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_CLASSES,
@@ -531,8 +528,7 @@
         SortedSet<TypeMirror> interfaces = new TreeSet<>(utils.makeTypeMirrorClassUseComparator());
         interfaces.addAll(utils.getAllInterfaces(typeElement));
         if (utils.isClass(typeElement) && !interfaces.isEmpty()) {
-            Content label = getResource(
-                    "doclet.All_Implemented_Interfaces");
+            Content label = contents.allImplementedInterfacesLabel;
             Content dt = HtmlTree.DT(label);
             Content dl = HtmlTree.DL(dt);
             dl.addContent(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_INTERFACES, interfaces));
@@ -550,7 +546,7 @@
         interfaces.addAll(utils.getAllInterfaces(typeElement));
 
         if (utils.isInterface(typeElement) && !interfaces.isEmpty()) {
-            Content label = getResource("doclet.All_Superinterfaces");
+            Content label = contents.allSuperinterfacesLabel;
             Content dt = HtmlTree.DT(label);
             Content dl = HtmlTree.DL(dt);
             dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUPER_INTERFACES, interfaces));
@@ -569,10 +565,10 @@
         new SimpleElementVisitor8<Void, Void>() {
             @Override @DefinedBy(Api.LANGUAGE_MODEL)
             public Void visitType(TypeElement e, Void p) {
-                String label = utils.isInterface(e)
-                        ? "doclet.Enclosing_Interface"
-                        : "doclet.Enclosing_Class";
-                Content dt = HtmlTree.DT(getResource(label));
+                Content label = utils.isInterface(e)
+                        ? contents.enclosingInterfaceLabel
+                        : contents.enclosingClassLabel;
+                Content dt = HtmlTree.DT(label);
                 Content dl = HtmlTree.DL(dt);
                 Content dd = new HtmlTree(HtmlTag.DD);
                 dd.addContent(getLink(new LinkInfoImpl(configuration,
@@ -590,10 +586,10 @@
     @Override
     public void addFunctionalInterfaceInfo (Content classInfoTree) {
         if (isFunctionalInterface()) {
-            Content dt = HtmlTree.DT(getResource("doclet.Functional_Interface"));
+            Content dt = HtmlTree.DT(contents.functionalInterface);
             Content dl = HtmlTree.DL(dt);
             Content dd = new HtmlTree(HtmlTag.DD);
-            dd.addContent(getResource("doclet.Functional_Interface_Message"));
+            dd.addContent(contents.functionalInterfaceMessage);
             dl.addContent(dd);
             classInfoTree.addContent(dl);
         }
@@ -619,14 +615,14 @@
         classInfoTree.addContent(hr);
         List<? extends DocTree> deprs = utils.getBlockTags(typeElement, DocTree.Kind.DEPRECATED);
         if (utils.isDeprecated(typeElement)) {
-            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
+            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
             Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
             if (!deprs.isEmpty()) {
                 CommentHelper ch = utils.getCommentHelper(typeElement);
                 DocTree dt = deprs.get(0);
                 List<? extends DocTree> commentTags = ch.getBody(configuration, dt);
                 if (!commentTags.isEmpty()) {
-                    div.addContent(getSpace());
+                    div.addContent(Contents.SPACE);
                     addInlineDeprecatedComment(typeElement, deprs.get(0), div);
                 }
             }
@@ -671,7 +667,7 @@
     @Override
     protected Content getNavLinkTree() {
         Content treeLinkContent = getHyperLink(DocPaths.PACKAGE_TREE,
-                treeLabel, "", "");
+                contents.treeLabel, "", "");
         Content li = HtmlTree.LI(treeLinkContent);
         return li;
     }
@@ -697,8 +693,8 @@
      * @return the content tree for the navigation summary links
      */
     protected Content getNavSummaryLinks() throws Exception {
-        Content li = HtmlTree.LI(summaryLabel);
-        li.addContent(getSpace());
+        Content li = HtmlTree.LI(contents.summaryLabel);
+        li.addContent(Contents.SPACE);
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
         MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
                 configuration.getBuilderFactory().getMemberSummaryBuilder(this);
@@ -713,7 +709,7 @@
             AbstractMemberWriter writer =
                 ((AbstractMemberWriter) memberSummaryBuilder.getMemberSummaryWriter(kind));
             if (writer == null) {
-                liNav.addContent(getResource(VisibleMemberMap.Kind.getNavLinkLabels(kind)));
+                liNav.addContent(contents.getContent(VisibleMemberMap.Kind.getNavLinkLabels(kind)));
             } else {
                 writer.addNavSummaryLink(
                         memberSummaryBuilder.members(kind),
@@ -734,8 +730,8 @@
      * @throws java.lang.Exception
      */
     protected Content getNavDetailLinks() throws Exception {
-        Content li = HtmlTree.LI(detailLabel);
-        li.addContent(getSpace());
+        Content li = HtmlTree.LI(contents.detailLabel);
+        li.addContent(Contents.SPACE);
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
         MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
                 configuration.getBuilderFactory().getMemberSummaryBuilder(this);
@@ -751,7 +747,7 @@
                 continue;
             }
             if (writer == null) {
-                liNav.addContent(getResource(VisibleMemberMap.Kind.getNavLinkLabels(kind)));
+                liNav.addContent(contents.getContent(VisibleMemberMap.Kind.getNavLinkLabels(kind)));
             } else {
                 writer.addNavDetailLink(memberSummaryBuilder.members(kind), liNav);
             }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -40,23 +40,22 @@
 
 import com.sun.source.util.DocTreePath;
 import com.sun.tools.doclint.DocLint;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symbol.ModuleSymbol;
 import com.sun.tools.javac.code.Symbol.PackageSymbol;
 
 import jdk.javadoc.doclet.Doclet;
 import jdk.javadoc.doclet.DocletEnvironment;
-import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlVersion;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.Resources;
 import jdk.javadoc.internal.doclets.toolkit.WriterFactory;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
-import jdk.javadoc.internal.doclets.toolkit.util.MessageRetriever;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 
 import static javax.tools.Diagnostic.Kind.*;
@@ -208,10 +207,7 @@
      */
     public Map<Doclet.Option, String> doclintOpts = new LinkedHashMap<>();
 
-    /**
-     * Unique Resource Handler for this package.
-     */
-    public final MessageRetriever standardmessage;
+    public final Resources resources;
 
     /**
      * First file to appear in the right-hand frame in the generated
@@ -236,13 +232,21 @@
 
     protected Set<Character> tagSearchIndexKeys;
 
+    protected Contents contents;
+
+    protected Messages messages;
+
     /**
      * Constructor. Initializes resource for the
      * {@link com.sun.tools.doclets.internal.toolkit.util.MessageRetriever MessageRetriever}.
      */
     public ConfigurationImpl() {
-        standardmessage = new MessageRetriever(this,
-            "jdk.javadoc.internal.doclets.formats.html.resources.standard");
+        resources = new Resources(this,
+                Configuration.sharedResourceBundleName,
+                "jdk.javadoc.internal.doclets.formats.html.resources.standard");
+
+        messages = new Messages(this);
+        contents = new Contents(this);
     }
 
     private final String versionRBName = "jdk.javadoc.internal.tool.resources.version";
@@ -269,6 +273,16 @@
         }
     }
 
+    @Override
+    public Resources getResources() {
+        return resources;
+    }
+
+    @Override
+    public Messages getMessages() {
+        return messages;
+    }
+
     protected boolean validateOptions() {
         // check shared options
         if (!generalValidOptions()) {
@@ -393,14 +407,6 @@
     }
 
     /**
-     * {@inheritDoc}
-     */
-    @Override
-    public MessageRetriever getDocletSpecificMsg() {
-        return standardmessage;
-    }
-
-    /**
      * Decide the page which will appear first in the right-hand frame. It will
      * be "overview-summary.html" if "-overview" option is used or no
      * "-overview" but the number of packages is more than one. It will be
@@ -479,10 +485,11 @@
     }
 
     /**
-     * Return the path of the overview file and null if it does not exist.
+     * Return the path of the overview file or null if it does not exist.
      *
-     * @return the path of the overview file and null if it does not exist.
+     * @return the path of the overview file or null if it does not exist.
      */
+    @Override
     public JavaFileObject getOverviewPath() {
         if (overviewpath != null && getFileManager() instanceof StandardJavaFileManager) {
             StandardJavaFileManager fm = (StandardJavaFileManager) getFileManager();
@@ -510,10 +517,63 @@
     }
 
     @Override
-    public Content newContent() {
-        return new ContentBuilder();
+    public String getText(String key) {
+        return resources.getText(key);
+    }
+
+    @Override
+    public String getText(String key, String... args) {
+        return resources.getText(key, (Object[]) args);
+    }
+
+   /**
+     * {@inheritdoc}
+     */
+    @Override
+    public Content getContent(String key) {
+        return contents.getContent(key);
+    }
+
+    /**
+     * Get the configuration string as a content.
+     *
+     * @param key the key to look for in the configuration file
+     * @param o   string or content argument added to configuration text
+     * @return a content tree for the text
+     */
+    @Override
+    public Content getContent(String key, Object o) {
+        return contents.getContent(key, o);
     }
 
+    /**
+     * Get the configuration string as a content.
+     *
+     * @param key the key to look for in the configuration file
+     * @param o1 resource argument
+     * @param o2 resource argument
+     * @return a content tree for the text
+     */
+    @Override
+    public Content getContent(String key, Object o1, Object o2) {
+        return contents.getContent(key, o1, o2);
+    }
+
+    /**
+     * Get the configuration string as a content.
+     *
+     * @param key the key to look for in the configuration file
+     * @param o0  string or content argument added to configuration text
+     * @param o1  string or content argument added to configuration text
+     * @param o2  string or content argument added to configuration text
+     * @return a content tree for the text
+     */
+    @Override
+    public Content getContent(String key, Object o0, Object o1, Object o2) {
+        return contents.getContent(key, o0, o1, o2);
+    }
+
+
     @Override
     public Location getLocationForPackage(PackageElement pd) {
         JavaFileManager fm = getFileManager();
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -87,8 +87,7 @@
      * @param configuration the configuration used in this run
      *        of the standard doclet.
      */
-    public ConstantsSummaryWriterImpl(ConfigurationImpl configuration)
-            throws IOException {
+    public ConstantsSummaryWriterImpl(ConfigurationImpl configuration) {
         super(configuration, DocPaths.CONSTANT_VALUES);
         this.configuration = configuration;
         constantsTableSummary = configuration.getText("doclet.Constants_Table_Summary",
@@ -133,7 +132,7 @@
         if (pkg.isUnnamed()) {
             link = getHyperLink(getDocLink(
                     SectionName.UNNAMED_PACKAGE_ANCHOR),
-                    defaultPackageLabel, "", "");
+                    contents.defaultPackageLabel, "", "");
         } else {
             String parsedPackageName = utils.parsePackageName(pkg);
             Content packageNameContent = getPackageLabel(parsedPackageName);
@@ -150,13 +149,11 @@
      * {@inheritDoc}
      */
     public void addContentsList(Content contentTree, Content contentListTree) {
-        Content titleContent = getResource(
-                "doclet.Constants_Summary");
+        Content titleContent = contents.constantsSummaryTitle;
         Content pHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
                 HtmlStyle.title, titleContent);
         Content div = HtmlTree.DIV(HtmlStyle.header, pHeading);
-        Content headingContent = getResource(
-                "doclet.Contents");
+        Content headingContent = contents.contentsHeading;
         Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
                 headingContent);
         if (configuration.allowTag(HtmlTag.SECTION)) {
@@ -191,7 +188,7 @@
         if (pkg.isUnnamed()) {
             summariesTree.addContent(getMarkerAnchor(
                     SectionName.UNNAMED_PACKAGE_ANCHOR));
-            pkgNameContent = defaultPackageLabel;
+            pkgNameContent = contents.defaultPackageLabel;
         } else {
             String parsedPackageName = utils.parsePackageName(pkg);
             summariesTree.addContent(getMarkerAnchor(parsedPackageName));
@@ -315,7 +312,7 @@
         for (Modifier mod : member.getModifiers()) {
             Content modifier = new StringContent(mod.toString());
             code.addContent(modifier);
-            code.addContent(getSpace());
+            code.addContent(Contents.SPACE);
         }
         Content type = getLink(new LinkInfoImpl(configuration,
                 LinkInfoImpl.Kind.CONSTANT_SUMMARY, member.asType()));
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -119,7 +119,7 @@
         constructorDetailsTree.addContent(writer.getMarkerAnchor(
                 SectionName.CONSTRUCTOR_DETAIL));
         Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
-                writer.constructorDetailsLabel);
+                contents.constructorDetailsLabel);
         constructorDetailsTree.addContent(heading);
         return constructorDetailsTree;
     }
@@ -221,14 +221,6 @@
     }
 
     /**
-     * Close the writer.
-     */
-    @Override
-    public void close() throws IOException {
-        writer.close();
-    }
-
-    /**
      * Let the writer know whether a non public constructor was found.
      *
      * @param foundNonPubConstructor true if we found a non public constructor.
@@ -244,7 +236,7 @@
     @Override
     public void addSummaryLabel(Content memberTree) {
         Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
-                writer.getResource("doclet.Constructor_Summary"));
+                contents.constructorSummaryLabel);
         memberTree.addContent(label);
     }
 
@@ -253,9 +245,9 @@
      */
     @Override
     public String getTableSummary() {
-        return configuration.getText("doclet.Member_Table_Summary",
-                configuration.getText("doclet.Constructor_Summary"),
-                configuration.getText("doclet.constructors"));
+        return resources.getText("doclet.Member_Table_Summary",
+                resources.getText("doclet.Constructor_Summary"),
+                resources.getText("doclet.constructors"));
     }
 
     /**
@@ -263,7 +255,7 @@
      */
     @Override
     public Content getCaption() {
-        return configuration.getResource("doclet.Constructors");
+        return contents.constructors;
     }
 
     /**
@@ -273,11 +265,11 @@
     public List<String> getSummaryTableHeader(Element member) {
         List<String> header = new ArrayList<>();
         if (foundNonPubConstructor) {
-            header.add(configuration.getText("doclet.Modifier"));
+            header.add(resources.getText("doclet.Modifier"));
         }
-        header.add(configuration.getText("doclet.0_and_1",
-                configuration.getText("doclet.Constructor"),
-                configuration.getText("doclet.Description")));
+        header.add(resources.getText("doclet.0_and_1",
+                resources.getText("doclet.Constructor"),
+                resources.getText("doclet.Description")));
         return header;
     }
 
@@ -311,9 +303,9 @@
     protected Content getNavSummaryLink(TypeElement typeElement, boolean link) {
         if (link) {
             return writer.getHyperLink(SectionName.CONSTRUCTOR_SUMMARY,
-                    writer.getResource("doclet.navConstructor"));
+                    contents.navConstructor);
         } else {
-            return writer.getResource("doclet.navConstructor");
+            return contents.navConstructor;
         }
     }
 
@@ -325,9 +317,9 @@
         if (link) {
             liNav.addContent(writer.getHyperLink(
                     SectionName.CONSTRUCTOR_DETAIL,
-                    writer.getResource("doclet.navConstructor")));
+                    contents.navConstructor));
         } else {
-            liNav.addContent(writer.getResource("doclet.navConstructor"));
+            liNav.addContent(contents.navConstructor);
         }
     }
 
@@ -343,7 +335,7 @@
             } else if (utils.isPrivate(member)) {
                 code.addContent("private ");
             } else if (utils.isPublic(member)) {
-                code.addContent(writer.getSpace());
+                code.addContent(Contents.SPACE);
             } else {
                 code.addContent(
                         configuration.getText("doclet.Package_private"));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java	Tue Aug 09 13:22:57 2016 -0700
@@ -0,0 +1,369 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.formats.html;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
+import jdk.javadoc.internal.doclets.formats.html.markup.FixedStringContent;
+import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
+import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Resources;
+import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
+
+/**
+ * Constants and factory methods for common fragments of content
+ * used by HtmlDoclet. The string content of these fragments is
+ * generally obtained from the {@link Resources resources} found
+ * in the doclet's configuration.
+ *
+ * @implNote
+ * Many constants are made available in this class, so that they are
+ * only created once per doclet-instance, instead of once per generated page.
+ */
+public class Contents {
+    public static final Content SPACE = RawHtml.nbsp;
+
+    public final Content allClassesLabel;
+    public final Content allImplementedInterfacesLabel;
+    public final Content allModulesLabel;
+    public final Content allPackagesLabel;
+    public final Content allSuperinterfacesLabel;
+    public final Content also;
+    public final Content annotateTypeOptionalMemberSummaryLabel;
+    public final Content annotateTypeRequiredMemberSummaryLabel;
+    public final Content annotationType;
+    public final Content annotationTypeDetailsLabel;
+    public final Content annotationTypeMemberDetail;
+    public final Content annotationTypes;
+    public final Content classLabel;
+    public final Content classes;
+    public final Content constantsSummaryTitle;
+    public final Content constructorDetailsLabel;
+    public final Content constructorSummaryLabel;
+    public final Content constructors;
+    public final Content contentsHeading;
+    public final Content defaultPackageLabel;
+    public final Content default_;
+    public final Content deprecatedAPI;
+    public final Content deprecatedLabel;
+    public final Content deprecatedPhrase;
+    public final Content descfrmClassLabel;
+    public final Content descfrmInterfaceLabel;
+    public final Content descriptionLabel;
+    public final Content detailLabel;
+    public final Content enclosingClassLabel;
+    public final Content enclosingInterfaceLabel;
+    public final Content enumConstantDetailLabel;
+    public final Content enumConstantSummary;
+    public final Content enum_;
+    public final Content enums;
+    public final Content errors;
+    public final Content exceptions;
+    public final Content fieldDetailsLabel;
+    public final Content fieldSummaryLabel;
+    public final Content fields;
+    public final Content framesLabel;
+    public final Content functionalInterface;
+    public final Content functionalInterfaceMessage;
+    public final Content helpLabel;
+    public final Content hierarchyForAllPackages;
+    public final Content implementation;
+    public final Content implementingClassesLabel;
+    public final Content inClass;
+    public final Content inInterface;
+    public final Content indexLabel;
+    public final Content interfaces;
+    public final Content interfacesItalic;
+    public final Content methodDetailLabel;
+    public final Content methodSummary;
+    public final Content methods;
+    public final Content moduleLabel;
+    public final Content moduleSubNavLabel;
+    public final Content modulesLabel;
+    public final Content navAnnotationTypeMember;
+    public final Content navAnnotationTypeOptionalMember;
+    public final Content navAnnotationTypeRequiredMember;
+    public final Content navConstructor;
+    public final Content navEnum;
+    public final Content navField;
+    public final Content navMethod;
+    public final Content navModuleDescription;
+    public final Content navModules;
+    public final Content navNested;
+    public final Content navPackages;
+    public final Content navProperty;
+    public final Content navServices;
+    public final Content nestedClassSummary;
+    public final Content nextClassLabel;
+    public final Content nextLabel;
+    public final Content nextLetter;
+    public final Content nextModuleLabel;
+    public final Content nextPackageLabel;
+    public final Content noFramesLabel;
+    public final Content noScriptMessage;
+    public final Content overridesLabel;
+    public final Content overviewLabel;
+    public final Content packageHierarchies;
+    public final Content packageLabel;
+    public final Content package_;
+    public final Content packagesLabel;
+    public final Content prevClassLabel;
+    public final Content prevLabel;
+    public final Content prevLetter;
+    public final Content prevModuleLabel;
+    public final Content prevPackageLabel;
+    public final Content properties;
+    public final Content propertyDetailsLabel;
+    public final Content propertySummary;
+    public final Content seeLabel;
+    public final Content serializedForm;
+    public final Content specifiedByLabel;
+    public final Content subclassesLabel;
+    public final Content subinterfacesLabel;
+    public final Content summaryLabel;
+    public final Content treeLabel;
+    public final Content useLabel;
+
+    private final Resources resources;
+
+    /**
+     * Creates a {@code Contents} object.
+     *
+     * @param configuration the configuration in which to find the
+     * resources used to look up resource keys, and other details.
+     */
+    Contents(ConfigurationImpl configuration) {
+        this.resources = configuration.getResources();
+
+        allClassesLabel = getNonBreakContent("doclet.All_Classes");
+        allImplementedInterfacesLabel = getContent("doclet.All_Implemented_Interfaces");
+        allModulesLabel = getNonBreakContent("doclet.All_Modules");
+        allPackagesLabel = getNonBreakContent("doclet.All_Packages");
+        allSuperinterfacesLabel = getContent("doclet.All_Superinterfaces");
+        also = getContent("doclet.also");
+        annotateTypeOptionalMemberSummaryLabel = getContent("doclet.Annotation_Type_Optional_Member_Summary");
+        annotateTypeRequiredMemberSummaryLabel = getContent("doclet.Annotation_Type_Required_Member_Summary");
+        annotationType = getContent("doclet.AnnotationType");
+        annotationTypeDetailsLabel = getContent("doclet.Annotation_Type_Member_Detail");
+        annotationTypeMemberDetail = getContent("doclet.Annotation_Type_Member_Detail");
+        annotationTypes = getContent("doclet.AnnotationTypes");
+        classLabel = getContent("doclet.Class");
+        classes = getContent("doclet.Classes");
+        constantsSummaryTitle = getContent("doclet.Constants_Summary");
+        constructorDetailsLabel = getContent("doclet.Constructor_Detail");
+        constructorSummaryLabel = getContent("doclet.Constructor_Summary");
+        constructors = getContent("doclet.Constructors");
+        contentsHeading = getContent("doclet.Contents");
+        defaultPackageLabel = new StringContent(DocletConstants.DEFAULT_PACKAGE_NAME);
+        default_ = getContent("doclet.Default");
+        deprecatedAPI = getContent("doclet.Deprecated_API");
+        deprecatedLabel = getContent("doclet.navDeprecated");
+        deprecatedPhrase = getContent("doclet.Deprecated");
+        descfrmClassLabel = getContent("doclet.Description_From_Class");
+        descfrmInterfaceLabel = getContent("doclet.Description_From_Interface");
+        descriptionLabel = getContent("doclet.Description");
+        detailLabel = getContent("doclet.Detail");
+        enclosingClassLabel = getContent("doclet.Enclosing_Class");
+        enclosingInterfaceLabel = getContent("doclet.Enclosing_Interface");
+        enumConstantDetailLabel = getContent("doclet.Enum_Constant_Detail");
+        enumConstantSummary = getContent("doclet.Enum_Constant_Summary");
+        enum_ = getContent("doclet.Enum");
+        enums = getContent("doclet.Enums");
+        errors = getContent("doclet.Errors");
+        exceptions = getContent("doclet.Exceptions");
+        fieldDetailsLabel = getContent("doclet.Field_Detail");
+        fieldSummaryLabel = getContent("doclet.Field_Summary");
+        fields = getContent("doclet.Fields");
+        framesLabel = getContent("doclet.Frames");
+        functionalInterface = getContent("doclet.Functional_Interface");
+        functionalInterfaceMessage = getContent("doclet.Functional_Interface_Message");
+        helpLabel = getContent("doclet.Help");
+        hierarchyForAllPackages = getContent("doclet.Hierarchy_For_All_Packages");
+        implementation = getContent("doclet.Implementation");
+        implementingClassesLabel = getContent("doclet.Implementing_Classes");
+        inClass = getContent("doclet.in_class");
+        inInterface = getContent("doclet.in_interface");
+        indexLabel = getContent("doclet.Index");
+        interfaces = getContent("doclet.Interfaces");
+        interfacesItalic = getContent("doclet.Interfaces_Italic");
+        methodDetailLabel = getContent("doclet.Method_Detail");
+        methodSummary = getContent("doclet.Method_Summary");
+        methods = getContent("doclet.Methods");
+        moduleLabel = getContent("doclet.Module");
+        moduleSubNavLabel = getContent("doclet.Module_Sub_Nav");
+        modulesLabel = getContent("doclet.Modules");
+        navAnnotationTypeMember = getContent("doclet.navAnnotationTypeMember");
+        navAnnotationTypeOptionalMember = getContent("doclet.navAnnotationTypeOptionalMember");
+        navAnnotationTypeRequiredMember = getContent("doclet.navAnnotationTypeRequiredMember");
+        navConstructor = getContent("doclet.navConstructor");
+        navEnum = getContent("doclet.navEnum");
+        navField = getContent("doclet.navField");
+        navMethod = getContent("doclet.navMethod");
+        navModuleDescription = getContent("doclet.navModuleDescription");
+        navModules = getContent("doclet.navModules");
+        navNested = getContent("doclet.navNested");
+        navPackages = getContent("doclet.navPackages");
+        navProperty = getContent("doclet.navProperty");
+        navServices = getContent("doclet.navServices");
+        nestedClassSummary = getContent("doclet.Nested_Class_Summary");
+        nextClassLabel = getNonBreakContent("doclet.Next_Class");
+        nextLabel = getNonBreakContent("doclet.Next");
+        nextLetter = getContent("doclet.Next_Letter");
+        nextModuleLabel = getNonBreakContent("doclet.Next_Module");
+        nextPackageLabel = getNonBreakContent("doclet.Next_Package");
+        noFramesLabel = getNonBreakContent("doclet.No_Frames");
+        noScriptMessage = getContent("doclet.No_Script_Message");
+        overridesLabel = getContent("doclet.Overrides");
+        overviewLabel = getContent("doclet.Overview");
+        packageHierarchies = getContent("doclet.Package_Hierarchies");
+        packageLabel = getContent("doclet.Package");
+        package_ = getContent("doclet.package");
+        packagesLabel = getContent("doclet.Packages");
+        prevClassLabel = getNonBreakContent("doclet.Prev_Class");
+        prevLabel = getContent("doclet.Prev");
+        prevLetter = getContent("doclet.Prev_Letter");
+        prevModuleLabel = getNonBreakContent("doclet.Prev_Module");
+        prevPackageLabel = getNonBreakContent("doclet.Prev_Package");
+        properties = getContent("doclet.Properties");
+        propertyDetailsLabel = getContent("doclet.Property_Detail");
+        propertySummary = getContent("doclet.Property_Summary");
+        seeLabel = getContent("doclet.See");
+        serializedForm = getContent("doclet.Serialized_Form");
+        specifiedByLabel = getContent("doclet.Specified_By");
+        subclassesLabel = getContent("doclet.Subclasses");
+        subinterfacesLabel = getContent("doclet.Subinterfaces");
+        summaryLabel = getContent("doclet.Summary");
+        treeLabel = getContent("doclet.Tree");
+        useLabel = getContent("doclet.navClassUse");
+    }
+
+    /**
+     * Gets a {@code Content} object, containing the string for
+     * a given key in the doclet's resources.
+     *
+     * @param key the key for the desired string
+     * @return a content tree for the string
+     */
+    public Content getContent(String key) {
+        return new FixedStringContent(resources.getText(key));
+    }
+
+    /**
+     * Gets a {@code Content} object, containing the string for
+     * a given key in the doclet's resources, formatted with
+     * given arguments.
+     *
+     * @param key the key to look for in the configuration fil
+     * @param key the key for the desired string
+     * @param o0  string or content argument to be formatted into the result
+     * @return a content tree for the text
+     */
+    public Content getContent(String key, Object o0) {
+        return getContent(key, o0, null, null);
+    }
+
+    /**
+     * Gets a {@code Content} object, containing the string for
+     * a given key in the doclet's resources, formatted with
+     * given arguments.
+
+     * @param key the key for the desired string
+     * @param o0  string or content argument to be formatted into the result
+     * @param o1  string or content argument to be formatted into the result
+     * @return a content tree for the text
+     */
+    public Content getContent(String key, Object o0, Object o1) {
+        return getContent(key, o0, o1, null);
+    }
+
+    /**
+     * Gets a {@code Content} object, containing the string for
+     * a given key in the doclet's resources, formatted with
+     * given arguments.
+     *
+     * @param key the key for the desired string
+     * @param o0  string or content argument to be formatted into the result
+     * @param o1  string or content argument to be formatted into the result
+     * @param o2  string or content argument to be formatted into the result
+     * @return a content tree for the text
+     */
+    public Content getContent(String key, Object o0, Object o1, Object o2) {
+        Content c = new ContentBuilder();
+        Pattern p = Pattern.compile("\\{([012])\\}");
+        String text = resources.getText(key); // TODO: cache
+        Matcher m = p.matcher(text);
+        int start = 0;
+        while (m.find(start)) {
+            c.addContent(text.substring(start, m.start()));
+
+            Object o = null;
+            switch (m.group(1).charAt(0)) {
+                case '0': o = o0; break;
+                case '1': o = o1; break;
+                case '2': o = o2; break;
+            }
+
+            if (o == null) {
+                c.addContent("{" + m.group(1) + "}");
+            } else if (o instanceof String) {
+                c.addContent((String) o);
+            } else if (o instanceof Content) {
+                c.addContent((Content) o);
+            }
+
+            start = m.end();
+        }
+
+        c.addContent(text.substring(start));
+        return c;
+    }
+
+    /**
+     * Gets a {@code Content} object, containing the string for
+     * a given key in the doclet's resources, substituting
+     * <code>&nbsp;</code> for any space characters found in
+     * the named resource string.
+     *
+     * @param key the key for the desired string
+     * @return a content tree for the string
+     */
+    private Content getNonBreakContent(String key) {
+        String text = resources.getText(key); // TODO: cache
+        Content c = new ContentBuilder();
+        int start = 0;
+        int p;
+        while ((p = text.indexOf(" ", start)) != -1) {
+            c.addContent(text.substring(start, p));
+            c.addContent(RawHtml.nbsp);
+            start = p + 1;
+        }
+        c.addContent(text.substring(start));
+        return c; // TODO: should be made immutable
+    }
+}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -35,6 +35,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
@@ -243,10 +244,9 @@
                    new DeprecatedListWriter(configuration, filename);
             depr.generateDeprecatedListFile(
                    new DeprecatedAPIListBuilder(configuration));
-            depr.close();
         } catch (IOException exc) {
-            configuration.standardmessage.error(
-                        "doclet.exception_encountered",
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
                         exc.toString(), filename);
             throw new DocletAbortException(exc);
         }
@@ -314,7 +314,7 @@
             DeprElementKind kind, Content contentTree) {
         if (builder.hasDocumentation(kind)) {
             Content li = HtmlTree.LI(getHyperLink(getAnchorName(kind),
-                    getResource(getHeadingKey(kind))));
+                    contents.getContent(getHeadingKey(kind))));
             contentTree.addContent(li);
         }
     }
@@ -326,11 +326,11 @@
      * @return a content tree for the contents list
      */
     public Content getContentsList(DeprecatedAPIListBuilder deprapi) {
-        Content headContent = getResource("doclet.Deprecated_API");
+        Content headContent = contents.deprecatedAPI;
         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
                 HtmlStyle.title, headContent);
         Content div = HtmlTree.DIV(HtmlStyle.header, heading);
-        Content headingContent = getResource("doclet.Contents");
+        Content headingContent = contents.contentsHeading;
         div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
                 headingContent));
         Content ul = new HtmlTree(HtmlTag.UL);
@@ -379,7 +379,7 @@
      * @return a content tree for the deprecated label
      */
     protected Content getNavLinkDeprecated() {
-        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, deprecatedLabel);
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.deprecatedLabel);
         return li;
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -95,7 +95,7 @@
         enumConstantsDetailsTree.addContent(writer.getMarkerAnchor(
                 SectionName.ENUM_CONSTANT_DETAIL));
         Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
-                writer.enumConstantsDetailsLabel);
+                contents.enumConstantDetailLabel);
         enumConstantsDetailsTree.addContent(heading);
         return enumConstantsDetailsTree;
     }
@@ -185,17 +185,9 @@
      * {@inheritDoc}
      */
     @Override
-    public void close() throws IOException {
-        writer.close();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
     public void addSummaryLabel(Content memberTree) {
         Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
-                writer.getResource("doclet.Enum_Constant_Summary"));
+                contents.enumConstantSummary);
         memberTree.addContent(label);
     }
 
@@ -204,9 +196,9 @@
      */
     @Override
     public String getTableSummary() {
-        return configuration.getText("doclet.Member_Table_Summary",
-                configuration.getText("doclet.Enum_Constant_Summary"),
-                configuration.getText("doclet.enum_constants"));
+        return resources.getText("doclet.Member_Table_Summary",
+                resources.getText("doclet.Enum_Constant_Summary"),
+                resources.getText("doclet.enum_constants"));
     }
 
     /**
@@ -214,7 +206,7 @@
      */
     @Override
     public Content getCaption() {
-        return configuration.getResource("doclet.Enum_Constants");
+        return configuration.getContent("doclet.Enum_Constants");
     }
 
     /**
@@ -303,14 +295,14 @@
         if (link) {
             if (typeElement == null) {
                 return writer.getHyperLink(SectionName.ENUM_CONSTANT_SUMMARY,
-                        writer.getResource("doclet.navEnum"));
+                        contents.navEnum);
             } else {
                 return writer.getHyperLink(
                         SectionName.ENUM_CONSTANTS_INHERITANCE,
-                        configuration.getClassName(typeElement), writer.getResource("doclet.navEnum"));
+                        configuration.getClassName(typeElement), contents.navEnum);
             }
         } else {
-            return writer.getResource("doclet.navEnum");
+            return contents.navEnum;
         }
     }
 
@@ -322,9 +314,9 @@
         if (link) {
             liNav.addContent(writer.getHyperLink(
                     SectionName.ENUM_CONSTANT_DETAIL,
-                    writer.getResource("doclet.navEnum")));
+                    contents.navEnum));
         } else {
-            liNav.addContent(writer.getResource("doclet.navEnum"));
+            liNav.addContent(contents.navEnum);
         }
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -95,7 +95,7 @@
         fieldDetailsTree.addContent(writer.getMarkerAnchor(
                 SectionName.FIELD_DETAIL));
         Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
-                writer.fieldDetailsLabel);
+                contents.fieldDetailsLabel);
         fieldDetailsTree.addContent(heading);
         return fieldDetailsTree;
     }
@@ -182,20 +182,12 @@
     }
 
     /**
-     * Close the writer.
-     */
-    @Override
-    public void close() throws IOException {
-        writer.close();
-    }
-
-    /**
      * {@inheritDoc}
      */
     @Override
     public void addSummaryLabel(Content memberTree) {
         Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
-                writer.getResource("doclet.Field_Summary"));
+                contents.fieldSummaryLabel);
         memberTree.addContent(label);
     }
 
@@ -204,9 +196,9 @@
      */
     @Override
     public String getTableSummary() {
-        return configuration.getText("doclet.Member_Table_Summary",
-                configuration.getText("doclet.Field_Summary"),
-                configuration.getText("doclet.fields"));
+        return resources.getText("doclet.Member_Table_Summary",
+                resources.getText("doclet.Field_Summary"),
+                resources.getText("doclet.fields"));
     }
 
     /**
@@ -214,7 +206,7 @@
      */
     @Override
     public Content getCaption() {
-        return configuration.getResource("doclet.Fields");
+        return contents.fields;
     }
 
     /**
@@ -223,9 +215,9 @@
     @Override
     public List<String> getSummaryTableHeader(Element member) {
         List<String> header = Arrays.asList(writer.getModifierTypeHeader(),
-            configuration.getText("doclet.0_and_1",
-                    configuration.getText("doclet.Field"),
-                    configuration.getText("doclet.Description")));
+            resources.getText("doclet.0_and_1",
+                    resources.getText("doclet.Field"),
+                    resources.getText("doclet.Description")));
         return header;
     }
 
@@ -259,7 +251,7 @@
                 : configuration.getText("doclet.Fields_Inherited_From_Interface"));
         Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
                 label);
-        labelHeading.addContent(writer.getSpace());
+        labelHeading.addContent(Contents.SPACE);
         labelHeading.addContent(classLink);
         inheritedTree.addContent(labelHeading);
     }
@@ -312,14 +304,14 @@
             if (typeElement == null) {
                 return writer.getHyperLink(
                         SectionName.FIELD_SUMMARY,
-                        writer.getResource("doclet.navField"));
+                        contents.navField);
             } else {
                 return writer.getHyperLink(
                         SectionName.FIELDS_INHERITANCE,
-                        configuration.getClassName(typeElement), writer.getResource("doclet.navField"));
+                        configuration.getClassName(typeElement), contents.navField);
             }
         } else {
-            return writer.getResource("doclet.navField");
+            return contents.navField;
         }
     }
 
@@ -331,9 +323,9 @@
         if (link) {
             liNav.addContent(writer.getHyperLink(
                     SectionName.FIELD_DETAIL,
-                    writer.getResource("doclet.navField")));
+                    contents.navField));
         } else {
-            liNav.addContent(writer.getResource("doclet.navField"));
+            liNav.addContent(contents.navField);
         }
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -32,6 +32,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
@@ -68,7 +69,7 @@
      * @param filename File to be generated.
      * @throws java.io.IOException
      */
-    public FrameOutputWriter(ConfigurationImpl configuration, DocPath filename) throws IOException {
+    public FrameOutputWriter(ConfigurationImpl configuration, DocPath filename) {
         super(configuration, filename);
         noOfPackages = configuration.packages.size();
     }
@@ -87,10 +88,9 @@
             filename = DocPaths.INDEX;
             framegen = new FrameOutputWriter(configuration, filename);
             framegen.generateFrameFile();
-            framegen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.error(
-                        "doclet.exception_encountered",
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
                         exc.toString(), filename);
             throw new DocletAbortException(exc);
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, 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
@@ -33,6 +33,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
@@ -58,7 +59,7 @@
      * @param filename File to be generated.
      */
     public HelpWriter(ConfigurationImpl configuration,
-                      DocPath filename) throws IOException {
+                      DocPath filename) {
         super(configuration, filename);
     }
 
@@ -76,10 +77,9 @@
             filename = DocPaths.HELP_DOC;
             helpgen = new HelpWriter(configuration, filename);
             helpgen.generateHelpFile();
-            helpgen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.error(
-                        "doclet.exception_encountered",
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
                         exc.toString(), filename);
             throw new DocletAbortException(exc);
         }
@@ -121,10 +121,10 @@
      */
     protected void addHelpFileContents(Content contentTree) {
         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, HtmlStyle.title,
-                getResource("doclet.Help_line_1"));
+                contents.getContent("doclet.Help_line_1"));
         Content div = HtmlTree.DIV(HtmlStyle.header, heading);
         Content line2 = HtmlTree.DIV(HtmlStyle.subTitle,
-                getResource("doclet.Help_line_2"));
+                contents.getContent("doclet.Help_line_2"));
         div.addContent(line2);
         if (configuration.allowTag(HtmlTag.MAIN)) {
             mainTree.addContent(div);
@@ -136,11 +136,11 @@
         ul.addStyle(HtmlStyle.blockList);
         if (configuration.createoverview) {
             Content overviewHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                getResource("doclet.Overview"));
+                contents.overviewLabel);
             htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                     ? HtmlTree.SECTION(overviewHeading)
                     : HtmlTree.LI(HtmlStyle.blockList, overviewHeading);
-            Content line3 = getResource("doclet.Help_line_3",
+            Content line3 = contents.getContent("doclet.Help_line_3",
                     getHyperLink(DocPaths.OVERVIEW_SUMMARY,
                     configuration.getText("doclet.Overview")));
             Content overviewPara = HtmlTree.P(line3);
@@ -152,26 +152,26 @@
             }
         }
         Content packageHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                getResource("doclet.Package"));
+                contents.packageLabel);
         htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                 ? HtmlTree.SECTION(packageHead)
                 : HtmlTree.LI(HtmlStyle.blockList, packageHead);
-        Content line4 = getResource("doclet.Help_line_4");
+        Content line4 = contents.getContent("doclet.Help_line_4");
         Content packagePara = HtmlTree.P(line4);
         htmlTree.addContent(packagePara);
         HtmlTree ulPackage = new HtmlTree(HtmlTag.UL);
         ulPackage.addContent(HtmlTree.LI(
-                getResource("doclet.Interfaces_Italic")));
+                contents.interfacesItalic));
         ulPackage.addContent(HtmlTree.LI(
-                getResource("doclet.Classes")));
+                contents.classes));
         ulPackage.addContent(HtmlTree.LI(
-                getResource("doclet.Enums")));
+                contents.enums));
         ulPackage.addContent(HtmlTree.LI(
-                getResource("doclet.Exceptions")));
+                contents.exceptions));
         ulPackage.addContent(HtmlTree.LI(
-                getResource("doclet.Errors")));
+                contents.errors));
         ulPackage.addContent(HtmlTree.LI(
-                getResource("doclet.AnnotationTypes")));
+                contents.annotationTypes));
         htmlTree.addContent(ulPackage);
         if (configuration.allowTag(HtmlTag.SECTION)) {
             ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
@@ -179,46 +179,39 @@
             ul.addContent(htmlTree);
         }
         Content classHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                getResource("doclet.Help_line_5"));
+                contents.getContent("doclet.Help_line_5"));
         htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                 ? HtmlTree.SECTION(classHead)
                 : HtmlTree.LI(HtmlStyle.blockList, classHead);
-        Content line6 = getResource("doclet.Help_line_6");
+        Content line6 = contents.getContent("doclet.Help_line_6");
         Content classPara = HtmlTree.P(line6);
         htmlTree.addContent(classPara);
         HtmlTree ul1 = new HtmlTree(HtmlTag.UL);
         ul1.addContent(HtmlTree.LI(
-                getResource("doclet.Help_line_7")));
+                contents.getContent("doclet.Help_line_7")));
         ul1.addContent(HtmlTree.LI(
-                getResource("doclet.Help_line_8")));
+                contents.getContent("doclet.Help_line_8")));
         ul1.addContent(HtmlTree.LI(
-                getResource("doclet.Help_line_9")));
+                contents.getContent("doclet.Help_line_9")));
         ul1.addContent(HtmlTree.LI(
-                getResource("doclet.Help_line_10")));
+                contents.getContent("doclet.Help_line_10")));
         ul1.addContent(HtmlTree.LI(
-                getResource("doclet.Help_line_11")));
+                contents.getContent("doclet.Help_line_11")));
         ul1.addContent(HtmlTree.LI(
-                getResource("doclet.Help_line_12")));
+                contents.getContent("doclet.Help_line_12")));
         htmlTree.addContent(ul1);
         HtmlTree ul2 = new HtmlTree(HtmlTag.UL);
-        ul2.addContent(HtmlTree.LI(
-                getResource("doclet.Nested_Class_Summary")));
-        ul2.addContent(HtmlTree.LI(
-                getResource("doclet.Field_Summary")));
-        ul2.addContent(HtmlTree.LI(
-                getResource("doclet.Constructor_Summary")));
-        ul2.addContent(HtmlTree.LI(
-                getResource("doclet.Method_Summary")));
+        ul2.addContent(HtmlTree.LI(contents.nestedClassSummary));
+        ul2.addContent(HtmlTree.LI(contents.fieldSummaryLabel));
+        ul2.addContent(HtmlTree.LI(contents.constructorSummaryLabel));
+        ul2.addContent(HtmlTree.LI(contents.methodSummary));
         htmlTree.addContent(ul2);
         HtmlTree ul3 = new HtmlTree(HtmlTag.UL);
-        ul3.addContent(HtmlTree.LI(
-                getResource("doclet.Field_Detail")));
-        ul3.addContent(HtmlTree.LI(
-                getResource("doclet.Constructor_Detail")));
-        ul3.addContent(HtmlTree.LI(
-                getResource("doclet.Method_Detail")));
+        ul3.addContent(HtmlTree.LI(contents.fieldDetailsLabel));
+        ul3.addContent(HtmlTree.LI(contents.constructorDetailsLabel));
+        ul3.addContent(HtmlTree.LI(contents.methodDetailLabel));
         htmlTree.addContent(ul3);
-        Content line13 = getResource("doclet.Help_line_13");
+        Content line13 = contents.getContent("doclet.Help_line_13");
         Content para = HtmlTree.P(line13);
         htmlTree.addContent(para);
         if (configuration.allowTag(HtmlTag.SECTION)) {
@@ -228,24 +221,24 @@
         }
         //Annotation Types
         Content aHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                getResource("doclet.AnnotationType"));
+                contents.annotationType);
         htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                 ? HtmlTree.SECTION(aHead)
                 : HtmlTree.LI(HtmlStyle.blockList, aHead);
-        Content aline1 = getResource("doclet.Help_annotation_type_line_1");
+        Content aline1 = contents.getContent("doclet.Help_annotation_type_line_1");
         Content aPara = HtmlTree.P(aline1);
         htmlTree.addContent(aPara);
         HtmlTree aul = new HtmlTree(HtmlTag.UL);
         aul.addContent(HtmlTree.LI(
-                getResource("doclet.Help_annotation_type_line_2")));
+                contents.getContent("doclet.Help_annotation_type_line_2")));
         aul.addContent(HtmlTree.LI(
-                getResource("doclet.Help_annotation_type_line_3")));
+                contents.getContent("doclet.Help_annotation_type_line_3")));
         aul.addContent(HtmlTree.LI(
-                getResource("doclet.Annotation_Type_Required_Member_Summary")));
+                contents.annotateTypeRequiredMemberSummaryLabel));
         aul.addContent(HtmlTree.LI(
-                getResource("doclet.Annotation_Type_Optional_Member_Summary")));
+                contents.annotateTypeOptionalMemberSummaryLabel));
         aul.addContent(HtmlTree.LI(
-                getResource("doclet.Annotation_Type_Member_Detail")));
+                contents.annotationTypeMemberDetail));
         htmlTree.addContent(aul);
         if (configuration.allowTag(HtmlTag.SECTION)) {
             ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
@@ -254,22 +247,22 @@
         }
         //Enums
         Content enumHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                getResource("doclet.Enum"));
+                contents.enum_);
         htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                 ? HtmlTree.SECTION(enumHead)
                 : HtmlTree.LI(HtmlStyle.blockList, enumHead);
-        Content eline1 = getResource("doclet.Help_enum_line_1");
+        Content eline1 = contents.getContent("doclet.Help_enum_line_1");
         Content enumPara = HtmlTree.P(eline1);
         htmlTree.addContent(enumPara);
         HtmlTree eul = new HtmlTree(HtmlTag.UL);
         eul.addContent(HtmlTree.LI(
-                getResource("doclet.Help_enum_line_2")));
+                contents.getContent("doclet.Help_enum_line_2")));
         eul.addContent(HtmlTree.LI(
-                getResource("doclet.Help_enum_line_3")));
+                contents.getContent("doclet.Help_enum_line_3")));
         eul.addContent(HtmlTree.LI(
-                getResource("doclet.Enum_Constant_Summary")));
+                contents.enumConstantSummary));
         eul.addContent(HtmlTree.LI(
-                getResource("doclet.Enum_Constant_Detail")));
+                contents.enumConstantDetailLabel));
         htmlTree.addContent(eul);
         if (configuration.allowTag(HtmlTag.SECTION)) {
             ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
@@ -278,11 +271,11 @@
         }
         if (configuration.classuse) {
             Content useHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                    getResource("doclet.Help_line_14"));
+                    contents.getContent("doclet.Help_line_14"));
             htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                     ? HtmlTree.SECTION(useHead)
                     : HtmlTree.LI(HtmlStyle.blockList, useHead);
-            Content line15 = getResource("doclet.Help_line_15");
+            Content line15 = contents.getContent("doclet.Help_line_15");
             Content usePara = HtmlTree.P(line15);
             htmlTree.addContent(usePara);
             if (configuration.allowTag(HtmlTag.SECTION)) {
@@ -293,11 +286,11 @@
         }
         if (configuration.createtree) {
             Content treeHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                    getResource("doclet.Help_line_16"));
+                    contents.getContent("doclet.Help_line_16"));
             htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                     ? HtmlTree.SECTION(treeHead)
                     : HtmlTree.LI(HtmlStyle.blockList, treeHead);
-            Content line17 = getResource("doclet.Help_line_17_with_tree_link",
+            Content line17 = contents.getContent("doclet.Help_line_17_with_tree_link",
                     getHyperLink(DocPaths.OVERVIEW_TREE,
                     configuration.getText("doclet.Class_Hierarchy")),
                     HtmlTree.CODE(new StringContent("java.lang.Object")));
@@ -305,9 +298,9 @@
             htmlTree.addContent(treePara);
             HtmlTree tul = new HtmlTree(HtmlTag.UL);
             tul.addContent(HtmlTree.LI(
-                    getResource("doclet.Help_line_18")));
+                    contents.getContent("doclet.Help_line_18")));
             tul.addContent(HtmlTree.LI(
-                    getResource("doclet.Help_line_19")));
+                    contents.getContent("doclet.Help_line_19")));
             htmlTree.addContent(tul);
             if (configuration.allowTag(HtmlTag.SECTION)) {
                 ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
@@ -318,11 +311,11 @@
         if (!(configuration.nodeprecatedlist ||
                   configuration.nodeprecated)) {
             Content dHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                    getResource("doclet.Deprecated_API"));
+                    contents.deprecatedAPI);
             htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                     ? HtmlTree.SECTION(dHead)
                     : HtmlTree.LI(HtmlStyle.blockList, dHead);
-            Content line20 = getResource("doclet.Help_line_20_with_deprecated_api_link",
+            Content line20 = contents.getContent("doclet.Help_line_20_with_deprecated_api_link",
                     getHyperLink(DocPaths.DEPRECATED_LIST,
                     configuration.getText("doclet.Deprecated_API")));
             Content dPara = HtmlTree.P(line20);
@@ -343,11 +336,11 @@
                         configuration.getText("doclet.Index"));
             }
             Content indexHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                    getResource("doclet.Help_line_21"));
+                    contents.getContent("doclet.Help_line_21"));
             htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                     ? HtmlTree.SECTION(indexHead)
                     : HtmlTree.LI(HtmlStyle.blockList, indexHead);
-            Content line22 = getResource("doclet.Help_line_22", indexlink);
+            Content line22 = contents.getContent("doclet.Help_line_22", indexlink);
             Content indexPara = HtmlTree.P(line22);
             htmlTree.addContent(indexPara);
             if (configuration.allowTag(HtmlTag.SECTION)) {
@@ -357,11 +350,11 @@
             }
         }
         Content prevHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                getResource("doclet.Help_line_23"));
+                contents.getContent("doclet.Help_line_23"));
         htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                 ? HtmlTree.SECTION(prevHead)
                 : HtmlTree.LI(HtmlStyle.blockList, prevHead);
-        Content line24 = getResource("doclet.Help_line_24");
+        Content line24 = contents.getContent("doclet.Help_line_24");
         Content prevPara = HtmlTree.P(line24);
         htmlTree.addContent(prevPara);
         if (configuration.allowTag(HtmlTag.SECTION)) {
@@ -370,11 +363,11 @@
             ul.addContent(htmlTree);
         }
         Content frameHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                getResource("doclet.Help_line_25"));
+                contents.getContent("doclet.Help_line_25"));
         htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                 ? HtmlTree.SECTION(frameHead)
                 : HtmlTree.LI(HtmlStyle.blockList, frameHead);
-        Content line26 = getResource("doclet.Help_line_26");
+        Content line26 = contents.getContent("doclet.Help_line_26");
         Content framePara = HtmlTree.P(line26);
         htmlTree.addContent(framePara);
         if (configuration.allowTag(HtmlTag.SECTION)) {
@@ -383,13 +376,13 @@
             ul.addContent(htmlTree);
         }
         Content allclassesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                getResource("doclet.All_Classes"));
+                contents.allClassesLabel);
         htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                 ? HtmlTree.SECTION(allclassesHead)
                 : HtmlTree.LI(HtmlStyle.blockList, allclassesHead);
-        Content line27 = getResource("doclet.Help_line_27",
+        Content line27 = contents.getContent("doclet.Help_line_27",
                 getHyperLink(DocPaths.ALLCLASSES_NOFRAME,
-                configuration.getText("doclet.All_Classes")));
+                resources.getText("doclet.All_Classes")));
         Content allclassesPara = HtmlTree.P(line27);
         htmlTree.addContent(allclassesPara);
         if (configuration.allowTag(HtmlTag.SECTION)) {
@@ -398,11 +391,11 @@
             ul.addContent(htmlTree);
         }
         Content sHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                getResource("doclet.Serialized_Form"));
+                contents.serializedForm);
         htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                 ? HtmlTree.SECTION(sHead)
                 : HtmlTree.LI(HtmlStyle.blockList, sHead);
-        Content line28 = getResource("doclet.Help_line_28");
+        Content line28 = contents.getContent("doclet.Help_line_28");
         Content serialPara = HtmlTree.P(line28);
         htmlTree.addContent(serialPara);
         if (configuration.allowTag(HtmlTag.SECTION)) {
@@ -411,13 +404,13 @@
             ul.addContent(htmlTree);
         }
         Content constHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
-                getResource("doclet.Constants_Summary"));
+                contents.constantsSummaryTitle);
         htmlTree = (configuration.allowTag(HtmlTag.SECTION))
                 ? HtmlTree.SECTION(constHead)
                 : HtmlTree.LI(HtmlStyle.blockList, constHead);
-        Content line29 = getResource("doclet.Help_line_29",
+        Content line29 = contents.getContent("doclet.Help_line_29",
                 getHyperLink(DocPaths.CONSTANT_VALUES,
-                configuration.getText("doclet.Constants_Summary")));
+                resources.getText("doclet.Constants_Summary")));
         Content constPara = HtmlTree.P(line29);
         htmlTree.addContent(constPara);
         if (configuration.allowTag(HtmlTag.SECTION)) {
@@ -426,7 +419,7 @@
             ul.addContent(htmlTree);
         }
         Content divContent = HtmlTree.DIV(HtmlStyle.contentContainer, ul);
-        Content line30 = HtmlTree.SPAN(HtmlStyle.emphasizedPhrase, getResource("doclet.Help_line_30"));
+        Content line30 = HtmlTree.SPAN(HtmlStyle.emphasizedPhrase, contents.getContent("doclet.Help_line_30"));
         divContent.addContent(line30);
         if (configuration.allowTag(HtmlTag.MAIN)) {
             mainTree.addContent(divContent);
@@ -443,7 +436,7 @@
      */
     @Override
     protected Content getNavLinkHelp() {
-        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, helpLabel);
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.helpLabel);
         return li;
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java	Tue Aug 09 13:22:57 2016 -0700
@@ -38,6 +38,7 @@
 import jdk.javadoc.doclet.Reporter;
 import jdk.javadoc.internal.doclets.toolkit.AbstractDoclet;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
@@ -68,7 +69,9 @@
     /**
      * The global configuration information for this run.
      */
-    public final ConfigurationImpl configuration;
+    private final ConfigurationImpl configuration;
+
+    private Messages messages;
 
 
     private static final DocPath DOCLET_RESOURCES = DocPath
@@ -77,6 +80,7 @@
     public void init(Locale locale, Reporter reporter) {
         configuration.reporter = reporter;
         configuration.locale = locale;
+        messages = configuration.getMessages();
     }
 
     /**
@@ -118,8 +122,7 @@
         }
 
         if (configuration.topFile.isEmpty()) {
-            configuration.standardmessage.
-                error("doclet.No_Non_Deprecated_Classes_To_Document");
+            messages.error("doclet.No_Non_Deprecated_Classes_To_Document");
             return;
         }
         boolean nodeprecated = configuration.nodeprecated;
@@ -351,11 +354,11 @@
             if (toFile.isSameFile(fromfile))
                 return;
 
-            configuration.message.notice("doclet.Copying_File_0_To_File_1",
+            messages.notice("doclet.Copying_File_0_To_File_1",
                     fromfile.toString(), path.getPath());
             toFile.copyFile(fromfile);
         } catch (IOException exc) {
-            configuration.message.error("doclet.perform_copy_exception_encountered",
+            messages.error("doclet.perform_copy_exception_encountered",
                     exc.toString());
             throw new DocletAbortException(exc);
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -82,7 +82,9 @@
 import jdk.javadoc.internal.doclets.toolkit.ClassWriter;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter;
+import jdk.javadoc.internal.doclets.toolkit.Resources;
 import jdk.javadoc.internal.doclets.toolkit.taglets.DocRootTaglet;
 import jdk.javadoc.internal.doclets.toolkit.taglets.TagletWriter;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
@@ -145,6 +147,12 @@
 
     protected final Utils utils;
 
+    protected final Contents contents;
+
+    protected final Messages messages;
+
+    protected final Resources resources;
+
     /**
      * To check whether annotation heading is printed or not.
      */
@@ -174,10 +182,12 @@
      *
      * @param path File to be generated.
      */
-    public HtmlDocletWriter(ConfigurationImpl configuration, DocPath path)
-            throws IOException {
+    public HtmlDocletWriter(ConfigurationImpl configuration, DocPath path) {
         super(configuration, path);
         this.configuration = configuration;
+        this.contents = configuration.contents;
+        this.messages = configuration.messages;
+        this.resources = configuration.resources;
         this.utils = configuration.utils;
         this.path = path;
         this.pathToRoot = path.parent().invert();
@@ -249,19 +259,19 @@
      */
     public Content getAllClassesLinkScript(String id) {
         HtmlTree script = HtmlTree.SCRIPT();
-        String scriptCode = "<!--" + DocletConstants.NL +
-                "  allClassesLink = document.getElementById(\"" + id + "\");" + DocletConstants.NL +
-                "  if(window==top) {" + DocletConstants.NL +
-                "    allClassesLink.style.display = \"block\";" + DocletConstants.NL +
-                "  }" + DocletConstants.NL +
-                "  else {" + DocletConstants.NL +
-                "    allClassesLink.style.display = \"none\";" + DocletConstants.NL +
-                "  }" + DocletConstants.NL +
-                "  //-->" + DocletConstants.NL;
-        Content scriptContent = new RawHtml(scriptCode);
+        String scriptCode = "<!--\n" +
+                "  allClassesLink = document.getElementById(\"" + id + "\");\n" +
+                "  if(window==top) {\n" +
+                "    allClassesLink.style.display = \"block\";\n" +
+                "  }\n" +
+                "  else {\n" +
+                "    allClassesLink.style.display = \"none\";\n" +
+                "  }\n" +
+                "  //-->\n";
+        Content scriptContent = new RawHtml(scriptCode.replace("\n", DocletConstants.NL));
         script.addContent(scriptContent);
         Content div = HtmlTree.DIV(script);
-        Content div_noscript = HtmlTree.DIV(getResource("doclet.No_Script_Message"));
+        Content div_noscript = HtmlTree.DIV(contents.noScriptMessage);
         Content noScript = HtmlTree.NOSCRIPT(div_noscript);
         div.addContent(noScript);
         return div;
@@ -404,7 +414,7 @@
                 HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
                 tdClassDescription.addStyle(HtmlStyle.colLast);
                 if (utils.isDeprecated(te)) {
-                    tdClassDescription.addContent(deprecatedLabel);
+                    tdClassDescription.addContent(contents.deprecatedLabel);
                     List<? extends DocTree> tags = utils.getDeprecatedTrees(te);
                     if (!tags.isEmpty()) {
                         addSummaryDeprecatedComment(te, tags.get(0), tdClassDescription);
@@ -535,7 +545,7 @@
             String allClassesId = "allclasses_";
             HtmlTree navDiv = new HtmlTree(HtmlTag.DIV);
             fixedNavDiv.addStyle(HtmlStyle.fixedNav);
-            Content skipNavLinks = configuration.getResource("doclet.Skip_navigation_links");
+            Content skipNavLinks = configuration.getContent("doclet.Skip_navigation_links");
             if (header) {
                 fixedNavDiv.addContent(HtmlConstants.START_OF_TOP_NAVBAR);
                 navDiv.addStyle(HtmlStyle.topNav);
@@ -617,8 +627,9 @@
             if (header && configuration.createindex) {
                 HtmlTree inputText = HtmlTree.INPUT("text", "search");
                 HtmlTree inputReset = HtmlTree.INPUT("reset", "reset");
-                Content searchTxt = configuration.getResource("doclet.search");
-                searchTxt.addContent(getSpace());
+                Content searchTxt = new ContentBuilder();
+                searchTxt.addContent(configuration.getContent("doclet.search"));
+                searchTxt.addContent(Contents.SPACE);
                 HtmlTree liInput = HtmlTree.LI(HtmlTree.SPAN(searchTxt));
                 liInput.addContent(inputText);
                 liInput.addContent(inputReset);
@@ -632,7 +643,7 @@
                 fixedNavDiv.addContent(subDiv);
                 fixedNavDiv.addContent(HtmlConstants.END_OF_TOP_NAVBAR);
                 tree.addContent(fixedNavDiv);
-                HtmlTree paddingDiv = HtmlTree.DIV(HtmlStyle.navPadding, getSpace());
+                HtmlTree paddingDiv = HtmlTree.DIV(HtmlStyle.navPadding, Contents.SPACE);
                 tree.addContent(paddingDiv);
             } else {
                 subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_BOTTOM));
@@ -678,7 +689,7 @@
      */
     protected Content getNavLinkContents() {
         Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_SUMMARY),
-                overviewLabel, "", "");
+                contents.overviewLabel, "", "");
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -690,7 +701,7 @@
      * @return a content tree for the link
      */
     protected Content getNavLinkModule(ModuleElement mdle) {
-        Content linkContent = getModuleLink(mdle, moduleLabel);
+        Content linkContent = getModuleLink(mdle, contents.moduleLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -701,7 +712,7 @@
      * @return a content tree for the link
      */
     protected Content getNavLinkModule() {
-        Content li = HtmlTree.LI(moduleLabel);
+        Content li = HtmlTree.LI(contents.moduleLabel);
         return li;
     }
 
@@ -712,7 +723,7 @@
      * @return a content tree for the link
      */
     protected Content getNavLinkPackage(PackageElement pkg) {
-        Content linkContent = getPackageLink(pkg, packageLabel);
+        Content linkContent = getPackageLink(pkg, contents.packageLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -723,7 +734,7 @@
      * @return a content tree for the link
      */
     protected Content getNavLinkPackage() {
-        Content li = HtmlTree.LI(packageLabel);
+        Content li = HtmlTree.LI(contents.packageLabel);
         return li;
     }
 
@@ -733,7 +744,7 @@
      * @return a content tree for the link
      */
     protected Content getNavLinkClassUse() {
-        Content li = HtmlTree.LI(useLabel);
+        Content li = HtmlTree.LI(contents.useLabel);
         return li;
     }
 
@@ -746,10 +757,10 @@
     public Content getNavLinkPrevious(DocPath prev) {
         Content li;
         if (prev != null) {
-            li = HtmlTree.LI(getHyperLink(prev, prevLabel, "", ""));
+            li = HtmlTree.LI(getHyperLink(prev, contents.prevLabel, "", ""));
         }
         else
-            li = HtmlTree.LI(prevLabel);
+            li = HtmlTree.LI(contents.prevLabel);
         return li;
     }
 
@@ -763,10 +774,10 @@
     public Content getNavLinkNext(DocPath next) {
         Content li;
         if (next != null) {
-            li = HtmlTree.LI(getHyperLink(next, nextLabel, "", ""));
+            li = HtmlTree.LI(getHyperLink(next, contents.nextLabel, "", ""));
         }
         else
-            li = HtmlTree.LI(nextLabel);
+            li = HtmlTree.LI(contents.nextLabel);
         return li;
     }
 
@@ -778,7 +789,7 @@
      */
     protected Content getNavShowLists(DocPath link) {
         DocLink dl = new DocLink(link, path.getPath(), null);
-        Content framesContent = getHyperLink(dl, framesLabel, "", "_top");
+        Content framesContent = getHyperLink(dl, contents.framesLabel, "", "_top");
         Content li = HtmlTree.LI(framesContent);
         return li;
     }
@@ -799,7 +810,7 @@
      * @return a content tree for the link
      */
     protected Content getNavHideLists(DocPath link) {
-        Content noFramesContent = getHyperLink(link, noframesLabel, "", "_top");
+        Content noFramesContent = getHyperLink(link, contents.noFramesLabel, "", "_top");
         Content li = HtmlTree.LI(noFramesContent);
         return li;
     }
@@ -817,7 +828,7 @@
         DocPath docPath = packages.size() == 1 && utils.getSpecifiedClasses().isEmpty()
                 ? pathString(packages.get(0), DocPaths.PACKAGE_TREE)
                 : pathToRoot.resolve(DocPaths.OVERVIEW_TREE);
-        return HtmlTree.LI(getHyperLink(docPath, treeLabel, "", ""));
+        return HtmlTree.LI(getHyperLink(docPath, contents.treeLabel, "", ""));
     }
 
     /**
@@ -839,7 +850,7 @@
      * @return a content tree for the link
      */
     protected Content getNavLinkClass() {
-        Content li = HtmlTree.LI(classLabel);
+        Content li = HtmlTree.LI(contents.classLabel);
         return li;
     }
 
@@ -850,7 +861,7 @@
      */
     protected Content getNavLinkDeprecated() {
         Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST),
-                deprecatedLabel, "", "");
+                contents.deprecatedLabel, "", "");
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -865,7 +876,7 @@
     protected Content getNavLinkClassIndex() {
         Content allClassesContent = getHyperLink(pathToRoot.resolve(
                 DocPaths.ALLCLASSES_NOFRAME),
-                allclassesLabel, "", "");
+                contents.allClassesLabel, "", "");
         Content li = HtmlTree.LI(allClassesContent);
         return li;
     }
@@ -880,7 +891,7 @@
                 (configuration.splitindex
                     ? DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1))
                     : DocPaths.INDEX_ALL)),
-            indexLabel, "", "");
+            contents.indexLabel, "", "");
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -902,7 +913,7 @@
             helpfilenm = DocPath.create(file.getName());
         }
         Content linkContent = getHyperLink(pathToRoot.resolve(helpfilenm),
-                helpLabel, "", "");
+                contents.helpLabel, "", "");
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -913,9 +924,9 @@
      * @param liNav the content tree to which the gap will be added
      */
     protected void addNavGap(Content liNav) {
-        liNav.addContent(getSpace());
+        liNav.addContent(Contents.SPACE);
         liNav.addContent("|");
-        liNav.addContent(getSpace());
+        liNav.addContent(Contents.SPACE);
     }
 
     /**
@@ -954,7 +965,7 @@
      */
     public Content getTableCaption(Content title) {
         Content captionSpan = HtmlTree.SPAN(title);
-        Content space = getSpace();
+        Content space = Contents.SPACE;
         Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, space);
         Content caption = HtmlTree.CAPTION(captionSpan);
         caption.addContent(tabSpan);
@@ -1014,7 +1025,7 @@
      */
     public Content getPackageName(PackageElement packageElement) {
         return packageElement == null || packageElement.isUnnamed()
-                ? defaultPackageLabel
+                ? contents.defaultPackageLabel
                 : getPackageLabel(packageElement.getQualifiedName());
     }
 
@@ -1040,7 +1051,7 @@
     protected void addPackageDeprecatedAPI(SortedSet<Element> deprPkgs, String headingKey,
             String tableSummary, List<String> tableHeader, Content contentTree) {
         if (deprPkgs.size() > 0) {
-            Content caption = getTableCaption(configuration.getResource(headingKey));
+            Content caption = getTableCaption(configuration.getContent(headingKey));
             Content table = (configuration.isOutputHtml5())
                     ? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
                     : HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption);
@@ -1551,7 +1562,7 @@
                     return classCrossLink;
                 } else {
                     // No cross link found so print warning
-                    configuration.getDocletSpecificMsg().warning(ch.getDocTreePath(see),
+                    messages.warning(ch.getDocTreePath(see),
                             "doclet.see.class_or_package_not_found",
                             "@" + tagName,
                             seetext);
@@ -1594,11 +1605,11 @@
                 if (this instanceof ClassWriterImpl) {
                     containing = ((ClassWriterImpl) this).getTypeElement();
                 } else if (!utils.isPublic(containing)) {
-                    configuration.getDocletSpecificMsg().warning(
+                    messages.warning(
                         ch.getDocTreePath(see), "doclet.see.class_or_package_not_accessible",
                         tagName, utils.getFullyQualifiedName(containing));
                 } else {
-                    configuration.getDocletSpecificMsg().warning(
+                    messages.warning(
                         ch.getDocTreePath(see), "doclet.see.class_or_package_not_found",
                         tagName, seetext);
                 }
@@ -1728,7 +1739,7 @@
             htmltree.addContent(div);
         }
         if (tags.isEmpty()) {
-            htmltree.addContent(getSpace());
+            htmltree.addContent(Contents.SPACE);
         }
     }
 
@@ -1917,7 +1928,7 @@
 
                 @Override @DefinedBy(Api.COMPILER_TREE)
                 public Boolean visitErroneous(ErroneousTree node, Content c) {
-                    configuration.getDocletSpecificMsg().warning(ch.getDocTreePath(node),
+                    messages.warning(ch.getDocTreePath(node),
                             "doclet.tag.invalid_usage", node);
                     result.addContent(new RawHtml(node.toString()));
                     return false;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -25,8 +25,6 @@
 
 package jdk.javadoc.internal.doclets.formats.html;
 
-import java.io.*;
-
 import java.util.Arrays;
 import java.util.List;
 import java.util.SortedSet;
@@ -111,7 +109,7 @@
         methodDetailsTree.addContent(writer.getMarkerAnchor(
                 SectionName.METHOD_DETAIL));
         Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
-                writer.methodDetailsLabel);
+                contents.methodDetailLabel);
         methodDetailsTree.addContent(heading);
         return methodDetailsTree;
     }
@@ -190,9 +188,9 @@
                 Content codelLink = HtmlTree.CODE(link);
                 Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel,
                         utils.isClass(holder)
-                                ? writer.descfrmClassLabel
-                                : writer.descfrmInterfaceLabel);
-                descfrmLabel.addContent(writer.getSpace());
+                                ? contents.descfrmClassLabel
+                                : contents.descfrmInterfaceLabel);
+                descfrmLabel.addContent(Contents.SPACE);
                 descfrmLabel.addContent(codelLink);
                 methodDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel));
                 writer.addInlineComment(method, methodDocTree);
@@ -230,20 +228,12 @@
     }
 
     /**
-     * Close the writer.
-     */
-    @Override
-    public void close() throws IOException {
-        writer.close();
-    }
-
-    /**
      * {@inheritDoc}
      */
     @Override
     public void addSummaryLabel(Content memberTree) {
         Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
-                writer.getResource("doclet.Method_Summary"));
+                contents.methodSummary);
         memberTree.addContent(label);
     }
 
@@ -252,9 +242,9 @@
      */
     @Override
     public String getTableSummary() {
-        return configuration.getText("doclet.Member_Table_Summary",
-                configuration.getText("doclet.Method_Summary"),
-                configuration.getText("doclet.methods"));
+        return resources.getText("doclet.Member_Table_Summary",
+                resources.getText("doclet.Method_Summary"),
+                resources.getText("doclet.methods"));
     }
 
     /**
@@ -262,7 +252,7 @@
      */
     @Override
     public Content getCaption() {
-        return configuration.getResource("doclet.Methods");
+        return contents.methods;
     }
 
     /**
@@ -271,9 +261,9 @@
     @Override
     public List<String> getSummaryTableHeader(Element member) {
         List<String> header = Arrays.asList(writer.getModifierTypeHeader(),
-        configuration.getText("doclet.0_and_1",
-                   configuration.getText("doclet.Method"),
-                   configuration.getText("doclet.Description")));
+                resources.getText("doclet.0_and_1",
+                        resources.getText("doclet.Method"),
+                        resources.getText("doclet.Description")));
         return header;
     }
 
@@ -307,7 +297,7 @@
                 : configuration.getText("doclet.Methods_Inherited_From_Interface"));
         Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
                 label);
-        labelHeading.addContent(writer.getSpace());
+        labelHeading.addContent(Contents.SPACE);
         labelHeading.addContent(classLink);
         inheritedTree.addContent(labelHeading);
     }
@@ -329,7 +319,8 @@
         if (writer.configuration.nocomment) {
             return;
         }
-        Utils utils = writer.configuration().utils;
+        Utils utils = writer.utils;
+        Contents contents = writer.contents;
         TypeElement holder = utils.getEnclosingTypeElement(method);
         if (!(utils.isPublic(holder) ||
             utils.isLinkable(holder))) {
@@ -341,14 +332,14 @@
             //is not visible so don't document this.
             return;
         }
-        Content label = writer.overridesLabel;
+        Content label = contents.overridesLabel;
         LinkInfoImpl.Kind context = LinkInfoImpl.Kind.METHOD_OVERRIDES;
 
         if (method != null) {
             if (utils.isAbstract(holder) && utils.isAbstract(method)){
                 //Abstract method is implemented from abstract class,
                 //not overridden
-                label = writer.specifiedByLabel;
+                label = contents.specifiedByLabel;
                 context = LinkInfoImpl.Kind.METHOD_SPECIFIED_BY;
             }
             Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.overrideSpecifyLabel, label));
@@ -362,9 +353,9 @@
                     .where(writer.getName(writer.getAnchor(method))).label(method.getSimpleName()));
             Content codeMethLink = HtmlTree.CODE(methlink);
             Content dd = HtmlTree.DD(codeMethLink);
-            dd.addContent(writer.getSpace());
-            dd.addContent(writer.getResource("doclet.in_class"));
-            dd.addContent(writer.getSpace());
+            dd.addContent(Contents.SPACE);
+            dd.addContent(writer.contents.inClass);
+            dd.addContent(Contents.SPACE);
             dd.addContent(codeOverridenTypeLink);
             dl.addContent(dd);
         }
@@ -379,6 +370,7 @@
             return;
         }
         Utils utils = writer.utils;
+        Contents contents = writer.contents;
         ImplementedMethods implementedMethodsFinder =
                 new ImplementedMethods(method, writer.configuration);
         SortedSet<ExecutableElement> implementedMethods =
@@ -390,16 +382,16 @@
             Content intfaclink = writer.getLink(new LinkInfoImpl(
                     writer.configuration, LinkInfoImpl.Kind.METHOD_SPECIFIED_BY, intfac));
             Content codeIntfacLink = HtmlTree.CODE(intfaclink);
-            Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.overrideSpecifyLabel, writer.specifiedByLabel));
+            Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.overrideSpecifyLabel, contents.specifiedByLabel));
             dl.addContent(dt);
             Content methlink = writer.getDocLink(
                     LinkInfoImpl.Kind.MEMBER, implementedMeth,
                     implementedMeth.getSimpleName(), false);
             Content codeMethLink = HtmlTree.CODE(methlink);
             Content dd = HtmlTree.DD(codeMethLink);
-            dd.addContent(writer.getSpace());
-            dd.addContent(writer.getResource("doclet.in_interface"));
-            dd.addContent(writer.getSpace());
+            dd.addContent(Contents.SPACE);
+            dd.addContent(contents.inInterface);
+            dd.addContent(Contents.SPACE);
             dd.addContent(codeIntfacLink);
             dl.addContent(dd);
         }
@@ -417,7 +409,7 @@
             Content linkContent = writer.getLink(
                     new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type));
             htmltree.addContent(linkContent);
-            htmltree.addContent(writer.getSpace());
+            htmltree.addContent(Contents.SPACE);
         }
     }
 
@@ -430,14 +422,14 @@
             if (typeElement == null) {
                 return writer.getHyperLink(
                         SectionName.METHOD_SUMMARY,
-                        writer.getResource("doclet.navMethod"));
+                        contents.navMethod);
             } else {
                 return writer.getHyperLink(
                         SectionName.METHODS_INHERITANCE,
-                        configuration.getClassName(typeElement), writer.getResource("doclet.navMethod"));
+                        configuration.getClassName(typeElement), contents.navMethod);
             }
         } else {
-            return writer.getResource("doclet.navMethod");
+            return contents.navMethod;
         }
     }
 
@@ -448,9 +440,9 @@
     protected void addNavDetailLink(boolean link, Content liNav) {
         if (link) {
             liNav.addContent(writer.getHyperLink(
-                    SectionName.METHOD_DETAIL, writer.getResource("doclet.navMethod")));
+                    SectionName.METHOD_DETAIL, contents.navMethod));
         } else {
-            liNav.addContent(writer.getResource("doclet.navMethod"));
+            liNav.addContent(contents.navMethod);
         }
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -60,7 +60,7 @@
     /**
      * The module being documented.
      */
-    private ModuleElement mdle;
+    private final ModuleElement mdle;
 
     /**
      * The classes to be documented.  Use this to filter out classes
@@ -114,9 +114,8 @@
             }
             mdlgen.printHtmlDocument(
                     configuration.metakeywords.getMetaKeywordsForModule(moduleElement), false, body);
-            mdlgen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.error(
+            configuration.messages.error(
                     "doclet.exception_encountered",
                     exc.toString(), DocPaths.moduleTypeFrame(moduleElement).getPath());
             throw new DocletAbortException(exc);
@@ -148,12 +147,12 @@
                 annotationTypes.addAll(utils.getAnnotationTypes(pkg));
             }
         }
-        addClassKindListing(interfaces, getResource("doclet.Interfaces"), contentTree);
-        addClassKindListing(classes, getResource("doclet.Classes"), contentTree);
-        addClassKindListing(enums, getResource("doclet.Enums"), contentTree);
-        addClassKindListing(exceptions, getResource("doclet.Exceptions"), contentTree);
-        addClassKindListing(errors, getResource("doclet.Errors"), contentTree);
-        addClassKindListing(annotationTypes, getResource("doclet.AnnotationTypes"), contentTree);
+        addClassKindListing(interfaces, contents.interfaces, contentTree);
+        addClassKindListing(classes, contents.classes, contentTree);
+        addClassKindListing(enums, contents.enums, contentTree);
+        addClassKindListing(exceptions, contents.exceptions, contentTree);
+        addClassKindListing(errors, contents.errors, contentTree);
+        addClassKindListing(annotationTypes, contents.annotationTypes, contentTree);
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -39,6 +39,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
@@ -79,10 +80,9 @@
         try {
             modulegen = new ModuleIndexFrameWriter(configuration, filename);
             modulegen.buildModuleIndexFile("doclet.Window_Overview", false);
-            modulegen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.error(
-                        "doclet.exception_encountered",
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
                         exc.toString(), filename);
             throw new DocletAbortException(exc);
         }
@@ -94,12 +94,12 @@
     protected void addModulesList(Map<ModuleElement, Set<PackageElement>> modules, String text,
             String tableSummary, Content body) {
         Content heading = HtmlTree.HEADING(HtmlConstants.MODULE_HEADING, true,
-                modulesLabel);
+                contents.modulesLabel);
         HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
                 ? HtmlTree.MAIN(HtmlStyle.indexContainer, heading)
                 : HtmlTree.DIV(HtmlStyle.indexContainer, heading);
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
-        ul.setTitle(modulesLabel);
+        ul.setTitle(contents.modulesLabel);
         for (ModuleElement mdle: modules.keySet()) {
             ul.addContent(getModuleLink(mdle));
         }
@@ -150,7 +150,7 @@
      */
     protected void addAllClassesLink(Content ul) {
         Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
-                allclassesLabel, "", "packageFrame");
+                contents.allClassesLabel, "", "packageFrame");
         Content li = HtmlTree.LI(linkContent);
         ul.addContent(li);
     }
@@ -163,7 +163,7 @@
      */
     protected void addAllPackagesLink(Content ul) {
         Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
-                allpackagesLabel, "", "packageListFrame");
+                contents.allPackagesLabel, "", "packageListFrame");
         Content li = HtmlTree.LI(linkContent);
         ul.addContent(li);
     }
@@ -172,7 +172,7 @@
      * {@inheritDoc}
      */
     protected void addNavigationBarFooter(Content body) {
-        Content p = HtmlTree.P(getSpace());
+        Content p = HtmlTree.P(Contents.SPACE);
         body.addContent(p);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -32,12 +32,14 @@
 import javax.lang.model.element.PackageElement;
 
 import jdk.javadoc.doclet.DocletEnvironment;
+import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
@@ -90,9 +92,9 @@
         try {
             mdlgen = new ModuleIndexWriter(configuration, filename);
             mdlgen.buildModuleIndexFile("doclet.Window_Overview_Summary", true);
-            mdlgen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.error(
+            Messages messages = configuration.getMessages();
+            messages.error(
                         "doclet.exception_encountered",
                         exc.toString(), filename);
             throw new DocletAbortException(exc);
@@ -195,12 +197,13 @@
             subTitleDiv.addStyle(HtmlStyle.subTitle);
             addSummaryComment(configuration.overviewElement, subTitleDiv);
             Content div = HtmlTree.DIV(HtmlStyle.header, subTitleDiv);
-            Content see = seeLabel;
+            Content see = new ContentBuilder();
+            see.addContent(contents.seeLabel);
             see.addContent(" ");
             Content descPara = HtmlTree.P(see);
             Content descLink = getHyperLink(getDocLink(
                     SectionName.OVERVIEW_DESCRIPTION),
-                    descriptionLabel, "", "");
+                    contents.descriptionLabel, "", "");
             descPara.addContent(descLink);
             div.addContent(descPara);
             if (configuration.allowTag(HtmlTag.MAIN)) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -41,6 +41,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
@@ -82,10 +83,9 @@
         try {
             modpackgen = new ModulePackageIndexFrameWriter(configuration, filename);
             modpackgen.buildModulePackagesIndexFile("doclet.Window_Overview", false, mdle);
-            modpackgen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.error(
-                        "doclet.exception_encountered",
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
                         exc.toString(), filename);
             throw new DocletAbortException(exc);
         }
@@ -99,13 +99,13 @@
         Content profNameContent = new StringContent(mdle.getQualifiedName().toString());
         Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
                 getTargetModuleLink("classFrame", profNameContent, mdle));
-        heading.addContent(getSpace());
-        heading.addContent(packagesLabel);
+        heading.addContent(Contents.SPACE);
+        heading.addContent(contents.packagesLabel);
         HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
                 ? HtmlTree.MAIN(HtmlStyle.indexContainer, heading)
                 : HtmlTree.DIV(HtmlStyle.indexContainer, heading);
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
-        ul.setTitle(packagesLabel);
+        ul.setTitle(contents.packagesLabel);
         List<PackageElement> packages = new ArrayList<>(modules.get(mdle));
         for (PackageElement pkg : packages) {
             if ((!(configuration.nodeprecated && utils.isDeprecated(pkg)))) {
@@ -124,13 +124,13 @@
         Content moduleNameContent = new StringContent(mdle.getQualifiedName().toString());
         Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
                 getTargetModuleLink("classFrame", moduleNameContent, mdle));
-        heading.addContent(getSpace());
-        heading.addContent(packagesLabel);
+        heading.addContent(Contents.SPACE);
+        heading.addContent(contents.packagesLabel);
         HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
                 ? HtmlTree.MAIN(HtmlStyle.indexContainer, heading)
                 : HtmlTree.DIV(HtmlStyle.indexContainer, heading);
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
-        ul.setTitle(packagesLabel);
+        ul.setTitle(contents.packagesLabel);
         Set<PackageElement> modulePackages = configuration.modulePackages.get(mdle);
         for (PackageElement pkg: modulePackages) {
             if ((!(configuration.nodeprecated && utils.isDeprecated(pkg)))) {
@@ -198,7 +198,7 @@
      */
     protected void addAllClassesLink(Content ul) {
         Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
-                allclassesLabel, "", "packageFrame");
+                contents.allClassesLabel, "", "packageFrame");
         Content li = HtmlTree.LI(linkContent);
         ul.addContent(li);
     }
@@ -211,7 +211,7 @@
      */
     protected void addAllPackagesLink(Content ul) {
         Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
-                allpackagesLabel, "", "packageListFrame");
+                contents.allPackagesLabel, "", "packageListFrame");
         Content li = HtmlTree.LI(linkContent);
         ul.addContent(li);
     }
@@ -224,7 +224,7 @@
      */
     protected void addAllModulesLink(Content ul) {
         Content linkContent = getHyperLink(DocPaths.MODULE_OVERVIEW_FRAME,
-                allmodulesLabel, "", "packageListFrame");
+                contents.allModulesLabel, "", "packageListFrame");
         Content li = HtmlTree.LI(linkContent);
         ul.addContent(li);
     }
@@ -233,7 +233,7 @@
      * {@inheritDoc}
      */
     protected void addNavigationBarFooter(Content body) {
-        Content p = HtmlTree.P(getSpace());
+        Content p = HtmlTree.P(Contents.SPACE);
         body.addContent(p);
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -102,8 +102,7 @@
      * @param nextModule   Next module in the sorted array.
      */
     public ModuleWriterImpl(ConfigurationImpl configuration,
-            ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule)
-            throws IOException {
+            ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule) {
         super(configuration, DocPaths.moduleSummary(mdle));
         this.prevModule = prevModule;
         this.nextModule = nextModule;
@@ -129,8 +128,8 @@
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.header);
         Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
-                HtmlStyle.title, moduleLabel);
-        tHeading.addContent(getSpace());
+                HtmlStyle.title, contents.moduleLabel);
+        tHeading.addContent(Contents.SPACE);
         Content moduleHead = new RawHtml(heading);
         tHeading.addContent(moduleHead);
         div.addContent(tHeading);
@@ -262,7 +261,7 @@
             HtmlTree li = new HtmlTree(HtmlTag.LI);
             li.addStyle(HtmlStyle.blockList);
             addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES,
-                    getResource("doclet.navModules"), li);
+                    contents.navModules, li);
             String text = configuration.getText("doclet.Requires_Summary");
             String tableSummary = configuration.getText("doclet.Member_Table_Summary",
                     configuration.getText("doclet.Requires_Summary"),
@@ -315,7 +314,7 @@
             HtmlTree li = new HtmlTree(HtmlTag.LI);
             li.addStyle(HtmlStyle.blockList);
             addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES,
-                    getResource("doclet.navPackages"), li);
+                    contents.navPackages, li);
             String text = configuration.getText("doclet.Exported_Packages_Summary");
             String tableSummary = configuration.getText("doclet.Member_Table_Summary",
                     configuration.getText("doclet.Exported_Packages_Summary"),
@@ -385,7 +384,7 @@
             HtmlTree li = new HtmlTree(HtmlTag.LI);
             li.addStyle(HtmlStyle.blockList);
             addSummaryHeader(HtmlConstants.START_OF_SERVICES_SUMMARY, SectionName.SERVICES,
-                    getResource("doclet.navServices"), li);
+                    contents.navServices, li);
             String text;
             String tableSummary;
             if (usesDirs != null && !usesDirs.isEmpty()) {
@@ -468,9 +467,9 @@
         HtmlTree tdType = HtmlTree.TD(HtmlStyle.colFirst, srvLinkContent);
         tdType.addContent(new HtmlTree(HtmlTag.BR));
         tdType.addContent("(");
-        HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, getResource("doclet.Implementation"));
+        HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation);
         tdType.addContent(implSpan);
-        tdType.addContent(getSpace());
+        tdType.addContent(Contents.SPACE);
         tdType.addContent(implLinkContent);
         tdType.addContent(")");
         HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
@@ -530,25 +529,25 @@
      * @return the content tree for the navigation summary links
      */
     protected Content getNavSummaryLinks() throws Exception {
-        Content li = HtmlTree.LI(moduleSubNavLabel);
-        li.addContent(getSpace());
+        Content li = HtmlTree.LI(contents.moduleSubNavLabel);
+        li.addContent(Contents.SPACE);
         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
         Content liNav = new HtmlTree(HtmlTag.LI);
         liNav.addContent(!utils.getBody(mdle).isEmpty() && !configuration.nocomment
-                ? getHyperLink(SectionName.MODULE_DESCRIPTION, getResource("doclet.navModuleDescription"))
-                : getResource("doclet.navModuleDescription"));
+                ? getHyperLink(SectionName.MODULE_DESCRIPTION, contents.navModuleDescription)
+                : contents.navModuleDescription);
         addNavGap(liNav);
         liNav.addContent(showDirectives(DirectiveKind.REQUIRES)
-                ? getHyperLink(SectionName.MODULES, getResource("doclet.navModules"))
-                : getResource("doclet.navModules"));
+                ? getHyperLink(SectionName.MODULES, contents.navModules)
+                : contents.navModules);
         addNavGap(liNav);
         liNav.addContent(showDirectives(DirectiveKind.EXPORTS)
-                ? getHyperLink(SectionName.PACKAGES, getResource("doclet.navPackages"))
-                : getResource("doclet.navPackages"));
+                ? getHyperLink(SectionName.PACKAGES, contents.navPackages)
+                : contents.navPackages);
         addNavGap(liNav);
         liNav.addContent((showDirectives(DirectiveKind.USES) || showDirectives(DirectiveKind.PROVIDES))
-                ? getHyperLink(SectionName.SERVICES, getResource("doclet.navServices"))
-                : getResource("doclet.navServices"));
+                ? getHyperLink(SectionName.SERVICES, contents.navServices)
+                : contents.navServices);
         ulNav.addContent(liNav);
         return ulNav;
     }
@@ -609,7 +608,7 @@
             deprs = utils.getDeprecatedTrees(pkg);
             HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
             deprDiv.addStyle(HtmlStyle.deprecatedContent);
-            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
+            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
             deprDiv.addContent(deprPhrase);
             if (!deprs.isEmpty()) {
                 CommentHelper ch = utils.getCommentHelper(pkg);
@@ -629,7 +628,7 @@
      */
     @Override
     protected Content getNavLinkModule() {
-        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, moduleLabel);
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.moduleLabel);
         return li;
     }
 
@@ -641,10 +640,10 @@
     public Content getNavLinkPrevious() {
         Content li;
         if (prevModule == null) {
-            li = HtmlTree.LI(prevmoduleLabel);
+            li = HtmlTree.LI(contents.prevModuleLabel);
         } else {
             li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.moduleSummary(
-                    prevModule)), prevmoduleLabel, "", ""));
+                    prevModule)), contents.prevModuleLabel, "", ""));
         }
         return li;
     }
@@ -657,10 +656,10 @@
     public Content getNavLinkNext() {
         Content li;
         if (nextModule == null) {
-            li = HtmlTree.LI(nextmoduleLabel);
+            li = HtmlTree.LI(contents.nextModuleLabel);
         } else {
             li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.moduleSummary(
-                    nextModule)), nextmoduleLabel, "", ""));
+                    nextModule)), contents.nextModuleLabel, "", ""));
         }
         return li;
     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -84,20 +84,12 @@
     }
 
     /**
-     * Close the writer.
-     */
-    @Override
-    public void close() throws IOException {
-        writer.close();
-    }
-
-    /**
      * {@inheritDoc}
      */
     @Override
     public void addSummaryLabel(Content memberTree) {
         Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
-                writer.getResource("doclet.Nested_Class_Summary"));
+                contents.nestedClassSummary);
         memberTree.addContent(label);
     }
 
@@ -106,9 +98,9 @@
      */
     @Override
     public String getTableSummary() {
-        return configuration.getText("doclet.Member_Table_Summary",
-                configuration.getText("doclet.Nested_Class_Summary"),
-                configuration.getText("doclet.nested_classes"));
+        return resources.getText("doclet.Member_Table_Summary",
+                resources.getText("doclet.Nested_Class_Summary"),
+                resources.getText("doclet.nested_classes"));
     }
 
     /**
@@ -116,7 +108,7 @@
      */
     @Override
     public Content getCaption() {
-        return configuration.getResource("doclet.Nested_Classes");
+        return configuration.getContent("doclet.Nested_Classes");
     }
 
     /**
@@ -169,7 +161,7 @@
                 : configuration.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
         Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
                 label);
-        labelHeading.addContent(writer.getSpace());
+        labelHeading.addContent(Contents.SPACE);
         labelHeading.addContent(classLink);
         inheritedTree.addContent(labelHeading);
     }
@@ -221,14 +213,14 @@
             if (typeElement == null) {
                 return writer.getHyperLink(
                         SectionName.NESTED_CLASS_SUMMARY,
-                        writer.getResource("doclet.navNested"));
+                        contents.navNested);
             } else {
                 return writer.getHyperLink(
                         SectionName.NESTED_CLASSES_INHERITANCE,
-                        utils.getFullyQualifiedName(typeElement), writer.getResource("doclet.navNested"));
+                        utils.getFullyQualifiedName(typeElement), contents.navNested);
             }
         } else {
-            return writer.getResource("doclet.navNested");
+            return contents.navNested;
         }
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -38,6 +38,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
@@ -80,8 +81,7 @@
      * @param configuration the configuration of the doclet.
      * @param packageElement PackageElement under consideration.
      */
-    public PackageFrameWriter(ConfigurationImpl configuration, PackageElement packageElement)
-            throws IOException {
+    public PackageFrameWriter(ConfigurationImpl configuration, PackageElement packageElement) {
         super(configuration, DocPath.forPackage(packageElement).resolve(DocPaths.PACKAGE_FRAME));
         this.packageElement = packageElement;
         if (utils.getSpecifiedPackages().isEmpty()) {
@@ -119,10 +119,9 @@
             }
             packgen.printHtmlDocument(
                     configuration.metakeywords.getMetaKeywords(packageElement), false, body);
-            packgen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.error(
-                    "doclet.exception_encountered",
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
                     exc.toString(), DocPaths.PACKAGE_FRAME.getPath());
             throw new DocletAbortException(exc);
         }
@@ -139,30 +138,30 @@
         Configuration config = configuration;
         if (utils.isIncluded(packageElement)) {
             addClassKindListing(utils.getInterfaces(packageElement),
-                getResource("doclet.Interfaces"), contentTree);
+                contents.interfaces, contentTree);
             addClassKindListing(utils.getOrdinaryClasses(packageElement),
-                getResource("doclet.Classes"), contentTree);
+                contents.classes, contentTree);
             addClassKindListing(utils.getEnums(packageElement),
-                getResource("doclet.Enums"), contentTree);
+                contents.enums, contentTree);
             addClassKindListing(utils.getExceptions(packageElement),
-                getResource("doclet.Exceptions"), contentTree);
+                contents.exceptions, contentTree);
             addClassKindListing(utils.getErrors(packageElement),
-                getResource("doclet.Errors"), contentTree);
+                contents.errors, contentTree);
             addClassKindListing(utils.getAnnotationTypes(packageElement),
-                getResource("doclet.AnnotationTypes"), contentTree);
+                contents.annotationTypes, contentTree);
         } else {
             addClassKindListing(config.typeElementCatalog.interfaces(packageElement),
-                getResource("doclet.Interfaces"), contentTree);
+                contents.interfaces, contentTree);
             addClassKindListing(config.typeElementCatalog.ordinaryClasses(packageElement),
-                getResource("doclet.Classes"), contentTree);
+                contents.classes, contentTree);
             addClassKindListing(config.typeElementCatalog.enums(packageElement),
-                getResource("doclet.Enums"), contentTree);
+                contents.enums, contentTree);
             addClassKindListing(config.typeElementCatalog.exceptions(packageElement),
-                getResource("doclet.Exceptions"), contentTree);
+                contents.exceptions, contentTree);
             addClassKindListing(config.typeElementCatalog.errors(packageElement),
-                getResource("doclet.Errors"), contentTree);
+                contents.errors, contentTree);
             addClassKindListing(config.typeElementCatalog.annotationTypes(packageElement),
-                getResource("doclet.AnnotationTypes"), contentTree);
+                contents.annotationTypes, contentTree);
         }
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -37,6 +37,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
@@ -76,10 +77,9 @@
         try {
             packgen = new PackageIndexFrameWriter(configuration, filename);
             packgen.buildPackageIndexFile("doclet.Window_Overview", false);
-            packgen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.error(
-                        "doclet.exception_encountered",
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
                         exc.toString(), filename);
             throw new DocletAbortException(exc);
         }
@@ -91,12 +91,12 @@
     protected void addPackagesList(Collection<PackageElement> packages, String text,
             String tableSummary, Content body) {
         Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
-                packagesLabel);
+                contents.packagesLabel);
         HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
                 ? HtmlTree.MAIN(HtmlStyle.indexContainer, heading)
                 : HtmlTree.DIV(HtmlStyle.indexContainer, heading);
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
-        ul.setTitle(packagesLabel);
+        ul.setTitle(contents.packagesLabel);
         for (PackageElement aPackage : packages) {
             // Do not list the package if -nodeprecated option is set and the
             // package is marked as deprecated.
@@ -161,7 +161,7 @@
      */
     protected void addAllClassesLink(Content ul) {
         Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
-                allclassesLabel, "", "packageFrame");
+                contents.allClassesLabel, "", "packageFrame");
         Content li = HtmlTree.LI(linkContent);
         ul.addContent(li);
     }
@@ -174,7 +174,7 @@
      */
     protected void addAllModulesLink(Content ul) {
         Content linkContent = getHyperLink(DocPaths.MODULE_OVERVIEW_FRAME,
-                allmodulesLabel, "", "packageListFrame");
+                contents.allModulesLabel, "", "packageListFrame");
         Content li = HtmlTree.LI(linkContent);
         ul.addContent(li);
     }
@@ -183,7 +183,7 @@
      * {@inheritDoc}
      */
     protected void addNavigationBarFooter(Content body) {
-        Content p = HtmlTree.P(getSpace());
+        Content p = HtmlTree.P(Contents.SPACE);
         body.addContent(p);
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -31,11 +31,13 @@
 import javax.lang.model.element.PackageElement;
 
 import jdk.javadoc.doclet.DocletEnvironment;
+import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
@@ -103,10 +105,9 @@
         try {
             packgen = new PackageIndexWriter(configuration, filename);
             packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", true);
-            packgen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.error(
-                        "doclet.exception_encountered",
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
                         exc.toString(), filename);
             throw new DocletAbortException(exc);
         }
@@ -189,12 +190,13 @@
             subTitleDiv.addStyle(HtmlStyle.subTitle);
             addSummaryComment(configuration.overviewElement, subTitleDiv);
             Content div = HtmlTree.DIV(HtmlStyle.header, subTitleDiv);
-            Content see = seeLabel;
-            see.addContent(" ");
-            Content descPara = HtmlTree.P(see);
+            Content descBody = new ContentBuilder();
+            descBody.addContent(contents.seeLabel);
+            descBody.addContent(" ");
+            Content descPara = HtmlTree.P(descBody);
             Content descLink = getHyperLink(getDocLink(
                     SectionName.OVERVIEW_DESCRIPTION),
-                    descriptionLabel, "", "");
+                    contents.descriptionLabel, "", "");
             descPara.addContent(descLink);
             div.addContent(descPara);
             if (configuration.allowTag(HtmlTag.MAIN)) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -34,6 +34,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
@@ -112,10 +113,9 @@
             packgen = new PackageTreeWriter(configuration, path, pkg,
                 prev, next);
             packgen.generatePackageTreeFile();
-            packgen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.error(
-                        "doclet.exception_encountered",
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
                         exc.toString(), path.getPath());
             throw new DocletAbortException(exc);
         }
@@ -130,7 +130,7 @@
         HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
                 ? HtmlTree.MAIN()
                 : body;
-        Content headContent = getResource("doclet.Hierarchy_For_Package",
+        Content headContent = contents.getContent("doclet.Hierarchy_For_Package",
                 utils.getPackageName(packageElement));
         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
                 HtmlStyle.title, headContent);
@@ -187,7 +187,7 @@
      */
     protected void addLinkToMainTree(Content div) {
         Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
-                getResource("doclet.Package_Hierarchies"));
+                contents.packageHierarchies);
         div.addContent(span);
         HtmlTree ul = new HtmlTree (HtmlTag.UL);
         ul.addStyle(HtmlStyle.horizontal);
@@ -231,7 +231,7 @@
     @Override
     protected Content getNavLinkModule() {
         Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement),
-                moduleLabel);
+                contents.moduleLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -243,7 +243,7 @@
      */
     protected Content getNavLinkPackage() {
         Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
-                packageLabel);
+                contents.packageLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -38,6 +38,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassUseMapper;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
@@ -108,11 +109,9 @@
         try {
             pkgusegen = new PackageUseWriter(configuration, mapper, filename, pkgElement);
             pkgusegen.generatePackageUseFile();
-            pkgusegen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.error(
-                "doclet.exception_encountered",
-                exc.toString(), filename);
+            Messages messages = configuration.getMessages();
+            messages.error(exc.toString(), filename);
             throw new DocletAbortException(exc);
         }
     }
@@ -125,7 +124,7 @@
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.contentContainer);
         if (usingPackageToUsedClasses.isEmpty()) {
-            div.addContent(getResource("doclet.ClassUse_No.usage.of.0", utils.getPackageName(packageElement)));
+            div.addContent(contents.getContent("doclet.ClassUse_No.usage.of.0", utils.getPackageName(packageElement)));
         } else {
             addPackageUse(div);
         }
@@ -167,7 +166,7 @@
      * @param contentTree the content tree to which the package list will be added
      */
     protected void addPackageList(Content contentTree) throws IOException {
-        Content caption = getTableCaption(configuration.getResource(
+        Content caption = getTableCaption(configuration.getContent(
                 "doclet.ClassUse_Packages.that.use.0",
                 getPackageLink(packageElement, utils.getPackageName(packageElement))));
         Content table = (configuration.isOutputHtml5())
@@ -208,7 +207,7 @@
             }
             String tableSummary = configuration.getText("doclet.Use_Table_Summary",
                                                         configuration.getText("doclet.classes"));
-            Content caption = getTableCaption(configuration.getResource(
+            Content caption = getTableCaption(configuration.getContent(
                     "doclet.ClassUse_Classes.in.0.used.by.1",
                     getPackageLink(packageElement, utils.getPackageName(packageElement)),
                     getPackageLink(usingPackage, utils.getPackageName(usingPackage))));
@@ -265,7 +264,7 @@
         if (pkg != null && !pkg.isUnnamed()) {
             addSummaryComment(pkg, tdLast);
         } else {
-            tdLast.addContent(getSpace());
+            tdLast.addContent(Contents.SPACE);
         }
         contentTree.addContent(tdLast);
     }
@@ -289,7 +288,7 @@
             bodyTree.addContent(htmlTree);
         }
         ContentBuilder headContent = new ContentBuilder();
-        headContent.addContent(getResource("doclet.ClassUse_Title", packageText));
+        headContent.addContent(contents.getContent("doclet.ClassUse_Title", packageText));
         headContent.addContent(new HtmlTree(HtmlTag.BR));
         headContent.addContent(name);
         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
@@ -311,7 +310,7 @@
     @Override
     protected Content getNavLinkModule() {
         Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement),
-                moduleLabel);
+                contents.moduleLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -323,7 +322,7 @@
      */
     protected Content getNavLinkPackage() {
         Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
-                packageLabel);
+                contents.packageLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -334,7 +333,7 @@
      * @return a content tree for the use link
      */
     protected Content getNavLinkClassUse() {
-        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, useLabel);
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.useLabel);
         return li;
     }
 
@@ -345,7 +344,7 @@
      */
     protected Content getNavLinkTree() {
         Content linkContent = getHyperLink(DocPaths.PACKAGE_TREE,
-                treeLabel);
+                contents.treeLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -100,8 +100,7 @@
      * @param next            Next package in the sorted array.
      */
     public PackageWriterImpl(ConfigurationImpl configuration,
-            PackageElement packageElement, PackageElement prev, PackageElement next)
-            throws IOException {
+            PackageElement packageElement, PackageElement prev, PackageElement next) {
         super(configuration, DocPath
                 .forPackage(packageElement)
                 .resolve(DocPaths.PACKAGE_SUMMARY));
@@ -127,9 +126,9 @@
         div.addStyle(HtmlStyle.header);
         ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(packageElement);
         if (mdle != null && !mdle.isUnnamed()) {
-            Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInClass, moduleLabel);
+            Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInClass, contents.moduleLabel);
             Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
-            moduleNameDiv.addContent(getSpace());
+            moduleNameDiv.addContent(Contents.SPACE);
             moduleNameDiv.addContent(getModuleLink(mdle,
                     new StringContent(mdle.getQualifiedName().toString())));
             div.addContent(moduleNameDiv);
@@ -138,8 +137,8 @@
         addAnnotationInfo(packageElement, annotationContent);
         div.addContent(annotationContent);
         Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
-                HtmlStyle.title, packageLabel);
-        tHeading.addContent(getSpace());
+                HtmlStyle.title, contents.packageLabel);
+        tHeading.addContent(Contents.SPACE);
         Content packageHead = new StringContent(heading);
         tHeading.addContent(packageHead);
         div.addContent(tHeading);
@@ -149,11 +148,11 @@
             docSummaryDiv.addStyle(HtmlStyle.docSummary);
             addSummaryComment(packageElement, docSummaryDiv);
             div.addContent(docSummaryDiv);
-            Content space = getSpace();
+            Content space = Contents.SPACE;
             Content descLink = getHyperLink(getDocLink(
                     SectionName.PACKAGE_DESCRIPTION),
-                    descriptionLabel, "", "");
-            Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
+                    contents.descriptionLabel, "", "");
+            Content descPara = new HtmlTree(HtmlTag.P, contents.seeLabel, space, descLink);
             div.addContent(descPara);
         }
         if (configuration.allowTag(HtmlTag.MAIN)) {
@@ -184,7 +183,7 @@
             CommentHelper ch = utils.getCommentHelper(packageElement);
             HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
             deprDiv.addStyle(HtmlStyle.deprecatedContent);
-            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
+            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
             deprDiv.addContent(deprPhrase);
             if (!deprs.isEmpty()) {
                 List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
@@ -233,7 +232,7 @@
                 HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
                 tdClassDescription.addStyle(HtmlStyle.colLast);
                 if (utils.isDeprecated(klass)) {
-                    tdClassDescription.addContent(deprecatedLabel);
+                    tdClassDescription.addContent(contents.deprecatedLabel);
                     List<? extends DocTree> tags = utils.getDeprecatedTrees(klass);
                     if (!tags.isEmpty()) {
                         addSummaryDeprecatedComment(klass, tags.get(0), tdClassDescription);
@@ -323,7 +322,7 @@
      */
     protected Content getNavLinkClassUse() {
         Content useLink = getHyperLink(DocPaths.PACKAGE_USE,
-                useLabel, "", "");
+                contents.useLabel, "", "");
         Content li = HtmlTree.LI(useLink);
         return li;
     }
@@ -336,11 +335,11 @@
     public Content getNavLinkPrevious() {
         Content li;
         if (prev == null) {
-            li = HtmlTree.LI(prevpackageLabel);
+            li = HtmlTree.LI(contents.prevPackageLabel);
         } else {
             DocPath path = DocPath.relativePath(packageElement, prev);
             li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.PACKAGE_SUMMARY),
-                prevpackageLabel, "", ""));
+                contents.prevPackageLabel, "", ""));
         }
         return li;
     }
@@ -353,11 +352,11 @@
     public Content getNavLinkNext() {
         Content li;
         if (next == null) {
-            li = HtmlTree.LI(nextpackageLabel);
+            li = HtmlTree.LI(contents.nextPackageLabel);
         } else {
             DocPath path = DocPath.relativePath(packageElement, next);
             li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.PACKAGE_SUMMARY),
-                nextpackageLabel, "", ""));
+                contents.nextPackageLabel, "", ""));
         }
         return li;
     }
@@ -370,7 +369,7 @@
      */
     protected Content getNavLinkTree() {
         Content useLink = getHyperLink(DocPaths.PACKAGE_TREE,
-                treeLabel, "", "");
+                contents.treeLabel, "", "");
         Content li = HtmlTree.LI(useLink);
         return li;
     }
@@ -383,7 +382,7 @@
     @Override
     protected Content getNavLinkModule() {
         Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement),
-                moduleLabel);
+                contents.moduleLabel);
         Content li = HtmlTree.LI(linkContent);
         return li;
     }
@@ -394,7 +393,7 @@
      * @return a content tree for the package link
      */
     protected Content getNavLinkPackage() {
-        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, packageLabel);
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.packageLabel);
         return li;
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -94,7 +94,7 @@
         propertyDetailsTree.addContent(writer.getMarkerAnchor(
                 SectionName.PROPERTY_DETAIL));
         Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
-                writer.propertyDetailsLabel);
+                contents.propertyDetailsLabel);
         propertyDetailsTree.addContent(heading);
         return propertyDetailsTree;
     }
@@ -163,9 +163,9 @@
                 Content codeLink = HtmlTree.CODE(link);
                 Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel,
                         utils.isClass(holder)
-                                ? writer.descfrmClassLabel
-                                : writer.descfrmInterfaceLabel);
-                descfrmLabel.addContent(writer.getSpace());
+                                ? contents.descfrmClassLabel
+                                : contents.descfrmInterfaceLabel);
+                descfrmLabel.addContent(Contents.SPACE);
                 descfrmLabel.addContent(codeLink);
                 propertyDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel));
                 writer.addInlineComment(property, propertyDocTree);
@@ -203,20 +203,12 @@
     }
 
     /**
-     * Close the writer.
-     */
-    @Override
-    public void close() throws IOException {
-        writer.close();
-    }
-
-    /**
      * {@inheritDoc}
      */
     @Override
     public void addSummaryLabel(Content memberTree) {
         Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
-                writer.getResource("doclet.Property_Summary"));
+                contents.propertySummary);
         memberTree.addContent(label);
     }
 
@@ -225,9 +217,9 @@
      */
     @Override
     public String getTableSummary() {
-        return configuration.getText("doclet.Member_Table_Summary",
-                configuration.getText("doclet.Property_Summary"),
-                configuration.getText("doclet.properties"));
+        return resources.getText("doclet.Member_Table_Summary",
+                resources.getText("doclet.Property_Summary"),
+                resources.getText("doclet.properties"));
     }
 
     /**
@@ -235,7 +227,7 @@
      */
     @Override
     public Content getCaption() {
-        return configuration.getResource("doclet.Properties");
+        return contents.properties;
     }
 
     /**
@@ -282,7 +274,7 @@
                        : configuration.getText("doclet.Properties_Inherited_From_Interface"));
         Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
                 label);
-        labelHeading.addContent(writer.getSpace());
+        labelHeading.addContent(Contents.SPACE);
         labelHeading.addContent(classLink);
         inheritedTree.addContent(labelHeading);
     }
@@ -342,14 +334,14 @@
             if (typeElement == null) {
                 return writer.getHyperLink(
                 SectionName.PROPERTY_SUMMARY,
-                writer.getResource("doclet.navProperty"));
+                contents.navProperty);
             } else {
                 return writer.getHyperLink(
                 SectionName.PROPERTIES_INHERITANCE,
-                configuration.getClassName(typeElement), writer.getResource("doclet.navProperty"));
+                configuration.getClassName(typeElement), contents.navProperty);
             }
         } else {
-            return writer.getResource("doclet.navProperty");
+            return contents.navProperty;
         }
     }
 
@@ -361,9 +353,9 @@
         if (link) {
             liNav.addContent(writer.getHyperLink(
                     SectionName.PROPERTY_DETAIL,
-                    writer.getResource("doclet.navProperty")));
+                    contents.navProperty));
         } else {
-            liNav.addContent(writer.getResource("doclet.navProperty"));
+            liNav.addContent(contents.navProperty);
         }
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -136,8 +136,8 @@
      */
     public Content getPackageHeader(String packageName) {
         Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
-                packageLabel);
-        heading.addContent(getSpace());
+                contents.packageLabel);
+        heading.addContent(Contents.SPACE);
         heading.addContent(packageName);
         return heading;
     }
@@ -183,9 +183,9 @@
 
         //Print the heading.
         Content className = superClassLink == null ?
-            configuration.getResource(
+            configuration.getContent(
             "doclet.Class_0_implements_serializable", classLink) :
-            configuration.getResource(
+            configuration.getContent(
             "doclet.Class_0_extends_implements_serializable", classLink,
             superClassLink);
         li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, 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
@@ -33,6 +33,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
@@ -84,10 +85,9 @@
             indexgen = new SingleIndexWriter(configuration,
                                              filename, indexbuilder);
             indexgen.generateIndexFile();
-            indexgen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.error(
-                        "doclet.exception_encountered",
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
                         exc.toString(), filename);
             throw new DocletAbortException(exc);
         }
@@ -150,7 +150,7 @@
             contentTree.addContent(
                     getHyperLink(getNameForIndex(unicode),
                             new StringContent(unicode)));
-            contentTree.addContent(getSpace());
+            contentTree.addContent(Contents.SPACE);
         }
     }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -40,6 +40,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
@@ -73,6 +74,7 @@
     private static final String NEW_LINE = DocletConstants.NL;
 
     private final ConfigurationImpl configuration;
+    private final Messages messages;
     private final Utils utils;
 
     private final DocletEnvironment docEnv;
@@ -88,6 +90,7 @@
     private SourceToHTMLConverter(ConfigurationImpl configuration, DocletEnvironment rd,
             DocPath outputdir) {
         this.configuration  = configuration;
+        this.messages = configuration.getMessages();
         this.utils = configuration.utils;
         this.docEnv = rd;
         this.outputdir = outputdir;
@@ -200,7 +203,7 @@
         Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
                 head, body);
         Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree);
-        configuration.message.notice("doclet.Generating_0", path.getPath());
+        messages.notice("doclet.Generating_0", path.getPath());
         DocFile df = DocFile.createFileForOutput(configuration, path);
         try (Writer w = df.openWriter()) {
             htmlDocument.write(w, true);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, 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
@@ -32,11 +32,13 @@
 import java.util.ListIterator;
 import java.util.Set;
 import java.util.TreeSet;
+
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
@@ -115,11 +117,10 @@
                 if (!li.hasNext()) {
                     indexgen.createSearchIndexFiles();
                 }
-                indexgen.close();
             }
         } catch (IOException exc) {
-            configuration.standardmessage.error(
-                        "doclet.exception_encountered",
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
                         exc.toString(), filename.getPath());
             throw new DocletAbortException(exc);
         }
@@ -178,7 +179,7 @@
             int j = i + 1;
             contentTree.addContent(getHyperLink(DocPaths.indexN(j),
                     new StringContent(indexElements.get(i).toString())));
-            contentTree.addContent(getSpace());
+            contentTree.addContent(Contents.SPACE);
         }
     }
 
@@ -188,7 +189,7 @@
      * @return a content tree for the link
      */
     public Content getNavLinkPrevious() {
-        Content prevletterLabel = getResource("doclet.Prev_Letter");
+        Content prevletterLabel = contents.prevLetter;
         if (prev == -1) {
             return HtmlTree.LI(prevletterLabel);
         }
@@ -205,7 +206,7 @@
      * @return a content tree for the link
      */
     public Content getNavLinkNext() {
-        Content nextletterLabel = getResource("doclet.Next_Letter");
+        Content nextletterLabel = contents.nextLetter;
         if (next == -1) {
             return HtmlTree.LI(nextletterLabel);
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -35,7 +35,6 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
-import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.MethodTypes;
@@ -67,8 +66,7 @@
      */
     protected HtmlTree mainTree = HtmlTree.MAIN();
 
-    public SubWriterHolderWriter(ConfigurationImpl configuration, DocPath filename)
-            throws IOException {
+    public SubWriterHolderWriter(ConfigurationImpl configuration, DocPath filename) {
         super(configuration, filename);
     }
 
@@ -126,7 +124,7 @@
             Content captionSpan;
             Content span;
             if (type.isDefaultTab()) {
-                captionSpan = HtmlTree.SPAN(configuration.getResource(type.resourceKey()));
+                captionSpan = HtmlTree.SPAN(configuration.getContent(type.resourceKey()));
                 span = HtmlTree.SPAN(type.tabId(),
                         HtmlStyle.activeTableTab, captionSpan);
             } else {
@@ -134,7 +132,7 @@
                 span = HtmlTree.SPAN(type.tabId(),
                         HtmlStyle.tableTab, captionSpan);
             }
-            Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, getSpace());
+            Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, Contents.SPACE);
             span.addContent(tabSpan);
             tabbedCaption.addContent(span);
         }
@@ -149,7 +147,7 @@
      */
     public Content getMethodTypeLinks(MethodTypes methodType) {
         String jsShow = "javascript:show(" + methodType.value() +");";
-        HtmlTree link = HtmlTree.A(jsShow, configuration.getResource(methodType.resourceKey()));
+        HtmlTree link = HtmlTree.A(jsShow, configuration.getContent(methodType.resourceKey()));
         return link;
     }
 
@@ -189,9 +187,9 @@
         List<? extends DocTree> deprs = utils.getBlockTags(member, DocTree.Kind.DEPRECATED);
         Content div;
         if (utils.isDeprecated(member)) {
-            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
+            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
             div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
-            div.addContent(getSpace());
+            div.addContent(Contents.SPACE);
             if (!deprs.isEmpty()) {
                 addInlineDeprecatedComment(member, deprs.get(0), div);
             }
@@ -200,9 +198,9 @@
         } else {
             Element te = member.getEnclosingElement();
             if (te != null &&  utils.isTypeElement(te) && utils.isDeprecated(te)) {
-                Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
+                Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
                 div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
-                div.addContent(getSpace());
+                div.addContent(Contents.SPACE);
                 tdSummary.addContent(div);
             }
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java	Tue Aug 09 13:22:57 2016 -0700
@@ -26,6 +26,7 @@
 package jdk.javadoc.internal.doclets.formats.html;
 
 import java.util.List;
+
 import javax.lang.model.element.Element;
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
@@ -51,7 +52,6 @@
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
-import jdk.javadoc.internal.doclets.toolkit.util.MessageRetriever;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 
 /**
@@ -144,7 +144,7 @@
                     return null;
                 }
             }.visit(element);
-            si.setCategory(configuration.getResource("doclet.SearchTags").toString());
+            si.setCategory(configuration.getContent("doclet.SearchTags").toString());
             configuration.tagSearchIndex.add(si);
         }
         return result;
@@ -215,13 +215,6 @@
     /**
      * {@inheritDoc}
      */
-    public MessageRetriever getMsgRetriever() {
-        return configuration.message;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
     public Content getParamHeader(String header) {
         HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.paramLabel,
                 new StringContent(header)));
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -36,6 +36,7 @@
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
@@ -96,10 +97,9 @@
         try {
             treegen = new TreeWriter(configuration, filename, classtree);
             treegen.generateTreeFile();
-            treegen.close();
         } catch (IOException exc) {
-            configuration.standardmessage.error(
-                        "doclet.exception_encountered",
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
                         exc.toString(), filename);
             throw new DocletAbortException(exc);
         }
@@ -110,7 +110,7 @@
      */
     public void generateTreeFile() throws IOException {
         HtmlTree body = getTreeHeader();
-        Content headContent = getResource("doclet.Hierarchy_For_All_Packages");
+        Content headContent = contents.hierarchyForAllPackages;
         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
                 HtmlStyle.title, headContent);
         Content div = HtmlTree.DIV(HtmlStyle.header, heading);
@@ -154,7 +154,7 @@
         }
         if (!classesonly) {
             Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
-                    getResource("doclet.Package_Hierarchies"));
+                    contents.packageHierarchies);
             contentTree.addContent(span);
             HtmlTree ul = new HtmlTree(HtmlTag.UL);
             ul.addStyle(HtmlStyle.horizontal);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/FixedStringContent.java	Tue Aug 09 13:22:57 2016 -0700
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.javadoc.internal.doclets.formats.html.markup;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
+import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
+
+/**
+ * Class for containing fixed string content for HTML tags of javadoc output.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class FixedStringContent extends Content {
+    private final String string;
+
+    /**
+     * Constructor to construct FixedStringContent object.
+     *
+     * @param content content for the object
+     */
+    public FixedStringContent(CharSequence content) {
+        string = needEscape(content)
+                ? escape(content)
+                : content.toString();
+    }
+
+    /**
+     * This method is not supported by the class.
+     *
+     * @param content content that needs to be added
+     * @throws DocletAbortException this method will always throw a
+     *                              DocletAbortException because it
+     *                              is not supported.
+     */
+    @Override
+    public void addContent(Content content) {
+        throw new DocletAbortException("not supported");
+    }
+
+    /**
+     * Adds content for the StringContent object.  The method escapes
+     * HTML characters for the string content that is added.
+     *
+     * @param strContent string content to be added
+     * @throws DocletAbortException this method will always throw a
+     *                              DocletAbortException because it
+     *                              is not supported.
+     */
+    @Override
+    public void addContent(CharSequence strContent) {
+        throw new DocletAbortException("not supported");
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isEmpty() {
+        return string.isEmpty();
+    }
+
+    @Override
+    public int charCount() {
+        return RawHtml.charCount(string);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return string;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean write(Writer out, boolean atNewline) throws IOException {
+        out.write(string);
+        return string.endsWith(DocletConstants.NL);
+    }
+
+    private boolean needEscape(CharSequence cs) {
+        for (int i = 0; i < cs.length(); i++) {
+            switch (cs.charAt(i)) {
+                case '<':
+                case '>':
+                case '&':
+                    return true;
+            }
+        }
+        return false;
+    }
+    private String escape(CharSequence s) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < s.length(); i++) {
+            char 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();
+    }
+
+}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -36,6 +36,7 @@
 import jdk.javadoc.internal.doclets.formats.html.SectionName;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
 import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
@@ -67,11 +68,11 @@
      *
      * @param filename String file name.
      */
-    public HtmlDocWriter(Configuration configuration, DocPath filename)
-            throws IOException {
+    public HtmlDocWriter(Configuration configuration, DocPath filename) {
         super(configuration, filename);
         this.pathToRoot = filename.parent().invert();
-        configuration.message.notice("doclet.Generating_0",
+        Messages messages = configuration.getMessages();
+        messages.notice("doclet.Generating_0",
             DocFile.createFileForOutput(configuration, filename).getPath());
     }
 
@@ -310,10 +311,6 @@
         return (encl.isUnnamed()) ? "" : (encl.getQualifiedName() + ".");
     }
 
-    public boolean getMemberDetailsListPrinted() {
-        return memberDetailsListPrinted;
-    }
-
     /**
      * Print the frames version of the Html file header.
      * Called only when generating an HTML frames file.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -30,6 +30,7 @@
 
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Resources;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
@@ -62,11 +63,6 @@
     protected Configuration configuration;
 
     /**
-     * The flag to indicate whether a member details list is printed or not.
-     */
-    protected boolean memberDetailsListPrinted;
-
-    /**
      * Header for table displaying modules and description..
      */
     protected final List<String> moduleTableHeader;
@@ -106,89 +102,7 @@
      */
     protected final String modifierTypeHeader;
 
-    public final Content overviewLabel;
-
-    public final Content defaultPackageLabel;
-
-    public final Content packageLabel;
-
-    public final Content moduleLabel;
-
-    public final Content useLabel;
-
-    public final Content prevLabel;
-
-    public final Content nextLabel;
-
-    public final Content prevclassLabel;
-
-    public final Content nextclassLabel;
-
-    public final Content summaryLabel;
-
-    public final Content detailLabel;
-
-    public final Content moduleSubNavLabel;
-
-    public final Content framesLabel;
-
-    public final Content noframesLabel;
-
-    public final Content treeLabel;
-
-    public final Content classLabel;
-
-    public final Content deprecatedLabel;
-
-    public final Content deprecatedPhrase;
-
-    public final Content allclassesLabel;
-
-    public final Content allpackagesLabel;
-
-    public final Content allmodulesLabel;
-
-    public final Content indexLabel;
-
-    public final Content helpLabel;
-
-    public final Content seeLabel;
-
-    public final Content descriptionLabel;
-
-    public final Content prevpackageLabel;
-
-    public final Content nextpackageLabel;
-
-    public final Content prevmoduleLabel;
-
-    public final Content nextmoduleLabel;
-
-    public final Content packagesLabel;
-
-    public final Content modulesLabel;
-
-    public final Content methodDetailsLabel;
-
-    public final Content annotationTypeDetailsLabel;
-
-    public final Content fieldDetailsLabel;
-
-    public final Content propertyDetailsLabel;
-
-    public final Content constructorDetailsLabel;
-
-    public final Content enumConstantsDetailsLabel;
-
-    public final Content specifiedByLabel;
-
-    public final Content overridesLabel;
-
-    public final Content descfrmClassLabel;
-
-    public final Content descfrmInterfaceLabel;
-
-    private final Writer writer;
+    private final DocFile docFile;
 
     protected Content script;
 
@@ -198,143 +112,45 @@
      *
      * @param path The directory path to be created for this file
      *             or null if none to be created.
-     * @exception IOException Exception raised by the FileWriter is passed on
-     * to next level.
-     * @exception UnsupportedEncodingException Exception raised by the
-     * OutputStreamWriter is passed on to next level.
      */
-    public HtmlWriter(Configuration configuration, DocPath path)
-            throws IOException, UnsupportedEncodingException {
-        writer = DocFile.createFileForOutput(configuration, path).openWriter();
+    public HtmlWriter(Configuration configuration, DocPath path) {
+        docFile = DocFile.createFileForOutput(configuration, path);
         this.configuration = configuration;
-        this.memberDetailsListPrinted = false;
+
+        // The following should be converted to shared Content objects
+        // and moved to Contents, but that will require additional
+        // changes at the use sites.
+        Resources resources = configuration.getResources();
         moduleTableHeader = Arrays.asList(
-            configuration.getText("doclet.Module"),
-            configuration.getText("doclet.Description"));
+            resources.getText("doclet.Module"),
+            resources.getText("doclet.Description"));
         packageTableHeader = new ArrayList<>();
-        packageTableHeader.add(configuration.getText("doclet.Package"));
-        packageTableHeader.add(configuration.getText("doclet.Description"));
+        packageTableHeader.add(resources.getText("doclet.Package"));
+        packageTableHeader.add(resources.getText("doclet.Description"));
         requiresTableHeader = new ArrayList<>();
-        requiresTableHeader.add(configuration.getText("doclet.Module"));
-        requiresTableHeader.add(configuration.getText("doclet.Description"));
+        requiresTableHeader.add(resources.getText("doclet.Module"));
+        requiresTableHeader.add(resources.getText("doclet.Description"));
         exportedPackagesTableHeader = new ArrayList<>();
-        exportedPackagesTableHeader.add(configuration.getText("doclet.Package"));
-        exportedPackagesTableHeader.add(configuration.getText("doclet.Module"));
-        exportedPackagesTableHeader.add(configuration.getText("doclet.Description"));
+        exportedPackagesTableHeader.add(resources.getText("doclet.Package"));
+        exportedPackagesTableHeader.add(resources.getText("doclet.Module"));
+        exportedPackagesTableHeader.add(resources.getText("doclet.Description"));
         usesTableHeader = new ArrayList<>();
-        usesTableHeader.add(configuration.getText("doclet.Type"));
-        usesTableHeader.add(configuration.getText("doclet.Description"));
+        usesTableHeader.add(resources.getText("doclet.Type"));
+        usesTableHeader.add(resources.getText("doclet.Description"));
         providesTableHeader = new ArrayList<>();
-        providesTableHeader.add(configuration.getText("doclet.Type"));
-        providesTableHeader.add(configuration.getText("doclet.Description"));
-        useTableSummary = configuration.getText("doclet.Use_Table_Summary",
-                configuration.getText("doclet.packages"));
-        modifierTypeHeader = configuration.getText("doclet.0_and_1",
-                configuration.getText("doclet.Modifier"),
-                configuration.getText("doclet.Type"));
-        overviewLabel = getResource("doclet.Overview");
-        defaultPackageLabel = new StringContent(DocletConstants.DEFAULT_PACKAGE_NAME);
-        packageLabel = getResource("doclet.Package");
-        moduleLabel = getResource("doclet.Module");
-        useLabel = getResource("doclet.navClassUse");
-        prevLabel = getResource("doclet.Prev");
-        nextLabel = getResource("doclet.Next");
-        prevclassLabel = getNonBreakResource("doclet.Prev_Class");
-        nextclassLabel = getNonBreakResource("doclet.Next_Class");
-        summaryLabel = getResource("doclet.Summary");
-        detailLabel = getResource("doclet.Detail");
-        moduleSubNavLabel = getResource("doclet.Module_Sub_Nav");
-        framesLabel = getResource("doclet.Frames");
-        noframesLabel = getNonBreakResource("doclet.No_Frames");
-        treeLabel = getResource("doclet.Tree");
-        classLabel = getResource("doclet.Class");
-        deprecatedLabel = getResource("doclet.navDeprecated");
-        deprecatedPhrase = getResource("doclet.Deprecated");
-        allclassesLabel = getNonBreakResource("doclet.All_Classes");
-        allpackagesLabel = getNonBreakResource("doclet.All_Packages");
-        allmodulesLabel = getNonBreakResource("doclet.All_Modules");
-        indexLabel = getResource("doclet.Index");
-        helpLabel = getResource("doclet.Help");
-        seeLabel = getResource("doclet.See");
-        descriptionLabel = getResource("doclet.Description");
-        prevpackageLabel = getNonBreakResource("doclet.Prev_Package");
-        nextpackageLabel = getNonBreakResource("doclet.Next_Package");
-        prevmoduleLabel = getNonBreakResource("doclet.Prev_Module");
-        nextmoduleLabel = getNonBreakResource("doclet.Next_Module");
-        packagesLabel = getResource("doclet.Packages");
-        modulesLabel = getResource("doclet.Modules");
-        methodDetailsLabel = getResource("doclet.Method_Detail");
-        annotationTypeDetailsLabel = getResource("doclet.Annotation_Type_Member_Detail");
-        fieldDetailsLabel = getResource("doclet.Field_Detail");
-        propertyDetailsLabel = getResource("doclet.Property_Detail");
-        constructorDetailsLabel = getResource("doclet.Constructor_Detail");
-        enumConstantsDetailsLabel = getResource("doclet.Enum_Constant_Detail");
-        specifiedByLabel = getResource("doclet.Specified_By");
-        overridesLabel = getResource("doclet.Overrides");
-        descfrmClassLabel = getResource("doclet.Description_From_Class");
-        descfrmInterfaceLabel = getResource("doclet.Description_From_Interface");
+        providesTableHeader.add(resources.getText("doclet.Type"));
+        providesTableHeader.add(resources.getText("doclet.Description"));
+        useTableSummary = resources.getText("doclet.Use_Table_Summary",
+                resources.getText("doclet.packages"));
+        modifierTypeHeader = resources.getText("doclet.0_and_1",
+                resources.getText("doclet.Modifier"),
+                resources.getText("doclet.Type"));
     }
 
     public void write(Content c) throws IOException {
-        c.write(writer, true);
-    }
-
-    public void close() throws IOException {
-        writer.close();
-    }
-
-    /**
-     * Get the configuration string as a content.
-     *
-     * @param key the key to look for in the configuration file
-     * @return a content tree for the text
-     */
-    public Content getResource(String key) {
-        return configuration.getResource(key);
-    }
-
-    /**
-     * Get the configuration string as a content, replacing spaces
-     * with non-breaking spaces.
-     *
-     * @param key the key to look for in the configuration file
-     * @return a content tree for the text
-     */
-    public Content getNonBreakResource(String key) {
-        String text = configuration.getText(key);
-        Content c = configuration.newContent();
-        int start = 0;
-        int p;
-        while ((p = text.indexOf(" ", start)) != -1) {
-            c.addContent(text.substring(start, p));
-            c.addContent(RawHtml.nbsp);
-            start = p + 1;
+        try (Writer writer = docFile.openWriter()) {
+            c.write(writer, true);
         }
-        c.addContent(text.substring(start));
-        return c;
-    }
-
-    /**
-     * Get the configuration string as a content.
-     *
-     * @param key the key to look for in the configuration file
-     * @param o   string or content argument added to configuration text
-     * @return a content tree for the text
-     */
-    public Content getResource(String key, Object o) {
-        return configuration.getResource(key, o);
-    }
-
-    /**
-     * Get the configuration string as a content.
-     *
-     * @param key the key to look for in the configuration file
-     * @param o1  string or content argument added to configuration text
-     * @param o2  string or content argument added to configuration text
-     * @return a content tree for the text
-     */
-    public Content getResource(String key, Object o0, Object o1) {
-        return configuration.getResource(key, o0, o1);
     }
 
     /**
@@ -343,21 +159,21 @@
      * @return an HtmlTree for the SCRIPT tag
      */
     protected HtmlTree getWinTitleScript(){
-        HtmlTree script = HtmlTree.SCRIPT();
+        HtmlTree scriptTree = HtmlTree.SCRIPT();
         if(winTitle != null && winTitle.length() > 0) {
-            String scriptCode = "<!--" + DocletConstants.NL +
-                    "    try {" + DocletConstants.NL +
-                    "        if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL +
-                    "            parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";" + DocletConstants.NL +
-                    "        }" + DocletConstants.NL +
-                    "    }" + DocletConstants.NL +
-                    "    catch(err) {" + DocletConstants.NL +
-                    "    }" + DocletConstants.NL +
-                    "//-->" + DocletConstants.NL;
-            RawHtml scriptContent = new RawHtml(scriptCode);
-            script.addContent(scriptContent);
+            String scriptCode = "<!--\n" +
+                    "    try {\n" +
+                    "        if (location.href.indexOf('is-external=true') == -1) {\n" +
+                    "            parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";\n" +
+                    "        }\n" +
+                    "    }\n" +
+                    "    catch(err) {\n" +
+                    "    }\n" +
+                    "//-->\n";
+            RawHtml scriptContent = new RawHtml(scriptCode.replace("\n", DocletConstants.NL));
+            scriptTree.addContent(scriptContent);
         }
-        return script;
+        return scriptTree;
     }
 
     /**
@@ -413,61 +229,61 @@
      * @return a content for the SCRIPT tag
      */
     protected Content getFramesJavaScript() {
-        HtmlTree script = HtmlTree.SCRIPT();
-        String scriptCode = DocletConstants.NL +
-                "    targetPage = \"\" + window.location.search;" + DocletConstants.NL +
-                "    if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
-                "        targetPage = targetPage.substring(1);" + DocletConstants.NL +
-                "    if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + DocletConstants.NL +
-                "        targetPage = \"undefined\";" + DocletConstants.NL +
-                "    function validURL(url) {" + DocletConstants.NL +
-                "        try {" + DocletConstants.NL +
-                "            url = decodeURIComponent(url);" + DocletConstants.NL +
-                "        }" + DocletConstants.NL +
-                "        catch (error) {" + DocletConstants.NL +
-                "            return false;" + DocletConstants.NL +
-                "        }" + DocletConstants.NL +
-                "        var pos = url.indexOf(\".html\");" + DocletConstants.NL +
-                "        if (pos == -1 || pos != url.length - 5)" + DocletConstants.NL +
-                "            return false;" + DocletConstants.NL +
-                "        var allowNumber = false;" + DocletConstants.NL +
-                "        var allowSep = false;" + DocletConstants.NL +
-                "        var seenDot = false;" + DocletConstants.NL +
-                "        for (var i = 0; i < url.length - 5; i++) {" + DocletConstants.NL +
-                "            var ch = url.charAt(i);" + DocletConstants.NL +
-                "            if ('a' <= ch && ch <= 'z' ||" + DocletConstants.NL +
-                "                    'A' <= ch && ch <= 'Z' ||" + DocletConstants.NL +
-                "                    ch == '$' ||" + DocletConstants.NL +
-                "                    ch == '_' ||" + DocletConstants.NL +
-                "                    ch.charCodeAt(0) > 127) {" + DocletConstants.NL +
-                "                allowNumber = true;" + DocletConstants.NL +
-                "                allowSep = true;" + DocletConstants.NL +
-                "            } else if ('0' <= ch && ch <= '9'" + DocletConstants.NL +
-                "                    || ch == '-') {" + DocletConstants.NL +
-                "                if (!allowNumber)" + DocletConstants.NL +
-                "                     return false;" + DocletConstants.NL +
-                "            } else if (ch == '/' || ch == '.') {" + DocletConstants.NL +
-                "                if (!allowSep)" + DocletConstants.NL +
-                "                    return false;" + DocletConstants.NL +
-                "                allowNumber = false;" + DocletConstants.NL +
-                "                allowSep = false;" + DocletConstants.NL +
-                "                if (ch == '.')" + DocletConstants.NL +
-                "                     seenDot = true;" + DocletConstants.NL +
-                "                if (ch == '/' && seenDot)" + DocletConstants.NL +
-                "                     return false;" + DocletConstants.NL +
-                "            } else {" + DocletConstants.NL +
-                "                return false;"+ DocletConstants.NL +
-                "            }" + DocletConstants.NL +
-                "        }" + DocletConstants.NL +
-                "        return true;" + DocletConstants.NL +
-                "    }" + DocletConstants.NL +
-                "    function loadFrames() {" + DocletConstants.NL +
-                "        if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
-                "             top.classFrame.location = top.targetPage;" + DocletConstants.NL +
-                "    }" + DocletConstants.NL;
-        RawHtml scriptContent = new RawHtml(scriptCode);
-        script.addContent(scriptContent);
-        return script;
+        HtmlTree scriptTree = HtmlTree.SCRIPT();
+        String scriptCode = "\n" +
+                "    targetPage = \"\" + window.location.search;\n" +
+                "    if (targetPage != \"\" && targetPage != \"undefined\")\n" +
+                "        targetPage = targetPage.substring(1);\n" +
+                "    if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))\n" +
+                "        targetPage = \"undefined\";\n" +
+                "    function validURL(url) {\n" +
+                "        try {\n" +
+                "            url = decodeURIComponent(url);\n" +
+                "        }\n" +
+                "        catch (error) {\n" +
+                "            return false;\n" +
+                "        }\n" +
+                "        var pos = url.indexOf(\".html\");\n" +
+                "        if (pos == -1 || pos != url.length - 5)\n" +
+                "            return false;\n" +
+                "        var allowNumber = false;\n" +
+                "        var allowSep = false;\n" +
+                "        var seenDot = false;\n" +
+                "        for (var i = 0; i < url.length - 5; i++) {\n" +
+                "            var ch = url.charAt(i);\n" +
+                "            if ('a' <= ch && ch <= 'z' ||\n" +
+                "                    'A' <= ch && ch <= 'Z' ||\n" +
+                "                    ch == '$' ||\n" +
+                "                    ch == '_' ||\n" +
+                "                    ch.charCodeAt(0) > 127) {\n" +
+                "                allowNumber = true;\n" +
+                "                allowSep = true;\n" +
+                "            } else if ('0' <= ch && ch <= '9'\n" +
+                "                    || ch == '-') {\n" +
+                "                if (!allowNumber)\n" +
+                "                     return false;\n" +
+                "            } else if (ch == '/' || ch == '.') {\n" +
+                "                if (!allowSep)\n" +
+                "                    return false;\n" +
+                "                allowNumber = false;\n" +
+                "                allowSep = false;\n" +
+                "                if (ch == '.')\n" +
+                "                     seenDot = true;\n" +
+                "                if (ch == '/' && seenDot)\n" +
+                "                     return false;\n" +
+                "            } else {\n" +
+                "                return false;\n" +
+                "            }\n" +
+                "        }\n" +
+                "        return true;\n" +
+                "    }\n" +
+                "    function loadFrames() {\n" +
+                "        if (targetPage != \"\" && targetPage != \"undefined\")\n" +
+                "             top.classFrame.location = top.targetPage;\n" +
+                "    }\n";
+        RawHtml scriptContent = new RawHtml(scriptCode.replace("\n", DocletConstants.NL));
+        scriptTree.addContent(scriptContent);
+        return scriptTree;
     }
 
     /**
@@ -487,7 +303,7 @@
             this.script = getWinTitleScript();
             body.addContent(script);
             Content noScript = HtmlTree.NOSCRIPT(
-                    HtmlTree.DIV(getResource("doclet.No_Script_Message")));
+                    HtmlTree.DIV(configuration.getContent("doclet.No_Script_Message")));
             body.addContent(noScript);
         }
         return body;
@@ -558,17 +374,6 @@
         return title;
     }
 
-    public String codeText(String text) {
-        return "<code>" + text + "</code>";
-    }
-
-    /**
-     * Return "&#38;nbsp;", non-breaking space.
-     */
-    public Content getSpace() {
-        return RawHtml.nbsp;
-    }
-
     /*
      * Returns a header for Modifier and Type column of a table.
      */
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/RawHtml.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/RawHtml.java	Tue Aug 09 13:22:57 2016 -0700
@@ -44,7 +44,7 @@
  */
 public class RawHtml extends Content {
 
-    private String rawHtmlContent;
+    private final String rawHtmlContent;
 
     public static final Content nbsp = new RawHtml("&nbsp;");
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java	Tue Aug 09 13:22:57 2016 -0700
@@ -58,7 +58,10 @@
     /**
      * The global configuration information for this run.
      */
-    public Configuration configuration;
+    private Configuration configuration;
+
+    protected Messages messages;
+
     /*
      *  a handle to our utility methods
      */
@@ -76,7 +79,7 @@
      */
     private boolean isValidDoclet() {
         if (!getClass().getName().equals(TOOLKIT_DOCLET_NAME)) {
-            configuration.message.error("doclet.Toolkit_Usage_Violation",
+            messages.error("doclet.Toolkit_Usage_Violation",
                 TOOLKIT_DOCLET_NAME);
             return false;
         }
@@ -96,6 +99,8 @@
         configuration.utils = new Utils(configuration);
         utils = configuration.utils;
         configuration.workArounds = new WorkArounds(configuration);
+        messages = configuration.getMessages();
+
         if (!isValidDoclet()) {
             return false;
         }
@@ -116,6 +121,7 @@
             }
             return false;
         } catch (Exception exc) {
+            exc.printStackTrace(System.err);
             return false;
         }
         return true;
@@ -146,14 +152,13 @@
      */
     private void startGeneration(DocletEnvironment root) throws Configuration.Fault, Exception {
         if (root.getIncludedClasses().isEmpty()) {
-            configuration.message.
-                error("doclet.No_Public_Classes_To_Document");
+            messages.error("doclet.No_Public_Classes_To_Document");
             return;
         }
         if (!configuration.setOptions()) {
             return;
         }
-        configuration.getDocletSpecificMsg().notice("doclet.build_version",
+        messages.notice("doclet.build_version",
             configuration.getDocletSpecificBuildDate());
         ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeFieldWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeFieldWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -124,9 +124,4 @@
      * @param annotationDocTree the content tree to which the tags will be added
      */
     public void addTags(Element member, Content annotationDocTree);
-
-    /**
-     * Close the writer.
-     */
-    public void close() throws IOException;
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeRequiredMemberWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeRequiredMemberWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -125,9 +125,4 @@
      * @param annotationDocTree the content tree to which the tags will be added
      */
     public void addTags(Element member, Content annotationDocTree);
-
-    /**
-     * Close the writer.
-     */
-    public void close() throws IOException;
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -156,11 +156,6 @@
     public void printDocument(Content contentTree) throws IOException;
 
     /**
-     * Close the writer.
-     */
-    public void close() throws IOException;
-
-    /**
      * Return the {@link TypeElement} being documented.
      *
      * @return the TypeElement representing the annotation being documented.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ClassWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ClassWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -197,11 +197,6 @@
     public void printDocument(Content contentTree) throws IOException;
 
     /**
-     * Close the writer.
-     */
-    public void close() throws IOException;
-
-    /**
      * Return the TypeElement being documented.
      *
      * @return the TypeElement being documented.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java	Tue Aug 09 13:22:57 2016 -0700
@@ -27,8 +27,6 @@
 
 import java.io.*;
 import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 import javax.lang.model.element.Element;
 import javax.lang.model.element.ModuleElement;
@@ -50,7 +48,6 @@
 import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
 import jdk.javadoc.internal.doclets.toolkit.util.Extern;
 import jdk.javadoc.internal.doclets.toolkit.util.Group;
-import jdk.javadoc.internal.doclets.toolkit.util.MessageRetriever;
 import jdk.javadoc.internal.doclets.toolkit.util.MetaKeywords;
 import jdk.javadoc.internal.doclets.toolkit.util.TypeElementCatalog;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
@@ -266,15 +263,6 @@
     public TypeElementCatalog typeElementCatalog;
 
     /**
-     * Message Retriever for the doclet, to retrieve message from the resource
-     * file for this Configuration, which is common for 1.1 and standard
-     * doclets.
-     *
-     * TODO:  Make this private!!!
-     */
-    public MessageRetriever message = null;
-
-    /**
      * True if user wants to suppress time stamp in output.
      * Default is false.
      */
@@ -309,6 +297,9 @@
 
     private List<GroupContainer> groups;
 
+    public abstract Messages getMessages();
+    public abstract Resources getResources();
+
     /**
      * Return the build date for the doclet.
      */
@@ -322,12 +313,6 @@
 
     public abstract boolean finishOptionSettings();
 
-    /**
-     * Return the doclet specific {@link MessageRetriever}
-     * @return the doclet specific MessageRetriever.
-     */
-    public abstract MessageRetriever getDocletSpecificMsg();
-
     public CommentUtils cmtUtils;
     public SortedSet<ModuleElement> modules;
 
@@ -354,11 +339,12 @@
      */
     public Map<ModuleElement, Set<PackageElement>> modulePackages;
 
+    protected static final String sharedResourceBundleName =
+            "jdk.javadoc.internal.doclets.toolkit.resources.doclets";
     /**
      * Constructor. Constructs the message retriever with resource file.
      */
     public Configuration() {
-        message = new MessageRetriever(this, "jdk.javadoc.internal.doclets.toolkit.resources.doclets");
         excludedDocFileDirs = new HashSet<>();
         excludedQualifiers = new HashSet<>();
         setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
@@ -578,7 +564,7 @@
                         sourcetab = -1;
                     }
                     if (sourcetab <= 0) {
-                        message.warning("doclet.sourcetab_warning");
+                        getMessages().warning("doclet.sourcetab_warning");
                         setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
                     }
                     return true;
@@ -696,7 +682,7 @@
      */
     private void initTagletManager(Set<List<String>> customTagStrs) {
         tagletManager = tagletManager == null ?
-            new TagletManager(nosince, showversion, showauthor, javafx, message) :
+            new TagletManager(nosince, showversion, showauthor, javafx, this) :
             tagletManager;
         for (List<String> args : customTagStrs) {
             if (args.get(0).equals("-taglet")) {
@@ -721,7 +707,8 @@
             } else if (tokens.size() >= 3) {
                 tagletManager.addNewSimpleCustomTag(tokens.get(0), tokens.get(2), tokens.get(1));
             } else {
-                message.error("doclet.Error_invalid_custom_tag_argument", args.get(1));
+                Messages messages = getMessages();
+                messages.error("doclet.Error_invalid_custom_tag_argument", args.get(1));
             }
         }
     }
@@ -893,123 +880,69 @@
                 : utils.getFullyQualifiedName(te);
     }
 
-    public String getText(String key) {
-        // Check the doclet specific properties file.
-        MessageRetriever docletMessage = getDocletSpecificMsg();
-        if (docletMessage.containsKey(key)) {
-            return docletMessage.getText(key);
-        }
-        // Check the shared properties file.
-        return message.getText(key);
-    }
+    /**
+     * Convenience method to obtain a resource from the doclet's
+     * {@link Resources resources}.
+     * Equivalent to <code>getResources.getText(key);</code>.
+     * @param key the key for the desired string
+     * @return the string for the given key
+     * @throws MissingResourceException if the key is not found in either
+     *  bundle.
+     */
+    public abstract String getText(String key);
 
-    public String getText(String key, String a1) {
-        // Check the doclet specific properties file.
-        MessageRetriever docletMessage = getDocletSpecificMsg();
-        if (docletMessage.containsKey(key)) {
-            return docletMessage.getText(key, a1);
-        }
-        // Check the shared properties file.
-        return message.getText(key, a1);
-    }
+    /**
+     * Convenience method to obtain a resource from the doclet's
+     * {@link Resources resources}.
+     * Equivalent to <code>getResources.getText(key, args);</code>.
+     * @param key the key for the desired string
+     * @param args values to be substituted into the resulting string
+     * @return the string for the given key
+     * @throws MissingResourceException if the key is not found in either
+     *  bundle.
+     */
+    public abstract String getText(String key, String... args);
 
-    public String getText(String key, String a1, String a2) {
-        // Check the doclet specific properties file.
-        MessageRetriever docletMessage = getDocletSpecificMsg();
-        if (docletMessage.containsKey(key)) {
-            return docletMessage.getText(key, a1, a2);
-        }
-        // Check the shared properties file.
-        return message.getText(key, a1, a2);
-    }
+    /**
+     * Convenience method to obtain a resource from the doclet's
+     * {@link Resources resources} as a {@code Content} object.
+     *
+     * @param key the key for the desired string
+     * @return a content tree for the text
+     */
+    public abstract Content getContent(String key);
 
-    public String getText(String key, String a1, String a2, String a3) {
-        // Check the doclet specific properties file.
-        MessageRetriever docletMessage = getDocletSpecificMsg();
-        if (docletMessage.containsKey(key)) {
-            return docletMessage.getText(key, a1, a2, a3);
-        }
-        // Check the shared properties file.
-        return message.getText(key, a1, a2, a3);
-    }
+    /**
+     * Convenience method to obtain a resource from the doclet's
+     * {@link Resources resources} as a {@code Content} object.
+     *
+     * @param key the key for the desired string
+     * @param o   string or content argument added to configuration text
+     * @return a content tree for the text
+     */
+    public abstract Content getContent(String key, Object o);
 
-    public abstract Content newContent();
+    /**
+     * Convenience method to obtain a resource from the doclet's
+     * {@link Resources resources} as a {@code Content} object.
+     *
+     * @param key the key for the desired string
+     * @param o1 resource argument
+     * @param o2 resource argument
+     * @return a content tree for the text
+     */
+    public abstract Content getContent(String key, Object o1, Object o2);
 
     /**
      * Get the configuration string as a content.
      *
-     * @param key the key to look for in the configuration file
-     * @return a content tree for the text
-     */
-    public Content getResource(String key) {
-        Content c = newContent();
-        c.addContent(getText(key));
-        return c;
-    }
-
-    /**
-     * Get the configuration string as a content.
-     *
-     * @param key the key to look for in the configuration file
-     * @param o   string or content argument added to configuration text
-     * @return a content tree for the text
-     */
-    public Content getResource(String key, Object o) {
-        return getResource(key, o, null, null);
-    }
-
-    /**
-     * Get the configuration string as a content.
-     *
-     * @param key the key to look for in the configuration file
-     * @param o1 resource argument
-     * @param o2 resource argument
-     * @return a content tree for the text
-     */
-    public Content getResource(String key, Object o1, Object o2) {
-        return getResource(key, o1, o2, null);
-    }
-
-    /**
-     * Get the configuration string as a content.
-     *
-     * @param key the key to look for in the configuration file
+     * @param key the key for the desired string
      * @param o0  string or content argument added to configuration text
      * @param o1  string or content argument added to configuration text
      * @param o2  string or content argument added to configuration text
      * @return a content tree for the text
      */
-    public Content getResource(String key, Object o0, Object o1, Object o2) {
-        Content c = newContent();
-        Pattern p = Pattern.compile("\\{([012])\\}");
-        String text = getText(key);
-        Matcher m = p.matcher(text);
-        int start = 0;
-        while (m.find(start)) {
-            c.addContent(text.substring(start, m.start()));
-
-            Object o = null;
-            switch (m.group(1).charAt(0)) {
-                case '0': o = o0; break;
-                case '1': o = o1; break;
-                case '2': o = o2; break;
-            }
-
-            if (o == null) {
-                c.addContent("{" + m.group(1) + "}");
-            } else if (o instanceof String) {
-                c.addContent((String) o);
-            } else if (o instanceof Content) {
-                c.addContent((Content) o);
-            }
-
-            start = m.end();
-        }
-
-        c.addContent(text.substring(start));
-        return c;
-    }
-
+    public abstract Content getContent(String key, Object o0, Object o1, Object o2);
 
     /**
      * Return true if the TypeElement element is getting documented, depending upon
@@ -1110,7 +1043,7 @@
 
         private String getOptionsMessage(String key) {
             try {
-                return c.getDocletSpecificMsg().getText(key, (Object[]) null);
+                return c.getResources().getText(key);
             } catch (MissingResourceException ignore) {
                 return "";
             }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ConstantsSummaryWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ConstantsSummaryWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -47,11 +47,6 @@
 public interface ConstantsSummaryWriter {
 
     /**
-     * Close the writer.
-     */
-    public abstract void close() throws IOException;
-
-    /**
      * Get the header for the constant summary documentation.
      *
      * @return header that needs to be added to the documentation
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ConstructorWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ConstructorWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -119,9 +119,4 @@
      * @param foundNonPubConstructor true if we found a non public constructor.
      */
     public void setFoundNonPubConstructor(boolean foundNonPubConstructor);
-
-    /**
-     * Close the writer.
-     */
-    public void close() throws IOException;
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/EnumConstantWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/EnumConstantWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -112,9 +112,4 @@
      * @return content tree for the enum constants documentation
      */
     public Content getEnumConstants(Content enumConstantsTree, boolean isLastContent);
-
-    /**
-     * Close the writer.
-     */
-    public void close() throws IOException;
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/FieldWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/FieldWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -113,9 +113,4 @@
      * @return content tree for the field documentation
      */
     public Content getFieldDoc(Content fieldDocTree, boolean isLastContent);
-
-    /**
-     * Close the writer.
-     */
-    public void close() throws IOException;
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/MemberSummaryWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/MemberSummaryWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -122,9 +122,4 @@
      * @return a content tree for the member
      */
     public Content getMemberTree(Content memberTree);
-
-    /**
-     * Close the writer.
-     */
-    public void close() throws IOException;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Messages.java	Tue Aug 09 13:22:57 2016 -0700
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.javadoc.internal.doclets.toolkit;
+
+import javax.lang.model.element.Element;
+import javax.tools.Diagnostic;
+
+import com.sun.source.util.DocTreePath;
+import jdk.javadoc.doclet.Reporter;
+
+import static javax.tools.Diagnostic.Kind.*;
+
+/**
+ * Provides standardized access to the diagnostic reporting facilities
+ * for a doclet.
+ *
+ * Messages are specified by resource keys to be found in the doclet's
+ * {@link Resources resources}.  Values can be substituted into the
+ * strings obtained from the resource files.
+ *
+ * Messages are reported to the doclet's {@link Reporter reporter}.
+ */
+public class Messages {
+    private final Configuration configuration;
+    private final Resources resources;
+    private Reporter reporter;
+
+    /**
+     * Creates a {@code Messages} object to provide standardized access to
+     * the doclet's diagnostic reporting mechanisms.
+     *
+     * @param configuration the doclet's configuration, used to access
+     *  the doclet's resources, reporter, and additional methods and state
+     *  used to filter out messages, if any, which should be suppressed.
+     */
+    public Messages(Configuration configuration) {
+        this.configuration = configuration;
+        resources = configuration.getResources();
+    }
+
+    // ***** Errors *****
+
+    /**
+     * Reports an error message to the doclet's reporter.
+     *
+     * @param key the name of a resource containing the message to be printed
+     * @param args optional arguments to be replaced in the message.
+     */
+    public void error(String key, Object... args) {
+        report(ERROR, resources.getText(key, args));
+    }
+
+    /**
+     * Reports an error message to the doclet's reporter.
+     *
+     * @param path a path identifying the position to be included with
+     *  the message
+     * @param key the name of a resource containing the message to be printed
+     * @param args optional arguments to be replaced in the message.
+     */
+    public void error(DocTreePath path, String key, Object... args) {
+        report(ERROR, path, resources.getText(key, args));
+    }
+
+    // ***** Warnings *****
+
+    /**
+     * Reports a warning message to the doclet's reporter.
+     *
+     * @param key the name of a resource containing the message to be printed
+     * @param args optional arguments to be replaced in the message.
+     */
+    public void warning(String key, Object... args) {
+        report(WARNING, resources.getText(key, args));
+    }
+
+    /**
+     * Reports a warning message to the doclet's reporter.
+     *
+     * @param path a path identifying the position to be included with
+     *  the message
+     * @param key the name of a resource containing the message to be printed
+     * @param args optional arguments to be replaced in the message.
+     */
+    public void warning(DocTreePath path, String key, Object... args) {
+        if (configuration.showMessage(path, key))
+            report(WARNING, path, resources.getText(key, args));
+    }
+
+    /**
+     * Reports a warning message to the doclet's reporter.
+     *
+     * @param e an element identifying the declaration whose position should
+     *  to be included with the message
+     * @param key the name of a resource containing the message to be printed
+     * @param args optional arguments to be replaced in the message.
+     */
+    public void warning(Element e, String key, Object... args) {
+        if (configuration.showMessage(e, key)) {
+            report(WARNING, e, resources.getText(key, args));
+        }
+    }
+
+    // ***** Notices *****
+
+    /**
+     * Reports an informational notice to the doclet's reporter.
+     *
+     * @param key the name of a resource containing the message to be printed
+     * @param args optional arguments to be replaced in the message.
+     */
+    public void notice(String key, Object... args) {
+        if (!configuration.quiet) {
+            report(NOTE, resources.getText(key, args));
+        }
+    }
+
+    // ***** Internal support *****
+
+    private void report(Diagnostic.Kind k, String msg) {
+        initReporter();
+        reporter.print(k, msg);
+    }
+
+    private void report(Diagnostic.Kind k, DocTreePath p, String msg) {
+        initReporter();
+        reporter.print(k, p, msg);
+    }
+
+    private void report(Diagnostic.Kind k, Element e, String msg) {
+        initReporter();
+        reporter.print(k, e, msg);
+    }
+
+    // Lazy init the reporter for now, until we can fix/improve
+    // the init of ConfigurationImpl in HtmlDoclet (and similar.)
+    private void initReporter() {
+        if (reporter == null) {
+            reporter = configuration.reporter;
+        }
+    }
+}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/MethodWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/MethodWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -114,9 +114,4 @@
      * @return content tree for the method documentation
      */
     public Content getMethodDoc(Content methodDocTree, boolean isLastContent);
-
-    /**
-     * Close the writer.
-     */
-    public void close() throws IOException;
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ModuleSummaryWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ModuleSummaryWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -132,10 +132,4 @@
      * @param contentTree the content tree that will be printed
      */
     public abstract void printDocument(Content contentTree) throws IOException;
-
-    /**
-     * Close the writer.
-     */
-    public abstract void close() throws IOException;
-
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/NestedClassWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/NestedClassWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -40,9 +40,4 @@
  */
 
 public interface NestedClassWriter {
-
-    /**
-     * Close the writer.
-     */
-    public void close() throws IOException;
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/PackageSummaryWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/PackageSummaryWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -121,9 +121,4 @@
      */
     public abstract void printDocument(Content contentTree) throws IOException;
 
-    /**
-     * Close the writer.
-     */
-    public abstract void close() throws IOException;
-
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/PropertyWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/PropertyWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -112,9 +112,4 @@
      * @return content tree for the property documentation
      */
     public Content getPropertyDoc(Content propertyDocTree, boolean isLastContent);
-
-    /**
-     * Close the writer.
-     */
-    public void close() throws IOException;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Resources.java	Tue Aug 09 13:22:57 2016 -0700
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.toolkit;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Access to the localizable resources used by a doclet.
+ * The resources are split across two resource bundles:
+ * one that contains format-neutral strings common to
+ * all supported formats, and one that contains strings
+ * specific to the selected doclet, such as the standard
+ * HTML doclet.
+ */
+public class Resources {
+    private final Configuration configuration;
+    private final String commonBundleName;
+    private final String docletBundleName;
+
+    protected ResourceBundle commonBundle;
+    protected ResourceBundle docletBundle;
+
+    /**
+     * Creates a {@code Resources} to provide access the resource
+     * bundles used by a doclet.
+     *
+     * @param configuration the configuration for the doclet,
+     *  to provide access the locale to be used when accessing the
+     *  names resource bundles.
+     * @param commonBundleName the name of the bundle containing the strings
+     *  common to all output formats
+     * @param docletBundleName the name of the bundle containing the strings
+     *  specific to a particular format
+     */
+    public Resources(Configuration configuration, String commonBundleName, String docletBundleName) {
+        this.configuration = configuration;
+        this.commonBundleName = commonBundleName;
+        this.docletBundleName = docletBundleName;
+    }
+
+    /**
+     * Gets the string for the given key from one of the doclet's
+     * resource bundles.
+     *
+     * The more specific bundle is checked first;
+     * if it is not there, the common bundle is then checked.
+     *
+     * @param key the key for the desired string
+     * @return the string for the given key
+     * @throws MissingResourceException if the key is not found in either
+     *  bundle.
+     */
+    public String getText(String key) throws MissingResourceException {
+        initBundles();
+
+        if (docletBundle.containsKey(key))
+            return docletBundle.getString(key);
+
+        return commonBundle.getString(key);
+    }
+    /**
+     * Gets the string for the given key from one of the doclet's
+     * resource bundles, substituting additional arguments into
+     * into the resulting string with {@link MessageFormat#format}.
+     *
+     * The more specific bundle is checked first;
+     * if it is not there, the common bundle is then checked.
+     *
+     * @param key the key for the desired string
+     * @param args values to be substituted into the resulting string
+     * @return the string for the given key
+     * @throws MissingResourceException if the key is not found in either
+     *  bundle.
+     */
+    public String getText(String key, Object... args) throws MissingResourceException {
+        return MessageFormat.format(getText(key), args);
+    }
+
+    /**
+     * Lazily initializes the bundles. This is (currently) necessary because
+     * this object may be created before the locale to be used is known.
+     */
+    protected void initBundles() {
+        if (commonBundle == null) {
+            Locale locale = configuration.getLocale();
+            this.commonBundle = ResourceBundle.getBundle(commonBundleName, locale);
+            this.docletBundle = ResourceBundle.getBundle(docletBundleName, locale);
+        }
+    }
+}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/SerializedFormWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/SerializedFormWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -138,11 +138,6 @@
     public SerialMethodWriter getSerialMethodWriter(TypeElement typeElement);
 
     /**
-     * Close the writer.
-     */
-    public abstract void close() throws IOException;
-
-    /**
      * Get the serialized content.
      *
      * @param serializedTreeContent content for serialized data
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractBuilder.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractBuilder.java	Tue Aug 09 13:22:57 2016 -0700
@@ -33,6 +33,7 @@
 
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 
@@ -89,6 +90,7 @@
      */
     protected final Configuration configuration;
 
+    protected final Messages messages;
     protected final Utils utils;
 
     /**
@@ -112,6 +114,7 @@
      */
     public AbstractBuilder(Context c) {
         this.configuration = c.configuration;
+        this.messages = configuration.getMessages();
         this.utils = configuration.utils;
         this.containingPackagesSeen = c.containingPackagesSeen;
         this.layoutParser = c.layoutParser;
@@ -144,13 +147,18 @@
                     new Class<?>[]{XMLNode.class, Content.class},
                     new Object[]{node, contentTree});
         } catch (NoSuchMethodException e) {
-            e.printStackTrace();
+            e.printStackTrace(System.err);
             configuration.reporter.print(ERROR, "Unknown element: " + component);
             throw new DocletAbortException(e);
         } catch (InvocationTargetException e) {
-            throw new DocletAbortException(e.getCause());
+            Throwable cause = e.getCause();
+            if (cause instanceof DocletAbortException) {
+                throw (DocletAbortException) cause;
+            } else {
+                throw new DocletAbortException(e.getCause());
+            }
         } catch (Exception e) {
-            e.printStackTrace();
+            e.printStackTrace(System.err);
             configuration.reporter.print(ERROR, "Exception " +
                     e.getClass().getName() +
                     " thrown while processing element: " + component);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java	Tue Aug 09 13:22:57 2016 -0700
@@ -124,7 +124,6 @@
          writer.addAnnotationContentTree(contentTree, annotationContentTree);
          writer.addFooter(contentTree);
          writer.printDocument(contentTree);
-         writer.close();
          copyDocFiles();
      }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java	Tue Aug 09 13:22:57 2016 -0700
@@ -152,7 +152,6 @@
          writer.addClassContentTree(contentTree, classContentTree);
          writer.addFooter(contentTree);
          writer.printDocument(contentTree);
-         writer.close();
          copyDocFiles();
      }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java	Tue Aug 09 13:22:57 2016 -0700
@@ -153,7 +153,6 @@
         buildChildren(node, contentTree);
         writer.addFooter(contentTree);
         writer.printDocument(contentTree);
-        writer.close();
     }
 
     /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java	Tue Aug 09 13:22:57 2016 -0700
@@ -132,7 +132,6 @@
         buildChildren(node, contentTree);
         moduleWriter.addModuleFooter(contentTree);
         moduleWriter.printDocument(contentTree);
-        moduleWriter.close();
         // TEMPORARY:
         // The use of SOURCE_PATH on the next line is temporary. As we transition into the
         // modules world, this should migrate into using a location for the appropriate module
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java	Tue Aug 09 13:22:57 2016 -0700
@@ -131,7 +131,6 @@
         buildChildren(node, contentTree);
         packageWriter.addPackageFooter(contentTree);
         packageWriter.printDocument(contentTree);
-        packageWriter.close();
         utils.copyDocFiles(packageElement);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java	Tue Aug 09 13:22:57 2016 -0700
@@ -140,7 +140,6 @@
             throw new DocletAbortException(e);
         }
         build(layoutParser.parseXML(NAME), contentTree);
-        writer.close();
     }
 
     /**
@@ -162,7 +161,6 @@
         buildChildren(node, serializedTree);
         writer.addFooter(serializedTree);
         writer.printDocument(serializedTree);
-        writer.close();
     }
 
     /**
@@ -362,7 +360,7 @@
                 && utils.getSerialDataTrees(method).isEmpty()) {
             if (configuration.serialwarn) {
                 TypeElement encl  = (TypeElement) method.getEnclosingElement();
-                configuration.getDocletSpecificMsg().warning(currentMember,
+                messages.warning(currentMember,
                         "doclet.MissingSerialDataTag", encl.getQualifiedName().toString(),
                         method.getSimpleName().toString());
             }
@@ -526,7 +524,7 @@
         // Process default Serializable field.
         if ((utils.getSerialTrees(field).isEmpty()) /*&& ! field.isSynthetic()*/
                 && configuration.serialwarn) {
-            configuration.message.warning(field,
+            messages.warning(field,
                     "doclet.MissingSerialTag", utils.getFullyQualifiedName(te),
                     utils.getSimpleName(field));
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritDocTaglet.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritDocTaglet.java	Tue Aug 09 13:22:57 2016 -0700
@@ -31,6 +31,7 @@
 import com.sun.source.doctree.DocTree;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFinder.Input;
@@ -135,6 +136,7 @@
             Element e, DocTree holderTag, boolean isFirstSentence) {
         Content replacement = writer.getOutputInstance();
         Configuration configuration = writer.configuration();
+        Messages messages = configuration.getMessages();
         Utils utils = configuration.utils;
         CommentHelper ch = utils.getCommentHelper(e);
         Taglet inheritableTaglet = holderTag == null
@@ -147,7 +149,7 @@
                         ? utils.flatSignature((ExecutableElement)e)
                         : "");
                 //This tag does not support inheritence.
-                configuration.message.warning(e, "doclet.noInheritedDoc", message);
+                messages.warning(e, "doclet.noInheritedDoc", message);
         }
         Input input = new DocFinder.Input(utils, e,
                 (InheritableTaglet) inheritableTaglet, new DocFinder.DocTreeInfo(holderTag, e),
@@ -165,7 +167,7 @@
                     ((utils.isExecutableElement(e))
                         ? utils.flatSignature((ExecutableElement)e)
                         : "");
-            configuration.message.warning(e, "doclet.noInheritedDoc", message);
+            messages.warning(e, "doclet.noInheritedDoc", message);
         }
         return replacement;
     }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ParamTaglet.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ParamTaglet.java	Tue Aug 09 13:22:57 2016 -0700
@@ -34,6 +34,7 @@
 import com.sun.source.doctree.DocTree;
 import com.sun.source.doctree.ParamTree;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFinder.Input;
@@ -288,6 +289,7 @@
     private Content processParamTags(Element e, boolean isParams,
             List<? extends DocTree> paramTags, Map<String, String> rankMap, TagletWriter writer,
             Set<String> alreadyDocumented) {
+        Messages messages = writer.configuration().getMessages();
         Content result = writer.getOutputInstance();
         if (!paramTags.isEmpty()) {
             CommentHelper ch = writer.configuration().utils.getCommentHelper(e);
@@ -296,22 +298,22 @@
                         ? ch.getParameterName(dt)
                         : "<" + ch.getParameterName(dt) + ">";
                 if (!rankMap.containsKey(ch.getParameterName(dt))) {
-                    writer.getMsgRetriever().warning(ch.getDocTreePath(dt),
-                                                     isParams ?
-                                                     "doclet.Parameters_warn" :
-                                                     "doclet.Type_Parameters_warn",
-                                                     paramName);
+                    messages.warning(ch.getDocTreePath(dt),
+                            isParams
+                                    ? "doclet.Parameters_warn"
+                                    : "doclet.Type_Parameters_warn",
+                            paramName);
                 }
                 String rank = rankMap.get(ch.getParameterName(dt));
                 if (rank != null && alreadyDocumented.contains(rank)) {
-                    writer.getMsgRetriever().warning(ch.getDocTreePath(dt),
-                                                     isParams ?
-                                                     "doclet.Parameters_dup_warn" :
-                                                     "doclet.Type_Parameters_dup_warn",
-                                                     paramName);
+                    messages.warning(ch.getDocTreePath(dt),
+                            isParams
+                                    ? "doclet.Parameters_dup_warn"
+                                    : "doclet.Type_Parameters_dup_warn",
+                            paramName);
                 }
                 result.addContent(processParamTag(e, isParams, writer, dt,
-                                                  ch.getParameterName(dt), alreadyDocumented.isEmpty()));
+                        ch.getParameterName(dt), alreadyDocumented.isEmpty()));
                 alreadyDocumented.add(rank);
             }
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ReturnTaglet.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ReturnTaglet.java	Tue Aug 09 13:22:57 2016 -0700
@@ -34,6 +34,7 @@
 
 import com.sun.source.doctree.DocTree;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
 import jdk.javadoc.internal.doclets.toolkit.util.DocFinder.Input;
@@ -87,6 +88,7 @@
      * {@inheritDoc}
      */
     public Content getTagletOutput(Element holder, TagletWriter writer) {
+        Messages messages = writer.configuration().getMessages();
         Utils utils = writer.configuration().utils;
         TypeMirror returnType = utils.getReturnType((ExecutableElement)holder);
         List<? extends DocTree> tags = utils.getBlockTags(holder, name);
@@ -94,7 +96,7 @@
         //Make sure we are not using @return tag on method with void return type.
         if (returnType != null && utils.isVoid(returnType)) {
             if (!tags.isEmpty()) {
-                writer.getMsgRetriever().warning(holder, "doclet.Return_tag_on_void_method");
+                messages.warning(holder, "doclet.Return_tag_on_void_method");
             }
             return null;
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java	Tue Aug 09 13:22:57 2016 -0700
@@ -26,7 +26,6 @@
 package jdk.javadoc.internal.doclets.toolkit.taglets;
 
 import java.io.*;
-import java.lang.reflect.Method;
 import java.util.*;
 
 import javax.lang.model.element.Element;
@@ -42,9 +41,11 @@
 import com.sun.source.doctree.DocTree;
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
+import jdk.javadoc.internal.doclets.toolkit.Configuration;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
+import jdk.javadoc.internal.doclets.toolkit.Resources;
 
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
-import jdk.javadoc.internal.doclets.toolkit.util.MessageRetriever;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 
 import static javax.tools.DocumentationTool.Location.*;
@@ -126,10 +127,8 @@
      */
     private List<Taglet> serializedFormTags;
 
-    /**
-     * The message retriever that will be used to print error messages.
-     */
-    private final MessageRetriever message;
+    private final Messages messages;
+    private final Resources resources;
 
     /**
      * Keep track of standard tags.
@@ -191,7 +190,7 @@
      */
     public TagletManager(boolean nosince, boolean showversion,
                          boolean showauthor, boolean javafx,
-                         MessageRetriever message) {
+                         Configuration configuration) {
         overridenStandardTags = new HashSet<>();
         potentiallyConflictingTags = new HashSet<>();
         standardTags = new HashSet<>();
@@ -202,7 +201,8 @@
         this.showversion = showversion;
         this.showauthor = showauthor;
         this.javafx = javafx;
-        this.message = message;
+        this.messages = configuration.getMessages();
+        this.resources = configuration.getResources();
         initStandardTaglets();
         initStandardTagsLowercase();
     }
@@ -260,9 +260,9 @@
                 customTags.remove(tname);
             }
             customTags.put(tname, newLegacy);
-            message.notice("doclet.Notice_taglet_registered", classname);
+            messages.notice("doclet.Notice_taglet_registered", classname);
         } catch (Exception exc) {
-            message.error("doclet.Error_taglet_not_registered", exc.getClass().getName(), classname);
+            messages.error("doclet.Error_taglet_not_registered", exc.getClass().getName(), classname);
         }
     }
 
@@ -359,10 +359,10 @@
             }
             if (! (standardTags.contains(name) || customTags.containsKey(name))) {
                 if (standardTagsLowercase.contains(Utils.toLowerCase(name))) {
-                    message.warning(ch.getDocTreePath(tag), "doclet.UnknownTagLowercase", ch.getTagName(tag));
+                    messages.warning(ch.getDocTreePath(tag), "doclet.UnknownTagLowercase", ch.getTagName(tag));
                     continue;
                 } else {
-                    message.warning(ch.getDocTreePath(tag), "doclet.UnknownTag", ch.getTagName(tag));
+                    messages.warning(ch.getDocTreePath(tag), "doclet.UnknownTag", ch.getTagName(tag));
                     continue;
                 }
             }
@@ -481,7 +481,7 @@
             }
             combined_locations.append(locations[i]);
         }
-        message.warning(ch.getDocTreePath(tag), "doclet.tag_misuse",
+        messages.warning(ch.getDocTreePath(tag), "doclet.tag_misuse",
             "@" + taglet.getName(), holderType, combined_locations.toString());
     }
 
@@ -698,17 +698,17 @@
         addStandardTaglet(new ThrowsTaglet());
         addStandardTaglet(new SimpleTaglet(EXCEPTION.tagName, null,
                 SimpleTaglet.METHOD + SimpleTaglet.CONSTRUCTOR));
-        addStandardTaglet(!nosince, new SimpleTaglet(SINCE.tagName, message.getText("doclet.Since"),
+        addStandardTaglet(!nosince, new SimpleTaglet(SINCE.tagName, resources.getText("doclet.Since"),
                 SimpleTaglet.ALL));
-        addStandardTaglet(showversion, new SimpleTaglet(VERSION.tagName, message.getText("doclet.Version"),
+        addStandardTaglet(showversion, new SimpleTaglet(VERSION.tagName, resources.getText("doclet.Version"),
                 SimpleTaglet.MODULE + SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW));
-        addStandardTaglet(showauthor, new SimpleTaglet(AUTHOR.tagName, message.getText("doclet.Author"),
+        addStandardTaglet(showauthor, new SimpleTaglet(AUTHOR.tagName, resources.getText("doclet.Author"),
                 SimpleTaglet.MODULE + SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW));
-        addStandardTaglet(new SimpleTaglet(SERIAL_DATA.tagName, message.getText("doclet.SerialData"),
+        addStandardTaglet(new SimpleTaglet(SERIAL_DATA.tagName, resources.getText("doclet.SerialData"),
                 SimpleTaglet.EXCLUDED));
-        addStandardTaglet(new SimpleTaglet(HIDDEN.tagName, message.getText("doclet.Hidden"),
+        addStandardTaglet(new SimpleTaglet(HIDDEN.tagName, resources.getText("doclet.Hidden"),
                 SimpleTaglet.FIELD + SimpleTaglet.METHOD + SimpleTaglet.TYPE));
-        customTags.put((temp = new SimpleTaglet("factory", message.getText("doclet.Factory"),
+        customTags.put((temp = new SimpleTaglet("factory", resources.getText("doclet.Factory"),
                 SimpleTaglet.METHOD)).getName(), temp);
         addStandardTaglet(new SeeTaglet());
         //Standard inline tags
@@ -735,9 +735,9 @@
         addStandardTaglet(new PropertyGetterTaglet());
         addStandardTaglet(new PropertySetterTaglet());
         addStandardTaglet(new SimpleTaglet("propertyDescription",
-                message.getText("doclet.PropertyDescription"),
+                resources.getText("doclet.PropertyDescription"),
                 SimpleTaglet.FIELD + SimpleTaglet.METHOD));
-        addStandardTaglet(new SimpleTaglet("defaultValue", message.getText("doclet.DefaultValue"),
+        addStandardTaglet(new SimpleTaglet("defaultValue", resources.getText("doclet.DefaultValue"),
             SimpleTaglet.FIELD + SimpleTaglet.METHOD));
         addStandardTaglet(new SimpleTaglet("treatAsPrivate", null,
                 SimpleTaglet.FIELD + SimpleTaglet.METHOD + SimpleTaglet.TYPE));
@@ -790,7 +790,7 @@
                     result += ", ";
                 }
             }
-            message.notice(noticeKey, result);
+            messages.notice(noticeKey, result);
         }
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -36,7 +36,6 @@
 import jdk.javadoc.internal.doclets.toolkit.Content;
 import jdk.javadoc.internal.doclets.toolkit.taglets.Taglet.UnsupportedTagletOperationException;
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
-import jdk.javadoc.internal.doclets.toolkit.util.MessageRetriever;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 
 /**
@@ -107,13 +106,6 @@
     protected abstract Content literalTagOutput(Element element, DocTree tag);
 
     /**
-     * Returns {@link MessageRetriever} for output purposes.
-     *
-     * @return {@link MessageRetriever} for output purposes.
-     */
-    protected abstract MessageRetriever getMsgRetriever();
-
-    /**
      * Return the header for the param tags.
      *
      * @param header the header to display.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ValueTaglet.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ValueTaglet.java	Tue Aug 09 13:22:57 2016 -0700
@@ -34,6 +34,7 @@
 import com.sun.source.doctree.DocTree;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
 import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
 
@@ -181,15 +182,16 @@
      */
     public Content getTagletOutput(Element holder, DocTree tag, TagletWriter writer) {
         Utils utils = writer.configuration().utils;
+        Messages messages = writer.configuration().getMessages();
         VariableElement field = getVariableElement(holder, writer.configuration(), tag);
         if (field == null) {
             if (tag.toString().isEmpty()) {
                 //Invalid use of @value
-                writer.getMsgRetriever().warning(holder,
+                messages.warning(holder,
                         "doclet.value_tag_invalid_use");
             } else {
                 //Reference is unknown.
-                writer.getMsgRetriever().warning(holder,
+                messages.warning(holder,
                         "doclet.value_tag_invalid_reference", tag.toString());
             }
         } else if (field.getConstantValue() != null) {
@@ -202,7 +204,7 @@
             );
         } else {
             //Referenced field is not a constant.
-            writer.getMsgRetriever().warning(holder,
+            messages.warning(holder,
                 "doclet.value_tag_invalid_constant", utils.getSimpleName(field));
         }
         return writer.getOutputInstance();
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassTree.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassTree.java	Tue Aug 09 13:22:57 2016 -0700
@@ -44,6 +44,7 @@
 
 import jdk.javadoc.doclet.DocletEnvironment;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 
 /**
  * Build Class Hierarchy for all the Classes. This class builds the Class
@@ -105,9 +106,12 @@
      * true.
      */
     public ClassTree(Configuration configuration, boolean noDeprecated) {
-        configuration.message.notice("doclet.Building_Tree");
         this.configuration = configuration;
         this.utils = configuration.utils;
+
+        Messages messages = configuration.getMessages();
+        messages.notice("doclet.Building_Tree");
+
         comparator = utils.makeClassUseComparator();
         baseAnnotationTypes = new TreeSet<>(comparator);
         baseEnums = new TreeSet<>(comparator);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java	Tue Aug 09 13:22:57 2016 -0700
@@ -31,6 +31,7 @@
 import javax.lang.model.element.PackageElement;
 
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 
 
 /**
@@ -87,6 +88,7 @@
      * The global configuration information for this run.
      */
     private final Configuration configuration;
+    private Messages messages;
 
     /**
      * Since we need to sort the keys in the reverse order(longest key first),
@@ -101,6 +103,7 @@
 
     public Group(Configuration configuration) {
         this.configuration = configuration;
+        messages = configuration.getMessages();
     }
 
     /**
@@ -120,14 +123,16 @@
     public boolean checkPackageGroups(String groupname, String pkgNameFormList) {
         StringTokenizer strtok = new StringTokenizer(pkgNameFormList, ":");
         if (groupList.contains(groupname)) {
-            configuration.message.warning("doclet.Groupname_already_used", groupname);
+            initMessages();
+            messages.warning("doclet.Groupname_already_used", groupname);
             return false;
         }
         groupList.add(groupname);
         while (strtok.hasMoreTokens()) {
             String id = strtok.nextToken();
             if (id.length() == 0) {
-                configuration.message.warning("doclet.Error_in_packagelist", groupname, pkgNameFormList);
+                initMessages();
+                messages.warning("doclet.Error_in_packagelist", groupname, pkgNameFormList);
                 return false;
             }
             if (id.endsWith("*")) {
@@ -148,6 +153,14 @@
         return true;
     }
 
+    // Lazy init of the messages for now, because Group is created
+    // in Configuration before configuration is fully initialized.
+    private void initMessages() {
+        if (messages == null) {
+            messages = configuration.getMessages();
+        }
+    }
+
     /**
      * Search if the given map has given the package format.
      *
@@ -158,7 +171,8 @@
      */
     boolean foundGroupFormat(Map<String,?> map, String pkgFormat) {
         if (map.containsKey(pkgFormat)) {
-            configuration.message.error("doclet.Same_package_name_used", pkgFormat);
+            initMessages();
+            messages.error("doclet.Same_package_name_used", pkgFormat);
             return true;
         }
         return false;
@@ -181,8 +195,8 @@
         Map<String, SortedSet<PackageElement>> groupPackageMap = new HashMap<>();
         String defaultGroupName =
             (pkgNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())?
-                configuration.message.getText("doclet.Packages") :
-                configuration.message.getText("doclet.Other_Packages");
+                configuration.getResources().getText("doclet.Packages") :
+                configuration.getResources().getText("doclet.Other_Packages");
         // if the user has not used the default group name, add it
         if (!groupList.contains(defaultGroupName)) {
             groupList.add(defaultGroupName);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexBuilder.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/IndexBuilder.java	Tue Aug 09 13:22:57 2016 -0700
@@ -33,6 +33,7 @@
 
 import jdk.javadoc.doclet.DocletEnvironment;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 
 /**
  * Build the mapping of each Unicode character with it's member lists
@@ -98,11 +99,14 @@
                         boolean classesOnly) {
         this.configuration  = configuration;
         this.utils = configuration.utils;
+
+        Messages messages = configuration.getMessages();
         if (classesOnly) {
-            configuration.message.notice("doclet.Building_Index_For_All_Classes");
+            messages.notice("doclet.Building_Index_For_All_Classes");
         } else {
-            configuration.message.notice("doclet.Building_Index");
+            messages.notice("doclet.Building_Index");
         }
+
         this.noDeprecated = noDeprecated;
         this.classesOnly = classesOnly;
         this.javafx = configuration.javafx;
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/MessageRetriever.java	Tue Aug 09 20:27:06 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,280 +0,0 @@
-/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.javadoc.internal.doclets.toolkit.util;
-
-import java.text.MessageFormat;
-import java.util.*;
-
-import javax.lang.model.element.Element;
-
-import com.sun.source.util.DocTreePath;
-import jdk.javadoc.internal.doclets.toolkit.Configuration;
-
-import static javax.tools.Diagnostic.Kind.*;
-
-
-/**
- * Retrieve and format messages stored in a resource.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- *
- * @author Atul M Dambalkar
- * @author Robert Field
- */
-public class MessageRetriever {
-    /**
-     * The global configuration information for this run.
-     */
-    private final Configuration configuration;
-
-    /**
-     * The location from which to lazily fetch the resource..
-     */
-    private final String resourcelocation;
-
-    /**
-     * The lazily fetched resource..
-     */
-    private ResourceBundle messageRB;
-
-    /**
-     * Initialize the ResourceBundle with the given resource.
-     *
-     * @param rb the resource bundle to read.
-     */
-    public MessageRetriever(ResourceBundle rb) {
-        this.configuration = null;
-        this.messageRB = rb;
-        this.resourcelocation = null;
-    }
-
-    /**
-     * Initialize the ResourceBundle with the given resource.
-     *
-     * @param configuration the configuration
-     * @param resourcelocation Resource.
-     */
-    public MessageRetriever(Configuration configuration,
-                            String resourcelocation) {
-        this.configuration = configuration;
-        this.resourcelocation = resourcelocation;
-    }
-
-    private ResourceBundle initRB() {
-        ResourceBundle bundle = messageRB;
-        if (bundle == null) {
-            try {
-                messageRB = bundle =
-                        ResourceBundle.getBundle(resourcelocation, configuration.getLocale());
-            } catch (MissingResourceException e) {
-                throw new Error("Fatal: Resource (" + resourcelocation
-                        + ") for javadoc doclets is missing.");
-            }
-        }
-        return bundle;
-    }
-
-    /**
-     * Determines whether the given <code>key</code> can be retrieved
-     * from this <code>MessageRetriever</code>
-     *
-     * @param key
-     *        the resource <code>key</code>
-     * @return <code>true</code> if the given <code>key</code> is
-     *        contained in the underlying <code>ResourceBundle</code>.
-     */
-    public boolean containsKey(String key) {
-        ResourceBundle bundle = initRB();
-        return bundle.containsKey(key);
-    }
-
-    /**
-     * Get and format message string from resource
-     *
-     * @param key selects message from resource
-     * @param args arguments to be replaced in the message.
-     * @return the composed text
-     * @throws MissingResourceException when the key does not
-     * exist in the properties file.
-     */
-    public String getText(String key, Object... args) throws MissingResourceException {
-        ResourceBundle bundle = initRB();
-        String message = bundle.getString(key);
-        return MessageFormat.format(message, args);
-    }
-
-    /**
-     * Print error message, increment error count.
-     *
-     * @param pos the position of the source
-     * @param msg message to print
-     */
-    private void printError(DocTreePath path, String msg) {
-        configuration.reporter.print(ERROR, path, msg);
-    }
-
-    /**
-     * Print error message, increment error count.
-     *
-     * @param msg message to print
-     */
-    private void printError(String msg) {
-        configuration.reporter.print(ERROR, msg);
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     *
-     * @param pos the position of the source
-     * @param msg message to print
-     */
-    private void printWarning(DocTreePath path, String msg) {
-        configuration.reporter.print(WARNING, path, msg);
-    }
-
-    private void printWarning(Element e, String msg) {
-        configuration.reporter.print(WARNING, e, msg);
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     *
-     * @param msg message to print
-     */
-    private void printWarning(String msg) {
-        configuration.reporter.print(WARNING, msg);
-    }
-
-//    Note: the following do not appear to be needed any more, delete me.
-//    /**
-//     * Print a message.
-//     *
-//     * @param pos the position of the source
-//     * @param msg message to print
-//     */
-//    private void printNotice(DocTreePath path, String msg) {
-//        DocEnv env = ((RootDocImpl)configuration.root).env;
-//        if (env.isQuiet() || env.isSilent()) {
-//            return;
-//        }
-//        configuration.reporter.print(NOTE, path, msg);
-//    }
-
-//    Note: does not appear to be needed any more.
-//    /**
-//     * Print a message.
-//     *
-//     * @param pos the position of the source
-//     * @param key selects message from resource
-//     * @param args arguments to be replaced in the message.
-//     */
-//    public void notice(DocTreePath path, String key, Object... args) {
-//        printNotice(path, getText(key, args));
-//    }
-
-    // ERRORS
-    /**
-     * Print error message, increment error count.
-     *
-     * @param path the path to the source
-     * @param key selects message from resource
-     * @param args arguments to be replaced in the message.
-     */
-    public void error(DocTreePath path, String key, Object... args) {
-        printError(path, getText(key, args));
-    }
-
-    /**
-     * Print error message, increment error count.
-     *
-     * @param key selects message from resource
-     * @param args arguments to be replaced in the message.
-     */
-    public void error(String key, Object... args) {
-        printError(getText(key, args));
-    }
-
-    // WARNINGS
-    /**
-     * Print warning message, increment warning count.
-
-     * @param path the path to the source
-     * @param key selects message from resource
-     * @param args arguments to be replaced in the message.
-     */
-    public void warning(DocTreePath path, String key, Object... args) {
-        if (configuration.showMessage(path, key))
-            printWarning(path, getText(key, args));
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     *
-     * @param e element target of the message
-     * @param key selects message from resource
-     * @param args arguments to be replaced in the message.
-     */
-    public void warning(Element e, String key, Object... args) {
-        if (configuration.showMessage(e, key))
-            printWarning(e, getText(key, args));
-    }
-
-    /**
-     * Print warning message, increment warning count.
-     *
-     * @param key selects message from resource
-     * @param args arguments to be replaced in the message.
-     */
-    public void warning(String key, Object... args) {
-        printWarning(getText(key, args));
-    }
-
-    // NOTICES
-    /**
-     * Print a message.
-     *
-     * @param msg message to print
-     */
-    private void printNotice(String msg) {
-        if (configuration.quiet) {
-            return;
-        }
-        configuration.reporter.print(NOTE, msg);
-    }
-
-    /**
-     * Print a message.
-     *
-     * @param key selects message from resource
-     * @param args arguments to be replaced in the message.
-     */
-    public void notice(String key, Object... args) {
-        printNotice(getText(key, args));
-    }
-}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/PackageListWriter.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/PackageListWriter.java	Tue Aug 09 13:22:57 2016 -0700
@@ -32,6 +32,7 @@
 
 import jdk.javadoc.doclet.DocletEnvironment;
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 
 
 /**
@@ -73,7 +74,8 @@
             packgen.generatePackageListFile(configuration.docEnv);
             packgen.close();
         } catch (IOException exc) {
-            configuration.message.error("doclet.exception_encountered",
+            Messages messages = configuration.getMessages();
+            messages.error("doclet.exception_encountered",
                 exc.toString(), DocPaths.PACKAGE_LIST);
             throw new DocletAbortException(exc);
         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java	Tue Aug 09 13:22:57 2016 -0700
@@ -85,7 +85,10 @@
 import static javax.lang.model.type.TypeKind.*;
 
 import static com.sun.source.doctree.DocTree.Kind.*;
+
 import com.sun.source.util.SimpleDocTreeVisitor;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
+
 import static jdk.javadoc.internal.doclets.toolkit.builders.ConstantsSummaryBuilder.MAX_CONSTANT_VALUE_INDEX_LENGTH;
 
 
@@ -102,12 +105,14 @@
  */
 public class Utils {
     public final Configuration configuration;
+    public final Messages messages;
     public final DocTrees docTrees;
     public final Elements elementUtils;
     public final Types typeUtils;
 
     public Utils(Configuration c) {
         configuration = c;
+        messages = configuration.getMessages();
         elementUtils = c.docEnv.getElementUtils();
         typeUtils = c.docEnv.getTypeUtils();
         docTrees = c.docEnv.getDocTrees();
@@ -293,11 +298,10 @@
                     DocFile destfile = destdir.resolve(srcfile.getName());
                     if (srcfile.isFile()) {
                         if (destfile.exists() && !first) {
-                            configuration.message.warning("doclet.Copy_Overwrite_warning",
+                            messages.warning("doclet.Copy_Overwrite_warning",
                                     srcfile.getPath(), destdir.getPath());
                         } else {
-                            configuration.message.notice(
-                                    "doclet.Copying_File_0_To_Dir_1",
+                            messages.notice("doclet.Copying_File_0_To_Dir_1",
                                     srcfile.getPath(), destdir.getPath());
                             destfile.copyFile(srcfile);
                         }
@@ -1577,11 +1581,10 @@
                     DocFile destfile = destdir.resolve(srcfile.getName());
                     if (srcfile.isFile()) {
                         if (destfile.exists() && !first) {
-                            configuration.message.warning("doclet.Copy_Overwrite_warning",
+                            messages.warning("doclet.Copy_Overwrite_warning",
                                     srcfile.getPath(), destdir.getPath());
                         } else {
-                            configuration.message.notice(
-                                    "doclet.Copying_File_0_To_Dir_1",
+                            messages.notice("doclet.Copying_File_0_To_Dir_1",
                                     srcfile.getPath(), destdir.getPath());
                             destfile.copyFile(srcfile);
                         }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java	Tue Aug 09 20:27:06 2016 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberMap.java	Tue Aug 09 13:22:57 2016 -0700
@@ -39,6 +39,7 @@
 import com.sun.source.doctree.DocTree;
 
 import jdk.javadoc.internal.doclets.toolkit.Configuration;
+import jdk.javadoc.internal.doclets.toolkit.Messages;
 
 /**
  * A data structure that encapsulates the visible members of a particular
@@ -126,6 +127,7 @@
      * The configuration this VisibleMemberMap was created with.
      */
     private final Configuration configuration;
+    private final Messages messages;
     private final Utils utils;
     private final Comparator<Element> comparator;
 
@@ -149,6 +151,7 @@
         this.typeElement = typeElement;
         this.kind = kind;
         this.configuration = configuration;
+        this.messages = configuration.getMessages();
         this.utils = configuration.utils;
         propertiesCache = configuration.propertiesCache;
         classPropertiesMap = configuration.classPropertiesMap;
@@ -697,7 +700,7 @@
                                 || tagName.equals("@propertyGetter")
                                 || tagName.equals("@propertyDescription")) {
                             if (!isPropertyGetterOrSetter(members, ee)) {
-                                configuration.message.warning(ch.getDocTreePath(tree),
+                                messages.warning(ch.getDocTreePath(tree),
                                         "doclet.javafx_tag_misuse");
                             }
                             break;