Useful IntelliJ Defaults

The following are some global IntelliJ defaults that I use. Hope they’re helpful to you as well.

Disable folding of Java imports during optimize imports

IntelliJ has a useful “optimize imports” feature that I use frequently (hotkey: ⌘+⇧+o). Unfortunately, one side effect of it is that, if you’ve imported a few classes from the same package, it will fold the imports. This pulls in all classes from that package, resulting in extraneous classes being imported. To prevent this, go to File -> Other Settings -> Default Settings -> Editor -> Code Style -> Imports, and set the threshold values to 999 for importing packages.

Enable annotation processing

If you work with frameworks that require annotation processing, such as Lombok, enabling annotation processing globally will save you the headache of configuring this for each of your projects. To do this, go to File -> Other Settings -> Default Settings -> Build, Exec, Deploy -> Compiler -> Annotation Processor, and check the box to enable annotation processing.