Program: 53955
Project: 53955
Buggy source:
private void writeContextImplementations(){
  for (  ContextMethod method : model.getMethods()) {
    PrintWriter pw=context.tryCreate(logger,method.getPackageName(),method.getSimpleSourceName());
    if (pw == null) {
      continue;
    }
    ClassSourceFileComposerFactory factory=new ClassSourceFileComposerFactory(method.getPackageName(),method.getSimpleSourceName());
    factory.setSuperclass(AbstractRequestContext.class.getCanonicalName());
    factory.addImplementedInterface(method.getImplementedInterfaceQualifiedSourceName());
    SourceWriter sw=factory.createSourceWriter(context,pw);
    sw.println("String_Node_Str",method.getSimpleSourceName(),AbstractRequestFactory.class.getCanonicalName());
    for (    RequestMethod request : method.getRequestMethods()) {
      JMethod jmethod=request.getDeclarationMethod();
      String operation=jmethod.getEnclosingType().getQualifiedBinaryName() + "String_Node_Str" + jmethod.getName();
      StringBuilder parameterArray=new StringBuilder();
      StringBuilder parameterDeclaration=new StringBuilder();
      if (request.isInstance()) {
        parameterArray.append("String_Node_Str");
      }
      for (      JParameter param : jmethod.getParameters()) {
        parameterArray.append("String_Node_Str").append(param.getName());
        parameterDeclaration.append("String_Node_Str").append(param.getType().getParameterizedQualifiedSourceName()).append("String_Node_Str").append(param.getName());
      }
      if (parameterArray.length() > 0) {
        parameterArray.deleteCharAt(0);
      }
      if (parameterDeclaration.length() > 0) {
        parameterDeclaration.deleteCharAt(0);
      }
      sw.println("String_Node_Str",jmethod.getReturnType().getParameterizedQualifiedSourceName(),jmethod.getName(),parameterDeclaration);
      sw.indent();
      sw.println("String_Node_Str",AbstractRequest.class.getCanonicalName(),request.getDataType().getParameterizedQualifiedSourceName(),jmethod.getReturnType().getParameterizedQualifiedSourceName());
      sw.indent();
      sw.println("String_Node_Str",method.getSimpleSourceName());
      sw.println("String_Node_Str");
      sw.println("String_Node_Str",RequestData.class.getCanonicalName());
      sw.indentln("String_Node_Str",RequestData.class.getCanonicalName(),operation,parameterArray);
      sw.println("String_Node_Str");
      sw.println("String_Node_Str");
      sw.indent();
      sw.println("String_Node_Str");
      if (request.isCollectionType()) {
        Class<?> collectionType=request.getCollectionType().equals(CollectionType.LIST) ? ArrayList.class : HashSet.class;
        sw.println("String_Node_Str",collectionType.getCanonicalName());
        String decodeMethod=request.isValueType() ? "String_Node_Str" : "String_Node_Str";
        sw.println("String_Node_Str",decodeMethod,request.getCollectionElementType().getQualifiedSourceName(),collectionType.getCanonicalName());
      }
 else       if (request.isValueType()) {
        sw.println("String_Node_Str",ValueCodex.class.getCanonicalName(),request.getDataType().getQualifiedSourceName());
      }
 else       if (request.isEntityType()) {
        sw.println("String_Node_Str",request.getEntityType().getQualifiedSourceName());
      }
 else {
        sw.println("String_Node_Str");
      }
      sw.println("String_Node_Str",request.getDataType().getParameterizedQualifiedSourceName());
      sw.outdent();
      sw.println("String_Node_Str");
      sw.outdent();
      sw.println("String_Node_Str");
      sw.println("String_Node_Str");
      if (!request.isInstance()) {
        sw.println("String_Node_Str");
      }
      sw.println("String_Node_Str");
      sw.outdent();
      sw.println("String_Node_Str");
    }
    sw.commit(logger);
  }
}

