@Override public void generate() { LocalVariable exception = getLocalAnonymousVariableModel(getExceptionType()); OperatorFactory.newOperator(Store.class, new Class[] { KernelProgramBlock.class, LocalVariable.class }, getExecutor(), exception); body(exception); }
@Override public Label getSerialEnd() { if (finallyBlock != null) { return finallyBlock.getEnd(); } else { return catches.get(catches.size() - 1).getEnd(); } }
c.prepare(); if (!c.isFinish()) { OperatorFactory.newOperator(GOTO.class, new Class[] { KernelProgramBlock.class, Label.class }, c, getSerialEnd()); c.prepare(); if (!c.isFinish()) { Label finallyStart = new Label("catch's implicit finally start"); Label finallyEnd = new Label("catch's implicit finally end"); addAnyExceptionCatchRange(catches.get(catches.size() - 1).getEnd());
@Override protected void doExecute(MethodExecuteContext context) { // the exception variable already exists at the top of the statck. context.getInstructions().getOperandStack().push(getExceptionType().getType()); for (InstructionNode node : getChildren()) { node.execute(context); } }
void appendEpisode(KernelCatch catchBlock) { initEpisode(catchBlock); if (catches == null) { catches = new ArrayList<>(); getChildren().addAfter(tryBlock, catchBlock); } else { KernelCatch previous = catches.get(catches.size() - 1); IClass exceptionType = catchBlock.getExceptionType(); if (exceptionType != null && exceptionType.isChildOrEqual(previous.getExceptionType())) { throw new ASMSupportException("Unreachable catch block for " + exceptionType + ". It is already handled by the catch block for " + exceptionType); } getChildren().addAfter(previous, catchBlock); } catches.add(catchBlock); // Add Exception Table: addTreCatchInfo(tryBlock.getStart(), tryBlock.getEnd(), catchBlock.getStart(), catchBlock.getExceptionType()); }
@Override public Catch catch_(Catch catchBlock) { catchBlock.parent = parent; getDelegate().catch_(catchBlock.getDelegate()); return catchBlock; }
@Override public Finally finally_(Finally finallyClient) { finallyClient.parent = parent; getDelegate().finally_(finallyClient.getDelegate()); return finallyClient; }
@Override public void execute(MethodExecuteContext context) { tryBlock.execute(context); if (CollectionUtils.isNotEmpty(catches)) { for (KernelCatch c : catches) { c.execute(context); } } if (finallyBlock != null) { implicitCatch.execute(context); finallyBlock.execute(context); } }