Uses of Interface
com.puppycrawl.tools.checkstyle.api.DetailAST
-
Packages that use DetailAST Package Description com.puppycrawl.tools.checkstyle Contains the implementation of the Checkstyle framework.com.puppycrawl.tools.checkstyle.api Contains the core API to be used to implement checks.com.puppycrawl.tools.checkstyle.checks Contains the checks that are bundled with the main distribution.com.puppycrawl.tools.checkstyle.checks.annotation Contains the Annotation checks that are bundled with the main distribution.com.puppycrawl.tools.checkstyle.checks.blocks Contains the Block checks that are bundled with the main distribution.com.puppycrawl.tools.checkstyle.checks.coding Contains the Coding checks that are bundled with the main distribution.com.puppycrawl.tools.checkstyle.checks.design Contains the Class Design checks that are bundled with the main distribution.com.puppycrawl.tools.checkstyle.checks.imports Contains the Imports checks that are bundled with the main distribution.com.puppycrawl.tools.checkstyle.checks.indentation Contains all classes required for the indentation check.com.puppycrawl.tools.checkstyle.checks.javadoc Contains the Javadoc checks that are bundled with the main distribution.com.puppycrawl.tools.checkstyle.checks.metrics Contains the Metrics checks that are bundled with the main distribution.com.puppycrawl.tools.checkstyle.checks.modifier Contains the modifier checks that are bundled with the main distribution.com.puppycrawl.tools.checkstyle.checks.naming Contains the Naming conventions checks that are bundled with the main distribution.com.puppycrawl.tools.checkstyle.checks.regexp Contains the regular expression checks that are bundled with the main distribution.com.puppycrawl.tools.checkstyle.checks.sizes Contains the Size Violations checks that are bundled with the main distribution.com.puppycrawl.tools.checkstyle.checks.whitespace Contains the Whitespace checks that are bundled with the main distribution.com.puppycrawl.tools.checkstyle.gui User interface classes for CheckStyle.com.puppycrawl.tools.checkstyle.meta Contains module metadata generation classes for checkstyle.com.puppycrawl.tools.checkstyle.site Contains classes for generating the Checkstyle website.com.puppycrawl.tools.checkstyle.utils Contains utils classes for checkstyle.com.puppycrawl.tools.checkstyle.xpath Contains the nodes implementations for XPATH queries and query generator. -
-
Uses of DetailAST in com.puppycrawl.tools.checkstyle
Classes in com.puppycrawl.tools.checkstyle that implement DetailAST Modifier and Type Class Description class
DetailAstImpl
The implementation ofDetailAST
.Fields in com.puppycrawl.tools.checkstyle declared as DetailAST Modifier and Type Field Description private DetailAST
TreeWalkerAuditEvent. rootAst
Root ast element.Methods in com.puppycrawl.tools.checkstyle that return DetailAST Modifier and Type Method Description static DetailAST
JavaParser. appendHiddenCommentNodes(DetailAST root)
Appends comment nodes to existing AST.private static DetailAST
JavaParser. createCommentAstFromToken(org.antlr.v4.runtime.CommonToken token)
Create comment AST from token.private static DetailAST
JavaParser. createSlCommentNode(org.antlr.v4.runtime.Token token)
Create single-line comment from token.DetailAST
DetailAstImpl. findFirstToken(int tokenType)
private static DetailAST
JavadocPropertiesGenerator. getClassBody(DetailAST top)
Finds the class body of the first class in the DetailAST.DetailAST
DetailAstImpl. getLastChild()
DetailAST
DetailAstImpl. getParent()
DetailAST
DetailAstImpl. getPreviousSibling()
DetailAST
TreeWalkerAuditEvent. getRootAst()
Gets the root element of the AST tree.static DetailAST
JavaParser. parse(FileContents contents)
Static helper method to parses a Java source file.static DetailAST
JavaParser. parseFile(File file, JavaParser.Options options)
Parses Java source file.static DetailAST
JavaParser. parseFileText(FileText text, JavaParser.Options options)
Parse a text and return the parse tree.Methods in com.puppycrawl.tools.checkstyle with parameters of type DetailAST Modifier and Type Method Description void
DetailAstImpl. addChild(DetailAST child)
Adds a new child to the current AST.void
DetailAstImpl. addNextSibling(DetailAST ast)
Add next sibling, pushes other siblings back.void
DetailAstImpl. addPreviousSibling(DetailAST ast)
Add previous sibling.static DetailAST
JavaParser. appendHiddenCommentNodes(DetailAST root)
Appends comment nodes to existing AST.private static int
DetailAstImpl. findColumnNo(DetailAST ast)
Finds column number in the first non-comment node.private static int
DetailAstImpl. findLineNo(DetailAST ast)
Finds line number in the first non-comment node.private static String
SuppressionsStringPrinter. generate(FileText fileText, DetailAST detailAST, int lineNumber, int columnNumber, int tabWidth)
CreatesXpathQueryGenerator
instance and generates suppressions.private static DetailAST
JavadocPropertiesGenerator. getClassBody(DetailAST top)
Finds the class body of the first class in the DetailAST.private SortedSet<Violation>
TreeWalker. getFilteredViolations(String fileName, FileContents fileContents, DetailAST rootAST)
Returns filtered set ofViolation
.private static String
JavadocPropertiesGenerator. getFirstJavadocSentence(DetailAST ast)
Extracts the first sentence as HTML formatted text from the comment of an DetailAST.private static String
AstTreeStringPrinter. getIndentation(DetailAST ast)
Get indentation for an AST node.private Collection<AbstractCheck>
TreeWalker. getListOfChecks(DetailAST ast, TreeWalker.AstState astState)
Method returns list of checks.private static String
JavadocPropertiesGenerator. getName(DetailAST ast)
Extracts the name of an ast.private static String
AstTreeStringPrinter. getNodeInfo(DetailAST node)
Get string representation of the node as token name, node text, line number and column number.private static boolean
JavadocPropertiesGenerator. isPublicStaticFinalIntField(DetailAST ast)
Checks that the DetailAST is apublic
static
final
int
field.private static void
JavadocPropertiesGenerator. iteratePublicStaticIntFields(DetailAST objBlock, Consumer<String> consumer)
Walks over the type members and push the first javadoc sentence of everypublic
static
int
field to the consumer.private void
TreeWalker. notifyBegin(DetailAST rootAST, FileContents contents, TreeWalker.AstState astState)
Notify checks that we are about to begin walking a tree.private void
TreeWalker. notifyEnd(DetailAST rootAST, TreeWalker.AstState astState)
Notify checks that we have finished walking a tree.private void
TreeWalker. notifyLeave(DetailAST ast, TreeWalker.AstState astState)
Notify checks that leaving a node.private void
TreeWalker. notifyVisit(DetailAST ast, TreeWalker.AstState astState)
Notify checks that visiting a node.private static String
AstTreeStringPrinter. parseAndPrintJavadocTree(DetailAST node)
Parses block comment as javadoc and prints its tree.static DetailNode
DetailNodeTreeStringPrinter. parseJavadocAsDetailNode(DetailAST blockComment)
Parse block comment DetailAST as Javadoc DetailNode tree.JavadocDetailNodeParser.ParseStatus
JavadocDetailNodeParser. parseJavadocAsDetailNode(DetailAST javadocCommentAst)
Parses Javadoc comment as DetailNode tree.static String
AstTreeStringPrinter. printBranch(DetailAST node)
Print branch info from root down to givennode
.private static String
AstTreeStringPrinter. printJavaAndJavadocTree(DetailAST ast)
Prints full tree (java + comments + javadoc) of the DetailAST.private static String
AstTreeStringPrinter. printTree(DetailAST ast)
Print AST.private void
TreeWalker. processIter(DetailAST root, TreeWalker.AstState astState)
Processes a node calling interested checks at each node.void
DetailAstImpl. setFirstChild(DetailAST firstChild)
Sets the first child of this AST.void
DetailAstImpl. setNextSibling(DetailAST nextSibling)
Sets the next sibling of this AST.private void
TreeWalker. walk(DetailAST ast, FileContents contents, TreeWalker.AstState astState)
Initiates the walk of an AST.Constructors in com.puppycrawl.tools.checkstyle with parameters of type DetailAST Constructor Description TreeWalkerAuditEvent(FileContents fileContents, String fileName, Violation violation, DetailAST rootAst)
Creates a newTreeWalkerAuditEvent
instance. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.api
Fields in com.puppycrawl.tools.checkstyle.api declared as DetailAST Modifier and Type Field Description private DetailAST
FullIdent. detailAst
The topmost and leftmost AST of the full identifier.Methods in com.puppycrawl.tools.checkstyle.api that return DetailAST Modifier and Type Method Description DetailAST
DetailAST. findFirstToken(int type)
Returns the first child token that makes a specified type.DetailAST
FullIdent. getDetailAst()
Gets the topmost leftmost DetailAST for this FullIdent.DetailAST
DetailAST. getFirstChild()
Get the first child of this AST.DetailAST
DetailAST. getLastChild()
Gets the last child node.DetailAST
DetailAST. getNextSibling()
Get the next sibling in line after this one.DetailAST
DetailAST. getParent()
Returns the parent token.DetailAST
DetailAST. getPreviousSibling()
Returns the previous sibling or null if no such sibling exists.Methods in com.puppycrawl.tools.checkstyle.api with parameters of type DetailAST Modifier and Type Method Description private void
FullIdent. append(DetailAST ast)
Append the specified token and also recalibrate the first line and column.private static void
FullIdent. appendBrackets(FullIdent full, DetailAST ast)
Appends the brackets of an array type to aFullIdent
.void
AbstractCheck. beginTree(DetailAST rootAST)
Called before the starting to process a tree.static FullIdent
FullIdent. createFullIdent(DetailAST ast)
Creates a new FullIdent starting from the specified node.static FullIdent
FullIdent. createFullIdentBelow(DetailAST ast)
Creates a new FullIdent starting from the child of the specified node.private static void
FullIdent. extractFullIdent(FullIdent full, DetailAST ast)
Recursively extract a FullIdent.void
AbstractCheck. finishTree(DetailAST rootAST)
Called after finished processing a tree.private static boolean
FullIdent. isArrayTypeDeclaration(DetailAST arrayDeclarator)
Checks an `ARRAY_DECLARATOR` ast to verify that it is not an array initialization, i.e.void
AbstractCheck. leaveToken(DetailAST ast)
Called after all the child nodes have been process.void
AbstractCheck. log(DetailAST ast, String key, Object... args)
Helper method to log a Violation.void
AbstractCheck. visitToken(DetailAST ast)
Called to process a token. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.checks
Fields in com.puppycrawl.tools.checkstyle.checks declared as DetailAST Modifier and Type Field Description private DetailAST
OuterTypeFilenameCheck. wrongType
Outer type with mismatched file name.Methods in com.puppycrawl.tools.checkstyle.checks that return DetailAST Modifier and Type Method Description private static DetailAST
SuppressWarningsHolder. getNthChild(DetailAST ast, int index)
Returns the n'th child of an AST node.Methods in com.puppycrawl.tools.checkstyle.checks that return types with arguments of type DetailAST Modifier and Type Method Description private static Optional<DetailAST>
SuppressWarningsHolder. getAnnotationTarget(DetailAST ast)
Get target of annotation.Methods in com.puppycrawl.tools.checkstyle.checks with parameters of type DetailAST Modifier and Type Method Description private static void
SuppressWarningsHolder. addSuppressions(List<String> values, DetailAST targetAST)
Method to populate list of suppression entries.void
AvoidEscapedUnicodeCharactersCheck. beginTree(DetailAST rootAST)
void
OuterTypeFilenameCheck. beginTree(DetailAST rootAST)
void
SuppressWarningsHolder. beginTree(DetailAST rootAST)
void
UncommentedMainCheck. beginTree(DetailAST rootAST)
private void
TrailingCommentCheck. checkBlockComment(DetailAST ast)
Method to check if block comment is in correct format.private static boolean
UncommentedMainCheck. checkModifiers(DetailAST method)
Checks that method has final and static modifiers.private static boolean
UncommentedMainCheck. checkName(DetailAST method)
Checks that method name is @quot;main@quot;.private void
FinalParametersCheck. checkParam(DetailAST param)
Checks if the given parameter is final.private static boolean
UncommentedMainCheck. checkParams(DetailAST method)
Checks that method has onlyString[]
or onlyString...
param.private void
TrailingCommentCheck. checkSingleLineComment(DetailAST ast)
Checks if single-line comment is legal.private static boolean
UncommentedMainCheck. checkType(DetailAST method)
Checks that return type isvoid
.private void
DescendantTokenCheck. countTokens(DetailAST ast, int depth)
Counts the number of occurrences of descendant tokens.private static List<String>
SuppressWarningsHolder. findAllExpressionsInChildren(DetailAST parent)
Method looks at children and returns list of expressions in strings.void
NoCodeInFileCheck. finishTree(DetailAST ast)
void
OuterTypeFilenameCheck. finishTree(DetailAST rootAST)
private static List<String>
SuppressWarningsHolder. getAllAnnotationValues(DetailAST ast)
Get all annotation values.private static Optional<DetailAST>
SuppressWarningsHolder. getAnnotationTarget(DetailAST ast)
Get target of annotation.private static List<String>
SuppressWarningsHolder. getAnnotationValues(DetailAST ast)
Returns the annotation values represented by an AST.private static String
SuppressWarningsHolder. getIdentifier(DetailAST ast)
Returns the Java identifier represented by an AST.private static DetailAST
SuppressWarningsHolder. getNthChild(DetailAST ast, int index)
Returns the n'th child of an AST node.private static String
SuppressWarningsHolder. getStringExpr(DetailAST ast)
Returns the literal string expression represented by an AST.private boolean
AvoidEscapedUnicodeCharactersCheck. hasTrailComment(DetailAST ast)
Check if trail comment is present after ast token.private boolean
FinalParametersCheck. isIgnoredPrimitiveParam(DetailAST paramDef)
Checks for skip current param due to ignorePrimitiveTypes option.private boolean
FinalParametersCheck. isIgnoredUnnamedParam(DetailAST paramDef)
Checks for skip current param due to ignoreUnnamedParameters option.private static boolean
UncommentedMainCheck. isStringType(DetailAST typeAst)
Whether the type is java.lang.String.void
UncommentedMainCheck. leaveToken(DetailAST ast)
private void
DescendantTokenCheck. logAsSeparated(DetailAST ast)
Log violations for each Token.private void
DescendantTokenCheck. logAsTotal(DetailAST ast)
Log validation as one violation.private void
FinalParametersCheck. visitCatch(DetailAST catchClause)
Checks parameter of the catch block.private void
UncommentedMainCheck. visitClassOrRecordDef(DetailAST classOrRecordDef)
If not inner class then change current class name.private void
FinalParametersCheck. visitForEachClause(DetailAST forEachClause)
Checks parameter of the for each clause.private void
FinalParametersCheck. visitMethod(DetailAST method)
Checks parameters of the method or ctor.private void
UncommentedMainCheck. visitMethodDef(DetailAST method)
Checks method definition if this ispublic static void main(String[])
.private void
UncommentedMainCheck. visitPackageDef(DetailAST packageDef)
Sets current package.void
ArrayTypeStyleCheck. visitToken(DetailAST ast)
void
AvoidEscapedUnicodeCharactersCheck. visitToken(DetailAST ast)
void
DescendantTokenCheck. visitToken(DetailAST ast)
void
FinalParametersCheck. visitToken(DetailAST ast)
void
OuterTypeFilenameCheck. visitToken(DetailAST ast)
void
SuppressWarningsHolder. visitToken(DetailAST ast)
void
TodoCommentCheck. visitToken(DetailAST ast)
void
TrailingCommentCheck. visitToken(DetailAST ast)
void
UncommentedMainCheck. visitToken(DetailAST ast)
void
UpperEllCheck. visitToken(DetailAST ast)
-
Uses of DetailAST in com.puppycrawl.tools.checkstyle.checks.annotation
Methods in com.puppycrawl.tools.checkstyle.checks.annotation that return DetailAST Modifier and Type Method Description private static DetailAST
SuppressWarningsCheck. findWarningsHolder(DetailAST annotation)
Find the parent (holder) of the of the warnings (Expr).private static DetailAST
SuppressWarningsCheck. getCondLeft(DetailAST cond)
Retrieves the left side of a conditional.private static DetailAST
SuppressWarningsCheck. getCondRight(DetailAST cond)
Retrieves the right side of a conditional.private static DetailAST
AnnotationOnSameLineCheck. getNextNode(DetailAST node)
Finds next node of ast tree.private static DetailAST
MissingDeprecatedCheck. getParent(DetailAST commentBlock)
Returns the parent node of the comment.private static DetailAST
SuppressWarningsCheck. getSuppressWarnings(DetailAST ast)
Gets theSuppressWarnings
annotation that is annotating the AST.Methods in com.puppycrawl.tools.checkstyle.checks.annotation with parameters of type DetailAST Modifier and Type Method Description private void
AnnotationLocationCheck. checkAnnotations(DetailAST modifierNode, int correctIndentation)
Checks annotations positions in code: 1) Checks whether the annotations locations are correct. 2) Checks whether the annotations have the valid indentation level.private void
AnnotationUseStyleCheck. checkCheckClosingParensOption(DetailAST ast)
Checks to see if the closing parenthesis are present if required or prohibited.private void
AnnotationUseStyleCheck. checkCompactNoArrayStyle(DetailAST annotation)
Checks for compact no array style type violations.private void
AnnotationUseStyleCheck. checkCompactStyle(DetailAST annotation)
Checks for compact style type violations.private void
AnnotationUseStyleCheck. checkExpandedStyle(DetailAST annotation)
Checks for expanded style type violations.private void
AnnotationUseStyleCheck. checkStyleType(DetailAST annotation)
Checks to see if theAnnotationElementStyleOption
is correct.private void
AnnotationUseStyleCheck. checkTrailingComma(DetailAST annotation)
Checks to see if the trailing comma is present if required or prohibited.private static boolean
MissingOverrideCheck. containsInheritDocTag(DetailAST ast)
Checks to see if the ast contains a inheritDoc tag.private static DetailAST
SuppressWarningsCheck. findWarningsHolder(DetailAST annotation)
Find the parent (holder) of the of the warnings (Expr).private static String
AnnotationLocationCheck. getAnnotationName(DetailAST annotation)
Returns the name of the given annotation.private static String
AnnotationOnSameLineCheck. getAnnotationName(DetailAST annotation)
Returns the name of the given annotation.private static DetailAST
SuppressWarningsCheck. getCondLeft(DetailAST cond)
Retrieves the left side of a conditional.private static DetailAST
SuppressWarningsCheck. getCondRight(DetailAST cond)
Retrieves the right side of a conditional.private static int
AnnotationLocationCheck. getExpectedAnnotationIndentation(DetailAST node)
Returns an expected annotation indentation.private static DetailAST
AnnotationOnSameLineCheck. getNextNode(DetailAST node)
Finds next node of ast tree.private static DetailAST
MissingDeprecatedCheck. getParent(DetailAST commentBlock)
Returns the parent node of the comment.private static DetailAST
SuppressWarningsCheck. getSuppressWarnings(DetailAST ast)
Gets theSuppressWarnings
annotation that is annotating the AST.private static boolean
AnnotationUseStyleCheck. hasArguments(DetailAST annotation)
Checks that annotation has arguments.private static boolean
AnnotationLocationCheck. hasNodeAfter(DetailAST annotation)
Checks whether an annotation node has any node after on the same line.private static boolean
AnnotationLocationCheck. hasNodeBefore(DetailAST annotation)
Checks whether an annotation node has any node before on the same line.private static boolean
AnnotationLocationCheck. hasNodeBeside(DetailAST annotation)
Checks whether an annotation node has any node before or after on the same line.private boolean
AnnotationLocationCheck. isCorrectLocation(DetailAST annotation, boolean hasParams)
Checks whether an annotation has a correct location.private static boolean
AnnotationLocationCheck. isParameterized(DetailAST annotation)
Checks whether an annotation has parameters.private void
AnnotationUseStyleCheck. logCommaViolation(DetailAST ast)
Logs a trailing array comma violation if one exists.private void
SuppressWarningsCheck. logMatch(DetailAST ast, String warningText)
This method looks for a warning that matches a configured expression.void
AnnotationLocationCheck. visitToken(DetailAST ast)
void
AnnotationOnSameLineCheck. visitToken(DetailAST ast)
void
AnnotationUseStyleCheck. visitToken(DetailAST ast)
void
MissingOverrideCheck. visitToken(DetailAST ast)
void
PackageAnnotationCheck. visitToken(DetailAST ast)
void
SuppressWarningsCheck. visitToken(DetailAST ast)
private void
SuppressWarningsCheck. walkConditional(DetailAST cond)
Recursively walks a conditional expression checking the left and right sides, checking for matches and logging violations. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.checks.blocks
Fields in com.puppycrawl.tools.checkstyle.checks.blocks declared as DetailAST Modifier and Type Field Description private DetailAST
RightCurlyCheck.Details. lcurly
Left curly.private DetailAST
RightCurlyCheck.Details. nextToken
Next token.private DetailAST
RightCurlyCheck.Details. rcurly
Right curly.Methods in com.puppycrawl.tools.checkstyle.checks.blocks that return DetailAST Modifier and Type Method Description private static DetailAST
LeftCurlyCheck. findLastAnnotation(DetailAST modifiers)
Find the last token of typeTokenTypes.ANNOTATION
under the given set of modifiers.private static DetailAST
LeftCurlyCheck. getBraceAsFirstChild(DetailAST ast)
Gets a SLIST if it is the first child of the AST.private static DetailAST
LeftCurlyCheck. getBraceFromSwitchMember(DetailAST ast)
Gets the brace of a switch statement/ expression member.private static DetailAST
NeedBracesCheck. getLastLambdaToken(DetailAST lambda)
Looks for the last token in lambda.private static DetailAST
RightCurlyCheck.Details. getNextToken(DetailAST ast)
Finds next token after the given one.private static DetailAST
LeftCurlyCheck. skipModifierAnnotations(DetailAST ast)
Skip allTokenTypes.ANNOTATION
s to the first non-annotation.Methods in com.puppycrawl.tools.checkstyle.checks.blocks that return types with arguments of type DetailAST Modifier and Type Method Description private static Optional<DetailAST>
EmptyBlockCheck. getLeftCurly(DetailAST ast)
Calculates the left curly corresponding to the block to be checked.Methods in com.puppycrawl.tools.checkstyle.checks.blocks with parameters of type DetailAST Modifier and Type Method Description private static DetailAST
LeftCurlyCheck. findLastAnnotation(DetailAST modifiers)
Find the last token of typeTokenTypes.ANNOTATION
under the given set of modifiers.private static DetailAST
LeftCurlyCheck. getBraceAsFirstChild(DetailAST ast)
Gets a SLIST if it is the first child of the AST.private static DetailAST
LeftCurlyCheck. getBraceFromSwitchMember(DetailAST ast)
Gets the brace of a switch statement/ expression member.private static String
EmptyCatchBlockCheck. getCommentFirstLine(DetailAST catchAst)
Gets the first line of comment in catch block.private static RightCurlyCheck.Details
RightCurlyCheck.Details. getDetails(DetailAST ast)
Collects validation Details.private static RightCurlyCheck.Details
RightCurlyCheck.Details. getDetailsForCase(DetailAST caseNode)
Collects details about case statements.private static RightCurlyCheck.Details
RightCurlyCheck.Details. getDetailsForDoLoops(DetailAST ast)
Collects validation details for LITERAL_DO loops' tokens.private static RightCurlyCheck.Details
RightCurlyCheck.Details. getDetailsForIf(DetailAST ast)
Collects validation details for LITERAL_IF.private static RightCurlyCheck.Details
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.private static RightCurlyCheck.Details
RightCurlyCheck.Details. getDetailsForSwitch(DetailAST switchNode)
Collects details about switch statements and expressions.private static RightCurlyCheck.Details
RightCurlyCheck.Details. getDetailsForTryCatch(DetailAST ast)
Collects validation details for LITERAL_TRY, and LITERAL_CATCH.private static String
EmptyCatchBlockCheck. getExceptionVariableName(DetailAST catchAst)
Gets variable's name associated with exception.private static DetailAST
NeedBracesCheck. getLastLambdaToken(DetailAST lambda)
Looks for the last token in lambda.private static Optional<DetailAST>
EmptyBlockCheck. getLeftCurly(DetailAST ast)
Calculates the left curly corresponding to the block to be checked.private static DetailAST
RightCurlyCheck.Details. getNextToken(DetailAST ast)
Finds next token after the given one.private boolean
LeftCurlyCheck. hasLineBreakAfter(DetailAST leftCurly)
Checks if left curly has line break after.private static boolean
RightCurlyCheck. hasLineBreakBefore(DetailAST rightCurly)
Checks if right curly has line break before.private static boolean
AvoidNestedBlocksCheck. hasSiblings(DetailAST ast)
Checks whether the AST node has any siblings or not.private boolean
EmptyBlockCheck. hasText(DetailAST slistAST)
Checks if SLIST token contains any text.private static boolean
NeedBracesCheck. hasUnbracedStatements(DetailAST ast)
Checks if switch member (case, default statements) has statements without curly braces.private boolean
NeedBracesCheck. isBracesNeeded(DetailAST ast)
Checks if token needs braces.private static boolean
EmptyCatchBlockCheck. isEmptyCatchBlock(DetailAST catchAst)
Checks if catch block is empty or contains only comments.private boolean
NeedBracesCheck. isEmptyLoopBodyAllowed(DetailAST ast)
Checks if current loop has empty body and can be skipped by this check.private static boolean
NeedBracesCheck. isInSwitchRule(DetailAST ast)
Checks if current ast's parent is a switch rule, e.g.:private static boolean
NeedBracesCheck. isSingleLineCaseGroup(DetailAST ast)
Checks if switch member in case group (case or default statement) is single-line statement, e.g.:private static boolean
NeedBracesCheck. isSingleLineDoWhile(DetailAST literalDo)
Checks if current do-while statement is single-line statement, e.g.:private static boolean
NeedBracesCheck. isSingleLineElse(DetailAST literalElse)
Checks if current else statement is single-line statement, e.g.:private static boolean
NeedBracesCheck. isSingleLineFor(DetailAST literalFor)
Checks if current for statement is single-line statement, e.g.:private static boolean
NeedBracesCheck. isSingleLineIf(DetailAST literalIf)
Checks if current if statement is single-line statement, e.g.:private static boolean
NeedBracesCheck. isSingleLineLambda(DetailAST lambda)
Checks if current lambda statement is single-line statement, e.g.:private static boolean
NeedBracesCheck. isSingleLineStatement(DetailAST statement)
Checks if current statement is single-line statement, e.g.:private static boolean
NeedBracesCheck. isSingleLineSwitchMember(DetailAST statement)
Checks if switch member (case or default statement) in a switch rule or case group is on a single-line.private static boolean
NeedBracesCheck. isSingleLineSwitchRule(DetailAST ast)
Checks if switch member in switch rule (case or default statement) is single-line statement, e.g.:private static boolean
NeedBracesCheck. isSingleLineWhile(DetailAST literalWhile)
Checks if current while statement is single-line statement, e.g.:private boolean
NeedBracesCheck. isSkipStatement(DetailAST statement)
Checks if current statement can be skipped by "need braces" warning.private static boolean
RightCurlyCheck.Details. isSwitchExpression(DetailAST switchNode)
Check whether switch is expression or not.private boolean
EmptyCatchBlockCheck. isVerifiable(DetailAST emptyCatchAst, String commentContent)
Checks if current empty catch block is verifiable according to Check's options (exception's variable name and comment format are both in consideration).private static DetailAST
LeftCurlyCheck. skipModifierAnnotations(DetailAST ast)
Skip allTokenTypes.ANNOTATION
s to the first non-annotation.private void
LeftCurlyCheck. validateEol(DetailAST brace, String braceLine)
Validate EOL case.private void
LeftCurlyCheck. validateNewLinePosition(DetailAST brace, DetailAST startToken, String braceLine)
Validate token on new Line position.private void
LeftCurlyCheck. verifyBrace(DetailAST brace, DetailAST startToken)
Verifies that a specified left curly brace is placed correctly according to policy.private void
EmptyCatchBlockCheck. visitCatchBlock(DetailAST catchAst)
Visits catch ast node, if it is empty catch block - checks it according to Check's options.void
AvoidNestedBlocksCheck. visitToken(DetailAST ast)
void
EmptyBlockCheck. visitToken(DetailAST ast)
void
EmptyCatchBlockCheck. visitToken(DetailAST ast)
void
LeftCurlyCheck. visitToken(DetailAST ast)
Visits token.void
NeedBracesCheck. visitToken(DetailAST ast)
void
RightCurlyCheck. visitToken(DetailAST ast)
Constructors in com.puppycrawl.tools.checkstyle.checks.blocks with parameters of type DetailAST Constructor Description Details(DetailAST lcurly, DetailAST rcurly, DetailAST nextToken, boolean shouldCheckLastRcurly)
Constructor. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.checks.coding
Fields in com.puppycrawl.tools.checkstyle.checks.coding declared as DetailAST Modifier and Type Field Description private DetailAST
UnusedLambdaParameterShouldBeUnnamedCheck.LambdaParameterDetails. enclosingLambda
Ast of typeTokenTypes.LAMBDA
enclosing the lambda parameter.private DetailAST
RequireThisCheck.AbstractFrame. frameNameIdent
Name identifier token.private DetailAST
UnusedLambdaParameterShouldBeUnnamedCheck.LambdaParameterDetails. identifierAst
Ast of typeTokenTypes.IDENT
of the given lambda parameter.private DetailAST
AbstractSuperCheck.MethodNode. method
Method definition.private DetailAST
UnusedCatchParameterShouldBeUnnamedCheck.CatchParameterDetails. parameterDefinition
Ast of typeTokenTypes.PARAMETER_DEF
to use it when logging.private DetailAST
UnnecessaryParenthesesCheck. parentToSkip
Used to test if logging a warning in a parent node may be skipped because a warning was already logged on an immediate child node.private DetailAST
UnusedLocalVariableCheck.VariableDesc. scope
The scope of variable is determined by the ast of typeTokenTypes.SLIST
orTokenTypes.LITERAL_FOR
orTokenTypes.OBJBLOCK
which is enclosing the variable.private DetailAST
UnusedLocalVariableCheck.VariableDesc. typeAst
Ast of typeTokenTypes.TYPE
.private DetailAST
UnusedLocalVariableCheck.TypeDeclDesc. typeDeclAst
Type declaration ast node.private DetailAST
FinalLocalVariableCheck.FinalVariableCandidate. variableIdent
Identifier token.Fields in com.puppycrawl.tools.checkstyle.checks.coding with type parameters of type DetailAST Modifier and Type Field Description private Map<DetailAST,UnusedLocalVariableCheck.TypeDeclDesc>
UnusedLocalVariableCheck. anonInnerAstToTypeDeclDesc
Maps local anonymous inner class to the TypeDeclDesc object containing it.private Set<DetailAST>
UnusedLocalVariableCheck. anonInnerClassHolders
Set of tokens of typeUnusedLocalVariableCheck.ANONYMOUS_CLASS_PARENT_TOKENS
andTokenTypes.LAMBDA
in some cases.private Deque<Deque<DetailAST>>
FinalLocalVariableCheck. currentScopeAssignedVariables
Assigned variables of current scope.private Set<DetailAST>
CovariantEqualsCheck. equalsMethods
Set of equals method definitions.private Map<String,DetailAST>
EqualsAvoidNullCheck.FieldFrame. fieldNameToAst
Map of field name to field DetailAst.private Map<DetailAST,RequireThisCheck.AbstractFrame>
RequireThisCheck. frames
Tree of all the parsed frames.private static Predicate<DetailAST>
AvoidDoubleBraceInitializationCheck. HAS_MEMBERS
Predicate for tokens that is used inAvoidDoubleBraceInitializationCheck.hasOnlyInitialization(DetailAST)
.private Set<DetailAST>
RequireThisCheck.ClassFrame. instanceMembers
Set of idents of instance members declared in this frame.private Set<DetailAST>
RequireThisCheck.ClassFrame. instanceMethods
Set of idents of instance methods declared in this frame.private Set<DetailAST>
IllegalInstantiationCheck. instantiations
The instantiations in the file.private Set<DetailAST>
EqualsAvoidNullCheck.FieldFrame. methodCalls
Set of equals calls.private Map<DetailAST,DetailAST>
EqualsHashCodeCheck. objBlockWithEquals
Maps OBJ_BLOCK to the method definition of equals().private Map<DetailAST,DetailAST>
EqualsHashCodeCheck. objBlockWithEquals
Maps OBJ_BLOCK to the method definition of equals().private Map<DetailAST,DetailAST>
EqualsHashCodeCheck. objBlockWithHashCode
Maps OBJ_BLOCKs to the method definition of hashCode().private Map<DetailAST,DetailAST>
EqualsHashCodeCheck. objBlockWithHashCode
Maps OBJ_BLOCKs to the method definition of hashCode().private Deque<DetailAST>
FinalLocalVariableCheck.ScopeData. prevScopeUninitializedVariables
Contains definitions of previous scope uninitialized variables.private Set<DetailAST>
RequireThisCheck.ClassFrame. staticMembers
Set of idents of variables declared in this frame.private Set<DetailAST>
RequireThisCheck.ClassFrame. staticMethods
Set of idents of static methods declared in this frame.private Map<String,List<DetailAST>>
MultipleStringLiteralsCheck. stringMap
The found strings and their tokens.private Map<DetailAST,UnusedLocalVariableCheck.TypeDeclDesc>
UnusedLocalVariableCheck. typeDeclAstToTypeDeclDesc
Maps type declaration ast to their respective TypeDeclDesc objects.private Deque<DetailAST>
FinalLocalVariableCheck.ScopeData. uninitializedVariables
Contains definitions of uninitialized variables.private Set<DetailAST>
RequireThisCheck.AbstractFrame. varIdents
Set of name of variables declared in this frame.Methods in com.puppycrawl.tools.checkstyle.checks.coding that return DetailAST Modifier and Type Method Description private static DetailAST
MagicNumberCheck. findContainingConstantDef(DetailAST ast)
Finds the constant definition that contains aAST.DetailAST
EqualsAvoidNullCheck.FieldFrame. findField(String name)
Determines whether this FieldFrame contains the field.private static DetailAST
FinalLocalVariableCheck. findFirstUpperNamedBlock(DetailAST ast)
Find the Class, Constructor, Enum, Method, or Field in which it is defined.private static DetailAST
FinalLocalVariableCheck. findLastCaseGroupWhichContainsSlist(DetailAST literalSwitchAst)
Returns the last token of typeTokenTypes.CASE_GROUP
which containsTokenTypes.SLIST
.private static DetailAST
UnusedLocalVariableCheck. findScopeOfVariable(DetailAST variableDef)
Find the scope of variable.private static DetailAST
UnusedLocalVariableCheck. getBlockContainingLocalAnonInnerClass(DetailAST literalNewAst)
Get the block containing local anon inner class.private static DetailAST
RequireThisCheck. getBlockEndToken(DetailAST blockNameIdent, DetailAST blockStartToken)
Returns the token which ends the code block.private static DetailAST
RequireThisCheck. getCodeBlockDefinitionToken(DetailAST ident)
Returns code block definition token for current identifier.private static DetailAST
VariableDeclarationUsageDistanceCheck. getFirstNodeInsideForWhileDoWhileBlocks(DetailAST block, DetailAST variable)
Gets first Ast node inside FOR, WHILE or DO-WHILE blocks if variable usage is met only inside the block (not in its declaration!).private static DetailAST
VariableDeclarationUsageDistanceCheck. getFirstNodeInsideIfBlock(DetailAST block, DetailAST variable)
Gets first Ast node inside IF block if variable usage is met only inside the block (not in its declaration!).private static DetailAST
VariableDeclarationUsageDistanceCheck. getFirstNodeInsideSwitchBlock(DetailAST block, DetailAST variable)
Gets first Ast node inside SWITCH block if variable usage is met only inside the block (not in its declaration!).private static DetailAST
VariableDeclarationUsageDistanceCheck. getFirstNodeInsideTryCatchFinallyBlocks(DetailAST block, DetailAST variable)
Gets first Ast node inside TRY-CATCH-FINALLY blocks if variable usage is met only inside the block (not in its declaration!).DetailAST
RequireThisCheck.AbstractFrame. getFrameNameIdent()
Returns the name identifier token.private DetailAST
UnusedLambdaParameterShouldBeUnnamedCheck.LambdaParameterDetails. getIdentifierAst()
Get ast of typeTokenTypes.IDENT
of the given lambda parameter.private static DetailAST
MultipleVariableDeclarationsCheck. getLastNode(DetailAST node)
Finds sub-node for given node maximum (line, column) pair.DetailAST
AbstractSuperCheck.MethodNode. getMethod()
Returns the overriding method definition AST.private static DetailAST
FallThroughCheck. getNextNonCommentAst(DetailAST ast)
This method will skip the comment content while finding the next ast of current ast.private static DetailAST
IllegalTypeCheck. getNextSubTreeNode(DetailAST currentNodeAst, DetailAST subTreeRootAst)
Gets the next node of a syntactical tree (child of a current node or sibling of a current node, or sibling of a parent of a current node).private DetailAST
UnusedCatchParameterShouldBeUnnamedCheck.CatchParameterDetails. getParameterDefinition()
Get the parameter definition token of the catch parameter represented by ast of typeTokenTypes.PARAMETER_DEF
.private static DetailAST
InnerAssignmentCheck. getParent(DetailAST ast, BitSet skipTokens)
Get ast parent, ignoring token types fromskipTokens
.private static DetailAST
FinalLocalVariableCheck. getParentLoop(DetailAST ast)
Get the ast node of typeFinalLocalVariableCheck.LOOP_TYPES
that is the ancestor of the current ast node, if there is no such node, null is returned.DetailAST
UnusedLocalVariableCheck.VariableDesc. getScope()
Get ast of typeTokenTypes.SLIST
orTokenTypes.LITERAL_FOR
orTokenTypes.OBJBLOCK
which is enclosing the variable i.e. its scope.private static DetailAST
WhenShouldBeUsedCheck. getStatementList(DetailAST caseAST)
Get the statement list token of the case block.DetailAST
UnusedLocalVariableCheck.VariableDesc. getTypeAst()
Get the associated ast node of typeTokenTypes.TYPE
.DetailAST
UnusedLocalVariableCheck.TypeDeclDesc. getTypeDeclAst()
Get the type declaration ast node.private static DetailAST
EqualsAvoidNullCheck. skipVariableAssign(DetailAST currentAST)
Skips over an inner assign portion of an argument expression.Methods in com.puppycrawl.tools.checkstyle.checks.coding that return types with arguments of type DetailAST Modifier and Type Method Description private static Map.Entry<DetailAST,Integer>
VariableDeclarationUsageDistanceCheck. calculateDistanceBetweenScopes(DetailAST ast, DetailAST variable)
Calculates distance between declaration of variable and its first usage in multiple scopes.private static Map.Entry<DetailAST,Integer>
VariableDeclarationUsageDistanceCheck. calculateDistanceInSingleScope(DetailAST semicolonAst, DetailAST variableIdentAst)
Calculates distance between declaration of variable and its first usage in single scope.private static List<DetailAST>
ModifiedControlVariableCheck. findChildrenOfExpressionType(DetailAST ast)
Find all child of given AST of type TokenType.EXPR.private List<DetailAST>
MatchXpathCheck. findMatchingNodesByXpathQuery(DetailAST rootAST)
Find nodes that match query.private static List<DetailAST>
MissingNullCaseInSwitchCheck. getAllCaseLabels(DetailAST switchAST)
Gets all case labels in the given switch AST node.private static Set<DetailAST>
DeclarationOrderCheck. getAllTokensOfType(DetailAST ast, int tokenType)
Collects all tokens of specific type starting with the current ast node.private static Set<DetailAST>
RequireThisCheck. getAllTokensOfType(DetailAST ast, int tokenType)
Collects all tokens of specific type starting with the current ast node.private static Set<DetailAST>
RequireThisCheck. getAllTokensOfType(DetailAST ast, int tokenType, int endLineNumber)
Collects all tokens of specific type starting with the current ast node and which line number is lower or equal to the end line number.private static Set<DetailAST>
RequireThisCheck. getAllTokensWhichAreEqualToCurrent(DetailAST ast, DetailAST token, int endLineNumber)
Collects all tokens which are equal to current token starting with the current ast node and which line number is lower or equal to the end line number.private static List<DetailAST>
WhenShouldBeUsedCheck. getBlockStatements(DetailAST statementList)
Get all statements inside the case block.private static List<DetailAST>
ConstructorsDeclarationGroupingCheck. getChildList(DetailAST ast)
Get a list of all children of the given AST.Set<DetailAST>
EqualsAvoidNullCheck.FieldFrame. getMethodCalls()
Getter for frame's method calls.private static List<DetailAST>
UnnecessaryParenthesesCheck. getParenthesesChildrenAroundQuestion(DetailAST questionToken)
Returns the direct LPAREN tokens children to a given QUESTION token which contain an expression not a literal variable.private static List<DetailAST>
VariableDeclarationUsageDistanceCheck. getVariableUsageExpressionsInsideSwitchBlock(DetailAST block, DetailAST variable)
Helper method for getFirstNodeInsideSwitchBlock to return all variable usage expressions inside a given switch block.private static Map.Entry<List<DetailAST>,Integer>
VariableDeclarationUsageDistanceCheck. searchVariableUsageExpressions(DetailAST variableAst, DetailAST statementAst)
Searches variable usages starting from specified statement.Methods in com.puppycrawl.tools.checkstyle.checks.coding with parameters of type DetailAST Modifier and Type Method Description void
EqualsAvoidNullCheck.FieldFrame. addField(DetailAST field)
Add field to this FieldFrame.private void
RequireThisCheck.AbstractFrame. addIdent(DetailAST identToAdd)
Add a name to the frame.void
RequireThisCheck.ClassFrame. addInstanceMember(DetailAST ident)
Adds instance member's ident.void
RequireThisCheck.ClassFrame. addInstanceMethod(DetailAST ident)
Adds instance method's name.private void
UnusedLocalVariableCheck. addInstanceOrClassVar(DetailAST varDefAst)
Add instance variables and class variables to theUnusedLocalVariableCheck.TypeDeclDesc.instanceAndClassVarStack
.private static void
UnusedLocalVariableCheck. addLocalVariables(DetailAST varDefAst, Deque<UnusedLocalVariableCheck.VariableDesc> variablesStack)
Add local variables to thevariablesStack
stack.void
EqualsAvoidNullCheck.FieldFrame. addMethodCall(DetailAST methodCall)
Add method call to this frame.void
RequireThisCheck.ClassFrame. addStaticMember(DetailAST ident)
Adds static member's ident.void
RequireThisCheck.ClassFrame. addStaticMethod(DetailAST ident)
Adds static method's name.void
AbstractSuperCheck. beginTree(DetailAST rootAST)
void
DeclarationOrderCheck. beginTree(DetailAST rootAST)
void
EqualsAvoidNullCheck. beginTree(DetailAST rootAST)
void
EqualsHashCodeCheck. beginTree(DetailAST rootAST)
void
HiddenFieldCheck. beginTree(DetailAST rootAST)
void
IllegalInstantiationCheck. beginTree(DetailAST rootAST)
void
IllegalTypeCheck. beginTree(DetailAST rootAST)
void
MatchXpathCheck. beginTree(DetailAST rootAST)
void
ModifiedControlVariableCheck. beginTree(DetailAST rootAST)
void
MultipleStringLiteralsCheck. beginTree(DetailAST rootAST)
void
OneStatementPerLineCheck. beginTree(DetailAST rootAST)
void
PackageDeclarationCheck. beginTree(DetailAST ast)
void
ParameterAssignmentCheck. beginTree(DetailAST rootAST)
void
RequireThisCheck. beginTree(DetailAST rootAST)
void
ReturnCountCheck. beginTree(DetailAST rootAST)
void
UnusedCatchParameterShouldBeUnnamedCheck. beginTree(DetailAST rootAST)
void
UnusedLambdaParameterShouldBeUnnamedCheck. beginTree(DetailAST rootAST)
void
UnusedLocalVariableCheck. beginTree(DetailAST root)
private static Map.Entry<DetailAST,Integer>
VariableDeclarationUsageDistanceCheck. calculateDistanceBetweenScopes(DetailAST ast, DetailAST variable)
Calculates distance between declaration of variable and its first usage in multiple scopes.private static Map.Entry<DetailAST,Integer>
VariableDeclarationUsageDistanceCheck. calculateDistanceInSingleScope(DetailAST semicolonAst, DetailAST variableIdentAst)
Calculates distance between declaration of variable and its first usage in single scope.private boolean
RequireThisCheck. canAssignValueToClassField(DetailAST ast)
Checks whether a value can be assigned to a field.private static boolean
RequireThisCheck. canBeReferencedFromStaticContext(DetailAST ident)
Checks whether a field can be referenced from a static context.private static boolean
SimplifyBooleanReturnCheck. canReturnOrYieldOnlyBooleanLiteral(DetailAST ast)
Returns if an AST is a return or a yield statement with a boolean literal or a compound statement that contains only such a return or a yield statement.private void
IllegalTypeCheck. checkBaseTypes(DetailAST clause)
Checks theextends
orimplements
statement.private static boolean
UnnecessaryParenthesesCheck. checkBitwiseBinaryOperator(DetailAST ast)
Check if bitwise binary operator has unnecessary parentheses.private void
IllegalTypeCheck. checkClassName(DetailAST ast)
Checks type and type arguments/parameters of given method, parameter, variable or method call/reference.private static boolean
UnnecessaryParenthesesCheck. checkConditionalOrRelationalOperator(DetailAST ast)
Check if conditional or relational operator has unnecessary parentheses.void
ReturnCountCheck.Context. checkCount(DetailAST ast)
Checks if number of return statements in the method are more than allowed.private void
UnnecessarySemicolonAfterTypeMemberDeclarationCheck. checkEnumConstant(DetailAST ast)
Checks if enum constant has unnecessary semicolon.private void
UnnecessaryParenthesesCheck. checkExpression(DetailAST ast)
Checks whether an expression is surrounded by parentheses.private void
IllegalTypeCheck. checkIdent(DetailAST type)
Checks the identifier of the given type.private void
ModifiedControlVariableCheck. checkIdent(DetailAST ast)
Check if ident is parameter.private static void
UnusedLocalVariableCheck. checkIdentifierAst(DetailAST identAst, Deque<UnusedLocalVariableCheck.VariableDesc> variablesStack)
Checks the identifier ast.private boolean
FallThroughCheck. checkIf(DetailAST ast, boolean useBreak, boolean useContinue, Set<String> labels)
Checks if a given IF terminated by return, throw or, if allowed break, continue.private void
OneStatementPerLineCheck. checkIfSemicolonIsInDifferentLineThanPrevious(DetailAST ast)
Checks if given semicolon is in different line than previous.private void
OneStatementPerLineCheck. checkLambda(DetailAST ast, DetailAST currentStatement)
Checks semicolon placement in lambda.private boolean
FallThroughCheck. checkLoop(DetailAST ast, Set<String> labels)
Checks if a given loop terminated by return, throw or, if allowed break, continue.private void
EqualsAvoidNullCheck. checkMethodCall(DetailAST methodCall)
Check whether the method call should be violated.private void
ParameterAssignmentCheck. checkNestedIdent(DetailAST ast)
Check if nested ident is parameter.private void
OverloadMethodsDeclarationOrderCheck. checkOverloadMethodsGrouping(DetailAST objectBlock)
Checks that if overload methods are grouped together they should not be separated from each other.private void
OneStatementPerLineCheck. checkResourceVariable(DetailAST currentStatement)
Checks resource variable.private boolean
FallThroughCheck. checkSlist(DetailAST slistAst, boolean useBreak, boolean useContinue, Set<String> labels)
Checks if a given SLIST terminated by return, throw or, if allowed break, continue.private boolean
FallThroughCheck. checkSwitch(DetailAST literalSwitchAst, boolean useContinue, Set<String> labels)
Checks if a given switch terminated by return, throw or, if allowed break, continue.private boolean
FallThroughCheck. checkSynchronized(DetailAST synchronizedAst, boolean useBreak, boolean useContinue, Set<String> labels)
Checks if a given synchronized block terminated by return, throw or, if allowed break, continue.private boolean
FallThroughCheck. checkTry(DetailAST ast, boolean useBreak, boolean useContinue, Set<String> labels)
Checks if a given try/catch/finally block terminated by return, throw or, if allowed break, continue.private void
IllegalTypeCheck. checkType(DetailAST type)
Checks the given type, its arguments and parameters.private void
IllegalTypeCheck. checkTypeArguments(DetailAST node)
Checks the type arguments of the node.private void
IllegalTypeCheck. checkTypeBounds(DetailAST type)
Checks the upper and lower bounds for the given type.private void
UnnecessarySemicolonAfterTypeMemberDeclarationCheck. checkTypeDefinition(DetailAST ast)
Checks if type definition has unnecessary semicolon.private void
UnnecessarySemicolonAfterTypeMemberDeclarationCheck. checkTypeMember(DetailAST ast)
Checks if type member has unnecessary semicolon.private void
IllegalTypeCheck. checkTypeParameters(DetailAST node)
Checks the type parameters of the node.private void
UnnecessarySemicolonAfterTypeMemberDeclarationCheck. checkVariableDefinition(DetailAST variableDef)
Checks if variable definition has unnecessary semicolon.private static void
RequireThisCheck. collectDeclarations(Deque<RequireThisCheck.AbstractFrame> frameStack, DetailAST ast)
Parses the next AST for declarations.private static void
RequireThisCheck. collectMethodDeclarations(Deque<RequireThisCheck.AbstractFrame> frameStack, DetailAST ast, RequireThisCheck.AbstractFrame frame)
CollectsMETHOD_DEF
declarations.private static void
RequireThisCheck. collectVariableDeclarations(DetailAST ast, RequireThisCheck.AbstractFrame frame)
Collects variable declarations.private static boolean
EqualsAvoidNullCheck. containsAllSafeTokens(DetailAST expr)
Looks for all "safe" Token combinations in the argument expression branch.private static boolean
MissingSwitchDefaultCheck. containsDefaultCaseLabelElement(DetailAST detailAst)
Checks if a switch block contains a default case label.private static boolean
MissingSwitchDefaultCheck. containsDefaultLabel(DetailAST detailAst)
Checks if the case group or its sibling contain the 'default' switch.protected boolean
RequireThisCheck.AbstractFrame. containsFieldOrVariable(DetailAST identToFind)
Check whether the frame contains a field or a variable with the given name.protected boolean
RequireThisCheck.ClassFrame. containsFieldOrVariable(DetailAST identToFind)
protected boolean
RequireThisCheck.AbstractFrame. containsFieldOrVariableDef(Set<DetailAST> set, DetailAST ident)
Whether the set contains a declaration with the text of the specified IDENT ast and it is declared in a proper position.private boolean
RequireThisCheck.ClassFrame. containsMethod(DetailAST methodToFind)
Check whether the frame contains a given method.private static boolean
RequireThisCheck.ClassFrame. containsMethodDef(Set<DetailAST> set, DetailAST ident)
Whether the set contains a method definition with the same name and number of parameters.private static boolean
MissingSwitchDefaultCheck. containsNullCaseLabelElement(DetailAST detailAst)
Checks if a switch block contains a null case label.private static boolean
EqualsAvoidNullCheck. containsOneArgument(DetailAST methodCall)
Verify that method call has one argument.private static boolean
MissingSwitchDefaultCheck. containsPatternCaseLabelElement(DetailAST detailAst)
Checks if a switch block contains a case label with a pattern variable definition or record pattern definition.private static String
IllegalTokenCheck. convertToString(DetailAST ast)
Converts given AST node to string representation.private void
UnusedLocalVariableCheck. customLeaveToken(DetailAST ast, Deque<UnusedLocalVariableCheck.VariableDesc> variablesStack)
Leave all ast nodes underUnusedLocalVariableCheck.anonInnerClassHolders
once again.private void
UnusedLocalVariableCheck. customVisitToken(DetailAST ast, Deque<UnusedLocalVariableCheck.VariableDesc> variablesStack)
Visit all ast nodes underUnusedLocalVariableCheck.anonInnerClassHolders
once again.private static void
FinalLocalVariableCheck. determineAssignmentConditions(DetailAST ident, FinalLocalVariableCheck.FinalVariableCandidate candidate)
Determines identifier assignment conditions (assigned or already assigned).private void
RequireThisCheck. endCollectingDeclarations(Queue<RequireThisCheck.AbstractFrame> frameStack, DetailAST ast)
Ends parsing of the AST for declarations.private static List<DetailAST>
ModifiedControlVariableCheck. findChildrenOfExpressionType(DetailAST ast)
Find all child of given AST of type TokenType.EXPR.private RequireThisCheck.AbstractFrame
RequireThisCheck. findClassFrame(DetailAST name, boolean lookForMethod)
Find the class frame containing declaration.private static DetailAST
MagicNumberCheck. findContainingConstantDef(DetailAST ast)
Finds the constant definition that contains aAST.Optional<FinalLocalVariableCheck.FinalVariableCandidate>
FinalLocalVariableCheck.ScopeData. findFinalVariableCandidateForAst(DetailAST ast)
Searches for final local variable candidate for ast in the scope.private static DetailAST
FinalLocalVariableCheck. findFirstUpperNamedBlock(DetailAST ast)
Find the Class, Constructor, Enum, Method, or Field in which it is defined.private RequireThisCheck.AbstractFrame
RequireThisCheck. findFrame(DetailAST name, boolean lookForMethod)
Find frame containing declaration.private static RequireThisCheck.AbstractFrame
RequireThisCheck. findFrame(RequireThisCheck.AbstractFrame frame, DetailAST name, boolean lookForMethod)
Find frame containing declaration.private static DetailAST
FinalLocalVariableCheck. findLastCaseGroupWhichContainsSlist(DetailAST literalSwitchAst)
Returns the last token of typeTokenTypes.CASE_GROUP
which containsTokenTypes.SLIST
.private List<DetailAST>
MatchXpathCheck. findMatchingNodesByXpathQuery(DetailAST rootAST)
Find nodes that match query.private static DetailAST
UnusedLocalVariableCheck. findScopeOfVariable(DetailAST variableDef)
Find the scope of variable.void
EqualsAvoidNullCheck. finishTree(DetailAST ast)
void
EqualsHashCodeCheck. finishTree(DetailAST rootAST)
void
IllegalInstantiationCheck. finishTree(DetailAST rootAST)
void
MultipleStringLiteralsCheck. finishTree(DetailAST rootAST)
void
PackageDeclarationCheck. finishTree(DetailAST ast)
private static List<DetailAST>
MissingNullCaseInSwitchCheck. getAllCaseLabels(DetailAST switchAST)
Gets all case labels in the given switch AST node.private static Set<DetailAST>
DeclarationOrderCheck. getAllTokensOfType(DetailAST ast, int tokenType)
Collects all tokens of specific type starting with the current ast node.private static Set<DetailAST>
RequireThisCheck. getAllTokensOfType(DetailAST ast, int tokenType)
Collects all tokens of specific type starting with the current ast node.private static Set<DetailAST>
RequireThisCheck. getAllTokensOfType(DetailAST ast, int tokenType, int endLineNumber)
Collects all tokens of specific type starting with the current ast node and which line number is lower or equal to the end line number.private static Set<DetailAST>
RequireThisCheck. getAllTokensWhichAreEqualToCurrent(DetailAST ast, DetailAST token, int endLineNumber)
Collects all tokens which are equal to current token starting with the current ast node and which line number is lower or equal to the end line number.private static DetailAST
UnusedLocalVariableCheck. getBlockContainingLocalAnonInnerClass(DetailAST literalNewAst)
Get the block containing local anon inner class.private static DetailAST
RequireThisCheck. getBlockEndToken(DetailAST blockNameIdent, DetailAST blockStartToken)
Returns the token which ends the code block.private static List<DetailAST>
WhenShouldBeUsedCheck. getBlockStatements(DetailAST statementList)
Get all statements inside the case block.private static List<DetailAST>
ConstructorsDeclarationGroupingCheck. getChildList(DetailAST ast)
Get a list of all children of the given AST.private RequireThisCheck.AbstractFrame
RequireThisCheck. getClassFrameWhereViolationIsFound(DetailAST ast)
Returns the class frame where violation is found (where the field is used without 'this') or null otherwise.private static DetailAST
RequireThisCheck. getCodeBlockDefinitionToken(DetailAST ident)
Returns code block definition token for current identifier.private static int
VariableDeclarationUsageDistanceCheck. getDistToVariableUsageInChildNode(DetailAST childNode, int currentDistToVarUsage)
Returns the distance to variable usage for in the child node.private static String
EqualsAvoidNullCheck.FieldFrame. getFieldName(DetailAST field)
Get the name of the field.private static String
EqualsAvoidNullCheck. getFieldType(DetailAST field)
Get field type.private RequireThisCheck.AbstractFrame
RequireThisCheck. getFieldWithoutThis(DetailAST ast, int parentType)
Returns the frame where the field is declared, if the given field is used without 'this', and null otherwise.private Optional<FinalLocalVariableCheck.FinalVariableCandidate>
FinalLocalVariableCheck. getFinalCandidate(DetailAST ast)
Gets final variable candidate for ast.private static DetailAST
VariableDeclarationUsageDistanceCheck. getFirstNodeInsideForWhileDoWhileBlocks(DetailAST block, DetailAST variable)
Gets first Ast node inside FOR, WHILE or DO-WHILE blocks if variable usage is met only inside the block (not in its declaration!).private static DetailAST
VariableDeclarationUsageDistanceCheck. getFirstNodeInsideIfBlock(DetailAST block, DetailAST variable)
Gets first Ast node inside IF block if variable usage is met only inside the block (not in its declaration!).private static DetailAST
VariableDeclarationUsageDistanceCheck. getFirstNodeInsideSwitchBlock(DetailAST block, DetailAST variable)
Gets first Ast node inside SWITCH block if variable usage is met only inside the block (not in its declaration!).private static DetailAST
VariableDeclarationUsageDistanceCheck. getFirstNodeInsideTryCatchFinallyBlocks(DetailAST block, DetailAST variable)
Gets first Ast node inside TRY-CATCH-FINALLY blocks if variable usage is met only inside the block (not in its declaration!).private static Set<String>
ModifiedControlVariableCheck. getForInitVariables(DetailAST ast)
Get all variables initialized In init part of for loop.private static Set<String>
ModifiedControlVariableCheck. getForIteratorVariables(DetailAST ast)
Get all variables which for loop iterating part change in every loop.protected RequireThisCheck.AbstractFrame
RequireThisCheck.AbstractFrame. getIfContains(DetailAST identToFind, boolean lookForMethod)
Check whether the frame contains a given name.protected RequireThisCheck.AbstractFrame
RequireThisCheck.CatchFrame. getIfContains(DetailAST identToFind, boolean lookForMethod)
protected RequireThisCheck.AbstractFrame
RequireThisCheck.ClassFrame. getIfContains(DetailAST identToFind, boolean lookForMethod)
private static String
IllegalTypeCheck. getImportedTypeCanonicalName(DetailAST importAst)
Gets imported type's canonical name.private static String
VariableDeclarationUsageDistanceCheck. getInstanceName(DetailAST methodCallAst)
Get name of instance whose method is called.private static DetailAST
MultipleVariableDeclarationsCheck. getLastNode(DetailAST node)
Finds sub-node for given node maximum (line, column) pair.private RequireThisCheck.AbstractFrame
RequireThisCheck. getMethodWithoutThis(DetailAST ast)
Returns the frame where the method is declared, if the given method is used without 'this' and null otherwise.private static DetailAST
FallThroughCheck. getNextNonCommentAst(DetailAST ast)
This method will skip the comment content while finding the next ast of current ast.private static DetailAST
IllegalTypeCheck. getNextSubTreeNode(DetailAST currentNodeAst, DetailAST subTreeRootAst)
Gets the next node of a syntactical tree (child of a current node or sibling of a current node, or sibling of a parent of a current node).private static DetailAST
InnerAssignmentCheck. getParent(DetailAST ast, BitSet skipTokens)
Get ast parent, ignoring token types fromskipTokens
.private static List<DetailAST>
UnnecessaryParenthesesCheck. getParenthesesChildrenAroundQuestion(DetailAST questionToken)
Returns the direct LPAREN tokens children to a given QUESTION token which contain an expression not a literal variable.private static DetailAST
FinalLocalVariableCheck. getParentLoop(DetailAST ast)
Get the ast node of typeFinalLocalVariableCheck.LOOP_TYPES
that is the ancestor of the current ast node, if there is no such node, null is returned.private String
UnusedLocalVariableCheck. getQualifiedTypeDeclarationName(DetailAST typeDeclAst)
Get qualified type declaration name from type ast.private static DetailAST
WhenShouldBeUsedCheck. getStatementList(DetailAST caseAST)
Get the statement list token of the case block.private UnusedLocalVariableCheck.TypeDeclDesc
UnusedLocalVariableCheck. getSuperClassOfAnonInnerClass(DetailAST literalNewAst)
Get theUnusedLocalVariableCheck.TypeDeclDesc
of the super class of anonymous inner class.Deque<UnusedLocalVariableCheck.VariableDesc>
UnusedLocalVariableCheck.TypeDeclDesc. getUpdatedCopyOfVarStack(DetailAST literalNewAst)
Get the copy of variables in instanceAndClassVar stack with updated scope.private static Set<String>
ModifiedControlVariableCheck. getVariablesManagedByForLoop(DetailAST ast)
Determines which variable are specific to for loop and should not be change by inner loop body.private static List<DetailAST>
VariableDeclarationUsageDistanceCheck. getVariableUsageExpressionsInsideSwitchBlock(DetailAST block, DetailAST variable)
Helper method for getFirstNodeInsideSwitchBlock to return all variable usage expressions inside a given switch block.private static boolean
AbstractSuperCheck. hasArguments(DetailAST methodCallDotAst)
Does method have any arguments.private boolean
FallThroughCheck. hasFallThroughComment(DetailAST currentCase)
Determines if the fall through case betweencurrentCase
andnextCase
is relieved by an appropriate comment.boolean
RequireThisCheck.ClassFrame. hasFinalField(DetailAST instanceMember)
Checks whether given instance member has final modifier.boolean
RequireThisCheck.ClassFrame. hasInstanceMember(DetailAST ident)
Checks if a given name is a known instance member of the class.boolean
RequireThisCheck.ClassFrame. hasInstanceMethod(DetailAST ident)
Checks if a given name is a known instance method of the class.private static boolean
FallThroughCheck. hasLabel(DetailAST statement, Set<String> labelsForCurrentSwitchScope)
Checks if given break or continue ast has outer label.private static boolean
MissingNullCaseInSwitchCheck. hasLiteralNull(DetailAST caseAST)
Checks if the given case AST node has a null label.private static boolean
MissingSwitchDefaultCheck. hasNullCaseLabel(DetailAST detailAST)
Checks if the case contains null label.private static boolean
AvoidDoubleBraceInitializationCheck. hasOnlyInitialization(DetailAST objBlock)
Checks that block has at least one instance init block and no other class members.private static boolean
MissingNullCaseInSwitchCheck. hasPatternCaseLabel(DetailAST caseAST)
Checks if the given case AST node has a pattern variable declaration label or record pattern definition label.private static boolean
WhenShouldBeUsedCheck. hasPatternLabel(DetailAST caseAST)
Check if the case block has a pattern variable definition or a record pattern definition.private boolean
FallThroughCheck. hasReliefComment(DetailAST ast)
Check if there is any fall through comment.boolean
RequireThisCheck.ClassFrame. hasStaticMethod(DetailAST ident)
Checks if a given name is a known static method of the class.private static boolean
MissingNullCaseInSwitchCheck. hasStringCaseLabel(DetailAST caseAST)
Checks if the given case contains a string in its label.private static boolean
StringLiteralEqualityCheck. hasStringLiteralChild(DetailAST ast)
Checks whether string literal or text block literals are concatenated.private static boolean
UnusedLambdaParameterShouldBeUnnamedCheck. hasValidParentToken(DetailAST identifierAst)
Check if the givenTokenTypes.IDENT
has a valid parent token.private void
FinalLocalVariableCheck. insertParameter(DetailAST ast)
Insert a parameter at the topmost scope stack.private void
FinalLocalVariableCheck. insertVariable(DetailAST ast)
Insert a variable at the topmost scope stack.private static boolean
WhenShouldBeUsedCheck. isAcceptableStatement(DetailAST ast)
Check if the statement is an acceptable statement inside the case block.private static boolean
RequireThisCheck. isAnonymousClassDef(DetailAST ast)
Whether the AST is a definition of an anonymous class.private static boolean
RequireThisCheck. isAstInside(DetailAST tree, DetailAST ast)
Checks if the givenast
is equal to thetree
or a child of it.private static boolean
RequireThisCheck. isAstSimilar(DetailAST left, DetailAST right)
Checks if 2 AST are similar by their type and text.private static boolean
SimplifyBooleanReturnCheck. isBooleanLiteralReturnOrYieldStatement(DetailAST ast)
Returns if an AST is a return or a yield statement with a boolean literal.private boolean
EqualsAvoidNullCheck. isCalledOnStringFieldOrVariable(DetailAST objCalledOn)
Determine, whether equals method is called on a field of String type.private static boolean
FinalLocalVariableCheck. isCaseTokenWithAnotherCaseFollowing(DetailAST ast)
If token is CASE_GROUP or SWITCH_RULE and there is anothercase
following.private static boolean
UnusedCatchParameterShouldBeUnnamedCheck. isCatchParameterIdentifierCandidate(DetailAST identifierAst)
Visit ast of typeTokenTypes.IDENT
and check if it is a candidate for a catch parameter identifier.private boolean
IllegalTypeCheck. isCheckedMethod(DetailAST ast)
Returns true if method has to be checked or false.private static boolean
VariableDeclarationUsageDistanceCheck. isChild(DetailAST parent, DetailAST ast)
Checks if Ast node contains given element.private static boolean
MagicNumberCheck. isChildOf(DetailAST ast, int type)
Determines if the given AST node has a parent node with given token type code.private static boolean
InnerAssignmentCheck. isComparison(DetailAST ast)
Checks if an AST is a comparison operator.private static boolean
ConstructorsDeclarationGroupingCheck. isConstructor(DetailAST ast)
Check if the given AST is a constructor.private boolean
IllegalTypeCheck. isContainVerifiableType(DetailAST modifiers)
Checks is modifiers contain verifiable type.private static boolean
NestedIfDepthCheck. isElse(DetailAST ast)
Returns whether a token represents an ELSE.private static boolean
NestedIfDepthCheck. isElseIf(DetailAST ast)
Returns whether a token represents an ELSE as part of an ELSE / IF set.private static boolean
NestedIfDepthCheck. isElseWithCurlyBraces(DetailAST ast)
Returns whether a token represents an SLIST as part of an ELSE statement.private static boolean
UnnecessarySemicolonInEnumerationCheck. isEndOfEnumerationAfter(DetailAST ast)
Checks if enum body has no code elements after enum constants semicolon.private static boolean
EqualsHashCodeCheck. isEqualsMethod(DetailAST ast)
Determines if an AST is a valid Equals method implementation.private static boolean
UnnecessaryParenthesesCheck. isExprSurrounded(DetailAST ast)
Tests if the given expression node is surrounded by parentheses.private static boolean
MagicNumberCheck. isFieldDeclaration(DetailAST ast)
Determines whether or not the given AST is field declaration.private static boolean
FinalLocalVariableCheck. isFirstChild(DetailAST ast)
Whether the ast is the first child of its parent.private static boolean
CovariantEqualsCheck. isFirstParameterObject(DetailAST methodDefAst)
Tests whether a method's first parameter is an Object.private boolean
DeclarationOrderCheck. isForwardReference(DetailAST fieldDef)
Checks whether an identifier references a field which has been already defined in class.private static boolean
EqualsHashCodeCheck. isHashCodeMethod(DetailAST ast)
Determines if an AST is a valid HashCode method implementation.private boolean
IllegalThrowsCheck. isIgnorableMethod(DetailAST methodDef)
Checks if current method is ignorable due to Check's properties.private boolean
HiddenFieldCheck. isIgnoredConstructorParam(DetailAST ast)
Decides whether to ignore an AST node that is the parameter of a constructor.private boolean
HiddenFieldCheck. isIgnoredParam(DetailAST ast, String name)
Checks whether method or constructor parameter is ignored.private boolean
HiddenFieldCheck. isIgnoredParamOfAbstractMethod(DetailAST ast)
Decides whether to ignore an AST node that is the parameter of an abstract method.private boolean
HiddenFieldCheck. isIgnoredSetterParam(DetailAST ast, String name)
Decides whether to ignore an AST node that is the parameter of a setter method, where the property setter method for field 'xyz' has name 'setXyz', one parameter named 'xyz', and return type void (default behavior) or return type is name of the class in which such method is declared (allowed only ifHiddenFieldCheck.setSetterCanReturnItsClass(boolean)
is called with value true).private static boolean
FinalLocalVariableCheck. isInAbstractOrNativeMethod(DetailAST ast)
Determines whether an AST is a descendant of an abstract or native method.private static boolean
RequireThisCheck. isInCompactConstructor(DetailAST ast)
Return whether ast is in a COMPACT_CTOR_DEF.private static boolean
InnerAssignmentCheck. isInContext(DetailAST ast, int[][] contextSet, BitSet skipTokens)
Tests whether the provided AST is in one of the given contexts.private static boolean
UnusedLocalVariableCheck. isIncrementOrDecrementVariableUsed(DetailAST exprAst)
A variable with increment or decrement operator is considered used if it is used as an argument or as an array index or for assigning value to a variable.private static boolean
RequireThisCheck. isInExpression(DetailAST ast)
Checks ast parent is in expression.private static boolean
MagicNumberCheck. isInHashCodeMethod(DetailAST ast)
Determines whether or not the given AST is in a valid hash code method.private boolean
MagicNumberCheck. isInIgnoreList(DetailAST ast)
Decides whether the number of an AST is in the ignore list of this check.private boolean
MultipleStringLiteralsCheck. isInIgnoreOccurrenceContext(DetailAST ast)
Analyses the path from the AST root to a given AST for occurrences of the token types inMultipleStringLiteralsCheck.ignoreOccurrenceContext
.private static boolean
VariableDeclarationUsageDistanceCheck. isInitializationSequence(DetailAST variableUsageAst, String variableName)
Processes statements until usage of variable to detect sequence of initialization methods.private static boolean
FinalLocalVariableCheck. isInitialized(DetailAST ast)
Check if VARIABLE_DEF is initialized or not.private static boolean
FinalLocalVariableCheck. isInLambda(DetailAST paramDef)
Check if current param is lambda's param.private static boolean
InnerAssignmentCheck. isInLoopIdiom(DetailAST ast)
Tests whether the given AST is used in the "assignment in loop" idiom.private static boolean
InnerAssignmentCheck. isInNoBraceControlStatement(DetailAST ast)
Determines if ast is in the body of a flow control statement without braces.private static boolean
UnusedLocalVariableCheck. isInsideLocalAnonInnerClass(DetailAST literalNewAst)
Whether ast node of typeTokenTypes.LITERAL_NEW
is a part of a local anonymous inner class.private static boolean
FinalLocalVariableCheck. isInSpecificCodeBlocks(DetailAST node, int... blockTypes)
Checks whether the scope of a node is restricted to a specific code blocks.private boolean
HiddenFieldCheck. isInstanceField(DetailAST ast, String name)
Check for instance field.private static boolean
HiddenFieldCheck. isInStatic(DetailAST ast)
Determines whether an AST node is in a static method or static initializer.private static boolean
RequireThisCheck. isLambdaParameter(DetailAST ast)
Checks if the token is a Lambda parameter.private static boolean
UnusedLambdaParameterShouldBeUnnamedCheck. isLambdaParameterIdentifierCandidate(DetailAST identifierAst)
Visit ast of typeTokenTypes.IDENT
and check if it is a candidate for a lambda parameter identifier.private static boolean
UnnecessaryParenthesesCheck. isLambdaSingleParameterSurrounded(DetailAST ast)
Tests if the given node has a single parameter, no defined type, and is surrounded by parentheses.private static boolean
UnusedCatchParameterShouldBeUnnamedCheck. isLeftHandOfAssignment(DetailAST identAst)
Check if the givenTokenTypes.IDENT
is a left hand side value.private static boolean
UnusedLambdaParameterShouldBeUnnamedCheck. isLeftHandOfAssignment(DetailAST identAst)
Check if the givenTokenTypes.IDENT
is a left hand side value.private static boolean
UnusedLocalVariableCheck. isLeftHandSideValue(DetailAST identAst)
Checks whether the ast of typeTokenTypes.IDENT
is used as left-hand side value.private boolean
MagicNumberCheck. isMagicNumberExists(DetailAST ast, DetailAST constantDefAST)
Is magic number somewhere at ast tree.private static boolean
UnusedCatchParameterShouldBeUnnamedCheck. isMethodInvocation(DetailAST identAst)
Check if the givenTokenTypes.IDENT
is a child of a dot operator and is a candidate for catch parameter.private static boolean
UnusedLambdaParameterShouldBeUnnamedCheck. isMethodInvocation(DetailAST identAst)
Check if the givenTokenTypes.IDENT
is a child of a dot operator and is a candidate for lambda parameter.private static boolean
FinalLocalVariableCheck. isMultipleTypeCatch(DetailAST parameterDefAst)
Check if given parameter definition is a multiple type catch.private static boolean
DefaultComesLastCheck. isNextSiblingOf(DetailAST ast, int tokenType)
Return true only if passed tokenType in argument is found or returns false.private static boolean
UnusedLocalVariableCheck. isNonLocalTypeDeclaration(DetailAST typeDeclAst)
Whether a type declaration is non-local.private static boolean
EqualsHashCodeCheck. isObjectParam(DetailAST paramNode)
Determines if an AST is a formal param of type Object.private static boolean
OneStatementPerLineCheck. isOnTheSameLine(DetailAST ast, int lastStatementEnd, int forStatementEnd, int lambdaStatementEnd)
Checks whether two statements are on the same line.private boolean
RequireThisCheck. isOverlappingByArgument(DetailAST ast)
Checks whether an overlapping by method or constructor argument takes place.private boolean
RequireThisCheck. isOverlappingByLocalVariable(DetailAST ast)
Checks whether an overlapping by local variable takes place.private boolean
AbstractSuperCheck. isOverridingMethod(DetailAST ast)
Determines whether an AST is a method definition for this check, without any parameters.private static boolean
UnusedLocalVariableCheck. isPrivateInstanceVariable(DetailAST varDefAst)
Whether instance variable or class variable have private access modifier.protected boolean
RequireThisCheck.AbstractFrame. isProperDefinition(DetailAST ident, DetailAST ast)
Whether the definition is correspondent to the IDENT.protected boolean
RequireThisCheck.ClassFrame. isProperDefinition(DetailAST ident, DetailAST ast)
private static boolean
OneStatementPerLineCheck. isResource(DetailAST ast)
Checks that given node is a resource.private static boolean
RequireThisCheck. isReturnedVariable(RequireThisCheck.AbstractFrame currentFrame, DetailAST ident)
Checks whether the current variable is returned from the method.private boolean
AbstractSuperCheck. isSameNameMethod(DetailAST ast)
Is same name of method.private static boolean
FinalLocalVariableCheck. isSameVariables(DetailAST ast1, DetailAST ast2)
Check if both the Variables are same.private static boolean
UnnecessarySemicolonAfterTypeMemberDeclarationCheck. isSemicolon(DetailAST ast)
Checks thatast
is a semicolon.private boolean
HiddenFieldCheck. isSetterMethod(DetailAST aMethodAST, String aName)
Determine if a specific method identified by methodAST and a single variable name aName is a setter.private static boolean
RequireThisCheck.ClassFrame. isSimilarSignature(DetailAST ident, DetailAST ast)
Whether the method definition has the same name and number of parameters.private static boolean
WhenShouldBeUsedCheck. isSingleIfWithNoElse(DetailAST statement)
Check if the case block statement is a single if statement with no else branch.private static boolean
ExplicitInitializationCheck. isSkipCase(DetailAST ast)
Checks for cases that should be skipped: no assignment, local variable, final variables.private static boolean
UnusedLocalVariableCheck. isStandAloneIncrementOrDecrement(DetailAST identAst)
Checks whether the ast of typeTokenTypes.IDENT
is used as an operand of a stand-alone increment or decrement.private static boolean
IllegalTypeCheck. isStarImport(DetailAST importAst)
Checks if current import is star import.private boolean
EqualsAvoidNullCheck. isStringFieldOrVariable(DetailAST objCalledOn)
Whether the field or the variable is of String type.private boolean
EqualsAvoidNullCheck. isStringFieldOrVariableFromClass(DetailAST objCalledOn, String className)
Whether the field or the variable from the specified class is of String type.private boolean
EqualsAvoidNullCheck. isStringFieldOrVariableFromThisInstance(DetailAST objCalledOn)
Whether the field or the variable from THIS instance is of String type.private boolean
AbstractSuperCheck. isSuperCall(DetailAST literalSuperAst)
Determines whether a 'super' literal is a call to the super method for this check.private boolean
AbstractSuperCheck. isSuperCallInOverridingMethod(DetailAST ast)
Determines whether a super call in overriding method.private static boolean
UnnecessaryParenthesesCheck. isSurrounded(DetailAST ast)
Tests if the givenDetailAST
is surrounded by parentheses.private static boolean
MissingSwitchDefaultCheck. isSwitchExpression(DetailAST ast)
Checks if this LITERAL_SWITCH token is part of a switch expression.private boolean
FallThroughCheck. isTerminated(DetailAST ast, boolean useBreak, boolean useContinue, Set<String> labelsForCurrentSwitchScope)
Checks if a given subtree terminated by return, throw or, if allowed break, continue.private static boolean
RequireThisCheck. isUserDefinedArrangementOfThis(RequireThisCheck.AbstractFrame currentFrame, DetailAST ident)
Checks whether user arranges 'this' for variable in method, constructor, or block on his own.private static boolean
FinalLocalVariableCheck. isVariableInForInit(DetailAST variableDef)
Checks if current variable is defined infor-loop init
, e.g.:private static boolean
VariableDeclarationUsageDistanceCheck. isVariableInOperatorExpr(DetailAST operator, DetailAST variable)
Checks if variable is in operator declaration.private boolean
IllegalTypeCheck. isVerifiable(DetailAST methodOrVariableDef)
Checks if current method's return type or variable's type is verifiable according to memberModifiers option.private static boolean
ExplicitInitializationCheck. isZero(DetailAST expr)
Checks if given node contains numeric constant for zero.private static boolean
ExplicitInitializationCheck. isZeroChar(DetailAST exprStart)
Examine char literal for initializing to default value.private void
UnusedLocalVariableCheck. iterateOverBlockContainingLocalAnonInnerClass(DetailAST ast, Deque<UnusedLocalVariableCheck.VariableDesc> variablesStack)
Iterate over all the ast nodes present underast
.private void
ReturnCountCheck. leave(DetailAST ast)
Checks number of return statements and restore previous context.private void
ModifiedControlVariableCheck. leaveForDef(DetailAST ast)
Pops the variables from the stack.private void
ModifiedControlVariableCheck. leaveForEach(DetailAST paramDef)
Push current variables to the stack.private void
ModifiedControlVariableCheck. leaveForIter(DetailAST ast)
Push current variables to the stack.private void
EqualsAvoidNullCheck. leaveLiteralNew(DetailAST ast)
Determine whether LITERAL_NEW is an anonymous class definition and leave the frame it is in.private void
EqualsAvoidNullCheck. leaveSlist(DetailAST ast)
Determine whether SLIST begins a block, determined by braces.void
AbstractSuperCheck. leaveToken(DetailAST ast)
void
DeclarationOrderCheck. leaveToken(DetailAST ast)
void
EqualsAvoidNullCheck. leaveToken(DetailAST ast)
void
FinalLocalVariableCheck. leaveToken(DetailAST ast)
void
HiddenFieldCheck. leaveToken(DetailAST ast)
void
ModifiedControlVariableCheck. leaveToken(DetailAST ast)
void
NestedForDepthCheck. leaveToken(DetailAST ast)
void
NestedIfDepthCheck. leaveToken(DetailAST literalIf)
void
NestedTryDepthCheck. leaveToken(DetailAST literalTry)
void
OneStatementPerLineCheck. leaveToken(DetailAST ast)
void
ParameterAssignmentCheck. leaveToken(DetailAST ast)
void
RequireThisCheck. leaveToken(DetailAST ast)
void
ReturnCountCheck. leaveToken(DetailAST ast)
void
UnnecessaryParenthesesCheck. leaveToken(DetailAST ast)
void
UnusedCatchParameterShouldBeUnnamedCheck. leaveToken(DetailAST ast)
void
UnusedLambdaParameterShouldBeUnnamedCheck. leaveToken(DetailAST ast)
void
UnusedLocalVariableCheck. leaveToken(DetailAST ast)
private void
RequireThisCheck. logViolation(String msgKey, DetailAST ast, RequireThisCheck.AbstractFrame frame)
Helper method to log a Violation.private void
UnusedLocalVariableCheck. logViolations(DetailAST scopeAst, Deque<UnusedLocalVariableCheck.VariableDesc> variablesStack)
TraversevariablesStack
stack and log the violations.private void
UnusedLocalVariableCheck. modifyVariablesStack(UnusedLocalVariableCheck.TypeDeclDesc obtainedClass, Deque<UnusedLocalVariableCheck.VariableDesc> variablesStack, DetailAST literalNewAst)
Add non-private instance and class variables of the super class of the anonymous class to the variables stack.private void
IllegalInstantiationCheck. postProcessLiteralNew(DetailAST newTokenAst)
Processes one of the collected "new" tokens when walking tree has finished.private void
IllegalInstantiationCheck. processClassDef(DetailAST ast)
Collects classes defined in the source file.private void
DeclarationOrderCheck. processConstructor(DetailAST ast)
Processes constructor.private void
EqualsAvoidNullCheck. processFrame(DetailAST ast)
Process CLASS_DEF, METHOD_DEF, LITERAL_IF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, LITERAL_CATCH, LITERAL_TRY, CTOR_DEF, ENUM_DEF, ENUM_CONSTANT_DEF.private void
RequireThisCheck. processIdent(DetailAST ast)
Checks if a given IDENT is method call or field name which requires explicitthis
qualifier.private void
IllegalInstantiationCheck. processImport(DetailAST ast)
Perform processing for an import token.private void
HiddenFieldCheck. processLambda(DetailAST ast)
Process a lambda token.private void
EqualsAvoidNullCheck. processLiteralNew(DetailAST ast)
Determine whether LITERAL_NEW is an anonymous class definition and add it as a frame in this case.private void
IllegalInstantiationCheck. processLiteralNew(DetailAST ast)
Collects a "new" token.private void
EqualsAvoidNullCheck. processMethodCall(DetailAST methodCall)
Add the method call to the current frame if it should be processed.private void
DeclarationOrderCheck. processModifiers(DetailAST ast)
Processes modifiers.private boolean
DeclarationOrderCheck. processModifiersState(DetailAST modifierAst, DeclarationOrderCheck.ScopeState state)
Process if given modifiers are appropriate in given state (STATE_STATIC_VARIABLE_DEF
,STATE_INSTANCE_VARIABLE_DEF
, (STATE_CTOR_DEF
,STATE_METHOD_DEF
), if it is it updates states where appropriate or logs violation.private void
DeclarationOrderCheck. processModifiersSubState(DetailAST modifiersAst, DeclarationOrderCheck.ScopeState state, boolean isStateValid)
Checks if given modifiers are valid in substate of given state(Scope
), if it is it updates substate or else it logs violation.private void
IllegalInstantiationCheck. processPackageDef(DetailAST ast)
Perform processing for an package token.private void
EqualsAvoidNullCheck. processSlist(DetailAST ast)
Determine whether SLIST begins a block, determined by braces, and add it as a frame in this case.private void
HiddenFieldCheck. processVariable(DetailAST ast)
Process a variable token.private void
FinalLocalVariableCheck. removeFinalVariableCandidateFromStack(DetailAST ast)
Removes the final variable candidate from the Stack.private void
MagicNumberCheck. reportMagicNumber(DetailAST ast)
Reports aAST as a magic number, includes unary operators as needed.private static Map.Entry<List<DetailAST>,Integer>
VariableDeclarationUsageDistanceCheck. searchVariableUsageExpressions(DetailAST variableAst, DetailAST statementAst)
Searches variable usages starting from specified statement.private boolean
FinalLocalVariableCheck. shouldCheckEnhancedForLoopVariable(DetailAST ast)
Determines whether enhanced for-loop variable should be checked or not.private static boolean
UnusedLocalVariableCheck. shouldCheckIdentTokenNestedUnderDot(DetailAST dotAst)
Whether to check identifier token nested under dotAst.private boolean
FinalLocalVariableCheck. shouldCheckUnnamedVariable(DetailAST ast)
Determines whether unnamed variable should be checked or not.private static boolean
FinalLocalVariableCheck. shouldRemoveFinalVariableCandidate(FinalLocalVariableCheck.ScopeData scopeData, DetailAST ast)
Whether the final variable candidate should be removed from the list of final local variable candidates.private boolean
MagicNumberCheck. shouldTestAnnotationArgs(DetailAST ast)
Checks if ast is annotation argument and should be checked.private boolean
MagicNumberCheck. shouldTestAnnotationDefaults(DetailAST ast)
Checks if ast is annotation element default value and should be checked.private static boolean
FinalLocalVariableCheck. shouldUpdateUninitializedVariables(DetailAST ast)
If there is anelse
following or token is CASE_GROUP or SWITCH_RULE and there is anothercase
following, then update the uninitialized variables.private boolean
UnusedLocalVariableCheck. skipUnnamedVariables(DetailAST varDefAst)
Check for skip currentTokenTypes.VARIABLE_DEF
due to allowUnnamedVariable option.private static DetailAST
EqualsAvoidNullCheck. skipVariableAssign(DetailAST currentAST)
Skips over an inner assign portion of an argument expression.private static boolean
UnnecessaryParenthesesCheck. unnecessaryParenAroundOperators(DetailAST ast)
Checks if conditional, relational, bitwise binary operator, unary and postfix operators in expressions are surrounded by unnecessary parentheses.private void
ExplicitInitializationCheck. validateNonObjects(DetailAST ast)
Checks for explicit initializations made to 'false', '0' and '\0'.private static void
UnusedLocalVariableCheck. visitDotToken(DetailAST dotAst, Deque<UnusedLocalVariableCheck.VariableDesc> variablesStack)
Visit ast of typeTokenTypes.DOT
.private static void
UnusedLocalVariableCheck. visitIdentToken(DetailAST identAst, Deque<UnusedLocalVariableCheck.VariableDesc> variablesStack)
Visit ast of typeTokenTypes.IDENT
.private void
IllegalTypeCheck. visitImport(DetailAST importAst)
Checks imported type (as static and star imports are not supported by Check, only type is in the consideration).
If this type is illegal due to Check's options - puts violation on it.private void
ParameterAssignmentCheck. visitLambda(DetailAST lambdaAst)
Creates new set of parameters and store old one in stack.private void
ParameterAssignmentCheck. visitLambdaParameters(DetailAST ast)
Creates new parameter set for given lambda expression.private void
UnusedLocalVariableCheck. visitLocalAnonInnerClass(DetailAST literalNewAst)
Visit the local anon inner class.private void
IllegalTypeCheck. visitMethodCallOrRef(DetailAST methodCallOrRef)
Checks the type arguments of given method call/reference.private void
IllegalTypeCheck. visitMethodDef(DetailAST methodDef)
Checks return type of a given method.private void
ParameterAssignmentCheck. visitMethodDef(DetailAST ast)
Creates new set of parameters and store old one in stack.private void
ReturnCountCheck. visitMethodDef(DetailAST ast)
Creates new method context and places old one on the stack.private void
ParameterAssignmentCheck. visitMethodParameters(DetailAST ast)
Creates new parameter set for given method.private void
UnusedLocalVariableCheck. visitNonLocalTypeDeclarationToken(DetailAST typeDeclAst)
Visit the non-local type declaration token.private void
HiddenFieldCheck. visitOtherTokens(DetailAST ast, int type)
Called to process tokens other thanTokenTypes.VARIABLE_DEF
andTokenTypes.PARAMETER_DEF
.private void
IllegalTypeCheck. visitParameterDef(DetailAST parameterDef)
Checks type of parameters.private void
ParameterAssignmentCheck. visitParameters(DetailAST parametersAst)
Visits parameter list and adds parameter names to the set.private void
ReturnCountCheck. visitReturn(DetailAST ast)
Examines the return statement and tells context about it.void
AbstractSuperCheck. visitToken(DetailAST ast)
void
ArrayTrailingCommaCheck. visitToken(DetailAST arrayInit)
void
AvoidDoubleBraceInitializationCheck. visitToken(DetailAST ast)
void
AvoidInlineConditionalsCheck. visitToken(DetailAST ast)
void
AvoidNoArgumentSuperConstructorCallCheck. visitToken(DetailAST ast)
void
ConstructorsDeclarationGroupingCheck. visitToken(DetailAST ast)
void
CovariantEqualsCheck. visitToken(DetailAST ast)
void
DeclarationOrderCheck. visitToken(DetailAST ast)
void
DefaultComesLastCheck. visitToken(DetailAST ast)
void
EmptyStatementCheck. visitToken(DetailAST ast)
void
EqualsAvoidNullCheck. visitToken(DetailAST ast)
void
EqualsHashCodeCheck. visitToken(DetailAST ast)
void
ExplicitInitializationCheck. visitToken(DetailAST ast)
void
FallThroughCheck. visitToken(DetailAST ast)
void
FinalLocalVariableCheck. visitToken(DetailAST ast)
void
HiddenFieldCheck. visitToken(DetailAST ast)
void
IllegalCatchCheck. visitToken(DetailAST detailAST)
void
IllegalInstantiationCheck. visitToken(DetailAST ast)
void
IllegalThrowsCheck. visitToken(DetailAST detailAST)
void
IllegalTokenCheck. visitToken(DetailAST ast)
void
IllegalTokenTextCheck. visitToken(DetailAST ast)
void
IllegalTypeCheck. visitToken(DetailAST ast)
void
InnerAssignmentCheck. visitToken(DetailAST ast)
void
MagicNumberCheck. visitToken(DetailAST ast)
void
MissingCtorCheck. visitToken(DetailAST ast)
void
MissingNullCaseInSwitchCheck. visitToken(DetailAST ast)
void
MissingSwitchDefaultCheck. visitToken(DetailAST ast)
void
ModifiedControlVariableCheck. visitToken(DetailAST ast)
void
MultipleStringLiteralsCheck. visitToken(DetailAST ast)
void
MultipleVariableDeclarationsCheck. visitToken(DetailAST ast)
void
NestedForDepthCheck. visitToken(DetailAST ast)
void
NestedIfDepthCheck. visitToken(DetailAST literalIf)
void
NestedTryDepthCheck. visitToken(DetailAST literalTry)
void
NoArrayTrailingCommaCheck. visitToken(DetailAST arrayInit)
void
NoCloneCheck. visitToken(DetailAST ast)
void
NoEnumTrailingCommaCheck. visitToken(DetailAST detailAST)
void
NoFinalizerCheck. visitToken(DetailAST ast)
void
OneStatementPerLineCheck. visitToken(DetailAST ast)
void
OverloadMethodsDeclarationOrderCheck. visitToken(DetailAST ast)
void
PackageDeclarationCheck. visitToken(DetailAST ast)
void
ParameterAssignmentCheck. visitToken(DetailAST ast)
void
RequireThisCheck. visitToken(DetailAST ast)
void
ReturnCountCheck. visitToken(DetailAST ast)
void
SimplifyBooleanExpressionCheck. visitToken(DetailAST ast)
void
SimplifyBooleanReturnCheck. visitToken(DetailAST ast)
void
StringLiteralEqualityCheck. visitToken(DetailAST ast)
void
UnnecessaryParenthesesCheck. visitToken(DetailAST ast)
void
UnnecessarySemicolonAfterOuterTypeDeclarationCheck. visitToken(DetailAST ast)
void
UnnecessarySemicolonAfterTypeMemberDeclarationCheck. visitToken(DetailAST ast)
void
UnnecessarySemicolonInEnumerationCheck. visitToken(DetailAST ast)
void
UnnecessarySemicolonInTryWithResourcesCheck. visitToken(DetailAST ast)
void
UnusedCatchParameterShouldBeUnnamedCheck. visitToken(DetailAST ast)
void
UnusedLambdaParameterShouldBeUnnamedCheck. visitToken(DetailAST ast)
void
UnusedLocalVariableCheck. visitToken(DetailAST ast)
void
VariableDeclarationUsageDistanceCheck. visitToken(DetailAST ast)
void
WhenShouldBeUsedCheck. visitToken(DetailAST ast)
private void
IllegalTypeCheck. visitTypeDef(DetailAST typeDef)
Checks the super type and implemented interfaces of a given type.private void
IllegalTypeCheck. visitVariableDef(DetailAST variableDef)
Checks type of given variable.private void
UnusedLocalVariableCheck. visitVariableDefToken(DetailAST varDefAst)
Visit ast of typeTokenTypes.VARIABLE_DEF
.Method parameters in com.puppycrawl.tools.checkstyle.checks.coding with type arguments of type DetailAST Modifier and Type Method Description protected boolean
RequireThisCheck.AbstractFrame. containsFieldOrVariableDef(Set<DetailAST> set, DetailAST ident)
Whether the set contains a declaration with the text of the specified IDENT ast and it is declared in a proper position.private static boolean
RequireThisCheck.ClassFrame. containsMethodDef(Set<DetailAST> set, DetailAST ident)
Whether the set contains a method definition with the same name and number of parameters.private void
FinalLocalVariableCheck. updateUninitializedVariables(Deque<DetailAST> scopeUninitializedVariableData)
Update current scope data uninitialized variable according to the specific scope data.Constructors in com.puppycrawl.tools.checkstyle.checks.coding with parameters of type DetailAST Constructor Description AbstractFrame(RequireThisCheck.AbstractFrame parent, DetailAST ident)
Constructor -- invocable only via super() from subclasses.BlockFrame(RequireThisCheck.AbstractFrame parent, DetailAST ident)
Creates block frame.CatchFrame(RequireThisCheck.AbstractFrame parent, DetailAST ident)
Creates catch frame.CatchParameterDetails(DetailAST enclosingCatchClause)
Create a new catch parameter instance.ClassFrame(RequireThisCheck.AbstractFrame parent, DetailAST ident)
Creates new instance of ClassFrame.ConstructorFrame(RequireThisCheck.AbstractFrame parent, DetailAST ident)
Creates a constructor frame.FinalVariableCandidate(DetailAST variableIdent)
Creates new instance.ForFrame(RequireThisCheck.AbstractFrame parent, DetailAST ident)
Creates for frame.LambdaParameterDetails(DetailAST enclosingLambda, DetailAST identifierAst)
Create a new lambda parameter instance.MethodFrame(RequireThisCheck.AbstractFrame parent, DetailAST ident)
Creates method frame.MethodNode(DetailAST ast)
Constructs a stack node for a method definition.TryWithResourcesFrame(RequireThisCheck.AbstractFrame parent, DetailAST ident)
Creates try-with-resources frame.TypeDeclDesc(String qualifiedName, int depth, DetailAST typeDeclAst)
Create a new TypeDeclDesc instance.VariableDesc(String name, DetailAST scope)
Create a new VariableDesc instance.VariableDesc(String name, DetailAST typeAst, DetailAST scope)
Create a new VariableDesc instance. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.checks.design
Fields in com.puppycrawl.tools.checkstyle.checks.design declared as DetailAST Modifier and Type Field Description private DetailAST
HideUtilityClassConstructorCheck.Details. ast
Class ast.private DetailAST
FinalClassCheck.TypeDeclarationDescription. typeDeclarationAst
Type declaration ast node.Fields in com.puppycrawl.tools.checkstyle.checks.design with type parameters of type DetailAST Modifier and Type Field Description private Map<DetailAST,String>
FinalClassCheck. anonInnerClassToOuterTypeDecl
Maps anonymous inner class'sTokenTypes.LITERAL_NEW
node to the outer type declaration's fully qualified name.Methods in com.puppycrawl.tools.checkstyle.checks.design that return DetailAST Modifier and Type Method Description private DetailAST
VisibilityModifierCheck. findMatchingAnnotation(DetailAST variableDef)
Checks whether the AST is annotated with an annotation containing the passed in regular expression and return the AST representing that annotation.private static DetailAST
VisibilityModifierCheck. getGenericTypeArgs(DetailAST type, boolean isCanonicalName)
Returns generic type arguments token.private static DetailAST
DesignForExtensionCheck. getNearestClassOrEnumDefinition(DetailAST ast)
Returns CLASS_DEF or ENUM_DEF token which is the nearest to the given ast node.private static DetailAST
VisibilityModifierCheck. getNextSubTreeNode(DetailAST currentNodeAst, DetailAST subTreeRootAst)
Gets the next node of a syntactical tree (child of a current node or sibling of a current node, or sibling of a parent of a current node).protected DetailAST
FinalClassCheck.TypeDeclarationDescription. getTypeDeclarationAst()
Get the type declaration ast node.Methods in com.puppycrawl.tools.checkstyle.checks.design with parameters of type DetailAST Modifier and Type Method Description void
FinalClassCheck. beginTree(DetailAST rootAST)
void
InnerTypeLastCheck. beginTree(DetailAST rootAST)
void
VisibilityModifierCheck. beginTree(DetailAST rootAst)
private boolean
DesignForExtensionCheck. branchContainsJavadocComment(DetailAST token)
Checks whether a javadoc comment exists under the token.private static boolean
DesignForExtensionCheck. canBeOverridden(DetailAST methodDef)
Checks whether a method can be overridden.private static boolean
DesignForExtensionCheck. canBeSubclassed(DetailAST classDef)
Checks if the given class (given CLASS_DEF node) can be subclassed.private String
FinalClassCheck. extractQualifiedTypeName(DetailAST typeDeclarationAst)
Extract the qualified type declaration name from given type declaration Ast.private DetailAST
VisibilityModifierCheck. findMatchingAnnotation(DetailAST variableDef)
Checks whether the AST is annotated with an annotation containing the passed in regular expression and return the AST representing that annotation.private static String
DesignForExtensionCheck. getAnnotationName(DetailAST annotation)
Gets the name of the annotation.private static String
ThrowsCountCheck. getAnnotationName(DetailAST annotation)
Gets name of an annotation.private static String
VisibilityModifierCheck. getCanonicalName(DetailAST type)
Gets canonical type's name from givenTYPE
node.private static DetailAST
VisibilityModifierCheck. getGenericTypeArgs(DetailAST type, boolean isCanonicalName)
Returns generic type arguments token.private static Set<String>
VisibilityModifierCheck. getModifiers(DetailAST defAST)
Returns the set of modifier Strings for a VARIABLE_DEF or CLASS_DEF AST.private static DetailAST
DesignForExtensionCheck. getNearestClassOrEnumDefinition(DetailAST ast)
Returns CLASS_DEF or ENUM_DEF token which is the nearest to the given ast node.private static DetailAST
VisibilityModifierCheck. getNextSubTreeNode(DetailAST currentNodeAst, DetailAST subTreeRootAst)
Gets the next node of a syntactical tree (child of a current node or sibling of a current node, or sibling of a parent of a current node).private static String
FinalClassCheck. getSuperClassName(DetailAST classAst)
Get super class name of given class.private static List<String>
VisibilityModifierCheck. getTypeArgsClassNames(DetailAST typeArgs)
Returns a list of type parameters class names.private static String
VisibilityModifierCheck. getVisibilityScope(DetailAST variableDef)
Returns the visibility scope for the variable.private static boolean
DesignForExtensionCheck. hasDefaultOrExplicitNonPrivateCtor(DetailAST classDef)
Checks whether a class has default or explicit non-private constructor.private static boolean
DesignForExtensionCheck. hasEmptyImplementation(DetailAST ast)
Checks whether a method has only comments in the body (has an empty implementation).private boolean
VisibilityModifierCheck. hasIgnoreAnnotation(DetailAST variableDef)
Checks if variable def has ignore annotation.private static boolean
DesignForExtensionCheck. hasIgnoredAnnotation(DetailAST methodDef, Set<String> annotations)
Checks whether a method has any of ignored annotations.private boolean
DesignForExtensionCheck. hasJavadocComment(DetailAST methodDef)
Checks whether a method has a javadoc comment.private boolean
DesignForExtensionCheck. hasJavadocCommentOnToken(DetailAST methodDef, int tokenType)
Checks whether a token has a javadoc comment.private boolean
VisibilityModifierCheck. hasProperAccessModifier(DetailAST variableDef, String variableName)
Checks if current variable has proper access modifier according to Check's options.private boolean
DesignForExtensionCheck. hasValidJavadocComment(DetailAST detailAST)
Checks whether a javadoc contains the specified comment pattern that denotes a method as designed for extension.private static boolean
HideUtilityClassConstructorCheck. isAbstract(DetailAST ast)
Returns true if given class is abstract or false.private boolean
VisibilityModifierCheck. isAllowedPublicField(DetailAST variableDef)
Checks whether the variable satisfies the public field check.private static boolean
VisibilityModifierCheck. isAnonymousClassVariable(DetailAST variableDef)
Checks if current variable definition is definition of an anonymous class.private static boolean
VisibilityModifierCheck. isCanonicalName(DetailAST type)
Checks whether type definition is in canonical form.private boolean
MutableExceptionCheck. isExtendedClassNamedAsException(DetailAST ast)
Checks that if extended class name conforms to specified format.private static boolean
VisibilityModifierCheck. isFinalField(DetailAST variableDef)
Checks whether current field is final.private boolean
VisibilityModifierCheck. isImmutableField(DetailAST variableDef)
Checks if current field is immutable: has final modifier and either a primitive type or instance of class known to be immutable (such as String, ImmutableCollection from Guava, etc.).private boolean
VisibilityModifierCheck. isImmutableFieldDefinedInFinalClass(DetailAST variableDef)
Checks whether immutable field is defined in final class.private static boolean
ThrowsCountCheck. isInPrivateMethod(DetailAST ast)
Checks if method, which throws an exception is private.private boolean
MutableExceptionCheck. isNamedAsException(DetailAST ast)
Checks that a class name conforms to specified format.private static boolean
DesignForExtensionCheck. isNativeMethod(DetailAST ast)
Checks whether a method is native.private static boolean
ThrowsCountCheck. isOverriding(DetailAST ast)
Check if a method has annotation @Override.private static boolean
VisibilityModifierCheck. isPrimitive(DetailAST type)
Checks if current type is primitive type (int, short, float, boolean, double, etc.).private static boolean
OneTopLevelClassCheck. isPublic(DetailAST typeDef)
Checks if a type is public.private static boolean
VisibilityModifierCheck. isStarImport(DetailAST importAst)
Checks if current import is star import.private static boolean
HideUtilityClassConstructorCheck. isStatic(DetailAST ast)
Returns true if given class is static or false.private static boolean
VisibilityModifierCheck. isStaticFinalVariable(DetailAST variableDef)
Checks whether variable has static final modifiers.private static boolean
OneTopLevelClassCheck. isTypeDef(DetailAST node)
Checks if an AST node is a type definition.void
FinalClassCheck. leaveToken(DetailAST ast)
void
InnerTypeLastCheck. leaveToken(DetailAST ast)
void
MutableExceptionCheck. leaveToken(DetailAST ast)
private void
FinalClassCheck. registerAnonymousInnerClassToSuperClass(DetailAST literalNewAst, String outerTypeDeclName)
Register to the super class of anonymous inner class that the given class is instantiated by an anonymous inner class.private boolean
HideUtilityClassConstructorCheck. shouldIgnoreClass(DetailAST ast)
Checks if class is annotated by specific annotation(s) to skip.private void
FinalClassCheck. visitClass(DetailAST ast)
Called to process a type definition.private void
MutableExceptionCheck. visitClassDef(DetailAST ast)
Called when we start processing class definition.private void
FinalClassCheck. visitCtor(DetailAST ast)
Called to process a constructor definition.private void
VisibilityModifierCheck. visitImport(DetailAST importAst)
Checks imported type.private void
ThrowsCountCheck. visitLiteralThrows(DetailAST ast)
Checks number of throws statements.void
DesignForExtensionCheck. visitToken(DetailAST ast)
void
FinalClassCheck. visitToken(DetailAST ast)
void
HideUtilityClassConstructorCheck. visitToken(DetailAST ast)
void
InnerTypeLastCheck. visitToken(DetailAST ast)
void
InterfaceIsTypeCheck. visitToken(DetailAST ast)
void
MutableExceptionCheck. visitToken(DetailAST ast)
void
OneTopLevelClassCheck. visitToken(DetailAST compilationUnit)
void
SealedShouldHavePermitsListCheck. visitToken(DetailAST ast)
void
ThrowsCountCheck. visitToken(DetailAST ast)
void
VisibilityModifierCheck. visitToken(DetailAST ast)
private void
MutableExceptionCheck. visitVariableDef(DetailAST ast)
Checks variable definition.private void
VisibilityModifierCheck. visitVariableDef(DetailAST variableDef)
Checks access modifier of given variable.Constructors in com.puppycrawl.tools.checkstyle.checks.design with parameters of type DetailAST Constructor Description ClassDesc(String qualifiedName, int depth, DetailAST classAst)
Create a new ClassDesc instance.Details(DetailAST ast)
C-tor.TypeDeclarationDescription(String qualifiedName, int depth, DetailAST typeDeclarationAst)
Create an instance of TypeDeclarationDescription. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.checks.imports
Fields in com.puppycrawl.tools.checkstyle.checks.imports declared as DetailAST Modifier and Type Field Description private DetailAST
CustomImportOrderCheck.ImportDetails. importAST
Import AST.Methods in com.puppycrawl.tools.checkstyle.checks.imports that return DetailAST Modifier and Type Method Description DetailAST
CustomImportOrderCheck.ImportDetails. getImportAST()
Get import ast.Methods in com.puppycrawl.tools.checkstyle.checks.imports with parameters of type DetailAST Modifier and Type Method Description void
CustomImportOrderCheck. beginTree(DetailAST rootAST)
void
ImportControlCheck. beginTree(DetailAST rootAST)
void
ImportOrderCheck. beginTree(DetailAST rootAST)
void
RedundantImportCheck. beginTree(DetailAST aRootAST)
void
UnusedImportsCheck. beginTree(DetailAST rootAST)
private void
UnusedImportsCheck. collectReferencesFromJavadoc(DetailAST ast)
Collects references made in Javadoc comments.private static String
CustomImportOrderCheck. createSamePackageRegexp(int firstPackageDomainsCount, DetailAST packageNode)
Creates samePackageDomainsRegExp of the first package domains.private void
ImportOrderCheck. doVisitToken(FullIdent ident, boolean isStatic, boolean previous, DetailAST ast)
Shares processing...private void
ImportOrderCheck. doVisitTokenInSameGroup(boolean isStatic, boolean previous, String name, DetailAST ast)
Shares processing...void
CustomImportOrderCheck. finishTree(DetailAST rootAST)
void
UnusedImportsCheck. finishTree(DetailAST rootAST)
private static String
CustomImportOrderCheck. getFullImportIdent(DetailAST token)
Forms import full path.private static String
ImportControlCheck. getImportText(DetailAST ast)
Returns import text.private static String
ImportControlCheck. getPackageText(DetailAST ast)
Returns package text.private static boolean
UnusedImportsCheck. isQualifiedIdentifier(DetailAST ast)
Checks whether ast is a fully qualified identifier.void
UnusedImportsCheck. leaveToken(DetailAST ast)
private void
AvoidStarImportCheck. logsStarredImportViolation(DetailAST startingDot)
Gets the full import identifier.private void
CustomImportOrderCheck. logWrongImportGroupOrder(DetailAST importAST, String importGroup, String currentGroupNumber, String fullImportIdent)
Log wrong import group order.private void
UnusedImportsCheck. processIdent(DetailAST ast)
Collects references made by IDENT.private void
UnusedImportsCheck. processImport(DetailAST ast)
Collects the details of imports.private void
UnusedImportsCheck. processStaticImport(DetailAST ast)
Collects the details of static imports.void
AvoidStarImportCheck. visitToken(DetailAST ast)
void
AvoidStaticImportCheck. visitToken(DetailAST ast)
void
CustomImportOrderCheck. visitToken(DetailAST ast)
void
IllegalImportCheck. visitToken(DetailAST ast)
void
ImportControlCheck. visitToken(DetailAST ast)
void
ImportOrderCheck. visitToken(DetailAST ast)
void
RedundantImportCheck. visitToken(DetailAST ast)
void
UnusedImportsCheck. visitToken(DetailAST ast)
Constructors in com.puppycrawl.tools.checkstyle.checks.imports with parameters of type DetailAST Constructor Description ImportDetails(String importFullPath, String importGroup, boolean staticImport, DetailAST importAST)
Initialise importFullPath, importGroup, staticImport, importAST. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.checks.indentation
Fields in com.puppycrawl.tools.checkstyle.checks.indentation declared as DetailAST Modifier and Type Field Description private DetailAST
AbstractExpressionHandler. mainAst
The AST which is handled by this handler.private DetailAST
NewHandler. mainAst
The AST which is handled by this handler.Fields in com.puppycrawl.tools.checkstyle.checks.indentation with type parameters of type DetailAST Modifier and Type Field Description private SortedMap<Integer,DetailAST>
DetailAstSet. astLines
Maps line numbers to their ast.private Map<DetailAST,AbstractExpressionHandler>
HandlerFactory. createdHandlers
Cache for created method call handlers.Methods in com.puppycrawl.tools.checkstyle.checks.indentation that return DetailAST Modifier and Type Method Description private DetailAST
CommentsIndentationCheck. findPreviousStatement(DetailAST comment, DetailAST root)
Finds a previous statement of the comment.private static DetailAST
CommentsIndentationCheck. findStartTokenOfMethodCallChain(DetailAST root)
Finds the start token of method call chain.private static DetailAST
CommentsIndentationCheck. findTokenWhichBeginsTheLine(DetailAST root)
Finds a token which begins the line.DetailAST
DetailAstSet. firstLine()
The first line in set of ast.DetailAST
DetailAstSet. getAst(int lineNum)
Get the ast corresponding to line number.private static DetailAST
MethodCallHandler. getCallLastNode(DetailAST firstNode)
Returns method or constructor call right paren.private static DetailAST
CommentsIndentationCheck. getDistributedPreviousStatement(DetailAST comment)
Returns the first token of the distributed previous statement of comment.private static DetailAST
MethodCallHandler. getFirstAst(DetailAST ast)
Get the first AST of the specified method call.protected static DetailAST
AbstractExpressionHandler. getFirstAstNode(DetailAST ast)
Get the first ast for given expression.private static DetailAST
CommentsIndentationCheck. getFirstExpressionNodeFromMethodCall(DetailAST methodCall)
Returns the first EXPR DetailAST child from parent of comment.static DetailAST
AbstractExpressionHandler. getFirstToken(DetailAST ast)
Searches in given subtree (including given node) for the token which represents first symbol for this subtree in file.private static DetailAST
ForHandler. getForLoopRightParen(DetailAST literalForAst)
Returns right parenthesis of for-loop statement.private static DetailAST
IfHandler. getIfStatementRightParen(DetailAST literalIfAst)
Returns right parenthesis of if statement.protected DetailAST
AnnotationArrayInitHandler. getLeftCurly()
protected DetailAST
ArrayInitHandler. getLeftCurly()
protected DetailAST
BlockParentHandler. getLeftCurly()
Get the left curly brace portion of the expression we are handling.protected DetailAST
ClassDefHandler. getLeftCurly()
protected DetailAST
ObjectBlockHandler. getLeftCurly()
protected DetailAST
SlistHandler. getLeftCurly()
protected DetailAST
SwitchHandler. getLeftCurly()
private DetailAST
BlockParentHandler. getLeftParen()
Get the left parenthesis portion of the expression we are handling.protected DetailAST
AnnotationArrayInitHandler. getListChild()
protected DetailAST
ArrayInitHandler. getListChild()
protected DetailAST
BlockParentHandler. getListChild()
Get the child element representing the list of statements.protected DetailAST
ClassDefHandler. getListChild()
protected DetailAST
ObjectBlockHandler. getListChild()
protected DetailAST
SlistHandler. getListChild()
protected DetailAST
SwitchHandler. getListChild()
protected DetailAST
AbstractExpressionHandler. getMainAst()
Accessor for the MainAst attribute.private static DetailAST
MethodDefHandler. getMethodDefParamRightParen(DetailAST methodDefAst)
Returns right parenthesis of method definition parameter list.private DetailAST
MethodCallHandler. getMethodIdentAst()
Returns method or constructor name.private static DetailAST
LineWrappingHandler. getNextCurNode(DetailAST curNode)
Returns next curNode node.private static DetailAST
CommentsIndentationCheck. getNextStmt(DetailAST comment)
Returns the next statement of a comment.private DetailAST
CommentsIndentationCheck. getNextToken(DetailAST checkedStatement)
Get the token to start counting the number of lines to add to the distance aim from.protected DetailAST
BlockParentHandler. getNonListChild()
Get the child element that is not a list of statements.protected DetailAST
DoWhileHandler. getNonListChild()
protected DetailAST
ElseHandler. getNonListChild()
protected DetailAST
SwitchHandler. getNonListChild()
private DetailAST
CommentsIndentationCheck. getOneLinePreviousStatement(DetailAST comment)
Does pre-order traverse of abstract syntax tree to find the previous statement of the comment.private static DetailAST
CommentsIndentationCheck. getPrevCaseToken(DetailAST parentStatement)
Gets previous case-token for comment.private DetailAST
CommentsIndentationCheck. getPreviousStatement(DetailAST comment)
Returns the previous statement of a comment.private static DetailAST
CommentsIndentationCheck. getPrevStatementFromSwitchBlock(DetailAST comment)
Gets comment's previous statement from switch block.private static DetailAST
CommentsIndentationCheck. getPrevStatementWhenCommentIsUnderCase(DetailAST parentStatement)
Gets previous statement for comment which is placed immediately under case.protected DetailAST
AnnotationArrayInitHandler. getRightCurly()
protected DetailAST
ArrayInitHandler. getRightCurly()
protected DetailAST
BlockParentHandler. getRightCurly()
Get the right curly brace portion of the expression we are handling.protected DetailAST
ClassDefHandler. getRightCurly()
protected DetailAST
ObjectBlockHandler. getRightCurly()
protected DetailAST
SlistHandler. getRightCurly()
protected DetailAST
SwitchHandler. getRightCurly()
private DetailAST
BlockParentHandler. getRightParen()
Get the right parenthesis portion of the expression we are handling.private static DetailAST
SynchronizedHandler. getSynchronizedStatementRightParen(DetailAST syncStatementAST)
Returns right parenthesis of synchronized statement.protected DetailAST
AnnotationArrayInitHandler. getTopLevelAst()
protected DetailAST
ArrayInitHandler. getTopLevelAst()
protected DetailAST
BlockParentHandler. getTopLevelAst()
Get the top level expression being managed by this handler.protected DetailAST
ClassDefHandler. getTopLevelAst()
protected DetailAST
MethodDefHandler. getTopLevelAst()
protected DetailAST
ObjectBlockHandler. getTopLevelAst()
protected DetailAST
SlistHandler. getTopLevelAst()
private DetailAST
TryHandler. getTryResLparen()
Method to find left parenthesis of try with resources.private DetailAST
TryHandler. getTryResRparen()
Method to find right parenthesis of try with resources.private static DetailAST
MemberDefHandler. getVarDefStatementSemicolon(DetailAST variableDef)
Returns semicolon for variable definition statement.Methods in com.puppycrawl.tools.checkstyle.checks.indentation that return types with arguments of type DetailAST Modifier and Type Method Description private NavigableMap<Integer,DetailAST>
LineWrappingHandler. collectFirstNodes(DetailAST firstNode, DetailAST lastNode)
Finds first nodes on line and puts them into Map.private static Optional<DetailAST>
MemberDefHandler. getArrayInitNode(DetailAST firstNode)
Finds the array init node.Methods in com.puppycrawl.tools.checkstyle.checks.indentation with parameters of type DetailAST Modifier and Type Method Description void
DetailAstSet. addAst(DetailAST ast)
Add ast to the set of ast.private void
DetailAstSet. addLineWithAst(int lineNo, DetailAST ast)
Map ast with their line number.private static boolean
CommentsIndentationCheck. areInSameMethodCallWithSameIndent(DetailAST comment)
Checks if the comment is inside a method call with same indentation of first expression. e.g:private static boolean
MethodCallHandler. areMethodsChained(DetailAST ast1, DetailAST ast2)
Checks if ast2 is a chained method call that starts on the same level as ast1 ends.private boolean
CommentsIndentationCheck. areSameLevelIndented(DetailAST comment, DetailAST prevStmt, DetailAST nextStmt)
Checks if comment and next code statement (or previous code stmt like case in switch block) are indented at the same level, e.g.:void
IndentationCheck. beginTree(DetailAST ast)
private void
LineWrappingHandler. checkAnnotationIndentation(DetailAST atNode, NavigableMap<Integer,DetailAST> firstNodesOnLines, int indentLevel)
Checks line wrapping into annotations.private void
TryHandler. checkChildIndentation(DetailAST ast, String subType, IndentLevel expectedIdent)
Method to check indentation of try resources children.protected void
AbstractExpressionHandler. checkChildren(DetailAST parentNode, int[] tokenTypes, IndentLevel startIndent, boolean firstLineMatches, boolean allowNesting)
Check the indent level of the children of the specified parent expression.protected void
AbstractExpressionHandler. checkExpressionSubtree(DetailAST tree, IndentLevel indentLevel, boolean firstLineMatches, boolean allowNesting)
Check the indentation level for an expression subtree.static boolean
LineWrappingHandler. checkForMethodLparenNewLine(DetailAST node)
Checks whether the method lparen starts from a new line or not.static boolean
LineWrappingHandler. checkForNullParameterChild(DetailAST node)
Checks whether parameter node has any child or not.void
LineWrappingHandler. checkIndentation(DetailAST firstNode, DetailAST lastNode)
Checks line wrapping into expressions and definitions using property 'lineWrappingIndentation'.private void
LineWrappingHandler. checkIndentation(DetailAST firstNode, DetailAST lastNode, int indentLevel)
Checks line wrapping into expressions and definitions.void
LineWrappingHandler. checkIndentation(DetailAST firstNode, DetailAST lastNode, int indentLevel, int startIndent, LineWrappingHandler.LineWrappingOptions ignoreFirstLine)
Checks line wrapping into expressions and definitions.protected void
AbstractExpressionHandler. checkLeftParen(DetailAST lparen)
Check the indentation of the left parenthesis.private void
AbstractExpressionHandler. checkLineIndent(DetailAST ast, IndentLevel indentLevel, boolean mustMatch)
Check the indentation for a single-line.protected void
AbstractExpressionHandler. checkRightParen(DetailAST lparen, DetailAST rparen)
Check the indentation of the right parenthesis.private void
TryHandler. checkTryResources(DetailAST resourcesSpecAst)
Checks indentation of resources parameters in try resources.private void
TryHandler. checkTryResParen(DetailAST parenAst, String subType)
Method to check the indentation of left paren or right paren.protected void
AbstractExpressionHandler. checkWrappingIndentation(DetailAST firstNode, DetailAST lastNode)
Checks indentation on wrapped lines between and includingfirstNode
andlastNode
.protected void
AbstractExpressionHandler. checkWrappingIndentation(DetailAST firstNode, DetailAST lastNode, int wrappedIndentLevel, int startIndent, boolean ignoreFirstLine)
Checks indentation on wrapped lines between and includingfirstNode
andlastNode
.private NavigableMap<Integer,DetailAST>
LineWrappingHandler. collectFirstNodes(DetailAST firstNode, DetailAST lastNode)
Finds first nodes on line and puts them into Map.private int
CommentsIndentationCheck. countEmptyLines(DetailAST startStatement, DetailAST endStatement)
Count the number of empty lines between statements.private AbstractExpressionHandler
HandlerFactory. createMethodCallHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Create new instance of handler for METHOD_CALL.protected int
AbstractExpressionHandler. expandedTabsColumnNo(DetailAST ast)
Get the column number for the start of a given expression, expanding tabs out into spaces in the process.protected int
DetailAstSet. expandedTabsColumnNo(DetailAST ast)
Get the column number for the start of a given expression, expanding tabs out into spaces in the process.private int
LineWrappingHandler. expandedTabsColumnNo(DetailAST ast)
Get the column number for the start of a given expression, expanding tabs out into spaces in the process.private DetailAST
CommentsIndentationCheck. findPreviousStatement(DetailAST comment, DetailAST root)
Finds a previous statement of the comment.private static DetailAST
CommentsIndentationCheck. findStartTokenOfMethodCallChain(DetailAST root)
Finds the start token of method call chain.protected void
AbstractExpressionHandler. findSubtreeAst(DetailAstSet astSet, DetailAST tree, boolean allowNesting)
Find the set of abstract syntax tree for a given subtree.private static DetailAST
CommentsIndentationCheck. findTokenWhichBeginsTheLine(DetailAST root)
Finds a token which begins the line.private static Optional<DetailAST>
MemberDefHandler. getArrayInitNode(DetailAST firstNode)
Finds the array init node.private static DetailAST
MethodCallHandler. getCallLastNode(DetailAST firstNode)
Returns method or constructor call right paren.private static DetailAST
CommentsIndentationCheck. getDistributedPreviousStatement(DetailAST comment)
Returns the first token of the distributed previous statement of comment.private static DetailAST
MethodCallHandler. getFirstAst(DetailAST ast)
Get the first AST of the specified method call.protected static DetailAST
AbstractExpressionHandler. getFirstAstNode(DetailAST ast)
Get the first ast for given expression.private static DetailAST
CommentsIndentationCheck. getFirstExpressionNodeFromMethodCall(DetailAST methodCall)
Returns the first EXPR DetailAST child from parent of comment.protected static int
AbstractExpressionHandler. getFirstLine(DetailAST tree)
Get the first line number for given expression.static DetailAST
AbstractExpressionHandler. getFirstToken(DetailAST ast)
Searches in given subtree (including given node) for the token which represents first symbol for this subtree in file.private static DetailAST
ForHandler. getForLoopRightParen(DetailAST literalForAst)
Returns right parenthesis of for-loop statement.AbstractExpressionHandler
HandlerFactory. getHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Get the handler for an AST.private static String
ClassDefHandler. getHandlerName(DetailAST ast)
Creates a handler name for this class according to ast type.private static String
MethodDefHandler. getHandlerName(DetailAST ast)
Creates a handler name for this class according to ast type.private static DetailAST
IfHandler. getIfStatementRightParen(DetailAST literalIfAst)
Returns right parenthesis of if statement.protected int
AbstractExpressionHandler. getLineStart(DetailAST ast)
Get the start of the line for the given expression.private int
LineWrappingHandler. getLineStart(DetailAST ast)
Get the start of the line for the given expression.private static String
CommentsIndentationCheck. getMessageKey(DetailAST comment)
Get a message key depending on a comment type.private static int
MethodDefHandler. getMethodDefLineStart(DetailAST mainAst)
Gets the start line of the method, excluding any annotations.private static DetailAST
MethodDefHandler. getMethodDefParamRightParen(DetailAST methodDefAst)
Returns right parenthesis of method definition parameter list.private static DetailAST
LineWrappingHandler. getNextCurNode(DetailAST curNode)
Returns next curNode node.private static Integer
LineWrappingHandler. getNextNodeLine(NavigableMap<Integer,DetailAST> firstNodesOnLines, DetailAST node)
Gets the next node line from the firstNodesOnLines map unless there is no next line, in which case, it returns the last line.private static DetailAST
CommentsIndentationCheck. getNextStmt(DetailAST comment)
Returns the next statement of a comment.private DetailAST
CommentsIndentationCheck. getNextToken(DetailAST checkedStatement)
Get the token to start counting the number of lines to add to the distance aim from.private DetailAST
CommentsIndentationCheck. getOneLinePreviousStatement(DetailAST comment)
Does pre-order traverse of abstract syntax tree to find the previous statement of the comment.private static DetailAST
CommentsIndentationCheck. getPrevCaseToken(DetailAST parentStatement)
Gets previous case-token for comment.private DetailAST
CommentsIndentationCheck. getPreviousStatement(DetailAST comment)
Returns the previous statement of a comment.private static DetailAST
CommentsIndentationCheck. getPrevStatementFromSwitchBlock(DetailAST comment)
Gets comment's previous statement from switch block.private static DetailAST
CommentsIndentationCheck. getPrevStatementWhenCommentIsUnderCase(DetailAST parentStatement)
Gets previous statement for comment which is placed immediately under case.private static DetailAST
SynchronizedHandler. getSynchronizedStatementRightParen(DetailAST syncStatementAST)
Returns right parenthesis of synchronized statement.private static DetailAST
MemberDefHandler. getVarDefStatementSemicolon(DetailAST variableDef)
Returns semicolon for variable definition statement.private void
CommentsIndentationCheck. handleCommentAtTheEndOfTheCodeBlock(DetailAST prevStmt, DetailAST comment, DetailAST nextStmt)
Handles a comment which is placed at the end of non-empty code block.private void
CommentsIndentationCheck. handleCommentInEmptyCaseBlock(DetailAST prevStmt, DetailAST comment, DetailAST nextStmt)
Handles a comment which is placed within empty case block.private void
CommentsIndentationCheck. handleCommentInEmptyCodeBlock(DetailAST comment, DetailAST nextStmt)
Handles a comment which is placed within the empty code block.private void
CommentsIndentationCheck. handleFallThroughComment(DetailAST prevStmt, DetailAST comment, DetailAST nextStmt)
Handles 'fall through' single-line comment.void
IndentationCheck. indentationLog(DetailAST ast, String key, Object... args)
Log a violation message.private static boolean
CommentsIndentationCheck. isBlockStart(DetailAST root)
Whether the AST node starts a block.private static boolean
CommentsIndentationCheck. isComment(DetailAST ast)
Whether the ast is a comment.private static boolean
CommentsIndentationCheck. isCommentAtTheEndOfTheCodeBlock(DetailAST nextStmt)
Checks whether a comment is placed at the end of the code block.private static boolean
CommentsIndentationCheck. isCommentForMultiblock(DetailAST endBlockStmt)
Whether the comment might have been used for the next block in a multi-block structure.private static boolean
CommentsIndentationCheck. isDefinition(DetailAST previousSibling)
Whether the statement is a kind of definition (method, class etc.).private boolean
CommentsIndentationCheck. isDistributedExpression(DetailAST comment)
Checks whether the previous statement of a comment is a method call chain or string concatenation statement distributed over two or more lines.private boolean
CommentsIndentationCheck. isDistributedPreviousStatement(DetailAST comment)
Checks whether the previous statement of a comment is distributed over two or more lines.private static boolean
CommentsIndentationCheck. isDistributedReturnStatement(DetailAST commentPreviousSibling)
Checks whether the previous statement of a comment is a distributed return statement.private static boolean
CommentsIndentationCheck. isDistributedThrowStatement(DetailAST commentPreviousSibling)
Checks whether the previous statement of a comment is a distributed throw statement.private static boolean
LineWrappingHandler. isEndOfScope(DetailAST lastAnnotationNode, DetailAST node)
Checks line for end of scope.private static boolean
CommentsIndentationCheck. isFallThroughComment(DetailAST prevStmt, DetailAST nextStmt)
Checks whether comment is a 'fall through' comment.private static boolean
CommentsIndentationCheck. isInEmptyCaseBlock(DetailAST prevStmt, DetailAST nextStmt)
Checks whether case block is empty.private static boolean
CommentsIndentationCheck. isInEmptyCodeBlock(DetailAST prevStmt, DetailAST nextStmt)
Checks whether comment is placed in the empty code block.private static boolean
SynchronizedHandler. isMethodModifier(DetailAST ast)
Checks if given synchronized is modifier of method.private boolean
CommentsIndentationCheck. isOnPreviousLineIgnoringComments(DetailAST currentStatement, DetailAST checkedStatement)
Checks whether the checked statement is on the previous line ignoring empty lines and lines which contain only comments.protected boolean
AbstractExpressionHandler. isOnStartOfLine(DetailAST ast)
Determines if the given expression is at the start of a line.private static boolean
LineWrappingHandler. isParentContainsTokenType(DetailAST node, int type)
Checks that some parent of given node contains given token type.private static boolean
CommentsIndentationCheck. isStatementWithPossibleCurlies(DetailAST previousSibling)
Whether the statement can have or always have curly brackets.private boolean
CommentsIndentationCheck. isTrailingBlockComment(DetailAST blockComment)
Checks if current comment block is trailing comment, e.g.:private boolean
CommentsIndentationCheck. isTrailingComment(DetailAST comment)
Checks if current comment is a trailing comment.private boolean
CommentsIndentationCheck. isTrailingSingleLineComment(DetailAST singleLineComment)
Checks if current single-line comment is trailing comment, e.g.:private static boolean
CommentsIndentationCheck. isUsingOfObjectReferenceToInvokeMethod(DetailAST root)
Checks whether there is a use of an object reference to invoke an object's method on line.void
IndentationCheck. leaveToken(DetailAST ast)
private void
AbstractExpressionHandler. logChildError(DetailAST ast, int actualIndent, IndentLevel expectedIndent)
Log child indentation error.protected void
AbstractExpressionHandler. logError(DetailAST ast, String subtypeName, int actualIndent)
Log an indentation error.protected void
AbstractExpressionHandler. logError(DetailAST ast, String subtypeName, int actualIndent, IndentLevel expectedIndent)
Log an indentation error.private void
CommentsIndentationCheck. logMultilineIndentation(DetailAST prevStmt, DetailAST comment, DetailAST nextStmt)
Logs comment which can have the same indentation level as next or previous statement.private void
LineWrappingHandler. logWarningMessage(DetailAST currentNode, int currentIndent)
Logs warning message if indentation is incorrect.private void
CommentsIndentationCheck. visitComment(DetailAST comment)
Checks comment indentations over surrounding code, e.g.:void
CommentsIndentationCheck. visitToken(DetailAST commentAst)
void
IndentationCheck. visitToken(DetailAST ast)
Method parameters in com.puppycrawl.tools.checkstyle.checks.indentation with type arguments of type DetailAST Modifier and Type Method Description private void
LineWrappingHandler. checkAnnotationIndentation(DetailAST atNode, NavigableMap<Integer,DetailAST> firstNodesOnLines, int indentLevel)
Checks line wrapping into annotations.void
LineWrappingHandler. checkForAnnotationIndentation(NavigableMap<Integer,DetailAST> firstNodesOnLines, int indentLevel)
Checks for annotation indentation.private static Integer
LineWrappingHandler. getNextNodeLine(NavigableMap<Integer,DetailAST> firstNodesOnLines, DetailAST node)
Gets the next node line from the firstNodesOnLines map unless there is no next line, in which case, it returns the last line.Constructors in com.puppycrawl.tools.checkstyle.checks.indentation with parameters of type DetailAST Constructor Description AbstractExpressionHandler(IndentationCheck indentCheck, String typeName, DetailAST expr, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, name, abstract syntax tree, and parent handler.AnnotationArrayInitHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.ArrayInitHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.BlockParentHandler(IndentationCheck indentCheck, String name, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, name, abstract syntax tree, and parent handler.CaseHandler(IndentationCheck indentCheck, DetailAST expr, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.CatchHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.ClassDefHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.DoWhileHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.ElseHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.FinallyHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.ForHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.IfHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.ImportHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.IndexHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.LabelHandler(IndentationCheck indentCheck, DetailAST expr, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.LambdaHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.MemberDefHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.MethodCallHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.MethodDefHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.NewHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.ObjectBlockHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.PackageDefHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.SlistHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.StaticInitHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.SwitchHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.SwitchRuleHandler(IndentationCheck indentCheck, DetailAST expr, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.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.TryHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.WhileHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.YieldHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.checks.javadoc
Fields in com.puppycrawl.tools.checkstyle.checks.javadoc declared as DetailAST Modifier and Type Field Description private DetailAST
JavadocMethodCheck.ExceptionInfo. ast
AST node representing this exception.private DetailAST
AbstractJavadocCheck.FileContext. blockCommentAst
DetailAST node of considered Javadoc comment that is just a block comment in Java language syntax tree.Methods in com.puppycrawl.tools.checkstyle.checks.javadoc that return DetailAST Modifier and Type Method Description private DetailAST
JavadocMethodCheck.ExceptionInfo. getAst()
Gets the AST node representing this exception.protected DetailAST
AbstractJavadocCheck. getBlockCommentAst()
Getter for block comment in Java language syntax tree.private static DetailAST
JavadocMethodCheck. getFirstClassNameNode(DetailAST ast)
Get node where class name of exception starts.Methods in com.puppycrawl.tools.checkstyle.checks.javadoc that return types with arguments of type DetailAST Modifier and Type Method Description static List<DetailAST>
JavadocMethodCheck. findTokensInAstByType(DetailAST root, int astType)
Finds node of specified type among root children, siblings, siblings children on any deep level.private static List<DetailAST>
JavadocMethodCheck. getParameters(DetailAST ast)
Computes the parameter nodes for a method.Methods in com.puppycrawl.tools.checkstyle.checks.javadoc with parameters of type DetailAST Modifier and Type Method Description void
AbstractJavadocCheck. beginTree(DetailAST rootAST)
private void
JavadocMethodCheck. checkComment(DetailAST ast, TextBlock comment)
Checks the Javadoc for a method.private void
JavadocStyleCheck. checkComment(DetailAST ast, TextBlock comment)
Performs the various checks against the Javadoc comment.private void
JavadocTypeCheck. checkComponentParamTag(DetailAST ast, Collection<JavadocTag> tags, String recordComponentName)
Verifies that a record definition has the specified param tag for the specified record component name.private void
JavadocStyleCheck. checkFirstSentenceEnding(DetailAST ast, TextBlock comment)
Checks that the first sentence ends with proper punctuation.private void
JavadocStyleCheck. checkHtmlTags(DetailAST ast, TextBlock comment)
Checks the comment for HTML tags that do not have a corresponding close tag or a close tag that has no previous open tag.private void
JavadocMethodCheck. checkParamTags(List<JavadocTag> tags, DetailAST parent, boolean reportExpectedTags)
Checks a set of tags for matching parameters.private void
JavadocTypeCheck. checkTag(DetailAST ast, Iterable<JavadocTag> tags, String tagName, Pattern formatPattern)
Verifies that a type definition has a required tag.private void
JavadocTypeCheck. checkTypeParamTag(DetailAST ast, Collection<JavadocTag> tags, String typeParamName)
Verifies that a type definition has the specified param tag for the specified type parameter name.static List<DetailAST>
JavadocMethodCheck. findTokensInAstByType(DetailAST root, int astType)
Finds node of specified type among root children, siblings, siblings children on any deep level.void
AbstractJavadocCheck. finishTree(DetailAST rootAST)
private static JavadocMethodCheck.ExceptionInfo
JavadocMethodCheck. getExceptionInfo(DetailAST ast)
Get ExceptionInfo instance.private static DetailAST
JavadocMethodCheck. getFirstClassNameNode(DetailAST ast)
Get node where class name of exception starts.private static int
MissingJavadocMethodCheck. getMethodsNumberOfLine(DetailAST methodDef)
Some javadoc.private static List<DetailAST>
JavadocMethodCheck. getParameters(DetailAST ast)
Computes the parameter nodes for a method.private static int
AtclauseOrderCheck. getParentType(DetailAST commentBlock)
Returns type of parent node.private static List<String>
JavadocTypeCheck. getRecordComponentNames(DetailAST node)
Collects the record components in a record definition.private static List<JavadocMethodCheck.ExceptionInfo>
JavadocMethodCheck. getThrowed(DetailAST methodAst)
Get ExceptionInfo for all exceptions that throws in method code by 'throw new'.private static List<JavadocMethodCheck.ExceptionInfo>
JavadocMethodCheck. getThrows(DetailAST ast)
Computes the exception nodes for a method.private static boolean
MissingJavadocPackageCheck. hasJavadoc(DetailAST ast)
Checks that there is javadoc before ast.private static boolean
MissingJavadocPackageCheck. hasJavadocAboveAnnotation(DetailAST ast)
Checks javadoc existence in annotations list.private boolean
JavadocMethodCheck. hasShortCircuitTag(DetailAST ast, List<JavadocTag> tags)
Validates whether the Javadoc has a short circuit tag.private boolean
MissingJavadocMethodCheck. isContentsAllowMissingJavadoc(DetailAST ast)
Checks if the Javadoc can be missing if the method or constructor is below the minimum line count or has a special annotation.static boolean
MissingJavadocMethodCheck. isGetterMethod(DetailAST ast)
Returns whether an AST represents a getter method.private boolean
JavadocVariableCheck. isIgnored(DetailAST ast)
Decides whether the variable name of an AST is in the ignore list.private static boolean
JavadocMethodCheck. isInIgnoreBlock(DetailAST methodBodyAst, DetailAST throwAst)
Checks if a 'throw' usage is contained within a block that should be ignored.private static boolean
MissingJavadocPackageCheck. isJavadoc(DetailAST ast)
Checks that ast is a javadoc comment.private boolean
MissingJavadocMethodCheck. isMissingJavadocAllowed(DetailAST ast)
Checks if a missing Javadoc is allowed by the check's configuration.private static boolean
JavadocContentLocationCheck. isMultilineComment(DetailAST node)
Checks if a DetailAST of typeTokenTypes.BLOCK_COMMENT_BEGIN
span more than one line.static boolean
MissingJavadocMethodCheck. isSetterMethod(DetailAST ast)
Returns whether an AST represents a setter method.private static boolean
SingleLineJavadocCheck. isSingleLineJavadoc(DetailAST blockCommentStart)
Checks if comment is single-line comment.abstract boolean
JavadocTagInfo. isValidOn(DetailAST ast)
Checks if a particular Javadoc tag is valid within a Javadoc block of a given AST.private boolean
MissingJavadocMethodCheck. matchesSkipRegex(DetailAST methodDef)
Checks if the given method name matches the regex.private void
JavadocMethodCheck. processAST(DetailAST ast)
Called to process an AST when visiting it.private boolean
JavadocMethodCheck. shouldCheck(DetailAST ast)
Whether we should check this node.private boolean
JavadocStyleCheck. shouldCheck(DetailAST ast)
Whether we should check this node.private boolean
JavadocTypeCheck. shouldCheck(DetailAST ast)
Whether we should check this node.private boolean
JavadocVariableCheck. shouldCheck(DetailAST ast)
Whether we should check this node.private boolean
MissingJavadocMethodCheck. shouldCheck(DetailAST ast, Scope nodeScope)
Whether we should check this node.private boolean
MissingJavadocTypeCheck. shouldCheck(DetailAST ast)
Whether we should check this node.void
AbstractJavadocCheck. visitToken(DetailAST blockCommentNode)
void
InvalidJavadocPositionCheck. visitToken(DetailAST ast)
void
JavadocContentLocationCheck. visitToken(DetailAST ast)
void
JavadocMethodCheck. visitToken(DetailAST ast)
void
JavadocStyleCheck. visitToken(DetailAST ast)
void
JavadocTypeCheck. visitToken(DetailAST ast)
void
JavadocVariableCheck. visitToken(DetailAST ast)
void
MissingJavadocMethodCheck. visitToken(DetailAST ast)
void
MissingJavadocPackageCheck. visitToken(DetailAST ast)
void
MissingJavadocTypeCheck. visitToken(DetailAST ast)
void
WriteTagCheck. visitToken(DetailAST ast)
Method parameters in com.puppycrawl.tools.checkstyle.checks.javadoc with type arguments of type DetailAST Modifier and Type Method Description private static boolean
JavadocMethodCheck. removeMatchingParam(Iterable<DetailAST> params, String paramName)
Remove parameter from params collection by name.private static boolean
JavadocMethodCheck. searchMatchingTypeParameter(Iterable<DetailAST> typeParams, String requiredTypeName)
Returns true if required type found in type parameters.Constructors in com.puppycrawl.tools.checkstyle.checks.javadoc with parameters of type DetailAST Constructor Description ExceptionInfo(DetailAST ast, JavadocMethodCheck.ClassInfo classInfo)
Creates new instance forFullIdent
. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.checks.metrics
Fields in com.puppycrawl.tools.checkstyle.checks.metrics declared as DetailAST Modifier and Type Field Description private DetailAST
AbstractClassCouplingCheck.ClassContext. classAst
AST of class definition.Methods in com.puppycrawl.tools.checkstyle.checks.metrics that return DetailAST Modifier and Type Method Description private static DetailAST
NPathComplexityCheck. getLastToken(DetailAST ast)
Finds a leaf, which is the most distant from the root.Methods in com.puppycrawl.tools.checkstyle.checks.metrics with parameters of type DetailAST Modifier and Type Method Description private void
AbstractClassCouplingCheck.ClassContext. addReferencedClassName(DetailAST ast)
Adds new referenced class.void
AbstractClassCouplingCheck. beginTree(DetailAST ast)
void
JavaNCSSCheck. beginTree(DetailAST rootAST)
void
NPathComplexityCheck. beginTree(DetailAST rootAST)
void
BooleanExpressionComplexityCheck.Context. checkCount(DetailAST ast)
Checks if we violate maximum allowed complexity.private static int
NPathComplexityCheck. countCaseConstants(DetailAST ast)
Counts number of case constants tokens in a switch labeled rule.private static int
NPathComplexityCheck. countCaseTokens(DetailAST ast)
Counts number of case tokens subject to a case group token.private static int
NPathComplexityCheck. countConditionalOperators(DetailAST ast)
Calculates number of conditional operators, including inline ternary operator, for a token.private void
AbstractClassCouplingCheck. createNewClassContext(String className, DetailAST ast)
Creates new inner class context with given name and location.void
JavaNCSSCheck. finishTree(DetailAST rootAST)
private static DetailAST
NPathComplexityCheck. getLastToken(DetailAST ast)
Finds a leaf, which is the most distant from the root.boolean
NPathComplexityCheck.TokenEnd. isAfter(DetailAST ast)
Checks if saved coordinates located after given token.private static boolean
JavaNCSSCheck. isCountable(DetailAST ast)
Checks if a token is countable for the ncss metric.private static boolean
JavaNCSSCheck. isExpressionCountable(DetailAST ast)
Checks if an expression is countable for the ncss metric.private static boolean
BooleanExpressionComplexityCheck. isPassedInParameter(DetailAST logicalOperator)
Checks if logical operator is part of constructor or method call.private static boolean
BooleanExpressionComplexityCheck. isPipeOperator(DetailAST binaryOr)
Checks ifbinary OR
is applied to exceptions in multi-catch (pipe-syntax).private static boolean
JavaNCSSCheck. isVariableDefCountable(DetailAST ast)
Checks if a variable definition is countable.private void
BooleanExpressionComplexityCheck. leaveExpr(DetailAST ast)
Restores previous context.private void
CyclomaticComplexityCheck. leaveMethodDef(DetailAST ast)
Process the end of a method definition.private void
NPathComplexityCheck. leaveMethodDef(DetailAST ast)
Process the end of a method definition.void
AbstractClassCouplingCheck. leaveToken(DetailAST ast)
void
BooleanExpressionComplexityCheck. leaveToken(DetailAST ast)
void
CyclomaticComplexityCheck. leaveToken(DetailAST ast)
void
JavaNCSSCheck. leaveToken(DetailAST ast)
void
NPathComplexityCheck. leaveToken(DetailAST ast)
private void
AbstractClassCouplingCheck. registerImport(DetailAST imp)
Registers given import.void
NPathComplexityCheck.TokenEnd. setToken(DetailAST endToken)
Sets end coordinates from given token.private void
AbstractClassCouplingCheck. visitAnnotationType(DetailAST annotationAST)
Visit ANNOTATION literal and get its type to referenced classes of context.private void
AbstractClassCouplingCheck. visitClassDef(DetailAST classDef)
Creates new context for a given class.private void
NPathComplexityCheck. visitConditional(DetailAST ast, int basicBranchingFactor)
Visits if, while, do-while, for and switch tokens - all of them have expression in parentheses which is used for calculation.void
AbstractClassCouplingCheck.ClassContext. visitLiteralNew(DetailAST ast)
Visits NEW.private void
AbstractClassCouplingCheck. visitLiteralNew(DetailAST ast)
Visits NEW token for the current class context.void
AbstractClassCouplingCheck.ClassContext. visitLiteralThrows(DetailAST literalThrows)
Visits throws clause and collects all exceptions we throw.private void
AbstractClassCouplingCheck. visitLiteralThrows(DetailAST ast)
Visits THROWS token for the current class context.private void
BooleanExpressionComplexityCheck. visitMethodDef(DetailAST ast)
Creates new context for a given method.private void
AbstractClassCouplingCheck. visitPackageDef(DetailAST pkg)
Stores package of current class we check.void
AbstractClassCouplingCheck. visitToken(DetailAST ast)
void
BooleanExpressionComplexityCheck. visitToken(DetailAST ast)
void
CyclomaticComplexityCheck. visitToken(DetailAST ast)
void
JavaNCSSCheck. visitToken(DetailAST ast)
void
NPathComplexityCheck. visitToken(DetailAST ast)
private void
CyclomaticComplexityCheck. visitTokenHook(DetailAST ast)
Hook called when visiting a token.void
AbstractClassCouplingCheck.ClassContext. visitType(DetailAST ast)
Visits type.private void
AbstractClassCouplingCheck. visitType(DetailAST ast)
Visits type token for the current class context.private void
NPathComplexityCheck. visitUnitaryOperator(DetailAST ast, int basicBranchingFactor)
Visits ternary operator (?private void
NPathComplexityCheck. visitWhenExpression(DetailAST ast, int basicBranchingFactor)
Visits when expression token.Constructors in com.puppycrawl.tools.checkstyle.checks.metrics with parameters of type DetailAST Constructor Description ClassContext(String className, DetailAST ast)
Create new context associated with given class. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.checks.modifier
Methods in com.puppycrawl.tools.checkstyle.checks.modifier that return DetailAST Modifier and Type Method Description private static DetailAST
ModifierOrderCheck. checkOrderSuggestedByJls(List<DetailAST> modifiers)
Checks if the modifiers were added in the order suggested in the Java language specification.private static DetailAST
ModifierOrderCheck. skipAnnotations(Iterator<DetailAST> modifierIterator)
Skip all annotations in modifier block.Methods in com.puppycrawl.tools.checkstyle.checks.modifier that return types with arguments of type DetailAST Modifier and Type Method Description private static List<DetailAST>
RedundantModifierCheck. getMethodAnnotationsList(DetailAST methodDef)
Gets the list of annotations on method definition.Methods in com.puppycrawl.tools.checkstyle.checks.modifier with parameters of type DetailAST Modifier and Type Method Description private void
RedundantModifierCheck. checkClassConstructorModifiers(DetailAST classCtorAst)
Check if class constructor has proper modifiers.private void
RedundantModifierCheck. checkConstructorModifiers(DetailAST ctorDefAst)
Check modifiers of constructor.private void
RedundantModifierCheck. checkEnumConstructorModifiers(DetailAST ast)
Check if enum constructor has proper modifiers.private void
RedundantModifierCheck. checkForRedundantModifier(DetailAST ast, int... modifierTypes)
Checks if given ast has a redundant modifier.private void
RedundantModifierCheck. checkInterfaceModifiers(DetailAST ast)
Checks if interface has proper modifiers.private void
RedundantModifierCheck. checkUnnamedVariables(DetailAST ast)
Check if the variable is unnamed and has redundant final modifier.private static List<DetailAST>
RedundantModifierCheck. getMethodAnnotationsList(DetailAST methodDef)
Gets the list of annotations on method definition.private static boolean
RedundantModifierCheck. isAnnotatedWithSafeVarargs(DetailAST methodDef)
Checks if method definition is annotated with.private static boolean
ModifierOrderCheck. isAnnotationOnType(DetailAST modifier)
Checks whether annotation on type takes place.private static boolean
RedundantModifierCheck. isClassProtected(DetailAST classDef)
Checks if given class ast has protected modifier.private static boolean
RedundantModifierCheck. isClassPublic(DetailAST ast)
Checks if given class is accessible from "public" scope.private static boolean
RedundantModifierCheck. isEnumMember(DetailAST ast)
Checks if current AST node is member of Enum.private static boolean
RedundantModifierCheck. isInterfaceOrAnnotationMember(DetailAST ast)
Checks if current AST node is member of Interface or Annotation, not of their subnodes.private static boolean
ClassMemberImpliedModifierCheck. isInTypeBlock(DetailAST ast)
Checks if ast is in a class, enum, anon class or record block.private static boolean
RedundantModifierCheck. isUnnamedVariable(DetailAST ast)
Check if the variable is unnamed.private void
RedundantModifierCheck. processAbstractMethodParameters(DetailAST ast)
Process validation of parameters for Methods with no definition.private void
InterfaceMemberImpliedModifierCheck. processField(DetailAST ast)
Check field in interface.private void
RedundantModifierCheck. processInterfaceOrAnnotation(DetailAST ast)
Do validation of interface of annotation.private void
RedundantModifierCheck. processLambdaParameters(DetailAST lambdaAst)
Process lambda parameters.private void
InterfaceMemberImpliedModifierCheck. processMethod(DetailAST ast)
Check method in interface.private void
RedundantModifierCheck. processMethods(DetailAST ast)
Process validation of Methods.private void
InterfaceMemberImpliedModifierCheck. processNestedType(DetailAST ast)
Check nested types in interface.private void
RedundantModifierCheck. processResources(DetailAST ast)
Checks if given resource has redundant modifiers.void
ClassMemberImpliedModifierCheck. visitToken(DetailAST ast)
void
InterfaceMemberImpliedModifierCheck. visitToken(DetailAST ast)
void
ModifierOrderCheck. visitToken(DetailAST ast)
void
RedundantModifierCheck. visitToken(DetailAST ast)
Method parameters in com.puppycrawl.tools.checkstyle.checks.modifier with type arguments of type DetailAST Modifier and Type Method Description private static DetailAST
ModifierOrderCheck. checkOrderSuggestedByJls(List<DetailAST> modifiers)
Checks if the modifiers were added in the order suggested in the Java language specification.private static DetailAST
ModifierOrderCheck. skipAnnotations(Iterator<DetailAST> modifierIterator)
Skip all annotations in modifier block. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.checks.naming
Methods in com.puppycrawl.tools.checkstyle.checks.naming that return types with arguments of type DetailAST Modifier and Type Method Description private static List<DetailAST>
AbbreviationAsWordInNameCheck. getChildren(DetailAST node)
Gets all the children which are one level below on the current DetailAST parent node.Methods in com.puppycrawl.tools.checkstyle.checks.naming with parameters of type DetailAST Modifier and Type Method Description private static List<DetailAST>
AbbreviationAsWordInNameCheck. getChildren(DetailAST node)
Gets all the children which are one level below on the current DetailAST parent node.private boolean
AbbreviationAsWordInNameCheck. hasIgnoredModifiers(DetailAST modifiers)
Checks if a variable is to be ignored based on its modifiers.private static boolean
AbbreviationAsWordInNameCheck. hasOverrideAnnotation(DetailAST methodModifiersAST)
Checks that the method has "@Override" annotation.private static boolean
AbstractClassNameCheck. isAbstract(DetailAST ast)
Checks if declared class is abstract or not.private static boolean
LocalVariableNameCheck. isForLoopVariable(DetailAST variableDef)
Checks if a variable is the loop's one.private boolean
AbbreviationAsWordInNameCheck. isIgnoreSituation(DetailAST ast)
Checks if it is an ignore situation.private static boolean
AbbreviationAsWordInNameCheck. isInterfaceDeclaration(DetailAST variableDefAst)
Check that variable definition in interface or @interface definition.private static boolean
ParameterNameCheck. isOverriddenMethod(DetailAST ast)
Checks whether a method is annotated with Override annotation.private static boolean
AbstractAccessControlNameCheck. isPublic(DetailAST modifiers)
Checks if given modifiers has public access.protected boolean
AbstractAccessControlNameCheck. mustCheckName(DetailAST ast)
protected abstract boolean
AbstractNameCheck. mustCheckName(DetailAST ast)
Decides whether the name of an AST should be checked against the format regexp.protected boolean
CatchParameterNameCheck. mustCheckName(DetailAST ast)
protected boolean
ClassTypeParameterNameCheck. mustCheckName(DetailAST ast)
protected boolean
ConstantNameCheck. mustCheckName(DetailAST ast)
protected boolean
IllegalIdentifierNameCheck. mustCheckName(DetailAST ast)
protected boolean
InterfaceTypeParameterNameCheck. mustCheckName(DetailAST ast)
protected boolean
LambdaParameterNameCheck. mustCheckName(DetailAST ast)
protected boolean
LocalFinalVariableNameCheck. mustCheckName(DetailAST ast)
protected boolean
LocalVariableNameCheck. mustCheckName(DetailAST ast)
protected boolean
MemberNameCheck. mustCheckName(DetailAST ast)
protected boolean
MethodTypeParameterNameCheck. mustCheckName(DetailAST ast)
protected boolean
ParameterNameCheck. mustCheckName(DetailAST ast)
protected boolean
PatternVariableNameCheck. mustCheckName(DetailAST ast)
protected boolean
RecordComponentNameCheck. mustCheckName(DetailAST ast)
protected boolean
RecordTypeParameterNameCheck. mustCheckName(DetailAST ast)
protected boolean
StaticVariableNameCheck. mustCheckName(DetailAST ast)
protected boolean
AbstractAccessControlNameCheck. shouldCheckInScope(DetailAST modifiers)
Should we check member with given modifiers.private void
AbstractClassNameCheck. visitClassDef(DetailAST ast)
Checks class definition.void
AbbreviationAsWordInNameCheck. visitToken(DetailAST ast)
void
AbstractClassNameCheck. visitToken(DetailAST ast)
void
AbstractNameCheck. visitToken(DetailAST ast)
void
LambdaParameterNameCheck. visitToken(DetailAST ast)
void
MethodNameCheck. visitToken(DetailAST ast)
void
PackageNameCheck. visitToken(DetailAST ast)
-
Uses of DetailAST in com.puppycrawl.tools.checkstyle.checks.regexp
Methods in com.puppycrawl.tools.checkstyle.checks.regexp with parameters of type DetailAST Modifier and Type Method Description void
RegexpCheck. beginTree(DetailAST rootAST)
void
RegexpSinglelineJavaCheck. beginTree(DetailAST rootAST)
-
Uses of DetailAST in com.puppycrawl.tools.checkstyle.checks.sizes
Fields in com.puppycrawl.tools.checkstyle.checks.sizes declared as DetailAST Modifier and Type Field Description private DetailAST
ExecutableStatementCountCheck.Context. ast
Member AST node.private DetailAST
MethodCountCheck.MethodCounter. scopeDefinition
The surrounding scope definition (class, enum, etc.) which the method counts are connected to.Methods in com.puppycrawl.tools.checkstyle.checks.sizes that return DetailAST Modifier and Type Method Description DetailAST
ExecutableStatementCountCheck.Context. getAST()
Gets the member AST node.private DetailAST
MethodCountCheck.MethodCounter. getScopeDefinition()
Returns the surrounding scope definition (class, enum, etc.) which the method counts are connected to.Methods in com.puppycrawl.tools.checkstyle.checks.sizes with parameters of type DetailAST Modifier and Type Method Description void
ExecutableStatementCountCheck. beginTree(DetailAST rootAST)
void
OuterTypeNumberCheck. beginTree(DetailAST ast)
private void
MethodCountCheck. checkCounters(MethodCountCheck.MethodCounter counter, DetailAST ast)
Check the counters and report violations.private void
MethodCountCheck. checkMax(int max, int value, String msg, DetailAST ast)
Utility for reporting if a maximum has been exceeded.private static int
RecordComponentNumberCheck. countComponents(DetailAST recordComponents)
Method to count the number of record components in this record definition.private static int
MethodLengthCheck. countUsedLines(DetailAST ast)
Count number of used code lines without comments.void
OuterTypeNumberCheck. finishTree(DetailAST ast)
private static int
LambdaBodyLengthCheck. getFirstNodeLineNumber(DetailAST lambdaBody)
Get first child node in the tree line number.private static int
LambdaBodyLengthCheck. getLastNodeLineNumber(DetailAST lambdaBody)
Get last child node in the tree line number.private static int
LambdaBodyLengthCheck. getLength(DetailAST ast)
Get length of lambda body.private static int
MethodLengthCheck. getLengthOfBlock(DetailAST openingBrace, DetailAST closingBrace)
Returns length of code.private boolean
ParameterNumberCheck. isAnnotatedByIgnoredAnnotations(DetailAST ast)
Checks if method or constructor is annotated by ignored annotation(s).private static boolean
ExecutableStatementCountCheck. isContainerNode(DetailAST node)
Check if the node is of type ctor (compact or canonical), instance/ static initializer, method definition or lambda.private boolean
ParameterNumberCheck. isIgnoredOverriddenMethod(DetailAST ast)
Checks if method is overridden and should be ignored.private boolean
MethodCountCheck. isInLatestScopeDefinition(DetailAST methodDef)
Checks if there is a scope definition to check and that the method is found inside that scope (class, enum, etc.).private void
ExecutableStatementCountCheck. leaveContainerNode(DetailAST ast)
Process the end of a container node.void
ExecutableStatementCountCheck. leaveToken(DetailAST ast)
void
MethodCountCheck. leaveToken(DetailAST ast)
void
OuterTypeNumberCheck. leaveToken(DetailAST ast)
private void
MethodCountCheck. raiseCounter(DetailAST method)
Determine the visibility modifier and raise the corresponding counter.private boolean
ParameterNumberCheck. shouldIgnoreNumberOfParameters(DetailAST ast)
Determine whether to ignore number of parameters.private void
ExecutableStatementCountCheck. visitContainerNode(DetailAST ast)
Process the start of the container node.private void
ExecutableStatementCountCheck. visitSlist(DetailAST ast)
Process the end of a statement list.void
AnonInnerLengthCheck. visitToken(DetailAST ast)
void
ExecutableStatementCountCheck. visitToken(DetailAST ast)
void
LambdaBodyLengthCheck. visitToken(DetailAST ast)
void
MethodCountCheck. visitToken(DetailAST ast)
void
MethodLengthCheck. visitToken(DetailAST ast)
void
OuterTypeNumberCheck. visitToken(DetailAST ast)
void
ParameterNumberCheck. visitToken(DetailAST ast)
void
RecordComponentNumberCheck. visitToken(DetailAST ast)
Constructors in com.puppycrawl.tools.checkstyle.checks.sizes with parameters of type DetailAST Constructor Description Context(DetailAST ast)
Creates new member context.MethodCounter(DetailAST scopeDefinition)
Creates an interface. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.checks.whitespace
Methods in com.puppycrawl.tools.checkstyle.checks.whitespace that return DetailAST Modifier and Type Method Description private static DetailAST
OperatorWrapCheck. adjustParens(DetailAST node, UnaryOperator<DetailAST> step)
Finds matching parentheses among siblings.private static DetailAST
NoWhitespaceAfterCheck. getArrayDeclaratorPreviousElement(DetailAST ast)
Returns proper argument for getPositionAfter method, it is a token afterARRAY_DECLARATOR
, in can beRBRACK
,IDENT
or an array type definition (literal).private static DetailAST
NoWhitespaceAfterCheck. getIdentLastToken(DetailAST ast)
Gets leftmost token of identifier.private static DetailAST
NoWhitespaceAfterCheck. getIndexOpPreviousElement(DetailAST ast)
Gets previous node forINDEX_OP
token for usage in getPositionAfter method, it is a simplified copy of getArrayDeclaratorPreviousElement method.private static DetailAST
EmptyLineSeparatorCheck. getLastElementBeforeEmptyLines(DetailAST ast, int line)
Returns the element after which empty lines exist.private static DetailAST
OperatorWrapCheck. getLeftNode(DetailAST node)
Returns the left neighbour of a binary operator.private static DetailAST
NoWhitespaceAfterCheck. getPreviousElementOfMultiDimArray(DetailAST leftBracket)
Gets the previous element of a second or higher dimension of an array declaration or initialization.private static DetailAST
NoWhitespaceAfterCheck. getPreviousNodeWithParentOfTypeAst(DetailAST ast, DetailAST parent)
Finds previous node by text order for an array declarator, which parent type isTYPE
.private static DetailAST
OperatorWrapCheck. getRightNode(DetailAST node)
Returns the right neighbour of a binary operator.private static DetailAST
NoWhitespaceAfterCheck. getTypeLastNode(DetailAST ast)
Searches parameter node for a type node.private static DetailAST
EmptyLineSeparatorCheck. getViolationAstForPackage(DetailAST ast)
Gets the Ast on which violation is to be given for package declaration.private static DetailAST
NoWhitespaceAfterCheck. getWhitespaceFollowedNode(DetailAST ast)
For a visited ast node returns node that should be checked for not being followed by whitespace.Methods in com.puppycrawl.tools.checkstyle.checks.whitespace that return types with arguments of type DetailAST Modifier and Type Method Description private static Optional<DetailAST>
EmptyLineSeparatorCheck. findCommentUnder(DetailAST packageDef)
Finds comment in next sibling of given packageDef.private static Optional<DetailAST>
EmptyLineSeparatorCheck. getPostFixNode(DetailAST ast)
Gets postfix Node from AST if present.private static Optional<DetailAST>
NoWhitespaceAfterCheck. getPrecedingDot(DetailAST leftBracket)
Gets the dot preceding a class member array index operation or class reference.private static Optional<DetailAST>
NoWhitespaceAfterCheck. getReferencedClassDot(DetailAST leftBracket)
Gets the dot preceding a class reference.Methods in com.puppycrawl.tools.checkstyle.checks.whitespace with parameters of type DetailAST Modifier and Type Method Description private static DetailAST
OperatorWrapCheck. adjustParens(DetailAST node, UnaryOperator<DetailAST> step)
Finds matching parentheses among siblings.void
GenericWhitespaceCheck. beginTree(DetailAST rootAST)
void
SingleSpaceSeparatorCheck. beginTree(DetailAST rootAST)
private void
EmptyLineSeparatorCheck. checkCommentInModifiers(DetailAST packageDef)
Checks that packageDef token is separated from comment in modifiers.private void
EmptyLineSeparatorCheck. checkComments(DetailAST token)
Check if group of comments located right before token has more than one previous empty line.private void
EmptyLineSeparatorCheck. checkCommentsInsideToken(DetailAST token)
Check if group of comments located at the start of token has more than one previous empty line.private void
EmptyLineSeparatorCheck. checkToken(DetailAST ast, DetailAST nextToken)
Checks that token and next token are separated.private static Optional<DetailAST>
EmptyLineSeparatorCheck. findCommentUnder(DetailAST packageDef)
Finds comment in next sibling of given packageDef.private static DetailAST
NoWhitespaceAfterCheck. getArrayDeclaratorPreviousElement(DetailAST ast)
Returns proper argument for getPositionAfter method, it is a token afterARRAY_DECLARATOR
, in can beRBRACK
,IDENT
or an array type definition (literal).private List<Integer>
EmptyLineSeparatorCheck. getEmptyLines(DetailAST ast)
Get list of empty lines.private static DetailAST
NoWhitespaceAfterCheck. getIdentLastToken(DetailAST ast)
Gets leftmost token of identifier.private static DetailAST
NoWhitespaceAfterCheck. getIndexOpPreviousElement(DetailAST ast)
Gets previous node forINDEX_OP
token for usage in getPositionAfter method, it is a simplified copy of getArrayDeclaratorPreviousElement method.private static int
NoWhitespaceBeforeCaseDefaultColonCheck. getLastColumnNumberOf(DetailAST ast)
Returns the last column number of an ast.private static DetailAST
EmptyLineSeparatorCheck. getLastElementBeforeEmptyLines(DetailAST ast, int line)
Returns the element after which empty lines exist.private static DetailAST
OperatorWrapCheck. getLeftNode(DetailAST node)
Returns the left neighbour of a binary operator.private static int
NoWhitespaceAfterCheck. getPositionAfter(DetailAST ast)
Gets position after token (place of possible redundant whitespace).private static Optional<DetailAST>
EmptyLineSeparatorCheck. getPostFixNode(DetailAST ast)
Gets postfix Node from AST if present.private static Optional<DetailAST>
NoWhitespaceAfterCheck. getPrecedingDot(DetailAST leftBracket)
Gets the dot preceding a class member array index operation or class reference.private static DetailAST
NoWhitespaceAfterCheck. getPreviousElementOfMultiDimArray(DetailAST leftBracket)
Gets the previous element of a second or higher dimension of an array declaration or initialization.private static DetailAST
NoWhitespaceAfterCheck. getPreviousNodeWithParentOfTypeAst(DetailAST ast, DetailAST parent)
Finds previous node by text order for an array declarator, which parent type isTYPE
.private static Optional<DetailAST>
NoWhitespaceAfterCheck. getReferencedClassDot(DetailAST leftBracket)
Gets the dot preceding a class reference.private static DetailAST
OperatorWrapCheck. getRightNode(DetailAST node)
Returns the right neighbour of a binary operator.private static DetailAST
NoWhitespaceAfterCheck. getTypeLastNode(DetailAST ast)
Searches parameter node for a type node.private static DetailAST
EmptyLineSeparatorCheck. getViolationAstForPackage(DetailAST ast)
Gets the Ast on which violation is to be given for package declaration.private static DetailAST
NoWhitespaceAfterCheck. getWhitespaceFollowedNode(DetailAST ast)
For a visited ast node returns node that should be checked for not being followed by whitespace.private boolean
EmptyLineSeparatorCheck. hasEmptyLineAfter(DetailAST token)
Checks if token have empty line after.private boolean
EmptyLineSeparatorCheck. hasEmptyLineBefore(DetailAST token)
Checks if a token has an empty line before.private boolean
EmptyLineSeparatorCheck. hasMultipleLinesBefore(DetailAST ast)
Whether the token has not allowed multiple empty lines before.private boolean
EmptyLineSeparatorCheck. hasNotAllowedTwoEmptyLinesBefore(DetailAST token)
Checks if a token has empty two previous lines and multiple empty lines is not allowed.private static boolean
ParenPadCheck. hasPrecedingSemiColon(DetailAST ast)
Checks that a token is preceded by a semicolon.private boolean
NoWhitespaceAfterCheck. hasTrailingWhitespace(DetailAST ast, int whitespaceColumnNo, int whitespaceLineNo)
Checks if there is unwanted whitespace after the visited node.private boolean
ParenPadCheck. isAcceptableToken(DetailAST ast)
Checks whether AcceptableTokens contains the given ast.private static boolean
GenericWhitespaceCheck. isAfterMethodReference(DetailAST genericEnd)
Checks if current generic end ('>') is located aftermethod reference operator
.private static boolean
OperatorWrapCheck. isAssignToVariable(DetailAST node)
Checks if a node isTokenTypes.ASSIGN
to a variable or resource.private static boolean
OperatorWrapCheck. isColonFromLabel(DetailAST node)
Checks if a node isTokenTypes.COLON
from a label, switch case of default.private boolean
EmptyLineSeparatorCheck. isCommentInBeginningOfLine(DetailAST comment)
Check if token is comment, which starting in beginning of line.private boolean
WhitespaceAroundCheck. isEmptyBlock(DetailAST ast, int parentType)
Is empty block.private static boolean
WhitespaceAroundCheck. isEmptyBlock(DetailAST ast, int parentType, int match)
Tests if a givenDetailAST
is part of an empty block.private boolean
WhitespaceAroundCheck. isEmptyCatch(DetailAST ast, int parentType)
Tests if the givenDetailAst
is part of an allowed empty catch block.private boolean
WhitespaceAroundCheck. isEmptyCtorBlockCheckedFromRcurly(DetailAST ast)
Test if the givenDetailAST
is part of an allowed empty constructor (ctor) block checked from RCURLY.private boolean
WhitespaceAroundCheck. isEmptyCtorBlockCheckedFromSlist(DetailAST ast)
Test if the givenDetailAST
is a part of an allowed empty constructor checked from SLIST token.private boolean
WhitespaceAroundCheck. isEmptyLambda(DetailAST ast, int parentType)
Test if the givenDetailAST
is part of an allowed empty lambda block.private boolean
WhitespaceAroundCheck. isEmptyLoop(DetailAST ast, int parentType)
Checks if loop is empty.private boolean
WhitespaceAroundCheck. isEmptyMethodBlock(DetailAST ast, int parentType)
Test if the givenDetailAST
is part of an allowed empty method block.private boolean
WhitespaceAroundCheck. isEmptySwitchBlockStatement(DetailAST ast)
Tests if the givenDetailAst
is part of an allowed empty switch case or default block.private static boolean
WhitespaceAroundCheck. isEmptyType(DetailAST ast)
Test if the givenDetailAST
is part of an empty block.private static boolean
OperatorWrapCheck. isEndOfLineModeViolation(DetailAST ast)
Checks whether operator violatesWrapOption.EOL
mode.private static boolean
WhitespaceAfterCheck. isFollowedByWhitespace(DetailAST targetAST, int... line)
Checks whether token is followed by a whitespace.private static boolean
ParenPadCheck. isFollowsEmptyForIterator(DetailAST ast)
Checks that a token follows an empty for iterator.private static boolean
GenericWhitespaceCheck. isGenericAfterNew(DetailAST ast)
Checks if generic is afterLITERAL_NEW
.private static boolean
GenericWhitespaceCheck. isGenericBeforeCtorInvocation(DetailAST ast)
Checks if generic is before constructor invocation.private static boolean
GenericWhitespaceCheck. isGenericBeforeMethod(DetailAST ast)
Is generic before method reference.private static boolean
GenericWhitespaceCheck. isGenericBeforeRecordHeader(DetailAST ast)
Checks if generic is before record header.private static boolean
NoWhitespaceBeforeCheck. isInEmptyForInitializerOrCondition(DetailAST semicolonAst)
Checks that semicolon is in empty for initializer or condition.private static boolean
OperatorWrapCheck. isInPatternDefinition(DetailAST node)
Ascends AST to determine if given node is part of a pattern definition.private static boolean
NoWhitespaceBeforeCaseDefaultColonCheck. isInSwitch(DetailAST colonAst)
Checks if the colon is inside a switch block.private static boolean
ParenPadCheck. isInTypecast(DetailAST ast)
Checks whetherTokenTypes.RPAREN
is a closing paren of aTokenTypes.TYPECAST
.private static boolean
EmptyLineSeparatorCheck. isLineEmptyAfterPackage(DetailAST ast)
Checks if there is another element at next line of package declaration.private static boolean
OperatorWrapCheck. isNewLineModeViolation(DetailAST ast)
Checks whether operator violatesWrapOption.NL
mode.private boolean
WhitespaceAroundCheck. isNotRelevantSituation(DetailAST ast, int currentType)
Is ast not a target of Check.private static boolean
NoWhitespaceBeforeCaseDefaultColonCheck. isOnDifferentLineWithPreviousToken(DetailAST colonAst)
Checks if the colon is on same line as of case or default.private static boolean
WhitespaceAroundCheck. isPartOfDoubleBraceInitializerForNextToken(DetailAST ast)
Check if given ast is part of double brace initializer and if it should omit checking if next token is separated by whitespace.private static boolean
WhitespaceAroundCheck. isPartOfDoubleBraceInitializerForPreviousToken(DetailAST ast)
Check if given ast is part of double brace initializer and if it should omit checking if previous token is separated by whitespace.private static boolean
EmptyLineSeparatorCheck. isPrecededByJavadoc(DetailAST token)
Check if token is preceded by javadoc comment.private static boolean
ParenPadCheck. isPrecedingEmptyForInit(DetailAST ast)
Checks that a token precedes an empty for initializer.private boolean
EmptyLineSeparatorCheck. isPrePreviousLineEmpty(DetailAST token)
Checks if a token has empty pre-previous line.private static boolean
OperatorWrapCheck. isTargetNode(DetailAST node)
Filters some false tokens that this check should ignore.private static boolean
EmptyLineSeparatorCheck. isTypeField(DetailAST variableDef)
If variable definition is a type field.private boolean
EmptyLineSeparatorCheck. isViolatingEmptyLineBetweenFieldsPolicy(DetailAST detailAST)
Checks whether token placement violates policy of empty line between fields.private static boolean
NoWhitespaceBeforeCaseDefaultColonCheck. isWhiteSpaceBeforeColon(DetailAST colonAst)
Checks if there is a whitespace before the colon of a switch case or switch default.private static boolean
NoWhitespaceBeforeCaseDefaultColonCheck. isWhitespaceBeforeColonOfCase(DetailAST colonAst)
Checks if there is a whitespace before the colon of a switch case.private static boolean
NoWhitespaceBeforeCaseDefaultColonCheck. isWhitespaceBeforeColonOfDefault(DetailAST colonAst)
Checks if there is a whitespace before the colon of a switch default.private void
GenericWhitespaceCheck. processEnd(DetailAST ast)
Checks the token for the end of Generics.private void
ParenPadCheck. processExpression(DetailAST ast)
private void
EmptyLineSeparatorCheck. processImport(DetailAST ast, DetailAST nextToken)
Process Import.protected void
AbstractParenPadCheck. processLeft(DetailAST ast)
Process a token representing a left parentheses.private void
EmptyLineSeparatorCheck. processMultipleLinesInside(DetailAST ast)
Log violation in case there are multiple empty lines inside constructor, initialization block or method.private void
GenericWhitespaceCheck. processNestedGenerics(DetailAST ast, int[] line, int after)
Process Nested generics.private void
EmptyLineSeparatorCheck. processPackage(DetailAST ast, DetailAST nextToken)
Process Package.protected void
AbstractParenPadCheck. processRight(DetailAST ast)
Process a token representing a right parentheses.private void
GenericWhitespaceCheck. processSingleGeneric(DetailAST ast, int[] line, int after)
Process Single-generic.private void
GenericWhitespaceCheck. processStart(DetailAST ast)
Checks the token for the start of Generics.private void
EmptyLineSeparatorCheck. processVariableDef(DetailAST ast, DetailAST nextToken)
Process Variable.private boolean
WhitespaceAroundCheck. shouldCheckSeparationFromNextToken(DetailAST ast, char nextChar)
Check if it should be checked if next token is separated from current by whitespace.private static boolean
WhitespaceAroundCheck. shouldCheckSeparationFromPreviousToken(DetailAST ast)
Check if it should be checked if previous token is separated from current by whitespace.private static boolean
NoWhitespaceAfterCheck. shouldCheckWhitespaceAfter(DetailAST ast)
Returns whether whitespace after a visited node should be checked.private void
SingleSpaceSeparatorCheck. visitEachToken(DetailAST node)
Examines every sibling and child ofnode
for violations.private void
ParenPadCheck. visitLiteralFor(DetailAST ast)
Checks parens inTokenTypes.LITERAL_FOR
.private void
ParenPadCheck. visitResourceSpecification(DetailAST ast)
Checks parens inTokenTypes.RESOURCE_SPECIFICATION
.void
EmptyForInitializerPadCheck. visitToken(DetailAST ast)
void
EmptyForIteratorPadCheck. visitToken(DetailAST ast)
void
EmptyLineSeparatorCheck. visitToken(DetailAST ast)
void
GenericWhitespaceCheck. visitToken(DetailAST ast)
void
MethodParamPadCheck. visitToken(DetailAST ast)
void
NoLineWrapCheck. visitToken(DetailAST ast)
void
NoWhitespaceAfterCheck. visitToken(DetailAST ast)
void
NoWhitespaceBeforeCaseDefaultColonCheck. visitToken(DetailAST ast)
void
NoWhitespaceBeforeCheck. visitToken(DetailAST ast)
void
OperatorWrapCheck. visitToken(DetailAST ast)
void
ParenPadCheck. visitToken(DetailAST ast)
void
SeparatorWrapCheck. visitToken(DetailAST ast)
void
TypecastParenPadCheck. visitToken(DetailAST ast)
void
WhitespaceAfterCheck. visitToken(DetailAST ast)
void
WhitespaceAroundCheck. visitToken(DetailAST ast)
private void
ParenPadCheck. visitTokenWithOptionalParentheses(DetailAST ast)
Checks parens in token which may not contain parens, e.g.Method parameters in com.puppycrawl.tools.checkstyle.checks.whitespace with type arguments of type DetailAST Modifier and Type Method Description private static DetailAST
OperatorWrapCheck. adjustParens(DetailAST node, UnaryOperator<DetailAST> step)
Finds matching parentheses among siblings. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.gui
Fields in com.puppycrawl.tools.checkstyle.gui declared as DetailAST Modifier and Type Field Description private DetailAST
ParseTreeTablePresentation. root
The root node of the tree table model.Fields in com.puppycrawl.tools.checkstyle.gui with type parameters of type DetailAST Modifier and Type Field Description private Map<DetailAST,DetailNode>
ParseTreeTablePresentation. blockCommentToJavadocTree
Cache to store already parsed Javadoc comments.Methods in com.puppycrawl.tools.checkstyle.gui with parameters of type DetailAST Modifier and Type Method Description private void
TreeTable. expandTreeTableByPath(DetailAST node)
Expands path in tree table to given node so that user can see the node.private int
CodeSelectorPresentation. findLastPosition(DetailAST astNode)
Finds the last position of node without children.private void
CodeSelectorPresentation. findSelectionPositions(DetailAST ast)
Find start and end selection positions from AST line and Column.private Object
ParseTreeTablePresentation. getChildAtDetailAst(DetailAST parent, int index)
Gets child of DetailAST node at specified index.private DetailNode
ParseTreeTablePresentation. getJavadocTree(DetailAST blockComment)
Gets Javadoc (DetailNode) tree of specified block comments.private static Object
ParseTreeTablePresentation. getValueAtDetailAST(DetailAST ast, int column)
Gets a value for DetailAST object.private static DetailNode
ParseTreeTablePresentation. parseJavadocTree(DetailAST blockComment)
Parses Javadoc (DetailNode) tree of specified block comments.protected void
ParseTreeTableModel. setParseTree(DetailAST parseTree)
Sets parse tree.protected void
ParseTreeTablePresentation. setRoot(DetailAST parseTree)
Set parse tree.Method parameters in com.puppycrawl.tools.checkstyle.gui with type arguments of type DetailAST Modifier and Type Method Description private static String
TreeTable. getAllMatchingXpathQueriesText(Deque<DetailAST> nodes)
Generates a String with all matching XPath queries separated by newlines.private void
TreeTable. updateTreeTable(String xpath, Deque<DetailAST> nodes)
Updates the Treetable by expanding paths in the tree and highlighting associated code.Constructors in com.puppycrawl.tools.checkstyle.gui with parameters of type DetailAST Constructor Description CodeSelectorPresentation(DetailAST ast, List<Integer> lines2position)
Constructor.ParseTreeTableModel(DetailAST parseTree)
Initialise pModel.ParseTreeTablePresentation(DetailAST parseTree)
Constructor initialise root node. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.meta
Methods in com.puppycrawl.tools.checkstyle.meta that return DetailAST Modifier and Type Method Description private static DetailAST
JavadocMetadataScraper. getParent(DetailAST commentBlock)
Returns parent node, removing modifier/annotation nodes.Methods in com.puppycrawl.tools.checkstyle.meta with parameters of type DetailAST Modifier and Type Method Description private static DetailAST
JavadocMetadataScraper. getParent(DetailAST commentBlock)
Returns parent node, removing modifier/annotation nodes. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.site
Methods in com.puppycrawl.tools.checkstyle.site that return DetailAST Modifier and Type Method Description private static DetailAST
ClassAndPropertiesSettersJavadocScraper. getParentAst(DetailAST ast, int type)
Get the parent node of the given type.Methods in com.puppycrawl.tools.checkstyle.site with parameters of type DetailAST Modifier and Type Method Description private static DetailAST
ClassAndPropertiesSettersJavadocScraper. getParentAst(DetailAST ast, int type)
Get the parent node of the given type.private static boolean
ClassAndPropertiesSettersJavadocScraper. isMethodOfScrapedModule(DetailAST methodDef)
Checks if the given method is a method of the module being scraped.private static boolean
ClassAndPropertiesSettersJavadocScraper. isSetterMethod(DetailAST ast)
Returns whether an AST represents a setter method. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.utils
Methods in com.puppycrawl.tools.checkstyle.utils that return DetailAST Modifier and Type Method Description static DetailAST
ParserUtil. createBlockCommentNode(String content)
Create block comment from string content.static DetailAST
ParserUtil. createBlockCommentNode(org.antlr.v4.runtime.CommonToken token)
Create block comment from token.private static DetailAST
AnnotationUtil. findFirstAnnotation(DetailAST ast, Predicate<DetailAST> predicate)
Checks if the given AST is annotated with at least one annotation that matches the given predicate and returns the AST representing the first matching annotation.static DetailAST
AnnotationUtil. getAnnotation(DetailAST ast, String annotation)
Checks if the AST is annotated with the passed in annotation and returns the AST representing that annotation.static DetailAST
AnnotationUtil. getAnnotationHolder(DetailAST ast)
Gets the AST that holds a series of annotations for the potentially annotated AST.static DetailAST
CheckUtil. getFirstNode(DetailAST node)
Finds sub-node for given node minimal (line, column) pair.private static DetailAST
BlockCommentPosition. getNextSiblingSkipComments(DetailAST node)
Get next sibling node skipping any comment nodes.private static DetailAST
BlockCommentPosition. getPrevSiblingSkipComments(DetailAST node)
Get previous sibling node skipping any comments.Methods in com.puppycrawl.tools.checkstyle.utils that return types with arguments of type DetailAST Modifier and Type Method Description static Optional<DetailAST>
TokenUtil. findFirstTokenByPredicate(DetailAST root, Predicate<DetailAST> predicate)
static List<DetailAST>
CheckUtil. getTypeParameters(DetailAST node)
Retrieves the type parameters to the node.Methods in com.puppycrawl.tools.checkstyle.utils with parameters of type DetailAST Modifier and Type Method Description static boolean
TokenUtil. areOnSameLine(DetailAST ast1, DetailAST ast2)
Determines if two ASTs are on the same line.static boolean
AnnotationUtil. containsAnnotation(DetailAST ast)
Checks if the AST is annotated with any annotation.static boolean
AnnotationUtil. containsAnnotation(DetailAST ast, String annotation)
Checks if the AST is annotated with the passed in annotation.static boolean
AnnotationUtil. containsAnnotation(DetailAST ast, Set<String> annotations)
Checks if the given AST element is annotated with any of the specified annotations.static List<AbstractNode>
XpathUtil. createChildren(AbstractNode root, AbstractNode parent, DetailAST firstChild)
Iterates siblings of the given node and creates new Xpath-nodes.static String
CheckUtil. extractQualifiedName(DetailAST ast)
Get name of package and super class of anon inner class by concatenating the identifier values underTokenTypes.DOT
.private static DetailAST
AnnotationUtil. findFirstAnnotation(DetailAST ast, Predicate<DetailAST> predicate)
Checks if the given AST is annotated with at least one annotation that matches the given predicate and returns the AST representing the first matching annotation.static Optional<DetailAST>
TokenUtil. findFirstTokenByPredicate(DetailAST root, Predicate<DetailAST> predicate)
static void
TokenUtil. forEachChild(DetailAST root, int type, Consumer<DetailAST> action)
Performs an action for each child ofDetailAST
root node which matches the given token type.static AccessModifierOption
CheckUtil. getAccessModifierFromModifiersToken(DetailAST ast)
Returns the access modifier of the method/constructor at the specified AST.private static AccessModifierOption
CheckUtil. getAccessModifierFromModifiersTokenDirectly(DetailAST modifiersToken)
ReturnsAccessModifierOption
based on the information about access modifier taken from the given token of typeTokenTypes.MODIFIERS
.static DetailAST
AnnotationUtil. getAnnotation(DetailAST ast, String annotation)
Checks if the AST is annotated with the passed in annotation and returns the AST representing that annotation.private static String
AnnotationUtil. getAnnotationFullIdent(DetailAST annotationNode)
Gets the full ident text of the annotation AST.static DetailAST
AnnotationUtil. getAnnotationHolder(DetailAST ast)
Gets the AST that holds a series of annotations for the potentially annotated AST.static String
JavadocUtil. getBlockCommentContent(DetailAST blockCommentBegin)
Gets content of block comment.static Scope
ScopeUtil. getDeclaredScopeFromMods(DetailAST aMods)
Returns theScope
explicitly specified by the modifier set.private static Scope
ScopeUtil. getDefaultScope(DetailAST ast)
Returns the defaultScope
for aDetailAST
.static DetailAST
CheckUtil. getFirstNode(DetailAST node)
Finds sub-node for given node minimal (line, column) pair.static String
JavadocUtil. getJavadocCommentContent(DetailAST javadocCommentBegin)
Get content of Javadoc comment.private static DetailAST
BlockCommentPosition. getNextSiblingSkipComments(DetailAST node)
Get next sibling node skipping any comment nodes.private static DetailAST
BlockCommentPosition. getPrevSiblingSkipComments(DetailAST node)
Get previous sibling node skipping any comments.static Scope
ScopeUtil. getScope(DetailAST ast)
Returns theScope
for a givenDetailAST
.static Scope
ScopeUtil. getScopeFromMods(DetailAST aMods)
Returns theScope
specified by the modifier set.static String
CheckUtil. getShortNameOfAnonInnerClass(DetailAST literalNewAst)
Get the short name of super class of anonymous inner class.static AccessModifierOption
CheckUtil. getSurroundingAccessModifier(DetailAST node)
Returns the access modifier of the surrounding "block".static Scope
ScopeUtil. getSurroundingScope(DetailAST node)
Returns the scope of the surrounding "block".static String
XpathUtil. getTextAttributeValue(DetailAST ast)
Returns content of the text attribute of the ast element.static List<String>
CheckUtil. getTypeParameterNames(DetailAST node)
Retrieves the names of the type parameters to the node.static List<DetailAST>
CheckUtil. getTypeParameters(DetailAST node)
Retrieves the type parameters to the node.static boolean
AnnotationUtil. hasOverrideAnnotation(DetailAST ast)
Checks if the AST is annotated withOverride
orjava.lang.Override
annotation.static boolean
CheckUtil. isBeforeInSource(DetailAST ast1, DetailAST ast2)
Retrieves whether ast1 is located before ast2.static boolean
ScopeUtil. isClassFieldDef(DetailAST node)
Determines whether a node is a class field definition.static boolean
JavadocUtil. isCorrectJavadocPosition(DetailAST blockComment)
Checks Javadoc comment it's in right place.static boolean
CheckUtil. isEqualsMethod(DetailAST ast)
Tests whether a method definition AST defines an equals covariant.static boolean
ScopeUtil. isInAnnotationBlock(DetailAST node)
Returns whether a node is directly contained within an annotation block.private static boolean
ScopeUtil. isInBlockOf(DetailAST node, int tokenType)
Returns whether a node is directly contained within a specified block.static boolean
ScopeUtil. isInClassBlock(DetailAST node)
Returns whether a node is directly contained within a class block.static boolean
ScopeUtil. isInCodeBlock(DetailAST node)
Returns whether the scope of a node is restricted to a code block.static boolean
ScopeUtil. isInEnumBlock(DetailAST node)
Returns whether a node is directly contained within an enum block.static boolean
ScopeUtil. isInInterfaceBlock(DetailAST node)
Returns whether a node is directly contained within an interface block.static boolean
ScopeUtil. isInInterfaceOrAnnotationBlock(DetailAST node)
Returns whether a node is directly contained within an interface or annotation block.static boolean
ScopeUtil. isInRecordBlock(DetailAST node)
Returns whether a node is directly contained within a record block.static boolean
ScopeUtil. isInScope(DetailAST ast, Scope scope)
Checks whether ast node is in a specific scope.static boolean
JavadocUtil. isJavadocComment(DetailAST blockCommentBegin)
Checks block comment content starts with '*' javadoc comment identifier.static boolean
ScopeUtil. isLocalVariableDef(DetailAST node)
Determines whether a node is a local variable definition.static boolean
CheckUtil. isNonVoidMethod(DetailAST methodDefAst)
Checks whether a method is a not void one.static boolean
TokenUtil. isOfType(DetailAST ast, int... types)
Determines if the AST belongs to the given types.static boolean
BlockCommentPosition. isOnAnnotationDef(DetailAST blockComment)
Node is on annotation definition.static boolean
BlockCommentPosition. isOnAnnotationField(DetailAST blockComment)
Node is on annotation field declaration.static boolean
BlockCommentPosition. isOnClass(DetailAST blockComment)
Node is on class definition.static boolean
BlockCommentPosition. isOnCompactConstructor(DetailAST blockComment)
Node is on compact constructor, note that we don't need to check for a plain token here, since a compact constructor must be public.static boolean
BlockCommentPosition. isOnConstructor(DetailAST blockComment)
Node is on constructor.static boolean
BlockCommentPosition. isOnEnum(DetailAST blockComment)
Node is on enum definition.static boolean
BlockCommentPosition. isOnEnumConstant(DetailAST blockComment)
Node is on enum constant.static boolean
BlockCommentPosition. isOnField(DetailAST blockComment)
Node is on field declaration.static boolean
BlockCommentPosition. isOnInterface(DetailAST blockComment)
Node is on interface definition.static boolean
BlockCommentPosition. isOnMember(DetailAST blockComment)
Node is on type member declaration.static boolean
BlockCommentPosition. isOnMethod(DetailAST blockComment)
Node is on method declaration.static boolean
BlockCommentPosition. isOnPackage(DetailAST blockComment)
Node is on package definition.private static boolean
BlockCommentPosition. isOnPlainClassMember(DetailAST blockComment)
Checks that block comment is on specified class member without any modifiers.private static boolean
BlockCommentPosition. isOnPlainToken(DetailAST blockComment, int parentTokenType, int nextTokenType)
Checks that block comment is on specified token without any modifiers.static boolean
BlockCommentPosition. isOnRecord(DetailAST blockComment)
Node is on record definition.private static boolean
BlockCommentPosition. isOnTokenWithAnnotation(DetailAST blockComment, int tokenType)
Checks that block comment is on specified token with annotation.private static boolean
BlockCommentPosition. isOnTokenWithModifiers(DetailAST blockComment, int tokenType)
Checks that block comment is on specified token with modifiers.static boolean
BlockCommentPosition. isOnType(DetailAST blockComment)
Node is on type definition.static boolean
ScopeUtil. isOuterMostType(DetailAST node)
Returns whether a node is contained in the outermost type block.static boolean
CheckUtil. isReceiverParameter(DetailAST parameterDefAst)
Checks whether a parameter is a receiver.static boolean
TokenUtil. isRootNode(DetailAST ast)
Determines if given AST is a root node, i.e. if the type of the token we are checking isCOMPILATION_UNIT
.static boolean
XpathUtil. supportsTextAttribute(DetailAST ast)
Checks, if specified node can have@text
attribute.Method parameters in com.puppycrawl.tools.checkstyle.utils with type arguments of type DetailAST Modifier and Type Method Description private static DetailAST
AnnotationUtil. findFirstAnnotation(DetailAST ast, Predicate<DetailAST> predicate)
Checks if the given AST is annotated with at least one annotation that matches the given predicate and returns the AST representing the first matching annotation.static Optional<DetailAST>
TokenUtil. findFirstTokenByPredicate(DetailAST root, Predicate<DetailAST> predicate)
static void
TokenUtil. forEachChild(DetailAST root, int type, Consumer<DetailAST> action)
Performs an action for each child ofDetailAST
root node which matches the given token type. -
Uses of DetailAST in com.puppycrawl.tools.checkstyle.xpath
Fields in com.puppycrawl.tools.checkstyle.xpath declared as DetailAST Modifier and Type Field Description private DetailAST
ElementNode. detailAst
The ast node.private DetailAST
RootNode. detailAst
The ast node.private DetailAST
XpathQueryGenerator. rootAst
The root ast.Methods in com.puppycrawl.tools.checkstyle.xpath that return DetailAST Modifier and Type Method Description private static DetailAST
XpathQueryGenerator. findChildWithTextAttribute(DetailAST root)
Returns childDetailAst
element of the given root, which has text attribute.private static DetailAST
XpathQueryGenerator. findChildWithTextAttributeRecursively(DetailAST root)
Returns childDetailAst
element of the given root, which has text attribute.DetailAST
ElementNode. getUnderlyingNode()
Returns underlying node.DetailAST
RootNode. getUnderlyingNode()
Returns underlying node.Methods in com.puppycrawl.tools.checkstyle.xpath that return types with arguments of type DetailAST Modifier and Type Method Description private List<DetailAST>
XpathQueryGenerator. getMatchingAstElements()
Returns list of nodes matching defined line number, column number and token type.Methods in com.puppycrawl.tools.checkstyle.xpath with parameters of type DetailAST Modifier and Type Method Description private int
XpathQueryGenerator. expandedTabColumn(DetailAST ast)
Returns the column number with tabs expanded.private static DetailAST
XpathQueryGenerator. findChildWithTextAttribute(DetailAST root)
Returns childDetailAst
element of the given root, which has text attribute.private static DetailAST
XpathQueryGenerator. findChildWithTextAttributeRecursively(DetailAST root)
Returns childDetailAst
element of the given root, which has text attribute.private static int
XpathQueryGenerator. findPositionAmongSiblings(DetailAST ast)
Finds position of the ast element among siblings.static String
XpathQueryGenerator. generateXpathQuery(DetailAST ast)
Returns full xpath query for given ast element.private static String
XpathQueryGenerator. getXpathQuery(DetailAST root, DetailAST ast)
Returns relative xpath query for given ast element from root.private static boolean
XpathQueryGenerator. hasAtLeastOneSiblingWithSameTokenType(DetailAST ast)
Checks if the given ast element has uniqueTokenTypes
among siblings.private boolean
XpathQueryGenerator. isMatchingByLineAndColumnAndTokenType(DetailAST ast)
Checks if the givenDetailAST
node is matching line number, column number and token type.private static boolean
XpathQueryGenerator. isXpathQueryForNodeIsAccurateEnough(DetailAST ast)
Checks if ast element has all requirements to have unique xpath query.Constructors in com.puppycrawl.tools.checkstyle.xpath with parameters of type DetailAST Constructor Description ElementNode(AbstractNode root, AbstractNode parent, DetailAST detailAst, int depth, int indexAmongSiblings)
Creates a newElementNode
instance.RootNode(DetailAST detailAst)
Creates a newRootNode
instance.XpathQueryGenerator(DetailAST rootAst, int lineNumber, int columnNumber, int tokenType, FileText fileText, int tabWidth)
Creates a newXpathQueryGenerator
instance.XpathQueryGenerator(DetailAST rootAst, int lineNumber, int columnNumber, FileText fileText, int tabWidth)
Creates a newXpathQueryGenerator
instance.
-