From 8cc01b4d0f882db8cd91aaa813f0601a59de707c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20R=C3=BCtter?= Date: Sun, 1 Dec 2024 13:37:31 +0100 Subject: [PATCH 1/7] FELIX-6741 Upgrade dependencies for maven-bundle-plugin - Upgrade all dependencies, including bnd 7.1.0 --- tools/maven-bundle-plugin/changelog.txt | 5 +++ tools/maven-bundle-plugin/pom.xml | 41 +++++++++++-------- .../felix/bundleplugin/BundlePlugin.java | 3 +- .../bundleplugin/baseline/BaselineReport.java | 33 ++++++++------- 4 files changed, 45 insertions(+), 37 deletions(-) diff --git a/tools/maven-bundle-plugin/changelog.txt b/tools/maven-bundle-plugin/changelog.txt index 5a60fdadaf..f0fb150f5c 100644 --- a/tools/maven-bundle-plugin/changelog.txt +++ b/tools/maven-bundle-plugin/changelog.txt @@ -1,3 +1,8 @@ +Changes from 6.0.0 to 6.1.0 +--------------------------- +* Improvement + * FELIX-6741 Upgrade dependencies for maven-bundle-plugin (bnd 7.1.0 among other updates). See https://github.com/bndtools/bnd/wiki/Changes-in-7.1.0 + Changes from 5.1.9 to 6.0.0 --------------------------- * Improvement diff --git a/tools/maven-bundle-plugin/pom.xml b/tools/maven-bundle-plugin/pom.xml index 19848a9658..93d43c7e52 100644 --- a/tools/maven-bundle-plugin/pom.xml +++ b/tools/maven-bundle-plugin/pom.xml @@ -168,72 +168,77 @@ org.osgi - org.osgi.core - 6.0.0 + osgi.core + 8.0.0 + + + org.apache.felix + org.apache.felix.metatype + 1.2.4 biz.aQute.bnd biz.aQute.bndlib - 7.0.0 + 7.1.0 org.slf4j slf4j-api - 1.7.25 + 2.0.16 org.apache.felix org.apache.felix.bundlerepository - 1.6.6 + 2.0.10 org.apache.felix org.apache.felix.utils - 1.6.0 + 1.11.8 org.apache.maven maven-core - 3.8.1 + 3.9.9 provided org.apache.maven maven-model - 3.3.9 + 3.9.9 provided org.apache.maven maven-artifact - 3.3.9 + 3.9.9 provided org.apache.maven maven-compat - 3.8.1 + 3.9.9 provided org.apache.maven.reporting maven-reporting-api - 3.0 + 4.0.0 org.apache.maven maven-archiver - 3.5.2 + 3.6.3 org.apache.maven.shared maven-dependency-tree - 3.0 + 3.3.0 org.codehaus.plexus plexus-utils - 3.3.0 + 4.0.2 org.sonatype.plexus @@ -243,17 +248,17 @@ org.apache.maven.doxia doxia-sink-api - 1.0 + 2.0.0 org.apache.maven.doxia doxia-site-renderer - 1.0 + 2.0.0 org.apache.maven.plugin-tools maven-plugin-annotations - 3.4 + 3.15.1 provided @@ -271,7 +276,7 @@ junit junit - 4.13.1 + 4.13.2 test diff --git a/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java index 7c54ba1b75..db38474ae1 100644 --- a/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java +++ b/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java @@ -550,8 +550,7 @@ protected Builder getOSGiBuilder( MavenProject currentProject, Map Date: Sun, 5 Jan 2025 07:40:47 +0100 Subject: [PATCH 2/7] FELIX-6741-Upgrade-dependencies-for-maven-bundle-plugin - Reset maven version to 3.3.9, as specified in bnd 7.1.0 changelog - Fix tests; add build timestamp greater than 1980 (required in new maven-archiver) - Fix tests; change bnd version --- tools/maven-bundle-plugin/pom.xml | 4 ++-- .../maven-bundle-plugin/src/it/reproducible-manifest/pom.xml | 2 +- tools/maven-bundle-plugin/src/it/reproducible/pom.xml | 2 +- .../src/it/with-multi-release-jar/verify.groovy | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/maven-bundle-plugin/pom.xml b/tools/maven-bundle-plugin/pom.xml index 93d43c7e52..c3fd3b6349 100644 --- a/tools/maven-bundle-plugin/pom.xml +++ b/tools/maven-bundle-plugin/pom.xml @@ -199,13 +199,13 @@ org.apache.maven maven-core - 3.9.9 + 3.3.9 provided org.apache.maven maven-model - 3.9.9 + 3.3.9 provided diff --git a/tools/maven-bundle-plugin/src/it/reproducible-manifest/pom.xml b/tools/maven-bundle-plugin/src/it/reproducible-manifest/pom.xml index 38f3ae2444..40368a44cb 100644 --- a/tools/maven-bundle-plugin/src/it/reproducible-manifest/pom.xml +++ b/tools/maven-bundle-plugin/src/it/reproducible-manifest/pom.xml @@ -26,7 +26,7 @@ under the License. - 1 + 2023-01-01T00:00:00Z diff --git a/tools/maven-bundle-plugin/src/it/reproducible/pom.xml b/tools/maven-bundle-plugin/src/it/reproducible/pom.xml index d0ae17c502..3f17290c44 100644 --- a/tools/maven-bundle-plugin/src/it/reproducible/pom.xml +++ b/tools/maven-bundle-plugin/src/it/reproducible/pom.xml @@ -25,7 +25,7 @@ under the License. 1-SNAPSHOT bundle - 1 + 2023-01-01T00:00:00Z diff --git a/tools/maven-bundle-plugin/src/it/with-multi-release-jar/verify.groovy b/tools/maven-bundle-plugin/src/it/with-multi-release-jar/verify.groovy index 54aa86f9a3..e01b3f62e0 100644 --- a/tools/maven-bundle-plugin/src/it/with-multi-release-jar/verify.groovy +++ b/tools/maven-bundle-plugin/src/it/with-multi-release-jar/verify.groovy @@ -20,7 +20,7 @@ String manifest = new File( basedir, "target/classes/META-INF/MANIFEST.MF" ).tex assert !manifest.isEmpty() manifest.eachLine() { line -> - if (line.contains("Tool") && !line.contains("7.0.0")) { + if (line.contains("Tool") && !line.contains("7.1.0")) { throw new Exception("Wrong bnd version used"); } if (line.contains("Embedded-Artifacts") && !line.contains("jersey-server-3.1.7.jar")) { From 4556b12f181813ca7ce549520f77d907d2fa8b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20R=C3=BCtter?= Date: Sun, 5 Jan 2025 07:48:00 +0100 Subject: [PATCH 3/7] FELIX-6741-Upgrade-dependencies-for-maven-bundle-plugin - Don't lower maven version used earlier --- tools/maven-bundle-plugin/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/maven-bundle-plugin/pom.xml b/tools/maven-bundle-plugin/pom.xml index c3fd3b6349..3cbe341d59 100644 --- a/tools/maven-bundle-plugin/pom.xml +++ b/tools/maven-bundle-plugin/pom.xml @@ -199,7 +199,7 @@ org.apache.maven maven-core - 3.3.9 + 3.8.1 provided @@ -211,13 +211,13 @@ org.apache.maven maven-artifact - 3.9.9 + 3.3.9 provided org.apache.maven maven-compat - 3.9.9 + 3.8.1 provided From 56287137b695848c2d525b814041c33e8d440a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20R=C3=BCtter?= Date: Sun, 5 Jan 2025 09:08:58 +0100 Subject: [PATCH 4/7] FELIX-6741-Upgrade-dependencies-for-maven-bundle-plugin - Add integration test for Export-Package / Import-Package, based on https://github.com/bndtools/bnd/pull/6270 - This is backwards compatible, as maven-bundle-plugin automatically adds a version for all Export-Package statements if not specified (1.0.0) These instructions: ``` org.apache.felix.test1,org.apache.felix.test2;version="1-SNAPSHOT" org.apache.felix.test1,org.apache.felix.test2 ``` Lead to these manifest entries: ``` Export-Package: org.apache.felix.test1;version="1.0.0",org.apache.felix. test2;version="1.0.0.SNAPSHOT" Import-Package: org.apache.felix.test1,org.apache.felix.test2;version="[ 1.0,2)" ``` --- .../pom.xml | 51 +++++++++++++++++++ .../java/org/apache/felix/test1/Dummy.java | 21 ++++++++ .../java/org/apache/felix/test2/Dummy2.java | 21 ++++++++ .../verify.groovy | 35 +++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/pom.xml create mode 100644 tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test1/Dummy.java create mode 100644 tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test2/Dummy2.java create mode 100644 tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/verify.groovy diff --git a/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/pom.xml b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/pom.xml new file mode 100644 index 0000000000..5b4209ce89 --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/pom.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + org.apache.felix.bundleits + unversioned-export-package-still-imported + 1-SNAPSHOT + bundle + + + + org.apache.maven.plugins + maven-compiler-plugin + + 17 + 17 + + + + org.apache.felix + maven-bundle-plugin + @project.version@ + true + + + org.apache.felix.test1,org.apache.felix.test2;version="1-SNAPSHOT" + org.apache.felix.test1,org.apache.felix.test2 + + + + + + diff --git a/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test1/Dummy.java b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test1/Dummy.java new file mode 100644 index 0000000000..30f4f42293 --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test1/Dummy.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.felix.test1; +public class Dummy { +} \ No newline at end of file diff --git a/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test2/Dummy2.java b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test2/Dummy2.java new file mode 100644 index 0000000000..90e34e9370 --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test2/Dummy2.java @@ -0,0 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.felix.test2; +public class Dummy2 { +} \ No newline at end of file diff --git a/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/verify.groovy b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/verify.groovy new file mode 100644 index 0000000000..ee2ae918d0 --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/verify.groovy @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +String manifest = new File( basedir, "target/classes/META-INF/MANIFEST.MF" ).text +assert !manifest.isEmpty() + +manifest.eachLine() { line -> + if (line.contains("Import-Package") && !line.contains("org.apache.felix.test1")) { + // See https://github.com/bndtools/bnd/pull/6270 + // bnd 7.1.0 by default would not add this to the Import-Package, as the version range is not specified + // the maven-bundle-plugin doesn't have this issue, as a default version is added to the Export-Package statement + // automatically if missing + throw new Exception("Unversioned Export-Package statements should also be added to Import-Package statements, as maven-bundle-plugin adds a default version (1.0.0)"); + } + if (line.contains("Import-Package") && !line.contains("org.apache.felix.test2;version=")) { + throw new Exception("Versioned Export-Package should be part of the Import-Package, as it contains an explicit version range"); + } +} + + From 1ab84cecbefd4d8e43d8a8c7621ae7734be897d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20R=C3=BCtter?= Date: Mon, 27 Jul 2026 11:36:22 +0200 Subject: [PATCH 5/7] FELIX-6741 Upgrade bndlib to 7.3.0 - Bump biz.aQute.bndlib 7.1.0 -> 7.3.0 - Update integration test assertions/comments referencing the bnd version - Update changelog Co-Authored-By: Claude Opus 4.8 --- .../it/unversioned-export-package-still-imported/verify.groovy | 2 +- .../src/it/with-multi-release-jar/verify.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/verify.groovy b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/verify.groovy index ee2ae918d0..3fbef40033 100644 --- a/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/verify.groovy +++ b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/verify.groovy @@ -22,7 +22,7 @@ assert !manifest.isEmpty() manifest.eachLine() { line -> if (line.contains("Import-Package") && !line.contains("org.apache.felix.test1")) { // See https://github.com/bndtools/bnd/pull/6270 - // bnd 7.1.0 by default would not add this to the Import-Package, as the version range is not specified + // bnd 7.3.0 by default would not add this to the Import-Package, as the version range is not specified // the maven-bundle-plugin doesn't have this issue, as a default version is added to the Export-Package statement // automatically if missing throw new Exception("Unversioned Export-Package statements should also be added to Import-Package statements, as maven-bundle-plugin adds a default version (1.0.0)"); diff --git a/tools/maven-bundle-plugin/src/it/with-multi-release-jar/verify.groovy b/tools/maven-bundle-plugin/src/it/with-multi-release-jar/verify.groovy index e01b3f62e0..24adf082dc 100644 --- a/tools/maven-bundle-plugin/src/it/with-multi-release-jar/verify.groovy +++ b/tools/maven-bundle-plugin/src/it/with-multi-release-jar/verify.groovy @@ -20,7 +20,7 @@ String manifest = new File( basedir, "target/classes/META-INF/MANIFEST.MF" ).tex assert !manifest.isEmpty() manifest.eachLine() { line -> - if (line.contains("Tool") && !line.contains("7.1.0")) { + if (line.contains("Tool") && !line.contains("7.3.0")) { throw new Exception("Wrong bnd version used"); } if (line.contains("Embedded-Artifacts") && !line.contains("jersey-server-3.1.7.jar")) { From f202ae4e2940bf6d78275995a4a843a2e2855d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20R=C3=BCtter?= Date: Mon, 27 Jul 2026 11:44:01 +0200 Subject: [PATCH 6/7] FELIX-6741 Add integration test for bnd 7.2.0 Proxy.newProxyInstance import detection Packages referenced only through the method signatures of an interface passed to Proxy.newProxyInstance are now added to Import-Package (bnd 7.2.0+, disableable via -noproxyinterfaces). The interface lives in a separate provider module so the bundle's own bytecode never references the method-signature package directly, isolating the new detection behavior. Co-Authored-By: Claude Opus 4.8 --- .../it/proxy-interface-import/bundle/pom.xml | 54 +++++++++++++++++++ .../org/apache/felix/proxy/client/Client.java | 38 +++++++++++++ .../src/it/proxy-interface-import/pom.xml | 48 +++++++++++++++++ .../proxy-interface-import/provider/pom.xml | 31 +++++++++++ .../org/apache/felix/proxy/api/Greeting.java | 30 +++++++++++ .../org/apache/felix/proxy/model/Message.java | 28 ++++++++++ .../it/proxy-interface-import/verify.groovy | 35 ++++++++++++ 7 files changed, 264 insertions(+) create mode 100644 tools/maven-bundle-plugin/src/it/proxy-interface-import/bundle/pom.xml create mode 100644 tools/maven-bundle-plugin/src/it/proxy-interface-import/bundle/src/main/java/org/apache/felix/proxy/client/Client.java create mode 100644 tools/maven-bundle-plugin/src/it/proxy-interface-import/pom.xml create mode 100644 tools/maven-bundle-plugin/src/it/proxy-interface-import/provider/pom.xml create mode 100644 tools/maven-bundle-plugin/src/it/proxy-interface-import/provider/src/main/java/org/apache/felix/proxy/api/Greeting.java create mode 100644 tools/maven-bundle-plugin/src/it/proxy-interface-import/provider/src/main/java/org/apache/felix/proxy/model/Message.java create mode 100644 tools/maven-bundle-plugin/src/it/proxy-interface-import/verify.groovy diff --git a/tools/maven-bundle-plugin/src/it/proxy-interface-import/bundle/pom.xml b/tools/maven-bundle-plugin/src/it/proxy-interface-import/bundle/pom.xml new file mode 100644 index 0000000000..cb1b2560cb --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/proxy-interface-import/bundle/pom.xml @@ -0,0 +1,54 @@ + + + + 4.0.0 + + org.apache.felix.bundleits + proxy-interface-import + 1-SNAPSHOT + + proxy-interface-import-bundle + bundle + + + + org.apache.felix.bundleits + proxy-interface-import-provider + 1-SNAPSHOT + + + + + + + org.apache.felix + maven-bundle-plugin + ${mbp.version} + true + + + org.apache.felix.proxy.client + + + + + + diff --git a/tools/maven-bundle-plugin/src/it/proxy-interface-import/bundle/src/main/java/org/apache/felix/proxy/client/Client.java b/tools/maven-bundle-plugin/src/it/proxy-interface-import/bundle/src/main/java/org/apache/felix/proxy/client/Client.java new file mode 100644 index 0000000000..5514f45a9b --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/proxy-interface-import/bundle/src/main/java/org/apache/felix/proxy/client/Client.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.felix.proxy.client; + +import java.lang.reflect.Proxy; + +import org.apache.felix.proxy.api.Greeting; + +/** + * Creates a dynamic proxy for {@link Greeting}. This class only references the Greeting interface + * (via the {@code Greeting.class} literal); it never references org.apache.felix.proxy.model + * directly. That package therefore appears in Import-Package only because bnd (7.2.0+) inspects + * the method signatures of interfaces passed to Proxy.newProxyInstance. + */ +public class Client { + public Greeting create() { + return (Greeting) Proxy.newProxyInstance( + Client.class.getClassLoader(), + new Class[] { Greeting.class }, + (proxy, method, args) -> null); + } +} diff --git a/tools/maven-bundle-plugin/src/it/proxy-interface-import/pom.xml b/tools/maven-bundle-plugin/src/it/proxy-interface-import/pom.xml new file mode 100644 index 0000000000..234dff9609 --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/proxy-interface-import/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + org.apache.felix.bundleits + proxy-interface-import + 1-SNAPSHOT + pom + + + + + @project.version@ + 17 + UTF-8 + + + + provider + bundle + + diff --git a/tools/maven-bundle-plugin/src/it/proxy-interface-import/provider/pom.xml b/tools/maven-bundle-plugin/src/it/proxy-interface-import/provider/pom.xml new file mode 100644 index 0000000000..9edecb110c --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/proxy-interface-import/provider/pom.xml @@ -0,0 +1,31 @@ + + + + 4.0.0 + + org.apache.felix.bundleits + proxy-interface-import + 1-SNAPSHOT + + proxy-interface-import-provider + + jar + diff --git a/tools/maven-bundle-plugin/src/it/proxy-interface-import/provider/src/main/java/org/apache/felix/proxy/api/Greeting.java b/tools/maven-bundle-plugin/src/it/proxy-interface-import/provider/src/main/java/org/apache/felix/proxy/api/Greeting.java new file mode 100644 index 0000000000..a00032caf9 --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/proxy-interface-import/provider/src/main/java/org/apache/felix/proxy/api/Greeting.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.felix.proxy.api; + +import org.apache.felix.proxy.model.Message; + +/** + * Proxied interface. Its single method references {@link Message}, which lives in a different + * package. The bundle under test only references this interface via a class literal, so the + * Message package can reach Import-Package solely through bnd's Proxy.newProxyInstance detection. + */ +public interface Greeting { + Message greet(); +} diff --git a/tools/maven-bundle-plugin/src/it/proxy-interface-import/provider/src/main/java/org/apache/felix/proxy/model/Message.java b/tools/maven-bundle-plugin/src/it/proxy-interface-import/provider/src/main/java/org/apache/felix/proxy/model/Message.java new file mode 100644 index 0000000000..db9790536c --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/proxy-interface-import/provider/src/main/java/org/apache/felix/proxy/model/Message.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.felix.proxy.model; + +/** + * Referenced only from {@link org.apache.felix.proxy.api.Greeting}'s method signature. + */ +public class Message { + public String text() { + return "hello"; + } +} diff --git a/tools/maven-bundle-plugin/src/it/proxy-interface-import/verify.groovy b/tools/maven-bundle-plugin/src/it/proxy-interface-import/verify.groovy new file mode 100644 index 0000000000..0d96dad383 --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/proxy-interface-import/verify.groovy @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import java.util.jar.Manifest + +// Parse with java.util.jar.Manifest so that 72-column line folding is handled for us. +Manifest manifest = new File(basedir, "bundle/target/classes/META-INF/MANIFEST.MF").withInputStream { new Manifest(it) } +String importPackage = manifest.mainAttributes.getValue("Import-Package") +assert importPackage != null : "Bundle has no Import-Package header" + +// Sanity check: the interface's own package is imported (referenced via the Greeting.class literal). +assert importPackage.contains("org.apache.felix.proxy.api") : + "Expected the proxied interface's package to be imported. Import-Package was: " + importPackage + +// The actual assertion: the package used only by Greeting's method signature is imported because +// bnd (7.2.0+) inspects the methods of interfaces passed to Proxy.newProxyInstance. +// See https://github.com/bndtools/bnd/wiki/Changes-in-7.2.0 (-noproxyinterfaces disables this). +assert importPackage.contains("org.apache.felix.proxy.model") : + "Expected the proxy interface's method-signature package (org.apache.felix.proxy.model) " + + "to be imported via Proxy.newProxyInstance detection. Import-Package was: " + importPackage From 9a3e97fdad766f7d1c64f8baf47e1857c20806af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20R=C3=BCtter?= Date: Mon, 27 Jul 2026 11:53:30 +0200 Subject: [PATCH 7/7] FELIX-6741 Bump slf4j-api to 2.0.17 and doxia to 2.1.0 Routine stable dependency updates alongside the bndlib upgrade: - org.slf4j:slf4j-api 2.0.16 -> 2.0.17 - org.apache.maven.doxia:doxia-sink-api 2.0.0 -> 2.1.0 - org.apache.maven.doxia:doxia-site-renderer 2.0.0 -> 2.1.0 Co-Authored-By: Claude Opus 4.8 --- tools/maven-bundle-plugin/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/maven-bundle-plugin/pom.xml b/tools/maven-bundle-plugin/pom.xml index b7affaea08..c724caa31a 100644 --- a/tools/maven-bundle-plugin/pom.xml +++ b/tools/maven-bundle-plugin/pom.xml @@ -184,7 +184,7 @@ org.slf4j slf4j-api - 2.0.16 + 2.0.17 org.apache.felix @@ -253,12 +253,12 @@ org.apache.maven.doxia doxia-sink-api - 2.0.0 + 2.1.0 org.apache.maven.doxia doxia-site-renderer - 2.0.0 + 2.1.0 org.apache.maven.plugin-tools