use of org.sonar.java.se.constraint.BooleanConstraint in project sonar-java by SonarSource.
the class RelationalSymbolicValue method addNullConstraintsForBooleanWrapper.
private List<ProgramState> addNullConstraintsForBooleanWrapper(ProgramState initialProgramState, List<ProgramState> copiedConstraints) {
BooleanConstraint leftConstraint = initialProgramState.getConstraint(leftOp, BooleanConstraint.class);
BooleanConstraint rightConstraint = initialProgramState.getConstraint(rightOp, BooleanConstraint.class);
if (leftConstraint != null && rightConstraint == null && !isEquality()) {
List<ProgramState> nullConstraints = copiedConstraints.stream().flatMap(ps -> rightOp.setConstraint(ps, ObjectConstraint.NULL).stream()).map(ps -> ps.removeConstraintsOnDomain(rightOp, BooleanConstraint.class)).collect(Collectors.toList());
return ImmutableList.<ProgramState>builder().addAll(copiedConstraints).addAll(nullConstraints).build();
}
return copiedConstraints;
}
Aggregations