public class UpperBoundTransfer extends IndexAbstractTransfer
int[] array = new
int[expr];
, the type of expr is @LTEqLength("array")
.
other * node
has type typeOfMultiplication
, then if other
is
positive, then node
is typeOfMultiplication
.
other * node
has type typeOfMultiplication
, if other
is
greater than 1, then node
is typeOfMultiplication
plus 1.
node
, that is known to have type typeOfSubtraction
. An offset can be applied to the left node (i.e. the left node has the
same type, but with an offset based on the right node).
@LTLengthOf(value="x", offset="-b")
. If b is known to be less than the
length of some other array, y, then the type of a + b is @LTLengthOf(value={"x",
"y"}, offset={"-b", "-a"})
.
@LTLengthOf(value="x", offset="o"))
, then the type of a + b is
@LTLengthOf(value="x",offset="o - b")
. (Note, if "o - b" can be computed, then it
is and the result is used in the annotation.)
@LTLengthOf(value = "f2", offset = "f1.length")
int
and expression j is less than or equal to the length of f1, then the type of i + j is
@LTLengthOf("f2")
.
@LTLengthOf(value="x", offset="b")
.
@LTLength(value={"array"...}, offset="-1")
where "array"... is the set of all
sequences that are the same length (via the SameLen checker) as "array"
@LTEqLengthOf("a")
and the value of a.length in the store.
@LTEqLengthOf("s")
and the value of s.length() in the store.
Constructor and Description |
---|
UpperBoundTransfer(org.checkerframework.framework.flow.CFAnalysis analysis) |
Modifier and Type | Method and Description |
---|---|
protected void |
refineGT(org.checkerframework.dataflow.cfg.node.Node larger,
AnnotationMirror largerAnno,
org.checkerframework.dataflow.cfg.node.Node smaller,
AnnotationMirror smallerAnno,
org.checkerframework.framework.flow.CFStore store,
org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
Case 8: if x < y, and y has a type that is related to the length of an array, then x has
the same type, with an offset that is one less.
|
protected void |
refineGTE(org.checkerframework.dataflow.cfg.node.Node left,
AnnotationMirror leftAnno,
org.checkerframework.dataflow.cfg.node.Node right,
AnnotationMirror rightAnno,
org.checkerframework.framework.flow.CFStore store,
org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
Case 9: if x ≤ y, and y has a type that is related to the length of an array, then x has
the same type.
|
protected org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> |
strengthenAnnotationOfEqualTo(org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> res,
org.checkerframework.dataflow.cfg.node.Node firstNode,
org.checkerframework.dataflow.cfg.node.Node secondNode,
org.checkerframework.framework.flow.CFValue firstValue,
org.checkerframework.framework.flow.CFValue secondValue,
boolean notEqualTo)
Implements case 11.
|
org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> |
visitAssignment(org.checkerframework.dataflow.cfg.node.AssignmentNode node,
org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
Case 1: Refine the type of expressions used as an array dimension to be less than length of
the array to which the new array is assigned.
|
org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> |
visitCase(org.checkerframework.dataflow.cfg.node.CaseNode n,
org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in) |
org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> |
visitFieldAccess(org.checkerframework.dataflow.cfg.node.FieldAccessNode n,
org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
If n is an array length field access, then the type of a.length is the glb
of @LTEqLengthOf("a") and the value of a.length in the store.
|
org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> |
visitMethodInvocation(org.checkerframework.dataflow.cfg.node.MethodInvocationNode n,
org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
If n is a String.length() method invocation, then the type of s.length() is the glb
of @LTEqLengthOf("s") and the value of s.length() in the store.
|
org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> |
visitNumericalAddition(org.checkerframework.dataflow.cfg.node.NumericalAdditionNode n,
org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
If some Node a is known to be less than the length of some array, x, then, the type of a + b,
is @LTLengthOf(value="x", offset="-b").
|
org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> |
visitNumericalSubtraction(org.checkerframework.dataflow.cfg.node.NumericalSubtractionNode n,
org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
If some Node a is known to be less than the length of some sequence x, then the type of a - b
is @LTLengthOf(value="x", offset="b").
|
visitGreaterThan, visitGreaterThanOrEqual, visitLessThan, visitLessThanOrEqual
addInformationFromPreconditions, finishValue, finishValue, getValueFromFactory, getValueWithSameAnnotations, initialStore, isNotFullyInitializedReceiver, moreSpecificValue, processCommonAssignment, processConditionalPostconditions, processPostconditions, setFixedInitialStore, splitAssignments, usesSequentialSemantics, visitArrayAccess, visitClassName, visitConditionalNot, visitEqualTo, visitLambdaResultExpression, visitLocalVariable, visitNarrowingConversion, visitNode, visitNotEqual, visitObjectCreation, visitReturn, visitStringConcatenateAssignment, visitStringConversion, visitTernaryExpression, visitThisLiteral, visitVariableDeclaration, visitWideningConversion
visitArrayCreation, visitArrayType, visitAssertionError, visitBitwiseAnd, visitBitwiseComplement, visitBitwiseOr, visitBitwiseXor, visitBooleanLiteral, visitCharacterLiteral, visitClassDeclaration, visitConditionalAnd, visitConditionalOr, visitDoubleLiteral, visitExplicitThisLiteral, visitFloatingDivision, visitFloatingRemainder, visitFloatLiteral, visitImplicitThisLiteral, visitInstanceOf, visitIntegerDivision, visitIntegerLiteral, visitIntegerRemainder, visitLeftShift, visitLongLiteral, visitMarker, visitMemberReference, visitMethodAccess, visitNullChk, visitNullLiteral, visitNumericalMinus, visitNumericalMultiplication, visitNumericalPlus, 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, visitExplicitThisLiteral, visitFloatingDivision, visitFloatingRemainder, visitFloatLiteral, visitImplicitThisLiteral, visitInstanceOf, visitIntegerDivision, visitIntegerLiteral, visitIntegerRemainder, visitLeftShift, visitLongLiteral, visitMarker, visitMemberReference, visitMethodAccess, visitNullChk, visitNullLiteral, visitNumericalMinus, visitNumericalMultiplication, visitNumericalPlus, visitPackageName, visitParameterizedType, visitPrimitiveType, visitShortLiteral, visitSignedRightShift, visitStringConcatenate, visitStringLiteral, visitSuper, visitSynchronized, visitThrow, visitTypeCast, visitUnsignedRightShift
public UpperBoundTransfer(org.checkerframework.framework.flow.CFAnalysis analysis)
public org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> visitAssignment(org.checkerframework.dataflow.cfg.node.AssignmentNode node, org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
visitAssignment
in interface org.checkerframework.dataflow.cfg.node.NodeVisitor<org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>,org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>>
visitAssignment
in class org.checkerframework.framework.flow.CFAbstractTransfer<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore,org.checkerframework.framework.flow.CFTransfer>
protected void refineGT(org.checkerframework.dataflow.cfg.node.Node larger, AnnotationMirror largerAnno, org.checkerframework.dataflow.cfg.node.Node smaller, AnnotationMirror smallerAnno, org.checkerframework.framework.flow.CFStore store, org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
refineGT
in class IndexAbstractTransfer
protected void refineGTE(org.checkerframework.dataflow.cfg.node.Node left, AnnotationMirror leftAnno, org.checkerframework.dataflow.cfg.node.Node right, AnnotationMirror rightAnno, org.checkerframework.framework.flow.CFStore store, org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
refineGTE
in class IndexAbstractTransfer
protected org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> strengthenAnnotationOfEqualTo(org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> res, org.checkerframework.dataflow.cfg.node.Node firstNode, org.checkerframework.dataflow.cfg.node.Node secondNode, org.checkerframework.framework.flow.CFValue firstValue, org.checkerframework.framework.flow.CFValue secondValue, boolean notEqualTo)
strengthenAnnotationOfEqualTo
in class org.checkerframework.framework.flow.CFAbstractTransfer<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore,org.checkerframework.framework.flow.CFTransfer>
public org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> visitNumericalAddition(org.checkerframework.dataflow.cfg.node.NumericalAdditionNode n, org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
Alternatively, if a is known to be less than the length of x when some offset, o, is added to a (the type of a is @LTLengthOf(value="x", offset="o")), then the type of a + b is @LTLengthOf(value="x",offset="o - b"). (Note, if "o - b" can be computed, then it is and the result is used in the annotation.)
In addition, If expression i has type @LTLengthOf(value = "f2", offset = "f1.length") int and expression j is less than or equal to the length of f1, then the type of i + j is .@LTLengthOf("f2").
These three cases correspond to cases 13-15.
visitNumericalAddition
in interface org.checkerframework.dataflow.cfg.node.NodeVisitor<org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>,org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>>
visitNumericalAddition
in class org.checkerframework.dataflow.cfg.node.AbstractNodeVisitor<org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>,org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>>
public org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> visitNumericalSubtraction(org.checkerframework.dataflow.cfg.node.NumericalSubtractionNode n, org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
visitNumericalSubtraction
in interface org.checkerframework.dataflow.cfg.node.NodeVisitor<org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>,org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>>
visitNumericalSubtraction
in class org.checkerframework.dataflow.cfg.node.AbstractNodeVisitor<org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>,org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>>
public org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> visitFieldAccess(org.checkerframework.dataflow.cfg.node.FieldAccessNode n, org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
visitFieldAccess
in interface org.checkerframework.dataflow.cfg.node.NodeVisitor<org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>,org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>>
visitFieldAccess
in class org.checkerframework.framework.flow.CFAbstractTransfer<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore,org.checkerframework.framework.flow.CFTransfer>
public org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> visitMethodInvocation(org.checkerframework.dataflow.cfg.node.MethodInvocationNode n, org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
visitMethodInvocation
in interface org.checkerframework.dataflow.cfg.node.NodeVisitor<org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>,org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>>
visitMethodInvocation
in class org.checkerframework.framework.flow.CFAbstractTransfer<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore,org.checkerframework.framework.flow.CFTransfer>
public org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> visitCase(org.checkerframework.dataflow.cfg.node.CaseNode n, org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore> in)
visitCase
in interface org.checkerframework.dataflow.cfg.node.NodeVisitor<org.checkerframework.dataflow.analysis.TransferResult<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>,org.checkerframework.dataflow.analysis.TransferInput<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore>>
visitCase
in class org.checkerframework.framework.flow.CFAbstractTransfer<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore,org.checkerframework.framework.flow.CFTransfer>