您当前的位置: 首页 >  json

柳鲲鹏

暂无认证

  • 0浏览

    0关注

    4642博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

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

柳鲲鹏 发布时间:2019-08-26 19:38:11 ,浏览量:0

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

  • 解决办法一:删除

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

 

  • 解决办法二:修改代码
//错误修正参考: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

关注
打赏
1665724893
查看更多评论
立即登录/注册

微信扫码登录

0.0522s