Program: 63498
Project: 63498
Buggy source:
private void createDelegateMethod(JavaWriter classWriter,ExecutableElement method,String newElementName) throws IOException {
  if (!isPublicOrProtectedMethod(method))   return;
  if (isAnnotatedWith(method,Init.class))   return;
  AnnotationMirror cachedAnnotation=getAnnotation(method,CacheThenCall.class);
  boolean isCached=cachedAnnotation != null;
  boolean isUiThread=getAnnotation(method,Ui.class) != null;
  boolean hasResult=!isVoid(method);
  if (isCached && !hasResult)   logger.error(method,cachedAnnotation,"String_Node_Str");
  if (hasResult && hasTypeParameters(processingEnv,method.getReturnType()))   logger.error(method,"String_Node_Str");
  String annotationCacheToParse=null;
  String cacheValueFromMethodSignatureToParse=defineKeyFromMethod(method);
  if (isCached) {
    String annotationValue=getAnnotationValue(cachedAnnotation,"String_Node_Str");
    annotationCacheToParse=annotationValue == null ? cacheValueFromMethodSignatureToParse : annotationValue;
    if (!isAssignable(processingEnv,method.getReturnType(),Serializable.class))     logger.error(method,method.getReturnType() + "String_Node_Str");
  }
  classWriter.emitEmptyLine().beginMethod(method.getReturnType().toString(),method.getSimpleName().toString(),method.getModifiers(),Utils.formatParameters(method,true),null);
  classWriter.emitField("String_Node_Str","String_Node_Str",of(FINAL),parseCacheKeyValue(cacheValueFromMethodSignatureToParse));
  AnnotationMirror annotation=getAnnotation(method,Serial.class);
  String serial=annotation == null ? SERIAL_DEFAULT : (String)getAnnotationValue(annotation,"String_Node_Str");
  AnnotationMirror nullAnnotation=getAnnotation(method,Null.class);
  boolean isNullManaged=nullAnnotation != null;
  if (isNullManaged && isVoid(method))   logger.error(method,"String_Node_Str");
  TypeMirror nullClass=nullAnnotation == null ? null : (TypeMirror)getAnnotationValue(nullAnnotation,"String_Node_Str");
  if (isNullManaged) {
    TypeElement nullTypeElement=processingEnv.getElementUtils().getTypeElement(nullClass.toString());
    if (isAbstract(nullTypeElement))     logger.error(method,nullAnnotation,"String_Node_Str","String_Node_Str");
    if (!hasPublicConstructor(nullTypeElement))     logger.error(method,nullAnnotation,"String_Node_Str","String_Node_Str");
  }
  if (isCached) {
    classWriter.emitField("String_Node_Str","String_Node_Str",of(FINAL),parseCacheKeyValue(annotationCacheToParse));
    StringWriter buffer=new StringWriter();
    JavaWriter inner=new JavaWriter(buffer);
    inner.emitPackage("String_Node_Str").beginType("String_Node_Str","String_Node_Str").emitAnnotation("String_Node_Str").beginMethod("String_Node_Str","String_Node_Str",of(PUBLIC)).emitStatement("String_Node_Str",method.getReturnType(),method.getReturnType()).emitStatement("String_Node_Str").emitStatement("String_Node_Str").emitStatement("String_Node_Str").emitStatement("String_Node_Str").endMethod().endType();
    classWriter.emitStatement("String_Node_Str",buffer.toString(),SERIAL_CHECK_CACHE);
  }
  String threadingPrefix=isUiThread ? "String_Node_Str" : "String_Node_Str";
  String threadingSuffix=isUiThread ? "String_Node_Str" : "String_Node_Str";
  String runnableCode;
  StringWriter buffer=new StringWriter();
  JavaWriter inner=new JavaWriter(buffer);
  inner.emitPackage("String_Node_Str");
  inner.beginType("String_Node_Str","String_Node_Str");
  inner.emitAnnotation("String_Node_Str");
  inner.beginMethod("String_Node_Str","String_Node_Str",of(PUBLIC));
  beginErrorManagement(method,inner);
  if (hasResult) {
    inner.emitStatement("String_Node_Str",method.getReturnType(),newElementName,method.getSimpleName(),formatParametersForCall(method)).beginControlFlow("String_Node_Str");
    if (isNullManaged) {
      inner.emitStatement("String_Node_Str",nullClass).emitStatement("String_Node_Str").emitStatement("String_Node_Str");
    }
 else {
      inner.emitStatement("String_Node_Str");
    }
    inner.endControlFlow().emitStatement("String_Node_Str").emitStatement("String_Node_Str").emitStatement("String_Node_Str");
    if (isCached)     inner.emitStatement("String_Node_Str");
    inner.emitStatement("String_Node_Str");
  }
 else {
    inner.emitStatement("String_Node_Str",newElementName,method.getSimpleName(),formatParametersForCall(method));
  }
  endErrorManagement(method,inner);
  inner.endMethod();
  inner.endType();
  runnableCode=buffer.toString();
  classWriter.emitStatement(threadingPrefix + runnableCode + threadingSuffix,serial);
  if (hasResult)   classWriter.emitStatement("String_Node_Str");
  classWriter.endMethod();
}

