Class SynchronizedHandler


Handler for synchronized statements.
  • Field Details

    • methodModifier

      private final boolean methodModifier
      Determine that "synchronized" token used as modifier of method.
  • Constructor Details

    • SynchronizedHandler

      Construct an instance of this handler with the given indentation check, name, abstract syntax tree, and parent handler.
      Parameters:
      indentCheck - the indentation check
      ast - the abstract syntax tree
      parent - the parent handler
  • Method Details

    • checkIndentation

      public void checkIndentation()
      Description copied from class: AbstractExpressionHandler
      Check the indentation of the expression we are handling.
      Overrides:
      checkIndentation in class BlockParentHandler
    • checkSynchronizedExpr

      private void checkSynchronizedExpr()
      Check indentation of expression we synchronized on.
    • isMethodModifier

      private static boolean isMethodModifier(DetailAST ast)
      Checks if given synchronized is modifier of method.
      Parameters:
      ast - synchronized(TokenTypes.LITERAL_SYNCHRONIZED) to check
      Returns:
      true if synchronized only modifies method
    • getSynchronizedStatementRightParen

      private static DetailAST getSynchronizedStatementRightParen(DetailAST syncStatementAST)
      Returns right parenthesis of synchronized statement.
      Parameters:
      syncStatementAST - ast node(TokenTypes.LITERAL_SYNCHRONIZED)
      Returns:
      right parenthesis of synchronized statement.