(ignored the issue template since this is a question/discussion and not a bug report)
Is there a suggested way to know when the "end" of a compilation is? Say I have some metadata I want to collect during a checker's use and want to write the collected data at the end of the compilation. The compilation would usually be a given project with N number of files.
While I could specify the number of files in an env var somewhere and had a counter in the checker, I still would potentially miss the last file due to undefined execution order of the various checks (not sure which statement is "last" in the visiting)
There is not an existing way to do this from the checker API. If you wanted to hack something together, you could store the metadata in some global variable, then emit the result in ErrorProneAnalyzer#finished.
Not totally sure how to hook into the analyzer, but what we ended up doing was writing a simple compiler plugin that stores a mutable datastructure to hold information in the javac context and retrieve it during analysis, then write data during the onFinished of that compilation. Since the analyzer does have a notion of finished, it would be neat if checkers could be handed that notification as well via optional override
Most helpful comment
Not totally sure how to hook into the analyzer, but what we ended up doing was writing a simple compiler plugin that stores a mutable datastructure to hold information in the javac context and retrieve it during analysis, then write data during the onFinished of that compilation. Since the analyzer does have a notion of finished, it would be neat if checkers could be handed that notification as well via optional override