Search in sources :

Example 1 with DAAPathFinder

use of net.sourceforge.pmd.lang.dfa.pathfinder.DAAPathFinder in project pmd by pmd.

the class UselessAssignment method visit.

public Object visit(ASTMethodDeclaration node, Object data) {
    this.rc = (RuleContext) data;
    /*
         * IDataFlowNode n1 = node.getDataFlowNode(); List f = n1.getFlow(); for
         * (Iterator i = f.iterator(); i.hasNext();) { DataFlowNode dfan =
         * (DataFlowNode)i.next(); System.out.println(dfan); List va =
         * dfan.getVariableAccess(); for (Iterator j = va.iterator();
         * j.hasNext();) { VariableAccess o = (VariableAccess)j.next();
         * System.out.println(o); } }
         */
    DAAPathFinder a = new DAAPathFinder(node.getDataFlowNode().getFlow().get(0), this);
    a.run();
    return data;
}
Also used : DAAPathFinder(net.sourceforge.pmd.lang.dfa.pathfinder.DAAPathFinder)

Example 2 with DAAPathFinder

use of net.sourceforge.pmd.lang.dfa.pathfinder.DAAPathFinder in project pmd by pmd.

the class DataflowAnomalyAnalysisRule method visit.

public Object visit(ASTMethodDeclaration methodDeclaration, Object data) {
    rc = (RuleContext) data;
    daaRuleViolations = new ArrayList<>();
    final DataFlowNode node = methodDeclaration.getDataFlowNode().getFlow().get(0);
    final DAAPathFinder pathFinder = new DAAPathFinder(node, this, getProperty(MAX_PATH_DESCRIPTOR));
    pathFinder.run();
    super.visit(methodDeclaration, data);
    return data;
}
Also used : DAAPathFinder(net.sourceforge.pmd.lang.dfa.pathfinder.DAAPathFinder) DataFlowNode(net.sourceforge.pmd.lang.dfa.DataFlowNode)

Example 3 with DAAPathFinder

use of net.sourceforge.pmd.lang.dfa.pathfinder.DAAPathFinder in project pmd by pmd.

the class DAAPathFinderTest method testTwoUpdateDefs.

@Test
public void testTwoUpdateDefs() {
    ASTMethodDeclarator meth = getOrderedNodes(ASTMethodDeclarator.class, TWO_UPDATE_DEFS).get(0);
    DAAPathFinder a = new DAAPathFinder(meth.getDataFlowNode().getFlow().get(0), this);
// a.run();
}
Also used : ASTMethodDeclarator(net.sourceforge.pmd.lang.java.ast.ASTMethodDeclarator) DAAPathFinder(net.sourceforge.pmd.lang.dfa.pathfinder.DAAPathFinder) Test(org.junit.Test)

Aggregations

DAAPathFinder (net.sourceforge.pmd.lang.dfa.pathfinder.DAAPathFinder)3 DataFlowNode (net.sourceforge.pmd.lang.dfa.DataFlowNode)1 ASTMethodDeclarator (net.sourceforge.pmd.lang.java.ast.ASTMethodDeclarator)1 Test (org.junit.Test)1