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:
  • Constructor Details

    • PurityUtils

      public PurityUtils()
  • Method Details

    • hasPurityAnnotation

      public static boolean hasPurityAnnotation(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(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(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(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(AnnotationProvider provider, MethodTree methodTree)
      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(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<Pure.Kind> getPurityKinds(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<Pure.Kind> getPurityKinds(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