From 96ca6272fe207a5007fec5474817efda287c54d7 Mon Sep 17 00:00:00 2001 From: Googler Date: Wed, 21 Mar 2018 14:41:04 -0700 Subject: Automatic code cleanup. PiperOrigin-RevId: 189970123 --- .../google/devtools/build/lib/remote/TreeNodeRepository.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/java/com/google/devtools/build/lib/remote/TreeNodeRepository.java b/src/main/java/com/google/devtools/build/lib/remote/TreeNodeRepository.java index 5763b25e51..7767cb8c7b 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/TreeNodeRepository.java +++ b/src/main/java/com/google/devtools/build/lib/remote/TreeNodeRepository.java @@ -21,7 +21,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Interner; import com.google.common.collect.Iterables; -import com.google.common.collect.TreeTraverser; +import com.google.common.graph.Traverser; import com.google.devtools.build.lib.actions.ActionInput; import com.google.devtools.build.lib.actions.ActionInputFileCache; import com.google.devtools.build.lib.actions.ActionInputHelper; @@ -55,10 +55,13 @@ import javax.annotation.Nullable; * computing and caching Merkle hashes on all objects. */ @ThreadSafe -public final class TreeNodeRepository extends TreeTraverser { +public final class TreeNodeRepository { // In this implementation, symlinks are NOT followed when expanding directory artifacts public static final Symlinks SYMLINK_POLICY = Symlinks.NOFOLLOW; + private final Traverser traverser = + Traverser.forTree((TreeNode node) -> children(node)); + /** * A single node in a hierarchical directory structure. Leaves are the Artifacts, although we only * use the ActionInput interface. We assume that the objects used for the ActionInputs are unique @@ -231,14 +234,13 @@ public final class TreeNodeRepository extends TreeTraverser children(TreeNode node) { return Iterables.transform(node.getChildEntries(), TreeNode.ChildEntry::getChild); } /** Traverse the directory structure in order (pre-order tree traversal). */ public Iterable descendants(TreeNode node) { - return preOrderTraversal(node); + return traverser.depthFirstPreOrder(node); } /** -- cgit v1.2.3