TypeAnnotation.FormalParameterTarget (Java SE 22 & JDK 22)
Description: declaration: module: java.base, package: java.lang.classfile, interface: TypeAnnotation, interface: FormalParameterTarget
Keywords: java.lang.classfile.TypeAnnotation.FormalParameterTarget interface

Module java.base
Package java.lang.classfilePREVIEW

# Interface TypeAnnotation.FormalParameterTarget

All Superinterfaces:
  `TypeAnnotation.TargetInfoPREVIEW`

Enclosing interface:
  `TypeAnnotationPREVIEW`

public static sealed interface TypeAnnotation.FormalParameterTarget extends TypeAnnotation.TargetInfoPREVIEW
`FormalParameterTarget` is a preview API of the Java platform.
Programs can only use `FormalParameterTarget` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Indicates that an annotation appears on the type in a formal parameter declaration of a method, constructor, or lambda expression.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `formalParameterIndex()`
  Which formal parameter declaration has an annotated type.

  ### Methods declared in interface java.lang.classfile.TypeAnnotation.TargetInfoPREVIEW

  `size, targetType`

- ## Method Details

  - ### formalParameterIndex

    int formalParameterIndex()
    Which formal parameter declaration has an annotated type.
    Returns:
      the index into the formal parameter declarations, in the order declared in the source code