Jtest logo




Contents  Previous  Next  Index

CODSTA.DCI


Define constants in an "interface"

Description

This rule flags any non-private named constant that is not defined in an "interface".

Example

 package CODSTA;
 
 class DCI{
     private int[] getArray () {
         return new int [ARRAY_SIZE];
     } 
 static final int ARRAY_SIZE = 1000;
 }

Repair

 class USN_fixed {
     private int[] getArray () {
         return new int [Constants.ARRAY_SIZE];
     } 
 }
 interface Constants {
     int ARRAY_SIZE = 1000;
 }

Contents  Previous  Next  Index

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