Remove unnecessary use of ResolvedTargets in SkyQueryEnvironment. ResolvedTargets#getTargets already doesn't contain any of ResolvedTargets#filteredTargets, and there is a 1-1 mapping between Labels and Targets, so the filtering we were doing was useless. -- MOS_MIGRATED_REVID=101463111
diff --git a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java index ef85d38..f3c3968 100644 --- a/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java +++ b/src/main/java/com/google/devtools/build/lib/query2/SkyQueryEnvironment.java
@@ -27,7 +27,6 @@ import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; -import com.google.devtools.build.lib.cmdline.ResolvedTargets; import com.google.devtools.build.lib.cmdline.TargetParsingException; import com.google.devtools.build.lib.cmdline.TargetPattern; import com.google.devtools.build.lib.collect.CompactHashSet; @@ -417,10 +416,8 @@ // The graph already contains a value or exception for this target pattern, so we use it. TargetPatternValue value = (TargetPatternValue) graph.getValue(patternKey); if (value != null) { - ResolvedTargets.Builder<Target> targetsBuilder = ResolvedTargets.builder(); - targetsBuilder.addAll(makeTargetsFromLabels(value.getTargets().getTargets())); - targetsBuilder.removeAll(makeTargetsFromLabels(value.getTargets().getFilteredTargets())); - result.put(pattern, targetsBuilder.build().getTargets()); + result.put( + pattern, ImmutableSet.copyOf(makeTargetsFromLabels(value.getTargets().getTargets()))); } else { // Because the graph was always initialized via a keep_going build, we know that the // exception stored here must be a TargetParsingException. Thus the comment in