Lines 6673-6677
Link Here
|
6673 |
JavaCore.removeClasspathVariable("MyVar", null); |
6673 |
JavaCore.removeClasspathVariable("MyVar", null); |
6674 |
} |
6674 |
} |
6675 |
} |
6675 |
} |
|
|
6676 |
/** |
6677 |
* @bug 313965: Breaking change in classpath container API |
6678 |
* Test that when the includeContainerReferencedLib system property is set to true, the referenced libraries |
6679 |
* for JARs from containers are resolved. |
6680 |
* |
6681 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=313965" |
6682 |
* @throws Exception |
6683 |
*/ |
6684 |
public void testBug313965() throws Exception { |
6685 |
try { |
6686 |
simulateExit(); |
6687 |
// Use the literal attribute and not constant. Attribute once documented is not supposed to change. |
6688 |
System.setProperty("resolveReferencedLibrariesForContainers", "true"); |
6689 |
simulateRestart(); |
6690 |
IJavaProject p = this.createJavaProject("P", new String[] {}, "bin"); |
6691 |
addLibrary(p, "lib.jar", null, new String[0], |
6692 |
new String[] { |
6693 |
"META-INF/MANIFEST.MF", |
6694 |
"Manifest-Version: 1.0\n" + |
6695 |
"Class-Path: lib1.jar\n", |
6696 |
}, |
6697 |
JavaCore.VERSION_1_4); |
6698 |
IClasspathEntry[] classpath = new IClasspathEntry[1]; |
6699 |
ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", "/P/lib.jar"})); |
6700 |
classpath[0] = JavaCore.newContainerEntry(new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER")); |
6701 |
setClasspath(p, classpath); |
6702 |
createFile("/P/lib1.jar", ""); |
6703 |
|
6704 |
IClasspathEntry[] resolvedClasspath = p.getResolvedClasspath(true); |
6705 |
assertClasspathEquals(resolvedClasspath, |
6706 |
"/P/lib1.jar[CPE_LIBRARY][K_BINARY][isExported:false]\n" + |
6707 |
"/P/lib.jar[CPE_LIBRARY][K_BINARY][isExported:false]"); |
6708 |
} finally { |
6709 |
deleteProject("P"); |
6710 |
ContainerInitializer.setInitializer(null); |
6711 |
simulateExit(); |
6712 |
System.setProperty("resolveReferencedLibrariesForContainers", ""); |
6713 |
simulateRestart(); |
6714 |
} |
6715 |
} |
6716 |
/** |
6717 |
* @bug 313965: Breaking change in classpath container API |
6718 |
* Test that when the includeContainerReferencedLib system property is set to false (or default), the referenced libraries |
6719 |
* for JARs from containers are NOT resolved or added to the project's classpath. |
6720 |
* |
6721 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=313965" |
6722 |
* @throws Exception |
6723 |
*/ |
6724 |
public void testBug313965a() throws Exception { |
6725 |
try { |
6726 |
// Do not set the includeContainerReferencedLib system property (the default value is false) |
6727 |
IJavaProject p = this.createJavaProject("P", new String[] {}, "bin"); |
6728 |
addLibrary(p, "lib.jar", null, new String[0], |
6729 |
new String[] { |
6730 |
"META-INF/MANIFEST.MF", |
6731 |
"Manifest-Version: 1.0\n" + |
6732 |
"Class-Path: lib1.jar\n", |
6733 |
}, |
6734 |
JavaCore.VERSION_1_4); |
6735 |
IClasspathEntry[] classpath = new IClasspathEntry[1]; |
6736 |
ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", "/P/lib.jar"})); |
6737 |
classpath[0] = JavaCore.newContainerEntry(new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER")); |
6738 |
setClasspath(p, classpath); |
6739 |
|
6740 |
createFile("/P/lib1.jar", ""); |
6741 |
|
6742 |
IClasspathEntry[] resolvedClasspath = p.getResolvedClasspath(true); |
6743 |
assertClasspathEquals(resolvedClasspath, |
6744 |
"/P/lib.jar[CPE_LIBRARY][K_BINARY][isExported:false]"); |
6745 |
} finally { |
6746 |
deleteProject("P"); |
6747 |
ContainerInitializer.setInitializer(null); |
6748 |
} |
6749 |
} |
6676 |
|
6750 |
|
6677 |
} |
6751 |
} |