Class AnnotatedTypeMirror.AnnotatedExecutableType
- java.lang.Object
-
- org.checkerframework.framework.type.AnnotatedTypeMirror
-
- org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedExecutableType
-
- All Implemented Interfaces:
org.plumelib.util.DeepCopyable<AnnotatedTypeMirror>
- Enclosing class:
- AnnotatedTypeMirror
public static class AnnotatedTypeMirror.AnnotatedExecutableType extends AnnotatedTypeMirror
Represents a type of an executable. An executable is a method, constructor, or initializer.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.checkerframework.framework.type.AnnotatedTypeMirror
AnnotatedTypeMirror.AnnotatedArrayType, AnnotatedTypeMirror.AnnotatedDeclaredType, AnnotatedTypeMirror.AnnotatedExecutableType, AnnotatedTypeMirror.AnnotatedIntersectionType, AnnotatedTypeMirror.AnnotatedNoType, AnnotatedTypeMirror.AnnotatedNullType, AnnotatedTypeMirror.AnnotatedPrimitiveType, AnnotatedTypeMirror.AnnotatedTypeVariable, AnnotatedTypeMirror.AnnotatedUnionType, AnnotatedTypeMirror.AnnotatedWildcardType
-
-
Field Summary
-
Fields inherited from class org.checkerframework.framework.type.AnnotatedTypeMirror
atypeFactory, EQUALITY_COMPARER, HASHCODE_VISITOR, primaryAnnotations, underlyingType
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <R,P>
Raccept(AnnotatedTypeVisitor<R,P> v, P p)
Applies a visitor to this type.void
addAnnotation(javax.lang.model.element.AnnotationMirror annotation)
Deprecated.add to the appropriate componentAnnotatedTypeMirror.AnnotatedExecutableType
deepCopy()
Returns a deep copy of this type with annotations.AnnotatedTypeMirror.AnnotatedExecutableType
deepCopy(boolean copyAnnotations)
Returns a deep copy of this type.javax.lang.model.element.ExecutableElement
getElement()
Returns the element of this AnnotatedExecutableType.AnnotatedTypeMirror.AnnotatedExecutableType
getErased()
Returns the erasure type of this type, according to JLS specifications.java.util.List<AnnotatedTypeMirror>
getParameterTypes()
Returns the parameter types of this executable type, excluding the receiver.@Nullable AnnotatedTypeMirror.AnnotatedDeclaredType
getReceiverType()
Returns the receiver type of this executable type; null for static methods and constructors of top-level classes.AnnotatedTypeMirror
getReturnType()
The return type of a method or constructor.java.util.List<AnnotatedTypeMirror>
getThrownTypes()
Returns the thrown types of this executable type.java.util.List<AnnotatedTypeMirror.AnnotatedTypeVariable>
getTypeVariables()
Returns the type variables of this executable type, if any.javax.lang.model.type.ExecutableType
getUnderlyingType()
Returns the underlying unannotated Java type, which this wraps.@Nullable AnnotatedTypeMirror.AnnotatedArrayType
getVarargType()
Returns the vararg type of this executable type.boolean
isVarArgs()
Returns true if this type represents a varargs method.void
setElement(javax.lang.model.element.ExecutableElement elem)
Sets the element of this AnnotatedExecutableType.AnnotatedTypeMirror.AnnotatedExecutableType
shallowCopy()
Returns a shallow copy of this type with annotations.AnnotatedTypeMirror.AnnotatedExecutableType
shallowCopy(boolean copyAnnotations)
Returns a shallow copy of this type.-
Methods inherited from class org.checkerframework.framework.type.AnnotatedTypeMirror
addAnnotation, addAnnotations, addMissingAnnotation, addMissingAnnotations, asUse, clearAnnotations, containsUninferredTypeArguments, createType, createTypeOfObject, createTypeOfRecord, directSupertypes, equals, getAnnotation, getAnnotation, getAnnotationInHierarchy, getAnnotations, getAnnotationsField, getEffectiveAnnotation, getEffectiveAnnotationInHierarchy, getEffectiveAnnotations, getExplicitAnnotations, getKind, getPrimitiveKind, getUnderlyingTypeHashCode, hasAnnotation, hasAnnotation, hasAnnotationInHierarchy, hasAnnotationRelaxed, hasEffectiveAnnotation, hasEffectiveAnnotation, hasEffectiveAnnotationRelaxed, hasExplicitAnnotation, hasExplicitAnnotation, hasExplicitAnnotationRelaxed, hashCode, isAnnotatedInHierarchy, isDeclaration, removeAnnotation, removeAnnotationByClass, removeAnnotationInHierarchy, removeAnnotations, removeNonTopAnnotationInHierarchy, replaceAnnotation, replaceAnnotations, toString, toString
-
-
-
-
Method Detail
-
isVarArgs
public boolean isVarArgs()
Returns true if this type represents a varargs method.- Returns:
- true if this type represents a varargs method
-
accept
public <R,P> R accept(AnnotatedTypeVisitor<R,P> v, P p)
Description copied from class:AnnotatedTypeMirror
Applies a visitor to this type.- Specified by:
accept
in classAnnotatedTypeMirror
- Type Parameters:
R
- the return type of the visitor's methodsP
- the type of the additional parameter to the visitor's methods- Parameters:
v
- the visitor operating on this typep
- additional parameter to the visitor- Returns:
- a visitor-specified result
-
getUnderlyingType
public javax.lang.model.type.ExecutableType getUnderlyingType()
Description copied from class:AnnotatedTypeMirror
Returns the underlying unannotated Java type, which this wraps.- Overrides:
getUnderlyingType
in classAnnotatedTypeMirror
- Returns:
- the underlying type
-
addAnnotation
@Deprecated public void addAnnotation(javax.lang.model.element.AnnotationMirror annotation)
Deprecated.add to the appropriate componentIt never makes sense to add annotations to an executable type. Instead, they should be added to the appropriate component.- Overrides:
addAnnotation
in classAnnotatedTypeMirror
- Parameters:
annotation
- the annotation to add
-
getParameterTypes
public java.util.List<AnnotatedTypeMirror> getParameterTypes()
Returns the parameter types of this executable type, excluding the receiver.- Returns:
- the parameter types of this executable type, excluding the receiver
-
getVarargType
public @Nullable AnnotatedTypeMirror.AnnotatedArrayType getVarargType()
Returns the vararg type of this executable type.- Returns:
- the vararg type of this executable type
-
getReturnType
public AnnotatedTypeMirror getReturnType()
The return type of a method or constructor. For constructors, the return type is not VOID, but the type of the enclosing class.- Returns:
- the return type of this executable type
-
getReceiverType
public @Nullable AnnotatedTypeMirror.AnnotatedDeclaredType getReceiverType()
Returns the receiver type of this executable type; null for static methods and constructors of top-level classes.- Returns:
- the receiver type of this executable type; null for static methods and constructors of top-level classes
-
getThrownTypes
public java.util.List<AnnotatedTypeMirror> getThrownTypes()
Returns the thrown types of this executable type.- Returns:
- the thrown types of this executable type
-
getTypeVariables
public java.util.List<AnnotatedTypeMirror.AnnotatedTypeVariable> getTypeVariables()
Returns the type variables of this executable type, if any.- Returns:
- the type variables of this executable type, if any
-
deepCopy
public AnnotatedTypeMirror.AnnotatedExecutableType deepCopy(boolean copyAnnotations)
Description copied from class:AnnotatedTypeMirror
Returns a deep copy of this type. A deep copy implies that each component type is copied recursively and the returned type refers to those copies in its component locations.Note: deepCopy provides two important properties in the returned copy:
- Structure preservation -- The exact structure of the original AnnotatedTypeMirror is preserved in the copy including all component types.
- Annotation preservation -- All of the annotations from the original AnnotatedTypeMirror and its components have been copied to the new type.
- Specified by:
deepCopy
in classAnnotatedTypeMirror
- Returns:
- a deep copy
-
deepCopy
public AnnotatedTypeMirror.AnnotatedExecutableType deepCopy()
Description copied from class:AnnotatedTypeMirror
Returns a deep copy of this type with annotations.Each subclass implements this method with the subclass return type. The method body must always be a call to deepCopy(true).
- Specified by:
deepCopy
in interfaceorg.plumelib.util.DeepCopyable<AnnotatedTypeMirror>
- Specified by:
deepCopy
in classAnnotatedTypeMirror
- Returns:
- a deep copy of this type with annotations
- See Also:
AnnotatedTypeMirror.deepCopy(boolean)
-
shallowCopy
public AnnotatedTypeMirror.AnnotatedExecutableType shallowCopy(boolean copyAnnotations)
Description copied from class:AnnotatedTypeMirror
Returns a shallow copy of this type. A shallow copy implies that each component type in the output copy refers to the same object as the object being copied.- Specified by:
shallowCopy
in classAnnotatedTypeMirror
- Parameters:
copyAnnotations
- whether copy should have annotations, i.e. whether fieldannotations
should be copied.
-
shallowCopy
public AnnotatedTypeMirror.AnnotatedExecutableType shallowCopy()
Description copied from class:AnnotatedTypeMirror
Returns a shallow copy of this type with annotations.Each subclass implements this method with the subclass return type. The method body must always be a call to shallowCopy(true).
- Specified by:
shallowCopy
in classAnnotatedTypeMirror
- Returns:
- a shallow copy of this type with annotations
- See Also:
AnnotatedTypeMirror.shallowCopy(boolean)
-
getElement
public javax.lang.model.element.ExecutableElement getElement()
Returns the element of this AnnotatedExecutableType.- Returns:
- the element of this AnnotatedExecutableType
-
setElement
public void setElement(javax.lang.model.element.ExecutableElement elem)
Sets the element of this AnnotatedExecutableType.- Parameters:
elem
- the new element for this AnnotatedExecutableType
-
getErased
public AnnotatedTypeMirror.AnnotatedExecutableType getErased()
Description copied from class:AnnotatedTypeMirror
Returns the erasure type of this type, according to JLS specifications.- Overrides:
getErased
in classAnnotatedTypeMirror
- Returns:
- the erasure of this AnnotatedTypeMirror, this is always a copy even if the erasure and the original type are equivalent
- See Also:
- https://docs.oracle.com/javase/specs/jls/se17/html/jls-4.html#jls-4.6
-
-