Using class information from the whole codebase, not just "close context"
- Dominant language
- Java
- Stars
- 7.2k
- Forks
- 820
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 50
Description
Hi,
I want to write a check that needs to know a lot of information about the codebase and knowing just the context of the current class/file is not enough... I need first to scan the whole codebase, collect some metadata and then use that metadata in the error-prone check... That's because (if I understand it correctly) the check always has only the context of at most the current file and maybe of what it directly references...
To be more specific, I want to write a check for hibernate validator, which will tell me that I'm missing `@Valid` on the inner structure. But to do that, I first must know if the class I'm referencing is inner structure/value object/other and based on that require the annotation. There are some very complex edge cases which force me to be able to inspect other classes and knowing just direct neighbours/parents/etc. is not enough, I need to be able to inspect this several layers (classes) deep.
The only solution I've come up with so far is to force error-prone to run twice over the whole module - the first pass would only collect metadata and the second pass would then use that to decide if the check is violated. But that's not nice at all...
I would prefer the ability to be natively available in error-prone, so I don't have to hack around it. Right now, I'm thinking that maybe it's better to abandon this idea and use, e.g. SpotBugs to write the check.
Any ideas? Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.