diff options
Diffstat (limited to 'src/main/org/apache/tools/ant/util/depend/bcel/AncestorAnalyzer.java')
-rw-r--r-- | src/main/org/apache/tools/ant/util/depend/bcel/AncestorAnalyzer.java | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/main/org/apache/tools/ant/util/depend/bcel/AncestorAnalyzer.java b/src/main/org/apache/tools/ant/util/depend/bcel/AncestorAnalyzer.java index fa2e9eeee..8fc6d57f7 100644 --- a/src/main/org/apache/tools/ant/util/depend/bcel/AncestorAnalyzer.java +++ b/src/main/org/apache/tools/ant/util/depend/bcel/AncestorAnalyzer.java @@ -16,9 +16,10 @@ * */ package org.apache.tools.ant.util.depend.bcel; + import java.io.File; import java.io.IOException; -import java.util.Enumeration; +import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.Vector; @@ -69,13 +70,9 @@ public class AncestorAnalyzer extends AbstractAnalyzer { // classes upon which they depend Set<String> dependencies = new HashSet<>(); Set<File> containers = new HashSet<>(); - Set<String> toAnalyze = new HashSet<>(); + Set<String> toAnalyze = new HashSet<>(Collections.list(getRootClasses())); Set<String> nextAnalyze = new HashSet<>(); - for (Enumeration<String> e = getRootClasses(); e.hasMoreElements();) { - toAnalyze.add(e.nextElement()); - } - int count = 0; int maxCount = isClosureRequired() ? MAX_LOOPS : 2; while (!toAnalyze.isEmpty() && count++ < maxCount) { @@ -115,9 +112,8 @@ public class AncestorAnalyzer extends AbstractAnalyzer { } } - Set<String> temp = toAnalyze; - toAnalyze = nextAnalyze; - nextAnalyze = temp; + toAnalyze.clear(); + toAnalyze.addAll(nextAnalyze); } files.clear(); |