All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.java.rules.squid.S1850.html Maven / Gradle / Ivy

The newest version!

instanceof operators that always return true or false are either useless or the result of a misunderstanding which could lead to unexpected behavior in production.

Noncompliant Code Example

public boolean isSuitable(Integer param) {
...
  if(param instanceof Number) {  //Always true as param is an Integer, unless param is null
    doSomething();
  }
...
}

Compliant Solution

public boolean isSuitable(Integer param) {
...
  doSomething();
...
}

See





© 2015 - 2025 Weber Informatics LLC | Privacy Policy