nus-yam/ex-repair huggingface dataset:
Program: 53072
Project: 53072
Buggy source:
@Override public void consumeConsoleEvent(final String message){
  if (!BuckToolWindowFactory.isToolWindowVisible(mProject)) {
    BuckToolWindowFactory.showToolWindow(mProject);
  }
  ApplicationManager.getApplication().invokeLater(new Runnable(){
    @Override public void run(){
      mCurrentBuildRootElement.addChild(new BuckTreeNodeDetail(mCurrentBuildRootElement,BuckTreeNodeDetail.DetailType.ERROR,message));
      BuckEventsConsumer.this.mTreeModel.reload();
    }
  }
);
}

Fixed version (ground truth):
@Override public void consumeConsoleEvent(final String message){
  if (!BuckToolWindowFactory.isToolWindowInstantiated(mProject)) {
    return;
  }
  if (!BuckToolWindowFactory.isToolWindowVisible(mProject)) {
    BuckToolWindowFactory.showToolWindow(mProject);
  }
  ApplicationManager.getApplication().invokeLater(new Runnable(){
    @Override public void run(){
      mCurrentBuildRootElement.addChild(new BuckTreeNodeDetail(mCurrentBuildRootElement,BuckTreeNodeDetail.DetailType.ERROR,message));
      BuckEventsConsumer.this.mTreeModel.reload();
    }
  }
);
}
Program: 53075
Project: 53075
Buggy source:
public void disconnect(){
  if (mConnected) {
    scheduledFuture.cancel(true);
    ApplicationManager.getApplication().executeOnPooledThread(new Runnable(){
      @Override public void run(){
        try {
          mWSClient.stop();
          mConnected=false;
        }
 catch (        InterruptedException e) {
          LOG.debug("String_Node_Str" + e);
        }
catch (        Throwable t) {
          LOG.error("String_Node_Str" + t.getMessage());
        }
      }
    }
);
  }
}

Fixed version (ground truth):
public void disconnect(){
  if (mConnected.get()) {
    scheduledFuture.cancel(true);
    scheduledThreadPoolExecutor.shutdown();
    ApplicationManager.getApplication().executeOnPooledThread(new Runnable(){
      @Override public void run(){
        try {
          mWSClient.stop();
          mConnected.set(false);
        }
 catch (        InterruptedException e) {
          LOG.debug("String_Node_Str" + e);
        }
catch (        Throwable t) {
          LOG.error("String_Node_Str" + t.getMessage());
        }
      }
    }
);
  }
}
Program: 53076
Project: 53076
Buggy source:
private void ping(){
  if ((new Date()).getTime() - mLastActionTime < PING_PERIOD) {
    return;
  }
  if (mConnected) {
    try {
      mWSSocket.sendMessage("String_Node_Str");
synchronized (syncObject) {
        mLastActionTime=(new Date()).getTime();
      }
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str" + e);
    }
  }
}

Fixed version (ground truth):
private void ping(){
  if ((new Date()).getTime() - mLastActionTime < PING_PERIOD) {
    return;
  }
  if (mConnected.get()) {
    try {
      mWSSocket.sendMessage("String_Node_Str");
synchronized (syncObject) {
        mLastActionTime=(new Date()).getTime();
      }
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str" + e);
    }
  }
}
Program: 53077
Project: 53077
Buggy source:
@Override public void run(){
  try {
    mWSClient.stop();
    mConnected=false;
  }
 catch (  InterruptedException e) {
    LOG.debug("String_Node_Str" + e);
  }
catch (  Throwable t) {
    LOG.error("String_Node_Str" + t.getMessage());
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    mWSClient.stop();
    mConnected.set(false);
  }
 catch (  InterruptedException e) {
    LOG.debug("String_Node_Str" + e);
  }
catch (  Throwable t) {
    LOG.error("String_Node_Str" + t.getMessage());
  }
}
Program: 53078
Project: 53078
Buggy source:
public void connect(){
  if (mPort != -1) {
    try {
      mWSClient.start();
      URI uri=new URI("String_Node_Str" + mHost + "String_Node_Str"+ mPort+ "String_Node_Str");
      mWSClient.connect(mWSSocket,uri);
synchronized (syncObject) {
        mLastActionTime=(new Date()).getTime();
      }
      mConnected=true;
      scheduledFuture=scheduledThreadPoolExecutor.scheduleAtFixedRate(new Runnable(){
        @Override public void run(){
          BuckClient.this.ping();
        }
      }
,10,10,TimeUnit.SECONDS);
    }
 catch (    Throwable t) {
      mConnected=false;
    }
  }
}

Fixed version (ground truth):
public void connect(){
  if (mPort != -1) {
    try {
      mWSClient.start();
      URI uri=new URI("String_Node_Str" + mHost + "String_Node_Str"+ mPort+ "String_Node_Str");
      mWSClient.connect(mWSSocket,uri);
synchronized (syncObject) {
        mLastActionTime=(new Date()).getTime();
      }
      mConnected.set(true);
      if (scheduledFuture != null && !scheduledFuture.isCancelled()) {
        scheduledFuture.cancel(true);
      }
      scheduledFuture=scheduledThreadPoolExecutor.scheduleAtFixedRate(new Runnable(){
        @Override public void run(){
          BuckClient.this.ping();
        }
      }
,10,10,TimeUnit.SECONDS);
    }
 catch (    Throwable t) {
      mConnected.set(false);
    }
  }
}
Program: 53079
Project: 53079
Buggy source:
@Override public Optional<ImmutableSet<SourcePath>> getPossibleInputSourcePaths() throws IOException {
  Preconditions.checkState(useDependencyFileRuleKeys());
  return Optional.<ImmutableSet<SourcePath>>of(((JarArchiveDependencySupplier)abiClasspath).getArchiveMembers(getResolver()));
}

Fixed version (ground truth):
@Override public Optional<ImmutableSet<SourcePath>> getPossibleInputSourcePaths() throws IOException {
  return Optional.<ImmutableSet<SourcePath>>of(abiClasspath.getArchiveMembers(getResolver()));
}
Program: 53081
Project: 53081
Buggy source:
public DefaultDependencyFileRuleKeyBuilderFactory(int seed,FileHashLoader fileHashLoader,SourcePathResolver pathResolver){
  super(seed,fileHashLoader,pathResolver,InputHandling.IGNORE);
  this.pathResolver=pathResolver;
}

