Skip to content

Make TokenBuffer(JsonParser, ObjectReadContext) constructor public #5101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sdeleuze opened this issue Apr 23, 2025 · 3 comments
Closed

Make TokenBuffer(JsonParser, ObjectReadContext) constructor public #5101

sdeleuze opened this issue Apr 23, 2025 · 3 comments
Labels
3.0 Issue planned for initial 3.0 release

Comments

@sdeleuze
Copy link

sdeleuze commented Apr 23, 2025

I am working on adding support for Jackson 3 in Spring Framework 7.

We would need TokenBuffer(JsonParser, ObjectReadContext) to be public not just protected as we use it there.

I would also welcome guidance on how to get the required ObjectReadContext as ObjectMapper#_deserializationContext is documented as "only public to allow for testing".

@sdeleuze sdeleuze added the to-evaluate Issue that has been received but not yet evaluated label Apr 23, 2025
@cowtowncoder
Copy link
Member

cowtowncoder commented Apr 23, 2025

@sdeleuze And this is for Jackson 3.0, right? So tools.jackson.databind.util.TokenBuffer.

Intent is to use factory method instead of contructor, there is:

public static TokenBuffer forBuffering(JsonParser p, ObjectReadContext ctxt) {

which is why constructor itself is protected (to allow factory method to perform whatever initialization might be needed in future).

As to ObjectReadContext: most usage is intended to go via DeserializationContext which has:

public TokenBuffer bufferForInputBuffering(JsonParser p) {

passing this as ObjectReadContext. But in general wherever code is to get a TokenBuffer, expectation is that DeserializationContext would be available; typically from ValueDeserializer or another handler to which one is passed. So usually it's part of deserialization processing workflow.

But if it is known that no calls are made that need the context, passing ObjectReadContext.empty() works fine. Many unit tests on jackson-core do that.

@cowtowncoder cowtowncoder added 3.0 Issue planned for initial 3.0 release and removed to-evaluate Issue that has been received but not yet evaluated labels Apr 24, 2025
@sdeleuze
Copy link
Author

Make sense, thanks for your feedback.

@sdeleuze sdeleuze closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2025
@sdeleuze
Copy link
Author

See #5110 related issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.0 Issue planned for initial 3.0 release
Projects
None yet
Development

No branches or pull requests

2 participants