!7 set flag AllPublic. p { ClassMaker c = new(IF0); // make code for get() method var m = new MethodMaker(c.cg, O, "get"); // declare and create StringBuffer int buffer = m.newLocalVar(); m.newObject(StringBuffer.class).astore(buffer); // Append two strings for (string : ll("Hello ", "world")) { m.aload(buffer).stringConstant(string); m.il.append(m.factory.createAppend(org.apache.bcel.generic.Type.OBJECT)); } // call StringBuffer.toString() and return m.aload(buffer); m.invokeVirtual(StringBuffer.class, S, "toString"); m.areturn().done(); // disassemble because it looks cool c.printClassWithMethods(); // bake class, load & create instance IF0 f = c.newInstance(); print(f); assertEqualsVerbose("Hello world", f!); }