### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java,v retrieving revision 1.43 diff -u -r1.43 ClasspathInitializerTests.java --- src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java 19 Jan 2007 17:10:23 -0000 1.43 +++ src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java 31 Jan 2007 18:23:57 -0000 @@ -1198,6 +1198,46 @@ } /** + * @bug 172207: [model] Marker for deprecated classpath variable should always have WARNING severity + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=172207" + */ +public void testVariableInitializerBug172207() throws CoreException { + try { + // Create initializer + String varName = "TEST_DEPRECATED_READ_ONLY"; + String path = "/P1/lib.jar"; + VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] { varName, path })); + assertEquals("JavaCore classpath value should have been initialized", JavaCore.getClasspathVariable(varName).toString(), path); + + // verify that Classpath Variable is read-only + assertEquals("JavaCore classpath variable should be deprecated", "A deprecated and read-only initializer", JavaCore.getClasspathVariableDeprecationMessage(varName)); + assertTrue("JavaCore classpath variable should be read-only", JavaCore.isClasspathVariableReadOnly(varName)); + + // Create project + IJavaProject project = createJavaProject("P1"); + createFile("/P1/lib.jar", ""); + IClasspathEntry variable = JavaCore.newVariableEntry(new Path("TEST_DEPRECATED_READ_ONLY"), null, null); + IClasspathEntry[] entries = project.getRawClasspath(); + int length = entries.length; + System.arraycopy(entries, 0, entries = new IClasspathEntry[length+1], 0, length); + entries[length] = variable; + project.setRawClasspath(entries, null); + + // verify markers + waitForAutoBuild(); + IMarker[] markers = project.getProject().findMarkers(IJavaModelMarker.BUILDPATH_PROBLEM_MARKER, false, IResource.DEPTH_ZERO); + sortMarkers(markers); + assertMarkers("Unexpected marker(s)", + "Classpath variable 'TEST_DEPRECATED_READ_ONLY' in project P1 is deprecated: 'A deprecated and read-only initializer'", + markers); + assertEquals("Marker on deprecated variable should be a WARNING", IMarker.SEVERITY_WARNING, markers[0].getAttribute(IMarker.SEVERITY, -1)); + } finally { + VariablesInitializer.reset(); + deleteProject("P1"); + } +} + +/** * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=61872" */ public void testUserLibraryInitializer1() throws CoreException { #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/JavaProject.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java,v retrieving revision 1.379 diff -u -r1.379 JavaProject.java --- model/org/eclipse/jdt/internal/core/JavaProject.java 31 Jan 2007 07:47:25 -0000 1.379 +++ model/org/eclipse/jdt/internal/core/JavaProject.java 31 Jan 2007 18:24:06 -0000 @@ -37,6 +37,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.QualifiedName; @@ -786,7 +787,8 @@ default: IPath path = status.getPath(); if (path != null) arguments = new String[] { path.toString() }; - if (JavaCore.ERROR.equals(getOption(JavaCore.CORE_INCOMPLETE_CLASSPATH, true))) { + if (JavaCore.ERROR.equals(getOption(JavaCore.CORE_INCOMPLETE_CLASSPATH, true)) && + status.getSeverity() != IStatus.WARNING) { severity = IMarker.SEVERITY_ERROR; } else { severity = IMarker.SEVERITY_WARNING;