From af222ed6afb93502ff1ea81fac1e226a15ee6029 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 20:14:07 +0000 Subject: [PATCH 1/2] Initial plan From b9a40f0c4fa5f6ac5bd8e5f94d272e52be50c63c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 20:23:49 +0000 Subject: [PATCH 2/2] Fix sporadic MarkerTest.testMarkerDeltasMoveFile failure The test performed two separate IFile.move() calls, creating a window where background jobs (e.g. charset/encoding validation) could acquire the workspace lock between the two moves and fire resource change events that added unexpected marker deltas for subFile. This caused the listener to record 2 changes for /MyProject/folder/subFile.txt while the test expected exactly 1. Fix: wrap both moves in a single IWorkspaceRunnable so the workspace lock is held throughout both operations, preventing background jobs from interleaving and ensuring a single coalesced event with exactly the 4 expected changes. To reproduce the race before the fix, run the test ~200 times in a loop: mvn -pl resources/tests/org.eclipse.core.tests.resources \ -Pbuild-individual-bundles \ -Dtest=MarkerTest#testMarkerDeltasMoveFile \ -Dsurefire.rerunFailingTestsCount=0 \ verify and repeat the invocation 200 times; the failure should appear within that many iterations. With the fix, 200 runs should all succeed. Co-authored-by: fedejeanne <2205684+fedejeanne@users.noreply.github.com> --- .../org/eclipse/core/tests/resources/MarkerTest.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerTest.java index 2b04fe3f416..616aab8b414 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/MarkerTest.java @@ -969,9 +969,13 @@ public void testMarkerDeltasMoveFile(TestInfo testInfo) throws CoreException { IMarker subFileMarker = subFile.createMarker(IMarker.BOOKMARK); listener.reset(); - // move the files - file.move(destFile.getFullPath(), IResource.FORCE, createTestMonitor()); - subFile.move(destSubFile.getFullPath(), IResource.FORCE, createTestMonitor()); + // move the files in one atomic workspace operation to prevent background jobs + // (e.g. charset/encoding validation) from running between the two moves and + // adding unexpected marker changes to the listener + getWorkspace().run(monitor -> { + file.move(destFile.getFullPath(), IResource.FORCE, monitor); + subFile.move(destSubFile.getFullPath(), IResource.FORCE, monitor); + }, createTestMonitor()); // verify marker deltas listener.assertNumberOfAffectedResources(4);