Merge branch 'jeffhube-cce' into issue-1396

This commit is contained in:
Andreas Dangel
2018-10-24 08:40:18 +02:00
4 changed files with 13 additions and 5 deletions

View File

@ -13,7 +13,7 @@ public class ASTFormalComment extends AbstractApexNodeBase {
}
@Override
Object jjtAccept(ApexParserVisitor visitor, Object data) {
public Object jjtAccept(ApexParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}

View File

@ -32,7 +32,7 @@ public abstract class AbstractApexNodeBase extends AbstractNode {
/**
* Accept the visitor. *
*/
abstract Object jjtAccept(ApexParserVisitor visitor, Object data);
public abstract Object jjtAccept(ApexParserVisitor visitor, Object data);
/**
* Accept the visitor. *

View File

@ -9,6 +9,7 @@ import net.sourceforge.pmd.lang.apex.ast.ASTContinueStatement;
import net.sourceforge.pmd.lang.apex.ast.ASTDoLoopStatement;
import net.sourceforge.pmd.lang.apex.ast.ASTForEachStatement;
import net.sourceforge.pmd.lang.apex.ast.ASTForLoopStatement;
import net.sourceforge.pmd.lang.apex.ast.ASTFormalComment;
import net.sourceforge.pmd.lang.apex.ast.ASTIfBlockStatement;
import net.sourceforge.pmd.lang.apex.ast.ASTIfElseBlockStatement;
import net.sourceforge.pmd.lang.apex.ast.ASTMethodCallExpression;
@ -17,6 +18,7 @@ import net.sourceforge.pmd.lang.apex.ast.ASTStatement;
import net.sourceforge.pmd.lang.apex.ast.ASTThrowStatement;
import net.sourceforge.pmd.lang.apex.ast.ASTTryCatchFinallyBlockStatement;
import net.sourceforge.pmd.lang.apex.ast.ASTWhileLoopStatement;
import net.sourceforge.pmd.lang.apex.ast.AbstractApexNodeBase;
import net.sourceforge.pmd.lang.apex.ast.ApexNode;
import net.sourceforge.pmd.lang.apex.rule.AbstractStatisticalApexRule;
import net.sourceforge.pmd.lang.ast.Node;
@ -53,7 +55,7 @@ public abstract class AbstractNcssCountRule extends AbstractStatisticalApexRule
int numNodes = 0;
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
ApexNode<?> n = (ApexNode<?>) node.jjtGetChild(i);
AbstractApexNodeBase n = (AbstractApexNodeBase) node.jjtGetChild(i);
Integer treeSize = (Integer) n.jjtAccept(this, data);
numNodes += treeSize.intValue();
}
@ -85,7 +87,7 @@ public abstract class AbstractNcssCountRule extends AbstractStatisticalApexRule
Integer nodeCount;
int lineCount = 0;
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
nodeCount = (Integer) ((ApexNode<?>) node.jjtGetChild(i)).jjtAccept(this, data);
nodeCount = (Integer) ((AbstractApexNodeBase) node.jjtGetChild(i)).jjtAccept(this, data);
lineCount += nodeCount.intValue();
}
return ++lineCount;
@ -159,4 +161,9 @@ public abstract class AbstractNcssCountRule extends AbstractStatisticalApexRule
public Object visit(ASTMethodCallExpression node, Object data) {
return NumericConstants.ONE;
}
@Override
public Object visit(ASTFormalComment node, Object data) {
return NumericConstants.ZERO;
}
}

View File

@ -4,6 +4,7 @@
package net.sourceforge.pmd.lang.apex.rule.design;
import net.sourceforge.pmd.lang.apex.ast.AbstractApexNodeBase;
import net.sourceforge.pmd.lang.apex.ast.ApexNode;
import net.sourceforge.pmd.lang.apex.rule.AbstractStatisticalApexRule;
import net.sourceforge.pmd.stat.DataPoint;
@ -39,7 +40,7 @@ public class ExcessiveNodeCountRule extends AbstractStatisticalApexRule {
int numNodes = 0;
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
Integer treeSize = (Integer) ((ApexNode<?>) node.jjtGetChild(i)).jjtAccept(this, data);
Integer treeSize = (Integer) ((AbstractApexNodeBase) node.jjtGetChild(i)).jjtAccept(this, data);
numNodes += treeSize;
}