julman99 / gson-fire

A java library that adds some very useful features to Gson, like Date serializing to unix timestamp or RFC3339, method (getters) serialization, pre/post processors and many others. Check out the documentation to learn how to use it!
http://gsonfire.io
Other
226 stars 36 forks source link

osgi is not more compatible with new version of gson #58

Closed p4535992 closed 2 years ago

p4535992 commented 2 years ago

In my use case i'm usin gson-fire version 1.8.5 e Gson 2.8.5.

507 | Installed |  80 | 1.8.5                                    | Gson on Fire!
510 | Active    |  80 | 2.8.5                                    | Gson
karaf@root()> start 507
Error executing command: Error executing command on bundles:
        Error starting bundle 507: Unable to resolve io.gsonfire [507](R 507.0): missing requirement [io.gsonfire [507](R 507.0)] osgi.wiring.package; (osgi.wiring.package=com.google.gson.internal.bind) Unresolved requirements: [[io.gsonfire [507](R 507.0)] osgi.wiring.package; (osgi.wiring.package=com.google.gson.internal.bind)]

It’s probably due to the Gson upgrade. The new bundle no longer exports the com.google.gson.internal package. That package is considered internal, i.e. not part of the API so it should never have been exported by the bundle or used by any add-on. The classes in this package can have breaking changes with any release.

The solution is probably to removed the import com.google.gson.internal from the bnd manifest.

I see the solution is already done here: https://github.com/escv/gson-fire/commit/bf14654d2a3cf1f14a44988e7f080708a35be447

ChaosMarc commented 2 years ago

This is a duplicate to https://github.com/julman99/gson-fire/issues/52. Another solution was discussed there. I'm not a fan of just marking unresolvable dependencies as optional because this way the gson-fire code that needs the internal gson libraries will throw ClassNotFoundExceptions at runtime...