code cleanup: AvoidConstantsInterface rule is now part of the dogfood ruleset

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6681 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch
2008-10-26 19:41:32 +00:00
parent 60314b66c4
commit 65dfd54ad6
5 changed files with 39 additions and 40 deletions

View File

@ -80,7 +80,6 @@
<exclude name="UncommentedEmptyMethod"/>
<exclude name="UnnecessaryLocalBeforeReturn"/>
<exclude name="AbstractClassWithoutAbstractMethod"/>
<exclude name="AvoidConstantsInterface"/>
<exclude name="AccessorClassGeneration"/>
<exclude name="SimplifyBooleanExpressions"/>
<exclude name="UseVarargs"/>

View File

@ -7,37 +7,37 @@ package net.sourceforge.pmd.lang.dfa;
* @author raik
*/
// TODO This should be an enum?
public interface NodeType {
public class NodeType {
int IF_EXPR = 1;
int IF_LAST_STATEMENT = 2;
int IF_LAST_STATEMENT_WITHOUT_ELSE = 3;
int ELSE_LAST_STATEMENT = 4;
public static final int IF_EXPR = 1;
public static final int IF_LAST_STATEMENT = 2;
public static final int IF_LAST_STATEMENT_WITHOUT_ELSE = 3;
public static final int ELSE_LAST_STATEMENT = 4;
int WHILE_EXPR = 10;
int WHILE_LAST_STATEMENT = 11;
public static final int WHILE_EXPR = 10;
public static final int WHILE_LAST_STATEMENT = 11;
int SWITCH_START = 20;
int CASE_LAST_STATEMENT = 21;
int SWITCH_LAST_DEFAULT_STATEMENT = 22;
int SWITCH_END = 23;
public static final int SWITCH_START = 20;
public static final int CASE_LAST_STATEMENT = 21;
public static final int SWITCH_LAST_DEFAULT_STATEMENT = 22;
public static final int SWITCH_END = 23;
int FOR_INIT = 30;
int FOR_EXPR = 31;
int FOR_UPDATE = 32;
int FOR_BEFORE_FIRST_STATEMENT = 33;
int FOR_END = 34;
public static final int FOR_INIT = 30;
public static final int FOR_EXPR = 31;
public static final int FOR_UPDATE = 32;
public static final int FOR_BEFORE_FIRST_STATEMENT = 33;
public static final int FOR_END = 34;
int DO_BEFORE_FIRST_STATEMENT = 40;
int DO_EXPR = 41;
public static final int DO_BEFORE_FIRST_STATEMENT = 40;
public static final int DO_EXPR = 41;
int RETURN_STATEMENT = 50;
int BREAK_STATEMENT = 51;
int CONTINUE_STATEMENT = 52;
public static final int RETURN_STATEMENT = 50;
public static final int BREAK_STATEMENT = 51;
public static final int CONTINUE_STATEMENT = 52;
int LABEL_STATEMENT = 60;
int LABEL_LAST_STATEMENT = 61;
public static final int LABEL_STATEMENT = 60;
public static final int LABEL_LAST_STATEMENT = 61;
// TODO - throw statements?
int THROW_STATEMENT = 70;
public static final int THROW_STATEMENT = 70;
}

View File

@ -1,9 +1,11 @@
package net.sourceforge.pmd.util;
public interface NumericConstants {
public class NumericConstants {
public static final Integer ZERO = 0;
public static final Integer ONE = 1;
public static final Float FLOAT_ZERO = new Float(0.0f);
Integer ZERO = 0;
Integer ONE = 1;
Float FLOAT_ZERO = new Float(0.0f);
}

View File

@ -4,10 +4,9 @@ package net.sourceforge.pmd.util.viewer.gui;
* contains action command constants
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public interface ActionCommands {
String COMPILE_ACTION = "Compile";
String EVALUATE_ACTION = "Evaluate";
public final class ActionCommands {
public static final String COMPILE_ACTION = "Compile";
public static final String EVALUATE_ACTION = "Evaluate";
}

View File

@ -29,12 +29,11 @@ import net.sourceforge.pmd.util.viewer.util.NLS;
* viewer's main frame
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class MainFrame
extends JFrame
implements ActionListener, ActionCommands, ViewerModelListener {
implements ActionListener, ViewerModelListener {
private ViewerModel model;
private SourceCodePanel sourcePanel;
private XPathPanel xPathPanel;
@ -68,10 +67,10 @@ public class MainFrame
interactionsPane.add(editingPane, BorderLayout.CENTER);
getContentPane().add(interactionsPane, BorderLayout.CENTER);
JButton compileBtn = new JButton(NLS.nls("MAIN.FRAME.COMPILE_BUTTON.TITLE"));
compileBtn.setActionCommand(COMPILE_ACTION);
compileBtn.setActionCommand(ActionCommands.COMPILE_ACTION);
compileBtn.addActionListener(this);
evalBtn = new JButton(NLS.nls("MAIN.FRAME.EVALUATE_BUTTON.TITLE"));
evalBtn.setActionCommand(EVALUATE_ACTION);
evalBtn.setActionCommand(ActionCommands.EVALUATE_ACTION);
evalBtn.addActionListener(this);
evalBtn.setEnabled(false);
statusLbl = new JLabel();
@ -134,7 +133,7 @@ public class MainFrame
String command = e.getActionCommand();
long t0;
long t1;
if (command.equals(COMPILE_ACTION)) {
if (ActionCommands.COMPILE_ACTION.equals(command)) {
try {
t0 = System.currentTimeMillis();
model.commitSource(sourcePanel.getSourceCode(), getLanguageVersion());
@ -144,7 +143,7 @@ public class MainFrame
setStatus(NLS.nls("MAIN.FRAME.COMPILATION.PROBLEM") + " " + exc.toString());
new ParseExceptionHandler(this, exc);
}
} else if (command.equals(EVALUATE_ACTION)) {
} else if (ActionCommands.EVALUATE_ACTION.equals(command)) {
try {
t0 = System.currentTimeMillis();
model.evaluateXPathExpression(xPathPanel.getXPathExpression(), this);