Class PurityUtils

java.lang.Object
org.checkerframework.dataflow.util.PurityUtils

public class PurityUtils extends Object
A utility class for working with the SideEffectFree, Deterministic, and Pure annotations.
See Also:
  • SideEffectFree
  • Deterministic
  • Pure
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static EnumSet<org.checkerframework.dataflow.qual.Pure.Kind>
    getPurityKinds(org.checkerframework.javacutil.AnnotationProvider provider, MethodTree methodTree)
    Returns the purity annotations on the method methodTree.
    static EnumSet<org.checkerframework.dataflow.qual.Pure.Kind>
    getPurityKinds(org.checkerframework.javacutil.AnnotationProvider provider, ExecutableElement methodElement)
    Returns the purity annotations on the method methodElement.
    static boolean
    hasPurityAnnotation(org.checkerframework.javacutil.AnnotationProvider provider, MethodTree methodTree)
    Does the method methodTree have any purity annotation?
    static boolean
    hasPurityAnnotation(org.checkerframework.javacutil.AnnotationProvider provider, ExecutableElement methodElement)
    Does the method methodElement have any purity annotation?
    static boolean
    isDeterministic(org.checkerframework.javacutil.AnnotationProvider provider, MethodTree methodTree)
    Is the method methodTree deterministic?
    static boolean
    isDeterministic(org.checkerframework.javacutil.AnnotationProvider provider, ExecutableElement methodElement)
    Is the method methodElement deterministic?
    static boolean
    isSideEffectFree(org.checkerframework.javacutil.AnnotationProvider provider, MethodTree methodTree)
    Deprecated.
    use AnnotationProvider.isSideEffectFree(javax.lang.model.element.ExecutableElement)
    static boolean
    isSideEffectFree(org.checkerframework.javacutil.AnnotationProvider provider, ExecutableElement methodElement)
    Is the method methodElement side-effect-free?

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PurityUtils

      public PurityUtils()
  • Method Details

    • hasPurityAnnotation

      public static boolean hasPurityAnnotation(org.checkerframework.javacutil.AnnotationProvider provider, MethodTree methodTree)
      Does the method methodTree have any purity annotation?
      Parameters:
      provider - how to get annotations
      methodTree - a method to test
      Returns:
      whether the method has any purity annotations
    • hasPurityAnnotation

      public static boolean hasPurityAnnotation(org.checkerframework.javacutil.AnnotationProvider provider, ExecutableElement methodElement)
      Does the method methodElement have any purity annotation?
      Parameters:
      provider - how to get annotations
      methodElement - a method to test
      Returns:
      whether the method has any purity annotations
    • isDeterministic

      public static boolean isDeterministic(org.checkerframework.javacutil.AnnotationProvider provider, MethodTree methodTree)
      Is the method methodTree deterministic?
      Parameters:
      provider - how to get annotations
      methodTree - a method to test
      Returns:
      whether the method is deterministic
    • isDeterministic

      public static boolean isDeterministic(org.checkerframework.javacutil.AnnotationProvider provider, ExecutableElement methodElement)
      Is the method methodElement deterministic?
      Parameters:
      provider - how to get annotations
      methodElement - a method to test
      Returns:
      whether the method is deterministic
    • isSideEffectFree

      @Deprecated public static boolean isSideEffectFree(org.checkerframework.javacutil.AnnotationProvider provider, MethodTree methodTree)
      Deprecated.
      use AnnotationProvider.isSideEffectFree(javax.lang.model.element.ExecutableElement)
      Is the method methodTree side-effect-free?

      This method does not use, and has different semantics than, AnnotationProvider.isSideEffectFree(javax.lang.model.element.ExecutableElement). This method is concerned only with standard purity annotations.

      Parameters:
      provider - how to get annotations
      methodTree - a method to test
      Returns:
      whether the method is side-effect-free
    • isSideEffectFree

      public static boolean isSideEffectFree(org.checkerframework.javacutil.AnnotationProvider provider, ExecutableElement methodElement)
      Is the method methodElement side-effect-free?

      This method does not use, and has different semantics than, AnnotationProvider.isSideEffectFree(javax.lang.model.element.ExecutableElement). This method is concerned only with standard purity annotations.

      Parameters:
      provider - how to get annotations
      methodElement - a method to test
      Returns:
      whether the method is side-effect-free
    • getPurityKinds

      public static EnumSet<org.checkerframework.dataflow.qual.Pure.Kind> getPurityKinds(org.checkerframework.javacutil.AnnotationProvider provider, MethodTree methodTree)
      Returns the purity annotations on the method methodTree.
      Parameters:
      provider - how to get annotations
      methodTree - a method to test
      Returns:
      the types of purity of the method methodTree
    • getPurityKinds

      public static EnumSet<org.checkerframework.dataflow.qual.Pure.Kind> getPurityKinds(org.checkerframework.javacutil.AnnotationProvider provider, ExecutableElement methodElement)
      Returns the purity annotations on the method methodElement.
      Parameters:
      provider - how to get annotations
      methodElement - a method to test
      Returns:
      the types of purity of the method methodElement