Interface ExceptionsAttribute

All Superinterfaces:
AttributePREVIEW<ExceptionsAttributePREVIEW>, ClassFileElementPREVIEW, MethodElementPREVIEW

public sealed interface ExceptionsAttribute extends AttributePREVIEW<ExceptionsAttributePREVIEW>, MethodElementPREVIEW
ExceptionsAttribute is a preview API of the Java platform.
Programs can only use ExceptionsAttribute when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
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 MethodElementPREVIEW when traversing the elements of a MethodModelPREVIEW.

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:
22
  • Method Details

    • exceptions

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

      Returns an Exceptions attribute.
      Parameters:
      exceptions - the checked exceptions that may be thrown from this method
      Returns:
      an Exceptions attribute
    • of

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

      static ExceptionsAttributePREVIEW 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 ExceptionsAttributePREVIEW ofSymbols(ClassDesc... exceptions)
      Returns an Exceptions attribute.
      Parameters:
      exceptions - the checked exceptions that may be thrown from this method
      Returns:
      an Exceptions attribute