CODSTA.CLS
Place constants on the left side of comparisons
Description
This rule flags code that does not place constants on the left side of comparisons.
Example
package CODSTA;
public class CLS {
public void testMethod (int something) {
if (something == 5) {} // violation.
}
}
Repair
Place constants in left side of comparisons.
public void testMethod (int something) {
if (5 == something ) {}
}
Reference
Section 2.5.2 of http://www.AmbySoft.com/javaCodingStandards.pdf
|