Fix ErrorProne warning.
ErrorProne said:
This method returns both mutable and immutable collections or maps from different paths. This may be confusing for users of the method.
Use an ImmutableList.Builder to resolve this.
@@ -32,7 +32,6 @@ import com.google.idea.blaze.base.targetmaps.SourceToTargetMap;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import java.io.File;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Queue;
@@ -93,7 +92,7 @@ class ProtoAutoSyncProvider implements AutoSyncProvider {
if (target.isPlainTarget()) {
return ImmutableList.of(target.getLabel());
}
- List<Label> output = new ArrayList<>();
+ ImmutableList.Builder<Label> output = new ImmutableList.Builder<>();
Queue<TargetKey> todo = Queues.newArrayDeque();
ImmutableMultimap<TargetKey, TargetKey> reverseDependencyMap =
ReverseDependencyMap.get(project);
@@ -110,6 +109,6 @@ class ProtoAutoSyncProvider implements AutoSyncProvider {
todo.addAll(reverseDependencyMap.get(targetKey));
}
}
- return output;
+ return output.build();
}
}
