Program: 24569
Project: 24569
Buggy source:
/** 
 * @param context
 * @param localPackageName
 * @param jc
 * @param localClassName
 */
public String generateSubClass(GeneratorContext context,String localPackageName,JClassType jc,String localClassName){
  this.jc=jc;
  this.className=localClassName;
  this.packageName=localPackageName;
  PrintWriter printWriter=context.tryCreate(logger,packageName,className);
  if (printWriter == null) {
    return generateSubClass(context,packageName,jc,className + sequencer++);
  }
  sequencer=0;
  ClassSourceFileComposerFactory composer=null;
  if (jc.isParameterized() != null) {
    this.jc=jc.isParameterized().getBaseType();
    String temp=this.jc.getParameterizedQualifiedSourceName();
    String name="String_Node_Str" + temp.substring(temp.lastIndexOf('.') + 1);
    composer=new ClassSourceFileComposerFactory(packageName,name);
  }
 else {
    composer=new ClassSourceFileComposerFactory(packageName,className);
  }
  fields=getFields(this.jc);
  composer.addImport(List.class.getCanonicalName());
  composer.addImport(JsonValue.class.getCanonicalName());
  composer.addImport(JSONValue.class.getCanonicalName());
  composer.addImport(JSONObject.class.getCanonicalName());
  composer.addImport(FrameEncoder.class.getCanonicalName());
  composer.addImport(jc.getQualifiedSourceName());
  composer.addImplementedInterface(JsonValue.class.getCanonicalName() + "String_Node_Str" + jc.getSimpleSourceName()+ "String_Node_Str");
  SourceWriter sourceWriter=composer.createSourceWriter(context,printWriter);
  for (  JField f : fields) {
    if (f.getType().isPrimitive() == null && f.getType().isTypeParameter() == null) {
      String s=f.getType().getQualifiedSourceName();
      composer.addImport(s);
    }
  }
  writeFromJson(sourceWriter);
  writeToJson(sourceWriter);
  writeNatives(sourceWriter);
  sourceWriter.outdent();
  sourceWriter.println("String_Node_Str");
  context.commit(logger,printWriter);
  return className;
}

Fixed version (ground truth):
/** 
 * @param context
 * @param localPackageName
 * @param jc
 * @param localClassName
 */
public String generateSubClass(GeneratorContext context,JClassType jc){
  this.jc=jc;
  this.className="String_Node_Str" + jc.getSimpleSourceName();
  JParameterizedType parameterizedType=jc.isParameterized();
  if (parameterizedType != null) {
    this.jc=parameterizedType.getBaseType();
    this.suffix=getParameterizedSimpleSourceName(parameterizedType.getBaseType());
  }
 else {
    this.suffix="String_Node_Str";
  }
  this.packageName=jc.getPackage().getName();
  PrintWriter printWriter=context.tryCreate(logger,packageName,className);
  if (printWriter == null) {
    return null;
  }
  ClassSourceFileComposerFactory composer=null;
  composer=new ClassSourceFileComposerFactory(packageName,className + suffix);
  fields=getFields(this.jc);
  composer.addImport(List.class.getCanonicalName());
  composer.addImport(JSONValue.class.getCanonicalName());
  composer.addImport(JSONObject.class.getCanonicalName());
  composer.addImport(FrameEncoder.class.getCanonicalName());
  composer.addImport(UnableToSerialize.class.getCanonicalName());
  composer.addImport(UnableToDeserialize.class.getCanonicalName());
  composer.addImplementedInterface(JsonValue.class.getCanonicalName() + "String_Node_Str" + jc.getQualifiedSourceName()+ suffix+ "String_Node_Str");
  SourceWriter sourceWriter=composer.createSourceWriter(context,printWriter);
  writeFromJson(sourceWriter);
  writeToJson(sourceWriter);
  writeNatives(sourceWriter);
  sourceWriter.outdent();
  sourceWriter.println("String_Node_Str");
  context.commit(logger,printWriter);
  return packageName + "String_Node_Str" + className;
}