Lets you optimize the import declarations by either expanding or collapsing them, obsolete or unused imports are removed.
Please note that when using either the Ant, Console or Maven Plug-ins, you have to explicitly enable type repository services for this feature to work. Please refer to the documentation of the individual Plug-ins to learn how one can accomplish this (see Part II, "Plug-ins").
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.
could become
The IDE Plug-ins usually leverage the build-in import optimization facility, but sometimes these may contain bugs that prevent there usage. Here, you can enable a custom Jalopy implementation instead. It's the same implementation that is used by the non-IDE Plug-ins (Ant, Console, Maven) by default. Please note that this implementation only supports import expansion!
Since 1.7
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.
Example 2.745. Single-type import declarations
import java.awt.event.MouseEvent; import javax.swing.JButton; import javax.swing.JTable; import javax.swing.JTextField;
could become
Please note that there might be collisions that prevent collapsing when two types have the same name.
In the example above, collapsing both packages is not possible because this would lead to invalid code as both <package>java.awt.</package> and <package>java.util</package> contain a type named List. In such cases only one package will be collapsed (if there are no further conflicts).