Class CreatesMustCallForToJavaExpression

java.lang.Object
org.checkerframework.checker.mustcall.CreatesMustCallForToJavaExpression

public class CreatesMustCallForToJavaExpression extends Object
Utility methods to convert targets of @CreatesMustCallFor annotations to JavaExpressions.
  • Method Details

    • getCreatesMustCallForExpressionsAtInvocation

      public static List<JavaExpression> getCreatesMustCallForExpressionsAtInvocation(MethodInvocationNode n, GenericAnnotatedTypeFactory<?,?,?,?> atypeFactory, CreatesMustCallForElementSupplier supplier)
      Returns the elements of the @CreatesMustCallFor annotations on the invoked method, as JavaExpressions. Returns the empty set if the given method has no @CreatesMustCallFor annotation.

      If any expression is unparseable, this method reports an error and returns the empty set.

      Parameters:
      n - a method invocation
      atypeFactory - the type factory to report errors and parse the expression string
      supplier - a type factory that can supply the executable elements for CreatesMustCallFor and CreatesMustCallFor.List's value elements. Usually, you should just pass atypeFactory again. The arguments are different so that the given type factory's adherence to both protocols are checked by the type system.
      Returns:
      the arguments of the method's @CreatesMustCallFor annotation, or an empty list
    • getCreatesMustCallForExpressionsAtMethodDeclaration

      public static List<JavaExpression> getCreatesMustCallForExpressionsAtMethodDeclaration(MethodTree tree, GenericAnnotatedTypeFactory<?,?,?,?> atypeFactory, CreatesMustCallForElementSupplier supplier)
      Returns the elements of the @CreatesMustCallFor annotations on the method declaration, as JavaExpressions. Returns the empty set if the given method has no @CreatesMustCallFor annotation.

      If any expression is unparseable, this method reports an error and returns the empty set.

      Parameters:
      tree - a method declaration
      atypeFactory - the type factory to report errors and parse the expression string
      supplier - a type factory that can supply the executable elements for CreatesMustCallFor and CreatesMustCallFor.List's value elements. Usually, you should just pass atypeFactory again. The arguments are different so that the given type factory's adherence to both protocols are checked by the type system.
      Returns:
      the arguments of the method's @CreatesMustCallFor annotation, or an empty list