Skip to content

ecj: enable possibleAccidentalBooleanAssignment and fix issues #14966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2025

Conversation

rmuir
Copy link
Member

@rmuir rmuir commented Jul 18, 2025

This check trips if you use an assignment as a boolean conditional.

You can avoid it either by not using assignments as boolean conditionals, or by using an explicit comparison such as:

// instead of:
if (x = y) {}

// change to:
if ((x = y) == true) {}

This check trips if you use an assignment as a boolean conditional.

You can avoid it either by not using assignments as boolean
conditionals, or by using an explicit comparison such as:

```java
// instead of:
if (x = y) {}

// change to:
if ((x = y) == true) {}
```
Copy link

This PR does not have an entry in lucene/CHANGES.txt. Consider adding one. If the PR doesn't need a changelog entry, then add the skip-changelog label to it and you will stop receiving this reminder on future updates to the PR.

Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

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

The code is clearer this way!

@rmuir rmuir merged commit 346d762 into apache:main Jul 21, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants