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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/DeltaProcessor.java (+2 lines)
Lines 924-929 Link Here
924
								System.out.println("- External JAR ADDED, affecting root: "+root.getElementName()); //$NON-NLS-1$
924
								System.out.println("- External JAR ADDED, affecting root: "+root.getElementName()); //$NON-NLS-1$
925
							} 
925
							} 
926
							elementAdded(root, null, null);
926
							elementAdded(root, null, null);
927
							this.state.addClasspathValidation(javaProject); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=185733
927
							hasDelta = true;
928
							hasDelta = true;
928
						} else if (status == EXTERNAL_JAR_CHANGED) {
929
						} else if (status == EXTERNAL_JAR_CHANGED) {
929
							PackageFragmentRoot root = (PackageFragmentRoot) javaProject.getPackageFragmentRoot(entryPath.toString());
930
							PackageFragmentRoot root = (PackageFragmentRoot) javaProject.getPackageFragmentRoot(entryPath.toString());
Lines 938-943 Link Here
938
								System.out.println("- External JAR REMOVED, affecting root: "+root.getElementName()); //$NON-NLS-1$
939
								System.out.println("- External JAR REMOVED, affecting root: "+root.getElementName()); //$NON-NLS-1$
939
							}
940
							}
940
							elementRemoved(root, null, null);
941
							elementRemoved(root, null, null);
942
							this.state.addClasspathValidation(javaProject); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=185733
941
							hasDelta = true;
943
							hasDelta = true;
942
						}
944
						}
943
					}
945
					}
(-)src/org/eclipse/jdt/core/tests/model/ClasspathTests.java (+46 lines)
Lines 41-46 Link Here
41
import org.eclipse.jdt.core.IClasspathContainer;
41
import org.eclipse.jdt.core.IClasspathContainer;
42
import org.eclipse.jdt.core.IClasspathEntry;
42
import org.eclipse.jdt.core.IClasspathEntry;
43
import org.eclipse.jdt.core.ICompilationUnit;
43
import org.eclipse.jdt.core.ICompilationUnit;
44
import org.eclipse.jdt.core.IJavaElement;
44
import org.eclipse.jdt.core.IJavaElementDelta;
45
import org.eclipse.jdt.core.IJavaElementDelta;
45
import org.eclipse.jdt.core.IJavaModelMarker;
46
import org.eclipse.jdt.core.IJavaModelMarker;
46
import org.eclipse.jdt.core.IJavaModelStatus;
47
import org.eclipse.jdt.core.IJavaModelStatus;
Lines 156-161 Link Here
156
	return result;
157
	return result;
157
}
158
}
158
159
160
/*
161
 * Ensures that adding an external jar and refreshing removed the markers
162
 * (regression test for 185733 Refreshing external jar doesn't update problem marker)
163
 */
164
public void testAddExternalJar() throws CoreException, IOException {
165
	String externalJarPath = getExternalPath() + "test185733.jar";
166
	try {
167
		IJavaProject p = createJavaProject("P", new String[0], new String[] {externalJarPath}, "");
168
		waitUntilIndexesReady();
169
		waitForAutoBuild();
170
		
171
		createFile(new File(getExternalPath()), "test185733.jar", "");
172
		getJavaModel().refreshExternalArchives(new IJavaElement[] {p}, null);
173
		assertMarkers(
174
			"Unexpected markers", 
175
			"",
176
			p);
177
	} finally {
178
		deleteFile(new File(externalJarPath));
179
		deleteProject("P");
180
	}
181
}
182
159
/**
183
/**
160
 * Add an entry to the classpath for a non-existent root. Then create
184
 * Add an entry to the classpath for a non-existent root. Then create
161
 * the root and ensure that it comes alive.
185
 * the root and ensure that it comes alive.
Lines 3904-3907 Link Here
3904
		this.deleteProjects(new String[] {"P1", "P2"});
3928
		this.deleteProjects(new String[] {"P1", "P2"});
3905
	}
3929
	}
3906
}
3930
}
3931
3932
/*
3933
 * Ensures that removing an external jar and refreshing creates the correct markers
3934
 * (regression test for 185733 Refreshing external jar doesn't update problem marker)
3935
 */
3936
public void testRemoveExternalJar() throws CoreException, IOException {
3937
	try {
3938
		File externalJar = createFile(new File(getExternalPath()), "test185733.jar", "");
3939
		IJavaProject p = createJavaProject("P", new String[0], new String[] {externalJar.getPath()}, "");
3940
		waitUntilIndexesReady();
3941
		waitForAutoBuild();
3942
		
3943
		deleteFile(externalJar);
3944
		getJavaModel().refreshExternalArchives(new IJavaElement[] {p}, null);
3945
		assertMarkers(
3946
			"Unexpected markers", 
3947
			"Project \'P\' is missing required library: \'" + externalJar.getPath() + "\'",
3948
			p);
3949
	} finally {
3950
		deleteProject("P");
3951
	}
3952
}
3907
}
3953
}

Return to bug 185733