Fixed version (ground truth):
public DefaultDependencyFileRuleKeyBuilderFactory(int seed,FileHashLoader fileHashLoader,SourcePathResolver pathResolver){
  super(seed,fileHashLoader,pathResolver,InputHandling.IGNORE,ArchiveHandling.MEMBERS);
  this.pathResolver=pathResolver;
}
Program: 53082
Project: 53082
Buggy source:
public InputBasedRuleKeyBuilderFactory(int seed,FileHashLoader hashLoader,SourcePathResolver pathResolver){
  this(seed,hashLoader,pathResolver,InputHandling.HASH);
}

Fixed version (ground truth):
public InputBasedRuleKeyBuilderFactory(int seed,FileHashLoader hashLoader,SourcePathResolver pathResolver){
  this(seed,hashLoader,pathResolver,InputHandling.HASH,ArchiveHandling.ARCHIVES);
}
Program: 53083
Project: 53083
Buggy source:
@Override public Builder setReflectively(String key,@Nullable Object val){
  if (val instanceof ArchiveDependencySupplier) {
    super.setReflectively(key,((ArchiveDependencySupplier)val).getArchiveMembers(pathResolver));
  }
 else {
    super.setReflectively(key,val);
  }
  return this;
}

Fixed version (ground truth):
@Override public Builder setReflectively(String key,@Nullable Object val){
  if (val instanceof ArchiveDependencySupplier && archiveHandling == ArchiveHandling.MEMBERS) {
    super.setReflectively(key,((ArchiveDependencySupplier)val).getArchiveMembers(pathResolver));
  }
 else {
    super.setReflectively(key,val);
  }
  return this;
}
Program: 53084
Project: 53084
Buggy source:
@Override public void run(){
  FileTypeManager fileTypeManager=FileTypeManagerImpl.getInstance();
  FileType fileType=fileTypeManager.getFileTypeByFileName(BuckFileType.INSTANCE.getDefaultExtension());
  while (!(fileType instanceof BuckFileType || fileType instanceof UnknownFileType)) {
    List<FileNameMatcher> fileNameMatchers=fileTypeManager.getAssociations(fileType);
    for (    FileNameMatcher fileNameMatcher : fileNameMatchers) {
      if (fileNameMatcher.accept(BuckFileType.INSTANCE.getDefaultExtension())) {
        fileTypeManager.removeAssociation(fileType,fileNameMatcher);
      }
    }
    fileType=fileTypeManager.getFileTypeByFileName(BuckFileType.INSTANCE.getDefaultExtension());
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (!mClient.isConnected()) {
    BuckWSServerPortUtils wsPortUtils=new BuckWSServerPortUtils();
    try {
      int port=wsPortUtils.getPort(BuckModule.this.mProject.getBasePath());
      mClient=new BuckClient(port,mEventHandler);
      BuckModule.this.mClient.connect();
    }
 catch (    NumberFormatException e) {
      LOG.error(e);
    }
catch (    ExecutionException e) {
      LOG.error(e);
    }
catch (    IOException e) {
      LOG.error(e);
    }
catch (    HumanReadableException e) {
      if (mBu == null) {
        attach(new BuckEventsConsumer(mProject),"String_Node_Str");
      }
      mBu.consumeConsoleEvent(e.toString());
    }
  }
}
Program: 53085
Project: 53085
Buggy source:
public void connect(){
  ApplicationManager.getApplication().executeOnPooledThread(new Runnable(){
    @Override public void run(){
      if (!mClient.isConnected()) {
        BuckWSServerPortUtils wsPortUtils=new BuckWSServerPortUtils();
        try {
          int port=wsPortUtils.getPort(BuckModule.this.mProject.getBasePath());
          mClient=new BuckClient(port,mEventHandler);
          BuckModule.this.mClient.connect();
        }
 catch (        NumberFormatException e) {
          LOG.error(e);
        }
catch (        ExecutionException e) {
          LOG.error(e);
        }
catch (        IOException e) {
          LOG.error(e);
        }
catch (        HumanReadableException e) {
          if (mBu == null) {
            attach(new BuckEventsConsumer(mProject),"String_Node_Str");
          }
          mBu.consumeConsoleEvent(e.toString());
        }
      }
    }
  }
);
  ApplicationManager.getApplication().runWriteAction(new Runnable(){
    @Override public void run(){
      FileTypeManager fileTypeManager=FileTypeManagerImpl.getInstance();
      FileType fileType=fileTypeManager.getFileTypeByFileName(BuckFileType.INSTANCE.getDefaultExtension());
      while (!(fileType instanceof BuckFileType || fileType instanceof UnknownFileType)) {
        List<FileNameMatcher> fileNameMatchers=fileTypeManager.getAssociations(fileType);
        for (        FileNameMatcher fileNameMatcher : fileNameMatchers) {
          if (fileNameMatcher.accept(BuckFileType.INSTANCE.getDefaultExtension())) {
            fileTypeManager.removeAssociation(fileType,fileNameMatcher);
          }
        }
        fileType=fileTypeManager.getFileTypeByFileName(BuckFileType.INSTANCE.getDefaultExtension());
      }
    }
  }
);
}

Fixed version (ground truth):
public void connect(){
  ApplicationManager.getApplication().executeOnPooledThread(new Runnable(){
    @Override public void run(){
      if (!mClient.isConnected()) {
        BuckWSServerPortUtils wsPortUtils=new BuckWSServerPortUtils();
        try {
          int port=wsPortUtils.getPort(BuckModule.this.mProject.getBasePath());
          mClient=new BuckClient(port,mEventHandler);
          BuckModule.this.mClient.connect();
        }
 catch (        NumberFormatException e) {
          LOG.error(e);
        }
catch (        ExecutionException e) {
          LOG.error(e);
        }
catch (        IOException e) {
          LOG.error(e);
        }
catch (        HumanReadableException e) {
          if (mBu == null) {
            attach(new BuckEventsConsumer(mProject),"String_Node_Str");
          }
          mBu.consumeConsoleEvent(e.toString());
        }
      }
    }
  }
);
  BuckFileUtil.setBuckFileType();
}
Program: 53086
Project: 53086
Buggy source:
public BuckModule(final Project project){
  mProject=project;
  mEventHandler=new BuckEventsHandler(new BuckEventsConsumerFactory(mProject),new Runnable(){
    @Override public void run(){
      ApplicationManager.getApplication().invokeLater(new Runnable(){
        @Override public void run(){
          BuckToolWindowFactory.outputConsoleMessage(project,"String_Node_Str",ConsoleViewContentType.SYSTEM_OUTPUT);
        }
      }
);
    }
  }
,new Runnable(){
    @Override public void run(){
      ApplicationManager.getApplication().invokeLater(new Runnable(){
        @Override public void run(){
          BuckToolWindowFactory.outputConsoleMessage(project,"String_Node_Str",ConsoleViewContentType.SYSTEM_OUTPUT);
        }
      }
);
      BuckModule mod=project.getComponent(BuckModule.class);
      mod.disconnect();
    }
  }
);
  if (!UISettings.getInstance().SHOW_MAIN_TOOLBAR) {
    BuckPluginNotifications.notifyActionToolbar(mProject);
  }
  mBuckEventsConsumer=new BuckEventsConsumer(project);
}

Fixed version (ground truth):
public BuckModule(final Project project){
  mProject=project;
  mEventHandler=new BuckEventsHandler(new BuckEventsConsumerFactory(mProject),new Runnable(){
    @Override public void run(){
      ApplicationManager.getApplication().invokeLater(new Runnable(){
        @Override public void run(){
          if (!project.isDisposed()) {
            BuckToolWindowFactory.outputConsoleMessage(project,"String_Node_Str",ConsoleViewContentType.SYSTEM_OUTPUT);
          }
        }
      }
);
    }
  }
,new Runnable(){
    @Override public void run(){
      ApplicationManager.getApplication().invokeLater(new Runnable(){
        @Override public void run(){
          if (!project.isDisposed()) {
            BuckToolWindowFactory.outputConsoleMessage(project,"String_Node_Str",ConsoleViewContentType.SYSTEM_OUTPUT);
          }
        }
      }
);
      BuckModule mod=project.getComponent(BuckModule.class);
      mod.disconnect();
    }
  }
);
  if (!UISettings.getInstance().SHOW_MAIN_TOOLBAR) {
    BuckPluginNotifications.notifyActionToolbar(mProject);
  }
  mBuckEventsConsumer=new BuckEventsConsumer(project);
}
Program: 53088
Project: 53088
Buggy source:
@Override public Iterable<BuildRule> visit(BuildRule rule) throws NoSuchBuildTargetException {
  Iterable<BuildRule> deps=empty;
  Optional<SharedNativeLinkTarget> linkTarget=nativeLinkStrategy == NativeLinkStrategy.MERGED ? NativeLinkables.getSharedNativeLinkTarget(rule,cxxPlatform) : Optional.<SharedNativeLinkTarget>absent();
  if (rule instanceof CxxPythonExtension) {
    extensions.put(rule.getBuildTarget(),(CxxPythonExtension)rule);
  }
 else   if (rule instanceof PythonPackagable) {
    PythonPackagable packagable=(PythonPackagable)rule;
    PythonPackageComponents comps=packagable.getPythonPackageComponents(pythonPlatform,cxxPlatform);
    allComponents.addComponent(comps,rule.getBuildTarget());
    if (hasNativeCode(cxxPlatform,comps)) {
      for (      BuildRule dep : rule.getDeps()) {
        if (dep instanceof NativeLinkable) {
          NativeLinkable linkable=(NativeLinkable)dep;
          excludedNativeLinkableRoots.add(linkable.getBuildTarget());
          nativeLinkableRoots.put(linkable.getBuildTarget(),linkable);
        }
      }
    }
    deps=rule.getDeps();
  }
 else   if (linkTarget.isPresent()) {
    nativeLinkTargetRoots.put(linkTarget.get().getBuildTarget(),linkTarget.get());
  }
 else   if (rule instanceof NativeLinkable) {
    nativeLinkableRoots.put(rule.getBuildTarget(),(NativeLinkable)rule);
  }
  return deps;
}

Fixed version (ground truth):
@Override public Iterable<NativeLinkable> visit(NativeLinkable linkable){
  transitivelyExcludedNativeLinkables.add(linkable.getBuildTarget());
  return Iterables.concat(linkable.getNativeLinkableDeps(cxxPlatform),linkable.getNativeLinkableExportedDeps(cxxPlatform));
}
Program: 53089
Project: 53089
Buggy source:
public IjFolder merge(IjFolder otherFolder){
  if (!canMergeWith(otherFolder)) {
    throw new IllegalArgumentException("String_Node_Str" + this.getClass().getSimpleName() + "String_Node_Str"+ otherFolder.getClass().getSimpleName());
  }
  if (equals(otherFolder)) {
    return this;
  }
  return getFactory().create(otherFolder.getPath(),getWantsPackagePrefix() || otherFolder.getWantsPackagePrefix(),combineInputs(this,otherFolder));
}

Fixed version (ground truth):
public IjFolder merge(IjFolder otherFolder){
  if (equals(otherFolder)) {
    return this;
  }
  return getFactory().create(otherFolder.getPath(),getWantsPackagePrefix() || otherFolder.getWantsPackagePrefix(),combineInputs(this,otherFolder));
}
Program: 53090
Project: 53090
Buggy source:
@Override public String toString(){
  return getClass().getSimpleName() + "String_Node_Str" + getPath().toString();
}

Fixed version (ground truth):
@Override public String toString(){
  return getClass().getSimpleName() + "String_Node_Str" + getPath().toString()+ (wantsPackagePrefix ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ getInputs();
}
Program: 53091
Project: 53091
Buggy source:
private IjFolder mergeAllowingTestToBePromotedToSource(IjFolder from,IjFolder to){
  if ((from instanceof TestFolder && to instanceof SourceFolder) || (to instanceof TestFolder && from instanceof SourceFolder)) {
    return new SourceFolder(to.getPath(),from.getWantsPackagePrefix() || to.getWantsPackagePrefix(),IjFolder.combineInputs(from,to));
  }
  return from.merge(to);
}

Fixed version (ground truth):
private IjFolder mergeAllowingTestToBePromotedToSource(IjFolder from,IjFolder to){
  if ((from instanceof TestFolder && to instanceof SourceFolder) || (to instanceof TestFolder && from instanceof SourceFolder)) {
    return new SourceFolder(to.getPath(),from.getWantsPackagePrefix() || to.getWantsPackagePrefix(),IjFolder.combineInputs(from,to));
  }
  Preconditions.checkArgument(from.getClass() == to.getClass());
  return from.merge(to);
}
Program: 53092
Project: 53092
Buggy source:
private BuckTracing(BuckTracingInterface tracingInterface,String pluginName){
  this.tracingInterface=tracingInterface;
  this.pluginName=pluginName;
}

Fixed version (ground truth):
private BuckTracing(String pluginName){
  this.pluginName=pluginName;
}
Program: 53093
Project: 53093
Buggy source:
/** 
 * Records the end of the traced section started by the most recent call to  {@link #begin(String,Map)}, on <em>any</em>   {@link BuckTracing} object, on the current thread.Arguments supplied here will be added to those supplied to  {@link #begin(String,Map)}; conflicting entries will be overwritten. For best results, this call should be in a finally block, with the corresponding  {@link #begin(String,Map)} call immediately before the try.
 */
public void end(final Map<String,String> args){
  if (tracingInterface == null) {
    return;
  }
  tracingInterface.end(args);
}

Fixed version (ground truth):
/** 
 * Records the end of the traced section started by the most recent call to  {@link #begin(String,Map)}, on <em>any</em>   {@link BuckTracing} object, on the current thread.Arguments supplied here will be added to those supplied to  {@link #begin(String,Map)}; conflicting entries will be overwritten. For best results, this call should be in a finally block, with the corresponding  {@link #begin(String,Map)} call immediately before the try.
 */
public void end(final Map<String,String> args){
  final BuckTracingInterface tracingInterface=curThreadTracingInterface.get();
  if (tracingInterface == null) {
    return;
  }
  tracingInterface.end(args);
}
Program: 53094
Project: 53094
Buggy source:
/** 
 * Gets an instance of   {@link BuckTracing} for tracing in the given plugin. All{@link BuckTracing} instances are backed by the same trace buffer, so{@link #begin(String,Map)} and {@link #end(Map)}} calls on a given thread must nest across all instances.
 */
public static BuckTracing getInstance(String pluginName){
  return new BuckTracing(curThreadTracingInterface.get(),pluginName);
}

Fixed version (ground truth):
/** 
 * Gets an instance of   {@link BuckTracing} for tracing in the given plugin. All{@link BuckTracing} instances are backed by the same trace buffer, so{@link #begin(String,Map)} and {@link #end(Map)}} calls on a given thread must nest across all instances.
 */
public static BuckTracing getInstance(String pluginName){
  return new BuckTracing(pluginName);
}
Program: 53095
Project: 53095
Buggy source:
/** 
 * Records the beginning of a traced section. The section will appear in the trace labeled with eventName, and the supplied arguments will be visible when the section is selected. For best results, this call should be immediately before a try block, and a corresponding call to   {@link #end(Map)} should be in the finally block.
 */
public void begin(final String eventName,final Map<String,String> args){
  if (tracingInterface == null) {
    return;
  }
  tracingInterface.begin(pluginName,eventName,args);
}

Fixed version (ground truth):
/** 
 * Records the beginning of a traced section. The section will appear in the trace labeled with eventName, and the supplied arguments will be visible when the section is selected. For best results, this call should be immediately before a try block, and a corresponding call to   {@link #end(Map)} should be in the finally block.
 */
public void begin(final String eventName,final Map<String,String> args){
  final BuckTracingInterface tracingInterface=curThreadTracingInterface.get();
  if (tracingInterface == null) {
    return;
  }
  tracingInterface.begin(pluginName,eventName,args);
}
Program: 53096
Project: 53096
Buggy source:
public static JavacOptions.Builder builder(JavacOptions options){
  Preconditions.checkNotNull(options);
  JavacOptions.Builder builder=JavacOptions.builder();
  builder.setVerbose(options.isVerbose());
  builder.setProductionBuild(options.isProductionBuild());
  builder.setJavacPath(options.getJavacPath());
  builder.setJavacJarPath(options.getJavacJarPath());
  builder.setSpoolMode(options.getSpoolMode());
  builder.setAnnotationProcessingParams(options.getAnnotationProcessingParams());
  builder.putAllSourceToBootclasspath(options.getSourceToBootclasspath());
  builder.setBootclasspath(options.getBootclasspath());
  builder.setSourceLevel(options.getSourceLevel());
  builder.setTargetLevel(options.getTargetLevel());
  builder.addAllExtraArguments(options.getExtraArguments());
  return builder;
}

Fixed version (ground truth):
public static JavacOptions.Builder builder(JavacOptions options){
  Preconditions.checkNotNull(options);
  JavacOptions.Builder builder=JavacOptions.builder();
  builder.setVerbose(options.isVerbose());
  builder.setProductionBuild(options.isProductionBuild());
  builder.setJavacPath(options.getJavacPath());
  builder.setJavacJarPath(options.getJavacJarPath());
  builder.setSpoolMode(options.getSpoolMode());
  builder.setAnnotationProcessingParams(options.getAnnotationProcessingParams());
  builder.setSafeAnnotationProcessors(options.getSafeAnnotationProcessors());
  builder.putAllSourceToBootclasspath(options.getSourceToBootclasspath());
  builder.setBootclasspath(options.getBootclasspath());
  builder.setSourceLevel(options.getSourceLevel());
  builder.setTargetLevel(options.getTargetLevel());
  builder.addAllExtraArguments(options.getExtraArguments());
  return builder;
}
Program: 53098
Project: 53098
Buggy source:
public JavacOptions getDefaultJavacOptions(){
  Optional<String> sourceLevel=delegate.getValue("String_Node_Str","String_Node_Str");
  Optional<String> targetLevel=delegate.getValue("String_Node_Str","String_Node_Str");
  ImmutableList<String> extraArguments=delegate.getListWithoutComments("String_Node_Str","String_Node_Str");
  AbstractJavacOptions.SpoolMode spoolMode=delegate.getEnum("String_Node_Str","String_Node_Str",AbstractJavacOptions.SpoolMode.class).or(AbstractJavacOptions.SpoolMode.INTERMEDIATE_TO_DISK);
  ImmutableMap<String,String> allEntries=delegate.getEntriesForSection("String_Node_Str");
  ImmutableMap.Builder<String,String> bootclasspaths=ImmutableMap.builder();
  for (  Map.Entry<String,String> entry : allEntries.entrySet()) {
    if (entry.getKey().startsWith("String_Node_Str")) {
      bootclasspaths.put(entry.getKey().substring("String_Node_Str".length()),entry.getValue());
    }
  }
  return JavacOptions.builderForUseInJavaBuckConfig().setJavacPath(getJavacPath()).setJavacJarPath(getJavacJarPath()).setSourceLevel(sourceLevel.or(TARGETED_JAVA_VERSION)).setTargetLevel(targetLevel.or(TARGETED_JAVA_VERSION)).setSpoolMode(spoolMode).putAllSourceToBootclasspath(bootclasspaths.build()).addAllExtraArguments(extraArguments).build();
}

Fixed version (ground truth):
public JavacOptions getDefaultJavacOptions(){
  Optional<String> sourceLevel=delegate.getValue("String_Node_Str","String_Node_Str");
  Optional<String> targetLevel=delegate.getValue("String_Node_Str","String_Node_Str");
  ImmutableList<String> extraArguments=delegate.getListWithoutComments("String_Node_Str","String_Node_Str");
  ImmutableList<String> safeAnnotationProcessors=delegate.getListWithoutComments("String_Node_Str","String_Node_Str");
  AbstractJavacOptions.SpoolMode spoolMode=delegate.getEnum("String_Node_Str","String_Node_Str",AbstractJavacOptions.SpoolMode.class).or(AbstractJavacOptions.SpoolMode.INTERMEDIATE_TO_DISK);
  ImmutableMap<String,String> allEntries=delegate.getEntriesForSection("String_Node_Str");
  ImmutableMap.Builder<String,String> bootclasspaths=ImmutableMap.builder();
  for (  Map.Entry<String,String> entry : allEntries.entrySet()) {
    if (entry.getKey().startsWith("String_Node_Str")) {
      bootclasspaths.put(entry.getKey().substring("String_Node_Str".length()),entry.getValue());
    }
  }
  return JavacOptions.builderForUseInJavaBuckConfig().setJavacPath(getJavacPath()).setJavacJarPath(getJavacJarPath()).setSourceLevel(sourceLevel.or(TARGETED_JAVA_VERSION)).setTargetLevel(targetLevel.or(TARGETED_JAVA_VERSION)).setSpoolMode(spoolMode).putAllSourceToBootclasspath(bootclasspaths.build()).addAllExtraArguments(extraArguments).setSafeAnnotationProcessors(safeAnnotationProcessors).build();
}
Program: 53099
Project: 53099
Buggy source:
int buildWithClasspath(ExecutionContext context,ProjectFilesystem filesystem,SourcePathResolver resolver,BuildTarget invokingRule,ImmutableList<String> options,ImmutableSortedSet<Path> javaSourceFilePaths,Path pathToSrcsList,Optional<Path> workingDirectory,Optional<Path> usedClassesFile,Optional<StandardJavaFileManagerFactory> fileManagerFactory) throws InterruptedException ;

Fixed version (ground truth):
int buildWithClasspath(ExecutionContext context,ProjectFilesystem filesystem,SourcePathResolver resolver,BuildTarget invokingRule,ImmutableList<String> options,ImmutableSet<String> safeAnnotationProcessors,ImmutableSortedSet<Path> javaSourceFilePaths,Path pathToSrcsList,Optional<Path> workingDirectory,Optional<Path> usedClassesFile,Optional<StandardJavaFileManagerFactory> fileManagerFactory) throws InterruptedException ;
Program: 53102
Project: 53102
Buggy source:
@Override public void close() throws IOException {
  if (classLoader != null) {
    classLoader.close();
  }
}

Fixed version (ground truth):
@Override public void close() throws IOException {
  if (closeClassLoader && classLoader != null) {
    classLoader.close();
    classLoader=null;
  }
}
Program: 53104
Project: 53104
Buggy source:
/** 
 * There was a bug where `BuildTargetSourcePath` sources were written to the classes file using their string representation, rather than their resolved path.
 */
@Test public void shouldWriteResolvedBuildTargetSourcePathsToClassesFile() throws IOException, InterruptedException {
  BuildRuleResolver resolver=new BuildRuleResolver(TargetGraph.EMPTY,new DefaultTargetNodeToBuildRuleTransformer());
  SourcePathResolver pathResolver=new SourcePathResolver(resolver);
  BuildRule rule=new FakeBuildRule("String_Node_Str",pathResolver);
  resolver.addToIndex(rule);
  Jsr199Javac javac=createJavac(false);
  ExecutionContext executionContext=TestExecutionContext.newInstance();
  int exitCode=javac.buildWithClasspath(executionContext,createProjectFilesystem(),PATH_RESOLVER,BuildTargetFactory.newInstance("String_Node_Str"),ImmutableList.<String>of(),SOURCE_PATHS,pathToSrcsList,Optional.<Path>absent(),Optional.<Path>absent(),Optional.<StandardJavaFileManagerFactory>absent());
  assertEquals("String_Node_Str",exitCode,0);
  File srcsListFile=pathToSrcsList.toFile();
  assertTrue(srcsListFile.exists());
  assertTrue(srcsListFile.isFile());
  assertEquals("String_Node_Str",Files.toString(srcsListFile,Charsets.UTF_8).trim());
}

Fixed version (ground truth):
/** 
 * There was a bug where `BuildTargetSourcePath` sources were written to the classes file using their string representation, rather than their resolved path.
 */
@Test public void shouldWriteResolvedBuildTargetSourcePathsToClassesFile() throws IOException, InterruptedException {
  BuildRuleResolver resolver=new BuildRuleResolver(TargetGraph.EMPTY,new DefaultTargetNodeToBuildRuleTransformer());
  SourcePathResolver pathResolver=new SourcePathResolver(resolver);
  BuildRule rule=new FakeBuildRule("String_Node_Str",pathResolver);
  resolver.addToIndex(rule);
  Jsr199Javac javac=createJavac(false);
  ExecutionContext executionContext=TestExecutionContext.newInstance();
  int exitCode=javac.buildWithClasspath(executionContext,createProjectFilesystem(),PATH_RESOLVER,BuildTargetFactory.newInstance("String_Node_Str"),ImmutableList.<String>of(),ImmutableSet.<String>of(),SOURCE_PATHS,pathToSrcsList,Optional.<Path>absent(),Optional.<Path>absent(),Optional.<StandardJavaFileManagerFactory>absent());
  assertEquals("String_Node_Str",exitCode,0);
  File srcsListFile=pathToSrcsList.toFile();
  assertTrue(srcsListFile.exists());
  assertTrue(srcsListFile.isFile());
  assertEquals("String_Node_Str",Files.toString(srcsListFile,Charsets.UTF_8).trim());
}
Program: 53105
Project: 53105
Buggy source:
@Test public void shouldUseSpecifiedJavacJar() throws Exception {
  BuildRuleResolver resolver=new BuildRuleResolver(TargetGraph.EMPTY,new DefaultTargetNodeToBuildRuleTransformer());
  SourcePathResolver pathResolver=new SourcePathResolver(resolver);
  BuildRule rule=new FakeBuildRule("String_Node_Str",pathResolver);
  resolver.addToIndex(rule);
  Path fakeJavacJar=Paths.get("String_Node_Str","String_Node_Str");
  ExecutionContext executionContext=TestExecutionContext.newInstance();
  MockClassLoader mockClassLoader=new MockClassLoader(ClassLoader.getSystemClassLoader(),ImmutableMap.<String,Class<?>>of("String_Node_Str",MockJavac.class));
  executionContext.getClassLoaderCache().injectClassLoader(ClassLoader.getSystemClassLoader(),ImmutableList.of(fakeJavacJar.toUri().toURL()),mockClassLoader);
  Jsr199Javac javac=createJavac(false,Optional.of(fakeJavacJar));
  boolean caught=false;
  try {
    javac.buildWithClasspath(executionContext,createProjectFilesystem(),PATH_RESOLVER,BuildTargetFactory.newInstance("String_Node_Str"),ImmutableList.<String>of(),SOURCE_PATHS,pathToSrcsList,Optional.<Path>absent(),Optional.<Path>absent(),Optional.<StandardJavaFileManagerFactory>absent());
    fail("String_Node_Str");
  }
 catch (  UnsupportedOperationException ex) {
    if (ex.toString().contains("String_Node_Str")) {
      caught=true;
    }
  }
  assertTrue("String_Node_Str",caught);
}

Fixed version (ground truth):
@Test public void shouldUseSpecifiedJavacJar() throws Exception {
  BuildRuleResolver resolver=new BuildRuleResolver(TargetGraph.EMPTY,new DefaultTargetNodeToBuildRuleTransformer());
  SourcePathResolver pathResolver=new SourcePathResolver(resolver);
  BuildRule rule=new FakeBuildRule("String_Node_Str",pathResolver);
  resolver.addToIndex(rule);
  Path fakeJavacJar=Paths.get("String_Node_Str","String_Node_Str");
  ExecutionContext executionContext=TestExecutionContext.newInstance();
  MockClassLoader mockClassLoader=new MockClassLoader(ClassLoader.getSystemClassLoader(),ImmutableMap.<String,Class<?>>of("String_Node_Str",MockJavac.class));
  executionContext.getClassLoaderCache().injectClassLoader(ClassLoader.getSystemClassLoader(),ImmutableList.of(fakeJavacJar.toUri().toURL()),mockClassLoader);
  Jsr199Javac javac=createJavac(false,Optional.of(fakeJavacJar));
  boolean caught=false;
  try {
    javac.buildWithClasspath(executionContext,createProjectFilesystem(),PATH_RESOLVER,BuildTargetFactory.newInstance("String_Node_Str"),ImmutableList.<String>of(),ImmutableSet.<String>of(),SOURCE_PATHS,pathToSrcsList,Optional.<Path>absent(),Optional.<Path>absent(),Optional.<StandardJavaFileManagerFactory>absent());
    fail("String_Node_Str");
  }
 catch (  UnsupportedOperationException ex) {
    if (ex.toString().contains("String_Node_Str")) {
      caught=true;
    }
  }
  assertTrue("String_Node_Str",caught);
}
Program: 53106
Project: 53106
Buggy source:
@Test public void testClassesFile() throws IOException, InterruptedException {
  Jsr199Javac javac=createJavac(false);
  ExecutionContext executionContext=TestExecutionContext.newInstance();
  int exitCode=javac.buildWithClasspath(executionContext,createProjectFilesystem(),PATH_RESOLVER,BuildTargetFactory.newInstance("String_Node_Str"),ImmutableList.<String>of(),SOURCE_PATHS,pathToSrcsList,Optional.<Path>absent(),Optional.<Path>absent(),Optional.<StandardJavaFileManagerFactory>absent());
  assertEquals("String_Node_Str",exitCode,0);
  File srcsListFile=pathToSrcsList.toFile();
  assertTrue(srcsListFile.exists());
  assertTrue(srcsListFile.isFile());
  assertEquals("String_Node_Str",Files.toString(srcsListFile,Charsets.UTF_8).trim());
}

Fixed version (ground truth):
@Test public void testClassesFile() throws IOException, InterruptedException {
  Jsr199Javac javac=createJavac(false);
  ExecutionContext executionContext=TestExecutionContext.newInstance();
  int exitCode=javac.buildWithClasspath(executionContext,createProjectFilesystem(),PATH_RESOLVER,BuildTargetFactory.newInstance("String_Node_Str"),ImmutableList.<String>of(),ImmutableSet.<String>of(),SOURCE_PATHS,pathToSrcsList,Optional.<Path>absent(),Optional.<Path>absent(),Optional.<StandardJavaFileManagerFactory>absent());
  assertEquals("String_Node_Str",exitCode,0);
  File srcsListFile=pathToSrcsList.toFile();
  assertTrue(srcsListFile.exists());
  assertTrue(srcsListFile.isFile());
  assertEquals("String_Node_Str",Files.toString(srcsListFile,Charsets.UTF_8).trim());
}
Program: 53107
Project: 53107
Buggy source:
private void addReadFile(FileObject fileObject){
  Preconditions.checkState(result == null);
  if (!(fileObject instanceof JavaFileObject)) {
    return;
  }
  JavaFileObject javaFileObject=(JavaFileObject)fileObject;
  if (javaFileObject.getKind() != JavaFileObject.Kind.CLASS) {
    return;
  }
  Matcher classFileMatcher=CLASS_FILE_PATTERN.matcher(javaFileObject.toUri().toString());
  boolean matches=classFileMatcher.matches();
  if (!matches) {
    return;
  }
  resultBuilder.put(Paths.get(classFileMatcher.group("String_Node_Str")),Paths.get(classFileMatcher.group("String_Node_Str")));
}

Fixed version (ground truth):
private void addReadFile(FileObject fileObject){
  Preconditions.checkState(result == null);
  if (!(fileObject instanceof JavaFileObject)) {
    return;
  }
  JavaFileObject javaFileObject=(JavaFileObject)fileObject;
  if (javaFileObject.getKind() != JavaFileObject.Kind.CLASS) {
    return;
  }
  URI classFileJarUri=javaFileObject.toUri();
  if (!classFileJarUri.getScheme().equals(JAR_SCHEME)) {
    return;
  }
  String jarUriSchemeSpecificPart=classFileJarUri.getRawSchemeSpecificPart();
  final String[] split=jarUriSchemeSpecificPart.split("String_Node_Str");
  Preconditions.checkState(split.length == 2);
  URI jarFileUri=URI.create(split[0]);
  Preconditions.checkState(jarFileUri.getScheme().equals(FILE_SCHEME));
  Path jarFilePath=Paths.get(jarFileUri);
  Path classPath=Paths.get(URI.create(split[1]).toString());
  Preconditions.checkState(jarFilePath.isAbsolute());
  Preconditions.checkState(!classPath.isAbsolute());
  resultBuilder.put(jarFilePath,classPath);
}
Program: 53108
Project: 53108
Buggy source:
public DIncludes getIncludes() throws NoSuchBuildTargetException {
  buildRuleResolver.requireRule(BuildTarget.builder(getBuildTarget()).addFlavors(DDescriptionUtils.SOURCE_LINK_TREE).build());
  return includes;
}

Fixed version (ground truth):
public DIncludes getIncludes() throws NoSuchBuildTargetException {
  buildRuleResolver.requireRule(getBuildTarget().withFlavors(DDescriptionUtils.SOURCE_LINK_TREE));
  return includes;
}
Program: 53109
Project: 53109
Buggy source:
@Override public <A extends Arg>BuildRule createBuildRule(TargetGraph targetGraph,BuildRuleParams params,BuildRuleResolver buildRuleResolver,A args) throws NoSuchBuildTargetException {
  SourcePathResolver pathResolver=new SourcePathResolver(buildRuleResolver);
  if (params.getBuildTarget().getFlavors().contains(DDescriptionUtils.SOURCE_LINK_TREE)) {
    return DDescriptionUtils.createSourceSymlinkTree(params.getBuildTarget(),params,pathResolver,args.srcs);
  }
  BuildTarget baseTarget=params.getBuildTarget().withoutFlavors(ImmutableSet.of(cxxPlatform.getFlavor(),CxxDescriptionEnhancer.STATIC_FLAVOR,DDescriptionUtils.SOURCE_LINK_TREE));
  DIncludes dIncludes=DIncludes.builder().setLinkTree(new BuildTargetSourcePath(DDescriptionUtils.getSymlinkTreeTarget(baseTarget))).setSources(args.srcs.getPaths()).build();
  if (params.getBuildTarget().getFlavors().contains(CxxDescriptionEnhancer.STATIC_FLAVOR)) {
    return createStaticLibraryBuildRule(params,buildRuleResolver,pathResolver,cxxPlatform,dBuckConfig,ImmutableList.<String>of(),args.srcs.getPaths(),dIncludes,CxxSourceRuleFactory.PicType.PDC);
  }
  return new DLibrary(params,buildRuleResolver,pathResolver,dIncludes);
}

Fixed version (ground truth):
@Override public <A extends Arg>BuildRule createBuildRule(TargetGraph targetGraph,BuildRuleParams params,BuildRuleResolver buildRuleResolver,A args) throws NoSuchBuildTargetException {
  SourcePathResolver pathResolver=new SourcePathResolver(buildRuleResolver);
  if (params.getBuildTarget().getFlavors().contains(DDescriptionUtils.SOURCE_LINK_TREE)) {
    return DDescriptionUtils.createSourceSymlinkTree(params.getBuildTarget(),params,pathResolver,args.srcs);
  }
  BuildTarget sourceTreeTarget=params.getBuildTarget().withFlavors(DDescriptionUtils.SOURCE_LINK_TREE);
  DIncludes dIncludes=DIncludes.builder().setLinkTree(new BuildTargetSourcePath(sourceTreeTarget)).setSources(args.srcs.getPaths()).build();
  if (params.getBuildTarget().getFlavors().contains(CxxDescriptionEnhancer.STATIC_FLAVOR)) {
    buildRuleResolver.requireRule(sourceTreeTarget);
    return createStaticLibraryBuildRule(params,buildRuleResolver,pathResolver,cxxPlatform,dBuckConfig,ImmutableList.<String>of(),args.srcs.getPaths(),dIncludes,CxxSourceRuleFactory.PicType.PDC);
  }
  return new DLibrary(params,buildRuleResolver,pathResolver,dIncludes);
}
Program: 53113
Project: 53113
Buggy source:
@Override public FileVisitResult visitFile(Path file,BasicFileAttributes attr) throws IOException {
  if (isResource(file)) {
    paths.add(new PathSourcePath(filesystem,file));
  }
  return FileVisitResult.CONTINUE;
}

Fixed version (ground truth):
@Override public FileVisitResult visitFile(Path file,BasicFileAttributes attr) throws IOException {
  String filename=file.getFileName().toString();
  if (isResource(filename)) {
    paths.add(new PathSourcePath(filesystem,file));
  }
  return FileVisitResult.CONTINUE;
}
Program: 53114
Project: 53114
Buggy source:
private boolean isResource(Path fileOrDir) throws IOException {
  for (  String nonAssetFilename : NON_ASSET_FILENAMES) {
    if (filesystem.isSameRelativePathIfFileExists(fileOrDir,fileOrDir.resolveSibling(nonAssetFilename))) {
      return false;
    }
  }
  String fileOrDirName=fileOrDir.getFileName().toString();
  if (fileOrDirName.charAt(fileOrDirName.length() - 1) == '~') {
    return false;
  }
  String fileOrDirNameWithoutExtension=Files.getNameWithoutExtension(fileOrDirName);
  for (  String ignoredMiniAaptExtension : MiniAapt.IGNORED_FILE_EXTENSIONS) {
    if (filesystem.isSameRelativePathIfFileExists(fileOrDir,fileOrDir.resolveSibling(fileOrDirNameWithoutExtension + "String_Node_Str" + ignoredMiniAaptExtension))) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean isResource(String fileOrDirName){
  if (NON_ASSET_FILENAMES.contains(fileOrDirName.toLowerCase())) {
    return false;
  }
  if (fileOrDirName.charAt(fileOrDirName.length() - 1) == '~') {
    return false;
  }
  if (MiniAapt.IGNORED_FILE_EXTENSIONS.contains(Files.getFileExtension(fileOrDirName))) {
    return false;
  }
  return true;
}
Program: 53116
Project: 53116
Buggy source:
@Override public FileVisitResult preVisitDirectory(Path dir,BasicFileAttributes attr) throws IOException {
  if (dir.getFileName().toString().charAt(0) == '_' || !isResource(dir)) {
    return FileVisitResult.SKIP_SUBTREE;
  }
  return FileVisitResult.CONTINUE;
}

Fixed version (ground truth):
@Override public FileVisitResult preVisitDirectory(Path dir,BasicFileAttributes attr) throws IOException {
  String dirName=dir.getFileName().toString();
  if (dirName.charAt(0) == '_' || !isResource(dirName)) {
    return FileVisitResult.SKIP_SUBTREE;
  }
  return FileVisitResult.CONTINUE;
}
Program: 53118
Project: 53118
Buggy source:
@Override public int runWithoutHelp(final CommandRunnerParams params) throws IOException, InterruptedException {
  final ImmutableSet<String> fullyQualifiedBuildTargets=ImmutableSet.copyOf(getArgumentsFormattedAsBuildTargets(params.getBuckConfig()));
  if (fullyQualifiedBuildTargets.isEmpty()) {
    params.getBuckEventBus().post(ConsoleEvent.severe("String_Node_Str"));
    return 1;
  }
  ImmutableSet<BuildTarget> targets=FluentIterable.from(getArgumentsFormattedAsBuildTargets(params.getBuckConfig())).transform(new Function<String,BuildTarget>(){
    @Override public BuildTarget apply(    String input){
      return BuildTargetParser.INSTANCE.parse(input,BuildTargetPatternParser.fullyQualified(),params.getCell().getCellRoots());
    }
  }
).toSet();
  LOG.debug("String_Node_Str",targets);
  TargetGraph graph;
  try (CommandThreadManager pool=new CommandThreadManager("String_Node_Str",params.getBuckConfig().getWorkQueueExecutionOrder(),getConcurrencyLimit(params.getBuckConfig()))){
    graph=params.getParser().buildTargetGraph(params.getBuckEventBus(),params.getCell(),getEnableProfiling(),pool.getExecutor(),targets);
  }
 catch (  BuildFileParseException e) {
    params.getBuckEventBus().post(ConsoleEvent.severe(MoreExceptions.getHumanReadableOrLocalizedMessage(e)));
    return 1;
  }
  if (shouldGenerateJsonOutput()) {
    return printJsonInputs(params,graph);
  }
  return printInputs(params,graph);
}

Fixed version (ground truth):
@Override public int runWithoutHelp(final CommandRunnerParams params) throws IOException, InterruptedException {
  final ImmutableSet<String> fullyQualifiedBuildTargets=ImmutableSet.copyOf(getArgumentsFormattedAsBuildTargets(params.getBuckConfig()));
  if (fullyQualifiedBuildTargets.isEmpty()) {
    params.getBuckEventBus().post(ConsoleEvent.severe("String_Node_Str"));
    return 1;
  }
  ImmutableSet<BuildTarget> targets=FluentIterable.from(getArgumentsFormattedAsBuildTargets(params.getBuckConfig())).transform(new Function<String,BuildTarget>(){
    @Override public BuildTarget apply(    String input){
      return BuildTargetParser.INSTANCE.parse(input,BuildTargetPatternParser.fullyQualified(),params.getCell().getCellRoots());
    }
  }
).toSet();
  LOG.debug("String_Node_Str",targets);
  TargetGraph graph;
  try (CommandThreadManager pool=new CommandThreadManager("String_Node_Str",params.getBuckConfig().getWorkQueueExecutionOrder(),getConcurrencyLimit(params.getBuckConfig()))){
    graph=params.getParser().buildTargetGraph(params.getBuckEventBus(),params.getCell(),getEnableProfiling(),pool.getExecutor(),targets);
  }
 catch (  BuildFileParseException|BuildTargetException e) {
    params.getBuckEventBus().post(ConsoleEvent.severe(MoreExceptions.getHumanReadableOrLocalizedMessage(e)));
    return 1;
  }
  if (shouldGenerateJsonOutput()) {
    return printJsonInputs(params,graph);
  }
  return printInputs(params,graph);
}
Program: 53119
Project: 53119
Buggy source:
private void buildGraphForBuildTargets(Set<BuildTarget> targets,Executor executor) throws QueryException, InterruptedException {
  try {
    graph=params.getParser().buildTargetGraph(params.getBuckEventBus(),params.getCell(),enableProfiling,executor,targets);
  }
 catch (  BuildFileParseException|IOException e) {
    throw new QueryException("String_Node_Str");
  }
}

Fixed version (ground truth):
private void buildGraphForBuildTargets(Set<BuildTarget> targets,Executor executor) throws QueryException, InterruptedException {
  try {
    graph=params.getParser().buildTargetGraph(params.getBuckEventBus(),params.getCell(),enableProfiling,executor,targets);
  }
 catch (  BuildFileParseException|BuildTargetException|IOException e) {
    throw new QueryException("String_Node_Str");
  }
}
Program: 53121
Project: 53121
Buggy source:
private TargetGraphAndTargets createTargetGraph(CommandRunnerParams params,TargetGraph projectGraph,ImmutableSet<BuildTarget> graphRoots,AssociatedTargetNodePredicate associatedProjectPredicate,boolean isWithTests,boolean isWithDependenciesTests,boolean needsFullRecursiveParse,Executor executor) throws IOException, InterruptedException, BuildFileParseException {
  ImmutableSet<BuildTarget> explicitTestTargets=ImmutableSet.of();
  ImmutableSet<BuildTarget> graphRootsOrSourceTargets=replaceWorkspacesWithSourceTargetsIfPossible(graphRoots,projectGraph);
  if (isWithTests) {
    explicitTestTargets=TargetGraphAndTargets.getExplicitTestTargets(graphRootsOrSourceTargets,projectGraph,isWithDependenciesTests);
    if (!needsFullRecursiveParse) {
      projectGraph=params.getParser().buildTargetGraph(params.getBuckEventBus(),params.getCell(),getEnableProfiling(),executor,Sets.union(graphRoots,explicitTestTargets));
    }
  }
  return TargetGraphAndTargets.create(graphRoots,graphRootsOrSourceTargets,projectGraph,associatedProjectPredicate,isWithTests,isWithDependenciesTests,explicitTestTargets);
}

Fixed version (ground truth):
private TargetGraphAndTargets createTargetGraph(CommandRunnerParams params,TargetGraph projectGraph,ImmutableSet<BuildTarget> graphRoots,AssociatedTargetNodePredicate associatedProjectPredicate,boolean isWithTests,boolean isWithDependenciesTests,boolean needsFullRecursiveParse,Executor executor) throws IOException, InterruptedException, BuildFileParseException, BuildTargetException {
  ImmutableSet<BuildTarget> explicitTestTargets=ImmutableSet.of();
  ImmutableSet<BuildTarget> graphRootsOrSourceTargets=replaceWorkspacesWithSourceTargetsIfPossible(graphRoots,projectGraph);
  if (isWithTests) {
    explicitTestTargets=TargetGraphAndTargets.getExplicitTestTargets(graphRootsOrSourceTargets,projectGraph,isWithDependenciesTests);
    if (!needsFullRecursiveParse) {
      projectGraph=params.getParser().buildTargetGraph(params.getBuckEventBus(),params.getCell(),getEnableProfiling(),executor,Sets.union(graphRoots,explicitTestTargets));
    }
  }
  return TargetGraphAndTargets.create(graphRoots,graphRootsOrSourceTargets,projectGraph,associatedProjectPredicate,isWithTests,isWithDependenciesTests,explicitTestTargets);
}