nus-yam/ex-repair huggingface dataset:
Program: 52889
Project: 52889
Buggy source:
private void forEachBuildFileFilesystem(final ProjectFilesystem filesystem,final String buildFileName,final Consumer<Path> function) throws IOException {
  filesystem.walkRelativeFileTree(getBasePath(),new FileVisitor<Path>(){
    @Override public FileVisitResult preVisitDirectory(    Path dir,    BasicFileAttributes attrs) throws IOException {
      if (filesystem.isIgnored(dir)) {
        return FileVisitResult.SKIP_SUBTREE;
      }
      return FileVisitResult.CONTINUE;
    }
    @Override public FileVisitResult visitFile(    Path file,    BasicFileAttributes attrs) throws IOException {
      if (buildFileName.equals(file.getFileName().toString()) && !filesystem.isIgnored(file)) {
        function.accept(filesystem.resolve(file));
      }
      return FileVisitResult.CONTINUE;
    }
    @Override public FileVisitResult visitFileFailed(    Path file,    IOException exc) throws IOException {
      throw exc;
    }
    @Override public FileVisitResult postVisitDirectory(    Path dir,    IOException exc) throws IOException {
      if (exc != null) {
        throw exc;
      }
      return FileVisitResult.CONTINUE;
    }
  }
);
}

Fixed version (ground truth):
private void forEachBuildFileFilesystem(final ProjectFilesystem filesystem,final String buildFileName,final Consumer<Path> function) throws IOException {
  if (!filesystem.isDirectory(getBasePath())) {
    throw new HumanReadableException("String_Node_Str" + "String_Node_Str",getBasePath());
  }
  filesystem.walkRelativeFileTree(getBasePath(),new FileVisitor<Path>(){
    @Override public FileVisitResult preVisitDirectory(    Path dir,    BasicFileAttributes attrs) throws IOException {
      if (filesystem.isIgnored(dir)) {
        return FileVisitResult.SKIP_SUBTREE;
      }
      return FileVisitResult.CONTINUE;
    }
    @Override public FileVisitResult visitFile(    Path file,    BasicFileAttributes attrs) throws IOException {
      if (buildFileName.equals(file.getFileName().toString()) && !filesystem.isIgnored(file)) {
        function.accept(filesystem.resolve(file));
      }
      return FileVisitResult.CONTINUE;
    }
    @Override public FileVisitResult visitFileFailed(    Path file,    IOException exc) throws IOException {
      throw exc;
    }
    @Override public FileVisitResult postVisitDirectory(    Path dir,    IOException exc) throws IOException {
      if (exc != null) {
        throw exc;
      }
      return FileVisitResult.CONTINUE;
    }
  }
);
}
Program: 52890
Project: 52890
Buggy source:
public static AppleCxxPlatform getAppleCxxPlatformForBuildTarget(FlavorDomain<CxxPlatform> cxxPlatformFlavorDomain,CxxPlatform defaultCxxPlatform,FlavorDomain<AppleCxxPlatform> appleCxxPlatformFlavorDomain,BuildTarget target,Optional<MultiarchFileInfo> fatBinaryInfo){
  AppleCxxPlatform appleCxxPlatform;
  if (fatBinaryInfo.isPresent()) {
    appleCxxPlatform=fatBinaryInfo.get().getRepresentativePlatform();
  }
 else {
    CxxPlatform cxxPlatform=getCxxPlatformForBuildTarget(cxxPlatformFlavorDomain,defaultCxxPlatform,target);
    try {
      appleCxxPlatform=appleCxxPlatformFlavorDomain.getValue(cxxPlatform.getFlavor());
    }
 catch (    FlavorDomainException e) {
      throw new HumanReadableException(e,"String_Node_Str",target,cxxPlatform.getFlavor().getName());
    }
  }
  return appleCxxPlatform;
}

Fixed version (ground truth):
public static AppleCxxPlatform getAppleCxxPlatformForBuildTarget(FlavorDomain<CxxPlatform> cxxPlatformFlavorDomain,CxxPlatform defaultCxxPlatform,FlavorDomain<AppleCxxPlatform> appleCxxPlatformFlavorDomain,BuildTarget target,Optional<MultiarchFileInfo> fatBinaryInfo){
  AppleCxxPlatform appleCxxPlatform;
  if (fatBinaryInfo.isPresent()) {
    appleCxxPlatform=fatBinaryInfo.get().getRepresentativePlatform();
  }
 else {
    CxxPlatform cxxPlatform=getCxxPlatformForBuildTarget(cxxPlatformFlavorDomain,defaultCxxPlatform,target);
    try {
      appleCxxPlatform=appleCxxPlatformFlavorDomain.getValue(cxxPlatform.getFlavor());
    }
 catch (    FlavorDomainException e) {
      throw new HumanReadableException(e,"String_Node_Str" + "String_Node_Str" + "String_Node_Str",target,cxxPlatform.getFlavor().getName());
    }
  }
  return appleCxxPlatform;
}
Program: 52891
Project: 52891
Buggy source:
@NotNull @Override public FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement root,@NotNull Document document,boolean quick){
  List<FoldingDescriptor> descriptors=new ArrayList<>();
  PsiTreeUtil.findChildrenOfAnyType(root,BuckRuleBlockImpl.class,BuckValueArrayImpl.class).stream().forEach(element -> {
    int offset=element instanceof BuckRuleBlockImpl ? 0 : 1;
    descriptors.add(new FoldingDescriptor(element.getNode(),new TextRange(element.getTextRange().getStartOffset() + offset,element.getTextRange().getEndOffset() - offset)));
  }
);
  return descriptors.toArray(new FoldingDescriptor[descriptors.size()]);
}

Fixed version (ground truth):
@NotNull @Override public FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement root,@NotNull Document document,boolean quick){
  List<FoldingDescriptor> descriptors=new ArrayList<>();
  PsiTreeUtil.findChildrenOfAnyType(root,BuckRuleBlockImpl.class,BuckValueArrayImpl.class).stream().forEach(element -> {
    int offset=element instanceof BuckRuleBlockImpl ? 0 : 1;
    TextRange elementTextRange=element.getTextRange();
    TextRange foldingRange=new TextRange(elementTextRange.getStartOffset() + offset,elementTextRange.getEndOffset() - offset);
    if (foldingRange.getLength() > 0) {
      descriptors.add(new FoldingDescriptor(element.getNode(),foldingRange));
    }
  }
);
  return descriptors.toArray(new FoldingDescriptor[descriptors.size()]);
}
Program: 52892
Project: 52892
Buggy source:
@Override public void consumeTestResultsAvailable(long timestamp,TestResults testResults){
  final GeneralTestEventsProcessor processor=getProcessor();
  if (processor == null) {
    return;
  }
  for (  TestCaseSummary suite : testResults.getTestCases()) {
    if (suite.getTestResults().isEmpty()) {
      continue;
    }
    final String locationUrl=null;
    processor.onSuiteStarted(new TestSuiteStartedEvent(suite.getTestCaseName(),locationUrl));
    for (    TestResultsSummary test : suite.getTestResults()) {
      final String testName=test.getTestName();
      processor.onTestStarted(new TestStartedEvent(testName,null));
      final String stdOut=test.getStdOut();
      if (stdOut != null) {
        processor.onTestOutput(new TestOutputEvent(testName,stdOut,true));
      }
      final String stdErr=test.getStdErr();
      if (stdErr != null) {
        processor.onTestOutput(new TestOutputEvent(testName,stdErr,false));
      }
      if (test.getType() == ResultType.FAILURE) {
        processor.onTestFailure(new TestFailedEvent(testName,"String_Node_Str",test.getStacktrace(),true,null,null));
      }
 else {
        processor.onTestFinished(new TestFinishedEvent(testName,test.getTime()));
      }
    }
    processor.onSuiteFinished(new TestSuiteFinishedEvent(suite.getTestCaseName()));
  }
}

