Jtest logo




Contents  Previous  Next  Index

MISC.FLV


Constant local variables should be declared as "final"

Description

This rule flags constant local variables that are not declared as "final".

Local variables that are initialized in a declaration whose values do not change throughout the block should be declared "final".

Example

 package MISC;
 public class FLV {
     private void method () {
 	 int size = 0;   //violation
         // do something but size's value do not change.
     }
 }

Repair

Make 'size' as a "final".


Contents  Previous  Next  Index

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