Program: 110974
Project: 110974
Buggy source:
/** 
 * Returns ids for dependent nodes of a given node, sorted by attribute. Note that some dependencies do not have a corresponding attribute here, and we use the null attribute to represent those edges. Visibility attributes are only visited if   {@code visitVisibility} is{@code true}. <p>If   {@code aspect} is null, returns the dependent nodes of the configuredtarget node representing the given target and configuration, otherwise that of the aspect node accompanying the aforementioned configured target node for the specified aspect. <p>The values are not simply labels because this also implements the first step of applying configuration transitions, namely, split transitions. This needs to be done before the labels are resolved because late bound attributes depend on the configuration. A good example for this is @{code :cc_toolchain}. <p>The long-term goal is that most configuration transitions be applied here. However, in order to do that, we first have to eliminate transitions that depend on the rule class of the dependency.
 */
public final ListMultimap<Attribute,Dependency> dependentNodeMap(TargetAndConfiguration node,BuildConfiguration hostConfig,Aspect aspect,Set<ConfigMatchingProvider> configConditions) throws EvalException, InterruptedException {
  Target target=node.getTarget();
  BuildConfiguration config=node.getConfiguration();
  ListMultimap<Attribute,Dependency> outgoingEdges=ArrayListMultimap.create();
  if (target instanceof OutputFile) {
    Preconditions.checkNotNull(config);
    visitTargetVisibility(node,outgoingEdges.get(null));
    Rule rule=((OutputFile)target).getGeneratingRule();
    outgoingEdges.put(null,Dependency.withConfiguration(rule.getLabel(),config));
  }
 else   if (target instanceof InputFile) {
    visitTargetVisibility(node,outgoingEdges.get(null));
  }
 else   if (target instanceof EnvironmentGroup) {
    visitTargetVisibility(node,outgoingEdges.get(null));
  }
 else   if (target instanceof Rule) {
    Preconditions.checkNotNull(config);
    visitTargetVisibility(node,outgoingEdges.get(null));
    Rule rule=(Rule)target;
    ListMultimap<Attribute,LabelAndConfiguration> labelMap=resolveAttributes(rule,aspect != null ? aspect.getDefinition() : null,config,hostConfig,configConditions);
    visitRule(rule,aspect,labelMap,outgoingEdges);
  }
 else   if (target instanceof PackageGroup) {
    visitPackageGroup(node,(PackageGroup)target,outgoingEdges.get(null));
  }
 else {
    throw new IllegalStateException(target.getLabel().toString());
  }
  return outgoingEdges;
}

Fixed version (ground truth):
/** 
 * Returns ids for dependent nodes of a given node, sorted by attribute. Note that some dependencies do not have a corresponding attribute here, and we use the null attribute to represent those edges. Visibility attributes are only visited if   {@code visitVisibility} is{@code true}. <p>If   {@code aspect} is null, returns the dependent nodes of the configuredtarget node representing the given target and configuration, otherwise that of the aspect node accompanying the aforementioned configured target node for the specified aspect. <p>The values are not simply labels because this also implements the first step of applying configuration transitions, namely, split transitions. This needs to be done before the labels are resolved because late bound attributes depend on the configuration. A good example for this is @{code :cc_toolchain}. <p>The long-term goal is that most configuration transitions be applied here. However, in order to do that, we first have to eliminate transitions that depend on the rule class of the dependency.
 */
public final ListMultimap<Attribute,Dependency> dependentNodeMap(TargetAndConfiguration node,BuildConfiguration hostConfig,Aspect aspect,Set<ConfigMatchingProvider> configConditions,NestedSetBuilder<Label> rootCauses) throws EvalException, InterruptedException {
  Target target=node.getTarget();
  BuildConfiguration config=node.getConfiguration();
  ListMultimap<Attribute,Dependency> outgoingEdges=ArrayListMultimap.create();
  if (target instanceof OutputFile) {
    Preconditions.checkNotNull(config);
    visitTargetVisibility(node,rootCauses,outgoingEdges.get(null));
    Rule rule=((OutputFile)target).getGeneratingRule();
    outgoingEdges.put(null,Dependency.withConfiguration(rule.getLabel(),config));
  }
 else   if (target instanceof InputFile) {
    visitTargetVisibility(node,rootCauses,outgoingEdges.get(null));
  }
 else   if (target instanceof EnvironmentGroup) {
    visitTargetVisibility(node,rootCauses,outgoingEdges.get(null));
  }
 else   if (target instanceof Rule) {
    Preconditions.checkNotNull(config);
    visitTargetVisibility(node,rootCauses,outgoingEdges.get(null));
    Rule rule=(Rule)target;
    ListMultimap<Attribute,LabelAndConfiguration> labelMap=resolveAttributes(rule,aspect != null ? aspect.getDefinition() : null,config,hostConfig,configConditions);
    visitRule(rule,aspect,labelMap,rootCauses,outgoingEdges);
  }
 else   if (target instanceof PackageGroup) {
    visitPackageGroup(node,(PackageGroup)target,rootCauses,outgoingEdges.get(null));
  }
 else {
    throw new IllegalStateException(target.getLabel().toString());
  }
  return outgoingEdges;
}