From ebd78e9bb1ddb246d7d85ff99ce660503f29eb4e Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Tue, 14 Feb 2012 18:38:54 +0000 Subject: [PATCH] Convert grammars to use StringBuilder as well --- hibernate-core/src/main/antlr/hql-sql.g | 2 +- hibernate-core/src/main/antlr/order-by-render.g | 2 +- hibernate-core/src/main/antlr/order-by.g | 4 ++-- hibernate-core/src/main/antlr/sql-gen.g | 4 ++-- hibernate-core/src/main/antlr/sql-stmt.g | 2 +- .../java/org/hibernate/hql/internal/ast/SqlGenerator.java | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hibernate-core/src/main/antlr/hql-sql.g b/hibernate-core/src/main/antlr/hql-sql.g index f830f7ba1c..54c687fdb1 100644 --- a/hibernate-core/src/main/antlr/hql-sql.g +++ b/hibernate-core/src/main/antlr/hql-sql.g @@ -478,7 +478,7 @@ path returns [String p] { } : a:identifier { p = a.getText(); } | #(DOT x=path y:identifier) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append(x).append(".").append(y.getText()); p = buf.toString(); } diff --git a/hibernate-core/src/main/antlr/order-by-render.g b/hibernate-core/src/main/antlr/order-by-render.g index bba7bddcf6..f4e7fe4e3f 100644 --- a/hibernate-core/src/main/antlr/order-by-render.g +++ b/hibernate-core/src/main/antlr/order-by-render.g @@ -40,7 +40,7 @@ options { { // the buffer to which we write the resulting SQL. - private StringBuffer buffer = new StringBuffer(); + private StringBuilder buffer = new StringBuilder(); protected void out(String text) { buffer.append( text ); diff --git a/hibernate-core/src/main/antlr/order-by.g b/hibernate-core/src/main/antlr/order-by.g index 48d3017a36..cc798d4fac 100644 --- a/hibernate-core/src/main/antlr/order-by.g +++ b/hibernate-core/src/main/antlr/order-by.g @@ -229,7 +229,7 @@ functionCall! { trace("functionCall"); } */ functionName { trace("functionName"); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); } : i:IDENT { buffer.append( i.getText() ); } ( DOT i2:IDENT { buffer.append( '.').append( i2.getText() ); } )* { @@ -295,7 +295,7 @@ orderingSpecification! { trace("orderingSpecification"); } */ simplePropertyPath { trace("simplePropertyPath"); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); } : i:IDENT { buffer.append( i.getText() ); } ( DOT i2:IDENT { buffer.append( '.').append( i2.getText() ); } )+ { diff --git a/hibernate-core/src/main/antlr/sql-gen.g b/hibernate-core/src/main/antlr/sql-gen.g index 0366ecd80e..b5640d4ace 100644 --- a/hibernate-core/src/main/antlr/sql-gen.g +++ b/hibernate-core/src/main/antlr/sql-gen.g @@ -25,7 +25,7 @@ options { { /** the buffer resulting SQL statement is written to */ - private StringBuffer buf = new StringBuffer(); + private StringBuilder buf = new StringBuilder(); protected void out(String s) { buf.append(s); @@ -71,7 +71,7 @@ options { // moved this impl into the subclass... } - protected StringBuffer getStringBuffer() { + protected StringBuilder getStringBuilder() { return buf; } diff --git a/hibernate-core/src/main/antlr/sql-stmt.g b/hibernate-core/src/main/antlr/sql-stmt.g index 567cac718e..35682415cd 100644 --- a/hibernate-core/src/main/antlr/sql-stmt.g +++ b/hibernate-core/src/main/antlr/sql-stmt.g @@ -95,7 +95,7 @@ options { } public String getErrorMessage() { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for ( Iterator iterator = errorList.iterator(); iterator.hasNext(); ) { buf.append( (String) iterator.next() ); if ( iterator.hasNext() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/SqlGenerator.java b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/SqlGenerator.java index f9955a6a6e..4973b6b016 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/SqlGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/SqlGenerator.java @@ -167,7 +167,7 @@ public class SqlGenerator extends SqlGeneratorBase implements ErrorReporter { } public String getSQL() { - return getStringBuffer().toString(); + return getStringBuilder().toString(); } @Override @@ -269,11 +269,11 @@ public class SqlGenerator extends SqlGeneratorBase implements ErrorReporter { */ class DefaultWriter implements SqlWriter { public void clause(String clause) { - getStringBuffer().append( clause ); + getStringBuilder().append( clause ); } public void commaBetweenParameters(String comma) { - getStringBuffer().append( comma ); + getStringBuilder().append( comma ); } }