Uses of Interface java.lang.classfile.Annotation (Java SE 26 & JDK 26)
Description: use: module: java.base, package: java.lang.classfile, interface: Annotation

# Uses of Interface
java.lang.classfile.Annotation

Packages that use Annotation
Package
Description
java.lang.classfile
Provides classfile parsing, generation, and transformation library.
java.lang.classfile.attribute
Provides interfaces describing `class` file attributes for the `java.lang.classfile` library.

- ## Uses of Annotation in java.lang.classfile

  Methods in java.lang.classfile that return Annotation
  Modifier and Type
  Method
  Description
  `Annotation`
  AnnotationValue.OfAnnotation.`annotation()`
  Returns the annotation value.
  `Annotation`
  TypeAnnotation.`annotation()`
  Returns the annotation applied to the part indicated by `TypeAnnotation.targetPath()`.
  `static Annotation`
  Annotation.`of(Utf8Entry annotationClass, AnnotationElement... elements)`
  Returns an annotation.
  `static Annotation`
  Annotation.`of(Utf8Entry annotationClass, List<AnnotationElement> elements)`
  Returns an annotation.
  `static Annotation`
  Annotation.`of(ClassDesc annotationClass, AnnotationElement... elements)`
  Returns an annotation.
  `static Annotation`
  Annotation.`of(ClassDesc annotationClass, List<AnnotationElement> elements)`
  Returns an annotation.
  Methods in java.lang.classfile with parameters of type Annotation
  Modifier and Type
  Method
  Description
  `static TypeAnnotation`
  TypeAnnotation.`of(TypeAnnotation.TargetInfo targetInfo, List<TypeAnnotation.TypePathComponent> targetPath, Annotation annotation)`
  Returns a `type_annotation` structure.
  `static AnnotationElement`
  AnnotationElement.`ofAnnotation(String name, Annotation value)`
  Returns an element-value pair for an annotation-valued element.
  `static AnnotationValue.OfAnnotation`
  AnnotationValue.`ofAnnotation(Annotation value)`
  Returns an annotation value for an element-value pair.

- ## Uses of Annotation in java.lang.classfile.attribute

  Methods in java.lang.classfile.attribute that return types with arguments of type Annotation
  Modifier and Type
  Method
  Description
  `List<Annotation>`
  RuntimeInvisibleAnnotationsAttribute.`annotations()`
  Returns the run-time invisible declaration annotations on this structure.
  `List<Annotation>`
  RuntimeVisibleAnnotationsAttribute.`annotations()`
  Returns the run-time visible declaration annotations on this structure.
  `List<List<Annotation>>`
  RuntimeInvisibleParameterAnnotationsAttribute.`parameterAnnotations()`
  Returns the list of run-time invisible annotations on the method parameters.
  `List<List<Annotation>>`
  RuntimeVisibleParameterAnnotationsAttribute.`parameterAnnotations()`
  Returns the list of run-time visible annotations on the method parameters.
  Methods in java.lang.classfile.attribute with parameters of type Annotation
  Modifier and Type
  Method
  Description
  `static RuntimeInvisibleAnnotationsAttribute`
  RuntimeInvisibleAnnotationsAttribute.`of(Annotation... annotations)`
  Returns a `RuntimeInvisibleAnnotations` attribute.
  `static RuntimeVisibleAnnotationsAttribute`
  RuntimeVisibleAnnotationsAttribute.`of(Annotation... annotations)`
  Returns a `RuntimeVisibleAnnotations` attribute.
  Method parameters in java.lang.classfile.attribute with type arguments of type Annotation
  Modifier and Type
  Method
  Description
  `static RuntimeInvisibleAnnotationsAttribute`
  RuntimeInvisibleAnnotationsAttribute.`of(List<Annotation> annotations)`
  Returns a `RuntimeInvisibleAnnotations` attribute.
  `static RuntimeInvisibleParameterAnnotationsAttribute`
  RuntimeInvisibleParameterAnnotationsAttribute.`of(List<List<Annotation>> parameterAnnotations)`
  Returns a `RuntimeInvisibleParameterAnnotations` attribute.
  `static RuntimeVisibleAnnotationsAttribute`
  RuntimeVisibleAnnotationsAttribute.`of(List<Annotation> annotations)`
  Returns a `RuntimeVisibleAnnotations` attribute.
  `static RuntimeVisibleParameterAnnotationsAttribute`
  RuntimeVisibleParameterAnnotationsAttribute.`of(List<List<Annotation>> parameterAnnotations)`
  Returns a `RuntimeVisibleParameterAnnotations` attribute.