Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant complete() call and CompletionFailure check. #4464

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

copybara-service[bot]
Copy link
Contributor

Remove redundant complete() call and CompletionFailure check.

Those operations are already performed during our call to getSymbolFromString, which returns null in case of failure.

(I've found the comment that I'm removing a little confusing, too: I think it might be making the point that we don't want to let the CompletionFailure propagate because that would fail Error Prone entirely when in fact the check that called annotationsAmong might find one of the other annotations it was looking for among the annotations inherited by the class? (We would already have handled any directly present annotations in annotationsAmong as well as in hasAnnotation.) If so, we're fine, as we handle null gracefully. (Of course, this assumes that silently ignoring an annotation that should have been inherited isn't a bad problem that should really lead to a crash. But there's only so much we can do in the presence of an incomplete classpath.) Or is it actually making the point that we want to try to look for @Inherited even if completing some other part of the annotation has failed (if that is even possible) and hence we fall through instead of immediately returning false? If so, that doesn't currently work because we would already have bailed after the null return from getSymbolFromString. Anyway, whatever the comment is getting at, this CL is a no-op, so I'm just trying to avoid putting on blinders as I remove the surrounding code.)

Those operations are already [performed during our call to `getSymbolFromString`](https://github.com/google/error-prone/blob/03d15b56478a40534b2b104e21d070d0eebc0701/check_api/src/main/java/com/google/errorprone/VisitorState.java#L432), which returns `null` in case of failure.

(I've found the comment that I'm removing a little confusing, too: I think it might be making the point that we don't want to let the `CompletionFailure` propagate because that would fail Error Prone entirely when in fact the check that called `annotationsAmong` might find one of the _other_ annotations it was looking for among the annotations inherited by the class? (We would already have handled any _directly_ present annotations in `annotationsAmong` as well as in `hasAnnotation`.) If so, we're fine, as we handle `null` gracefully. (Of course, this assumes that silently ignoring an annotation that should have been inherited isn't a bad problem that should really lead to a crash. But there's only so much we can do in the presence of an incomplete classpath.) Or is it actually making the point that we want to try to look for `@Inherited` even if completing some _other_ part of the annotation has failed (if that is even possible) and hence we fall through instead of immediately returning `false`? If so, that doesn't currently work because we would already have bailed after the `null` return from `getSymbolFromString`. Anyway, whatever the comment is getting at, this CL is a no-op, so I'm just trying to avoid putting on blinders as I remove the surrounding code.)

PiperOrigin-RevId: 651828339
@copybara-service copybara-service bot merged commit 008cfb0 into master Jul 12, 2024
@copybara-service copybara-service bot deleted the test_651820377 branch July 12, 2024 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant