Search in sources :

Example 26 with ASTExpression

use of net.sourceforge.pmd.lang.java.ast.ASTExpression in project pmd by pmd.

the class StatementAndBraceFinderTest method testForStmtHasCorrectTypes.

@Test
public void testForStmtHasCorrectTypes() {
    ASTExpression exp = getOrderedNodes(ASTExpression.class, TEST5).get(0);
    DataFlowNode dfn = exp.getDataFlowNode().getFlow().get(2);
    assertTrue(dfn.isType(NodeType.FOR_INIT));
    dfn = exp.getDataFlowNode().getFlow().get(3);
    assertTrue(dfn.isType(NodeType.FOR_EXPR));
    dfn = exp.getDataFlowNode().getFlow().get(4);
    assertTrue(dfn.isType(NodeType.FOR_UPDATE));
    assertTrue(dfn.isType(NodeType.FOR_BEFORE_FIRST_STATEMENT));
    assertTrue(dfn.isType(NodeType.FOR_END));
}
Also used : DataFlowNode(net.sourceforge.pmd.lang.dfa.DataFlowNode) ASTExpression(net.sourceforge.pmd.lang.java.ast.ASTExpression) Test(org.junit.Test)

Aggregations

ASTExpression (net.sourceforge.pmd.lang.java.ast.ASTExpression)26 Test (org.junit.Test)9 ASTPrimaryExpression (net.sourceforge.pmd.lang.java.ast.ASTPrimaryExpression)8 Constraint (net.sourceforge.pmd.lang.java.typeresolution.typeinference.Constraint)8 Node (net.sourceforge.pmd.lang.ast.Node)7 ASTCompilationUnit (net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit)6 ASTPrimaryPrefix (net.sourceforge.pmd.lang.java.ast.ASTPrimaryPrefix)6 DataFlowNode (net.sourceforge.pmd.lang.dfa.DataFlowNode)3 ASTName (net.sourceforge.pmd.lang.java.ast.ASTName)3 ASTStatementExpression (net.sourceforge.pmd.lang.java.ast.ASTStatementExpression)3 ArrayList (java.util.ArrayList)2 ASTAssignmentOperator (net.sourceforge.pmd.lang.java.ast.ASTAssignmentOperator)2 ASTForInit (net.sourceforge.pmd.lang.java.ast.ASTForInit)2 ASTForUpdate (net.sourceforge.pmd.lang.java.ast.ASTForUpdate)2 ASTPrimarySuffix (net.sourceforge.pmd.lang.java.ast.ASTPrimarySuffix)2 ASTVariableDeclaratorId (net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId)2 VariableNameDeclaration (net.sourceforge.pmd.lang.java.symboltable.VariableNameDeclaration)2 ResolutionFailedException (net.sourceforge.pmd.lang.java.typeresolution.typeinference.TypeInferenceResolver.ResolutionFailedException)2 NameDeclaration (net.sourceforge.pmd.lang.symboltable.NameDeclaration)2 NameOccurrence (net.sourceforge.pmd.lang.symboltable.NameOccurrence)2