|
Lines 1198-1203
Link Here
|
| 1198 |
} |
1198 |
} |
| 1199 |
|
1199 |
|
| 1200 |
/** |
1200 |
/** |
|
|
1201 |
* @bug 172207: [model] Marker for deprecated classpath variable should always have WARNING severity |
| 1202 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=172207" |
| 1203 |
*/ |
| 1204 |
public void testVariableInitializerBug172207() throws CoreException { |
| 1205 |
try { |
| 1206 |
// Create initializer |
| 1207 |
String varName = "TEST_DEPRECATED_READ_ONLY"; |
| 1208 |
String path = "/P1/lib.jar"; |
| 1209 |
VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] { varName, path })); |
| 1210 |
assertEquals("JavaCore classpath value should have been initialized", JavaCore.getClasspathVariable(varName).toString(), path); |
| 1211 |
|
| 1212 |
// verify that Classpath Variable is read-only |
| 1213 |
assertEquals("JavaCore classpath variable should be deprecated", "A deprecated and read-only initializer", JavaCore.getClasspathVariableDeprecationMessage(varName)); |
| 1214 |
assertTrue("JavaCore classpath variable should be read-only", JavaCore.isClasspathVariableReadOnly(varName)); |
| 1215 |
|
| 1216 |
// Create project |
| 1217 |
IJavaProject project = createJavaProject("P1"); |
| 1218 |
createFile("/P1/lib.jar", ""); |
| 1219 |
IClasspathEntry variable = JavaCore.newVariableEntry(new Path("TEST_DEPRECATED_READ_ONLY"), null, null); |
| 1220 |
IClasspathEntry[] entries = project.getRawClasspath(); |
| 1221 |
int length = entries.length; |
| 1222 |
System.arraycopy(entries, 0, entries = new IClasspathEntry[length+1], 0, length); |
| 1223 |
entries[length] = variable; |
| 1224 |
project.setRawClasspath(entries, null); |
| 1225 |
|
| 1226 |
// verify markers |
| 1227 |
waitForAutoBuild(); |
| 1228 |
IMarker[] markers = project.getProject().findMarkers(IJavaModelMarker.BUILDPATH_PROBLEM_MARKER, false, IResource.DEPTH_ZERO); |
| 1229 |
sortMarkers(markers); |
| 1230 |
assertMarkers("Unexpected marker(s)", |
| 1231 |
"Classpath variable 'TEST_DEPRECATED_READ_ONLY' in project P1 is deprecated: 'A deprecated and read-only initializer'", |
| 1232 |
markers); |
| 1233 |
assertEquals("Marker on deprecated variable should be a WARNING", IMarker.SEVERITY_WARNING, markers[0].getAttribute(IMarker.SEVERITY, -1)); |
| 1234 |
} finally { |
| 1235 |
VariablesInitializer.reset(); |
| 1236 |
deleteProject("P1"); |
| 1237 |
} |
| 1238 |
} |
| 1239 |
|
| 1240 |
/** |
| 1201 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=61872" |
1241 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=61872" |
| 1202 |
*/ |
1242 |
*/ |
| 1203 |
public void testUserLibraryInitializer1() throws CoreException { |
1243 |
public void testUserLibraryInitializer1() throws CoreException { |