Skip to content

Instantly share code, notes, and snippets.

@ujjkumsi
Last active May 14, 2018 11:19
Show Gist options
  • Save ujjkumsi/bd1d190cade59151ef33d37b0e1fa498 to your computer and use it in GitHub Desktop.
Save ujjkumsi/bd1d190cade59151ef33d37b0e1fa498 to your computer and use it in GitHub Desktop.
public static class Invoker implements InvokerIfc {
public Object doit(Integer b) {
return fake(new Something()).target(b);
}
}
public static Class rewrite(Class old)throws IOException,InvalidConstantPoolFormatException{
HashMap constPatchMap=new HashMap();
constPatchMap.put("fake","real");
ConstantPoolPatch patch=new ConstantPoolPatch(Invoker.class);
patch.putPatches(constPatchMap,null,null,true);
return new AnonymousClassLoader(Invoker.class).loadClass(patch);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment