nus-yam/ex-repair huggingface dataset:
Program: 151650
Project: 151650
Buggy source:
@DefaultCommand public void listCommands(@Option(name="String_Node_Str",shortName="String_Node_Str",flagOnly=true) boolean showAll){
  List<String> listData=new ArrayList<String>();
  Class currResource=shell.getCurrentResource().getClass();
  for (  List<PluginMetadata> lpm : registry.getPlugins().values()) {
    for (    PluginMetadata pluginMetadata : lpm) {
      for (      CommandMetadata commandMetadata : pluginMetadata.getAllCommands()) {
        String name=render(listData,showAll,currResource,commandMetadata);
        if (name.endsWith("String_Node_Str")) {
          listData.remove(name.substring(0,name.length() - 1));
        }
        listData.add(name);
      }
    }
  }
  if (showAll)   shell.println("String_Node_Str");
  printOutColumns(listData,shell,true);
}

Fixed version (ground truth):
@DefaultCommand public void listCommands(@Option(name="String_Node_Str",shortName="String_Node_Str",flagOnly=true) boolean showAll){
  List<String> listData=new ArrayList<String>();
  Class currResource=shell.getCurrentResource().getClass();
  for (  List<PluginMetadata> lpm : registry.getPlugins().values()) {
    for (    PluginMetadata pluginMetadata : lpm) {
      for (      CommandMetadata commandMetadata : pluginMetadata.getAllCommands()) {
        String name=render(listData,showAll,currResource,commandMetadata);
        if (name.endsWith("String_Node_Str")) {
          listData.remove(name.substring(0,name.length() - 1));
        }
        if (!"String_Node_Str".equals(name))         listData.add(name);
      }
    }
  }
  if (showAll)   shell.println("String_Node_Str");
  printOutColumns(listData,shell,true);
}
Program: 151651
Project: 151651
Buggy source:
public PathspecParser(final ResourceFactory factory,final Resource<?> res,final String path){
  this.factory=factory;
  this.res=res;
  this.length=(this.path=path).length();
}

Fixed version (ground truth):
public PathspecParser(final ResourceFactory factory,final Resource<?> res,final String path){
  this.factory=factory;
  this.res=res;
  this.path=path;
  this.length=path.length();
}
Program: 151652
Project: 151652
Buggy source:
private String capture(){
  int start=cursor;
  if (path.charAt(cursor) == '/') {
    cursor++;
  }
  while ((cursor != length) && (path.charAt(cursor) != '/')) {
    cursor++;
  }
  return path.substring(start,cursor);
}

Fixed version (ground truth):
private String capture(){
  int start=cursor;
  if (path.charAt(cursor) == '/') {
    cursor++;
  }
  while ((cursor < length) && (path.charAt(cursor) != '/')) {
    cursor++;
  }
  return path.substring(start,cursor);
}
Program: 151653
Project: 151653
Buggy source:
public Resource<?> parse(){
  Resource<?> r=res;
  String tk;
  if (path.startsWith("String_Node_Str")) {
    File homeDir=new File(System.getProperty("String_Node_Str")).getAbsoluteFile();
    if (path.length() == 1) {
      return new DirectoryResource(factory,homeDir);
    }
 else {
      path=path.substring(1);
      r=new DirectoryResource(factory,homeDir);
    }
  }
  while (cursor < length) {
switch (path.charAt(cursor++)) {
case '.':
      if (read() == '.') {
        Resource<?> parent=r.getParent();
        if (parent == null) {
          return r;
        }
        r=parent;
      }
    break;
default :
  if (read() == '.') {
    continue;
  }
boolean first=--cursor == 0;
tk=capture();
if (tk.startsWith("String_Node_Str")) {
if (first) {
r=factory.getResourceFrom(new File(tk));
cursor++;
continue;
}
 else {
tk=tk.substring(1);
}
}
Resource<?> child=r.getChild(tk);
if (child == null) {
throw new RuntimeException("String_Node_Str" + child);
}
r=child;
break;
}
}
return r;
}

Fixed version (ground truth):
public Resource<?> parse(){
  Resource<?> r=res;
  String tk;
  if (path.startsWith("String_Node_Str")) {
    File homeDir=new File(System.getProperty("String_Node_Str")).getAbsoluteFile();
    if (path.length() == 1) {
      return new DirectoryResource(factory,homeDir);
    }
 else {
      cursor++;
      r=new DirectoryResource(factory,homeDir);
    }
  }
  while (cursor < length) {
switch (path.charAt(cursor++)) {
case '.':
      if (read() == '.') {
        Resource<?> parent=r.getParent();
        if (parent == null) {
          return r;
        }
        r=parent;
      }
    break;
default :
  if (read() == '.') {
    continue;
  }
boolean first=--cursor == 0;
tk=capture();
if (tk.startsWith("String_Node_Str")) {
if (first) {
r=factory.getResourceFrom(new File(tk));
cursor++;
continue;
}
 else {
tk=tk.substring(1);
}
}
Resource<?> child=r.getChild(tk);
if (child == null) {
throw new RuntimeException("String_Node_Str" + child);
}
r=child;
break;
}
}
return r;
}
Program: 151654
Project: 151654
Buggy source:
void init(@Observes final Startup event,final PluginCommandCompleter pluginCompleter) throws Exception {
  log.info("String_Node_Str");
  BooleanConverter booleanConverter=new BooleanConverter();
  DataConversion.addConversionHandler(boolean.class,booleanConverter);
  DataConversion.addConversionHandler(Boolean.class,booleanConverter);
  DataConversion.addConversionHandler(File.class,new FileConverter());
  initStreams();
  initCompleters(pluginCompleter);
  initParameters();
  printWelcomeBanner();
  postStartup.fire(new PostStartup());
}

Fixed version (ground truth):
void init(@Observes final Startup event,final PluginCommandCompleter pluginCompleter) throws Exception {
  log.info("String_Node_Str");
  BooleanConverter booleanConverter=new BooleanConverter();
  addConversionHandler(boolean.class,booleanConverter);
  addConversionHandler(Boolean.class,booleanConverter);
  addConversionHandler(File.class,new FileConverter());
  initStreams();
  initCompleters(pluginCompleter);
  initParameters();
  printWelcomeBanner();
  postStartup.fire(new PostStartup());
}
Program: 151655
Project: 151655
Buggy source:
public static int firstWhitespace(String str){
  int len=str.length();
  for (int i=0; i < len; i++) {
switch (str.charAt(i)) {
case '\t':
case ' ':
      return i;
  }
}
return -1;
}

