A RetroSearch Logo

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

Search Query:

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

[java] AddEmptyString - false negative with empty var · Issue #3625 · pmd/pmd · GitHub

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]


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