Program: 25717
Project: 25717
Buggy source:
/** 
 * Replaces the method call with the bytecode derived from the given source text. <p>$0 is available even if the called method is static. If the field access is writing, $_ is available but the value of $_ is ignored.
 * @param statement         a Java statement.
 */
public void replace(String statement) throws CannotCompileException {
  ConstPool constPool=getConstPool();
  int pos=currentPos;
  int index=iterator.u16bitAt(pos + 1);
  Javac jc=new Javac(thisClass);
  CodeAttribute ca=iterator.get();
  try {
    CtClass[] params;
    CtClass retType;
    CtClass fieldType=Descriptor.toCtClass(constPool.getFieldrefType(index),thisClass.getClassPool());
    boolean read=isReader();
    if (read) {
      params=new CtClass[0];
      retType=fieldType;
    }
 else {
      params=new CtClass[1];
      params[0]=fieldType;
      retType=CtClass.voidType;
    }
    int paramVar=ca.getMaxLocals();
    jc.recordParams(constPool.getFieldrefClassName(index),params,true,paramVar,withinStatic());
    boolean included=checkResultValue(retType,statement);
    if (read)     included=true;
    int retVar=jc.recordReturnType(retType,included);
    if (read)     jc.recordProceed(new ProceedForRead(retType,opcode,index,paramVar));
 else {
      jc.recordType(fieldType);
      jc.recordProceed(new ProceedForWrite(params[0],opcode,index,paramVar));
    }
    Bytecode bytecode=jc.getBytecode();
    storeStack(params,isStatic(),paramVar,bytecode);
    jc.recordLocalVariables(ca,pos);
    if (included)     if (retType == CtClass.voidType) {
      bytecode.addOpcode(ACONST_NULL);
      bytecode.addAstore(retVar);
    }
 else {
      bytecode.addConstZero(retType);
      bytecode.addStore(retVar,retType);
    }
    jc.compileStmnt(statement);
    if (read)     bytecode.addLoad(retVar,retType);
    replace0(pos,bytecode,3);
  }
 catch (  CompileError e) {
    throw new CannotCompileException(e);
  }
catch (  NotFoundException e) {
    throw new CannotCompileException(e);
  }
catch (  BadBytecode e) {
    throw new CannotCompileException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Replaces the method call with the bytecode derived from the given source text. <p>$0 is available even if the called method is static. If the field access is writing, $_ is available but the value of $_ is ignored.
 * @param statement         a Java statement.
 */
public void replace(String statement) throws CannotCompileException {
  thisClass.getClassFile();
  ConstPool constPool=getConstPool();
  int pos=currentPos;
  int index=iterator.u16bitAt(pos + 1);
  Javac jc=new Javac(thisClass);
  CodeAttribute ca=iterator.get();
  try {
    CtClass[] params;
    CtClass retType;
    CtClass fieldType=Descriptor.toCtClass(constPool.getFieldrefType(index),thisClass.getClassPool());
    boolean read=isReader();
    if (read) {
      params=new CtClass[0];
      retType=fieldType;
    }
 else {
      params=new CtClass[1];
      params[0]=fieldType;
      retType=CtClass.voidType;
    }
    int paramVar=ca.getMaxLocals();
    jc.recordParams(constPool.getFieldrefClassName(index),params,true,paramVar,withinStatic());
    boolean included=checkResultValue(retType,statement);
    if (read)     included=true;
    int retVar=jc.recordReturnType(retType,included);
    if (read)     jc.recordProceed(new ProceedForRead(retType,opcode,index,paramVar));
 else {
      jc.recordType(fieldType);
      jc.recordProceed(new ProceedForWrite(params[0],opcode,index,paramVar));
    }
    Bytecode bytecode=jc.getBytecode();
    storeStack(params,isStatic(),paramVar,bytecode);
    jc.recordLocalVariables(ca,pos);
    if (included)     if (retType == CtClass.voidType) {
      bytecode.addOpcode(ACONST_NULL);
      bytecode.addAstore(retVar);
    }
 else {
      bytecode.addConstZero(retType);
      bytecode.addStore(retVar,retType);
    }
    jc.compileStmnt(statement);
    if (read)     bytecode.addLoad(retVar,retType);
    replace0(pos,bytecode,3);
  }
 catch (  CompileError e) {
    throw new CannotCompileException(e);
  }
catch (  NotFoundException e) {
    throw new CannotCompileException(e);
  }
catch (  BadBytecode e) {
    throw new CannotCompileException("String_Node_Str");
  }
}