public class RightCurlyCheck extends AbstractCheck
Checks the placement of right curly braces (''}) for code blocks. This check supports
if-else, try-catch-finally blocks, while-loops, for-loops,
method definitions, class definitions, constructor definitions,
instance, static initialization blocks, annotation definitions and enum definitions.
For right curly brace of expression blocks please follow issue
#5945.
option - Specify the policy on placement of a right curly brace
('}').
Default value is same.
tokens - tokens to check
Default value is:
LITERAL_TRY,
LITERAL_CATCH,
LITERAL_FINALLY,
LITERAL_IF,
LITERAL_ELSE.
To configure the check:
<module name="RightCurly"/>
To configure the check with policy alone for else and
METHOD_DEF tokens:
<module name="RightCurly"> <property name="option" value="alone"/> <property name="tokens" value="LITERAL_ELSE, METHOD_DEF"/> </module>
AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
MSG_KEY_LINE_ALONE
A key is pointing to the warning message text in "messages.properties"
file.
|
static java.lang.String |
MSG_KEY_LINE_BREAK_BEFORE
A key is pointing to the warning message text in "messages.properties"
file.
|
static java.lang.String |
MSG_KEY_LINE_SAME
A key is pointing to the warning message text in "messages.properties"
file.
|
| Constructor and Description |
|---|
RightCurlyCheck() |
| Modifier and Type | Method and Description |
|---|---|
int[] |
getAcceptableTokens()
The configurable token set.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
void |
setOption(java.lang.String optionStr)
Setter to specify the policy on placement of a right curly brace (
'}'). |
void |
visitToken(DetailAST ast)
Called to process a token.
|
beginTree, clearMessages, destroy, finishTree, getFileContents, getLine, getLines, getMessages, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, log, setFileContents, setTabWidth, setTokensfinishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityconfigure, contextualize, getConfiguration, setupChildpublic static final java.lang.String MSG_KEY_LINE_BREAK_BEFORE
public static final java.lang.String MSG_KEY_LINE_ALONE
public static final java.lang.String MSG_KEY_LINE_SAME
public RightCurlyCheck()
public void setOption(java.lang.String optionStr)
'}').optionStr - string to decode option fromjava.lang.IllegalArgumentException - if unable to decodepublic int[] getDefaultTokens()
AbstractCheckgetDefaultTokens in class AbstractCheckTokenTypespublic int[] getAcceptableTokens()
AbstractCheckgetAcceptableTokens in class AbstractCheckTokenTypespublic int[] getRequiredTokens()
AbstractCheckgetRequiredTokens in class AbstractCheckTokenTypespublic void visitToken(DetailAST ast)
AbstractCheckvisitToken in class AbstractCheckast - the token to processCopyright © 2001-2020. All Rights Reserved.