class ConstructorFolder extends BodyTransformer {
  private static final Logger logger = LoggerFactory.getLogger(ConstructorFolder.class);

  public ConstructorFolder(Singletons.Global g) {
  }

  public static ConstructorFolder v() {
    return G.v().soot_grimp_toolkits_base_ConstructorFolder();
  }

  /** This method change all new Obj/<init>(args) pairs to new Obj(args) idioms. */
  protected void internalTransform(Body b, String phaseName, Map options) {<FILL_FUNCTION_BODY>}
}

    GrimpBody body = (GrimpBody) b;

    if (Options.v().verbose()) {
      logger.debug("[" + body.getMethod().getName() + "] Folding constructors...");
    }

    Chain units = body.getUnits();
    List<Unit> stmtList = new ArrayList<Unit>();
    stmtList.addAll(units);

    Iterator<Unit> it = stmtList.iterator();

    LocalUses localUses = LocalUses.Factory.newLocalUses(b);

    /* fold in NewExpr's with specialinvoke's */
    while (it.hasNext()) {
      Stmt s = (Stmt) it.next();

      if (!(s instanceof AssignStmt)) {
        continue;
      }

      /* this should be generalized to ArrayRefs */
      Value lhs = ((AssignStmt) s).getLeftOp();
      if (!(lhs instanceof Local)) {
        continue;
      }

      Value rhs = ((AssignStmt) s).getRightOp();
      if (!(rhs instanceof NewExpr)) {
        continue;
      }

      /*
       * TO BE IMPLEMENTED LATER: move any copy of the object reference for lhs down beyond the NewInvokeExpr, with the
       * rationale being that you can't modify the object before the constructor call in any case.
       *
       * Also, do note that any new's (object creation) without corresponding constructors must be dead.
       */

      List lu = localUses.getUsesOf(s);
      Iterator luIter = lu.iterator();
      boolean MadeNewInvokeExpr = false;

      while (luIter.hasNext()) {
        Unit use = ((UnitValueBoxPair) (luIter.next())).unit;
        if (!(use instanceof InvokeStmt)) {
          continue;
        }
        InvokeStmt is = (InvokeStmt) use;
        if (!(is.getInvokeExpr() instanceof SpecialInvokeExpr)
            || lhs != ((SpecialInvokeExpr) is.getInvokeExpr()).getBase()) {
          continue;
        }

        SpecialInvokeExpr oldInvoke = ((SpecialInvokeExpr) is.getInvokeExpr());
        LinkedList invokeArgs = new LinkedList();
        for (int i = 0; i < oldInvoke.getArgCount(); i++) {
          invokeArgs.add(oldInvoke.getArg(i));
        }

        AssignStmt constructStmt = Grimp.v().newAssignStmt((AssignStmt) s);
        constructStmt
            .setRightOp(Grimp.v().newNewInvokeExpr(((NewExpr) rhs).getBaseType(), oldInvoke.getMethodRef(), invokeArgs));
        MadeNewInvokeExpr = true;

        use.redirectJumpsToThisTo(constructStmt);
        units.insertBefore(constructStmt, use);
        units.remove(use);
      }
      if (MadeNewInvokeExpr) {
        units.remove(s);
      }
    }
  
<methods>public non-sealed void <init>() ,public final void transform(soot.Body, java.lang.String, Map<java.lang.String,java.lang.String>) ,public final void transform(soot.Body, java.lang.String) ,public final void transform(soot.Body) <variables>private static final Map<java.lang.String,java.lang.String> enabledOnlyMap