Interface ExceptionsAttribute

All Superinterfaces:
Attribute<ExceptionsAttribute>, ClassFileElement, MethodElement

public sealed interface ExceptionsAttribute extends Attribute<ExceptionsAttribute>, MethodElement
Models the Exceptions attribute (JVMS 4.7.5), which can appear on methods, and records the exceptions declared to be thrown by this method. Delivered as a MethodElement when traversing the elements of a MethodModel.

The attribute does not permit multiple instances in a given location. Subsequent occurrence of the attribute takes precedence during the attributed element build or transformation.

Since:
24
  • Method Details

    • exceptions

      List<ClassEntry> exceptions()
      Returns the exceptions declared to be thrown by this method.
      Returns:
      the exceptions declared to be thrown by this method
    • of

      static ExceptionsAttribute of(List<ClassEntry> exceptions)
      Returns an Exceptions attribute.
      Parameters:
      exceptions - the checked exceptions that may be thrown from this method
      Returns:
      an Exceptions attribute
    • of

      static ExceptionsAttribute of(ClassEntry... exceptions)
      Returns an Exceptions attribute.
      Parameters:
      exceptions - the checked exceptions that may be thrown from this method
      Returns:
      an Exceptions attribute
    • ofSymbols

      static ExceptionsAttribute ofSymbols(List<ClassDesc> exceptions)
      Returns an Exceptions attribute.
      Parameters:
      exceptions - the checked exceptions that may be thrown from this method
      Returns:
      an Exceptions attribute
    • ofSymbols

      static ExceptionsAttribute ofSymbols(ClassDesc... exceptions)
      Returns an Exceptions attribute.
      Parameters:
      exceptions - the checked exceptions that may be thrown from this method
      Returns:
      an Exceptions attribute