You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2009/09/01 21:12:51 UTC
svn commit: r810179 - in /commons/proper/math/trunk: checkstyle.xml
src/main/java/org/apache/commons/math/stat/ranking/NaturalRanking.java
Author: luc
Date: Tue Sep 1 19:12:50 2009
New Revision: 810179
URL: http://svn.apache.org/viewvc?rev=810179&view=rev
Log:
tighten checkstyle rules for switch statements
Modified:
commons/proper/math/trunk/checkstyle.xml
commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/ranking/NaturalRanking.java
Modified: commons/proper/math/trunk/checkstyle.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/checkstyle.xml?rev=810179&r1=810178&r2=810179&view=diff
==============================================================================
--- commons/proper/math/trunk/checkstyle.xml (original)
+++ commons/proper/math/trunk/checkstyle.xml Tue Sep 1 19:12:50 2009
@@ -78,6 +78,26 @@
<!-- Utility class should not be instantiated, they must have a private constructor -->
<module name="HideUtilityClassConstructor" />
+ <!-- Switch statements should be complete and with independent cases -->
+ <module name="FallThrough" />
+ <module name="MissingSwitchDefault" />
+
+ <!--
+ <module name="ConstantName" />
+ <module name="HiddenField">
+ <property name="ignoreConstructorParameter" value="true" />
+ <property name="ignoreSetter" value="true" />
+ </module>
+ <module name="DeclarationOrder" />
+ <module name="IllegalCatch" />
+ <module name="RedundantModifier" />
+ <module name="StringLiteralEquality" />
+ <module name="ModifierOrder" />
+ <module name="MultipleStringLiterals" />
+ <module name="MultipleVariableDeclarations" />
+ <module name="TodoComment" />
+ <module name="UnnecessaryParentheses" />
+ -->
</module>
<!-- Require package javadoc -->
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/ranking/NaturalRanking.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/ranking/NaturalRanking.java?rev=810179&r1=810178&r2=810179&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/ranking/NaturalRanking.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/ranking/NaturalRanking.java Tue Sep 1 19:12:50 2009
@@ -22,6 +22,7 @@
import java.util.Iterator;
import java.util.List;
+import org.apache.commons.math.MathRuntimeException;
import org.apache.commons.math.random.RandomData;
import org.apache.commons.math.random.RandomDataImpl;
import org.apache.commons.math.random.RandomGenerator;
@@ -208,6 +209,8 @@
case FIXED: // Record positions of NaNs
nanPositions = getNanPositions(ranks);
break;
+ default: // this should not happen unless NaNStrategy enum is changed
+ throw MathRuntimeException.createInternalError(null);
}
// Sort the IntDoublePairs
@@ -354,6 +357,8 @@
ranks[iterator.next()] = f + i++;
}
break;
+ default: // this should not happen unless TiesStrategy enum is changed
+ throw MathRuntimeException.createInternalError(null);
}
}