Jtest logo




Contents  Previous  Next  Index

MISC.FF


Constant fields should be declared as "final"

Description

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

Fields that are initialized in a declaration and values that do not change throughout the class should be "final" fields.

Example

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

Repair

Declare 'size' "final".


Contents  Previous  Next  Index

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