public abstract class CFAbstractTransfer<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>,T extends CFAbstractTransfer<V,S,T>> extends AbstractNodeVisitor<TransferResult<V,S>,TransferInput<V,S>> implements ForwardTransferFunction<V,S>
AnnotatedTypeFactory
to provide checker-specific logic how to
combine types (e.g., what is the type of a string concatenation, given the types of the two
operands) and as an abstraction function (e.g., determine the annotations on literals).
Design note: CFAbstractTransfer and its subclasses are supposed to act as transfer functions. But, since the AnnotatedTypeFactory already existed and performed checker-independent type propagation, CFAbstractTransfer delegates work to it instead of duplicating some logic in CFAbstractTransfer. The checker-specific subclasses of CFAbstractTransfer do implement transfer function logic themselves.
Modifier and Type | Field and Description |
---|---|
protected CFAbstractAnalysis<V,S,T> |
analysis
The analysis used by this transfer function.
|
protected boolean |
sequentialSemantics
Should the analysis use sequential Java semantics (i.e., assume that only one thread is running
at all times)?
|
Modifier | Constructor and Description |
---|---|
protected |
CFAbstractTransfer(CFAbstractAnalysis<V,S,T> analysis)
Create a CFAbstractTransfer.
|
protected |
CFAbstractTransfer(CFAbstractAnalysis<V,S,T> analysis,
boolean forceConcurrentSemantics)
Constructor that allows forcing concurrent semantics to be on for this instance of
CFAbstractTransfer.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addInformationFromPreconditions(S initialStore,
AnnotatedTypeFactory factory,
UnderlyingAST.CFGMethod methodAst,
MethodTree methodDeclTree,
ExecutableElement methodElement)
Add the information from all the preconditions of a method to the initial store in the method
body.
|
protected TransferResult<V,S> |
createTransferResult(V value,
TransferInput<V,S> in)
Creates a TransferResult.
|
protected V |
finishValue(V value,
S store)
A hook for subclasses to modify the result of the transfer function.
|
protected V |
finishValue(V value,
S thenStore,
S elseStore)
A hook for subclasses to modify the result of the transfer function.
|
protected V |
getNarrowedValue(TypeMirror type,
V annotatedValue)
Returns an abstract value with the given
type and the annotations from annotatedValue , adapted for narrowing. |
protected V |
getValueFromFactory(Tree tree,
Node node)
Returns the abstract value of a non-leaf tree
tree , as computed by the AnnotatedTypeFactory . |
protected V |
getWidenedValue(TypeMirror type,
V annotatedValue)
Returns an abstract value with the given
type and the annotations from annotatedValue , adapted for widening. |
S |
initialStore(UnderlyingAST underlyingAST,
@Nullable List<LocalVariableNode> parameters)
The initial store maps method formal parameters to their currently most refined type.
|
static void |
insertIntoStores(TransferResult<CFValue,CFStore> result,
JavaExpression target,
AnnotationMirror newAnno)
Inserts newAnno as the value into all stores (conditional or not) in the result for node.
|
protected boolean |
isNotFullyInitializedReceiver(MethodTree methodDeclTree)
Returns true if the receiver of a method or constructor might not yet be fully initialized.
|
V |
moreSpecificValue(V value1,
V value2)
Returns the abstract value of
(value1, value2) that is more specific. |
protected void |
processCommonAssignment(TransferInput<V,S> in,
Node lhs,
Node rhs,
S store,
V rhsValue)
Determine abstract value of right-hand side and update the store accordingly.
|
protected void |
processConditionalPostconditions(MethodInvocationNode invocationNode,
ExecutableElement methodElement,
Tree invocationTree,
S thenStore,
S elseStore)
Add information from the conditional postconditions of a method to the stores after an
invocation.
|
protected void |
processPostconditions(MethodInvocationNode invocationNode,
S store,
ExecutableElement methodElement,
Tree invocationTree)
Add information from the postconditions of a method to the store after an invocation.
|
protected TransferResult<V,S> |
recreateTransferResult(V value,
TransferResult<V,S> in)
Creates a TransferResult just like the given one, but with the given value.
|
void |
setFixedInitialStore(S s)
Set a fixed initial Store.
|
protected List<Node> |
splitAssignments(Node node)
Takes a node, and either returns the node itself again (as a singleton list), or if the node is
an assignment node, returns the lhs and rhs (where splitAssignments is applied recursively to
the rhs -- that is, it is possible that the rhs does not appear in the result, but rather its
lhs and rhs do).
|
protected TransferResult<V,S> |
strengthenAnnotationOfEqualTo(TransferResult<V,S> res,
Node firstNode,
Node secondNode,
V firstValue,
V secondValue,
boolean notEqualTo)
Refine the annotation of
secondNode if the annotation secondValue is less
precise than firstValue . |
boolean |
usesSequentialSemantics()
Returns true if the transfer function uses sequential semantics, false if it uses concurrent
semantics.
|
TransferResult<V,S> |
visitArrayAccess(ArrayAccessNode n,
TransferInput<V,S> p) |
TransferResult<V,S> |
visitAssignment(AssignmentNode n,
TransferInput<V,S> in) |
TransferResult<V,S> |
visitCase(CaseNode n,
TransferInput<V,S> in)
A case produces no value, but it may imply some facts about the argument to the switch
statement.
|
TransferResult<V,S> |
visitClassName(ClassNameNode n,
TransferInput<V,S> in) |
TransferResult<V,S> |
visitConditionalNot(ConditionalNotNode n,
TransferInput<V,S> p)
Reverse the role of the 'thenStore' and 'elseStore'.
|
TransferResult<V,S> |
visitEqualTo(EqualToNode n,
TransferInput<V,S> p) |
TransferResult<V,S> |
visitFieldAccess(FieldAccessNode n,
TransferInput<V,S> p) |
TransferResult<V,S> |
visitInstanceOf(InstanceOfNode node,
TransferInput<V,S> in) |
TransferResult<V,S> |
visitLambdaResultExpression(LambdaResultExpressionNode n,
TransferInput<V,S> in) |
TransferResult<V,S> |
visitLocalVariable(LocalVariableNode n,
TransferInput<V,S> in)
Use the most specific type information available according to the store.
|
TransferResult<V,S> |
visitMethodInvocation(MethodInvocationNode n,
TransferInput<V,S> in) |
TransferResult<V,S> |
visitNarrowingConversion(NarrowingConversionNode n,
TransferInput<V,S> p) |
TransferResult<V,S> |
visitNode(Node n,
TransferInput<V,S> in)
The default visitor returns the input information unchanged, or in the case of conditional
input information, merged.
|
TransferResult<V,S> |
visitNotEqual(NotEqualNode n,
TransferInput<V,S> p) |
TransferResult<V,S> |
visitObjectCreation(ObjectCreationNode n,
TransferInput<V,S> p) |
TransferResult<V,S> |
visitReturn(ReturnNode n,
TransferInput<V,S> p) |
TransferResult<V,S> |
visitStringConcatenateAssignment(StringConcatenateAssignmentNode n,
TransferInput<V,S> in) |
TransferResult<V,S> |
visitStringConversion(StringConversionNode n,
TransferInput<V,S> p) |
TransferResult<V,S> |
visitTernaryExpression(TernaryExpressionNode n,
TransferInput<V,S> p) |
TransferResult<V,S> |
visitThis(ThisNode n,
TransferInput<V,S> in) |
TransferResult<V,S> |
visitVariableDeclaration(VariableDeclarationNode n,
TransferInput<V,S> p) |
TransferResult<V,S> |
visitWideningConversion(WideningConversionNode n,
TransferInput<V,S> p) |
visitArrayCreation, visitArrayType, visitAssertionError, visitBitwiseAnd, visitBitwiseComplement, visitBitwiseOr, visitBitwiseXor, visitBooleanLiteral, visitCharacterLiteral, visitClassDeclaration, visitConditionalAnd, visitConditionalOr, visitDoubleLiteral, visitExplicitThis, visitFloatingDivision, visitFloatingRemainder, visitFloatLiteral, visitGreaterThan, visitGreaterThanOrEqual, visitImplicitThis, visitIntegerDivision, visitIntegerLiteral, visitIntegerRemainder, visitLeftShift, visitLessThan, visitLessThanOrEqual, visitLongLiteral, visitMarker, visitMemberReference, visitMethodAccess, visitNullChk, visitNullLiteral, visitNumericalAddition, visitNumericalMinus, visitNumericalMultiplication, visitNumericalPlus, visitNumericalSubtraction, visitPackageName, visitParameterizedType, visitPrimitiveType, visitShortLiteral, visitSignedRightShift, visitStringConcatenate, visitStringLiteral, visitSuper, visitSynchronized, visitThrow, visitTypeCast, visitUnsignedRightShift, visitValueLiteral
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
visitArrayCreation, visitArrayType, visitAssertionError, visitBitwiseAnd, visitBitwiseComplement, visitBitwiseOr, visitBitwiseXor, visitBooleanLiteral, visitCharacterLiteral, visitClassDeclaration, visitConditionalAnd, visitConditionalOr, visitDoubleLiteral, visitExplicitThis, visitFloatingDivision, visitFloatingRemainder, visitFloatLiteral, visitGreaterThan, visitGreaterThanOrEqual, visitImplicitThis, visitIntegerDivision, visitIntegerLiteral, visitIntegerRemainder, visitLeftShift, visitLessThan, visitLessThanOrEqual, visitLongLiteral, visitMarker, visitMemberReference, visitMethodAccess, visitNullChk, visitNullLiteral, visitNumericalAddition, visitNumericalMinus, visitNumericalMultiplication, visitNumericalPlus, visitNumericalSubtraction, visitPackageName, visitParameterizedType, visitPrimitiveType, visitShortLiteral, visitSignedRightShift, visitStringConcatenate, visitStringLiteral, visitSuper, visitSynchronized, visitThrow, visitTypeCast, visitUnsignedRightShift
protected final CFAbstractAnalysis<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>,T extends CFAbstractTransfer<V,S,T>> analysis
protected final boolean sequentialSemantics
protected CFAbstractTransfer(CFAbstractAnalysis<V,S,T> analysis)
analysis
- the analysis used by this transfer functionprotected CFAbstractTransfer(CFAbstractAnalysis<V,S,T> analysis, boolean forceConcurrentSemantics)
analysis
- the analysis used by this transfer functionforceConcurrentSemantics
- whether concurrent semantics should be forced to be on. If
false, concurrent semantics are turned off by default, but the user can still turn them on
via -AconcurrentSemantics
. If true, the user cannot turn off concurrent semantics.public boolean usesSequentialSemantics()
protected V finishValue(V value, S store)
value
as the result of the transfer function.
If a subclass overrides this method, the subclass should also override finishValue(CFAbstractValue,CFAbstractStore,CFAbstractStore)
.
value
- a value to possibly modifystore
- the storeprotected V finishValue(V value, S thenStore, S elseStore)
value
as the result of the transfer function.
If a subclass overrides this method, the subclass should also override finishValue(CFAbstractValue,CFAbstractStore)
.
value
- the value to finishthenStore
- the "then" storeelseStore
- the "else" storeprotected V getValueFromFactory(Tree tree, Node node)
tree
, as computed by the AnnotatedTypeFactory
.tree
, as computed by the AnnotatedTypeFactory
public void setFixedInitialStore(S s)
public S initialStore(UnderlyingAST underlyingAST, @Nullable List<LocalVariableNode> parameters)
initialStore
in interface ForwardTransferFunction<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>
underlyingAST
- an abstract syntax treeparameters
- a list of local variable nodesprotected boolean isNotFullyInitializedReceiver(MethodTree methodDeclTree)
methodDeclTree
- the declaration of the method or constructorprotected void addInformationFromPreconditions(S initialStore, AnnotatedTypeFactory factory, UnderlyingAST.CFGMethod methodAst, MethodTree methodDeclTree, ExecutableElement methodElement)
initialStore
- the initial store for the method bodyfactory
- the type factorymethodAst
- the AST for a method declarationmethodDeclTree
- the declaration of the method; is a field of methodAst
methodElement
- the element for the methodpublic TransferResult<V,S> visitNode(Node n, TransferInput<V,S> in)
visitNode
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
protected TransferResult<V,S> createTransferResult(V value, TransferInput<V,S> in)
This default implementation returns the input information unchanged, or in the case of conditional input information, merged.
value
- the value; possibly nullin
- the transfer inputprotected TransferResult<V,S> recreateTransferResult(V value, TransferResult<V,S> in)
This default implementation returns the input information unchanged, or in the case of conditional input information, merged.
value
- the value; possibly nullin
- the TransferResult to copypublic TransferResult<V,S> visitClassName(ClassNameNode n, TransferInput<V,S> in)
visitClassName
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitClassName
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitFieldAccess(FieldAccessNode n, TransferInput<V,S> p)
visitFieldAccess
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitFieldAccess
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitArrayAccess(ArrayAccessNode n, TransferInput<V,S> p)
visitArrayAccess
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitArrayAccess
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitLocalVariable(LocalVariableNode n, TransferInput<V,S> in)
visitLocalVariable
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitLocalVariable
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitThis(ThisNode n, TransferInput<V,S> in)
visitThis
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitTernaryExpression(TernaryExpressionNode n, TransferInput<V,S> p)
visitTernaryExpression
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitTernaryExpression
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitConditionalNot(ConditionalNotNode n, TransferInput<V,S> p)
visitConditionalNot
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitConditionalNot
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitEqualTo(EqualToNode n, TransferInput<V,S> p)
visitEqualTo
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitEqualTo
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitNotEqual(NotEqualNode n, TransferInput<V,S> p)
visitNotEqual
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitNotEqual
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
protected TransferResult<V,S> strengthenAnnotationOfEqualTo(TransferResult<V,S> res, Node firstNode, Node secondNode, V firstValue, V secondValue, boolean notEqualTo)
secondNode
if the annotation secondValue
is less
precise than firstValue
. This is possible, if secondNode
is an expression that
is tracked by the store (e.g., a local variable or a field). Clients usually call this twice
with firstNode
and secondNode
reversed, to refine each of them.
Note that when overriding this method, when a new type is inserted into the store, splitAssignments(org.checkerframework.dataflow.cfg.node.Node)
should be called, and the new type should be inserted into the store for
each of the resulting nodes.
firstNode
- the node that might be more precisesecondNode
- the node whose type to possibly refinefirstValue
- the abstract value that might be more precisesecondValue
- the abstract value that might be less preciseres
- the previous resultnotEqualTo
- if true, indicates that the logic is flipped (i.e., the information is added
to the elseStore
instead of the thenStore
) for a not-equal comparison.null
protected List<Node> splitAssignments(Node node)
node
- possibly an assignment nodepublic TransferResult<V,S> visitAssignment(AssignmentNode n, TransferInput<V,S> in)
visitAssignment
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitAssignment
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitReturn(ReturnNode n, TransferInput<V,S> p)
visitReturn
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitReturn
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitLambdaResultExpression(LambdaResultExpressionNode n, TransferInput<V,S> in)
visitLambdaResultExpression
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitLambdaResultExpression
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitStringConcatenateAssignment(StringConcatenateAssignmentNode n, TransferInput<V,S> in)
visitStringConcatenateAssignment
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitStringConcatenateAssignment
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
protected void processCommonAssignment(TransferInput<V,S> in, Node lhs, Node rhs, S store, V rhsValue)
in
- the store(s) before the assignmentlhs
- the left-hand side of the assignmentrhs
- the right-hand side of the assignmentstore
- the regular input store (from in
)rhsValue
- the value of the right-hand side of the assignmentpublic TransferResult<V,S> visitObjectCreation(ObjectCreationNode n, TransferInput<V,S> p)
visitObjectCreation
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitObjectCreation
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitMethodInvocation(MethodInvocationNode n, TransferInput<V,S> in)
visitMethodInvocation
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitMethodInvocation
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitInstanceOf(InstanceOfNode node, TransferInput<V,S> in)
visitInstanceOf
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitInstanceOf
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
protected void processPostconditions(MethodInvocationNode invocationNode, S store, ExecutableElement methodElement, Tree invocationTree)
invocationNode
- a method callstore
- a store; is side-effected by this methodmethodElement
- the method being calledinvocationTree
- the tree for the method callprotected void processConditionalPostconditions(MethodInvocationNode invocationNode, ExecutableElement methodElement, Tree invocationTree, S thenStore, S elseStore)
invocationNode
- a method callmethodElement
- the method being calledinvocationTree
- the tree for the method callthenStore
- the "then" store; is side-effected by this methodelseStore
- the "else" store; is side-effected by this methodpublic TransferResult<V,S> visitCase(CaseNode n, TransferInput<V,S> in)
visitCase
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitCase
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public V moreSpecificValue(V value1, V value2)
(value1, value2)
that is more specific. If the two are
incomparable, then value1
is returned.public TransferResult<V,S> visitVariableDeclaration(VariableDeclarationNode n, TransferInput<V,S> p)
visitVariableDeclaration
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitVariableDeclaration
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitWideningConversion(WideningConversionNode n, TransferInput<V,S> p)
visitWideningConversion
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitWideningConversion
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
protected V getNarrowedValue(TypeMirror type, V annotatedValue)
type
and the annotations from annotatedValue
, adapted for narrowing. This is only called at a narrowing conversion.type
- the type to narrow toannotatedValue
- the type to narrow fromtype
and the annotations from annotatedValue
; returns null if annotatedValue
is nullprotected V getWidenedValue(TypeMirror type, V annotatedValue)
type
and the annotations from annotatedValue
, adapted for widening. This is only called at a widening conversion.type
- the type to widen toannotatedValue
- the type to widen fromtype
and the annotations from annotatedValue
; returns null if annotatedValue
is nullpublic TransferResult<V,S> visitNarrowingConversion(NarrowingConversionNode n, TransferInput<V,S> p)
visitNarrowingConversion
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitNarrowingConversion
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public TransferResult<V,S> visitStringConversion(StringConversionNode n, TransferInput<V,S> p)
visitStringConversion
in interface NodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
visitStringConversion
in class AbstractNodeVisitor<TransferResult<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>,TransferInput<V extends CFAbstractValue<V>,S extends CFAbstractStore<V,S>>>
public static void insertIntoStores(TransferResult<CFValue,CFStore> result, JavaExpression target, AnnotationMirror newAnno)
result
- the TransferResult holding the stores to modifytarget
- the receiver whose value should be modifiednewAnno
- the new value