A RetroSearch Logo

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

Search Query:

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

[java] StringToString doesn't trigger on string literals · Issue #3681 · pmd/pmd · GitHub

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]


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