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

# Interface TypeAnnotation.TargetInfo

All Known Subinterfaces:
  `TypeAnnotation.CatchTarget, TypeAnnotation.EmptyTarget, TypeAnnotation.FormalParameterTarget, TypeAnnotation.LocalVarTarget, TypeAnnotation.OffsetTarget, TypeAnnotation.SupertypeTarget, TypeAnnotation.ThrowsTarget, TypeAnnotation.TypeArgumentTarget, TypeAnnotation.TypeParameterBoundTarget, TypeAnnotation.TypeParameterTarget`

Enclosing interface:
  `TypeAnnotation`

public static sealed interface TypeAnnotation.TargetInfo permits TypeAnnotation.TypeParameterTarget, TypeAnnotation.SupertypeTarget, TypeAnnotation.TypeParameterBoundTarget, TypeAnnotation.EmptyTarget, TypeAnnotation.FormalParameterTarget, TypeAnnotation.ThrowsTarget, TypeAnnotation.LocalVarTarget, TypeAnnotation.CatchTarget, TypeAnnotation.OffsetTarget, TypeAnnotation.TypeArgumentTarget
Specifies which type in a declaration or expression is being annotated.

Sealed Class Hierarchy Graph:
Since:
  24
See Also:
  - `TypeAnnotation.targetInfo()`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `TARGET_CAST`
  The value of type annotation target type `CAST`.
  `static final int`
  `TARGET_CLASS_EXTENDS`
  The value of type annotation target type `CLASS_EXTENDS`.
  `static final int`
  `TARGET_CLASS_TYPE_PARAMETER`
  The value of type annotation target type `CLASS_TYPE_PARAMETER`.
  `static final int`
  `TARGET_CLASS_TYPE_PARAMETER_BOUND`
  The value of type annotation target type `CLASS_TYPE_PARAMETER_BOUND`.
  `static final int`
  `TARGET_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT`
  The value of type annotation target type `CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT`.
  `static final int`
  `TARGET_CONSTRUCTOR_REFERENCE`
  The value of type annotation target type `CONSTRUCTOR_REFERENCE`.
  `static final int`
  `TARGET_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT`
  The value of type annotation target type `CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT`.
  `static final int`
  `TARGET_EXCEPTION_PARAMETER`
  The value of type annotation target type `EXCEPTION_PARAMETER`.
  `static final int`
  `TARGET_FIELD`
  The value of type annotation target type `FIELD`.
  `static final int`
  `TARGET_INSTANCEOF`
  The value of type annotation target type `INSTANCEOF`.
  `static final int`
  `TARGET_LOCAL_VARIABLE`
  The value of type annotation target type `LOCAL_VARIABLE`.
  `static final int`
  `TARGET_METHOD_FORMAL_PARAMETER`
  The value of type annotation target type `METHOD_FORMAL_PARAMETER`.
  `static final int`
  `TARGET_METHOD_INVOCATION_TYPE_ARGUMENT`
  The value of type annotation target type `METHOD_INVOCATION_TYPE_ARGUMENT`.
  `static final int`
  `TARGET_METHOD_RECEIVER`
  The value of type annotation target type `METHOD_RECEIVER`.
  `static final int`
  `TARGET_METHOD_REFERENCE`
  The value of type annotation target type `METHOD_REFERENCE`.
  `static final int`
  `TARGET_METHOD_REFERENCE_TYPE_ARGUMENT`
  The value of type annotation target type `METHOD_REFERENCE_TYPE_ARGUMENT`.
  `static final int`
  `TARGET_METHOD_RETURN`
  The value of type annotation target type `METHOD_RETURN`.
  `static final int`
  `TARGET_METHOD_TYPE_PARAMETER`
  The value of type annotation target type `METHOD_TYPE_PARAMETER`.
  `static final int`
  `TARGET_METHOD_TYPE_PARAMETER_BOUND`
  The value of type annotation target type `METHOD_TYPE_PARAMETER_BOUND`.
  `static final int`
  `TARGET_NEW`
  The value of type annotation target type `NEW`.
  `static final int`
  `TARGET_RESOURCE_VARIABLE`
  The value of type annotation target type `RESOURCE_VARIABLE`.
  `static final int`
  `TARGET_THROWS`
  The value of type annotation target type `THROWS`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static TypeAnnotation.EmptyTarget`
  `of(TypeAnnotation.TargetType targetType)`
  Returns a target for annotations.
  `static TypeAnnotation.TypeArgumentTarget`
  `ofCastExpr(Label target, int typeArgumentIndex)`
  Returns a target for annotations on the i'th type in a cast expression.
  `static TypeAnnotation.SupertypeTarget`
  `ofClassExtends(int supertypeIndex)`
  Returns a target for annotations on the type of an "extends" or "implements" clause.
  `static TypeAnnotation.TypeParameterTarget`
  `ofClassTypeParameter(int typeParameterIndex)`
  Returns a target for annotations on a class type parameter declaration.
  `static TypeAnnotation.TypeParameterBoundTarget`
  `ofClassTypeParameterBound(int typeParameterIndex, int boundIndex)`
  Returns a target for annotations on the i'th bound of the j'th type parameter declaration of a generic class, or interface.
  `static TypeAnnotation.TypeArgumentTarget`
  `ofConstructorInvocationTypeArgument(Label target, int typeArgumentIndex)`
  Returns a target for annotations on the i'th type argument in the explicit type argument list for an explicit constructor invocation statement.
  `static TypeAnnotation.OffsetTarget`
  `ofConstructorReference(Label target)`
  Returns a target for annotations on the type before the :: in a constructor reference expression.
  `static TypeAnnotation.TypeArgumentTarget`
  `ofConstructorReferenceTypeArgument(Label target, int typeArgumentIndex)`
  Returns a target for annotations on the i'th type argument in the explicit type argument list for a new expression.
  `static TypeAnnotation.CatchTarget`
  `ofExceptionParameter(int exceptionTableIndex)`
  Returns a target for annotations on the i'th type in an exception parameter declaration.
  `static TypeAnnotation.EmptyTarget`
  `ofField()`
  Returns a target for annotations on the type in a field or record declaration.
  `static TypeAnnotation.OffsetTarget`
  `ofInstanceofExpr(Label target)`
  Returns a target for annotations on the type in an instanceof expression.
  `static TypeAnnotation.LocalVarTarget`
  `ofLocalVariable(List<TypeAnnotation.LocalVarTargetInfo> table)`
  Returns a target for annotations on the type in a local variable declaration.
  `static TypeAnnotation.FormalParameterTarget`
  `ofMethodFormalParameter(int formalParameterIndex)`
  Returns a target for annotations on the type in a formal parameter declaration of a method, constructor, or lambda expression.
  `static TypeAnnotation.TypeArgumentTarget`
  `ofMethodInvocationTypeArgument(Label target, int typeArgumentIndex)`
  Returns a target for annotations on the i'th type argument in the explicit type argument list for a method invocation expression.
  `static TypeAnnotation.EmptyTarget`
  `ofMethodReceiver()`
  Returns a target for annotations on the receiver type of a method or constructor.
  `static TypeAnnotation.OffsetTarget`
  `ofMethodReference(Label target)`
  Returns a target for annotations on the type before the :: in a method reference expression.
  `static TypeAnnotation.TypeArgumentTarget`
  `ofMethodReferenceTypeArgument(Label target, int typeArgumentIndex)`
  Returns a target for annotations on the i'th type argument in the explicit type argument list for a method reference expression.
  `static TypeAnnotation.EmptyTarget`
  `ofMethodReturn()`
  Returns a target for annotations on the return type of a method or a newly constructed object.
  `static TypeAnnotation.TypeParameterTarget`
  `ofMethodTypeParameter(int typeParameterIndex)`
  Returns a target for annotations on a method type parameter declaration.
  `static TypeAnnotation.TypeParameterBoundTarget`
  `ofMethodTypeParameterBound(int typeParameterIndex, int boundIndex)`
  Returns a target for annotations on the i'th bound of the j'th type parameter declaration of a generic method, or constructor.
  `static TypeAnnotation.OffsetTarget`
  `ofNewExpr(Label target)`
  Returns a target for annotations on the type in a new expression.
  `static TypeAnnotation.OffsetTarget`
  `ofOffset(TypeAnnotation.TargetType targetType, Label target)`
  Returns a target for annotations on the type in an instanceof expression or a new expression, or the type before the :: in a method reference expression.
  `static TypeAnnotation.LocalVarTarget`
  `ofResourceVariable(List<TypeAnnotation.LocalVarTargetInfo> table)`
  Returns a target for annotations on the type in a local variable declared as a resource in a try-with-resources statement.
  `static TypeAnnotation.ThrowsTarget`
  `ofThrows(int throwsTargetIndex)`
  Returns a target for annotations on the i'th type in the throws clause of a method or constructor declaration.
  `static TypeAnnotation.TypeArgumentTarget`
  `ofTypeArgument(TypeAnnotation.TargetType targetType, Label target, int typeArgumentIndex)`
  Returns a target for annotations on the i'th type in a cast expression, or on the i'th type argument in the explicit type argument list for any of the following: a new expression, an explicit constructor invocation statement, a method invocation expression, or a method reference expression.
  `static TypeAnnotation.TypeParameterTarget`
  `ofTypeParameter(TypeAnnotation.TargetType targetType, int typeParameterIndex)`
  Returns a target for annotations on a class or method type parameter declaration.
  `static TypeAnnotation.TypeParameterBoundTarget`
  `ofTypeParameterBound(TypeAnnotation.TargetType targetType, int typeParameterIndex, int boundIndex)`
  Returns a target for annotations on the i'th bound of the j'th type parameter declaration of a generic class, interface, method, or constructor.
  `static TypeAnnotation.LocalVarTarget`
  `ofVariable(TypeAnnotation.TargetType targetType, List<TypeAnnotation.LocalVarTargetInfo> table)`
  Returns a target for annotations on the type in a local variable declaration, including a variable declared as a resource in a try-with-resources statement.
  `default int`
  `size()`
  Returns the size of the target info.
  `TypeAnnotation.TargetType`
  `targetType()`
  Returns the type of the target.

- ## Field Details

  - ### TARGET_CLASS_TYPE_PARAMETER

    static final int TARGET_CLASS_TYPE_PARAMETER
    The value of type annotation target type `CLASS_TYPE_PARAMETER`.
    See Also:
      - Constant Field Values

  - ### TARGET_METHOD_TYPE_PARAMETER

    static final int TARGET_METHOD_TYPE_PARAMETER
    The value of type annotation target type `METHOD_TYPE_PARAMETER`.
    See Also:
      - Constant Field Values

  - ### TARGET_CLASS_EXTENDS

    static final int TARGET_CLASS_EXTENDS
    The value of type annotation target type `CLASS_EXTENDS`.
    See Also:
      - Constant Field Values

  - ### TARGET_CLASS_TYPE_PARAMETER_BOUND

    static final int TARGET_CLASS_TYPE_PARAMETER_BOUND
    The value of type annotation target type `CLASS_TYPE_PARAMETER_BOUND`.
    See Also:
      - Constant Field Values

  - ### TARGET_METHOD_TYPE_PARAMETER_BOUND

    static final int TARGET_METHOD_TYPE_PARAMETER_BOUND
    The value of type annotation target type `METHOD_TYPE_PARAMETER_BOUND`.
    See Also:
      - Constant Field Values

  - ### TARGET_FIELD

    static final int TARGET_FIELD
    The value of type annotation target type `FIELD`.
    See Also:
      - Constant Field Values

  - ### TARGET_METHOD_RETURN

    static final int TARGET_METHOD_RETURN
    The value of type annotation target type `METHOD_RETURN`.
    See Also:
      - Constant Field Values

  - ### TARGET_METHOD_RECEIVER

    static final int TARGET_METHOD_RECEIVER
    The value of type annotation target type `METHOD_RECEIVER`.
    See Also:
      - Constant Field Values

  - ### TARGET_METHOD_FORMAL_PARAMETER

    static final int TARGET_METHOD_FORMAL_PARAMETER
    The value of type annotation target type `METHOD_FORMAL_PARAMETER`.
    See Also:
      - Constant Field Values

  - ### TARGET_THROWS

    static final int TARGET_THROWS
    The value of type annotation target type `THROWS`.
    See Also:
      - Constant Field Values

  - ### TARGET_LOCAL_VARIABLE

    static final int TARGET_LOCAL_VARIABLE
    The value of type annotation target type `LOCAL_VARIABLE`.
    See Also:
      - Constant Field Values

  - ### TARGET_RESOURCE_VARIABLE

    static final int TARGET_RESOURCE_VARIABLE
    The value of type annotation target type `RESOURCE_VARIABLE`.
    See Also:
      - Constant Field Values

  - ### TARGET_EXCEPTION_PARAMETER

    static final int TARGET_EXCEPTION_PARAMETER
    The value of type annotation target type `EXCEPTION_PARAMETER`.
    See Also:
      - Constant Field Values

  - ### TARGET_INSTANCEOF

    static final int TARGET_INSTANCEOF
    The value of type annotation target type `INSTANCEOF`.
    See Also:
      - Constant Field Values

  - ### TARGET_NEW

    static final int TARGET_NEW
    The value of type annotation target type `NEW`.
    See Also:
      - Constant Field Values

  - ### TARGET_CONSTRUCTOR_REFERENCE

    static final int TARGET_CONSTRUCTOR_REFERENCE
    The value of type annotation target type `CONSTRUCTOR_REFERENCE`.
    See Also:
      - Constant Field Values

  - ### TARGET_METHOD_REFERENCE

    static final int TARGET_METHOD_REFERENCE
    The value of type annotation target type `METHOD_REFERENCE`.
    See Also:
      - Constant Field Values

  - ### TARGET_CAST

    static final int TARGET_CAST
    The value of type annotation target type `CAST`.
    See Also:
      - Constant Field Values

  - ### TARGET_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT

    static final int TARGET_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
    The value of type annotation target type `CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT`.
    See Also:
      - Constant Field Values

  - ### TARGET_METHOD_INVOCATION_TYPE_ARGUMENT

    static final int TARGET_METHOD_INVOCATION_TYPE_ARGUMENT
    The value of type annotation target type `METHOD_INVOCATION_TYPE_ARGUMENT`.
    See Also:
      - Constant Field Values

  - ### TARGET_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT

    static final int TARGET_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
    The value of type annotation target type `CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT`.
    See Also:
      - Constant Field Values

  - ### TARGET_METHOD_REFERENCE_TYPE_ARGUMENT

    static final int TARGET_METHOD_REFERENCE_TYPE_ARGUMENT
    The value of type annotation target type `METHOD_REFERENCE_TYPE_ARGUMENT`.
    See Also:
      - Constant Field Values

- ## Method Details

  - ### targetType

    TypeAnnotation.TargetType targetType()
    Returns the type of the target.
    Returns:
      the type of the target

  - ### size

    default int size()
    Returns the size of the target info.
    Returns:
      the size of the target info

  - ### ofTypeParameter

    static TypeAnnotation.TypeParameterTarget ofTypeParameter(TypeAnnotation.TargetType targetType, int typeParameterIndex)
    Returns a target for annotations on a class or method type parameter declaration.
    Parameters:
      `targetType` - `TypeAnnotation.TargetType.CLASS_TYPE_PARAMETER` or `TypeAnnotation.TargetType.METHOD_TYPE_PARAMETER`
      `typeParameterIndex` - specifies which type parameter declaration is annotated
    Returns:
      a target for annotations on a class or method type parameter declaration
    Throws:
      `IllegalArgumentException` - if `typeParameterIndex` is not `u1`

  - ### ofClassTypeParameter

    static TypeAnnotation.TypeParameterTarget ofClassTypeParameter(int typeParameterIndex)
    Returns a target for annotations on a class type parameter declaration.
    Parameters:
      `typeParameterIndex` - specifies which type parameter declaration is annotated
    Returns:
      a target for annotations on a class type parameter declaration
    Throws:
      `IllegalArgumentException` - if `typeParameterIndex` is not `u1`

  - ### ofMethodTypeParameter

    static TypeAnnotation.TypeParameterTarget ofMethodTypeParameter(int typeParameterIndex)
    Returns a target for annotations on a method type parameter declaration.
    Parameters:
      `typeParameterIndex` - specifies which type parameter declaration is annotated
    Returns:
      a target for annotations on a method type parameter declaration
    Throws:
      `IllegalArgumentException` - if `typeParameterIndex` is not `u1`

  - ### ofClassExtends

    static TypeAnnotation.SupertypeTarget ofClassExtends(int supertypeIndex)
    Returns a target for annotations on the type of an "extends" or "implements" clause.
    Parameters:
      `supertypeIndex` - the index into the interfaces array or 65535 to indicate it is the superclass
    Returns:
      a target for annotations on the type of an "extends" or "implements" clause
    Throws:
      `IllegalArgumentException` - if `supertypeIndex` is not `u2`

  - ### ofTypeParameterBound

    static TypeAnnotation.TypeParameterBoundTarget ofTypeParameterBound(TypeAnnotation.TargetType targetType, int typeParameterIndex, int boundIndex)
    Returns a target for annotations on the i'th bound of the j'th type parameter declaration of a generic class, interface, method, or constructor.
    Parameters:
      `targetType` - `TypeAnnotation.TargetType.CLASS_TYPE_PARAMETER_BOUND` or `TypeAnnotation.TargetType.METHOD_TYPE_PARAMETER_BOUND`
      `typeParameterIndex` - specifies which type parameter declaration is annotated
      `boundIndex` - specifies which bound of the type parameter declaration is annotated
    Returns:
      a target for annotations on the i'th bound of the j'th type parameter declaration of a generic class, interface, method, or constructor
    Throws:
      `IllegalArgumentException` - if `typeParameterIndex` or `boundIndex` is not `u1`

  - ### ofClassTypeParameterBound

    static TypeAnnotation.TypeParameterBoundTarget ofClassTypeParameterBound(int typeParameterIndex, int boundIndex)
    Returns a target for annotations on the i'th bound of the j'th type parameter declaration of a generic class, or interface.
    Parameters:
      `typeParameterIndex` - specifies which type parameter declaration is annotated
      `boundIndex` - specifies which bound of the type parameter declaration is annotated
    Returns:
      a target for annotations on the i'th bound of the j'th type parameter declaration of a generic class, or interface
    Throws:
      `IllegalArgumentException` - if `typeParameterIndex` or `boundIndex` is not `u1`

  - ### ofMethodTypeParameterBound

    static TypeAnnotation.TypeParameterBoundTarget ofMethodTypeParameterBound(int typeParameterIndex, int boundIndex)
    Returns a target for annotations on the i'th bound of the j'th type parameter declaration of a generic method, or constructor.
    Parameters:
      `typeParameterIndex` - specifies which type parameter declaration is annotated
      `boundIndex` - specifies which bound of the type parameter declaration is annotated
    Returns:
      a target for annotations on the i'th bound of the j'th type parameter declaration of a generic method, or constructor
    Throws:
      `IllegalArgumentException` - if `typeParameterIndex` or `boundIndex` is not `u1`

  - ### of

    static TypeAnnotation.EmptyTarget of(TypeAnnotation.TargetType targetType)
    Returns a target for annotations.
    Parameters:
      `targetType` - `TypeAnnotation.TargetType.FIELD`, `TypeAnnotation.TargetType.METHOD_RETURN` or `TypeAnnotation.TargetType.METHOD_RECEIVER`
    Returns:
      a target for annotations

  - ### ofField

    static TypeAnnotation.EmptyTarget ofField()
    Returns a target for annotations on the type in a field or record declaration.
    Returns:
      a target for annotations on the type in a field or record declaration

  - ### ofMethodReturn

    static TypeAnnotation.EmptyTarget ofMethodReturn()
    Returns a target for annotations on the return type of a method or a newly constructed object.
    Returns:
      a target for annotations on the return type of a method or a newly constructed object

  - ### ofMethodReceiver

    static TypeAnnotation.EmptyTarget ofMethodReceiver()
    Returns a target for annotations on the receiver type of a method or constructor.
    Returns:
      a target for annotations on the receiver type of a method or constructor

  - ### ofMethodFormalParameter

    static TypeAnnotation.FormalParameterTarget ofMethodFormalParameter(int formalParameterIndex)
    Returns a target for annotations on the type in a formal parameter declaration of a method, constructor, or lambda expression. The index may differ from the index in the method descriptor because some synthetic or implicit parameters are omitted.
    Parameters:
      `formalParameterIndex` - specifies which formal parameter declaration has an annotated type
    Returns:
      a target for annotations on the type in a formal parameter declaration of a method, constructor, or lambda expression
    Throws:
      `IllegalArgumentException` - if `formalParameterIndex` is not `u1`

  - ### ofThrows

    static TypeAnnotation.ThrowsTarget ofThrows(int throwsTargetIndex)
    Returns a target for annotations on the i'th type in the throws clause of a method or constructor declaration.
    Parameters:
      `throwsTargetIndex` - the index into the exception table of the Exceptions attribute of the method
    Returns:
      a target for annotations on the i'th type in the throws clause of a method or constructor declaration
    Throws:
      `IllegalArgumentException` - if `throwsTargetIndex` is not `u2`

  - ### ofVariable

    static TypeAnnotation.LocalVarTarget ofVariable(TypeAnnotation.TargetType targetType, List<TypeAnnotation.LocalVarTargetInfo> table)
    Returns a target for annotations on the type in a local variable declaration, including a variable declared as a resource in a try-with-resources statement.
    Parameters:
      `targetType` - `TypeAnnotation.TargetType.LOCAL_VARIABLE` or `TypeAnnotation.TargetType.RESOURCE_VARIABLE`
      `table` - the list of local variable targets
    Returns:
      a target for annotations on the type in a local variable declaration, including a variable declared as a resource in a try-with-resources statement
    Throws:
      `IllegalArgumentException` - if the size of the list of targets exceeds the limit of `u2`

  - ### ofLocalVariable

    static TypeAnnotation.LocalVarTarget ofLocalVariable(List<TypeAnnotation.LocalVarTargetInfo> table)
    Returns a target for annotations on the type in a local variable declaration.
    Parameters:
      `table` - the list of local variable targets
    Returns:
      a target for annotations on the type in a local variable declaration
    Throws:
      `IllegalArgumentException` - if the size of the list of targets exceeds the limit of `u2`

  - ### ofResourceVariable

    static TypeAnnotation.LocalVarTarget ofResourceVariable(List<TypeAnnotation.LocalVarTargetInfo> table)
    Returns a target for annotations on the type in a local variable declared as a resource in a try-with-resources statement.
    Parameters:
      `table` - the list of local variable targets
    Returns:
      a target for annotations on the type in a local variable declared as a resource in a try-with-resources statement
    Throws:
      `IllegalArgumentException` - if the size of the list of targets exceeds the limit of `u2`

  - ### ofExceptionParameter

    static TypeAnnotation.CatchTarget ofExceptionParameter(int exceptionTableIndex)
    Returns a target for annotations on the i'th type in an exception parameter declaration.
    Parameters:
      `exceptionTableIndex` - the index into the exception table of the Code attribute
    Returns:
      a target for annotations on the i'th type in an exception parameter declaration
    Throws:
      `IllegalArgumentException` - if `exceptionTableIndex` is not `u2`

  - ### ofOffset

    static TypeAnnotation.OffsetTarget ofOffset(TypeAnnotation.TargetType targetType, Label target)
    Returns a target for annotations on the type in an instanceof expression or a new expression, or the type before the :: in a method reference expression.
    Parameters:
      `targetType` - `TypeAnnotation.TargetType.INSTANCEOF`, `TypeAnnotation.TargetType.NEW`, `TypeAnnotation.TargetType.CONSTRUCTOR_REFERENCE`, or `TypeAnnotation.TargetType.METHOD_REFERENCE`
      `target` - the label right before the instruction
    Returns:
      a target for annotations on the type in an instanceof expression or a new expression, or the type before the :: in a method reference expression

  - ### ofInstanceofExpr

    static TypeAnnotation.OffsetTarget ofInstanceofExpr(Label target)
    Returns a target for annotations on the type in an instanceof expression.
    Parameters:
      `target` - the label right before the instruction
    Returns:
      a target for annotations on the type in an instanceof expression

  - ### ofNewExpr

    static TypeAnnotation.OffsetTarget ofNewExpr(Label target)
    Returns a target for annotations on the type in a new expression.
    Parameters:
      `target` - the label right before the instruction
    Returns:
      a target for annotations on the type in a new expression

  - ### ofConstructorReference

    static TypeAnnotation.OffsetTarget ofConstructorReference(Label target)
    Returns a target for annotations on the type before the :: in a constructor reference expression.
    Parameters:
      `target` - the label right before the instruction
    Returns:
      a target for annotations on the type before the :: in a constructor reference expression

  - ### ofMethodReference

    static TypeAnnotation.OffsetTarget ofMethodReference(Label target)
    Returns a target for annotations on the type before the :: in a method reference expression.
    Parameters:
      `target` - the label right before the instruction
    Returns:
      a target for annotations on the type before the :: in a method reference expression

  - ### ofTypeArgument

    static TypeAnnotation.TypeArgumentTarget ofTypeArgument(TypeAnnotation.TargetType targetType, Label target, int typeArgumentIndex)
    Returns a target for annotations on the i'th type in a cast expression, or on the i'th type argument in the explicit type argument list for any of the following: a new expression, an explicit constructor invocation statement, a method invocation expression, or a method reference expression.
    Parameters:
      `targetType` - `TypeAnnotation.TargetType.CAST`, `TypeAnnotation.TargetType.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT`, `TypeAnnotation.TargetType.METHOD_INVOCATION_TYPE_ARGUMENT`, `TypeAnnotation.TargetType.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT`, or `TypeAnnotation.TargetType.METHOD_REFERENCE_TYPE_ARGUMENT`
      `target` - the label right before the instruction
      `typeArgumentIndex` - specifies which type in the cast operator or argument is annotated
    Returns:
      a target for annotations on the i'th type in a cast expression, or on the i'th type argument in the explicit type argument list for any of the following: a new expression, an explicit constructor invocation statement, a method invocation expression, or a method reference expression
    Throws:
      `IllegalArgumentException` - if `typeArgumentIndex` is not `u1`

  - ### ofCastExpr

    static TypeAnnotation.TypeArgumentTarget ofCastExpr(Label target, int typeArgumentIndex)
    Returns a target for annotations on the i'th type in a cast expression.
    Parameters:
      `target` - the label right before the instruction
      `typeArgumentIndex` - specifies which type in the cast operator is annotated
    Returns:
      a target for annotations on the i'th type in a cast expression
    Throws:
      `IllegalArgumentException` - if `typeArgumentIndex` is not `u1`

  - ### ofConstructorInvocationTypeArgument

    static TypeAnnotation.TypeArgumentTarget ofConstructorInvocationTypeArgument(Label target, int typeArgumentIndex)
    Returns a target for annotations on the i'th type argument in the explicit type argument list for an explicit constructor invocation statement.
    Parameters:
      `target` - the label right before the instruction
      `typeArgumentIndex` - specifies which type in the argument is annotated
    Returns:
      a target for annotations on the i'th type argument in the explicit type argument list for an explicit constructor invocation statement
    Throws:
      `IllegalArgumentException` - if `typeArgumentIndex` is not `u1`

  - ### ofMethodInvocationTypeArgument

    static TypeAnnotation.TypeArgumentTarget ofMethodInvocationTypeArgument(Label target, int typeArgumentIndex)
    Returns a target for annotations on the i'th type argument in the explicit type argument list for a method invocation expression.
    Parameters:
      `target` - the label right before the instruction
      `typeArgumentIndex` - specifies which type in the argument is annotated
    Returns:
      a target for annotations on the i'th type argument in the explicit type argument list for a method invocation expression
    Throws:
      `IllegalArgumentException` - if `typeArgumentIndex` is not `u1`

  - ### ofConstructorReferenceTypeArgument

    static TypeAnnotation.TypeArgumentTarget ofConstructorReferenceTypeArgument(Label target, int typeArgumentIndex)
    Returns a target for annotations on the i'th type argument in the explicit type argument list for a new expression.
    Parameters:
      `target` - the label right before the instruction
      `typeArgumentIndex` - specifies which type in the argument is annotated
    Returns:
      a target for annotations on the i'th type argument in the explicit type argument list for a new expression
    Throws:
      `IllegalArgumentException` - if `typeArgumentIndex` is not `u1`

  - ### ofMethodReferenceTypeArgument

    static TypeAnnotation.TypeArgumentTarget ofMethodReferenceTypeArgument(Label target, int typeArgumentIndex)
    Returns a target for annotations on the i'th type argument in the explicit type argument list for a method reference expression.
    Parameters:
      `target` - the label right before the instruction
      `typeArgumentIndex` - specifies which type in the argument is annotated
    Returns:
      a target for annotations on the i'th type argument in the explicit type argument list for a method reference expression
    Throws:
      `IllegalArgumentException` - if `typeArgumentIndex` is not `u1`