View | Details | Raw Unified | Return to bug 177922 | Differences between
and this patch

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/ChangeClasspathOperation.java (+6 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core;
11
package org.eclipse.jdt.internal.core;
12
12
13
import org.eclipse.core.resources.ResourcesPlugin;
13
import org.eclipse.core.runtime.jobs.ISchedulingRule;
14
import org.eclipse.core.runtime.jobs.ISchedulingRule;
14
import org.eclipse.jdt.core.IJavaElement;
15
import org.eclipse.jdt.core.IJavaElement;
15
import org.eclipse.jdt.core.JavaModelException;
16
import org.eclipse.jdt.core.JavaModelException;
Lines 43-48 Link Here
43
		DeltaProcessor deltaProcessor = state.getDeltaProcessor();
44
		DeltaProcessor deltaProcessor = state.getDeltaProcessor();
44
		ClasspathChange change = (ClasspathChange) deltaProcessor.classpathChanges.get(project.getProject());
45
		ClasspathChange change = (ClasspathChange) deltaProcessor.classpathChanges.get(project.getProject());
45
		if (this.canChangeResources) {
46
		if (this.canChangeResources) {
47
			// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=177922
48
			if (isTopLevelOperation() && !ResourcesPlugin.getWorkspace().isTreeLocked()) {
49
				new ClasspathValidation(project).validate();
50
			}
51
				
46
			// delta, indexing and classpath markers are going to be created by the delta processor 
52
			// delta, indexing and classpath markers are going to be created by the delta processor 
47
			// while handling the .classpath file change
53
			// while handling the .classpath file change
48
54
(-)src/org/eclipse/jdt/core/tests/model/ClasspathTests.java (+31 lines)
Lines 3715-3720 Link Here
3715
}
3715
}
3716
3716
3717
/*
3717
/*
3718
 * Ensures that renaming a .jar file and updating the classpath in a PRE_BUILD event doesn't leave markers
3719
 * (regression test for bug 177922 FlexibleProjectContainer refresh logic sporadically leaves project with "missing library" error on rename/delete)
3720
 */
3721
public void testRenameJar() throws CoreException {
3722
	try {
3723
		final IJavaProject p = createJavaProject("P", new String[0], new String[] {"/P/lib/test1.jar"}, "");
3724
		createFolder("/P/lib");
3725
		createFile("/P/lib/test1.jar", "");
3726
		// at this point no markers exist
3727
		
3728
		// register a listener that updates the classpath in a PRE_BUILD event
3729
		IResourceChangeListener listener = new IResourceChangeListener(){
3730
			public void resourceChanged(IResourceChangeEvent event) {
3731
				try {
3732
					p.setRawClasspath(new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("/P/lib/test2.jar"), null, null)}, null);
3733
				} catch (JavaModelException e) {
3734
					e.printStackTrace();
3735
				}
3736
			}
3737
		};
3738
		getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.PRE_BUILD);
3739
		
3740
		// rename .jar
3741
		getFile("/P/lib/test1.jar").move(new Path("/P/lib/test2.jar"), false, null);
3742
		assertMarkers("Unexpected markers", "", p);
3743
	} finally {
3744
		deleteProject("P");
3745
	}
3746
}
3747
3748
/*
3718
 * Ensures that unknown classpath attributes in a .classpath file are not lost when read and rewritten.
3749
 * Ensures that unknown classpath attributes in a .classpath file are not lost when read and rewritten.
3719
 * (regression test for bug 101425 Classpath persistence should be resilient with unknown attributes)
3750
 * (regression test for bug 101425 Classpath persistence should be resilient with unknown attributes)
3720
 */
3751
 */

Return to bug 177922