View | Details | Raw Unified | Return to bug 294360
Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/JavaProject.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 2644-2651 Link Here
2644
		if (result.rawReverseMap.get(resolvedPath = resolvedEntry.getPath()) == null) {
2644
		if (result.rawReverseMap.get(resolvedPath = resolvedEntry.getPath()) == null) {
2645
			result.rawReverseMap.put(resolvedPath, rawEntry);
2645
			result.rawReverseMap.put(resolvedPath, rawEntry);
2646
			result.rootPathToResolvedEntries.put(resolvedPath, resolvedEntry);
2646
			result.rootPathToResolvedEntries.put(resolvedPath, resolvedEntry);
2647
			resolvedEntries.add(resolvedEntry);
2647
		}
2648
		}
2648
		resolvedEntries.add(resolvedEntry);
2649
		if (resolvedEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && ExternalFoldersManager.isExternalFolderPath(resolvedPath)) {
2649
		if (resolvedEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && ExternalFoldersManager.isExternalFolderPath(resolvedPath)) {
2650
			externalFoldersManager.addFolder(resolvedPath); // no-op if not an external folder or if already registered
2650
			externalFoldersManager.addFolder(resolvedPath); // no-op if not an external folder or if already registered
2651
		}
2651
		}
(-)src/org/eclipse/jdt/core/tests/model/ClasspathTests.java (-1 / +48 lines)
Lines 6026-6032 Link Here
6026
	}	
6026
	}	
6027
}
6027
}
6028
/**
6028
/**
6029
 * Additional test for bug 300136 - Test that the the errors are reported when the 
6029
 * Additional test for bug 300136 - Test that the errors are reported when the 
6030
 * optional attribute is not used.
6030
 * optional attribute is not used.
6031
 * 
6031
 * 
6032
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=300136"
6032
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=300136"
Lines 6069-6073 Link Here
6069
		JavaCore.removeClasspathVariable("INVALID_LIB", null);
6069
		JavaCore.removeClasspathVariable("INVALID_LIB", null);
6070
	}	
6070
	}	
6071
}
6071
}
6072
/**
6073
 * @bug 294360:Duplicate entries in Classpath Resolution when importing dependencies from parent project  
6074
 * Test that duplicate entries are not added to the resolved classpath
6075
 * 
6076
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=294360"
6077
 * @throws Exception
6078
 */ 
6079
public void testBug294360a() throws Exception {
6080
	try {
6081
		IJavaProject p = createJavaProject("P");
6082
		addExternalLibrary(p, getExternalResourcePath("lib.jar"), new String[0], 
6083
				new String[] {
6084
					"META-INF/MANIFEST.MF",
6085
					"Manifest-Version: 1.0\n",
6086
				},
6087
				JavaCore.VERSION_1_4);
6088
		IClasspathEntry[] classpath = new IClasspathEntry[2];
6089
		classpath[0] = JavaCore.newLibraryEntry(new Path(getExternalResourcePath("lib.jar")), null, null);
6090
		ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", getExternalResourcePath("lib.jar")}));
6091
		classpath[1] = JavaCore.newContainerEntry(new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER"));
6092
		setClasspath(p, classpath);
6093
6094
		StringBuffer buffer = new StringBuffer(
6095
						"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
6096
						"<classpath>\n" +
6097
						"	<classpathentry kind=\"con\" path=\"org.eclipse.jdt.core.tests.model.TEST_CONTAINER\"/>\n" +
6098
						"	<classpathentry kind=\"lib\" path=\""+ getExternalResourcePath("lib.jar") + "\">\n" +
6099
						"    	<attributes>\n" + 
6100
						"   	 <attribute name=\"optional\" value=\"true\"/>\n" +
6101
						"    	</attributes>\n" +
6102
						"	</classpathentry>\n" +						
6103
						"	<classpathentry kind=\"output\" path=\"\"/>\n" +
6104
						"</classpath>\n");
6105
		
6106
		editFile(
6107
			"/P/.classpath",
6108
			buffer.toString()
6109
		);		
6110
6111
		IClasspathEntry[] resolvedClasspath = p.getResolvedClasspath(true);
6112
		assertClasspathEquals(resolvedClasspath, 
6113
				""+ getExternalPath() + "lib.jar[CPE_LIBRARY][K_BINARY][isExported:false]");
6114
	} finally {
6115
		deleteProject("P");
6116
		deleteExternalResource("lib.jar");
6117
	}
6118
}
6072
6119
6073
}
6120
}

Return to bug 294360