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

Commits on Jul 12, 2024

  1. Remove redundant complete() call and CompletionFailure check.

    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
    cpovirk authored and Error Prone Team committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    008cfb0 View commit details
    Browse the repository at this point in the history