Search in sources :

Example 11 with MethodCall

use of org.checkerframework.dataflow.expression.MethodCall in project checker-framework by typetools.

the class LockStore method insertValue.

@Override
public void insertValue(JavaExpression je, @Nullable CFValue value, boolean permitNondeterministic) {
    if (!shouldInsert(je, value, permitNondeterministic)) {
        return;
    }
    // side effect the lock expression that has value @LockHeld.
    if (hasLockHeld(value)) {
        if (je instanceof FieldAccess) {
            FieldAccess fieldAcc = (FieldAccess) je;
            CFValue oldValue = fieldValues.get(fieldAcc);
            CFValue newValue = value.mostSpecific(oldValue, null);
            if (newValue != null) {
                fieldValues.put(fieldAcc, newValue);
            }
        } else if (je instanceof MethodCall) {
            MethodCall method = (MethodCall) je;
            CFValue oldValue = methodValues.get(method);
            CFValue newValue = value.mostSpecific(oldValue, null);
            if (newValue != null) {
                methodValues.put(method, newValue);
            }
        }
    }
    super.insertValue(je, value, permitNondeterministic);
}
Also used : CFValue(org.checkerframework.framework.flow.CFValue) FieldAccess(org.checkerframework.dataflow.expression.FieldAccess) MethodCall(org.checkerframework.dataflow.expression.MethodCall)

Aggregations

MethodCall (org.checkerframework.dataflow.expression.MethodCall)11 FieldAccess (org.checkerframework.dataflow.expression.FieldAccess)9 ArrayAccess (org.checkerframework.dataflow.expression.ArrayAccess)6 ClassName (org.checkerframework.dataflow.expression.ClassName)6 LocalVariable (org.checkerframework.dataflow.expression.LocalVariable)6 JavaExpression (org.checkerframework.dataflow.expression.JavaExpression)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 ThisReference (org.checkerframework.dataflow.expression.ThisReference)3 CFValue (org.checkerframework.framework.flow.CFValue)3 Tree (com.sun.source.tree.Tree)1 ArrayCreationNode (org.checkerframework.dataflow.cfg.node.ArrayCreationNode)1 AssignmentNode (org.checkerframework.dataflow.cfg.node.AssignmentNode)1 CaseNode (org.checkerframework.dataflow.cfg.node.CaseNode)1 FieldAccessNode (org.checkerframework.dataflow.cfg.node.FieldAccessNode)1 IntegerLiteralNode (org.checkerframework.dataflow.cfg.node.IntegerLiteralNode)1 MethodInvocationNode (org.checkerframework.dataflow.cfg.node.MethodInvocationNode)1 Node (org.checkerframework.dataflow.cfg.node.Node)1 NumericalAdditionNode (org.checkerframework.dataflow.cfg.node.NumericalAdditionNode)1 NumericalMultiplicationNode (org.checkerframework.dataflow.cfg.node.NumericalMultiplicationNode)1