Jtest logo




Contents  Previous  Next  Index

OPT.DUN


Don't use the negation operator frequently

Description

This rule flags code that uses the negation operator frequently (i.e., more than two times).

The negation operator (!) decreases the readability of the program.

Example

 package OPT;
 
 public class DUN {
     boolean method (boolean a, boolean b) {
         if (!a)
             return !a;
         else
             return !b;
     }
 }

Repair

Do not use the negation operator if possible.


Contents  Previous  Next  Index

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