Jtest logo




Contents  Previous  Next  Index

MISC.IFBLK


"if" statements should have a block

Description

This rule flags "if" statements that do not have a block.

"if" statements are less error-prone if they have a block.

Example

 package MISC;
 
 public class IFBLK {
     public void method (boolean b) {
         if (b)    // violation
             System.out.println ("inside of if");
         if (b) {
             System.out.println ("inside of if");
         }
     }
 }
 

Repair

Provide a block for each "if" statements.


Contents  Previous  Next  Index

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