Removing Unused Import Statements
Step 3 of the Import Management Tool wizard lets you perform the following tasks:
- Remove unused import statements. If an import statement is not referenced by
any identifiers, it is removed from the source file.
- Remove underused import statements. The Import Management Tool
automatically schedules an import statement to be removed if the source contains
fewer identifiers from an imported package than are specified by the Maximum Fully
Qualified Names in Source property. All related identifiers are changed to use fully qualified names.
- Choose between package and single-name import statements. If the number
of single-name import statements for classes from the same package is greater than the number specified
in the Number of Single-Name Imports property, the Import Management Tool creates one package import
statement. Likewise, if the number of identifiers covered by one package import statement is less than
the number specified in the Number of Single-Name Imports property, the Import Management Tool replaces
the package import statement with single-name import statements.
If there are no import statements to be removed and no import statements to
change from package to single-name or the reverse, Step 3 displays only a
message and no actions are possible.
To override the Import Management Tool's suggested actions:
-
In the Imports tree view, click the Action for the package node you want
to change, and choose Use Package Import or Use Single-Name Import.
-
Expand the package node or nodes to see if there are any single-name import
statements scheduled for removal. If you don't want to remove the import,
you can click the Action and select Use.
 |
The java.lang package and the package of your processed class are
omitted from the Imports tree view, as these packages are always included by
default.
|
Legal Notices