TypeAnnotation.CatchTarget, TypeAnnotation.EmptyTarget, TypeAnnotation.FormalParameterTarget, TypeAnnotation.LocalVarTarget, TypeAnnotation.OffsetTarget, TypeAnnotation.SupertypeTarget, TypeAnnotation.ThrowsTarget, TypeAnnotation.TypeArgumentTarget, TypeAnnotation.TypeParameterBoundTarget, TypeAnnotation.TypeParameterTargetTypeAnnotationpublic 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
| Modifier and Type | Field | Description |
|---|---|---|
static final int |
TARGET_CAST |
|
static final int |
TARGET_CLASS_EXTENDS |
|
static final int |
TARGET_CLASS_TYPE_PARAMETER |
|
static final int |
TARGET_CLASS_TYPE_PARAMETER_BOUND |
|
static final int |
TARGET_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT |
|
static final int |
TARGET_CONSTRUCTOR_REFERENCE |
|
static final int |
TARGET_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT |
|
static final int |
TARGET_EXCEPTION_PARAMETER |
|
static final int |
TARGET_FIELD |
|
static final int |
TARGET_INSTANCEOF |
|
static final int |
TARGET_LOCAL_VARIABLE |
|
static final int |
TARGET_METHOD_FORMAL_PARAMETER |
|
static final int |
TARGET_METHOD_INVOCATION_TYPE_ARGUMENT |
|
static final int |
TARGET_METHOD_RECEIVER |
|
static final int |
TARGET_METHOD_REFERENCE |
|
static final int |
TARGET_METHOD_REFERENCE_TYPE_ARGUMENT |
|
static final int |
TARGET_METHOD_RETURN |
|
static final int |
TARGET_METHOD_TYPE_PARAMETER |
|
static final int |
TARGET_METHOD_TYPE_PARAMETER_BOUND |
|
static final int |
TARGET_NEW |
|
static final int |
TARGET_RESOURCE_VARIABLE |
|
static final int |
TARGET_THROWS |
| Modifier and Type | Method | Description |
|---|---|---|
static TypeAnnotation.EmptyTarget |
of |
Returns a target for annotations. |
static TypeAnnotation.TypeArgumentTarget |
ofCastExpr |
Returns a target for annotations on the i'th type in a cast expression. |
static TypeAnnotation.SupertypeTarget |
ofClassExtends |
Returns a target for annotations on the type of an "extends" or "implements" clause. |
static TypeAnnotation.TypeParameterTarget |
ofClassTypeParameter |
Returns a target for annotations on a class type parameter declaration. |
static TypeAnnotation.TypeParameterBoundTarget |
ofClassTypeParameterBound |
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 |
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 |
Returns a target for annotations on the type before the :: in a constructor reference expression. |
static TypeAnnotation.TypeArgumentTarget |
ofConstructorReferenceTypeArgument |
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 |
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 |
Returns a target for annotations on the type in an instanceof expression. |
static TypeAnnotation.LocalVarTarget |
ofLocalVariable |
Returns a target for annotations on the type in a local variable declaration. |
static TypeAnnotation.FormalParameterTarget |
ofMethodFormalParameter |
Returns a target for annotations on the type in a formal parameter declaration of a method, constructor, or lambda expression. |
static TypeAnnotation.TypeArgumentTarget |
ofMethodInvocationTypeArgument |
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 |
Returns a target for annotations on the type before the :: in a method reference expression. |
static TypeAnnotation.TypeArgumentTarget |
ofMethodReferenceTypeArgument |
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 |
Returns a target for annotations on a method type parameter declaration. |
static TypeAnnotation.TypeParameterBoundTarget |
ofMethodTypeParameterBound |
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 |
Returns a target for annotations on the type in a new expression. |
static TypeAnnotation.OffsetTarget |
ofOffset |
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 |
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 |
Returns a target for annotations on the i'th type in the throws clause of a method or constructor declaration. |
static TypeAnnotation.TypeArgumentTarget |
ofTypeArgument |
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 |
Returns a target for annotations on a class or method type parameter declaration. |
static TypeAnnotation.TypeParameterBoundTarget |
ofTypeParameterBound |
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 |
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. |
static final int TARGET_CLASS_TYPE_PARAMETER
static final int TARGET_METHOD_TYPE_PARAMETER
static final int TARGET_CLASS_EXTENDS
static final int TARGET_CLASS_TYPE_PARAMETER_BOUND
static final int TARGET_METHOD_TYPE_PARAMETER_BOUND
static final int TARGET_METHOD_RETURN
static final int TARGET_METHOD_RECEIVER
static final int TARGET_METHOD_FORMAL_PARAMETER
static final int TARGET_LOCAL_VARIABLE
static final int TARGET_RESOURCE_VARIABLE
static final int TARGET_EXCEPTION_PARAMETER
static final int TARGET_CONSTRUCTOR_REFERENCE
static final int TARGET_METHOD_REFERENCE
static final int TARGET_CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
static final int TARGET_METHOD_INVOCATION_TYPE_ARGUMENT
static final int TARGET_CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
static final int TARGET_METHOD_REFERENCE_TYPE_ARGUMENT
TypeAnnotation.TargetType targetType()
default int size()
static TypeAnnotation.TypeParameterTarget ofTypeParameter(TypeAnnotation.TargetType targetType, int typeParameterIndex)
targetType - TypeAnnotation.TargetType.CLASS_TYPE_PARAMETER or TypeAnnotation.TargetType.METHOD_TYPE_PARAMETER
typeParameterIndex - specifies which type parameter declaration is annotatedstatic TypeAnnotation.TypeParameterTarget ofClassTypeParameter(int typeParameterIndex)
typeParameterIndex - specifies which type parameter declaration is annotatedstatic TypeAnnotation.TypeParameterTarget ofMethodTypeParameter(int typeParameterIndex)
typeParameterIndex - specifies which type parameter declaration is annotatedstatic TypeAnnotation.SupertypeTarget ofClassExtends(int supertypeIndex)
supertypeIndex - the index into the interfaces array or 65535 to indicate it is the superclassstatic TypeAnnotation.TypeParameterBoundTarget ofTypeParameterBound(TypeAnnotation.TargetType targetType, int typeParameterIndex, int boundIndex)
targetType - TypeAnnotation.TargetType.CLASS_TYPE_PARAMETER_BOUND or TypeAnnotation.TargetType.METHOD_TYPE_PARAMETER_BOUND
typeParameterIndex - specifies which type parameter declaration is annotatedboundIndex - specifies which bound of the type parameter declaration is annotatedstatic TypeAnnotation.TypeParameterBoundTarget ofClassTypeParameterBound(int typeParameterIndex, int boundIndex)
typeParameterIndex - specifies which type parameter declaration is annotatedboundIndex - specifies which bound of the type parameter declaration is annotatedstatic TypeAnnotation.TypeParameterBoundTarget ofMethodTypeParameterBound(int typeParameterIndex, int boundIndex)
typeParameterIndex - specifies which type parameter declaration is annotatedboundIndex - specifies which bound of the type parameter declaration is annotatedstatic TypeAnnotation.EmptyTarget of(TypeAnnotation.TargetType targetType)
targetType - TypeAnnotation.TargetType.FIELD, TypeAnnotation.TargetType.METHOD_RETURN or TypeAnnotation.TargetType.METHOD_RECEIVER
static TypeAnnotation.EmptyTarget ofField()
static TypeAnnotation.EmptyTarget ofMethodReturn()
static TypeAnnotation.EmptyTarget ofMethodReceiver()
static TypeAnnotation.FormalParameterTarget ofMethodFormalParameter(int formalParameterIndex)
formalParameterIndex - specifies which formal parameter declaration has an annotated typestatic TypeAnnotation.ThrowsTarget ofThrows(int throwsTargetIndex)
throwsTargetIndex - the index into the exception table of the Exceptions attribute of the methodstatic TypeAnnotation.LocalVarTarget ofVariable(TypeAnnotation.TargetType targetType, List<TypeAnnotation.LocalVarTargetInfo> table)
targetType - TypeAnnotation.TargetType.LOCAL_VARIABLE or TypeAnnotation.TargetType.RESOURCE_VARIABLE
table - the list of local variable targetsstatic TypeAnnotation.LocalVarTarget ofLocalVariable(List<TypeAnnotation.LocalVarTargetInfo> table)
table - the list of local variable targetsstatic TypeAnnotation.LocalVarTarget ofResourceVariable(List<TypeAnnotation.LocalVarTargetInfo> table)
table - the list of local variable targetsstatic TypeAnnotation.CatchTarget ofExceptionParameter(int exceptionTableIndex)
exceptionTableIndex - the index into the exception table of the Code attributestatic TypeAnnotation.OffsetTarget ofOffset(TypeAnnotation.TargetType targetType, Label target)
targetType - TypeAnnotation.TargetType.INSTANCEOF, TypeAnnotation.TargetType.NEW, TypeAnnotation.TargetType.CONSTRUCTOR_REFERENCE, or TypeAnnotation.TargetType.METHOD_REFERENCE
target - the label right before the instructionstatic TypeAnnotation.OffsetTarget ofInstanceofExpr(Label target)
target - the label right before the instructionstatic TypeAnnotation.OffsetTarget ofNewExpr(Label target)
target - the label right before the instructionstatic TypeAnnotation.OffsetTarget ofConstructorReference(Label target)
target - the label right before the instructionstatic TypeAnnotation.OffsetTarget ofMethodReference(Label target)
target - the label right before the instructionstatic TypeAnnotation.TypeArgumentTarget ofTypeArgument(TypeAnnotation.TargetType targetType, Label target, int typeArgumentIndex)
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 instructiontypeArgumentIndex - specifies which type in the cast operator or argument is annotatedstatic TypeAnnotation.TypeArgumentTarget ofCastExpr(Label target, int typeArgumentIndex)
target - the label right before the instructiontypeArgumentIndex - specifies which type in the cast operator is annotatedstatic TypeAnnotation.TypeArgumentTarget ofConstructorInvocationTypeArgument(Label target, int typeArgumentIndex)
target - the label right before the instructiontypeArgumentIndex - specifies which type in the argument is annotatedstatic TypeAnnotation.TypeArgumentTarget ofMethodInvocationTypeArgument(Label target, int typeArgumentIndex)
target - the label right before the instructiontypeArgumentIndex - specifies which type in the argument is annotatedstatic TypeAnnotation.TypeArgumentTarget ofConstructorReferenceTypeArgument(Label target, int typeArgumentIndex)
target - the label right before the instructiontypeArgumentIndex - specifies which type in the argument is annotatedstatic TypeAnnotation.TypeArgumentTarget ofMethodReferenceTypeArgument(Label target, int typeArgumentIndex)
target - the label right before the instructiontypeArgumentIndex - specifies which type in the argument is annotated
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/classfile/TypeAnnotation.TargetInfo.html