### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/core/JavaCore.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v retrieving revision 1.650 diff -u -r1.650 JavaCore.java --- model/org/eclipse/jdt/core/JavaCore.java 8 Apr 2010 17:57:19 -0000 1.650 +++ model/org/eclipse/jdt/core/JavaCore.java 9 Apr 2010 09:23:27 -0000 @@ -4602,15 +4602,17 @@ * entries, they are processed recursively and added to the list. For entry kinds other * than {@link IClasspathEntry#CPE_LIBRARY}, this method returns an empty array. *

- * If a referenced entry has already been stored - * in the given project's .classpath, the stored attributes are populated in the corresponding - * referenced entry. For more details on storing referenced entries see + * When a non-null project is passed, any additional attributes that may have been stored + * previously in the project's .classpath files are retrived and populated in the + * corresponding referenced entry. If the project is null, the raw referenced + * entries are returned without any persisted attributes. * see {@link IJavaProject#setRawClasspath(IClasspathEntry[], IClasspathEntry[], IPath, * IProgressMonitor)}. *

* * @param libraryEntry the library entry whose referenced entries are sought - * @param project project where the persisted referenced entries to be retrieved from + * @param project project where the persisted referenced entries to be retrieved from. If null + * persisted attributes are not attempted to be retrived. * @return an array of classpath entries that are referenced directly or indirectly by the given entry. * If not applicable, returns an empty array. * @since 3.6 Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v retrieving revision 1.447 diff -u -r1.447 JavaModelManager.java --- model/org/eclipse/jdt/internal/core/JavaModelManager.java 8 Apr 2010 17:57:19 -0000 1.447 +++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 9 Apr 2010 09:23:35 -0000 @@ -1850,8 +1850,11 @@ public IClasspathEntry[] getReferencedClasspathEntries(IClasspathEntry libraryEntry, IJavaProject project) { IClasspathEntry[] referencedEntries = ((ClasspathEntry)libraryEntry).resolvedChainedLibraries(); - PerProjectInfo perProjectInfo = getPerProjectInfo(project.getProject(), false); + if (project == null) + return referencedEntries; + + PerProjectInfo perProjectInfo = getPerProjectInfo(project.getProject(), false); if(perProjectInfo == null) return referencedEntries; #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.212 diff -u -r1.212 ClasspathTests.java --- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 8 Apr 2010 14:44:20 -0000 1.212 +++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 9 Apr 2010 09:23:44 -0000 @@ -6157,11 +6157,17 @@ // Test referenced entries for a particular entry appear in the right order and the referencingEntry // attribute has the correct value - IClasspathEntry[] chains = JavaCore.getReferencedClasspathEntries(rawClasspath[2], p); + IClasspathEntry[] chains = JavaCore.getReferencedClasspathEntries(rawClasspath[2], null); assertClasspathEquals(chains, "/P/lib2.jar[CPE_LIBRARY][K_BINARY][isExported:true]\n" + "/P/lib3.jar[CPE_LIBRARY][K_BINARY][isExported:true]"); + chains = JavaCore.getReferencedClasspathEntries(rawClasspath[2], p); + assertClasspathEquals(chains, + "/P/lib2.jar[CPE_LIBRARY][K_BINARY][isExported:true]\n" + + "/P/lib3.jar[CPE_LIBRARY][K_BINARY][isExported:true]"); + + assertSame("Referencing Entry", rawClasspath[2], chains[0].getReferencingEntry()); assertSame("Referencing Entry", rawClasspath[2], chains[1].getReferencingEntry());