//^olsen: exceptAttr != null ???
// begin of method body
final InsnTarget begin = new InsnTarget();
Insn insn = begin;
// store the sm field into local var
insn = insn.append(Insn.create(opc_aload_0));
insn = insn.append(
Insn.create(
opc_getfield,
getjdoStateManagerFieldRef()));
insn = insn.append(Insn.create(opc_astore_2));
// test the sm field and call the sm if nonnull
final InsnTarget check = new InsnTarget();
insn = insn.append(Insn.create(opc_aload_2));
insn = insn.append(Insn.create(opc_ifnull, check));
// load 'this' on the stack
insn = insn.append(Insn.create(opc_aload_0));
// call the sm's method with 'this' and 'sm' arguments
insn = insn.append(Insn.create(opc_aload_2));
insn = insn.append(Insn.create(opc_aload_0));
insn = insn.append(Insn.create(opc_aload_1));
insn = insn.append(
new InsnInterfaceInvoke(
pool.addInterfaceMethodRef(
JDO_StateManager_Path,
JDO_SM_replacingStateManager_Name,
JDO_SM_replacingStateManager_Sig),
countMethodArgWords(JDO_SM_replacingStateManager_Sig)));
// put result value to sm field and return
insn = insn.append(
Insn.create(opc_putfield,
getjdoStateManagerFieldRef()));
insn = insn.append(Insn.create(opc_return));
// invoke JDOImplHelper.checkAuthorizedStateManager with 'sm' argument
insn = insn.append(check);
insn = insn.append(Insn.create(opc_aload_1));
insn = insn.append(
Insn.create(opc_invokestatic,
pool.addMethodRef(
JDO_JDOImplHelper_Path,
JDO_JDOImplHelper_checkAuthorizedStateManager_Name,
JDO_JDOImplHelper_checkAuthorizedStateManager_Sig)));
// put argument value to jdoStateManager field
insn = insn.append(Insn.create(opc_aload_0));
insn = insn.append(Insn.create(opc_aload_1));
insn = insn.append(
Insn.create(opc_putfield,
getjdoStateManagerFieldRef()));
// reset flags to LOAD_REQUIRED
insn = insn.append(Insn.create(opc_aload_0));
insn = insn.append(Insn.create(opc_iconst_1));
insn = insn.append(
Insn.create(opc_putfield,
getjdoFlagsFieldRef()));
// end of method body
insn = insn.append(Insn.create(opc_return));
final CodeAttribute codeAttr
= new CodeAttribute(getCodeAttributeUtf8(),
4, // maxStack
3, // maxLocals