Transforming lambdas in Java 8
Java 8 appears to generate classes to represent lambda expressions. For instance, the code: Runnable r = app::doStuff; Manifests, roughly, as: // $FF: synthetic class final class App$$Lambda$1 implements Runnable { private final App arg$1; private App$$Lambda$1(App var1) { this.arg$1 = var1; } private static Runnable get$Lambda(App var0) { return new App$$Lambda$1(var0); } public void run() { this.arg$1.doStuff(); } } As I understand this, the code is generated at runtime. Now, suppose one wanted to inject code into the run method of the above class. Experiments thus far yield a mix of