{
final ExceptionsAttribute exceptAttr = null;
// begin of method body
final InsnTarget begin = new InsnTarget();
Insn insn = begin;
// check arg
insn = appendCheckVarNonNull(insn, 1,
JAVA_IllegalArgumentException_Path,
"arg1");
// store the array argument length into local var
insn = insn.append(Insn.create(opc_aload_1));
insn = insn.append(Insn.create(opc_arraylength));
insn = insn.append(Insn.create(opc_istore_2));
// init loop counter and goto loop check
final InsnTarget loopcheck = new InsnTarget();
insn = insn.append(Insn.create(opc_iconst_0));
insn = insn.append(Insn.create(opc_istore_3));
insn = insn.append(Insn.create(opc_goto, loopcheck));
// loop body: call self-delegating method with array element
final InsnTarget loopbody = new InsnTarget();
insn = insn.append(loopbody);
insn = insn.append(Insn.create(opc_aload_0));
// select element from array argument at loop counter
insn = insn.append(Insn.create(opc_aload_1));
insn = insn.append(Insn.create(opc_iload_3));
insn = insn.append(Insn.create(opc_iaload));
// call self-delegating method
insn = insn.append(
Insn.create(opc_invokevirtual,
pool.addMethodRef(
className,
delegateName,
delegateSig)));
// loop counter increment
insn = insn.append(new InsnIInc(3, 1));
// loop termination check
insn = insn.append(loopcheck);
insn = insn.append(Insn.create(opc_iload_3));
insn = insn.append(Insn.create(opc_iload_2));
insn = insn.append(Insn.create(opc_if_icmplt, loopbody));
// end of method body
insn = insn.append(Insn.create(opc_return));
final CodeAttribute codeAttr
= new CodeAttribute(getCodeAttributeUtf8(),
3, // maxStack
4, // maxLocals