Open Cooper-Zhong opened 3 weeks ago
使用fastjson兼容JSONPath.set返回true但没有实际修改成功。使用fastjson 1.x 正常。
JSONPath.set
import com.alibaba.fastjson.JSONPath; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class Issue2640_899 { @Test public void testWithMutatedBean() { BeanClass bean = new BeanClass(10, "Original"); System.out.println(JSONPath.set(bean, "$.intValue", 20)); assertEquals(20, bean.getIntValue()); } static class BeanClass { private int intValue; private String stringValue; public BeanClass(int intValue, String stringValue) { this.intValue = intValue; this.stringValue = stringValue; } public int getIntValue() { return intValue; } public String getStringValue() { return stringValue; } } }
true
org.opentest4j.AssertionFailedError: Expected :20 Actual :10
这个没有setter方法,不兼容是对的
明白了,感谢温少。我们前几天给您邮箱发了一封论文合作的邮件,想邀请您作为文章的共同作者。不知道您是否有兴趣参与?
好的,你先发给我看下内容哈
我们7月3日发送到shaojin.wensj@alibaba-inc.com这个邮箱了,请温少查收一下
已经回复,非常有意思的一个工作,很乐意参与一起完成。
非常感谢温少支持,刚给您发送了follow up的邮件,请查收一下
问题描述
使用fastjson兼容
JSONPath.set
返回true但没有实际修改成功。使用fastjson 1.x 正常。环境信息
重现步骤
相关日志输出
true
org.opentest4j.AssertionFailedError: Expected :20 Actual :10