From 6baa56d86ea1faee8a262b0e75fff17e132b5f14 Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Wed, 4 Sep 2024 00:28:12 +0200 Subject: [PATCH] remove the self-Import of gson.annotations based on #2725 and https://github.com/bndtools/bnd/issues/6220#issuecomment-2312660794 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 --- gson/pom.xml | 2 +- gson/src/test/java/com/google/gson/regression/OSGiTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gson/pom.xml b/gson/pom.xml index daf43ac480..4a35e97145 100644 --- a/gson/pom.xml +++ b/gson/pom.xml @@ -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 ]]> diff --git a/gson/src/test/java/com/google/gson/regression/OSGiTest.java b/gson/src/test/java/com/google/gson/regression/OSGiTest.java index 29ff39b8dd..475f3e27bb 100644 --- a/gson/src/test/java/com/google/gson/regression/OSGiTest.java +++ b/gson/src/test/java/com/google/gson/regression/OSGiTest.java @@ -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