Program: 75421
Project: 75421
Buggy source:
private boolean _inlineMethodCalls(SootClass modelClass,SootClass theClass,SootMethod method,JimpleBody body,PortInliner inliner,boolean debug){
  boolean doneSomething=false;
  CompleteUnitGraph unitGraph=new CompleteUnitGraph(body);
  SimpleLocalDefs localDefs=new SimpleLocalDefs(unitGraph);
  SimpleLocalUses localUses=new SimpleLocalUses(unitGraph,localDefs);
  for (Iterator units=body.getUnits().snapshotIterator(); units.hasNext(); ) {
    Stmt stmt=(Stmt)units.next();
    if (!stmt.containsInvokeExpr()) {
      continue;
    }
    ValueBox box=stmt.getInvokeExprBox();
    Value value=stmt.getInvokeExpr();
    if (value instanceof InstanceInvokeExpr) {
      InstanceInvokeExpr r=(InstanceInvokeExpr)value;
      if (r.getBase().getType() instanceof RefType) {
        RefType type=(RefType)r.getBase().getType();
        if (r.getMethod().equals(PtolemyUtilities.connectionsChangedMethod)) {
          if (type.getSootClass().isApplicationClass()) {
            SootMethod inlinee=null;
            if (r instanceof VirtualInvokeExpr) {
              List methodList=Scene.v().getActiveHierarchy().resolveAbstractDispatch(type.getSootClass(),PtolemyUtilities.connectionsChangedMethod);
              if (methodList.size() == 1) {
                inlinee=(SootMethod)methodList.get(0);
              }
 else {
                String string="String_Node_Str" + stmt + "String_Node_Str"+ method+ "String_Node_Str";
                for (int i=0; i < methodList.size(); i++) {
                  string+="String_Node_Str" + methodList.get(i) + "String_Node_Str";
                }
                System.out.println(string);
              }
            }
 else             if (r instanceof SpecialInvokeExpr) {
              inlinee=Scene.v().getActiveHierarchy().resolveSpecialDispatch((SpecialInvokeExpr)r,method);
            }
            if (!inlinee.getDeclaringClass().isApplicationClass()) {
              inlinee.getDeclaringClass().setLibraryClass();
            }
            inlinee.retrieveActiveBody();
            if (debug)             System.out.println("String_Node_Str" + r);
            SiteInliner.inlineSite(inlinee,stmt,method);
            doneSomething=true;
          }
 else {
            body.getUnits().remove(stmt);
            doneSomething=true;
          }
        }
        Value argValues[]=new Value[r.getArgCount()];
        int constantArgCount=0;
        for (Iterator args=r.getArgs().iterator(); args.hasNext(); ) {
          Value arg=(Value)args.next();
          if (Evaluator.isValueConstantValued(arg)) {
            argValues[constantArgCount++]=Evaluator.getConstantValueOf(arg);
          }
 else {
            break;
          }
        }
        boolean allArgsAreConstant=(r.getArgCount() == constantArgCount);
        if (SootUtilities.derivesFrom(type.getSootClass(),PtolemyUtilities.componentPortClass)) {
          TypedIOPort port=(TypedIOPort)getPortValue(method,(Local)r.getBase(),stmt,localDefs,localUses);
          if (port == null) {
            continue;
          }
          if (port instanceof Typeable) {
            PtolemyUtilities.inlineTypeableMethods(body,stmt,box,r,(Typeable)port);
          }
          if (r.getMethod().getSubSignature().equals(PtolemyUtilities.getFullNameMethod.getSubSignature())) {
            box.setValue(StringConstant.v(port.getFullName()));
          }
          if (r.getMethod().getSubSignature().equals(PtolemyUtilities.getNameMethod.getSubSignature())) {
            box.setValue(StringConstant.v(port.getName()));
          }
          String methodName=r.getMethod().getName();
          if (port.getWidth() == 0 && (methodName.equals("String_Node_Str") || methodName.equals("String_Node_Str") || methodName.equals("String_Node_Str")|| methodName.equals("String_Node_Str"))) {
            Local local=SootUtilities.createRuntimeException(body,stmt,methodName + "String_Node_Str" + port.getFullName()+ "String_Node_Str");
            body.getUnits().insertBefore(Jimple.v().newThrowStmt(local),stmt);
            if (stmt instanceof DefinitionStmt) {
              if (methodName.equals("String_Node_Str") || methodName.equals("String_Node_Str")) {
                box.setValue(IntConstant.v(0));
              }
 else {
                box.setValue(NullConstant.v());
              }
            }
 else {
              body.getUnits().remove(stmt);
            }
            continue;
          }
          if (r.getMethod().getName().equals("String_Node_Str")) {
            if (port.isInput()) {
              box.setValue(IntConstant.v(1));
            }
 else {
              box.setValue(IntConstant.v(0));
            }
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            if (port.isOutput()) {
              box.setValue(IntConstant.v(1));
            }
 else {
              box.setValue(IntConstant.v(0));
            }
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            if (port.isMultiport()) {
              box.setValue(IntConstant.v(1));
            }
 else {
              box.setValue(IntConstant.v(0));
            }
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            Object object=SootUtilities.reflectAndInvokeMethod(port,r.getMethod(),argValues);
            Constant constant=SootUtilities.convertArgumentToConstantValue(object);
            box.setValue(constant);
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            box.setValue(IntConstant.v(1));
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            box.setValue(IntConstant.v(1));
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            inliner.inlineGet(body,stmt,box,r,port);
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            inliner.inlineSend(body,stmt,r,port);
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            if (port.getWidth() == 0) {
              body.getUnits().remove(stmt);
            }
 else {
              inliner.inlineBroadcast(body,stmt,r,port);
            }
          }
        }
      }
    }
  }
  return doneSomething;
}

