Program: 2371
Project: 2371
Buggy source:
private GProtocolDecl visitOverrideForGProtocolDecl(Module parent,GProtocolDecl child) throws ScribbleException {
  Job job=getJob();
  GProtocolDecl gpd=(GProtocolDecl)child;
  GProtocolName fullname=gpd.getFullMemberName(parent);
  Map<Role,EndpointState> fsms=new HashMap<>();
  for (  Role self : gpd.header.roledecls.getRoles()) {
    EndpointGraph fsm=job.getContext().getEndpointGraph(fullname,self);
    if (fsm == null) {
      Module proj=this.getJobContext().getProjection(fullname,self);
      EndpointGraphBuilder graph=new EndpointGraphBuilder(getJob());
      proj.accept(graph);
      fsm=job.getContext().getEndpointGraph(fullname,self);
    }
    job.debugPrintln("String_Node_Str" + fullname + "String_Node_Str"+ self+ "String_Node_Str"+ fsm);
    fsms.put(self,fsm.init);
  }
  WFBuffers b0=new WFBuffers(fsms.keySet(),!gpd.modifiers.contains(GProtocolDecl.Modifiers.EXPLICIT));
  WFConfig c0=new WFConfig(fsms,b0);
  WFState init=new WFState(c0);
  Set<WFState> seen=new HashSet<>();
  LinkedHashSet<WFState> todo=new LinkedHashSet<>();
  todo.add(init);
  int count=0;
  while (!todo.isEmpty()) {
    Iterator<WFState> i=todo.iterator();
    WFState curr=i.next();
    i.remove();
    seen.add(curr);
    if (job.debug) {
      count++;
      if (count % 50 == 0) {
        job.debugPrintln("String_Node_Str" + fullname + "String_Node_Str"+ count);
      }
    }
    Map<Role,List<IOAction>> acceptable=curr.getAcceptable();
    for (    Role r : acceptable.keySet()) {
      List<IOAction> acceptable_r=acceptable.get(r);
      EndpointState currstate=curr.config.states.get(r);
      Kind k=currstate.getStateKind();
      if (k == Kind.OUTPUT) {
        for (        IOAction a : acceptable_r) {
          if (acceptable_r.stream().anyMatch((x) -> !a.equals(x) && a.peer.equals(x.peer) && a.mid.equals(x.mid)&& !a.payload.equals(x.payload))) {
            throw new ScribbleException("String_Node_Str" + acceptable_r);
          }
        }
      }
 else       if (k == Kind.UNARY_INPUT || k == Kind.POLY_INPUT) {
        for (        IOAction a : acceptable_r) {
          if (currstate.getAllAcceptable().stream().anyMatch((x) -> !a.equals(x) && a.peer.equals(x.peer) && a.mid.equals(x.mid)&& !a.payload.equals(x.payload))) {
            throw new ScribbleException("String_Node_Str" + currstate.getAllAcceptable());
          }
        }
      }
      for (      IOAction a : acceptable_r) {
        if (a.isSend() || a.isReceive() || a.isDisconnect()) {
          getNextStates(todo,seen,curr,a.toGlobal(r),curr.accept(r,a));
        }
 else         if (a.isAccept() || a.isConnect()) {
          List<IOAction> as=acceptable.get(a.peer);
          IOAction d=a.toDual(r);
          if (as != null && as.contains(d)) {
            as.remove(d);
            GIOAction g=(a.isConnect()) ? a.toGlobal(r) : d.toGlobal(a.peer);
            getNextStates(todo,seen,curr,g,curr.sync(r,a,a.peer,d));
          }
        }
 else {
          throw new RuntimeException("String_Node_Str" + a);
        }
      }
    }
  }
  job.debugPrintln("String_Node_Str" + fullname + "String_Node_Str"+ count+ "String_Node_Str"+ init.toDot());
  this.getJobContext().addGlobalModel(gpd.getFullMemberName((Module)parent),init);
  Set<WFState> all=seen;
  String errorMsg="String_Node_Str";
  Map<WFState,Set<WFState>> reach=getReachability(job,all);
  count=0;
  for (  WFState s : all) {
    if (job.debug) {
      count++;
      if (count % 50 == 0) {
        job.debugPrintln("String_Node_Str" + fullname + "String_Node_Str"+ count);
      }
    }
    WFStateErrors errors=s.getErrors();
    if (!errors.isEmpty()) {
      List<GIOAction> trace=getTrace(init,s,reach);
      errorMsg+="String_Node_Str" + s.toString() + "String_Node_Str"+ trace;
    }
    if (!errors.stuck.isEmpty()) {
      errorMsg+="String_Node_Str" + errors.stuck;
    }
    if (!errors.waitFor.isEmpty()) {
      errorMsg+="String_Node_Str" + errors.waitFor;
    }
    if (!errors.orphans.isEmpty()) {
      errorMsg+="String_Node_Str" + errors.orphans;
    }
  }
  if (!job.noLiveness) {
    Set<Set<WFState>> termsets=new HashSet<>();
    findTerminalSets(reach,termsets);
    for (    Set<WFState> termset : termsets) {
      Set<Role> safety=new HashSet<>();
      Set<Role> roleLiveness=new HashSet<>();
      checkTerminalSet(init,termset,safety,roleLiveness);
      if (!safety.isEmpty()) {
        errorMsg+="String_Node_Str" + safety + "String_Node_Str"+ termset;
      }
      if (!roleLiveness.isEmpty()) {
        errorMsg+="String_Node_Str" + roleLiveness + "String_Node_Str"+ termset;
      }
      Set<Send> msgLiveness=checkMessageLiveness(init,termset);
      if (!msgLiveness.isEmpty()) {
        errorMsg+="String_Node_Str" + msgLiveness + "String_Node_Str"+ termset;
      }
    }
  }
  if (!errorMsg.equals("String_Node_Str")) {
    throw new ScribbleException(errorMsg);
  }
  return child;
}

