Class CompileTimeDeclarationType

java.lang.Object
org.checkerframework.framework.util.typeinference8.types.AbstractExecutableType
org.checkerframework.framework.util.typeinference8.types.CompileTimeDeclarationType

public class CompileTimeDeclarationType extends AbstractExecutableType
Represents the compile-time declaration type of the method reference that is the method to which the method reference refers. See JLS section 15.13.1 for a complete definition.

The type of a member reference is a functional interface. The function type of a member reference is the type of the single abstract method declared by the functional interface. The compile-time declaration type is the type of the actual method referenced by the method reference.

For example,


 class MyClass {
    public int compareByField(MyClass other) { ... }
  }
  Comparator<MyClass> func = MyClass::compareByField;
 

The function type is int compare(Comparator<MyClass> this, MyClass o1, MyClass o2) whereas the compile-time declaration type is int compareByField(MyClass this, MyClass other).

  • Constructor Details

  • Method Details

    • getMethodRef

      public MemberReferenceTree getMethodRef()
      Returns the method reference for which this is a compile-time declaration.
      Returns:
      the method reference for which this is a compile-time declaration
    • getReturnType

      public AbstractType getReturnType(Theta map)
      Description copied from class: AbstractExecutableType
      Returns the return type of this.
      Specified by:
      getReturnType in class AbstractExecutableType
      Parameters:
      map - a mapping from type variable to inference variable
      Returns:
      the return type
    • getParameterTypes

      public List<AbstractType> getParameterTypes(Theta map, int size)
      Description copied from class: AbstractExecutableType
      Returns a list of the parameter types of AbstractExecutableType where the vararg parameter has been replaced by individual parameters so the result has length size.
      Specified by:
      getParameterTypes in class AbstractExecutableType
      Parameters:
      map - a mapping from type variable to inference variable
      size - the number of parameters to return; used to expand the vararg
      Returns:
      a list of the parameter types of AbstractExecutableType, of length size