The function System.exit will never return control to the
code that called it, but the compiler has no way of
knowing that. It is just another method call to the
compiler. Because of this the compiler may complain
about uninitialized variables and may not optimize the
code as well. There is also a possibility that someone
may actually write code following the call to System.exit
that is in reality unreachable code and will never be
executed. And there is always the possibility that some
implementation might be broken and actually return
from System.exit and cause havoc.
I have therefore become convinced that it should be
considered a required practice to always follow
System.exit with throwing an exception of some kind.
This helps the compiler with optimization, recognizing
unreachable code, handling variable initialization, and
actually provides a safeguard for broken System.exit
I therefore propose a check that requires a throw
statement following any call to System.exit.