jakartaee / jakartaee/jsonb-api
private constructors for deserialization
- Dominant language
- Java
- Stars
- 95
- Forks
- 41
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 35
Description
Some use cases of a POJO demand that there is neither a *public* nor *protected* default constructor. For example, "effectively immutable" classes (i. e. classes being immutable by applications but are deserialized by JSON-P) will have no setters but just can be filled with values using a custom constructor. When _deserializing_ this instance it should be enough to have a `package-private` or `private` constructor. Unfortunately JSON-P explicitly requests `public` / `protected`.
Proposal: A future release of the spec should allow to use such constructors when annotated with `@JsonbConstructor` (even when the constructor has no parameters). This would be similar to the existing behavior that JSON-P can write `private` fields annotated by `@JsonbProperty` when having no setter method.
Contributor guide
Research direction
No files or tests are identified in the issue. Start by reviewing the JSON-B specification's constructor visibility rules and the existing @JsonbConstructor behavior. Done means defining and approving a specification change that permits annotated private or package-private no-argument constructors during deserialization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100