title: Why is IJavaProject.findPackageFragmentRoots returning an empty array?
body: <p>Every time I call <code>IJavaProject.findPackageFragmentRoots(IClasspathEntry cpe)</code> and pass it an IClasspathEntry of kind CPE_PROJECT, it returns an empty list. I paused the debugger and ran the following lines in the Eclipse Display view to see what was going on:</p>
  
  <pre><code>IClasspathEntry cpe = javaProject.getRawClasspath()[8];
  cpe.toString();
      (java.lang.String) /Some Project[CPE_PROJECT][K_SOURCE][isExported:false][combine access rules:false]
  
  // Show that the referenced project exists and has a root containing source
  IClasspathEntry cpe = javaProject.getRawClasspath()[8];
  IProject someProject = ResourcesPlugin.getWorkspace().getRoot().getProject(cpe.getPath().toString());
  IJavaProject someJavaProject = (IJavaProject) someProject.getNature(JavaCore.NATURE_ID);
  IPackageFragmentRoot pfr = someJavaProject.getPackageFragmentRoots()[0];
  new Boolean(pfr.getKind() == IPackageFragmentRoot.K_SOURCE).toString();
      (java.lang.String) true
  
  IClasspathEntry cpe = javaProject.getRawClasspath()[8];
  javaProject.findPackageFragmentRoots(cpe);
      (org.eclipse.jdt.core.IPackageFragmentRoot[]) []
  </code></pre>
  
  <p>The classpath entry is part of the Java project's classpath and it's of kind CPE_PROJECT. In addition, the referenced Java project (titled "Some Project") has at least one root containing source. According to the <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/IJavaProject.html" rel="nofollow noreferrer">javadoc for IJavaProject</a>, it seems this should return at least one IPackageFragmentRoot, but its doesn't.</p>
  
  <p>Any idea what I'm misunderstanding here? How can I get the IPackageFragmentRoots from an IClasspathEntry of kind CPE_PROJECT without doing something hackish? (I mean, I could get the IJavaProject from the classpath entry and iterate through its raw classpath, ignoring non-exported entries, in search of IPackageFragmentRoots.)</p>