Flatten the BinderTransports using the "guard clause" pattern #12449
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Binder[Client/Server]Transportuses the following "single exit point" style/pattern of control flow all over the place:This has the advantage of a single exit point which, in C-like languages has historically been useful for unconditional cleanup like releasing locks and closing resources. However, in Java with exceptions, unconditional cleanup has to happen in a finally block and so we don't really benefit. On the other hand the single exit point pattern creates a lot of nesting:
else.In this PR, I reduce nesting and make life easier for future PRs by converting all BinderTransport methods to use the guard clause pattern instead:
https://refactoring.com/catalog/replaceNestedConditionalWithGuardClauses.html
https://testing.googleblog.com/2017/06/code-health-reduce-nesting-reduce.html