In our team it is considered a bad practice to throw NullPointerException ,and we should use IllegalArgumentException and IllegalStateException instead. The request it to make a configurable check to forbid not only declaring certain types of exceptions, but also throwing it.
We use the following piece of configuration inside the module TreeWalker:
<property name="format" value="throw new NullPointerException"/>
<property name="message" value="Please throw IllegalArgumentException or IllegalStateException instead of NullPointerException!"/>
<property name="illegalPattern" value="true"/>
However we are concerned about efficiency of such way, it is not very convenient to alter this check, it raises warnings for commented code (it is a bad practice on its own, but it is a separate bad practice) and it do not raise warnings for something like this:
NullPointerException ex = new NullPointerException();