Back to Intellij Community

GroovyConditionalWithIdenticalBranches

plugins/groovy/groovy-psi/resources/inspectionDescriptions/GroovyConditionalWithIdenticalBranches.html

2025.3-rc-2294 B
Original Source

Reports ternary expressions with identical "then" and "else" branches. Such expressions are almost certainly a programmer error.

The quick-fix replaces the expression with its "then" branch.

Example:

condition ? a.foo() : a.foo()

After the quick-fix is applied:

a.foo()