Simplifiable statement
Reports the statements that can be simplified, such as constant conditions, identical if branches, redundant boolean expressions, and others. Use the checkboxes below to control the analysis options:
Simplify "if (true)", "while(false)": suggest replacing the
if/whilestatement with a boolean literal.Simplify "condition == true": suggest replacing equality statements with boolean literals.
Simplify "condition1 ? true : condition2;": suggest simplifying ternary operators where one of the expressions is a boolean literal.
Simplify "if (condition1) return true; return condition2;": suggest simplifying
ifwhere a boolean literal is returned if the condition is true and another condition is returned otherwise.
Locating this inspection
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
Simplify- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
Inspection ID: Simplify
Inspection options
Here you can find the description of settings available for the Simplifiable statement inspection, and the reference of their default values.
- Simplify "if (true)", "while (false)"
Option ID:
enableSimplifyConstantConditionsDefault value:
Selected- Simplify "condition == true"
Option ID:
enableSimplifyEqualToTrueFalseDefault value:
Selected- Simplify "condition1 ? true : condition2"
Option ID:
enableSimplifyTernaryWithConstantBranchDefault value:
Selected- Simplify "if (condition1) return true; return condition2;"
Option ID:
enableSimplifyIfWithReturnDefault value:
Not selected
Suppressing Inspection
You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:
More detailed instructions as well as other ways and options that you have can be found in the product documentation:
Inspection Details | |
|---|---|
By default bundled with: | |
Can be installed with plugin: | CLion, 2025.2 |