编译OpenJDK12:test_json.cpp error C2143 语法错误

这个是代码错误,有点傻眼了。

  • 解决办法一:删除

从目录来看这个不是必须的。可以删除。

  • 解决办法二:修改代码
//错误修正参考:http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/dba0765d2b6d

先打开代码test/hotspot/gtest/utilities/test_json.cpp看看:

TEST_VM(utilities, json_key_values_1) {
    JSON_GTest::test("/* comment */{ key1 : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
            "{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
            " : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
}
 
TEST_VM(utilities, json_key_values_2) {
    JSON_GTest::test("/* comment */ { \"key1\" : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
            "{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
            " : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
}
 
TEST_VM(utilities, json_quoted_symbols) {
    JSON_GTest::test("/*comment*/{\"ff1 fsd\":{\"☃\":{\"☃\":[\"☃\",\"☃\"]},"
            "\"☃\":true},\"☃\":[\"☃\"],\"foo\":\"☃\",}", true);
}
 
TEST_VM(utilities, json_incorrect_key) {
    JSON_GTest::test("/* comment */ { key1 error : { \"☃\" : { \"☃\" : [ \"☃\","
            " \"☃\" ] }, \"☃\" : true }, \"baz\" : [ \"☃\" ], foo : \"☃\",}",
            false); // first key needs to be quoted since it contains a space
}

改成:

TEST_VM(utilities, json_key_values_1) {
    JSON_GTest::test("/* comment */{ key1 : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
            "{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
            " : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
}
 
TEST_VM(utilities, json_key_values_2) {
    JSON_GTest::test("/* comment */ { \"key1\" : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
            "{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
            " : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
}
 
TEST_VM(utilities, json_quoted_symbols) {
    JSON_GTest::test("/*comment*/{\"ff1 fsd\":{\"☃\":{\"☃\":[\"☃\",\"☃\"]},"
            "\"☃\":true},\"☃\":[\"☃\"],\"foo\":\"☃\",}", true);
}
 
TEST_VM(utilities, json_incorrect_key) {
    JSON_GTest::test("/* comment */ { key1 error : { \"☃\" : { \"☃\" : [ \"☃\","
            " \"☃\" ] }, \"☃\" : true }, \"baz\" : [ \"☃\" ], foo : \"☃\",}",
            false); // first key needs to be quoted since it contains a space
}

就是把一个特殊符号,用三个特殊的代替。

在word中插入特殊符号,选择拉丁语扩充-B

上一篇:平衡大师Sophos 最大安全供应商替代者


下一篇:SQLServer表变量对IO及内存影响测试