A RetroSearch Logo

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

Search Query:

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

[java] UselessOperationOnImmutable various false negatives with String · Issue #4513 · pmd/pmd · GitHub

Affects PMD Version: 6.x

Rule: UselessOperationOnImmutable

Description:

This is already fixed with PMD 7.0.0-rc1.
Found via #3123

Code Sample demonstrating the issue:

public class TestCase {
  public void method1(String s) {
    s.trim();
  }
  public void method2() {
   String.valueOf(0);
  }
  public void method3() {
   String.valueOf(0).trim();
  }
}

Expected outcome:

PMD should report a violation at lines 3,6,9 but doesn't. This is a false-negative.


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