8012183: replace some uses of Configuration.getText with Configuration.getResource
authorjjg
Tue, 14 May 2013 10:14:55 -0700
changeset 17570 78512b2899db
parent 17569 ef80738645e2
child 17571 50895ba58e0d
8012183: replace some uses of Configuration.getText with Configuration.getResource Reviewed-by: darcy
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Tue May 14 10:14:55 2013 -0700
@@ -91,7 +91,7 @@
      *
      * @return a string for the table caption
      */
-    public abstract String getCaption();
+    public abstract Content getCaption();
 
     /**
      * Get the summary table header for the member.
@@ -415,7 +415,7 @@
             String tableSummary, String[] tableHeader, Content contentTree) {
         if (deprmembers.size() > 0) {
             Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
-                writer.getTableCaption(configuration.getText(headingKey)));
+                writer.getTableCaption(configuration.getResource(headingKey)));
             table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
             Content tbody = new HtmlTree(HtmlTag.TBODY);
             for (int i = 0; i < deprmembers.size(); i++) {
@@ -447,7 +447,7 @@
      * @param contentTree the content tree to which the use information will be added
      */
     protected void addUseInfo(List<? extends ProgramElementDoc> mems,
-            String heading, String tableSummary, Content contentTree) {
+            Content heading, String tableSummary, Content contentTree) {
         if (mems == null) {
             return;
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java	Tue May 14 10:14:55 2013 -0700
@@ -158,10 +158,10 @@
             }
             body.addContent(div);
             if (configuration.showProfiles) {
-                String profileSummary = configuration.getText("doclet.Profiles");
-                String profilesTableSummary = configuration.getText("doclet.Member_Table_Summary",
-                configuration.getText("doclet.Profile_Summary"),
-                configuration.getText("doclet.profiles"));
+                Content profileSummary = configuration.getResource("doclet.Profiles");
+                Content profilesTableSummary = configuration.getResource("doclet.Member_Table_Summary",
+                        configuration.getResource("doclet.Profile_Summary"),
+                        configuration.getResource("doclet.profiles"));
                 addProfilesList(profileSummary, profilesTableSummary, body);
             }
             addPackagesList(packages, text, tableSummary, body);
@@ -217,7 +217,7 @@
      * @param profilesTableSummary the profiles table summary information
      * @param body the content tree to which the profiles list will be added
      */
-    protected void addProfilesList(String profileSummary, String profilesTableSummary,
+    protected void addProfilesList(Content profileSummary, Content profilesTableSummary,
             Content body) {
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java	Tue May 14 10:14:55 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -111,8 +111,8 @@
     /**
      * {@inheritDoc}
      */
-    public String getCaption() {
-        return configuration.getText("doclet.Annotation_Type_Optional_Members");
+    public Content getCaption() {
+        return configuration.getResource("doclet.Annotation_Type_Optional_Members");
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java	Tue May 14 10:14:55 2013 -0700
@@ -183,8 +183,8 @@
     /**
      * {@inheritDoc}
      */
-    public String getCaption() {
-        return configuration.getText("doclet.Annotation_Type_Required_Members");
+    public Content getCaption() {
+        return configuration.getResource("doclet.Annotation_Type_Required_Members");
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Tue May 14 10:14:55 2013 -0700
@@ -256,10 +256,10 @@
      */
     protected void addPackageList(Content contentTree) throws IOException {
         Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
-                getTableCaption(configuration.getText(
+                getTableCaption(configuration.getResource(
                 "doclet.ClassUse_Packages.that.use.0",
                 getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc
-                )).toString())));
+                )))));
         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
         Content tbody = new HtmlTree(HtmlTag.TBODY);
         Iterator<PackageDoc> it = pkgSet.iterator();
@@ -291,10 +291,10 @@
             return;
         }
         Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
-                getTableCaption(configuration.getText(
+                getTableCaption(configuration.getResource(
                 "doclet.ClassUse_PackageAnnotation",
                 getLink(new LinkInfoImpl(configuration,
-                        LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)).toString())));
+                        LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)))));
         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
         Content tbody = new HtmlTree(HtmlTag.TBODY);
         Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
