Skip to content

Issue #19716: Fix SimplifyBooleanExpressionCheck with parenthesized boolean literals#19723

Merged
romani merged 1 commit into
checkstyle:masterfrom
lithops-zty:issue-19716-fix-simplify-boolean-expression-paranthesized
May 11, 2026
Merged

Issue #19716: Fix SimplifyBooleanExpressionCheck with parenthesized boolean literals#19723
romani merged 1 commit into
checkstyle:masterfrom
lithops-zty:issue-19716-fix-simplify-boolean-expression-paranthesized

Conversation

@lithops-zty

@lithops-zty lithops-zty commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

fixes: #19716

Adds logic to skip parentheses when checking operands of ternary operators.

@lithops-zty lithops-zty force-pushed the issue-19716-fix-simplify-boolean-expression-paranthesized branch 2 times, most recently from 3f2b0e1 to 29a121c Compare April 20, 2026 11:56
@romani

romani commented Apr 21, 2026

Copy link
Copy Markdown
Member

Github, generate report for SimplifyBooleanExpression/all-examples-in-one

@romani

romani commented Apr 21, 2026

Copy link
Copy Markdown
Member

Fyi, it is taken from https://github.com/checkstyle/test-configs/tree/main/SimplifyBooleanExpression/all-examples-in-one

You can use it to trigger test yourself.

@github-actions

Copy link
Copy Markdown
Contributor

@lithops-zty

Copy link
Copy Markdown
Contributor Author

@romani Why does CI report a shorter execution time as a performance regression? I saw this issue in multiple PRs and would like to know if this is intended.

@romani

romani commented Apr 25, 2026

Copy link
Copy Markdown
Member

This is basic intention to catch performance degradation. But it not stable, as it depends on performance on Linux nodes.

@lithops-zty

Copy link
Copy Markdown
Contributor Author

The average execution time is 324.67s while the baseline is 390.7s. May I know why is this an error since not only there is no preformance degradation, but execution is even faster?

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

itms:

temp = a() ? true : true; // violation, 'Expression can be simplified'
temp = value != null ? value : (false);
boolean w = c > 1 ? (true) : ((false)); // violation, 'Expression can be simplified'
boolean x = ((false)) ? c == 1 : c > 10; // violation, 'Expression can be simplified'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please put under violation line a line with simplified code to make sure simplied it same and has no violation.

@lithops-zty lithops-zty force-pushed the issue-19716-fix-simplify-boolean-expression-paranthesized branch 2 times, most recently from 16354f8 to fe2644a Compare May 11, 2026 12:44
@lithops-zty lithops-zty force-pushed the issue-19716-fix-simplify-boolean-expression-paranthesized branch from fe2644a to 2ed6199 Compare May 11, 2026 13:34

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot

@romani romani merged commit 8328059 into checkstyle:master May 11, 2026
126 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False Negative: SimplifyBooleanExpression does not report with paranthesized boolean literals in ternary operators

2 participants