Fixed bug 1172137 - PMD no longer locks up when generating a control flow graph for if statements with labelled breaks.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@3567 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2005-06-11 03:03:15 +00:00
parent 643a167fac
commit 60b19072a9
4 changed files with 5 additions and 8 deletions

View File

@ -6,6 +6,7 @@ Fixed bug 1052356 - ImmutableField no longer triggers on fields which are assign
Fixed bug 1215854 - Package/class/method name are now filled in whenever possible, and the XML report includes all three.
Fixed bug 1209719 - MethodArgumentCouldBeFinal no longer triggers on arguments which are modified using postfix or prefix expressions. A bug in AvoidReassigningParameters was also fixed under the same bug id.
Fixed bug 1188386 - MethodReturnsInternalArray no longer flags returning a local array declaration.
Fixed bug 1172137 - PMD no longer locks up when generated a control flow graph for if statements with labelled breaks.
Implemented RFE 1188604 - AvoidThrowingCertainExceptionTypes has been split into AvoidThrowingRawExceptionTypes and AvoidThrowingNullPointerException.
Implemented RFE 1188369 - UnnecessaryBooleanAssertion now checks for things like 'assertTrue(!foo)'. These should be changed to 'assertFalse(foo)' for clarity.
Implemented RFE 1199622 - UnusedFormalParameter now defaults to only checking private methods unless a 'checkall' property is set.

View File

@ -13,8 +13,7 @@ import java.util.List;
public class AcceptanceTest extends ParserTst {
public void testLabelledBreakLockup() throws Throwable {
//System.out.println(LABELLED_BREAK_LOCKUP);
//getOrderedNodes(ASTMethodDeclarator.class, LABELLED_BREAK_LOCKUP);
getOrderedNodes(ASTMethodDeclarator.class, LABELLED_BREAK_LOCKUP);
}
private static final String LABELLED_BREAK_LOCKUP =

View File

@ -94,6 +94,7 @@ public class Linker {
break;
case NodeType.BREAK_STATEMENT:
// FIXME - what about breaks to labels above if statements?
List bList = node.getFlow();
for (int i = bList.indexOf(node); i < bList.size(); i++) {
IDataFlowNode n = (IDataFlowNode) bList.get(i);
@ -101,6 +102,7 @@ public class Linker {
if (n.isType(NodeType.WHILE_LAST_STATEMENT) ||
n.isType(NodeType.SWITCH_END) ||
n.isType(NodeType.FOR_END) ||
n.isType(NodeType.IF_LAST_STATEMENT_WITHOUT_ELSE) ||
n.isType(NodeType.DO_EXPR)) {
node.removePathToChild((IDataFlowNode) node.getChildren().get(0));
@ -116,7 +118,6 @@ public class Linker {
case NodeType.CONTINUE_STATEMENT:
//List cList = node.getFlow();
/* traverse up the tree and find the first loop start node
*/
/*

View File

@ -5,35 +5,31 @@ package net.sourceforge.pmd.dfa;
*/
public interface NodeType {
//IF STATEMENT
int IF_EXPR = 1;
int IF_LAST_STATEMENT = 2;
int IF_LAST_STATEMENT_WITHOUT_ELSE = 3;
int ELSE_LAST_STATEMENT = 4;
//WHILE STATEMENT
int WHILE_EXPR = 10;
int WHILE_LAST_STATEMENT = 11;
//SWITCH STATEMENT
int SWITCH_START = 20;
int CASE_LAST_STATEMENT = 21;
int SWITCH_LAST_DEFAULT_STATEMENT = 22;
int SWITCH_END = 23;
//FOR STATEMENT
int FOR_INIT = 30;
int FOR_EXPR = 31;
int FOR_UPDATE = 32;
int FOR_BEFORE_FIRST_STATEMENT = 33;
int FOR_END = 34;
//DO WHILE
int DO_BEFORE_FIRST_STATEMENT = 40;
int DO_EXPR = 41;
int RETURN_STATEMENT = 50;
int BREAK_STATEMENT = 51;
int CONTINUE_STATEMENT = 52;
// TODO - throw statements?
}