IntelliJ: Never use wildcard imports
- File\Settings... (Ctrl+Alt+S)
- Project Settings > Editor > Code Style > Java > Imports tab
- Set Class count to use import with '*' to 999
- Set Names count to use static import with '*' to 999
After this, your configuration should look like:
(On IntelliJ IDEA 13.x, 14.x, 15.x, 2016.x, 2017.x)
It's obvious why you'd want to disable this: To force IntelliJ to include each and every import individually. It makes it easier for people to figure out exactly where classes you're using come from.
Click on the Settings "wrench" icon on the toolbar, open "Imports" under "Code Style", and check the "Use single class import" selection. You can also completely remove entries under "Packages to use import with *
", or specify a threshold value that only uses the "*
" when the individual classes from a package exceeds that threshold.
Update: in IDEA 13 "Use single class import" does not prevent wildcard imports. The solution is to go to Preferences
(⌘ + , on macOS / Ctrl + Alt + S on Windows and Linux) > Editor > Code Style > Java > Imports tab
set Class count to use import with '*'
and Names count to use static import with '*'
to a higher value. Any value over 99 seems to work fine.