### Eclipse Workspace Patch 1.0 #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.427 diff -u -r1.427 JavaProject.java --- model/org/eclipse/jdt/internal/core/JavaProject.java 8 Jul 2009 07:12:08 -0000 1.427 +++ model/org/eclipse/jdt/internal/core/JavaProject.java 17 Feb 2010 17:34:18 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -2644,8 +2644,8 @@ if (result.rawReverseMap.get(resolvedPath = resolvedEntry.getPath()) == null) { result.rawReverseMap.put(resolvedPath, rawEntry); result.rootPathToResolvedEntries.put(resolvedPath, resolvedEntry); + resolvedEntries.add(resolvedEntry); } - resolvedEntries.add(resolvedEntry); if (resolvedEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && ExternalFoldersManager.isExternalFolderPath(resolvedPath)) { externalFoldersManager.addFolder(resolvedPath); // no-op if not an external folder or if already registered } #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/ClasspathTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java,v retrieving revision 1.206 diff -u -r1.206 ClasspathTests.java --- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 3 Feb 2010 06:38:02 -0000 1.206 +++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 17 Feb 2010 17:34:26 -0000 @@ -6026,7 +6026,7 @@ } } /** - * Additional test for bug 300136 - Test that the the errors are reported when the + * Additional test for bug 300136 - Test that the errors are reported when the * optional attribute is not used. * * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=300136" @@ -6069,5 +6069,52 @@ JavaCore.removeClasspathVariable("INVALID_LIB", null); } } +/** + * @bug 294360:Duplicate entries in Classpath Resolution when importing dependencies from parent project + * Test that duplicate entries are not added to the resolved classpath + * + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=294360" + * @throws Exception + */ +public void testBug294360a() throws Exception { + try { + IJavaProject p = createJavaProject("P"); + addExternalLibrary(p, getExternalResourcePath("lib.jar"), new String[0], + new String[] { + "META-INF/MANIFEST.MF", + "Manifest-Version: 1.0\n", + }, + JavaCore.VERSION_1_4); + IClasspathEntry[] classpath = new IClasspathEntry[2]; + classpath[0] = JavaCore.newLibraryEntry(new Path(getExternalResourcePath("lib.jar")), null, null); + ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", getExternalResourcePath("lib.jar")})); + classpath[1] = JavaCore.newContainerEntry(new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER")); + setClasspath(p, classpath); + + StringBuffer buffer = new StringBuffer( + "\n" + + "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "\n"); + + editFile( + "/P/.classpath", + buffer.toString() + ); + + IClasspathEntry[] resolvedClasspath = p.getResolvedClasspath(true); + assertClasspathEquals(resolvedClasspath, + ""+ getExternalPath() + "lib.jar[CPE_LIBRARY][K_BINARY][isExported:false]"); + } finally { + deleteProject("P"); + deleteExternalResource("lib.jar"); + } +} }