Fixed version (ground truth):
public static int firstWhitespace(String str){
  int len=str.length();
  for (int i=0; i < len; i++) {
switch (str.charAt(i)) {
case '\t':
case ' ':
      return i;
  }
}
return str.length();
}
Program: 151656
Project: 151656
Buggy source:
public Resource<?> parse(){
  Resource r=res;
  String tk;
  if (path.startsWith("String_Node_Str")) {
    File homeDir=new File(System.getProperty("String_Node_Str")).getAbsoluteFile();
    if (path.length() == 1) {
      return new DirectoryResource(factory,homeDir);
    }
 else {
      path=path.substring(1);
      r=new DirectoryResource(factory,homeDir);
    }
  }
  while (cursor < length) {
switch (path.charAt(cursor++)) {
case '.':
      if (read() == '.') {
        Resource parent=r.getParent();
        if (parent == null)         return r;
        r=parent;
      }
    break;
default :
  if (read() == '.')   continue;
cursor--;
tk=capture();
if (tk.startsWith("String_Node_Str")) {
if (res == r) {
r=factory.getResourceFrom(new File(tk));
cursor++;
continue;
}
 else {
tk=tk.substring(1);
}
}
Resource child=r.getChild(tk);
if (child == null) {
throw new RuntimeException("String_Node_Str" + child);
}
r=child;
break;
}
}
return r;
}

Fixed version (ground truth):
public Resource<?> parse(){
  Resource r=res;
  String tk;
  if (path.startsWith("String_Node_Str")) {
    File homeDir=new File(System.getProperty("String_Node_Str")).getAbsoluteFile();
    if (path.length() == 1) {
      return new DirectoryResource(factory,homeDir);
    }
 else {
      path=path.substring(1);
      r=new DirectoryResource(factory,homeDir);
    }
  }
  while (cursor < length) {
switch (path.charAt(cursor++)) {
case '.':
      if (read() == '.') {
        Resource parent=r.getParent();
        if (parent == null)         return r;
        r=parent;
      }
    break;
default :
  if (read() == '.')   continue;
boolean first=--cursor == 0;
tk=capture();
if (tk.startsWith("String_Node_Str")) {
if (first) {
r=factory.getResourceFrom(new File(tk));
cursor++;
continue;
}
 else {
tk=tk.substring(1);
}
}
Resource child=r.getChild(tk);
if (child == null) {
throw new RuntimeException("String_Node_Str" + child);
}
r=child;
break;
}
}
return r;
}
Program: 151657
Project: 151657
Buggy source:
@DefaultCommand public void run(@Option(flagOnly=true,name="String_Node_Str",shortName="String_Node_Str",required=false) boolean showAll){
  Resource<?> resource=shell.getCurrentResource();
  int width=shell.getWidth();
  List<Resource<?>> childResources=resource.listResources(resourceFactory);
  List<String> listData=new LinkedList<String>();
  int maxLength=0;
  String el;
  for (  Resource r : childResources) {
    el=r.toString();
    if (showAll || !el.startsWith("String_Node_Str"))     listData.add(el);
    if (el.length() > maxLength)     maxLength=el.length();
  }
  int cols=width / (maxLength + 4);
  int colSize=width / cols;
  if (cols == 0) {
    colSize=width;
    cols=1;
  }
  int i=0;
  for (  String s : listData) {
    shell.print(s);
    shell.print(pad(colSize - s.length()));
    if (++i == cols) {
      shell.println();
      i=0;
    }
  }
  shell.println();
}

Fixed version (ground truth):
@DefaultCommand public void run(@Option(flagOnly=true,name="String_Node_Str",shortName="String_Node_Str",required=false) boolean showAll){
  Resource<?> resource=shell.getCurrentResource();
  int width=shell.getWidth();
  List<Resource<?>> childResources=resource.listResources(resourceFactory);
  List<String> listData=new LinkedList<String>();
  int maxLength=0;
  String el;
  for (  Resource r : childResources) {
    el=r.toString();
    if (showAll || !el.startsWith("String_Node_Str")) {
      listData.add(el);
      if (el.length() > maxLength)       maxLength=el.length();
    }
  }
  int cols=width / (maxLength + 4);
  int colSize=width / cols;
  if (cols == 0) {
    colSize=width;
    cols=1;
  }
  int i=0;
  for (  String s : listData) {
    shell.print(s);
    shell.print(pad(colSize - s.length()));
    if (++i == cols) {
      shell.println();
      i=0;
    }
  }
  shell.println();
}
Program: 151658
Project: 151658
Buggy source:
@Override public JavaClass getTestJavaClass(final String relativePath) throws FileNotFoundException {
  try {
    return JavaParser.parse(getTestSourceFile(relativePath));
  }
 catch (  FileNotFoundException e) {
    return getTestJavaClass(getBasePackageFile().getAbsolutePath() + File.separator + Packages.toFileSyntax(relativePath)+ "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public JavaClass getTestJavaClass(final String relativePath) throws FileNotFoundException {
  File target=getTestSourceFile(relativePath);
  return JavaParser.parse(target);
}
Program: 151659
Project: 151659
Buggy source:
@Override public File getSourceFile(final String relativePath){
  return new File(getSourceFolder() + File.separator + relativePath).getAbsoluteFile();
}

Fixed version (ground truth):
@Override public File getSourceFile(final String relativePath){
  File target=new File(getSourceFolder() + File.separator + relativePath).getAbsoluteFile();
  return target;
}
Program: 151660
Project: 151660
Buggy source:
@Override public JavaClass getJavaClass(final String relativePath) throws FileNotFoundException {
  try {
    return JavaParser.parse(getSourceFile(relativePath));
  }
 catch (  FileNotFoundException e) {
    return getJavaClass(getBasePackageFile().getAbsolutePath() + File.separator + Packages.toFileSyntax(relativePath)+ "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public JavaClass getJavaClass(final String relativePath) throws FileNotFoundException {
  File target=getSourceFile(relativePath);
  return JavaParser.parse(target);
}
Program: 151661
Project: 151661
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public <F extends Facet>F getFacet(final Class<F> type){
  Facet result=null;
  for (  Facet facet : installedFacets) {
    if ((facet != null) && type.isAssignableFrom(facet.getClass())) {
      result=facet;
    }
  }
  if (result == null) {
    throw new FacetNotFoundException("String_Node_Str" + type.getName() + "String_Node_Str");
  }
  return (F)result;
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public <F extends Facet>F getFacet(final Class<F> type){
  Facet result=null;
  for (  Facet facet : installedFacets) {
    if ((facet != null) && type.isAssignableFrom(facet.getClass())) {
      result=facet;
      break;
    }
  }
  if (result == null) {
    throw new FacetNotFoundException("String_Node_Str" + type.getName() + "String_Node_Str");
  }
  return (F)result;
}
Program: 151663
Project: 151663
Buggy source:
@Override public void addDependency(final Dependency dep){
  bootstrapMaven();
  if (!hasDependency(dep)) {
    Model pom=getPOM();
    List<Dependency> dependencies=pom.getDependencies();
    dependencies.add(dep);
    setPOM(pom);
  }
}

Fixed version (ground truth):
@Override public void addDependency(final Dependency dep){
  bootstrapMaven();
  if (!hasDependency(dep)) {
    Model pom=getPOM();
    List<Dependency> dependencies=pom.getDependencies();
    dependencies.add(dep);
    setPOM(pom);
  }
  invalidateBuildingResult();
}
Program: 151664
Project: 151664
Buggy source:
@Override public void removeDependency(final Dependency dep){
  bootstrapMaven();
  Model pom=getPOM();
  List<Dependency> dependencies=pom.getDependencies();
  List<Dependency> toBeRemoved=new ArrayList<Dependency>();
  for (  Dependency dependency : dependencies) {
    if (areEquivalent(dependency,dep)) {
      toBeRemoved.add(dependency);
    }
  }
  dependencies.removeAll(toBeRemoved);
  setPOM(pom);
}

Fixed version (ground truth):
@Override public void removeDependency(final Dependency dep){
  bootstrapMaven();
  Model pom=getPOM();
  List<Dependency> dependencies=pom.getDependencies();
  List<Dependency> toBeRemoved=new ArrayList<Dependency>();
  for (  Dependency dependency : dependencies) {
    if (areEquivalent(dependency,dep)) {
      toBeRemoved.add(dependency);
    }
  }
  dependencies.removeAll(toBeRemoved);
  setPOM(pom);
  invalidateBuildingResult();
}
Program: 151665
Project: 151665
Buggy source:
@Override public ProjectBuildingResult getProjectBuildingResult(){
  bootstrapMaven();
  try {
    ProjectBuildingResult buildingResult=builder.build(getPOMFile(),request);
    return buildingResult;
  }
 catch (  ProjectBuildingException e) {
    throw new ProjectModelException(e);
  }
}

Fixed version (ground truth):
@Override public ProjectBuildingResult getProjectBuildingResult(){
  bootstrapMaven();
  try {
    if (this.buildingResult == null) {
      buildingResult=builder.build(getPOMFile(),request);
    }
    return buildingResult;
  }
 catch (  ProjectBuildingException e) {
    throw new ProjectModelException(e);
  }
}
Program: 151666
Project: 151666
Buggy source:
public Project createProject(final File targetDir,final Class<? extends Facet>... facetTypes){
  Project project=new ProjectImpl(targetDir);
  for (  Class<? extends Facet> type : facetTypes) {
    installSingleFacet(project,type);
  }
  return project;
}

Fixed version (ground truth):
public Project createProject(final File targetDir,final Class<? extends Facet>... facetTypes){
  Project project=new ProjectImpl(targetDir);
  for (  Class<? extends Facet> type : facetTypes) {
    installSingleFacet(project,type);
  }
  registerFacets(project);
  return project;
}
Program: 151667
Project: 151667
Buggy source:
private void init(final char[] source){
  document=new Document(new String(source));
  ASTParser parser=ASTParser.newParser(AST.JLS3);
  parser.setSource(document.get().toCharArray());
  parser.setResolveBindings(true);
  parser.setKind(ASTParser.K_COMPILATION_UNIT);
  unit=(CompilationUnit)parser.createAST(null);
  unit.recordModifications();
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private void init(final char[] source){
  document=new Document(new String(source));
  ASTParser parser=ASTParser.newParser(AST.JLS3);
  parser.setSource(document.get().toCharArray());
  Map options=JavaCore.getOptions();
  options.put(CompilerOptions.OPTION_Source,CompilerOptions.VERSION_1_5);
  parser.setCompilerOptions(options);
  parser.setResolveBindings(true);
  parser.setKind(ASTParser.K_COMPILATION_UNIT);
  unit=(CompilationUnit)parser.createAST(null);
  unit.recordModifications();
}
Program: 151668
Project: 151668
Buggy source:
@Override public String toString(){
  return document.get();
}

Fixed version (ground truth):
@Override public String toString(){
  return unit.toString();
}
Program: 151669
Project: 151669
Buggy source:
@Test public void testSetType() throws Exception {
  assertEquals("String_Node_Str",field.getName());
  field.setType(FieldTest.class);
  field.applyChanges();
  assertTrue(field.toString().contains("String_Node_Str"));
  assertEquals(FieldTest.class.getSimpleName(),field.getType());
}

Fixed version (ground truth):
@Test public void testSetType() throws Exception {
  assertEquals("String_Node_Str",field.getName());
  field.setType(FieldTest.class);
  field.getOrigin();
  assertTrue(field.toString().contains("String_Node_Str"));
  assertEquals(FieldTest.class.getSimpleName(),field.getType());
}
Program: 151670
Project: 151670
Buggy source:
@Test public void testAddFieldInitializerString() throws Exception {
  javaClass.addField("String_Node_Str").setStringInitializer("String_Node_Str");
  Field fld=javaClass.getFields().get(javaClass.getFields().size() - 1);
  fld.applyChanges();
  assertEquals("String_Node_Str",fld.getType());
  assertEquals("String_Node_Str",fld.getName());
  assertEquals("String_Node_Str",fld.getLiteralInitializer());
  assertEquals("String_Node_Str",fld.getStringInitializer());
  assertEquals("String_Node_Str",fld.toString().trim());
}

Fixed version (ground truth):
@Test public void testAddFieldInitializerString() throws Exception {
  javaClass.addField("String_Node_Str").setStringInitializer("String_Node_Str");
  Field fld=javaClass.getFields().get(javaClass.getFields().size() - 1);
  fld.getOrigin();
  assertEquals("String_Node_Str",fld.getType());
  assertEquals("String_Node_Str",fld.getName());
  assertEquals("String_Node_Str",fld.getLiteralInitializer());
  assertEquals("String_Node_Str",fld.getStringInitializer());
  assertEquals("String_Node_Str",fld.toString().trim());
}
Program: 151671
Project: 151671
Buggy source:
@Test public void testSetTypeString() throws Exception {
  assertEquals("String_Node_Str",field.getName());
  field.setType("String_Node_Str");
  field.applyChanges();
  assertTrue(field.toString().contains("String_Node_Str"));
  assertEquals("String_Node_Str",field.getType());
}

Fixed version (ground truth):
@Test public void testSetTypeString() throws Exception {
  assertEquals("String_Node_Str",field.getName());
  field.setType("String_Node_Str");
  field.getOrigin();
  assertTrue(field.toString().contains("String_Node_Str"));
  assertEquals("String_Node_Str",field.getType());
}
Program: 151672
Project: 151672
Buggy source:
@Test public void testAddQualifiedFieldType() throws Exception {
  javaClass.addField().setName("String_Node_Str").setType(String.class.getName()).setStringInitializer("String_Node_Str").setPrivate();
  Field fld=javaClass.getFields().get(javaClass.getFields().size() - 1);
  fld.applyChanges();
  assertEquals(String.class.getName(),fld.getType());
  assertEquals("String_Node_Str",fld.getName());
  assertEquals("String_Node_Str",fld.getLiteralInitializer());
  assertEquals("String_Node_Str",fld.getStringInitializer());
  assertEquals("String_Node_Str",fld.toString().trim());
}

Fixed version (ground truth):
@Test public void testAddQualifiedFieldType() throws Exception {
  javaClass.addField().setName("String_Node_Str").setType(String.class.getName()).setStringInitializer("String_Node_Str").setPrivate();
  Field fld=javaClass.getFields().get(javaClass.getFields().size() - 1);
  fld.getOrigin();
  assertEquals(String.class.getName(),fld.getType());
  assertEquals("String_Node_Str",fld.getName());
  assertEquals("String_Node_Str",fld.getLiteralInitializer());
  assertEquals("String_Node_Str",fld.getStringInitializer());
  assertEquals("String_Node_Str",fld.toString().trim());
}
Program: 151673
Project: 151673
Buggy source:
@Test public void testSetName() throws Exception {
  assertEquals("String_Node_Str",field.getName());
  field.setName("String_Node_Str");
  field.applyChanges();
  assertTrue(field.toString().contains("String_Node_Str"));
  assertEquals("String_Node_Str",field.getName());
}

Fixed version (ground truth):
@Test public void testSetName() throws Exception {
  assertEquals("String_Node_Str",field.getName());
  field.setName("String_Node_Str");
  field.getOrigin();
  assertTrue(field.toString().contains("String_Node_Str"));
  assertEquals("String_Node_Str",field.getName());
}
Program: 151674
Project: 151674
Buggy source:
@Test public void testAddFieldInitializerLiteral() throws Exception {
  javaClass.addField("String_Node_Str").setLiteralInitializer("String_Node_Str").setPrivate();
  Field fld=javaClass.getFields().get(javaClass.getFields().size() - 1);
  fld.applyChanges();
  assertEquals("String_Node_Str",fld.getType());
  assertEquals("String_Node_Str",fld.getName());
  assertEquals("String_Node_Str",fld.getLiteralInitializer());
  assertEquals("String_Node_Str",fld.getStringInitializer());
  assertEquals("String_Node_Str",fld.toString().trim());
}

Fixed version (ground truth):
@Test public void testAddFieldInitializerLiteral() throws Exception {
  javaClass.addField("String_Node_Str").setLiteralInitializer("String_Node_Str").setPrivate();
  Field fld=javaClass.getFields().get(javaClass.getFields().size() - 1);
  fld.getOrigin();
  assertEquals("String_Node_Str",fld.getType());
  assertEquals("String_Node_Str",fld.getName());
  assertEquals("String_Node_Str",fld.getLiteralInitializer());
  assertEquals("String_Node_Str",fld.getStringInitializer());
  assertEquals("String_Node_Str",fld.toString().trim());
}
Program: 151675
Project: 151675
Buggy source:
@Test public void testAddField() throws Exception {
  javaClass.addField("String_Node_Str");
  Field fld=javaClass.getFields().get(javaClass.getFields().size() - 1);
  fld.applyChanges();
  assertTrue(fld.toString().contains("String_Node_Str"));
  assertEquals("String_Node_Str",fld.getType());
  assertEquals("String_Node_Str",fld.getName());
  assertEquals("String_Node_Str",fld.getLiteralInitializer());
}

Fixed version (ground truth):
@Test public void testAddField() throws Exception {
  javaClass.addField("String_Node_Str");
  Field fld=javaClass.getFields().get(javaClass.getFields().size() - 1);
  fld.getOrigin();
  assertTrue(fld.toString().contains("String_Node_Str"));
  assertEquals("String_Node_Str",fld.getType());
  assertEquals("String_Node_Str",fld.getName());
  assertEquals("String_Node_Str",fld.getLiteralInitializer());
}
Program: 151676
Project: 151676
Buggy source:
@Test public void testAddConstructorIngoresReturnTypeAndName() throws Exception {
  javaClass.addMethod().setName("String_Node_Str").setConstructor(true).setPrivate().setReturnType(String.class).setBody("String_Node_Str").applyChanges();
  Method method=javaClass.getMethods().get(javaClass.getMethods().size() - 1);
  assertEquals(3,javaClass.getMethods().size());
  assertTrue(method.isPrivate());
  assertTrue(method.isConstructor());
  assertNull(method.getReturnType());
  assertEquals(javaClass.getName(),method.getName());
  String body=method.getBody();
  assertEquals("String_Node_Str".replaceAll("String_Node_Str","String_Node_Str"),body.replaceAll("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testAddConstructorIngoresReturnTypeAndName() throws Exception {
  javaClass.addMethod().setName("String_Node_Str").setConstructor(true).setPrivate().setReturnType(String.class).setBody("String_Node_Str").getOrigin();
  Method method=javaClass.getMethods().get(javaClass.getMethods().size() - 1);
  assertEquals(3,javaClass.getMethods().size());
  assertTrue(method.isPrivate());
  assertTrue(method.isConstructor());
  assertNull(method.getReturnType());
  assertEquals(javaClass.getName(),method.getName());
  String body=method.getBody();
  assertEquals("String_Node_Str".replaceAll("String_Node_Str","String_Node_Str"),body.replaceAll("String_Node_Str","String_Node_Str"));
}
Program: 151677
Project: 151677
Buggy source:
@Test public void testCannotAddDuplicateImport() throws Exception {
  assertEquals(1,javaClass.getImports().size());
  assertFalse(javaClass.hasImport(List.class));
  javaClass.addImport(List.class).applyChanges();
  javaClass.addImport(List.class).applyChanges();
  assertEquals(2,javaClass.getImports().size());
  assertTrue(javaClass.hasImport(List.class));
}

Fixed version (ground truth):
@Test public void testCannotAddDuplicateImport() throws Exception {
  assertEquals(1,javaClass.getImports().size());
  assertFalse(javaClass.hasImport(List.class));
  javaClass.addImport(List.class).getOrigin();
  javaClass.addImport(List.class).getOrigin();
  assertEquals(2,javaClass.getImports().size());
  assertTrue(javaClass.hasImport(List.class));
}
Program: 151678
Project: 151678
Buggy source:
@Test public void testAddImportStatic() throws Exception {
  assertEquals(1,javaClass.getImports().size());
  javaClass.addImport(List.class).setStatic(true).applyChanges();
  assertEquals(2,javaClass.getImports().size());
  assertTrue(javaClass.getImports().get(1).isStatic());
}

Fixed version (ground truth):
@Test public void testAddImportStatic() throws Exception {
  assertEquals(1,javaClass.getImports().size());
  javaClass.addImport(List.class).setStatic(true).getOrigin();
  assertEquals(2,javaClass.getImports().size());
  assertTrue(javaClass.getImports().get(1).isStatic());
}
Program: 151679
Project: 151679
Buggy source:
@Test public void testRemoveMethod() throws Exception {
  List<Method> methods=javaClass.getMethods();
  javaClass.removeMethod(methods.get(0)).applyChanges();
  methods=javaClass.getMethods();
  assertEquals(1,methods.size());
}

Fixed version (ground truth):
@Test public void testRemoveMethod() throws Exception {
  List<Method> methods=javaClass.getMethods();
  javaClass.removeMethod(methods.get(0)).getOrigin();
  methods=javaClass.getMethods();
  assertEquals(1,methods.size());
}
Program: 151680
Project: 151680
Buggy source:
@Test public void testHasImport() throws Exception {
  assertEquals(1,javaClass.getImports().size());
  assertFalse(javaClass.hasImport(List.class));
  javaClass.addImport(List.class).applyChanges();
  assertEquals(2,javaClass.getImports().size());
  assertTrue(javaClass.hasImport(List.class));
}

Fixed version (ground truth):
@Test public void testHasImport() throws Exception {
  assertEquals(1,javaClass.getImports().size());
  assertFalse(javaClass.hasImport(List.class));
  javaClass.addImport(List.class).getOrigin();
  assertEquals(2,javaClass.getImports().size());
  assertTrue(javaClass.hasImport(List.class));
}
Program: 151681
Project: 151681
Buggy source:
@Test public void testAddMethodFromString() throws Exception {
  javaClass.addMethod("String_Node_Str").setPackagePrivate().applyChanges();
  List<Method> methods=javaClass.getMethods();
  assertEquals(3,methods.size());
  assertEquals("String_Node_Str",methods.get(2).getReturnType());
  assertEquals("String_Node_Str",methods.get(2).getName());
  String body=methods.get(2).getBody();
  assertEquals("String_Node_Str".replaceAll("String_Node_Str","String_Node_Str"),body.replaceAll("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testAddMethodFromString() throws Exception {
  javaClass.addMethod("String_Node_Str").setPackagePrivate().getOrigin();
  List<Method> methods=javaClass.getMethods();
  assertEquals(3,methods.size());
  assertEquals("String_Node_Str",methods.get(2).getReturnType());
  assertEquals("String_Node_Str",methods.get(2).getName());
  String body=methods.get(2).getBody();
  assertEquals("String_Node_Str".replaceAll("String_Node_Str","String_Node_Str"),body.replaceAll("String_Node_Str","String_Node_Str"));
}
Program: 151682
Project: 151682
Buggy source:
@Test public void testAddMethod() throws Exception {
  javaClass.addMethod().setName("String_Node_Str").setReturnTypeVoid().setBody("String_Node_Str").applyChanges();
  List<Method> methods=javaClass.getMethods();
  assertEquals(3,methods.size());
  assertNull(methods.get(2).getReturnType());
}

Fixed version (ground truth):
@Test public void testAddMethod() throws Exception {
  javaClass.addMethod().setName("String_Node_Str").setReturnTypeVoid().setBody("String_Node_Str").getOrigin();
  List<Method> methods=javaClass.getMethods();
  assertEquals(3,methods.size());
  assertNull(methods.get(2).getReturnType());
}
Program: 151683
Project: 151683
Buggy source:
@Test public void testAddConstructor() throws Exception {
  javaClass.addMethod().setName("String_Node_Str").setConstructor(true).setProtected().setReturnType(String.class).setBody("String_Node_Str").applyChanges();
  Method method=javaClass.getMethods().get(javaClass.getMethods().size() - 1);
  assertEquals(3,javaClass.getMethods().size());
  assertEquals(javaClass.getName(),method.getName());
  assertTrue(method.isProtected());
  assertTrue(method.isConstructor());
  assertNull(method.getReturnType());
  String body=method.getBody();
  assertEquals("String_Node_Str".replaceAll("String_Node_Str","String_Node_Str"),body.replaceAll("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testAddConstructor() throws Exception {
  javaClass.addMethod().setName("String_Node_Str").setConstructor(true).setProtected().setReturnType(String.class).setBody("String_Node_Str").getOrigin();
  Method method=javaClass.getMethods().get(javaClass.getMethods().size() - 1);
  assertEquals(3,javaClass.getMethods().size());
  assertEquals(javaClass.getName(),method.getName());
  assertTrue(method.isProtected());
  assertTrue(method.isConstructor());
  assertNull(method.getReturnType());
  String body=method.getBody();
  assertEquals("String_Node_Str".replaceAll("String_Node_Str","String_Node_Str"),body.replaceAll("String_Node_Str","String_Node_Str"));
}
Program: 151684
Project: 151684
Buggy source:
private AnnotatedParameter<Object> addUniqueQualifier(final AnnotatedMethod<Object> method,final AnnotatedParameter<Object> param,final String identifier){
  final BusManaged qualifier=new BusManaged(){
    @Override public Class<? extends Annotation> annotationType(){
      return BusManaged.class;
    }
    @Override public String value(){
      return identifier;
    }
  }
;
  addQualifierToMap(method,param,qualifier);
  final Set<Annotation> annotations=new HashSet<Annotation>();
  annotations.addAll(param.getAnnotations());
  annotations.add(qualifier);
  return new AnnotatedParameter<Object>(){
    @Override @SuppressWarnings("String_Node_Str") public <T extends Annotation>T getAnnotation(    final Class<T> clazz){
      if (BusManaged.class.isAssignableFrom(clazz)) {
        return (T)qualifier;
      }
      return param.getAnnotation(clazz);
    }
    @Override public Set<Annotation> getAnnotations(){
      return annotations;
    }
    @Override public Type getBaseType(){
      return param.getBaseType();
    }
    @Override public Set<Type> getTypeClosure(){
      return param.getTypeClosure();
    }
    @Override public boolean isAnnotationPresent(    final Class<? extends Annotation> clazz){
      if (BusManaged.class.isAssignableFrom(clazz)) {
        return true;
      }
      return param.isAnnotationPresent(clazz);
    }
    @Override public AnnotatedCallable<Object> getDeclaringCallable(){
      return param.getDeclaringCallable();
    }
    @Override public int getPosition(){
      return param.getPosition();
    }
  }
;
}

Fixed version (ground truth):
private AnnotatedParameter addUniqueQualifier(final AnnotatedMethod method,final AnnotatedParameter param,final String identifier){
  final BusManaged qualifier=new BusManaged(){
    @Override public Class<? extends Annotation> annotationType(){
      return BusManaged.class;
    }
    @Override public String value(){
      return identifier;
    }
  }
;
  addQualifierToMap(method,param,qualifier);
  final Set<Annotation> annotations=new HashSet<Annotation>();
  annotations.addAll(param.getAnnotations());
  annotations.add(qualifier);
  return new AnnotatedParameter<Object>(){
    @Override public <T extends Annotation>T getAnnotation(    final Class<T> clazz){
      if (BusManaged.class.isAssignableFrom(clazz)) {
        return (T)qualifier;
      }
      return param.getAnnotation(clazz);
    }
    @Override public Set<Annotation> getAnnotations(){
      return annotations;
    }
    @Override public Type getBaseType(){
      return param.getBaseType();
    }
    @Override public Set<Type> getTypeClosure(){
      return param.getTypeClosure();
    }
    @Override public boolean isAnnotationPresent(    final Class<? extends Annotation> clazz){
      if (BusManaged.class.isAssignableFrom(clazz)) {
        return true;
      }
      return param.isAnnotationPresent(clazz);
    }
    @Override public AnnotatedCallable<Object> getDeclaringCallable(){
      return param.getDeclaringCallable();
    }
    @Override public int getPosition(){
      return param.getPosition();
    }
  }
;
}
Program: 151685
Project: 151685
Buggy source:
public void scan(@Observes final ProcessAnnotatedType<Object> event){
  AnnotatedType<Object> originalType=event.getAnnotatedType();
  AnnotatedType<Object> newType=originalType;
  List<AnnotatedMethod<Object>> obsoleteMethods=new ArrayList<AnnotatedMethod<Object>>();
  List<AnnotatedMethod<Object>> replacementMethods=new ArrayList<AnnotatedMethod<Object>>();
  for (  AnnotatedMethod<Object> method : originalType.getMethods()) {
    for (    AnnotatedParameter<Object> param : method.getParameters()) {
      if (param.isAnnotationPresent(Observes.class)) {
        if (param.getTypeClosure().contains(BaseEvent.class)) {
          replacementMethods.add(qualifyObservedEvent(method,param));
          obsoleteMethods.add(method);
        }
      }
    }
  }
  newType=removeMethodsFromType(originalType,obsoleteMethods);
  newType=addReplacementMethodsToType(newType,replacementMethods);
  event.setAnnotatedType(newType);
}

Fixed version (ground truth):
public void scan(@Observes final ProcessAnnotatedType<Object> event){
  AnnotatedType<Object> originalType=event.getAnnotatedType();
  AnnotatedType<Object> newType=originalType;
  List<AnnotatedMethod> obsoleteMethods=new ArrayList<AnnotatedMethod>();
  List<AnnotatedMethod> replacementMethods=new ArrayList<AnnotatedMethod>();
  for (  AnnotatedMethod<?> method : originalType.getMethods()) {
    for (    AnnotatedParameter<?> param : method.getParameters()) {
      if (param.isAnnotationPresent(Observes.class)) {
        if (param.getTypeClosure().contains(BaseEvent.class)) {
          replacementMethods.add(qualifyObservedEvent(method,param));
          obsoleteMethods.add(method);
        }
      }
    }
  }
  newType=removeMethodsFromType(originalType,obsoleteMethods);
  newType=addReplacementMethodsToType(newType,replacementMethods);
  event.setAnnotatedType(newType);
}
Program: 151686
Project: 151686
Buggy source:
private void addQualifierToMap(final AnnotatedMethod<Object> annotatedMethod,final AnnotatedParameter<Object> param,final BusManaged qualifier){
  Method method=annotatedMethod.getJavaMember();
  Class<?> clazz=method.getParameterTypes()[param.getPosition()];
  List<BusManaged> qualifiers=eventQualifierMap.get(clazz);
  if (qualifiers == null) {
    qualifiers=new ArrayList<BusManaged>();
  }
  qualifiers.add(qualifier);
  eventQualifierMap.put(clazz,qualifiers);
}

Fixed version (ground truth):
private void addQualifierToMap(final AnnotatedMethod annotatedMethod,final AnnotatedParameter param,final BusManaged qualifier){
  Method method=annotatedMethod.getJavaMember();
  Class<?> clazz=method.getParameterTypes()[param.getPosition()];
  List<BusManaged> qualifiers=eventQualifierMap.get(clazz);
  if (qualifiers == null) {
    qualifiers=new ArrayList<BusManaged>();
  }
  qualifiers.add(qualifier);
  eventQualifierMap.put(clazz,qualifiers);
}
Program: 151687
Project: 151687
Buggy source:
public Set<AnnotatedConstructor<Object>> getConstructors(){
  return type.getConstructors();
}

Fixed version (ground truth):
@Override public Set<AnnotatedConstructor> getConstructors(){
  return type.getConstructors();
}
Program: 151688
Project: 151688
Buggy source:
private AnnotatedType<Object> removeMethodsFromType(final AnnotatedType<Object> type,final List<AnnotatedMethod<Object>> targetedMethods){
  final Set<AnnotatedMethod<? super Object>> methods=new HashSet<AnnotatedMethod<? super Object>>();
  methods.addAll(type.getMethods());
  methods.removeAll(targetedMethods);
  return new AnnotatedType<Object>(){
    public Class<Object> getJavaClass(){
      return type.getJavaClass();
    }
    public Set<AnnotatedConstructor<Object>> getConstructors(){
      return type.getConstructors();
    }
    public Set<AnnotatedMethod<? super Object>> getMethods(){
      return methods;
    }
    public Set<AnnotatedField<? super Object>> getFields(){
      return type.getFields();
    }
    public Type getBaseType(){
      return type.getBaseType();
    }
    public Set<Type> getTypeClosure(){
      return type.getTypeClosure();
    }
    public <T extends Annotation>T getAnnotation(    final Class<T> annotationType){
      return type.getAnnotation(annotationType);
    }
    public Set<Annotation> getAnnotations(){
      return type.getAnnotations();
    }
    public boolean isAnnotationPresent(    final Class<? extends Annotation> annotationType){
      return type.isAnnotationPresent(annotationType);
    }
  }
;
}

Fixed version (ground truth):
private AnnotatedType<Object> removeMethodsFromType(final AnnotatedType type,final List<AnnotatedMethod> targetedMethods){
  final Set<AnnotatedMethod> methods=new HashSet<AnnotatedMethod>();
  methods.addAll(type.getMethods());
  methods.removeAll(targetedMethods);
  return new AnnotatedType(){
    @Override public Class getJavaClass(){
      return type.getJavaClass();
    }
    @Override public Set<AnnotatedConstructor> getConstructors(){
      return type.getConstructors();
    }
    @Override public Set<AnnotatedMethod> getMethods(){
      return methods;
    }
    @Override public Set<AnnotatedField> getFields(){
      return type.getFields();
    }
    @Override public Type getBaseType(){
      return type.getBaseType();
    }
    @Override public Set<Type> getTypeClosure(){
      return type.getTypeClosure();
    }
    @Override public <T extends Annotation>T getAnnotation(    final Class<T> annotationType){
      return type.getAnnotation(annotationType);
    }
    @Override public Set<Annotation> getAnnotations(){
      return type.getAnnotations();
    }
    @Override public boolean isAnnotationPresent(    final Class<? extends Annotation> annotationType){
      return type.isAnnotationPresent(annotationType);
    }
  }
;
}
Program: 151689
Project: 151689
Buggy source:
public Class<Object> getJavaClass(){
  return type.getJavaClass();
}

Fixed version (ground truth):
@Override public Class getJavaClass(){
  return type.getJavaClass();
}
Program: 151690
Project: 151690
Buggy source:
private AnnotatedMethod<Object> qualifyObservedEvent(final AnnotatedMethod<Object> method,final AnnotatedParameter<Object> param){
  final List<AnnotatedParameter<Object>> parameters=new ArrayList<AnnotatedParameter<Object>>();
  parameters.addAll(method.getParameters());
  parameters.remove(param);
  parameters.add(addUniqueQualifier(method,param,method.toString()));
  return new AnnotatedMethod<Object>(){
    @Override public List<AnnotatedParameter<Object>> getParameters(){
      return parameters;
    }
    @Override public AnnotatedType<Object> getDeclaringType(){
      return method.getDeclaringType();
    }
    @Override public boolean isStatic(){
      return method.isStatic();
    }
    @Override public <T extends Annotation>T getAnnotation(    final Class<T> annotation){
      return method.getAnnotation(annotation);
    }
    @Override public Set<Annotation> getAnnotations(){
      return method.getAnnotations();
    }
    @Override public Type getBaseType(){
      return method.getBaseType();
    }
    @Override public Set<Type> getTypeClosure(){
      return method.getTypeClosure();
    }
    @Override public boolean isAnnotationPresent(    final Class<? extends Annotation> annotation){
      return method.isAnnotationPresent(annotation);
    }
    @Override public Method getJavaMember(){
      return method.getJavaMember();
    }
  }
;
}

Fixed version (ground truth):
private AnnotatedMethod<Object> qualifyObservedEvent(final AnnotatedMethod method,final AnnotatedParameter param){
  final List<AnnotatedParameter> parameters=new ArrayList<AnnotatedParameter>();
  parameters.addAll(method.getParameters());
  parameters.remove(param);
  parameters.add(addUniqueQualifier(method,param,method.toString()));
  return new AnnotatedMethod(){
    @Override public List<AnnotatedParameter> getParameters(){
      return parameters;
    }
    @Override public AnnotatedType<Object> getDeclaringType(){
      return method.getDeclaringType();
    }
    @Override public boolean isStatic(){
      return method.isStatic();
    }
    @Override public <T extends Annotation>T getAnnotation(    final Class<T> annotation){
      return method.getAnnotation(annotation);
    }
    @Override public Set<Annotation> getAnnotations(){
      return method.getAnnotations();
    }
    @Override public Type getBaseType(){
      return method.getBaseType();
    }
    @Override public Set<Type> getTypeClosure(){
      return method.getTypeClosure();
    }
    @Override public boolean isAnnotationPresent(    final Class<? extends Annotation> annotation){
      return method.isAnnotationPresent(annotation);
    }
    @Override public Method getJavaMember(){
      return method.getJavaMember();
    }
  }
;
}
Program: 151691
Project: 151691
Buggy source:
private AnnotatedType<Object> addReplacementMethodsToType(final AnnotatedType<Object> newType,final List<AnnotatedMethod<Object>> replacementMethods){
  newType.getMethods().addAll(replacementMethods);
  return newType;
}

Fixed version (ground truth):
private AnnotatedType<Object> addReplacementMethodsToType(final AnnotatedType newType,final List<AnnotatedMethod> replacementMethods){
  newType.getMethods().addAll(replacementMethods);
  return newType;
}
Program: 151692
Project: 151692
Buggy source:
public Set<AnnotatedField<? super Object>> getFields(){
  return type.getFields();
}

Fixed version (ground truth):
@Override public Set<AnnotatedField> getFields(){
  return type.getFields();
}
Program: 151693
Project: 151693
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public <T extends Annotation>T getAnnotation(final Class<T> clazz){
  if (BusManaged.class.isAssignableFrom(clazz)) {
    return (T)qualifier;
  }
  return param.getAnnotation(clazz);
}

Fixed version (ground truth):
@Override public <T extends Annotation>T getAnnotation(final Class<T> clazz){
  if (BusManaged.class.isAssignableFrom(clazz)) {
    return (T)qualifier;
  }
  return param.getAnnotation(clazz);
}
Program: 151694
Project: 151694
Buggy source:
@Override public List<AnnotatedParameter<Object>> getParameters(){
  return parameters;
}

Fixed version (ground truth):
@Override public List<AnnotatedParameter> getParameters(){
  return parameters;
}
Program: 151695
Project: 151695
Buggy source:
public Set<AnnotatedMethod<? super Object>> getMethods(){
  return methods;
}

Fixed version (ground truth):
@Override public Set<AnnotatedMethod> getMethods(){
  return methods;
}
Program: 151696
Project: 151696
Buggy source:
public List<BusManaged> getEventQualifiers(final Class<? extends BaseEvent> class1){
  List<BusManaged> result=new ArrayList<BusManaged>();
  for (  Entry<Class<?>,List<BusManaged>> entry : eventQualifierMap.entrySet()) {
    Class<?> key=entry.getKey();
    List<BusManaged> value=entry.getValue();
    if (key.isAssignableFrom(class1)) {
      result=value;
    }
  }
  return result;
}

Fixed version (ground truth):
public List<BusManaged> getEventQualifiers(final Class<? extends BaseEvent> class1){
  List<BusManaged> result=new ArrayList<BusManaged>();
  for (  Entry<Class<?>,List<BusManaged>> entry : eventQualifierMap.entrySet()) {
    Class<?> key=entry.getKey();
    List<BusManaged> value=entry.getValue();
    if (key.isAssignableFrom(class1)) {
      result.addAll(value);
    }
  }
  return result;
}
Program: 151697
Project: 151697
Buggy source:
private void initProject(){
  writeVerbose("String_Node_Str" + parameters);
  String projectPath="String_Node_Str";
  if ((parameters != null) && !parameters.isEmpty()) {
    for (    String path : parameters) {
      if ((path != null) && !path.startsWith("String_Node_Str") && !path.startsWith("String_Node_Str")) {
        projectPath=path;
        break;
      }
    }
  }
  writeVerbose("String_Node_Str" + projectPath);
  File targetDirectory=new File(projectPath);
  if (targetDirectory.exists()) {
    currentProject=new MavenProject(new File(projectPath));
    if (currentProject.exists()) {
      prompt=currentProject.getPOM().getArtifactId() + "String_Node_Str";
      reader.setPrompt(prompt);
    }
  }
 else {
    write("String_Node_Str" + targetDirectory.getAbsolutePath() + "String_Node_Str");
    shutdown.fire(Shutdown.ERROR);
  }
}

Fixed version (ground truth):
private void initProject(){
  writeVerbose("String_Node_Str" + parameters);
  String projectPath="String_Node_Str";
  if ((parameters != null) && !parameters.isEmpty()) {
    for (    String path : parameters) {
      if ((path != null) && !path.startsWith("String_Node_Str") && !path.startsWith("String_Node_Str")) {
        projectPath=path;
        break;
      }
    }
  }
  File targetDirectory=new File(projectPath).getAbsoluteFile();
  writeVerbose("String_Node_Str" + targetDirectory.getAbsolutePath() + "String_Node_Str");
  if (targetDirectory.exists()) {
    currentProject=new MavenProject(targetDirectory);
    if (currentProject.exists()) {
      prompt=currentProject.getPOM().getArtifactId() + "String_Node_Str";
      reader.setPrompt(prompt);
    }
  }
 else {
    write("String_Node_Str" + targetDirectory.getAbsolutePath() + "String_Node_Str");
    shutdown.fire(Shutdown.ERROR);
  }
}
Program: 151698
Project: 151698
Buggy source:
@DefaultCommand public void listCommands(){
  for (  PluginMetadata pluginMetaData : registry.getPlugins().values()) {
    for (    CommandMetadata commandMetadata : pluginMetaData.getCommands()) {
      for (      String commandName : commandMetadata.getNames()) {
        shell.print(commandName);
        shell.print("String_Node_Str");
      }
    }
  }
  shell.println();
}

Fixed version (ground truth):
@DefaultCommand public void listCommands(){
  for (  PluginMetadata pluginMetaData : registry.getPlugins().values()) {
    for (    CommandMetadata commandMetadata : pluginMetaData.getCommands()) {
      shell.print(commandMetadata.getName());
      shell.print("String_Node_Str");
    }
  }
  shell.println();
}
Program: 151699
Project: 151699
Buggy source:
@Inject public ListCommandsPlugin(PluginRegistry registry,Shell shell){
  this.registry=registry;
  this.shell=shell;
}

Fixed version (ground truth):
@Inject public ListCommandsPlugin(final PluginRegistry registry,final Shell shell){
  this.registry=registry;
  this.shell=shell;
}