This fixes the tools so they use StringBuilder where
appropriate.
ChangeLog:
2008-05-07 Andrew John Hughes <[EMAIL PROTECTED]>
PR classpath/21869
* tools/gnu/classpath/tools/jar/Indexer.java,
* tools/gnu/classpath/tools/javah/JniHelper.java,
* tools/gnu/classpath/tools/native2ascii/Native2ASCII.java,
* tools/gnu/classpath/tools/orbd/PersistentMap.java,
* tools/gnu/classpath/tools/rmic/ClassRmicCompiler.java,
* tools/gnu/classpath/tools/rmic/Generator.java,
* tools/gnu/classpath/tools/rmic/MethodGenerator.java,
* tools/gnu/classpath/tools/rmic/RmiMethodGenerator.java,
* tools/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.java,
* tools/gnu/classpath/tools/rmic/SourceRmicCompiler.java:
Swap use of StringBuffer for StringBuilder.
--
Andrew :)
Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8
Index: tools/gnu/classpath/tools/jar/Indexer.java
===================================================================
RCS file:
/sources/classpath/classpath/tools/gnu/classpath/tools/jar/Indexer.java,v
retrieving revision 1.6
diff -u -r1.6 Indexer.java
--- tools/gnu/classpath/tools/jar/Indexer.java 15 Dec 2006 19:45:38 -0000
1.6
+++ tools/gnu/classpath/tools/jar/Indexer.java 7 May 2008 01:43:20 -0000
@@ -57,7 +57,7 @@
public class Indexer
extends Updater
{
- private void indexJarFile(StringBuffer result, File fileName,
+ private void indexJarFile(StringBuilder result, File fileName,
boolean verbose)
throws IOException
{
@@ -129,7 +129,7 @@
super.writeCommandLineEntries(parameters, os);
// Now compute our index file and write it.
- StringBuffer contents = new StringBuffer();
+ StringBuilder contents = new StringBuilder();
indexJarFile(contents, parameters.archiveFile, parameters.verbose);
if (contents.length() != 0)
{
Index: tools/gnu/classpath/tools/javah/JniHelper.java
===================================================================
RCS file:
/sources/classpath/classpath/tools/gnu/classpath/tools/javah/JniHelper.java,v
retrieving revision 1.2
diff -u -r1.2 JniHelper.java
--- tools/gnu/classpath/tools/javah/JniHelper.java 9 Aug 2006 17:18:31
-0000 1.2
+++ tools/gnu/classpath/tools/javah/JniHelper.java 7 May 2008 01:43:20
-0000
@@ -92,7 +92,7 @@
public static String mangle(String name)
{
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
for (int i = 0; i < name.length(); ++i)
{
char c = name.charAt(i);
Index: tools/gnu/classpath/tools/native2ascii/Native2ASCII.java
===================================================================
RCS file:
/sources/classpath/classpath/tools/gnu/classpath/tools/native2ascii/Native2ASCII.java,v
retrieving revision 1.7
diff -u -r1.7 Native2ASCII.java
--- tools/gnu/classpath/tools/native2ascii/Native2ASCII.java 25 Jan 2008
19:21:07 -0000 1.7
+++ tools/gnu/classpath/tools/native2ascii/Native2ASCII.java 7 May 2008
01:43:21 -0000
@@ -138,7 +138,7 @@
String s = rdr.readLine();
if (s == null)
break;
- StringBuffer sb = new StringBuffer(s.length() + 80);
+ StringBuilder sb = new StringBuilder(s.length() + 80);
for (int i = 0; i < s.length(); i++)
{
char c = s.charAt(i);
Index: tools/gnu/classpath/tools/orbd/PersistentMap.java
===================================================================
RCS file:
/sources/classpath/classpath/tools/gnu/classpath/tools/orbd/PersistentMap.java,v
retrieving revision 1.1
diff -u -r1.1 PersistentMap.java
--- tools/gnu/classpath/tools/orbd/PersistentMap.java 22 Sep 2006 22:53:17
-0000 1.1
+++ tools/gnu/classpath/tools/orbd/PersistentMap.java 7 May 2008 01:43:22
-0000
@@ -165,7 +165,7 @@
*/
public String getKey(String id, String kind)
{
- StringBuffer b = new StringBuffer(id.length() + 8);
+ StringBuilder b = new StringBuilder(id.length() + 8);
appEscaping(b, id);
b.append('.');
if (kind != null && kind.length() > 0)
@@ -180,7 +180,7 @@
* @param b a buffer to append the contents to.
* @param s a string to append.
*/
- void appEscaping(StringBuffer b, String s)
+ void appEscaping(StringBuilder b, String s)
{
char c;
for (int i = 0; i < s.length(); i++)
Index: tools/gnu/classpath/tools/rmic/ClassRmicCompiler.java
===================================================================
RCS file:
/sources/classpath/classpath/tools/gnu/classpath/tools/rmic/ClassRmicCompiler.java,v
retrieving revision 1.2
diff -u -r1.2 ClassRmicCompiler.java
--- tools/gnu/classpath/tools/rmic/ClassRmicCompiler.java 18 Sep 2007
21:52:37 -0000 1.2
+++ tools/gnu/classpath/tools/rmic/ClassRmicCompiler.java 7 May 2008
01:43:25 -0000
@@ -330,7 +330,7 @@
{
Method m = remotemethods[i].meth;
- StringBuffer desc = new StringBuffer();
+ StringBuilder desc = new StringBuilder();
desc.append(getPrettyName(m.getReturnType()) + " ");
desc.append(m.getName() + "(");
@@ -1712,7 +1712,7 @@
private static String getPrettyName(Class cls)
{
- StringBuffer str = new StringBuffer();
+ StringBuilder str = new StringBuilder();
for (int count = 0;; count++)
{
if (! cls.isArray())
Index: tools/gnu/classpath/tools/rmic/Generator.java
===================================================================
RCS file:
/sources/classpath/classpath/tools/gnu/classpath/tools/rmic/Generator.java,v
retrieving revision 1.1
diff -u -r1.1 Generator.java
--- tools/gnu/classpath/tools/rmic/Generator.java 22 Sep 2006 22:53:18
-0000 1.1
+++ tools/gnu/classpath/tools/rmic/Generator.java 7 May 2008 01:43:25
-0000
@@ -53,7 +53,7 @@
+ resourcePath);
BufferedReader r = new BufferedReader(new InputStreamReader(in));
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
String s;
try
@@ -90,7 +90,7 @@
{
BufferedReader r = new BufferedReader(new StringReader(template));
String s;
- StringBuffer b = new StringBuffer(template.length());
+ StringBuilder b = new StringBuilder(template.length());
try
{
Iterator iter;
Index: tools/gnu/classpath/tools/rmic/MethodGenerator.java
===================================================================
RCS file:
/sources/classpath/classpath/tools/gnu/classpath/tools/rmic/MethodGenerator.java,v
retrieving revision 1.1
diff -u -r1.1 MethodGenerator.java
--- tools/gnu/classpath/tools/rmic/MethodGenerator.java 22 Sep 2006 22:53:18
-0000 1.1
+++ tools/gnu/classpath/tools/rmic/MethodGenerator.java 7 May 2008 01:43:25
-0000
@@ -93,7 +93,7 @@
*/
public String getArgumentList()
{
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Class[] args = method.getParameterTypes();
@@ -115,7 +115,7 @@
*/
public String getArgumentNames()
{
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Class[] args = method.getParameterTypes();
@@ -135,7 +135,7 @@
*/
public String getThrows()
{
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Class[] args = method.getExceptionTypes();
@@ -239,7 +239,7 @@
*/
public String getRda()
{
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Class[] args = method.getParameterTypes();
for (int i = 0; i < args.length; i++)
@@ -263,7 +263,7 @@
*/
public String getStubParaWriteStatement()
{
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Class[] args = method.getParameterTypes();
for (int i = 0; i < args.length; i++)
Index: tools/gnu/classpath/tools/rmic/RmiMethodGenerator.java
===================================================================
RCS file:
/sources/classpath/classpath/tools/gnu/classpath/tools/rmic/RmiMethodGenerator.java,v
retrieving revision 1.1
diff -u -r1.1 RmiMethodGenerator.java
--- tools/gnu/classpath/tools/rmic/RmiMethodGenerator.java 22 Sep 2006
22:53:18 -0000 1.1
+++ tools/gnu/classpath/tools/rmic/RmiMethodGenerator.java 7 May 2008
01:43:26 -0000
@@ -74,7 +74,7 @@
*/
public String getArgumentList()
{
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Class[] args = method.getParameterTypes();
@@ -96,7 +96,7 @@
*/
public String getArgumentNames()
{
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Class[] args = method.getParameterTypes();
@@ -116,7 +116,7 @@
*/
public String getThrows()
{
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Class[] args = method.getExceptionTypes();
@@ -173,7 +173,7 @@
*/
public String getStaticMethodDeclarations()
{
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Class[] args = method.getParameterTypes();
for (int i = 0; i < args.length; i++)
@@ -201,7 +201,7 @@
if (args.length==0)
return "NO_ARGS";
- StringBuffer b = new StringBuffer("new Object[] {");
+ StringBuilder b = new StringBuilder("new Object[] {");
for (int i = 0; i < args.length; i++)
{
@@ -246,7 +246,7 @@
*/
public String getArgListAsClassArray()
{
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Class[] args = method.getParameterTypes();
for (int i = 0; i < args.length; i++)
Index: tools/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.java
===================================================================
RCS file:
/sources/classpath/classpath/tools/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.java,v
retrieving revision 1.1
diff -u -r1.1 SourceGiopRmicCompiler.java
--- tools/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.java 22 Sep 2006
22:53:18 -0000 1.1
+++ tools/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.java 7 May 2008
01:43:26 -0000
@@ -342,7 +342,7 @@
dimension++;
}
- StringBuffer brackets = new StringBuffer();
+ StringBuilder brackets = new StringBuilder();
for (int i = 0; i < dimension; i++)
{
@@ -388,7 +388,7 @@
*/
public String getIdList(Collection remotes)
{
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
// Keep the Ids sorted, ensuring, that the same order will be preserved
// between compilations.
@@ -420,7 +420,7 @@
String template = getResource("Stub.jav");
// Generate methods.
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Iterator iter = methods.iterator();
while (iter.hasNext())
{
@@ -444,7 +444,7 @@
*/
public String getAllInterfaces()
{
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Iterator iter = implementedRemotes.iterator();
while (iter.hasNext())
@@ -494,7 +494,7 @@
iter = sortedMethods.iterator();
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
MethodGenerator prev = null;
@@ -539,7 +539,7 @@
imp.add("import " + ic + ";\n");
}
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
it = imp.iterator();
while (it.hasNext())
Index: tools/gnu/classpath/tools/rmic/SourceRmicCompiler.java
===================================================================
RCS file:
/sources/classpath/classpath/tools/gnu/classpath/tools/rmic/SourceRmicCompiler.java,v
retrieving revision 1.1
diff -u -r1.1 SourceRmicCompiler.java
--- tools/gnu/classpath/tools/rmic/SourceRmicCompiler.java 22 Sep 2006
22:53:18 -0000 1.1
+++ tools/gnu/classpath/tools/rmic/SourceRmicCompiler.java 7 May 2008
01:43:26 -0000
@@ -56,7 +56,7 @@
String template = getResource("Stub_12.jav");
// Generate methods.
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Iterator iter = methods.iterator();
while (iter.hasNext())
{
@@ -99,7 +99,7 @@
*/
public String getStubMethodDeclarations()
{
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Iterator iter = methods.iterator();
@@ -122,7 +122,7 @@
*/
public String getStubMethodInitializations()
{
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
Iterator iter = methods.iterator();