RFR: 8289397: Fix warnings: Possible accidental assignment in place of a comparison. A condition expression should not be reduced to an assignment [v2]

Phil Race prr at openjdk.org
Fri Jul 29 16:38:48 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.

I'll throw in one more thing.

The OpenJFX wiki code style rules reference
https://wiki.openjdk.org/display/OpenJFX/Code+Style+Rules

reference the vintage 1996 Sun JDK code guidelines

https://www.oracle.com/java/technologies/javase/codeconventions-programmingpractices.html#547
----
Do not use embedded assignments in an attempt to improve run-time performance. This is the job of the compiler. Example:

d = (a = b + c) + r; // AVOID!
-----
To the extent it is the same case (I don't think this is being done for performance etc) it would support extraction.

-------------

PR: https://git.openjdk.org/jfx/pull/851


More information about the openjfx-dev mailing list