Fixed version (ground truth):
private GProtocolDecl visitOverrideForGProtocolDecl(Module parent,GProtocolDecl child) throws ScribbleException {
  Job job=getJob();
  GProtocolDecl gpd=(GProtocolDecl)child;
  GProtocolName fullname=gpd.getFullMemberName(parent);
  Map<Role,EndpointState> fsms=new HashMap<>();
  for (  Role self : gpd.header.roledecls.getRoles()) {
    EndpointGraph fsm=job.getContext().getEndpointGraph(fullname,self);
    if (fsm == null) {
      Module proj=this.getJobContext().getProjection(fullname,self);
      EndpointGraphBuilder graph=new EndpointGraphBuilder(getJob());
      proj.accept(graph);
      fsm=job.getContext().getEndpointGraph(fullname,self);
    }
    job.debugPrintln("String_Node_Str" + fullname + "String_Node_Str"+ self+ "String_Node_Str"+ fsm);
    fsms.put(self,fsm.init);
  }
  WFBuffers b0=new WFBuffers(fsms.keySet(),!gpd.modifiers.contains(GProtocolDecl.Modifiers.EXPLICIT));
  WFConfig c0=new WFConfig(fsms,b0);
  WFState init=new WFState(c0);
  Set<WFState> seen=new HashSet<>();
  LinkedHashSet<WFState> todo=new LinkedHashSet<>();
  todo.add(init);
  int count=0;
  while (!todo.isEmpty()) {
    Iterator<WFState> i=todo.iterator();
    WFState curr=i.next();
    i.remove();
    seen.add(curr);
    if (job.debug) {
      count++;
      if (count % 50 == 0) {
        job.debugPrintln("String_Node_Str" + fullname + "String_Node_Str"+ count);
      }
    }
    Map<Role,List<IOAction>> acceptable=curr.getAcceptable();
    for (    Role r : acceptable.keySet()) {
      List<IOAction> acceptable_r=acceptable.get(r);
      EndpointState currstate=curr.config.states.get(r);
      Kind k=currstate.getStateKind();
      if (k == Kind.OUTPUT) {
        for (        IOAction a : acceptable_r) {
          if (acceptable_r.stream().anyMatch((x) -> !a.equals(x) && a.peer.equals(x.peer) && a.mid.equals(x.mid)&& !a.payload.equals(x.payload))) {
            throw new ScribbleException("String_Node_Str" + acceptable_r);
          }
        }
      }
 else       if (k == Kind.UNARY_INPUT || k == Kind.POLY_INPUT) {
        for (        IOAction a : acceptable_r) {
          if (currstate.getAllAcceptable().stream().anyMatch((x) -> !a.equals(x) && a.peer.equals(x.peer) && a.mid.equals(x.mid)&& !a.payload.equals(x.payload))) {
            throw new ScribbleException("String_Node_Str" + currstate.getAllAcceptable());
          }
        }
      }
      for (      IOAction a : acceptable_r) {
        if (a.isSend() || a.isReceive() || a.isDisconnect()) {
          getNextStates(todo,seen,curr,a.toGlobal(r),curr.accept(r,a));
        }
 else         if (a.isAccept() || a.isConnect()) {
          List<IOAction> as=acceptable.get(a.peer);
          IOAction d=a.toDual(r);
          if (as != null && as.contains(d)) {
            as.remove(d);
            GIOAction g=(a.isConnect()) ? a.toGlobal(r) : d.toGlobal(a.peer);
            getNextStates(todo,seen,curr,g,curr.sync(r,a,a.peer,d));
          }
        }
 else {
          throw new RuntimeException("String_Node_Str" + a);
        }
      }
    }
  }
  job.debugPrintln("String_Node_Str" + fullname + "String_Node_Str"+ count+ "String_Node_Str"+ init.toDot());
  this.getJobContext().addGlobalModel(gpd.getFullMemberName((Module)parent),init);
  Set<WFState> all=seen;
  String errorMsg="String_Node_Str";
  Map<WFState,Set<WFState>> reach=getReachability(job,all);
  count=0;
  for (  WFState s : all) {
    if (job.debug) {
      count++;
      if (count % 50 == 0) {
        job.debugPrintln("String_Node_Str" + fullname + "String_Node_Str"+ count);
      }
    }
    WFStateErrors errors=s.getErrors();
    if (!errors.isEmpty()) {
      List<GIOAction> trace=getTrace(init,s,reach);
      errorMsg+="String_Node_Str" + s.toString() + "String_Node_Str"+ trace;
    }
    if (!errors.stuck.isEmpty()) {
      errorMsg+="String_Node_Str" + errors.stuck;
    }
    if (!errors.waitFor.isEmpty()) {
      errorMsg+="String_Node_Str" + errors.waitFor;
    }
    if (!errors.orphans.isEmpty()) {
      errorMsg+="String_Node_Str" + errors.orphans;
    }
  }
  if (!job.noLiveness) {
    Set<Set<WFState>> termsets=new HashSet<>();
    findTerminalSets(reach,termsets);
    for (    Set<WFState> termset : termsets) {
      Set<Role> safety=new HashSet<>();
      Set<Role> roleLiveness=new HashSet<>();
      checkTerminalSet(init,termset,safety,roleLiveness);
      if (!safety.isEmpty()) {
        errorMsg+="String_Node_Str" + safety + "String_Node_Str"+ termset;
      }
      if (!roleLiveness.isEmpty()) {
        errorMsg+="String_Node_Str" + roleLiveness + "String_Node_Str"+ termset;
      }
      Map<Role,Set<Send>> msgLiveness=checkMessageLiveness(init,termset);
      if (!msgLiveness.isEmpty()) {
        errorMsg+="String_Node_Str" + msgLiveness + "String_Node_Str"+ termset;
      }
    }
  }
  if (!errorMsg.equals("String_Node_Str")) {
    throw new ScribbleException(errorMsg);
  }
  return child;
}