Interface TryBlock

All Superinterfaces:
AutoCloseable, BytecodeCreator
All Known Implementing Classes:
TryBlockImpl

public interface TryBlock extends BytecodeCreator
A try block. If the flow of control exits the bottom of the try block, it will resume after the point the block was declared in the enclosing scope.
  • Method Details

    • addCatch

      CatchBlockCreator addCatch(String exceptionType)
      Add a catch block. The catch block will be emitted after the try block. If the flow of control exits the bottom of the catch block, it will resume after the point where the try block was declared in the enclosing scope. The parent scope of the catch block is the same as the parent scope of the try block.
      Parameters:
      exceptionType - the exception type to catch (must not be null)
      Returns:
      the catch block (not null)
    • addCatch

      default CatchBlockCreator addCatch(Class<? extends Throwable> exceptionType)
      Add a catch block in the same manner as addCatch(String).
      Parameters:
      exceptionType - the exception type (must not be null)
      Returns:
      the catch block (not null)