Program: 2362
Project: 2362
Buggy source:
private void addIOStateInterfacesToStateChannels(Set<EndpointState> visited,EndpointState s){
  if (visited.contains(s) || s.isTerminal()) {
    return;
  }
  Role self=getSelf();
  String scname=this.apigen.getSocketClassName(s);
  String ioname=IOStateInterfaceGenerator.getIOStateInterfaceName(self,s);
  TypeBuilder tb=this.apigen.getType(scname);
  tb.addImports(getIOInterfacePackageName(this.gpn,self) + "String_Node_Str");
  tb.addInterfaces(ioname + getConcreteSuccessorParameters(s));
  InterfaceBuilder iostate=this.iostates.get(ioname);
  MethodBuilder mb=addToCastMethod(iostate,scname);
  if (mb != null) {
    iostate.addImports(SessionApiGenerator.getStateChannelPackageName(this.gpn,self) + "String_Node_Str");
  }
  if (s.getStateKind() == Kind.POLY_INPUT) {
    TypeBuilder cases=this.apigen.getType(CaseSocketGenerator.getCaseSocketName(this.apigen.getSocketClassName(s)));
    cases.addImports(getIOInterfacePackageName(this.gpn,self) + "String_Node_Str");
    cases.addInterfaces(CaseInterfaceGenerator.getCasesInterfaceName(self,s) + getConcreteSuccessorParameters(s));
    InterfaceBuilder handler=(InterfaceBuilder)this.apigen.getType(HandlerInterfaceGenerator.getHandlerInterfaceName(this.apigen.getSocketClassName(s)));
    handler.addImports(getIOInterfacePackageName(this.gpn,self) + "String_Node_Str");
    String tmp="String_Node_Str";
    boolean first=true;
    String handle=HandleInterfaceGenerator.getHandleInterfaceName(self,s);
    for (    IOAction a : s.getAcceptable().stream().sorted(IOStateInterfaceGenerator.IOACTION_COMPARATOR).collect(Collectors.toList())) {
      if (first) {
        first=false;
      }
 else {
        tmp+="String_Node_Str";
      }
      EndpointState succ=s.accept(a);
      if (succ.isTerminal()) {
        tmp+=ScribSocketGenerator.GENERATED_ENDSOCKET_NAME;
      }
 else {
        tmp+=this.apigen.getSocketClassName(succ);
      }
    }
    handler.addInterfaces(handle + "String_Node_Str" + tmp+ "String_Node_Str");
  }
  visited.add(s);
  for (  IOAction a : s.getAcceptable()) {
    addIOStateInterfacesToStateChannels(visited,s.accept(a));
  }
}

Fixed version (ground truth):
private void addIOStateInterfacesToStateChannels(Set<EndpointState> visited,EndpointState s){
  if (visited.contains(s) || s.isTerminal()) {
    return;
  }
  Role self=getSelf();
  String scname=this.apigen.getSocketClassName(s);
  String ioname=IOStateInterfaceGenerator.getIOStateInterfaceName(self,s);
  TypeBuilder tb=this.apigen.getType(scname);
  tb.addImports(getIOInterfacePackageName(this.gpn,self) + "String_Node_Str");
  tb.addInterfaces(ioname + getConcreteSuccessorParameters(s));
  InterfaceBuilder iostate=this.iostates.get(ioname);
  MethodBuilder mb=addToCastMethod(iostate,scname);
  if (mb != null) {
    iostate.addImports(SessionApiGenerator.getStateChannelPackageName(this.gpn,self) + "String_Node_Str");
  }
  if (s.getStateKind() == Kind.POLY_INPUT) {
    TypeBuilder cases=this.apigen.getType(CaseSocketGenerator.getCaseSocketName(this.apigen.getSocketClassName(s)));
    cases.addImports(getIOInterfacePackageName(this.gpn,self) + "String_Node_Str");
    cases.addInterfaces(CaseInterfaceGenerator.getCasesInterfaceName(self,s) + getConcreteSuccessorParameters(s));
    InterfaceBuilder handler=(InterfaceBuilder)this.apigen.getType(HandlerInterfaceGenerator.getHandlerInterfaceName(this.apigen.getSocketClassName(s)));
    handler.addImports(getIOInterfacePackageName(this.gpn,self) + "String_Node_Str");
    String tmp="String_Node_Str";
    boolean first=true;
    String handle=HandleInterfaceGenerator.getHandleInterfaceName(self,s);
    for (    IOAction a : s.getTakeable().stream().sorted(IOStateInterfaceGenerator.IOACTION_COMPARATOR).collect(Collectors.toList())) {
      if (first) {
        first=false;
      }
 else {
        tmp+="String_Node_Str";
      }
      EndpointState succ=s.take(a);
      if (succ.isTerminal()) {
        tmp+=ScribSocketGenerator.GENERATED_ENDSOCKET_NAME;
      }
 else {
        tmp+=this.apigen.getSocketClassName(succ);
      }
    }
    handler.addInterfaces(handle + "String_Node_Str" + tmp+ "String_Node_Str");
  }
  visited.add(s);
  for (  IOAction a : s.getTakeable()) {
    addIOStateInterfacesToStateChannels(visited,s.take(a));
  }
}