Class TryHandler

    • Constructor Detail

      • TryHandler

        public TryHandler​(IndentationCheck indentCheck,
                          DetailAST ast,
                          AbstractExpressionHandler parent)
        Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.
        Parameters:
        indentCheck - the indentation check
        ast - the abstract syntax tree
        parent - the parent handler
    • Method Detail

      • getTryResLparen

        private DetailAST getTryResLparen()
        Method to find left parenthesis of try with resources.
        Returns:
        DetailAst left parenthesis of try with resources
      • getTryResRparen

        private DetailAST getTryResRparen()
        Method to find right parenthesis of try with resources.
        Returns:
        DetailAst right parenthesis of try with resources
      • checkTryResParen

        private void checkTryResParen​(DetailAST parenAst,
                                      String subType)
        Method to check the indentation of left paren or right paren. This method itself checks whether either of these are on start of line. This method takes care of line wrapping strict condition as well.
        Parameters:
        parenAst - lparen or rparen ast to check
        subType - name to be used in log message
      • checkChildIndentation

        private void checkChildIndentation​(DetailAST ast,
                                           String subType,
                                           IndentLevel expectedIdent)
        Method to check indentation of try resources children. It takes into account forceStrictCondition value when logging violations. Example of usage would include checking for try parenthesis and try resources.
        Parameters:
        ast - AST to check.
        subType - String representing child type.
        expectedIdent - Expected indent level.
      • checkTryResources

        private void checkTryResources​(DetailAST resourcesSpecAst)
        Checks indentation of resources parameters in try resources.
        Parameters:
        resourcesSpecAst - Resource specification ast