pmdOnPmd: migration rules

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5006 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch
2007-01-29 03:12:13 +00:00
parent ec3f66e433
commit 7e26a9c1dc
5 changed files with 13 additions and 17 deletions

View File

@ -27,7 +27,7 @@ public class TokenEntry implements Comparable<TokenEntry> {
public TokenEntry(String image, String tokenSrcID, int beginLine) {
Integer i = Tokens.get(image);
if (i == null) {
i = new Integer(Tokens.size() + 1);
i = Tokens.size() + 1;
Tokens.put(image, i);
}
this.identifier = i.intValue();

View File

@ -17,7 +17,7 @@ import net.sourceforge.pmd.properties.IntegerProperty;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -88,7 +88,7 @@ public class DaaRule extends AbstractRule implements Executable {
return;
}
final Hashtable<String, Usage> hash = new Hashtable<String, Usage>();
final Map<String, Usage> hash = new HashMap<String, Usage>();
final Iterator pathIterator = path.iterator();
while (pathIterator.hasNext()) {
@ -148,7 +148,7 @@ public class DaaRule extends AbstractRule implements Executable {
&& !violationAlreadyExists(type, var, startLine, endLine)
&& node != null) {
final RuleContext ctx = (RuleContext) data;
final Object[] params = new Object[] { type, var, new Integer(startLine), new Integer(endLine) };
final Object[] params = new Object[] { type, var, startLine, endLine };
String msg = type;
if (getMessage() != null) {
msg = MessageFormat.format(getMessage(), params);

View File

@ -22,7 +22,7 @@ import net.sourceforge.pmd.ast.SimpleNode;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import java.util.ArrayList;
/**
* @author mgriffa
@ -134,15 +134,14 @@ public class ArrayIsStoredDirectly extends AbstractSunSecureRule {
}
private final ASTFormalParameter[] getArrays(ASTFormalParameters params) {
final List l = params.findChildrenOfType(ASTFormalParameter.class);
final List<ASTFormalParameter> l = params.findChildrenOfType(ASTFormalParameter.class);
if (l != null && !l.isEmpty()) {
Vector<ASTFormalParameter> v = new Vector<ASTFormalParameter>();
for (Iterator it = l.iterator(); it.hasNext();) {
ASTFormalParameter fp = (ASTFormalParameter) it.next();
List<ASTFormalParameter> l2 = new ArrayList<ASTFormalParameter>();
for (ASTFormalParameter fp: l) {
if (fp.isArray())
v.add(fp);
l2.add(fp);
}
return v.toArray(new ASTFormalParameter[v.size()]);
return l2.toArray(new ASTFormalParameter[l2.size()]);
}
return null;
}

View File

@ -35,9 +35,7 @@ public class DataPoint implements Comparable<DataPoint> {
if (lhsScore.doubleValue() != rhsScore.doubleValue()) {
return lhsScore.compareTo(rhsScore);
}
Integer lhsRand = new Integer(random);
Integer rhsRand = new Integer(rhs.random);
return lhsRand.compareTo(rhsRand);
return random - rhs.random;
}
public SimpleNode getNode() {

View File

@ -55,7 +55,6 @@ import java.lang.reflect.Method;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
public class Designer implements ClipboardOwner {
@ -276,7 +275,7 @@ public class Designer implements ClipboardOwner {
private class ASTTreeWidget extends JTree {
public ASTTreeWidget(Vector items) {
public ASTTreeWidget(Object[] items) {
super(items);
}
@ -407,7 +406,7 @@ public class Designer implements ClipboardOwner {
}
private final CodeEditorTextPane codeEditorPane = new CodeEditorTextPane();
private final ASTTreeWidget astWidget = new ASTTreeWidget(new Vector());
private final ASTTreeWidget astWidget = new ASTTreeWidget(new Object[0]);
private DefaultListModel xpathResults = new DefaultListModel();
private final JList xpathResultList = new JList(xpathResults);
private final JTextArea xpathQueryArea = new JTextArea(15, 30);