Skip to content
Permalink
Browse files
8263353: assert(CompilerOracle::option_matches_type(option, value)) f…
…ailed: Value must match option type

Reviewed-by: neliasso, kvn
  • Loading branch information
DamonFool committed Mar 12, 2021
1 parent cf1c021 commit ad1f60541940ae59da2af63015c5b5038832a676
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
@@ -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");
@@ -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'"
}
};

0 comments on commit ad1f605

Please sign in to comment.