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 (+49 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 2179-2184 Link Here
2179
	}
2180
	}
2180
}
2181
}
2181
/*
2182
/*
2183
 * Ensures that adding an external jar and refreshing removed the markers
2184
 * (regression test for 185733 Refreshing external jar doesn't update problem marker)
2185
 */
2186
public void testExternalJarAdd() throws CoreException, IOException {
2187
	String externalJarPath = getExternalPath() + "test185733.jar";
2188
	try {
2189
		IJavaProject p = createJavaProject("P", new String[0], new String[] {externalJarPath}, "");
2190
		waitUntilIndexesReady();
2191
		waitForAutoBuild();
2192
		// at this point, a marker indicates that test185733.jar has been created: "Project 'P' is missing required library: '[...]\test185733.jar'"
2193
		
2194
		createFile(new File(getExternalPath()), "test185733.jar", "");
2195
		getJavaModel().refreshExternalArchives(new IJavaElement[] {p}, null);
2196
		assertMarkers(
2197
			"Unexpected markers", 
2198
			"",
2199
			p);
2200
	} finally {
2201
		deleteFile(new File(externalJarPath));
2202
		deleteProject("P");
2203
	}
2204
}
2205
2206
/*
2207
 * Ensures that removing an external jar and refreshing creates the correct markers
2208
 * (regression test for 185733 Refreshing external jar doesn't update problem marker)
2209
 */
2210
public void testExternalJarRemove() throws CoreException, IOException {
2211
	try {
2212
		File externalJar = createFile(new File(getExternalPath()), "test185733.jar", "");
2213
		IJavaProject p = createJavaProject("P", new String[0], new String[] {externalJar.getPath()}, "");
2214
		waitUntilIndexesReady();
2215
		waitForAutoBuild();
2216
		// at this point, the project has no markers
2217
		
2218
		deleteFile(externalJar);
2219
		getJavaModel().refreshExternalArchives(new IJavaElement[] {p}, null);
2220
		assertMarkers(
2221
			"Unexpected markers", 
2222
			"Project \'P\' is missing required library: \'" + externalJar.getPath() + "\'",
2223
			p);
2224
	} finally {
2225
		deleteProject("P");
2226
	}
2227
}
2228
2229
/*
2182
 * Ensures that setting 0 extra classpath attributes generates the correct .classpath file.
2230
 * Ensures that setting 0 extra classpath attributes generates the correct .classpath file.
2183
 */
2231
 */
2184
public void testExtraAttributes1() throws CoreException {
2232
public void testExtraAttributes1() throws CoreException {
Lines 3904-3907 Link Here
3904
		this.deleteProjects(new String[] {"P1", "P2"});
3952
		this.deleteProjects(new String[] {"P1", "P2"});
3905
	}
3953
	}
3906
}
3954
}
3955
3907
}
3956
}

Return to bug 185733