Tips & Tricks

Excluding Classes from Auto-Import

IntelliJ IDEA auto-import popup is a very handy feature that lets you stop worrying about import statements in your Java class files. However, sometimes it can show more choices than you need (e.g. when some of the class names in your project match the names of internal JDK or unrelated library classes).

To make auto-import easier to use and to avoid accidental imports of wrong classes, you can open the Settings dialog, then go to Editor | Auto-Import and add their package prefixes to the exclusion list. This will also hide the specified classes from class name completion lists.

image description

Discover more