A RetroSearch Logo

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

Search Query:

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

False positive when there is no initial String to append to · Issue #3492 · pmd/pmd · GitHub

Affects PMD Version: 6.37.0

Rule: UselessStringValueOf

Description: False positive, when there is no initial String to append to.

Code Sample demonstrating the issue:
40b5f95/#3490

public class Test {
    private short getPrefix(long id) {
        return 0;
    }
    private short getTimestamp(long id) {
        return 0;
    }
    private short getCounter(long id) {
        return 0;
    }
    public String toShortString(long id) {
        return String.valueOf(getPrefix(id)) + getTimestamp(id) + getCounter(id); // (12)
    }
}

Expected outcome:

PMD reports a violation at line 12, but that's wrong. That's a false positive.

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