Fixed version (ground truth):
@Override public void consumeTestResultsAvailable(long timestamp,TestResults testResults){
  final GeneralTestEventsProcessor processor=getProcessor();
  if (processor == null) {
    return;
  }
  for (  TestCaseSummary suite : testResults.getTestCases()) {
    if (suite.getTestResults().isEmpty()) {
      continue;
    }
    final String locationUrl=null;
    processor.onSuiteStarted(new TestSuiteStartedEvent(suite.getTestCaseName(),locationUrl));
    for (    TestResultsSummary test : suite.getTestResults()) {
      final String testName=test.getTestName();
      processor.onTestStarted(new TestStartedEvent(testName,null));
      final String stdOut=test.getStdOut();
      if (stdOut != null) {
        processor.onTestOutput(new TestOutputEvent(testName,stdOut,true));
      }
      final String stdErr=test.getStdErr();
      if (stdErr != null) {
        processor.onTestOutput(new TestOutputEvent(testName,stdErr,false));
      }
      if (test.getType() == ResultType.FAILURE) {
        processor.onTestFailure(new TestFailedEvent(testName,"String_Node_Str",test.getStacktrace(),true,null,null));
      }
      processor.onTestFinished(new TestFinishedEvent(testName,test.getTime()));
    }
    processor.onSuiteFinished(new TestSuiteFinishedEvent(suite.getTestCaseName()));
  }
}
Program: 52895
Project: 52895
Buggy source:
@SuppressWarnings("String_Node_Str") ImmutableList<String> getCompilationFlags(Path workingDir,ImmutableMap<Path,Path> prefixMap){
  return ImmutableList.of();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") ImmutableList<String> getCompilationFlags(Compiler compiler,Path workingDir,ImmutableMap<Path,Path> prefixMap){
  return ImmutableList.of();
}
Program: 52897
Project: 52897
Buggy source:
public PrefixMapDebugPathSanitizer(String fakeCompilationDirectory,ImmutableBiMap<Path,String> other,CxxToolProvider.Type cxxType){
  this.fakeCompilationDirectory=fakeCompilationDirectory;
  this.isGcc=cxxType == CxxToolProvider.Type.GCC;
  this.cxxType=cxxType;
  this.other=other;
}

Fixed version (ground truth):
public PrefixMapDebugPathSanitizer(String fakeCompilationDirectory,ImmutableBiMap<Path,String> other){
  this.fakeCompilationDirectory=fakeCompilationDirectory;
  this.other=other;
}
Program: 52898
Project: 52898
Buggy source:
@Override ImmutableList<String> getCompilationFlags(Path workingDir,ImmutableMap<Path,Path> prefixMap){
  if (cxxType == CxxToolProvider.Type.WINDOWS) {
    return ImmutableList.of();
  }
  ImmutableList.Builder<String> flags=ImmutableList.builder();
  RichStream.<Map.Entry<Path,String>>empty().concat(isGcc ? Stream.empty() : prefixMap.entrySet().stream().map(e -> new AbstractMap.SimpleEntry<>(e.getKey(),e.getValue().toString()))).concat(RichStream.from(getAllPaths(Optional.of(workingDir)))).sorted(Comparator.comparingInt(entry -> entry.getKey().toString().length())).map(p -> getDebugPrefixMapFlag(p.getKey(),p.getValue())).forEach(flags::add);
  if (isGcc) {
    flags.add("String_Node_Str");
  }
  return flags.build();
}

Fixed version (ground truth):
@Override ImmutableList<String> getCompilationFlags(Compiler compiler,Path workingDir,ImmutableMap<Path,Path> prefixMap){
  if (compiler instanceof WindowsCompiler) {
    return ImmutableList.of();
  }
  ImmutableList.Builder<String> flags=ImmutableList.builder();
  RichStream.<Map.Entry<Path,String>>empty().concat(compiler instanceof GccCompiler ? Stream.empty() : prefixMap.entrySet().stream().map(e -> new AbstractMap.SimpleEntry<>(e.getKey(),e.getValue().toString()))).concat(RichStream.from(getAllPaths(Optional.of(workingDir)))).sorted(Comparator.comparingInt(entry -> entry.getKey().toString().length())).map(p -> getDebugPrefixMapFlag(p.getKey(),p.getValue())).forEach(flags::add);
  if (compiler instanceof GccCompiler) {
    flags.add("String_Node_Str");
  }
  return flags.build();
}
Program: 52899
Project: 52899
Buggy source:
@Override ImmutableList<String> getCompilationFlags(Path workingDir,ImmutableMap<Path,Path> prefixMap){
  if (cxxType == CxxToolProvider.Type.WINDOWS) {
    return ImmutableList.of();
  }
  ImmutableList.Builder<String> flags=ImmutableList.builder();
  RichStream.from(prefixMap.entrySet()).<Map.Entry<Path,String>>map(e -> new AbstractMap.SimpleEntry<>(e.getKey(),e.getValue().toString())).concat(RichStream.from(getAllPaths(Optional.of(workingDir)))).sorted(Comparator.comparingInt(entry -> entry.getKey().toString().length())).map(p -> getDebugPrefixMapFlag(p.getKey(),p.getValue())).forEach(flags::add);
  if (isGcc) {
    flags.add("String_Node_Str");
  }
  return flags.build();
}

Fixed version (ground truth):
@Override ImmutableList<String> getCompilationFlags(Path workingDir,ImmutableMap<Path,Path> prefixMap){
  if (cxxType == CxxToolProvider.Type.WINDOWS) {
    return ImmutableList.of();
  }
  ImmutableList.Builder<String> flags=ImmutableList.builder();
  RichStream.<Map.Entry<Path,String>>empty().concat(isGcc ? Stream.empty() : prefixMap.entrySet().stream().map(e -> new AbstractMap.SimpleEntry<>(e.getKey(),e.getValue().toString()))).concat(RichStream.from(getAllPaths(Optional.of(workingDir)))).sorted(Comparator.comparingInt(entry -> entry.getKey().toString().length())).map(p -> getDebugPrefixMapFlag(p.getKey(),p.getValue())).forEach(flags::add);
  if (isGcc) {
    flags.add("String_Node_Str");
  }
  return flags.build();
}
Program: 52906
Project: 52906
Buggy source:
public String getCompilationDirectory(){
  return getExpandedPath(compilationDirectory);
}

