diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index ecf46b450d..a3d6b950f9 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -14,12 +14,23 @@ This is a {{ site.pmd.release_type }} release. ### New and noteworthy +#### Renamed Rules + +* The Java rule {% rule "java/errorprone/DoNotCallSystemExit" %} has been renamed to + {% rule "java/errorprone/DoNotTerminateVM" %}, since it checks for all the following calls: + `System.exit(int)`, `Runtime.exit(int)`, `Runtime.halt(int)`. All these calls terminate + the Java VM, which is bad, if the VM runs an application server which many independent applications. + ### Fixed Issues +* java-errorprone + * [#2157](https://github.com/pmd/pmd/issues/2157): \[java] Improve DoNotCallSystemExit: permit call in main(), flag System.halt + ### API Changes ### External Contributions +* [#2803](https://github.com/pmd/pmd/pull/2803): \[java] Improve DoNotCallSystemExit (Fixes #2157) - [Vitaly Polonetsky](https://github.com/mvitaly) * [#2809](https://github.com/pmd/pmd/pull/2809): \[java] Move test config from file to test class - [Stefan Birkner](https://github.com/stefanbirkner) * [#2810](https://github.com/pmd/pmd/pull/2810): \[core] Move method "renderTempFile" to XMLRendererTest - [Stefan Birkner](https://github.com/stefanbirkner) diff --git a/pmd-java/src/main/resources/category/java/errorprone.xml b/pmd-java/src/main/resources/category/java/errorprone.xml index 94875fb765..d0ac48edb3 100644 --- a/pmd-java/src/main/resources/category/java/errorprone.xml +++ b/pmd-java/src/main/resources/category/java/errorprone.xml @@ -1296,42 +1296,7 @@ public class GCCall { - - -Web applications should not call System.exit(), since only the web container or the -application server should stop the JVM. This rule also checks for the equivalent call Runtime.getRuntime().exit(). - - 3 - - - - - - - - - - - - + + + +Web applications should not call `System.exit()`, since only the web container or the +application server should stop the JVM. Otherwise a web application would terminate all other applications +running on the same application server. + +This rule also checks for the equivalent calls `Runtime.getRuntime().exit()` and `Runtime.getRuntime().halt()`. + +This rule was called *DoNotCallSystemExit* until PMD 6.29.0. + + 3 + + + + + + + + + + + + + basic violations - 1 + 2 basic violations with Runtime - 1 + 2 + + + system exit in main + 0 + + + + + system exit in anonymous class inside main + 1 + + +