Fixed version (ground truth):
private void writeContextImplementations(){
  for (  ContextMethod method : model.getMethods()) {
    PrintWriter pw=context.tryCreate(logger,method.getPackageName(),method.getSimpleSourceName());
    if (pw == null) {
      continue;
    }
    ClassSourceFileComposerFactory factory=new ClassSourceFileComposerFactory(method.getPackageName(),method.getSimpleSourceName());
    factory.setSuperclass(AbstractRequestContext.class.getCanonicalName());
    factory.addImplementedInterface(method.getImplementedInterfaceQualifiedSourceName());
    SourceWriter sw=factory.createSourceWriter(context,pw);
    sw.println("String_Node_Str",method.getSimpleSourceName(),AbstractRequestFactory.class.getCanonicalName());
    for (    RequestMethod request : method.getRequestMethods()) {
      JMethod jmethod=request.getDeclarationMethod();
      String operation=jmethod.getEnclosingType().getQualifiedBinaryName() + "String_Node_Str" + jmethod.getName();
      StringBuilder parameterArray=new StringBuilder();
      StringBuilder parameterDeclaration=new StringBuilder();
      StringBuilder typeParameterDeclaration=new StringBuilder();
      if (request.isInstance()) {
        parameterArray.append("String_Node_Str");
      }
      for (      JTypeParameter param : jmethod.getTypeParameters()) {
        typeParameterDeclaration.append("String_Node_Str").append(param.getQualifiedSourceName());
      }
      for (      JParameter param : jmethod.getParameters()) {
        parameterArray.append("String_Node_Str").append(param.getName());
        parameterDeclaration.append("String_Node_Str").append(param.getType().getParameterizedQualifiedSourceName()).append("String_Node_Str").append(param.getName());
      }
      if (parameterArray.length() > 0) {
        parameterArray.deleteCharAt(0);
      }
      if (parameterDeclaration.length() > 0) {
        parameterDeclaration.deleteCharAt(0);
      }
      if (typeParameterDeclaration.length() > 0) {
        typeParameterDeclaration.deleteCharAt(0).insert(0,"String_Node_Str").append("String_Node_Str");
      }
      sw.println("String_Node_Str",typeParameterDeclaration,jmethod.getReturnType().getParameterizedQualifiedSourceName(),jmethod.getName(),parameterDeclaration);
      sw.indent();
      sw.println("String_Node_Str",AbstractRequest.class.getCanonicalName(),request.getDataType().getParameterizedQualifiedSourceName(),jmethod.getReturnType().getParameterizedQualifiedSourceName());
      sw.indent();
      sw.println("String_Node_Str",method.getSimpleSourceName());
      sw.println("String_Node_Str");
      sw.println("String_Node_Str",RequestData.class.getCanonicalName());
      sw.indentln("String_Node_Str",RequestData.class.getCanonicalName(),operation,parameterArray);
      sw.println("String_Node_Str");
      sw.println("String_Node_Str");
      sw.indent();
      sw.println("String_Node_Str");
      if (request.isCollectionType()) {
        Class<?> collectionType=request.getCollectionType().equals(CollectionType.LIST) ? ArrayList.class : HashSet.class;
        sw.println("String_Node_Str",collectionType.getCanonicalName());
        String decodeMethod=request.isValueType() ? "String_Node_Str" : "String_Node_Str";
        sw.println("String_Node_Str",decodeMethod,ModelUtils.getQualifiedBaseName(request.getCollectionElementType()),collectionType.getCanonicalName());
      }
 else       if (request.isValueType()) {
        sw.println("String_Node_Str",ValueCodex.class.getCanonicalName(),ModelUtils.getQualifiedBaseName(request.getDataType()));
      }
 else       if (request.isEntityType()) {
        sw.println("String_Node_Str",request.getEntityType().getQualifiedSourceName());
      }
 else {
        sw.println("String_Node_Str");
      }
      sw.println("String_Node_Str",request.getDataType().getParameterizedQualifiedSourceName());
      sw.outdent();
      sw.println("String_Node_Str");
      sw.outdent();
      sw.println("String_Node_Str");
      sw.println("String_Node_Str");
      if (!request.isInstance()) {
        sw.println("String_Node_Str");
      }
      sw.println("String_Node_Str");
      sw.outdent();
      sw.println("String_Node_Str");
    }
    sw.commit(logger);
  }
}