Class AMethod
java.lang.Object
org.checkerframework.afu.scenelib.el.AElement
org.checkerframework.afu.scenelib.el.ADeclaration
org.checkerframework.afu.scenelib.el.AMethod
- All Implemented Interfaces:
Cloneable
An annotated method; contains bounds, return, parameters, receiver, and throws.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe body of the method.The method's annotated type parameter bounds.Clients set this before printing the AMethod.final String
The method's simple name followed by its erased signature in JVML format.final VivifyingMap
<Integer, AField> The method's annotated parameters; map key is parameter index, starting at 0.final VivifyingMap
<String, AField> Types of expressions at exit from the method.final VivifyingMap
<String, AField> Types of expressions at entry to the method.final AField
The method's annotated receiver parameter type.final ATypeElement
The method's annotated return type.Exceptions that are thrown.Fields inherited from class org.checkerframework.afu.scenelib.el.ADeclaration
insertAnnotations, insertTypecasts
Fields inherited from class org.checkerframework.afu.scenelib.el.AElement
description, tlAnnotationsHere, type
-
Method Summary
Modifier and TypeMethodDescription<R,
T> R accept
(ElementVisitor<R, T> v, T t) clone()
boolean
Returns true if thisAElement
equalso
.Returns the method's simple name.Returns the parameters, as a map from parameter index (0-indexed) to representation.Returns the postconditions: annotations that apply to fields at method exit.Returns the preconditions: annotations that apply to fields at method entry.Returns the return type.List
<? extends TypeParameterElement> Returns the type parameters of this method.int
hashCode()
boolean
isEmpty()
Returns true if thisAElement
is empty.void
prune()
Removes empty subelements of thisAElement
depth-first.void
setFieldsFromMethodElement
(ExecutableElement methodElt) Sets return type, type parameters, and formal parameters in this AMethod, from information in the given method element.void
setReturnTypeMirror
(@Nullable TypeMirror returnTypeMirror) Set the return type.void
setTypeParameters
(List<? extends TypeParameterElement> typeParameters) Set the type parameters of this method.toString()
vivifyAndAddTypeMirrorToParameter
(int i, TypeMirror type, Name simpleName) Obtain the parameter at the given index, which can be further operated on to e.g.vivifyAndAddTypeMirrorToPostcondition
(String expression, TypeMirror type) Obtain information about an expression at method exit.vivifyAndAddTypeMirrorToPrecondition
(String expression, TypeMirror type) Obtain information about an expression at method entry.Methods inherited from class org.checkerframework.afu.scenelib.el.ADeclaration
equals
Methods inherited from class org.checkerframework.afu.scenelib.el.AElement
lookup, tlAnnotationsHereFormatted
-
Field Details
-
methodSignature
The method's simple name followed by its erased signature in JVML format. For example,foo()V
orbar(B[I[[Ljava/lang/String;)I
. -
bounds
The method's annotated type parameter bounds. -
returnType
The method's annotated return type. Non-null even if returnTypeMirror is null. -
receiver
The method's annotated receiver parameter type. -
parameters
The method's annotated parameters; map key is parameter index, starting at 0. -
throwsException
Exceptions that are thrown. -
preconditions
Types of expressions at entry to the method. The map key is the string representation of the expression. -
postconditions
Types of expressions at exit from the method. The map key is the string representation of the expression. -
contracts
Clients set this before printing the AMethod.These annotations are not stored in tlAnnotationsHere because whole-program inference assumes that inferred annotations only become stronger, but these annotations might disappear as other annotations become stronger.
These annotations are not part of the abstract state of this AMethod (but are derived from it).
-
body
The body of the method.
-
-
Method Details
-
setFieldsFromMethodElement
Sets return type, type parameters, and formal parameters in this AMethod, from information in the given method element.- Parameters:
methodElt
- the element whose information to propagate into this
-
getMethodName
Returns the method's simple name.- Returns:
- the method's simple name
-
getTypeParameters
Returns the type parameters of this method.- Returns:
- the list of type parameters
-
setTypeParameters
Set the type parameters of this method.- Parameters:
typeParameters
- the list of type parameters
-
vivifyAndAddTypeMirrorToParameter
Obtain the parameter at the given index, which can be further operated on to e.g. add a type annotation.- Parameters:
i
- the parameter index (first parameter is zero)type
- the type of the parametersimpleName
- the name of the parameter- Returns:
- an AFieldWrapper representing the parameter
-
vivifyAndAddTypeMirrorToPrecondition
Obtain information about an expression at method entry. It can be further operated on to e.g. add a type annotation.- Parameters:
expression
- the expressiontype
- the type of the expression- Returns:
- an AField representing the expression
-
vivifyAndAddTypeMirrorToPostcondition
Obtain information about an expression at method exit. It can be further operated on to e.g. add a type annotation.- Parameters:
expression
- the expressiontype
- the type of the expression- Returns:
- an AField representing the expression
-
getReturnTypeMirror
Returns the return type.- Returns:
- the return type, or null if the return type is unknown or void
-
setReturnTypeMirror
Set the return type. Does nothing if the argument is null. Errs if called twice with different non-null arguments.- Parameters:
returnTypeMirror
- the return type
-
getParameters
Returns the parameters, as a map from parameter index (0-indexed) to representation.- Returns:
- an immutable copy of the vivified parameters, as a map from index to representation
-
getPreconditions
Returns the preconditions: annotations that apply to fields at method entry.- Returns:
- an immutable copy of the vivified preconditions
-
getPostconditions
Returns the postconditions: annotations that apply to fields at method exit.- Returns:
- an immutable copy of the vivified postconditions
-
clone
-
equals
Description copied from class:AElement
Returns true if thisAElement
equalso
. This is a slightly faster variant ofAElement.equals(Object)
for when the argument is statically known to be another nonnullAElement
. -
hashCode
public int hashCode()- Overrides:
hashCode
in classADeclaration
-
isEmpty
public boolean isEmpty()Description copied from class:AElement
Returns true if thisAElement
is empty.- Overrides:
isEmpty
in classADeclaration
- Returns:
- true iff this is empty
-
prune
public void prune()Description copied from class:AElement
Removes empty subelements of thisAElement
depth-first.- Overrides:
prune
in classADeclaration
-
toString
- Overrides:
toString
in classADeclaration
-
accept
- Specified by:
accept
in classADeclaration
-