Program: 9138
Project: 9138
Buggy source:
public void generateDispatchMethod(ClassScope classScope,ClassFile classFile){
  EclipseFactory world=EclipseFactory.fromScopeLookupEnvironment(classScope);
  UnresolvedType aspectType=world.fromBinding(classScope.referenceContext.binding);
  ResolvedMember signature=munger.getSignature();
  ResolvedMember dispatchMember=AjcMemberMaker.interMethodDispatcher(signature,aspectType);
  MethodBinding dispatchBinding=world.makeMethodBinding(dispatchMember,munger.getTypeVariableAliases(),munger.getSignature().getDeclaringType());
  MethodBinding introducedMethod=world.makeMethodBinding(AjcMemberMaker.interMethod(signature,aspectType,onTypeBinding.isInterface()),munger.getTypeVariableAliases());
  classFile.generateMethodInfoHeader(dispatchBinding);
  int methodAttributeOffset=classFile.contentsOffset;
  int attributeNumber=classFile.generateMethodInfoAttribute(binding,false,makeEffectiveSignatureAttribute(signature,Shadow.MethodCall,false));
  int codeAttributeOffset=classFile.contentsOffset;
  classFile.generateCodeAttributeHeader();
  CodeStream codeStream=classFile.codeStream;
  codeStream.reset(this,classFile);
  codeStream.initializeMaxLocals(dispatchBinding);
  Argument[] itdArgs=this.arguments;
  if (itdArgs != null) {
    for (int a=0; a < itdArgs.length; a++) {
      LocalVariableBinding lvb=itdArgs[a].binding;
      LocalVariableBinding lvbCopy=new LocalVariableBinding(lvb.name,lvb.type,lvb.modifiers,true);
      codeStream.record(lvbCopy);
      lvbCopy.recordInitializationStartPC(0);
      lvbCopy.resolvedPosition=lvb.resolvedPosition;
    }
  }
  MethodBinding methodBinding=introducedMethod;
  TypeBinding[] parameters=methodBinding.parameters;
  int length=parameters.length;
  int resolvedPosition;
  if (methodBinding.isStatic())   resolvedPosition=0;
 else {
    codeStream.aload_0();
    resolvedPosition=1;
  }
  for (int i=0; i < length; i++) {
    codeStream.load(parameters[i],resolvedPosition);
    if ((parameters[i] == TypeBinding.DOUBLE) || (parameters[i] == TypeBinding.LONG))     resolvedPosition+=2;
 else     resolvedPosition++;
  }
  if (methodBinding.isStatic())   codeStream.invokestatic(methodBinding);
 else {
    if (methodBinding.declaringClass.isInterface()) {
      codeStream.invokeinterface(methodBinding);
    }
 else {
      codeStream.invokevirtual(methodBinding);
    }
  }
  AstUtil.generateReturn(dispatchBinding.returnType,codeStream);
  if (itdArgs != null) {
    for (int a=0; a < itdArgs.length; a++) {
      codeStream.locals[a].recordInitializationEndPC(codeStream.position);
    }
  }
  classFile.completeCodeAttribute(codeAttributeOffset);
  attributeNumber++;
  classFile.completeMethodInfo(methodAttributeOffset,attributeNumber);
}

Fixed version (ground truth):
public void generateDispatchMethod(ClassScope classScope,ClassFile classFile){
  EclipseFactory world=EclipseFactory.fromScopeLookupEnvironment(classScope);
  UnresolvedType aspectType=world.fromBinding(classScope.referenceContext.binding);
  ResolvedMember signature=munger.getSignature();
  ResolvedMember dispatchMember=AjcMemberMaker.interMethodDispatcher(signature,aspectType);
  MethodBinding dispatchBinding=world.makeMethodBinding(dispatchMember,munger.getTypeVariableAliases(),munger.getSignature().getDeclaringType());
  MethodBinding introducedMethod=world.makeMethodBinding(AjcMemberMaker.interMethod(signature,aspectType,onTypeBinding.isInterface()),munger.getTypeVariableAliases());
  classFile.generateMethodInfoHeader(dispatchBinding);
  int methodAttributeOffset=classFile.contentsOffset;
  int attributeNumber=classFile.generateMethodInfoAttribute(binding,false,makeEffectiveSignatureAttribute(signature,Shadow.MethodCall,false));
  int codeAttributeOffset=classFile.contentsOffset;
  classFile.generateCodeAttributeHeader();
  CodeStream codeStream=classFile.codeStream;
  codeStream.reset(this,classFile);
  codeStream.initializeMaxLocals(dispatchBinding);
  Argument[] itdArgs=this.arguments;
  if (itdArgs != null) {
    for (int a=0; a < itdArgs.length; a++) {
      LocalVariableBinding lvb=itdArgs[a].binding;
      LocalVariableBinding lvbCopy=new LocalVariableBinding(lvb.name,lvb.type,lvb.modifiers,true);
      codeStream.record(lvbCopy);
      lvbCopy.recordInitializationStartPC(0);
      lvbCopy.resolvedPosition=lvb.resolvedPosition;
    }
  }
  MethodBinding methodBinding=introducedMethod;
  TypeBinding[] parameters=methodBinding.parameters;
  int length=parameters.length;
  int resolvedPosition;
  if (methodBinding.isStatic())   resolvedPosition=0;
 else {
    codeStream.aload_0();
    resolvedPosition=1;
  }
  for (int i=0; i < length; i++) {
    codeStream.load(parameters[i],resolvedPosition);
    if ((parameters[i] == TypeBinding.DOUBLE) || (parameters[i] == TypeBinding.LONG))     resolvedPosition+=2;
 else     resolvedPosition++;
  }
  if (methodBinding.isStatic())   codeStream.invokestatic(methodBinding);
 else {
    if (methodBinding.declaringClass.isInterface()) {
      codeStream.invokeinterface(methodBinding);
    }
 else {
      codeStream.invokevirtual(methodBinding);
    }
  }
  AstUtil.generateReturn(dispatchBinding.returnType,codeStream);
  if (itdArgs != null && codeStream.locals != null) {
    for (int a=0; a < itdArgs.length; a++) {
      if (codeStream.locals[a] != null) {
        codeStream.locals[a].recordInitializationEndPC(codeStream.position);
      }
    }
  }
  classFile.completeCodeAttribute(codeAttributeOffset);
  attributeNumber++;
  classFile.completeMethodInfo(methodAttributeOffset,attributeNumber);
}