8263353: assert(CompilerOracle::option_matches_type(option, value)) failed: Value must match option type

Reviewed-by: neliasso, kvn
This commit is contained in:
Jie Fu 2021-03-12 02:22:34 +00:00
parent cf1c0219ce
commit ad1f605419
2 changed files with 44 additions and 2 deletions

View File

@ -781,7 +781,14 @@ void CompilerOracle::parse_from_line(char* line) {
print_parse_error(error_buf, original.get());
return;
}
register_command(typed_matcher, option, true);
if (option2type(option) == OptionType::Bool) {
register_command(typed_matcher, option, true);
} else {
jio_snprintf(error_buf, sizeof(error_buf), " Missing type '%s' before option '%s'",
optiontype2name(option2type(option)), option2name(option));
print_parse_error(error_buf, original.get());
return;
}
}
assert(typed_matcher != NULL, "sanity");
assert(*error_buf == '\0', "No error here");

View File

@ -23,7 +23,7 @@
/*
* @test TestInvalidCompileCommand
* @bug 8263206
* @bug 8263206 8263353
* @summary Regression tests of -XX:CompileCommand
* @library /test/lib
* @run driver compiler.oracle.TestInvalidCompileCommand
@ -40,12 +40,47 @@ public class TestInvalidCompileCommand {
{
"-XX:CompileCommand=unknown",
"-version"
},
{
"-XX:CompileCommand=option,Test::test,TestOptionDouble,3.14",
"-version"
},
{
"-XX:CompileCommand=option,Test::test,TestOptionInt,3",
"-version"
},
{
"-XX:CompileCommand=option,Test::test,TestOptionUint,3",
"-version"
},
{
"-XX:CompileCommand=option,Test::test,TestOptionStr,hello",
"-version"
},
{
"-XX:CompileCommand=option,Test::test,TestOptionList,hello,world",
"-version"
}
};
private static final String[][] OUTPUTS = {
{
"Unrecognized option 'unknown'"
},
{
"Missing type 'double' before option 'TestOptionDouble'"
},
{
"Missing type 'intx' before option 'TestOptionInt'"
},
{
"Missing type 'uintx' before option 'TestOptionUint'"
},
{
"Missing type 'ccstr' before option 'TestOptionStr'"
},
{
"Missing type 'ccstrlist' before option 'TestOptionList'"
}
};