public class TryHandler extends BlockParentHandler
| Constructor and Description |
|---|
TryHandler(IndentationCheck indentCheck,
DetailAST ast,
AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check,
abstract syntax tree, and parent handler.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
checkChildIndentation(DetailAST ast,
java.lang.String subType,
IndentLevel expectedIdent)
Method to check indentation of try resources children.
|
void |
checkIndentation()
Check the indentation of the expression we are handling.
|
private void |
checkTryResources(DetailAST resourcesSpecAst)
Checks indentation of resources parameters in try resources.
|
private void |
checkTryResParen(DetailAST parenAst,
java.lang.String subType)
Method to check the indentation of left paren or right paren.
|
IndentLevel |
getSuggestedChildIndent(AbstractExpressionHandler child)
Indentation level suggested for a child element.
|
private DetailAST |
getTryResLparen()
Method to find left parenthesis of try with resources.
|
private DetailAST |
getTryResRparen()
Method to find right parenthesis of try with resources.
|
private static boolean |
isTryBlocksResourceSpecification(AbstractExpressionHandler expression)
Check if the expression is resource of try block.
|
canChildrenBeNested, checkTopLevelToken, curlyIndent, getCheckedChildren, getChildrenExpectedIndent, getLeftCurly, getListChild, getNonListChild, getRightCurly, getTopLevelAstcheckChildren, checkExpressionSubtree, checkLeftParen, checkModifiers, checkRightParen, checkWrappingIndentation, checkWrappingIndentation, expandedTabsColumnNo, findSubtreeAst, getBasicOffset, getBraceAdjustment, getFirstAstNode, getFirstLine, getFirstToken, getIndent, getIndentCheck, getIndentImpl, getLineStart, getLineStart, getMainAst, getParent, isOnStartOfLine, logError, logError, shouldIncreaseIndentpublic TryHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
indentCheck - the indentation checkast - the abstract syntax treeparent - the parent handlerprivate DetailAST getTryResLparen()
private DetailAST getTryResRparen()
public IndentLevel getSuggestedChildIndent(AbstractExpressionHandler child)
AbstractExpressionHandlergetSuggestedChildIndent in class BlockParentHandlerchild - child AST (so suggestion level can differ based on child
type)public void checkIndentation()
AbstractExpressionHandlercheckIndentation in class BlockParentHandlerprivate void checkTryResParen(DetailAST parenAst, java.lang.String subType)
parenAst - lparen or rparen ast to checksubType - name to be used in log messageprivate void checkChildIndentation(DetailAST ast, java.lang.String subType, IndentLevel expectedIdent)
ast - AST to check.subType - String representing child type.expectedIdent - Expected indent level.private void checkTryResources(DetailAST resourcesSpecAst)
resourcesSpecAst - Resource specification astprivate static boolean isTryBlocksResourceSpecification(AbstractExpressionHandler expression)
expression - The expression to checkCopyright © 2001-2022. All Rights Reserved.