import org.allspice.bytecode.instructions.New;
import org.allspice.bytecode.instructions.Return;
public class TestNew extends MyTestCase {
public ClassDef defadd() {
ClassDef cd = makeClassDef() ;
{
MethodRef mref = new MethodRef(
new TypeName("TestClass"),TypeName.VOID,"<init>") ;
MethodDef md = new MethodDef(new TypeName("TestClass"),"getFoo") ;
md = md.setStatic(true) ;
md = md.addInstructions(
new New(new TypeName("TestClass")),
new org.allspice.bytecode.instructions.Dup(TypeCode.VOID,TypeCode.OBJECT),
new InvokeSpecial(mref),
new Return(TypeCode.OBJECT)
) ;
cd = cd.addMethod(md) ;
}
return cd ;
}