Interface ITypeAnnotationWalker

All Known Subinterfaces:
ExternalAnnotationProvider.IMethodAnnotationWalker
All Known Implementing Classes:
ExternalAnnotationProvider.TypeParametersAnnotationWalker, NonNullDefaultAwareTypeAnnotationWalker, TypeAnnotationWalker

public interface ITypeAnnotationWalker
A TypeAnnotationWalker is initialized with all type annotations found at a given element. It can be used to walk into the types at the given element and finally answer the actual annotations at any node of the walk. The walker is implemented as immutable objects. During the walk either new instances are created, or the current instance is shared if no difference is encountered.
  • Field Details

    • NO_ANNOTATIONS

      static final IBinaryAnnotation[] NO_ANNOTATIONS
    • EMPTY_ANNOTATION_WALKER

      static final ITypeAnnotationWalker EMPTY_ANNOTATION_WALKER
      A no-effect annotation walker, all walking methods are implemented as identity-functions. At the end of any walk an empty array of annotations is returned.
  • Method Details

    • toField

      Walk to a field.
    • toMethodReturn

      ITypeAnnotationWalker toMethodReturn()
      Walk to the return type of a method.
    • toReceiver

      ITypeAnnotationWalker toReceiver()
      Walk to the receiver type of a method. Note: Type annotations on receiver are not currently used by the compiler.
    • toTypeParameter

      ITypeAnnotationWalker toTypeParameter(boolean isClassTypeParameter, int rank)
      Walk to the type parameter of the given rank.
      Parameters:
      isClassTypeParameter - whether we are looking for a class type parameter (else: method type parameter)
      rank - rank of the type parameter
    • toTypeParameterBounds

      ITypeAnnotationWalker toTypeParameterBounds(boolean isClassTypeParameter, int parameterRank)
      Walk to the bounds of a type parameter of either a class or a method (signaled by isClassTypeParameter). Clients must then call toTypeBound(short) on the resulting walker.
      Parameters:
      isClassTypeParameter - whether we are looking at a class type parameter (else: method type parameter)
      parameterRank - rank of the type parameter.
    • toTypeBound

      ITypeAnnotationWalker toTypeBound(short boundIndex)
      Detail of toTypeParameterBounds(boolean, int): walk to the bounds of the previously selected type parameter.
      Parameters:
      boundIndex -
    • toSupertype

      ITypeAnnotationWalker toSupertype(short index, char[] superTypeSignature)
      Walk to the specified supertype either index based or name based:
      Parameters:
      index - -1 is superclass, else index into the list of superinterfaces
      superTypeSignature - name and type arguments of the super type to visit
    • toMethodParameter

      ITypeAnnotationWalker toMethodParameter(short index)
      Walk to the index'th visible formal method parameter (i.e., not counting synthetic args).
    • toThrows

      ITypeAnnotationWalker toThrows(int index)
      Walk to the throws type at the given index.
    • toTypeArgument

      ITypeAnnotationWalker toTypeArgument(int rank)
      Walk to the type argument of the given rank.
    • toWildcardBound

      ITypeAnnotationWalker toWildcardBound()
      Walk to the bound of a wildcard.
    • toNextArrayDimension

      ITypeAnnotationWalker toNextArrayDimension()
      Descend down one level of array dimensions.
    • toNextNestedType

      ITypeAnnotationWalker toNextNestedType()
      Descend down one level of type nesting.
    • getAnnotationsAtCursor

      IBinaryAnnotation[] getAnnotationsAtCursor(int currentTypeId, boolean mayApplyArrayContentsDefaultNullness)
      Retrieve the type annotations at the current position reached by invocations of toXYZ() methods.
      Parameters:
      currentTypeId - the id of the type being annotated; 0 signals don't care / unknown; -1 signals if annotating a wildcard or a use of a type variable.