Checking in some Java 5 changes

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5021 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Allan Caplan
2007-01-31 02:40:27 +00:00
parent 9f54333348
commit 6e258f58e1

View File

@ -40,7 +40,7 @@ public class BrokenNullCheck extends AbstractRule {
private void checkForViolations(ASTIfStatement node, Object data, SimpleJavaNode conditionalExpression) {
ASTEqualityExpression equalityExpression = (ASTEqualityExpression)getFirstDirectChildOfType(ASTEqualityExpression.class, conditionalExpression);
ASTEqualityExpression equalityExpression = getFirstDirectChildOfType(ASTEqualityExpression.class, conditionalExpression);
if (equalityExpression == null) {
return;
}
@ -164,11 +164,11 @@ public class BrokenNullCheck extends AbstractRule {
return null; //Nothing found
}
private Node getFirstDirectChildOfType(Class childType, Node node) {
private <T> T getFirstDirectChildOfType(Class<T> childType, Node node) {
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
SimpleJavaNode simpleNode = (SimpleJavaNode) node.jjtGetChild(i);
if (simpleNode.getClass().equals(childType))
return simpleNode;
return (T)simpleNode;
}
return null;
}