Class ReturnCountCheck.Context
java.lang.Object
com.puppycrawl.tools.checkstyle.checks.coding.ReturnCountCheck.Context
- Enclosing class:
- ReturnCountCheck
Class to encapsulate information about one method.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanWhether we should check this method or not.private intCounter for return statements.private booleanIdentifies if context is void.private IntegerMaximum allowed number of return statements. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckCount(DetailAST ast) Checks if number of return statements in the method are more than allowed.voidvisitLiteralReturn(int maxAssigned, Boolean voidReturn) Increase the number of return statements and set context return type.
-
Field Details
-
checking
Whether we should check this method or not. -
count
Counter for return statements. -
maxAllowed
Maximum allowed number of return statements. -
isVoidContext
Identifies if context is void.
-
-
Constructor Details
-
Context
Creates new method context.- Parameters:
checking- should we check this method or not
-
-
Method Details
-
visitLiteralReturn
Increase the number of return statements and set context return type.- Parameters:
maxAssigned- Maximum allowed number of return statements.voidReturn- Identifies if context is void.
-
checkCount
Checks if number of return statements in the method are more than allowed.- Parameters:
ast- method def associated with this context.
-