Search in sources :

Example 16 with FieldAccess

use of org.checkerframework.dataflow.analysis.FlowExpressions.FieldAccess in project checker-framework by typetools.

the class LockStore method updateForMethodCall.

@Override
public void updateForMethodCall(MethodInvocationNode n, AnnotatedTypeFactory atypeFactory, CFValue val) {
    super.updateForMethodCall(n, atypeFactory, val);
    ExecutableElement method = n.getTarget().getMethod();
    if (!isSideEffectFree(atypeFactory, method)) {
        // the GuardedBy hierarchy should not be changed.
        for (FieldAccess field : new ArrayList<>(fieldValues.keySet())) {
            fieldValues.put(field, changeLockAnnoToTop(field, fieldValues.get(field)));
        }
        // Local variables could also be unlocked via an alias
        for (LocalVariable var : new ArrayList<>(localVariableValues.keySet())) {
            CFValue newValue = changeLockAnnoToTop(var, localVariableValues.get(var));
            localVariableValues.put(var, newValue);
        }
        if (thisValue != null) {
            thisValue = changeLockAnnoToTop(null, thisValue);
        }
    }
}
Also used : CFValue(org.checkerframework.framework.flow.CFValue) ExecutableElement(javax.lang.model.element.ExecutableElement) ArrayList(java.util.ArrayList) LocalVariable(org.checkerframework.dataflow.analysis.FlowExpressions.LocalVariable) FieldAccess(org.checkerframework.dataflow.analysis.FlowExpressions.FieldAccess)

Aggregations

FieldAccess (org.checkerframework.dataflow.analysis.FlowExpressions.FieldAccess)16 Receiver (org.checkerframework.dataflow.analysis.FlowExpressions.Receiver)8 ClassName (org.checkerframework.dataflow.analysis.FlowExpressions.ClassName)6 HashMap (java.util.HashMap)5 VariableElement (javax.lang.model.element.VariableElement)5 AnnotationMirror (javax.lang.model.element.AnnotationMirror)4 Element (javax.lang.model.element.Element)4 LocalVariable (org.checkerframework.dataflow.analysis.FlowExpressions.LocalVariable)4 ThisReference (org.checkerframework.dataflow.analysis.FlowExpressions.ThisReference)4 ExecutableElement (javax.lang.model.element.ExecutableElement)3 FlowExpressions (org.checkerframework.dataflow.analysis.FlowExpressions)3 CFValue (org.checkerframework.framework.flow.CFValue)3 Tree (com.sun.source.tree.Tree)2 TypeElement (javax.lang.model.element.TypeElement)2 TypeMirror (javax.lang.model.type.TypeMirror)2 ArrayAccess (org.checkerframework.dataflow.analysis.FlowExpressions.ArrayAccess)2 MethodCall (org.checkerframework.dataflow.analysis.FlowExpressions.MethodCall)2 CFAbstractStore (org.checkerframework.framework.flow.CFAbstractStore)2 CFAbstractValue (org.checkerframework.framework.flow.CFAbstractValue)2 CFStore (org.checkerframework.framework.flow.CFStore)2