From 8a9f025213f9fc1f9e75f0e7eca56d346da3cd13 Mon Sep 17 00:00:00 2001 From: Patrick Ziegler Date: Thu, 20 Jun 2024 17:11:08 +0200 Subject: [PATCH] Extend StateBuilder to handle EE from Require-Capability header With this change, the BundleDescription instance that is returned by the StateBuilder now also contains the execution environments that are required by the Require-Capability header, rather than only the Bundle-RequireExecutionEnvironment header. Previously, a call to getExecutionEnvironments() would always return an empty array, if a bundle lacks the Bundle-RequireExecutionEnvironment header, even though a minimum version is required as a capability. Resolves https://github.com/eclipse-equinox/equinox/issues/643 --- .../META-INF/MANIFEST.MF | 2 +- .../osgi/internal/resolver/StateBuilder.java | 59 +++++++++++++++++-- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.osgi.compatibility.state/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.compatibility.state/META-INF/MANIFEST.MF index f575907d4cd..52b8009afa7 100644 --- a/bundles/org.eclipse.osgi.compatibility.state/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.osgi.compatibility.state/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.osgi.compatibility.state -Bundle-Version: 1.2.1000.qualifier +Bundle-Version: 1.2.1100.qualifier ExtensionBundle-Activator: org.eclipse.osgi.compatibility.state.Activator Fragment-Host: org.eclipse.osgi;bundle-version="3.12.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateBuilder.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateBuilder.java index 1735efa76c9..83fba7a0c13 100644 --- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateBuilder.java +++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateBuilder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2020 IBM Corporation and others. + * Copyright (c) 2003, 2024 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -25,7 +25,9 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; +import java.util.stream.Stream; import org.eclipse.osgi.internal.framework.EquinoxContainer; import org.eclipse.osgi.internal.framework.FilterImpl; import org.eclipse.osgi.internal.messages.Msg; @@ -47,6 +49,7 @@ import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.Version; import org.osgi.framework.namespace.BundleNamespace; +import org.osgi.framework.namespace.ExecutionEnvironmentNamespace; import org.osgi.framework.namespace.IdentityNamespace; import org.osgi.resource.Namespace; @@ -128,8 +131,6 @@ static BundleDescription createBundleDescription(StateImpl state, Dictionary