com.jimischopp.checkstyle
Class WastefulParseNumCheck
java.lang.Object
com.puppycrawl.tools.checkstyle.api.AutomaticBean
com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
com.puppycrawl.tools.checkstyle.api.Check
com.jimischopp.checkstyle.AbstractBaseChecker
com.jimischopp.checkstyle.WastefulParseNumCheck
- All Implemented Interfaces:
- com.puppycrawl.tools.checkstyle.api.Configurable, com.puppycrawl.tools.checkstyle.api.Contextualizable
public class WastefulParseNumCheck
- extends AbstractBaseChecker
Checks for unnecessary wrapper object creation used to parse strings and primitives.
This is a very novice programming mistake that nevertheless occurs. It finds code like:
short s = new Short("5").shortValue();
It also subsequently finds truly creative novice code such as:
int i = new Integer("-" + x).intValue();
and
int i = new Long(-1).intValue();
Copyright 2003, James Schopp
- Since:
- Oct 27, 2003
- Author:
- James Schopp
- See Also:
Check
Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check |
beginTree, destroy, finishTree, getClassLoader, getFileContents, getLines, getTokenNames, init, leaveToken, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens |
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter |
getId, getSeverity, getSeverityLevel, setId, setSeverity |
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean |
configure, contextualize |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WastefulParseNumCheck
public WastefulParseNumCheck()
getDefaultTokens
public int[] getDefaultTokens()
- Specified by:
getDefaultTokens
in class com.puppycrawl.tools.checkstyle.api.Check
getAcceptableTokens
public int[] getAcceptableTokens()
- Overrides:
getAcceptableTokens
in class com.puppycrawl.tools.checkstyle.api.Check
getRequiredTokens
public int[] getRequiredTokens()
- Overrides:
getRequiredTokens
in class com.puppycrawl.tools.checkstyle.api.Check
visitToken
public void visitToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast)
- Overrides:
visitToken
in class com.puppycrawl.tools.checkstyle.api.Check