Top Description Methods
java.lang.classfile.attribute

public sealed Interface ExceptionsAttribute

extends Attribute<ExceptionsAttribute>, MethodElement
Known Direct Implementers
jdk.internal.classfile.impl.BoundAttribute.BoundExceptionsAttribute, jdk.internal.classfile.impl.UnboundAttribute.UnboundExceptionsAttribute
Annotations
@PreviewFeature
feature:CLASSFILE_API
Imports
java.lang.constant.ClassDesc, java.util.Arrays, .List, java.lang.classfile.Attribute, .MethodElement, java.lang.classfile.constantpool.ClassEntry, jdk.internal.classfile.impl.BoundAttribute, .UnboundAttribute, .Util, jdk.internal.javac.PreviewFeature

Models the Exceptions attribute 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 java.lang.classfile.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
22

Method Summary

Modifier and TypeMethod and Description
public List<ClassEntry>

Returns:

the exceptions declared to be thrown by this method
exceptions
()

Returns the exceptions declared to be thrown by this method.

public static ExceptionsAttribute

Returns:

an Exceptions attribute
of
(List<ClassEntry>
the checked exceptions that may be thrown from this method
exceptions
)

Returns an Exceptions attribute.

public static ExceptionsAttribute

Returns:

an Exceptions attribute
of
(ClassEntry...
the checked exceptions that may be thrown from this method
exceptions
)

Returns an Exceptions attribute.

public static ExceptionsAttribute

Returns:

an Exceptions attribute
ofSymbols
(List<ClassDesc>
the checked exceptions that may be thrown from this method
exceptions
)

Returns an Exceptions attribute.

public static ExceptionsAttribute

Returns:

an Exceptions attribute
ofSymbols
(ClassDesc...
the checked exceptions that may be thrown from this method
exceptions
)

Returns an Exceptions attribute.

Inherited from java.lang.classfile.Attribute:
attributeMapperattributeName

Method Detail

exceptionsback to summary
public List<ClassEntry> exceptions()

Returns the exceptions declared to be thrown by this method.

Returns:List<ClassEntry>

the exceptions declared to be thrown by this method

ofback to summary
public static ExceptionsAttribute of(List<ClassEntry> exceptions)

Returns an Exceptions attribute.

Parameters
exceptions:List<ClassEntry>

the checked exceptions that may be thrown from this method

Returns:ExceptionsAttribute

an Exceptions attribute

ofback to summary
public static ExceptionsAttribute of(ClassEntry... exceptions)

Returns an Exceptions attribute.

Parameters
exceptions:ClassEntry[]

the checked exceptions that may be thrown from this method

Returns:ExceptionsAttribute

an Exceptions attribute

ofSymbolsback to summary
public static ExceptionsAttribute ofSymbols(List<ClassDesc> exceptions)

Returns an Exceptions attribute.

Parameters
exceptions:List<ClassDesc>

the checked exceptions that may be thrown from this method

Returns:ExceptionsAttribute

an Exceptions attribute

ofSymbolsback to summary
public static ExceptionsAttribute ofSymbols(ClassDesc... exceptions)

Returns an Exceptions attribute.

Parameters
exceptions:ClassDesc[]

the checked exceptions that may be thrown from this method

Returns:ExceptionsAttribute

an Exceptions attribute