Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
com.puppycrawl.tools.checkstyle.api.AutomaticBean
com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
com.puppycrawl.tools.checkstyle.api.Check
com.puppycrawl.tools.checkstyle.checks.DeclarationCollector
com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck
public class RequireThisCheck
extends DeclarationCollector
<module name="RequireThis"/>An example of how to configure to check
this
qualifier for
methods only:
<module name="RequireThis"> <property name="checkFields" value="false"/> <property name="checkMethods" value="true"/> </module>Limitations: I'm not currently doing anything about static variables or catch-blocks. Static methods invoked on a class name seem to be OK; both the class name and the method name have a DOT parent. Non-static methods invoked on either this or a variable name seem to be OK, likewise. Much of the code for this check was cribbed from Rick Giles's
HiddenFieldCheck
.
Constructor Summary | |
|
Method Summary | |
boolean | |
boolean | |
int[] | |
int[] | |
void |
|
void |
|
void |
|
Methods inherited from class com.puppycrawl.tools.checkstyle.checks.DeclarationCollector | |
beginTree , isClassField , isDeclared , leaveToken , visitToken |
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 |
public boolean getCheckFields()
- Returns:
- true if we should check fields usage false overwise.
public boolean getCheckMethods()
- Returns:
- true if we should check methods usage false overwise.
public void setCheckFields(boolean aCheckFields)
Setter for checkFields property.
- Parameters:
aCheckFields
- should we check fields usage or not.
public void setCheckMethods(boolean aCheckMethods)
Setter for checkMethods property.
- Parameters:
aCheckMethods
- should we check methods usage or not.
public void visitToken(DetailAST aAST)
- Overrides:
- visitToken in interface DeclarationCollector
Back to the Checkstyle Home Page |