JVM command-line flag argument validation [JEP 245]
In this chapter, you have gained exposure to much of the command-line flag usage with the Java 9 platform. Java Enhancement Proposal 245, titled Validate JVM Command-Line Flag Arguments, was created to ensure all JVM command-line flags with arguments are validated. The primary goals of this effort were:
- Avoid JVM crashes
- Provide error messages to inform of invalid flag arguments
As you can see from the following graphic, there was no attempt to auto-correct the flag argument errors; rather, just to identify the errors and prevent the JVM from crashing:
A sample error message is provided here and indicates that the flag argument was out of range. This error would be displayed during the flag argument range check performed during the JVM's initialization:
exampleFlag UnguardOnExecutionViolation = 4 is outside the allowed range [ 0 . . . 3]
Here are some specifics regarding this change to the Java platform:
- Expand on the current
globals.hpp
source...