Jtest logo




Contents  Previous  Next  Index

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


Contents  Previous  Next  Index

ParaSoft logo
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft