public static Set<Flow> flow(ExplodedGraph.Node currentNode, Set<SymbolicValue> symbolicValues, Predicate<Constraint> addToFlow, Predicate<Constraint> terminateTraversal, List<Class<? extends Constraint>> domains, Set<Symbol> symbols) { return flow(currentNode, symbolicValues, addToFlow, terminateTraversal, domains, symbols, false); }
public static Set<Flow> flow(ExplodedGraph.Node currentNode, Set<SymbolicValue> symbolicValues, Predicate<Constraint> addToFlow, Predicate<Constraint> terminateTraversal, List<Class<? extends Constraint>> domains, Set<Symbol> symbols) { return flow(currentNode, symbolicValues, addToFlow, terminateTraversal, domains, symbols, false); }
public Set<Flow> flows() { return FlowComputation.flow(node, newValue, Collections.emptyList(), fromSymbol); } }
public Set<Flow> flows() { return FlowComputation.flow(node, newValue, Collections.emptyList(), fromSymbol); } }
private static Set<Flow> flow(SymbolicValue invocationTarget, ExplodedGraph.Node node) { Set<Flow> flows = FlowComputation.flow(node, Collections.singleton(invocationTarget), StreamPipelineConstraint.CONSUMED::equals, c -> false, Collections.singletonList(StreamPipelineConstraint.class), Collections.emptySet()); // make copy with explicit message return flows.stream() .map(StreamConsumedCheck::copyFlowWithExplicitMessage) .collect(Collectors.toSet()); }
private static Set<Flow> flow(SymbolicValue invocationTarget, ExplodedGraph.Node node) { Set<Flow> flows = FlowComputation.flow(node, Collections.singleton(invocationTarget), StreamPipelineConstraint.CONSUMED::equals, c -> false, Collections.singletonList(StreamPipelineConstraint.class), Collections.emptySet()); // make copy with explicit message return flows.stream() .map(StreamConsumedCheck::copyFlowWithExplicitMessage) .collect(Collectors.toSet()); }
public static Set<Flow> flowWithoutExceptions(ExplodedGraph.Node currentNode, @Nullable SymbolicValue currentVal, Predicate<Constraint> addToFlow, Predicate<Constraint> terminateTraversal, List<Class<? extends Constraint>> domains) { return flow(currentNode, setFromNullable(currentVal), addToFlow, terminateTraversal, domains, Collections.emptySet(), true); }
public static Set<Flow> flowWithoutExceptions(ExplodedGraph.Node currentNode, @Nullable SymbolicValue currentVal, Predicate<Constraint> addToFlow, List<Class<? extends Constraint>> domains) { return flow(currentNode, setFromNullable(currentVal), addToFlow, c -> false, domains, Collections.emptySet(), true); }
public static Set<Flow> flowWithoutExceptions(ExplodedGraph.Node currentNode, @Nullable SymbolicValue currentVal, Predicate<Constraint> addToFlow, Predicate<Constraint> terminateTraversal, List<Class<? extends Constraint>> domains) { return flow(currentNode, setFromNullable(currentVal), addToFlow, terminateTraversal, domains, Collections.emptySet(), true); }
public static Set<Flow> flow(ExplodedGraph.Node currentNode, @Nullable SymbolicValue currentVal, List<Class<? extends Constraint>> domains) { return flow(currentNode, setFromNullable(currentVal), constraint -> true, c -> false, domains, Collections.emptySet(), false); }
public static Set<Flow> flow(ExplodedGraph.Node currentNode, @Nullable SymbolicValue currentVal, List<Class<? extends Constraint>> domains) { return flow(currentNode, setFromNullable(currentVal), constraint -> true, c -> false, domains, Collections.emptySet(), false); }
public static Set<Flow> flowWithoutExceptions(ExplodedGraph.Node currentNode, @Nullable SymbolicValue currentVal, Predicate<Constraint> addToFlow, List<Class<? extends Constraint>> domains) { return flow(currentNode, setFromNullable(currentVal), addToFlow, c -> false, domains, Collections.emptySet(), true); }
public Set<Flow> exceptionFlows() { List<Class<? extends Constraint>> domains = node.programState.getConstraints(svCausingException).domains().collect(Collectors.toList()); return FlowComputation.flow(node, svCausingException, domains); }
public static Set<Flow> flow(ExplodedGraph.Node currentNode, @Nullable SymbolicValue currentVal, List<Class<? extends Constraint>> domains, @Nullable Symbol trackSymbol) { return flow(currentNode, setFromNullable(currentVal), c -> true, c -> false, domains, setFromNullable(trackSymbol), false); }
public Set<Flow> exceptionFlows() { List<Class<? extends Constraint>> domains = node.programState.getConstraints(svCausingException).domains().collect(Collectors.toList()); return FlowComputation.flow(node, svCausingException, domains); }
private static Set<Flow> flowFromNode(ExplodedGraph.Node node) { List<Class<? extends Constraint>> domains = Lists.newArrayList(ObjectConstraint.class, BooleanConstraint.class); return FlowComputation.flow(node.parent(), node.programState.peekValue(), domains, node.programState.peekValueSymbol().symbol); }
private static Set<Flow> flowFromNode(ExplodedGraph.Node node) { List<Class<? extends Constraint>> domains = Lists.newArrayList(ObjectConstraint.class, BooleanConstraint.class); return FlowComputation.flow(node.parent(), node.programState.peekValue(), domains, node.programState.peekValueSymbol().symbol); }
private Set<Flow> flows() { // build nullness flows for value constraint Set<Flow> flows = FlowComputation.flow(node, value, Collections.singletonList(ObjectConstraint.class)); // enrich each flow with both map method invocations return flows.stream().map(flow -> Flow.builder() .add(new JavaFileScannerContext.Location("'Map.put()' is invoked with same key.", putInvocation.methodSelect())) .addAll(flow) .add(new JavaFileScannerContext.Location("'Map.get()' is invoked.", getInvocation.methodSelect())) .build()).collect(Collectors.toSet()); } }
private Set<Flow> flows() { // build nullness flows for value constraint Set<Flow> flows = FlowComputation.flow(node, value, Collections.singletonList(ObjectConstraint.class)); // enrich each flow with both map method invocations return flows.stream().map(flow -> Flow.builder() .add(new JavaFileScannerContext.Location("'Map.put()' is invoked with same key.", putInvocation.methodSelect())) .addAll(flow) .add(new JavaFileScannerContext.Location("'Map.get()' is invoked.", getInvocation.methodSelect())) .build()).collect(Collectors.toSet()); } }
private void reportIssue(Tree tree, SymbolicValue denominator, Symbol denominatorSymbol) { ExpressionTree expression = getDenominator(tree); String operation = tree.is(Tree.Kind.REMAINDER, Tree.Kind.REMAINDER_ASSIGNMENT) ? "modulation" : "division"; String expressionName = expression.is(Tree.Kind.IDENTIFIER) ? ("\"" + ((IdentifierTree) expression).name() + "\"") : "this expression"; List<Class<? extends Constraint>> domains = Collections.singletonList(ZeroConstraint.class); Set<Flow> flows = FlowComputation.flow(context.getNode(), denominator, domains, denominatorSymbol).stream() .filter(f -> !f.isEmpty()) .map(f -> Flow.builder() .add(new JavaFileScannerContext.Location("Division by zero.", tree)) .addAll(f) .build()) .collect(Collectors.toSet()); context.reportIssue(expression, DivisionByZeroCheck.this, "Make sure " + expressionName + " can't be zero before doing this " + operation + ".", flows); }