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] StringToString doesn't trigger on string literals · Issue #3681 · pmd/pmd

[java] StringToString doesn't trigger on string literals #3681

New issue
Copy link
New issue
Copy link
Closed
#4154
Closed
[java] StringToString doesn't trigger on string literals#3681
#4154
Copy link
Labels
a:false-negativePMD doesn't flag a problematic piece of code
Milestone
6.51.0

Description

@ghost
ghost
opened on Dec 9, 2021

Affects PMD Version:6.41.0

Rule:StringToString

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

Description:
I found a false negative about the rule StringToString, please refer to the minimized sample below.

PMD should have reported a warning at line 3, but it does not. However, this is definitely a String object calls toString() method. So, I think this is a false negative.

Code Sample demonstrating the issue:

class Impl {
  String foo() {
    return "123".toString();
  }
}

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 9, 2021
  2. adangel
    changed the title [-][java] Make StringToString can detect literal[/-] [+][java] StringToString doesn't trigger on string literals[/+] on Oct 13, 2022
  3. adangel
    added 2 commits that reference this issue on Oct 13, 2022

    [java] StringToString - consider literals

    This issue will close once commit b26e0bd is merged into the 'main' branch.
    b26e0bd

    [doc] Update release notes (pmd#2080, pmd#3437, pmd#3681, pmd#3977)

    This issue will close once commit 39c26d9 is merged into the 'main' branch.
    39c26d9
  4. adangel
    added this to the 6.51.0 milestone on Oct 13, 2022
  5. adangel
    closed this as completedin b26e0bdon Oct 28, 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.51.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.