LocalVariable[] lv = ((LocalVariableTable)a).getLocalVariableTable();
removeLocalVariables();
for(int k=0; k < lv.length; k++) {
LocalVariable l = lv[k];
InstructionHandle start = il.findHandle(l.getStartPC());
InstructionHandle end = il.findHandle(l.getStartPC() + l.getLength());
// AMC, this actually gives us the first instruction AFTER the range,
// so move back one... (findHandle can't cope with mid-instruction indices)
if (end != null) end = end.getPrev();
// Repair malformed handles
if(null == start) {
start = il.getStart();
}
if(null == end) {
end = il.getEnd();
}
addLocalVariable(l.getName(), Type.getType(l.getSignature()),
l.getIndex(), start, end);
}
} else
addCodeAttribute(a);
}
} else if(a instanceof ExceptionTable) {
String[] names = ((ExceptionTable)a).getExceptionNames();
for(int j=0; j < names.length; j++)
addException(names[j]);
} else if (a instanceof RuntimeAnnotations) {
RuntimeAnnotations runtimeAnnotations = (RuntimeAnnotations)a;
List l = runtimeAnnotations.getAnnotations();
for (Iterator it = l.iterator(); it.hasNext();) {
Annotation element = (Annotation) it.next();
addAnnotation(new AnnotationGen(element,cp,false));
}
} else {
addAttribute(a);