Program: 40550
Project: 40550
Buggy source:
/** 
 * Creates a callee target based on the following criteria: <ol> <li> If the method being invoked through reflection is definitely static, then do not create a callee target for any <code>callee</code> method that is not static. In this case, return <code>null</code>. <li> If the method being invoked through reflection takes a constant number of parameters, <code>n</code>, then do not create a callee target for any <code>callee</code> method that takes a number of parameters different from <code>n</code>.  In this case, return <code>null</code>. <li> Otherwise, return a new   {@link ReceiverInstanceContext} for <code>receiver</code>.</ol>       
 */
public Context getCalleeTarget(CGNode caller,CallSiteReference site,IMethod callee,InstanceKey receiver){
  if (!mayUnderstand(caller,site,callee,receiver)) {
    return null;
  }
  IR ir=caller.getIR();
  SSAAbstractInvokeInstruction[] invokeInstructions=ir.getCalls(site);
  if (invokeInstructions.length != 1) {
    return new ReceiverInstanceContext(receiver);
  }
  SymbolTable st=ir.getSymbolTable();
  ConstantKey receiverConstantKey=(ConstantKey)receiver;
  IMethod m=(IMethod)receiverConstantKey.getValue();
  boolean isStatic=m.isStatic();
  boolean isConstructor=isConstructorConstant(receiver);
  if (!isConstructor) {
    int recvUse=invokeInstructions[0].getUse(1);
    if (st.isNullConstant(recvUse) && !isStatic) {
      return null;
    }
  }
  int numberOfParams=isStatic ? m.getNumberOfParameters() : m.getNumberOfParameters() - 1;
  int paramIndex=isConstructor ? 1 : 2;
  int paramUse=invokeInstructions[0].getUse(paramIndex);
  SSAInstruction instr=caller.getDU().getDef(paramUse);
  if (!(instr instanceof SSANewInstruction)) {
    return new ReceiverInstanceContext(receiver);
  }
  SSANewInstruction newInstr=(SSANewInstruction)instr;
  if (!newInstr.getConcreteType().isArrayType()) {
    return null;
  }
  int vn=newInstr.getUse(0);
  try {
    int arrayLength=st.getIntValue(vn);
    if (arrayLength == numberOfParams) {
      return new ReceiverInstanceContext(receiver);
    }
 else {
      return new IllegalArgumentExceptionContext();
    }
  }
 catch (  IllegalArgumentException e) {
    return new ReceiverInstanceContext(receiver);
  }
}

Fixed version (ground truth):
/** 
 * Creates a callee target based on the following criteria: <ol> <li> If the method being invoked through reflection is definitely static, then do not create a callee target for any <code>callee</code> method that is not static. In this case, return <code>null</code>. <li> If the method being invoked through reflection takes a constant number of parameters, <code>n</code>, then do not create a callee target for any <code>callee</code> method that takes a number of parameters different from <code>n</code>. In this case, return <code>null</code>. <li> Otherwise, return a new   {@link ReceiverInstanceContext} for <code>receiver</code>.</ol>
 */
public Context getCalleeTarget(CGNode caller,CallSiteReference site,IMethod callee,InstanceKey receiver){
  if (!mayUnderstand(caller,site,callee,receiver)) {
    return null;
  }
  IR ir=caller.getIR();
  SSAAbstractInvokeInstruction[] invokeInstructions=ir.getCalls(site);
  if (invokeInstructions.length != 1) {
    return new ReceiverInstanceContext(receiver);
  }
  SymbolTable st=ir.getSymbolTable();
  ConstantKey receiverConstantKey=(ConstantKey)receiver;
  IMethod m=(IMethod)receiverConstantKey.getValue();
  boolean isStatic=m.isStatic();
  boolean isConstructor=isConstructorConstant(receiver);
  if (!isConstructor) {
    int recvUse=invokeInstructions[0].getUse(1);
    if (st.isNullConstant(recvUse) && !isStatic) {
      return null;
    }
  }
  int numberOfParams=isStatic ? m.getNumberOfParameters() : m.getNumberOfParameters() - 1;
  int paramIndex=isConstructor ? 1 : 2;
  int paramUse=invokeInstructions[0].getUse(paramIndex);
  SSAInstruction instr=caller.getDU().getDef(paramUse);
  if (!(instr instanceof SSANewInstruction)) {
    return new ReceiverInstanceContext(receiver);
  }
  SSANewInstruction newInstr=(SSANewInstruction)instr;
  if (!newInstr.getConcreteType().isArrayType()) {
    return null;
  }
  int vn=newInstr.getUse(0);
  try {
    int arrayLength=st.getIntValue(vn);
    if (arrayLength == numberOfParams) {
      return new ReceiverInstanceContext(receiver);
    }
 else {
      return new IllegalArgumentExceptionContext();
    }
  }
 catch (  IllegalArgumentException e) {
    return new ReceiverInstanceContext(receiver);
  }
}