Jtest logo




Contents  Previous  Next  Index

PB.CTOR


Avoid package-private classes with "public" constructors

Description

This rule flags any "package-private" class with a "public" constructor.

A "public" constructor of a non-"public" class does not have "public" accessibility.Thus, the "public" modifier should be removed because it has no effect and it is confusing.

Example

 package PB;
 class CTOR {    // package accessible class
     public CTOR () {   // public constructor.
     }
 }

Repair

Change the constructor's modifier to either "package" or "private".


Contents  Previous  Next  Index

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