public interface WholeProgramInference
This interface has update* methods that should be called at certain (pseudo-)assignments, and they may update the type of the LHS of the (pseudo-)assignment based on the type of the RHS. In case the element on the LHS already had an inferred type, its new type will be the LUB between the previous and new types.
Modifier and Type | Method and Description |
---|---|
void |
saveResults()
Saves the inferred results.
|
void |
updateInferredConstructorParameterTypes(ObjectCreationNode objectCreationNode,
ExecutableElement constructorElt,
AnnotatedTypeFactory atf)
Updates the parameter types of the constructor
constructorElt based on the arguments
in objectCreationNode . |
void |
updateInferredFieldType(FieldAccessNode field,
Node rhs,
ClassTree classTree,
AnnotatedTypeFactory atf)
Updates the type of
field base on an assignment of rhs to field . |
void |
updateInferredMethodParameterTypes(MethodInvocationNode methodInvNode,
Tree receiverTree,
ExecutableElement methodElt,
AnnotatedTypeFactory atf)
Updates the parameter types of the method
methodElt based on the arguments in the
method invocation methodInvNode . |
void |
updateInferredMethodParameterTypes(MethodTree methodTree,
ExecutableElement methodElt,
AnnotatedTypeMirror.AnnotatedExecutableType overriddenMethod,
AnnotatedTypeFactory atf)
Updates the parameter types of the method
methodTree based on the parameter types of
the overridden method overriddenMethod . |
void |
updateInferredMethodReceiverType(MethodTree methodTree,
ExecutableElement methodElt,
AnnotatedTypeMirror.AnnotatedExecutableType overriddenMethod,
AnnotatedTypeFactory atf)
Updates the receiver type of the method
methodElt based on the receiver type of the
overridden method overriddenMethod . |
void |
updateInferredMethodReturnType(ReturnNode returnedExpression,
com.sun.tools.javac.code.Symbol.ClassSymbol classSymbol,
MethodTree methodTree,
AnnotatedTypeFactory atf)
Updates the return type of the method
methodTree based on returnedExpression . |
void |
updateInferredParameterType(LocalVariableNode parameter,
Node rhs,
ClassTree classTree,
MethodTree methodTree,
AnnotatedTypeFactory atf)
Updates the type of
parameter based on an assignment of rhs to parameter . |
void updateInferredConstructorParameterTypes(ObjectCreationNode objectCreationNode, ExecutableElement constructorElt, AnnotatedTypeFactory atf)
constructorElt
based on the arguments
in objectCreationNode
.objectCreationNode
- the Node that invokes the constructorconstructorElt
- the Element of the constructoratf
- the annotated type factory of a given type system, whose type hierarchy will be
used to update the constructor's parameters' typesvoid updateInferredMethodParameterTypes(MethodInvocationNode methodInvNode, Tree receiverTree, ExecutableElement methodElt, AnnotatedTypeFactory atf)
methodElt
based on the arguments in the
method invocation methodInvNode
.methodInvNode
- the node representing a method invocationreceiverTree
- the Tree of the class that contains the method being invokedmethodElt
- the element of the method being invokedatf
- the annotated type factory of a given type system, whose type hierarchy will be
used to update the method parameters' typesvoid updateInferredMethodParameterTypes(MethodTree methodTree, ExecutableElement methodElt, AnnotatedTypeMirror.AnnotatedExecutableType overriddenMethod, AnnotatedTypeFactory atf)
methodTree
based on the parameter types of
the overridden method overriddenMethod
.methodTree
- the tree of the method that contains the parameter(s)methodElt
- the element of the methodoverriddenMethod
- the AnnotatedExecutableType of the overridden methodatf
- the annotated type factory of a given type system, whose type hierarchy will be
used to update the parameter typevoid updateInferredMethodReceiverType(MethodTree methodTree, ExecutableElement methodElt, AnnotatedTypeMirror.AnnotatedExecutableType overriddenMethod, AnnotatedTypeFactory atf)
methodElt
based on the receiver type of the
overridden method overriddenMethod
.methodTree
- the tree of the method that contains the receivermethodElt
- the element of the methodoverriddenMethod
- the AnnotatedExecutableType of the overridden methodatf
- the annotated type factory of a given type system, whose type hierarchy will be
used to update the receiver typevoid updateInferredParameterType(LocalVariableNode parameter, Node rhs, ClassTree classTree, MethodTree methodTree, AnnotatedTypeFactory atf)
parameter
based on an assignment of rhs
to parameter
.parameter
- the node representing the parameterrhs
- the node being assigned to the parameter in the method bodyclassTree
- the tree of the class that contains the parametermethodTree
- the tree of the method that contains the parameteratf
- the annotated type factory of a given type system, whose type hierarchy will be
used to update the parameter typevoid updateInferredFieldType(FieldAccessNode field, Node rhs, ClassTree classTree, AnnotatedTypeFactory atf)
field
base on an assignment of rhs
to field
.field
- the field whose type will be refinedrhs
- the expression being assigned to the fieldclassTree
- the ClassTree for the enclosing class of the assignmentatf
- the annotated type factory of a given type system, whose type hierarchy will be
used to update the field's typevoid updateInferredMethodReturnType(ReturnNode returnedExpression, com.sun.tools.javac.code.Symbol.ClassSymbol classSymbol, MethodTree methodTree, AnnotatedTypeFactory atf)
methodTree
based on returnedExpression
.returnedExpression
- the node that contains the expression returnedclassSymbol
- the symbol of the class that contains the methodmethodTree
- the tree of the method whose return type may be updatedatf
- the annotated type factory of a given type system, whose type hierarchy will be
used to update the method's return typevoid saveResults()