Tue, 14 May 2013 10:14:52 -0700
8011642: Remove LinkOutput in favor of direct use of Content
Reviewed-by: bpatel, darcy
1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Tue May 14 10:14:51 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Tue May 14 10:14:52 2013 -0700 1.3 @@ -63,9 +63,9 @@ 1.4 protected int addTypeParameters(ExecutableMemberDoc member, Content htmltree) { 1.5 LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, 1.6 LinkInfoImpl.Kind.MEMBER_TYPE_PARAMS, member, false); 1.7 - String typeParameters = writer.getTypeParameterLinks(linkInfo); 1.8 + Content typeParameters = writer.getTypeParameterLinks(linkInfo); 1.9 if (linkInfo.displayLength > 0) { 1.10 - Content linkContent = new RawHtml(typeParameters); 1.11 + Content linkContent = typeParameters; 1.12 htmltree.addContent(linkContent); 1.13 htmltree.addContent(writer.getSpace()); 1.14 writer.displayLength += linkInfo.displayLength + 1; 1.15 @@ -94,9 +94,9 @@ 1.16 Content tdSummary) { 1.17 ExecutableMemberDoc emd = (ExecutableMemberDoc)member; 1.18 String name = emd.name(); 1.19 - Content strong = HtmlTree.STRONG(new RawHtml( 1.20 + Content strong = HtmlTree.STRONG( 1.21 writer.getDocLink(context, cd, (MemberDoc) emd, 1.22 - name, false))); 1.23 + name, false)); 1.24 Content code = HtmlTree.CODE(strong); 1.25 writer.displayLength = name.length(); 1.26 addParameters(emd, false, code); 1.27 @@ -112,9 +112,9 @@ 1.28 */ 1.29 protected void addInheritedSummaryLink(ClassDoc cd, 1.30 ProgramElementDoc member, Content linksTree) { 1.31 - linksTree.addContent(new RawHtml( 1.32 + linksTree.addContent( 1.33 writer.getDocLink(LinkInfoImpl.Kind.MEMBER, cd, (MemberDoc) member, 1.34 - member.name(), false))); 1.35 + member.name(), false)); 1.36 } 1.37 1.38 /** 1.39 @@ -128,9 +128,9 @@ 1.40 protected void addParam(ExecutableMemberDoc member, Parameter param, 1.41 boolean isVarArg, Content tree) { 1.42 if (param.type() != null) { 1.43 - Content link = new RawHtml(writer.getLink(new LinkInfoImpl( 1.44 + Content link = writer.getLink(new LinkInfoImpl( 1.45 configuration, LinkInfoImpl.Kind.EXECUTABLE_MEMBER_PARAM, 1.46 - param.type(), isVarArg))); 1.47 + param.type(), isVarArg)); 1.48 tree.addContent(link); 1.49 } 1.50 if(param.name().length() > 0) { 1.51 @@ -154,7 +154,7 @@ 1.52 tree.addContent(rcvrType.typeName()); 1.53 LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, 1.54 LinkInfoImpl.Kind.CLASS_SIGNATURE, rcvrType); 1.55 - tree.addContent(new RawHtml(writer.getTypeParameterLinks(linkInfo))); 1.56 + tree.addContent(writer.getTypeParameterLinks(linkInfo)); 1.57 tree.addContent(writer.getSpace()); 1.58 tree.addContent("this"); 1.59 } 1.60 @@ -255,15 +255,15 @@ 1.61 htmltree.addContent(indent); 1.62 htmltree.addContent("throws "); 1.63 indent += " "; 1.64 - Content link = new RawHtml(writer.getLink(new LinkInfoImpl(configuration, 1.65 - LinkInfoImpl.Kind.MEMBER, exceptions[0]))); 1.66 + Content link = writer.getLink(new LinkInfoImpl(configuration, 1.67 + LinkInfoImpl.Kind.MEMBER, exceptions[0])); 1.68 htmltree.addContent(link); 1.69 for(int i = 1; i < exceptions.length; i++) { 1.70 htmltree.addContent(","); 1.71 htmltree.addContent(DocletConstants.NL); 1.72 htmltree.addContent(indent); 1.73 - Content exceptionLink = new RawHtml(writer.getLink(new LinkInfoImpl( 1.74 - configuration, LinkInfoImpl.Kind.MEMBER, exceptions[i]))); 1.75 + Content exceptionLink = writer.getLink(new LinkInfoImpl( 1.76 + configuration, LinkInfoImpl.Kind.MEMBER, exceptions[i])); 1.77 htmltree.addContent(exceptionLink); 1.78 } 1.79 }
2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java Tue May 14 10:14:51 2013 -0700 2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java Tue May 14 10:14:52 2013 -0700 2.3 @@ -139,9 +139,8 @@ 2.4 * @param dlTree the content tree to which the description will be added 2.5 */ 2.6 protected void addDescription(ClassDoc cd, Content dlTree) { 2.7 - Content link = new RawHtml( 2.8 - getLink(new LinkInfoImpl(configuration, 2.9 - LinkInfoImpl.Kind.INDEX, cd, true))); 2.10 + Content link = getLink(new LinkInfoImpl(configuration, 2.11 + LinkInfoImpl.Kind.INDEX, cd, true)); 2.12 Content dt = HtmlTree.DT(link); 2.13 dt.addContent(" - "); 2.14 addClassInfo(cd, dt); 2.15 @@ -162,7 +161,7 @@ 2.16 contentTree.addContent(getResource("doclet.in", 2.17 Util.getTypeName(configuration, cd, false), 2.18 getPackageLinkString(cd.containingPackage(), 2.19 - Util.getPackageName(cd.containingPackage()), false))); 2.20 + Util.escapeHtmlChars(Util.getPackageName(cd.containingPackage())), false))); 2.21 } 2.22 2.23 /**
3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Tue May 14 10:14:51 2013 -0700 3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Tue May 14 10:14:52 2013 -0700 3.3 @@ -292,13 +292,13 @@ 3.4 if (displayLength > 10) { 3.5 code.addContent(new HtmlTree(HtmlTag.BR)); 3.6 } 3.7 - code.addContent(new RawHtml( 3.8 + code.addContent( 3.9 writer.getLink(new LinkInfoImpl(configuration, 3.10 - LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type)))); 3.11 + LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type))); 3.12 } else { 3.13 - code.addContent(new RawHtml( 3.14 + code.addContent( 3.15 writer.getLink(new LinkInfoImpl(configuration, 3.16 - LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type)))); 3.17 + LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type))); 3.18 } 3.19 3.20 }
4.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java Tue May 14 10:14:51 2013 -0700 4.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java Tue May 14 10:14:52 2013 -0700 4.3 @@ -159,11 +159,11 @@ 4.4 String label = italicsClassName(cd, false); 4.5 Content linkContent; 4.6 if(wantFrames){ 4.7 - linkContent = new RawHtml(getLink(new LinkInfoImpl(configuration, 4.8 - LinkInfoImpl.Kind.ALL_CLASSES_FRAME, cd, label, "classFrame"))); 4.9 + linkContent = getLink(new LinkInfoImpl(configuration, 4.10 + LinkInfoImpl.Kind.ALL_CLASSES_FRAME, cd, label, "classFrame")); 4.11 } else { 4.12 - linkContent = new RawHtml(getLink(new LinkInfoImpl( 4.13 - configuration, cd, label))); 4.14 + linkContent = getLink(new LinkInfoImpl( 4.15 + configuration, cd, label)); 4.16 } 4.17 Content li = HtmlTree.LI(linkContent); 4.18 content.addContent(li);
5.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Tue May 14 10:14:51 2013 -0700 5.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Tue May 14 10:14:52 2013 -0700 5.3 @@ -105,9 +105,9 @@ 5.4 Content pre = new HtmlTree(HtmlTag.PRE); 5.5 writer.addAnnotationInfo(member, pre); 5.6 addModifiers(member, pre); 5.7 - Content link = new RawHtml( 5.8 + Content link = 5.9 writer.getLink(new LinkInfoImpl(configuration, 5.10 - LinkInfoImpl.Kind.MEMBER, getType(member)))); 5.11 + LinkInfoImpl.Kind.MEMBER, getType(member))); 5.12 pre.addContent(link); 5.13 pre.addContent(writer.getSpace()); 5.14 if (configuration.linksource) { 5.15 @@ -225,8 +225,8 @@ 5.16 */ 5.17 protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, 5.18 Content tdSummary) { 5.19 - Content strong = HtmlTree.STRONG(new RawHtml( 5.20 - writer.getDocLink(context, (MemberDoc) member, member.name(), false))); 5.21 + Content strong = HtmlTree.STRONG( 5.22 + writer.getDocLink(context, (MemberDoc) member, member.name(), false)); 5.23 Content code = HtmlTree.CODE(strong); 5.24 tdSummary.addContent(code); 5.25 }
6.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Tue May 14 10:14:51 2013 -0700 6.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Tue May 14 10:14:52 2013 -0700 6.3 @@ -116,9 +116,9 @@ 6.4 public Content getNavLinkPrevious() { 6.5 Content li; 6.6 if (prev != null) { 6.7 - Content prevLink = new RawHtml(getLink(new LinkInfoImpl(configuration, 6.8 + Content prevLink = getLink(new LinkInfoImpl(configuration, 6.9 LinkInfoImpl.Kind.CLASS, prev.asClassDoc(), "", 6.10 - configuration.getText("doclet.Prev_Class"), true))); 6.11 + configuration.getText("doclet.Prev_Class"), true)); 6.12 li = HtmlTree.LI(prevLink); 6.13 } 6.14 else 6.15 @@ -134,9 +134,9 @@ 6.16 public Content getNavLinkNext() { 6.17 Content li; 6.18 if (next != null) { 6.19 - Content nextLink = new RawHtml(getLink(new LinkInfoImpl(configuration, 6.20 + Content nextLink = getLink(new LinkInfoImpl(configuration, 6.21 LinkInfoImpl.Kind.CLASS, next.asClassDoc(), "", 6.22 - configuration.getText("doclet.Next_Class"), true))); 6.23 + configuration.getText("doclet.Next_Class"), true)); 6.24 li = HtmlTree.LI(nextLink); 6.25 } 6.26 else 6.27 @@ -167,7 +167,7 @@ 6.28 Content headerContent = new StringContent(header); 6.29 Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true, 6.30 HtmlStyle.title, headerContent); 6.31 - heading.addContent(new RawHtml(getTypeParameterLinks(linkInfo))); 6.32 + heading.addContent(getTypeParameterLinks(linkInfo)); 6.33 div.addContent(heading); 6.34 bodyTree.addContent(div); 6.35 return bodyTree; 6.36 @@ -222,7 +222,7 @@ 6.37 LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, 6.38 LinkInfoImpl.Kind.CLASS_SIGNATURE, annotationType, false); 6.39 Content annotationName = new StringContent(annotationType.name()); 6.40 - Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo)); 6.41 + Content parameterLinks = getTypeParameterLinks(linkInfo); 6.42 if (configuration.linksource) { 6.43 addSrcLink(annotationType, annotationName, pre); 6.44 pre.addContent(parameterLinks);
7.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Tue May 14 10:14:51 2013 -0700 7.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Tue May 14 10:14:52 2013 -0700 7.3 @@ -259,7 +259,7 @@ 7.4 getTableCaption(configuration.getText( 7.5 "doclet.ClassUse_Packages.that.use.0", 7.6 getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc, 7.7 - false))))); 7.8 + false)).toString()))); 7.9 table.addContent(getSummaryTableHeader(packageTableHeader, "col")); 7.10 Content tbody = new HtmlTree(HtmlTag.TBODY); 7.11 Iterator<PackageDoc> it = pkgSet.iterator(); 7.12 @@ -294,7 +294,7 @@ 7.13 getTableCaption(configuration.getText( 7.14 "doclet.ClassUse_PackageAnnotation", 7.15 getLink(new LinkInfoImpl(configuration, 7.16 - LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc, false))))); 7.17 + LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc, false)).toString()))); 7.18 table.addContent(getSummaryTableHeader(packageTableHeader, "col")); 7.19 Content tbody = new HtmlTree(HtmlTag.TBODY); 7.20 Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator(); 7.21 @@ -334,8 +334,8 @@ 7.22 Content link = new RawHtml( 7.23 configuration.getText("doclet.ClassUse_Uses.of.0.in.1", 7.24 getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, 7.25 - classdoc, false)), 7.26 - getPackageLinkString(pkg, Util.getPackageName(pkg), false))); 7.27 + classdoc, false)).toString(), 7.28 + getPackageLinkString(pkg, Util.escapeHtmlChars(Util.getPackageName(pkg)), false))); 7.29 Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link); 7.30 li.addContent(heading); 7.31 addClassUse(pkg, li); 7.32 @@ -369,8 +369,8 @@ 7.33 */ 7.34 protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException { 7.35 String classLink = getLink(new LinkInfoImpl(configuration, 7.36 - LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc, false)); 7.37 - String pkgLink = getPackageLinkString(pkg, Util.getPackageName(pkg), false); 7.38 + LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc, false)).toString(); 7.39 + String pkgLink = getPackageLinkString(pkg, Util.escapeHtmlChars(Util.getPackageName(pkg)), false); 7.40 classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()), 7.41 configuration.getText("doclet.ClassUse_Annotation", classLink, 7.42 pkgLink), classUseTableSummary, contentTree); 7.43 @@ -476,9 +476,9 @@ 7.44 * @return a content tree for the class page link 7.45 */ 7.46 protected Content getNavLinkClass() { 7.47 - Content linkContent = new RawHtml(getLink(new LinkInfoImpl( 7.48 + Content linkContent = getLink(new LinkInfoImpl( 7.49 configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc, 7.50 - "", configuration.getText("doclet.Class"), false))); 7.51 + "", configuration.getText("doclet.Class"), false)); 7.52 Content li = HtmlTree.LI(linkContent); 7.53 return li; 7.54 }
8.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Tue May 14 10:14:51 2013 -0700 8.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Tue May 14 10:14:52 2013 -0700 8.3 @@ -124,9 +124,9 @@ 8.4 public Content getNavLinkPrevious() { 8.5 Content li; 8.6 if (prev != null) { 8.7 - Content prevLink = new RawHtml(getLink(new LinkInfoImpl(configuration, 8.8 + Content prevLink = getLink(new LinkInfoImpl(configuration, 8.9 LinkInfoImpl.Kind.CLASS, prev, "", 8.10 - configuration.getText("doclet.Prev_Class"), true))); 8.11 + configuration.getText("doclet.Prev_Class"), true)); 8.12 li = HtmlTree.LI(prevLink); 8.13 } 8.14 else 8.15 @@ -142,9 +142,9 @@ 8.16 public Content getNavLinkNext() { 8.17 Content li; 8.18 if (next != null) { 8.19 - Content nextLink = new RawHtml(getLink(new LinkInfoImpl(configuration, 8.20 + Content nextLink = getLink(new LinkInfoImpl(configuration, 8.21 LinkInfoImpl.Kind.CLASS, next, "", 8.22 - configuration.getText("doclet.Next_Class"), true))); 8.23 + configuration.getText("doclet.Next_Class"), true)); 8.24 li = HtmlTree.LI(nextLink); 8.25 } 8.26 else 8.27 @@ -191,7 +191,7 @@ 8.28 Content headerContent = new StringContent(header); 8.29 Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true, 8.30 HtmlStyle.title, headerContent); 8.31 - heading.addContent(new RawHtml(getTypeParameterLinks(linkInfo))); 8.32 + heading.addContent(getTypeParameterLinks(linkInfo)); 8.33 div.addContent(heading); 8.34 bodyTree.addContent(div); 8.35 return bodyTree; 8.36 @@ -249,7 +249,7 @@ 8.37 //Let's not link to ourselves in the signature. 8.38 linkInfo.linkToSelf = false; 8.39 Content className = new StringContent(classDoc.name()); 8.40 - Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo)); 8.41 + Content parameterLinks = getTypeParameterLinks(linkInfo); 8.42 if (configuration.linksource) { 8.43 addSrcLink(classDoc, className, pre); 8.44 pre.addContent(parameterLinks); 8.45 @@ -264,9 +264,9 @@ 8.46 if (superclass != null) { 8.47 pre.addContent(DocletConstants.NL); 8.48 pre.addContent("extends "); 8.49 - Content link = new RawHtml(getLink(new LinkInfoImpl(configuration, 8.50 + Content link = getLink(new LinkInfoImpl(configuration, 8.51 LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME, 8.52 - superclass))); 8.53 + superclass)); 8.54 pre.addContent(link); 8.55 } 8.56 } 8.57 @@ -285,9 +285,9 @@ 8.58 } else { 8.59 pre.addContent(", "); 8.60 } 8.61 - Content link = new RawHtml(getLink(new LinkInfoImpl(configuration, 8.62 + Content link = getLink(new LinkInfoImpl(configuration, 8.63 LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME, 8.64 - implIntfacs[i]))); 8.65 + implIntfacs[i])); 8.66 pre.addContent(link); 8.67 counter++; 8.68 } 8.69 @@ -360,22 +360,22 @@ 8.70 private Content getTreeForClassHelper(Type type) { 8.71 Content li = new HtmlTree(HtmlTag.LI); 8.72 if (type.equals(classDoc)) { 8.73 - String typeParameters = getTypeParameterLinks( 8.74 + Content typeParameters = getTypeParameterLinks( 8.75 new LinkInfoImpl(configuration, LinkInfoImpl.Kind.TREE, 8.76 classDoc, false)); 8.77 if (configuration.shouldExcludeQualifier( 8.78 classDoc.containingPackage().name())) { 8.79 li.addContent(type.asClassDoc().name()); 8.80 - li.addContent(new RawHtml(typeParameters)); 8.81 + li.addContent(typeParameters); 8.82 } else { 8.83 li.addContent(type.asClassDoc().qualifiedName()); 8.84 - li.addContent(new RawHtml(typeParameters)); 8.85 + li.addContent(typeParameters); 8.86 } 8.87 } else { 8.88 - Content link = new RawHtml(getLink(new LinkInfoImpl(configuration, 8.89 + Content link = getLink(new LinkInfoImpl(configuration, 8.90 LinkInfoImpl.Kind.CLASS_TREE_PARENT, 8.91 type instanceof ClassDoc ? (ClassDoc) type : type, 8.92 - configuration.getClassName(type.asClassDoc()), false))); 8.93 + configuration.getClassName(type.asClassDoc()), false)); 8.94 li.addContent(link); 8.95 } 8.96 return li; 8.97 @@ -520,8 +520,8 @@ 8.98 Content dt = HtmlTree.DT(label); 8.99 Content dl = HtmlTree.DL(dt); 8.100 Content dd = new HtmlTree(HtmlTag.DD); 8.101 - dd.addContent(new RawHtml(getLink(new LinkInfoImpl(configuration, 8.102 - LinkInfoImpl.Kind.CLASS, outerClass, false)))); 8.103 + dd.addContent(getLink(new LinkInfoImpl(configuration, 8.104 + LinkInfoImpl.Kind.CLASS, outerClass, false))); 8.105 dl.addContent(dd); 8.106 classInfoTree.addContent(dl); 8.107 } 8.108 @@ -578,12 +578,12 @@ 8.109 dd.addContent(separator); 8.110 } 8.111 if (typeList[i] instanceof ClassDoc) { 8.112 - Content link = new RawHtml(getLink( 8.113 - new LinkInfoImpl(configuration, context, (ClassDoc)(typeList[i])))); 8.114 + Content link = getLink( 8.115 + new LinkInfoImpl(configuration, context, (ClassDoc)(typeList[i]))); 8.116 dd.addContent(link); 8.117 } else { 8.118 - Content link = new RawHtml(getLink( 8.119 - new LinkInfoImpl(configuration, context, (Type)(typeList[i])))); 8.120 + Content link = getLink( 8.121 + new LinkInfoImpl(configuration, context, (Type)(typeList[i]))); 8.122 dd.addContent(link); 8.123 } 8.124 }
9.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java Tue May 14 10:14:51 2013 -0700 9.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java Tue May 14 10:14:52 2013 -0700 9.3 @@ -186,7 +186,7 @@ 9.4 //generate links backward only to public classes. 9.5 String classlink = (cd.isPublic() || cd.isProtected()) ? 9.6 getLink(new LinkInfoImpl(configuration, 9.7 - LinkInfoImpl.Kind.CONSTANT_SUMMARY, cd, false)) : 9.8 + LinkInfoImpl.Kind.CONSTANT_SUMMARY, cd, false)).toString() : 9.9 cd.qualifiedName(); 9.10 String name = cd.containingPackage().name(); 9.11 if (name.length() > 0) { 9.12 @@ -260,8 +260,8 @@ 9.13 code.addContent(modifier); 9.14 code.addContent(getSpace()); 9.15 } 9.16 - Content type = new RawHtml(getLink(new LinkInfoImpl(configuration, 9.17 - LinkInfoImpl.Kind.CONSTANT_SUMMARY, member.type()))); 9.18 + Content type = getLink(new LinkInfoImpl(configuration, 9.19 + LinkInfoImpl.Kind.CONSTANT_SUMMARY, member.type())); 9.20 code.addContent(type); 9.21 tdType.addContent(code); 9.22 return tdType; 9.23 @@ -274,8 +274,8 @@ 9.24 * @return the name column of the constant table row 9.25 */ 9.26 private Content getNameColumn(FieldDoc member) { 9.27 - Content nameContent = new RawHtml(getDocLink( 9.28 - LinkInfoImpl.Kind.CONSTANT_SUMMARY, member, member.name(), false)); 9.29 + Content nameContent = getDocLink( 9.30 + LinkInfoImpl.Kind.CONSTANT_SUMMARY, member, member.name(), false); 9.31 Content code = HtmlTree.CODE(nameContent); 9.32 return HtmlTree.TD(code); 9.33 }
10.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java Tue May 14 10:14:51 2013 -0700 10.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java Tue May 14 10:14:52 2013 -0700 10.3 @@ -101,8 +101,8 @@ 10.4 Content pre = new HtmlTree(HtmlTag.PRE); 10.5 writer.addAnnotationInfo(enumConstant, pre); 10.6 addModifiers(enumConstant, pre); 10.7 - Content enumConstantLink = new RawHtml(writer.getLink(new LinkInfoImpl( 10.8 - configuration, LinkInfoImpl.Kind.MEMBER, enumConstant.type()))); 10.9 + Content enumConstantLink = writer.getLink(new LinkInfoImpl( 10.10 + configuration, LinkInfoImpl.Kind.MEMBER, enumConstant.type())); 10.11 pre.addContent(enumConstantLink); 10.12 pre.addContent(" "); 10.13 if (configuration.linksource) { 10.14 @@ -222,8 +222,8 @@ 10.15 */ 10.16 protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, 10.17 Content tdSummary) { 10.18 - Content strong = HtmlTree.STRONG(new RawHtml( 10.19 - writer.getDocLink(context, (MemberDoc) member, member.name(), false))); 10.20 + Content strong = HtmlTree.STRONG( 10.21 + writer.getDocLink(context, (MemberDoc) member, member.name(), false)); 10.22 Content code = HtmlTree.CODE(strong); 10.23 tdSummary.addContent(code); 10.24 }
11.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java Tue May 14 10:14:51 2013 -0700 11.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java Tue May 14 10:14:52 2013 -0700 11.3 @@ -102,8 +102,8 @@ 11.4 Content pre = new HtmlTree(HtmlTag.PRE); 11.5 writer.addAnnotationInfo(field, pre); 11.6 addModifiers(field, pre); 11.7 - Content fieldlink = new RawHtml(writer.getLink(new LinkInfoImpl( 11.8 - configuration, LinkInfoImpl.Kind.MEMBER, field.type()))); 11.9 + Content fieldlink = writer.getLink(new LinkInfoImpl( 11.10 + configuration, LinkInfoImpl.Kind.MEMBER, field.type())); 11.11 pre.addContent(fieldlink); 11.12 pre.addContent(" "); 11.13 if (configuration.linksource) { 11.14 @@ -132,12 +132,12 @@ 11.15 (! (holder.isPublic() || Util.isLinkable(holder, configuration)))) { 11.16 writer.addInlineComment(field, fieldDocTree); 11.17 } else { 11.18 - Content link = new RawHtml( 11.19 + Content link = 11.20 writer.getDocLink(LinkInfoImpl.Kind.FIELD_DOC_COPY, 11.21 holder, field, 11.22 holder.isIncluded() ? 11.23 holder.typeName() : holder.qualifiedTypeName(), 11.24 - false)); 11.25 + false); 11.26 Content codeLink = HtmlTree.CODE(link); 11.27 Content strong = HtmlTree.STRONG(holder.isClass()? 11.28 writer.descfrmClassLabel : writer.descfrmInterfaceLabel); 11.29 @@ -256,8 +256,8 @@ 11.30 */ 11.31 protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, 11.32 Content tdSummary) { 11.33 - Content strong = HtmlTree.STRONG(new RawHtml( 11.34 - writer.getDocLink(context, cd , (MemberDoc) member, member.name(), false))); 11.35 + Content strong = HtmlTree.STRONG( 11.36 + writer.getDocLink(context, cd , (MemberDoc) member, member.name(), false)); 11.37 Content code = HtmlTree.CODE(strong); 11.38 tdSummary.addContent(code); 11.39 } 11.40 @@ -267,9 +267,9 @@ 11.41 */ 11.42 protected void addInheritedSummaryLink(ClassDoc cd, 11.43 ProgramElementDoc member, Content linksTree) { 11.44 - linksTree.addContent(new RawHtml( 11.45 + linksTree.addContent( 11.46 writer.getDocLink(LinkInfoImpl.Kind.MEMBER, cd, (MemberDoc)member, 11.47 - member.name(), false))); 11.48 + member.name(), false)); 11.49 } 11.50 11.51 /**
12.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Tue May 14 10:14:51 2013 -0700 12.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Tue May 14 10:14:52 2013 -0700 12.3 @@ -372,9 +372,9 @@ 12.4 !configuration.isGeneratedDoc(classes[i])) { 12.5 continue; 12.6 } 12.7 - Content classContent = new RawHtml(getLink(new LinkInfoImpl( 12.8 + Content classContent = getLink(new LinkInfoImpl( 12.9 configuration, LinkInfoImpl.Kind.PACKAGE, classes[i], 12.10 - false))); 12.11 + false)); 12.12 Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent); 12.13 HtmlTree tr = HtmlTree.TR(tdClass); 12.14 if (i%2 == 0) 12.15 @@ -1109,9 +1109,9 @@ 12.16 * 12.17 * @return the link for the given class. 12.18 */ 12.19 - public String getLink(LinkInfoImpl linkInfo) { 12.20 + public Content getLink(LinkInfoImpl linkInfo) { 12.21 LinkFactoryImpl factory = new LinkFactoryImpl(this); 12.22 - String link = factory.getLinkOutput(linkInfo).toString(); 12.23 + Content link = factory.getLink(linkInfo); 12.24 displayLength += linkInfo.displayLength; 12.25 return link; 12.26 } 12.27 @@ -1122,9 +1122,9 @@ 12.28 * @param linkInfo the information about the link. 12.29 * @return the type for the given class. 12.30 */ 12.31 - public String getTypeParameterLinks(LinkInfoImpl linkInfo) { 12.32 + public Content getTypeParameterLinks(LinkInfoImpl linkInfo) { 12.33 LinkFactoryImpl factory = new LinkFactoryImpl(this); 12.34 - return factory.getTypeParameterLinks(linkInfo, false).toString(); 12.35 + return factory.getTypeParameterLinks(linkInfo, false); 12.36 } 12.37 12.38 /************************************************************* 12.39 @@ -1192,8 +1192,8 @@ 12.40 * @return a content tree for the link 12.41 */ 12.42 public Content getQualifiedClassLink(LinkInfoImpl.Kind context, ClassDoc cd) { 12.43 - return new RawHtml(getLink(new LinkInfoImpl(configuration, context, cd, 12.44 - configuration.getClassName(cd), ""))); 12.45 + return getLink(new LinkInfoImpl(configuration, context, cd, 12.46 + configuration.getClassName(cd), "")); 12.47 } 12.48 12.49 /** 12.50 @@ -1244,8 +1244,8 @@ 12.51 if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) { 12.52 contentTree.addContent(getPkgName(cd)); 12.53 } 12.54 - contentTree.addContent(new RawHtml(getLink(new LinkInfoImpl(configuration, 12.55 - context, cd, cd.name(), isStrong)))); 12.56 + contentTree.addContent(getLink(new LinkInfoImpl(configuration, 12.57 + context, cd, cd.name(), isStrong))); 12.58 } 12.59 12.60 /** 12.61 @@ -1281,8 +1281,8 @@ 12.62 * @param strong true if the link should be strong. 12.63 * @return the link for the given member. 12.64 */ 12.65 - public String getDocLink(LinkInfoImpl.Kind context, MemberDoc doc, String label, 12.66 - boolean strong) { 12.67 + public Content getDocLink(LinkInfoImpl.Kind context, MemberDoc doc, String label, 12.68 + boolean strong) { 12.69 return getDocLink(context, doc.containingClass(), doc, label, strong); 12.70 } 12.71 12.72 @@ -1298,8 +1298,8 @@ 12.73 * @param strong true if the link should be strong. 12.74 * @return the link for the given member. 12.75 */ 12.76 - public String getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc, 12.77 - String label, boolean strong) { 12.78 + public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc, 12.79 + String label, boolean strong) { 12.80 return getDocLink(context, classDoc, doc, label, strong, false); 12.81 } 12.82 12.83 @@ -1316,11 +1316,11 @@ 12.84 * @param isProperty true if the doc parameter is a JavaFX property. 12.85 * @return the link for the given member. 12.86 */ 12.87 - public String getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc, 12.88 + public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc, 12.89 String label, boolean strong, boolean isProperty) { 12.90 if (! (doc.isIncluded() || 12.91 Util.isLinkable(classDoc, configuration))) { 12.92 - return label; 12.93 + return new RawHtml(label); 12.94 } else if (doc instanceof ExecutableMemberDoc) { 12.95 ExecutableMemberDoc emd = (ExecutableMemberDoc)doc; 12.96 return getLink(new LinkInfoImpl(configuration, context, classDoc, 12.97 @@ -1329,7 +1329,7 @@ 12.98 return getLink(new LinkInfoImpl(configuration, context, classDoc, 12.99 doc.name(), label, strong)); 12.100 } else { 12.101 - return label; 12.102 + return new RawHtml(label); 12.103 } 12.104 } 12.105 12.106 @@ -1351,11 +1351,11 @@ 12.107 return new StringContent(label); 12.108 } else if (doc instanceof ExecutableMemberDoc) { 12.109 ExecutableMemberDoc emd = (ExecutableMemberDoc)doc; 12.110 - return new RawHtml(getLink(new LinkInfoImpl(configuration, context, classDoc, 12.111 - getAnchor(emd), label, false))); 12.112 + return getLink(new LinkInfoImpl(configuration, context, classDoc, 12.113 + getAnchor(emd), label, false)); 12.114 } else if (doc instanceof MemberDoc) { 12.115 - return new RawHtml(getLink(new LinkInfoImpl(configuration, context, classDoc, 12.116 - doc.name(), label, false))); 12.117 + return getLink(new LinkInfoImpl(configuration, context, classDoc, 12.118 + doc.name(), label, false)); 12.119 } else { 12.120 return new StringContent(label); 12.121 } 12.122 @@ -1441,7 +1441,7 @@ 12.123 if (label.isEmpty()) { 12.124 label = plainOrCodeText(plain, refClass.name()); 12.125 } 12.126 - return getLink(new LinkInfoImpl(configuration, refClass, label)); 12.127 + return getLink(new LinkInfoImpl(configuration, refClass, label)).toString(); 12.128 } else if (refMem == null) { 12.129 // Must be a member reference since refClass is not null and refMemName is not null. 12.130 // However, refMem is null, so this referenced member does not exist. 12.131 @@ -1481,7 +1481,7 @@ 12.132 text = plainOrCodeText(plain, Util.escapeHtmlChars(refMemName)); 12.133 12.134 return getDocLink(LinkInfoImpl.Kind.SEE_TAG, containing, 12.135 - refMem, (label.isEmpty() ? text: label), false); 12.136 + refMem, (label.isEmpty() ? text: label), false).toString(); 12.137 } 12.138 } 12.139 12.140 @@ -2147,7 +2147,7 @@ 12.141 linkInfo.label = (type.asClassDoc().isIncluded() ? 12.142 type.typeName() : 12.143 type.qualifiedTypeName()) + type.dimension() + ".class"; 12.144 - return getLink(linkInfo); 12.145 + return getLink(linkInfo).toString(); 12.146 } else { 12.147 return type.typeName() + type.dimension() + ".class"; 12.148 } 12.149 @@ -2163,7 +2163,7 @@ 12.150 } else if (annotationValue.value() instanceof MemberDoc) { 12.151 return getDocLink(LinkInfoImpl.Kind.ANNOTATION, 12.152 (MemberDoc) annotationValue.value(), 12.153 - ((MemberDoc) annotationValue.value()).name(), false); 12.154 + ((MemberDoc) annotationValue.value()).name(), false).toString(); 12.155 } else { 12.156 return annotationValue.toString(); 12.157 }
13.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java Tue May 14 10:14:51 2013 -0700 13.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java Tue May 14 10:14:52 2013 -0700 13.3 @@ -129,8 +129,8 @@ 13.4 if (fieldType == null) { 13.5 pre.addContent(fieldTypeStr); 13.6 } else { 13.7 - Content fieldContent = new RawHtml(writer.getLink(new LinkInfoImpl( 13.8 - configuration, LinkInfoImpl.Kind.SERIAL_MEMBER, fieldType))); 13.9 + Content fieldContent = writer.getLink(new LinkInfoImpl( 13.10 + configuration, LinkInfoImpl.Kind.SERIAL_MEMBER, fieldType)); 13.11 pre.addContent(fieldContent); 13.12 } 13.13 pre.addContent(fieldDimensions + " ");
14.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java Tue May 14 10:14:51 2013 -0700 14.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java Tue May 14 10:14:52 2013 -0700 14.3 @@ -28,6 +28,8 @@ 14.4 import java.util.List; 14.5 14.6 import com.sun.javadoc.*; 14.7 +import com.sun.tools.doclets.formats.html.markup.ContentBuilder; 14.8 +import com.sun.tools.doclets.formats.html.markup.RawHtml; 14.9 import com.sun.tools.doclets.internal.toolkit.*; 14.10 import com.sun.tools.doclets.internal.toolkit.util.*; 14.11 import com.sun.tools.doclets.internal.toolkit.util.links.*; 14.12 @@ -54,14 +56,14 @@ 14.13 /** 14.14 * {@inheritDoc} 14.15 */ 14.16 - protected LinkOutput getOutputInstance() { 14.17 - return new LinkOutputImpl(); 14.18 + protected Content newContent() { 14.19 + return new ContentBuilder(); 14.20 } 14.21 14.22 /** 14.23 * {@inheritDoc} 14.24 */ 14.25 - protected LinkOutput getClassLink(LinkInfo linkInfo) { 14.26 + protected Content getClassLink(LinkInfo linkInfo) { 14.27 LinkInfoImpl classLinkInfo = (LinkInfoImpl) linkInfo; 14.28 boolean noLabel = linkInfo.label == null || linkInfo.label.length() == 0; 14.29 ClassDoc classDoc = classLinkInfo.classDoc; 14.30 @@ -77,21 +79,21 @@ 14.31 classLinkInfo.getClassLinkLabel(m_writer.configuration)); 14.32 classLinkInfo.displayLength += label.length(); 14.33 Configuration configuration = m_writer.configuration; 14.34 - LinkOutputImpl linkOutput = new LinkOutputImpl(); 14.35 + Content link = new ContentBuilder(); 14.36 if (classDoc.isIncluded()) { 14.37 if (configuration.isGeneratedDoc(classDoc)) { 14.38 DocPath filename = getPath(classLinkInfo); 14.39 if (linkInfo.linkToSelf || 14.40 !(DocPath.forName(classDoc)).equals(m_writer.filename)) { 14.41 - linkOutput.append(m_writer.getHyperLinkString( 14.42 + link.addContent(new RawHtml(m_writer.getHyperLinkString( 14.43 filename.fragment(classLinkInfo.where), 14.44 label.toString(), 14.45 classLinkInfo.isStrong, classLinkInfo.styleName, 14.46 - title, classLinkInfo.target)); 14.47 + title, classLinkInfo.target))); 14.48 if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { 14.49 - linkOutput.append(getTypeParameterLinks(linkInfo).toString()); 14.50 + link.addContent(getTypeParameterLinks(linkInfo)); 14.51 } 14.52 - return linkOutput; 14.53 + return link; 14.54 } 14.55 } 14.56 } else { 14.57 @@ -100,25 +102,25 @@ 14.58 label.toString(), classLinkInfo.isStrong, classLinkInfo.styleName, 14.59 true); 14.60 if (crossLink != null) { 14.61 - linkOutput.append(crossLink); 14.62 + link.addContent(new RawHtml(crossLink)); 14.63 if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { 14.64 - linkOutput.append(getTypeParameterLinks(linkInfo).toString()); 14.65 + link.addContent(getTypeParameterLinks(linkInfo)); 14.66 } 14.67 - return linkOutput; 14.68 + return link; 14.69 } 14.70 } 14.71 // Can't link so just write label. 14.72 - linkOutput.append(label.toString()); 14.73 + link.addContent(new RawHtml(label.toString())); 14.74 if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { 14.75 - linkOutput.append(getTypeParameterLinks(linkInfo).toString()); 14.76 + link.addContent(getTypeParameterLinks(linkInfo)); 14.77 } 14.78 - return linkOutput; 14.79 + return link; 14.80 } 14.81 14.82 /** 14.83 * {@inheritDoc} 14.84 */ 14.85 - protected LinkOutput getTypeParameterLink(LinkInfo linkInfo, 14.86 + protected Content getTypeParameterLink(LinkInfo linkInfo, 14.87 Type typeParam) { 14.88 LinkInfoImpl typeLinkInfo = new LinkInfoImpl(m_writer.configuration, 14.89 ((LinkInfoImpl) linkInfo).getContext(), typeParam); 14.90 @@ -126,29 +128,29 @@ 14.91 typeLinkInfo.excludeTypeParameterLinks = linkInfo.excludeTypeParameterLinks; 14.92 typeLinkInfo.linkToSelf = linkInfo.linkToSelf; 14.93 typeLinkInfo.isJava5DeclarationLocation = false; 14.94 - LinkOutput output = getLinkOutput(typeLinkInfo); 14.95 + Content output = getLink(typeLinkInfo); 14.96 ((LinkInfoImpl) linkInfo).displayLength += typeLinkInfo.displayLength; 14.97 return output; 14.98 } 14.99 14.100 - protected LinkOutput getTypeAnnotationLink(LinkInfo linkInfo, 14.101 + protected Content getTypeAnnotationLink(LinkInfo linkInfo, 14.102 AnnotationDesc annotation) { 14.103 throw new RuntimeException("Not implemented yet!"); 14.104 } 14.105 14.106 - public LinkOutput getTypeAnnotationLinks(LinkInfo linkInfo) { 14.107 - LinkOutput output = getOutputInstance(); 14.108 + public Content getTypeAnnotationLinks(LinkInfo linkInfo) { 14.109 + ContentBuilder links = new ContentBuilder(); 14.110 AnnotationDesc[] annotations; 14.111 if (linkInfo.type instanceof AnnotatedType) { 14.112 annotations = linkInfo.type.asAnnotatedType().annotations(); 14.113 } else if (linkInfo.type instanceof TypeVariable) { 14.114 annotations = linkInfo.type.asTypeVariable().annotations(); 14.115 } else { 14.116 - return output; 14.117 + return links; 14.118 } 14.119 14.120 if (annotations.length == 0) 14.121 - return output; 14.122 + return links; 14.123 14.124 List<String> annos = m_writer.getAnnotations(0, annotations, false, linkInfo.isJava5DeclarationLocation); 14.125 14.126 @@ -156,17 +158,17 @@ 14.127 for (String anno : annos) { 14.128 if (!isFirst) { 14.129 linkInfo.displayLength += 1; 14.130 - output.append(" "); 14.131 + links.addContent(" "); 14.132 } 14.133 - output.append(anno); 14.134 + links.addContent(new RawHtml(anno)); 14.135 isFirst = false; 14.136 } 14.137 if (!annos.isEmpty()) { 14.138 linkInfo.displayLength += 1; 14.139 - output.append(" "); 14.140 + links.addContent(" "); 14.141 } 14.142 14.143 - return output; 14.144 + return links; 14.145 } 14.146 14.147 /** 14.148 @@ -182,16 +184,16 @@ 14.149 classDoc.name()); 14.150 } else if (classDoc.isInterface()){ 14.151 return configuration.getText("doclet.Href_Interface_Title", 14.152 - Util.getPackageName(classDoc.containingPackage())); 14.153 + Util.escapeHtmlChars(Util.getPackageName(classDoc.containingPackage()))); 14.154 } else if (classDoc.isAnnotationType()) { 14.155 return configuration.getText("doclet.Href_Annotation_Title", 14.156 - Util.getPackageName(classDoc.containingPackage())); 14.157 + Util.escapeHtmlChars(Util.getPackageName(classDoc.containingPackage()))); 14.158 } else if (classDoc.isEnum()) { 14.159 return configuration.getText("doclet.Href_Enum_Title", 14.160 - Util.getPackageName(classDoc.containingPackage())); 14.161 + Util.escapeHtmlChars(Util.getPackageName(classDoc.containingPackage()))); 14.162 } else { 14.163 return configuration.getText("doclet.Href_Class_Title", 14.164 - Util.getPackageName(classDoc.containingPackage())); 14.165 + Util.escapeHtmlChars(Util.getPackageName(classDoc.containingPackage()))); 14.166 } 14.167 } 14.168
15.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Tue May 14 10:14:51 2013 -0700 15.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Tue May 14 10:14:52 2013 -0700 15.3 @@ -152,12 +152,12 @@ 15.4 Util.isLinkable(holderClassDoc, configuration)))) { 15.5 writer.addInlineComment(method, methodDocTree); 15.6 } else { 15.7 - Content link = new RawHtml( 15.8 + Content link = 15.9 writer.getDocLink(LinkInfoImpl.Kind.METHOD_DOC_COPY, 15.10 holder.asClassDoc(), method, 15.11 holder.asClassDoc().isIncluded() ? 15.12 holder.typeName() : holder.qualifiedTypeName(), 15.13 - false)); 15.14 + false); 15.15 Content codelLink = HtmlTree.CODE(link); 15.16 Content strong = HtmlTree.STRONG(holder.asClassDoc().isClass()? 15.17 writer.descfrmClassLabel : writer.descfrmInterfaceLabel); 15.18 @@ -311,14 +311,14 @@ 15.19 } 15.20 Content dt = HtmlTree.DT(HtmlTree.STRONG(label)); 15.21 dl.addContent(dt); 15.22 - Content overriddenTypeLink = new RawHtml( 15.23 - writer.getLink(new LinkInfoImpl(writer.configuration, context, overriddenType))); 15.24 + Content overriddenTypeLink = 15.25 + writer.getLink(new LinkInfoImpl(writer.configuration, context, overriddenType)); 15.26 Content codeOverridenTypeLink = HtmlTree.CODE(overriddenTypeLink); 15.27 String name = method.name(); 15.28 - Content methlink = new RawHtml(writer.getLink( 15.29 + Content methlink = writer.getLink( 15.30 new LinkInfoImpl(writer.configuration, LinkInfoImpl.Kind.MEMBER, 15.31 overriddenType.asClassDoc(), 15.32 - writer.getAnchor(method), name, false))); 15.33 + writer.getAnchor(method), name, false)); 15.34 Content codeMethLink = HtmlTree.CODE(methlink); 15.35 Content dd = HtmlTree.DD(codeMethLink); 15.36 dd.addContent(writer.getSpace()); 15.37 @@ -361,14 +361,14 @@ 15.38 for (int i = 0; i < implementedMethods.length; i++) { 15.39 MethodDoc implementedMeth = implementedMethods[i]; 15.40 Type intfac = implementedMethodsFinder.getMethodHolder(implementedMeth); 15.41 - Content intfaclink = new RawHtml(writer.getLink(new LinkInfoImpl( 15.42 - writer.configuration, LinkInfoImpl.Kind.METHOD_SPECIFIED_BY, intfac))); 15.43 + Content intfaclink = writer.getLink(new LinkInfoImpl( 15.44 + writer.configuration, LinkInfoImpl.Kind.METHOD_SPECIFIED_BY, intfac)); 15.45 Content codeIntfacLink = HtmlTree.CODE(intfaclink); 15.46 Content dt = HtmlTree.DT(HtmlTree.STRONG(writer.specifiedByLabel)); 15.47 dl.addContent(dt); 15.48 - Content methlink = new RawHtml(writer.getDocLink( 15.49 + Content methlink = writer.getDocLink( 15.50 LinkInfoImpl.Kind.MEMBER, implementedMeth, 15.51 - implementedMeth.name(), false)); 15.52 + implementedMeth.name(), false); 15.53 Content codeMethLink = HtmlTree.CODE(methlink); 15.54 Content dd = HtmlTree.DD(codeMethLink); 15.55 dd.addContent(writer.getSpace()); 15.56 @@ -388,8 +388,8 @@ 15.57 protected void addReturnType(MethodDoc method, Content htmltree) { 15.58 Type type = method.returnType(); 15.59 if (type != null) { 15.60 - Content linkContent = new RawHtml(writer.getLink( 15.61 - new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type))); 15.62 + Content linkContent = writer.getLink( 15.63 + new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type)); 15.64 htmltree.addContent(linkContent); 15.65 htmltree.addContent(writer.getSpace()); 15.66 }
16.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java Tue May 14 10:14:51 2013 -0700 16.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java Tue May 14 10:14:52 2013 -0700 16.3 @@ -26,7 +26,6 @@ 16.4 package com.sun.tools.doclets.formats.html; 16.5 16.6 import java.io.*; 16.7 -import java.util.*; 16.8 16.9 import com.sun.javadoc.*; 16.10 import com.sun.tools.doclets.formats.html.markup.*; 16.11 @@ -165,8 +164,8 @@ 16.12 */ 16.13 protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, 16.14 Content tdSummary) { 16.15 - Content strong = HtmlTree.STRONG(new RawHtml( 16.16 - writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member, false)))); 16.17 + Content strong = HtmlTree.STRONG( 16.18 + writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member, false))); 16.19 Content code = HtmlTree.CODE(strong); 16.20 tdSummary.addContent(code); 16.21 } 16.22 @@ -176,9 +175,9 @@ 16.23 */ 16.24 protected void addInheritedSummaryLink(ClassDoc cd, 16.25 ProgramElementDoc member, Content linksTree) { 16.26 - linksTree.addContent(new RawHtml( 16.27 + linksTree.addContent( 16.28 writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, 16.29 - (ClassDoc)member, false)))); 16.30 + (ClassDoc)member, false))); 16.31 } 16.32 16.33 /**
17.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Tue May 14 10:14:51 2013 -0700 17.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Tue May 14 10:14:52 2013 -0700 17.3 @@ -94,7 +94,7 @@ 17.4 packgen = new PackageFrameWriter(configuration, packageDoc); 17.5 String pkgName = Util.getPackageName(packageDoc); 17.6 Content body = packgen.getBody(false, packgen.getWindowTitle(pkgName)); 17.7 - Content pkgNameContent = new RawHtml(pkgName); 17.8 + Content pkgNameContent = new RawHtml(Util.escapeHtmlChars(pkgName)); 17.9 Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, 17.10 packgen.getTargetPackageLink(packageDoc, "classFrame", pkgNameContent)); 17.11 body.addContent(heading); 17.12 @@ -182,10 +182,10 @@ 17.13 contentTree.addContent(heading); 17.14 printedHeader = true; 17.15 } 17.16 - Content link = new RawHtml (getLink(new LinkInfoImpl(configuration, 17.17 + Content link = getLink(new LinkInfoImpl(configuration, 17.18 LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i], 17.19 (arr[i].isInterface() ? italicsText(arr[i].name()) : 17.20 - arr[i].name()),"classFrame"))); 17.21 + arr[i].name()),"classFrame")); 17.22 Content li = HtmlTree.LI(link); 17.23 ul.addContent(li); 17.24 }
18.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java Tue May 14 10:14:51 2013 -0700 18.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java Tue May 14 10:14:52 2013 -0700 18.3 @@ -1,5 +1,5 @@ 18.4 /* 18.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 18.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 18.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.8 * 18.9 * This code is free software; you can redistribute it and/or modify it 18.10 @@ -115,7 +115,7 @@ 18.11 protected void generatePackageTreeFile() throws IOException { 18.12 Content body = getPackageTreeHeader(); 18.13 Content headContent = getResource("doclet.Hierarchy_For_Package", 18.14 - Util.getPackageName(packagedoc)); 18.15 + Util.escapeHtmlChars(Util.getPackageName(packagedoc))); 18.16 Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, 18.17 HtmlStyle.title, headContent); 18.18 Content div = HtmlTree.DIV(HtmlStyle.header, heading);
19.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Tue May 14 10:14:51 2013 -0700 19.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Tue May 14 10:14:52 2013 -0700 19.3 @@ -1,5 +1,5 @@ 19.4 /* 19.5 - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 19.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. 19.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.8 * 19.9 * This code is free software; you can redistribute it and/or modify it 19.10 @@ -154,7 +154,7 @@ 19.11 Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary, 19.12 getTableCaption(configuration.getText( 19.13 "doclet.ClassUse_Packages.that.use.0", 19.14 - getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false)))); 19.15 + getPackageLinkString(pkgdoc, Util.escapeHtmlChars(Util.getPackageName(pkgdoc)), false)))); 19.16 table.addContent(getSummaryTableHeader(packageTableHeader, "col")); 19.17 Content tbody = new HtmlTree(HtmlTag.TBODY); 19.18 Iterator<String> it = usingPackageToUsedClasses.keySet().iterator(); 19.19 @@ -199,8 +199,8 @@ 19.20 Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, 19.21 getTableCaption(configuration.getText( 19.22 "doclet.ClassUse_Classes.in.0.used.by.1", 19.23 - getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false), 19.24 - getPackageLinkString(usingPackage,Util.getPackageName(usingPackage), false)))); 19.25 + getPackageLinkString(pkgdoc, Util.escapeHtmlChars(Util.getPackageName(pkgdoc)), false), 19.26 + getPackageLinkString(usingPackage, Util.escapeHtmlChars(Util.getPackageName(usingPackage)), false)))); 19.27 table.addContent(getSummaryTableHeader(classTableHeader, "col")); 19.28 Content tbody = new HtmlTree(HtmlTag.TBODY); 19.29 Iterator<ClassDoc> itc = 19.30 @@ -247,7 +247,7 @@ 19.31 protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException { 19.32 Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst, 19.33 getHyperLink(Util.getPackageName(pkg), 19.34 - new RawHtml(Util.getPackageName(pkg)))); 19.35 + new StringContent(Util.getPackageName(pkg)))); 19.36 contentTree.addContent(tdFirst); 19.37 HtmlTree tdLast = new HtmlTree(HtmlTag.TD); 19.38 tdLast.addStyle(HtmlStyle.colLast);
20.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Tue May 14 10:14:51 2013 -0700 20.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Tue May 14 10:14:52 2013 -0700 20.3 @@ -178,9 +178,9 @@ 20.4 !configuration.isGeneratedDoc(classes[i])) { 20.5 continue; 20.6 } 20.7 - Content classContent = new RawHtml(getLink(new LinkInfoImpl( 20.8 + Content classContent = getLink(new LinkInfoImpl( 20.9 configuration, LinkInfoImpl.Kind.PACKAGE, classes[i], 20.10 - false))); 20.11 + false)); 20.12 Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent); 20.13 HtmlTree tr = HtmlTree.TR(tdClass); 20.14 if (i%2 == 0)
21.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java Tue May 14 10:14:51 2013 -0700 21.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java Tue May 14 10:14:52 2013 -0700 21.3 @@ -173,10 +173,10 @@ 21.4 contentTree.addContent(heading); 21.5 printedHeader = true; 21.6 } 21.7 - Content link = new RawHtml (getLink(new LinkInfoImpl(configuration, 21.8 + Content link = getLink(new LinkInfoImpl(configuration, 21.9 LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i], 21.10 (arr[i].isInterface() ? italicsText(arr[i].name()) : 21.11 - arr[i].name()),"classFrame"))); 21.12 + arr[i].name()),"classFrame")); 21.13 Content li = HtmlTree.LI(link); 21.14 ul.addContent(li); 21.15 }
22.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java Tue May 14 10:14:51 2013 -0700 22.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java Tue May 14 10:14:52 2013 -0700 22.3 @@ -98,9 +98,9 @@ 22.4 Content pre = new HtmlTree(HtmlTag.PRE); 22.5 writer.addAnnotationInfo(property, pre); 22.6 addModifiers(property, pre); 22.7 - Content propertylink = new RawHtml(writer.getLink(new LinkInfoImpl( 22.8 + Content propertylink = writer.getLink(new LinkInfoImpl( 22.9 configuration, LinkInfoImpl.Kind.MEMBER, 22.10 - property.returnType()))); 22.11 + property.returnType())); 22.12 pre.addContent(propertylink); 22.13 pre.addContent(" "); 22.14 if (configuration.linksource) { 22.15 @@ -128,12 +128,12 @@ 22.16 (! (holder.isPublic() || Util.isLinkable(holder, configuration)))) { 22.17 writer.addInlineComment(property, propertyDocTree); 22.18 } else { 22.19 - Content link = new RawHtml( 22.20 + Content link = 22.21 writer.getDocLink(LinkInfoImpl.Kind.PROPERTY_DOC_COPY, 22.22 holder, property, 22.23 holder.isIncluded() ? 22.24 holder.typeName() : holder.qualifiedTypeName(), 22.25 - false)); 22.26 + false); 22.27 Content codeLink = HtmlTree.CODE(link); 22.28 Content strong = HtmlTree.STRONG(holder.isClass()? 22.29 writer.descfrmClassLabel : writer.descfrmInterfaceLabel); 22.30 @@ -252,13 +252,13 @@ 22.31 */ 22.32 protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, 22.33 Content tdSummary) { 22.34 - Content strong = HtmlTree.STRONG(new RawHtml( 22.35 + Content strong = HtmlTree.STRONG( 22.36 writer.getDocLink(context, 22.37 cd, 22.38 (MemberDoc) member, 22.39 member.name().substring(0, member.name().lastIndexOf("Property")), 22.40 false, 22.41 - true))); 22.42 + true)); 22.43 22.44 Content code = HtmlTree.CODE(strong); 22.45 tdSummary.addContent(code); 22.46 @@ -269,12 +269,12 @@ 22.47 */ 22.48 protected void addInheritedSummaryLink(ClassDoc cd, 22.49 ProgramElementDoc member, Content linksTree) { 22.50 - linksTree.addContent(new RawHtml( 22.51 + linksTree.addContent( 22.52 writer.getDocLink(LinkInfoImpl.Kind.MEMBER, cd, (MemberDoc)member, 22.53 ((member.name().lastIndexOf("Property") != -1) && configuration.javafx) 22.54 ? member.name().substring(0, member.name().length() - "Property".length()) 22.55 : member.name(), 22.56 - false, true))); 22.57 + false, true)); 22.58 } 22.59 22.60 /**
23.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java Tue May 14 10:14:51 2013 -0700 23.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java Tue May 14 10:14:52 2013 -0700 23.3 @@ -127,9 +127,9 @@ 23.4 * @return a content tree for the class header 23.5 */ 23.6 public Content getClassHeader(ClassDoc classDoc) { 23.7 - String classLink = (classDoc.isPublic() || classDoc.isProtected())? 23.8 + String classLink = (classDoc.isPublic() || classDoc.isProtected()) ? 23.9 getLink(new LinkInfoImpl(configuration, classDoc, 23.10 - configuration.getClassName(classDoc))): 23.11 + configuration.getClassName(classDoc))).toString() : 23.12 classDoc.qualifiedName(); 23.13 Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor( 23.14 classDoc.qualifiedName())); 23.15 @@ -137,7 +137,7 @@ 23.16 classDoc.superclassType() != null ? 23.17 getLink(new LinkInfoImpl(configuration, 23.18 LinkInfoImpl.Kind.SERIALIZED_FORM, 23.19 - classDoc.superclassType())) : 23.20 + classDoc.superclassType())).toString() : 23.21 null; 23.22 23.23 //Print the heading.
24.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Tue May 14 10:14:51 2013 -0700 24.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Tue May 14 10:14:52 2013 -0700 24.3 @@ -248,7 +248,7 @@ 24.4 htmlWriter.codeText(throwsTag.exceptionName()) : 24.5 htmlWriter.codeText( 24.6 htmlWriter.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, 24.7 - throwsTag.exceptionType()))); 24.8 + throwsTag.exceptionType())).toString()); 24.9 TagletOutput text = new TagletOutputImpl( 24.10 htmlWriter.commentTagsToString(throwsTag, null, 24.11 throwsTag.inlineTags(), false)); 24.12 @@ -265,7 +265,7 @@ 24.13 public TagletOutput throwsTagOutput(Type throwsType) { 24.14 return new TagletOutputImpl(DocletConstants.NL + "<dd>" + 24.15 htmlWriter.codeText(htmlWriter.getLink( 24.16 - new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, throwsType))) + "</dd>"); 24.17 + new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, throwsType)).toString()) + "</dd>"); 24.18 } 24.19 24.20 /** 24.21 @@ -275,7 +275,7 @@ 24.22 boolean includeLink) { 24.23 return new TagletOutputImpl(includeLink ? 24.24 htmlWriter.getDocLink(LinkInfoImpl.Kind.VALUE_TAG, field, 24.25 - constantVal, false) : constantVal); 24.26 + constantVal, false).toString() : constantVal); 24.27 } 24.28 24.29 /**
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 25.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java Tue May 14 10:14:52 2013 -0700 25.3 @@ -0,0 +1,88 @@ 25.4 +/* 25.5 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 25.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.7 + * 25.8 + * This code is free software; you can redistribute it and/or modify it 25.9 + * under the terms of the GNU General Public License version 2 only, as 25.10 + * published by the Free Software Foundation. Oracle designates this 25.11 + * particular file as subject to the "Classpath" exception as provided 25.12 + * by Oracle in the LICENSE file that accompanied this code. 25.13 + * 25.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 25.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 25.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25.17 + * version 2 for more details (a copy is included in the LICENSE file that 25.18 + * accompanied this code). 25.19 + * 25.20 + * You should have received a copy of the GNU General Public License version 25.21 + * 2 along with this work; if not, write to the Free Software Foundation, 25.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25.23 + * 25.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 25.25 + * or visit www.oracle.com if you need additional information or have any 25.26 + * questions. 25.27 + */ 25.28 + 25.29 +package com.sun.tools.doclets.formats.html.markup; 25.30 + 25.31 +import java.io.IOException; 25.32 +import java.io.Writer; 25.33 +import java.util.ArrayList; 25.34 +import java.util.Collections; 25.35 +import java.util.List; 25.36 +import com.sun.tools.doclets.internal.toolkit.Content; 25.37 + 25.38 +/** 25.39 + * A sequence of Content nodes. 25.40 + */ 25.41 +public class ContentBuilder extends Content { 25.42 + protected List<Content> contents = Collections.<Content>emptyList(); 25.43 + 25.44 + @Override 25.45 + public void addContent(Content content) { 25.46 + if (content.isEmpty()) 25.47 + return; 25.48 + ensureMutableContents(); 25.49 + if (content instanceof ContentBuilder) { 25.50 + contents.addAll(((ContentBuilder) content).contents); 25.51 + } else 25.52 + contents.add(content); 25.53 + } 25.54 + 25.55 + @Override 25.56 + public void addContent(String text) { 25.57 + if (text.isEmpty()) 25.58 + return; 25.59 + ensureMutableContents(); 25.60 + Content c = contents.isEmpty() ? null : contents.get(contents.size() - 1); 25.61 + StringContent sc; 25.62 + if (c != null && c instanceof StringContent) { 25.63 + sc = (StringContent) c; 25.64 + } else { 25.65 + contents.add(sc = new StringContent()); 25.66 + } 25.67 + sc.addContent(text); 25.68 + } 25.69 + 25.70 + @Override 25.71 + public boolean write(Writer writer, boolean atNewline) throws IOException { 25.72 + for (Content content: contents) { 25.73 + atNewline = content.write(writer, atNewline); 25.74 + } 25.75 + return atNewline; 25.76 + } 25.77 + 25.78 + @Override 25.79 + public boolean isEmpty() { 25.80 + for (Content content: contents) { 25.81 + if (!content.isEmpty()) 25.82 + return false; 25.83 + } 25.84 + return true; 25.85 + } 25.86 + 25.87 + private void ensureMutableContents() { 25.88 + if (contents.isEmpty()) 25.89 + contents = new ArrayList<Content>(); 25.90 + } 25.91 +}
26.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Tue May 14 10:14:51 2013 -0700 26.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Tue May 14 10:14:52 2013 -0700 26.3 @@ -1,5 +1,5 @@ 26.4 /* 26.5 - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 26.6 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 26.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.8 * 26.9 * This code is free software; you can redistribute it and/or modify it 26.10 @@ -132,7 +132,7 @@ 26.11 */ 26.12 public static HtmlTree A(String ref, Content body) { 26.13 HtmlTree htmltree = new HtmlTree(HtmlTag.A, nullCheck(body)); 26.14 - htmltree.addAttr(HtmlAttr.HREF, nullCheck(ref)); 26.15 + htmltree.addAttr(HtmlAttr.HREF, Util.escapeHtmlChars(nullCheck(ref))); 26.16 return htmltree; 26.17 } 26.18
27.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Tue May 14 10:14:51 2013 -0700 27.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Tue May 14 10:14:52 2013 -0700 27.3 @@ -196,7 +196,7 @@ 27.4 configuration.getText("doclet.Type")); 27.5 overviewLabel = getResource("doclet.Overview"); 27.6 defaultPackageLabel = new RawHtml( 27.7 - DocletConstants.DEFAULT_PACKAGE_NAME); 27.8 + Util.escapeHtmlChars(DocletConstants.DEFAULT_PACKAGE_NAME)); 27.9 packageLabel = getResource("doclet.Package"); 27.10 profileLabel = getResource("doclet.Profile"); 27.11 useLabel = getResource("doclet.navClassUse");
28.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java Tue May 14 10:14:51 2013 -0700 28.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java Tue May 14 10:14:52 2013 -0700 28.3 @@ -1,5 +1,5 @@ 28.4 /* 28.5 - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 28.6 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 28.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 28.8 * 28.9 * This code is free software; you can redistribute it and/or modify it 28.10 @@ -106,32 +106,4 @@ 28.11 t.getClass(); 28.12 return t; 28.13 } 28.14 - 28.15 - /** 28.16 - * Returns true if the content ends with a newline character. Empty content 28.17 - * is considered as ending with new line. 28.18 - * 28.19 - * @param contentBuilder content to test for newline character at the end 28.20 - * @return true if the content ends with newline. 28.21 - */ 28.22 - protected boolean endsWithNewLine(StringBuilder contentBuilder) { 28.23 - int contentLength = contentBuilder.length(); 28.24 - if (contentLength == 0) { 28.25 - return true; 28.26 - } 28.27 - int nlLength = DocletConstants.NL.length(); 28.28 - if (contentLength < nlLength) { 28.29 - return false; 28.30 - } 28.31 - int contentIndex = contentLength - 1; 28.32 - int nlIndex = nlLength - 1; 28.33 - while (nlIndex >= 0) { 28.34 - if (contentBuilder.charAt(contentIndex) != DocletConstants.NL.charAt(nlIndex)) { 28.35 - return false; 28.36 - } 28.37 - contentIndex--; 28.38 - nlIndex--; 28.39 - } 28.40 - return true; 28.41 - } 28.42 }
29.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java Tue May 14 10:14:51 2013 -0700 29.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java Tue May 14 10:14:52 2013 -0700 29.3 @@ -121,7 +121,7 @@ 29.4 */ 29.5 public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception { 29.6 contentTree = packageWriter.getPackageHeader( 29.7 - Util.getPackageName(packageDoc)); 29.8 + Util.escapeHtmlChars(Util.getPackageName(packageDoc))); 29.9 buildChildren(node, contentTree); 29.10 packageWriter.addPackageFooter(contentTree); 29.11 packageWriter.printDocument(contentTree);
30.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java Tue May 14 10:14:51 2013 -0700 30.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java Tue May 14 10:14:52 2013 -0700 30.3 @@ -1,5 +1,5 @@ 30.4 /* 30.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 30.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 30.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 30.8 * 30.9 * This code is free software; you can redistribute it and/or modify it 30.10 @@ -52,7 +52,7 @@ 30.11 /** 30.12 * The default package name. 30.13 */ 30.14 - public static final String DEFAULT_PACKAGE_NAME = "<Unnamed>"; 30.15 + public static final String DEFAULT_PACKAGE_NAME = "<Unnamed>"; 30.16 30.17 /** 30.18 * The default package file name.
31.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java Tue May 14 10:14:51 2013 -0700 31.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java Tue May 14 10:14:52 2013 -0700 31.3 @@ -26,6 +26,7 @@ 31.4 package com.sun.tools.doclets.internal.toolkit.util.links; 31.5 31.6 import com.sun.javadoc.*; 31.7 +import com.sun.tools.doclets.internal.toolkit.Content; 31.8 31.9 /** 31.10 * A factory that constructs links from given link information. 31.11 @@ -41,11 +42,11 @@ 31.12 public abstract class LinkFactory { 31.13 31.14 /** 31.15 - * Return an empty instance of the link output object. 31.16 + * Return an empty instance of a content object. 31.17 * 31.18 - * @return an empty instance of the link output object. 31.19 + * @return an empty instance of a content object. 31.20 */ 31.21 - protected abstract LinkOutput getOutputInstance(); 31.22 + protected abstract Content newContent(); 31.23 31.24 /** 31.25 * Constructs a link from the given link information. 31.26 @@ -53,41 +54,41 @@ 31.27 * @param linkInfo the information about the link. 31.28 * @return the output of the link. 31.29 */ 31.30 - public LinkOutput getLinkOutput(LinkInfo linkInfo) { 31.31 + public Content getLink(LinkInfo linkInfo) { 31.32 if (linkInfo.type != null) { 31.33 Type type = linkInfo.type; 31.34 - LinkOutput linkOutput = getOutputInstance(); 31.35 + Content link = newContent(); 31.36 if (type.isPrimitive()) { 31.37 //Just a primitive. 31.38 linkInfo.displayLength += type.typeName().length(); 31.39 - linkOutput.append(type.typeName()); 31.40 + link.addContent(type.typeName()); 31.41 } else if (type.asAnnotatedType() != null && type.dimension().length() == 0) { 31.42 - linkOutput.append(getTypeAnnotationLinks(linkInfo)); 31.43 + link.addContent(getTypeAnnotationLinks(linkInfo)); 31.44 linkInfo.type = type.asAnnotatedType().underlyingType(); 31.45 - linkOutput.append(getLinkOutput(linkInfo)); 31.46 - return linkOutput; 31.47 + link.addContent(getLink(linkInfo)); 31.48 + return link; 31.49 } else if (type.asWildcardType() != null) { 31.50 //Wildcard type. 31.51 linkInfo.isTypeBound = true; 31.52 linkInfo.displayLength += 1; 31.53 - linkOutput.append("?"); 31.54 + link.addContent("?"); 31.55 WildcardType wildcardType = type.asWildcardType(); 31.56 Type[] extendsBounds = wildcardType.extendsBounds(); 31.57 for (int i = 0; i < extendsBounds.length; i++) { 31.58 linkInfo.displayLength += i > 0 ? 2 : 9; 31.59 - linkOutput.append(i > 0 ? ", " : " extends "); 31.60 + link.addContent(i > 0 ? ", " : " extends "); 31.61 setBoundsLinkInfo(linkInfo, extendsBounds[i]); 31.62 - linkOutput.append(getLinkOutput(linkInfo)); 31.63 + link.addContent(getLink(linkInfo)); 31.64 } 31.65 Type[] superBounds = wildcardType.superBounds(); 31.66 for (int i = 0; i < superBounds.length; i++) { 31.67 linkInfo.displayLength += i > 0 ? 2 : 7; 31.68 - linkOutput.append(i > 0 ? ", " : " super "); 31.69 + link.addContent(i > 0 ? ", " : " super "); 31.70 setBoundsLinkInfo(linkInfo, superBounds[i]); 31.71 - linkOutput.append(getLinkOutput(linkInfo)); 31.72 + link.addContent(getLink(linkInfo)); 31.73 } 31.74 } else if (type.asTypeVariable()!= null) { 31.75 - linkOutput.append(getTypeAnnotationLinks(linkInfo)); 31.76 + link.addContent(getTypeAnnotationLinks(linkInfo)); 31.77 linkInfo.isTypeBound = true; 31.78 //A type variable. 31.79 Doc owner = type.asTypeVariable().owner(); 31.80 @@ -95,11 +96,11 @@ 31.81 owner instanceof ClassDoc) { 31.82 linkInfo.classDoc = (ClassDoc) owner; 31.83 linkInfo.label = type.typeName(); 31.84 - linkOutput.append(getClassLink(linkInfo)); 31.85 + link.addContent(getClassLink(linkInfo)); 31.86 } else { 31.87 //No need to link method type parameters. 31.88 linkInfo.displayLength += type.typeName().length(); 31.89 - linkOutput.append(type.typeName()); 31.90 + link.addContent(type.typeName()); 31.91 } 31.92 31.93 Type[] bounds = type.asTypeVariable().bounds(); 31.94 @@ -107,9 +108,9 @@ 31.95 linkInfo.excludeTypeBounds = true; 31.96 for (int i = 0; i < bounds.length; i++) { 31.97 linkInfo.displayLength += i > 0 ? 2 : 9; 31.98 - linkOutput.append(i > 0 ? " & " : " extends "); 31.99 + link.addContent(i > 0 ? " & " : " extends "); 31.100 setBoundsLinkInfo(linkInfo, bounds[i]); 31.101 - linkOutput.append(getLinkOutput(linkInfo)); 31.102 + link.addContent(getLink(linkInfo)); 31.103 } 31.104 } 31.105 } else if (type.asClassDoc() != null) { 31.106 @@ -119,14 +120,15 @@ 31.107 //Since we are excluding type parameter links, we should not 31.108 //be linking to the type bound. 31.109 linkInfo.displayLength += type.typeName().length(); 31.110 - linkOutput.append(type.typeName()); 31.111 - linkOutput.append(getTypeParameterLinks(linkInfo)); 31.112 - return linkOutput; 31.113 + link.addContent(type.typeName()); 31.114 + link.addContent(getTypeParameterLinks(linkInfo)); 31.115 + return link; 31.116 } else { 31.117 linkInfo.classDoc = type.asClassDoc(); 31.118 - linkOutput = getClassLink(linkInfo); 31.119 + link = newContent(); 31.120 + link.addContent(getClassLink(linkInfo)); 31.121 if (linkInfo.includeTypeAsSepLink) { 31.122 - linkOutput.append(getTypeParameterLinks(linkInfo, false)); 31.123 + link.addContent(getTypeParameterLinks(linkInfo, false)); 31.124 } 31.125 } 31.126 } 31.127 @@ -136,35 +138,39 @@ 31.128 //Javadoc returns var args as array. 31.129 //Strip out the first [] from the var arg. 31.130 linkInfo.displayLength += type.dimension().length()-2; 31.131 - linkOutput.append(type.dimension().substring(2)); 31.132 + link.addContent(type.dimension().substring(2)); 31.133 } 31.134 linkInfo.displayLength += 3; 31.135 - linkOutput.append("..."); 31.136 + link.addContent("..."); 31.137 } else { 31.138 while (type != null && type.dimension().length() > 0) { 31.139 linkInfo.displayLength += type.dimension().length(); 31.140 if (type.asAnnotatedType() != null) { 31.141 linkInfo.type = type; 31.142 - linkOutput.append(" "); 31.143 - linkOutput.append(getTypeAnnotationLinks(linkInfo)); 31.144 - linkOutput.append("[]"); 31.145 + link.addContent(" "); 31.146 + link.addContent(getTypeAnnotationLinks(linkInfo)); 31.147 + link.addContent("[]"); 31.148 type = type.asAnnotatedType().underlyingType().getElementType(); 31.149 } else { 31.150 - linkOutput.append("[]"); 31.151 + link.addContent("[]"); 31.152 type = type.getElementType(); 31.153 } 31.154 } 31.155 linkInfo.type = type; 31.156 - linkOutput.insert(0, getTypeAnnotationLinks(linkInfo)); 31.157 + Content newLink = newContent(); 31.158 + newLink.addContent(getTypeAnnotationLinks(linkInfo)); 31.159 + newLink.addContent(link); 31.160 + link = newLink; 31.161 } 31.162 - return linkOutput; 31.163 + return link; 31.164 } else if (linkInfo.classDoc != null) { 31.165 //Just a class link 31.166 - LinkOutput linkOutput = getClassLink(linkInfo); 31.167 + Content link = newContent(); 31.168 + link.addContent(getClassLink(linkInfo)); 31.169 if (linkInfo.includeTypeAsSepLink) { 31.170 - linkOutput.append(getTypeParameterLinks(linkInfo, false)); 31.171 + link.addContent(getTypeParameterLinks(linkInfo, false)); 31.172 } 31.173 - return linkOutput; 31.174 + return link; 31.175 } else { 31.176 return null; 31.177 } 31.178 @@ -183,7 +189,7 @@ 31.179 * 31.180 * @return the link for the given class. 31.181 */ 31.182 - protected abstract LinkOutput getClassLink(LinkInfo linkInfo); 31.183 + protected abstract Content getClassLink(LinkInfo linkInfo); 31.184 31.185 /** 31.186 * Return the link to the given type parameter. 31.187 @@ -191,10 +197,10 @@ 31.188 * @param linkInfo the information about the link to construct. 31.189 * @param typeParam the type parameter to link to. 31.190 */ 31.191 - protected abstract LinkOutput getTypeParameterLink(LinkInfo linkInfo, 31.192 + protected abstract Content getTypeParameterLink(LinkInfo linkInfo, 31.193 Type typeParam); 31.194 31.195 - protected abstract LinkOutput getTypeAnnotationLink(LinkInfo linkInfo, 31.196 + protected abstract Content getTypeAnnotationLink(LinkInfo linkInfo, 31.197 AnnotationDesc annotation); 31.198 31.199 /** 31.200 @@ -203,7 +209,7 @@ 31.201 * @param linkInfo the information about the link to construct. 31.202 * @return the links to the type parameters. 31.203 */ 31.204 - public LinkOutput getTypeParameterLinks(LinkInfo linkInfo) { 31.205 + public Content getTypeParameterLinks(LinkInfo linkInfo) { 31.206 return getTypeParameterLinks(linkInfo, true); 31.207 } 31.208 31.209 @@ -215,8 +221,8 @@ 31.210 * the type parameters portion of the link. 31.211 * @return the links to the type parameters. 31.212 */ 31.213 - public LinkOutput getTypeParameterLinks(LinkInfo linkInfo, boolean isClassLabel) { 31.214 - LinkOutput output = getOutputInstance(); 31.215 + public Content getTypeParameterLinks(LinkInfo linkInfo, boolean isClassLabel) { 31.216 + Content links = newContent(); 31.217 Type[] vars; 31.218 if (linkInfo.executableMemberDoc != null) { 31.219 vars = linkInfo.executableMemberDoc.typeParameters(); 31.220 @@ -227,62 +233,42 @@ 31.221 vars = linkInfo.classDoc.typeParameters(); 31.222 } else { 31.223 //Nothing to document. 31.224 - return output; 31.225 + return links; 31.226 } 31.227 if (((linkInfo.includeTypeInClassLinkLabel && isClassLabel) || 31.228 (linkInfo.includeTypeAsSepLink && ! isClassLabel) 31.229 ) 31.230 && vars.length > 0) { 31.231 linkInfo.displayLength += 1; 31.232 - output.append(getLessThanString()); 31.233 + links.addContent("<"); 31.234 for (int i = 0; i < vars.length; i++) { 31.235 if (i > 0) { 31.236 linkInfo.displayLength += 1; 31.237 - output.append(","); 31.238 + links.addContent(","); 31.239 } 31.240 - output.append(getTypeParameterLink(linkInfo, vars[i])); 31.241 + links.addContent(getTypeParameterLink(linkInfo, vars[i])); 31.242 } 31.243 linkInfo.displayLength += 1; 31.244 - output.append(getGreaterThanString()); 31.245 + links.addContent(">"); 31.246 } 31.247 - return output; 31.248 + return links; 31.249 } 31.250 31.251 - public LinkOutput getTypeAnnotationLinks(LinkInfo linkInfo) { 31.252 - LinkOutput output = getOutputInstance(); 31.253 + public Content getTypeAnnotationLinks(LinkInfo linkInfo) { 31.254 + Content links = newContent(); 31.255 if (linkInfo.type.asAnnotatedType() == null) 31.256 - return output; 31.257 + return links; 31.258 AnnotationDesc[] annotations = linkInfo.type.asAnnotatedType().annotations(); 31.259 for (int i = 0; i < annotations.length; i++) { 31.260 if (i > 0) { 31.261 linkInfo.displayLength += 1; 31.262 - output.append(" "); 31.263 + links.addContent(" "); 31.264 } 31.265 - output.append(getTypeAnnotationLink(linkInfo, annotations[i])); 31.266 + links.addContent(getTypeAnnotationLink(linkInfo, annotations[i])); 31.267 } 31.268 31.269 linkInfo.displayLength += 1; 31.270 - output.append(" "); 31.271 - return output; 31.272 - } 31.273 - 31.274 - /** 31.275 - * Return &lt;, which is used in type parameters. Override this 31.276 - * if your doclet uses something different. 31.277 - * 31.278 - * @return return &lt;, which is used in type parameters. 31.279 - */ 31.280 - protected String getLessThanString() { 31.281 - return "<"; 31.282 - } 31.283 - 31.284 - /** 31.285 - * Return &gt;, which is used in type parameters. Override this 31.286 - * if your doclet uses something different. 31.287 - * 31.288 - * @return return &gt;, which is used in type parameters. 31.289 - */ 31.290 - protected String getGreaterThanString() { 31.291 - return ">"; 31.292 + links.addContent(" "); 31.293 + return links; 31.294 } 31.295 }
32.1 --- a/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Tue May 14 10:14:51 2013 -0700 32.2 +++ b/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Tue May 14 10:14:52 2013 -0700 32.3 @@ -306,7 +306,7 @@ 32.4 // Handle multiple bounds. 32.5 //============================================================== 32.6 {BUG_ID + FS + "pkg" + FS + "MultiTypeParameters.html", 32.7 - "public <T extends java.lang.Number & java.lang.Runnable> T foo(T t)"}, 32.8 + "public <T extends java.lang.Number & java.lang.Runnable> T foo(T t)"}, 32.9 32.10 //============================================================== 32.11 // Test Class-Use Documenation for Type Parameters. 32.12 @@ -323,7 +323,7 @@ 32.13 "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/ClassUseTest1.html\" " + 32.14 "title=\"class in pkg2\">ClassUseTest1</a><T extends " + 32.15 "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo" + 32.16 - "</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">" + 32.17 + "</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">" + 32.18 "Foo2</a>></strong></code> </td>" 32.19 }, 32.20 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", 32.21 @@ -375,7 +375,7 @@ 32.22 "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/ClassUseTest1.html\" " + 32.23 "title=\"class in pkg2\">ClassUseTest1</a><T extends " + 32.24 "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo" + 32.25 - "</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">" + 32.26 + "</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">" + 32.27 "Foo2</a>></strong></code> </td>" 32.28 }, 32.29 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
33.1 --- a/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Tue May 14 10:14:51 2013 -0700 33.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Tue May 14 10:14:52 2013 -0700 33.3 @@ -103,17 +103,17 @@ 33.4 {BUG_ID + FS + "typeannos" + FS + "Complex1.html", 33.5 "class <span class=\"strong\">Complex1<K extends <a href=\"../" + 33.6 "typeannos/ClassParamA.html\" title=\"annotation in typeannos\">" + 33.7 - "@ClassParamA</a> java.lang.String & java.lang.Runnable></span>" 33.8 + "@ClassParamA</a> java.lang.String & java.lang.Runnable></span>" 33.9 }, 33.10 {BUG_ID + FS + "typeannos" + FS + "Complex2.html", 33.11 "class <span class=\"strong\">Complex2<K extends java.lang." + 33.12 - "String & <a href=\"../typeannos/ClassParamB.html\" title=\"" + 33.13 + "String & <a href=\"../typeannos/ClassParamB.html\" title=\"" + 33.14 "annotation in typeannos\">@ClassParamB</a> java.lang.Runnable></span>" 33.15 }, 33.16 {BUG_ID + FS + "typeannos" + FS + "ComplexBoth.html", 33.17 "class <span class=\"strong\">ComplexBoth<K extends <a href=\"" + 33.18 "../typeannos/ClassParamA.html\" title=\"annotation in typeannos\"" + 33.19 - ">@ClassParamA</a> java.lang.String & <a href=\"../typeannos/" + 33.20 + ">@ClassParamA</a> java.lang.String & <a href=\"../typeannos/" + 33.21 "ClassParamA.html\" title=\"annotation in typeannos\">@ClassParamA" + 33.22 "</a> java.lang.Runnable></span>" 33.23 },