- All Superinterfaces:
AttributedElement,ClassFileElement,CompoundElement<CodeElement>,Iterable<CodeElement>,MethodElement
- All Known Subinterfaces:
CodeAttribute
Code attribute). A Code
attribute is viewed as a composition of CodeElements, which is the only way to access Instructions; the
order of elements of a code model is significant.
A CodeModel is obtained from MethodModel.code(), or in the
traversal of the member elements of a method.
MethodBuilder.withCode(java.util.function.Consumer<? super io.smallrye.classfile.CodeBuilder>) is the main way to build code models. MethodBuilder.transformCode(io.smallrye.classfile.CodeModel, io.smallrye.classfile.CodeTransform) and CodeBuilder.transforming(io.smallrye.classfile.CodeTransform, java.util.function.Consumer<io.smallrye.classfile.CodeBuilder>) allow
creating new Code attributes by selectively processing the original
code elements and directing the results to a code builder.
A Code attribute holds attributes, but they are usually not member
elements, but are decomposed to PseudoInstruction, accessible
according to ClassFile.DeadLabelsOption, ClassFile.DebugElementsOption, and
ClassFile.LineNumbersOption. StackMapTableAttribute can only be
accessed via explicit attribute reading, as it
is considered a derived property from the code body.
- Since:
- 24
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns the exception table of the method.parent()Returns the enclosing method, if known.Methods inherited from interface io.smallrye.classfile.AttributedElement
attributes, findAttribute, findAttributesMethods inherited from interface io.smallrye.classfile.CompoundElement
elementList, elementStream, forEach, iterator, toDebugStringMethods inherited from interface java.lang.Iterable
spliterator
-
Method Details
-
parent
Optional<MethodModel> parent()Returns the enclosing method, if known.- Returns:
- the enclosing method, if known
-
exceptionHandlers
List<ExceptionCatch> exceptionHandlers()Returns the exception table of the method. The exception table is also modeled byExceptionCatchelements in the streaming view.- Returns:
- the exception table of the method
-