ST
- the flow state subclass that should be used.
If DefaultFlow is instantiated directly the type argument has to be DefaultFlowState.
In other cases, method createFlowState has to be overridden correctly!public class DefaultFlow<ST extends DefaultFlowState> extends AbstractFlow<ST>
alive, annoRelations, atypeFactory, checker, debug, flowResults, flowState, flowState_whenFalse, flowState_whenTrue, root
Constructor and Description |
---|
DefaultFlow(BaseTypeChecker checker,
CompilationUnitTree root,
Set<AnnotationMirror> annotations,
AnnotatedTypeFactory factory) |
Modifier and Type | Method and Description |
---|---|
protected void |
clearOnCall(@Nullable MethodTree enclMeth,
ExecutableElement method)
Clear whatever part of the state that gets invalidated by
invoking the method.
|
protected ST |
createFlowState(Set<AnnotationMirror> annotations)
Create the correct instance of FlowState.
|
protected void |
newVar(VariableTree tree)
Registers a new variable for flow tracking.
|
protected void |
propagate(Tree lhs,
ExpressionTree rhs)
Moves bits as assignments are made.
|
protected void |
propagateFromType(Tree lhs,
AnnotatedTypeMirror rhs)
Moves bits in an assignment using a type instead of a tree.
|
protected void |
recordBitsImps(Tree tree,
Element elt) |
addFlowResult, containsKey, copyState, inferFromAssert, isNonFinalField, recordBits, removeFlowResult, scan, scan, scanCond, scanDef, scanExpr, scanStat, scanStats, setDebug, test, varDefHasAnnotation, visitAnnotation, visitArrayAccess, visitAssert, visitAssignment, visitBlock, visitBreak, visitClass, visitCompoundAssignment, visitConditionalExpression, visitContinue, visitDoWhileLoop, visitEnhancedForLoop, visitForLoop, visitIdentifier, visitIf, visitImport, visitMemberSelect, visitMethod, visitMethodEndCallback, visitMethodInvocation, visitReturn, visitThrow, visitTry, visitTypeCast, visitVariable, visitWhileLoop
getCurrentPath, scan
reduce, scan, visitAnnotatedType, visitArrayType, visitBinary, visitCase, visitCatch, visitCompilationUnit, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitInstanceOf, visitIntersectionType, visitLabeledStatement, visitLambdaExpression, visitLiteral, visitMemberReference, visitModifiers, visitNewArray, visitNewClass, visitOther, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitSwitch, visitSynchronized, visitTypeParameter, visitUnary, visitUnionType, visitWildcard
public DefaultFlow(BaseTypeChecker checker, CompilationUnitTree root, Set<AnnotationMirror> annotations, AnnotatedTypeFactory factory)
protected ST createFlowState(Set<AnnotationMirror> annotations)
AbstractFlow
createFlowState
in class AbstractFlow<ST extends DefaultFlowState>
annotations
- The annotations that can be inferred.protected void newVar(VariableTree tree)
AbstractFlow
newVar
in class AbstractFlow<ST extends DefaultFlowState>
tree
- the variable to registerprotected void propagate(Tree lhs, ExpressionTree rhs)
AbstractFlow
If only type information (and not a Tree
) is available, use
AbstractFlow.propagateFromType(Tree, AnnotatedTypeMirror)
instead.
propagate
in class AbstractFlow<ST extends DefaultFlowState>
lhs
- the left-hand side of the assignmentrhs
- the right-hand side of the assignmentprotected void propagateFromType(Tree lhs, AnnotatedTypeMirror rhs)
AbstractFlow
#propagate(Tree, Tree)
is preferred, since it is able to use
extra information about the right-hand side (such as its element). This
method should only be used when a type (and nothing else) is available,
such as when checking the variable in an enhanced for loop against the
iterated type (which is the type argument of an Iterable
).
propagateFromType
in class AbstractFlow<ST extends DefaultFlowState>
lhs
- the left-hand side of the assignmentrhs
- the type of the right-hand side of the assignmentprotected void recordBitsImps(Tree tree, Element elt)
recordBitsImps
in class AbstractFlow<ST extends DefaultFlowState>
protected void clearOnCall(@Nullable MethodTree enclMeth, ExecutableElement method)
AbstractFlow
clearOnCall
in class AbstractFlow<ST extends DefaultFlowState>
enclMeth
- The method within which "method" is called.
Might be null if the invocation is in a field initializer.method
- The invoked method.