@@ -367,71 +367,71 @@
      * @param contentTree the content tree to which the class use information will be added
      */
     protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException {
-        String classLink = getLink(new LinkInfoImpl(configuration,
-            LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)).toString();
-        String pkgLink = getPackageLink(pkg, Util.getPackageName(pkg)).toString();
+        Content classLink = getLink(new LinkInfoImpl(configuration,
+            LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc));
+        Content pkgLink = getPackageLink(pkg, Util.getPackageName(pkg));
         classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_Annotation", classLink,
+                configuration.getResource("doclet.ClassUse_Annotation", classLink,
                 pkgLink), classUseTableSummary, contentTree);
         classSubWriter.addUseInfo(pkgToClassTypeParameter.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_TypeParameter", classLink,
+                configuration.getResource("doclet.ClassUse_TypeParameter", classLink,
                 pkgLink), classUseTableSummary, contentTree);
         classSubWriter.addUseInfo(pkgToSubclass.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_Subclass", classLink,
+                configuration.getResource("doclet.ClassUse_Subclass", classLink,
                 pkgLink), subclassUseTableSummary, contentTree);
         classSubWriter.addUseInfo(pkgToSubinterface.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_Subinterface", classLink,
+                configuration.getResource("doclet.ClassUse_Subinterface", classLink,
                 pkgLink), subinterfaceUseTableSummary, contentTree);
         classSubWriter.addUseInfo(pkgToImplementingClass.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_ImplementingClass", classLink,
+                configuration.getResource("doclet.ClassUse_ImplementingClass", classLink,
                 pkgLink), classUseTableSummary, contentTree);
         fieldSubWriter.addUseInfo(pkgToField.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_Field", classLink,
+                configuration.getResource("doclet.ClassUse_Field", classLink,
                 pkgLink), fieldUseTableSummary, contentTree);
         fieldSubWriter.addUseInfo(pkgToFieldAnnotations.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_FieldAnnotations", classLink,
+                configuration.getResource("doclet.ClassUse_FieldAnnotations", classLink,
                 pkgLink), fieldUseTableSummary, contentTree);
         fieldSubWriter.addUseInfo(pkgToFieldTypeParameter.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_FieldTypeParameter", classLink,
+                configuration.getResource("doclet.ClassUse_FieldTypeParameter", classLink,
                 pkgLink), fieldUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodAnnotations.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_MethodAnnotations", classLink,
+                configuration.getResource("doclet.ClassUse_MethodAnnotations", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodParameterAnnotations.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_MethodParameterAnnotations", classLink,
+                configuration.getResource("doclet.ClassUse_MethodParameterAnnotations", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodTypeParameter.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_MethodTypeParameter", classLink,
+                configuration.getResource("doclet.ClassUse_MethodTypeParameter", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodReturn.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_MethodReturn", classLink,
+                configuration.getResource("doclet.ClassUse_MethodReturn", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodReturnTypeParameter.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_MethodReturnTypeParameter", classLink,
+                configuration.getResource("doclet.ClassUse_MethodReturnTypeParameter", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodArgs.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_MethodArgs", classLink,
+                configuration.getResource("doclet.ClassUse_MethodArgs", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodArgTypeParameter.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_MethodArgsTypeParameters", classLink,
+                configuration.getResource("doclet.ClassUse_MethodArgsTypeParameters", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         methodSubWriter.addUseInfo(pkgToMethodThrows.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_MethodThrows", classLink,
+                configuration.getResource("doclet.ClassUse_MethodThrows", classLink,
                 pkgLink), methodUseTableSummary, contentTree);
         constrSubWriter.addUseInfo(pkgToConstructorAnnotations.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_ConstructorAnnotations", classLink,
+                configuration.getResource("doclet.ClassUse_ConstructorAnnotations", classLink,
                 pkgLink), constructorUseTableSummary, contentTree);
         constrSubWriter.addUseInfo(pkgToConstructorParameterAnnotations.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
+                configuration.getResource("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
                 pkgLink), constructorUseTableSummary, contentTree);
         constrSubWriter.addUseInfo(pkgToConstructorArgs.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_ConstructorArgs", classLink,
+                configuration.getResource("doclet.ClassUse_ConstructorArgs", classLink,
                 pkgLink), constructorUseTableSummary, contentTree);
         constrSubWriter.addUseInfo(pkgToConstructorArgTypeParameter.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
+                configuration.getResource("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
                 pkgLink), constructorUseTableSummary, contentTree);
         constrSubWriter.addUseInfo(pkgToConstructorThrows.get(pkg.name()),
-                configuration.getText("doclet.ClassUse_ConstructorThrows", classLink,
+                configuration.getResource("doclet.ClassUse_ConstructorThrows", classLink,
                 pkgLink), constructorUseTableSummary, contentTree);
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Tue May 14 10:14:55 2013 -0700
@@ -565,7 +565,7 @@
     }
 
     @Override
-    public Content getContentForResource() {
+    public Content newContent() {
         return new ContentBuilder();
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java	Tue May 14 10:14:55 2013 -0700
@@ -184,13 +184,17 @@
      */
     public Content getConstantMembersHeader(ClassDoc cd) {
         //generate links backward only to public classes.
-        String classlink = (cd.isPublic() || cd.isProtected()) ?
+        Content classlink = (cd.isPublic() || cd.isProtected()) ?
             getLink(new LinkInfoImpl(configuration,
-                    LinkInfoImpl.Kind.CONSTANT_SUMMARY, cd)).toString() :
-            cd.qualifiedName();
+                    LinkInfoImpl.Kind.CONSTANT_SUMMARY, cd)) :
+            new StringContent(cd.qualifiedName());
         String name = cd.containingPackage().name();
         if (name.length() > 0) {
-            return getClassName(name + "." + classlink);
+            Content cb = new ContentBuilder();
+            cb.addContent(name);
+            cb.addContent(".");
+            cb.addContent(classlink);
+            return getClassName(cb);
         } else {
             return getClassName(classlink);
         }
@@ -202,7 +206,7 @@
      * @param classStr the class name to print.
      * @return the table caption and header
      */
-    protected Content getClassName(String classStr) {
+    protected Content getClassName(Content classStr) {
         Content table = HtmlTree.TABLE(0, 3, 0, constantsTableSummary,
                 getTableCaption(classStr));
         table.addContent(getSummaryTableHeader(constantsTableHeader, "col"));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java	Tue May 14 10:14:55 2013 -0700
@@ -225,8 +225,8 @@
     /**
      * {@inheritDoc}
      */
-    public String getCaption() {
-        return configuration.getText("doclet.Constructors");
+    public Content getCaption() {
+        return configuration.getResource("doclet.Constructors");
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java	Tue May 14 10:14:55 2013 -0700
@@ -182,8 +182,8 @@
     /**
      * {@inheritDoc}
      */
-    public String getCaption() {
-        return configuration.getText("doclet.Enum_Constants");
+    public Content getCaption() {
+        return configuration.getResource("doclet.Enum_Constants");
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java	Tue May 14 10:14:55 2013 -0700
@@ -203,8 +203,8 @@
     /**
      * {@inheritDoc}
      */
-    public String getCaption() {
-        return configuration.getText("doclet.Fields");
+    public Content getCaption() {
+        return configuration.getResource("doclet.Fields");
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue May 14 10:14:55 2013 -0700
@@ -350,7 +350,7 @@
             int profileValue) {
         if(classes.length > 0) {
             Arrays.sort(classes);
-            Content caption = getTableCaption(label);
+            Content caption = getTableCaption(new RawHtml(label));
             Content table = HtmlTree.TABLE(HtmlStyle.packageSummary, 0, 3, 0,
                     tableSummary, caption);
             table.addContent(getSummaryTableHeader(tableHeader, "col"));
@@ -869,8 +869,7 @@
      * @param rawText the caption for the table which could be raw Html
      * @return a content tree for the caption
      */
-    public Content getTableCaption(String rawText) {
-        Content title = new RawHtml(rawText);
+    public Content getTableCaption(Content title) {
         Content captionSpan = HtmlTree.SPAN(title);
         Content space = getSpace();
         Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, space);
@@ -938,7 +937,7 @@
             String tableSummary, String[] tableHeader, Content contentTree) {
         if (deprPkgs.size() > 0) {
             Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
-                    getTableCaption(configuration.getText(headingKey)));
+                    getTableCaption(configuration.getResource(headingKey)));
             table.addContent(getSummaryTableHeader(tableHeader, "col"));
             Content tbody = new HtmlTree(HtmlTag.TBODY);
             for (int i = 0; i < deprPkgs.size(); i++) {
@@ -1573,7 +1572,7 @@
      */
     public Content commentTagsToContent(Tag holderTag, Doc doc, Tag[] tags,
             boolean isFirstSentence) {
-        ContentBuilder result = new ContentBuilder();
+        Content result = new ContentBuilder();
         boolean textTagChange = false;
         // Array of all possible inline tags for this javadoc run
         configuration.tagletManager.checkTags(doc, tags, true);
@@ -1890,7 +1889,7 @@
     }
 
     /**
-     * Adds the annotatation types for the given doc.
+     * Adds the annotation types for the given doc.
      *
      * @param indent the number of extra spaces to indent the annotations.
      * @param doc the doc to write annotations for.
@@ -1900,16 +1899,14 @@
      */
     private boolean addAnnotationInfo(int indent, Doc doc,
             AnnotationDesc[] descList, boolean lineBreak, Content htmltree) {
-        List<String> annotations = getAnnotations(indent, descList, lineBreak);
+        List<Content> annotations = getAnnotations(indent, descList, lineBreak);
         String sep ="";
-        if (annotations.size() == 0) {
+        if (annotations.isEmpty()) {
             return false;
         }
-        Content annotationContent;
-        for (Iterator<String> iter = annotations.iterator(); iter.hasNext();) {
+        for (Content annotation: annotations) {
             htmltree.addContent(sep);
-            annotationContent = new RawHtml(iter.next());
-            htmltree.addContent(annotationContent);
+            htmltree.addContent(annotation);
             sep = " ";
         }
         return true;
@@ -1925,7 +1922,7 @@
      * @return an array of strings representing the annotations being
      *         documented.
      */
-    private List<String> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak) {
+    private List<Content> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak) {
         return getAnnotations(indent, descList, linkBreak, true);
     }
 
@@ -1944,10 +1941,10 @@
      * @return an array of strings representing the annotations being
      *         documented.
      */
-    public List<String> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak,
+    public List<Content> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak,
             boolean isJava5DeclarationLocation) {
-        List<String> results = new ArrayList<String>();
-        StringBuilder annotation;
+        List<Content> results = new ArrayList<Content>();
+        ContentBuilder annotation;
         for (int i = 0; i < descList.length; i++) {
             AnnotationTypeDoc annotationDoc = descList[i].annotationType();
             // If an annotation is not documented, do not add it to the list. If
@@ -1964,7 +1961,7 @@
             if  (Util.isDeclarationAnnotation(annotationDoc, isJava5DeclarationLocation)) {
                 continue;
             }*/
-            annotation = new StringBuilder();
+            annotation = new ContentBuilder();
             isAnnotationDocumented = false;
             LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
                 LinkInfoImpl.Kind.ANNOTATION, annotationDoc);
@@ -1983,8 +1980,8 @@
                     }
                     String sep = "";
                     for (AnnotationValue av : annotationTypeValues) {
-                        annotation.append(sep);
-                        annotation.append(annotationValueToString(av));
+                        annotation.addContent(sep);
+                        annotation.addContent(annotationValueToContent(av));
                         sep = " ";
                     }
                 }
@@ -2000,8 +1997,8 @@
                     annotationTypeValues.addAll(Arrays.asList(annotationArray));
                     String sep = "";
                     for (AnnotationValue av : annotationTypeValues) {
-                        annotation.append(sep);
-                        annotation.append(annotationValueToString(av));
+                        annotation.addContent(sep);
+                        annotation.addContent(annotationValueToContent(av));
                         sep = " ";
                     }
                 }
@@ -2016,8 +2013,8 @@
                 addAnnotations(annotationDoc, linkInfo, annotation, pairs,
                         indent, linkBreak);
             }
-            annotation.append(linkBreak ? DocletConstants.NL : "");
-            results.add(annotation.toString());
+            annotation.addContent(linkBreak ? DocletConstants.NL : "");
+            results.add(annotation);
         }
         return results;
     }
@@ -2033,26 +2030,26 @@
      * @param linkBreak if true, add new line between each member value
      */
     private void addAnnotations(AnnotationTypeDoc annotationDoc, LinkInfoImpl linkInfo,
-            StringBuilder annotation, AnnotationDesc.ElementValuePair[] pairs,
+            ContentBuilder annotation, AnnotationDesc.ElementValuePair[] pairs,
             int indent, boolean linkBreak) {
         linkInfo.label = new StringContent("@" + annotationDoc.name());
-        annotation.append(getLink(linkInfo));
+        annotation.addContent(getLink(linkInfo));
         if (pairs.length > 0) {
-            annotation.append('(');
+            annotation.addContent("(");
             for (int j = 0; j < pairs.length; j++) {
                 if (j > 0) {
-                    annotation.append(",");
+                    annotation.addContent(",");
                     if (linkBreak) {
-                        annotation.append(DocletConstants.NL);
+                        annotation.addContent(DocletConstants.NL);
                         int spaces = annotationDoc.name().length() + 2;
                         for (int k = 0; k < (spaces + indent); k++) {
-                            annotation.append(' ');
+                            annotation.addContent(" ");
                         }
                     }
                 }
-                annotation.append(getDocLink(LinkInfoImpl.Kind.ANNOTATION,
+                annotation.addContent(getDocLink(LinkInfoImpl.Kind.ANNOTATION,
                         pairs[j].element(), pairs[j].element().name(), false));
-                annotation.append('=');
+                annotation.addContent("=");
                 AnnotationValue annotationValue = pairs[j].value();
                 List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>();
                 if (annotationValue.value() instanceof AnnotationValue[]) {
@@ -2062,17 +2059,17 @@
                 } else {
                     annotationTypeValues.add(annotationValue);
                 }
-                annotation.append(annotationTypeValues.size() == 1 ? "" : "{");
+                annotation.addContent(annotationTypeValues.size() == 1 ? "" : "{");
                 String sep = "";
                 for (AnnotationValue av : annotationTypeValues) {
-                    annotation.append(sep);
-                    annotation.append(annotationValueToString(av));
+                    annotation.addContent(sep);
+                    annotation.addContent(annotationValueToContent(av));
                     sep = ",";
                 }
-                annotation.append(annotationTypeValues.size() == 1 ? "" : "}");
+                annotation.addContent(annotationTypeValues.size() == 1 ? "" : "}");
                 isContainerDocumented = false;
             }
-            annotation.append(")");
+            annotation.addContent(")");
         }
     }
 
@@ -2107,7 +2104,7 @@
         return false;
     }
 
-    private String annotationValueToString(AnnotationValue annotationValue) {
+    private Content annotationValueToContent(AnnotationValue annotationValue) {
         if (annotationValue.value() instanceof Type) {
             Type type = (Type) annotationValue.value();
             if (type.asClassDoc() != null) {
@@ -2116,25 +2113,25 @@
                 linkInfo.label = new StringContent((type.asClassDoc().isIncluded() ?
                     type.typeName() :
                     type.qualifiedTypeName()) + type.dimension() + ".class");
-                return getLink(linkInfo).toString();
+                return getLink(linkInfo);
             } else {
-                return type.typeName() + type.dimension() + ".class";
+                return new StringContent(type.typeName() + type.dimension() + ".class");
             }
         } else if (annotationValue.value() instanceof AnnotationDesc) {
-            List<String> list = getAnnotations(0,
+            List<Content> list = getAnnotations(0,
                 new AnnotationDesc[]{(AnnotationDesc) annotationValue.value()},
                     false);
-            StringBuilder buf = new StringBuilder();
-            for (String s: list) {
-                buf.append(s);
+            ContentBuilder buf = new ContentBuilder();
+            for (Content c: list) {
+                buf.addContent(c);
             }
-            return buf.toString();
+            return buf;
         } else if (annotationValue.value() instanceof MemberDoc) {
             return getDocLink(LinkInfoImpl.Kind.ANNOTATION,
                 (MemberDoc) annotationValue.value(),
-                ((MemberDoc) annotationValue.value()).name(), false).toString();
+                ((MemberDoc) annotationValue.value()).name(), false);
          } else {
-            return annotationValue.toString();
+            return new StringContent(annotationValue.toString());
          }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Tue May 14 10:14:55 2013 -0700
@@ -149,14 +149,14 @@
         if (annotations.length == 0)
             return links;
 
-        List<String> annos = m_writer.getAnnotations(0, annotations, false, linkInfo.isJava5DeclarationLocation);
+        List<Content> annos = m_writer.getAnnotations(0, annotations, false, linkInfo.isJava5DeclarationLocation);
 
         boolean isFirst = true;
-        for (String anno : annos) {
+        for (Content anno : annos) {
             if (!isFirst) {
                 links.addContent(" ");
             }
-            links.addContent(new RawHtml(anno));
+            links.addContent(anno);
             isFirst = false;
         }
         if (!annos.isEmpty()) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Tue May 14 10:14:55 2013 -0700
@@ -223,8 +223,8 @@
     /**
      * {@inheritDoc}
      */
-    public String getCaption() {
-        return configuration.getText("doclet.Methods");
+    public Content getCaption() {
+        return configuration.getResource("doclet.Methods");
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java	Tue May 14 10:14:55 2013 -0700
@@ -100,8 +100,8 @@
     /**
      * {@inheritDoc}
      */
-    public String getCaption() {
-        return configuration.getText("doclet.Nested_Classes");
+    public Content getCaption() {
+        return configuration.getResource("doclet.Nested_Classes");
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Tue May 14 10:14:55 2013 -0700
@@ -166,7 +166,7 @@
             Arrays.sort(arr);
             boolean printedHeader = false;
             HtmlTree ul = new HtmlTree(HtmlTag.UL);
-            ul.addAttr(HtmlAttr.TITLE, labelContent.toString());
+            ul.setTitle(labelContent);
             for (int i = 0; i < arr.length; i++) {
                 if (documentedClasses != null &&
                         !documentedClasses.contains(arr[i])) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Tue May 14 10:14:55 2013 -0700
@@ -84,7 +84,7 @@
                 packagesLabel);
         Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
-        ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString());
+        ul.setTitle(packagesLabel);
         for(int i = 0; i < packages.length; i++) {
             // Do not list the package if -nodeprecated option is set and the
             // package is marked as deprecated.
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Tue May 14 10:14:55 2013 -0700
@@ -123,7 +123,7 @@
     /**
      * {@inheritDoc}
      */
-    protected void addProfilesList(String profileSummary, String profilesTableSummary,
+    protected void addProfilesList(Content profileSummary, String profilesTableSummary,
             Content body) {
         Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, profilesTableSummary,
                 getTableCaption(profileSummary));
@@ -141,7 +141,7 @@
     protected void addPackagesList(PackageDoc[] packages, String text,
             String tableSummary, Content body) {
         Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary,
-                getTableCaption(text));
+                getTableCaption(new RawHtml(text)));
         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
         Content tbody = new HtmlTree(HtmlTag.TBODY);
         addPackagesList(packages, tbody);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Tue May 14 10:14:55 2013 -0700
@@ -152,9 +152,9 @@
      */
     protected void addPackageList(Content contentTree) throws IOException {
         Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
-                getTableCaption(configuration.getText(
+                getTableCaption(configuration.getResource(
                 "doclet.ClassUse_Packages.that.use.0",
-                getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)).toString())));
+                getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)))));
         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
         Content tbody = new HtmlTree(HtmlTag.TBODY);
         Iterator<String> it = usingPackageToUsedClasses.keySet().iterator();
@@ -197,10 +197,10 @@
             String tableSummary = configuration.getText("doclet.Use_Table_Summary",
                     configuration.getText("doclet.classes"));
             Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
-                    getTableCaption(configuration.getText(
+                    getTableCaption(configuration.getResource(
                     "doclet.ClassUse_Classes.in.0.used.by.1",
-                    getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)).toString(),
-                    getPackageLink(usingPackage, Util.getPackageName(usingPackage)).toString())));
+                    getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)),
+                    getPackageLink(usingPackage, Util.getPackageName(usingPackage)))));
             table.addContent(getSummaryTableHeader(classTableHeader, "col"));
             Content tbody = new HtmlTree(HtmlTag.TBODY);
             Iterator<ClassDoc> itc =
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Tue May 14 10:14:55 2013 -0700
@@ -168,7 +168,7 @@
             String tableSummary, String[] tableHeader, Content summaryContentTree) {
         if(classes.length > 0) {
             Arrays.sort(classes);
-            Content caption = getTableCaption(label);
+            Content caption = getTableCaption(new RawHtml(label));
             Content table = HtmlTree.TABLE(HtmlStyle.packageSummary, 0, 3, 0,
                     tableSummary, caption);
             table.addContent(getSummaryTableHeader(tableHeader, "col"));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java	Tue May 14 10:14:55 2013 -0700
@@ -87,7 +87,7 @@
                 profilesLabel);
         Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
-        ul.addAttr(HtmlAttr.TITLE, profilesLabel.toString());
+        ul.setTitle(profilesLabel);
         for (int i = 1; i < profiles.getProfileCount(); i++) {
             ul.addContent(getProfile(i));
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Tue May 14 10:14:55 2013 -0700
@@ -158,7 +158,7 @@
             Arrays.sort(arr);
             boolean printedHeader = false;
             HtmlTree ul = new HtmlTree(HtmlTag.UL);
-            ul.addAttr(HtmlAttr.TITLE, labelContent.toString());
+            ul.setTitle(labelContent);
             for (int i = 0; i < arr.length; i++) {
                 if (!isTypeInProfile(arr[i], profileValue)) {
                     continue;
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Tue May 14 10:14:55 2013 -0700
@@ -91,7 +91,7 @@
         heading.addContent(packagesLabel);
         Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
-        ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString());
+        ul.setTitle(packagesLabel);
         PackageDoc[] packages = configuration.profilePackages.get(profileName);
         for (int i = 0; i < packages.length; i++) {
             if ((!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java	Tue May 14 10:14:55 2013 -0700
@@ -199,8 +199,8 @@
     /**
      * {@inheritDoc}
      */
-    public String getCaption() {
-        return configuration.getText("doclet.Properties");
+    public Content getCaption() {
+        return configuration.getResource("doclet.Properties");
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java	Tue May 14 10:14:55 2013 -0700
@@ -133,23 +133,22 @@
             new StringContent(classDoc.qualifiedName());
         Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(
                 classDoc.qualifiedName()));
-        String superClassLink =
+        Content superClassLink =
             classDoc.superclassType() != null ?
                 getLink(new LinkInfoImpl(configuration,
                         LinkInfoImpl.Kind.SERIALIZED_FORM,
-                        classDoc.superclassType())).toString() :
+                        classDoc.superclassType())) :
                 null;
 
         //Print the heading.
-        String className = superClassLink == null ?
-            configuration.getText(
-            "doclet.Class_0_implements_serializable", classLink.toString()) :
-            configuration.getText(
-            "doclet.Class_0_extends_implements_serializable", classLink.toString(),
+        Content className = superClassLink == null ?
+            configuration.getResource(
+            "doclet.Class_0_implements_serializable", classLink) :
+            configuration.getResource(
+            "doclet.Class_0_extends_implements_serializable", classLink,
             superClassLink);
-        Content classNameContent = new RawHtml(className);
         li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
-                classNameContent));
+                className));
         return li;
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java	Tue May 14 10:14:55 2013 -0700
@@ -78,27 +78,6 @@
     /**
      * Get Html Hyper Link string.
      *
-     * @param link       String name of the file.
-     * @param label      Tag for the link.
-     * @param strong       Boolean that sets label to strong.
-     * @param stylename  String style of text defined in style sheet.
-     * @return String    Hyper Link.
-     */
-    public String getHyperLinkString(DocPath link,
-                               String label, boolean strong,
-                               String stylename) {
-        return getHyperLinkString(link, label, strong, stylename, "", "");
-    }
-
-    public String getHyperLinkString(DocLink link,
-                               String label, boolean strong,
-                               String stylename) {
-        return getHyperLinkString(link, label, strong, stylename, "", "");
-    }
-
-    /**
-     * Get Html Hyper Link string.
-     *
      * @param where      Position of the link in the file. Character '#' is not
      *                   needed.
      * @param label      Tag for the link.
@@ -124,55 +103,6 @@
         return getHyperLink(link, label, "", "");
     }
 
-    /**
-     * Get Html Hyper Link string.
-     *
-     * @param link       String name of the file.
-     * @param label      Tag for the link.
-     * @param strong       Boolean that sets label to strong.
-     * @param stylename  String style of text defined in style sheet.
-     * @param title      String that describes the links content for accessibility.
-     * @param target     Target frame.
-     * @return String    Hyper Link.
-     */
-    public String getHyperLinkString(DocPath link,
-                               String label, boolean strong,
-                               String stylename, String title, String target) {
-        return getHyperLinkString(new DocLink(link), label, strong,
-                stylename, title, target);
-    }
-
-    public String getHyperLinkString(DocLink link,
-                               String label, boolean strong,
-                               String stylename, String title, String target) {
-        StringBuilder retlink = new StringBuilder();
-        retlink.append("<a href=\"").append(link).append('"');
-        if (title != null && title.length() != 0) {
-            retlink.append(" title=\"").append(title).append('"');
-        }
-        if (target != null && target.length() != 0) {
-            retlink.append(" target=\"").append(target).append('"');
-        }
-        retlink.append(">");
-        if (stylename != null && stylename.length() != 0) {
-            retlink.append("<FONT CLASS=\"");
-            retlink.append(stylename);
-            retlink.append("\">");
-        }
-        if (strong) {
-            retlink.append("<span class=\"strong\">");
-        }
-        retlink.append(label);
-        if (strong) {
-            retlink.append("</span>");
-        }
-        if (stylename != null && stylename.length() != 0) {
-            retlink.append("</FONT>");
-        }
-        retlink.append("</a>");
-        return retlink.toString();
-    }
-
     public Content getHyperLink(DocPath link,
                                Content label, boolean strong,
                                String stylename, String title, String target) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Tue May 14 10:14:55 2013 -0700
@@ -82,6 +82,10 @@
         attrs.put(nullCheck(attrName), escapeHtmlChars(attrValue));
     }
 
+    public void setTitle(Content body) {
+        addAttr(HtmlAttr.TITLE, stripHtml(body));
+    }
+
     /**
      * Adds a style for the HTML tag.
      *
@@ -353,7 +357,7 @@
             HtmlStyle styleClass, Content body) {
         HtmlTree htmltree = new HtmlTree(headingTag, nullCheck(body));
         if (printTitle)
-            htmltree.addAttr(HtmlAttr.TITLE, stripHtml(body));
+            htmltree.setTitle(body);
         if (styleClass != null)
             htmltree.addStyle(styleClass);
         return htmltree;
@@ -838,7 +842,7 @@
         out.write(tagString);
         Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
         HtmlAttr key;
-        String value = "";
+        String value;
         while (iterator.hasNext()) {
             key = iterator.next();
             value = attrs.get(key);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Tue May 14 10:14:55 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Tue May 14 10:14:55 2013 -0700
@@ -827,7 +827,7 @@
         }
     }
 
-    public abstract Content getContentForResource();
+    public abstract Content newContent();
 
     /**
      * Get the configuration string as a content.
@@ -836,7 +836,7 @@
      * @return a content tree for the text
      */
     public Content getResource(String key) {
-        Content c = getContentForResource();
+        Content c = newContent();
         c.addContent(getText(key));
         return c;
     }
@@ -872,7 +872,7 @@
      * @return a content tree for the text
      */
     public Content getResource(String key, Object o0, Object o1, Object o2) {
-        Content c = getContentForResource();
+        Content c = newContent();
         Pattern p = Pattern.compile("\\{([012])\\}");
         String text = getText(key);
         Matcher m = p.matcher(text);