JDK-8308679 : Exit VM for CompileCommand parsing errors
  • Type: CSR
  • Component: hotspot
  • Sub-Component: compiler
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 22
  • Submitted: 2023-05-23
  • Updated: 2023-05-31
  • Resolved: 2023-05-31
Related Reports
CSR :  
Description
# Summary 
CompileCommand prints an error for parsing errors. The VM should exit the VM after the error. 

# Problem
At the moment, errors during CompileCommand parsing just print an error but do not exit the VM. As a result, issues like [JDK-8282715] go unnoticed. 

E.g. `java -XX:CompileCommand=compileonly,HashMap:: -version` prints an error message but continues afterwards with the command:
```
CompileCommand: An error occurred during parsing
Error: Could not parse method pattern
Line: 'compileonly,HashMap::'

Usage: '-XX:CompileCommand=<option>,<method pattern>' - to set boolean option to true
Usage: '-XX:CompileCommand=<option>,<method pattern>,<value>'
Use:   '-XX:CompileCommand=help' for more information and to list all option.
```
# Solution
Exit the VM after the `CompileCommand: An error occurred during parsing ` error message. 

# Specification
E.g. `java -XX:CompileCommand=compileonly,HashMap:: -version` will exit the VM after a parsing error occurred.  
```
CompileCommand: An error occurred during parsing
Error: Could not parse method pattern
Line: 'compileonly,HashMap::'

Usage: '-XX:CompileCommand=<option>,<method pattern>' - to set boolean option to true
Usage: '-XX:CompileCommand=<option>,<method pattern>,<value>'
Use:   '-XX:CompileCommand=help' for more information and to list all option.

Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
```
Comments
Moving to Approved for JDK 22.
31-05-2023

I have added a release note https://bugs.openjdk.org/browse/JDK-8309190
31-05-2023

Moving to Provisional for JDK 22 contingent on a release note being written.
27-05-2023