Program: 88612
Project: 88612
Buggy source:
/** 
 * Unary Expression Creation
 */
private soot.Local getUnaryLocal(polyglot.ast.Unary unary){
  polyglot.ast.Expr expr=unary.expr();
  polyglot.ast.Unary.Operator op=unary.operator();
  if (op == polyglot.ast.Unary.POST_INC) {
    soot.Local retLocal=generateLocal(expr.type());
    soot.Value sootExpr=base().createExpr(expr);
    soot.jimple.AssignStmt preStmt=soot.jimple.Jimple.v().newAssignStmt(retLocal,sootExpr);
    body.getUnits().add(preStmt);
    soot.jimple.AddExpr addExpr=soot.jimple.Jimple.v().newAddExpr(sootExpr,getConstant(retLocal.getType(),1));
    Util.addLnPosTags(addExpr.getOp1Box(),expr.position());
    soot.Local local=generateLocal(expr.type());
    soot.jimple.AssignStmt stmt=soot.jimple.Jimple.v().newAssignStmt(local,addExpr);
    body.getUnits().add(stmt);
    Util.addLnPosTags(stmt,expr.position());
    soot.jimple.AssignStmt aStmt=soot.jimple.Jimple.v().newAssignStmt(sootExpr,local);
    body.getUnits().add(aStmt);
    Util.addLnPosTags(aStmt,expr.position());
    Util.addLnPosTags(aStmt,unary.position());
    if ((expr instanceof polyglot.ast.Field) || (expr instanceof polyglot.ast.ArrayAccess)) {
      soot.Value actualUnaryExpr=createLHS(expr);
      soot.jimple.AssignStmt s=soot.jimple.Jimple.v().newAssignStmt(actualUnaryExpr,local);
      body.getUnits().add(s);
      Util.addLnPosTags(s,expr.position());
      Util.addLnPosTags(s.getLeftOpBox(),expr.position());
    }
    return retLocal;
  }
 else   if (op == polyglot.ast.Unary.POST_DEC) {
    soot.Local retLocal=generateLocal(expr.type());
    soot.Value sootExpr=base().createExpr(expr);
    soot.jimple.AssignStmt preStmt=soot.jimple.Jimple.v().newAssignStmt(retLocal,sootExpr);
    body.getUnits().add(preStmt);
    soot.jimple.SubExpr subExpr=soot.jimple.Jimple.v().newSubExpr(sootExpr,getConstant(retLocal.getType(),1));
    Util.addLnPosTags(subExpr.getOp1Box(),expr.position());
    soot.Local local=generateLocal(expr.type());
    soot.jimple.AssignStmt stmt=soot.jimple.Jimple.v().newAssignStmt(local,subExpr);
    body.getUnits().add(stmt);
    Util.addLnPosTags(stmt,expr.position());
    soot.jimple.AssignStmt aStmt=soot.jimple.Jimple.v().newAssignStmt(sootExpr,local);
    body.getUnits().add(aStmt);
    Util.addLnPosTags(aStmt,expr.position());
    Util.addLnPosTags(aStmt,unary.position());
    if ((expr instanceof polyglot.ast.Field) || (expr instanceof polyglot.ast.ArrayAccess)) {
      soot.Value actualUnaryExpr=createLHS(expr);
      soot.jimple.AssignStmt s=soot.jimple.Jimple.v().newAssignStmt(actualUnaryExpr,local);
      body.getUnits().add(s);
      Util.addLnPosTags(s,expr.position());
      Util.addLnPosTags(s.getLeftOpBox(),expr.position());
    }
    return retLocal;
  }
 else   if (op == polyglot.ast.Unary.PRE_INC) {
    soot.Value sootExpr=base().createExpr(expr);
    soot.jimple.AddExpr addExpr=soot.jimple.Jimple.v().newAddExpr(sootExpr,getConstant(sootExpr.getType(),1));
    Util.addLnPosTags(addExpr.getOp1Box(),expr.position());
    soot.Local local=generateLocal(expr.type());
    soot.jimple.AssignStmt stmt=soot.jimple.Jimple.v().newAssignStmt(local,addExpr);
    body.getUnits().add(stmt);
    Util.addLnPosTags(stmt,expr.position());
    if ((expr instanceof polyglot.ast.Field) || (expr instanceof polyglot.ast.ArrayAccess) || (expr instanceof polyglot.ast.Local)) {
      soot.Value actualUnaryExpr=createLHS(expr);
      body.getUnits().add(soot.jimple.Jimple.v().newAssignStmt(actualUnaryExpr,local));
    }
    return local;
  }
 else   if (op == polyglot.ast.Unary.PRE_DEC) {
    soot.Value sootExpr=base().createExpr(expr);
    soot.jimple.SubExpr subExpr=soot.jimple.Jimple.v().newSubExpr(sootExpr,getConstant(sootExpr.getType(),1));
    Util.addLnPosTags(subExpr.getOp1Box(),expr.position());
    soot.Local local=generateLocal(expr.type());
    soot.jimple.AssignStmt stmt=soot.jimple.Jimple.v().newAssignStmt(local,subExpr);
    body.getUnits().add(stmt);
    Util.addLnPosTags(stmt,expr.position());
    if ((expr instanceof polyglot.ast.Field) || (expr instanceof polyglot.ast.ArrayAccess) || (expr instanceof polyglot.ast.Local)) {
      soot.Value actualUnaryExpr=createLHS(expr);
      body.getUnits().add(soot.jimple.Jimple.v().newAssignStmt(actualUnaryExpr,local));
    }
    return local;
  }
 else   if (op == polyglot.ast.Unary.BIT_NOT) {
    soot.jimple.IntConstant int1=soot.jimple.IntConstant.v(-1);
    soot.Local retLocal=generateLocal(expr.type());
    soot.Value sootExpr=base().createExpr(expr);
    soot.jimple.XorExpr xor=soot.jimple.Jimple.v().newXorExpr(sootExpr,getConstant(sootExpr.getType(),-1));
    Util.addLnPosTags(xor.getOp1Box(),expr.position());
    soot.jimple.Stmt assign1=soot.jimple.Jimple.v().newAssignStmt(retLocal,xor);
    body.getUnits().add(assign1);
    Util.addLnPosTags(assign1,unary.position());
    return retLocal;
  }
 else   if (op == polyglot.ast.Unary.NEG) {
    soot.Value sootExpr;
    if (expr instanceof polyglot.ast.NumLit) {
      int intVal=(int)((polyglot.ast.NumLit)expr).longValue();
      sootExpr=soot.jimple.IntConstant.v(-intVal);
    }
 else     if (expr instanceof polyglot.ast.FloatLit) {
      double doubleVal=((polyglot.ast.FloatLit)expr).value();
      if (((polyglot.ast.FloatLit)expr).kind() == polyglot.ast.FloatLit.DOUBLE) {
        sootExpr=soot.jimple.DoubleConstant.v(-doubleVal);
      }
 else {
        sootExpr=soot.jimple.FloatConstant.v(-(float)doubleVal);
      }
    }
 else {
      soot.Value local=base().createExpr(expr);
      soot.jimple.NegExpr negExpr=soot.jimple.Jimple.v().newNegExpr(local);
      sootExpr=negExpr;
      Util.addLnPosTags(negExpr.getOpBox(),expr.position());
    }
    soot.Local retLocal=generateLocal(expr.type());
    soot.jimple.Stmt assign=soot.jimple.Jimple.v().newAssignStmt(retLocal,sootExpr);
    body.getUnits().add(assign);
    Util.addLnPosTags(assign,expr.position());
    return retLocal;
  }
 else   if (op == polyglot.ast.Unary.POS) {
    soot.Local retLocal=generateLocal(expr.type());
    soot.Value sootExpr=base().createExpr(expr);
    soot.jimple.Stmt assign=soot.jimple.Jimple.v().newAssignStmt(retLocal,sootExpr);
    body.getUnits().add(assign);
    Util.addLnPosTags(assign,expr.position());
    return retLocal;
  }
 else   if (op == polyglot.ast.Unary.NOT) {
    soot.Value local=base().createExpr(expr);
    if (local instanceof soot.jimple.ConditionExpr) {
      local=handleCondBinExpr((soot.jimple.ConditionExpr)local);
    }
    soot.jimple.NeExpr neExpr=soot.jimple.Jimple.v().newNeExpr(local,getConstant(local.getType(),0));
    soot.jimple.Stmt noop1=soot.jimple.Jimple.v().newNopStmt();
    soot.jimple.Stmt ifStmt=soot.jimple.Jimple.v().newIfStmt(neExpr,noop1);
    body.getUnits().add(ifStmt);
    Util.addLnPosTags(ifStmt,expr.position());
    soot.Local retLocal=lg.generateLocal(local.getType());
    soot.jimple.Stmt assign1=soot.jimple.Jimple.v().newAssignStmt(retLocal,getConstant(retLocal.getType(),1));
    body.getUnits().add(assign1);
    Util.addLnPosTags(assign1,expr.position());
    soot.jimple.Stmt noop2=soot.jimple.Jimple.v().newNopStmt();
    soot.jimple.Stmt goto1=soot.jimple.Jimple.v().newGotoStmt(noop2);
    body.getUnits().add(goto1);
    body.getUnits().add(noop1);
    soot.jimple.Stmt assign2=soot.jimple.Jimple.v().newAssignStmt(retLocal,getConstant(retLocal.getType(),0));
    body.getUnits().add(assign2);
    Util.addLnPosTags(assign2,expr.position());
    body.getUnits().add(noop2);
    return retLocal;
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Unary Expression Creation
 */
private soot.Local getUnaryLocal(polyglot.ast.Unary unary){
  polyglot.ast.Expr expr=unary.expr();
  polyglot.ast.Unary.Operator op=unary.operator();
  if (op == polyglot.ast.Unary.POST_INC) {
    soot.Local retLocal=generateLocal(expr.type());
    soot.Value sootExpr=base().createExpr(expr);
    soot.jimple.AssignStmt preStmt=soot.jimple.Jimple.v().newAssignStmt(retLocal,sootExpr);
    body.getUnits().add(preStmt);
    soot.jimple.AddExpr addExpr=soot.jimple.Jimple.v().newAddExpr(sootExpr,getConstant(retLocal.getType(),1));
    Util.addLnPosTags(addExpr.getOp1Box(),expr.position());
    soot.Local local=generateLocal(expr.type());
    soot.jimple.AssignStmt stmt=soot.jimple.Jimple.v().newAssignStmt(local,addExpr);
    body.getUnits().add(stmt);
    Util.addLnPosTags(stmt,expr.position());
    soot.jimple.AssignStmt aStmt=soot.jimple.Jimple.v().newAssignStmt(sootExpr,local);
    body.getUnits().add(aStmt);
    Util.addLnPosTags(aStmt,expr.position());
    Util.addLnPosTags(aStmt,unary.position());
    if ((expr instanceof polyglot.ast.Field) || (expr instanceof polyglot.ast.ArrayAccess)) {
      if ((expr instanceof polyglot.ast.Field) && (needsPrivateAccessor((polyglot.ast.Field)expr) || needsProtectedAccessor((polyglot.ast.Field)expr))) {
        handlePrivateFieldSet((polyglot.ast.Field)expr,local);
      }
 else {
        soot.Value actualUnaryExpr=createLHS(expr);
        soot.jimple.AssignStmt s=soot.jimple.Jimple.v().newAssignStmt(actualUnaryExpr,local);
        body.getUnits().add(s);
        Util.addLnPosTags(s,expr.position());
        Util.addLnPosTags(s.getLeftOpBox(),expr.position());
      }
    }
    return retLocal;
  }
 else   if (op == polyglot.ast.Unary.POST_DEC) {
    soot.Local retLocal=generateLocal(expr.type());
    soot.Value sootExpr=base().createExpr(expr);
    soot.jimple.AssignStmt preStmt=soot.jimple.Jimple.v().newAssignStmt(retLocal,sootExpr);
    body.getUnits().add(preStmt);
    soot.jimple.SubExpr subExpr=soot.jimple.Jimple.v().newSubExpr(sootExpr,getConstant(retLocal.getType(),1));
    Util.addLnPosTags(subExpr.getOp1Box(),expr.position());
    soot.Local local=generateLocal(expr.type());
    soot.jimple.AssignStmt stmt=soot.jimple.Jimple.v().newAssignStmt(local,subExpr);
    body.getUnits().add(stmt);
    Util.addLnPosTags(stmt,expr.position());
    soot.jimple.AssignStmt aStmt=soot.jimple.Jimple.v().newAssignStmt(sootExpr,local);
    body.getUnits().add(aStmt);
    Util.addLnPosTags(aStmt,expr.position());
    Util.addLnPosTags(aStmt,unary.position());
    if ((expr instanceof polyglot.ast.Field) || (expr instanceof polyglot.ast.ArrayAccess)) {
      if ((expr instanceof polyglot.ast.Field) && (needsPrivateAccessor((polyglot.ast.Field)expr) || needsProtectedAccessor((polyglot.ast.Field)expr))) {
        handlePrivateFieldSet((polyglot.ast.Field)expr,local);
      }
 else {
        soot.Value actualUnaryExpr=createLHS(expr);
        soot.jimple.AssignStmt s=soot.jimple.Jimple.v().newAssignStmt(actualUnaryExpr,local);
        body.getUnits().add(s);
        Util.addLnPosTags(s,expr.position());
        Util.addLnPosTags(s.getLeftOpBox(),expr.position());
      }
    }
    return retLocal;
  }
 else   if (op == polyglot.ast.Unary.PRE_INC) {
    soot.Value sootExpr=base().createExpr(expr);
    soot.jimple.AddExpr addExpr=soot.jimple.Jimple.v().newAddExpr(sootExpr,getConstant(sootExpr.getType(),1));
    Util.addLnPosTags(addExpr.getOp1Box(),expr.position());
    soot.Local local=generateLocal(expr.type());
    soot.jimple.AssignStmt stmt=soot.jimple.Jimple.v().newAssignStmt(local,addExpr);
    body.getUnits().add(stmt);
    Util.addLnPosTags(stmt,expr.position());
    if ((expr instanceof polyglot.ast.Field) || (expr instanceof polyglot.ast.ArrayAccess) || (expr instanceof polyglot.ast.Local)) {
      if ((expr instanceof polyglot.ast.Field) && (needsPrivateAccessor((polyglot.ast.Field)expr) || needsProtectedAccessor((polyglot.ast.Field)expr))) {
        handlePrivateFieldSet((polyglot.ast.Field)expr,local);
      }
 else {
        soot.Value actualUnaryExpr=createLHS(expr);
        body.getUnits().add(soot.jimple.Jimple.v().newAssignStmt(actualUnaryExpr,local));
      }
    }
    return local;
  }
 else   if (op == polyglot.ast.Unary.PRE_DEC) {
    soot.Value sootExpr=base().createExpr(expr);
    soot.jimple.SubExpr subExpr=soot.jimple.Jimple.v().newSubExpr(sootExpr,getConstant(sootExpr.getType(),1));
    Util.addLnPosTags(subExpr.getOp1Box(),expr.position());
    soot.Local local=generateLocal(expr.type());
    soot.jimple.AssignStmt stmt=soot.jimple.Jimple.v().newAssignStmt(local,subExpr);
    body.getUnits().add(stmt);
    Util.addLnPosTags(stmt,expr.position());
    if ((expr instanceof polyglot.ast.Field) || (expr instanceof polyglot.ast.ArrayAccess) || (expr instanceof polyglot.ast.Local)) {
      if ((expr instanceof polyglot.ast.Field) && (needsPrivateAccessor((polyglot.ast.Field)expr) || needsProtectedAccessor((polyglot.ast.Field)expr))) {
        handlePrivateFieldSet((polyglot.ast.Field)expr,local);
      }
 else {
        soot.Value actualUnaryExpr=createLHS(expr);
        body.getUnits().add(soot.jimple.Jimple.v().newAssignStmt(actualUnaryExpr,local));
      }
    }
    return local;
  }
 else   if (op == polyglot.ast.Unary.BIT_NOT) {
    soot.jimple.IntConstant int1=soot.jimple.IntConstant.v(-1);
    soot.Local retLocal=generateLocal(expr.type());
    soot.Value sootExpr=base().createExpr(expr);
    soot.jimple.XorExpr xor=soot.jimple.Jimple.v().newXorExpr(sootExpr,getConstant(sootExpr.getType(),-1));
    Util.addLnPosTags(xor.getOp1Box(),expr.position());
    soot.jimple.Stmt assign1=soot.jimple.Jimple.v().newAssignStmt(retLocal,xor);
    body.getUnits().add(assign1);
    Util.addLnPosTags(assign1,unary.position());
    return retLocal;
  }
 else   if (op == polyglot.ast.Unary.NEG) {
    soot.Value sootExpr;
    if (expr instanceof polyglot.ast.NumLit) {
      int intVal=(int)((polyglot.ast.NumLit)expr).longValue();
      sootExpr=soot.jimple.IntConstant.v(-intVal);
    }
 else     if (expr instanceof polyglot.ast.FloatLit) {
      double doubleVal=((polyglot.ast.FloatLit)expr).value();
      if (((polyglot.ast.FloatLit)expr).kind() == polyglot.ast.FloatLit.DOUBLE) {
        sootExpr=soot.jimple.DoubleConstant.v(-doubleVal);
      }
 else {
        sootExpr=soot.jimple.FloatConstant.v(-(float)doubleVal);
      }
    }
 else {
      soot.Value local=base().createExpr(expr);
      soot.jimple.NegExpr negExpr=soot.jimple.Jimple.v().newNegExpr(local);
      sootExpr=negExpr;
      Util.addLnPosTags(negExpr.getOpBox(),expr.position());
    }
    soot.Local retLocal=generateLocal(expr.type());
    soot.jimple.Stmt assign=soot.jimple.Jimple.v().newAssignStmt(retLocal,sootExpr);
    body.getUnits().add(assign);
    Util.addLnPosTags(assign,expr.position());
    return retLocal;
  }
 else   if (op == polyglot.ast.Unary.POS) {
    soot.Local retLocal=generateLocal(expr.type());
    soot.Value sootExpr=base().createExpr(expr);
    soot.jimple.Stmt assign=soot.jimple.Jimple.v().newAssignStmt(retLocal,sootExpr);
    body.getUnits().add(assign);
    Util.addLnPosTags(assign,expr.position());
    return retLocal;
  }
 else   if (op == polyglot.ast.Unary.NOT) {
    soot.Value local=base().createExpr(expr);
    if (local instanceof soot.jimple.ConditionExpr) {
      local=handleCondBinExpr((soot.jimple.ConditionExpr)local);
    }
    soot.jimple.NeExpr neExpr=soot.jimple.Jimple.v().newNeExpr(local,getConstant(local.getType(),0));
    soot.jimple.Stmt noop1=soot.jimple.Jimple.v().newNopStmt();
    soot.jimple.Stmt ifStmt=soot.jimple.Jimple.v().newIfStmt(neExpr,noop1);
    body.getUnits().add(ifStmt);
    Util.addLnPosTags(ifStmt,expr.position());
    soot.Local retLocal=lg.generateLocal(local.getType());
    soot.jimple.Stmt assign1=soot.jimple.Jimple.v().newAssignStmt(retLocal,getConstant(retLocal.getType(),1));
    body.getUnits().add(assign1);
    Util.addLnPosTags(assign1,expr.position());
    soot.jimple.Stmt noop2=soot.jimple.Jimple.v().newNopStmt();
    soot.jimple.Stmt goto1=soot.jimple.Jimple.v().newGotoStmt(noop2);
    body.getUnits().add(goto1);
    body.getUnits().add(noop1);
    soot.jimple.Stmt assign2=soot.jimple.Jimple.v().newAssignStmt(retLocal,getConstant(retLocal.getType(),0));
    body.getUnits().add(assign2);
    Util.addLnPosTags(assign2,expr.position());
    body.getUnits().add(noop2);
    return retLocal;
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}