Class MethodDefHandler


  • public class MethodDefHandler
    extends BlockParentHandler
    Handler for method definitions.
    • Constructor Detail

      • MethodDefHandler

        public MethodDefHandler​(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

      • checkThrows

        private void checkThrows()
        Check the indentation level of the throws clause.
      • getMethodDefLineStart

        private int getMethodDefLineStart​(DetailAST mainAst)
        Gets the start line of the method, excluding any annotations. This is required because the current TokenTypes.METHOD_DEF may not always be the start as seen in https://github.com/checkstyle/checkstyle/issues/3145.
        Parameters:
        mainAst - The method definition ast.
        Returns:
        The start column position of the method.
      • getMethodDefParamRightParen

        private static DetailAST getMethodDefParamRightParen​(DetailAST methodDefAst)
        Returns right parenthesis of method definition parameter list.
        Parameters:
        methodDefAst - method definition ast node(TokenTypes.LITERAL_IF)
        Returns:
        right parenthesis of method definition parameter list.
      • getHandlerName

        private static java.lang.String getHandlerName​(DetailAST ast)
        Creates a handler name for this class according to ast type.
        Parameters:
        ast - the abstract syntax tree.
        Returns:
        handler name for this class.