Program: 9691
Project: 9691
Buggy source:
private MethodDeclaration makePreMethod(ClassScope scope,ExplicitConstructorCall explicitConstructorCall){
  EclipseWorld world=EclipseWorld.fromScopeLookupEnvironment(scope);
  TypeX aspectTypeX=EclipseWorld.fromBinding(binding.declaringClass);
  TypeX targetTypeX=EclipseWorld.fromBinding(onTypeBinding);
  ArrayBinding objectArrayBinding=scope.createArray(scope.getJavaLangObject(),1);
  MethodDeclaration pre=new MethodDeclaration(compilationResult);
  pre.modifiers=AccPublic | AccStatic;
  pre.returnType=AstUtil.makeTypeReference(objectArrayBinding);
  pre.selector=NameMangler.postIntroducedConstructor(aspectTypeX,targetTypeX).toCharArray();
  pre.arguments=AstUtil.copyArguments(this.arguments);
  pre.scope=new MethodScope(scope,pre,true);
  pre.binding=world.makeMethodBinding(AjcMemberMaker.preIntroducedConstructor(aspectTypeX,targetTypeX,world.fromBindings(binding.parameters)));
  pre.bindArguments();
  pre.bindThrownExceptions();
  if (explicitConstructorCall == null) {
    pre.statements=new Statement[]{};
  }
 else {
    pre.statements=new Statement[]{explicitConstructorCall};
  }
  InterTypeScope newParent=new InterTypeScope(scope,onTypeBinding);
  pre.scope.parent=newParent;
  pre.resolveStatements(newParent);
  int nParams=pre.arguments.length;
  MethodBinding explicitConstructor=null;
  if (explicitConstructorCall != null) {
    explicitConstructor=explicitConstructorCall.binding;
    if (explicitConstructor.alwaysNeedsAccessMethod()) {
      explicitConstructor=explicitConstructor.getAccessMethod();
    }
  }
  int nExprs;
  if (explicitConstructor == null)   nExprs=0;
 else   nExprs=explicitConstructor.parameters.length;
  ArrayInitializer init=new ArrayInitializer();
  init.expressions=new Expression[nExprs + nParams];
  int index=0;
  for (int i=0; i < nExprs; i++) {
    if (i >= explicitConstructorCall.arguments.length) {
      init.expressions[index++]=new NullLiteral(0,0);
      continue;
    }
    Expression arg=explicitConstructorCall.arguments[i];
    ResolvedMember conversionMethod=AjcMemberMaker.toObjectConversionMethod(world.fromBinding(explicitConstructorCall.binding.parameters[i]));
    if (conversionMethod != null) {
      arg=new KnownMessageSend(world.makeMethodBindingForCall(conversionMethod),new CastExpression(new NullLiteral(0,0),AstUtil.makeTypeReference(world.makeTypeBinding(AjcMemberMaker.CONVERSIONS_TYPE))),new Expression[]{arg});
    }
    init.expressions[index++]=arg;
  }
  for (int i=0; i < nParams; i++) {
    LocalVariableBinding binding=pre.arguments[i].binding;
    Expression arg=AstUtil.makeResolvedLocalVariableReference(binding);
    ResolvedMember conversionMethod=AjcMemberMaker.toObjectConversionMethod(world.fromBinding(binding.type));
    if (conversionMethod != null) {
      arg=new KnownMessageSend(world.makeMethodBindingForCall(conversionMethod),new CastExpression(new NullLiteral(0,0),AstUtil.makeTypeReference(world.makeTypeBinding(AjcMemberMaker.CONVERSIONS_TYPE))),new Expression[]{arg});
    }
    init.expressions[index++]=arg;
  }
  init.binding=objectArrayBinding;
  ArrayAllocationExpression newArray=new ArrayAllocationExpression();
  newArray.initializer=init;
  newArray.type=AstUtil.makeTypeReference(scope.getJavaLangObject());
  newArray.dimensions=new Expression[1];
  newArray.constant=NotAConstant;
  pre.statements=new Statement[]{new ReturnStatement(newArray,0,0)};
  return pre;
}

