Password4j/password4j

Remove this unnecessary cast to "xxx".

firaja opened this issue · 2 comments

From sonarcloud report: Casting may be required to distinguish the method to call in the case of overloading

Noncompliant

public void example() {
  for (Foo obj : (List<Foo>) getFoos()) {  // Noncompliant; cast unnecessary because List<Foo> is what's returned
    //...
  }
}

public List<Foo> getFoos() {
  return this.foos;
}

Compliant

public void example() {
  for (Foo obj : getFoos()) {
    //...
  }
}

public List<Foo> getFoos() {
  return this.foos;
}

Can I be assigned to this issue @firaja