Interface TryBlock<EH extends ExceptionHandler>

All Known Implementing Classes:
BaseTryBlock, BuilderTryBlock, BuilderTryBlock, DexBackedTryBlock, ImmutableTryBlock, TryBlockRewriter.RewrittenTryBlock, TryListBuilder.MutableTryBlock

public interface TryBlock<EH extends ExceptionHandler>
This class represents an individual try block and associated set of handlers.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares this TryBlock to another TryBlock for equality.
    int
    Gets the number of code units covered by this try block.
    List<? extends EH>
    A list of the exception handlers associated with this try block.
    int
    Gets the code offset of the start of this try block.
  • Method Details

    • getStartCodeAddress

      int getStartCodeAddress()
      Gets the code offset of the start of this try block. The starting location must not occur in the middle of an instruction.
      Returns:
      The offset of the start of the try block from the the beginning of the bytecode for the method. The offset will be in terms of 16-bit code units.
    • getCodeUnitCount

      int getCodeUnitCount()
      Gets the number of code units covered by this try block. The end of the try block is typically coincident with the end of an instruction, but does not strictly need to be. If the last instruction is only partly covered by this try block, it is considered to be covered.
      Returns:
      The number of code units covered by this try block.
    • getExceptionHandlers

      @Nonnull List<? extends EH> getExceptionHandlers()
      A list of the exception handlers associated with this try block. The exception handlers in the returned list will all have a unique type, including at most 1 with no type, which is the catch-all handler. If present, the catch-all handler is always the last item in the list.
      Returns:
      A list of ExceptionHandler objects
    • equals

      boolean equals(@Nullable Object o)
      Compares this TryBlock to another TryBlock for equality. This TryBlock is equal to another TryBlock if all 3 fields are equal. The exception handlers are tested for equality using the usual List equality semantics.
      Overrides:
      equals in class Object
      Parameters:
      o - The object to be compared for equality with this TryBlock
      Returns:
      true if the specified object is equal to this TryBlock