Skip to content
pyricau edited this page May 30, 2011 · 1 revision

#How it works

It's pure Java!

No extra compilation step, no bytecode instrumentation, no Java proxy. You can use it straight away, anywhere!

We use good old Java features:

public class SomeClass {
    public void myMethod() {
        class MyMethodLocalClass { // This is a local class
        }
        new MyMethodLocalClass(); // It can only be instantiated in myMethod()
    }
}
public class SomeClass {
    public SomeClass() { // a good old constructor
        super();
        doSomething();
    }
    
    {
        // This is an init block
        // It is executed in the constructor, after super() and before doSomething();
    }
}