@CheckForNull private Symbol symbolFromStack(SymbolicValue symbolicValue, @Nullable ProgramState programState) { if (programState != null && programState.peekValue() == symbolicValue) { return programState.peekValueSymbol().symbol; } return null; }
@CheckForNull private Symbol symbolFromStack(SymbolicValue symbolicValue, @Nullable ProgramState programState) { if (programState != null && programState.peekValue() == symbolicValue) { return programState.peekValueSymbol().symbol; } return null; }
private Set<Symbol> getReturnSymbolAsTrackedSymbols(List<Integer> parameterIndices) { if (parameterIndices.contains(-1) && node.programState.peekValue() == node.programState.exitValue()) { Symbol symbol = node.programState.peekValueSymbol().symbol(); if (symbol != null) { return Collections.singleton(symbol); } } return Collections.emptySet(); }
private Set<Symbol> getReturnSymbolAsTrackedSymbols(List<Integer> parameterIndices) { if (parameterIndices.contains(-1) && node.programState.peekValue() == node.programState.exitValue()) { Symbol symbol = node.programState.peekValueSymbol().symbol(); if (symbol != null) { return Collections.singleton(symbol); } } return Collections.emptySet(); }
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 void handleAssignment(CheckerContext context, AssignmentExpressionTree assignmentExpressionTree) { SymbolicValueSymbol assignedVariable = context.getState().peekValueSymbol(); Symbol assignedSymbol = assignedVariable.symbol(); if (assignedSymbol == null // Rule S3959 returns the same SV after each intermediate operations, // meaning that 'stream = stream.map(...);' would be detected as redundant assignment if not explicitly excluded || STREAM_TYPES.stream().anyMatch(assignedSymbol.type()::is)) { return; } ExplodedGraph.Node node = context.getNode(); ProgramState previousState = node.programState; SymbolicValue oldValue = previousState.getValue(assignedSymbol); SymbolicValue newValue = assignedVariable.symbolicValue(); Symbol fromSymbol = previousState.peekValueSymbol().symbol(); assignmentsByMethod.peek().put(assignmentExpressionTree, new AssignmentDataHolder(assignedSymbol, oldValue, newValue, fromSymbol, node)); }
private void handleAssignment(CheckerContext context, AssignmentExpressionTree assignmentExpressionTree) { SymbolicValueSymbol assignedVariable = context.getState().peekValueSymbol(); Symbol assignedSymbol = assignedVariable.symbol(); if (assignedSymbol == null // Rule S3959 returns the same SV after each intermediate operations, // meaning that 'stream = stream.map(...);' would be detected as redundant assignment if not explicitly excluded || STREAM_TYPES.stream().anyMatch(assignedSymbol.type()::is)) { return; } ExplodedGraph.Node node = context.getNode(); ProgramState previousState = node.programState; SymbolicValue oldValue = previousState.getValue(assignedSymbol); SymbolicValue newValue = assignedVariable.symbolicValue(); Symbol fromSymbol = previousState.peekValueSymbol().symbol(); assignmentsByMethod.peek().put(assignmentExpressionTree, new AssignmentDataHolder(assignedSymbol, oldValue, newValue, fromSymbol, node)); }
@CheckForNull private Symbol getSymbol(ProgramState programState, SymbolicValue sv) { SymbolicValue peekValue = programState.peekValue(); if (sv.equals(peekValue)) { return programState.peekValueSymbol().symbol; } if (peekValue instanceof BinarySymbolicValue) { BinarySymbolicValue bsv = (BinarySymbolicValue) peekValue; if (sv.equals(bsv.getRightOp())) { return bsv.rightSymbol(); } return bsv.leftSymbol(); } return null; }
@CheckForNull private Symbol getSymbol(ProgramState programState, SymbolicValue sv) { SymbolicValue peekValue = programState.peekValue(); if (sv.equals(peekValue)) { return programState.peekValueSymbol().symbol; } if (peekValue instanceof BinarySymbolicValue) { BinarySymbolicValue bsv = (BinarySymbolicValue) peekValue; if (sv.equals(bsv.getRightOp())) { return bsv.rightSymbol(); } return bsv.leftSymbol(); } return null; }