Program: 110794
Project: 110794
Buggy source:
/** 
 * Calculates the set of   {@link Package} objects, represented as source file targets, that dependon the given list of BUILD files and subincludes (other files are filtered out).
 */
@ThreadSafe void getRBuildFiles(Collection<PathFragment> fileIdentifiers,Callback<Target> callback) throws QueryException, InterruptedException {
  Collection<SkyKey> files=getSkyKeysForFileFragments(fileIdentifiers);
  Uniquifier<SkyKey> keyUniquifier=new ThreadSafeSkyKeyUniquifier(1);
  Collection<SkyKey> current=keyUniquifier.unique(graph.getSuccessfulValues(files).keySet());
  Set<SkyKey> resultKeys=CompactHashSet.create();
  while (!current.isEmpty()) {
    Collection<Iterable<SkyKey>> reverseDeps=graph.getReverseDeps(current).values();
    current=new HashSet<>();
    for (    SkyKey rdep : Iterables.concat(reverseDeps)) {
      if (rdep.functionName().equals(SkyFunctions.PACKAGE)) {
        resultKeys.add(rdep);
        if (rdep.equals(PackageValue.key(Label.EXTERNAL_PACKAGE_IDENTIFIER))) {
          if (keyUniquifier.unique(rdep)) {
            current.add(rdep);
          }
        }
      }
 else       if (!rdep.functionName().equals(SkyFunctions.PACKAGE_LOOKUP)) {
        if (keyUniquifier.unique(rdep)) {
          current.add(rdep);
        }
      }
    }
    if (resultKeys.size() >= BATCH_CALLBACK_SIZE) {
      for (      Iterable<SkyKey> batch : Iterables.partition(resultKeys,BATCH_CALLBACK_SIZE)) {
        callback.process(getBuildFilesForPackageValues(graph.getSuccessfulValues(batch).values()));
      }
      resultKeys.clear();
    }
  }
  callback.process(getBuildFilesForPackageValues(graph.getSuccessfulValues(resultKeys).values()));
}

Fixed version (ground truth):
/** 
 * Calculates the set of   {@link Package} objects, represented as source file targets, that dependon the given list of BUILD files and subincludes (other files are filtered out).
 */
@ThreadSafe void getRBuildFiles(Collection<PathFragment> fileIdentifiers,Callback<Target> callback) throws QueryException, InterruptedException {
  Collection<SkyKey> files=getSkyKeysForFileFragments(fileIdentifiers);
  Uniquifier<SkyKey> keyUniquifier=new ThreadSafeUniquifierImpl<>(SkyKeyKeyExtractor.INSTANCE,1);
  Collection<SkyKey> current=keyUniquifier.unique(graph.getSuccessfulValues(files).keySet());
  Set<SkyKey> resultKeys=CompactHashSet.create();
  while (!current.isEmpty()) {
    Collection<Iterable<SkyKey>> reverseDeps=graph.getReverseDeps(current).values();
    current=new HashSet<>();
    for (    SkyKey rdep : Iterables.concat(reverseDeps)) {
      if (rdep.functionName().equals(SkyFunctions.PACKAGE)) {
        resultKeys.add(rdep);
        if (rdep.equals(PackageValue.key(Label.EXTERNAL_PACKAGE_IDENTIFIER))) {
          if (keyUniquifier.unique(rdep)) {
            current.add(rdep);
          }
        }
      }
 else       if (!rdep.functionName().equals(SkyFunctions.PACKAGE_LOOKUP)) {
        if (keyUniquifier.unique(rdep)) {
          current.add(rdep);
        }
      }
    }
    if (resultKeys.size() >= BATCH_CALLBACK_SIZE) {
      for (      Iterable<SkyKey> batch : Iterables.partition(resultKeys,BATCH_CALLBACK_SIZE)) {
        callback.process(getBuildFilesForPackageValues(graph.getSuccessfulValues(batch).values()));
      }
      resultKeys.clear();
    }
  }
  callback.process(getBuildFilesForPackageValues(graph.getSuccessfulValues(resultKeys).values()));
}