IntelliJ IDEA performs code analysis by applying inspections to your code. Numerous code inspections exist for Java and for the other supported languages.
The inspections detect not only compiling errors, but also different code inefficiencies. Whenever you have some unreachable code, unused code, non-localized string, unresolved method, memory leaks or even spelling problems – you'll find it very quickly.
IntelliJ IDEA's code analysis is flexibly configurable. You can enable/disable each code inspection and change its severity, create profiles with custom sets of inspections, apply inspections differently in different scopes, suppress inspections in specific pieces of code, and more.
The analysis can be performed in several ways:
- By default, IntelliJ IDEA analyses all open files and highlights all detected code issues right in the editor. On the right side of the editor you can see the analysis status of the whole file (the icon in the top-right corner).
When an error is detected, this icon is ; in case of a warning, it is ; if everything is correct, the icon is .
- Alternatively, you can run code analysis in a bulk mode for the specified scope, which can be as large as the whole project.
- If necessary, you can apply a single code inspection in a specific scope.
For the majority of the detected code issues, IntelliJ IDEA provides quick fix suggestions. You can quickly review errors in a file by navigating from one highlighted line to another by pressing F2Shift+F2 .
IntelliJ IDEA analyses your projects on the various levels:
- "On-the-fly" analysis helps you fix problems as they arise as you type, using intention actions.
- Code inspections are intended to point out issues related to the program design.
- Highlighting level allows you to control the scope of problems highlighted in the current file.
- Dependencies analysis helps you understand the structure of your source code, explore relationships between the components of your projects, track down dependencies and work through the code hierarchies.
- Dataflow analysis helps you with code archeology.
- Reverse engineering.