private <T, X extends T> CodeGenerator<T> newCodeGenerator(Class<T> iface, Class<X> impl) {
final TemplateClassDefinition<T> template = new TemplateClassDefinition<T>(iface, impl);
CodeGenerator<T> cg = CodeGenerator.get(template, bit.getContext().getFunctionImplementationRegistry());
ClassGenerator<T> root = cg.getRoot();
root.setMappingSet(new MappingSet(new GeneratorMapping("doOutside", null, null, null)));
root.getSetupBlock().directStatement("System.out.println(\"outside\");");
ClassGenerator<T> inner = root.getInnerGenerator("TheInnerClass");
inner.setMappingSet(new MappingSet(new GeneratorMapping("doInside", null, null, null)));
inner.getSetupBlock().directStatement("System.out.println(\"inside\");");
ClassGenerator<T> doubleInner = inner.getInnerGenerator("DoubleInner");
doubleInner.setMappingSet(new MappingSet(new GeneratorMapping("doDouble", null, null, null)));
doubleInner.getSetupBlock().directStatement("System.out.println(\"double\");");
return cg;
}