-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]应该为null的List解析成ArrayList然后往里面添加一个null的item #525
Comments
Coloryr
changed the title
[BUG]List解析成ArrayList然后往里面添加一个null的项目
[BUG]应该为null的List解析成ArrayList然后往里面添加一个null的项目
Jul 2, 2022
Coloryr
changed the title
[BUG]应该为null的List解析成ArrayList然后往里面添加一个null的项目
[BUG]应该为null的List解析成ArrayList然后往里面添加一个null的item
Jul 2, 2022
没重现问题,测试代码如下: package com.alibaba.fastjson2.issues;
import com.alibaba.fastjson2.JSON;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
public class Issue525 {
@Test
public void test() {
String str = "{\"qq\":123456789,\"name\":\"xxx\",\"req\":null,\"groups\":null,\"qqList\":null}";
StartPack startPack = JSON.parseObject(str, StartPack.class);
assertEquals(123456789, startPack.qq);
assertEquals("xxx", startPack.name);
assertNull(startPack.reg);
assertNull(startPack.groups);
assertNull(startPack.qqList);
}
public static class StartPack
extends PackBase {
/**
* 插件名字
*/
public String name;
/**
* 注册的事件
*/
public List<Integer> reg;
/**
* 监听QQ群列表
*/
public List<Long> groups;
/**
* 监听QQ号列表
*/
public List<Long> qqList;
}
public abstract static class PackBase {
/*
* 运行QQ号
*/
public long qq;
}
} |
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.9-SNAPSHOT/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
直接上图看吧
2.0.6无此问题
2.0.8问题依旧存在
The text was updated successfully, but these errors were encountered: