Index: src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
===================================================================
RCS file: /home/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java,v
retrieving revision 1.130
diff -u -r1.130 ClasspathTests.java
--- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 25 May 2005 16:08:44 -0000 1.130
+++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 30 Aug 2005 09:48:30 -0000
@@ -75,8 +75,8 @@
// All specified tests which do not belong to the class are skipped...
static {
// Names of tests to run: can be "testBugXXXX" or "BugXXXX")
-// TESTS_PREFIX = "testClasspathDuplicateExtraAttribute";
-// TESTS_NAMES = new String[] {"testExportContainer"};
+// TESTS_PREFIX = "testUnknownElements";
+// TESTS_NAMES = new String[] {"testExtraAttributes4"};
// TESTS_NUMBERS = new int[] { 23, 28, 38 };
// TESTS_RANGE = new int[] { 21, 38 };
}
@@ -3322,6 +3322,94 @@
}
}
+/*
+ * Ensures that unknown classpath attributes in a .classpath file are not lost when read and rewritten.
+ * (regression test for bug 101425 Classpath persistence should be resilient with unknown attributes)
+ */
+public void testUnknownAttributes() throws CoreException {
+ try {
+ IJavaProject project = createJavaProject("P");
+ editFile(
+ "/P/.classpath",
+ "\n" +
+ "\n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ "\n"
+ );
+ IClasspathEntry[] classpath = project.getRawClasspath();
+
+ // swap 2 entries
+ IClasspathEntry src1 = classpath[0];
+ classpath[0] = classpath[1];
+ classpath[1] = src1;
+ project.setRawClasspath(classpath, null);
+
+ // check that .classpath has correct content
+ String contents = new String (org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P/.classpath")));
+ assertSourceEquals(
+ "Unexpected content",
+ "\n" +
+ "\n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ "\n",
+ contents);
+ } finally {
+ deleteProject("P");
+ }
+}
+
+/*
+ * Ensures that unknown classpath elements in a .classpath file are not lost when read and rewritten.
+ * (regression test for bug 101425 Classpath persistence should be resilient with unknown attributes)
+ */
+public void testUnknownElements() throws CoreException {
+ try {
+ IJavaProject project = createJavaProject("P");
+ editFile(
+ "/P/.classpath",
+ "\n" +
+ "\n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ "\n"
+ );
+ IClasspathEntry[] classpath = project.getRawClasspath();
+
+ // swap 2 entries
+ IClasspathEntry src1 = classpath[0];
+ classpath[0] = classpath[1];
+ classpath[1] = src1;
+ project.setRawClasspath(classpath, null);
+
+ // check that .classpath has correct content
+ String contents = new String (org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(getFile("/P/.classpath")));
+ assertSourceEquals(
+ "Unexpected content",
+ "\n" +
+ "\n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ "\n",
+ contents);
+ } finally {
+ deleteProject("P");
+ }
+}
+
/**
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=55992
* Check that Assert.AssertionFailedException exception is well catched
Index: src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
===================================================================
RCS file: /home/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java,v
retrieving revision 1.65
diff -u -r1.65 ReconcilerTests.java
--- src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 8 Jun 2005 09:03:20 -0000 1.65
+++ src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 30 Aug 2005 09:48:32 -0000
@@ -63,7 +63,7 @@
// All specified tests which do not belong to the class are skipped...
static {
// Names of tests to run: can be "testBugXXXX" or "BugXXXX")
- // TESTS_NAMES = new String[] { "testTwoProjectsWithDifferentCompliances" };
+// TESTS_NAMES = new String[] { "testAccessRestriction5" };
// Numbers of tests to run: "test" will be run for each number of this array
//TESTS_NUMBERS = new int[] { 13 };
// Range numbers of tests to run: all tests between "test" and "test" will be run for { first, last }