if (fmds.length == 0)
throwException(code, IllegalArgumentException.class);
else {
// switch (val)
code.iload().setLocal(relLocal);
TableSwitchInstruction tabins = code.tableswitch();
tabins.setLow(0);
tabins.setHigh(fmds.length - 1);
// <field> = pcStateManager.replace<type>Field
// (this, fieldNumber);
for (int i = 0; i < fmds.length; i++) {
// for the addSetManagedValueCode call below.
tabins.addTarget(loadManagedInstance(code, false, fmds[i]));
loadManagedInstance(code, false, fmds[i]);
code.getfield().setField(SM, SMTYPE);
loadManagedInstance(code, false, fmds[i]);
code.iload().setParam(0);
code.invokeinterface().setMethod(getStateManagerMethod
(fmds[i].getDeclaredType(), "replace", true, false));
if (!fmds[i].getDeclaredType().isPrimitive())
code.checkcast().setType(fmds[i].getDeclaredType());
addSetManagedValueCode(code, fmds[i]);
if(_addVersionInitFlag){
if(fmds[i].isVersion()){
// If this case is setting the version field
// pcVersionInit = true;
loadManagedInstance(code, false);
code.constant().setValue(1);
putfield(code, null, VERSION_INIT_STR, boolean.class);
}
}
code.vreturn();
}
// default: throw new IllegalArgumentException ()
tabins.setDefaultTarget(throwException
(code, IllegalArgumentException.class));
}
code.calculateMaxStack();
code.calculateMaxLocals();