From 92c4a1d4fb13a11e7898850c9659352035174b88 Mon Sep 17 00:00:00 2001 From: Stephan Herrmann Date: Mon, 24 Jun 2024 11:05:28 +0200 Subject: [PATCH] mac: Random failing CopyMoveElementsTests.testCopyFieldForce (#2629) fixes https://github.com/eclipse-jdt/eclipse.jdt.core/issues/2552 --- .../src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java index c47d315a3da..394245dcf6d 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java @@ -15,6 +15,7 @@ import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jdt.core.*; @@ -58,7 +59,7 @@ public void copyNegative(IJavaElement[] elements, IJavaElement[] destinations, I * and forcing. The operation should succeed, so any exceptions * encountered are thrown. */ -public IJavaElement copyPositive(IJavaElement element, IJavaElement container, IJavaElement sibling, String rename, boolean force) throws JavaModelException { +public IJavaElement copyPositive(IJavaElement element, IJavaElement container, IJavaElement sibling, String rename, boolean force) throws CoreException { // if forcing, ensure that a name collision exists if (force) { IJavaElement collision = generateHandle(element, rename, container); @@ -75,6 +76,7 @@ public IJavaElement copyPositive(IJavaElement element, IJavaElement container, I // ensure the original element still exists assertTrue("The original element must still exist", element.exists()); + element.getJavaProject().getProject().build(IncrementalProjectBuilder.FULL_BUILD, null); waitForAutoBuild(); // generate the new element handle