A RetroSearch Logo

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

Search Query:

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

False negative with String-array access · Issue #2141 · pmd/pmd · GitHub

Affects PMD Version:
Running 6.19.0, 6.20.0.

Rule:
StringInstantiation

Description:
The rule does not catch String instantiation of array subscripted variable.

Code Sample demonstrating the issue:

package pmdtests;

public final class TestStringInstantiation {

  private TestStringInstantiation() {
    throw new IllegalStateException("Private constructor");
  }

  public static void main(String... args) {
    String[] vals = splitOn(args,2,"=");
    for (String val: vals)
      System.out.println(val);
 }
  
private static String[] splitOn(String[] values,int index, String separator) {
    return new String(values[index]).split(separator);
  }

}

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]


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