RFR: 8324126: Error message for mistyping -XX:+Unlock...Options is not helpful

Thomas Stuefe stuefe at openjdk.org
Fri Jan 26 06:02:35 UTC 2024


On Thu, 25 Jan 2024 19:01:18 GMT, Sonia Zaldana Calles <szaldana at openjdk.org> wrote:

> If we run the VM option to unlock experimental vm options without the preceding ‘+’, the error message is not very helpful: 
> 
> ```Error: VM option 'UnlockExperimentalVMOptions' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions.```
> 
> With the proposed change, we should see a more descriptive error message, namely the lack of a +/- sign. 
> 
> ```Missing +/- setting for VM option 'UnlockExperimentalVMOptions'```
> 
> Testing: runtime/commandLine regression tests pass. Also added a regression test to verify expected behaviour.

Mechanically, the fix looks okay. But we now will always, when missing +- for a locked option, print "missing +-":

Example:

"-XX:UseCompactObjectHeaders"
-> "missing +-"
User corrects:
"-XX:+UseCompactObjectHeaders"
-> "needs to be unlocked"

I think this is fine, and a minor concern, but let's ask @dholmes-ora.

The alternative would be to not make "UseDiagnosticVMOptions" option itself diagnostic, and vice versa with UseExperimentalVMOptions. Wonder what the reason for that was, @dholmes-ora ?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17575#issuecomment-1911528419


More information about the hotspot-runtime-dev mailing list