RuedigerMoeller / fast-serialization

FST: fast java serialization drop in-replacement
Apache License 2.0
1.58k stars 248 forks source link

Manifest OSGi Import-Packages should not contain "com.google.gson.internal" #335

Open Hannu1 opened 1 year ago

Hannu1 commented 1 year ago

Has this project moved? I can't seem to find the latest changes. Latest release in maven central is 3.0.4-jdk17.

This issue relates to version 3.0.4-jdk17.

In FSTConfiguration class android configuration uses Class.forName("com.google.gson.internal.LinkedTreeMap") and Class.forName("com.google.gson.internal.LinkedHashTreeMap"). maven-bundle-plugin probably notices these and adds "com.google.gson.internal" as an Import-Package in MANIFEST.MF. Manifest also contains "DynamicImport-Package: *" so this import is not necessary. Other option could be to declare the import optional, since it is only for android.

Fix could be to change pom.xml line: <Import-Package>*</Import-Package> to <Import-Package>!com.google.gson.internal.*,*</Import-Package>

or if you would like to make it optional: <Import-Package>com.google.gson.internal.*;resolution=optional,*</Import-Package>

Also maven-bundle-plugin shouldn't be a compile dependency and should be removed from "dependencies" element. (Separate issue #328)

EDIT: Added .* to the exclusion example and added the optional example. Also cleaned up the text a bit.