TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - Java Coding Standard
Search

Rule:  Basic25Checked automatically with code checker

Synopsis:The null check here is misplaced; if the variable is null there'll be a NullPointerException
Language:Java
Severity Level:1
Category:Basic


Description:
The null check here is misplaced. if the variable is null you'll get a NullPointerException. Either the check is useless (the variable will never be "null") or it's incorrect.
public class Foo {
 void bar() {
  if (a.equals(baz) || a == null) {}
 }
}