com.puppycrawl.tools.checkstyle.checks.coding
public class HiddenFieldCheck extends Check
Checks that a local variable or a parameter does not shadow a field that is defined in the same class.
An example of how to configure the check is:
<module name="HiddenField"/>
An example of how to configure the check so that it checks variables but not parameters is:
<module name="HiddenField"> <property name="tokens" value="VARIABLE_DEF"/> </module>
An example of how to configure the check so that it ignores the parameter of a setter method is:
<module name="HiddenField"> <property name="ignoreSetter" value="true"/> </module>
An example of how to configure the check so that it ignores constructor parameters is:
<module name="HiddenField"> <property name="ignoreConstructorParameter" value="true"/> </module>
Version: 1.0
Method Summary | |
---|---|
void | beginTree(DetailAST aRootAST) {@inheritDoc} |
int[] | getAcceptableTokens() {@inheritDoc} |
int[] | getDefaultTokens() {@inheritDoc} |
Pattern | getRegexp() |
int[] | getRequiredTokens() {@inheritDoc} |
void | leaveToken(DetailAST aAST) {@inheritDoc} |
void | setIgnoreAbstractMethods(boolean aIgnoreAbstractMethods)
Set whether to ignore parameters of abstract methods. |
void | setIgnoreConstructorParameter(boolean aIgnoreConstructorParameter)
Set whether to ignore constructor parameters. |
void | setIgnoreFormat(String aFormat)
Set the ignore format to the specified regular expression. |
void | setIgnoreSetter(boolean aIgnoreSetter)
Set whether to ignore the parameter of a property setter method. |
void | visitToken(DetailAST aAST) {@inheritDoc} |
Returns: the regexp to match against
Parameters: aIgnoreAbstractMethods decide whether to ignore parameters of abstract methods.
Parameters: aIgnoreConstructorParameter decide whether to ignore constructor parameters.
Parameters: aFormat a String
value
Throws: ConversionException unable to parse aFormat
Parameters: aIgnoreSetter decide whether to ignore the parameter of a property setter method.