diff --git a/pmd/src/net/sourceforge/pmd/lang/java/rule/strings/ConsecutiveLiteralAppendsRule.java b/pmd/src/net/sourceforge/pmd/lang/java/rule/strings/ConsecutiveLiteralAppendsRule.java index 4ef5922267..2b2af6bd2c 100644 --- a/pmd/src/net/sourceforge/pmd/lang/java/rule/strings/ConsecutiveLiteralAppendsRule.java +++ b/pmd/src/net/sourceforge/pmd/lang/java/rule/strings/ConsecutiveLiteralAppendsRule.java @@ -31,14 +31,14 @@ import net.sourceforge.pmd.lang.java.typeresolution.TypeHelper; import net.sourceforge.pmd.lang.rule.properties.IntegerProperty; /** - * This rule finds concurrent calls to StringBuffer.append where String literals + * This rule finds concurrent calls to StringBuffer/Builder.append where String literals * are used It would be much better to make these calls using one call to * .append *

* example: *

*

- * StringBuffer buf = new StringBuffer();
+ * StringBuilder buf = new StringBuilder();
  * buf.append("Hello");
  * buf.append(" ").append("World");
  * 
@@ -46,7 +46,7 @@ import net.sourceforge.pmd.lang.rule.properties.IntegerProperty; * This would be more eloquently put as: *

*

- * StringBuffer buf = new StringBuffer();
+ * StringBuilder buf = new StringBuilder();
  * buf.append("Hello World");
  * 
*

diff --git a/pmd/src/net/sourceforge/pmd/lang/java/symboltable/AbstractScope.java b/pmd/src/net/sourceforge/pmd/lang/java/symboltable/AbstractScope.java index 743330e6a2..dc0db82ce5 100644 --- a/pmd/src/net/sourceforge/pmd/lang/java/symboltable/AbstractScope.java +++ b/pmd/src/net/sourceforge/pmd/lang/java/symboltable/AbstractScope.java @@ -50,7 +50,7 @@ public abstract class AbstractScope implements Scope { protected abstract NameDeclaration findVariableHere(NameOccurrence occurrence); protected String glomNames(Set s) { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); for (T t: s) { result.append(t.toString()); result.append(','); diff --git a/pmd/src/net/sourceforge/pmd/lang/java/symboltable/MethodNameDeclaration.java b/pmd/src/net/sourceforge/pmd/lang/java/symboltable/MethodNameDeclaration.java index ba69da5088..ffac355e29 100644 --- a/pmd/src/net/sourceforge/pmd/lang/java/symboltable/MethodNameDeclaration.java +++ b/pmd/src/net/sourceforge/pmd/lang/java/symboltable/MethodNameDeclaration.java @@ -35,7 +35,7 @@ public class MethodNameDeclaration extends AbstractNameDeclaration { } public String getParameterDisplaySignature() { - StringBuffer sb = new StringBuffer("("); + StringBuilder sb = new StringBuilder("("); ASTFormalParameters params = (ASTFormalParameters) node.jjtGetChild(0); // TODO - this can be optimized - add [0] then ,[n] in a loop. // no need to trim at the end diff --git a/pmd/src/net/sourceforge/pmd/lang/java/symboltable/NameFinder.java b/pmd/src/net/sourceforge/pmd/lang/java/symboltable/NameFinder.java index a2aafc0fc9..93559641f6 100644 --- a/pmd/src/net/sourceforge/pmd/lang/java/symboltable/NameFinder.java +++ b/pmd/src/net/sourceforge/pmd/lang/java/symboltable/NameFinder.java @@ -69,7 +69,7 @@ public class NameFinder { @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); for (NameOccurrence occ: names) { result.append(occ.getImage()); }