Skip to content

Commit

Permalink
Improvents to Dagger validation performance.
Browse files Browse the repository at this point in the history
RELNOTES=N/A

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=264453588
  • Loading branch information
bcorso authored and cpovirk committed Aug 21, 2019
1 parent f799bd9 commit 48db4f1
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.graph.EndpointPair;
import com.google.common.graph.Graphs;
import com.google.common.graph.ImmutableNetwork;
import com.google.common.graph.MutableNetwork;
import com.google.common.graph.NetworkBuilder;
Expand Down Expand Up @@ -76,6 +77,10 @@ public String pluginName() {
public void visitGraph(BindingGraph bindingGraph, DiagnosticReporter diagnosticReporter) {
ImmutableNetwork<Node, DependencyEdge> dependencyGraph =
nonCycleBreakingDependencyGraph(bindingGraph);
// First check the graph for a cycle. If there is one, then we'll do more work to report where.
if (!Graphs.hasCycle(dependencyGraph)) {
return;
}
// Check each endpoint pair only once, no matter how many parallel edges connect them.
Set<EndpointPair<Node>> dependencyEndpointPairs = dependencyGraph.asGraph().edges();
Set<EndpointPair<Node>> visited = newHashSetWithExpectedSize(dependencyEndpointPairs.size());
Expand Down

0 comments on commit 48db4f1

Please sign in to comment.