FasterXML / FasterXML/jackson-databind

Add a feature to require "complete" creators; that is, to prevent use of setters if using property-based creator

未关闭
#567 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
3.7k
派生
1.5k
平均合并
3 天 6 小时
30 天内合并 PR
28

描述

(note: migrated from https://github.com/FasterXML/jackson-core/issues/154 by @benson-basis)

---

I was surprised to learn that Jackson will combine `@JsonCreator` with patching properties. Even, in particular, protected final properties. When I wrote a mixin with `@JsonCreator`, I thought that I was specifying the one and only way (give or take other annotated constructors) to construct the class.

I wish that there was an option to set that would have this effect, and throw rather than patch a property if the `JsonCreator` is not usable in a deserialization.

---

My view of the semantics I want is

```
@JsonCreator(Complete = true)
```

If any `@JsonCreator` says this, then if Jackson feels a need to call a setter or patch a property, it should throw instead. For this to work, my other idea about JsonAnySetter versus JsonCreator has to be done, too.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。