Program: 46602
Project: 46602
Buggy source:
private void addThisReference(ConstructorNode node){
  if (classNode.isEnum() || classNode.isInterface())   return;
  if ((classNode.getModifiers() & Opcodes.ACC_STATIC) != 0)   return;
  Statement code=node.getCode();
  if (!(classNode instanceof InnerClassNode))   return;
  InnerClassNode innerClass=(InnerClassNode)classNode;
  if (innerClass.getVariableScope() != null)   return;
  if ((innerClass.getModifiers() & ACC_STATIC) != 0)   return;
  Parameter[] params=node.getParameters();
  Parameter[] newParams=new Parameter[params.length + 1];
  System.arraycopy(params,0,newParams,1,params.length);
  Parameter thisPara=new Parameter(classNode.getOuterClass(),getUniqueName(params,node));
  newParams[0]=thisPara;
  node.setParameters(newParams);
  Statement firstStatement=node.getFirstStatement();
  BlockStatement block=null;
  if (code == null) {
    block=new BlockStatement();
  }
 else   if (!(code instanceof BlockStatement)) {
    block=new BlockStatement();
    block.addStatement(code);
  }
 else {
    block=(BlockStatement)code;
  }
  BlockStatement newCode=new BlockStatement();
  addFieldInit(thisPara,thisField,newCode);
  ConstructorCallExpression cce=getFirstIfSpecialConstructorCall(block);
  if (cce == null) {
    newCode.addStatement(block);
  }
 else   if (cce.isThisCall()) {
    TupleExpression args=(TupleExpression)cce.getArguments();
    List<Expression> expressions=args.getExpressions();
    VariableExpression ve=new VariableExpression(thisPara.getName());
    ve.setAccessedVariable(thisPara);
    expressions.add(0,ve);
    newCode=block;
  }
 else {
    block.getStatements().remove(0);
    newCode.getStatements().add(0,firstStatement);
    newCode.addStatement(block);
  }
  node.setCode(newCode);
}

Fixed version (ground truth):
private void addThisReference(ConstructorNode node){
  if (classNode.isEnum() || classNode.isInterface())   return;
  if ((classNode.getModifiers() & Opcodes.ACC_STATIC) != 0)   return;
  Statement code=node.getCode();
  if (!(classNode instanceof InnerClassNode))   return;
  InnerClassNode innerClass=(InnerClassNode)classNode;
  if (innerClass.getVariableScope() != null)   return;
  if ((innerClass.getModifiers() & ACC_STATIC) != 0)   return;
  Parameter[] params=node.getParameters();
  Parameter[] newParams=new Parameter[params.length + 1];
  System.arraycopy(params,0,newParams,1,params.length);
  Parameter thisPara=new Parameter(classNode.getOuterClass(),getUniqueName(params,node));
  newParams[0]=thisPara;
  node.setParameters(newParams);
  Statement firstStatement=node.getFirstStatement();
  BlockStatement block=null;
  if (code == null) {
    block=new BlockStatement();
  }
 else   if (!(code instanceof BlockStatement)) {
    block=new BlockStatement();
    block.addStatement(code);
  }
 else {
    block=(BlockStatement)code;
  }
  BlockStatement newCode=new BlockStatement();
  addFieldInit(thisPara,thisField,newCode);
  ConstructorCallExpression cce=getFirstIfSpecialConstructorCall(block);
  if (cce == null) {
    block.getStatements().add(0,newCode);
  }
 else   if (cce.isThisCall()) {
    TupleExpression args=(TupleExpression)cce.getArguments();
    List<Expression> expressions=args.getExpressions();
    VariableExpression ve=new VariableExpression(thisPara.getName());
    ve.setAccessedVariable(thisPara);
    expressions.add(0,ve);
    newCode=block;
  }
 else {
    block.getStatements().add(1,newCode);
  }
  node.setCode(block);
}