/** * in bytecode and Jimple the conditions in conditional binary expressions are often reversed */ private soot.Value reverseCondition(soot.jimple.ConditionExpr cond) { soot.jimple.ConditionExpr newExpr; if (cond instanceof soot.jimple.EqExpr) { newExpr = soot.jimple.Jimple.v().newNeExpr(cond.getOp1(), cond.getOp2()); } else if (cond instanceof soot.jimple.NeExpr) { newExpr = soot.jimple.Jimple.v().newEqExpr(cond.getOp1(), cond.getOp2()); } else if (cond instanceof soot.jimple.GtExpr) { newExpr = soot.jimple.Jimple.v().newLeExpr(cond.getOp1(), cond.getOp2()); } else if (cond instanceof soot.jimple.GeExpr) { newExpr = soot.jimple.Jimple.v().newLtExpr(cond.getOp1(), cond.getOp2()); } else if (cond instanceof soot.jimple.LtExpr) { newExpr = soot.jimple.Jimple.v().newGeExpr(cond.getOp1(), cond.getOp2()); } else if (cond instanceof soot.jimple.LeExpr) { newExpr = soot.jimple.Jimple.v().newGtExpr(cond.getOp1(), cond.getOp2()); } else { throw new RuntimeException("Unknown Condition Expr"); } newExpr.getOp1Box().addAllTagsOf(cond.getOp1Box()); newExpr.getOp2Box().addAllTagsOf(cond.getOp2Box()); return newExpr; }