Fixed version (ground truth):
private boolean _inlineMethodCalls(SootClass modelClass,SootClass theClass,SootMethod method,JimpleBody body,PortInliner inliner,boolean debug){
  if (debug)   System.out.println("String_Node_Str" + method);
  boolean doneSomething=false;
  CompleteUnitGraph unitGraph=new CompleteUnitGraph(body);
  SimpleLocalDefs localDefs=new SimpleLocalDefs(unitGraph);
  SimpleLocalUses localUses=new SimpleLocalUses(unitGraph,localDefs);
  for (Iterator units=body.getUnits().snapshotIterator(); units.hasNext(); ) {
    Stmt stmt=(Stmt)units.next();
    if (!stmt.containsInvokeExpr()) {
      continue;
    }
    ValueBox box=stmt.getInvokeExprBox();
    Value value=stmt.getInvokeExpr();
    if (value instanceof InstanceInvokeExpr) {
      InstanceInvokeExpr r=(InstanceInvokeExpr)value;
      if (r.getBase().getType() instanceof RefType) {
        RefType type=(RefType)r.getBase().getType();
        if (r.getMethod().equals(PtolemyUtilities.connectionsChangedMethod)) {
          if (type.getSootClass().isApplicationClass()) {
            SootMethod inlinee=null;
            if (r instanceof VirtualInvokeExpr) {
              List methodList=Scene.v().getActiveHierarchy().resolveAbstractDispatch(type.getSootClass(),PtolemyUtilities.connectionsChangedMethod);
              if (methodList.size() == 1) {
                inlinee=(SootMethod)methodList.get(0);
              }
 else {
                String string="String_Node_Str" + stmt + "String_Node_Str"+ method+ "String_Node_Str";
                for (int i=0; i < methodList.size(); i++) {
                  string+="String_Node_Str" + methodList.get(i) + "String_Node_Str";
                }
                System.out.println(string);
              }
            }
 else             if (r instanceof SpecialInvokeExpr) {
              inlinee=Scene.v().getActiveHierarchy().resolveSpecialDispatch((SpecialInvokeExpr)r,method);
            }
            if (!inlinee.getDeclaringClass().isApplicationClass()) {
              inlinee.getDeclaringClass().setLibraryClass();
            }
            inlinee.retrieveActiveBody();
            if (debug)             System.out.println("String_Node_Str" + r);
            SiteInliner.inlineSite(inlinee,stmt,method);
            doneSomething=true;
          }
 else {
            body.getUnits().remove(stmt);
            doneSomething=true;
          }
        }
        Value argValues[]=new Value[r.getArgCount()];
        int constantArgCount=0;
        for (Iterator args=r.getArgs().iterator(); args.hasNext(); ) {
          Value arg=(Value)args.next();
          if (Evaluator.isValueConstantValued(arg)) {
            argValues[constantArgCount++]=Evaluator.getConstantValueOf(arg);
          }
 else {
            break;
          }
        }
        boolean allArgsAreConstant=(r.getArgCount() == constantArgCount);
        if (SootUtilities.derivesFrom(type.getSootClass(),PtolemyUtilities.componentPortClass)) {
          TypedIOPort port=(TypedIOPort)getPortValue(method,(Local)r.getBase(),stmt,localDefs,localUses);
          if (port == null) {
            continue;
          }
          if (port instanceof Typeable) {
            PtolemyUtilities.inlineTypeableMethods(body,stmt,box,r,(Typeable)port);
          }
          if (r.getMethod().getSubSignature().equals(PtolemyUtilities.getFullNameMethod.getSubSignature())) {
            box.setValue(StringConstant.v(port.getFullName()));
          }
          if (r.getMethod().getSubSignature().equals(PtolemyUtilities.getNameMethod.getSubSignature())) {
            box.setValue(StringConstant.v(port.getName()));
          }
          String methodName=r.getMethod().getName();
          if (port.getWidth() == 0 && (methodName.equals("String_Node_Str") || methodName.equals("String_Node_Str") || methodName.equals("String_Node_Str")|| methodName.equals("String_Node_Str"))) {
            Local local=SootUtilities.createRuntimeException(body,stmt,methodName + "String_Node_Str" + port.getFullName()+ "String_Node_Str");
            body.getUnits().insertBefore(Jimple.v().newThrowStmt(local),stmt);
            if (stmt instanceof DefinitionStmt) {
              if (methodName.equals("String_Node_Str") || methodName.equals("String_Node_Str")) {
                box.setValue(IntConstant.v(0));
              }
 else {
                box.setValue(NullConstant.v());
              }
            }
 else {
              body.getUnits().remove(stmt);
            }
            continue;
          }
          if (r.getMethod().getName().equals("String_Node_Str")) {
            if (port.isInput()) {
              box.setValue(IntConstant.v(1));
            }
 else {
              box.setValue(IntConstant.v(0));
            }
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            if (port.isOutput()) {
              box.setValue(IntConstant.v(1));
            }
 else {
              box.setValue(IntConstant.v(0));
            }
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            if (port.isMultiport()) {
              box.setValue(IntConstant.v(1));
            }
 else {
              box.setValue(IntConstant.v(0));
            }
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            Object object=SootUtilities.reflectAndInvokeMethod(port,r.getMethod(),argValues);
            Constant constant=SootUtilities.convertArgumentToConstantValue(object);
            box.setValue(constant);
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            box.setValue(IntConstant.v(1));
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            box.setValue(IntConstant.v(1));
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            inliner.inlineGet(body,stmt,box,r,port);
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            inliner.inlineSend(body,stmt,r,port);
          }
 else           if (r.getMethod().getName().equals("String_Node_Str")) {
            if (port.getWidth() == 0) {
              body.getUnits().remove(stmt);
            }
 else {
              inliner.inlineBroadcast(body,stmt,r,port);
            }
          }
        }
      }
    }
  }
  return doneSomething;
}