class MethodStaticnessCorrector extends AbstractStaticnessCorrector {
  private static final Logger logger = LoggerFactory.getLogger(MethodStaticnessCorrector.class);

  public MethodStaticnessCorrector(Singletons.Global g) {
  }

  public static MethodStaticnessCorrector v() {
    return G.v().soot_jimple_toolkits_scalar_MethodStaticnessCorrector();
  }

  @Override
  protected void internalTransform(Body b, String phaseName, Map<String, String> options) {<FILL_FUNCTION_BODY>}

  /**
   * Checks whether the given method can be made static, i.e., does not reference the "this" object
   *
   * @param target
   *          The method to check
   * @return True if the given method can be made static, otherwise false
   */
  private boolean canBeMadeStatic(SootMethod target) {
    if (!target.hasActiveBody()) {
      return false;
    }
    Body body = target.getActiveBody();
    Value thisLocal = body.getThisLocal();
    for (Unit u : body.getUnits()) {
      for (ValueBox vb : u.getUseBoxes()) {
        if (vb.getValue() == thisLocal) {
          return false;
        }
      }
    }
    return true;
  }
}

    for (Iterator<Unit> unitIt = b.getUnits().snapshotIterator(); unitIt.hasNext();) {
      Unit u = unitIt.next();
      if (u instanceof Stmt) {
        Stmt s = (Stmt) u;
        if (s.containsInvokeExpr()) {
          InvokeExpr iexpr = s.getInvokeExpr();
          if (iexpr instanceof StaticInvokeExpr) {
            SootMethodRef methodRef = iexpr.getMethodRef();
            if (isClassLoaded(methodRef.declaringClass())) {
              SootMethod target = Scene.v().grabMethod(methodRef.getSignature());
              if (target != null && !target.isStatic()) {
                if (canBeMadeStatic(target)) {
                  // Remove the this-assignment to prevent
                  // 'this-assignment in a static method!' exception
                  Body targetBody = target.getActiveBody();
                  targetBody.getUnits().remove(targetBody.getThisUnit());
                  target.setModifiers(target.getModifiers() | Modifier.STATIC);
                  logger.warn(target.getName() + " changed into a static method");
                }
              }
            }
          }
        }
      }
    }
  
<methods>public non-sealed void <init>() <variables>