Class SynchronizedHandler
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler
-
- com.puppycrawl.tools.checkstyle.checks.indentation.BlockParentHandler
-
- com.puppycrawl.tools.checkstyle.checks.indentation.SynchronizedHandler
-
public class SynchronizedHandler extends BlockParentHandler
Handler for synchronized statements.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
methodModifier
Determine that "synchronized" token used as modifier of method.
-
Constructor Summary
Constructors Constructor Description SynchronizedHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, name, abstract syntax tree, and parent handler.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkIndentation()
Check the indentation of the expression we are handling.private void
checkSynchronizedExpr()
Check indentation of expression we synchronized on.private static DetailAST
getSynchronizedStatementRightParen(DetailAST syncStatementAST)
Returns right parenthesis of synchronized statement.private static boolean
isMethodModifier(DetailAST ast)
Checks if given synchronized is modifier of method.-
Methods inherited from class com.puppycrawl.tools.checkstyle.checks.indentation.BlockParentHandler
canChildrenBeNested, checkTopLevelToken, curlyIndent, getCheckedChildren, getChildrenExpectedIndent, getLeftCurly, getListChild, getNonListChild, getRightCurly, getSuggestedChildIndent, getTopLevelAst
-
Methods inherited from class com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler
checkChildren, checkExpressionSubtree, checkLeftParen, checkModifiers, checkRightParen, checkWrappingIndentation, checkWrappingIndentation, expandedTabsColumnNo, findSubtreeAst, getBasicOffset, getBraceAdjustment, getFirstAstNode, getFirstLine, getFirstToken, getIndent, getIndentCheck, getIndentImpl, getLineStart, getLineStart, getMainAst, getParent, isOnStartOfLine, logError, logError, shouldIncreaseIndent
-
-
-
-
Field Detail
-
methodModifier
private final boolean methodModifier
Determine that "synchronized" token used as modifier of method.
-
-
Constructor Detail
-
SynchronizedHandler
public SynchronizedHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, name, abstract syntax tree, and parent handler.- Parameters:
indentCheck
- the indentation checkast
- the abstract syntax treeparent
- the parent handler
-
-
Method Detail
-
checkIndentation
public void checkIndentation()
Description copied from class:AbstractExpressionHandler
Check the indentation of the expression we are handling.- Overrides:
checkIndentation
in classBlockParentHandler
-
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.
-
-