Suppress/grandfather existing warnings
Adding errorprone to a new codebase is currently quite tedious as it complains about all the existing issues. In an ideal world, this means that we should go back and fix all of them, but this is usually infeasible :)
It would be nice if we could use Refaster to just automatically add suppression decorations to existing issues.
One variation on this (which is similar to a workflow we use at Google) is to emit the diagnostics, and then have a separate tool that can add @SuppressWarnings for a collection of diagnostics. #3766 could be helpful for that, although only the the path and line number is needed for a particular diagnostic, which is fairly straightforward to scrape from the text of the build log.
Hmm, I agree that line numbers would be fairly easy to scrape out. But is the start of the offending line always the best place for a suppression annotation? (Genuinely asking, I would think no but I’m unsure)
The annotation is only valid on declarations of variables, methods, and classes. The separate tool we use parses the file and then looks at the syntax tree to find the closes valid location for a particular line.
Ooh, would love to see that in the open if Google is amenable to it!
Alternatively… errorprone could read CSV of filenames/linenumbers/error types to ignore. That would be more brittle, but I think in this case that would actually be a good thing— anyone who touches the file would be forced to at least consider improving it.