Class AbstractExecutableType

java.lang.Object
org.checkerframework.framework.util.typeinference8.types.AbstractExecutableType
Direct Known Subclasses:
AbstractInvocationType, CompileTimeDeclarationType

public abstract class AbstractExecutableType extends Object
An inference type for a method call, a constructor invocation, or a compile-time declaration of a method reference. This is a wrapper around AnnotatedTypeMirror.AnnotatedExecutableType whose methods return AbstractType.
  • Field Details

  • Constructor Details

    • AbstractExecutableType

      protected AbstractExecutableType(AnnotatedTypeMirror.AnnotatedExecutableType annotatedExecutableType, ExecutableType executableType, ExpressionTree invocation, Java8InferenceContext context)
      Fills in fields of abstract class AbstractExecutableType.
      Parameters:
      annotatedExecutableType - the underlying annotated method or constructor type
      executableType - the underlying Java method or constructor type. This must be an argument to the constructor, because it is not always equal to annotatedExecutableType.getUnderlyingType().
      invocation - a method or constructor invocation
      context - the context
  • Method Details

    • getThrownTypes

      public List<? extends AbstractType> getThrownTypes(Theta map)
      Returns the thrown types of this.
      Parameters:
      map - a mapping from type variable to inference variable
      Returns:
      the thrown types
    • getReturnType

      public abstract AbstractType getReturnType(@Nullable Theta map)
      Returns the return type of this.
      Parameters:
      map - a mapping from type variable to inference variable, or null to treat no type variable as an inference variable
      Returns:
      the return type
    • getParameterTypes

      public abstract List<AbstractType> getParameterTypes(@Nullable Theta map, int size)
      Returns the formal parameter types of this executable.

      If this invocation uses varargs, then the vararg parameter is replaced by individual parameters and the result has length size. Otherwise, size is ignored and the result contains one element per declared formal parameter, plus one for the receiver if this is an unbound method reference.

      Parameters:
      map - a mapping from type variable to inference variable, or null to treat no type variable as an inference variable
      size - the number of parameters to return; used to expand the vararg. It is ignored if this invocation does not use varargs.
      Returns:
      the formal parameter types of this executable
    • getParameterTypes

      public List<AbstractType> getParameterTypes(@Nullable Theta map)
      Returns the formal parameter types of this executable, without expanding the vararg parameter. Call this method only for an invocation that does not use varargs.
      Parameters:
      map - a mapping from type variable to inference variable, or null to treat no type variable as an inference variable
      Returns:
      the formal parameter types of this executable
    • getParameterTypes

      protected final List<AbstractType> getParameterTypes(@Nullable Theta map, int size, @Nullable AnnotatedTypeMirror firstParam, boolean isVarargsCall)
      Returns the formal parameter types of this executable. If isVarargsCall is true, then the vararg parameter is replaced by individual parameters so that the result has length size; otherwise, size is ignored.

      This is a helper method for getParameterTypes(Theta, int).

      Parameters:
      map - a mapping from type variable to inference variable, or null to treat no type variable as an inference variable
      size - the number of parameters to return; used to expand the vararg. It is ignored if isVarargsCall is false.
      firstParam - an extra first parameter to add at the beginning of the returned list, or null
      isVarargsCall - true if this invocation uses varargs
      Returns:
      the formal parameter types of this executable
    • hasTypeVariables

      public boolean hasTypeVariables()
      Returns true if this type has type variables.
      Returns:
      true if this type has type variables
    • getAnnotatedTypeVariables

      public List<? extends AnnotatedTypeMirror.AnnotatedTypeVariable> getAnnotatedTypeVariables()
      Returns the annotated type variables.
      Returns:
      the annotated type variables
    • getTypeVariables

      public List<? extends TypeVariable> getTypeVariables()
      Returns the Java type variables.
      Returns:
      the Java type variables
    • isVoid

      public boolean isVoid()
      Returns true if this method or constructor has void return type.
      Returns:
      true if this method or constructor has void return type
    • getAnnotatedType

      Returns the underlying annotated method or constructor type.
      Returns:
      the underlying annotated method or constructor type