CODSTA.IMPT2
Use wild card symbols when importing classes
Description
This rule flags code that does not use wild card symbols when importing classes.
The import statement allows the use of the wild cards when indicating the names of classes. For example, the statement import java.awt.*; brings in all of the classes in the package java.awt at once. Actually, that's not completely true. What really happens is that every class that you use form the java.awt package will be brought into your code when it is compiled, classes that you do not use will not be.
Note: Jtest has another rule, CODSTA.IMPT, which discourages the use of wild card symbols in import statements. Because we have two references, which contain conflicting opinions, ParaSoft added both rules for the users to decide.
Example
package CODSTA;
import java.io.InputStream; // violation.
public class IMPT2 {
void method (InputStream in) {
if (in == null) return;
}
}
Reference
Section 7.2 of http://www.AmbySoft.com/javaCodingStandards.pdf
|