RFR: 8289397: Fix warnings: Possible accidental assignment in place of a comparison. A condition expression should not be reduced to an assignment [v2]
Nir Lisker
nlisker at openjdk.org
Wed Jul 27 00:48:11 UTC 2022
On Tue, 26 Jul 2022 22:54:56 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> - replaced with exact functional equivalent (in the presence of exceptions, for example)
>
> Andy Goryachev has updated the pull request incrementally with two additional commits since the last revision:
>
> - 8289397: review comments
> - Revert "8289397: functional equivalent"
>
> This reverts commit 6ae0ef60b186c75993fe7faa099140b26593d308.
The purpose of the warning it to find bugs in code that means to do equality comparison `if (a == b)` but instead do assignment `if (a = b)`. If the assignment is on purpose, I would suppress the warning. Since we're trying to not add Eclipse-specific annotations, a comment (as already exists) is enough. If we want to be more readable, pulling the assignment out is good.
-------------
PR: https://git.openjdk.org/jfx/pull/851
More information about the openjfx-dev
mailing list