From 0418bfd8b3010fad5407fc42b58214794d0e78c8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 08:07:08 +0000 Subject: [PATCH 1/2] Initial plan From 3483bd232986c5787fabb01154d5fa42ecfe0c56 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 08:20:00 +0000 Subject: [PATCH 2/2] Fix manifestHeaderServiceComponentAdded test to read MANIFEST.MF directly The test was using PluginRegistry.findModel() which returns a cached in-memory model that may not reflect the updated MANIFEST.MF after the DS annotation builder writes the Service-Component header. On macOS and Windows, the model manager's resource change event processing can lag behind the file changes, causing the test to read stale data. Fix by reading the MANIFEST.MF file directly using java.util.jar.Manifest, with refreshLocal() before reading, consistent with how other DS annotation tests (AnnotationProcessorTest) read their test files. Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com> --- .../annotations/tests/ManagedProjectTest.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/ManagedProjectTest.java b/ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/ManagedProjectTest.java index bcadcb2c37..a47e46b918 100644 --- a/ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/ManagedProjectTest.java +++ b/ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/ManagedProjectTest.java @@ -1,21 +1,19 @@ package org.eclipse.pde.ds.internal.annotations.tests; -import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; +import java.io.InputStream; import java.util.Arrays; import java.util.List; +import java.util.jar.Manifest; import org.eclipse.core.resources.ICommand; +import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; -import org.eclipse.pde.core.plugin.IPluginModelBase; -import org.eclipse.pde.core.plugin.PluginRegistry; import org.eclipse.pde.ds.internal.annotations.DSAnnotationCompilationParticipant; -import org.eclipse.pde.internal.core.ibundle.IBundleModel; -import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase; import org.junit.jupiter.api.Test; @SuppressWarnings("restriction") @@ -45,11 +43,14 @@ public void folderOSGIInfCreated() throws Exception { @Test public void manifestHeaderServiceComponentAdded() throws Exception { - IPluginModelBase pluginModel = PluginRegistry.findModel(testProject); - assertThat(pluginModel).isInstanceOf(IBundlePluginModelBase.class); - IBundleModel bundleModel = ((IBundlePluginModelBase) pluginModel).getBundleModel(); - assertNotNull(bundleModel, "Missing bundle manifest!"); - String serviceComponentHeader = bundleModel.getBundle().getHeader("Service-Component"); + IFile manifestFile = testProject.getFile("META-INF/MANIFEST.MF"); + manifestFile.refreshLocal(IResource.DEPTH_ZERO, null); + assertTrue(manifestFile.exists(), "Missing MANIFEST.MF!"); + String serviceComponentHeader; + try (InputStream is = manifestFile.getContents(true)) { + Manifest manifest = new Manifest(is); + serviceComponentHeader = manifest.getMainAttributes().getValue("Service-Component"); + } assertNotNull(serviceComponentHeader, "Missing Service-Component header!"); String[] entries = serviceComponentHeader.split("\\s*,\\s*"); List entryList = Arrays.asList(entries);