Class AbstractExecutableType
java.lang.Object
org.checkerframework.framework.util.typeinference8.types.AbstractExecutableType
- Direct Known Subclasses:
AbstractInvocationType,CompileTimeDeclarationType
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final AnnotatedTypeMirror.AnnotatedExecutableTypeThe underlying annotated method or constructor type.protected final Java8InferenceContextThe inference context.protected final ExecutableTypeThe underlying Java method or constructor type.protected final AnnotationMirrorMap<QualifierVar> A mapping from polymorphic annotation toQualifierVar.protected final AnnotatedTypeFactoryThe annotated type factory. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractExecutableType(AnnotatedTypeMirror.AnnotatedExecutableType annotatedExecutableType, ExecutableType executableType, ExpressionTree invocation, Java8InferenceContext context) Fills in fields of abstract class AbstractExecutableType. -
Method Summary
Modifier and TypeMethodDescriptionReturns the underlying annotated method or constructor type.List<? extends AnnotatedTypeMirror.AnnotatedTypeVariable> Returns the annotated type variables.Returns the formal parameter types of this executable, without expanding the vararg parameter.abstract List<AbstractType> getParameterTypes(@Nullable Theta map, int size) Returns the formal parameter types of this executable.protected final List<AbstractType> getParameterTypes(@Nullable Theta map, int size, @Nullable AnnotatedTypeMirror firstParam, boolean isVarargsCall) Returns the formal parameter types of this executable.abstract AbstractTypegetReturnType(@Nullable Theta map) Returns the return type of this.List<? extends AbstractType> getThrownTypes(Theta map) Returns the thrown types of this.List<? extends TypeVariable> Returns the Java type variables.booleanReturns true if this type has type variables.booleanisVoid()Returns true if this method or constructor has void return type.
-
Field Details
-
annotatedExecutableType
The underlying annotated method or constructor type. -
executableType
The underlying Java method or constructor type. -
context
The inference context. -
typeFactory
The annotated type factory. -
qualifierVars
A mapping from polymorphic annotation toQualifierVar. It keeps track of which annotation mirror is represented by whichQualifierVar.
-
-
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 typeexecutableType- the underlying Java method or constructor type. This must be an argument to the constructor, because it is not always equal toannotatedExecutableType.getUnderlyingType().invocation- a method or constructor invocationcontext- the context
-
-
Method Details
-
getThrownTypes
Returns the thrown types of this.- Parameters:
map- a mapping from type variable to inference variable- Returns:
- the thrown types
-
getReturnType
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
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,sizeis 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 variablesize- 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
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. IfisVarargsCallis true, then the vararg parameter is replaced by individual parameters so that the result has lengthsize; otherwise,sizeis 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 variablesize- the number of parameters to return; used to expand the vararg. It is ignored ifisVarargsCallis false.firstParam- an extra first parameter to add at the beginning of the returned list, or nullisVarargsCall- 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
Returns the annotated type variables.- Returns:
- the annotated type variables
-
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
-