Skip to content

Commit

Permalink
remove the self-Import of gson.annotations
Browse files Browse the repository at this point in the history
based on google#2725 and bndtools/bnd#6220 (comment)
append -noimport:=true to all exports which we do not want to re-import
This avoids issues in OSGi environments where multiple versions of gson are deployed and com.google.gson.annotations causes wiring conflicts between these different versions
  • Loading branch information
chrisrueger committed Sep 3, 2024
1 parent 3feae55 commit 6baa56d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
-exportcontents:\
com.google.gson,\
com.google.gson.annotations,\
com.google.gson.annotations;-noimport:=true,\
com.google.gson.reflect,\
com.google.gson.stream
]]></bnd>
Expand Down
4 changes: 2 additions & 2 deletions gson/src/test/java/com/google/gson/regression/OSGiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public void testComGoogleGsonAnnotationsPackage() throws Exception {
Manifest mf = findManifest("com.google.gson");
String importPkg = mf.getMainAttributes().getValue("Import-Package");
assertWithMessage("Import-Package statement is there").that(importPkg).isNotNull();
assertWithMessage("There should be com.google.gson.annotations dependency")
assertWithMessage("There should be no com.google.gson.annotations dependency")
.that(importPkg)
.contains("com.google.gson.annotations");
.doesNotContain("com.google.gson.annotations");
}

@Test
Expand Down

0 comments on commit 6baa56d

Please sign in to comment.