Attribute[] attributes = m.getAttributes();
for (int i = 0; i < attributes.length; i++) {
Attribute a = attributes[i];
if (a instanceof Code) {
Code code = (Code) a;
setMaxStack(code.getMaxStack());
setMaxLocals(code.getMaxLocals());
CodeException[] ces = code.getExceptionTable();
InstructionHandle[] arrayOfInstructions = il.getInstructionsAsArray();
// process the exception table
// -
if (ces != null) {
for (CodeException ce : ces) {
int type = ce.getCatchType();
ObjectType catchType = null;
if (type > 0) {
String cen = m.getConstantPool().getConstantString_CONSTANTClass(type);
catchType = new ObjectType(cen);
}
int end_pc = ce.getEndPC();
int length = m.getCode().getCode().length;
InstructionHandle end;
if (length == end_pc) { // May happen, because end_pc is exclusive
end = il.getEnd();
} else {
end = il.findHandle(end_pc, arrayOfInstructions);// il.findHandle(end_pc);
end = end.getPrev(); // Make it inclusive
}
addExceptionHandler(il.findHandle(ce.getStartPC(), arrayOfInstructions), end, il.findHandle(ce
.getHandlerPC(), arrayOfInstructions), catchType);
}
}
Attribute[] codeAttrs = code.getAttributes();
for (int j = 0; j < codeAttrs.length; j++) {
a = codeAttrs[j];
if (a instanceof LineNumberTable) {
LineNumber[] ln = ((LineNumberTable) a).getLineNumberTable();