- All Known Implementing Classes:
UnboundAttribute.TypePathComponentImpl
- Enclosing interface:
TypeAnnotation
public static sealed interface TypeAnnotation.TypePathComponent
permits UnboundAttribute.TypePathComponentImpl
JVMS: Wherever a type is used in a declaration or expression, the type_path structure identifies which part of
the type is annotated. An annotation may appear on the type itself, but if the type is a reference type, then
there are additional locations where an annotation may appear:
If an array type T[] is used in a declaration or expression, then an annotation may appear on any component type
of the array type, including the element type.
If a nested type T1.T2 is used in a declaration or expression, then an annotation may appear on the name of the
innermost member type and any enclosing type for which a type annotation is admissible .
If a parameterized type T<A> or T<? extends A> or T<? super A> is used in a declaration or expression, then an
annotation may appear on any type argument or on the bound of any wildcard type argument.
JVMS: ... each entry in the path array represents an iterative, left-to-right step towards the precise location
of the annotation in an array type, nested type, or parameterized type. (In an array type, the iteration visits
the array type itself, then its component type, then the component type of that component type, and so on,
until the element type is reached.)
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TypeAnnotation.TypePathComponentstatic final TypeAnnotation.TypePathComponentstatic final TypeAnnotation.TypePathComponent -
Method Summary
Modifier and TypeMethodDescriptionof(TypeAnnotation.TypePathComponent.Kind typePathKind, int typeArgumentIndex) intJVMS: type_argument_index If the value of the type_path_kind item is 0, 1, or 2, then the value of the type_argument_index item is 0.The type path kind items from JVMS Table 4.7.20.2-A.
-
Field Details
-
ARRAY
-
INNER_TYPE
-
WILDCARD
-
-
Method Details
-
typePathKind
TypeAnnotation.TypePathComponent.Kind typePathKind()The type path kind items from JVMS Table 4.7.20.2-A.- Returns:
- the kind of path element
-
typeArgumentIndex
int typeArgumentIndex()JVMS: type_argument_index If the value of the type_path_kind item is 0, 1, or 2, then the value of the type_argument_index item is 0. If the value of the type_path_kind item is 3, then the value of the type_argument_index item specifies which type argument of a parameterized type is annotated, where 0 indicates the first type argument of a parameterized type.- Returns:
- the index within the type component
-
of
static TypeAnnotation.TypePathComponent of(TypeAnnotation.TypePathComponent.Kind typePathKind, int typeArgumentIndex)
-