Wed, 10 Oct 2012 18:44:21 -0700
8000310: Clean up use of StringBuffer in langtools
Reviewed-by: bpatel
1.1 --- a/src/share/classes/com/sun/tools/classfile/Descriptor.java Wed Oct 10 18:34:46 2012 -0700 1.2 +++ b/src/share/classes/com/sun/tools/classfile/Descriptor.java Wed Oct 10 18:44:21 2012 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -114,7 +114,7 @@ 1.11 private String parse(String desc, int start, int end) 1.12 throws InvalidDescriptor { 1.13 int p = start; 1.14 - StringBuffer sb = new StringBuffer(); 1.15 + StringBuilder sb = new StringBuilder(); 1.16 int dims = 0; 1.17 count = 0; 1.18
2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Wed Oct 10 18:34:46 2012 -0700 2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Wed Oct 10 18:44:21 2012 -0700 2.3 @@ -281,7 +281,7 @@ 2.4 * @return the 1.4.x style anchor for the ExecutableMemberDoc. 2.5 */ 2.6 protected String getErasureAnchor(ExecutableMemberDoc emd) { 2.7 - StringBuffer buf = new StringBuffer(emd.name() + "("); 2.8 + StringBuilder buf = new StringBuilder(emd.name() + "("); 2.9 Parameter[] params = emd.parameters(); 2.10 boolean foundTypeVariable = false; 2.11 for (int i = 0; i < params.length; i++) {
3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Wed Oct 10 18:34:46 2012 -0700 3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Wed Oct 10 18:44:21 2012 -0700 3.3 @@ -263,7 +263,7 @@ 3.4 if (len <= 0) { 3.5 return ""; 3.6 } 3.7 - StringBuffer sb = new StringBuffer(len); 3.8 + StringBuilder sb = new StringBuilder(len); 3.9 for(int i = 0; i < len; i++) { 3.10 sb.append(' '); 3.11 }
4.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Wed Oct 10 18:34:46 2012 -0700 4.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Wed Oct 10 18:44:21 2012 -0700 4.3 @@ -1567,7 +1567,7 @@ 4.4 * @param name File name, to which path string is. 4.5 */ 4.6 protected String pathString(PackageDoc pd, String name) { 4.7 - StringBuffer buf = new StringBuffer(relativePath); 4.8 + StringBuilder buf = new StringBuilder(relativePath); 4.9 buf.append(DirectoryManager.getPathToPackage(pd, name)); 4.10 return buf.toString(); 4.11 } 4.12 @@ -2030,7 +2030,7 @@ 4.13 if (! (tagName.startsWith("@link") || tagName.equals("@see"))) { 4.14 return ""; 4.15 } 4.16 - StringBuffer result = new StringBuffer(); 4.17 + StringBuilder result = new StringBuilder(); 4.18 boolean isplaintext = tagName.toLowerCase().equals("@linkplain"); 4.19 String label = see.label(); 4.20 label = (label.length() > 0)? 4.21 @@ -2329,7 +2329,7 @@ 4.22 text = removeNonInlineHtmlTags(text); 4.23 } 4.24 StringTokenizer lines = new StringTokenizer(text, "\r\n", true); 4.25 - StringBuffer textBuff = new StringBuffer(); 4.26 + StringBuilder textBuff = new StringBuilder(); 4.27 while (lines.hasMoreTokens()) { 4.28 StringBuilder line = new StringBuilder(lines.nextToken()); 4.29 Util.replaceTabs(configuration.sourcetab, line); 4.30 @@ -2398,7 +2398,7 @@ 4.31 //Redirect all relative links. 4.32 int end, begin = text.toLowerCase().indexOf("<a"); 4.33 if(begin >= 0){ 4.34 - StringBuffer textBuff = new StringBuffer(text); 4.35 + StringBuilder textBuff = new StringBuilder(text); 4.36 4.37 while(begin >=0){ 4.38 if (textBuff.length() > begin + 2 && ! Character.isWhitespace(textBuff.charAt(begin+2))) { 4.39 @@ -2688,13 +2688,13 @@ 4.40 */ 4.41 private List<String> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak) { 4.42 List<String> results = new ArrayList<String>(); 4.43 - StringBuffer annotation; 4.44 + StringBuilder annotation; 4.45 for (int i = 0; i < descList.length; i++) { 4.46 AnnotationTypeDoc annotationDoc = descList[i].annotationType(); 4.47 if (! Util.isDocumentedAnnotation(annotationDoc)){ 4.48 continue; 4.49 } 4.50 - annotation = new StringBuffer(); 4.51 + annotation = new StringBuilder(); 4.52 LinkInfoImpl linkInfo = new LinkInfoImpl( 4.53 LinkInfoImpl.CONTEXT_ANNOTATION, annotationDoc); 4.54 linkInfo.label = "@" + annotationDoc.name(); 4.55 @@ -2759,9 +2759,9 @@ 4.56 List<String> list = getAnnotations(0, 4.57 new AnnotationDesc[]{(AnnotationDesc) annotationValue.value()}, 4.58 false); 4.59 - StringBuffer buf = new StringBuffer(); 4.60 - for (Iterator<String> iter = list.iterator(); iter.hasNext(); ) { 4.61 - buf.append(iter.next()); 4.62 + StringBuilder buf = new StringBuilder(); 4.63 + for (String s: list) { 4.64 + buf.append(s); 4.65 } 4.66 return buf.toString(); 4.67 } else if (annotationValue.value() instanceof MemberDoc) {
5.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java Wed Oct 10 18:34:46 2012 -0700 5.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java Wed Oct 10 18:44:21 2012 -0700 5.3 @@ -71,7 +71,7 @@ 5.4 classLinkInfo.type != null && 5.5 !classDoc.qualifiedTypeName().equals(classLinkInfo.type.qualifiedTypeName())) : 5.6 ""; 5.7 - StringBuffer label = new StringBuffer( 5.8 + StringBuilder label = new StringBuilder( 5.9 classLinkInfo.getClassLinkLabel(m_writer.configuration)); 5.10 classLinkInfo.displayLength += label.length(); 5.11 Configuration configuration = ConfigurationImpl.getInstance(); 5.12 @@ -167,7 +167,7 @@ 5.13 //with 1.4.2 output. 5.14 return linkInfo.classDoc.name() + ".html"; 5.15 } 5.16 - StringBuffer buf = new StringBuffer(m_writer.relativePath); 5.17 + StringBuilder buf = new StringBuilder(m_writer.relativePath); 5.18 buf.append(DirectoryManager.getPathToPackage( 5.19 linkInfo.classDoc.containingPackage(), 5.20 linkInfo.classDoc.name() + ".html"));
6.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkOutputImpl.java Wed Oct 10 18:34:46 2012 -0700 6.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkOutputImpl.java Wed Oct 10 18:44:21 2012 -0700 6.3 @@ -43,13 +43,13 @@ 6.4 /** 6.5 * The output of the link. 6.6 */ 6.7 - public StringBuffer output; 6.8 + public StringBuilder output; 6.9 6.10 /** 6.11 * Construct a new LinkOutputImpl. 6.12 */ 6.13 public LinkOutputImpl() { 6.14 - output = new StringBuffer(); 6.15 + output = new StringBuilder(); 6.16 } 6.17 6.18 /**
7.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/TagletOutputImpl.java Wed Oct 10 18:34:46 2012 -0700 7.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TagletOutputImpl.java Wed Oct 10 18:44:21 2012 -0700 7.3 @@ -41,7 +41,7 @@ 7.4 7.5 public class TagletOutputImpl implements TagletOutput { 7.6 7.7 - private StringBuffer output; 7.8 + private StringBuilder output; 7.9 7.10 public TagletOutputImpl(String o) { 7.11 setOutput(o); 7.12 @@ -51,7 +51,7 @@ 7.13 * {@inheritDoc} 7.14 */ 7.15 public void setOutput (Object o) { 7.16 - output = new StringBuffer(o == null ? "" : (String) o); 7.17 + output = new StringBuilder(o == null ? "" : (String) o); 7.18 } 7.19 7.20 /**
8.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Wed Oct 10 18:34:46 2012 -0700 8.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Wed Oct 10 18:44:21 2012 -0700 8.3 @@ -74,7 +74,7 @@ 8.4 * {@inheritDoc} 8.5 */ 8.6 public TagletOutput deprecatedTagOutput(Doc doc) { 8.7 - StringBuffer output = new StringBuffer(); 8.8 + StringBuilder output = new StringBuilder(); 8.9 Tag[] deprs = doc.tags("deprecated"); 8.10 if (doc instanceof ClassDoc) { 8.11 if (Util.isDeprecated((ProgramElementDoc) doc)) { 8.12 @@ -125,9 +125,9 @@ 8.13 * {@inheritDoc} 8.14 */ 8.15 public TagletOutput getParamHeader(String header) { 8.16 - StringBuffer result = new StringBuffer(); 8.17 + StringBuilder result = new StringBuilder(); 8.18 result.append("<dt>"); 8.19 - result.append("<span class=\"strong\">" + header + "</span></dt>"); 8.20 + result.append("<span class=\"strong\">").append(header).append("</span></dt>"); 8.21 return new TagletOutputImpl(result.toString()); 8.22 } 8.23
9.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Wed Oct 10 18:34:46 2012 -0700 9.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Wed Oct 10 18:44:21 2012 -0700 9.3 @@ -186,7 +186,7 @@ 9.4 public String getHyperLinkString(String link, String where, 9.5 String label, boolean strong, 9.6 String stylename, String title, String target) { 9.7 - StringBuffer retlink = new StringBuffer(); 9.8 + StringBuilder retlink = new StringBuilder(); 9.9 retlink.append("<a href=\""); 9.10 retlink.append(link); 9.11 if (where != null && where.length() != 0) { 9.12 @@ -195,10 +195,10 @@ 9.13 } 9.14 retlink.append("\""); 9.15 if (title != null && title.length() != 0) { 9.16 - retlink.append(" title=\"" + title + "\""); 9.17 + retlink.append(" title=\"").append(title).append("\""); 9.18 } 9.19 if (target != null && target.length() != 0) { 9.20 - retlink.append(" target=\"" + target + "\""); 9.21 + retlink.append(" target=\"").append(target).append("\""); 9.22 } 9.23 retlink.append(">"); 9.24 if (stylename != null && stylename.length() != 0) {
10.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Wed Oct 10 18:34:46 2012 -0700 10.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Wed Oct 10 18:44:21 2012 -0700 10.3 @@ -465,7 +465,7 @@ 10.4 tagletManager.addNewSimpleCustomTag(tagName, null, ""); 10.5 } else { 10.6 //Create a simple tag with the heading that has the same name as the tag. 10.7 - StringBuffer heading = new StringBuffer(tagName + ":"); 10.8 + StringBuilder heading = new StringBuilder(tagName + ":"); 10.9 heading.setCharAt(0, Character.toUpperCase(tagName.charAt(0))); 10.10 tagletManager.addNewSimpleCustomTag(tagName, heading.toString(), "a"); 10.11 }
11.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java Wed Oct 10 18:34:46 2012 -0700 11.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java Wed Oct 10 18:44:21 2012 -0700 11.3 @@ -179,7 +179,7 @@ 11.4 * @param annotationInfoTree the content tree to which the documentation will be added 11.5 */ 11.6 public void buildAnnotationTypeSignature(XMLNode node, Content annotationInfoTree) { 11.7 - StringBuffer modifiers = new StringBuffer( 11.8 + StringBuilder modifiers = new StringBuilder( 11.9 annotationTypeDoc.modifiers() + " "); 11.10 writer.addAnnotationTypeSignature(Util.replaceText( 11.11 modifiers.toString(), "interface", "@interface"), annotationInfoTree);
12.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java Wed Oct 10 18:34:46 2012 -0700 12.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java Wed Oct 10 18:44:21 2012 -0700 12.3 @@ -282,18 +282,18 @@ 12.4 * @param classInfoTree the content tree to which the documentation will be added 12.5 */ 12.6 public void buildClassSignature(XMLNode node, Content classInfoTree) { 12.7 - StringBuffer modifiers = new StringBuffer(classDoc.modifiers() + " "); 12.8 + StringBuilder modifiers = new StringBuilder(classDoc.modifiers() + " "); 12.9 if (isEnum) { 12.10 modifiers.append("enum "); 12.11 int index; 12.12 if ((index = modifiers.indexOf("abstract")) >= 0) { 12.13 - modifiers.delete(index, index + (new String("abstract")).length()); 12.14 - modifiers = new StringBuffer( 12.15 + modifiers.delete(index, index + "abstract".length()); 12.16 + modifiers = new StringBuilder( 12.17 Util.replaceText(modifiers.toString(), " ", " ")); 12.18 } 12.19 if ((index = modifiers.indexOf("final")) >= 0) { 12.20 - modifiers.delete(index, index + (new String("final")).length()); 12.21 - modifiers = new StringBuffer( 12.22 + modifiers.delete(index, index + "final".length()); 12.23 + modifiers = new StringBuilder( 12.24 Util.replaceText(modifiers.toString(), " ", " ")); 12.25 } 12.26 //} else if (classDoc.isAnnotationType()) {
13.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/LiteralTaglet.java Wed Oct 10 18:34:46 2012 -0700 13.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/LiteralTaglet.java Wed Oct 10 18:44:21 2012 -0700 13.3 @@ -84,7 +84,7 @@ 13.4 * Replace occurrences of the following characters: < > & 13.5 */ 13.6 protected static String textToString(String text) { 13.7 - StringBuffer buf = new StringBuffer(); 13.8 + StringBuilder buf = new StringBuilder(); 13.9 for (int i = 0; i < text.length(); i++) { 13.10 char c = text.charAt(i); 13.11 switch (c) {
14.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java Wed Oct 10 18:34:46 2012 -0700 14.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java Wed Oct 10 18:44:21 2012 -0700 14.3 @@ -449,7 +449,7 @@ 14.4 //This known tag is excluded. 14.5 return; 14.6 } 14.7 - StringBuffer combined_locations = new StringBuffer(); 14.8 + StringBuilder combined_locations = new StringBuilder(); 14.9 for (int i = 0; i < locations.length; i++) { 14.10 if (i > 0) { 14.11 combined_locations.append(", ");
15.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DirectoryManager.java Wed Oct 10 18:34:46 2012 -0700 15.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DirectoryManager.java Wed Oct 10 18:44:21 2012 -0700 15.3 @@ -1,5 +1,5 @@ 15.4 /* 15.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. 15.6 + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 15.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.8 * 15.9 * This code is free software; you can redistribute it and/or modify it 15.10 @@ -119,7 +119,7 @@ 15.11 if (packageName == null || packageName.length() == 0) { 15.12 return ""; 15.13 } 15.14 - StringBuffer pathstr = new StringBuffer(); 15.15 + StringBuilder pathstr = new StringBuilder(); 15.16 for (int i = 0; i < packageName.length(); i++) { 15.17 char ch = packageName.charAt(i); 15.18 if (ch == '.') { 15.19 @@ -151,7 +151,7 @@ 15.20 if (name == null || name.length() == 0) { 15.21 return ""; 15.22 } 15.23 - StringBuffer pathstr = new StringBuffer(); 15.24 + StringBuilder pathstr = new StringBuilder(); 15.25 for (int i = 0; i < name.length(); i++) { 15.26 char ch = name.charAt(i); 15.27 if (ch == '.') { 15.28 @@ -181,7 +181,7 @@ 15.29 * @see #getPath(String) 15.30 */ 15.31 public static String getRelativePath(String from, String to) { 15.32 - StringBuffer pathstr = new StringBuffer(); 15.33 + StringBuilder pathstr = new StringBuilder(); 15.34 pathstr.append(getRelativePath(from)); 15.35 pathstr.append(getPath(to)); 15.36 pathstr.append(URL_FILE_SEPARATOR); 15.37 @@ -222,7 +222,7 @@ 15.38 if (from == null || from.length() == 0) { 15.39 return ""; 15.40 } 15.41 - StringBuffer pathstr = new StringBuffer(); 15.42 + StringBuilder pathstr = new StringBuilder(); 15.43 for (int i = 0; i < from.length(); i++) { 15.44 char ch = from.charAt(i); 15.45 if (ch == '.') { 15.46 @@ -293,7 +293,7 @@ 15.47 * @param filename File name to be appended to the path of the package. 15.48 */ 15.49 public static String getPathToPackage(PackageDoc pd, String filename) { 15.50 - StringBuffer buf = new StringBuffer(); 15.51 + StringBuilder buf = new StringBuilder(); 15.52 String pathstr = createPathString(pd); 15.53 if (pathstr.length() > 0) { 15.54 buf.append(pathstr);
16.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java Wed Oct 10 18:34:46 2012 -0700 16.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java Wed Oct 10 18:44:21 2012 -0700 16.3 @@ -277,7 +277,7 @@ 16.4 boolean relative) 16.5 throws IOException { 16.6 BufferedReader in = new BufferedReader(new InputStreamReader(input)); 16.7 - StringBuffer strbuf = new StringBuffer(); 16.8 + StringBuilder strbuf = new StringBuilder(); 16.9 try { 16.10 int c; 16.11 while ((c = in.read()) >= 0) {
17.1 --- a/src/share/classes/com/sun/tools/javac/code/Printer.java Wed Oct 10 18:34:46 2012 -0700 17.2 +++ b/src/share/classes/com/sun/tools/javac/code/Printer.java Wed Oct 10 18:44:21 2012 -0700 17.3 @@ -182,7 +182,7 @@ 17.4 17.5 @Override 17.6 public String visitClassType(ClassType t, Locale locale) { 17.7 - StringBuffer buf = new StringBuffer(); 17.8 + StringBuilder buf = new StringBuilder(); 17.9 if (t.getEnclosingType().tag == CLASS && t.tsym.owner.kind == Kinds.TYP) { 17.10 buf.append(visit(t.getEnclosingType(), locale)); 17.11 buf.append("."); 17.12 @@ -210,7 +210,7 @@ 17.13 17.14 @Override 17.15 public String visitWildcardType(WildcardType t, Locale locale) { 17.16 - StringBuffer s = new StringBuffer(); 17.17 + StringBuilder s = new StringBuilder(); 17.18 s.append(t.kind); 17.19 if (t.kind != UNBOUND) { 17.20 s.append(visit(t.type, locale)); 17.21 @@ -248,7 +248,7 @@ 17.22 protected String className(ClassType t, boolean longform, Locale locale) { 17.23 Symbol sym = t.tsym; 17.24 if (sym.name.length() == 0 && (sym.flags() & COMPOUND) != 0) { 17.25 - StringBuffer s = new StringBuffer(visit(t.supertype_field, locale)); 17.26 + StringBuilder s = new StringBuilder(visit(t.supertype_field, locale)); 17.27 for (List<Type> is = t.interfaces_field; is.nonEmpty(); is = is.tail) { 17.28 s.append("&"); 17.29 s.append(visit(is.head, locale)); 17.30 @@ -287,7 +287,7 @@ 17.31 if (!varArgs) { 17.32 return visitTypes(args, locale); 17.33 } else { 17.34 - StringBuffer buf = new StringBuffer(); 17.35 + StringBuilder buf = new StringBuilder(); 17.36 while (args.tail.nonEmpty()) { 17.37 buf.append(visit(args.head, locale)); 17.38 args = args.tail;
18.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Wed Oct 10 18:34:46 2012 -0700 18.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Wed Oct 10 18:44:21 2012 -0700 18.3 @@ -1945,7 +1945,7 @@ 18.4 * @param sig The signature of type T. 18.5 */ 18.6 private Name cacheName(String sig) { 18.7 - StringBuffer buf = new StringBuffer(); 18.8 + StringBuilder buf = new StringBuilder(); 18.9 if (sig.startsWith("[")) { 18.10 buf = buf.append("array"); 18.11 while (sig.startsWith("[")) {
19.1 --- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Wed Oct 10 18:34:46 2012 -0700 19.2 +++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Wed Oct 10 18:44:21 2012 -0700 19.3 @@ -806,7 +806,7 @@ 19.4 t = odStack[0]; 19.5 19.6 if (t.hasTag(JCTree.Tag.PLUS)) { 19.7 - StringBuffer buf = foldStrings(t); 19.8 + StringBuilder buf = foldStrings(t); 19.9 if (buf != null) { 19.10 t = toP(F.at(startPos).Literal(TypeTags.CLASS, buf.toString())); 19.11 } 19.12 @@ -833,7 +833,7 @@ 19.13 /** If tree is a concatenation of string literals, replace it 19.14 * by a single literal representing the concatenated string. 19.15 */ 19.16 - protected StringBuffer foldStrings(JCTree tree) { 19.17 + protected StringBuilder foldStrings(JCTree tree) { 19.18 if (!allowStringFolding) 19.19 return null; 19.20 List<String> buf = List.nil(); 19.21 @@ -841,8 +841,8 @@ 19.22 if (tree.hasTag(LITERAL)) { 19.23 JCLiteral lit = (JCLiteral) tree; 19.24 if (lit.typetag == TypeTags.CLASS) { 19.25 - StringBuffer sbuf = 19.26 - new StringBuffer((String)lit.value); 19.27 + StringBuilder sbuf = 19.28 + new StringBuilder((String)lit.value); 19.29 while (buf.nonEmpty()) { 19.30 sbuf.append(buf.head); 19.31 buf = buf.tail;
20.1 --- a/src/share/classes/com/sun/tools/javac/util/Convert.java Wed Oct 10 18:34:46 2012 -0700 20.2 +++ b/src/share/classes/com/sun/tools/javac/util/Convert.java Wed Oct 10 18:44:21 2012 -0700 20.3 @@ -1,5 +1,5 @@ 20.4 /* 20.5 - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. 20.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 20.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.8 * 20.9 * This code is free software; you can redistribute it and/or modify it 20.10 @@ -260,7 +260,7 @@ 20.11 while (i < len) { 20.12 char ch = s.charAt(i); 20.13 if (ch > 255) { 20.14 - StringBuffer buf = new StringBuffer(); 20.15 + StringBuilder buf = new StringBuilder(); 20.16 buf.append(s.substring(0, i)); 20.17 while (i < len) { 20.18 ch = s.charAt(i);
21.1 --- a/src/share/classes/com/sun/tools/javac/util/List.java Wed Oct 10 18:34:46 2012 -0700 21.2 +++ b/src/share/classes/com/sun/tools/javac/util/List.java Wed Oct 10 18:44:21 2012 -0700 21.3 @@ -1,5 +1,5 @@ 21.4 /* 21.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 21.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 21.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.8 * 21.9 * This code is free software; you can redistribute it and/or modify it 21.10 @@ -287,7 +287,7 @@ 21.11 if (isEmpty()) { 21.12 return ""; 21.13 } else { 21.14 - StringBuffer buf = new StringBuffer(); 21.15 + StringBuilder buf = new StringBuilder(); 21.16 buf.append(head); 21.17 for (List<A> l = tail; l.nonEmpty(); l = l.tail) { 21.18 buf.append(sep);
22.1 --- a/src/share/classes/com/sun/tools/javah/Gen.java Wed Oct 10 18:34:46 2012 -0700 22.2 +++ b/src/share/classes/com/sun/tools/javah/Gen.java Wed Oct 10 18:44:21 2012 -0700 22.3 @@ -1,5 +1,5 @@ 22.4 /* 22.5 - * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved. 22.6 + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 22.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.8 * 22.9 * This code is free software; you can redistribute it and/or modify it 22.10 @@ -287,7 +287,7 @@ 22.11 constString = value.toString(); 22.12 } 22.13 if (constString != null) { 22.14 - StringBuffer s = new StringBuffer("#undef "); 22.15 + StringBuilder s = new StringBuilder("#undef "); 22.16 s.append(cname); s.append("_"); s.append(fname); s.append(lineSep); 22.17 s.append("#define "); s.append(cname); s.append("_"); 22.18 s.append(fname); s.append(" "); s.append(constString); 22.19 @@ -370,7 +370,7 @@ 22.20 22.21 // c.f. MethodDoc.signature 22.22 String signature(ExecutableElement e) { 22.23 - StringBuffer sb = new StringBuffer("("); 22.24 + StringBuilder sb = new StringBuilder("("); 22.25 String sep = ""; 22.26 for (VariableElement p: e.getParameters()) { 22.27 sb.append(sep);
23.1 --- a/src/share/classes/com/sun/tools/javah/LLNI.java Wed Oct 10 18:34:46 2012 -0700 23.2 +++ b/src/share/classes/com/sun/tools/javah/LLNI.java Wed Oct 10 18:44:21 2012 -0700 23.3 @@ -1,5 +1,5 @@ 23.4 /* 23.5 - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. 23.6 + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 23.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.8 * 23.9 * This code is free software; you can redistribute it and/or modify it 23.10 @@ -647,7 +647,7 @@ 23.11 %%% This may not be right, but should be called more often. */ 23.12 protected final String nameToIdentifier(String name) { 23.13 int len = name.length(); 23.14 - StringBuffer buf = new StringBuffer(len); 23.15 + StringBuilder buf = new StringBuilder(len); 23.16 for (int i = 0; i < len; i++) { 23.17 char c = name.charAt(i); 23.18 if (isASCIILetterOrDigit(c))
24.1 --- a/src/share/classes/com/sun/tools/javah/Mangle.java Wed Oct 10 18:34:46 2012 -0700 24.2 +++ b/src/share/classes/com/sun/tools/javah/Mangle.java Wed Oct 10 18:44:21 2012 -0700 24.3 @@ -1,5 +1,5 @@ 24.4 /* 24.5 - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. 24.6 + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 24.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.8 * 24.9 * This code is free software; you can redistribute it and/or modify it 24.10 @@ -66,7 +66,7 @@ 24.11 } 24.12 24.13 public final String mangle(CharSequence name, int mtype) { 24.14 - StringBuffer result = new StringBuffer(100); 24.15 + StringBuilder result = new StringBuilder(100); 24.16 int length = name.length(); 24.17 24.18 for (int i = 0; i < length; i++) { 24.19 @@ -115,7 +115,7 @@ 24.20 24.21 public String mangleMethod(ExecutableElement method, TypeElement clazz, 24.22 int mtype) throws TypeSignature.SignatureException { 24.23 - StringBuffer result = new StringBuffer(100); 24.24 + StringBuilder result = new StringBuilder(100); 24.25 result.append("Java_"); 24.26 24.27 if (mtype == Mangle.Type.METHOD_JDK_1) { 24.28 @@ -164,7 +164,7 @@ 24.29 24.30 // Warning: duplicated in Gen 24.31 private String signature(ExecutableElement e) { 24.32 - StringBuffer sb = new StringBuffer(); 24.33 + StringBuilder sb = new StringBuilder(); 24.34 String sep = "("; 24.35 for (VariableElement p: e.getParameters()) { 24.36 sb.append(sep);