From cfe324d3cb1a5ae8871617a887e0206051d0892a Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Thu, 5 Sep 2024 22:23:52 +0200 Subject: [PATCH] Restore check if a BundleComponent has explicitly declared its EE And assume no EE if that check is positive. Fixes https://github.com/eclipse-pde/eclipse.pde/issues/1386 --- .../pde/api/tools/internal/model/BundleComponent.java | 5 ++++- .../src/org/eclipse/pde/internal/core/MinimalState.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/BundleComponent.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/BundleComponent.java index 30363ae5c2..7caa4b7362 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/BundleComponent.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/BundleComponent.java @@ -75,6 +75,7 @@ import org.eclipse.pde.api.tools.internal.provisional.model.IApiTypeContainer; import org.eclipse.pde.api.tools.internal.util.SourceDefaultHandler; import org.eclipse.pde.api.tools.internal.util.Util; +import org.eclipse.pde.internal.core.MinimalState; import org.eclipse.pde.internal.core.TargetWeaver; import org.eclipse.pde.internal.core.util.ManifestUtils; import org.osgi.framework.Bundle; @@ -310,7 +311,9 @@ protected void init() throws CoreException { BundleDescription bundleDescription = getBundleDescription(manifest, fLocation, fBundleId); fSymbolicName = bundleDescription.getSymbolicName(); fVersion = bundleDescription.getVersion(); - fdeclaredRequiredEE = ManifestUtils.getRequiredExecutionEnvironments(bundleDescription).toArray(String[]::new); + fdeclaredRequiredEE = MinimalState.hasDeclaredRequiredEE(manifest) + ? ManifestUtils.getRequiredExecutionEnvironments(bundleDescription).toArray(String[]::new) + : new String[0]; setName(manifest.get(Constants.BUNDLE_NAME)); fBundleDescription = bundleDescription; } catch (BundleException e) { diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/MinimalState.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/MinimalState.java index 2b041619ef..6a0c0c00ed 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/MinimalState.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/MinimalState.java @@ -161,7 +161,7 @@ private Map loadWorkspaceBundleManifest(File bundleLocation, IRe } @SuppressWarnings("deprecation") - private boolean hasDeclaredRequiredEE(Map manifest) { + public static boolean hasDeclaredRequiredEE(Map manifest) { if (manifest.containsKey(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT)) { return true; }