Class AnnotatedTypes
AnnotatedTypeMirror
. This class mimics the class Types
.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Class representing type arguments for a method, constructor, or method reference expression. -
Method Summary
Modifier and TypeMethodDescriptionstatic List<AnnotatedTypeMirror>
adaptParameters
(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror.AnnotatedExecutableType method, List<? extends ExpressionTree> args, Tree invok) Returns the method parameters for the invoked method (or constructor), with the same number of arguments as passed to the invocation tree.static AnnotatedTypeMirror
annotatedGLB
(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror type1, AnnotatedTypeMirror type2) Returns the "annotated greatest lower bound" oftype1
andtype2
.static void
applyAnnotationsFromDeclaredType
(AnnotatedTypeMirror.AnnotatedDeclaredType annotatedDeclaredType, DeclaredType declaredType) Add all the annotations indeclaredType
toannotatedDeclaredType
.static boolean
areCorrespondingTypeVariables
(Elements elements, AnnotatedTypeMirror.AnnotatedTypeVariable type1, AnnotatedTypeMirror.AnnotatedTypeVariable type2) When overriding a method, you must include the same number of type parameters as the base method.static AnnotatedTypeMirror
asMemberOf
(Types types, AnnotatedTypeFactory atypeFactory, @Nullable AnnotatedTypeMirror t, Element elem, AnnotatedTypeMirror elemType) Returns the type of an element when that element is viewed as a member of, or otherwise directly contained by, a given type.static AnnotatedTypeMirror
asMemberOf
(Types types, AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror t, Element elem) Returns the type of an element when that element is viewed as a member of, or otherwise directly contained by, a given type.asMemberOf
(Types types, AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror t, ExecutableElement elem) Specialization ofasMemberOf(Types, AnnotatedTypeFactory, AnnotatedTypeMirror, Element)
with more precise return type.asMemberOf
(Types types, AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror t, ExecutableElement elem, AnnotatedTypeMirror.AnnotatedExecutableType type) Specialization ofasMemberOf(Types, AnnotatedTypeFactory, AnnotatedTypeMirror, Element, AnnotatedTypeMirror)
with more precise return type.static <T extends AnnotatedTypeMirror>
TasSuper
(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror type, T superType) Copies annotations fromtype
to a copy ofsuperType
where the type variables ofsuperType
have been substituted.static <T extends AnnotatedTypeMirror>
TcastedAsSuper
(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror subtype, T supertype) Calls asSuper and casts the result to the same type as the input supertype.static boolean
containsModifier
(AnnotatedTypeMirror type, AnnotationMirror modifier) Checks whether type contains the given modifier, also recursively in type arguments and arrays.static void
copyOnlyExplicitConstructorAnnotations
(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror.AnnotatedDeclaredType returnType, AnnotatedTypeMirror.AnnotatedExecutableType constructor) Copies explicit annotations and annotations resulting from resolution of polymorphic qualifiers fromconstructor
toreturnType
.static List<AnnotatedTypeMirror>
expandVarArgsParameters
(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror.AnnotatedExecutableType method, List<? extends ExpressionTree> args) Deprecated.static List<AnnotatedTypeMirror>
expandVarargsParametersFromTypes
(AnnotatedTypeMirror.AnnotatedExecutableType method, List<AnnotatedTypeMirror> args) Returns the method parameters for the invoked method, with the same number of formal parameters as the arguments in the given list.static AnnotationMirror
findEffectiveAnnotationInHierarchy
(QualifierHierarchy qualHierarchy, AnnotatedTypeMirror toSearch, AnnotationMirror top) When comparing types against the bounds of a type variable, we may encounter other type variables, wildcards, and intersections in those bounds.static @Nullable AnnotationMirror
findEffectiveAnnotationInHierarchy
(QualifierHierarchy qualHierarchy, AnnotatedTypeMirror toSearch, AnnotationMirror top, boolean canBeEmpty) When comparing types against the bounds of a type variable, we may encounter other type variables, wildcards, and intersections in those bounds.static AnnotationMirrorSet
findEffectiveAnnotations
(QualifierHierarchy qualHierarchy, AnnotatedTypeMirror toSearch) When comparing types against the bounds of a type variable, we may encounter other type variables, wildcards, and intersections in those bounds.static AnnotationMirrorSet
findEffectiveLowerBoundAnnotations
(QualifierHierarchy qualHierarchy, AnnotatedTypeMirror toSearch) This method returns the effective annotation on the lower bound of a type, or on the type itself if the type has no lower bound (it is not a type variable, wildcard, or intersection).static AnnotatedTypes.TypeArguments
findTypeArguments
(AnnotatedTypeFactory atypeFactory, ExpressionTree expr, ExecutableElement elt, AnnotatedTypeMirror.AnnotatedExecutableType preType, boolean inferTypeArgs) Given a method or constructor invocation, return a mapping of the type variables to their type arguments, if any exist.static AnnotatedTypeMirror
getAnnotatedTypeMirrorOfParameter
(AnnotatedTypeMirror.AnnotatedExecutableType methodType, int index) Given an AnnotatedExecutableType of a method or constructor declaration, get the parameter type expected at the indexth position (unwrapping varargs if necessary).static int
Returns the depth of the array type of the provided array.Returns all the supertypes (direct or indirect) of the given declared type.static AnnotationMirrorSet
glbOfBounds
(AnnotatedTypeMirror.AnnotatedIntersectionType isect, QualifierHierarchy qualHierarchy) Gets the lowest primary annotation of all bounds in the intersection.static boolean
hasExplicitExtendsBound
(AnnotatedTypeMirror wildcard) Returns true if wildcard type has an explicit extends bound.static boolean
hasExplicitSuperBound
(AnnotatedTypeMirror wildcard) Returns true if wildcard type has an explicit super bound.static boolean
hasNoExplicitBound
(AnnotatedTypeMirror wildcard) This method identifies wildcard types that are unbound.static boolean
haveSameDeclaration
(Types types, AnnotatedTypeMirror.AnnotatedTypeVariable typeVar1, AnnotatedTypeMirror.AnnotatedTypeVariable typeVar2) Returns true if the typeVar1 and typeVar2 are two uses of the same type variable.static boolean
Returns true if atm is an Annotation interface, i.e., an implementation of java.lang.annotation.Annotation.static AnnotatedTypeMirror
static boolean
isDeclarationOfJavaLangEnum
(Types types, Elements elements, AnnotatedTypeMirror typeMirror) static boolean
isEnum
(AnnotatedTypeMirror typeMirror) static boolean
Deprecated.static boolean
Deprecated.static boolean
Returns true if the underlying type of this atm is a java.lang.annotation.Annotation.static boolean
Returns whethertype
is a type argument to a type whose#underlyingType
is raw.static boolean
Returns true if this type is extends bounded or unbounded.static boolean
Returns true if this type is super bounded or unbounded.static AnnotatedTypeMirror
leastUpperBound
(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror type1, AnnotatedTypeMirror type2) Returns the lub of two annotated types.static AnnotatedTypeMirror
leastUpperBound
(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, TypeMirror lubTypeMirror) Returns the lub, whose underlying type islubTypeMirror
of two annotated types.overriddenMethods
(Elements elements, ExecutableElement method, Collection<AnnotatedTypeMirror.AnnotatedDeclaredType> supertypes) Given a method and all supertypes (recursively) of the method's enclosing class, returns the methods that the method overrides.overriddenMethods
(Elements elements, AnnotatedTypeFactory atypeFactory, ExecutableElement method) Given a method, return the methods that it overrides.
-
Method Details
-
asSuper
public static <T extends AnnotatedTypeMirror> T asSuper(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror type, T superType) Copies annotations fromtype
to a copy ofsuperType
where the type variables ofsuperType
have been substituted. How the annotations are copied depends on the kinds of AnnotatedTypeMirrors given. Generally, iftype
andsuperType
are both declared types, asSuper is called recursively on the direct super types, seeAnnotatedTypeMirror.directSupertypes()
, oftype
untiltype
's erased Java type is the same assuperType
's erased super type. Thentype is returned
. For compound types, asSuper is called recursively on components.Preconditions:
superType
may have annotations, but they are ignored.
type
may not be an instanceof AnnotatedNullType, because ifsuperType
is a compound type, the annotations on the component types are undefined.
The underlyingtype
(ie the Java type) oftype
should be a subtype (or the same type) of the underlying type ofsuperType
. Except for these cases:- If
type
is a primitive, then the boxed type oftype
must be subtype ofsuperType
. - If
superType
is a primitive, thentype
must be convertible tosuperType
. - If
superType
is a type variable or wildcard without a lower bound, thentype
must be a subtype of the upper bound ofsuperType
. (This relaxed rule is used during type argument inference where the type variable or wildcard is the type argument that was inferred.) - If
superType
is a wildcard with a lower bound, thentype
must be a subtype of the lower bound ofsuperType
.
Postconditions:
type
andsuperType
are not modified.- Parameters:
atypeFactory
-AnnotatedTypeFactory
type
- type from which to copy annotationssuperType
- a type whose erased Java type is a supertype oftype
's erased Java type.- Returns:
superType
with annotations copied fromtype
and type variables substituted fromtype
.
- If
-
castedAsSuper
public static <T extends AnnotatedTypeMirror> T castedAsSuper(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror subtype, T supertype) Calls asSuper and casts the result to the same type as the input supertype.- Type Parameters:
T
- the type of supertype and return type- Parameters:
atypeFactory
- the type factorysubtype
- subtype to be transformed to supertypesupertype
- supertype that subtype is transformed to- Returns:
- subtype as an instance of supertype
-
asMemberOf
public static AnnotatedTypeMirror.AnnotatedExecutableType asMemberOf(Types types, AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror t, ExecutableElement elem) Specialization ofasMemberOf(Types, AnnotatedTypeFactory, AnnotatedTypeMirror, Element)
with more precise return type.- Parameters:
types
- the Types instance to useatypeFactory
- the type factory to uset
- the receiver typeelem
- the element that should be viewed as member of t- Returns:
- the type of elem as member of t
- See Also:
-
asMemberOf
public static AnnotatedTypeMirror.AnnotatedExecutableType asMemberOf(Types types, AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror t, ExecutableElement elem, AnnotatedTypeMirror.AnnotatedExecutableType type) Specialization ofasMemberOf(Types, AnnotatedTypeFactory, AnnotatedTypeMirror, Element, AnnotatedTypeMirror)
with more precise return type.- Parameters:
types
- the Types instance to useatypeFactory
- the type factory to uset
- the receiver typeelem
- the element that should be viewed as member of ttype
- unsubstituted type of member- Returns:
- the type of member as member of
t
, with initial type memberType; can be an alias to memberType - See Also:
-
asMemberOf
public static AnnotatedTypeMirror asMemberOf(Types types, AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror t, Element elem) Returns the type of an element when that element is viewed as a member of, or otherwise directly contained by, a given type.For example, when viewed as a member of the parameterized type
Set<@NonNull String>
, theSet.add
method is anExecutableType
whose parameter is of type@NonNull String
.Before returning the result, this method adjusts it by calling
AnnotatedTypeFactory.postAsMemberOf(AnnotatedTypeMirror, AnnotatedTypeMirror, Element)
.- Parameters:
types
- the Types instance to useatypeFactory
- the type factory to uset
- the receiver typeelem
- the element that should be viewed as member of t- Returns:
- the type of elem as member of t
-
asMemberOf
public static AnnotatedTypeMirror asMemberOf(Types types, AnnotatedTypeFactory atypeFactory, @Nullable AnnotatedTypeMirror t, Element elem, AnnotatedTypeMirror elemType) Returns the type of an element when that element is viewed as a member of, or otherwise directly contained by, a given type. An initial type for the member is provided, to allow for earlier changes to the declared type of elem. For example, polymorphic qualifiers must be substituted before type variables are substituted.- Parameters:
types
- the Types instance to useatypeFactory
- the type factory to uset
- the receiver typeelem
- the element that should be viewed as member of telemType
- unsubstituted type of elem- Returns:
- the type of elem as member of t
- See Also:
-
getSuperTypes
public static Set<AnnotatedTypeMirror.AnnotatedDeclaredType> getSuperTypes(AnnotatedTypeMirror.AnnotatedDeclaredType type) Returns all the supertypes (direct or indirect) of the given declared type.- Parameters:
type
- a declared type- Returns:
- all the supertypes of the given type
-
overriddenMethods
public static Map<AnnotatedTypeMirror.AnnotatedDeclaredType,ExecutableElement> overriddenMethods(Elements elements, AnnotatedTypeFactory atypeFactory, ExecutableElement method) Given a method, return the methods that it overrides.- Parameters:
method
- the overriding method- Returns:
- a map from types to methods that
method
overrides
-
overriddenMethods
public static Map<AnnotatedTypeMirror.AnnotatedDeclaredType,ExecutableElement> overriddenMethods(Elements elements, ExecutableElement method, Collection<AnnotatedTypeMirror.AnnotatedDeclaredType> supertypes) Given a method and all supertypes (recursively) of the method's enclosing class, returns the methods that the method overrides.- Parameters:
method
- the overriding methodsupertypes
- the set of supertypes to check for methods that are overridden bymethod
- Returns:
- a map from types to methods that
method
overrides
-
findTypeArguments
public static AnnotatedTypes.TypeArguments findTypeArguments(AnnotatedTypeFactory atypeFactory, ExpressionTree expr, ExecutableElement elt, AnnotatedTypeMirror.AnnotatedExecutableType preType, boolean inferTypeArgs) Given a method or constructor invocation, return a mapping of the type variables to their type arguments, if any exist.It uses the method or constructor invocation type arguments if they were specified and otherwise it infers them based on the passed arguments or the return type context, according to JLS 15.12.2.
- Parameters:
atypeFactory
- the annotated type factoryexpr
- the method or constructor invocation tree; the passed argument has to be a subtype of MethodInvocationTree or NewClassTreeelt
- the element corresponding to the treepreType
- the (partially annotated) type corresponding to the tree - the result of AnnotatedTypes.asMemberOf with the receiver and eltinferTypeArgs
- whether the type argument should be inferred- Returns:
- the mapping of type variables to type arguments for this method or constructor invocation, and whether unchecked conversion was required to infer the type arguments, and whether type argument inference crashed
-
leastUpperBound
public static AnnotatedTypeMirror leastUpperBound(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror type1, AnnotatedTypeMirror type2) Returns the lub of two annotated types.- Parameters:
atypeFactory
- the type factorytype1
- a typetype2
- another type- Returns:
- the lub of
type1
andtype2
-
leastUpperBound
public static AnnotatedTypeMirror leastUpperBound(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, TypeMirror lubTypeMirror) Returns the lub, whose underlying type islubTypeMirror
of two annotated types.- Parameters:
atypeFactory
- a type factorytype1
- annotated type whose underlying type must be a subtype or convertible to lubTypeMirrortype2
- annotated type whose underlying type must be a subtype or convertible to lubTypeMirrorlubTypeMirror
- underlying type of the returned lub- Returns:
- the lub of type1 and type2 with underlying type lubTypeMirror
-
annotatedGLB
public static AnnotatedTypeMirror annotatedGLB(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror type1, AnnotatedTypeMirror type2) Returns the "annotated greatest lower bound" oftype1
andtype2
.Suppose that there is an expression e with annotated type T. The underlying type of T must be the same as javac's type for e. (This is a requirement of the Checker Framework.) As a corollary, when computing a glb of atype1 and atype2, it is required that underlyingType(cfGLB(atype1, atype2) == glb(javacGLB(underlyingType(atype1), underlyingType(atype2)). Because of this requirement, the return value of this method (the "annotated GLB") may not be a subtype of one of the types.
The "annotated greatest lower bound" is defined as follows:
- If the underlying type of
type1
andtype2
are the same, then return a copy oftype1
whose primary annotations are the greatest lower bound of the primary annotations ontype1
andtype2
. - If the underlying type of
type1
is a subtype of the underlying type oftype2
, then return a copy oftype1
whose primary annotations are the greatest lower bound of the primary annotations ontype1
andtype2
. - If the underlying type of
type1
is a supertype of the underlying type oftype2
, then return a copy oftype2
whose primary annotations are the greatest lower bound of the primary annotations ontype1
andtype2
. - If the underlying type of
type1
andtype2
are not in a subtyping relationship, then return an annotated intersection type whose bounds aretype1
andtype2
.
- Parameters:
atypeFactory
- the AnnotatedTypeFactorytype1
- annotated typetype2
- annotated type- Returns:
- the annotated glb of type1 and type2
- If the underlying type of
-
expandVarArgsParameters
@Deprecated public static List<AnnotatedTypeMirror> expandVarArgsParameters(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror.AnnotatedExecutableType method, List<? extends ExpressionTree> args) Deprecated.Returns the method parameters for the invoked method, with the same number of arguments passed in the methodInvocation tree.If the invoked method is not a vararg method or it is a vararg method but the invocation passes an array to the vararg parameter, it would simply return the method parameters.
Otherwise, it would return the list of parameters as if the vararg is expanded to match the size of the passed arguments.
- Parameters:
atypeFactory
- the type factory to use for fetching annotated typesmethod
- the method's typeargs
- the arguments to the method invocation- Returns:
- the types that the method invocation arguments need to be subtype of
-
adaptParameters
public static List<AnnotatedTypeMirror> adaptParameters(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror.AnnotatedExecutableType method, List<? extends ExpressionTree> args, Tree invok) Returns the method parameters for the invoked method (or constructor), with the same number of arguments as passed to the invocation tree.This expands the parameters if the call uses varargs or contracts the parameters if the call is to an anonymous class that extends a class with an enclosing type. If the call is neither of these, then the parameters are returned unchanged.
- Parameters:
atypeFactory
- the type factory to use for fetching annotated typesmethod
- the method or constructor's typeargs
- the arguments to the method or constructor invocationinvok
- the method or constructor invocation- Returns:
- a list of the types that the invocation arguments need to be subtype of; has the same
length as
args
-
expandVarargsParametersFromTypes
public static List<AnnotatedTypeMirror> expandVarargsParametersFromTypes(AnnotatedTypeMirror.AnnotatedExecutableType method, List<AnnotatedTypeMirror> args) Returns the method parameters for the invoked method, with the same number of formal parameters as the arguments in the given list.- Parameters:
method
- the method's typeargs
- the types of the arguments at the call site- Returns:
- the method parameters, with varargs replaced by instances of its component type
-
getAnnotatedTypeMirrorOfParameter
public static AnnotatedTypeMirror getAnnotatedTypeMirrorOfParameter(AnnotatedTypeMirror.AnnotatedExecutableType methodType, int index) Given an AnnotatedExecutableType of a method or constructor declaration, get the parameter type expected at the indexth position (unwrapping varargs if necessary).- Parameters:
methodType
- the type of a method or constructor containing the parameter to returnindex
- position of the parameter type to return- Returns:
- the type of the parameter in the index position. If that parameter is a varArgs, return the component type of the varargs and NOT the array type.
-
getArrayDepth
Returns the depth of the array type of the provided array.- Parameters:
array
- the type of the array- Returns:
- the depth of the provided array
-
innerMostType
-
containsModifier
Checks whether type contains the given modifier, also recursively in type arguments and arrays. This method might be easier to implement directly as instance method in AnnotatedTypeMirror; it corresponds to a "deep" version ofAnnotatedTypeMirror.hasPrimaryAnnotation(AnnotationMirror)
.- Parameters:
type
- the type to searchmodifier
- the modifier to search for- Returns:
- whether the type contains the modifier
-
isJavaLangAnnotation
Returns true if the underlying type of this atm is a java.lang.annotation.Annotation.- Returns:
- true if the underlying type of this atm is a java.lang.annotation.Annotation
-
implementsAnnotation
Returns true if atm is an Annotation interface, i.e., an implementation of java.lang.annotation.Annotation. Given@interface MyAnno
, a call toimplementsAnnotation
returns true when called on an AnnotatedDeclaredType representing a use of MyAnno.- Returns:
- true if atm is an Annotation interface
-
isEnum
-
isDeclarationOfJavaLangEnum
public static boolean isDeclarationOfJavaLangEnum(Types types, Elements elements, AnnotatedTypeMirror typeMirror) -
haveSameDeclaration
public static boolean haveSameDeclaration(Types types, AnnotatedTypeMirror.AnnotatedTypeVariable typeVar1, AnnotatedTypeMirror.AnnotatedTypeVariable typeVar2) Returns true if the typeVar1 and typeVar2 are two uses of the same type variable.- Parameters:
types
- type utilstypeVar1
- a type variabletypeVar2
- a type variable- Returns:
- true if the typeVar1 and typeVar2 are two uses of the same type variable
-
areCorrespondingTypeVariables
public static boolean areCorrespondingTypeVariables(Elements elements, AnnotatedTypeMirror.AnnotatedTypeVariable type1, AnnotatedTypeMirror.AnnotatedTypeVariable type2) When overriding a method, you must include the same number of type parameters as the base method. By index, these parameters are considered equivalent to the type parameters of the overridden method.Necessary conditions:
- Both type variables are defined in methods.
- One of the two methods overrides the other.
- Within their method declaration, both types have the same type parameter index.
- Returns:
- true if type1 and type2 are corresponding type variables (that is, either one "overrides" the other)
-
findEffectiveAnnotationInHierarchy
public static AnnotationMirror findEffectiveAnnotationInHierarchy(QualifierHierarchy qualHierarchy, AnnotatedTypeMirror toSearch, AnnotationMirror top) When comparing types against the bounds of a type variable, we may encounter other type variables, wildcards, and intersections in those bounds. This method traverses the bounds until it finds a concrete type from which it can pull an annotation.- Parameters:
top
- the top of the hierarchy for which you are searching- Returns:
- the AnnotationMirror that represents the type of toSearch in the hierarchy of top
-
findEffectiveAnnotationInHierarchy
public static @Nullable AnnotationMirror findEffectiveAnnotationInHierarchy(QualifierHierarchy qualHierarchy, AnnotatedTypeMirror toSearch, AnnotationMirror top, boolean canBeEmpty) When comparing types against the bounds of a type variable, we may encounter other type variables, wildcards, and intersections in those bounds. This method traverses the bounds until it finds a concrete type from which it can pull an annotation.- Parameters:
top
- the top of the hierarchy for which you are searchingcanBeEmpty
- whether or not the effective type can have NO annotation in the hierarchy specified by top. If this param is false, an exception will be thrown if no annotation is found. Otherwise the result is null.- Returns:
- the AnnotationMirror that represents the type of
toSearch
in the hierarchy oftop
-
findEffectiveLowerBoundAnnotations
public static AnnotationMirrorSet findEffectiveLowerBoundAnnotations(QualifierHierarchy qualHierarchy, AnnotatedTypeMirror toSearch) This method returns the effective annotation on the lower bound of a type, or on the type itself if the type has no lower bound (it is not a type variable, wildcard, or intersection).- Parameters:
qualHierarchy
- the qualifier hierarchytoSearch
- the type whose lower bound to examine- Returns:
- the set of effective annotation mirrors in all hierarchies
-
findEffectiveAnnotations
public static AnnotationMirrorSet findEffectiveAnnotations(QualifierHierarchy qualHierarchy, AnnotatedTypeMirror toSearch) When comparing types against the bounds of a type variable, we may encounter other type variables, wildcards, and intersections in those bounds. This method traverses the bounds until it finds a concrete type from which it can pull an annotation. This occurs for every hierarchy in QualifierHierarchy.- Parameters:
qualHierarchy
- the qualifier hierarchytoSearch
- the type whose effective annotations to determine- Returns:
- the set of effective annotation mirrors in all hierarchies
-
glbOfBounds
public static AnnotationMirrorSet glbOfBounds(AnnotatedTypeMirror.AnnotatedIntersectionType isect, QualifierHierarchy qualHierarchy) Gets the lowest primary annotation of all bounds in the intersection.- Parameters:
isect
- the intersection for which we are glbing boundsqualHierarchy
- the qualifier used to get the hierarchies in which to glb- Returns:
- a set of annotations representing the glb of the intersection's bounds
-
hasNoExplicitBound
This method identifies wildcard types that are unbound.- Parameters:
wildcard
- the type to check- Returns:
- true if the given card is an unbounded wildcard
-
isExplicitlySuperBounded
@Deprecated public static boolean isExplicitlySuperBounded(AnnotatedTypeMirror.AnnotatedWildcardType wildcardType) Deprecated.Returns true if wildcard type is explicitly super bounded.- Parameters:
wildcardType
- the wildcard type to test- Returns:
- true if wildcard type is explicitly super bounded
-
hasExplicitSuperBound
Returns true if wildcard type has an explicit super bound.- Parameters:
wildcard
- the wildcard type to test- Returns:
- true if wildcard type is explicitly super bounded
-
isExplicitlyExtendsBounded
@Deprecated public static boolean isExplicitlyExtendsBounded(AnnotatedTypeMirror.AnnotatedWildcardType wildcardType) Deprecated.Returns true if wildcard type is explicitly extends bounded.- Parameters:
wildcardType
- the wildcard type to test- Returns:
- true if wildcard type is explicitly extends bounded
-
hasExplicitExtendsBound
Returns true if wildcard type has an explicit extends bound.- Parameters:
wildcard
- the wildcard type to test- Returns:
- true if wildcard type is explicitly extends bounded
-
isUnboundedOrSuperBounded
Returns true if this type is super bounded or unbounded.- Parameters:
wildcard
- the wildcard type to test- Returns:
- true if this type is super bounded or unbounded
-
isUnboundedOrExtendsBounded
public static boolean isUnboundedOrExtendsBounded(AnnotatedTypeMirror.AnnotatedWildcardType wildcard) Returns true if this type is extends bounded or unbounded.- Parameters:
wildcard
- the wildcard type to test- Returns:
- true if this type is extends bounded or unbounded
-
copyOnlyExplicitConstructorAnnotations
public static void copyOnlyExplicitConstructorAnnotations(AnnotatedTypeFactory atypeFactory, AnnotatedTypeMirror.AnnotatedDeclaredType returnType, AnnotatedTypeMirror.AnnotatedExecutableType constructor) Copies explicit annotations and annotations resulting from resolution of polymorphic qualifiers fromconstructor
toreturnType
. IfreturnType
has an annotation in the same hierarchy of an annotation to be copied, that annotation is not copied.- Parameters:
atypeFactory
- type factoryreturnType
- return type to copy annotations toconstructor
- the ATM for the constructor
-
applyAnnotationsFromDeclaredType
public static void applyAnnotationsFromDeclaredType(AnnotatedTypeMirror.AnnotatedDeclaredType annotatedDeclaredType, DeclaredType declaredType) Add all the annotations indeclaredType
toannotatedDeclaredType
.(The
TypeMirror
returned byannotatedDeclaredType#getUnderlyingType
may not have all the annotations on the type, so allow the user to specify a different one.)- Parameters:
annotatedDeclaredType
- annotated type to which annotations are addeddeclaredType
- a type that may have annotations
-
isTypeArgOfRawType
Returns whethertype
is a type argument to a type whose#underlyingType
is raw. The Checker Framework gives raw types wildcard type arguments so that the annotated type can be used as if the annotated type was not raw.- Parameters:
type
- an annotated type- Returns:
- whether this is a type argument to a type whose
#underlyingType
is raw
-
adaptParameters(AnnotatedTypeFactory, AnnotatedExecutableType, List, Tree)
instead