// get first instruction which always is an instruction target
affirm(codeAttr.theCode().opcode() == Insn.opc_target);
final InsnTarget begin = (InsnTarget)codeAttr.theCode();
// get attributes of the code attribute
final AttributeVector codeSpecificAttrs = codeAttr.attributes();
affirm(codeSpecificAttrs != null);
// add dummy line number attribute with first instruction
codeSpecificAttrs.addElement(
new LineNumberTableAttribute(
pool.addUtf8(LineNumberTableAttribute.expectedAttrName),
new short[]{ 0 }, new InsnTarget[]{ begin }));
}
// add the method's code and exception attributes
final AttributeVector methodAttrs = new AttributeVector();
methodAttrs.addElement(codeAttr);
if (exceptAttr != null) {
methodAttrs.addElement(exceptAttr);
}
//@olsen: fix 4467428, add synthetic attribute for generated methods
if (addSyntheticAttr) {
methodAttrs.addElement(
new SyntheticAttribute(
pool.addUtf8(SyntheticAttribute.expectedAttrName)));
}
// create and add the method