Checnge some check to use new API (I hate wrapping :)
This commit is contained in:
parent
e029c0077f
commit
db19bd67dc
|
|
@ -80,8 +80,7 @@ public abstract class AbstractNestedDepthCheck extends Check
|
|||
protected final void nestIn(DetailAST aAST, String aMessageId)
|
||||
{
|
||||
if (mDepth > mMax) {
|
||||
log(aAST.getLineNo(), aAST.getColumnNo(), aMessageId,
|
||||
new Integer(mDepth), new Integer(mMax));
|
||||
log(aAST, aMessageId, new Integer(mDepth), new Integer(mMax));
|
||||
}
|
||||
++mDepth;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,27 +90,23 @@ public class ExplicitInitializationCheck extends Check
|
|||
if (isObjectType(type)
|
||||
&& exprStart.getType() == TokenTypes.LITERAL_NULL)
|
||||
{
|
||||
log(ident.getLineNo(), ident.getColumnNo(),
|
||||
"explicit.init", ident.getText(), "null");
|
||||
log(ident, "explicit.init", ident.getText(), "null");
|
||||
}
|
||||
int primitiveType = type.getFirstChild().getType();
|
||||
if (primitiveType == TokenTypes.LITERAL_BOOLEAN
|
||||
&& exprStart.getType() == TokenTypes.LITERAL_FALSE)
|
||||
{
|
||||
log(ident.getLineNo(), ident.getColumnNo(),
|
||||
"explicit.init", ident.getText(), "false");
|
||||
log(ident, "explicit.init", ident.getText(), "false");
|
||||
}
|
||||
if (isNumericType(primitiveType) && isZero(exprStart)) {
|
||||
log(ident.getLineNo(), ident.getColumnNo(),
|
||||
"explicit.init", ident.getText(), "0");
|
||||
log(ident, "explicit.init", ident.getText(), "0");
|
||||
}
|
||||
if (primitiveType == TokenTypes.LITERAL_CHAR
|
||||
&& (isZero(exprStart)
|
||||
|| exprStart.getType() == TokenTypes.CHAR_LITERAL
|
||||
&& "'\\0'".equals(exprStart.getText())))
|
||||
{
|
||||
log(ident.getLineNo(), ident.getColumnNo(),
|
||||
"explicit.init", ident.getText(), "\\0");
|
||||
log(ident, "explicit.init", ident.getText(), "\\0");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,9 +71,7 @@ public final class IllegalCatchCheck extends Check
|
|||
FullIdent ident = CheckUtils.createFullType(excType);
|
||||
|
||||
if (isIllegalClassName(ident.getText())) {
|
||||
log(aDetailAST.getLineNo(),
|
||||
aDetailAST.getColumnNo(),
|
||||
"illegal.catch", ident.getText());
|
||||
log(aDetailAST, "illegal.catch", ident.getText());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,13 +95,11 @@ public final class JUnitTestCaseCheck extends Check
|
|||
private void checkSuiteMethod(DetailAST aAST, String aActualName)
|
||||
{
|
||||
if (!aActualName.equals(SUITE_METHOD_NAME)) {
|
||||
log(aAST.getLineNo(), aAST.getColumnNo(),
|
||||
"junit.method.name", SUITE_METHOD_NAME);
|
||||
log(aAST, "junit.method.name", SUITE_METHOD_NAME);
|
||||
}
|
||||
|
||||
if (!isPublicAndStatic(aAST)) {
|
||||
log(aAST.getLineNo(), aAST.getColumnNo(),
|
||||
"junit.method.public.and.static", SUITE_METHOD_NAME);
|
||||
log(aAST, "junit.method.public.and.static", SUITE_METHOD_NAME);
|
||||
}
|
||||
|
||||
// let's check return type
|
||||
|
|
@ -113,9 +111,8 @@ public final class JUnitTestCaseCheck extends Check
|
|||
|| !"Test".equals(type)
|
||||
&& !"junit.framework.Test".equals(type))
|
||||
{
|
||||
log(aAST.getLineNo(), aAST.getColumnNo(),
|
||||
"junit.method.return.type", SUITE_METHOD_NAME,
|
||||
"junit.framework.Test");
|
||||
log(aAST, "junit.method.return.type",
|
||||
SUITE_METHOD_NAME, "junit.framework.Test");
|
||||
}
|
||||
checkParameters(aAST, SUITE_METHOD_NAME);
|
||||
}
|
||||
|
|
@ -130,18 +127,15 @@ public final class JUnitTestCaseCheck extends Check
|
|||
String aExpectedName)
|
||||
{
|
||||
if (!aActualName.equals(aExpectedName)) {
|
||||
log(aAST.getLineNo(), aAST.getColumnNo(),
|
||||
"junit.method.name", aActualName, aExpectedName);
|
||||
log(aAST, "junit.method.name", aActualName, aExpectedName);
|
||||
}
|
||||
|
||||
if (!isPublicOrProtected(aAST)) {
|
||||
log(aAST.getLineNo(), aAST.getColumnNo(),
|
||||
"junit.method.protected.or.public", aExpectedName);
|
||||
log(aAST, "junit.method.protected.or.public", aExpectedName);
|
||||
}
|
||||
|
||||
if (isStatic(aAST)) {
|
||||
log(aAST.getLineNo(), aAST.getColumnNo(),
|
||||
"junit.method.static", aExpectedName);
|
||||
log(aAST, "junit.method.static", aExpectedName);
|
||||
}
|
||||
|
||||
checkReturnValue(aAST, TEAR_DOWN_METHOD_NAME);
|
||||
|
|
@ -158,8 +152,7 @@ public final class JUnitTestCaseCheck extends Check
|
|||
DetailAST returnValueAST = aAST.findFirstToken(TokenTypes.TYPE);
|
||||
|
||||
if (returnValueAST.findFirstToken(TokenTypes.LITERAL_VOID) == null) {
|
||||
log(aAST.getLineNo(), aAST.getColumnNo(),
|
||||
"junit.method.return.type", aName, "void");
|
||||
log(aAST, "junit.method.return.type", aName, "void");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -173,8 +166,7 @@ public final class JUnitTestCaseCheck extends Check
|
|||
DetailAST parametersAST = aAST.findFirstToken(TokenTypes.PARAMETERS);
|
||||
|
||||
if (parametersAST.getChildCount() != 0) {
|
||||
log (aAST.getLineNo(), aAST.getColumnNo(),
|
||||
"junit.method.parameters", aName);
|
||||
log(aAST, "junit.method.parameters", aName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -288,9 +288,7 @@ public class JavadocMethodCheck
|
|||
contents.getJavadocBefore(aAST.getLineNo());
|
||||
|
||||
if (cmt == null) {
|
||||
log(aAST.getLineNo(),
|
||||
aAST.getColumnNo(),
|
||||
"javadoc.missing");
|
||||
log(aAST, "javadoc.missing");
|
||||
}
|
||||
else {
|
||||
checkComment(aAST, cmt);
|
||||
|
|
@ -508,8 +506,7 @@ public class JavadocMethodCheck
|
|||
final Iterator paramIt = aParams.iterator();
|
||||
while (paramIt.hasNext()) {
|
||||
final DetailAST param = (DetailAST) paramIt.next();
|
||||
log(param.getLineNo(), param.getColumnNo(),
|
||||
"javadoc.expectedTag", "@param", param.getText());
|
||||
log(param, "javadoc.expectedTag", "@param", param.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,9 +91,7 @@ public class JavadocVariableCheck
|
|||
contents.getJavadocBefore(aAST.getLineNo());
|
||||
|
||||
if (cmt == null) {
|
||||
log(aAST.getLineNo(),
|
||||
aAST.getColumnNo(),
|
||||
"javadoc.missing");
|
||||
log(aAST, "javadoc.missing");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue