Checkstyle fixes

This commit is contained in:
oowekyala
2017-07-20 12:59:47 +02:00
parent 0f313f9044
commit 99b3c5e12f
2 changed files with 4 additions and 36 deletions

View File

@ -173,38 +173,6 @@ import net.sourceforge.pmd.lang.java.oom.signature.OperationSignature;
} }
/**
* Finds the declaration nodes of all methods or constructors that are declared inside a class.
*
* @param node The class in which to look for.
* @param includeNested Include operations found in nested classes?
*
* @return The list of all operations declared inside the specified class.
*
* TODO:cf this one is computed every time
*/
private static List<ASTMethodOrConstructorDeclaration> findOperations(ASTAnyTypeDeclaration node,
boolean includeNested) {
if (includeNested) {
return node.findDescendantsOfType(ASTMethodOrConstructorDeclaration.class);
}
List<ASTClassOrInterfaceBodyDeclaration> outerDecls
= node.jjtGetChild(0).findChildrenOfType(ASTClassOrInterfaceBodyDeclaration.class);
List<ASTMethodOrConstructorDeclaration> operations = new ArrayList<>();
for (ASTClassOrInterfaceBodyDeclaration decl : outerDecls) {
if (decl.jjtGetChild(0) instanceof ASTMethodOrConstructorDeclaration) {
operations.add((ASTMethodOrConstructorDeclaration) decl.jjtGetChild(0));
}
}
return operations;
}
/** /**
* Computes the value of a metric for an operation. * Computes the value of a metric for an operation.
* *

View File

@ -20,28 +20,28 @@ public enum OperationMetricKey implements MetricKey<ASTMethodOrConstructorDeclar
* *
* @see net.sourceforge.pmd.lang.java.oom.metrics.AtfdMetric * @see net.sourceforge.pmd.lang.java.oom.metrics.AtfdMetric
*/ */
ATFD(new AtfdClassMetric()), ATFD(new AtfdOperationMetric()),
/** /**
* Cyclomatic complexity. * Cyclomatic complexity.
* *
* @see net.sourceforge.pmd.lang.java.oom.metrics.CycloMetric * @see net.sourceforge.pmd.lang.java.oom.metrics.CycloMetric
*/ */
CYCLO(new CycloClassMetric()), CYCLO(new CycloOperationMetric()),
/** /**
* Non Commenting Source Statements. * Non Commenting Source Statements.
* *
* @see net.sourceforge.pmd.lang.java.oom.metrics.NcssMetric * @see net.sourceforge.pmd.lang.java.oom.metrics.NcssMetric
*/ */
NCSS(new NcssClassMetric()), NCSS(new NcssOperationMetric()),
/** /**
* Lines of Code. * Lines of Code.
* *
* @see net.sourceforge.pmd.lang.java.oom.metrics.LocMetric * @see net.sourceforge.pmd.lang.java.oom.metrics.LocMetric
*/ */
LOC(new LocClassMetric()); LOC(new LocOperationMetric());
private final OperationMetric calculator; private final OperationMetric calculator;