1.2.83 升级 2.0.40 值丢失?[BUG]
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
```Java
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Setter;
@Setter
public class TestVo implements Serializable {
@JsonIgnore
private String test1;
@JsonIgnore
@JSONField(serialize = false)
private String test2;
public String getTest1() {
if(StringUtil.isNotEmpty(test2)){
return test2;
}
return test1;
}
public static void main(String[] args) {
TestVo test = new TestVo();
test.setTest2("a");
System.out.println(JSON.toJSONString(test));
// 1.2.83 输出 {"test1":"a"} 2.0.40 输出 {}
}
}
```
Contributor guide
Research direction
Start with the TestVo main method and run the reproducer against versions 1.2.83 and 2.0.40, checking how the serializer handles the getter and its annotations. Trace the relevant serialization path and add a regression test; done means the reported value is handled consistently in 2.0.40.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100