Search in sources :

Example 1 with ASTNewObjectExpression

use of net.sourceforge.pmd.lang.apex.ast.ASTNewObjectExpression in project pmd by pmd.

the class ApexOpenRedirectRule method visit.

@Override
public Object visit(ASTUserClass node, Object data) {
    if (Helper.isTestMethodOrClass(node) || Helper.isSystemLevelClass(node)) {
        // stops all the rules
        return data;
    }
    List<ASTAssignmentExpression> assignmentExprs = node.findDescendantsOfType(ASTAssignmentExpression.class);
    for (ASTAssignmentExpression assignment : assignmentExprs) {
        findSafeLiterals(assignment);
    }
    List<ASTVariableDeclaration> variableDecls = node.findDescendantsOfType(ASTVariableDeclaration.class);
    for (ASTVariableDeclaration varDecl : variableDecls) {
        findSafeLiterals(varDecl);
    }
    List<ASTField> fieldDecl = node.findDescendantsOfType(ASTField.class);
    for (ASTField fDecl : fieldDecl) {
        findSafeLiterals(fDecl);
    }
    List<ASTNewObjectExpression> newObjects = node.findDescendantsOfType(ASTNewObjectExpression.class);
    for (ASTNewObjectExpression newObj : newObjects) {
        checkNewObjects(newObj, data);
    }
    listOfStringLiteralVariables.clear();
    return data;
}
Also used : ASTAssignmentExpression(net.sourceforge.pmd.lang.apex.ast.ASTAssignmentExpression) ASTVariableDeclaration(net.sourceforge.pmd.lang.apex.ast.ASTVariableDeclaration) ASTNewObjectExpression(net.sourceforge.pmd.lang.apex.ast.ASTNewObjectExpression) ASTField(net.sourceforge.pmd.lang.apex.ast.ASTField)

Aggregations

ASTAssignmentExpression (net.sourceforge.pmd.lang.apex.ast.ASTAssignmentExpression)1 ASTField (net.sourceforge.pmd.lang.apex.ast.ASTField)1 ASTNewObjectExpression (net.sourceforge.pmd.lang.apex.ast.ASTNewObjectExpression)1 ASTVariableDeclaration (net.sourceforge.pmd.lang.apex.ast.ASTVariableDeclaration)1