ClassFileElement (Java SE 26 & JDK 26)
Description: declaration: module: java.base, package: java.lang.classfile, interface: ClassFileElement
Keywords: java.lang.classfile.ClassFileElement interface

# Interface ClassFileElement

All Known Subinterfaces:
  `AccessFlags, AnnotationDefaultAttribute, ArrayLoadInstruction, ArrayStoreInstruction, Attribute<A>, AttributedElement, BootstrapMethodsAttribute, BranchInstruction, CharacterRange, CharacterRangeTableAttribute, ClassElement, ClassFileVersion, ClassModel, CodeAttribute, CodeElement, CodeModel, CompilationIDAttribute, CompoundElement<E>, ConstantInstruction, ConstantInstruction.ArgumentConstantInstruction, ConstantInstruction.IntrinsicConstantInstruction, ConstantInstruction.LoadConstantInstruction, ConstantValueAttribute, ConvertInstruction, DeprecatedAttribute, DiscontinuedInstruction, DiscontinuedInstruction.JsrInstruction, DiscontinuedInstruction.RetInstruction, EnclosingMethodAttribute, ExceptionCatch, ExceptionsAttribute, FieldElement, FieldInstruction, FieldModel, IncrementInstruction, InnerClassesAttribute, Instruction, Interfaces, InvokeDynamicInstruction, InvokeInstruction, LabelTarget, LineNumber, LineNumberTableAttribute, LoadInstruction, LocalVariable, LocalVariableTableAttribute, LocalVariableType, LocalVariableTypeTableAttribute, LookupSwitchInstruction, MethodElement, MethodModel, MethodParametersAttribute, ModuleAttribute, ModuleHashesAttribute, ModuleMainClassAttribute, ModulePackagesAttribute, ModuleResolutionAttribute, ModuleTargetAttribute, MonitorInstruction, NestHostAttribute, NestMembersAttribute, NewMultiArrayInstruction, NewObjectInstruction, NewPrimitiveArrayInstruction, NewReferenceArrayInstruction, NopInstruction, OperatorInstruction, PermittedSubclassesAttribute, PseudoInstruction, RecordAttribute, RecordComponentInfo, ReturnInstruction, RuntimeInvisibleAnnotationsAttribute, RuntimeInvisibleParameterAnnotationsAttribute, RuntimeInvisibleTypeAnnotationsAttribute, RuntimeVisibleAnnotationsAttribute, RuntimeVisibleParameterAnnotationsAttribute, RuntimeVisibleTypeAnnotationsAttribute, SignatureAttribute, SourceDebugExtensionAttribute, SourceFileAttribute, SourceIDAttribute, StackInstruction, StackMapTableAttribute, StoreInstruction, Superclass, SyntheticAttribute, TableSwitchInstruction, ThrowInstruction, TypeCheckInstruction, UnknownAttribute`

All Known Implementing Classes:
  `CustomAttribute`

public sealed interface ClassFileElement permits AttributedElement, CompoundElement<E>, Attribute<A>, ClassElement, CodeElement, FieldElement, MethodElement
Marker interface for structures with special capabilities in the `class` file format. `AttributedElement` indicates a structure has `Attribute`s. `CompoundElement` indicates a structure can be viewed as a composition of member structures, whose memberships are marked by `ClassElement`, `MethodElement`, `FieldElement`, or `CodeElement`.

## Membership Elements

`ClassModel`, `MethodModel`, `FieldModel`, and `CodeModel` each has a dedicated interface marking its member structures: `ClassElement`, `MethodElement`, `FieldElement`, and `CodeElement`. They can be supplied to a `ClassBuilder`, a `MethodBuilder`, a `FieldBuilder`, or a `CodeBuilder` to be included as members of the built model. Unless otherwise specified, these structures are delivered during the traversal of the corresponding models. Some of these elements may appear at most once or exactly once in the traversal of the models; such elements have special treatment by `ClassFileBuilder` and are specified in their modeling interfaces. If such elements appear multiple times during traversal, the last occurrence should be used and all previous instances should be discarded.

These membership element marker interfaces are sealed; future versions of the Java SE Platform may define new elements to the sealed hierarchy when the `class` file format for the Java Platform evolves. Using an exhaustive pattern matching switch over these hierarchies indicates the user only wish the processing code to run on a specific version of Java Platform, and will fail if unknown new elements are encountered.

Sealed Class Hierarchy Graph:
Since:
  24