Class RightCurlyCheck.Details
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.Details
-
- Enclosing class:
- RightCurlyCheck
private static final class RightCurlyCheck.Details extends java.lang.Object
Structure that contains all details for validation.
-
-
Field Summary
Fields Modifier and Type Field Description private DetailASTlcurlyLeft curly.private DetailASTnextTokenNext token.private DetailASTrcurlyRight curly.private booleanshouldCheckLastRcurlyShould check last right curly.private static int[]TOKENS_WITH_NO_CHILD_SLISTToken types that identify tokens that will never have SLIST in their AST.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static RightCurlyCheck.DetailsgetDetails(DetailAST ast)Collects validation Details.private static RightCurlyCheck.DetailsgetDetailsForDoLoops(DetailAST ast)Collects validation details for LITERAL_DO loops' tokens.private static RightCurlyCheck.DetailsgetDetailsForIf(DetailAST ast)Collects validation details for LITERAL_IF.private static RightCurlyCheck.DetailsgetDetailsForOthers(DetailAST ast)Collects validation details for CLASS_DEF, RECORD_DEF, METHOD DEF, CTOR_DEF, STATIC_INIT, INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, and COMPACT_CTOR_DEF.private static RightCurlyCheck.DetailsgetDetailsForTryCatch(DetailAST ast)Collects validation details for LITERAL_TRY, and LITERAL_CATCH.private static DetailASTgetNextToken(DetailAST ast)Finds next token after the given one.private static booleanisTokenWithNoChildSlist(int tokenType)Tests whether the provided tokenType will never have a SLIST as child in its AST.
-
-
-
Field Detail
-
TOKENS_WITH_NO_CHILD_SLIST
private static final int[] TOKENS_WITH_NO_CHILD_SLIST
Token types that identify tokens that will never have SLIST in their AST.
-
shouldCheckLastRcurly
private final boolean shouldCheckLastRcurly
Should check last right curly.
-
-
Constructor Detail
-
Details
private Details(DetailAST lcurly, DetailAST rcurly, DetailAST nextToken, boolean shouldCheckLastRcurly)
Constructor.- Parameters:
lcurly- the lcurly of the token whose details are being collectedrcurly- the rcurly of the token whose details are being collectednextToken- the token after the token whose details are being collectedshouldCheckLastRcurly- boolean value to determine if to check last rcurly
-
-
Method Detail
-
getDetails
private static RightCurlyCheck.Details getDetails(DetailAST ast)
Collects validation Details.- Parameters:
ast- aDetailASTvalue- Returns:
- object containing all details to make a validation
-
getDetailsForTryCatch
private static RightCurlyCheck.Details getDetailsForTryCatch(DetailAST ast)
Collects validation details for LITERAL_TRY, and LITERAL_CATCH.- Parameters:
ast- aDetailASTvalue- Returns:
- object containing all details to make a validation
-
getDetailsForIf
private static RightCurlyCheck.Details getDetailsForIf(DetailAST ast)
Collects validation details for LITERAL_IF.- Parameters:
ast- aDetailASTvalue- Returns:
- object containing all details to make a validation
-
getDetailsForOthers
private static RightCurlyCheck.Details getDetailsForOthers(DetailAST ast)
Collects validation details for CLASS_DEF, RECORD_DEF, METHOD DEF, CTOR_DEF, STATIC_INIT, INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, and COMPACT_CTOR_DEF.- Parameters:
ast- aDetailASTvalue- Returns:
- an object containing all details to make a validation
-
isTokenWithNoChildSlist
private static boolean isTokenWithNoChildSlist(int tokenType)
Tests whether the provided tokenType will never have a SLIST as child in its AST. Like CLASS_DEF, ANNOTATION_DEF etc.- Parameters:
tokenType- the tokenType to test against.- Returns:
- weather provided tokenType is definition token.
-
getDetailsForDoLoops
private static RightCurlyCheck.Details getDetailsForDoLoops(DetailAST ast)
Collects validation details for LITERAL_DO loops' tokens.- Parameters:
ast- aDetailASTvalue- Returns:
- an object containing all details to make a validation
-
getNextToken
private static DetailAST getNextToken(DetailAST ast)
Finds next token after the given one.- Parameters:
ast- the given node.- Returns:
- the token which represents next lexical item.
-
-