According to the language specification, a throw statement is defined as:
throw Expression
And if the Expression evaluates to null, then a NullPointerException is thrown. Specifically,
If evaluation of the Expression completes normally, producing a
nullvalue, then an instance V’ of classNullPointerExceptionis created and thrown instead ofnull.
Since NullPointerException extends RuntimeException, it is an unchecked exception. This could explain why there’s no compile-time error reported from this construct.