public class CovariantEqualsCheck extends AbstractCheck
Checks that if a class defines a covariant method equals, then it defines method equals(java.lang.Object). Inspired by findbugs, http://findbugs.sourceforge.net/bugDescriptions.html#EQ_SELF_NO_OBJECT
An example of how to configure the check is:
<module name="CovariantEquals"/>
| Modifier and Type | Field and Description |
|---|---|
private java.util.Set<DetailAST> |
equalsMethods
Set of equals method definitions.
|
static java.lang.String |
MSG_KEY
A key is pointing to the warning message text in "messages.properties"
file.
|
| Constructor and Description |
|---|
CovariantEqualsCheck() |
| Modifier and Type | Method and Description |
|---|---|
int[] |
getAcceptableTokens()
The configurable token set.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
private static boolean |
isFirstParameterObject(DetailAST methodDefAst)
Tests whether a method's first parameter is an Object.
|
void |
visitToken(DetailAST ast)
Called to process a token.
|
beginTree, destroy, finishTree, getClassLoader, getFileContents, getLine, getLines, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokensgetCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverityconfigure, contextualize, finishLocalSetup, getConfiguration, setupChildpublic static final java.lang.String MSG_KEY
private final java.util.Set<DetailAST> equalsMethods
public int[] getDefaultTokens()
AbstractCheckgetDefaultTokens in class AbstractCheckTokenTypespublic int[] getRequiredTokens()
AbstractCheckgetRequiredTokens in class AbstractCheckTokenTypespublic int[] getAcceptableTokens()
AbstractCheckgetAcceptableTokens in class AbstractCheckTokenTypespublic void visitToken(DetailAST ast)
AbstractCheckvisitToken in class AbstractCheckast - the token to processprivate static boolean isFirstParameterObject(DetailAST methodDefAst)
methodDefAst - the method definition AST to test.
Precondition: ast is a TokenTypes.METHOD_DEF node.