Class AnnotatableType

  • Direct Known Subclasses:
    NameQualifiedType, PrimitiveType, QualifiedType, SimpleType, WildcardType

    public abstract class AnnotatableType
    extends Type
    Abstract base class of AST nodes that represent an annotatable type (added in JLS8 API).

    Introduced in JLS8, type references that can be annotated are represented by AnnotatableType. For the list of types extending AnnotatableType, see Type.

    Note that type annotations (ITypeBinding.getTypeAnnotations()) that semantically belong to a resolved type reference don't always show up in annotations(). Syntactically, type annotations can also be part of an associated declaration node's modifiers() list.

    Since:
    3.10
    • Method Detail

      • getAnnotationsProperty

        public final ChildListPropertyDescriptor getAnnotationsProperty()
        Returns the structural property descriptor for the "annotations" property of this node (element type: Annotation) (added in JLS8 API).
        Returns:
        the property descriptor
      • annotations

        public List annotations()
        Returns the live ordered list of annotations for this Type node (added in JLS8 API).

        Note that type annotations (ITypeBinding.getTypeAnnotations()) that semantically belong to a resolved type reference don't always show up in this list. Syntactically, type annotations can also be part of an associated declaration node's modifiers() list.

        Returns:
        the live list of annotations (element type: Annotation)
        Throws:
        UnsupportedOperationException - if this operation is used below JLS8
        See Also:
        ITypeBinding.getTypeAnnotations()