Jtest logo




Contents  Previous  Next  Index

INIT.CSI


The constructor should explicitly initialize all fields

Description

This rule flags any constructor that does not explicitly initialize all fields.

Example

 package INIT;
 
 class CSI {
     CSI () {
         this (12);
         k = 0;
     }
 
     CSI (int val) {
         j = val;
     }
 
     private int i = 5;
     private int j;
     private int k;
 }

Repair

In some cases, these errors can be corrected by initializing the appropriate fields. In other cases, these fields will have been assigned values from other uninitialized fields that must be initialized to eliminate the problem.


Contents  Previous  Next  Index

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