Program: 110891
Project: 110891
Buggy source:
/** 
 * Retrieves the configurations needed for the given deps, trimming down their fragments to those only needed by their transitive closures.
 */
private Map<Dependency,BuildConfiguration> getConfigurations(EventHandler eventHandler,BuildOptions fromOptions,Iterable<Dependency> keys){
  Map<Dependency,BuildConfiguration> builder=new HashMap<>();
  Set<Dependency> depsToEvaluate=new HashSet<>();
  final List<SkyKey> transitiveFragmentSkyKeys=new ArrayList<>();
  Map<Label,Set<Class<? extends BuildConfiguration.Fragment>>> fragmentsMap=new HashMap<>();
  Set<Label> labelsWithErrors=new HashSet<>();
  for (  Dependency key : keys) {
    if (key.hasStaticConfiguration()) {
      builder.put(key,key.getConfiguration());
    }
 else     if (key.getTransition() == Attribute.ConfigurationTransition.NULL) {
      builder.put(key,null);
    }
 else {
      depsToEvaluate.add(key);
      transitiveFragmentSkyKeys.add(TransitiveTargetValue.key(key.getLabel()));
    }
  }
  EvaluationResult<SkyValue> fragmentsResult=evaluateSkyKeys(eventHandler,transitiveFragmentSkyKeys);
  for (  Dependency key : keys) {
    if (!depsToEvaluate.contains(key)) {
    }
 else     if (fragmentsResult.getError(TransitiveTargetValue.key(key.getLabel())) != null) {
      labelsWithErrors.add(key.getLabel());
    }
 else {
      TransitiveTargetValue ttv=(TransitiveTargetValue)fragmentsResult.get(TransitiveTargetValue.key(key.getLabel()));
      fragmentsMap.put(key.getLabel(),ttv.getTransitiveConfigFragments().toSet());
    }
  }
  final List<SkyKey> configSkyKeys=new ArrayList<>();
  for (  Dependency key : keys) {
    if (!depsToEvaluate.contains(key) || labelsWithErrors.contains(key.getLabel())) {
      continue;
    }
    configSkyKeys.add(BuildConfigurationValue.key(fragmentsMap.get(key.getLabel()),getDynamicConfigOptions(key,fromOptions)));
  }
  EvaluationResult<SkyValue> configsResult=evaluateSkyKeys(eventHandler,configSkyKeys);
  for (  Dependency key : keys) {
    if (!depsToEvaluate.contains(key) || labelsWithErrors.contains(key.getLabel())) {
      continue;
    }
    SkyKey configKey=BuildConfigurationValue.key(fragmentsMap.get(key.getLabel()),getDynamicConfigOptions(key,fromOptions));
    builder.put(key,((BuildConfigurationValue)configsResult.get(configKey)).getConfiguration());
  }
  return builder;
}

Fixed version (ground truth):
/** 
 * Retrieves the configurations needed for the given deps, trimming down their fragments to those only needed by their transitive closures.
 */
private Map<Dependency,BuildConfiguration> getConfigurations(EventHandler eventHandler,BuildOptions fromOptions,Iterable<Dependency> keys){
  Map<Dependency,BuildConfiguration> builder=new HashMap<>();
  Set<Dependency> depsToEvaluate=new HashSet<>();
  final List<SkyKey> transitiveFragmentSkyKeys=new ArrayList<>();
  Map<Label,Set<Class<? extends BuildConfiguration.Fragment>>> fragmentsMap=new HashMap<>();
  Set<Label> labelsWithErrors=new HashSet<>();
  for (  Dependency key : keys) {
    if (key.hasStaticConfiguration()) {
      builder.put(key,key.getConfiguration());
    }
 else     if (key.getTransition() == Attribute.ConfigurationTransition.NULL) {
      builder.put(key,null);
    }
 else {
      depsToEvaluate.add(key);
      transitiveFragmentSkyKeys.add(TransitiveTargetValue.key(key.getLabel()));
    }
  }
  EvaluationResult<SkyValue> fragmentsResult=evaluateSkyKeys(eventHandler,transitiveFragmentSkyKeys);
  for (  Dependency key : keys) {
    if (!depsToEvaluate.contains(key)) {
    }
 else     if (fragmentsResult.getError(TransitiveTargetValue.key(key.getLabel())) != null) {
      labelsWithErrors.add(key.getLabel());
    }
 else {
      TransitiveTargetValue ttv=(TransitiveTargetValue)fragmentsResult.get(TransitiveTargetValue.key(key.getLabel()));
      fragmentsMap.put(key.getLabel(),ttv.getTransitiveConfigFragments().toSet());
    }
  }
  final List<SkyKey> configSkyKeys=new ArrayList<>();
  for (  Dependency key : keys) {
    if (!depsToEvaluate.contains(key) || labelsWithErrors.contains(key.getLabel())) {
      continue;
    }
    Set<Class<? extends BuildConfiguration.Fragment>> depFragments=fragmentsMap.get(key.getLabel());
    configSkyKeys.add(BuildConfigurationValue.key(depFragments,getDynamicConfigOptions(key,fromOptions,depFragments)));
  }
  EvaluationResult<SkyValue> configsResult=evaluateSkyKeys(eventHandler,configSkyKeys);
  for (  Dependency key : keys) {
    if (!depsToEvaluate.contains(key) || labelsWithErrors.contains(key.getLabel())) {
      continue;
    }
    Set<Class<? extends BuildConfiguration.Fragment>> depFragments=fragmentsMap.get(key.getLabel());
    SkyKey configKey=BuildConfigurationValue.key(depFragments,getDynamicConfigOptions(key,fromOptions,depFragments));
    builder.put(key,((BuildConfigurationValue)configsResult.get(configKey)).getConfiguration());
  }
  return builder;
}