Program: 187075
Project: 187075
Buggy source:
/** 
 * Check if a method call can be inlined, depending on the configuration and the class structs. The invoked method must be resolved first, and it must be ensured that this method is the only (known) method which can be called (p.e. by calling invoked.  {@link com.jopdesign.libgraph.struct.MethodInfo#isOverwritten()}) as this is not checked here to allow for more sophisticated devirtualization techniques. <p> This depends on the flags and classinfos of the called method, and on the configuration. This function does not check for resulting code sizes etc. </p><p> Here the correct method is determined and the safety criteria for inlining are checked as described in 'Practial Techniques For Virtual Call Resolution In Java' by Vijay Sundaresan and the Java Virtual Machine Specification Second Edition. </p>
 * @param caller the calling method
 * @param invoked the resolved, invoked method.
 * @param stmt the invoke stmt handle, must be a handle of an {@link InvokeStmt}.
 * @param localsOffset the variable offset to use for the inlined method.
 * @param parentInlines a set of {@link com.jopdesign.libgraph.struct.MethodInfo}s of already inlined method which contain this statement.
 * @return null if no inlining should be performed, else a checkresult.
 */
public CheckResult checkInvocation(MethodInfo caller,MethodInfo invoked,StmtHandle stmt,int localsOffset,List parentInlines){
  if (invoked == null || caller == null || !(stmt.getStatement() instanceof InvokeStmt)) {
    return null;
  }
  InvokeStmt invoke=(InvokeStmt)stmt.getStatement();
  if (!checkPreliminaries(caller,invoke.getClassInfo(),invoked,parentInlines)) {
    return null;
  }
  boolean unsafeInline=!(invoked.isStatic() || invoked.isPrivate() || invoked.isFinal()|| !assumeDynLoading);
  if (unsafeInline && !useCheckCode) {
    return null;
  }
  CheckResult rs=null;
  try {
    MethodCode code=invoked.getMethodCode();
    ControlFlowGraph srcGraph=code.createGraph();
    if (!checkCodesize(code.getCodeSize(),srcGraph,localsOffset)) {
      return null;
    }
    Set makePublic=checkGraph(caller,invoked,srcGraph);
    if (makePublic != null) {
      rs=new CheckResult(stmt,invoked,srcGraph,unsafeInline,code.getCodeSize(),srcGraph.getVariableTable().size(),localsOffset);
      rs.setChangePublic(makePublic);
      rs.setParentInlines(parentInlines);
    }
  }
 catch (  GraphException e) {
    logger.warn("String_Node_Str" + invoked.getFQMethodName() + "String_Node_Str");
    return null;
  }
  return rs;
}

Fixed version (ground truth):
/** 
 * Check if a method call can be inlined, depending on the configuration and the class structs. The invoked method must be resolved first, and it must be ensured that this method is the only (known) method which can be called (p.e. by calling invoked.  {@link com.jopdesign.libgraph.struct.MethodInfo#isOverwritten()}) as this is not checked here to allow for more sophisticated devirtualization techniques. <p> This depends on the flags and classinfos of the called method, and on the configuration. This function does not check for resulting code sizes etc. </p><p> Here the correct method is determined and the safety criteria for inlining are checked as described in 'Practial Techniques For Virtual Call Resolution In Java' by Vijay Sundaresan and the Java Virtual Machine Specification Second Edition. </p>
 * @param caller the calling method
 * @param invoked the resolved, invoked method.
 * @param stmt the invoke stmt handle, must be a handle of an {@link InvokeStmt}.
 * @param localsOffset the variable offset to use for the inlined method.
 * @param parentInlines a set of {@link com.jopdesign.libgraph.struct.MethodInfo}s of already inlined method which contain this statement.
 * @return null if no inlining should be performed, else a checkresult.
 */
public CheckResult checkInvocation(MethodInfo caller,MethodInfo invoked,StmtHandle stmt,int localsOffset,List parentInlines){
  if (invoked == null || caller == null || !(stmt.getStatement() instanceof InvokeStmt)) {
    return null;
  }
  InvokeStmt invoke=(InvokeStmt)stmt.getStatement();
  if (!checkPreliminaries(caller,invoke.getClassInfo(),invoked,parentInlines)) {
    return null;
  }
  boolean unsafeInline=!(invoked.isStatic() || invoked.isPrivate() || invoked.isFinal()|| !assumeDynLoading);
  if (unsafeInline && !useCheckCode) {
    return null;
  }
  CheckResult rs=null;
  try {
    MethodCode code=invoked.getMethodCode();
    ControlFlowGraph srcGraph=code.getGraph();
    if (!checkCodesize(code.getCodeSize(),srcGraph,localsOffset)) {
      return null;
    }
    Set makePublic=checkGraph(caller,invoked,srcGraph);
    if (makePublic != null) {
      rs=new CheckResult(stmt,invoked,srcGraph,unsafeInline,code.getCodeSize(),srcGraph.getVariableTable().size(),localsOffset);
      rs.setChangePublic(makePublic);
      rs.setParentInlines(parentInlines);
    }
  }
 catch (  GraphException e) {
    logger.warn("String_Node_Str" + invoked.getFQMethodName() + "String_Node_Str");
    return null;
  }
  return rs;
}