Interface AnnotationProvider

All Known Implementing Classes:
BasicAnnotationProvider

public interface AnnotationProvider
An implementation of AnnotationProvider returns annotations on Java AST elements.
  • Method Summary

    Modifier and Type
    Method
    Description
    getAnnotationMirror(Tree tree, Class<? extends Annotation> target)
    Return the annotation on tree that is in the hierarchy that contains the qualifier target.
    getDeclAnnotation(Element elt, Class<? extends Annotation> anno)
    Returns the AnnotationMirror, of the given class or an alias of it, used to annotate the element.
    boolean
    Returns true if the given method is deterministic according to this AnnotationProvider — that is, if multiple calls to the given method (with the same arguments) return the same value.
    boolean
    Returns true if the given method is side-effect-free according to this AnnotationProvider — that is, if a call to the given method does not undo flow-sensitive type refinement.
  • Method Details

    • getDeclAnnotation

      @Nullable AnnotationMirror getDeclAnnotation(Element elt, Class<? extends Annotation> anno)
      Returns the AnnotationMirror, of the given class or an alias of it, used to annotate the element. Returns null if no annotation equivalent to anno exists on elt.
      Parameters:
      elt - the element
      anno - annotation class
      Returns:
      an annotation mirror of class anno on elt, or an equivalent one, or null if none exists on anno
    • getAnnotationMirror

      @Nullable AnnotationMirror getAnnotationMirror(Tree tree, Class<? extends Annotation> target)
      Return the annotation on tree that is in the hierarchy that contains the qualifier target. Returns null if none exists.
      Parameters:
      tree - the tree of which the annotation is returned
      target - the class of the annotation
      Returns:
      the annotation on tree that has the class target, or null
    • isSideEffectFree

      boolean isSideEffectFree(ExecutableElement methodElement)
      Returns true if the given method is side-effect-free according to this AnnotationProvider — that is, if a call to the given method does not undo flow-sensitive type refinement.

      Note that this method takes account of this AnnotationProvider's semantics, whereas org.checkerframework.dataflow.util.PurityUtils#isSideEffectFree does not.

      Parameters:
      methodElement - a method
      Returns:
      true if a call to the method does not undo flow-sensitive type refinement
    • isDeterministic

      boolean isDeterministic(ExecutableElement methodElement)
      Returns true if the given method is deterministic according to this AnnotationProvider — that is, if multiple calls to the given method (with the same arguments) return the same value.

      Note that this method takes account of this AnnotationProvider's semantics, whereas org.checkerframework.dataflow.util.PurityUtils#isDeterministic does not.

      Parameters:
      methodElement - a method
      Returns:
      true if multiple calls to the method (with the same arguments) return the same value