Coder Social home page Coder Social logo

Comments (5)

pose avatar pose commented on September 7, 2024

Hi @hexangular,

Unfortunately, people using our library could be using a different Jackson version (this was the case why we decided to merge this change, see #6). I agree is not elegant repackaging but how would you address having different versions of Jackson? Do you think there is a better and more elegant way to tackle the issue?

Thanks in advance,

from java-jwt.

kucharzyk avatar kucharzyk commented on September 7, 2024

Hi @pose ,

Maybe can You provide some kind of adapter for users and remove Jackson from dependencies.
Adapter interface would have all serialization/deserialization methods and user would implement it using his version of Jackson or maybe even using different library.

It would require a liite more work from users but I think It can be a solution.

What do You think?

from java-jwt.

pose avatar pose commented on September 7, 2024

Hi @hexangular,

One of the guiding lights of java-jwt is making the library simple to use. That means that we should provide a default JSON serialization/deserialization mechanism in the library. I agree with your point of creating an Adapter Interface as long as is clear and doesn't add much complexity or too many abstractions but by default it should work as it does now.

Maybe there is another way to solve this: What if we use optional dependencies in Maven? I'm thinking something like, if you include GSON or your own JSON library we use that but if we don't find it we switch to our default. One of the drawbacks would be that those checks could be expensive as they use reflection. Thoughts?

from java-jwt.

thaggie avatar thaggie commented on September 7, 2024

Or you could provide multiple binaries and let consumers decide whether or not to have things repackaged.

from java-jwt.

cowtowncoder avatar cowtowncoder commented on September 7, 2024

Couple of comments here, in case they might help.

First, while it makes sense to repackage some of Jackson code (like streaming parser/generator, jackson-core and databinding, jackson-databind), it may not make as much sense to repackage annotations under com.fasterxml.jackson.annotation. That package is much more static and slow moving, and rarely causes version conflicts. So perhaps leaving annotations package in its original Java package would be the best way? This would allow working with both vanilla Jackson 2.x and repackaged version(s).

Second: all access to annotations by Jackson is via abstract (AnnotationIntrospector), so it is actually possible to add support both for "alien" annotations (like JAXB), old versions (use Jackson 1.x annotations with Jackson 2.x) and repackaged variants. Not sure if this helps here -- probably not? -- but perhaps worth mentioning.

from java-jwt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.