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 Nov 27, 2024
1 parent 1b51ec2 commit b2b5bab
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 @@ -359,6 +360,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 @@ -377,14 +379,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 b2b5bab

Please sign in to comment.