Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. @Override
  2. protected void internalTransform(Body body, String phase, Map<String, String> options) {
  3.   Iterator<Unit> i = body.getUnits().snapshotIterator();
  4.  
  5.   while (i.hasNext()) {
  6.     Unit u = i.next();
  7.     inspectUnit(u, body);
  8.   }
  9. }
  10.  
  11. private void inspectUnit(Unit u, final Body body) {
  12.   u.apply(new AbstractStmtSwitch() {
  13.    
  14.     public void caseIfStmt(IfStmt stmt) {
  15.       Unit branch1 = body.getUnits().getSuccOf(stmt);
  16.       Unit branch2 = stmt.getTargetBox().getUnit();
  17.      
  18.       if (isBranchToForce(branch1)) {
  19.         GotoStmt gotoStmt = Jimple.v().newGotoStmt(branch1);
  20.         body.getUnits().insertBefore(gotoStmt, stmt);
  21.       }
  22.     }
  23.   });
  24.  
  25.   body.validate();
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement