[java] SwitchDensity - use super.visit

There are no fixed false negatives, but it looks more correct.
This commit is contained in:
Andreas Dangel
2021-11-13 11:21:33 +01:00
parent 85f67d7e24
commit 008141cd92
2 changed files with 4 additions and 7 deletions

View File

@ -51,7 +51,6 @@ public class SwitchDensityRule extends AbstractStatisticalJavaRule {
}
public SwitchDensityRule() {
super();
setProperty(MINIMUM_DESCRIPTOR, 10d);
}
@ -65,7 +64,7 @@ public class SwitchDensityRule extends AbstractStatisticalJavaRule {
SwitchDensity density = new SwitchDensity();
node.childrenAccept(this, density);
super.visit(node, density);
DataPoint point = new DataPoint();
point.setNode(node);
@ -86,9 +85,7 @@ public class SwitchDensityRule extends AbstractStatisticalJavaRule {
((SwitchDensity) data).addStatement();
}
statement.childrenAccept(this, data);
return data;
return super.visit(statement, data);
}
@Override
@ -97,7 +94,6 @@ public class SwitchDensityRule extends AbstractStatisticalJavaRule {
((SwitchDensity) data).addSwitchLabel();
}
switchLabel.childrenAccept(this, data);
return data;
return super.visit(switchLabel, data);
}
}

View File

@ -8,6 +8,7 @@
<description>Five stmts in one switch case, should be flagged</description>
<rule-property name="minimum">4</rule-property>
<expected-problems>1</expected-problems>
<expected-linenumbers>4</expected-linenumbers>
<code><![CDATA[
// Switch Density = 5.0
public class SwitchDensity1 {