/**
* @param context The context in which to write this try/catch/final
*/
public void write(BytecodeContextMethod context) {
BytecodeScope parent = context.getScope(0);
BytecodeScope code = new BytecodeScope(parent, context.createMarker(), context.createMarker());
Map<String, BytecodeScope> scopes = new LinkedHashMap<String, BytecodeScope>();
for (String key : exceptionTypes.keySet()) {
ExceptionHandler handler = exceptionTypes.get(key);
BytecodeScope scope = new BytecodeScope(parent, context.createMarker(), context.createMarker());
context.jumpIfException(code.getStart(), code.getEnd(), scope.getStart(), handler.getExceptionType());
scopes.put(handler.getExceptionType().getClassName(), scope);
}
BytecodeScope fscope = null;
if (this.finallyBlock != null) {
fscope = new BytecodeScope(parent, context.createMarker(), context.createMarker());
context.jumpFinally(code.getStart(), fscope.getStart());
}
context.mark(code.getStart());
this.writeLogic(context);
context.mark(code.getEnd());
if (this.finallyBlock != null) {
context.jump(fscope.getStart());
}
for (String key : exceptionTypes.keySet()) {
ExceptionHandler handler = exceptionTypes.get(key);
handler.write(context, scopes.get(handler.getExceptionType().getClassName()));