Here I will post the things which I stumble upon when writing code in Java.
I use org.apache.commons.lang3.Validate for validation and (un)surprisingly it has a few overloads for perfomance:
isTrue(boolean)
isTrue(boolean, String, long)
isTrue(boolean, String, double)
isTrue(boolean, String, Object...)
So when I write code like this, I get a NullPointerException right away, because the overload with long is selected:
... Long value ...
Validate.isTrue(value == null || value > 0, "value non-positive: %d", value);
