mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8017611: Auto corrector for mistyped vm options
The auto corrector for mistyped vm options fuzzy-matches existing flags based on string similarity (Dice's coefficient). Reviewed-by: kvn, dsamersoff, hseigel, johnc
This commit is contained in:
parent
f93ee2a9dd
commit
7109e85e43
4 changed files with 128 additions and 4 deletions
|
@ -849,7 +849,7 @@ bool Arguments::process_argument(const char* arg,
|
|||
arg_len = equal_sign - argname;
|
||||
}
|
||||
|
||||
Flag* found_flag = Flag::find_flag((char*)argname, arg_len, true);
|
||||
Flag* found_flag = Flag::find_flag((const char*)argname, arg_len, true);
|
||||
if (found_flag != NULL) {
|
||||
char locked_message_buf[BUFLEN];
|
||||
found_flag->get_locked_message(locked_message_buf, BUFLEN);
|
||||
|
@ -870,6 +870,14 @@ bool Arguments::process_argument(const char* arg,
|
|||
} else {
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
"Unrecognized VM option '%s'\n", argname);
|
||||
Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true);
|
||||
if (fuzzy_matched != NULL) {
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
"Did you mean '%s%s%s'?\n",
|
||||
(fuzzy_matched->is_bool()) ? "(+/-)" : "",
|
||||
fuzzy_matched->name,
|
||||
(fuzzy_matched->is_bool()) ? "" : "=<value>");
|
||||
}
|
||||
}
|
||||
|
||||
// allow for commandline "commenting out" options like -XX:#+Verbose
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue