nus-yam/ex-repair huggingface dataset:
Program: 2318
Project: 2318
Buggy source:
private EndpointGraph getEndointGraph(Job job,GProtocolName fullname,Role role) throws ScribbleException {
  JobContext jcontext=job.getContext();
  GProtocolDecl gpd=(GProtocolDecl)jcontext.getMainModule().getProtocolDecl(fullname.getSimpleName());
  if (gpd == null || !gpd.header.roledecls.getRoles().contains(role)) {
    throw new RuntimeException("String_Node_Str" + Arrays.toString(this.args.get(ArgFlag.FSM)));
  }
  EndpointGraph fsm=jcontext.getEndpointGraph(fullname,role);
  if (fsm == null) {
    throw new ScribbleException("String_Node_Str" + fullname);
  }
  return fsm;
}

Fixed version (ground truth):
private EndpointGraph getEndointGraph(Job job,GProtocolName fullname,Role role) throws ScribbleException {
  JobContext jcontext=job.getContext();
  GProtocolDecl gpd=(GProtocolDecl)jcontext.getMainModule().getProtocolDecl(fullname.getSimpleName());
  if (gpd == null || !gpd.header.roledecls.getRoles().contains(role)) {
    throw new RuntimeException("String_Node_Str" + Arrays.toString(this.args.get(ArgFlag.FSM)));
  }
  EndpointGraph fsm=this.args.containsKey(ArgFlag.MIN_EFSM) ? jcontext.getMinimisedEndpointGraph(fullname,role) : jcontext.getEndpointGraph(fullname,role);
  if (fsm == null) {
    throw new ScribbleException("String_Node_Str" + fullname);
  }
  return fsm;
}
Program: 2320
Project: 2320
Buggy source:
public MainContext(boolean debug,ResourceLocator locator,Path mainpath,boolean useOldWF,boolean noLiveness){
  this.debug=debug;
  this.useOldWF=useOldWF;
  this.noLiveness=noLiveness;
  this.antlrParser=new AntlrParser();
  this.scribParser=new ScribParser();
  this.locator=locator;
  this.loader=new ScribModuleLoader(this.locator,this.antlrParser,this.scribParser);
  Pair<Resource,Module> p=loadMainModule(mainpath);
  this.main=p.right.getFullModuleName();
  loadAllModules(p);
}

Fixed version (ground truth):
public MainContext(boolean debug,ResourceLocator locator,Path mainpath,boolean useOldWF,boolean noLiveness,boolean minEfsm){
  this.debug=debug;
  this.useOldWF=useOldWF;
  this.noLiveness=noLiveness;
  this.minEfsm=minEfsm;
  this.antlrParser=new AntlrParser();
  this.scribParser=new ScribParser();
  this.locator=locator;
  this.loader=new ScribModuleLoader(this.locator,this.antlrParser,this.scribParser);
  Pair<Resource,Module> p=loadMainModule(mainpath);
  this.main=p.right.getFullModuleName();
  loadAllModules(p);
}
Program: 2321
Project: 2321
Buggy source:
public StateChannelApiGenerator(Job job,GProtocolName fullname,Role self){
  super(job,fullname);
  this.self=self;
  this.lpn=Projector.projectFullProtocolName(fullname,self);
  JobContext jc=job.getContext();
  EndpointGraph minimised=jc.getMinimisedEndpointGraph(fullname,self);
  if (minimised == null) {
    try {
      String aut=runAut(jc.getEndpointGraph(fullname,self).init.toAut(),lpn + "String_Node_Str");
      minimised=new AutParser().parse(aut);
      jc.addMinimisedEndpointGraph(lpn,minimised);
    }
 catch (    ScribbleException e) {
      throw new RuntimeException(e);
    }
  }
  this.init=minimised.init;
  generateClassNames(this.init);
  constructClasses(this.init);
  EndpointState term=EndpointState.getTerminal(this.init);
  if (term != null) {
    ClassBuilder cb=new EndSocketGenerator(this,term).generateType();
    this.types.put(cb.getName(),cb);
  }
}

Fixed version (ground truth):
public StateChannelApiGenerator(Job job,GProtocolName fullname,Role self){
  super(job,fullname);
  this.self=self;
  this.lpn=Projector.projectFullProtocolName(fullname,self);
  JobContext jc=job.getContext();
  this.init=job.minEfsm ? jc.getMinimisedEndpointGraph(fullname,self).init : jc.getEndpointGraph(fullname,self).init;
  generateClassNames(this.init);
  constructClasses(this.init);
  EndpointState term=EndpointState.getTerminal(this.init);
  if (term != null) {
    ClassBuilder cb=new EndSocketGenerator(this,term).generateType();
    this.types.put(cb.getName(),cb);
  }
}
Program: 2323
Project: 2323
Buggy source:
public String toAut(){
  Set<S> all=getAllReachable((S)this);
  String aut="String_Node_Str";
  int edges=0;
  Set<Integer> seen=new HashSet<>();
  for (  S s : all) {
    if (seen.contains(s.id)) {
      continue;
    }
    seen.add(s.id);
    Iterator<A> as=s.getAllTakeable().iterator();
    Iterator<S> ss=s.getSuccessors().iterator();
    for (; as.hasNext(); edges++) {
      A a=as.next();
      S succ=ss.next();
      aut+="String_Node_Str" + s.id + "String_Node_Str"+ a+ "String_Node_Str"+ succ.id+ "String_Node_Str";
    }
  }
  return "String_Node_Str" + this.id + "String_Node_Str"+ edges+ "String_Node_Str"+ all.size()+ "String_Node_Str"+ aut+ "String_Node_Str";
}

Fixed version (ground truth):
public String toAut(){
  Set<S> all=new HashSet<>();
  all.add((S)this);
  all.addAll(getAllReachable((S)this));
  String aut="String_Node_Str";
  int edges=0;
  Set<Integer> seen=new HashSet<>();
  for (  S s : all) {
    if (seen.contains(s.id)) {
      continue;
    }
    seen.add(s.id);
    Iterator<A> as=s.getAllTakeable().iterator();
    Iterator<S> ss=s.getSuccessors().iterator();
    for (; as.hasNext(); edges++) {
      A a=as.next();
      S succ=ss.next();
      aut+="String_Node_Str" + s.id + "String_Node_Str"+ a+ "String_Node_Str"+ succ.id+ "String_Node_Str";
    }
  }
  return "String_Node_Str" + this.id + "String_Node_Str"+ edges+ "String_Node_Str"+ all.size()+ "String_Node_Str"+ aut+ "String_Node_Str";
}
Program: 2324
Project: 2324
Buggy source:
public Job(boolean debug,Map<ModuleName,Module> parsed,ModuleName main,boolean useOldWF,boolean noLiveness){
  this.debug=debug;
  this.useOldWf=useOldWF;
  this.noLiveness=noLiveness;
  this.jcontext=new JobContext(parsed,main);
}

Fixed version (ground truth):
public Job(boolean debug,Map<ModuleName,Module> parsed,ModuleName main,boolean useOldWF,boolean noLiveness,boolean minEfsm){
  this.debug=debug;
  this.useOldWf=useOldWF;
  this.noLiveness=noLiveness;
  this.minEfsm=minEfsm;
  this.jcontext=new JobContext(parsed,main);
}
Program: 2325
Project: 2325
Buggy source:
public EndpointGraph getMinimisedEndpointGraph(LProtocolName fullname){
  return this.minimised.get(fullname);
}

Fixed version (ground truth):
public EndpointGraph getMinimisedEndpointGraph(LProtocolName fullname){
  EndpointGraph minimised=this.minimised.get(fullname);
  if (minimised == null) {
    try {
      EndpointGraph tmp=getEndpointGraph(fullname);
      String aut=tmp.init.toAut();
      aut=runAut(aut,fullname + "String_Node_Str");
      minimised=new AutParser().parse(aut);
      addMinimisedEndpointGraph(fullname,minimised);
    }
 catch (    ScribbleException e) {
      throw new RuntimeException(e);
    }
  }
  return minimised;
}
Program: 2326
Project: 2326
Buggy source:
@Test public void tests() throws Exception {
  MainContext mc=newMainContext();
  Job job=new Job(mc.debug,mc.getParsedModules(),mc.main,mc.useOldWF,mc.noLiveness);
  ScribbleException x=job.testWellFormednessCheck();
  if (!hasErrors && x != null) {
    throw x;
  }
 else   if (hasErrors && x == null) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void tests() throws Exception {
  MainContext mc=newMainContext();
  Job job=new Job(mc.debug,mc.getParsedModules(),mc.main,mc.useOldWF,mc.noLiveness,mc.minEfsm);
  ScribbleException x=job.testWellFormednessCheck();
  if (!hasErrors && x != null) {
    throw x;
  }
 else   if (hasErrors && x == null) {
    fail("String_Node_Str");
  }
}
Program: 2327
Project: 2327
Buggy source:
private MainContext newMainContext(){
  boolean debug=false;
  boolean useOldWF=false;
  boolean noLiveness=false;
  Path mainpath=Paths.get(filename);
  List<Path> impaths=new ArrayList<Path>();
  URL url=ClassLoader.getSystemResource("String_Node_Str");
  String dir=url.getFile().substring(0,url.getFile().length() - 5);
  impaths.add(Paths.get(dir));
  ResourceLocator locator=new DirectoryResourceLocator(impaths);
  return new MainContext(debug,locator,mainpath,useOldWF,noLiveness);
}

Fixed version (ground truth):
private MainContext newMainContext(){
  boolean debug=false;
  boolean useOldWF=false;
  boolean noLiveness=false;
  boolean minEfsm=false;
  Path mainpath=Paths.get(filename);
  List<Path> impaths=new ArrayList<Path>();
  URL url=ClassLoader.getSystemResource("String_Node_Str");
  String dir=url.getFile().substring(0,url.getFile().length() - 5);
  impaths.add(Paths.get(dir));
  ResourceLocator locator=new DirectoryResourceLocator(impaths);
  return new MainContext(debug,locator,mainpath,useOldWF,noLiveness,minEfsm);
}
Program: 2328
Project: 2328
Buggy source:
public String toAut(){
  Set<S> all=new HashSet<>();
  all.add((S)this);
  all.addAll(getAllReachable((S)this));
  String aut="String_Node_Str";
  int edges=0;
  Set<Integer> seen=new HashSet<>();
  for (  S s : all) {
    if (seen.contains(s.id)) {
      continue;
    }
    seen.add(s.id);
    Iterator<A> as=s.getAllTakeable().iterator();
    Iterator<S> ss=s.getSuccessors().iterator();
    for (; as.hasNext(); edges++) {
      A a=as.next();
      S succ=ss.next();
      aut+="String_Node_Str" + s.id + "String_Node_Str"+ a+ "String_Node_Str"+ succ.id+ "String_Node_Str";
    }
  }
  return "String_Node_Str" + this.id + "String_Node_Str"+ edges+ "String_Node_Str"+ all.size()+ "String_Node_Str"+ aut+ "String_Node_Str";
}

Fixed version (ground truth):
public String toAut(){
  Set<S> all=new HashSet<>();
  all.add((S)this);
  all.addAll(getAllReachable((S)this));
  String aut="String_Node_Str";
  int edges=0;
  Set<Integer> seen=new HashSet<>();
  for (  S s : all) {
    if (seen.contains(s.id)) {
      continue;
    }
    seen.add(s.id);
    Iterator<A> as=s.getAllTakeable().iterator();
    Iterator<S> ss=s.getSuccessors().iterator();
    for (; as.hasNext(); edges++) {
      A a=as.next();
      S succ=ss.next();
      String msg=a.toStringWithMessageIdHack();
      aut+="String_Node_Str" + s.id + "String_Node_Str"+ msg+ "String_Node_Str"+ succ.id+ "String_Node_Str";
    }
  }
  return "String_Node_Str" + this.id + "String_Node_Str"+ edges+ "String_Node_Str"+ all.size()+ "String_Node_Str"+ aut+ "String_Node_Str";
}
Program: 2329
Project: 2329
Buggy source:
private static IOAction parseIOAction(String a){
  String peer;
  String action;
  String op;
  String[] pay=null;
  int i=a.indexOf("String_Node_Str");
  i=(i == -1) ? a.indexOf("String_Node_Str") : i;
  int j=i + 1;
  String tmp=a.substring(j,j + 1);
  if (tmp.equals("String_Node_Str") || tmp.equals("String_Node_Str")) {
    j++;
  }
  action=a.substring(i,j);
  peer=a.substring(0,i);
  int k=a.indexOf("String_Node_Str");
  op=a.substring(j,k);
  String p=a.substring(k + 1,a.length() - 1);
  if (!p.isEmpty()) {
    pay=p.split("String_Node_Str");
  }
switch (action) {
case "String_Node_Str":
{
      Payload payload=(pay != null) ? new Payload(Arrays.asList(pay).stream().map((pe) -> new DataType(pe)).collect(Collectors.toList())) : Payload.EMPTY_PAYLOAD;
      return new Send(new Role(peer),new Op(op),payload);
    }
case "String_Node_Str":
{
    Payload payload=(pay != null) ? new Payload(Arrays.asList(pay).stream().map((pe) -> new DataType(pe)).collect(Collectors.toList())) : Payload.EMPTY_PAYLOAD;
    return new Receive(new Role(peer),new Op(op),payload);
  }
case "String_Node_Str":
{
  return new Connect(new Role(peer));
}
case "String_Node_Str":
{
return new Accept(new Role(peer));
}
default :
{
throw new RuntimeException("String_Node_Str" + op);
}
}
}

Fixed version (ground truth):
private static IOAction parseIOAction(String a){
  String peer;
  String action;
  String msg;
  String[] pay=null;
  int i=a.indexOf("String_Node_Str");
  i=(i == -1) ? a.indexOf("String_Node_Str") : i;
  int j=i + 1;
  String tmp=a.substring(j,j + 1);
  if (tmp.equals("String_Node_Str") || tmp.equals("String_Node_Str")) {
    j++;
  }
  action=a.substring(i,j);
  peer=a.substring(0,i);
  int k=a.indexOf("String_Node_Str");
  msg=a.substring(j,k);
  String p=a.substring(k + 1,a.length() - 1);
  if (!p.isEmpty()) {
    pay=p.split("String_Node_Str");
  }
switch (action) {
case "String_Node_Str":
{
      Payload payload=(pay != null) ? new Payload(Arrays.asList(pay).stream().map((pe) -> new DataType(pe)).collect(Collectors.toList())) : Payload.EMPTY_PAYLOAD;
      return new Send(new Role(peer),getMessageIdHack(msg),payload);
    }
case "String_Node_Str":
{
    Payload payload=(pay != null) ? new Payload(Arrays.asList(pay).stream().map((pe) -> new DataType(pe)).collect(Collectors.toList())) : Payload.EMPTY_PAYLOAD;
    return new Receive(new Role(peer),getMessageIdHack(msg),payload);
  }
case "String_Node_Str":
{
  return new Connect(new Role(peer));
}
case "String_Node_Str":
{
return new Accept(new Role(peer));
}
default :
{
throw new RuntimeException("String_Node_Str" + msg);
}
}
}
Program: 2332
Project: 2332
Buggy source:
private ClassBuilder constructClass(EndpointState curr){
  Set<IOAction> as=curr.getTakeable();
  IOAction a=as.iterator().next();
  if (a instanceof Send) {
    return new SendSocketGenerator(this,curr).generateType();
  }
 else   if (a instanceof Receive) {
    return (as.size() > 1) ? new BranchSocketGenerator(this,curr).generateType() : new ReceiveSocketGenerator(this,curr).generateType();
  }
 else {
    throw new RuntimeException("String_Node_Str" + curr);
  }
}

Fixed version (ground truth):
private ClassBuilder constructClass(EndpointState curr){
switch (curr.getStateKind()) {
case OUTPUT:
{
      Set<IOAction> as=curr.getTakeable();
      if (as.stream().allMatch((a) -> a.isSend())) {
        return new SendSocketGenerator(this,curr).generateType();
      }
      throw new RuntimeException("String_Node_Str" + curr.toLongString());
    }
case ACCEPT:
{
    throw new RuntimeException("String_Node_Str" + curr.toLongString());
  }
case UNARY_INPUT:
{
  return new ReceiveSocketGenerator(this,curr).generateType();
}
case POLY_INPUT:
{
return new BranchSocketGenerator(this,curr).generateType();
}
default :
{
throw new RuntimeException("String_Node_Str" + curr.toLongString());
}
}
}
Program: 2333
Project: 2333
Buggy source:
public Set<A> getTakeable(){
  Set<A> as=new HashSet<>(this.actions);
  if (as.size() != this.actions.size()) {
    throw new RuntimeException("String_Node_Str" + this.actions);
  }
  return as;
}

Fixed version (ground truth):
public Set<A> getTakeable(){
  Set<A> as=new HashSet<>(this.actions);
  if (as.size() != this.actions.size()) {
    throw new RuntimeException("String_Node_Str" + this.actions + "String_Node_Str");
  }
  return as;
}
Program: 2335
Project: 2335
Buggy source:
@Override public ScribNode visit(ScribNode parent,ScribNode child) throws ScribbleException {
  if (child instanceof GProtocolDecl) {
    GProtocolDecl gpd=(GProtocolDecl)child;
    if (gpd.isAuxModifier()) {
      return child;
    }
  }
  if (child instanceof Choice<?>) {
    return visitOverrideForChoice((InteractionSeq<?>)parent,(Choice<?>)child);
  }
 else {
    return super.visit(parent,child);
  }
}

Fixed version (ground truth):
@Override public ScribNode visit(ScribNode parent,ScribNode child) throws ScribbleException {
  if (child instanceof GProtocolDecl) {
    GProtocolDecl gpd=(GProtocolDecl)child;
    if (gpd.isAuxModifier()) {
      return child;
    }
  }
  if (getJob().useOldWf) {
    if (child instanceof Choice<?>) {
      return visitOverrideForChoice((InteractionSeq<?>)parent,(Choice<?>)child);
    }
  }
  return super.visit(parent,child);
}
Program: 2336
Project: 2336
Buggy source:
private EndpointGraph getEndointGraph(Job job,GProtocolName fullname,Role role) throws ScribbleException {
  JobContext jcontext=job.getContext();
  GProtocolDecl gpd=(GProtocolDecl)jcontext.getMainModule().getProtocolDecl(fullname.getSimpleName());
  if (gpd == null || !gpd.header.roledecls.getRoles().contains(role)) {
    throw new RuntimeException("String_Node_Str" + Arrays.toString(this.args.get(ArgFlag.FSM)));
  }
  EndpointGraph fsm=this.args.containsKey(ArgFlag.MIN_EFSM) ? jcontext.getMinimisedEndpointGraph(fullname,role) : jcontext.getEndpointGraph(fullname,role);
  if (fsm == null) {
    throw new ScribbleException("String_Node_Str" + fullname);
  }
  return fsm;
}

Fixed version (ground truth):
private EndpointGraph getEndointGraph(Job job,GProtocolName fullname,Role role) throws ScribbleException {
  JobContext jcontext=job.getContext();
  GProtocolDecl gpd=(GProtocolDecl)jcontext.getMainModule().getProtocolDecl(fullname.getSimpleName());
  if (gpd == null || !gpd.header.roledecls.getRoles().contains(role)) {
    throw new RuntimeException("String_Node_Str" + Arrays.toString(this.args.get(ArgFlag.FSM)));
  }
  EndpointGraph fsm=this.args.containsKey(ArgFlag.MIN_EFSM) ? jcontext.getMinimisedEndpointGraph(fullname,role) : jcontext.getEndpointGraph(fullname,role);
  if (fsm == null) {
    throw new ScribbleException("String_Node_Str" + fullname);
  }
  System.out.println("String_Node_Str" + fsm.init.unfairClone().toDot());
  return fsm;
}
Program: 2337
Project: 2337
Buggy source:
public static <A extends ModelAction<K>,S extends ModelState<A,S,K>,K extends ProtocolKind>S getTerminal(S start){
  Set<S> terms=getAllReachable(start).stream().filter((s) -> s.isTerminal()).collect(Collectors.toSet());
  if (terms.size() > 1) {
    throw new RuntimeException("String_Node_Str" + terms);
  }
  return (terms.isEmpty()) ? null : terms.iterator().next();
}

Fixed version (ground truth):
public static <A extends ModelAction<K>,S extends ModelState<A,S,K>,K extends ProtocolKind>S getTerminal(S start){
  if (start.isTerminal()) {
    return start;
  }
  Set<S> terms=getAllReachable(start).stream().filter((s) -> s.isTerminal()).collect(Collectors.toSet());
  if (terms.size() > 1) {
    throw new RuntimeException("String_Node_Str" + terms);
  }
  return (terms.isEmpty()) ? null : terms.iterator().next();
}
Program: 2338
Project: 2338
Buggy source:
public static <A extends ModelAction<K>,S extends ModelState<A,S,K>,K extends ProtocolKind>Set<A> getAllReachableActions(S start){
  Set<S> all=getAllReachable(start);
  Set<A> as=new HashSet<>();
  for (  S s : all) {
    as.addAll(s.getAllTakeable());
  }
  return as;
}

Fixed version (ground truth):
public static <A extends ModelAction<K>,S extends ModelState<A,S,K>,K extends ProtocolKind>Set<A> getAllReachableActions(S start){
  Set<S> all=new HashSet<>();
  all.add(start);
  all.addAll(getAllReachable(start));
  Set<A> as=new HashSet<>();
  for (  S s : all) {
    as.addAll(s.getAllTakeable());
  }
  return as;
}
Program: 2339
Project: 2339
Buggy source:
public static <A extends ModelAction<K>,S extends ModelState<A,S,K>,K extends ProtocolKind>Set<S> getAllReachable(S start){
  Map<Integer,S> all=new HashMap<>();
  Map<Integer,S> todo=new LinkedHashMap<>();
  todo.put(start.id,start);
  while (!todo.isEmpty()) {
    Iterator<S> i=todo.values().iterator();
    S next=i.next();
    todo.remove(next.id);
    if (all.containsKey(next.id)) {
      continue;
    }
    all.put(next.id,next);
    for (    S s : next.getSuccessors()) {
      if (!all.containsKey(s.id) && !todo.containsKey(s.id)) {
        todo.put(s.id,s);
      }
    }
  }
  return new HashSet<>(all.values());
}

Fixed version (ground truth):
public static <A extends ModelAction<K>,S extends ModelState<A,S,K>,K extends ProtocolKind>Set<S> getAllReachable(S start){
  Map<Integer,S> all=new HashMap<>();
  Map<Integer,S> todo=new LinkedHashMap<>();
  todo.put(start.id,start);
  while (!todo.isEmpty()) {
    Iterator<S> i=todo.values().iterator();
    S next=i.next();
    todo.remove(next.id);
    System.out.println("String_Node_Str" + next.getAllTakeable() + "String_Node_Str"+ next.getSuccessors());
    for (    S s : next.getSuccessors()) {
      System.out.println("String_Node_Str" + all + "String_Node_Str"+ s);
      if (!all.containsKey(s.id)) {
        all.put(s.id,s);
{
          todo.put(s.id,s);
        }
      }
    }
  }
  return new HashSet<>(all.values());
}
Program: 2342
Project: 2342
Buggy source:
@Override protected void addMethods(){
  String branchName=this.apigen.getSocketClassName(curr);
  String enumClassName=branchName + "String_Node_Str" + BranchSocketGenerator.getBranchEnumClassName(this.apigen,this.curr);
  FieldBuilder fb1=this.cb.newField(CASE_OP_FIELD);
  fb1.addModifiers(JavaBuilder.PUBLIC,JavaBuilder.FINAL);
  fb1.setType(enumClassName);
  FieldBuilder fb2=this.cb.newField(CASE_MESSAGE_FIELD);
  fb2.addModifiers(JavaBuilder.PRIVATE,JavaBuilder.FINAL);
  fb2.setType(StateChannelApiGenerator.SCRIBMESSAGE_CLASS);
  for (  IOAction a : this.curr.getAcceptable()) {
    EndpointState succ=this.curr.accept(a);
    addReceiveMethod(this.cb,a,succ);
    addCaseReceiveMethod(this.cb,a,succ);
    if (!a.payload.isEmpty() || a.mid.isMessageSigName()) {
      addCaseReceiveDiscardMethod(this.cb,a,succ);
    }
  }
  Role self=this.apigen.getSelf();
  MethodBuilder mb=this.cb.newMethod("String_Node_Str");
  mb.addAnnotations("String_Node_Str");
  mb.addModifiers(JavaBuilder.PUBLIC);
  mb.setReturn(IOStateInterfaceGenerator.getIOStateInterfaceName(self,this.curr) + "String_Node_Str" + BranchInterfaceGenerator.getBranchInterfaceEnumName(self,this.curr));
  mb.addBodyLine(JavaBuilder.RETURN + "String_Node_Str" + JavaBuilder.THIS+ "String_Node_Str"+ CASE_OP_FIELD+ "String_Node_Str");
  this.apigen.addTypeDecl(this.cb);
}

Fixed version (ground truth):
@Override protected void addMethods(){
  String branchName=this.apigen.getSocketClassName(curr);
  String enumClassName=branchName + "String_Node_Str" + BranchSocketGenerator.getBranchEnumClassName(this.apigen,this.curr);
  FieldBuilder fb1=this.cb.newField(CASE_OP_FIELD);
  fb1.addModifiers(JavaBuilder.PUBLIC,JavaBuilder.FINAL);
  fb1.setType(enumClassName);
  FieldBuilder fb2=this.cb.newField(CASE_MESSAGE_FIELD);
  fb2.addModifiers(JavaBuilder.PRIVATE,JavaBuilder.FINAL);
  fb2.setType(StateChannelApiGenerator.SCRIBMESSAGE_CLASS);
  for (  IOAction a : this.curr.getTakeable()) {
    EndpointState succ=this.curr.take(a);
    addReceiveMethod(this.cb,a,succ);
    addCaseReceiveMethod(this.cb,a,succ);
    if (!a.payload.isEmpty() || a.mid.isMessageSigName()) {
      addCaseReceiveDiscardMethod(this.cb,a,succ);
    }
  }
  Role self=this.apigen.getSelf();
  MethodBuilder mb=this.cb.newMethod("String_Node_Str");
  mb.addAnnotations("String_Node_Str");
  mb.addModifiers(JavaBuilder.PUBLIC);
  mb.setReturn(IOStateInterfaceGenerator.getIOStateInterfaceName(self,this.curr) + "String_Node_Str" + BranchInterfaceGenerator.getBranchInterfaceEnumName(self,this.curr));
  mb.addBodyLine(JavaBuilder.RETURN + "String_Node_Str" + JavaBuilder.THIS+ "String_Node_Str"+ CASE_OP_FIELD+ "String_Node_Str");
  this.apigen.addTypeDecl(this.cb);
}
Program: 2343
Project: 2343
Buggy source:
@Override public InterfaceBuilder generateType(){
  GProtocolName gpn=this.apigen.getGProtocolName();
  InterfaceBuilder ib=new InterfaceBuilder();
  ib.setPackage(SessionApiGenerator.getStateChannelPackageName(gpn,this.apigen.getSelf()));
  ib.addImports(SessionApiGenerator.getOpsPackageName(gpn) + "String_Node_Str");
  ib.setName(getHandlerInterfaceName(this.parent.getName()));
  ib.addModifiers(InterfaceBuilder.PUBLIC);
  for (  IOAction a : this.curr.getAcceptable()) {
    EndpointState succ=this.curr.accept(a);
    String nextClass=this.apigen.getSocketClassName(succ);
    AbstractMethodBuilder mb3=ib.newAbstractMethod();
    mb3.addAnnotations("String_Node_Str");
    setHandleMethodHeaderWithoutParamTypes(this.apigen,mb3);
    if (succ.isTerminal()) {
      mb3.addParameters(ScribSocketGenerator.GENERATED_ENDSOCKET_NAME + "String_Node_Str");
    }
 else {
      mb3.addParameters(nextClass + "String_Node_Str");
    }
    addHandleMethodOpAndPayloadParams(this.apigen,a,mb3);
    if (this.curr.accept(a).isTerminal()) {
      ib.addImports(SessionApiGenerator.getEndpointApiRootPackageName(gpn) + "String_Node_Str");
      ib.addImports(SessionApiGenerator.getRolesPackageName(this.apigen.getGProtocolName()) + "String_Node_Str");
    }
  }
  return ib;
}

Fixed version (ground truth):
@Override public InterfaceBuilder generateType(){
  GProtocolName gpn=this.apigen.getGProtocolName();
  InterfaceBuilder ib=new InterfaceBuilder();
  ib.setPackage(SessionApiGenerator.getStateChannelPackageName(gpn,this.apigen.getSelf()));
  ib.addImports(SessionApiGenerator.getOpsPackageName(gpn) + "String_Node_Str");
  ib.setName(getHandlerInterfaceName(this.parent.getName()));
  ib.addModifiers(InterfaceBuilder.PUBLIC);
  for (  IOAction a : this.curr.getTakeable()) {
    EndpointState succ=this.curr.take(a);
    String nextClass=this.apigen.getSocketClassName(succ);
    AbstractMethodBuilder mb3=ib.newAbstractMethod();
    mb3.addAnnotations("String_Node_Str");
    setHandleMethodHeaderWithoutParamTypes(this.apigen,mb3);
    if (succ.isTerminal()) {
      mb3.addParameters(ScribSocketGenerator.GENERATED_ENDSOCKET_NAME + "String_Node_Str");
    }
 else {
      mb3.addParameters(nextClass + "String_Node_Str");
    }
    addHandleMethodOpAndPayloadParams(this.apigen,a,mb3);
    if (this.curr.take(a).isTerminal()) {
      ib.addImports(SessionApiGenerator.getEndpointApiRootPackageName(gpn) + "String_Node_Str");
      ib.addImports(SessionApiGenerator.getRolesPackageName(this.apigen.getGProtocolName()) + "String_Node_Str");
    }
  }
  return ib;
}
Program: 2344
Project: 2344
Buggy source:
@Override protected void addMethods(){
  IOAction a=curr.getAcceptable().iterator().next();
  EndpointState succ=curr.accept(a);
  ClassBuilder futureClass=new InputFutureGenerator(this.apigen,this.cb,a).generateType();
  this.apigen.addTypeDecl(futureClass);
  makeReceiveMethod(a,succ);
  makeAsyncMethod(a,succ,futureClass.getName());
  makeIsDoneMethod(a);
  makeAsyncDiscardMethod(a,succ,futureClass.getName());
}

Fixed version (ground truth):
@Override protected void addMethods(){
  IOAction a=curr.getTakeable().iterator().next();
  EndpointState succ=curr.take(a);
  ClassBuilder futureClass=new InputFutureGenerator(this.apigen,this.cb,a).generateType();
  this.apigen.addTypeDecl(futureClass);
  makeReceiveMethod(a,succ);
  makeAsyncMethod(a,succ,futureClass.getName());
  makeIsDoneMethod(a);
  makeAsyncDiscardMethod(a,succ,futureClass.getName());
}
Program: 2345
Project: 2345
Buggy source:
@Override protected void addMethods(){
  final String ROLE_PARAM="String_Node_Str";
  for (  IOAction a : curr.getAcceptable()) {
    EndpointState succ=curr.accept(a);
    MethodBuilder mb=this.cb.newMethod();
    setSendHeaderWithoutReturnType(apigen,a,mb);
    setNextSocketReturnType(this.apigen,mb,succ);
    if (a.mid.isOp()) {
      this.cb.addImports(getOpsPackageName() + "String_Node_Str");
    }
    if (a.mid.isOp()) {
      List<String> args=getSendPayloadArgs(a);
      String body=JavaBuilder.SUPER + "String_Node_Str" + ROLE_PARAM+ "String_Node_Str"+ getSessionApiOpConstant(a.mid);
      if (!a.payload.isEmpty()) {
        body+="String_Node_Str" + args.stream().collect(Collectors.joining("String_Node_Str"));
      }
      body+="String_Node_Str";
      mb.addBodyLine(body);
    }
 else {
      final String MESSAGE_PARAM="String_Node_Str";
      mb.addBodyLine(JavaBuilder.SUPER + "String_Node_Str" + ROLE_PARAM+ "String_Node_Str"+ MESSAGE_PARAM+ "String_Node_Str");
    }
    addReturnNextSocket(mb,succ);
  }
}

Fixed version (ground truth):
@Override protected void addMethods(){
  final String ROLE_PARAM="String_Node_Str";
  for (  IOAction a : curr.getTakeable()) {
    EndpointState succ=curr.take(a);
    MethodBuilder mb=this.cb.newMethod();
    setSendHeaderWithoutReturnType(apigen,a,mb);
    setNextSocketReturnType(this.apigen,mb,succ);
    if (a.mid.isOp()) {
      this.cb.addImports(getOpsPackageName() + "String_Node_Str");
    }
    if (a.mid.isOp()) {
      List<String> args=getSendPayloadArgs(a);
      String body=JavaBuilder.SUPER + "String_Node_Str" + ROLE_PARAM+ "String_Node_Str"+ getSessionApiOpConstant(a.mid);
      if (!a.payload.isEmpty()) {
        body+="String_Node_Str" + args.stream().collect(Collectors.joining("String_Node_Str"));
      }
      body+="String_Node_Str";
      mb.addBodyLine(body);
    }
 else {
      final String MESSAGE_PARAM="String_Node_Str";
      mb.addBodyLine(JavaBuilder.SUPER + "String_Node_Str" + ROLE_PARAM+ "String_Node_Str"+ MESSAGE_PARAM+ "String_Node_Str");
    }
    addReturnNextSocket(mb,succ);
  }
}
Program: 2346
Project: 2346
Buggy source:
private ClassBuilder constructClass(EndpointState curr){
  Set<IOAction> as=curr.getAcceptable();
  IOAction a=as.iterator().next();
  if (a instanceof Send) {
    return new SendSocketGenerator(this,curr).generateType();
  }
 else   if (a instanceof Receive) {
    return (as.size() > 1) ? new BranchSocketGenerator(this,curr).generateType() : new ReceiveSocketGenerator(this,curr).generateType();
  }
 else {
    throw new RuntimeException("String_Node_Str" + curr);
  }
}

Fixed version (ground truth):
private ClassBuilder constructClass(EndpointState curr){
  Set<IOAction> as=curr.getTakeable();
  IOAction a=as.iterator().next();
  if (a instanceof Send) {
    return new SendSocketGenerator(this,curr).generateType();
  }
 else   if (a instanceof Receive) {
    return (as.size() > 1) ? new BranchSocketGenerator(this,curr).generateType() : new ReceiveSocketGenerator(this,curr).generateType();
  }
 else {
    throw new RuntimeException("String_Node_Str" + curr);
  }
}
Program: 2347
Project: 2347
Buggy source:
protected void addBranchEnum(){
  Role self=this.apigen.getSelf();
  EnumBuilder eb=this.ib.newMemberEnum(getBranchInterfaceEnumName(self,this.curr));
  eb.addModifiers(JavaBuilder.PUBLIC);
  eb.addInterfaces(ScribSocketGenerator.OPENUM_INTERFACE);
  this.curr.getAcceptable().stream().forEach((a) -> eb.addValues(SessionApiGenerator.getOpClassName(a.mid)));
}

Fixed version (ground truth):
protected void addBranchEnum(){
  Role self=this.apigen.getSelf();
  EnumBuilder eb=this.ib.newMemberEnum(getBranchInterfaceEnumName(self,this.curr));
  eb.addModifiers(JavaBuilder.PUBLIC);
  eb.addInterfaces(ScribSocketGenerator.OPENUM_INTERFACE);
  this.curr.getTakeable().stream().forEach((a) -> eb.addValues(SessionApiGenerator.getOpClassName(a.mid)));
}
Program: 2349
Project: 2349
Buggy source:
@Override protected void addSuccessorParamsAndActionInterfaces(){
  int i=1;
  for (  IOAction a : this.curr.getAcceptable().stream().sorted(IOACTION_COMPARATOR).collect(Collectors.toList())) {
    this.ib.addParameters("String_Node_Str" + i + "String_Node_Str"+ SuccessorInterfaceGenerator.getSuccessorInterfaceName(a));
    i++;
  }
}

Fixed version (ground truth):
@Override protected void addSuccessorParamsAndActionInterfaces(){
  int i=1;
  for (  IOAction a : this.curr.getTakeable().stream().sorted(IOACTION_COMPARATOR).collect(Collectors.toList())) {
    this.ib.addParameters("String_Node_Str" + i + "String_Node_Str"+ SuccessorInterfaceGenerator.getSuccessorInterfaceName(a));
    i++;
  }
}
Program: 2350
Project: 2350
Buggy source:
protected void addCaseReceiveDiscardMethods(){
  GProtocolName gpn=this.apigen.getGProtocolName();
  Set<IOAction> as=this.curr.getAcceptable();
  int i=1;
  this.ib.addImports(SessionApiGenerator.getOpsPackageName(gpn) + "String_Node_Str");
  for (  IOAction a : as.stream().sorted(IOACTION_COMPARATOR).collect(Collectors.toList())) {
    MethodBuilder mb=this.ib.newAbstractMethod();
    CaseSocketGenerator.setCaseReceiveDiscardHeaderWithoutReturnType(this.apigen,a,mb);
    EndpointState succ=this.curr.accept(a);
    if (succ.isTerminal()) {
      ScribSocketGenerator.setNextSocketReturnType(this.apigen,mb,succ);
    }
 else {
      mb.setReturn("String_Node_Str" + i);
    }
    i++;
  }
}

Fixed version (ground truth):
protected void addCaseReceiveDiscardMethods(){
  GProtocolName gpn=this.apigen.getGProtocolName();
  Set<IOAction> as=this.curr.getTakeable();
  int i=1;
  this.ib.addImports(SessionApiGenerator.getOpsPackageName(gpn) + "String_Node_Str");
  for (  IOAction a : as.stream().sorted(IOACTION_COMPARATOR).collect(Collectors.toList())) {
    MethodBuilder mb=this.ib.newAbstractMethod();
    CaseSocketGenerator.setCaseReceiveDiscardHeaderWithoutReturnType(this.apigen,a,mb);
    EndpointState succ=this.curr.take(a);
    if (succ.isTerminal()) {
      ScribSocketGenerator.setNextSocketReturnType(this.apigen,mb,succ);
    }
 else {
      mb.setReturn("String_Node_Str" + i);
    }
    i++;
  }
}
Program: 2351
Project: 2351
Buggy source:
protected static String getCasesInterfaceName(Role self,EndpointState s){
  return "String_Node_Str" + self + "String_Node_Str"+ s.getAcceptable().stream().sorted(IOACTION_COMPARATOR).map((a) -> ActionInterfaceGenerator.getActionString(a)).collect(Collectors.joining("String_Node_Str"));
}

Fixed version (ground truth):
protected static String getCasesInterfaceName(Role self,EndpointState s){
  return "String_Node_Str" + self + "String_Node_Str"+ s.getTakeable().stream().sorted(IOACTION_COMPARATOR).map((a) -> ActionInterfaceGenerator.getActionString(a)).collect(Collectors.joining("String_Node_Str"));
}
Program: 2352
Project: 2352
Buggy source:
public static String getHandleInterfaceName(Role self,EndpointState s){
  return "String_Node_Str" + self + "String_Node_Str"+ s.getAcceptable().stream().sorted(IOACTION_COMPARATOR).map((a) -> ActionInterfaceGenerator.getActionString(a)).collect(Collectors.joining("String_Node_Str"));
}

Fixed version (ground truth):
public static String getHandleInterfaceName(Role self,EndpointState s){
  return "String_Node_Str" + self + "String_Node_Str"+ s.getTakeable().stream().sorted(IOACTION_COMPARATOR).map((a) -> ActionInterfaceGenerator.getActionString(a)).collect(Collectors.joining("String_Node_Str"));
}
Program: 2353
Project: 2353
Buggy source:
protected void addHandleMethods(){
  GProtocolName gpn=this.apigen.getGProtocolName();
  Set<IOAction> as=this.curr.getAcceptable();
  this.ib.addImports(SessionApiGenerator.getOpsPackageName(gpn) + "String_Node_Str");
  int i=1;
  for (  IOAction a : as.stream().sorted(IOACTION_COMPARATOR).collect(Collectors.toList())) {
    MethodBuilder mb=this.ib.newAbstractMethod();
    HandlerInterfaceGenerator.setHandleMethodHeaderWithoutParamTypes(this.apigen,mb);
    mb.addParameters("String_Node_Str" + i++ + "String_Node_Str");
    HandlerInterfaceGenerator.addHandleMethodOpAndPayloadParams(this.apigen,a,mb);
  }
}

Fixed version (ground truth):
protected void addHandleMethods(){
  GProtocolName gpn=this.apigen.getGProtocolName();
  Set<IOAction> as=this.curr.getTakeable();
  this.ib.addImports(SessionApiGenerator.getOpsPackageName(gpn) + "String_Node_Str");
  int i=1;
  for (  IOAction a : as.stream().sorted(IOACTION_COMPARATOR).collect(Collectors.toList())) {
    MethodBuilder mb=this.ib.newAbstractMethod();
    HandlerInterfaceGenerator.setHandleMethodHeaderWithoutParamTypes(this.apigen,mb);
    mb.addParameters("String_Node_Str" + i++ + "String_Node_Str");
    HandlerInterfaceGenerator.addHandleMethodOpAndPayloadParams(this.apigen,a,mb);
  }
}
Program: 2354
Project: 2354
Buggy source:
@Override protected void addSuccessorParamsAndActionInterfaces(){
  int i=1;
  for (  IOAction a : this.curr.getAcceptable().stream().sorted(IOACTION_COMPARATOR).collect(Collectors.toList())) {
    this.ib.addParameters("String_Node_Str" + i + "String_Node_Str"+ SuccessorInterfaceGenerator.getSuccessorInterfaceName(a));
    this.ib.addInterfaces(this.caseActions.get(a).getName() + "String_Node_Str" + i+ "String_Node_Str");
    i++;
  }
}

Fixed version (ground truth):
@Override protected void addSuccessorParamsAndActionInterfaces(){
  int i=1;
  for (  IOAction a : this.curr.getTakeable().stream().sorted(IOACTION_COMPARATOR).collect(Collectors.toList())) {
    this.ib.addParameters("String_Node_Str" + i + "String_Node_Str"+ SuccessorInterfaceGenerator.getSuccessorInterfaceName(a));
    this.ib.addInterfaces(this.caseActions.get(a).getName() + "String_Node_Str" + i+ "String_Node_Str");
    i++;
  }
}
Program: 2355
Project: 2355
Buggy source:
protected static void setHandleMethodSuccessorParam(IOInterfacesGenerator iogen,Role self,EndpointState succ,MethodBuilder mb,List<IOAction> as,Map<IOAction,Integer> count){
  if (succ.isTerminal()) {
    mb.addParameters(ScribSocketGenerator.ENDSOCKET_CLASS + "String_Node_Str");
  }
 else {
    InterfaceBuilder next=iogen.getIOStateInterface(IOStateInterfaceGenerator.getIOStateInterfaceName(self,succ));
    String ret=next.getName() + "String_Node_Str";
    boolean first=true;
    for (    IOAction a : succ.getAcceptable().stream().sorted(IOStateInterfaceGenerator.IOACTION_COMPARATOR).collect(Collectors.toList())) {
      int offset;
      if (!count.containsKey(a)) {
        offset=0;
        count.put(a,0);
      }
 else {
        offset=count.get(a) + 1;
        count.put(a,offset);
      }
      if (first) {
        first=false;
      }
 else {
        ret+="String_Node_Str";
      }
      ret+="String_Node_Str" + (as.indexOf(a) + 1 + offset);
    }
    ret+="String_Node_Str";
    mb.addParameters(ret + "String_Node_Str");
  }
}

Fixed version (ground truth):
protected static void setHandleMethodSuccessorParam(IOInterfacesGenerator iogen,Role self,EndpointState succ,MethodBuilder mb,List<IOAction> as,Map<IOAction,Integer> count){
  if (succ.isTerminal()) {
    mb.addParameters(ScribSocketGenerator.ENDSOCKET_CLASS + "String_Node_Str");
  }
 else {
    InterfaceBuilder next=iogen.getIOStateInterface(IOStateInterfaceGenerator.getIOStateInterfaceName(self,succ));
    String ret=next.getName() + "String_Node_Str";
    boolean first=true;
    for (    IOAction a : succ.getTakeable().stream().sorted(IOStateInterfaceGenerator.IOACTION_COMPARATOR).collect(Collectors.toList())) {
      int offset;
      if (!count.containsKey(a)) {
        offset=0;
        count.put(a,0);
      }
 else {
        offset=count.get(a) + 1;
        count.put(a,offset);
      }
      if (first) {
        first=false;
      }
 else {
        ret+="String_Node_Str";
      }
      ret+="String_Node_Str" + (as.indexOf(a) + 1 + offset);
    }
    ret+="String_Node_Str";
    mb.addParameters(ret + "String_Node_Str");
  }
}
Program: 2356
Project: 2356
Buggy source:
private void generateIOStateInterfacesFirstPass(Set<EndpointState> visited,EndpointState s){
  if (visited.contains(s) || s.isTerminal()) {
    return;
  }
  String key=IOStateInterfaceGenerator.getIOStateInterfaceName(getSelf(),s);
  if (!this.iostates.containsKey(key)) {
    IOStateInterfaceGenerator ifgen=null;
switch (s.getStateKind()) {
case OUTPUT:
      ifgen=new SelectInterfaceGenerator(this.apigen,this.actions,s);
    break;
case UNARY_INPUT:
  ifgen=new ReceiveInterfaceGenerator(this.apigen,this.actions,s);
break;
case POLY_INPUT:
InterfaceBuilder cases=new CaseInterfaceGenerator(this.apigen,this.actions,s).generateType();
this.iostates.put(cases.getName(),cases);
ifgen=new BranchInterfaceGenerator(this.apigen,this.actions,s);
break;
case TERMINAL:
default :
throw new RuntimeException("String_Node_Str");
}
this.iostates.put(key,ifgen.generateType());
}
visited.add(s);
for (IOAction a : s.getAcceptable()) {
generateIOStateInterfacesFirstPass(visited,s.accept(a));
}
}

Fixed version (ground truth):
private void generateIOStateInterfacesFirstPass(Set<EndpointState> visited,EndpointState s){
  if (visited.contains(s) || s.isTerminal()) {
    return;
  }
  String key=IOStateInterfaceGenerator.getIOStateInterfaceName(getSelf(),s);
  if (!this.iostates.containsKey(key)) {
    IOStateInterfaceGenerator ifgen=null;
switch (s.getStateKind()) {
case OUTPUT:
      ifgen=new SelectInterfaceGenerator(this.apigen,this.actions,s);
    break;
case UNARY_INPUT:
  ifgen=new ReceiveInterfaceGenerator(this.apigen,this.actions,s);
break;
case POLY_INPUT:
InterfaceBuilder cases=new CaseInterfaceGenerator(this.apigen,this.actions,s).generateType();
this.iostates.put(cases.getName(),cases);
ifgen=new BranchInterfaceGenerator(this.apigen,this.actions,s);
break;
case TERMINAL:
default :
throw new RuntimeException("String_Node_Str");
}
this.iostates.put(key,ifgen.generateType());
}
visited.add(s);
for (IOAction a : s.getTakeable()) {
generateIOStateInterfacesFirstPass(visited,s.take(a));
}
}
Program: 2358
Project: 2358
Buggy source:
private String getConcreteSuccessorParameters(EndpointState s){
  return "String_Node_Str" + s.getAcceptable().stream().sorted(IOStateInterfaceGenerator.IOACTION_COMPARATOR).map((a) -> this.getSuccName.apply(s.accept(a))).collect(Collectors.joining("String_Node_Str")) + "String_Node_Str";
}

Fixed version (ground truth):
private String getConcreteSuccessorParameters(EndpointState s){
  return "String_Node_Str" + s.getTakeable().stream().sorted(IOStateInterfaceGenerator.IOACTION_COMPARATOR).map((a) -> this.getSuccName.apply(s.take(a))).collect(Collectors.joining("String_Node_Str")) + "String_Node_Str";
}
Program: 2359
Project: 2359
Buggy source:
private void generateHandleInterfaces(Set<EndpointState> visited,EndpointState s){
  if (visited.contains(s) || s.isTerminal()) {
    return;
  }
  if (s.getStateKind() == Kind.POLY_INPUT) {
    String key=HandleInterfaceGenerator.getHandleInterfaceName(getSelf(),s);
    if (!this.iostates.containsKey(key)) {
      IOStateInterfaceGenerator ifgen=new HandleInterfaceGenerator(this,this.actions,s,this.caseActions);
      this.iostates.put(key,ifgen.generateType());
    }
  }
  visited.add(s);
  for (  IOAction a : s.getAcceptable()) {
    generateHandleInterfaces(visited,s.accept(a));
  }
}

Fixed version (ground truth):
private void generateHandleInterfaces(Set<EndpointState> visited,EndpointState s){
  if (visited.contains(s) || s.isTerminal()) {
    return;
  }
  if (s.getStateKind() == Kind.POLY_INPUT) {
    String key=HandleInterfaceGenerator.getHandleInterfaceName(getSelf(),s);
    if (!this.iostates.containsKey(key)) {
      IOStateInterfaceGenerator ifgen=new HandleInterfaceGenerator(this,this.actions,s,this.caseActions);
      this.iostates.put(key,ifgen.generateType());
    }
  }
  visited.add(s);
  for (  IOAction a : s.getTakeable()) {
    generateHandleInterfaces(visited,s.take(a));
  }
}
Program: 2361
Project: 2361
Buggy source:
private void generateHandleInterfacesSecondPass(Set<EndpointState> visited,EndpointState s){
  if (visited.contains(s) || s.isTerminal()) {
    return;
  }
  if (s.getStateKind() == Kind.POLY_INPUT) {
    GProtocolName gpn=this.apigen.getGProtocolName();
    Role self=this.apigen.getSelf();
    String key=HandleInterfaceGenerator.getHandleInterfaceName(self,s);
    List<IOAction> succifs=this.branchSuccs.get(key);
    if (succifs != null) {
      InterfaceBuilder handleif=this.iostates.get(key);
      List<IOAction> tmp=this.branchSuccs.get(key);
      Map<IOAction,Integer> count=new HashMap<>();
    }
  }
  visited.add(s);
  for (  IOAction a : s.getAcceptable()) {
    generateHandleInterfacesSecondPass(visited,s.accept(a));
  }
}

Fixed version (ground truth):
private void generateHandleInterfacesSecondPass(Set<EndpointState> visited,EndpointState s){
  if (visited.contains(s) || s.isTerminal()) {
    return;
  }
  if (s.getStateKind() == Kind.POLY_INPUT) {
    GProtocolName gpn=this.apigen.getGProtocolName();
    Role self=this.apigen.getSelf();
    String key=HandleInterfaceGenerator.getHandleInterfaceName(self,s);
    List<IOAction> succifs=this.branchSuccs.get(key);
    if (succifs != null) {
      InterfaceBuilder handleif=this.iostates.get(key);
      List<IOAction> tmp=this.branchSuccs.get(key);
      Map<IOAction,Integer> count=new HashMap<>();
    }
  }
  visited.add(s);
  for (  IOAction a : s.getTakeable()) {
    generateHandleInterfacesSecondPass(visited,s.take(a));
  }
}
Program: 2363
Project: 2363
Buggy source:
private void collectBranchSuccs(){
  Role self=getSelf();
  for (  EndpointState s : this.branchPostActions.keySet()) {
    String key=HandleInterfaceGenerator.getHandleInterfaceName(self,s);
    List<IOAction> curr1=new LinkedList<>();
    this.branchPostActions.get(s).forEach((a) -> curr1.addAll(s.accept(a).getAcceptable()));
    List<IOAction> tmp=this.branchSuccs.get(key);
    if (tmp == null) {
      tmp=new LinkedList<>();
      tmp.addAll(curr1);
    }
 else {
      for (      IOAction a : curr1) {
        long n=curr1.stream().filter((x) -> x.equals(a)).count();
        long m=tmp.stream().filter((x) -> x.equals(a)).count();
        if (n > m) {
          for (int i=0; i < n - m; i++) {
            tmp.add(a);
          }
        }
      }
    }
    this.branchSuccs.put(key,tmp.stream().sorted(IOStateInterfaceGenerator.IOACTION_COMPARATOR).collect(Collectors.toList()));
  }
}

Fixed version (ground truth):
private void collectBranchSuccs(){
  Role self=getSelf();
  for (  EndpointState s : this.branchPostActions.keySet()) {
    String key=HandleInterfaceGenerator.getHandleInterfaceName(self,s);
    List<IOAction> curr1=new LinkedList<>();
    this.branchPostActions.get(s).forEach((a) -> curr1.addAll(s.take(a).getTakeable()));
    List<IOAction> tmp=this.branchSuccs.get(key);
    if (tmp == null) {
      tmp=new LinkedList<>();
      tmp.addAll(curr1);
    }
 else {
      for (      IOAction a : curr1) {
        long n=curr1.stream().filter((x) -> x.equals(a)).count();
        long m=tmp.stream().filter((x) -> x.equals(a)).count();
        if (n > m) {
          for (int i=0; i < n - m; i++) {
            tmp.add(a);
          }
        }
      }
    }
    this.branchSuccs.put(key,tmp.stream().sorted(IOStateInterfaceGenerator.IOACTION_COMPARATOR).collect(Collectors.toList()));
  }
}
Program: 2364
Project: 2364
Buggy source:
protected void addCastField(){
  String ifname=getIOStateInterfaceName(this.apigen.getSelf(),this.curr);
  Set<IOAction> as=this.curr.getAcceptable();
  FieldBuilder cast=this.ib.newField("String_Node_Str");
  cast.addModifiers(TypeBuilder.PUBLIC,TypeBuilder.STATIC,TypeBuilder.FINAL);
  cast.setType(ifname + "String_Node_Str" + IntStream.range(1,as.size() + 1).mapToObj((i) -> "String_Node_Str").collect(Collectors.joining("String_Node_Str"))+ "String_Node_Str");
  cast.setExpression("String_Node_Str");
}

Fixed version (ground truth):
protected void addCastField(){
  String ifname=getIOStateInterfaceName(this.apigen.getSelf(),this.curr);
  Set<IOAction> as=this.curr.getTakeable();
  FieldBuilder cast=this.ib.newField("String_Node_Str");
  cast.addModifiers(TypeBuilder.PUBLIC,TypeBuilder.STATIC,TypeBuilder.FINAL);
  cast.setType(ifname + "String_Node_Str" + IntStream.range(1,as.size() + 1).mapToObj((i) -> "String_Node_Str").collect(Collectors.joining("String_Node_Str"))+ "String_Node_Str");
  cast.setExpression("String_Node_Str");
}
Program: 2365
Project: 2365
Buggy source:
protected void addSuccessorParamsAndActionInterfaces(){
  int i=1;
  for (  IOAction a : this.curr.getAcceptable().stream().sorted(IOACTION_COMPARATOR).collect(Collectors.toList())) {
    String actif=this.actions.get(a).getName();
    this.ib.addParameters("String_Node_Str" + i + "String_Node_Str"+ SuccessorInterfaceGenerator.getSuccessorInterfaceName(a));
    this.ib.addInterfaces(actif + "String_Node_Str" + i+ "String_Node_Str");
    i++;
  }
}

Fixed version (ground truth):
protected void addSuccessorParamsAndActionInterfaces(){
  int i=1;
  for (  IOAction a : this.curr.getTakeable().stream().sorted(IOACTION_COMPARATOR).collect(Collectors.toList())) {
    String actif=this.actions.get(a).getName();
    this.ib.addParameters("String_Node_Str" + i + "String_Node_Str"+ SuccessorInterfaceGenerator.getSuccessorInterfaceName(a));
    this.ib.addInterfaces(actif + "String_Node_Str" + i+ "String_Node_Str");
    i++;
  }
}
Program: 2366
Project: 2366
Buggy source:
public static String getIOStateInterfaceName(Role self,EndpointState s){
  String name=null;
switch (s.getStateKind()) {
case OUTPUT:
    name="String_Node_Str";
  break;
case UNARY_INPUT:
name="String_Node_Str";
break;
case POLY_INPUT:
name="String_Node_Str";
break;
case TERMINAL:
throw new RuntimeScribbleException("String_Node_Str" + s);
}
return name + "String_Node_Str" + self+ "String_Node_Str"+ s.getAcceptable().stream().sorted(IOACTION_COMPARATOR).map((a) -> ActionInterfaceGenerator.getActionString(a)).collect(Collectors.joining("String_Node_Str"));
}

Fixed version (ground truth):
public static String getIOStateInterfaceName(Role self,EndpointState s){
  String name=null;
switch (s.getStateKind()) {
case OUTPUT:
    name="String_Node_Str";
  break;
case UNARY_INPUT:
name="String_Node_Str";
break;
case POLY_INPUT:
name="String_Node_Str";
break;
case TERMINAL:
throw new RuntimeScribbleException("String_Node_Str" + s);
}
return name + "String_Node_Str" + self+ "String_Node_Str"+ s.getTakeable().stream().sorted(IOACTION_COMPARATOR).map((a) -> ActionInterfaceGenerator.getActionString(a)).collect(Collectors.joining("String_Node_Str"));
}