Class LostInstanceCheck
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.api.AutomaticBean
-
- com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
-
- com.puppycrawl.tools.checkstyle.api.AbstractCheck
-
- com.thomasjensen.checkstyle.addons.checks.AbstractAddonsCheck
-
- com.thomasjensen.checkstyle.addons.checks.coding.LostInstanceCheck
-
- All Implemented Interfaces:
Configurable
,Contextualizable
public class LostInstanceCheck extends AbstractAddonsCheck
Checks that object instances created explicitly withnew
are actually used for something. Just being assigned to a variable or passed as a parameter is enough. A full data flow analysis is not performed.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
AutomaticBean.OutputStreamOptions
-
-
Constructor Summary
Constructors Constructor Description LostInstanceCheck()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<Integer>
getRelevantTokens()
The tokens which this check is interested in.void
init()
void
visitToken(BinaryName pBinaryClassName, DetailAST pAst)
Called to process a token.-
Methods inherited from class com.thomasjensen.checkstyle.addons.checks.AbstractAddonsCheck
beginTree, finishTree, finishTree, getAcceptableTokens, getApiFixer, getClassDeclarationPosition, getCurrentBinaryName, getCurrentSimpleName, getDefaultTokens, getMyPackage, getRequiredTokens, leaveKnownType, leaveToken, leaveToken, visitKnownType, visitToken
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractCheck
clearViolations, destroy, getLine, getLineCodePoints, getLines, getTabWidth, getTokenNames, getViolations, isCommentNodesRequired, log, log, log, setFileContents, setTabWidth, setTokens
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
finishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverity
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, getConfiguration, setupChild
-
-
-
-
Method Detail
-
init
public void init()
- Overrides:
init
in classAbstractCheck
-
getRelevantTokens
public Set<Integer> getRelevantTokens()
Description copied from class:AbstractAddonsCheck
The tokens which this check is interested in. Will be added to the tokens of the base class.- Specified by:
getRelevantTokens
in classAbstractAddonsCheck
- Returns:
- the relevant tokens
-
visitToken
public void visitToken(@Nullable BinaryName pBinaryClassName, @Nonnull DetailAST pAst)
Description copied from class:AbstractAddonsCheck
Called to process a token.- Overrides:
visitToken
in classAbstractAddonsCheck
- Parameters:
pBinaryClassName
- the currently active binary class namepAst
- the token to process
-
-