changeset 14263:473b1eaede64

8000310: Clean up use of StringBuffer in langtools Reviewed-by: bpatel
author jjg
date Wed, 10 Oct 2012 18:44:21 -0700
parents 058238ba531e
children 1aca6b2e90a0
files langtools/src/share/classes/com/sun/tools/classfile/Descriptor.java langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkOutputImpl.java langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletOutputImpl.java langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/LiteralTaglet.java langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DirectoryManager.java langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java langtools/src/share/classes/com/sun/tools/javac/code/Printer.java langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java langtools/src/share/classes/com/sun/tools/javac/util/Convert.java langtools/src/share/classes/com/sun/tools/javac/util/List.java langtools/src/share/classes/com/sun/tools/javah/Gen.java langtools/src/share/classes/com/sun/tools/javah/LLNI.java langtools/src/share/classes/com/sun/tools/javah/Mangle.java
diffstat 24 files changed, 63 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/langtools/src/share/classes/com/sun/tools/classfile/Descriptor.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Descriptor.java	Wed Oct 10 18:44:21 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -114,7 +114,7 @@
     private String parse(String desc, int start, int end)
             throws InvalidDescriptor {
         int p = start;
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         int dims = 0;
         count = 0;
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Wed Oct 10 18:44:21 2012 -0700
@@ -281,7 +281,7 @@
      * @return the 1.4.x style anchor for the ExecutableMemberDoc.
      */
     protected String getErasureAnchor(ExecutableMemberDoc emd) {
-        StringBuffer buf = new StringBuffer(emd.name() + "(");
+        StringBuilder buf = new StringBuilder(emd.name() + "(");
         Parameter[] params = emd.parameters();
         boolean foundTypeVariable = false;
         for (int i = 0; i < params.length; i++) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Wed Oct 10 18:44:21 2012 -0700
@@ -263,7 +263,7 @@
         if (len <= 0) {
             return "";
         }
-        StringBuffer sb = new StringBuffer(len);
+        StringBuilder sb = new StringBuilder(len);
         for(int i = 0; i < len; i++) {
             sb.append(' ');
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Wed Oct 10 18:44:21 2012 -0700
@@ -1567,7 +1567,7 @@
      * @param name File name, to which path string is.
      */
     protected String pathString(PackageDoc pd, String name) {
-        StringBuffer buf = new StringBuffer(relativePath);
+        StringBuilder buf = new StringBuilder(relativePath);
         buf.append(DirectoryManager.getPathToPackage(pd, name));
         return buf.toString();
     }
@@ -2030,7 +2030,7 @@
         if (! (tagName.startsWith("@link") || tagName.equals("@see"))) {
             return "";
         }
-        StringBuffer result = new StringBuffer();
+        StringBuilder result = new StringBuilder();
         boolean isplaintext = tagName.toLowerCase().equals("@linkplain");
         String label = see.label();
         label = (label.length() > 0)?
@@ -2329,7 +2329,7 @@
                     text = removeNonInlineHtmlTags(text);
                 }
                 StringTokenizer lines = new StringTokenizer(text, "\r\n", true);
-                StringBuffer textBuff = new StringBuffer();
+                StringBuilder textBuff = new StringBuilder();
                 while (lines.hasMoreTokens()) {
                     StringBuilder line = new StringBuilder(lines.nextToken());
                     Util.replaceTabs(configuration.sourcetab, line);
@@ -2398,7 +2398,7 @@
         //Redirect all relative links.
         int end, begin = text.toLowerCase().indexOf("<a");
         if(begin >= 0){
-            StringBuffer textBuff = new StringBuffer(text);
+            StringBuilder textBuff = new StringBuilder(text);
 
             while(begin >=0){
                 if (textBuff.length() > begin + 2 && ! Character.isWhitespace(textBuff.charAt(begin+2))) {
@@ -2688,13 +2688,13 @@
      */
     private List<String> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak) {
         List<String> results = new ArrayList<String>();
-        StringBuffer annotation;
+        StringBuilder annotation;
         for (int i = 0; i < descList.length; i++) {
             AnnotationTypeDoc annotationDoc = descList[i].annotationType();
             if (! Util.isDocumentedAnnotation(annotationDoc)){
                 continue;
             }
-            annotation = new StringBuffer();
+            annotation = new StringBuilder();
             LinkInfoImpl linkInfo = new LinkInfoImpl(
                 LinkInfoImpl.CONTEXT_ANNOTATION, annotationDoc);
             linkInfo.label = "@" + annotationDoc.name();
@@ -2759,9 +2759,9 @@
             List<String> list = getAnnotations(0,
                 new AnnotationDesc[]{(AnnotationDesc) annotationValue.value()},
                     false);
-            StringBuffer buf = new StringBuffer();
-            for (Iterator<String> iter = list.iterator(); iter.hasNext(); ) {
-                buf.append(iter.next());
+            StringBuilder buf = new StringBuilder();
+            for (String s: list) {
+                buf.append(s);
             }
             return buf.toString();
         } else if (annotationValue.value() instanceof MemberDoc) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Wed Oct 10 18:44:21 2012 -0700
@@ -71,7 +71,7 @@
                     classLinkInfo.type != null &&
                     !classDoc.qualifiedTypeName().equals(classLinkInfo.type.qualifiedTypeName())) :
             "";
-        StringBuffer label = new StringBuffer(
+        StringBuilder label = new StringBuilder(
             classLinkInfo.getClassLinkLabel(m_writer.configuration));
         classLinkInfo.displayLength += label.length();
         Configuration configuration = ConfigurationImpl.getInstance();
@@ -167,7 +167,7 @@
             //with 1.4.2 output.
             return linkInfo.classDoc.name() + ".html";
         }
-        StringBuffer buf = new StringBuffer(m_writer.relativePath);
+        StringBuilder buf = new StringBuilder(m_writer.relativePath);
         buf.append(DirectoryManager.getPathToPackage(
             linkInfo.classDoc.containingPackage(),
             linkInfo.classDoc.name() + ".html"));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkOutputImpl.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkOutputImpl.java	Wed Oct 10 18:44:21 2012 -0700
@@ -43,13 +43,13 @@
     /**
      * The output of the link.
      */
-    public StringBuffer output;
+    public StringBuilder output;
 
     /**
      * Construct a new LinkOutputImpl.
      */
     public LinkOutputImpl() {
-        output = new StringBuffer();
+        output = new StringBuilder();
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletOutputImpl.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletOutputImpl.java	Wed Oct 10 18:44:21 2012 -0700
@@ -41,7 +41,7 @@
 
 public class TagletOutputImpl implements TagletOutput {
 
-    private StringBuffer output;
+    private StringBuilder output;
 
     public TagletOutputImpl(String o) {
         setOutput(o);
@@ -51,7 +51,7 @@
      * {@inheritDoc}
      */
     public void setOutput (Object o) {
-        output = new StringBuffer(o == null ? "" : (String) o);
+        output = new StringBuilder(o == null ? "" : (String) o);
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Wed Oct 10 18:44:21 2012 -0700
@@ -74,7 +74,7 @@
      * {@inheritDoc}
      */
     public TagletOutput deprecatedTagOutput(Doc doc) {
-        StringBuffer output = new StringBuffer();
+        StringBuilder output = new StringBuilder();
         Tag[] deprs = doc.tags("deprecated");
         if (doc instanceof ClassDoc) {
             if (Util.isDeprecated((ProgramElementDoc) doc)) {
@@ -125,9 +125,9 @@
      * {@inheritDoc}
      */
     public TagletOutput getParamHeader(String header) {
-        StringBuffer result = new StringBuffer();
+        StringBuilder result = new StringBuilder();
         result.append("<dt>");
-        result.append("<span class=\"strong\">" +  header + "</span></dt>");
+        result.append("<span class=\"strong\">").append(header).append("</span></dt>");
         return new TagletOutputImpl(result.toString());
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java	Wed Oct 10 18:44:21 2012 -0700
@@ -186,7 +186,7 @@
     public String getHyperLinkString(String link, String where,
                                String label, boolean strong,
                                String stylename, String title, String target) {
-        StringBuffer retlink = new StringBuffer();
+        StringBuilder retlink = new StringBuilder();
         retlink.append("<a href=\"");
         retlink.append(link);
         if (where != null && where.length() != 0) {
@@ -195,10 +195,10 @@
         }
         retlink.append("\"");
         if (title != null && title.length() != 0) {
-            retlink.append(" title=\"" + title + "\"");
+            retlink.append(" title=\"").append(title).append("\"");
         }
         if (target != null && target.length() != 0) {
-            retlink.append(" target=\"" + target + "\"");
+            retlink.append(" target=\"").append(target).append("\"");
         }
         retlink.append(">");
         if (stylename != null && stylename.length() != 0) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Wed Oct 10 18:44:21 2012 -0700
@@ -465,7 +465,7 @@
                     tagletManager.addNewSimpleCustomTag(tagName, null, "");
                 } else {
                     //Create a simple tag with the heading that has the same name as the tag.
-                    StringBuffer heading = new StringBuffer(tagName + ":");
+                    StringBuilder heading = new StringBuilder(tagName + ":");
                     heading.setCharAt(0, Character.toUpperCase(tagName.charAt(0)));
                     tagletManager.addNewSimpleCustomTag(tagName, heading.toString(), "a");
                 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java	Wed Oct 10 18:44:21 2012 -0700
@@ -179,7 +179,7 @@
      * @param annotationInfoTree the content tree to which the documentation will be added
      */
     public void buildAnnotationTypeSignature(XMLNode node, Content annotationInfoTree) {
-        StringBuffer modifiers = new StringBuffer(
+        StringBuilder modifiers = new StringBuilder(
                 annotationTypeDoc.modifiers() + " ");
         writer.addAnnotationTypeSignature(Util.replaceText(
                 modifiers.toString(), "interface", "@interface"), annotationInfoTree);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java	Wed Oct 10 18:44:21 2012 -0700
@@ -282,18 +282,18 @@
      * @param classInfoTree the content tree to which the documentation will be added
      */
     public void buildClassSignature(XMLNode node, Content classInfoTree) {
-        StringBuffer modifiers = new StringBuffer(classDoc.modifiers() + " ");
+        StringBuilder modifiers = new StringBuilder(classDoc.modifiers() + " ");
         if (isEnum) {
             modifiers.append("enum ");
             int index;
             if ((index = modifiers.indexOf("abstract")) >= 0) {
-                modifiers.delete(index, index + (new String("abstract")).length());
-                modifiers = new StringBuffer(
+                modifiers.delete(index, index + "abstract".length());
+                modifiers = new StringBuilder(
                         Util.replaceText(modifiers.toString(), "  ", " "));
             }
             if ((index = modifiers.indexOf("final")) >= 0) {
-                modifiers.delete(index, index + (new String("final")).length());
-                modifiers = new StringBuffer(
+                modifiers.delete(index, index + "final".length());
+                modifiers = new StringBuilder(
                         Util.replaceText(modifiers.toString(), "  ", " "));
             }
         //} else if (classDoc.isAnnotationType()) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/LiteralTaglet.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/LiteralTaglet.java	Wed Oct 10 18:44:21 2012 -0700
@@ -84,7 +84,7 @@
      * Replace occurrences of the following characters:  < > &
      */
     protected static String textToString(String text) {
-           StringBuffer buf = new StringBuffer();
+           StringBuilder buf = new StringBuilder();
            for (int i = 0; i < text.length(); i++) {
                char c = text.charAt(i);
                switch (c) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Wed Oct 10 18:44:21 2012 -0700
@@ -449,7 +449,7 @@
             //This known tag is excluded.
             return;
         }
-        StringBuffer combined_locations = new StringBuffer();
+        StringBuilder combined_locations = new StringBuilder();
         for (int i = 0; i < locations.length; i++) {
             if (i > 0) {
                 combined_locations.append(", ");
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DirectoryManager.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DirectoryManager.java	Wed Oct 10 18:44:21 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -119,7 +119,7 @@
         if (packageName == null || packageName.length() == 0) {
             return "";
         }
-        StringBuffer pathstr = new StringBuffer();
+        StringBuilder pathstr = new StringBuilder();
         for (int i = 0; i < packageName.length(); i++) {
             char ch = packageName.charAt(i);
             if (ch == '.') {
@@ -151,7 +151,7 @@
         if (name == null || name.length() == 0) {
             return "";
         }
-        StringBuffer pathstr = new StringBuffer();
+        StringBuilder pathstr = new StringBuilder();
         for (int i = 0; i < name.length(); i++) {
             char ch = name.charAt(i);
             if (ch == '.') {
@@ -181,7 +181,7 @@
      * @see          #getPath(String)
      */
     public static String getRelativePath(String from, String to) {
-        StringBuffer pathstr = new StringBuffer();
+        StringBuilder pathstr = new StringBuilder();
         pathstr.append(getRelativePath(from));
         pathstr.append(getPath(to));
         pathstr.append(URL_FILE_SEPARATOR);
@@ -222,7 +222,7 @@
         if (from == null || from.length() == 0) {
             return "";
         }
-        StringBuffer pathstr = new StringBuffer();
+        StringBuilder pathstr = new StringBuilder();
         for (int i = 0; i < from.length(); i++) {
             char ch = from.charAt(i);
             if (ch == '.') {
@@ -293,7 +293,7 @@
      * @param filename   File name to be appended to the path of the package.
      */
     public static String getPathToPackage(PackageDoc pd, String filename) {
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
         String pathstr = createPathString(pd);
         if (pathstr.length() > 0) {
             buf.append(pathstr);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java	Wed Oct 10 18:44:21 2012 -0700
@@ -277,7 +277,7 @@
                                 boolean relative)
                          throws IOException {
         BufferedReader in = new BufferedReader(new InputStreamReader(input));
-        StringBuffer strbuf = new StringBuffer();
+        StringBuilder strbuf = new StringBuilder();
         try {
             int c;
             while ((c = in.read()) >= 0) {
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java	Wed Oct 10 18:44:21 2012 -0700
@@ -182,7 +182,7 @@
 
     @Override
     public String visitClassType(ClassType t, Locale locale) {
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
         if (t.getEnclosingType().tag == CLASS && t.tsym.owner.kind == Kinds.TYP) {
             buf.append(visit(t.getEnclosingType(), locale));
             buf.append(".");
@@ -210,7 +210,7 @@
 
     @Override
     public String visitWildcardType(WildcardType t, Locale locale) {
-        StringBuffer s = new StringBuffer();
+        StringBuilder s = new StringBuilder();
         s.append(t.kind);
         if (t.kind != UNBOUND) {
             s.append(visit(t.type, locale));
@@ -248,7 +248,7 @@
     protected String className(ClassType t, boolean longform, Locale locale) {
         Symbol sym = t.tsym;
         if (sym.name.length() == 0 && (sym.flags() & COMPOUND) != 0) {
-            StringBuffer s = new StringBuffer(visit(t.supertype_field, locale));
+            StringBuilder s = new StringBuilder(visit(t.supertype_field, locale));
             for (List<Type> is = t.interfaces_field; is.nonEmpty(); is = is.tail) {
                 s.append("&");
                 s.append(visit(is.head, locale));
@@ -287,7 +287,7 @@
         if (!varArgs) {
             return visitTypes(args, locale);
         } else {
-            StringBuffer buf = new StringBuffer();
+            StringBuilder buf = new StringBuilder();
             while (args.tail.nonEmpty()) {
                 buf.append(visit(args.head, locale));
                 args = args.tail;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Wed Oct 10 18:44:21 2012 -0700
@@ -1945,7 +1945,7 @@
      *  @param sig      The signature of type T.
      */
     private Name cacheName(String sig) {
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
         if (sig.startsWith("[")) {
             buf = buf.append("array");
             while (sig.startsWith("[")) {
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Wed Oct 10 18:44:21 2012 -0700
@@ -806,7 +806,7 @@
         t = odStack[0];
 
         if (t.hasTag(JCTree.Tag.PLUS)) {
-            StringBuffer buf = foldStrings(t);
+            StringBuilder buf = foldStrings(t);
             if (buf != null) {
                 t = toP(F.at(startPos).Literal(TypeTags.CLASS, buf.toString()));
             }
@@ -833,7 +833,7 @@
         /** If tree is a concatenation of string literals, replace it
          *  by a single literal representing the concatenated string.
          */
-        protected StringBuffer foldStrings(JCTree tree) {
+        protected StringBuilder foldStrings(JCTree tree) {
             if (!allowStringFolding)
                 return null;
             List<String> buf = List.nil();
@@ -841,8 +841,8 @@
                 if (tree.hasTag(LITERAL)) {
                     JCLiteral lit = (JCLiteral) tree;
                     if (lit.typetag == TypeTags.CLASS) {
-                        StringBuffer sbuf =
-                            new StringBuffer((String)lit.value);
+                        StringBuilder sbuf =
+                            new StringBuilder((String)lit.value);
                         while (buf.nonEmpty()) {
                             sbuf.append(buf.head);
                             buf = buf.tail;
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Convert.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Convert.java	Wed Oct 10 18:44:21 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -260,7 +260,7 @@
         while (i < len) {
             char ch = s.charAt(i);
             if (ch > 255) {
-                StringBuffer buf = new StringBuffer();
+                StringBuilder buf = new StringBuilder();
                 buf.append(s.substring(0, i));
                 while (i < len) {
                     ch = s.charAt(i);
--- a/langtools/src/share/classes/com/sun/tools/javac/util/List.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/List.java	Wed Oct 10 18:44:21 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -287,7 +287,7 @@
         if (isEmpty()) {
             return "";
         } else {
-            StringBuffer buf = new StringBuffer();
+            StringBuilder buf = new StringBuilder();
             buf.append(head);
             for (List<A> l = tail; l.nonEmpty(); l = l.tail) {
                 buf.append(sep);
--- a/langtools/src/share/classes/com/sun/tools/javah/Gen.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javah/Gen.java	Wed Oct 10 18:44:21 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -287,7 +287,7 @@
                         constString = value.toString();
                 }
                 if (constString != null) {
-                    StringBuffer s = new StringBuffer("#undef ");
+                    StringBuilder s = new StringBuilder("#undef ");
                     s.append(cname); s.append("_"); s.append(fname); s.append(lineSep);
                     s.append("#define "); s.append(cname); s.append("_");
                     s.append(fname); s.append(" "); s.append(constString);
@@ -370,7 +370,7 @@
 
     // c.f. MethodDoc.signature
     String signature(ExecutableElement e) {
-        StringBuffer sb = new StringBuffer("(");
+        StringBuilder sb = new StringBuilder("(");
         String sep = "";
         for (VariableElement p: e.getParameters()) {
             sb.append(sep);
--- a/langtools/src/share/classes/com/sun/tools/javah/LLNI.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javah/LLNI.java	Wed Oct 10 18:44:21 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -647,7 +647,7 @@
        %%% This may not be right, but should be called more often. */
     protected final String nameToIdentifier(String name) {
         int len = name.length();
-        StringBuffer buf = new StringBuffer(len);
+        StringBuilder buf = new StringBuilder(len);
         for (int i = 0; i < len; i++) {
             char c = name.charAt(i);
             if (isASCIILetterOrDigit(c))
--- a/langtools/src/share/classes/com/sun/tools/javah/Mangle.java	Wed Oct 10 18:34:46 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javah/Mangle.java	Wed Oct 10 18:44:21 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,7 @@
     }
 
     public final String mangle(CharSequence name, int mtype) {
-        StringBuffer result = new StringBuffer(100);
+        StringBuilder result = new StringBuilder(100);
         int length = name.length();
 
         for (int i = 0; i < length; i++) {
@@ -115,7 +115,7 @@
 
     public String mangleMethod(ExecutableElement method, TypeElement clazz,
                                       int mtype) throws TypeSignature.SignatureException {
-        StringBuffer result = new StringBuffer(100);
+        StringBuilder result = new StringBuilder(100);
         result.append("Java_");
 
         if (mtype == Mangle.Type.METHOD_JDK_1) {
@@ -164,7 +164,7 @@
 
     // Warning: duplicated in Gen
     private String signature(ExecutableElement e) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         String sep = "(";
         for (VariableElement p: e.getParameters()) {
             sb.append(sep);