Class Handler

java.lang.Object
org.objectweb.asm.Handler

final class Handler extends Object
Information about an exception handler. Corresponds to an element of the exception_table array of a Code attribute, as defined in the Java Virtual Machine Specification (JVMS). Handler instances can be chained together, with their nextHandler field, to describe a full JVMS exception_table array.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) final int
    The catch_type field of this JVMS exception_table entry.
    (package private) final String
    The internal name of the type of exceptions handled by this handler, or null to catch any exceptions.
    (package private) final Label
    The end_pc field of this JVMS exception_table entry.
    (package private) final Label
    The handler_pc field of this JVMS exception_table entry.
    (package private) Handler
    The next exception handler.
    (package private) final Label
    The start_pc field of this JVMS exception_table entry.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Handler(Handler handler, Label startPc, Label endPc)
    Constructs a new Handler from the given one, with a different scope.
    Handler(Label startPc, Label endPc, Label handlerPc, int catchType, String catchTypeDescriptor)
    Constructs a new Handler.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static int
    Returns the number of elements of the Handler list that begins with the given element.
    (package private) static int
    Returns the size in bytes of the JVMS exception_table corresponding to the Handler list that begins with the given element.
    (package private) static void
    putExceptionTable(Handler firstHandler, ByteVector output)
    Puts the JVMS exception_table corresponding to the Handler list that begins with the given element.
    (package private) static Handler
    removeRange(Handler firstHandler, Label start, Label end)
    Removes the range between start and end from the Handler list that begins with the given element.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • startPc

      final Label startPc
      The start_pc field of this JVMS exception_table entry. Corresponds to the beginning of the exception handler's scope (inclusive).
    • endPc

      final Label endPc
      The end_pc field of this JVMS exception_table entry. Corresponds to the end of the exception handler's scope (exclusive).
    • handlerPc

      final Label handlerPc
      The handler_pc field of this JVMS exception_table entry. Corresponding to the beginning of the exception handler's code.
    • catchType

      final int catchType
      The catch_type field of this JVMS exception_table entry. This is the constant pool index of the internal name of the type of exceptions handled by this handler, or 0 to catch any exceptions.
    • catchTypeDescriptor

      final String catchTypeDescriptor
      The internal name of the type of exceptions handled by this handler, or null to catch any exceptions.
    • nextHandler

      Handler nextHandler
      The next exception handler.
  • Constructor Details

    • Handler

      Handler(Label startPc, Label endPc, Label handlerPc, int catchType, String catchTypeDescriptor)
      Constructs a new Handler.
      Parameters:
      startPc - the start_pc field of this JVMS exception_table entry.
      endPc - the end_pc field of this JVMS exception_table entry.
      handlerPc - the handler_pc field of this JVMS exception_table entry.
      catchType - The catch_type field of this JVMS exception_table entry.
      catchTypeDescriptor - The internal name of the type of exceptions handled by this handler, or null to catch any exceptions.
    • Handler

      Handler(Handler handler, Label startPc, Label endPc)
      Constructs a new Handler from the given one, with a different scope.
      Parameters:
      handler - an existing Handler.
      startPc - the start_pc field of this JVMS exception_table entry.
      endPc - the end_pc field of this JVMS exception_table entry.
  • Method Details

    • removeRange

      static Handler removeRange(Handler firstHandler, Label start, Label end)
      Removes the range between start and end from the Handler list that begins with the given element.
      Parameters:
      firstHandler - the beginning of a Handler list. May be null.
      start - the start of the range to be removed.
      end - the end of the range to be removed. Maybe null.
      Returns:
      the exception handler list with the start-end range removed.
    • getExceptionTableLength

      static int getExceptionTableLength(Handler firstHandler)
      Returns the number of elements of the Handler list that begins with the given element.
      Parameters:
      firstHandler - the beginning of a Handler list. May be null.
      Returns:
      the number of elements of the Handler list that begins with 'handler'.
    • getExceptionTableSize

      static int getExceptionTableSize(Handler firstHandler)
      Returns the size in bytes of the JVMS exception_table corresponding to the Handler list that begins with the given element. This includes the exception_table_length field.
      Parameters:
      firstHandler - the beginning of a Handler list. May be null.
      Returns:
      the size in bytes of the exception_table_length and exception_table structures.
    • putExceptionTable

      static void putExceptionTable(Handler firstHandler, ByteVector output)
      Puts the JVMS exception_table corresponding to the Handler list that begins with the given element. This includes the exception_table_length field.
      Parameters:
      firstHandler - the beginning of a Handler list. May be null.
      output - where the exception_table_length and exception_table structures must be put.