Optimization

Lets you optimize the import declarations by either expanding or collapsing them, obsolete or unused imports are removed.

Please note that you have to explicitly enable type repository services for the Ant, Console and Maven Plug-ins to activate this feature. Please refer to the documentation of the individual Plug-ins to learn how one can accomplish this (see Part II, "Plug-ins").

Expand on-demand imports

If enabled, tries to expand all on-demand import declarations.

Expanding means to resolve all on-demand import declarations (sometimes called wildcard imports) and replace them with single-type import declarations (sometimes called explicit imports) of the types that are actually used in the source file.

So the following on-demand import declaration may be expanded into two single-type import declarations that reference the needed types for this package.

Example 2.726. On-demand import declaration

import java.util.*;

Example 2.727. Single-type import declarations

import java.util.ArrayList;
import java.util.List;
Use custom implementation

The IDE Plug-ins usually leverage the build-in import optimization facility, but sometimes these may lead to problems, especially when used during a file saving operation. Here, you can enable a custom Jalopy implementation that is used by the console Plug-ins (Ant, CLI, Maven) instead. Please note that this implementation only supports import expansion!

Since 1.7

Collapse single-type imports

If enabled, tries to collapse all single-type declarations.

Collapsing means to remove all single-type imports of a given package and replace them with one on-demand import declaration.