コード例 #1
0
  private void inlineLocalFinallyStmt(IRStatement tryOrCatchStmt, Label labelEnd) {
    MethodVisitor mv = _context.getMv();

    if (tryOrCatchStmt.getLeastSignificantTerminalStatement() == null) {
      if (hasFinally()) {
        _finallyPartitioner.inlineFinally();
        NamedLabel endLabel =
            new NamedLabel("EndFinally" + _finallyPartitioner.getFinallyEnds().size());
        _context.visitLabel(endLabel);
        _finallyPartitioner.endInlineFinally(endLabel);
      }

      // Also jump to end of finally
      mv.visitJumpInsn(Opcodes.GOTO, labelEnd);
    }
  }
コード例 #2
0
 private void declareCatchExtents(
     MethodVisitor mv, Label tryStart, Label coverageEnd, Label handlerStart, IRType type) {
   Label start = tryStart;
   Label end;
   List<Label> starts =
       _finallyPartitioner == null
           ? Collections.<Label>emptyList()
           : _finallyPartitioner.getFinallyStarts();
   List<Label> ends =
       _finallyPartitioner == null
           ? Collections.<Label>emptyList()
           : _finallyPartitioner.getFinallyEnds();
   for (int i = 0; i < starts.size(); i++) {
     end = starts.get(i);
     if (end.getOffset() > coverageEnd.getOffset()) {
       break;
     }
     insertTryCatchBlock(mv, handlerStart, type, start, end);
     start = ends.get(i);
   }
   end = coverageEnd;
   insertTryCatchBlock(mv, handlerStart, type, start, end);
 }