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

Unresolved requirement: Import-Package: com.google.gson.internal.bind #52

Closed ChaosMarc closed 10 months ago

ChaosMarc commented 3 years ago

Hi,

when providing gson and gson-fire as modules in an osgi container gson-fire can't be resolved as it's referencing the internal package com.google.gson.internal.bind which is not exported by gson. Only by including both modules in every other module they're used in the problem disappears

I would love the get rid of all compileInclude statements and gson-fire is one of the last on my list I can't find a workaround for. Can you help me?

Thanks Marc

sjsajj commented 3 years ago

pull request #55 will resolve this issue

ChaosMarc commented 3 years ago

As sjsajj' fix sadly doesn't work I wanted to offer the workaround I'm using for now. I found https://github.com/stempler/bnd-platform with which I created my own gson-internal bundle which only exports the internal packages:

bundle("com.google.code.gson:gson:2.8.6") {
    bnd {
        symbolicName = 'com.google.code.gson-internal'
        bundleName = 'com.google.code.gson-internal'
        instruction 'Export-Package', 
                "com.google.gson.internal," +
                "com.google.gson.internal.bind," +
                "com.google.gson.internal.bind.util," +
                "com.google.gson.internal.reflect"
        instruction 'Private-Package', '*'
    }
}

I would nevertheless be happy about a "real" fix 😇 But I guess it's only possible by removing the usage of JsonTreeReader/JsonTreeWriter in gson-fire