Fixed version (ground truth):
public abstract String getCompilationDirectory();
Program: 52908
Project: 52908
Buggy source:
/** 
 * @return a {@link ByteBufferReplacer} suitable for replacing {@code workingDir} with {@code compilationDirectory}.
 */
protected ByteBufferReplacer getCompilationDirectoryReplacer(Path workingDir){
  return new ByteBufferReplacer(ImmutableMap.of(getExpandedPath(workingDir).getBytes(Charsets.US_ASCII),getExpandedPath(compilationDirectory).getBytes(Charsets.US_ASCII)));
}

Fixed version (ground truth):
/** 
 * @return a {@link ByteBufferReplacer} suitable for replacing {@code workingDir} with {@code compilationDirectory}.
 */
private ByteBufferReplacer getCompilationDirectoryReplacer(Path workingDir){
  return new ByteBufferReplacer(ImmutableMap.of(getExpandedPath(workingDir).getBytes(Charsets.US_ASCII),getExpandedPath(compilationDirectory).getBytes(Charsets.US_ASCII)));
}
Program: 52909
Project: 52909
Buggy source:
/** 
 * @param pathSize fix paths to this size for in-place replacements.
 * @param separator the path separator used to fill paths aren't of {@code pathSize} length.
 * @param compilationDirectory the desired path to replace the actual compilation directory with.
 */
public MungingDebugPathSanitizer(int pathSize,char separator,Path compilationDirectory,ImmutableBiMap<Path,String> other){
  super(separator,pathSize,compilationDirectory);
  this.other=other;
}

Fixed version (ground truth):
/** 
 * @param pathSize fix paths to this size for in-place replacements.
 * @param separator the path separator used to fill paths aren't of {@code pathSize} length.
 * @param compilationDirectory the desired path to replace the actual compilation directory with.
 */
public MungingDebugPathSanitizer(int pathSize,char separator,Path compilationDirectory,ImmutableBiMap<Path,String> other){
  this.compilationDirectory=compilationDirectory;
  this.pathSize=pathSize;
  this.separator=separator;
  this.other=other;
}
Program: 52910
Project: 52910
Buggy source:
public PrefixMapDebugPathSanitizer(int pathSize,char separator,Path fakeCompilationDirectory,ImmutableBiMap<Path,String> other,CxxToolProvider.Type cxxType){
  super(separator,pathSize,fakeCompilationDirectory);
  this.isGcc=cxxType == CxxToolProvider.Type.GCC;
  this.cxxType=cxxType;
  ImmutableBiMap.Builder<Path,String> pathsBuilder=ImmutableBiMap.builder();
  pathsBuilder.putAll(FluentIterable.from(other.entrySet()).toSortedList((left,right) -> right.getKey().toString().length() - left.getKey().toString().length()));
  this.other=pathsBuilder.build();
}

Fixed version (ground truth):
public PrefixMapDebugPathSanitizer(String fakeCompilationDirectory,ImmutableBiMap<Path,String> other,CxxToolProvider.Type cxxType){
  this.fakeCompilationDirectory=fakeCompilationDirectory;
  this.isGcc=cxxType == CxxToolProvider.Type.GCC;
  this.cxxType=cxxType;
  ImmutableBiMap.Builder<Path,String> pathsBuilder=ImmutableBiMap.builder();
  other.entrySet().stream().sorted((left,right) -> right.getKey().toString().length() - left.getKey().toString().length()).forEach(e -> pathsBuilder.put(e.getKey(),e.getValue()));
  this.other=pathsBuilder.build();
}
Program: 52911
Project: 52911
Buggy source:
@Override protected Iterable<Map.Entry<Path,String>> getAllPaths(Optional<Path> workingDir){
  if (!workingDir.isPresent()) {
    return other.entrySet();
  }
  return Iterables.concat(other.entrySet(),ImmutableList.of(new AbstractMap.SimpleEntry<>(workingDir.get(),compilationDirectory.toString())));
}

Fixed version (ground truth):
@Override protected Iterable<Map.Entry<Path,String>> getAllPaths(Optional<Path> workingDir){
  if (!workingDir.isPresent()) {
    return other.entrySet();
  }
  return Iterables.concat(other.entrySet(),ImmutableList.of(new AbstractMap.SimpleEntry<>(workingDir.get(),fakeCompilationDirectory)));
}
Program: 52912
Project: 52912
Buggy source:
@Test public void runtimeSupportsStl() throws InterruptedException, IOException {
  assumeTrue("String_Node_Str",NdkCxxPlatforms.isSupportedConfiguration(getNdkRoot(),cxxRuntime));
  ProjectWorkspace workspace=setupWorkspace("String_Node_Str");
  workspace.runBuckCommand("String_Node_Str",String.format("String_Node_Str",arch)).assertSuccess();
}

