Java Reference
In-Depth Information
Use single class import —If unselected, IDEA always imports entire pack-
ages rather than single classes. If enabled, individual classes are used unless
one of the package options discussed later takes effect.
Use fully qualified class names —If enabled, IDEA doesn't bother import-
ing classes and instead refers to a class reference with its fully qualified
class name.
Insert imports for inner classes —If enabled, IDEA provides import state-
ments for inner classes contained in the Java class.
Use fully qualified class names in JavaDoc —When enabled, IDEA always
uses a fully qualified class name in a JavaDoc reference, even if the class is
imported or package-local.
Class count to use import with * —Specifies a threshold value for the num-
ber of imports from a particular package, which causes the entire package
to be imported rather than individual classes.
Importing entire packages
The packages listed under the Packages to Use Import with * list are always
imported en masse, regardless of the number of classes you import from the
package (as long as you use one, of course). The Swing and AWT packages are
included in this list by default, but you can remove them if you wish.
When you're entering a package, you don't need to add a wildcard or trailing
period to the end of the package name. For example, the pattern for matching
the Swing package is javax.swing —no need for a wildcard. If you don't select the
With Subpackages option next to your package, the rule only applies to the root
package. If it's selected, all subpackages below the specified package are also
imported as a single unit when required.
Specifying an import layout
The Import Layout list specifies the preferred order in which your import state-
ments appear, based on the package they come from. You can also insert blank
lines between groups of import statements. The <all other imports> entry can't
be removed; it specifies the location for any imported class or package not match-
ing an entry in the layout list. As before, you can use the With Subpackages
option to extend the scope of a match to include all the packages below it.
Order isn't technically important. Java won't let you create ambiguous class
references, so order doesn't determine precedence when resolving class names.
This is purely a stylistic issue. For example, you may want all your local package
 
 
 
 
 
 
 
 
 
 
Search WWH ::




Custom Search