3

Sweet Zombie NullFuckingPointerException...

New Rule: When creating an API (I'm looking at you, Java), designers must include a boolean flag in the parameter list of any method which throws a NullPointerException.
If TRUE, this means that a NULL result is non-trivial and the method should therefore THROW an NPE.
If set to FALSE, this means that NULL is completely f*cking trivial so whenever there's a NULL result, just instantiate a new instance of the return type and return that, 'cause that's what was gonna happen in the catch block of the NPE anyways.

Comments
  • 2
    gotta love c#
    if (TryDoSomething(input, out var output))
    {
    //do something with output
    }
  • 0
    Still amazes me how can people get npe, i dont remember it ever happening to me in the past 10 years.
Add Comment