Fixed version (ground truth):
private MethodDeclaration makePreMethod(ClassScope scope,ExplicitConstructorCall explicitConstructorCall){
  EclipseWorld world=EclipseWorld.fromScopeLookupEnvironment(scope);
  TypeX aspectTypeX=EclipseWorld.fromBinding(binding.declaringClass);
  TypeX targetTypeX=EclipseWorld.fromBinding(onTypeBinding);
  ArrayBinding objectArrayBinding=scope.createArray(scope.getJavaLangObject(),1);
  MethodDeclaration pre=new MethodDeclaration(compilationResult);
  pre.modifiers=AccPublic | AccStatic;
  pre.returnType=AstUtil.makeTypeReference(objectArrayBinding);
  pre.selector=NameMangler.postIntroducedConstructor(aspectTypeX,targetTypeX).toCharArray();
  pre.arguments=AstUtil.copyArguments(this.arguments);
  pre.scope=new MethodScope(scope,pre,true);
  pre.binding=world.makeMethodBinding(AjcMemberMaker.preIntroducedConstructor(aspectTypeX,targetTypeX,world.fromBindings(binding.parameters)));
  pre.bindArguments();
  pre.bindThrownExceptions();
  if (explicitConstructorCall == null) {
    pre.statements=new Statement[]{};
  }
 else {
    pre.statements=new Statement[]{explicitConstructorCall};
  }
  InterTypeScope newParent=new InterTypeScope(scope,onTypeBinding);
  pre.scope.parent=newParent;
  pre.resolveStatements(newParent);
  int nParams=pre.arguments.length;
  MethodBinding explicitConstructor=null;
  if (explicitConstructorCall != null) {
    explicitConstructor=explicitConstructorCall.binding;
    if (explicitConstructor.alwaysNeedsAccessMethod()) {
      explicitConstructor=explicitConstructor.getAccessMethod(true);
    }
  }
  int nExprs;
  if (explicitConstructor == null)   nExprs=0;
 else   nExprs=explicitConstructor.parameters.length;
  ArrayInitializer init=new ArrayInitializer();
  init.expressions=new Expression[nExprs + nParams];
  int index=0;
  for (int i=0; i < nExprs; i++) {
    if (i >= explicitConstructorCall.arguments.length) {
      init.expressions[index++]=new NullLiteral(0,0);
      continue;
    }
    Expression arg=explicitConstructorCall.arguments[i];
    ResolvedMember conversionMethod=AjcMemberMaker.toObjectConversionMethod(world.fromBinding(explicitConstructorCall.binding.parameters[i]));
    if (conversionMethod != null) {
      arg=new KnownMessageSend(world.makeMethodBindingForCall(conversionMethod),new CastExpression(new NullLiteral(0,0),AstUtil.makeTypeReference(world.makeTypeBinding(AjcMemberMaker.CONVERSIONS_TYPE))),new Expression[]{arg});
    }
    init.expressions[index++]=arg;
  }
  for (int i=0; i < nParams; i++) {
    LocalVariableBinding binding=pre.arguments[i].binding;
    Expression arg=AstUtil.makeResolvedLocalVariableReference(binding);
    ResolvedMember conversionMethod=AjcMemberMaker.toObjectConversionMethod(world.fromBinding(binding.type));
    if (conversionMethod != null) {
      arg=new KnownMessageSend(world.makeMethodBindingForCall(conversionMethod),new CastExpression(new NullLiteral(0,0),AstUtil.makeTypeReference(world.makeTypeBinding(AjcMemberMaker.CONVERSIONS_TYPE))),new Expression[]{arg});
    }
    init.expressions[index++]=arg;
  }
  init.binding=objectArrayBinding;
  ArrayAllocationExpression newArray=new ArrayAllocationExpression();
  newArray.initializer=init;
  newArray.type=AstUtil.makeTypeReference(scope.getJavaLangObject());
  newArray.dimensions=new Expression[1];
  newArray.constant=NotAConstant;
  pre.statements=new Statement[]{new ReturnStatement(newArray,0,0)};
  return pre;
}