예제 #1
0
  public Pair<List<ProgramState>, List<ProgramState>> assumeDual(ProgramState programState) {

    ProgramState.Pop unstack = programState.unstackValue(1);
    SymbolicValue sv = unstack.values.get(0);
    List<ProgramState> falseConstraint = sv.setConstraint(unstack.state, BooleanConstraint.FALSE);
    List<ProgramState> trueConstraint = sv.setConstraint(unstack.state, BooleanConstraint.TRUE);
    return new Pair<>(falseConstraint, trueConstraint);
  }
 private static ObjectConstraint openedConstraint(
     ProgramState programState, SymbolicValue value) {
   final Object constraint = programState.getConstraint(value.wrappedValue());
   if (constraint instanceof ObjectConstraint) {
     ObjectConstraint oConstraint = (ObjectConstraint) constraint;
     if (oConstraint.hasStatus(Status.OPENED)) {
       return oConstraint;
     }
   }
   return null;
 }
 private static ProgramState closeResource(
     ProgramState programState, @Nullable final SymbolicValue target) {
   if (target != null) {
     ObjectConstraint oConstraint = openedConstraint(programState, target);
     if (oConstraint != null) {
       return programState.addConstraint(
           target.wrappedValue(), oConstraint.withStatus(Status.CLOSED));
     }
   }
   return programState;
 }
예제 #4
0
 public boolean isNull(ProgramState ps, SymbolicValue val) {
   Object constraint = ps.getConstraint(val);
   return constraint instanceof ObjectConstraint && ((ObjectConstraint) constraint).isNull();
 }