use of org.checkerframework.dataflow.analysis.FlowExpressions.Unknown in project checker-framework by typetools.
the class LockVisitor method getLockExpressions.
private List<LockExpression> getLockExpressions(boolean implicitThis, AnnotationMirror gbAnno, Tree tree) {
List<String> expressions = AnnotationUtils.getElementValueArray(gbAnno, "value", String.class, true);
if (expressions.isEmpty()) {
return Collections.emptyList();
}
TreePath currentPath = getCurrentPath();
List<Receiver> params = FlowExpressions.getParametersOfEnclosingMethod(atypeFactory, currentPath);
TypeMirror enclosingType = TreeUtils.typeOf(TreeUtils.enclosingClass(currentPath));
Receiver pseudoReceiver = FlowExpressions.internalReprOfPseudoReceiver(currentPath, enclosingType);
FlowExpressionContext exprContext = new FlowExpressionContext(pseudoReceiver, params, atypeFactory.getContext());
Receiver self;
if (implicitThis) {
self = pseudoReceiver;
} else if (TreeUtils.isExpressionTree(tree)) {
self = FlowExpressions.internalReprOf(atypeFactory, (ExpressionTree) tree);
} else {
self = new Unknown(TreeUtils.typeOf(tree));
}
List<LockExpression> lockExpressions = new ArrayList<>();
for (String expression : expressions) {
lockExpressions.add(parseExpressionString(expression, exprContext, currentPath, self));
}
return lockExpressions;
}
use of org.checkerframework.dataflow.analysis.FlowExpressions.Unknown in project checker-framework by typetools.
the class OffsetEquation method createOffsetFromNode.
private static void createOffsetFromNode(Node node, AnnotationProvider factory, OffsetEquation eq, char op) {
Receiver r = FlowExpressions.internalReprOf(factory, node);
if (r instanceof Unknown || r == null) {
if (node instanceof NumericalAdditionNode) {
createOffsetFromNode(((NumericalAdditionNode) node).getLeftOperand(), factory, eq, op);
createOffsetFromNode(((NumericalAdditionNode) node).getRightOperand(), factory, eq, op);
} else if (node instanceof NumericalSubtractionNode) {
createOffsetFromNode(((NumericalSubtractionNode) node).getLeftOperand(), factory, eq, op);
char other = op == '+' ? '-' : '+';
createOffsetFromNode(((NumericalSubtractionNode) node).getRightOperand(), factory, eq, other);
} else {
eq.error = node.toString();
}
} else {
eq.addTerm(op, r.toString());
}
}
Aggregations