A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/3455 below:

[java] WhileLoopWithLiteralBoolean - false negative with complex expressions · Issue #3455 · pmd/pmd · GitHub

Affects PMD Version:6.35.0

Rule:WhileLoopWithLiteralBoolean

Link:
https://pmd.github.io/pmd-6.36.0/pmd_rules_java_bestpractices.html#whileloopwithliteralboolean

Description:
Hi, when using PMD, I found some false negatives caused by compound but constant expression. I have provided them in the following minimal code sample. Actually, expressions in conditional statements are constant and they should have been detected. Thanks.

Code Sample demonstrating the issue:

public void func() {
    do {
      // Loop Body
    } while(false || false); // This is a false negative
//        } while(false | false); // This is a similar false negative.
}

Expected outcome: Two warnings

PMD should report two violations at line 4 and 5, but doesn't. This is a false-negative.

Running PMD through: [Maven]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4