...
ERR09-EX0: It is permissible for a command-line utility to call System.exit()
, for example, when the required number of arguments are not input [Bloch 2008][ESA 2005].
Risk Assessment
Allowing unauthorized calls to System.exit()
may lead to denial of service (DoS).
...
On Android, System.exit()
should not be used because it will terminate the virtual machine abruptly, ignoring the activity lifecycle which may prevent proper garbage collection.
Bibliography
[API 2006] | Method |
9.5, The Finalize Method | |
[ESA 2005] | Rule 78. Restrict the use of the |
7.4, JVM Shutdown | |
Chapter 16, Intercepting a Call to |
...
Rule 07: Exceptional Behavior (ERR) Rule 08: Visibility and Atomicity (VNA)