A RetroSearch Logo

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

Search Query:

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

[java] Make FinalFieldCouldBeStatic detect constant variable · Issue #3679 · pmd/pmd · GitHub

Affects PMD Version:6.41.0

Rule:FinalFieldCouldBeStatic

Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/latest/pmd_rules_java_design.html#finalfieldcouldbestatic

Description:
Hi, I found a false negative about the rule FinalFieldCouldBeStatic. Please refer to the following case, PMD should report a warning a line 3 because b is assigned by a compile-time constant, but it doesn't.

Code Sample demonstrating the issue:

class Clazz {
  public static final int a = 10;
  public final int b = a;  // should report a warning here
}

Expected outcome:

PMD should report a violation at line 3, 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