A RetroSearch Logo

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

Search Query:

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

false negative for expressions · Issue #2140 · pmd/pmd · GitHub

Affects PMD Version:
Running against 6.19.0,6.20.0.

Rule:
AvoidLiteralsInIfCondition

Description:
Expression with constants sidesteps this rule. The rule is configured with allowed values: -1,0,1.

Code Sample demonstrating the issue:

package pmdtests;

public enum MulticastSender {
;

 private static byte getTTL(String... args) {
    try {
      if (args.length > (1 + 1))
        return (byte)Integer.parseInt(args[2]);
    } catch (NumberFormatException e) {
      // empty catch block
    }
    return (byte)1;
  }

}

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]


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