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
- node that invokes the constructorconstructorElt
- 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' types.void 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 invocation.receiverTree
- the Tree of the class that contains the method being
invoked.methodElt
- the element of the method being invoked.atf
- the annotated type factory of a given type system, whose
type hierarchy will be used to update the method parameters' types.void 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 method.overriddenMethod
- the AnnotatedExecutableType of the overridden
method.atf
- the annotated type factory of a given type system, whose
type hierarchy will be used to update the parameter type.void 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 receiver.methodElt
- the element of the method.overriddenMethod
- the AnnotatedExecutableType of the overridden
method.atf
- the annotated type factory of a given type system, whose
type hierarchy will be used to update the receiver type.void 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 parameter.rhs
- the node being assigned to the parameter in the method body.classTree
- the tree of the class that contains the parameter.methodTree
- the tree of the method that contains the parameter.atf
- the annotated type factory of a given type system, whose
type hierarchy will be used to update the parameter type.void 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 refined.rhs
- the expression being assigned to the field.classTree
- the ClassTree for the enclosing class of the assignment.atf
- the annotated type factory of a given type system, whose
type hierarchy will be used to update the field's type.void 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 returned.classSymbol
- the symbol of the class that contains the method.methodTree
- the tree of the method whose return type
may be updated.atf
- the annotated type factory of a given type system, whose
type hierarchy will be used to update the method's return type.void saveResults()