in com.microsoft.java.lsif.core/src/com/microsoft/java/lsif/core/internal/indexer/Indexer.java [174:195]
private List<ICompilationUnit> getAllSourceFiles(IJavaProject javaProject) throws JavaModelException {
List<ICompilationUnit> res = new LinkedList<>();
IClasspathEntry[] references = javaProject.getRawClasspath();
for (IClasspathEntry reference : references) {
if (reference.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
IPackageFragmentRoot[] fragmentRoots = javaProject.findPackageFragmentRoots(reference);
for (IPackageFragmentRoot fragmentRoot : fragmentRoots) {
for (IJavaElement child : fragmentRoot.getChildren()) {
IPackageFragment fragment = (IPackageFragment) child;
if (fragment.hasChildren()) {
for (IJavaElement sourceFile : fragment.getChildren()) {
if (sourceFile.exists() && sourceFile instanceof ICompilationUnit) {
res.add((ICompilationUnit) sourceFile);
}
}
}
}
}
}
}
return res;
}