Inspectopedia 2025.2 Help

Unnecessary parentheses

Reports any instance of unnecessary parentheses.

Parentheses are considered unnecessary if the evaluation order of an expression remains unchanged after you remove the parentheses.

Example:

int n = 3 + (9 * 8);

After quick-fix is applied:

int n = 3 + 9 * 8;

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.

UnnecessaryParentheses
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.

Settings or Preferences | Editor | Inspections | Java | Code style issues

Configure the inspection:

  • Use the Ignore clarifying parentheses option to ignore parentheses that help clarify a binary expression. Parentheses are clarifying if the parenthesized expression is an instanceof expression that is a part of a larger expression or has a different operator than the parent expression.

  • Use the Ignore parentheses around the condition of conditional expressions option to ignore any parentheses around the condition of conditional expressions. Some coding standards specify that all such conditions must be surrounded by parentheses.

  • Use the Ignore parentheses around single no formal type lambda parameter option to ignore parentheses around a single lambda parameter within a lambda expression.

Inspection options

Here you can find the description of settings available for the Unnecessary parentheses inspection, and the reference of their default values.

Ignore clarifying parentheses

Default value:

Not selected
Ignore parentheses around the condition of conditional expressions

Default value:

Not selected
Ignore parentheses around single no formal type lambda parameter

Default 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:

//noinspection UnnecessaryParentheses

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:

IntelliJ IDEA 2025.2, Qodana for JVM 2025.2,

Last modified: 18 September 2025