Skip to content

Commit

Permalink
Endless loop during testBug229951a
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Stryker <stryker@redhat.com>
  • Loading branch information
Rob Stryker committed Dec 2, 2024
1 parent a460a7c commit c35043f
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.io.File;
import java.lang.Runtime.Version;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
Expand Down Expand Up @@ -355,6 +356,7 @@ public static <T> boolean isEmpty(List<T> list) {
private static Collection<File> classpathEntriesToFiles(JavaProject project, Predicate<IClasspathEntry> select) {
try {
LinkedHashSet<File> res = new LinkedHashSet<>();
ArrayList<IClasspathEntry> seen = new ArrayList<>();
Queue<IClasspathEntry> toProcess = new LinkedList<>();
toProcess.addAll(Arrays.asList(project.resolveClasspath(project.getExpandedClasspath())));
while (!toProcess.isEmpty()) {
Expand All @@ -373,14 +375,16 @@ private static Collection<File> classpathEntriesToFiles(JavaProject project, Pre
if (moduleDescription == null) {
IPath path = referencedJavaProject.getOutputLocation();
addPath(referencedJavaProject, path, res);
for (IClasspathEntry transitiveEntry : referencedJavaProject.resolveClasspath(referencedJavaProject.getExpandedClasspath()) ) {
IClasspathEntry[] resolved = referencedJavaProject.resolveClasspath(referencedJavaProject.getExpandedClasspath());
for (IClasspathEntry transitiveEntry : resolved ) {
if (transitiveEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
IPath outputLocation = transitiveEntry.getOutputLocation();
if (outputLocation != null && select.test(transitiveEntry)) {
addPath(referencedJavaProject, outputLocation, res);
}
} else if (transitiveEntry.isExported()) {
} else if (transitiveEntry.isExported() && !seen.contains(transitiveEntry)) {
toProcess.add(transitiveEntry);
seen.add(transitiveEntry);
}
}
}
Expand Down

0 comments on commit c35043f

Please sign in to comment.