Class AvoidInstantiatingObjectsInLoopsRule

    • Constructor Detail

      • AvoidInstantiatingObjectsInLoopsRule

        public AvoidInstantiatingObjectsInLoopsRule()
    • Method Detail

      • visit

        public Object visit​(ASTAllocationExpression node,
                            Object data)
        This method is used to check whether user instantiates variables which are not assigned to arrays/lists in loops.
        Specified by:
        visit in interface JavaParserVisitor
        Overrides:
        visit in class AbstractJavaRule
        Parameters:
        node - This is the expression of part of java code to be checked.
        data - This is the data to return.
        Returns:
        Object This returns the data passed in. If violation happens, violation is added to data.