Skip to content

Commit

Permalink
better comments
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar committed Mar 27, 2024
1 parent 39aeb23 commit a794043
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,23 @@ public MethodInvocationNode onCFGBuildPhase1AfterVisitMethodInvocation(
}
}
if (supported) {
// In practice the failure may not be RuntimeException, however the
// throw is inserted after the method invocation where we must assume that
// any invocation is capable of throwing an unchecked throwable.
if (runtimeExceptionType == null) {
runtimeExceptionType = phase.classToErrorType(RuntimeException.class);
}
// In practice the failure may not be RuntimeException, however the conditional
// throw is inserted after the method invocation where we must assume that
// any invocation is capable of throwing an unchecked throwable.
Preconditions.checkNotNull(runtimeExceptionType);
// If arg != null, we found a single boolean antecedent that determines whether the call
// fails, as reflected by booleanConstraint. Otherwise, all antecedents are '_' (or there
// are no antecedents), meaning the method fails unconditionally
if (arg != null) {
if (booleanConstraint) {
phase.insertThrowOnTrue(arg, runtimeExceptionType);
} else {
phase.insertThrowOnFalse(arg, runtimeExceptionType);
}
} else {
// the method unconditionally fails
phase.insertUnconditionalThrow(runtimeExceptionType);
}
}
Expand Down

0 comments on commit a794043

Please sign in to comment.