Fixed version (ground truth):
private void createDelegateMethod(JavaWriter classWriter,ExecutableElement method,String newElementName) throws IOException {
  if (!isPublicOrProtectedMethod(method))   return;
  if (isAnnotatedWith(method,Init.class))   return;
  AnnotationMirror cachedAnnotation=getAnnotation(method,CacheThenCall.class);
  boolean isCached=cachedAnnotation != null;
  boolean isUiThread=getAnnotation(method,Ui.class) != null;
  boolean hasResult=!isVoid(method);
  if (isCached && !hasResult)   logger.error(method,cachedAnnotation,"String_Node_Str");
  if (hasResult && hasTypeParameters(processingEnv,method.getReturnType()))   logger.error(method,"String_Node_Str");
  String annotationCacheToParse=null;
  String cacheValueFromMethodSignatureToParse=defineKeyFromMethod(method);
  if (isCached) {
    String annotationValue=getAnnotationValue(cachedAnnotation,"String_Node_Str");
    annotationCacheToParse=annotationValue == null ? cacheValueFromMethodSignatureToParse : annotationValue;
    if (!isAssignable(processingEnv,method.getReturnType(),Serializable.class))     logger.error(method,method.getReturnType() + "String_Node_Str");
  }
  classWriter.emitEmptyLine().beginMethod(method.getReturnType().toString(),method.getSimpleName().toString(),method.getModifiers(),Utils.formatParameters(method,true),null);
  classWriter.emitField("String_Node_Str","String_Node_Str",of(FINAL),parseCacheKeyValue(cacheValueFromMethodSignatureToParse));
  AnnotationMirror annotation=getAnnotation(method,Serial.class);
  String serial=annotation == null ? SERIAL_DEFAULT : (String)getAnnotationValue(annotation,"String_Node_Str");
  AnnotationMirror nullAnnotation=getAnnotation(method,Null.class);
  boolean isNullManaged=nullAnnotation != null;
  if (isNullManaged && isVoid(method))   logger.error(method,"String_Node_Str");
  TypeMirror nullClass=nullAnnotation == null ? null : (TypeMirror)getAnnotationValue(nullAnnotation,"String_Node_Str");
  if (isNullManaged) {
    TypeElement nullTypeElement=processingEnv.getElementUtils().getTypeElement(nullClass.toString());
    if (isAbstract(nullTypeElement))     logger.error(method,nullAnnotation,"String_Node_Str","String_Node_Str");
    if (!hasPublicConstructor(nullTypeElement))     logger.error(method,nullAnnotation,"String_Node_Str","String_Node_Str");
  }
  if (isCached) {
    classWriter.emitField("String_Node_Str","String_Node_Str",of(FINAL),parseCacheKeyValue(annotationCacheToParse));
    StringWriter buffer=new StringWriter();
    JavaWriter inner=new JavaWriter(buffer);
    inner.emitPackage("String_Node_Str").beginType("String_Node_Str","String_Node_Str").emitAnnotation("String_Node_Str").beginMethod("String_Node_Str","String_Node_Str",of(PUBLIC)).emitStatement("String_Node_Str",method.getReturnType(),method.getReturnType()).emitStatement("String_Node_Str").emitStatement("String_Node_Str").emitStatement("String_Node_Str").emitStatement("String_Node_Str").endMethod().endType();
    classWriter.emitStatement("String_Node_Str",buffer.toString(),SERIAL_CHECK_CACHE);
  }
  String threadingPrefix=isUiThread ? "String_Node_Str" : "String_Node_Str";
  String threadingSuffix=isUiThread ? "String_Node_Str" : "String_Node_Str";
  String runnableCode;
  StringWriter buffer=new StringWriter();
  JavaWriter inner=new JavaWriter(buffer);
  inner.emitPackage("String_Node_Str");
  inner.beginType("String_Node_Str","String_Node_Str");
  inner.emitAnnotation("String_Node_Str");
  inner.beginMethod("String_Node_Str","String_Node_Str",of(PUBLIC));
  beginErrorManagement(method,inner);
  if (hasResult) {
    inner.emitStatement("String_Node_Str",method.getReturnType(),newElementName,method.getSimpleName(),formatParametersForCall(method)).beginControlFlow("String_Node_Str");
    if (isNullManaged) {
      inner.emitStatement("String_Node_Str",nullClass).emitStatement("String_Node_Str").emitStatement("String_Node_Str").emitStatement("String_Node_Str");
    }
 else {
      inner.emitStatement("String_Node_Str");
    }
    inner.endControlFlow().emitStatement("String_Node_Str").emitStatement("String_Node_Str").emitStatement("String_Node_Str");
    if (isCached)     inner.emitStatement("String_Node_Str");
    inner.emitStatement("String_Node_Str");
  }
 else {
    inner.emitStatement("String_Node_Str",newElementName,method.getSimpleName(),formatParametersForCall(method));
  }
  endErrorManagement(method,inner);
  inner.endMethod();
  inner.endType();
  runnableCode=buffer.toString();
  classWriter.emitStatement(threadingPrefix + runnableCode + threadingSuffix,serial);
  if (hasResult)   classWriter.emitStatement("String_Node_Str");
  classWriter.endMethod();
}