forked from phoedos/pmd
StringBuffer -> StringBuilder switchovers
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7344 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -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
|
||||
* <p/>
|
||||
* example:
|
||||
* <p/>
|
||||
* <pre>
|
||||
* StringBuffer buf = new StringBuffer();
|
||||
* StringBuilder buf = new StringBuilder();
|
||||
* buf.append("Hello");
|
||||
* buf.append(" ").append("World");
|
||||
* </pre>
|
||||
@ -46,7 +46,7 @@ import net.sourceforge.pmd.lang.rule.properties.IntegerProperty;
|
||||
* This would be more eloquently put as:
|
||||
* <p/>
|
||||
* <pre>
|
||||
* StringBuffer buf = new StringBuffer();
|
||||
* StringBuilder buf = new StringBuilder();
|
||||
* buf.append("Hello World");
|
||||
* </pre>
|
||||
* <p/>
|
||||
|
@ -50,7 +50,7 @@ public abstract class AbstractScope implements Scope {
|
||||
protected abstract NameDeclaration findVariableHere(NameOccurrence occurrence);
|
||||
|
||||
protected <T> String glomNames(Set<T> s) {
|
||||
StringBuffer result = new StringBuffer();
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (T t: s) {
|
||||
result.append(t.toString());
|
||||
result.append(',');
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
}
|
||||
|
Reference in New Issue
Block a user