Class PurityChecker.PurityResult

java.lang.Object
org.checkerframework.dataflow.util.PurityChecker.PurityResult
Enclosing class:
PurityChecker

public static class PurityChecker.PurityResult extends Object
Result of the PurityChecker. Can be queried regarding whether a given tree was side-effect-free, deterministic, or both; also gives reasons if the answer is "no".
  • Field Details

    • notSEFreeReasons

      protected final List<Pair<Tree,String>> notSEFreeReasons
      Reasons that the referenced method is not side-effect-free.
    • notDetReasons

      protected final List<Pair<Tree,String>> notDetReasons
      Reasons that the referenced method is not deterministic.
    • notBothReasons

      protected final List<Pair<Tree,String>> notBothReasons
      Reasons that the referenced method is not side-effect-free and deterministic.
    • kinds

      protected EnumSet<Pure.Kind> kinds
      Contains all the varieties of purity that the expression has. Starts out with all varieties, and elements are removed from it as violations are found.
  • Constructor Details

    • PurityResult

      public PurityResult()
  • Method Details

    • getKinds

      public EnumSet<Pure.Kind> getKinds()
      Return the kinds of purity that the method has.
      Returns:
      the kinds of purity that the method has
    • isPure

      public boolean isPure(EnumSet<Pure.Kind> otherKinds)
      Is the method pure w.r.t. a given set of kinds?
      Parameters:
      otherKinds - the varieties of purity to check
      Returns:
      true if the method is pure with respect to all the given kinds
    • getNotSEFreeReasons

      public List<Pair<Tree,String>> getNotSEFreeReasons()
      Get the reasons why the method is not side-effect-free.
      Returns:
      the reasons why the method is not side-effect-free
    • addNotSEFreeReason

      public void addNotSEFreeReason(Tree t, String msgId)
      Add a reason why the method is not side-effect-free.
      Parameters:
      t - a tree
      msgId - why the tree is not side-effect-free
    • getNotDetReasons

      public List<Pair<Tree,String>> getNotDetReasons()
      Get the reasons why the method is not deterministic.
      Returns:
      the reasons why the method is not deterministic
    • addNotDetReason

      public void addNotDetReason(Tree t, String msgId)
      Add a reason why the method is not deterministic.
      Parameters:
      t - a tree
      msgId - why the tree is not deterministic
    • getNotBothReasons

      public List<Pair<Tree,String>> getNotBothReasons()
      Get the reasons why the method is not both side-effect-free and deterministic.
      Returns:
      the reasons why the method is not both side-effect-free and deterministic
    • addNotBothReason

      public void addNotBothReason(Tree t, String msgId)
      Add a reason why the method is not both side-effect-free and deterministic.
      Parameters:
      t - tree
      msgId - why the tree is not deterministic and side-effect-free
    • toString

      public String toString()
      Overrides:
      toString in class Object