These days, having written about bad code for a few years now, it's pretty rare to uncover a new anti-pattern like the FOR-CASE paradigm, IHBLRIA, or RLB o'PCC. However, having seen snippet after snippet like todays two, I think it's finally time to identify the Null Understanding...

Daniel found this snippet during a code review that was left by a senior developer who, thankfully, is no longer with the company.

void failIfNull(Object o) throws RuntimeException {
  if (o == null)
  {
    throw new RuntimeException(o.getClass().getName() + " is null!");
  }
}

This next snippet was submitted anonymously, dug up from a large investment bank's global finance management application...

// An exception may be thrown before the [...] is fully initialised
if (this.equals(null))
{
  Warning.showWarning((JFrame) null, title, msg);
}
else
{
  Warning.showWarning(this, title, msg);
}