RFR: 8275771: JDK source code contains redundant boolean operations in jdk.compiler and langtools
Joe Darcy
darcy at openjdk.java.net
Mon Nov 29 19:57:08 UTC 2021
On Mon, 29 Nov 2021 19:05:59 GMT, Vicente Romero <vromero at openjdk.org> wrote:
> Hi,
>
> Please review this PR which is basically rewriting some redundant boolean expressions in the compiler.
>
> TIA
make/langtools/tools/compileproperties/CompileProperties.java line 187:
> 185: }
> 186: if ( ok && contents != null ) {
> 187: String tokens[] = (new String(contents)).split("\\s+");
So the intended composite predicate here is thought to be
ok == true && contents != null
which is equivalent to
ok && contents != null.
The semantics of the current code are equivalent to just
contents != null
right?
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java line 1316:
> 1314: public void visitReference(JCMemberReference tree) {
> 1315: if (sRet.hasTag(VOID)) {
> 1316: result = true;
Isn't the equivalent statement to
result &= true
just
result
?
-------------
PR: https://git.openjdk.java.net/jdk/pull/6599
More information about the build-dev
mailing list