Var x = new Var(1,TypeName.INT) ; // index 1
Var y = new Var(2,TypeName.INT) ; // index 2
MethodDef md = new MethodDef(TypeName.INT,"add",x,y).addInstructions(
new Load(x),
new Load(y),
new Add(TypeCode.INT),
new Return(TypeCode.INT)
) ;
// Watch it! ClassDef is immutable
cd = cd.addMethod(md) ;
}