Class TypeVariableSubstitutor
- java.lang.Object
-
- org.checkerframework.framework.type.TypeVariableSubstitutor
-
public class TypeVariableSubstitutor extends java.lang.Object
TypeVariableSubstitutor replaces type variables from a declaration with arguments to its use.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
TypeVariableSubstitutor.Visitor
Visitor that makes the substitution.
-
Constructor Summary
Constructors Constructor Description TypeVariableSubstitutor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnnotatedTypeMirror
substitute(java.util.Map<javax.lang.model.type.TypeVariable,AnnotatedTypeMirror> typeVarToTypeArgument, AnnotatedTypeMirror type)
Given a mapping from type variable to its type argument, replace each instance of a type variable with a copy of type argument.protected AnnotatedTypeMirror
substituteTypeVariable(AnnotatedTypeMirror argument, AnnotatedTypeMirror.AnnotatedTypeVariable use)
Given the types of a type parameter declaration, the argument to that type parameter declaration, and a given use of that declaration, return a substitute for the use with the correct annotations.AnnotatedTypeMirror
substituteWithoutCopyingTypeArguments(java.util.Map<javax.lang.model.type.TypeVariable,AnnotatedTypeMirror> typeVarToTypeArgument, AnnotatedTypeMirror type)
Given a mapping from type variable to its type argument, replace each instance of a type variable with the given type argument.
-
-
-
Method Detail
-
substitute
public AnnotatedTypeMirror substitute(java.util.Map<javax.lang.model.type.TypeVariable,AnnotatedTypeMirror> typeVarToTypeArgument, AnnotatedTypeMirror type)
Given a mapping from type variable to its type argument, replace each instance of a type variable with a copy of type argument.- Parameters:
typeVarToTypeArgument
- a mapping from type variable to its type argumenttype
- the type to substitute- Returns:
- a copy of type with its type variables substituted
- See Also:
substituteTypeVariable(AnnotatedTypeMirror, org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedTypeVariable)
-
substituteWithoutCopyingTypeArguments
public AnnotatedTypeMirror substituteWithoutCopyingTypeArguments(java.util.Map<javax.lang.model.type.TypeVariable,AnnotatedTypeMirror> typeVarToTypeArgument, AnnotatedTypeMirror type)
Given a mapping from type variable to its type argument, replace each instance of a type variable with the given type argument.- Parameters:
typeVarToTypeArgument
- a mapping from type variable to its type argumenttype
- the type to substitute- Returns:
- a copy of type with its type variables substituted
- See Also:
substituteTypeVariable(AnnotatedTypeMirror, org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedTypeVariable)
-
substituteTypeVariable
protected AnnotatedTypeMirror substituteTypeVariable(AnnotatedTypeMirror argument, AnnotatedTypeMirror.AnnotatedTypeVariable use)
Given the types of a type parameter declaration, the argument to that type parameter declaration, and a given use of that declaration, return a substitute for the use with the correct annotations.To determine what primary annotations are correct for the substitute the following rules are used: If the type variable use has a primary annotation then apply that primary annotation to the substitute. Otherwise, use the annotations of the argument.
- Parameters:
argument
- the argument to declaration (this will be a value in typeParamToArg)use
- the use that is being replaced- Returns:
- a deep copy of argument with the appropriate annotations applied
-
-