GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] Make FinalFieldCouldBeStatic detect constant variable · Issue #3679 · pmd/pmd

[java] Make FinalFieldCouldBeStatic detect constant variable #3679

New issue
Copy link
New issue
Copy link
Closed
#3727
#3724
Closed
[java] Make FinalFieldCouldBeStatic detect constant variable#3679
#3727
#3724
Copy link
Labels
a:false-negativePMD doesn't flag a problematic piece of code
Milestone
6.42.0

Description

@ghost
ghost
opened on Dec 8, 2021

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]

Activity

  1. ghost added
    a:false-negativePMD doesn't flag a problematic piece of code
    on Dec 8, 2021
  2. ghost changed the title [-]Make FinalFieldCouldBeStatic detect constant variable[/-] [+][java] Make FinalFieldCouldBeStatic detect constant variable[/+] on Dec 8, 2021
  3. dykov
    added a commit that references this issue on Jan 12, 2022

    pmd#3679 - fix FinalFieldCouldBeStatic

    8bd9032
  4. adangel
    added this to the 6.42.0 milestone on Jan 13, 2022
  5. adangel
    added 2 commits that reference this issue on Jan 13, 2022

    [doc] Update release notes (#3679, #3724)

    a52c62c

    Merge pull request pmd#3724 from dykov:hotfix/3679

    7a1d787
  6. adangel
    closed this as completedin #3724on Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-negativePMD doesn't flag a problematic piece of code

    Type

    No type

    Projects

    No projects

      Milestone

      • 6.42.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.