jackson-annotations icon indicating copy to clipboard operation
jackson-annotations copied to clipboard

Add record target type to `JsonPropertyDescription`

Open bcersows opened this issue 10 months ago • 7 comments

Hi!

Currently JsonPropertyDescription does not have a target type of RECORD_COMPONENT, making it impossible to read it out at runtime. Adding that would be great.

Cheers and thanks

bcersows avatar Jan 07 '26 14:01 bcersows

Which JDK is this available in? Unfortunately annotations must compile with JDK 8, to Java 8 bytecode.

cowtowncoder avatar Jan 07 '26 16:01 cowtowncoder

Oh no. I read somewhere that annotations already has a JDK16 baseline. Which is where this element has been added. Then maybe with an upcoming 3.x release.

bcersows avatar Jan 08 '26 06:01 bcersows

@bcersows Alas, no -- 3.x databind depends on 2.x annotations to maximize compatibility. See #307 and https://github.com/FasterXML/jackson-future-ideas/wiki/JSTEP-1#handling-of-jackson-annotations .

So this is bit of a problem. Might even lead to re-evaluating annotation question... But on short-to-medium term annotations are limited to Java 8.

cowtowncoder avatar Jan 08 '26 16:01 cowtowncoder

Pity. Would you like me to close the issue and PR?

bcersows avatar Jan 09 '26 08:01 bcersows

You can leave issue open as placeholder, maybe close PR.

cowtowncoder avatar Jan 09 '26 17:01 cowtowncoder

For Jackson 2.x this seems blocked by the Java 8 annotation target set, but it may still be worth documenting the intended Jackson 3.x behavior. If RECORD_COMPONENT can only be added once the annotations module baseline moves past Java 16, users need to know whether the interim recommendation is duplicating @JsonPropertyDescription on the accessor/field, or reading record component annotations through a separate introspection path.

hiSandog avatar Jul 02 '26 02:07 hiSandog

Eventually we do need to figure out upgrade path for jackson-annotations but for now Java 8 will remain baseline so this cannot be resolved. No change will come for 3.3 but even beyond that there's big decision wrt how exactly to re-create jackson-annotations 3.x series (wrt backwards compatibility).

cowtowncoder avatar Jul 02 '26 03:07 cowtowncoder