class ConstantInvokeMethodBaseTransformer extends SceneTransformer {
  private static final Logger logger = LoggerFactory.getLogger(ConstantInvokeMethodBaseTransformer.class);

  private final static String INVOKE_SIG
      = "<java.lang.reflect.Method: java.lang.Object invoke(java.lang.Object,java.lang.Object[])>";

  public ConstantInvokeMethodBaseTransformer(Singletons.Global g) {
  }

  public static ConstantInvokeMethodBaseTransformer v() {
    return G.v().soot_jimple_toolkits_reflection_ConstantInvokeMethodBaseTransformer();
  }

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

    final boolean verbose = options.containsKey("verbose");
    final Jimple jimp = Jimple.v();

    for (SootClass sootClass : Scene.v().getApplicationClasses()) {
      // In some rare cases we will have application classes that are not resolved due to being located in excluded packages
      // (e.g., the ServiceConnection class constructed by FlowDroid:
      // soot.jimple.infoflow.cfg.LibraryClassPatcher#patchServiceConnection)
      if (sootClass.resolvingLevel() < SootClass.BODIES) {
        continue;
      }
      for (SootMethod sootMethod : sootClass.getMethods()) {
        Body body = sootMethod.retrieveActiveBody();
        final Chain<Local> locals = body.getLocals();
        final Chain<Unit> units = body.getUnits();
        for (Iterator<Unit> iterator = units.snapshotIterator(); iterator.hasNext();) {
          Stmt s = (Stmt) iterator.next();

          if (s.containsInvokeExpr()) {
            InvokeExpr invokeExpr = s.getInvokeExpr();
            if (INVOKE_SIG.equals(invokeExpr.getMethod().getSignature())) {
              Value arg0 = invokeExpr.getArg(0);
              if (arg0 instanceof StringConstant) {
                Local newLocal = jimp.newLocal("sc" + locals.size(), arg0.getType());
                locals.add(newLocal);
                units.insertBefore(jimp.newAssignStmt(newLocal, (StringConstant) arg0), s);
                invokeExpr.setArg(0, newLocal);

                if (verbose) {
                  logger.debug("Replaced constant base object of Method.invoke() by local in: " + sootMethod.toString());
                }
              }
            }
          }
        }
      }
    }
  
<methods>public non-sealed void <init>() ,public final void transform(java.lang.String, Map<java.lang.String,java.lang.String>) ,public final void transform(java.lang.String) ,public final void transform() <variables>