com.puppycrawl.tools.checkstyle.checks.blocks

Class RightCurlyCheck

Implemented Interfaces:
Configurable, Contextualizable

public class RightCurlyCheck
extends AbstractOptionCheck

Checks the placement of right curly braces. The policy to verify is specified using the RightCurlyOption class and defaults to RightCurlyOption.SAME.

By default the check will check the following tokens: LITERAL_TRY. LITERAL_CATCH, LITERAL_FINALLY. LITERAL_IF, LITERAL_ELSE,

An example of how to configure the check is:

 <module name="RightCurly"/>
 

An example of how to configure the check with policy RightCurlyOption.ALONE for else tokens is:

 <module name="RightCurly">
     <property name="tokens" value="LITERAL_ELSE"/>
     <property name="option" value="alone"/>
 </module>
 
Version:
2.0
Authors:
Oliver Burn
lkuehne
o_sukhodolsky

Constructor Summary

RightCurlyCheck()
Sets the right curly option to same.

Method Summary

int[]
getDefaultTokens()
void
setShouldStartLine(boolean aFlag)
Does the check need to check if rcurly starts line.
void
visitToken(DetailAST aAST)

Methods inherited from class com.puppycrawl.tools.checkstyle.checks.AbstractOptionCheck

getAbstractOption, setOption

Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check

beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens, visitToken

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter

getId, getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, log, log, setId, setSeverity

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean

configure, contextualize, finishLocalSetup, getConfiguration, setupChild

Constructor Details

RightCurlyCheck

public RightCurlyCheck()
Sets the right curly option to same.

Method Details

getDefaultTokens

public int[] getDefaultTokens()
Overrides:
getDefaultTokens in interface Check

setShouldStartLine

public void setShouldStartLine(boolean aFlag)
Does the check need to check if rcurly starts line.
Parameters:
aFlag - new value of this property.

visitToken

public void visitToken(DetailAST aAST)
Overrides:
visitToken in interface Check