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] AddEmptyString - false negative with empty var · Issue #3625 · pmd/pmd

[java] AddEmptyString - false negative with empty var #3625

New issue
Copy link
New issue
Copy link
Closed
#3984
Closed
[java] AddEmptyString - false negative with empty var#3625
#3984
Copy link
Assignees
LiGaOg
Labels
a:false-negativePMD doesn't flag a problematic piece of code
Milestone
6.48.0

Description

@ghost
ghost
opened on Nov 15, 2021

Affects PMD Version:
6.39.0

Rule:
AddEmptyString

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

Description:
PMD should have reported a warning at line 3, because String variable test adds an empty string, but it doesn't. This can lead to performance issue. So, I think it is a false negative. Thanks for your consideration.
Code Sample demonstrating the issue:

public void func() {
    final String var = "";
    String test = var + "123";  // 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 Nov 15, 2021
  2. adangel
    changed the title [-][Java] A false negative about the rule AddEmptyString[/-] [+][java] AddEmptyString - false negative with empty var[/+] on Nov 16, 2021
  3. LiGaOg commented on Apr 23, 2022

    @LiGaOg
    LiGaOg
    on Apr 23, 2022
    More actions

    Please assign this issue to me

  4. adangel
    added this to the 6.47.0 milestone on May 28, 2022
  5. adangel
    assigned
    LiGaOg
    on Jun 2, 2022
  6. adangel
    removed this from the 6.47.0 milestone on Jun 2, 2022
  7. adangel
    added this to the 6.48.0 milestone on Jul 1, 2022
  8. adangel
    added a commit that references this issue on Jul 1, 2022

    [doc] Update release notes (pmd#3984, pmd#3625)

    cfcfa32
  9. adangel
    closed this as completedin #3984on Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @LiGaOg
    LiGaOg

Labels

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

Type

No type

Projects

No projects

    Milestone

    • 6.48.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.