Fixed version (ground truth):
@Test public void runtimeSupportsStl() throws InterruptedException, IOException {
  assumeTrue("String_Node_Str",NdkCxxPlatforms.isSupportedConfiguration(getNdkRoot(),cxxRuntime));
  ProjectWorkspace workspace=setupWorkspace("String_Node_Str",tmp);
  workspace.runBuckCommand("String_Node_Str",String.format("String_Node_Str",arch)).assertSuccess();
}
Program: 52913
Project: 52913
Buggy source:
private ProjectWorkspace setupWorkspace(String name) throws IOException {
  ProjectWorkspace workspace=TestDataHelper.createProjectWorkspaceForScenario(this,name,tmp);
  workspace.setUp();
  workspace.writeContentsToPath(String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",compiler,cxxRuntime),"String_Node_Str");
  return workspace;
}

Fixed version (ground truth):
private ProjectWorkspace setupWorkspace(String name,TemporaryPaths tmp) throws IOException {
  ProjectWorkspace workspace=TestDataHelper.createProjectWorkspaceForScenario(this,name,tmp);
  workspace.setUp();
  workspace.writeContentsToPath(String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",compiler,cxxRuntime),"String_Node_Str");
  return workspace;
}
Program: 52914
Project: 52914
Buggy source:
@Test public void testWorkingDirectoryAndNdkHeaderPathsAreSanitized() throws InterruptedException, IOException {
  ProjectWorkspace workspace=setupWorkspace("String_Node_Str");
  workspace.writeContentsToPath("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str","String_Node_Str");
  ProjectFilesystem filesystem=new ProjectFilesystem(workspace.getDestPath());
  BuildTarget target=BuildTargetFactory.newInstance(String.format("String_Node_Str",arch));
  workspace.runBuckBuild(target.getFullyQualifiedName()).assertSuccess();
  Path lib=workspace.getPath(BuildTargets.getGenPath(filesystem,target,"String_Node_Str" + target.getShortName() + "String_Node_Str"));
  String contents=MorePaths.asByteSource(lib).asCharSource(Charsets.ISO_8859_1).read();
  assertFalse(contents.contains(tmp.getRoot().toString()));
  for (  NdkCxxPlatforms.Host host : NdkCxxPlatforms.Host.values()) {
    assertFalse(contents.contains(host.toString()));
  }
  assertFalse(contents.contains(getNdkRoot().toString()));
}

Fixed version (ground truth):
@Test public void testWorkingDirectoryAndNdkHeaderPathsAreSanitized() throws InterruptedException, IOException {
  String buckConfig="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str";
  ProjectWorkspace workspace=setupWorkspace("String_Node_Str",tmp);
  ProjectFilesystem filesystem=new ProjectFilesystem(workspace.getDestPath());
  workspace.writeContentsToPath(buckConfig,"String_Node_Str");
  BuildTarget target=BuildTargetFactory.newInstance(String.format("String_Node_Str",arch));
  workspace.runBuckBuild(target.getFullyQualifiedName()).assertSuccess();
  Path lib=workspace.getPath(BuildTargets.getGenPath(filesystem,target,"String_Node_Str" + target.getShortName() + "String_Node_Str"));
  String contents=MorePaths.asByteSource(lib).asCharSource(Charsets.ISO_8859_1).read();
  assertFalse(contents.contains(tmp.getRoot().toString()));
  for (  NdkCxxPlatforms.Host host : NdkCxxPlatforms.Host.values()) {
    assertFalse(contents.contains(host.toString()));
  }
  assertFalse(contents.contains(getNdkRoot().toString()));
  ProjectWorkspace longPwdWorkspace=setupWorkspace("String_Node_Str",tmp_long_pwd);
  ProjectFilesystem longPwdFilesystem=new ProjectFilesystem(workspace.getDestPath());
  longPwdWorkspace.writeContentsToPath(buckConfig,"String_Node_Str");
  longPwdWorkspace.runBuckBuild(target.getFullyQualifiedName()).assertSuccess();
  lib=longPwdWorkspace.getPath(BuildTargets.getGenPath(longPwdFilesystem,target,"String_Node_Str" + target.getShortName() + "String_Node_Str"));
  String movedContents=MorePaths.asByteSource(lib).asCharSource(Charsets.ISO_8859_1).read();
  assertEquals(contents,movedContents);
}
Program: 52915
Project: 52915
Buggy source:
@Test public void changedPlatformTarget() throws InterruptedException, IOException {
  assumeTrue("String_Node_Str",NdkCxxPlatforms.isSupportedConfiguration(getNdkRoot(),cxxRuntime));
  assumeThat("String_Node_Str",arch,not(anyOf(equalTo("String_Node_Str"),equalTo("String_Node_Str"))));
  ProjectWorkspace workspace=setupWorkspace("String_Node_Str");
  BuildTarget target=BuildTargetFactory.newInstance(String.format("String_Node_Str",arch));
  BuildTarget linkTarget=CxxDescriptionEnhancer.createCxxLinkTarget(target,Optional.empty());
  workspace.runBuckCommand("String_Node_Str",target.toString()).assertSuccess();
  workspace.getBuildLog().assertTargetBuiltLocally(linkTarget.toString());
  workspace.writeContentsToPath("String_Node_Str","String_Node_Str");
  workspace.runBuckCommand("String_Node_Str",target.toString()).assertSuccess();
  workspace.getBuildLog().assertTargetBuiltLocally(linkTarget.toString());
}

Fixed version (ground truth):
@Test public void changedPlatformTarget() throws InterruptedException, IOException {
  assumeTrue("String_Node_Str",NdkCxxPlatforms.isSupportedConfiguration(getNdkRoot(),cxxRuntime));
  assumeThat("String_Node_Str",arch,not(anyOf(equalTo("String_Node_Str"),equalTo("String_Node_Str"))));
  ProjectWorkspace workspace=setupWorkspace("String_Node_Str",tmp);
  BuildTarget target=BuildTargetFactory.newInstance(String.format("String_Node_Str",arch));
  BuildTarget linkTarget=CxxDescriptionEnhancer.createCxxLinkTarget(target,Optional.empty());
  workspace.runBuckCommand("String_Node_Str",target.toString()).assertSuccess();
  workspace.getBuildLog().assertTargetBuiltLocally(linkTarget.toString());
  workspace.writeContentsToPath("String_Node_Str","String_Node_Str");
  workspace.runBuckCommand("String_Node_Str",target.toString()).assertSuccess();
  workspace.getBuildLog().assertTargetBuiltLocally(linkTarget.toString());
}
Program: 52916
Project: 52916
Buggy source:
public static CxxSandboxInclude from(SymlinkTree symlinkTree,String includeDir,CxxPreprocessables.IncludeType includeType){
  CxxSandboxInclude.Builder builder=CxxSandboxInclude.builder();
  builder.setIncludeType(includeType);
  builder.setRoot(new ExplicitBuildTargetSourcePath(symlinkTree.getBuildTarget(),symlinkTree.getRoot().resolve(includeDir)));
  builder.setIncludeDir(includeDir);
  return builder.build();
}

Fixed version (ground truth):
public static CxxSandboxInclude from(SymlinkTree symlinkTree,String includeDir,CxxPreprocessables.IncludeType includeType){
  CxxSandboxInclude.Builder builder=CxxSandboxInclude.builder();
  builder.setIncludeType(includeType);
  builder.setRoot(new ExplicitBuildTargetSourcePath(symlinkTree.getBuildTarget(),symlinkTree.getProjectFilesystem().relativize(symlinkTree.getRoot().resolve(includeDir))));
  builder.setIncludeDir(includeDir);
  return builder.build();
}
Program: 52917
Project: 52917
Buggy source:
/** 
 * @return a {@link CxxHeaders} constructed from the given {@link HeaderSymlinkTree}. 
 */
public static CxxSymlinkTreeHeaders from(HeaderSymlinkTree symlinkTree,CxxPreprocessables.IncludeType includeType){
  CxxSymlinkTreeHeaders.Builder builder=CxxSymlinkTreeHeaders.builder();
  builder.setBuildTarget(symlinkTree.getBuildTarget());
  builder.setIncludeType(includeType);
  builder.setRoot(new ExplicitBuildTargetSourcePath(symlinkTree.getBuildTarget(),symlinkTree.getRoot()));
  if (includeType == CxxPreprocessables.IncludeType.LOCAL) {
    builder.setIncludeRoot(new ExplicitBuildTargetSourcePath(symlinkTree.getBuildTarget(),symlinkTree.getIncludePath()));
    if (symlinkTree.getHeaderMap().isPresent()) {
      builder.setHeaderMap(new ExplicitBuildTargetSourcePath(symlinkTree.getBuildTarget(),symlinkTree.getHeaderMap().get()));
    }
  }
 else {
    builder.setIncludeRoot(new ExplicitBuildTargetSourcePath(symlinkTree.getBuildTarget(),symlinkTree.getRoot()));
  }
  builder.putAllNameToPathMap(symlinkTree.getLinks());
  return builder.build();
}

Fixed version (ground truth):
/** 
 * @return a {@link CxxHeaders} constructed from the given {@link HeaderSymlinkTree}. 
 */
public static CxxSymlinkTreeHeaders from(HeaderSymlinkTree symlinkTree,CxxPreprocessables.IncludeType includeType){
  CxxSymlinkTreeHeaders.Builder builder=CxxSymlinkTreeHeaders.builder();
  builder.setBuildTarget(symlinkTree.getBuildTarget());
  builder.setIncludeType(includeType);
  builder.setRoot(new ExplicitBuildTargetSourcePath(symlinkTree.getBuildTarget(),symlinkTree.getProjectFilesystem().relativize(symlinkTree.getRoot())));
  if (includeType == CxxPreprocessables.IncludeType.LOCAL) {
    builder.setIncludeRoot(new ExplicitBuildTargetSourcePath(symlinkTree.getBuildTarget(),symlinkTree.getIncludePath()));
    if (symlinkTree.getHeaderMap().isPresent()) {
      builder.setHeaderMap(new ExplicitBuildTargetSourcePath(symlinkTree.getBuildTarget(),symlinkTree.getHeaderMap().get()));
    }
  }
 else {
    builder.setIncludeRoot(new ExplicitBuildTargetSourcePath(symlinkTree.getBuildTarget(),symlinkTree.getProjectFilesystem().relativize(symlinkTree.getRoot())));
  }
  builder.putAllNameToPathMap(symlinkTree.getLinks());
  return builder.build();
}
Program: 52918
Project: 52918
Buggy source:
@SuppressWarnings("String_Node_Str") ImmutableList<String> getCompilationFlags(Path workingDir){
  return ImmutableList.of();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") ImmutableList<String> getCompilationFlags(Path workingDir,ImmutableMap<Path,Path> prefixMap){
  return ImmutableList.of();
}
Program: 52919
Project: 52919
Buggy source:
public Builder addSymlinkTree(SourcePath root,ImmutableMap<Path,SourcePath> headerMap){
  Path rootPath=pathResolver.getAbsolutePath(root);
  for (  Map.Entry<Path,SourcePath> entry : headerMap.entrySet()) {
    addHeader(entry.getValue(),rootPath.resolve(entry.getKey()));
  }
  return this;
}

Fixed version (ground truth):
public Builder addSymlinkTree(SourcePath root,ImmutableMap<Path,SourcePath> headerMap){
  Path rootPath=pathResolver.getAbsolutePath(root);
  for (  Map.Entry<Path,SourcePath> entry : headerMap.entrySet()) {
    addHeader(entry.getValue(),rootPath.resolve(entry.getKey()));
  }
  Optional<Pair<Path,ImmutableList<Path>>> keys=MorePaths.splitOnCommonPrefix(headerMap.keySet());
  Optional<Pair<Path,ImmutableList<Path>>> vals=MorePaths.splitOnCommonPrefix(headerMap.values().stream().map(pathResolver::getRelativePath).collect(Collectors.toList()));
  if (keys.isPresent() && vals.isPresent() && keys.get().getSecond().equals(vals.get().getSecond())) {
    Pair<Path,Path> stripped=MorePaths.stripCommonSuffix(pathResolver.getRelativePath(root).resolve(keys.get().getFirst()),vals.get().getFirst());
    prefixMap.put(stripped.getFirst(),stripped.getSecond());
  }
  return this;
}
Program: 52920
Project: 52920
Buggy source:
public HeaderPathNormalizer build(){
  return new HeaderPathNormalizer(pathResolver,ImmutableMap.copyOf(headers),ImmutableMap.copyOf(normalized));
}

Fixed version (ground truth):
public HeaderPathNormalizer build(){
  return new HeaderPathNormalizer(pathResolver,ImmutableMap.copyOf(headers),ImmutableMap.copyOf(normalized),ImmutableMap.copyOf(prefixMap));
}
Program: 52921
Project: 52921
Buggy source:
protected HeaderPathNormalizer(SourcePathResolver pathResolver,ImmutableMap<Path,SourcePath> headers,ImmutableMap<Path,SourcePath> normalized){
  this.pathResolver=pathResolver;
  this.headers=headers;
  this.normalized=normalized;
}

Fixed version (ground truth):
protected HeaderPathNormalizer(SourcePathResolver pathResolver,ImmutableMap<Path,SourcePath> headers,ImmutableMap<Path,SourcePath> normalized,ImmutableMap<Path,Path> prefixMap){
  this.pathResolver=pathResolver;
  this.headers=headers;
  this.normalized=normalized;
  this.prefixMap=prefixMap;
}
Program: 52922
Project: 52922
Buggy source:
public static HeaderPathNormalizer empty(SourcePathResolver pathResolver){
  return new HeaderPathNormalizer(pathResolver,ImmutableMap.of(),ImmutableMap.of());
}

Fixed version (ground truth):
public static HeaderPathNormalizer empty(SourcePathResolver pathResolver){
  return new HeaderPathNormalizer(pathResolver,ImmutableMap.of(),ImmutableMap.of(),ImmutableMap.of());
}
Program: 52923
Project: 52923
Buggy source:
public PrefixMapDebugPathSanitizer(String fakeCompilationDirectory,ImmutableBiMap<Path,String> other,CxxToolProvider.Type cxxType){
  this.fakeCompilationDirectory=fakeCompilationDirectory;
  this.isGcc=cxxType == CxxToolProvider.Type.GCC;
  this.cxxType=cxxType;
  ImmutableBiMap.Builder<Path,String> pathsBuilder=ImmutableBiMap.builder();
  other.entrySet().stream().sorted((left,right) -> right.getKey().toString().length() - left.getKey().toString().length()).forEach(e -> pathsBuilder.put(e.getKey(),e.getValue()));
  this.other=pathsBuilder.build();
}

Fixed version (ground truth):
public PrefixMapDebugPathSanitizer(String fakeCompilationDirectory,ImmutableBiMap<Path,String> other,CxxToolProvider.Type cxxType){
  this.fakeCompilationDirectory=fakeCompilationDirectory;
  this.isGcc=cxxType == CxxToolProvider.Type.GCC;
  this.cxxType=cxxType;
  this.other=other;
}
Program: 52924
Project: 52924
Buggy source:
private String getDebugPrefixMapFlag(Path realPath,String fakePath){
  return String.format("String_Node_Str",realPath,fakePath);
}

Fixed version (ground truth):
private String getDebugPrefixMapFlag(Path realPath,String fakePath){
  String realPathStr=realPath.toString();
  if (fakePath.isEmpty()) {
    realPathStr+="String_Node_Str";
  }
  return String.format("String_Node_Str",realPathStr,fakePath);
}
Program: 52925
Project: 52925
Buggy source:
@Override ImmutableList<String> getCompilationFlags(Path workingDir){
  if (cxxType == CxxToolProvider.Type.WINDOWS) {
    return ImmutableList.of();
  }
  ImmutableList.Builder<String> flags=ImmutableList.builder();
  Iterable<Map.Entry<Path,String>> iter=ImmutableList.copyOf(getAllPaths(Optional.of(workingDir))).reverse();
  for (  Map.Entry<Path,String> mappings : iter) {
    flags.add(getDebugPrefixMapFlag(mappings.getKey(),mappings.getValue()));
  }
  if (isGcc) {
    flags.add("String_Node_Str");
  }
  return flags.build();
}

Fixed version (ground truth):
@Override ImmutableList<String> getCompilationFlags(Path workingDir,ImmutableMap<Path,Path> prefixMap){
  if (cxxType == CxxToolProvider.Type.WINDOWS) {
    return ImmutableList.of();
  }
  ImmutableList.Builder<String> flags=ImmutableList.builder();
  RichStream.from(prefixMap.entrySet()).<Map.Entry<Path,String>>map(e -> new AbstractMap.SimpleEntry<>(e.getKey(),e.getValue().toString())).concat(RichStream.from(getAllPaths(Optional.of(workingDir)))).sorted(Comparator.comparingInt(entry -> entry.getKey().toString().length())).map(p -> getDebugPrefixMapFlag(p.getKey(),p.getValue())).forEach(flags::add);
  if (isGcc) {
    flags.add("String_Node_Str");
  }
  return flags.build();
}
Program: 52926
Project: 52926
Buggy source:
@Override public HeaderPathNormalizer get(){
  HeaderPathNormalizer.Builder builder=new HeaderPathNormalizer.Builder(resolver);
  for (  CxxHeaders include : preprocessorFlags.getIncludes()) {
    include.addToHeaderPathNormalizer(builder);
  }
  for (  FrameworkPath frameworkPath : preprocessorFlags.getFrameworkPaths()) {
    frameworkPath.getSourcePath().ifPresent(builder::addHeaderDir);
  }
  if (preprocessorFlags.getPrefixHeader().isPresent()) {
    SourcePath headerPath=preprocessorFlags.getPrefixHeader().get();
    builder.addPrefixHeader(headerPath);
  }
  if (sandbox.isPresent()) {
    ExplicitBuildTargetSourcePath root=new ExplicitBuildTargetSourcePath(sandbox.get().getBuildTarget(),sandbox.get().getRoot());
    builder.addSymlinkTree(root,sandbox.get().getLinks());
  }
  return builder.build();
}

Fixed version (ground truth):
@Override public HeaderPathNormalizer get(){
  HeaderPathNormalizer.Builder builder=new HeaderPathNormalizer.Builder(resolver);
  for (  CxxHeaders include : preprocessorFlags.getIncludes()) {
    include.addToHeaderPathNormalizer(builder);
  }
  for (  FrameworkPath frameworkPath : preprocessorFlags.getFrameworkPaths()) {
    frameworkPath.getSourcePath().ifPresent(builder::addHeaderDir);
  }
  if (preprocessorFlags.getPrefixHeader().isPresent()) {
    SourcePath headerPath=preprocessorFlags.getPrefixHeader().get();
    builder.addPrefixHeader(headerPath);
  }
  if (sandbox.isPresent()) {
    ExplicitBuildTargetSourcePath root=new ExplicitBuildTargetSourcePath(sandbox.get().getBuildTarget(),sandbox.get().getProjectFilesystem().relativize(sandbox.get().getRoot()));
    builder.addSymlinkTree(root,sandbox.get().getLinks());
  }
  return builder.build();
}
Program: 52927
Project: 52927
Buggy source:
@Test public void shouldProperlyTransformColoredLinesInErrorMessages(){
  Ansi ansi=new Ansi(true);
  assertThat(transformer.transformLine(String.format("String_Node_Str",ansi.asErrorText(originalPath + "String_Node_Str"))),equalTo(String.format("String_Node_Str",ansi.asErrorText(expectedPath + "String_Node_Str"))));
  assertThat(transformer.transformLine(String.format("String_Node_Str",ansi.asErrorText(originalPath + "String_Node_Str"))),equalTo(String.format("String_Node_Str",ansi.asErrorText(expectedPath + "String_Node_Str"))));
  assertThat(transformer.transformLine(String.format("String_Node_Str",ansi.asErrorText(originalPath + "String_Node_Str"))),equalTo(String.format("String_Node_Str",ansi.asErrorText(expectedPath + "String_Node_Str"))));
}

Fixed version (ground truth):
@Test public void shouldProperlyTransformColoredLinesInErrorMessages(){
  Ansi ansi=new Ansi(true);
  assertThat(transformer.transformLine(String.format("String_Node_Str",ansi.asErrorText(originalPath + "String_Node_Str"))),equalTo(String.format("String_Node_Str",ansi.asErrorText(expectedPath + "String_Node_Str"))));
  assertThat(transformer.transformLine(String.format("String_Node_Str",ansi.asErrorText(originalPath + "String_Node_Str"))),equalTo(String.format("String_Node_Str",ansi.asErrorText(expectedPath + "String_Node_Str"))));
  assertThat(transformer.transformLine(String.format("String_Node_Str",ansi.asErrorText(originalPath + "String_Node_Str"))),equalTo(String.format("String_Node_Str",ansi.asErrorText(expectedPath + "String_Node_Str"))));
  assertThat(transformer.transformLine(String.format("String_Node_Str",originalPath)),equalTo(String.format("String_Node_Str",expectedPath)));
  assertThat(transformer.transformLine(String.format("String_Node_Str",originalPath)),equalTo(String.format("String_Node_Str",expectedPath)));
  assertThat(transformer.transformLine(String.format("String_Node_Str",originalPath)),equalTo(String.format("String_Node_Str",expectedPath)));
  assertThat(transformer.transformLine(String.format("String_Node_Str",originalPath)),equalTo(String.format("String_Node_Str",expectedPath)));
}
Program: 52930
Project: 52930
Buggy source:
private void mangledResourceLink(Matcher match,String input){
  String fileName=basename(input);
  String name=fileName.substring(0,fileName.length() - DOT_XML.length());
  String path=match.group(1).replace('/','_');
  String configQualifier=match.groupCount() > 2 ? match.group(3) : "String_Node_Str";
  String directory=fileJoin(viewPath,OUTPUT_RESOURCE_FOLDER,match.group(2));
  mkdir(directory);
  symlink(fileJoin(repository,input),fileJoin(directory,path + name + configQualifier+ DOT_XML));
}

Fixed version (ground truth):
private void mangledResourceLink(Matcher match,String input){
  String fileName=basename(input);
  String name=fileName.substring(0,fileName.length() - DOT_XML.length());
  String path=match.group(1).replace('/','_');
  String configQualifier=match.group(3);
  if (configQualifier == null) {
    configQualifier="String_Node_Str";
  }
  String directory=fileJoin(viewPath,OUTPUT_RESOURCE_FOLDER,match.group(2));
  mkdir(directory);
  symlink(fileJoin(repository,input),fileJoin(directory,path + name + configQualifier+ DOT_XML));
}
Program: 52931
Project: 52931
Buggy source:
@Override public boolean materializeFileContents(BuildJobStateFileHashEntry entry,Path targetAbsPath) throws IOException {
  if (inlineProvider.materializeFileContents(entry,targetAbsPath)) {
    fileMaterializationStatsTracker.recordLocalFileMaterialized();
    LOG.info("String_Node_Str",targetAbsPath);
    return true;
  }
  if (localFsProvider.isPresent() && localFsProvider.get().materializeFileContents(entry,targetAbsPath)) {
    LOG.info("String_Node_Str",targetAbsPath);
    return true;
  }
  Stopwatch remoteMaterializationStopwatch=Stopwatch.createStarted();
  boolean wasRemotelyMaterialized=serverProvider.materializeFileContents(entry,targetAbsPath);
  remoteMaterializationStopwatch.stop();
  if (wasRemotelyMaterialized) {
    fileMaterializationStatsTracker.recordRemoteFileMaterialized(remoteMaterializationStopwatch.elapsed(TimeUnit.MILLISECONDS));
    if (localFsProvider.isPresent()) {
      localFsProvider.get().writeFileAndGetInputStream(entry,targetAbsPath);
    }
    LOG.info("String_Node_Str",targetAbsPath);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean materializeFileContents(BuildJobStateFileHashEntry entry,Path targetAbsPath) throws IOException {
  if (inlineProvider.materializeFileContents(entry,targetAbsPath)) {
    LOG.info("String_Node_Str",targetAbsPath);
    return true;
  }
  if (localFsProvider.isPresent() && localFsProvider.get().materializeFileContents(entry,targetAbsPath)) {
    fileMaterializationStatsTracker.recordLocalFileMaterialized();
    LOG.info("String_Node_Str",targetAbsPath);
    return true;
  }
  Stopwatch remoteMaterializationStopwatch=Stopwatch.createStarted();
  boolean wasRemotelyMaterialized=serverProvider.materializeFileContents(entry,targetAbsPath);
  remoteMaterializationStopwatch.stop();
  if (wasRemotelyMaterialized) {
    fileMaterializationStatsTracker.recordRemoteFileMaterialized(remoteMaterializationStopwatch.elapsed(TimeUnit.MILLISECONDS));
    if (localFsProvider.isPresent()) {
      localFsProvider.get().writeFileAndGetInputStream(entry,targetAbsPath);
    }
    LOG.info("String_Node_Str",targetAbsPath);
    return true;
  }
  return false;
}
Program: 52932
Project: 52932
Buggy source:
private void buildAllDirectoriesAndSymlinks(){
  Set<Path> deletedDirectories=new HashSet<>();
  for (  Path path : existingDirectories) {
    if (!directoriesToMake.contains(path)) {
      if (dryRun) {
        stderr("String_Node_Str",path);
      }
 else {
        deleteAll(path);
        deletedDirectories.add(path);
      }
    }
  }
  for (  Path path : directoriesToMake) {
    if (!existingDirectories.contains(path)) {
      immediateMkdir(path);
    }
  }
  existingSymlinks.forEach((filePath,linkPath) -> {
    if (linkPath.equals(symlinksToCreate.get(filePath))) {
      symlinksToCreate.remove(filePath);
    }
 else {
      if (dryRun) {
        stderr("String_Node_Str",linkPath);
      }
 else {
        try {
          Files.delete(linkPath);
        }
 catch (        IOException e) {
          if (!linkInDeletedDirectories(deletedDirectories,linkPath)) {
            stderr("String_Node_Str",e.getMessage(),linkPath);
          }
        }
      }
    }
  }
);
  symlinksToCreate.forEach((filePath,linkPath) -> {
    if (dryRun) {
      stderr("String_Node_Str",filePath,linkPath);
    }
 else {
      createSymbolicLink(filePath,linkPath);
    }
  }
);
}

Fixed version (ground truth):
private void buildAllDirectoriesAndSymlinks(){
  Set<Path> deletedDirectories=new HashSet<>();
  for (  Path path : existingDirectories) {
    if (!directoriesToMake.contains(path)) {
      if (dryRun) {
        stderr("String_Node_Str",path);
      }
 else {
        deleteAll(path);
        deletedDirectories.add(path);
      }
    }
  }
  existingSymlinks.forEach((filePath,linkPath) -> {
    if (linkPath.equals(symlinksToCreate.get(filePath))) {
      symlinksToCreate.remove(filePath);
    }
 else {
      if (dryRun) {
        stderr("String_Node_Str",linkPath);
      }
 else {
        try {
          Files.delete(linkPath);
        }
 catch (        IOException e) {
          if (!linkInDeletedDirectories(deletedDirectories,linkPath)) {
            stderr("String_Node_Str",e.getMessage(),linkPath);
          }
        }
      }
    }
  }
);
  symlinksToCreate.forEach((filePath,linkPath) -> {
    if (dryRun) {
      stderr("String_Node_Str",filePath,linkPath);
    }
 else {
      createSymbolicLink(filePath,linkPath);
    }
  }
);
}
Program: 52933
Project: 52933
Buggy source:
/** 
 * Parameter order is compatible with Ruby library code, for porting transparency 
 */
private void createSymbolicLink(Path oldPath,Path newPath){
  try {
    Files.createSymbolicLink(newPath,oldPath);
  }
 catch (  IOException e) {
    stderr("String_Node_Str",oldPath,newPath,e.getClass().getSimpleName(),e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Parameter order is compatible with Ruby library code, for porting transparency 
 */
private void createSymbolicLink(Path oldPath,Path newPath){
  Path directory=newPath.getParent();
  if (directory != null && Files.notExists(directory)) {
    immediateMkdir(directory);
  }
  try {
    Files.createSymbolicLink(newPath,oldPath);
  }
 catch (  IOException e) {
    stderr("String_Node_Str",oldPath,newPath,e.getClass().getSimpleName(),e.getMessage());
  }
}
Program: 52934
Project: 52934
Buggy source:
@Override public BuildRule createBuildRule(TargetGraph targetGraph,BuildRuleParams params,BuildRuleResolver resolver,CellPathResolver cellRoots,AppleLibraryDescriptionArg args) throws NoSuchBuildTargetException {
  Optional<Map.Entry<Flavor,Type>> type=LIBRARY_TYPE.getFlavorAndValue(params.getBuildTarget());
  if (type.isPresent() && type.get().getValue().equals(Type.FRAMEWORK)) {
    return createFrameworkBundleBuildRule(targetGraph,params,resolver,args);
  }
 else {
    return createLibraryBuildRule(targetGraph,params,resolver,cellRoots,args,args.getLinkStyle(),Optional.empty(),ImmutableSet.of(),ImmutableSortedSet.of());
  }
}

Fixed version (ground truth):
@Override public BuildRule createBuildRule(TargetGraph targetGraph,BuildRuleParams params,BuildRuleResolver resolver,CellPathResolver cellRoots,AppleLibraryDescriptionArg args) throws NoSuchBuildTargetException {
  Optional<Map.Entry<Flavor,Type>> type=LIBRARY_TYPE.getFlavorAndValue(params.getBuildTarget());
  if (type.isPresent() && type.get().getValue().equals(Type.FRAMEWORK)) {
    return createFrameworkBundleBuildRule(targetGraph,params,resolver,args);
  }
 else {
    return createLibraryBuildRule(targetGraph,params,resolver,cellRoots,args,args.getLinkStyle(),Optional.empty(),ImmutableSet.of(),ImmutableSortedSet.of(),CxxLibraryDescription.TransitiveCxxPreprocessorInputFunction.fromLibraryRule());
  }
}
Program: 52935
Project: 52935
Buggy source:
private <A extends AppleNativeTargetDescriptionArg>BuildRule requireUnstrippedBuildRule(BuildRuleParams params,BuildRuleResolver resolver,CellPathResolver cellRoots,TargetGraph targetGraph,A args,Optional<Linker.LinkableDepType> linkableDepType,Optional<SourcePath> bundleLoader,ImmutableSet<BuildTarget> blacklist,SourcePathResolver pathResolver,ImmutableSortedSet<BuildTarget> extraCxxDeps) throws NoSuchBuildTargetException {
  Optional<MultiarchFileInfo> multiarchFileInfo=MultiarchFileInfos.create(appleCxxPlatformFlavorDomain,params.getBuildTarget());
  if (multiarchFileInfo.isPresent()) {
    ImmutableSortedSet.Builder<BuildRule> thinRules=ImmutableSortedSet.naturalOrder();
    for (    BuildTarget thinTarget : multiarchFileInfo.get().getThinTargets()) {
      thinRules.add(requireSingleArchUnstrippedBuildRule(params.withBuildTarget(thinTarget),resolver,cellRoots,targetGraph,args,linkableDepType,bundleLoader,blacklist,pathResolver,extraCxxDeps));
    }
    return MultiarchFileInfos.requireMultiarchRule(params.withBuildTarget(params.getBuildTarget().withoutFlavors(AppleDebugFormat.FLAVOR_DOMAIN.getFlavors())),resolver,multiarchFileInfo.get(),thinRules.build());
  }
 else {
    return requireSingleArchUnstrippedBuildRule(params,resolver,cellRoots,targetGraph,args,linkableDepType,bundleLoader,blacklist,pathResolver,extraCxxDeps);
  }
}

Fixed version (ground truth):
private <A extends AppleNativeTargetDescriptionArg>BuildRule requireUnstrippedBuildRule(BuildRuleParams params,BuildRuleResolver resolver,CellPathResolver cellRoots,TargetGraph targetGraph,A args,Optional<Linker.LinkableDepType> linkableDepType,Optional<SourcePath> bundleLoader,ImmutableSet<BuildTarget> blacklist,SourcePathResolver pathResolver,ImmutableSortedSet<BuildTarget> extraCxxDeps,CxxLibraryDescription.TransitiveCxxPreprocessorInputFunction transitiveCxxPreprocessorInput) throws NoSuchBuildTargetException {
  Optional<MultiarchFileInfo> multiarchFileInfo=MultiarchFileInfos.create(appleCxxPlatformFlavorDomain,params.getBuildTarget());
  if (multiarchFileInfo.isPresent()) {
    ImmutableSortedSet.Builder<BuildRule> thinRules=ImmutableSortedSet.naturalOrder();
    for (    BuildTarget thinTarget : multiarchFileInfo.get().getThinTargets()) {
      thinRules.add(requireSingleArchUnstrippedBuildRule(params.withBuildTarget(thinTarget),resolver,cellRoots,targetGraph,args,linkableDepType,bundleLoader,blacklist,pathResolver,extraCxxDeps,transitiveCxxPreprocessorInput));
    }
    return MultiarchFileInfos.requireMultiarchRule(params.withBuildTarget(params.getBuildTarget().withoutFlavors(AppleDebugFormat.FLAVOR_DOMAIN.getFlavors())),resolver,multiarchFileInfo.get(),thinRules.build());
  }
 else {
    return requireSingleArchUnstrippedBuildRule(params,resolver,cellRoots,targetGraph,args,linkableDepType,bundleLoader,blacklist,pathResolver,extraCxxDeps,transitiveCxxPreprocessorInput);
  }
}
Program: 52938
Project: 52938
Buggy source:
private BuildRule createTestLibraryRule(TargetGraph targetGraph,BuildRuleParams params,BuildRuleResolver resolver,CellPathResolver cellRoots,AppleTestDescriptionArg args,Optional<SourcePath> testHostAppBinarySourcePath,ImmutableSet<BuildTarget> blacklist,BuildTarget libraryTarget,ImmutableSortedSet<BuildTarget> extraCxxDeps) throws NoSuchBuildTargetException {
  BuildTarget existingLibraryTarget=libraryTarget.withAppendedFlavors(AppleDebuggableBinary.RULE_FLAVOR,CxxStrip.RULE_FLAVOR).withAppendedFlavors(StripStyle.NON_GLOBAL_SYMBOLS.getFlavor());
  Optional<BuildRule> existingLibrary=resolver.getRuleOptional(existingLibraryTarget);
  BuildRule library;
  if (existingLibrary.isPresent()) {
    library=existingLibrary.get();
  }
 else {
    library=appleLibraryDescription.createLibraryBuildRule(targetGraph,params.withBuildTarget(libraryTarget),resolver,cellRoots,args,Optional.of(Linker.LinkableDepType.STATIC),testHostAppBinarySourcePath,blacklist,extraCxxDeps);
    resolver.addToIndex(library);
  }
  return library;
}

Fixed version (ground truth):
private BuildRule createTestLibraryRule(TargetGraph targetGraph,BuildRuleParams params,BuildRuleResolver resolver,CellPathResolver cellRoots,AppleTestDescriptionArg args,Optional<SourcePath> testHostAppBinarySourcePath,ImmutableSet<BuildTarget> blacklist,BuildTarget libraryTarget,ImmutableSortedSet<BuildTarget> extraCxxDeps) throws NoSuchBuildTargetException {
  BuildTarget existingLibraryTarget=libraryTarget.withAppendedFlavors(AppleDebuggableBinary.RULE_FLAVOR,CxxStrip.RULE_FLAVOR).withAppendedFlavors(StripStyle.NON_GLOBAL_SYMBOLS.getFlavor());
  Optional<BuildRule> existingLibrary=resolver.getRuleOptional(existingLibraryTarget);
  BuildRule library;
  if (existingLibrary.isPresent()) {
    library=existingLibrary.get();
  }
 else {
    library=appleLibraryDescription.createLibraryBuildRule(targetGraph,params.withBuildTarget(libraryTarget),resolver,cellRoots,args,Optional.of(Linker.LinkableDepType.STATIC),testHostAppBinarySourcePath,blacklist,extraCxxDeps,CxxLibraryDescription.TransitiveCxxPreprocessorInputFunction.fromDeps());
    resolver.addToIndex(library);
  }
  return library;
}