null
JAVA-E1097Throwing null
is a bad practice and should be avoided, as it serves no meaningful purpose.
Throwing a literal null
value will cause Java to throw a NullPointerException
instead.
throw null;
If you need to throw a NullPointerException
, do so directly.
throw new NullPointerException("something was null!");