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

Reviewed-by: dholmes, stuefe
This commit is contained in:
Sonia Zaldana Calles 2024-02-06 07:03:47 +00:00 committed by Thomas Stuefe
parent 9ee9f28849
commit 542b0b6656
2 changed files with 18 additions and 13 deletions

View file

@ -1119,18 +1119,7 @@ bool Arguments::process_argument(const char* arg,
if (found_flag != nullptr) {
char locked_message_buf[BUFLEN];
JVMFlag::MsgType msg_type = found_flag->get_locked_message(locked_message_buf, BUFLEN);
if (strlen(locked_message_buf) == 0) {
if (found_flag->is_bool() && !has_plus_minus) {
jio_fprintf(defaultStream::error_stream(),
"Missing +/- setting for VM option '%s'\n", argname);
} else if (!found_flag->is_bool() && has_plus_minus) {
jio_fprintf(defaultStream::error_stream(),
"Unexpected +/- setting in VM option '%s'\n", argname);
} else {
jio_fprintf(defaultStream::error_stream(),
"Improperly specified VM option '%s'\n", argname);
}
} else {
if (strlen(locked_message_buf) != 0) {
#ifdef PRODUCT
bool mismatched = ((msg_type == JVMFlag::NOTPRODUCT_FLAG_BUT_PRODUCT_BUILD) ||
(msg_type == JVMFlag::DEVELOPER_FLAG_BUT_PRODUCT_BUILD));
@ -1140,6 +1129,16 @@ bool Arguments::process_argument(const char* arg,
#endif
jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf);
}
if (found_flag->is_bool() && !has_plus_minus) {
jio_fprintf(defaultStream::error_stream(),
"Missing +/- setting for VM option '%s'\n", argname);
} else if (!found_flag->is_bool() && has_plus_minus) {
jio_fprintf(defaultStream::error_stream(),
"Unexpected +/- setting in VM option '%s'\n", argname);
} else {
jio_fprintf(defaultStream::error_stream(),
"Improperly specified VM option '%s'\n", argname);
}
} else {
if (ignore_unrecognized) {
return true;